uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
d8d73ea2-bc81-4cdf-9a08-cdad79172257
NarouMas/LeetCode_C
DP/0198_House_Robber.cpp
#include<iostream> #include<vector> using namespace std; class Solution { public: int rob(vector<int>& nums) { vector<int> memo(nums.size() + 1, -1); memo[0] = 0, memo[1] = nums[0]; for(int i = 1; i < nums.size(); i++) memo[i + 1] = max(memo[i - 1] + nums[i], memo[i]); ...
ALGO
0.999952
5.267271
71ba7d20-76a3-49a8-b5ae-eff296c7d3d8
nono19972020/atcoder
keyence/2019/b.cpp
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ string s; cin >> s; string key = "keyence"; if(s == key){ printf("YES\n"); return 0; } for(int i = 0; i < s.size(); i++){ for(int j = i; j < s.size(); j++){ string ...
ALGO
0.999988
3.402019
d8244c84-8d74-40bc-b888-2b383d14678e
quiverteam/Engine
src/utils/vbsp/detail.cpp
#include "vbsp.h" #include "detail.h" #include "utlvector.h" #include <assert.h> face_t *NewFaceFromFace (face_t *f); face_t *ComputeVisibleBrushSides( bspbrush_t *list ); //----------------------------------------------------------------------------- // Purpose: Copies a face and its winding // Input : *pFace - //...
ALGO
0.996981
4.98645
4264244c-c64d-48ef-a725-fc42cd718fa3
raincross7/code-similarity
codes/train_code/problem076/problem076_242.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define _GLIBCXX_DEBUG #define all(v) v.begin(), v.end() int main() { int N, M; cin >> N >> M; vector<int> H(N,0); vector<int> count_H(N,1); rep(i, N) cin >> H[i]; rep(i, M) { int a, b; ...
ALGO
0.999984
3.915065
5ef4d903-df2c-420f-bb64-54967af26314
astghbaroyan/cpp_tasks
lesson5_task2.cpp
#include <iostream> int main() { int A,B; std::cin >> A; std::cin >> B; int i=A; while (i>=A && i<= B) { if (i % 2 == 0) { std::cout << i << " "; } i += 1; } }
ALGO
0.999643
3.204117
784a3358-0346-47de-9cd2-536279249af4
ZhanserikKalmukhambet/ALGORITHM_DATA_STRUCTURES
Week_10/lab9/A.cpp
#include <bits/stdc++.h> using namespace std; vector <int> p_f(string s){ int n = s.size(); vector <int> p(n); p[0] = 0; for(int i=1; i<n; i++){ int j = p[i-1]; while(j > 0 && s[i] != s[j]) j = p[j-1]; if(s[i] == s[j]) j++; p[i] = j; } return p; } bool checkPattern(vector <int> v, int sz){ fo...
ALGO
0.999924
3.980111
124c8e88-d28e-445e-9097-c922ddccb8ba
TeamWarm/android_frameworks_base
media/libstagefright/codecs/amrnb/common/src/q_plsf.cpp
/* ******************************************************************************** * * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 * R99 Version 3.2.0 * REL-4 Version 4.0.0 * *********************************************************...
ALGO
0.927666
5.540532
fa663839-66ee-4b8a-9aa6-b16c5e74d58b
SujitP8901/Development
2404-most-frequent-even-element/2404-most-frequent-even-element.cpp
class Solution { public: int mostFrequentEven(vector<int>& nums) { map<int,int> m; int ans = -1, ansFreq = 0; int i = 0; for(i = 0; i < nums.size(); i++) { if(nums[i] % 2 == 0) { m[nums[i]]++; } } ...
ALGO
0.999902
5.867287
471771be-04f2-4c70-ac77-62ec59a80c98
raghadislam/problem-solving
lazy_propagation/Assignment_and_Minimum.cpp
/* problem link: https://codeforces.com/edu/course/2/lesson/5/2/practice/contest/279653/problem/E * solution by: Raghad Islam * date: 27-6-2025 */ #include <bits/stdc++.h> using namespace std; void fileIO(void) { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #e...
ALGO
0.99998
6.110086
2862bbd2-d47a-4fb1-ae97-7413c7298e8c
N1k1ta-white/SDA_2023-2024
leetcode/273.cpp
#include <iostream> using namespace std; class Solution { static const string digitString[]; static const string teenString[]; static const string tenString[]; static const string hundred; static const string thousand; static const string million; static const string billion; public: ...
ALGO
0.993582
5.970022
c3ddf5f3-ad43-4645-973c-a8530a5cd981
Dawoodsarfraz/CS2001-Data-Structures
codes(Lab-Practice-Assignments)/LLQueue.cpp
#include<iostream> using namespace std; class node{ public: int data; node *next; node(int val){ data = val; next = NULL; } }; class queue{ node *front; node *back; public: queue(){ front = NULL; back = NULL; } void push(int x){ ...
ALGO
0.999461
4.418463
e08a04fd-a9dd-4ec2-ba2c-ce41cdbe2144
jlandy99/RSA-Encryption
Decrypt.cpp
#include "Decrypt.h" #include <iostream> // Global function to raise long to power of long mod long extern long power(long a, long e, long mod); // Global function to find gcd of two numbers int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } // Helper function to handle coprimality te...
ALGO
0.997079
4.515321
f42cf4db-95f6-4763-b27d-73d1eee9f2cf
jaimemin/programmers
주차 요금 계산.cpp
#include <string> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <map> #include <iostream> using namespace std; const string MAX_TO = "23:59"; typedef struct { string from; string to; } Time; int getDiffMinute(string from, string to) { int toHour = stoi(to.substr(0, 2)); int toMi...
ALGO
0.997956
5.396476
c02ef0e1-1038-4215-9d05-f2fee197dde4
7matuag/DSA-Sheet-by-Love-Babbar-450-Questions-
Dynamic Programming/Array Removals.cpp
class Solution{ public: int removals(vector<int>& arr, int k){ //Code here sort(arr.begin(), arr.end()); int n = arr.size(); int s = 0, e = 0; int maxlen = 0; while(e < n){ if(arr[e] - arr[s] <= k){ maxlen = max(maxlen, e - s + 1); ...
ALGO
0.999952
5.278135
c5add120-b94d-42ee-a798-1c2067ae83bc
Eeman1113/Leetcode
Problems/2469.cpp
class Solution { public: int maxPalindromes(string s, int k) { const int n = s.length(); // dp[i] := the maximum number of substrings in the first i chars of s vector<int> dp(n + 1); // If a palindrome is a substring of another palindrome, then considering // the longer palindrome won't increase...
ALGO
0.999806
6.653178
0374a8cd-73c7-47ff-bdc8-3efddc9c8430
SadeepNanda/Competitive-Coding
Octoberlunchtime1.cpp
#include <iostream> using namespace std; int main() {int t; cin>>t; while(t--) { long long x; cin>>x; if(x%2==0) cout<<(x/2)+1<<" "<<(x/2)-1<<endl; else cout<<x/2<<" "<<x-(x/2)<<endl; } // your code goes here return 0; }
ALGO
0.999738
4.104102
906a7fac-e732-406c-b296-d3eee5213168
LeDevilCat/Ohjelmoinnin-perusteet
TEH-14/TEH-14.cpp
#include <iostream> #include <locale> using namespace std; int main () { setlocale(LC_ALL, "fi_FI.UTF-8"); int num1, num2; cout << "Syötä ensimmäinen kokonaisluku: "; cin >> num1; cout << "Syötä toinen kokonaisluku: "; cin >> num2; if (num1 > num2) { cout << "Ensimmäinen luku on su...
TOOL
0.953589
3.827618
c423a633-03ce-4e99-91a3-30b6bdadd0df
savvynavi/Math-for-Games
Geometry/Hitbox/Hitbox/AABB2.cpp
#include"AABB2.h" #include"Matrix2.h" #include<iostream> AABB2::AABB2(){ min.x = 100000; min.y = 100000; max.x = -min.x; max.y = -min.y; } AABB2::AABB2(Matrix2 points){ min.x = 100000; min.y = 100000; max.x = -min.x; max.y = -min.y; points.transpose(); for(int i = 0; i < 2; i++){ for(int j = 0; j < 2; j++...
ALGO
0.976561
6.039948
19821c6e-c1a9-4be0-b413-55141c840a8e
Yawn-Sean/Daily_CF_Problems
daily_problems/2025/01/0113/personal_submission/cf1463d_lyxxys.cpp
#include <bits/stdc++.h> using namespace std; using i64 = long long; using f64 = long double; const f64 eps = 1e-12; const i64 inf_i64 = 4e18; const int inf_int = 1e9; template <class T> void fmax(T &a, const T &b){ if (b > a) a = b; } template <class T> void fmin(T &a, const T &b){ if (b < a) a = b; } int jgs(...
ALGO
0.999936
4.1087
978995ca-e98a-4a0d-85dd-7390cc7c6290
king-yyf/cpcode
other/cses/1145.cpp
#include <bits/stdc++.h> using namespace std; // https://vjudge.net/problem/CSES-1145 using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector<int> res; for (int ...
ALGO
0.999961
4.634799
9d1d0375-790c-41b3-a06d-8190b332d777
istiaqueahmedarik/Phitron
week9/Expression.cpp
#include <stdio.h> int main() { int a, b, c; scanf("%d%d%d", &a, &b, &c); int max = a + b + c; if (a + b * c > max) max = a + b * c; if (a * (b + c) > max) max = a * (b + c); if (a * b * c > max) max = a * b * c; if ((a + b) * c > max) max = (a + b) * c; ...
ALGO
0.99973
4.034986
6cbbc15c-62b6-4cae-8d4c-ba0385c3da72
stefdasca/CompetitiveProgramming
Codeforces/Codeforces Global Round 3/CF1148-D12-E.cpp
#include<bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; int n; pair<int, int> v1[300002]; int v2[300002]; struct mutari { int a, b, c; }; mutari v[2000002]; int xo; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 1; i <= n; ++i) cin >> v1[i...
ALGO
0.999991
3.360643
5f6eb6f9-e3cd-4359-8a39-130f2bcbc87b
turajred/algorithm
module 6/adjacentlist.cpp
#include<bits/stdc++.h> using namespace std; const int N=1e5+6; vector<int> adj[N]; int main(){ int n,m; cin>>n>>m; while(m--){ int u,v,w; cin>>u>>v; adj[u].push_back(v); adj[v].push_back(u); } for(int i=1;i<=n;i++){ cout<<"List "<<i<<":"; for(int j:ad...
ALGO
0.999393
4.135977
d528e4da-a681-47c7-9448-21d28bd5bcb5
ishandutta2007/codeforces
bench0310/normal/1051/B.cpp
#include <iostream> using namespace std; int main() { long long l,r; cin >> l >> r; cout << "YES" << endl; for(long long i=l;i<=r;i+=2) { cout << i << " " << i+1 << endl; } return 0; }
ALGO
0.999817
3.451422
3e6943f1-862d-4297-9751-fb04691eaea8
tanyagupta0201/DSA
Heaps/PriorityQueueForCustomClass.cpp
#include <iostream> #include <cstring> #include <queue> using namespace std; class Person { public: string name; int age; Person() { } Person(string n, int a) { name = n; age = a; } }; class PersonCompare { public: bool operator()(Person A, Person B) { ...
ALGO
0.999026
5.023142
03b11596-b045-4c10-9055-fb61d67596a3
threalwinky/cp_notebook
from_other_people/YouKnowWho Lib/code-library-master/Number Theory/Linear Diophantine With N Unknowns and Two Equations.cpp
#include<bits/stdc++.h> using namespace std; using ll = long long; /** given are a[i], b[i], p and q: sum(x[i] * a[i]) = p --- (i) sum(x[i] * b[i]) = q --- (ii) x[i]s can only be integers. does a solution exist? **/ ll extended_euclid(ll a, ll b, ll& x, ll& y) { if (b == 0) { x = 1; y = 0; return a; } ...
ALGO
0.999904
4.417001
488d44c4-67bc-4815-a137-23731eefd9d9
Khizanag/algorithms
Leetcode/0700. Search in a Binary Search Tree.cpp
/* Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should return NULL. For example, Given the tree: 4 / \ 2 7 / \ 1 3 And the va...
ALGO
0.999983
5.986603
63138a92-e414-4ccb-9d52-12651ea703da
Bonzskie01/Cplusplus-COMPILATION
Loop Statements/12skipwhile.cpp
#include <iostream> using namespace std; int main() { int num = 10; while (num >= 0) { if (num != 5) { cout << num << " "; } num--; } cout << endl; return 0; }
ALGO
0.999785
3.024752
16d8d704-e039-44bb-9b20-16c5602308e4
beast4sourav/DSA-with-C-
armstrong.cpp
#include<iostream> using namespace std; int main(){ int n; int sum = 0; cin>>n; while(n>0){ int lastD = n%10 ; sum = sum + (lastD*lastD*lastD) ; n=n/10; } cout<<sum; }
ALGO
0.99992
4.048778
35613188-fa87-4f75-b183-984bc8f9c80a
chm15/kattis
bits.cpp
#include <iostream> #include <string> long oneCount(long x) { long carry = 0; while(x>0) { if (x&1) { carry++; } x >>= 1; } return carry; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); long n; std::cin >> n; for (long i...
ALGO
0.999846
4.459744
64c490a1-b627-4285-aa4e-d464b516df9c
7566565794/must_do_tree
serializable_and_deserializable.cpp
void serialize(Node *root,vector<int> &A) { //Your code here if(!root){ A.push_back(-1); return; } A.push_back(root->data); serialize(root->left,A); serialize(root->right,A); } Node *des(deque<int>&q){ Node *root; if(!q.empty()){ int val = q.front(); q.pop_front(); ...
ALGO
0.999863
5.193692
369b0f7d-9e77-4d25-982d-a73937f70d84
rishabhgargdps/coding_prep
5_April_2022/count_number_of_maximum_bitwise_or_subsets.cpp
class Solution { public: int res = 0; int max = 0; void backtrack(vector<int>nums, int start, int val) { //Base case if(val == max) res++; //Recursive step for(int i=start; i<nums.size(); i++) { backtrack(nums, i+1, val | nums[i]); } } in...
ALGO
0.999993
6.120626
75c013e7-94e0-433e-8bfc-eed2d3d631e1
abhi2666/Striver-79
Arrays/floorInArray.cpp
class Solution{ public: // Function to find floor of x // n: size of vector // x: element whose floor is to find int findFloor(vector<long long> v, long long n, long long x){ int l = 0, h = n-1; // we have to find the largest element smallest than x int mid, ans = -1; w...
ALGO
0.999948
5.497479
8affc91e-ec06-49cd-9516-7f92cc649fd1
Readiz/BOJ
boj/1748/solution/main.cpp
#include <bits/stdc++.h> using namespace std; #define _D(...) #define FOR(i,a,b) for(int i=(a); i<(b); ++i) typedef long long ll; bool chk(int v) { while(v) { if (v % 10 == 1) { if (v / 10 == 0) return true; return false; } else if (v % 10 != 0) { return false; ...
ALGO
0.999785
4.23458
9ce94c9d-df43-49e4-9b04-eb93ebd525c7
aabhas-sao/DSA-CB-CPP
binary_search/cb_scholarship.cpp
#include<iostream> #include<climits> using namespace std; #define long long ll bool canGiveScholarship(ll n, ll mid, ll m, ll x, ll y) { ll coupons = m + (n - mid) * y; return mid * x <= coupons; } void cb(ll n, ll m, ll x, ll y) { ll s = 0; ll e = n; ll ans = ll_MIN; ll mid; while(s <= e) ...
ALGO
0.999809
3.828018
323a6408-03c3-42ff-ab93-2d7da86cc1a7
mdakram2002/DSA
BinarySearch/peakIndex_MountianArray.cpp
/* Problem Statmente:- 852. Peak Index in a Mountain Array. {LeetCode} Let's call an array arr a mountain if the following properties hold: arr.length > 3 There exists some i with 0 < i < arr.length - 1 such that: arr[0] < arr[1] <... arr[i-1] < arr[i] arr[i] > arr[i+1] > ... > arr[arr.length - 1] Given an integer...
ALGO
0.999976
5.285801
ed13b8c4-d3c1-4a35-8438-cf42dacd83e6
Welsoon/Problem_solving
solving_HW7/main.cpp
#include "NodeRecognition.h" #include "TreeConstruct.h" using namespace std; int main() { bool exercise_1 = true; if(exercise_1) { //------------------------------------------------------------------------------- NodeRecognition P; getline(cin, P.input); P.cutInPut(); ...
ALGO
0.998694
3.629733
0a049c74-ee07-40d1-a500-cfc6d2449c2e
OsrHu/algorithm
pat/2019-09/1162_Postfix_Expression.cpp
#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 30; int n; int l[N], r[N]; string w[N]; bool has_father[N]; bool f = true; string dfs(int u) { string res; if(u == -1) { return ""; } res = "(" + res; if(l[u] == -1 && r[u] != -1) { ...
ALGO
0.999936
4.042064
62b2f34a-0156-4ef6-8d3d-abf3465f4b6c
JALABIT12/CppTest
C++실습문제/C++실습문제.cpp
#include<stdio.h> #include <iostream> #include <stdlib.h> #include <math.h> #include <conio.h> #include <time.h> #include <string.h> typedef struct { char name[10]; int kor; int eng; double tot; double avg; } STU; void SWAP(void* a, void* b, int op) { if (op == 1) // char { char c = *(char*)a; *(char*)a = ...
ALGO
0.99691
3.694831
501cec6d-ff5e-4682-b25f-592d2444fd64
SohamAdhikary/LLM-Red-Teaming-Dashboard
numpy-1.25.2/numpy/core/src/npysort/heapsort.cpp
/* -*- c -*- */ /* * The purpose of this module is to add faster sort functions * that are type-specific. This is done by altering the * function table for the builtin descriptors. * * These sorting functions are copied almost directly from numarray * with a few modifications (complex comparisons compare the im...
ALGO
0.999537
6.691545
3cd51038-fd92-4ea2-817e-b74cf5359ab7
ishandutta2007/codeforces
aaaaajack/normal/1326/D1.cpp
#include<bits/stdc++.h> #define N 200100 #define Q 998244353 #define sz(x) (x).size() #define rep(i,a,b) for(int i=a; i<(b);i++) using namespace std; typedef vector<int> vi; array<vi, 2> manacher(const string& s) { int n = sz(s); array<vi,2> p = {vi(n+1), vi(n)}; rep(z,0,2) for (int i=0,l=0,r=0; i < n; i++) { int...
ALGO
0.999996
5.339422
9f063f89-e8df-48d4-87c6-e1607e4f29c7
falcaoanderson/CompetitiveProgramming
OBI/obi-2020-tres-por-dois.cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5+10; int n, v[MAXN]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i=1; i<=n; i++) cin >> v[i]; sort(v+1, v+n+1); int total=0; for(int i=n; i>=1; i-=3){ total += v[i] + v[i-...
ALGO
0.999836
4.190267
1e8baf0d-233f-49f7-a258-1bd16a9f459f
harry7557558/Graphics
numerical/debug/_exp_travelling_salesman.cpp
// try simulated annealing for combinatorial optimization // algorithm introduced in Numerical Recipes // standard traveling salesman problem, the cost is the sum of Euclidean distances // the code can be optimized a lot in time without changing the result, // however, since most of the time used by the program is wr...
ALGO
0.999996
6.558297
c0523efe-4a13-402e-bd1b-75d1cdc80609
LargerPanda/LoomIO
src/boost/libs/geometry/example/03_polygon_example.cpp
// Boost.Geometry (aka GGL, Generic Geometry Library) #include <algorithm> // for reverse, unique #include <iostream> #include <string> #include <boost/geometry/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/adapted/...
TOOL
0.991865
7.843921
ce2080c0-2caa-445d-b5db-5f936b4d535b
matcher9131/AtCoder-Repo
recommend/old/abc242d/main.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <iomanip> #include <cmath> #include <climits> #include <cfloat> #include <utility> #include <map> #include <set> #include <stack> #include <queue> #include <unordered_map> #include <unordered_set> #include <cassert> #include <numeric>...
ALGO
0.99998
4.801253
936c3339-57c2-46a6-a267-88297cad8236
anujak1802/C-
knapsack.cpp
#include <bits/stdc++.h> using namespace std; int knapsack(int value[],int w[],int n,int W) { if(n==0 || W==0) { return 0; } if(w[n-1]>W){ return knapsack(value,w,n-1,W); } return max(knapsack(value,w,n-1,W-w[n-1])+value[n-1],knapsack(value,w,n-1,W)); } int main() { int W,n...
ALGO
0.999998
4.275384
c2dee205-d0f3-47fc-85e4-a6e00d0689ae
GuoWeiSJTU/spring
SigSlotBubbleSortStu/main.cpp
#include <boost/thread/thread.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <iostream> #include <boost/signals2.hpp> using namespace boost::signals2; using namespace std; class Student { public : int stuID; int stuScore; Student(){}; Student(int id,int score) { this->stuID = id; this->s...
ALGO
0.932364
4.497971
8999bce3-f619-4a07-9b5f-c06ee3393cba
ravenblackhart/ImageProcessing
opencv/sources/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp
/** * @function generalContours_demo2.cpp * @brief Demo code to obtain ellipses and rotated rectangles that contain detected contours * @author OpenCV team */ #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include <iostream> using namespace cv; using namespace std;...
ALGO
0.99744
7.738669
badcd955-0245-4379-aa2a-021b7fcd5224
P41NT/Competitive-Programming
Codeforces/1404A_BalancedBitstring/A. Balanced Bitstring.cpp
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define int long long int void solve() { int n, k; cin >> n >> k; vector<char> s; string temp; cin >> temp; for (char c : temp) s.push_back(c); vector<char> required(k); for (int i = 0; i < k; i++) required[i] = s[i]; ...
ALGO
0.999986
4.491683
20f3186e-b4cf-4d7e-8951-8969db99ac6a
XiaoXiaoLui/CodeForces
Round365/D.cpp
#include <iostream> #include <cstdio> #include <vector> #include <set> #include <map> #include <algorithm> #include <string> #include <cmath> #include <cstring> #include <queue> using namespace std; #define pii pair<int, int> #define mp make_pair<int, int> typedef long long ll; struct Query { int left; int right;...
ALGO
0.999992
4.458552
3ab27ad5-7036-4ba9-b2dc-54deff6864b6
realShinchoku/TTUD
sumnm/sumnm.cpp
#include <iostream> #include <vector> using namespace std; int N,m; void printVector(vector<int> &arr) { if (arr.size() == m) { cout << N << " = "; for (int i = 0; i < arr.size()-1; i++) { cout << arr[i] << "+"; } cout << arr[arr.size()-1] << endl; } } ...
ALGO
0.999932
3.568459
2c3ca445-fdfe-4a78-8612-b236c84e2655
artiste-qb-net/OpenPNL
c_pgmtk/tests/src/AGetParametersTest.cpp
PNL_USING static char func_nameBNet[] = "testGetFactorsBNet"; static char func_nameMNet[] = "testGetFactorsMNet"; static char func_nameMRF2[] = "testGetFactorsMRF2"; static char* test_desc = "Checks if the params returned are on the subdomain"; static char* test_class = "Algorithm"; int NodesInParamDomain( int num...
TEST
0.850673
5.801356
3f4347cb-c10d-45fa-8475-4de3a1ce0c35
tsawke/OI
Exams/Exam-2022_09_19/show/show.cpp
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define PI M_PI #define E M_E #define npt nullptr #define SON i->to /****************************** abbr ******************************/ using namespace std; mt19937 rnd(random_device{}()); int rndd(int l, int r){return rnd() % (r - l + 1) + l;} typedef unsigned ...
ALGO
0.99956
3.91823
10058667-d4be-4f9c-946d-d810ed2a3b8c
kdh01517/Coding_example
bfs/2178.cpp
#include <bits/stdc++.h> using namespace std; #define X first #define Y second int dist[102][102]; int n, m; string board[102]; int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for(int i = 0; i < n; i++) cin >> board[i]; for...
ALGO
0.999864
4.192513
e2ed0b7e-173b-49ca-821b-0c9ee9c54dc0
ishandutta2007/codeforces
lhic/normal/750/F.cpp
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> #define mp make_pair #define pb push_back typedef long long ll; typedef long double...
ALGO
0.999617
3.275805
27bdc201-7ad0-432d-af6a-653e8c7c0241
harshitsuthar77731/striverSheet
Recursion/40. Combination Sum II.cpp
class Solution { public: vector<vector<int>>v; void fun(vector<int>& can,int ind, int target,int sum,vector<int>&temp){ if(ind<=can.size()&&sum==target){ v.push_back(temp); return; } if(ind==can.size()) return; if(s...
ALGO
0.999994
6.20667
de82102f-0ffb-45bc-94b5-090925144ad6
praveenmehta010/dsa-c
Q1/LinkedListStack.cpp
#include <iostream> using namespace std; class Node{ public: int key; Node* next{}; }; class LinkedListStack { private: Node* listfront{}; Node* listend{}; public: void push(int); void pop(); int peek(); bool isEmpty(); }; void LinkedListStack::push(int key){ Node* temp; t...
ALGO
0.997083
4.156807
00494aa6-bf10-4c49-81d0-cbc4ff17bbf7
raincross7/code-similarity
codes/train_code/problem353/problem353_237.cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n, ans = 0; int a[maxn]; unordered_map < int, pair < int, int > > cnt; signed main () { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); if (i & 1) ++cnt[a[i]].first; else ...
ALGO
0.999967
3.701749
05d6d29a-7d89-425f-a742-0ea38b0fd836
DexterSamir/CodeVentures
Codeforces/Practice/152A Marks.cpp
#include <bits/stdc++.h> using namespace std; //Author: Ezio Sam /* Shorthands */ #define ll long long #define pb push_back #define em emplace_back #define mp make_pair #define sp " " #define cs "Case " #define fi first #define sn second /* STL */ #define mem(a,n) memset(a, n, sizeof(a)); #define all(x) x.begin(),x....
ALGO
0.999957
3.177489
020a07b2-f017-4cd2-956d-654de866b202
KwonSunwon/Algorithm
BAEKJOON/10798.cpp
/* 세로읽기 B1 https://www.acmicpc.net/problem/10798 */ #include <iostream> #include <string> #include <array> using namespace std; int main() { cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false); array<array<char, 15>, 5> words; for (auto& word : words) { for (auto& alpha...
ALGO
0.990476
4.162019
a7b818be-dc94-434c-989a-ca6a96e3c7d0
starrydeca/luoGu
算法2-4_字符串/01/1.cpp
#include <iostream> using namespace std; const int maxl = 1e6 + 7; string a, b; int kmp[maxl]; void getkmp() { // 字串的next数组 for (int i = 1, j = 0; i < b.size(); i++) { while(j && b[i] != b[j]) j = kmp[j - 1]; if (b[i] == b[j]) j++; kmp[i] = j; } } void KMP() { for (int i = 0, j = 0; i < a.size(); i++) { // 匹...
ALGO
0.999921
4.408991
021fe488-3bdf-468d-ad7c-3b1eea149fe9
KrSOURAV250/Data-Structures-and-Algorithms
Queue.cpp
#include <iostream> using namespace std; class queue { public: int frontIndex = -1, backIndex = -1, size; int *arr; }; void display(queue *q) { for (int i = q->frontIndex + 1; i <= q->backIndex; i++) { cout << q->arr[i] << " "; } } bool isEmpty(queue *q) { if (q->backIndex == -1 && q->ba...
ALGO
0.998963
4.472051
8c96d8c3-5b05-4491-90b3-b041ebbccb34
tauhrick/Competitive-Programming
Contests/Codeforces/CF-R2-297/b.cpp
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return '"' + s + '"'; } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typenam...
ALGO
0.999997
4.073619
2459fc91-b2c2-48d8-aa5c-cdaf660904ec
anj20/CsesProblems
planetcycleII.cpp
#include <iostream> #include <queue> using namespace std; void dfs(int planet); bool visited[200000]{}; int destinations[200000]; int pathlength[200000]{}; queue<int> path; int steps = 0; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> destinations[i]; destinations[i]--; } for (int i = 0; ...
ALGO
0.999977
4.188592
e622a2b8-6deb-4c58-8434-35c51fe9723a
tootoonchian/tasvir
apps/cyclades/examples/SimpleLeastSquares.cpp
// Make: make simple_ls // Sample run: ./simple_ls --sparse_sgd --n_epochs=10 --learning_rate=1e-1 --print_loss_per_epoch --hogwild_trainer --n_threads=1 --data_file='./examples/simple_ls_data' #include <iostream> #include <vector> #include "../src/run.h" #include "../src/defines.h" /* Minimize the equation sum (a_i...
ALGO
0.938026
5.745653
0c7bb975-5460-4aea-a43d-97e39b323b17
raincross7/code-similarity
codes/train_code/problem063/problem063_208.cpp
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; vector<int> a; bool ok[1000010]; bool check_pairwise() { for (int i=1;i<=1000000;i++) ok[i] = true; for (auto x: a) { if (x==1) continue; if (...
ALGO
0.999764
4.48833
93cff2a1-bdb6-4de7-ac1f-8c97e225998f
kavi26/algo-dir
universal_sink.cpp
#include<iostream> using namespace std; /* Universal Sink Application:- source: http://techinterviewsuncovered.blogspot.in/2008/12/universal-sink-problem-basic.html The problem is that in a party of n people there is a celebrity whom everybody knows, and who does not know anybody. You can ask only this question to a ...
ALGO
0.999402
4.382655
0344c185-cb32-4caf-bee4-bea2b39f822d
dhlee130/computer-graphics
lab3/hw20143085/main.cpp
// hello_world.cpp #include <GL/glew.h> #include <GL/freeglut.h> #include <iostream> #include <fstream> #include <cstdlib> #include <ctime> #include <vector> #include "vec.hpp" #include "mat.hpp" #include "transform.hpp" void init(); void mydisplay(); void myidle(); float position[16] = { 0.5f, 0.5f, 0.0f, 1.0f, -0...
TOOL
0.860561
4.237835
9cd7868f-a88f-4368-aa81-5e1f6f9968ea
gvp-yamini/DataStructuresAlgorithms
DreamsDontWorkUnlessYouDo/hungry/prob1.1/prob1.1/RangeSumQuery.cpp
#include "stdafx.h" #include "stdio.h" #include "conio.h" #include "malloc.h" int sumRange(int *,int ,int ); void main(){ int arr[7] = {-2,0,3,-5,2,1}; int rangesum = 0,i=0,j=3; rangesum = sumRange(arr,i,j); printf("sum is: %d",rangesum); getch(); } int sumRange(int *arr,int i,int j){ int *dp; dp = (int *)malloc...
ALGO
0.997719
3.773905
c6c5c6a2-ae14-4a3d-9cb5-f2006297a951
Deven-Codes/CS106B_Assignments
Assignment 1/perfectNumber/perfectNumber/perfectNumber.cpp
/* * Project: perfectNumber * Created by CS106 C++ Assignment Wizard 0.1 * * This program finds out the perfect number between 1 tp 10000. * using N = (2^(p-1))(2^p -1) where p is a prime for which 2p -1 is a Mersenne prime. * * Name: Deveneder Singh * Section: [TODO: enter section leader here] * [TODO: Descri...
ALGO
0.999109
4.028553
444475a9-5189-473c-b4b7-5d3f630545f8
nolan0801/Competitive-Programming
VNOJ/mclean.cpp
/* Author : vidut_206_CNH */ #include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pb push_back #define gcd(a,b) (__gcd(a,b)) #define lcm(a,b) (a/gcd(a,b)*b) #define sz(x) (int)(x.size()) #define fast_cin() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #...
ALGO
0.999926
4.242375
4bd5a7de-2e68-464b-8e64-6a3a79eeed46
DebeshMondal/C-language-
BG Sir C programes/funtion_factorial.cpp
#include<stdio.h> int factorial(int n){ if (n==0){ return 1;} else{return n*factorial(n-1); } } int main(){ int number,result; printf("Enter the number:"); scanf("%d",&number); result=factorial(number); printf("The factorial of the no.%d is %d\n",number,result); return 0; }
ALGO
0.999918
3.01139
3b359166-d59a-4ec3-8830-ae2f9d62debe
flskhhdf/boj_algorithm
7576-1.cpp
#include "iostream" #include <queue> using namespace std; int main(){ queue<pair<int,int>> q; int n,m,map[1000][1000],offset[4][2] = {{-1,0},{0,1},{1,0},{0,-1}},cnt=0; int visit[1000][1000]={0}; cin >> m >> n; for(int i = 0; i<n; i++){ for(int j = 0; j<m; j++){ cin >> map[i][j]; if(map[i][j] == 1) q.push(...
ALGO
0.999739
3.474152
aa8f2183-44a5-43c7-93dc-8d0b4867c99c
ishandutta2007/codeforces
turmax/normal/1528/E.cpp
#include <bits/stdc++.h> using namespace std; #define int long long const int p=998244353; const int maxn=1e6+5; int dp[maxn]; int dp1[maxn]; int dp2[maxn]; int pr2[maxn+1]; int po(int a,int b) { if(b==0) return 1; if(b==1) return a; if(b%2==0) { int u=po(a,b/2); return (u*u)%p; } ...
ALGO
0.999975
4.688122
89dd455e-d697-4941-bf41-78e3d61bfb1b
Kimjimmy/Algoritm
BOJ/repeatPermutation.cpp
#include<iostream> #include<vector> #include<algorithm> #include<string> using std::cin; using std::cout; using std::vector; char arr[] = { 'a','b','c','d' }; vector<char> vec(3); int n = 4; void r_permutation(int k, int r) { if (k == r) { for (int i = 0; i < r; i++) { cout << vec[i] << " "; } cout << '\n...
ALGO
0.999109
3.342707
b533d649-c6d3-4dfe-990a-e4c1bfdffa54
wxharry/MyLeetCode
visa.cardinality-sorting.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector<int> cardinalitySorting(vector<int>& nums){ sort(nums.begin(), nums.end(), [](int a, int b){ int counta=0, countb=0; while (a) { counta += a&1; a >>= 1; } while (b...
ALGO
0.999977
4.985859
952cb34b-4739-49ed-b6af-699f1fee00fb
NVlabs/timeloop
src/sparse-analysis/sparse-analysis.cpp
#include "loop-analysis/coordinate-space-tile-info.hpp" #include "sparse-analysis/sparse-analysis.hpp" #include "mapping/loop.hpp" namespace sparse { void SetPointSetTileRepresentations(const SparseAnalysisState& state, tiling::CompoundDataMovementNest& compound_data_movement_nest)...
TOOL
0.953489
6.074281
3d951751-caf5-4adb-a92e-151252fbef26
sulovm/UP2017
Homeworks/Homework4/zad2.cpp
#include <iostream> #include <cstring> using namespace std; bool moreLettersThanOthers(const char* s, int &numOfLetters) { numOfLetters = 0; int n = strlen(s); for (int i = 0; i < n; i++) { if (s[i] >= 'a' && s[i] <= 'z' || s[i] >= 'A' && s[i] <= 'Z') { numOfLetters++; ...
ALGO
0.998705
5.120874
8717c56e-aa3a-4f06-bef9-664d3725d3a8
RhesusP/Piscine_CPP
module_02/ex03/main.cpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.cpp :+: :+: :+: ...
ALGO
0.91156
4.79238
a198fc18-55b3-40a0-bc1d-914619cebb07
shashikantpawar21/DSA-practice
5-Recursion/CodeHelp/31-Recursion-I/4-Print_Counting.cpp
#include<iostream> using namespace std; // I/p --> 5 // o/p --> 5 4 3 2 1 // base case return on 0 // recursive print value and then call fn(n-1 ) void printCount(int n ) { if(n ==0) return; cout << n << " "; printCount(n - 1); } int main() { int n = 10; printCount(n); cout << ...
ALGO
0.999839
5.386129
4d297c93-4598-4a24-93e4-ec11409d104a
Arvln/LeetCode
DFS/78.Subsets/78.Subsets.cpp
class Solution { vector<vector<int>>rets; vector<int>path; public: vector<vector<int>> subsets(vector<int>& nums) { dfs(nums, 0); return rets; } void dfs(vector<int>&nums, int i) { rets.push_back(path); for (int j=i; j<nums.size(); j++) { path...
ALGO
0.999911
6.047009
1ceaf55b-4a06-43e0-b51d-66464948b1f5
omanshu23/temp1
10_02_5.cpp
// First repeating element (Amazon, Oracle) #include<iostream> #include<climits> using namespace std; int main() { int n; cin>>n; int a[n]; for(int i=0; i<n; i++){ cin>>a[i]; } const int N = 1e6+2; int idx[N]; for(int i=0; i<N; i++){ idx[i] = -1; } int minidx ...
ALGO
0.999964
4.048483
978a9900-686d-4196-8fe2-8d89952dc5cc
ZoruaSama/Solutions-4-Luogu-Problems
P6242/main.cpp
#include <iostream> #include <cstdio> using namespace std; const int maxn=2e5+10; struct t{ int v,maxt,mint; int l,r; int la; int lmin; }T[maxn*4]; short data[maxn]; int n,m; string s; int len(int x){ return T[x].r-T[x].l+1; } void update(int x){ T[x].v = T[x<<1].v + T[x<<1|1].v; } void build(in...
ALGO
0.999931
4.192077
e40da2f4-f002-4739-a66d-083c14c113cf
hrithik86/algorithm
kmpSearchAlgo.cpp
// KMP Algorithm #include <bits/stdc++.h> using namespace std; void computeLPS(int lps[], string pat, int m){ int len=0; int i=1; while(i<m){ if(pat[i]==pat[len]){ lps[i]=len+1; i++; len++; } else{ if(len==0){ lps[i]=0;...
ALGO
0.999962
5.90169
08fae60f-755e-4c8f-9cbf-b140fb7354d1
CodeCamper-Sub/Problem_Solving
atCoder/Beginner/281/E/main.cpp
#include <bits/stdc++.h> #define INF 999999999999 typedef long long ll; using namespace std; ll n, m, k, sum; ll arr[200200]; multiset<ll, greater<ll>> least; multiset<ll> remain; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m >> k; for(ll i = 1; i <= n; i++) { cin >...
ALGO
0.999993
3.526954
0074c6f3-cf6e-4be8-905b-d3a1bdf982b5
IVI0narch/Cpp
dynamic/deadlines.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int Salary(vector<vector<int>> v, int sum, int day) { int m = sum; vector<vector<int>> v_copied; v_copied = v; for (int i = 0; i < v.size(); ++i) { if (v[i][0] <= day) v.erase(v.begin() + i); } ...
ALGO
0.999975
5.017035
a614ba26-6a42-46ce-a307-7c599fe72202
ArkadiuszStanislawLega/leetcode
301223/main.cpp
#include <iostream> #include <ratio> #include <string> #include <vector> #include <algorithm> #include <cassert> #include <chrono> using namespace std; using namespace std::chrono; class Solution { private: int memoization(int n, vector<int>& counter){ if(n <= 1) return 1; if(counter[n] != -1) return cou...
ALGO
0.99625
6.023032
fac680a3-ef8e-4eb2-b2fe-b6e207063ade
ShrutikaM25/LP5
HPC/Mini_Project.cpp
#include <iostream> #include <vector> #include <string> #include <omp.h> // Define the Employee structure, representing a row in our "Employees" table struct Employee { int id; std::string name; int age; }; // Simulate a simple "Employees" table with some sample data std::vector<Employee> table = { {1...
ALGO
0.988782
4.238425
f80c990a-4def-412c-94c0-8b12d4f1799a
Justdwiwt/Cpp_basic
src/leetcode/15.cpp
#include <vector> #include <unordered_map> #include <algorithm> #include <map> using namespace std; class Solution { public: vector<vector<int>> threeSum(vector<int> &nums) { vector<vector<int >> res; sort(nums.begin(), nums.end()); if (nums.size() < 3 || nums.front() > 0 || nums.back() < ...
ALGO
0.999933
5.350638
057e4801-6c8d-4556-9175-b3e2096e5e3b
CTRoundTable/Encrypted.Cash
src/zcash/NoteEncryption.cpp
#include "NoteEncryption.hpp" #include <stdexcept> #include "sodium.h" #include <boost/static_assert.hpp> #include "prf.h" #define NOTEENCRYPTION_CIPHER_KEYSIZE 32 void clamp_curve25519(unsigned char key[crypto_scalarmult_SCALARBYTES]) { key[0] &= 248; key[31] &= 127; key[31] |= 64; } void KDF(unsigned c...
TOOL
0.981948
6.992135
10e74d79-be91-4bf7-bc31-05c34b0dbdb0
nazariyg/Qcore
Qcore/Mathematics/QIntegerFactorization.cpp
#include "QIntegerFactorization.h" #include "QArray.h" #include "QSortUtils.h" using namespace Q; //------------------------------------------------------------------------------------------------------------------ IntegerFactorization::IntegerFactorization (int iNumber) : m_iNumber(iNumber) { assert( iNum...
ALGO
0.999401
4.367435
de43e00f-7624-48f6-92ea-b6a1b3ad2686
boyboy007000/Cryptography
cryptopp-CRYPTOPP_8_5_0/scrypt.cpp
// scrypt.cpp - written and placed in public domain by Jeffrey Walton. // Based on reference source code by Colin Percival for // Scrypt and Daniel Bernstein for Salsa20 core. #include "pch.h" #include "scrypt.h" #include "algparam.h" #include "argnames.h" #include "pwdbased.h" #include "std...
ALGO
0.95535
6.138616
e22cd558-348b-4540-ab5f-8e610633da9d
myselflabib/SolutionVault
CSES/Introductory_Problems/Missing_Number.cpp
#include<bits/stdc++.h> using namespace std; int main(){ long long int N; cin >> N; long long int allSum, withoutSum = 0, Num; allSum = (long long)(N*(N+1))/2; for (int i = 0; i < N-1; i++) { cin >> Num; withoutSum += Num; } cout << allSum-withoutSum <<endl; r...
ALGO
0.99986
3.270133
62c9cf8f-4bef-44df-82a0-cfbffd134506
shenxs/ACM
zjutOJ/母牛问题2.cpp
#include<iostream> using namespace std; int main() { long long int a[106]={1,1,1,2,2,3}; for (int i=6;i<=105;i++) { a[i]=a[i-1]+a[i-5]; } int n; while (cin>>n) { cout<<a[n]<<endl; } return 0; }
ALGO
0.999665
3.074737
cae1c1c2-0845-4950-8f5a-300290a09a6c
sirAdarsh/CP-files
codechef/SSEC0006.cpp
/*----- || Hare Krishna || -----*/ /* "WHY DO WE FALL, BRUCE?" */ //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") #include<bits/stdc++.h> #define ll long long #define endl '\n' #define elif else if #define pb push_back #define pf push_front #define PI 3.1415926535897932384 #define MOD 10000000...
ALGO
0.999928
3.589939
43a68389-ee18-4fee-a7ff-c5b3c4895769
TirolJPN/competitive_programming
contest/ABC334/c.cpp
#include <iostream> #include <deque> #include <algorithm> #include <vector> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) int main() { cin.tie(0); ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; vector<int> cnt(n, 2); rep(i,k) { int a; cin >> a; a--; cnt[...
ALGO
0.999927
3.938391
f61b3215-d5ca-4032-807b-04bc2e6000e2
Xuding0829/CompetitiveProgramming
Src/Luogu/P5742.cpp
#include <bits/stdc++.h> using i64 = long long; struct node { int id; double sc1, sc2; int score; double final_score; } a[1000]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> a[i].id ...
ALGO
0.999246
4.546329
1ba39d19-883a-4859-8062-dfc6045dfe75
jailsonevora/yandex-cpp-for-competitive-programming
Yandex 2.1/C.EvaluateLogicalExpression.cpp
#include <iostream> using namespace std; int main(){ int a,b,c; cin >> a >> b >> c; cout << ( ( !(a && b || c) || (b || (!a)) ) && ( ((!c) && (!b)) && !(b || (!a) || c) ) ) << "\n"; }
ALGO
0.999806
3.394129
729bd239-f3ac-4262-b750-2a208d0d7e28
kimhyeyun/Baekjoon
입출력/입출력/11721.cpp
#include<iostream> #include<stdio.h> using namespace std; int main() { string str; cin >> str; for (int i = 0; i < str.size(); i++) { printf("%c", str[i]); if ((i + 1) % 10 == 0) printf("\n"); } }
ALGO
0.999626
3.994763
c9a5c6ae-0cea-45f8-9d51-24d4aec92371
VIRAJcHOPADE/A2Z
Basic of Recursion/Print N to 1 without loop.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: void printNos(int N) { // code here cout<<N<<" "; if(N==1){ return; } printNos(N-1); } }; //{ Driver Code Starts. /* Driver program to test ...
ALGO
0.999646
6.054861