uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
85deb14f-eb2b-4ba5-aa62-118c2ca2ca77
nicolatoscan/ASD-1920
28_alpini/alpini.cpp
//#include "alpini.h" #include <fstream> #include <iostream> #include <vector> #include <cassert> #include <string> #include <algorithm> #include <ctime> #include <queue> using namespace std; ifstream in("input.txt"); #ifdef EVAL ofstream out("output.txt"); #else ostream &out(cout); #endif bool hasCycle(); void delB...
ALGO
0.999926
4.113957
f5ba8b1e-442b-43f3-80f0-de30e139f0f9
timlael/Algorithms
Project2/mergesort.cpp
/* Tim M. Lael CS 3010 e01 Project 2 Part A - Mergesort */ #include <iostream> #include <ctime> #include <cmath> /* Array fill function */ int fill(int *array, int size){ for(int i=0; i<size; i++){ array[i] = (rand()%1000000); } return *array; } /* Array zero function */ int clear(int *array, int siz...
ALGO
0.999646
5.536275
d043a705-a52c-44da-8e20-011fea2da281
QbitQuantum/Basics
Исходники/CameraTracking.cpp
void CCameraTracking::UpdateAutoFollow(const SViewParams &viewParams, const CPlayer &hero) { if(g_pGameCVars->cl_cam_auto_follow_rate > 0.0f) //auto-tracking { //if there is an obstacle nearby, don't try to rotate into it float lastObstacleDist = (m_vLastObstaclePos - viewParams.position).len(); if(lastObstacl...
ALGO
0.999113
5.959233
077033f4-2281-4e1b-aa38-925293d0ba8f
bbye98/mdcraft
lib/openmm-ic-plugin/platforms/cuda/src/CudaICKernels.cpp
#include <algorithm> #include <iostream> #include <set> #include "CudaBondedUtilities.h" #include "CudaForceInfo.h" #include "CudaICKernelSources.h" #include "CudaICKernels.h" #include "CudaIntegrationUtilities.h" #include "ICLangevinIntegrator.h" #include "SimTKOpenMMRealType.h" #include "openmm/CMMotionRemover.h" #i...
ALGO
0.992069
6.393489
e369027f-08c7-4deb-8294-f7b3f4881b54
fulatin/MyAlgorithmProblemCode
codefoces/r981/e2.cpp
#include <bits/stdc++.h> #include <cstring> using namespace std; const int MAXN = 1000002; int n; int arr[MAXN]; bool vis[MAXN]; void solve() { memset(vis, 0, sizeof(vis)); cin >> n; for (int i = 1; i <= n; ++i) { cin >> arr[i]; } int ans = 0; for (int i = 1; i <= n; ++i) { if (vis[i]) conti...
ALGO
0.999622
4.334725
d3e96143-338d-4273-b02c-8244923a0533
swathisnayak14/Interview_Prep
Strings/RomanNumberToInt.cpp
// Given a string in roman no format (s) your task is to convert it to an integer . Various symbols and their values are given below. // I 1 // V 5 // X 10 // L 50 // C 100 // D 500 // M 1000 // Example 1: // Input: // s = V // Output: 5 // Example 2: // Input: // s = III // Output: 3 #include <bits/stdc++.h> usin...
ALGO
0.999966
6.068695
7d231e82-cd99-4bca-ac40-4fb41fd938cc
ls-rain/baekjoon
프로그래머스/2/178870. 연속된 부분 수열의 합/연속된 부분 수열의 합.cpp
#include <string> #include <vector> using namespace std; vector<int> solution(vector<int> sequence, int k) { vector<int> answer(0, sequence.size() - 1); int s = 0, e = 1; int sum = sequence[0]; int diff = 1000000; while(e < sequence.size() + 1){ if(sum == k){ if(e - 1 - s < dif...
ALGO
0.9999
5.116851
ce54346c-7758-4a64-8465-8139a8f0b4c8
sonalkr132/algos
AUPM.cpp
#include <iostream> #include <iomanip> using namespace std; void print_square(int size){ //get first line drawn for(int i=0; i < size; i++) cout << "#"; cout << endl; int mid = size/2; //upto start of next square for(int i=0; i< mid-1; i++) cout <<"#"<<setw(size-1)<<"#"<<endl; //the complicated one cout<<"#"<...
ALGO
0.999564
4.02132
70ca34ba-89c7-4e43-9779-8a36203080e7
JanHidranovich/progue
lab4/lab4.cpp
#include <iostream> #include "Stack.h" int main() { Stack<long long> s1; int a = 999999; s1.pop(); }
ALGO
0.920352
3.145436
6818dcd1-3a22-42c4-99c6-be533835d97f
Avairon/ControlWork
Task5.cpp
#include <iostream> #include <fstream> #include <string> using namespace std; void output(double otvet) //вывод { cout << otvet; } void solution(double summa, double first_pay, double crok) //подсчет { double otvet = (summa - first_pay) / (11 + (crok - 1) * 12); output(otvet); } void input() //ввод ч...
ALGO
0.993764
3.28763
14ab1270-4826-4ece-9789-ab382b638e48
ishandutta2007/codeforces
i_love_tigersugar/normal/489/C.cpp
#include<bits/stdc++.h> #define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1) #define FORD(i,b,a) for (int i=(b),_a=(a);i>=_a;i=i-1) #define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1) using namespace std; int main(void) { int m,s; cin>>m>>s; if (m==1) { if (s>9) cout<<"-1 -1"; else cout<<s<<" ...
ALGO
0.999815
3.11498
24e45469-4cbb-4624-a5da-a2d46b648983
nileshsah/Algorithms
IITK2P02.cpp
#include <bits/stdc++.h> #define ll long long #define get(a) scanf("%lld", &a); #define rep(n) for( ll i = 1; i <= n; i++ ) #define repVector(v) for( vector<ll>::iterator it = v.begin(); it != v.end(); it++ ) #define repSet(s) for( set<ll>::iterator it = s.begin(); it != s.end(); it++ ) #define all(c) c.begin(), c.end...
ALGO
0.999772
4.234601
e0fe6f17-12a1-4b22-9258-81c5143d8830
udayjayasanthosh/gfg
Difficulty: Medium/Diameter of a Binary Tree/diameter-of-a-binary-tree.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; /* A binary tree node has data, pointer to left child and a pointer to right child */ class Node { public: int data; Node* left; Node* right; Node(int val) { data = val; left = NULL; right = NULL; } }...
ALGO
0.998412
6.921966
89e4fa64-f06d-445c-a5bf-5c19ea3e901e
226johan/mono_slam
src/map.cpp
// // Created by johan on 2024/9/3. // #include"../include/map.h" #include"../include/feature.h" namespace mono_slam { /** * 构造函数 * @param frame 当前帧 * @param num_active_keyframes 最大活动关键帧数量 */ void Map::InsertKeyframe(Frame::Ptr frame) { // 更新当前帧 表示当前处理的关键帧 current_frame...
ALGO
0.883158
5.953435
514ad43f-0263-43bb-a9c2-11c497b79cf2
Faysal-star/DSA_2-1
Lab/Sorting Algorithms/B2-insertionSort.cpp
#include<bits/stdc++.h> using namespace std; void swp(int *a , int *b){ *a ^= *b ^= *a ^= *b ; } void insertionSort(int *arr , int n){ int i, key, j; for (i = 1; i < n; i++){ key = arr[i]; j = i - 1; while (j >= 0 && arr[j] > key){ swp(&arr[j + 1],&arr[j]); j ...
ALGO
0.999985
3.767361
c615e764-fcb4-4595-89a2-7143af0c2027
Ming0Kim/foralgorithm
solution/dynamic_programming_1/1010/main.cpp
// Authored by : tony9402 // Co-authored by : - // Link : http://boj.kr/4a2e9c2a7d9a44e7b0c4eda2c2cae10b #include<bits/stdc++.h> using namespace std; typedef long long ll; ll DP[33][33]; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; DP[0][0] = 1; for(int i=1;i<=30;i++...
ALGO
0.99991
4.608514
fd269c12-863e-4326-a384-0ca9a591b691
Nikhil9887/nikhil
daa/n_queens.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: bool isSafe1(int row, int col, vector<string> board, int n) { // check upper element int duprow = row; int dupcol = col; while (row >= 0 && col >= 0) { if (board[row][col] == 'Q') ...
ALGO
0.999781
5.923487
e1bce0c6-195b-4e24-91be-3a0535736623
cielavenir/procon
aizu/tyama_aizuCGL~2B.cpp
#include <vector> #include <complex> #include <cstdio> #include <cassert> #include <cmath> using namespace std; #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define ALL(c) (c).begin(), (c).end() const double EPS = 1e-8; const double INF = 1e12; t...
ALGO
0.997641
4.172409
aa6a62b1-dda7-40e7-80af-82453c302ccb
gellistvan/Advanced-Cpp
modules/03_Memory/03_memory_models_and_concurency/220_syncronization_with_condition_variables.cpp
#include <iostream> #include <mutex> #include <condition_variable> #include <thread> #include <vector> #include <queue> #include <atomic> // Shared resources std::mutex mtx; std::condition_variable cv; std::queue<int> dataQueue; // Queue to hold produced data std::atomic<bool> done(false); // Flag to indicate when p...
ALGO
0.934834
6.372393
cf7a3fc5-96c2-4335-9758-74e869051583
freenetcoder/defis
3rdparty/crypto/equihash_impl.cpp
// Implementation of the Equihash Proof-of-Work algorithm. // // Reference // ========= // Alex Biryukov and Dmitry Khovratovich // Equihash: Asymmetric Proof-of-Work Based on the Generalized Birthday Problem // NDSS ’16, 21-24 February 2016, San Diego, CA, USA // https://www.internetsociety.org/sites/default/files/blo...
ALGO
0.999918
7.344016
8e3555ce-f0d0-4781-8160-dfbf0cc41cee
UIC-RoboMaster/UICRM-Embedded
boards/algorithm/src/power_limit_new.cpp
#include "power_limit_new.h" // clang-format off #include <main.h> // add __FPU_PRESENT #include <arm_math.h> #include <stdint.h> // clang-format on namespace control { NewPowerLimit::NewPowerLimit(power_param_t params[4]) { for (int i = 0; i < 4; i++) { this->params[i] = params[i]; } ...
ALGO
0.996343
5.705307
00a2c6f9-028e-4958-a9e1-e2bf050c6c6d
krish6166/Excel-Clone
LL_loveBabbar3.cpp
#include<iostream> #include<unordered_set> #include<set> using namespace std; class node{ public: int data; node* next; node(int value){ data = value; next = NULL; } }; void display(node* head){ node* temp = head; while(temp!=NULL){ cout << temp->data << "->"; ...
ALGO
0.999032
5.114853
0c12ac46-5c50-44e8-8e5b-4ca6487266bf
SOFTK2765/PS
BOJ/2217.cpp
#include <bits/stdc++.h> using namespace std; int a[100001]; bool cmp(const int &a, const int &b){return a>b;} int main() { int n; scanf(" %d", &n); for(int i=0;i<n;i++) scanf(" %d", &a[i]); sort(a, a+n, cmp); int mx = 0; for(int i=1;i<=n;i++) mx = max(mx, a[i-1]*i); prin...
ALGO
0.999711
3.535588
5b63db9b-e85c-4886-8428-cecbee511f79
toki3122/all
cubeplusminus.cpp
#include<iostream> using namespace std; int main() { int n,sum=1; cout<<"enter n: "; cin>>n; cout<<"series: "<<endl; cout<<"1"; for(int i=2;i<=n;i++) { if(i%2==0) { sum-=i*i*i; cout<<"-"; } else { sum+=i*i*i; ...
ALGO
0.999445
3.632082
76d87968-da13-45ef-8f20-ff3e7e5aa77f
PhoengZ/DataStructure
sparse_project/main_sparse.cpp
#include "sparsegraph.h" #include <iostream> #include <vector> using namespace std; bool runCase(int testCase) { if (testCase == 1) { SparseGraph g; g.AddEdge(0,1); if (!g.DoesEdgeExist(0,1)) return false; if (g.DoesEdgeExist(1,0)) return false; } else if (testCase == 2) { ...
ALGO
0.988242
4.129735
d0ae1127-3ec5-4787-ab03-4dae5f3ff8ce
jllobvemy/AlgorithmExercises
Exercise_1/MatrixChain/matrixchain.cpp
#include"myutils.hpp" pair<Matrix<int>, Matrix<int>> MChain(const vector<int>&); pair<Matrix<int>, Matrix<int>> LookupChian(const vector<int>&); string TraceBack(const Matrix<int>& s); int main(int argc, char const *argv[]) { vector data = {30, 35, 15, 5, 10, 20, 25}; auto a = MChain(data); cout << "Matri...
ALGO
0.999977
3.41378
01b1e27c-1b57-48d1-9a7b-3387c46a21be
gcallah/OOP2
code/vector/vector_experiments.cpp
/* * A place to experiment with vectors and see what various * operations do. * */ #include <iostream> #include <vector> using namespace std; /* * `ATestType` is a type with copy control that also * prints when its copy control members are called * so we can track their usage. * */ class ATestType { frie...
TOOL
0.915391
7.093637
54ab7868-9c74-4852-b3ee-faf27350d622
YILINQ/biharmonic_distance
libigl/include/igl/copyleft/cgal/insphere.cpp
#include "insphere.h" #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> template<typename Scalar> IGL_INLINE short igl::copyleft::cgal::insphere( const Scalar pa[3], const Scalar pb[3], const Scalar pc[3], const Scalar pd[3], ...
ALGO
0.998115
6.401182
bf6b3593-6bd5-4ab4-a98d-350122a9be21
ishandutta2007/codeforces
lawrenceli/normal/519/D.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 100100; int n, x[30]; map<ll, int> num[30]; char s[MAXN]; int main() { for (int i=0; i<26; i++) cin >> x[i]; cin >> s; n = strlen(s); ll p = 0, ans = 0; for (int i=0; i<n; i++) { int a = s[i]-'a'; ans...
ALGO
0.99992
3.717313
e8cb21f8-9366-4035-b42b-ec9188552d35
abhishekBhangalia/Striver-s_SDE_Sheet_cpp_solutions
22. Binary Trees Miscellaneous/1. Binary tree to doubly linked list.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.999915
6.228248
31a0b19c-e71d-489c-bdc3-5f7f57a60c43
subh31/Graph-Data-Structure
CyclicDetectioNusingBFS.cpp
#include<iostream> #include<map> #include<unordered_map> #include<list> #include<queue> using namespace std; template<typename T> class Graph {map<T,list<T>> adjlist; public: void addedge(T u,T v,bool bidir) { adjlist[u].push_back(v); if(bidir) adjlist[v].push_back(u); } void printAdjList() { for...
ALGO
0.999737
4.641407
4fa09408-1940-4db8-876f-0da0ee17fd50
Dawn-K/Andy
neuoj/2.23(2.cpp
#include <stdio.h> #include <cstring> #include <iostream> #include <string> #include <algorithm> #include <stack> using namespace std; typedef long long ll; const int maxn = 1100005; int dp[maxn]; char s[maxn]; int main (void) { ios::sync_with_stdio(false); int n; scanf("%d",&n); for(int k=1;k<=n;++k) ...
ALGO
0.999346
3.578058
191f5aab-27ef-49cf-9605-1072a65d5764
tamim36/Algorithm-Design-And-Analysis
Pattern Matching/Pattern Matching 2.cpp
#include<bits/stdc++.h> using namespace std; #define NO_OF_CHARS 256 void buildTransitionTable(char *pat, int M, int TF[][NO_OF_CHARS]) { int i, tracker = 0, x; for (x=0; x<NO_OF_CHARS; x++) TF[0][x] = 0; TF[0][pat[0]] = 1; for (i=1; i<=M; i++) { for (x=0; x<NO_OF_CHARS; x++) ...
ALGO
0.999971
4.34126
fd869f4f-08d6-4ecb-bf18-2b313c8326a3
liruqi/topcoder
POJ/1837/3971999_AC_0MS_268K.cpp
#include<cstdio> #include<algorithm> using namespace std; int dp[2][8000]; int hook_n, weig_n, hook[24], weig[24]; #define zero 4000 #define ni(x) (scanf("%d",&x)) int main() { ni(hook_n); ni(weig_n); for(int i=0;i<hook_n;i++) ni(hook[i]); for(int i=0;i<weig_n;i++) ni(weig[i]); int left=zero; int right = z...
ALGO
0.999774
3.000595
6c8cc721-9386-4753-868a-ef900f8ab7db
tamaltm/CP
ACboy_needs_your_help_again.cpp
#include <bits/stdc++.h> using namespace std; #define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long #define FOR(i,n) for(int i=0;i<n;i++) #define a_sort(v) sort(v.begin(),v.end()) #define d_sort(v) sort(v.begin(),v.end(),greater<int>()) #define YES cout ...
ALGO
0.999508
5.721254
e969b439-8b92-4f96-95ca-54b22c32a604
shermz-lim/kattis-problems
numberfun.cpp
#include <bits/stdc++.h> using namespace std; #define ar array #define ll long long int main() { int n,a,b,c; cin>>n; for (int i=0;i<n;i++) { cin>>a>>b>>c; bool y = ( (a + b == c) || (a - b == c) || (a * b == c) || ((double) a / b == c) || (b - a == c) || ((double)...
ALGO
0.999397
4.332071
19dd7de2-1ebf-43f0-a875-e4937fa6b7bd
Pierre-Terdiman/PEEL_PhysX_Edition
PEEL_Externals/5_5_0_GitHub/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp
#include "GuPCMContactGenUtil.h" using namespace physx; using namespace Gu; using namespace aos; bool Gu::contains(Vec3V* verts, PxU32 numVerts, const Vec3VArg p, const Vec3VArg min, const Vec3VArg max) { const BoolV tempCon = BOr(V3IsGrtr(min, p), V3IsGrtr(p, max)); const BoolV con = BOr(BGetX(tempCon), BGetY(temp...
ALGO
0.999078
6.665644
92c640a4-6fce-40de-a449-99abc0642e7c
djtessari/Thesis
Assignment3/JPEG/jfdctint.cpp
#define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_ISLOW_SUPPORTED /* * This module is specialized to the case DCTSIZE = 8. */ #if DCTSIZE != 8 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif ...
ALGO
0.998971
6.077851
caddeed1-98f0-4bb7-ae76-49e8250fb033
Anmol-48/Cpp-practice
52.cpp
//Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. // // // //Example 1: // //Input: haystack = "sadbutsad", needle = "sad" //Output: 0 //Explanation: "sad" occurs at index 0 and 6. //The first occurrence is at index 0, so w...
ALGO
0.999805
4.66312
4e62f646-f05d-4713-b187-1ff0b4fd9552
TurralPont/Competitive-Programming
AceptaElReto/AceptaElReto412-ovejas.cpp
#include <iostream> #include <string> #include <vector> using namespace std; vector<string> Foto; vector<vector<bool> > visited; int blancas = 0; const int modF[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; const int modC[8] = {0, 1, 1, 1, 0, -1, -1, -1}; void DFS_Fondo(int i, int j){ if (visited[i][j]) return; visited[i]...
ALGO
0.998696
4.542251
10753917-b45f-4254-8253-09f18063d42e
Goodnameisfordoggy/College-assignment
c BasicHomework/06章 数组/0603计算33矩阵的主对角线元素之和.cpp
#include <stdio.h> int main() { int a[3][3], x, y, sum; for (y = 0; y < 3; y++) { for (x = 0; x < 3; x++) { scanf("%d", &a[y][x]); } } sum = a[0][0] + a[1][1] + a[2][2]; printf("sum=%d", sum); return 0; }
ALGO
0.999753
3.472051
177e43e4-e439-4002-95d7-d1436dc14387
qqiang00/LCD-like-Snake-game
SnakeGame/Snake.cpp
#include "stdafx.h" #include "Snake.h" Snake::Snake() { head = new LinkNode(); tail = head; Length = 1; } //һȷͷλáзԼڶγȵ̰ʳ Snake::Snake(UnitPosition headunit, Orientation movedirection, int length) { head =new LinkNode(headunit); tail = head; Length = 1; moveDirection = movedirection; if (length < 1) length ...
TOOL
0.988405
4.603594
319c45b6-9ced-424b-a4dc-ec991a631d53
fuhadkalathingal/codeforces
271A - Beautiful Year.cpp
#include <bits/stdc++.h> using namespace std; int main() { int year; cin >> year; while(true) { year += 1; //incrementing the year(year should be greater than input year) int a = year/1000; //first digit int b = year/100 % 10; //secound digit int c = year/10 % 10; //third ...
ALGO
0.998623
4.465971
e270705d-ea0b-4808-bdf5-da59fde3e21f
hehe114514/Spiral-code
树的直径.cpp
//#define _CRT_SECURE_NO_WARNINGS //#include<bits/stdc++.h> //using namespace std; //const int p = 1e5 + 10; ////1dfsиȨԼ¼· ////2dpиȨܼ¼· // //int n,d[p],lu[p]; //struct node { // int to, w; //}; //vector<node>vc[p]; // ////void dfs(int u,int fa,int w,int t) { //// if (t == 2)lu[u] = fa;//ڶα¼ֱ //// d[u] = d[fa] + w; ///...
ALGO
0.999951
4.164594
de5dd292-6aae-4dcd-8db9-c572d7c5944c
tushartg/Competitive-Programming-Standard-Codes
functions.cpp
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") ...
ALGO
0.999694
3.271058
b6dcf06d-d6ff-41ac-b687-df6101507b06
raincross7/code-similarity
codes/train_code/problem155/problem155_385.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define repr(i,x,n) for(int i=x; i<(n); i++) #define ALL(x) (x).begin(),(x).end() #define INF 1e9 typedef long long ll; using VI = vector<int>; using VB = vector<bool>; using VS = vector<string>; using graph = vector<vector<int>>; ...
ALGO
0.999984
3.71847
99787608-dc48-427b-a096-171e13b46e12
Jashimjnn/CppProject
phitron1.cpp/Algorithm/RecapAlgorithm/A_Too_Min_Too_Max.cpp
#include <iostream> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define Y cout << "YES" << endl; #define N cout << "NO" << endl; int main() { ll t; cin>>t; while(t--) { ll n; cin>>n; vector<ll>v(n); for(int i=0;i<n;i++) { cin>>v...
ALGO
0.999774
3.974046
cec6dcf2-74c4-4e46-b5c9-7e6dda261e17
Cyborn13x/UVa-1
10165 - Stone Game/Stone Game.cpp
/* *SHAKIL AHMED *Bangladesh University of Engineering & Technology (BUET) *<EMAIL> * */ #include <algorithm> #include <iostream> #include <utility> #include <sstream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cctype> #include <string> #include <vector> #include <bitset> #include <cmath>...
ALGO
0.999876
3.422708
bb6c54d3-796c-4b58-8e0d-ce6d26565a28
JiHyeok-Kim/SAF-AL
220823 - UnionFind/MST 크루스칼 p5 - 개념.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; char line[200]; struct Node { char a, b; int val; }; bool compare(Node t, Node v) { return t.val < v.val; } char findBoss(char tar) { if (line[tar] == 0) return tar; return line[tar] = findBoss(line[tar]); } void un...
ALGO
0.999944
4.096225
c121b859-0d44-4642-b218-c0ad2a4e1210
HPC-AI-Team/lammps-fugaku-threadpool-sc23
src/CG-DNA/pair_oxdna2_coaxstk.cpp
// clang-format off /* ---------------------------------------------------------------------- Contributing author: Oliver Henrich (University of Strathclyde, Glasgow) ------------------------------------------------------------------------- */ #include "pair_oxdna2_coaxstk.h" #include "atom.h" #include "comm.h" #...
ALGO
0.996832
6.721822
047c0542-9d63-4370-aa70-dab3921cdf15
Anu9356/recursion
m colouring oroblem.cpp
unordered_map<int,int>x; bool flag=0; bool ischeck(int index,int i,bool graph[101][101],int &n){ for(int j=0;j<n;j++){ if(graph[index][j]==1 && x[j]==i){ return false; } } return true; } bool colour(int index,bool graph[101][101]...
ALGO
0.999596
5.078331
eb9cdeab-abbb-4558-90aa-15b4f858a342
OhYee/sourcecode
ACM/POJ/2739.Sum of Consecutive Prime Numbers.cpp
/* By:OhYee Github:OhYee Blog:http://www.oyohyee.com/ Email:<EMAIL> かしこいかわいい? エリーチカ! 要写出来Хорошо的代码哦~ */ #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <set> #include <list> #include <queue> #include <stack> #include <string> #in...
ALGO
0.999945
3.668854
f9329eec-b734-4fdd-9718-4e2816ba512e
shammo18/Sports-Programming
635A.cpp
//Bismillahir Rahmanir Rahim #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define ll long long #define ull unsigned long long #define pii pair<int,int> #define pll pair<ll,ll> #define xx first #define yy second #define sci(n) scanf("%d",&n) #define scii(n,m) sca...
ALGO
0.999035
3.481013
e4cf8864-ff97-4170-8a51-2ba57dd8ea51
realme-mt6771-devs/android_frameworks_av
media/codecs/amrwb/dec/src/dec_acelp_2p_in_64.cpp
/* ------------------------------------------------------------------------------ Filename: dec_acelp_2p_in_64.cpp Date: 05/08/2007 ------------------------------------------------------------------------------ REVISION HISTORY Description: ------------------------------------------------------------------...
ALGO
0.999691
5.926583
777095d8-6399-4c25-a3c6-20403bb52a83
fanzhijun301/leetcode
MaximumDepthBinaryTree.cpp
#include <iostream> using namespace std; /** * Definition for binary tree */ struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: int maxDepth(TreeNode *root) { if (root == NULL) return 0; int curr...
ALGO
0.999946
6.755814
5b919fe6-96c3-46d6-aa6b-8f335043c54f
RahulBantode/c_cpp_practice
pr4.cpp
#include<iostream> using namespace std; int main() { cout.width(25); cout<<"99"<<endl; cout.setf(ios::left); cout.width(5); cout<<"99"<<endl; cout.setf(ios::right); cout<<"99"<<endl; return 0; } //set width function
TOOL
0.860682
4.780807
31a9c2d6-7fbb-44e6-b5d1-bb2e8414bb39
AscCrs/Competitive-Training
CPC/UVa/Set/11137 - Hoax or What.cpp
/* Exercise 11136 Hoax or What */ #include <bits/stdc++.h> using namespace std; int main() { int n, k, bill, case_num = 0; long long total_cost; set<int> bill_set; while (cin >> n && n != 0) { total_cost = 0; for (int i = 0; i < n; i++) { bill_set.clear(); cin ...
ALGO
0.991784
3.786472
62ea5cb2-ee5c-4fe1-9988-8385fd6a5f4d
LucasJezap/AlgorithmsForNPProblems
Sokoban_checkpoint1/src/uniform_cost_pull.cpp
#include <iostream> #include <bits/stdc++.h> #define contains(x) count(x) using namespace std; // Coordinate struct struct Coordinate { explicit Coordinate(Coordinate *pCoordinate) { this->x = pCoordinate->x; this->y = pCoordinate->y; } int x{}, y{}; Coordinate(int x, int y) { ...
ALGO
0.99993
5.135288
d5eaac9b-98dc-436c-8839-094bfa54404e
G33k1973/CodingGames
FourSum(InterviewBit).cpp
#define pb push_back vector<vector<int> > Solution::fourSum(vector<int> &A, int B) { int n = static_cast<int>(A.size()); vector<vector<int>> res; if (n < 4)return res; std::map<vector<int>, int> seen; int i, j, u, v; sort(begin(A), end(A), less<int>()); for (i = 0; i < n - 3; ++i) { int x = A[i]; if (x > B &...
ALGO
0.999772
5.242906
284a9429-3484-4040-be89-807fa7138fbd
c00k133/q-learning-project
src/libs/Box2D/Box2D/Collision/b2CollidePolygon.cpp
#include "Box2D/Collision/b2Collision.h" #include "Box2D/Collision/Shapes/b2PolygonShape.h" // Find the max separation between poly1 and poly2 using edge normals from poly1. static float32 b2FindMaxSeparation(int32* edgeIndex, const b2PolygonShape* poly1, const b2Transform& xf1, const b2PolygonShape*...
ALGO
0.999782
6.833144
9434c7e2-74f2-488b-88f9-13aca26cec32
256bitguy/Competitive-Programming
codeforces/800/A. Word.cpp
#include <bits/stdc++.h> using namespace std; int main() { string str1 ; cin>>str1; int size_of_string,count_upper=0, count_lower=0; size_of_string=str1.size(); char new_string[size_of_string]; for(int i=0;i<size_of_string;i++) { if ( isupper( str1[i])){ co...
ALGO
0.999852
5.580286
99402a8b-3ddb-4c79-9c4f-442b99533d15
pavelsimo/ProgrammingContest
uva/11227_The_silver_bullet/P11227.cpp
/* @BEGIN_OF_SOURCE_CODE */ /* @JUDGE_ID: 11227 C++ "Geometry, Vectors, Collinear Points" */ #include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <list> #include <bitset> #include <deque> #include <num...
ALGO
0.998968
4.98221
f9ad6a83-803b-4bd6-a4d2-acbf8cfb8384
shwetaboora/CPlusPlus-Codes
Patterns/SquareStarPattern.cpp
#include <iostream> using namespace std; int main() { // **** // **** // **** // **** int n; cin >> n; int row = 1; while (row <= n) { int col = 1; while (col <= n) { cout << "*"; col++; } cout << endl; row++;...
ALGO
0.999962
4.140349
317dbaba-f00a-43bf-b079-78c4db961214
himanshu-14/solutions
CPP CODE/chefand feedback.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin.ignore(); getline(cin, s); int i; for (i = 0; i <= s.length() - 3; i++) { // cout<<"loop"; if ((s[i] == '0' && s[i +...
ALGO
0.9987
4.405749
2385d95a-1d96-4cb3-9990-7889c2a3bfb8
Sumu154/Algorithms
E_Divide and Conquar/1.MergeSort.cpp
#include<bits/stdc++.h> using namespace std; vector<int> MergeSort(vector<int> a) { //base case if(a.size() <= 1){ return a; } int mid = a.size()/2; vector<int> b; vector<int> c; for(int i=0 ; i<mid ; i++){ b.push_back(a[i]); } for(int i=mid ; i<a.size() ; i++){ ...
ALGO
0.999953
4.578832
1fd14c2e-ab2b-40aa-a1f6-33f04856e54d
kamojirou/-Reversi
提出用オセロ/CollisionDetection.cpp
#include "CollisionDetection.h" #include"Point.h" #include"Rect.h" bool PointInRect(const Rect & rect, const Point & point) { if (point.x > rect.left && point.x < rect.right && point.y > rect.top && point.y < rect.bottom) { return true; } else { return false; } }
ALGO
0.991468
4.179087
ac6bb263-5771-4afa-8a48-3f33d9a37598
diegoventurasg/flutter_weather
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
85dace7d-ea1a-4546-afcf-7c43c0ef839c
FrankBlabu/GenePool
src/libs/ecosystem/gep_system_controller.cpp
/* * gep_system_controller.cpp - Base class for all process controllers * * Frank Cieslok, Aug. 2011 */ #define GEP_DEBUG #include "GEPSystemDebug.h" #include "GEPSystemController.h" #include "GEPSystemNotifier.h" #include "GEPSystemWorld.h" #include <limits> #include <boost/bind.hpp> #include <QFuture> #includ...
ALGO
0.97524
5.549823
9ea5214d-75d6-4547-b908-fea315b20341
lifecycles1/competitive-programming
neetcode/6. linked list/3.palindromeLinkedList.cpp
// Given the head of a singly linked list, return true if it is a palindrome or false otherwise. # include <vector> // * Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : val(x), next(nullptr) {} ListNode(int x, ListNode *n...
ALGO
0.999552
6.07784
0bf33b76-42e8-4987-bbcb-2fd183b8b620
siamthecoder/500-difficulty-rating-Codechef-
whoIsTaller.cpp
#include <bits/stdc++.h> using namespace std; int main() { int X, Y, T; cin >> T; while (T != 0) { cin >> X >> Y; if (X > Y) { cout << "A" << endl; } else { cout << "B" << endl; } T--; } return 0; }
ALGO
0.999169
4.151926
268388c0-2008-4b14-aba6-f962dc24c94d
sjtao98/Leetcode_backup_2
1217-minimum-cost-to-move-chips-to-the-same-position/1217-minimum-cost-to-move-chips-to-the-same-position.cpp
class Solution { public: int minCostToMoveChips(vector<int>& position) { int even = 0, odd = 0; for(int p : position){ if(p%2 == 0) even ++; else odd ++; } return min(even, odd); } };
ALGO
0.999821
5.564821
12b68518-3288-4f55-8f50-f198dafe7fab
ilkos/uva
uva147-Dollars/src/uva147-Dollars.cpp
//============================================================================ // Name : uva147-Dollars.cpp //============================================================================ #include <iostream> #include <iomanip> #include <vector> using namespace std; #define LEN(x) (sizeof((x)) / sizeof((x)[0])) ...
ALGO
0.948493
4.355889
93bdc432-f210-4389-87a6-9b3705a7248d
tim-lansen/SPOJ-cpp
QTREE2/QTREE2.cpp
// SPOJ exersises // Tim Lansen <EMAIL> // QTREE2 - Query on a tree II // This problem's URL: // http://www.spoj.com/problems/QTREE2/ // // Approach: pre-build 'reverse to root' sequences and store levels and distances from root // then for every DIST query find an LCA and calculate answer (d(a) + d(b) - 2*d(LCA)) // ...
ALGO
0.999761
4.2738
59898f2a-5c7f-43f9-968e-3d932bf0330d
Med1D/OOP
GameofLife(SFML)/Life.cpp
#include "Life.h" Life::Life():universe_size(0),cell_size(0) { //ctor } Life::Life(int n, int CellSize):universe_size(n),cell_size(CellSize) { for(int i=0;i<n/CellSize;i++) { universe[i] = new sf::Sprite[n]; } for(int i=0;i<n/CellSize;i++) { for(int j=0;j<n/CellSize;j++) ...
ALGO
0.904204
3.509578
be228f98-f84c-4ce9-929e-2423cfbe956b
BlueSu007/Luogu-codes
P1802 5倍经验日.cpp
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <climits> using namespace std; #define LEN 1005 int n , m , lose[LEN] , win[LEN] , use[LEN] ; long long dp[LEN] ; int main () { scanf ( "%d %d" , &n , &m ) ; for ( int i = 1 ; i <= n ; i++ ) { scanf ( "%d %d %d" , &l...
ALGO
0.999823
3.734001
8faea600-2068-4477-a678-b026b5760cb4
liuxiaocs7/AlgorithmLearn
LeetCode_C++/0105.从前序与中序遍历序列构造二叉树.cpp
/* * @lc app=leetcode.cn id=105 lang=cpp * * [105] 从前序与中序遍历序列构造二叉树 */ // @lc code=start /** * 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 { unordered_...
ALGO
0.99996
6.854398
c1fdabb3-dda2-45ac-adf1-de0d56d5a3fd
sx-aurora-dev/llvm-vp-project
libc/src/math/generic/fminf.cpp
#include "src/math/fminf.h" #include "src/__support/common.h" #include "utils/FPUtil/BasicOperations.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) { return fputil::fmin(x, y); } } // namespace __llvm_libc
ALGO
0.99662
5.883698
8a3129ce-76fc-491e-8a50-a29a9188aaff
ythea/repulsive-surfaces
src/energy/implicit_obstacle.cpp
#include "energy/implicit_obstacle.h" #include "matrix_utils.h" namespace rsurfaces { ImplicitObstacle::ImplicitObstacle(MeshPtr mesh_, GeomPtr geom_, std::unique_ptr<ImplicitSurface> surface_, double power_, double w) : surface(std::move(surface_)) { power = power_; weight = w; ...
ALGO
0.99651
6.892688
11fb9635-d48d-453a-b065-c4f830c4b792
cafenoctua/at-corder
algorithm/bit_fe_xor.cpp
#include <iostream> #include <map> using namespace std; unsigned int randInt() { static unsigned int tx = 123456789, ty=362436069, tz=521288629, tw=88675123; unsigned int tt = (tx^(tx<<11)); tx = ty; ty = tz; tz = tw; return ( tw=(tw^(tw>>19))^(tt^(tt>>8)) ); } int main() { int count[6] = {0}; ...
ALGO
0.992844
3.764851
2f7b257e-604a-4fd6-be8d-771beb1d563b
akahimanshurawat/CPP-DSA-Journey
6.Arrays/maxMin.cpp
#include<iostream> using namespace std; int getMax(int num[], int n) { int max = INT_MIN; //int maxi = INT_MIN; //maxi = max(maxi, num[i]); for (int i = 0; i<n ; i++) { if (num[i]>max) { max = num[i]; } } return max; } int getMin(int num[], int n) { int min = INT_...
ALGO
0.998622
3.986422
ba520367-b985-423c-b57e-592119f1ce5d
vsharkovski/Competitive-Programming
Programs/Codeforces/933A - A Twisty Movement.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { ios::sync_with_stdio(false); cin.tie(0); const int maxn = 2010; int n; cin >> n; int a[maxn]; for (int i = 1; i <= n; ++i) { cin >> a[i]; --a[i]; } int cnt[2]...
ALGO
0.999942
3.81892
b4f9895a-3118-475b-bb56-928e636fe163
expertsleepersltd/distingNT_API
airwindows/src/Console0Buss.cpp
#include <math.h> #include <new> #include <distingnt/api.h> #define AIRWINDOWS_NAME "Console0Buss" #define AIRWINDOWS_DESCRIPTION "A radical, minimalist Console system." #define AIRWINDOWS_GUID NT_MULTICHAR( 'A','C','o','n' ) enum { kParam_One =0, kParam_Two =1, //Add your parameters here... kNumberOfParameters=2 ...
ALGO
0.906314
5.134192
f1545b0a-9ca4-46ba-a730-6e903c747eca
JNArrazola/Leetcode_Files
725_splitLinkedListInParts/main.cpp
#include <iostream> #include <vector> #include <unordered_map> #include <unordered_set> #include <algorithm> #include <string> #include <cmath> #include <queue> #include <stack> #include <list> #include <array> #include <set> #include <math.h> #include <iomanip> #include <bitset> #include <bits/stdc++.h> using namespa...
ALGO
0.999722
4.575726
8d5c6869-dc1b-472d-ad95-89c2dca781bc
clay-arras/cp-practice
usaco/gold/fencedin.cpp
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #define open(x) freopen(x, "r", stdin); #else #define open(x) #endif struct DSU { vector<long long> e; void init(long long N) { e = vector<long long>(N,-1); } long long get(long long x) { if (e[x] < 0) ...
ALGO
0.999867
3.715147
e6353c3a-3f48-4616-b938-240a13aa79c2
Senvikas/-6Companies30days-or-ReviseWithArsh.
https:/leetcode.com/problems/CourseSchedule.cpp
class Solution { public: bool dfs(int node, vector<int> adj[], vector<int> &vis, vector<int> &path) { vis[node] = 1; path[node] = 1; for (auto it: adj[node]) { if (!vis[it]) { if (dfs(it, adj, vis, p...
ALGO
0.999808
5.905983
adf91a7f-0d97-4032-bc19-878ca6f6eeff
SamSweet04/PP1
Midterm 2021/25.cpp
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string t = s; reverse(s.begin(), s.end()); cout << ((t == s)?"YES\n":"NO\n"); }
ALGO
0.999993
4.456189
d849968b-2778-4912-99a5-1a9cb8a6ca90
ishandutta2007/codeforces
aqt/normal/1027/E.cpp
#include <bits/stdc++.h> using namespace std; int N, K; long long MOD = 998244353; long long add(long long a, long long b){ return (a+b)%MOD; } long long mult(long long a, long long b){ return a*b%MOD; } long long dp1[2][505][505]; long long dp2[505][505]; int main(){ cin >> N >> K; dp1[1][1][1] =...
ALGO
0.999969
4.673689
8faff030-ee6c-4655-8c05-8a3996ebad68
113bommy/deepmind_codecontests_refine
cpp_source_filter_file/cpp_train_1276_4.cpp
#include <bits/stdc++.h> using namespace std; const int n1 = 1e9 + 7; struct compare { inline bool operator()(const std::string& first, const std::string& second) const { return first.size() < second.size(); } }; long long fact(long long n) { long long ans = 1; for (long long i = 1;...
ALGO
0.999901
5.029818
84ccd9cb-b72d-42c5-aa34-6838e5d87690
labismallnew/2023aaia3
week07/week07-3b.cpp
class Solution { public: bool isRobotBounded(string instructions) { int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; int x = 0,y = 0,dir=0; for(char c : instructions){ if(c=='G'){ x+=dx[dir]; y+=dy[dir]; } if(c=='L') ...
ALGO
0.999836
6.084696
3391c167-c5ee-414e-aeb4-2c44fedd9162
raincross7/code-similarity
codes/train_code/problem331/problem331_201.cpp
#include<iostream> #include<vector> #include<math.h> #include<algorithm> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { ll n, m, x; cin >> n >> m >> x; vector<ll> C(n); ll A[12][12]; for (int i = 0; i < n; i++) { cin ...
ALGO
0.999978
4.162335
40b4199b-743a-4733-91fe-a49681113ea6
03PrakharSrivastava/Dynamic-Programming
CoinChange.cpp
#include <bits/stdc++.h> using namespace std; #define faster \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.tie(nullptr); typedef long long ll; const int mod = 1e9 + 7; const ll MOD = 1e18; int calculate(int idx, vector<int> coins, int amount, vector...
ALGO
0.999952
4.643894
cfa6643c-4f41-4176-8724-5e7e81a6547f
Kawser-nerd/CLCDSA
Source Codes/AtCoder/abc116/D/4058606.cpp
#include <algorithm> #include <cassert> #include <cfloat> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <unorder...
ALGO
0.999949
3.539414
8a58f2df-1532-4832-a00c-72ca494cb29d
ioqoo/PS
2016 Daejeon Pre/D.cpp
#include <bits/stdc++.h> #define ll long long const ll MOD = 31991LL; using namespace std; ll d, t; vector<vector<ll>> A; vector<vector<ll>> Apow; map<ll, vector<vector<ll>>> mp; vector<ll> init; vector<vector<ll>> matmul(vector<vector<ll>> A, vector<vector<ll>> B){ vector<vector<ll>> ret; for (int i=0;i<d;i...
ALGO
0.999959
4.22722
260417f3-dbfd-4c30-bbd6-e47a2b713d58
goshkakit/astronomy
src/OrbitIntegration/PredictOrbitSat.cpp
//==============================================================================// // Andrianov N.G. // opbit predict module // main //==============================================================================// #include <time.h> #include <stdio.h> #include "PredictOrbitSat.h" // name namespace Orbit { //======...
ALGO
0.9991
3.277267
096ad44f-9e50-433e-b71c-59a1dd450963
coldmate/CPSC-2430
Labs/lab5/lab5_copy.cpp
// Alen Ovalles // lab5.cpp // 06/3/2022 // #include <iostream> #include <chrono> using namespace std; using namespace chrono; // Converted int size[] = {10,100,1000,10000}; to const variables bc... // I would keep getting a "ISO C++ forbids variable length array" using the // variable size[i] as the length when decl...
ALGO
0.999465
5.237817
16c396b8-b525-41ff-8b22-d63a8b8a780e
MihHiu2829/exerice_Cpp
kdl_coban/bai_1_nang_cao.cpp
#include <iostream> #include <string.h> #include <string> #include <algorithm> #include <bits/stdc++.h> using namespace std; typedef struct thongtin { string mathuebao, HoVaTenChuThueBao, date; int timeNoiMang, timeNgoaiMang; bool loaiThueBao; } in4; void inputthuepao(in4 &thuebao) { fflush(stdin); ...
TOOL
0.989096
3.156143
d07b8f2f-e6fd-4e97-99ae-e16d8c81d4d0
sps1112/cp-problems
Introductory/1. Weird Algo.cpp
/* Consider an algorithm that takes as input a positive integer n. If n is even, the algorithm divides it by two, and if n is odd, the algorithm multiplies it by three and adds one. The algorithm repeats this, until n is one. For example, the sequence for n=3 is as follows: 3→10→5→16→8→4→2→1 Your task is to simulate...
ALGO
0.999984
6.251246
14e0677c-5fe6-43dc-9854-466b15e87e52
prakriti06/Leetcode-Questions
Merge two sorted linked lists - GFG/merge-two-sorted-linked-lists.cpp
// { Driver Code Starts #include<iostream> using namespace std; /* Link list Node */ struct Node { int data; struct Node *next; Node(int x) { data = x; next = NULL; } }; Node* sortedMerge(struct Node* a, struct Node* b); /* Function to print Nodes in a given linked list */ vo...
ALGO
0.999918
5.109712
38ad64fc-8f14-47dd-a085-7cf1a8befae6
sarvex/leetcode-factor
lcci/17.10.Find Majority Element/Solution.cpp
class Solution { public: int majorityElement(vector<int>& nums) { int cnt = 0, m = 0; for (int& v : nums) { if (cnt == 0) { m = v; cnt = 1; } else cnt += (m == v ? 1 : -1); } cnt = count(nums.begin(), nums.end(),...
ALGO
0.999955
5.655781
fb098ab9-8b41-4c93-af56-23245bf48b2f
RedtRocks/leet
two sum.cpp
// two sum class Solution { public: vector<int> twoSum(vector<int> &nums, int target) { vector<int> ret; int size = nums.size(); int diff; unordered_map<int, int> m; for (int i = 0; i < size; i++) { diff = target - nums[i]; if (m.contains(d...
ALGO
0.999879
5.930499