uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
9fe182e9-cc19-4036-85e0-563526f076c7
asceznyk/loc
leetcode/684.cpp
class Solution { private: int start = -1; bool *cycle, *visited, found{}; void dfs(vector<int> graph[], int cur, int prt=-1) { if(visited[cur]) { start = cur; found = true; return; } visited[cur] = true; for(auto child: graph[cur]) { if(child == prt) continue; if(!found) dfs(graph, child, ...
ALGO
0.999972
5.602976
99ed4099-9495-453a-915e-886cc7991f8d
ShashimaniDwivedi/CPP-Codes
callfunc.cpp
#include <iostream> using namespace std; int sum(int a, int b) { int c = a + b; return c; } // Call by reference using pointers void swapPointer(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } // Call by reference using C++ reference Variables void swapReferenceVar(int &a, int &b) { int temp = a; ...
ALGO
0.995652
6.296925
4a27b81b-c37e-443f-8416-b79b110427cf
Madiyar09/Algos
Graphs/FordFulkerson.cpp
/******************************************************************************** MaxFlow Ford-Fulkerson algorithm. O(M|f|), |f| - maxflow value Based on problem 2783 from informatics.mccme.ru http://informatics.mccme.ru/mod/statements/view3.php?chapterid=2783#1 ***************************************************...
ALGO
0.999969
4.690456
bb9a12f4-54cf-4137-9d71-302291bfcb77
Xan-ca/CF-Submissions
Practice-C/P86.cpp
#include<bits/stdc++.h> using namespace std; #define inf 10000000 #define lli long long #define lld long double #define vli vector<long long> #define vld vector<long double> lli dp[3]; int add(lli x,lli a){ if(x<a)return 1; else if(x>a)return -1; else return 0; } void solve(){ lli n; cin>>n; dp[0]=0; dp[1]=-n; ...
ALGO
0.999852
3.889037
0875622e-564c-4fb4-aa6c-2b4c0c53e212
atuljha381/Algorithm-Implementation
Power_algo.cpp
#include<iostream> using namespace std; int Power(int a,int b) { int Res=1; while(b>0) { if(b%2!=0){ Res=Res * a; b-=1; } else{ b=b/2; a*=a; } } return Res; } main() { int x=2,y=8; cout<<Power(x,y); }
ALGO
0.999864
4.571989
7ce5eb27-c09f-46ac-8235-69bd6038a715
sivatejachigicherla/Android-SDKs-for-Unity
NDK/sources/cxx-stl/llvm-libc++/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
// <random> // template<class IntType = int> // class negative_binomial_distribution // template<class _URNG> result_type operator()(_URNG& g); #include <random> #include <numeric> #include <vector> #include <cassert> template <class T> inline T sqr(T x) { return x * x; } void test1() { typedef std::negati...
TEST
0.872909
6.312136
31236b0b-a87f-4a17-86a3-323655ed558e
TengFeiyang01/Algorithm
casual/Training/AcWing849.cpp
#include <iostream> #include <algorithm> #include <string> #include <queue> #include <set> #include <functional> #include <vector> #include <cstring> #include <map> #include <unordered_map> #include <stack> #include <numeric> #include <cmath> #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), ...
ALGO
0.999978
4.649695
33896cd1-7154-443d-9798-daffc9e5c089
BoyanLiu-Bot/Summer
基本算法/求最大公约数问题-递归.cpp
/* ǵԼ һУ(<1,000,000,000) һԼ*/ #include<iostream> using namespace std; //շת int a,b,res; void f(int a,int b){ int z=a%b; if(z==0){ res=b; return; } else return f(b,a%b); } int main(){ cin>>a>>b; int x=max(a,b); int y=min(a,b); f(x,y); cout<<res<<endl; }
ALGO
0.999886
3.538912
57929b01-22d1-4bb2-954d-e2d110ef9ab7
ishandutta2007/codeforces
kostaskostil/normal/1396/B.cpp
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second using namespace std; const int nmax=1e6+100; typedef long long ll; #define int ll main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int qqq; cin>>qqq; for (int iii=0; iii<qqq; iii++) { ...
ALGO
0.999328
3.401242
768fc4f6-68b3-46e1-a632-beb6e52efd13
GustiG/Programming_Principles_and_Practice_Using_Cpp
012_coins.cpp
#include <iostream> using namespace std; int main() { int pennies, nickels, dimes, quarters, half, ones; double total; cout << "pennies: "; cin >> pennies; cout << "nickels: "; cin >> nickels; cout << "dimes: "; cin >> dimes; cout << "quarters: "; cin >> quarters; cout << "h...
TOOL
0.948479
5.027687
014abe1e-fafa-47c5-b335-0330c7589c36
AaronNGray/GenomeWorkbench
src/algo/winmask/seq_masker_score_mean_glob.cpp
#include <ncbi_pch.hpp> #include <algo/winmask/seq_masker_score_mean_glob.hpp> #include <algo/winmask/seq_masker_window.hpp> BEGIN_NCBI_SCOPE //------------------------------------------------------------------------- void CSeqMaskerScoreMeanGlob::PostAdvance( Uint4 step ) { if( step%window->UnitStep() ) { ...
ALGO
0.929969
5.623729
1718e17c-c2c8-484a-843c-19636b1db1b6
plumkewe/scuola
Libro/Esempi/A4_la-programmazione-strutturata/82.cpp
#include <iostream> using namespace std; // int main() { setlocale(LC_ALL, "italian"); int a, b; double soluzione; cin >> a; cin >> b; if (a != 0) { soluzione = (double) b/a; cout << "La soluzione è " << soluzione; } else if (b != 0) cout << "L'equazione non ammette soluzioni"; e...
ALGO
0.99949
4.665929
2af4365f-3fc9-4d5a-9604-83435ef70bbc
IvanPopme/-Labs_PSTU_2024
2_sem_labs/Sort./Sort_Viborov.cpp
#include <iostream> using namespace std; int main() { int tmp; int n; cin >> n; int arr[n]; int range_min, range_max; range_min = 2; range_max = 412; for (int i = 0; i < n; i++) { arr[i] = ((double)rand() / RAND_MAX) * (range_max - range_min) + range_min; cout << arr[i] << " "; } cout << endl; int mi...
ALGO
0.99996
3.464931
0ea38ec4-89fd-417d-9fda-88a0e9cb2c76
Gambl3r08/ejercicios-C-
CalculoDNI.cpp
#include<iostream> using namespace std; int main(){ string const tablaDNI ="TRWAGMYFPDXBNJZSQVHLCKE"; int numeroDNI; cin>>numeroDNI; cout<<numeroDNI << "-" << tablaDNI[numeroDNI % 23]<<endl; }
ALGO
0.999777
3.959648
4b614844-abd5-46cf-8f97-732e29358cde
113bommy/deepmind_codecontests_refine
cpp_source_filter_file/cpp_train_12323_7.cpp
#include <bits/stdc++.h> using namespace std; int main() { char s[9]; bool ok = 1; for (int i = 0; i < 8; ++i) { scanf("%s", s); for (int j = 0; j < 7; ++j) { if (s[i] == s[i + 1]) ok = 0; } } puts(ok ? "YES" : "NO"); return 0; }
ALGO
0.999759
3.729814
1164c36c-dee6-41fc-8dab-2752e0cabf64
Raghavan098/competitive-programming
algos/xgcd.cpp
int xgcd(int a, int b, int &x, int &y) //Returns GCD of A, B { if(a==0) { x=0; y=1; return b; } int x1, y1; int d = xgcd(b % a, a, x1, y1); x = y1 - (b/a)*x1; y = x1; return d; }
ALGO
0.999622
4.429792
73ae1c20-5b36-4ae6-9edf-b712c2890e27
MinhThien1805/BT-C--
asd.cpp
#include<stdio.h> int nhap(){ int n; do{ printf("\nNhap n>0: "); scanf("%d",&n); }while(n<=0); return n; } void nhapmang(int a[], int n){ for(int i=1;i<=n;i++){ printf("A[%d]: ",i); scanf("%d",&a[i]); } } void xuatmang(int a[], int n){ printf("Mang vua nhap: "); for(int i=1; i<=n; i++){ printf("%5d",...
ALGO
0.999166
3.043405
895e473e-21d1-4247-9402-90c07af9d0b6
Algumithm/study
2025_June/June_1/gchomu_1.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int k; vector<int> arr; void combination(int cnt, int depth, vector<int> lotto) { if (cnt == 6) { for (int i = 0; i < 5; ++i) { cout << lotto[i] << " "; } cout << lotto[5] << "\n"; ...
ALGO
0.999486
4.472897
c298b157-3b3a-4adb-b9df-9aca08232083
Tomcruseal/dImageProcessor
include/boost_1_77_0/libs/sort/example/sample.cpp
// See http://www.boost.org/libs/sort for library home page. #include <boost/sort/spreadsort/spreadsort.hpp> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <vector> #include <string> #include <fstream> #include <sstream> #include <iostream> using namespace boost::sort::spreadso...
ALGO
0.996039
4.604353
209e669e-e92e-45c1-af9b-92a27489962e
Lqs66/boost_1_74_0
libs/math/example/lambert_w_diode_graph.cpp
/*! \brief Graph showing use of Lambert W function to compute current through a diode-connected transistor with preset series resistance. \details T. C. Banwell and A. Jayakumar, Exact analytical solution of current flow through diode with series resistance, Electron Letters, 36(4):291-2 (2000). DOI: doi.org/10.1049/...
ALGO
0.990532
6.069701
170993fe-c473-46cb-bad6-020f68f8da02
PedroDariva36/Desktop
Beecrowd/1362/a.cpp
#include <bits/stdc++.h> #include <map> #define ll long long #define endl '\n' #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back using namespace std; vector<vector<int>> capacity; vector<vector<int>> adj; int INF = 1e9; int bfs(int s, int t, vector<int>& parent) { ...
ALGO
0.999899
5.186094
5b2476d1-0421-4cfa-8335-1472987f259e
vorkey/pemrograman-dasar
praktikum7/array102a.cpp
// Ambadaya Gaman - C020324001 - Elektronika 1A // Jhonly Ardianto - C020324008 - Elektronika 1B #include <stdio.h> #define n 10 int main() { int A[n]; int i, min; printf("Input %i bilangan:\n\n", n); for (int i = 0; i < n; i++) { printf("Bil %i: ", (i + 1)); scanf("%i", &A[i]); } min = A[0]; fo...
ALGO
0.999878
4.425074
15e16e57-fd40-4b5b-bb3f-c77cd63a103b
fonte-nele/Competitive-Programming
URI Online Judge/uri1737.cpp
/*input 5 7 54782 0158309 12345678910 987654321 0 */ // URI 1629 - DescompactaFACE #include <bits/stdc++.h> using namespace std; #define f(inicio, fim) for(int i = inicio; i < fim; i++) #define fr(inicio, fim) for(int j = inicio; j < fim; j++) #define all(x) x.begin (), x.end () #define sz(x) (int) x.size () #define ...
ALGO
0.989983
3.741965
b5a289d6-ea0e-44a0-b7b5-00b39b50cb6e
tres-xxx/Codeforces-Exercises
F/1000-1099/1005F-BerlandAndTheShortestPaths(writerCodeforcesContestSolution).cpp
//this code is the solution posted by MikeMirzayanov on Codeforces's contest 496 solution #include <climits> #include <queue> #include <iostream> using namespace std; int main(){ int n,m,k; cin >> n >> m >> k; vector<vector<int>> g(n); vector<int> a(m), b(m); for(int i = 0; i < m; i++){ //paths ...
ALGO
0.999997
3.822536
0f2c02e8-53a1-4e56-ba50-1bed38ac8ff4
Jayeshkhandelwal09/DSA-QUESTIONS
Functions/Leetcode Question - Reverse Integer.cpp
#include <iostream> #include <climits> using namespace std; // // Leet Code Question - Reverse Integer; // Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. // Assume the environment does n...
ALGO
0.99987
5.719908
59e762df-cfb0-4f63-a836-a0676f856198
adit2005/LEETCODE-CPP-DSA-QUESTIONS
60-permutation-sequence/permutation-sequence.cpp
class Solution { public: string getPermutation(int n, int k) { int fact = 1; vector < int > numbers; for (int i = 1; i < n; i++) { fact = fact * i; numbers.push_back(i); } numbers.push_back(n); string ans = ""; k = k - 1; while (true) { ans = a...
ALGO
0.999989
6.567022
c06541e3-43dd-4dfb-ab56-64f45ff12bb0
prabhjotschugh/DSA-Solutions
0623-add-one-row-to-tree/0623-add-one-row-to-tree.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.999994
6.464176
8eab27f0-df3a-41b4-8d0a-704b9bd0071e
REEF3D/REEF3D
ThirdParty/eigen-3.3.8/unsupported/doc/examples/EulerAngles.cpp
#include <unsupported/Eigen/EulerAngles> #include <iostream> using namespace Eigen; int main() { // A common Euler system by many armies around the world, // where the first one is the azimuth(the angle from the north - // the same angle that is show in compass) // and the second one is elevation(the angl...
ALGO
0.993704
5.125681
bf89b313-214a-4b95-bf4f-c089ac71a16d
itsAadi1/CP
dms.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int c=0; for(int i=1;i<100;i++){ if(i%2==0 && i%3==0 && i%5==0) c++; } cout<<c; }
ALGO
0.999581
4.040789
9d3cbd82-53b5-4eca-a3b6-1a6cdaf55a1d
gvschaitanya93/Hacker-Rank
HackerRank-master/Algorithms/Implementation/utopian-tree.cpp
//utopian-tree.cpp //Algorithms - Warmup //Author: derekhh #include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int ans = 1; for (int i = 1; i <= n; i++) { if (i % 2 == 1) ans *= 2; else ans += 1; } cout << ans << endl; } return 0; }
ALGO
0.999841
4.984581
9ade60f5-308d-4692-a5c2-dc1003e99bc4
vfolunin/archives-solutions
LeetCode/2663.cpp
class Solution { string makeBeautifulString(string s, int from, char c) { s[from] = c; for (int i = from + 1; i < s.size(); i++) { for (char c = 'a'; 1; c++) { if (c != s[i - 1] && (i < 2 || c != s[i - 2])) { s[i] = c; break;...
ALGO
0.999983
5.848083
6f8aef5c-28c0-4e62-a8ac-5a193b6db344
fThAbhishek-Pandey/Data-Structure-And-Algorithm
dp/longcommonsubstringmoye.cpp
#include <iostream> #include<vector> using namespace std ; int f(string a, string b ,int i, int j){ if (i==a.size()|| j==b.size()) return 0; if (a[i]!=b[j]) { return max (f(a,b, i,j+1), f(a,b,i+1, j)); } else return 1 + f (a,b, i+1,j+1); } int main() { // I love Abhishek ji // cout << ...
ALGO
0.999955
4.388584
167e955f-cf38-4270-b926-606f1b490612
ziqi-zhang/TAOISM
Include/eigen/doc/examples/DenseBase_middleCols_int.cpp
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl; return 0; }
ALGO
0.975396
3.133398
866b848a-e658-4e62-8e5b-2e0457a62de7
mpawank/Decode-CPP-2.0-PW
06. Loops 02/writeAProgramToCountNumberOfDigits.cpp
#include "iostream" using namespace std; int main() { cout << "Enter The number Whose Number Of Digits You Want To Count :\n"; int n; cin >> n; int i, x = n; for (i = 0; x > 0; i++) x /= 10; if (n == 0) i = 1; cout << "\nThe Number Of Digits In " << n << " Is " << i << endl; }
ALGO
0.999624
4.603456
bebb56b5-c5c8-47d2-83ed-78648ef2e001
Lektor161/discrete-math
cf-grammar/A.cpp
#include <fstream> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> using namespace std; int main() { ifstream fin("automaton.in"); ofstream fout("automaton.out"); int n, m; char s; fin >> n >> s; char c, t1, t2; string p, word; map<pair<char, char...
ALGO
0.999952
4.546879
3e8a6606-6540-4f2b-a7c0-a9e4d2411d19
raincross7/code-similarity
codes/train_code/problem172/problem172_436.cpp
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define repr(i,a,b) for(int i=a;i<b;i++) #define rep(i,n) for(int i=0;i<n;i++) #define invrepr(i,a,b) for(int i=b-1;i>=a;i--) #define invrep(i,n) invrepr(i,0,n) #define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr) #define P pair<int,int> co...
ALGO
0.999947
4.216054
213ed3f3-aa15-4f4d-b11c-75802cea39da
CoderSubrota/dsa
queue/module-15.2/linkedList.cpp
#include <iostream> // Node class representing each element in the stack class Node { public: int data; Node* next; Node(int data) { this->data = data; this->next = nullptr; } }; // Stack class implemented using a singly linked list class Stack { private: Node* head; // Pointer to...
ALGO
0.998435
6.109199
b53b5354-8691-458c-bcec-c1f6ac246694
Adi2511/cse205-ds
assignments/18.10.2023/219.cpp
class Solution { public: bool containsNearbyDuplicate(vector<int>& nums, int k) { std::unordered_map<int, int> map; for (int i=0; i<nums.size(); i++) { if (map.find(nums[i])==map.end()) { map[nums[i]]=i; } else { ...
ALGO
0.999924
6.194
54d09294-c4a7-4340-a6da-3b788ff6a163
hzfsls/leetcode-supercrawl
data/0551.student-attendance-record-i/code_snippets/sol.cpp
class Solution { public: bool checkRecord(string s) { } };
ALGO
0.994757
3.820874
a8b72277-3717-45f2-b4f3-ee3ffc0a828b
algorithmstudy4/sw_test
YE_coding/백준 풀이/2610_회의준비.cpp
//백준 https://www.acmicpc.net/problem/2610 //회의준비 #include<iostream> #include<vector> #include<queue> #include<algorithm> #define MAX 1000 using namespace std; int parent[101]; bool group[101]; int Find(int n) { if (parent[n] == n) return n; else return parent[n] = Find(parent[n]); } void Union(int a, int b) { a ...
ALGO
0.999984
4.509797
1f417b0a-ee92-48a5-a8b4-80ba1e1c1968
sfirdous/LeetCode
ISSC75-2025/Medium/Problem73_SetMatricesZero/73.cpp
class Solution { public: void setZeroes(vector<vector<int>>& matrix) { int rowSize = matrix.size(); int colSize = matrix[0].size(); vector<int> row(rowSize,0); vector<int> col(colSize,0); for(int i = 0 ; i < rowSize; ++i){ for(int j = 0 ; j < colSize ; ++j){ ...
ALGO
0.99785
6.312982
c08f45a0-ba88-498e-8e8d-5a5874912c92
chaemon/atcoder-workspace
arc071/E/main.cpp
// #includes {{{ #ifdef MY_DEBUG #include "header/header.hpp" #else #include <bits/stdc++.h> #endif using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);++i) #define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i) #define LET(x,a) __typ...
ALGO
0.999229
3.225688
20b3899f-bea5-4563-92a2-908b66d8a162
Spielerr/Automated-Parallelization-of-Source-Code-using-Program-Comprehension
Phase2/Final_Demo/demo_4/testfile_demo_4.cpp
#include <parallel/algorithm> #include <parallel/numeric> #include <stdio.h> #include <stdlib.h> // Map Reduce Program to find distributed count // Given the batsmen scores from every match // in the Cricket World Cup, // find the frequency of the scores struct node_results { int score; int count; }; typede...
ALGO
0.999639
4.693032
eafdb705-051d-4d17-b4cf-9b6fc090bb3f
galileokim/CSES-Problem-Set
Introductory Problems/numberspiral.cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; for (int i = 0; i < t; i++) { long long int x,y; cin >> y >> x; if (x >= y) { if (x % 2 != 0) { long long int xpos = x * x; cout << xpos - y + 1 << endl; } else { long long int xpos = x * x - 2 * x + 2; ...
ALGO
0.999634
4.066982
e7ff2693-fdfd-4b24-b38e-940a9a321eb3
RiyaRoy06/Phitron-XPSC
Week 5/Day 6/Negetive and Positive.cpp
#include<bits/stdc++.h> #define ll long long int using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin>>t;while(t--){ ll n,k,c=0,p=0; cin>>n; vector<ll>a(n),b; for(ll i=0;i<n;i++) { cin>>a[i]; } for(ll i...
ALGO
0.999962
4.323871
84e1e83c-d4f5-4a83-9e5f-74132e916adb
comradez/Pseudo-LOGO-Interpreter
source/expression.cpp
#include <cctype> #include <cstring> #include <cmath> #include <string> #include <ctime> #include <random> #include "variable.hpp" #include "error.hpp" #include "expression.h" using namespace std; namespace expression{ char a[105]; int isop[305],CUR; bool VALID=1; int rand(){ static mt19937_64 gen( #ifdef _WIN32 ...
ALGO
0.997857
3.726799
b1a23302-5f12-4976-a6d4-cd4cbb1e263c
ajais-25/mycodes
Arrarys_1D/LinearSearch.cpp
#include<bits/stdc++.h> using namespace std; bool linSearch(int arr[], int n, int key) { for(int i = 0; i<n; i++) { if(key == arr[i]) return true; } return false; } void inputArray(int arr[], int size) { cout<<"Enter the Array Elements :-" <<endl; for(int i = 0; i <size;...
ALGO
0.999791
4.578051
80bb2041-cbbc-4707-bc49-9a47d7c483f4
Dinesh-RDY/Coding
6890.FindTheValueOfThePartition/Solution.cpp
#include<bits/stdc++.h> using namespace std; class Solution { public: int findValueOfPartition(vector<int>& nums) { sort(begin(nums), end(nums)); int ans = INT_MAX; for (int i = 0; i < nums.size() - 1; i++){ ans = min(ans, nums[i + 1] - nums[i]); } return ans; ...
ALGO
0.999955
4.660643
647b81ed-ba93-4d77-aaf4-60cbcb9d8fdf
RajdevKapoor/Leetcode-Practice
1603-design-parking-system/1603-design-parking-system.cpp
class ParkingSystem { public: vector<int> vehicle; ParkingSystem(int big, int medium, int small) { vehicle = {big,medium,small}; } bool addCar(int cartype) { cartype--; if(vehicle[cartype]>0){ vehicle[cartype]--; return true; } ...
ALGO
0.954352
5.909504
83179b1e-a8a3-4e07-a767-f82af4e1ba22
yiorgosynkl/ntua-ece-progintro
istriangle/istriangle.cpp
/********************************************************************** * Project : ntua-ece-progintro * Program name : istriangle.cpp * Author : yiorgosynkl (find me in Github: https://github.com/yiorgosynkl) * Date created : 20200124 * Purpose : find if the lengths can form a ...
ALGO
0.999754
4.437926
3cc039c8-7109-495a-9fd6-0688c03725ef
Asfia-oishy/Cpp
427A - Police Recruits/427A_Police_Recruits.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n,police=0,untreated=0; cin>>n; int events[n]; for(int i=0; i<n; i++) { cin>>events[i]; } for(int i=0; i<n; i++) { if(events[i]<0 && police==0) { untreated+=1; } else ...
ALGO
0.999887
3.893642
a0b286ab-8e97-435f-b86a-3e2358bd396b
K0NSTANT1N3/Abstractions
src/exams/mid/2/2024/circle.cpp
#include "circle.h" #include <iostream> Circle::Circle() { logLength = 0; head = NULL; } int Circle::length() { if (this->head == NULL)return 0; return logLength; } void Circle::insert(int pos, int v) { if (head == NULL) { head = new Node(v, head); logLength = 1; return; } if (pos == 0) { Node* tmp = ...
ALGO
0.999132
3.931145
78207a52-dce8-4d91-9548-4189065b303d
jaydobariya444/cpp
Binaryoppov2.cpp
#include<iostream> using namespace std; class Complex{ int x; int y; public: Complex(){ x=0; y=0; } Complex(int a, int b){ x=a; y=b; } void display(){ cout<<"value of x :"<<x<<endl; ...
TOOL
0.860481
3.823079
66f6af40-f8c2-4d4c-9695-64770ee8747c
sarvex/leetcode-intercal
solution/2300-2399/2312.Selling Pieces of Wood/Solution.cpp
using ll = long long; class Solution { public: long long sellingWood(int m, int n, vector<vector<int>>& prices) { vector<vector<ll>> memo(m + 1, vector<ll>(n + 1, -1)); vector<vector<int>> d(m + 1, vector<int>(n + 1)); for (auto& p : prices) d[p[0]][p[1]] = p[2]; return dfs(m, n, d,...
ALGO
0.999948
5.172876
68f19e1d-3062-44f6-9b64-ee105c4ef963
RutujaGaikwad45/CodSoft
obst-1.cpp
#include<iostream> #include<queue> using namespace std; #define max 10 class obst { int w[max][max],r[max][max],c[max][max],a[max],p[max],q[max+1]; int m,n,i,j,k; public: void accept() { cout<<"Enter the total no keys :"; cin>>n; for(i=0;i<n;i++) { ...
ALGO
0.999872
3.493765
09e9eb10-2919-4fb6-8697-a3bff0b2b55c
PaukIsUha/optimizing_formating_code
predictions/submissions-aizu-gpt4/Codenet/p02269/132124773/response_4.cpp
#include <iostream> #include <unordered_map> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; unordered_map<string, bool> Dic; string com, word; while (n--) { cin >> com >> word; if (com[0] == 'i') Dic[word] = true; els...
ALGO
0.999372
4.334126
405e8fa5-ecad-4aa1-a5e8-87acd2acf4ee
viere1234/NTPU-Projects
Introduction_to_Algorithm/HW1/1_insertion_sort.cpp
#include <iostream> #include <vector> using namespace std; void insertion_sort() { int n, count=0; float tmp; // Input cin >> n; vector<float> arr(n); for (int i=0;i<n;++i) cin >> arr[i]; // Sort for (int i=1, j; i<n; ++i) { tmp = arr[i]; j = i - 1; wh...
ALGO
0.999863
4.569884
976a28d7-a9d7-4ca7-9ee9-ee0f206ddd6c
MohiOnirban/everythinginside
C++/practiced.cpp/PracticeYT.cpp
#include <iostream> int main () { double x=10; double y=5; double z = (x+10)/(3*y); std::cout << "The result is: " << z << std::endl; return 0; }
TOOL
0.935003
3.571041
94efc4fe-adcb-42ac-b9ac-a7a0f4c57d53
hantwofish/recode
leetcode/leetcode/1593.cpp
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<unordered_set> using namespace std; class Solution { public: int maxUniqueSplit(string s) { return 0; } void backtracing(string& str, int index) { if(index == str.length()){ } } ...
ALGO
0.999982
5.043823
ad060d5a-8be4-4d5e-8016-7168bd51b0cd
AtaHurdoganDemiray/SunFlower
GeoUnited2024/src/PlaneSurfacePointGenerator.cpp
// PlaneSurfacePointGenerator.cpp #include "stdafx.h" #include "PlaneSurfacePointGenerator.h" #include "PlaneSurface.h" #include "IgesEntitySet.h" #include "Point.h" #include "DoubleVec.h" #include "SequentialLineSet.h" #include "DirectionEntity.h" PlaneSurfacePointGenerator::PlaneSurfacePointGenerator(const PlaneSur...
TOOL
0.871222
6.494166
417b2b33-a8b2-4867-bf09-6bbe39149c37
ishandutta2007/codeforces
wasa855/normal/1456/B.cpp
#include<bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back #define mp make_pair #define Fast_IO ios::sync_with_stdio(false); #define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__) //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); #de...
ALGO
0.999962
3.85377
dfe249fc-9edf-4275-98d0-16630558c2ea
kumarshivam27december/data_structure_and_algorithm_in_c-
complete_stl_in_one_go/map.cpp
/* Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have same key values. List of all functions of Map: map insert() in C++ STL– Insert elements with a particular key in the map container. . map count() function in C...
ALGO
0.986431
4.317011
75addcf1-f5ff-445f-9774-827eeb542e2c
BHARATH-KV-007/LeetCode-Solutions
125-valid-palindrome/valid-palindrome.cpp
class Solution { public: bool isPalindrome(string s) { int left=0; int right=s.size()-1; while(left<right) { if(!isalnum(s[left])) { left++; } else if(!isalnum(s[right])) { right--; ...
ALGO
0.999769
6.369914
40c98082-5d41-4149-ada5-dca173f8b922
Abhinandan-Sah/DSA-In-Class
19-BST-Problem/4-Sum-of-Node-greater-then-target-BSt.cpp
/* Problem Statement: Geetha is exploring the world of binary search trees (BSTs) and wants to create a program to find the sum of all nodes in a BST that are greater than a given target value. She has implemented a program to accomplish this and needs a problem statement for her task. Input format : The first line ...
ALGO
0.999989
6.142291
f17e98b7-5d79-41ec-91e1-9d17f44038f8
Bhavesh-26sareen/Striver-SDE-sheet
Arrays_Day4/2sum.cpp
class Solution { public: vector<int> twoSum(vector<int> &nums, int target) { unordered_map<int, int> omap; vector<int> result; for (int i = 0; i < nums.size(); i++) { omap[nums[i]] = i; } for (int i = 0; i < nums.size(); i++) { int ...
ALGO
0.999825
6.147226
a9436f08-e915-409d-b431-344351a29f0f
alessiasaporita/MDP
Exam6/lz78encode.cpp
#include <stdlib.h> #include <cstring> #include <stdio.h> #include <fstream> #include <iostream> #include <map> #include <vector> #include <string> #include <cmath> template <typename T> std::ostream& raw_write(std::ostream& os, const T& val, size_t size = sizeof(T)) { return os.write(reinterpret_cast<const char*>(&v...
ALGO
0.970684
4.417045
779b1b32-ddea-426b-90d6-e27498f43747
n22dcdk069/adfasf
Chapter9/Program/program13.cpp
// This program demonstrates a pointer to const parameter #include <iostream> using namespace std; void displayValues(const int *, int); int main() { // Array sizes const int SIZE = 6; // Define an array of const ints. const int array1[SIZE] = { 1, 2, 3, 4, 5, 6 }; // Define an array of nonconst...
TOOL
0.994405
5.563834
0b5e798b-1643-4558-86cc-e94464e02da8
mir183/CodeForces
731Tape/m.cpp
//#include<bits/stdc++.h> //Uncomment while submitting #include <iostream> #include <deque> #include <algorithm> using namespace std; #define ll long long int #define ld long double #define endl '\n' #define MIR183_Mac ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define yes cout << "YES" << endl #...
ALGO
0.999893
3.664541
f2869a35-89c5-4138-8182-809f609d54b3
mairohanhoon/CodeForces-Files
maximum_strength.cpp
#include<iostream> #include<cmath> using namespace std; int main(){ int t; cin >> t; while(t--){ unsigned long long int a, b; cin >> a >> b; unsigned long long int sum = 0; while(a!=0 && b!=0){ int x = a%10; int y = b%10; a = a/10; ...
ALGO
0.999723
4.712193
20d5783a-8a64-4996-ba37-1f170504206c
Ironblade1/coding-question
all-nodes-distance-k-in-binary-tree/all-nodes-distance-k-in-binary-tree.cpp
class Solution { public: unordered_map<int, TreeNode*> parentMap; void findParents(TreeNode* node, TreeNode* parent) { if (!node) return; parentMap[node->val] = parent; findParents(node->left, node); findParents(node->right, node); } ...
ALGO
0.999997
6.33777
48210cc2-8a83-4f26-959b-a641805579f1
Hyunmin-jasper-Cho/AlgorithmSolving_Acmicpc
11779_최소비용구하기2(경로역추적)/solve.cpp
// * 최단거리는 최단거리들의 합이다. #include <iostream> #include <cstring> #include <queue> #include <vector> #include <functional> #define INF 100000001 using namespace std; int N, M; void clr(int arr[1001]); int main() { scanf("%d %d", &N, &M); // index, cost vector<pair<int, int>> adjacent_node_of[N + 1]; i...
ALGO
0.999988
4.471552
74d62849-8e11-4e05-bf55-f7babe32a1d0
wujinggrt/PAT
Advanced/1019/s.cpp
#include <algorithm> #include <vector> #include <iostream> using namespace std; auto decode(uint64_t n, const uint64_t& radix) { vector<uint32_t> ret; ret.reserve(32); while (n != 0) { auto tmp = n % radix; ret.push_back(tmp); n /= radix; } return ret; } int main() { st...
ALGO
0.999953
5.275128
6911345e-1918-4b36-8f66-161ebe9be9ce
rhidoyhasanmahmud/Online-Judge-Problem-Solutions
UVa Archive/UVa 12577 - Hajj-e-Akbar.cpp
#include<bits/stdc++.h> using namespace std; int main() { string a; int i=1; while(true) { cin>>a; if(a=="Hajj") printf("Case %d: Hajj-e-Akbar\n",i++); else if(a=="Umrah") printf("Case %d: Hajj-e-Asghar\n",i++); else break; } re...
ALGO
0.997761
3.146161
1a17b230-4646-41da-917d-a0d752590420
li-ming-jiang/MyOpenSees
SRC/material/yieldSurface/evolution/BkStressLimSurface2D.cpp
//BkStressLimSurface2D // ////////////////////////////////////////////////////////////////////// #include "BkStressLimSurface2D.h" #include <YieldSurface_BC.h> #include <math.h> #define evolDebug 0 ////////////////////////////////////////////////////////////////////// // Construction/Destruction /////////////////////...
ALGO
0.959029
4.417675
4ea8d7aa-003f-4b90-af9d-7004eb6fdbb2
dcvz/desmume-mobile
src/mobile/7z/CPP/Common/Lang.cpp
// Common/Lang.cpp #include "StdAfx.h" #include "Lang.h" #include "TextConfig.h" #include "../Windows/FileIO.h" #include "UTFConvert.h" #include "Defs.h" static bool HexStringToNumber(const UString &s, UInt32 &value) { value = 0; if (s.IsEmpty()) return false; for (int i = 0; i < s.Length(); i++) { ...
TOOL
0.935357
5.45917
594b75be-0df7-4df3-9d9c-c8994434fbf0
oblivious137/cxsjsx
day9/5.cpp
#include<set> #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; set<pair<int ,int>> s; int main(){ s.insert(make_pair(1000000000,1)); int n; cin>>n; for (int i=0;i<n;++i){ int id,v; cin>>id>>v; pair<int,int> nw(v,id);...
ALGO
0.999539
3.424517
833e2025-169e-40c2-b614-a3b76c1b9335
zilixie/kinematics
libigl/include/igl/shortest_edge_and_midpoint.cpp
IGL_INLINE void igl::shortest_edge_and_midpoint( const int e, const Eigen::MatrixXd & V, const Eigen::MatrixXi & /*F*/, const Eigen::MatrixXi & E, const Eigen::VectorXi & /*EMAP*/, const Eigen::MatrixXi & /*EF*/, const Eigen::MatrixXi & /*EI*/, double & cost, Eigen::RowVectorXd & p) { cost = (V.row(...
ALGO
0.999317
4.988283
dbff45ba-63bb-4b55-89f2-c06cd2cac980
Khushisrivastava9/LeetCode-Practice
99-recover-binary-search-tree/recover-binary-search-tree.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.999997
5.965036
5e29c671-a19a-4c49-a6f4-1768a5c9737d
CppWielder/cppPatterns
alternateOneZeroPyramid.cpp
#include<iostream> int main() { int height; std::cout << "Enter height : "; std::cin >> height; for(int i = 0;i < height;i++) { for(int j = 0;j <= i;j++) { std::cout << (i + j + 1) % 2 << ' '; } std::cout << '\n'; } return 0; }
ALGO
0.999386
4.013777
e7fe9b13-9b0f-408b-9ab9-950347f20086
SHY-Corp/LeetCode-Solutions
C++/199. BinaryTreeRightSideView.cpp
// Problem - 199. Binary Tree Right Side View /* First we need to know what is the depth of the tree. Once we know the depth of the tree, we can initialize a vector of that size. Then we recursively add the rightmost element in every tree to that vector. Note that it will always change the value in eve...
ALGO
0.999921
6.695485
3c115d2b-8e4f-45d3-9488-4057f117216c
vineetyadav2403/Data-Structures
Arrary/next permuatation.cpp
https://www.interviewbit.com/problems/next-permutation/ vector<int> Solution::nextPermutation(vector<int> &A) { int index = -1; int n = A.size(); for(int i=n-2;i>=0;i--){ if(A[i]<A[i+1]){ index = i; break; } } int x = 0; if(index==-1){ while(x<n/2...
ALGO
0.999993
5.12956
19b933cc-a2ca-4aa5-b6eb-c625d34b1e6a
heathkh/iwct
snap/boost/libs/multiprecision/performance/voronoi_performance.cpp
#ifdef _MSC_VER #pragma warning(disable:4244) #endif #include <boost/polygon/detail/voronoi_predicates.hpp> #include <boost/polygon/detail/voronoi_structures.hpp> #include <boost/polygon/detail/skeleton_predicates.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int_distribution.hpp> #i...
TEST
0.961838
6.788018
7cc86831-f2f9-4848-baec-d58bac178067
wmrmrx/icpc-notebook
latam/Graphs/euler_tour.cpp
// Euler Walk // Description: Find an Eulerean Path that passes through all edges // starting at src. Not necesseraly a cycle. Works for both // directed and undirected. Returns vector // of \{vertex,label of edge to vertex\}. // Second element of first pair i...
ALGO
0.999918
5.982731
6c3a2bf2-b781-45b0-a8cb-9cecd7b07e00
TRYang/acm
sgu/sgu_132.cpp
#include <stdio.h> #include <string.h> #define maxm 70 #define maxn 7 int g[maxm][maxn]; char s[maxn]; int n,m; int f[2][1<<14]; int a[2][2200],an[2]; int now,next; int ans; int rv(int x,int p){ return (x&(((1<<(n<<1))-1)^(3<<p))); } int ins(int x,int p){ return x|p; } void updata(int p,int x){ if (f[next][p]==-1){ ...
ALGO
0.999848
3.482138
d974cc45-70c0-49ef-a59c-0ac750a78b47
compbiogroup/Approximation-Algorithm-for-Rearrangement-Distances-Considering-Repeated-Genes-and-Intergenic-Region
distance/misc/genome.cpp
#include "genome.hpp" #include <algorithm> #include <cassert> #include <cstring> #include <iostream> #include <sstream> Genome::Genome(string str_g, string str_i, bool extend) { string token; op_max = -1; genes.reset(new vector<Gene>()); intergenic_regions.reset(new vector<IR>()); /* Read each element of th...
ALGO
0.972993
5.09399
97f8ba6c-c53d-4260-8c00-fcd87c97c484
artursarlo/IGR202_Project
Mesh.cpp
#include "Mesh.h" #include <iostream> #include <fstream> #include <cstdlib> #include <vector> #include <algorithm> #if REMESH_VERBOSE #include <ctime> #endif // Multiplicative factor to be multiplied by calculated average from mesh #define REMESH_FACTOR_L_PERCENTAGE 0.9f using namespace std; void Mesh::loadOFF (con...
ALGO
0.965016
4.603562
4e3fb899-64c8-4835-84c6-0c4893f6d11c
kth5/archpower
rocm/hipsolver/test.cpp
#include <hipsolver/hipsolver.h> #include <hip/hip_runtime.h> #include <vector> #include <random> #include <algorithm> #include <cmath> #include <iostream> int main() { size_t n = 64; size_t m = 41; size_t size = n * m; std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribut...
TEST
0.995761
5.718276
d78b4638-8957-44d3-8bc2-0f9f866c8513
Rushikeshkadam13/algorithm
DanceMoves.cpp
#include<bits/stdc++.h> using namespace std; int main() { int tt;cin>>tt;while(tt--) { int x,y; cin>>x>>y; int z=y-x; if(z>=0) { if(z%2==1) cout<<(z+1)/2+1<<endl; else cout<<z/2<<endl; } else { c...
ALGO
0.999918
4.291781
fb68f25a-a75d-496e-a045-b2207cffabcd
gymnasiumlife/Gymnasium
src/llmq/instantsend.cpp
#include <llmq/instantsend.h> #include <llmq/chainlocks.h> #include <llmq/quorums.h> #include <llmq/utils.h> #include <llmq/commitment.h> #include <llmq/signing_shares.h> #include <bls/bls_batchverifier.h> #include <chainparams.h> #include <consensus/validation.h> #include <index/txindex.h> #include <masternode/sync....
TOOL
0.87947
6.969348
5e50871f-a511-4bf3-bf38-8b5d6820568b
mayankrajput123/DSA-Problem-Practice
2503-longest-subarray-with-maximum-bitwise-and/2503-longest-subarray-with-maximum-bitwise-and.cpp
class Solution { public: int longestSubarray(vector<int>& nums) { int n = nums.size(); int maxelem = nums[0]; for(int i=1; i<n; i++){ if(nums[i]>maxelem){ maxelem=nums[i]; } } int cur=0; int maxi=0; for(int i=0; i<n; i++...
ALGO
0.999873
5.883974
b5988347-8397-4d52-8317-355c9f0b71db
MostafaMohamed2001/C-Data-Structure
.history/hello_20240701105855.cpp
#include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; int s_size = s.length(); if((s[0]>= 65 && s[0]<=90) && (s[1] >= 97 && s[1] <= 122) && ()) }
ALGO
0.986456
3.510919
c0b0c878-d0a7-480a-9a8a-d25001da028b
underscoreanuj/Codes
Hackerearth/Algorithms/Searching/Binary Search/Little Monk and Mountains.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int n = 0, q = 0; cin >> n >> q; vector<ll> L(n, 0); vector<ll> R(n, 0); vector<ll> range(n, 0); for (int i = 0; i < n; ++i) { cin >> L[i] >> R[i]; range[i] = R[i] - L[i] + 1; if ...
ALGO
0.99999
3.990042
455e5370-6489-4cd5-93ea-1966e9dfc256
bpritch1/finalProject
Final Project/AI.cpp
#include "AI.h" #include <cassert> // This file is used only in the Reach, not the Core. // You do not need to make any changes to this file for the Core string getAIMoveString(const BuildingState& buildingState) { return ""; } string getAIPickupList(const Move& move, const BuildingState& buildingState, ...
TOOL
0.945372
5.052934
65631434-8494-46c4-8d13-0632163f88d0
ishandutta2007/codeforces
fangzhijian2020/normal/1556/A.cpp
#include<iostream> #include<iomanip> #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; long long read(){ long long a=0;bool opt=0;char c=getchar(); while(c<'0'||c>'9')opt|=c=='-',c=getchar(); while(c>='0'&&c<='9')a=(a<<3)+(a<<1)+(c^48),c=getchar(); return opt?-a:a; } int T,...
ALGO
0.999914
3.406607
48e529a8-d54b-4690-bee6-0107090bbb9e
M-SRIKAR-VARDHAN/DAILY-PRACTICE
0287-find-the-duplicate-number/0287-find-the-duplicate-number.cpp
class Solution { public: int findDuplicate(vector<int>& nums) { sort(nums.begin(), nums.end()); int b = nums.size(); int i = 0; while (i < b - 1) { if (nums[i] == nums[i + 1]) { return nums[i]; } i++; } retur...
ALGO
0.999994
5.938636
09d308d5-91a7-406e-9e18-245643ea91d8
HanetakaChou/PDF
Engine/Source/Runtime/MediaUtils/Private/MediaAudioResampler.cpp
#include "MediaAudioResampler.h" #include "MediaUtilsPrivate.h" #include "Algo/Reverse.h" #include "IMediaAudioSample.h" /* Local helpers *****************************************************************************/ namespace MediaAudioResampler { // Rows: output speaker configuration // Cols: input source chann...
ALGO
0.988306
6.675864
79305051-f828-458c-8f13-249072c76693
zongxinqi/Code
C-C++/acm/Divide by three, multiply by two.cpp
#include<bits/stdc++.h> using namespace std; typedef long long LL; struct node{ LL a,b; }A[110]; int cmp(node m,node n){ if(m.b == n.b) return m.a < n.a; else return m.b > n.b; } int main() { int n;cin>>n; for(int i = 1;i <= n;i++){ cin>>A[i].a; LL k = A[i].a; while(k % 3 == 0&&k){ A[i].b++; k /= 3; ...
ALGO
0.999966
3.039033
26253cde-e906-4a86-a0c6-6d73c29e16f8
MTG/essentia
src/examples/outdated/streaming_extractorsfx.cpp
#include <vector> using namespace std; #include <essentia/algorithmfactory.h> #include <essentia/essentiamath.h> #include <essentia/streaming/algorithms/poolstorage.h> using namespace essentia; using namespace essentia::streaming; #include "streaming_extractorsfx.h" void SFX(SourceBase& input, Pool& pool, const stri...
TOOL
0.975314
5.486943
e31d3d0e-cf02-44ec-addc-3ac665ac2062
moyuanhuang/leetcode
0/106.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 Solution { public: TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) { return helper(inorder, 0, i...
ALGO
0.999961
5.988079
c1ee6d57-e86c-4d37-9545-845270e771e1
pvc1989/miniWiki
algorithms/data_structures/leetcode/97.interleaving-string.cpp
/* * @lc app=leetcode id=97 lang=cpp * * [97] Interleaving String * * https://leetcode.com/problems/interleaving-string/description/ * * algorithms * Medium (32.69%) * Likes: 2526 * Dislikes: 129 * Total Accepted: 203.9K * Total Submissions: 607.8K * Testcase Example: '"aabcc"\n"dbbca"\n"aadbbcbcac"...
ALGO
0.998417
6.755334