uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2bffc7ca-1f0a-4547-b7b7-2eeb817ec5e7 | shanpengli/FastJM | src/getfittedSurvSF.cpp | #include <RcppEigen.h>
#include "basics.h"
// [[Rcpp::depends(RcppEigen)]]
//
// [[Rcpp::export]]
Eigen::MatrixXd getfittedSurvSF(const Eigen::VectorXd & gamma1, const Eigen::MatrixXd & X2,
const Eigen::MatrixXd & CH01, const Eigen::VectorXd & alpha1,
c... | ALGO | 0.943058 | 5.887575 |
389dbb03-4701-4134-9778-e9a2ed00bfdf | Mokuroh54/Comp_Prog | CSES/Intro/2_Missing_Number.cpp | /*
___
(o,o)
< . >
--"-"---
Rowlet is orz
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <cstring>
#include <cassert>
using n... | ALGO | 0.999793 | 3.548086 |
acec9a2a-4907-4824-b458-377fa9646bef | afaji/Marian-transfer | marian/src/tensors/cpu/sharp/sse_gemm.cpp | #include <emmintrin.h>
#include <immintrin.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tmmintrin.h>
#include <xmmintrin.h>
#include <cassert>
namespace marian {
namespace cpu {
namespace int16 {
// This is a reference implementation of 16-bit matrix mu... | ALGO | 0.999204 | 5.927157 |
ad6834d9-1200-415e-acdd-ece64241c787 | rohitkr963/only-for-revision-of-c- | Besics/sumAllEvenDigit.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
int sum=0;
cout<<"enter your digit :)";
cin>>n;
for(int i=1; i<=n; i++)
{
int digit=n%10;
if(digit%2==0)
{
sum=sum+digit;
}
n/=10;
}
cout<<sum<<endl;
} | ALGO | 0.999808 | 3.38258 |
c8137920-64ac-4672-bb2f-e2db7011eeee | ehnryx/acm | codeforces/1540/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#include "../../../lca/number/mod_int.h"
//#define FILENAME sadcactus
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>,... | ALGO | 0.999647 | 4.628332 |
a14b1f1c-37e9-4d5c-a25c-3297498b38e8 | ishandutta2007/codeforces | rounddog/normal/832/A.cpp | #include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<iostream>
#include<algorithm>
#define maxn 10020
#define mt 120
using namespace std;
int main()
{
long long int n,k;
scanf("%I64d%I64d",&n,&k);
if ((n/k)%2) printf("YES\n"); else printf("NO\n");
return 0;
} | ALGO | 0.999966 | 3.203527 |
45c96233-e304-4472-bf1e-fe3e75bcbad8 | DreamChaser-luzeyu/NKDataTypeNew | Data-Structures-Algorithms-and-Applications-in-cpp-master/all codes in book/Data Structures, Algorithms, & Applications in C++, 2nd Edition/arrayIterator.cpp | // using an array iterator
#include <iostream>
using namespace std;
int main()
{
int x[3] = {0, 1, 2};
// use a pointer y to iterate through the array x
for (int* y = x; y != x + 3; y++)
cout << *y << " ";
cout << endl;
return 0;
}
| TOOL | 0.99743 | 3.875552 |
261e0b1c-a009-4cfe-8316-ea04c20ebf3c | yfliu017258/CPP_programs | UVA/已通過/uva490.cpp | #include<iostream>
using namespace std;
#define Max 110
string a[Max];
int index=0;
size_t L=0;
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
while(getline(cin,a[index]))
L=max(a[index++].size(),L);
for(int i=0;i<L;i++)
{
for(int j=index-1;j>=0;j--)
if(i<a[j].size())
cout<<a[j][i];
else
... | ALGO | 0.999723 | 3.579936 |
4dc60a4e-a400-411f-b4c1-2f3794defccc | Pavan4239/CSA5111 | DAY 2 PG 5.cpp | #include <stdio.h>
#include <math.h>
int factorial(int n) {
if (n == 0) return 1;
return n * factorial(n - 1);
}
int main() {
int key_size = 25;
long double possible_keys = (long double)factorial(key_size);
possible_keys /= key_size;
double log_base_2 = log2(possible_keys);
printf("Approxi... | ALGO | 0.999759 | 4.085442 |
5195528c-8f1f-44e8-8bea-cb9e2b2bc78a | yukeyi/LeetCode | 43 Multiply Strings/Multiply Strings.cpp | // My Code
class Solution {
public:
void addResult(char a, char b, int pos, vector<int>& res)
{
int addnum = (int)(a - '0') * (int)(b - '0');
int tennum = addnum / 10;
int onenum = addnum % 10;
res[pos] += onenum;
res[pos + 1] += tennum;
for (int i = pos;; i++)
... | ALGO | 0.999987 | 6.101618 |
8ce94da9-2def-4728-8304-3845cfd8e3c7 | rshohruh/competitive_programming | codeforces/round 974 (div3)/E - Rendez-vous de Marian et Robin.cpp | // author: rshohruh
// create time: Sep 21 2024, 19:42
// https://codeforces.com/contest/2014/problem/E
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define with_testcases
int n;
vector<vector<pair<int, int>>> g;
vector<int> h;
vector<int> bf... | ALGO | 0.9999 | 5.016482 |
a2b33029-8440-40cb-9853-7df8ccdd8c07 | poon-zx/kattis | solutions/bannord.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <ios>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#inclu... | ALGO | 0.999901 | 4.031197 |
2d145ed4-cdb2-4f7d-a8cc-f8be47a7830a | luzernyl/Data-Structure-and-Algorithm | StudentInfo/Student.cpp | #include "Student.h"
#include <cstdlib>
#include <iostream>
#include <vector>
Student::Student()
{
std_no = -1;
major = 'M';
GPA = 0;
};
Student::Student(int stdnum, char maj, double gpa)
{
std_no = stdnum;
major = maj;
GPA = gpa;
if (major == 'M')
major_num = 1;
if (major == 'C')
major_num = ... | TOOL | 0.901533 | 3.561014 |
2a140364-ca2c-404e-a02d-be2cb9e69f7f | hjiang13/LLMs-in-IR | POJ-104/42/964.cpp | #include <iostream>
using namespace std;
int main()
{
int n, c, a[100000 + 10] = {
0}
;
int i, j;
cin >> n;
for (i = 0 ; i < n; i ++)
cin >> a[i];
cin>>c;
for (i = 0; i < n; i ++)
{
if (a[i] == c)
{
for (j = i; j < n; j ++)
{
a[j] = a[j + 1];
}
n --;
i --;
}
}
int first = 1;
for (i = 0; i < n; i ++)
{
if (first... | ALGO | 0.999996 | 3.209555 |
6d0b0543-1e71-4b62-a475-619bd511271e | xzgz/cuda-study | src/chapter03/sumMatrix.cpp | #include <stdio.h>
// includes CUDA Runtime
#include <cuda_runtime.h>
#include "../include/common/common.h"
/*
* This example implements matrix element-wise addition on the host and GPU.
* sumMatrixOnHost iterates over the rows and columns of each matrix, adding
* elements from A and B together and storing the res... | ALGO | 0.91926 | 6.240903 |
3201e98c-5258-448a-ad7f-01eee5729780 | yqw1212/fuzztruction-llvm17.0.6 | libcxx/src/ryu/d2fixed.cpp | // Avoid formatting to keep the changes with the original code minimal.
// clang-format off
#include <__assert>
#include <__config>
#include <charconv>
#include <cstring>
#include "include/ryu/common.h"
#include "include/ryu/d2fixed.h"
#include "include/ryu/d2fixed_full_table.h"
#include "include/ryu/d2s.h"
#include ... | ALGO | 0.902588 | 4.026351 |
854e0771-e7e5-4eda-9c52-be7cc044b3e7 | geekswaroop/Competitive-Coding-Solutions | SPOJ/BusyMan/main.cpp | /*#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
return (a.second < b.second);
}
int main()
{
int t,n,i,x,y,cnt,cnt2,index,temp;
cin>>t;
while(t--)
{ cnt=1;
cin>>n;
vector< pair <int,in... | ALGO | 0.999939 | 4.852142 |
080a75a4-c4db-4a11-a004-e61c0f51d492 | Prudhviv3s/c.programming- | Assignment- 5 (09.04.2023)/Answer 5.cpp | #include <stdio.h>
#include <math.h>
int main() {
int binary, decimal = 0, octal = 0, digit, i = 0;
printf("Enter a binary number: ");
scanf("%d", &binary);
while (binary != 0) {
digit = binary % 10;
decimal += digit * pow(2, i);
binary /= 10;
i++;
}
printf("D... | ALGO | 0.950722 | 5.497563 |
35b0c92e-7d1d-4502-8342-55ed63085bd6 | gkichaev/PAINTOR_V3.0 | eigen/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.985531 | 3.51303 |
a75ab617-414f-4644-a81f-2de325e394b0 | ashishc534/Trees-Data-Structure | Find the maximum sum leaf to root path in a Binary Tree.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
node *left;
node *right;
}**root,*temp;
node *newNode(int data)
{
temp = new node;
temp->data=data;
temp->left=temp->right=NULL;
return temp;
}
bool printPath(node *root,node *target)
{
if(!root)
return false;
if(root==target ||printPa... | ALGO | 0.999974 | 4.680758 |
1e1bb9e9-29f2-4b29-8daf-3ad5f52f5030 | EDB02/thesis | src/main.cpp | #include "algorithm.hpp"
#include "matrix.hpp"
using namespace std;
int main(int argc, char *argv[])
{
if(argc != 3 && argc != 4)
{
cout << "Usage: ./reorder matrix_name block_size [output]" << endl;
return 1;
}
Matrix m;
m.read_from_file(argv[1]);
int block_size = stoi(argv[... | ALGO | 0.982025 | 4.346724 |
87a435bf-d8da-44df-9659-ac85184fba52 | amansaini0003/Leetcode-Problem-Solving | 1461-check-if-a-string-contains-all-binary-codes-of-size-k/1461-check-if-a-string-contains-all-binary-codes-of-size-k.cpp | class Solution {
public:
bool hasAllCodes(string s, int k) {
unordered_set<string> seen;
deque<char> dq;
for(auto c: s) {
dq.push_back(c);
if(dq.size() == k) {
seen.insert({dq.begin(), dq.end()});
dq.pop_front();
}
... | ALGO | 0.999919 | 6.049129 |
8f242eb3-80bf-4862-9a4c-9b340ca231f9 | RobertYL/USACO | 1-chap2/2.3/money/money.cpp | /*
ID: rob3rty1
PROB: money
LANG: C++11
*/
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
ifstream in ("money.in");
ofstream out ("money.out");
int num, target;
long long combinations[10001] = {0... | ALGO | 0.999921 | 4.491697 |
89bf5d76-e216-429e-ae92-a52d57a9b58b | AlanMelendez/flutter_counter-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
fe09b39a-58a9-4739-bcc9-89ae67597b62 | ZorroSavage117/Lab04 | demo/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp | // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
int main()
{
int number = 4;
int value;
switch (number)
{
case 10:
value = 0x101;
break;
case 20:
value = 0x102;
break;
case 30:
value... | TOOL | 0.917754 | 3.883109 |
009b206c-da54-47bf-92d8-81fcb99baf46 | kingminkyo/codetree-TILs | 241003/강력한 폭발/strong-explosion.cpp | #include <iostream>
#include <tuple>
#include <vector>
using namespace std;
#define MAX_N 20
int n;
int bomb_type[MAX_N][MAX_N];
bool bombed[MAX_N][MAX_N];
int ans;
bool inRange(int x, int y){
return x>=0 && x<n && y>=0 && y<n;
}
void Bomb(int x, int y, int b_type){
pair<int, int> bomb_shape[3][5] = {
... | ALGO | 0.999529 | 4.724821 |
5b19672f-b634-4c21-a700-32749fe7a149 | ishandutta2007/codeforces | mnaeraxr/normal/1220/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;
const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
const int mod = 1000000007;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
string... | ALGO | 0.999986 | 3.412029 |
506b1d82-9896-4a97-9ac0-7dbb0be85c26 | meghana-ganesh/Coding-Practice | Arrays/SumOfMaxAndMin.cpp | #include <bits/stdc++.h>
int sumOfMaxMin(int arr[], int n)
{
// Write your code here.
int max = INT_MIN,min = INT_MAX;
for(int i=0;i<n;i++)
{
if(arr[i] >= max)
max = arr[i];
if(arr[i] <= min)
min = arr[i];
}
return max+min;
}
| ALGO | 0.99987 | 5.218609 |
408aeb01-6a70-4fd9-a62e-1172ef961259 | daraskin/verilator | src/V3GraphAlg.cpp | #include "config_build.h"
#include "verilatedos.h"
#include <cstdio>
#include <cstdarg>
#include <unistd.h>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include "V3Global.h"
#include "V3GraphAlg.h"
//######################################################################
//###################... | ALGO | 0.99647 | 4.58245 |
842156fb-d7d2-4c16-8ebf-03ab051e6e7a | bananaappletw/online-judge | leetcode/spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> answer;
int m=matrix.size();
if(!m)
return answer;
int n=matrix.front().size();
int i=0,j=0;
while(n&&m)
{
if(m==1)
{
... | ALGO | 0.999997 | 6.108287 |
42267c8a-601d-4a45-8aac-6b3e20385b75 | Khaleeq01/Leetcode-problems-solutions | 0802-find-eventual-safe-states/0802-find-eventual-safe-states.cpp | class Solution {
public:
vector<int> eventualSafeNodes(vector<vector<int>>& graph) {
int n=graph.size();
vector<vector<int>> adj(n);
vector<int>indegree(n,0);
int i=0;
//reverse edges of a graph
for(auto &g:graph){
for(auto &it:g){
adj[it].... | ALGO | 0.999997 | 5.985539 |
0cceecb5-9c5c-405a-acfd-76600a429705 | yehuohan/evktor | src/omega/demo_filter.cpp | /*!
* @brief filter with compute shader
*/
#include <iostream>
#include <cstdio>
#include "demos.h"
DemoFilter::DemoFilter(int width, int height)
: LnGL(width, height)
{
this->setCameraPos(glm::vec3(0.0f, 0.0f, 5.0f));
glEnable(GL_DEPTH_TEST);
// load verteices
rect = loadMeshData(MESH_DATA_Re... | TOOL | 0.924987 | 5.544685 |
0e8b844d-e3ec-43bd-83c3-e5b1eaf77b0b | eggag32/Competitive-Programming | Codeforces/Mere Array.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i ... | ALGO | 0.999695 | 3.768148 |
1a28cd52-fc1c-4c72-9eda-c44f8eb96a71 | FACT0RN/FACT0RN | src/crypto/aes.cpp | #include <crypto/aes.h>
#include <string.h>
extern "C" {
#include <crypto/ctaes/ctaes.c>
}
AES256Encrypt::AES256Encrypt(const unsigned char key[32])
{
AES256_init(&ctx, key);
}
AES256Encrypt::~AES256Encrypt()
{
memset(&ctx, 0, sizeof(ctx));
}
void AES256Encrypt::Encrypt(unsigned char ciphertext[16], const ... | TOOL | 0.880316 | 7.549944 |
07b3bb4a-564c-48de-8920-a3223ed4aef7 | Harshkr2308/Graph_Algo | Graph algorithms/cycledetectbydisjointsetunit.cpp | #include <bits/stdc++.h>
using namespace std;
// Harsh kumar
struct node
{
int parent;
int rank;
};
vector<node>dsuf;
int find(int v)
{
if(dsuf[v].parent==-1)
return v;
return dsuf[v].parent=find(dsuf[v].parent);//path compression
}
void union_op(int fromp,int top)
{
if(dsuf[fromp].rank>dsuf[t... | ALGO | 0.999956 | 5.140508 |
a76c0d7d-782c-495b-b2c4-5956246cfdea | Rohit-2163/QUICK_STL | CODE_04_LIST.cpp | #include<iostream>
#include<list>
using namespace std;
int main(){
//creating list
list<int> l;
//puttng elements in list
l.push_back(1);
l.push_front(2);
// printing
for(int i: l){
cout<<i<<" ";
}cout<<endl;
//erasing element from list
l.erase(l.begin());
c... | TOOL | 0.959934 | 3.642523 |
c4170fff-b6ea-4e69-b1d8-c2c1dcbbb48b | mayankbisht123/c-code | Recursion/sumOfArray_recursion.cpp | #include<iostream>
using namespace std;
int sum(int arr[],int size)
{
if(size==0)
return 0;
int add=arr[0]+sum(arr+1,size-1);
return add;
}
int main()
{
cout<<"Enter the size of array"<<endl;
int m;
cin>>m;
cout<<"Enter your array"<<endl;
int arr[m];
for(int i=0;i<m;i++)
... | ALGO | 0.999695 | 4.527597 |
4cb68783-2aff-4713-bdb4-9e139688531b | t-aha/FinancialComputing | h5/bspline.cpp | #include "home5/home5.hpp"
#include "cfl/Fit.hpp"
#include "cfl/Error.hpp"
#include <algorithm>
#include <cmath>
#include <gsl/gsl_bspline.h>
#include <gsl/gsl_multifit.h>
#include <numeric>
using namespace cfl;
using namespace std;
class BSpline : public IFit {
public:
BSpline(unsigned iOrder, const std:... | ALGO | 0.999198 | 6.091613 |
8e27dcee-885a-450b-85c4-15450e5d0bfc | XyeHyin/vscode | LuoGu/P2340.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define PII pair<int, int>
#define dbg(x) std::cout << #x << ":" << x << " "
#define MP make_pair
#define PB push_back
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define dep(i,x,n) for(int i=x;i>=n;i--)
#define arrout(a,n) rep... | ALGO | 0.999543 | 3.43607 |
f4a2e546-fac0-44c7-9b66-a6d795365653 | anonymous-atom/DSA_CPP | Matrix_Polynomial/Matrix_Poly.cpp | //
// Created by karun on 9/8/22.
//
#include <iostream>
#include <valarray>
using std::cout;
using std::cin;
struct Term {
int coeff;
int exp;
};
struct Poly {
int n; //Number of terms in polynomial
struct Term *m;
};
int Evaluate_Poly(const Poly &pol, int x) {
static int sum = 0;
for(int ... | ALGO | 0.996337 | 4.311804 |
73bc52e8-610a-403b-9550-99c2af18f618 | wei-han/LeetCode | 244. Shortest Word Distance II.cpp | class WordDistance {
public:
WordDistance(vector<string> words) {
for(int i=0; i<words.size(); i++){
hash[words[i]].push_back(i);
}
}
int shortest(string word1, string word2) {
int res = INT_MAX;
int i = 0, j = 0;
while(i<hash[word1].size() && j<hash[... | ALGO | 0.999952 | 6.004282 |
4f7cee72-004b-4d38-b824-97acd8d05cf8 | biyu/PlayGround | C#/WindowsPhone/FantasticProject/FantasticBox2DD3DDemo/FantasticBox2DD3DDemoComponent/Box2D/Box2D/Collision/Shapes/b2CircleShape.cpp | #include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <new>
using namespace std;
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2CircleShape));
b2CircleShape* clone = new (mem) b2CircleShape;
*clone = *this;
return clone;
}
int32 b2CircleShape::GetC... | ALGO | 0.855807 | 7.850329 |
da3a1490-ae38-447b-a862-22248e0c85cc | Ismail2527/450_DSA-questions | Array/Kadane's Algorithm.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
// Function to find the sum of contiguous subarray with maximum sum.
int maxSubarraySum(vector<int> &arr) {
// code here...... | ALGO | 0.999076 | 6.763577 |
24db63f1-b99d-4222-9f5f-d15a89621f3e | bilboque/aoc_2024 | d1/p1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (ll)x.size()
//--------CODE--------//
const ll INF = 1e18;
const int MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
vector<int> vec1, vec2;
int a, b;
wh... | ALGO | 0.999899 | 4.66659 |
407d3f80-27e1-44ff-8a79-3bc2fe3388fa | ishandutta2007/codeforces | papa3/normal/1097/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const long long mod = 1000000007ll;
const long long INF = 1000000000000000000ll;
int32_t main() {
ios_base::sync_with_stdio( 0 );
cin.tie( 0 );
char a, b;
cin >> a >> b;
char c, d;
for( int i=1; i<=... | ALGO | 0.999916 | 3.090739 |
8dc492c8-55cd-4fe8-8678-b5435ed3efb0 | DivyamVJ0901/Love-Babbar-DSA-Youtube-Course-all-Codes | L133_Buy_and_sell_stock_IV.cpp | #include <bits/stdc++.h>
using namespace std;
int solveByRecursion(int index, int buy, vector<int> &prices, int limit)
{
if (index == prices.size() || limit == 0)
return 0;
int profit = 0;
if (buy)
profit = max((-prices[index] + solveByRecursion(index + 1, 0, prices, limit)), (solveByRecurs... | ALGO | 0.999925 | 5.342128 |
27d38dfd-a2fc-4daf-b13b-23191f65b654 | Ben10Bytes/cpp-program | cin.cpp/while_loop/file03.cpp | // This program prints all even numbers from 1 to n using a while loop.
#include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int i = 1;
while(i <=n){
if (i%2 == 0) { // Check if the number is even
cout << i << " "; // Print the even number
}
i++; // ... | ALGO | 0.991147 | 4.25749 |
7bf9d3a7-35bd-45f2-986f-5bfa0075a834 | wrren/cryptopals | src/cryptopals/xor.cpp | #include <cryptopals/xor.hpp>
#include <limits>
#include <map>
#include <numeric>
#include <string_view>
namespace cpl
{
void xor_encrypt(const byte_vector_view_t& in, const byte_vector_t& pad, byte_vector_t& out)
{
out.resize(in.size());
for(size_t i = 0; i < in.length(); i++)
{
... | ALGO | 0.998446 | 6.45549 |
a4bf43c9-1087-4bca-8c17-854efb9d03d1 | GomHyeok/Algorithm_Study | BOJ코드/2195.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
string s, p;
int i;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>s>>p;
int useCopy = 0;
while(i<p.size()) {
int maxl = 0;
for(int j=0; j<s.size();... | ALGO | 0.999875 | 3.968611 |
8d8dbf42-aabc-4ead-8d62-42d9220c518e | dinox0r/comp-prog | atcoder/rounds/abc209/c.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
//int n; cin >> n;
//vector<int64_t> c(n, 0);
//for (int i = 0; i < n; i++) cin >> c[i];
//sort(begin(c), end(c));
const int M = 1e9 + 7;
unordered_set<string> seen;
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
for (in... | ALGO | 0.998906 | 4.995605 |
3d6ea18e-8be4-40c5-a275-57f5a0cb0d83 | alexandraback/datacollection | solutions_5769900270288896_1/C++/FilipV/main.cpp | #include <bits/stdc++.h>
using namespace std;
bool black(int x,int y,int r,int c)
{
if(x<0||y<0||x>=r||y>=c)return false;
return (x+y)%2==0;
}
bool black2(int x,int y,int r,int c)
{
if(x<0||y<0||x>=r||y>=c)return false;
return (x+y)%2==1;
}
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int solve(int r,in... | ALGO | 0.999837 | 4.440093 |
fe5e3682-f56a-42d9-a610-e518ddb176c0 | bcdev/iavisa-ct | src/internal/CloudTestH.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include "CloudTestConstants.h"
#include "CloudTestH.h"
#include "Utils.h"
using namespace std;
/**
* Detection of dust storms (ALG.A8315.160-175).
*
* @param BT the brightness temperature spectra for the IASI IFOV of interest.
* @param thrDesstr the IASI ch... | ALGO | 0.984298 | 6.916482 |
70ff1c80-fa9d-488e-be67-3e00c5d226c2 | jhbaik1501/Algorithm | 알고리즘 정리/11강(재귀)/분할과 정복/Divide_and_Conquer.cpp | /*
입력을 나누어,
더 작은 문제를 풀고,
작은 문제들의 답을 조합하여
전체 문제의 답을 만든다
아주 작은 문제는 어쨌든 풀린다.
어떻게 나누지?????
*/
/*Merge Sort*/
/*
n개 (3 5 8 10 15
(1 2 4 6 9 11
Merge --> 1 2 3 4 5 6 8 10 11 15
머지는 O(n)시간!
*/
#include <stdio.h>
int sort(int a[], int n)
{
int h;
int b[n];
h = n/2;
// copy a[] to b[]
sort(b, h)... | ALGO | 0.999952 | 4.555041 |
9308ef27-d8d6-4506-8930-26e4b4a5c9db | Gladiator-20/Leetcode-Daily-Challenges | December/5.cpp | // Problem Link : https://leetcode.com/problems/middle-of-the-linked-list/
// Author - gladiator-20
class Solution {
public:
ListNode* middleNode(ListNode* head) {
ListNode* slo=head;
ListNode* fas=head;
while(fas!=NULL && fas->next!=NULL)
{
slo=slo->next;
f... | ALGO | 0.999944 | 5.997132 |
9cbd4a71-f2bf-46dc-9e2b-a1c24418c94a | sx-aurora-devold/llvm | tools/llvm-dwarfdump/Statistics.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Object/ObjectFile.h"
#define DEBUG_TYPE "dwarfdump"
using namespace llvm;... | TOOL | 0.905566 | 7.88619 |
fb4bd143-818a-4b00-b37c-4c60197a7ae6 | adsovetzky/ADSO-FILE | tinhoctre/file C++8 NGUYENHONGTHAI/1083.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr); cout.tie(nullptr);
long long n, d = 0; cin >> n;
string s, u = ""; cin >> s;
cout << s << endl;
long long row = s.size() / n;
for(long long i = 1; i <= n; i++){
for(long long ... | ALGO | 0.999951 | 3.148554 |
ef03cf68-fe1f-4905-a2bd-ade0caa02ad3 | phuocchubeo123/Codeforces | Contests/ICPCTrain/OCPC202303/asol.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;
typedef complex<double> cd;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r... | ALGO | 0.99998 | 3.725348 |
19b1d983-5283-46ac-9703-0e4a44f698a4 | NotTahaAli/LeetCode | 387-first-unique-character-in-a-string/first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
int count['z'-'a'+1] = {0};
int strlen = s.size();
for (auto c: s) {
count[c-'a']++;
}
for (int i = 0; i < strlen; i++) {
if (count[s[i]-'a'] == 1) return i;
}
return -1;
}
}; | ALGO | 0.999808 | 5.910044 |
b8463906-6e42-4deb-a292-9ebdebcfc155 | Akku1508/Codingninjas-quesns-solutions | Print all divisors of a number.cpp | #include <bits/stdc++.h>
using namespace std;
#include "solution.h"
vector<int> printDivisors(int n) {
int i=1;
vector<int> divisors;
while(i<=n)
{
if(n%i==0)
{
divisors.push_back(i);
}
i++;
}
return divisors;
}
class Runner
{
int t;
int s... | ALGO | 0.999617 | 4.228186 |
317392bb-43f4-454c-b7cd-ee81658b475e | chauhansatyam3112/DSA-problems | 2967-minimum-cost-to-make-array-equalindromic/2967-minimum-cost-to-make-array-equalindromic.cpp | class Solution {
public:
bool isPalindrome(int n) {
long long r, sum = 0, temp;
temp = n;
while (n > 0) {
r = n % 10;
sum = (sum * 10) + r;
n = n / 10;
}
return temp == sum;
}
long long solve(vector<int>& nums,... | ALGO | 0.99998 | 5.841226 |
3bc20638-f151-4792-865e-59470533f893 | Dhruv-Limbani/Data-Structures | Hashing/find_max_min_freq_elem.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Given an array 'v' of 'n' numbers. Your task is to find and return the highest and lowest frequency elements.
If there are multiple elements that have the highest frequency or lowest frequency, pick the smallest element.
*/
vector<int> getFrequencies(vector<int>... | ALGO | 0.999991 | 4.907937 |
42ae6d9e-6274-4348-ae54-9bfd35968602 | Nolin7777/HysteriaCoreClustering | dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp | #include <float.h>
#include <string.h>
#include "DetourNavMeshQuery.h"
#include "DetourNavMesh.h"
#include "DetourNode.h"
#include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourAlloc.h"
#include "DetourAssert.h"
#include <new>
/// @class dtQueryFilter
///
/// <b>The Default Implementation</b>
///
/// At co... | ALGO | 0.990628 | 6.063533 |
e48ace93-fe12-48e4-af40-c5913502450a | ahmedsharaf19/IEEE-ZSB-Technica1-Rookies-23 | Task-4/k most frequent elements.cpp | #include <bits/stdc++.h>
using namespace std;
void print_N_mostFrequentNumber(int arr[], int N, int K);
bool compare(pair<int, int> p1, pair<int, int> p2);
int main()
{
int n, k;
cin >> n >> k;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
print_N_mostFrequentNumber(arr, n, k);
return 0;
}
boo... | ALGO | 0.999995 | 4.58566 |
f2cad4cd-122b-4911-9309-ca4128ae0602 | NikhilAnand1998/Analysis-of-Algorithms | WrestlerProblem/wrestler.cpp | /****************************************************
**Program: wrestler.cpp
**Author: Nikhil Anand
**Date: 7/29/2018
**Input: wrestler/1/2.txt
**Output: Prints in console
****************************************************/
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
#include <cstdlib>... | ALGO | 0.998623 | 3.851089 |
f2a2f236-9ac1-4a44-ba5c-1c6882ade3df | theoden42/code-store | codeforces/Codeforces Round 853 (Div. 2)/C 2.cpp |
/* @uthor: (g)theoden42 */
#include <bits/stdc++.h>
using namespace std;
#ifdef ON_PC
#include <debug.h>
#else
#define debug(x...)
#endif
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
const int MAX_N = 1e6 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
#define int lon... | ALGO | 0.99993 | 4.053084 |
19e94c4e-6a22-4809-8e48-873155303a48 | VANSHIKA1803/DSA | Lecture009 Introduction To Arrays in C++/SumOfArrayElements.cpp | #include <iostream>
using namespace std;
int sumArray(int arr[], int size)
{
int count = 0;
for (int i = 0; i < size; i++)
{
count = count + arr[i];
}
return count;
}
int main()
{
int arr[100];
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
... | ALGO | 0.982113 | 5.288598 |
d792ae02-8df1-4bbc-a42c-78f4bf86aded | logicmoo/logicmoo_nlu | ext/regulus/Mobile/CommunicationChannel/src/RtspRequest.cpp | #include <vector>
#include <iostream>
#include <sstream>
#include "RtspRequest.hpp"
#include "ace/Log_Msg.h"
using namespace std;
// requires <locale>
static void StringToLower(string& s)
{
for (string::size_type i = 0; i < s.size(); ++i)
{
s[i] = tolower(s[i]);
}
return;
}
// unused?
/*
stati... | WEB | 0.85768 | 4.533721 |
ce90d745-9c10-45dd-9e06-2c7a731ec01b | yandex/perforator | contrib/libs/llvm18/tools/llvm-mca/CodeRegionGenerator.cpp | #include "CodeRegionGenerator.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/SMLoc.h"
#include <memory>
namespace llvm {
namespace mca {
// This virtual dtor s... | TOOL | 0.965899 | 7.888411 |
c23a8a6a-b65c-4a11-9184-a9f4f1474f7c | EganChin/Solution | 力扣/算法/870.优势洗牌.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
struct Node{
int value;
int index;
Node(int v, int i){
value = v;
index = i;
}
};
int cmp(Node n1, Node n2){
return n1.value < n2.value;
}
class Solution {
public:
vector<int> advantageCount(vector<int>& A, vecto... | ALGO | 0.999943 | 5.198363 |
8a737ede-2a4c-45ec-be5f-9d7d1c99dbb8 | YALOKGARua/leetcode | codingame/Mars Lander - Episode 2.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
static int clampInt(int v, int lo, int hi) {
if (v < lo) return lo;
if (v > hi) return hi;
return v;
}
static double clampDouble(double v, double lo, double hi) {
if (v < lo) return lo;
if (v > hi) return hi;
return v;... | ALGO | 0.999884 | 3.739618 |
0687a461-ee84-41c5-bc54-89a2f58dd387 | NyaanNyaan/library | verify/verify-yosupo-graph/yosupo-cartesian.test.cpp | #define PROBLEM "https://judge.yosupo.jp/problem/cartesian_tree"
#include "../../template/template.hpp"
#include "../../tree/cartesian-tree.hpp"
using namespace Nyaan; void Nyaan::solve(){
ini(N);
vl a(N);
in(a);
auto [g, root] = CartesianTree<ll>(a);
vl ans(N);
ans[root] = root;
rep(i,N){
each(j,g[... | ALGO | 0.999981 | 4.777649 |
da4e752f-8402-4017-9489-1a1e07891d07 | devjeyem/C-Plus-Plus-Problems | wtf/wtc.cpp | #include <iostream>
#include <cmath>
using namespace std;
long long int intExp(int a, int b);
int digitSum (long long int x);
void storeLargestExpDigitSum (int x[], int s);
int dispExpDigitSum(int x[],int s);
int main ()
{
//cout << intExp(8,2);
//cout << digitSum (512);
int s = 10;
int x[s];
sto... | ALGO | 0.999575 | 3.799225 |
9cc00f72-bad3-4bec-a145-b47647320470 | hritu1701/DSA_SummerTraining | stack.cpp | #include<bits/stdc++.h>
#include<string.h>
using namespace std;
const int SIZE = 100;
char myStack[SIZE];
int top = -1;
void push(char item) {
if (top == SIZE - 1) {
cout << "Stack Overflow! Cannot push element.\n";
} else {
myStack[++top] = item;
cout << "Pushed: " << item << endl;
... | ALGO | 0.987766 | 4.604449 |
e8f17504-028e-47aa-a257-b6e17d9131ba | ishandutta2007/codeforces | wxhtzdy/normal/278/A.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999853 | 3.632143 |
330bf990-fc7b-422a-84ba-b278734210df | saikaisa/HomomorphicFiltering | src_legacy/c_normal_legacy.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <complex>
#include <fftw3.h>
#include <algorithm>
// PPMͼʽļȡ
bool readPPM(const std::string& filename, int& width, int& height, std::vector<unsigned char>& data) {
// ԶģʽļͼΪһļ
std::ifstream input_file(filename, std::ios::bina... | ALGO | 0.992925 | 4.613132 |
769c3aa9-5ff1-4b03-8483-139a993e5050 | pluslin/gromacs_gpu | src/gromacs/domdec/domdec_setup.cpp | /*! \internal \file
*
* \brief This file defines functions used by the domdec module
* in its initial setup phase.
*
* \author Berk Hess <<EMAIL>>
* \ingroup module_domdec
*/
#include "gmxpre.h"
#include <assert.h>
#include <stdio.h>
#include <cmath>
#include "gromacs/domdec/domdec.h"
#include "gromacs/legac... | ALGO | 0.999869 | 6.405102 |
348ba716-ee2a-463e-b46b-c910b005ce1d | Akanksha1212/C_Programs | Dynamic_programing/nCr_mod_p.cpp | #include<bits/stdc++.h>
using namespace std;
int nCrModp(int n, int r, int p)
{
// The array C is going to store last row of
// pascal triangle at the end. And last entry
// of last row is nCr
int C[r+1];
memset(C, 0, sizeof(C));
C[0] = 1; // Top row of Pascal Triangle
// ... | ALGO | 0.999988 | 5.402819 |
2e13bf54-45a4-4d54-b569-59cf862045b1 | ishandutta2007/codeforces | latte0119/normal/767/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n... | ALGO | 0.999892 | 3.776221 |
fa9dd747-87bc-4001-986c-5b49adfe8774 | YhgzXxfz/lintcode | reorder_array_to_construct_the_minimum_number.cpp | class Solution {
public:
/**
* @param nums n non-negative integer array
* @return a string
*/
string minNumber(vector<int>& nums) {
// Write your code here
auto comp = [](int i1, int i2) {
return to_string(i1) + to_string(i2) < to_string(i2) + to_string(i1);
}... | ALGO | 0.999992 | 6.462149 |
6a07e128-5ce2-45b4-890c-b877ec466f4b | bakseo3060/Algorithm | 17298.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
int main() {
/*
방법 1
수열을 탐색하면서 i 번째 위치일 때 i+1 과 비교.
i+1 이 큰 경우 오큰수에 해당하므로 nge[i]에 해당 값을 넣는다.
i+1 이 작은 경우 오큰수가 아니므로 인덱스인 i를 stack에 push
매번 stack의 top을 idx로 두고 a[idx]와 a[i]를 비교하여 a[i]가 더 큰 경우
nge[idx] = a[k] stack pop하... | ALGO | 0.999997 | 3.901454 |
62f5a348-2ba3-469b-8ebe-b762e7f70465 | ishandutta2007/codeforces | igorbunov/normal/1166/A.cpp | using namespace std;
#define pb push_back
//#define int long long
#define endl "\n"
signed main() {
int n;
vector<int> arr(30);
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
arr[s[0] - 'a']++;
}
int x = 0;
for (int i = 0; i < 30; i++) {
int a =... | ALGO | 0.999935 | 4.410129 |
6d15c4c7-0ac8-4799-a9d9-33714ec83e97 | kylienic/CTP-250 | Lab 2/LAB 2 SUBMISSION/Lab2-2.cpp | /**
* @file: Lab2-2.cpp
* @author: Kylie Nicholson
* This file takes an input string and displays its words backwards. The string must end with a
* space (because of the method I use to parse the words), and an EOF (per Lab instructions).
*
*/
#include <string>
#include <iostream>
using namespace std;
int writeBack... | ALGO | 0.985516 | 4.587233 |
b1e27220-9606-4c66-acfd-a126b4cc2b3f | chisolm/CarND-MPC-Project | src/Eigen-3.3/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.992317 | 4.29849 |
a8b7bc76-3bf0-4998-a984-9cfe155f2d20 | everx-labs/TVM-Compiler | llvm/tools/dsymutil/CFBundle.cpp | #include "CFBundle.h"
#ifdef __APPLE__
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <CoreFoundation/CoreFoundation.h>
#include <assert.h>
#include <glob.h>
#include <memory>
#endif
namespace llvm {
namespace dsymutil {
#ifdef __APPLE__
/// Deleter... | TOOL | 0.88912 | 5.703995 |
6c076b9a-5432-4db0-a5f7-a4d984d454e9 | qualia4/ServerToCountMarixDifferences | Server/Server.cpp | #include <iostream>
#include "vector"
#include <cstdlib>
#include <ctime>
#include "thread"
#include "chrono"
#include "math.h"
#include <winsock2.h>
using namespace std;
#pragma comment(lib, "ws2_32.lib") // link with ws2_32.lib
void calculate(int start, int actions, int** matrixA, int** matrixB, int** matrixRes, int... | ALGO | 0.951133 | 3.855938 |
b1d766b9-9bc5-41eb-9ded-5748f12cea5b | aravind-kumar/Coding | sorting/merge_sort_std11.cpp | #include <iostream>
#include <vector>
#include <algorithm>
void PrintArray(std::vector<int>& inputVector)
{
for(auto&& element:inputVector)
{
std::cout<<element<<"\n";
}
}
void SortArray(std::vector<int>& inputVector)
{
MergeSortHelper(inputVector.begin(),inputVector.end());
}
int main()
{
st... | ALGO | 0.999907 | 5.557329 |
795104a3-f244-4dc2-b3cf-24fad4c732df | lsprangers/implementations-and-systems-design | leet/largestPossibleIntegerThatExistsWIthNegative.cpp | class Solution {
public:
int findMaxK(vector<int>& nums) {
if(nums.size() < 2) {
return(-1);
}
// sort descending
// O(n log n)
std::sort(nums.begin(), nums.end(), std::greater<>());
int idx = 0;
set<int> pos;
// O(n)
while(idx < nu... | ALGO | 0.999955 | 5.331583 |
0e4978e8-be7e-4901-a61e-eaa183c4f1e6 | skritichauhan/HackerRank_Solutions | C++ Language Proficiency/Other Concepts/Operator Overloading.cpp |
class Matrix
{
public:
vector<vector <int> >a;
Matrix& operator+ (Matrix& m1)
{ Matrix res;
//result.a = vector<vector<int>>(param.a.size());
for(int i=0;i<a.size();i++)
{
for(int j=0;j<a[0].size();j++)
{
this->a[i][j]=(m1.a[i][j]+this->a[i][j]);
}
... | ALGO | 0.999459 | 3.828714 |
4c497f89-aec7-4d97-8214-b860eb910604 | baixun2307/asd | solution/0200-0299/0297.Serialize and Deserialize Binary Tree/Solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
if (!root) {
... | ALGO | 0.999789 | 6.693848 |
066e81c1-6683-4d1e-b5b3-594c48d6062c | ESTEKI/compliant-emg-driven | Interface/appv1/cppinterface_v1.0/my includes/EIGENDIR/doc/examples/tut_matrix_resize.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,5);
m.resize(4,3);
std::cout << "The matrix m is of size "
<< m.rows() << "x" << m.cols() << std::endl;
std::cout << "It has " << m.size() << " coefficients" << std::endl;
VectorXd v(2);
v.resize(5);
... | ALGO | 0.911207 | 3.882785 |
356f7e94-d579-4ed4-9fb4-da8601b03500 | yoursshahnawaz/Codeforces | 344A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, magnet, prevMagnet, count = 1;
cin >> n;
cin >> prevMagnet;
--n;
while(n--) {
cin >> magnet;
if(magnet == prevMagnet) {
prevMagnet = magnet;
} else {
count++;
prevMagnet = magnet;
}
}
cout << count;
}
| ALGO | 0.999959 | 3.400463 |
9d95d775-3650-435c-b845-5f0e7e887f73 | princeofcrows/--cp | unsolved/C_Recover_an_RBS.cpp | #include <bits/stdc++.h>
using namespace std;
// Data type
#define int long long
#define ll long long
#define pii pair<int, int>
#define piii pair<int, pii>
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pii>
#define mii map<int, int>
#define msi map<string, int>
#define si set<int>
#define s... | ALGO | 0.998746 | 4.492259 |
b09706a9-5092-43dc-8932-b03a75dd1bfb | SciEco/IntelliEco | MothCount/MatToJson/MatToJson.cpp | #include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <fstream>
#include <list>
#include <queue>
#include <deque>
#include "DrawContour.hpp"
#include "json.hpp"
using namespace cv;
using namespace nlohmann;
using namespa... | ALGO | 0.997931 | 3.898046 |
4c93f0aa-3b25-4b51-9054-fc5b39d2df9d | Amdev-5/Leetcode-Algorithmic-Problems | 1572-matrix-diagonal-sum/1572-matrix-diagonal-sum.cpp | class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int n=mat.size(),ans=0;
for(int i=0;i<n;i++){
if(i!=n-i-1) ans+=mat[i][i]+mat[i][n-i-1];
else ans+=mat[i][i];
}
return ans;
}
}; | ALGO | 0.999948 | 5.801324 |
37eb27ef-8604-4ad7-89a4-48eb2e5a5c4a | raghuvanshraj/Competitive-Programming-Archive | Coding Ninjas/min_elt_lazy.cpp | #include <bits/stdc++.h>
using namespace std;
void buildTree(int *arr, int *tree, int start, int end, int node)
{
if (start == end)
{
tree[node] = arr[start];
return;
}
int mid = (start+end) / 2;
buildTree(arr, tree, start, mid, 2*node);
buildTree(arr, tree, mid+1, end, 2*node+1);
tree[node] = min(tree[2... | ALGO | 0.99997 | 4.813046 |
e7913703-8860-423f-8c11-4d35dcdff2fd | EthanCaol/Game-2048 | Game2048-Logic.cpp | #include "Game2048.h"
/* 随机放置新数字 */
void Game2048::putNumber() {
// 随机生成0~3的整数
std::uniform_int_distribution<int> randNum(0, 3);
int x = randNum(randGen);
int y = randNum(randGen);
// 随机挑选一个空格子放置新数字
while (board[x][y] != 0) {
x = randNum(randGen);
y = randNum(randGen);
}
... | ALGO | 0.996914 | 4.874194 |
0d2e5886-bdf2-448f-9505-34e461aea02d | quandquang1312/red_training_exercise | graph/flow/minimum_cut/cses_1695.cpp | // https://cses.fi/problemset/task/1695
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct Edge {
int to, rev, cap;
};
class Dinic {
public:
int n;
vector<vector<Edge>> adj;
vector<int> level, ptr;
Dinic(int n): n(n), adj(n), level(n), ptr(n) {}
void addEdge(int u... | ALGO | 0.999974 | 4.693097 |
104c930a-dbb0-436a-8364-2733c3b2d0f4 | Blackhatarcher/CHS172-HW03 | 10.4/10.4/10.4.cpp | // 10.4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
string sort(string& s)
{ //following lines of code will rearrange letters input by user//
for (int i = s.length() - 1; i >= 1; i--)
char currentMax = s[0];
int curr... | ALGO | 0.998485 | 4.568164 |
d1056a3c-ec48-4f6f-95ef-2b558c42377f | Kalp22/Cpp | StudentDynamicDatabase.cpp | #include<iostream>
#include<string.h>
using namespace std;
class Student{
int roll;
string name;
int marks;
public:
Student(int rol, string n, int mark){
roll = rol;
for(int i=0; i<n.length(); i++){
name[i] = n[i];
}
marks = mark;
... | TOOL | 0.928915 | 4.003695 |
952c5191-7764-4f7b-b4ea-db303f82c462 | SummerS-tars/CodeServerCodeStore | CodeDocuments/codes/1_1cpp_basicgrammar/7class_structure_pointer_reference/4linkedlist2.cpp | #include <iostream>
using namespace std;
struct Node /*node 节点*/
{
int val ;
Node* next ;
Node ( int _val ) : val ( _val ) , next ( NULL ) {} //构造函数
//NULL表示空指针,值为0
};
int main()
{
Node* head = new Node ( 1 ) ;
Node* p = new Node ( 2 ) ;
Node* q = new Node ( 3 ) ;
//头插法:在链表头部加上... | ALGO | 0.999837 | 3.336734 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.