uuid
stringlengths
36
36
repo_name
stringlengths
5
123
relative_path
stringlengths
5
4k
content
stringlengths
33
2.85M
category
stringclasses
6 values
algo_rel_score
float64
0.85
1
quality_score
float64
3
8.76
c7d6e7ac-e7fc-4d85-ab91-f515606b398c
yuyouyou123/JinNiuHuaNiuPai_Yougurt_youyou
jinniuhua/frameworks/cocos2d-x/cocos/math/Vec2.cpp
#include "math/Vec2.h" #include "math/MathUtil.h" #include "base/ccMacros.h" NS_CC_MATH_BEGIN // returns true if segment A-B intersects with segment C-D. S->E is the overlap part bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E) { float ABmin = std::min(A, B); float AB...
TOOL
0.973339
7.040969
e6be0ac6-071c-4717-82ad-8dabe1f2c27c
nishgpt/competitive_programming
hackerearth/october-circuits-18/question_paper.cpp
/* Author : Nishant Gupta 2.0 */ #include<bits/stdc++.h> #define LL long long int #define pb push_back #define MP make_pair #define MAX 2000005 #define MOD 1000000007 using namespace std; void print(pair<int, int> p) { cout<<p.first<<" "<<p.second<<endl; } int main() { int t, n, a, b; cin>>t; ...
ALGO
0.999832
3.600767
46ee570c-55f3-4428-8db5-37908c641111
nutanp255/Source-codes-2
operatorover5.cpp
#include<iostream> using namespace std; class Demo { public: int x; int y; Demo(int i=10,int j=20) { x=i; y=j; } }; Demo operator +(Demo op) { return op; } Demo operator -(Demo op) { return Demo (-op.x,-op.y); //return -op; } int main() { Demo obj1(11,-21); Demo obj2(51,-101); Demo robj1(0,0); ...
ALGO
0.936348
4.696157
2908fc0d-ce1f-4e2c-8b40-1e72beb17ad1
danieltudor11/Contests
CodeJam2022Round1A/a.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; typedef vector<vector<int>> vvi; typedef pair<int, int> pii; #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) void print_vec(v...
ALGO
0.999948
4.327138
9451f02d-b229-4abc-a0d6-1d73ea339ba9
Yayayayayayyayayay/oopITSA
03-8problem32.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int num; cin >> num; //1是Person 2是Fairy 3是Dwarf switch(num){ case 1: cout << "Person\n"; break; case 2: cout << "Fairy\n"; break; case 3: cout << "Dwarf\n"; ...
ALGO
0.997035
3.437192
e21f8c97-1fae-46da-a510-799a2460d7c0
buihung0602/baitap-ss15
bt_8.cpp
#include <stdio.h> #include <string.h> int main() { char str[100]; int a = 1; printf("Nhap vao chuoi: "); fgets(str, sizeof(str), stdin); str[strcspn(str, "\n")] = '\0'; for (int i = 0; i < strlen(str); i++) { if (a && str[i] >= 'a' && str[i] <= 'z') { str[i] -= 32; ...
ALGO
0.994069
4.314304
302df0ef-e2f2-4b63-a7fc-8f5a0a212e34
Sandeep-Raj-CSE/Leetcode-practice
2977-check-if-a-string-is-an-acronym-of-words/check-if-a-string-is-an-acronym-of-words.cpp
class Solution { public: bool isAcronym(vector<string>& words, string s) { // if(s.length > ) string temp=""; for(auto it:words){ temp=temp+it[0]; } return temp==s; } };
ALGO
0.999545
5.217061
182f0eba-78d0-4626-ae10-ac8431a7f6b6
Jashimjnn/CppProject
phitron1.cpp/module7/sort.cpp
#include <iostream> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define Y cout << "YES" << endl; #define N cout << "NO" << endl; class Student { public: string name; int roll; int marks; }; int main() { int n; cin >> n; // cin.ignore(); // Student ar[n]; Student *...
ALGO
0.999759
3.97377
28d95b1c-efe3-47cd-83b3-04b69f801600
EricJeffrey/myleetcode
leetcode/problems/621.cpp
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; class Solution { public: int leastInterval(vector<char> &tasks, int n) { int vec[26] = {}; for (char ch : tasks) vec...
ALGO
0.999934
6.060102
8caa78c2-2c4d-4d13-8202-9a043aa9a159
Glumboi/GlummyVM-Crackme
src/GlummyVM/GlummyVM/VM.cpp
#include "VM.h" void VM::Push(i32 v) { stack[++sp] = v; } i32 VM::Pop() { return stack[sp--]; } i32 VM::NextInstruction() { return code[ip++]; } void VM::Run(i32* code) { sp = 0; ip = 0; stack = (i32*)malloc(sizeof(i32) * STACK_SIZE); this->code = code; do { i32 op = Ne...
TOOL
0.929739
4.086162
32e43db0-7d60-43d7-aa34-43b653879218
lovestories0eng/LeetCode
46. 全排列/permute.cpp
#include "../stdc++.h" using namespace std; class Solution { public: void backTrack( vector<vector<int>>& result, vector<int>& nums, vector<int>& path, vector<bool>& used, int& size ) { if (path.size() == size) { result.emplace_back(path); ...
ALGO
0.999993
6.177133
261506ab-8a6b-49bf-93de-957ed18d5c8f
sahadat-11/CodeLibrary
Bit Malupulatiion/xor_queries_of_a_subarray.cpp
//In The Name of ALLAH #include <bits/stdc++.h> using namespace std; #define ll long long int main() {//In The Name of ALLAH #include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) cin >> ...
ALGO
0.999982
5.455685
5960975d-8935-4398-876e-b67f0bc1d59c
Yang890912/Leetcode
LeetCode/Hard/3108-minimum-cost-walk-in-weighted-graph/3108-minimum-cost-walk-in-weighted-graph.cpp
class Solution { public: vector<int> minimumCost(int n, vector<vector<int>>& edges, vector<vector<int>>& query) { vector<int> parent(n, 0); vector<int> rank(n, 1); vector<int> cost(n, INT_MAX); vector<int> res; for (int i = 0; i < n; i++) parent[i] = i; for (int i =...
ALGO
0.999968
5.852002
bd0ad411-174a-4f16-9910-4e9586940045
YooJeeSeok/Sol_Algo
BJ/BJ200505_4_4948.cpp
// while case  Ŀ ʱȭ #include <iostream> #include <cmath> #define FOR(i,s,e) for(int (i)=(s); (i)<(e);(i)++) using namespace std; int IsPrime(int n); int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, cnt; while(1) { cnt = 0; cin >> n; if(n==0) ...
ALGO
0.999741
4.296485
a640d52c-a327-49a3-b813-1f4516ba66fd
bachtran02/competitive-prog
CSES/Grid_Paths.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1000000007; // 998244353 - another common prime struct mint{ int v; int val() { return v; } mint() : v(0) {} mint(ll v) : v(v % MOD) { v += (v < 0) * MOD; } }; mint& operator+=(mint& a, mint b) { if ((a.v += b.v) >= MOD) a.v -...
ALGO
0.999923
4.535707
bfab0bd3-26bb-4d5e-bc3c-173104d95b35
programmerAryanChaurasia/C
Assignment_25/Question_4.cpp
// #include<iostream> #include<conio.h> using namespace std; class LargectNumber { private: int a,b,c; public: void setValue(int val1,int val2,int val3){ a=val1; b=val2; c=val3; } int findLarge(){ if(a>b&&a>c){ ret...
ALGO
0.997158
3.504103
2f6b6abd-7f2b-43f2-a7d5-f23ad4e90880
Stanotron/vsCode
c++/extras/tempCodeRunnerFile.cpp
#include <iostream> #include <algorithm> using namespace std; void Pair(int nums[], int n, int target) { sort(nums, nums + n); int low = 0; int high = n - 1; while (low < high) { if (nums[low] + nums[high] == target) { cout << "Pair found (" << low << ", " << high << ")\n...
ALGO
0.999933
5.264922
002c59c8-8a68-4d51-845f-57c11762aae1
dataNerd65/Algorithms_practice
UVAJudge/10018.cpp
#include<iostream> #include<algorithm> long long longlongToreverseTolonglong(long long num){ // convert to string std::string str = std::to_string(num); // reverse std::reverse(str.begin(), str.end()); // return as long long after converting return std::stoll(str); } int main(){ std::ios_b...
ALGO
0.999942
3.878884
f7dd8e12-6ec5-428f-9636-fdd4bb49f8f1
plab0n/OJ_solutions
bigSegment.cpp
#include <bits/stdc++.h> using namespace std; int main() { map<pair<long long,long long>,int>mp; int n; while(cin>>n) { long long min=10000000000,max=0,a,b; for(int i=1; i<=n; i++) { cin>>a>>b; if(min>a) min = a; if(max<b) ...
ALGO
0.999658
3.666701
d4fb181f-f844-4d70-88fd-6aeefca1edca
vader-coder/Search
search.cpp
List<Position*>* Maze::solve(OrderedCollection<Position*>* exploration) { Position* current; this->positions[0][0]->setVisited(); //mark as visited List<Position*>* neighbors; OrderedCollection<Position*>* frontier = exploration;//set frontier equal to pointer. List<Position*>* path = new STLList<P...
ALGO
0.999991
3.36797
fbf4b079-9f44-4519-9ee9-aab7a827a9e4
scott-sihui-wang/LeetCode
344_Reverse_String.cpp
class Solution { public: void reverseString(vector<char>& s) { int len=s.size(); int bound; if(len%2==0){ bound=(len-1)/2; } else{ bound=(len-2)/2; } for(int i=0;i<=bound;i++){ char tmp=s[i]; s[i]=s[len-1-i]; ...
ALGO
0.999755
6.057323
44a342a6-b2ed-4b82-9307-8382c0b37efc
kenwu890831/CPE
CPE_Vito'sfamily.cpp
#include <iostream> #include <algorithm> #include <vector> using namespace std ; void findHouse() { int famiNum,input,result = 0 ; cin >> famiNum ; vector<int> list ; for ( int i = 0 ; i < famiNum ; i++ ) { cin >> input ; list.push_back(input) ; } sort(list.begin(), list.end() ) ; for ...
ALGO
0.999099
4.544959
550e0ca6-d193-4221-b411-e3819d2cfa47
ishandutta2007/codeforces
ftiasch/normal/685/E.cpp
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <functional> #include <numeric> #include <vector> #define ALL(v) (v).begin(), (v).end() const int N = 1000; const int M = 200000; using Bitset = std::bitset<N>; int n, m, q, vertex[M + M], low[M], high[M], source[M], target[M], asc...
ALGO
0.999951
5.07015
ec640fc7-f73f-4687-bcbb-7f5d960b9e64
hgfzs/jade-legacy
source/drawing/DrawingGlobals.cpp
#include <DrawingGlobals.h> namespace Drawing { QRectF rectFromPoints(const QPointF& point0, const QPointF& point1) { return QRectF(qMin(point0.x(), point1.x()), qMin(point0.y(), point1.y()), qAbs(point0.x() - point1.x()), qAbs(point0.y() - point1.y())); } QRectF adjustRectForMinimumSize(const QRectF& rect) { Q...
TOOL
0.913789
6.578456
d70e36d6-4ddb-4d97-a01b-41086b6088b9
Sagarbha1991/com.example.trilinos
packages/epetraext/test/hypre/cxx_main.cpp
#include "Epetra_Map.h" #include "Epetra_Time.h" #include "Epetra_CrsMatrix.h" #include "EpetraExt_HypreIJMatrix.h" #include "HYPRE_IJ_mv.h" #include "hypre_Helpers.hpp" #include "Epetra_Vector.h" #include "Epetra_Flops.h" #ifdef EPETRA_MPI #include "Epetra_MpiComm.h" #include "mpi.h" #else #include "Epetra_SerialComm....
ALGO
0.981626
4.472054
56696c44-5eb6-4004-9340-1bc49f843a54
tonytech83/cpp
01-cpp-basics/06-while-loop/01-lab/07-min-number.cpp
// // Created by TonyTech on 20.12.2024 г.. // #include <climits> #include <iostream> #include <string> int main() { int smallest_number = INT_MAX; while (true) { std::string input; std::cin >> input; if (input == "Stop") break; if (std::stoi(input) < smallest_nu...
ALGO
0.99742
5.690374
0df7554a-bd96-4d09-9ade-824bef6ec6e2
YusufSyam/Cpp-Code
Uri/Uri1012.cpp
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a; cin >> b; cin >> c; printf("%d eh o maior\n", (a>=(b>=c? b=b : b=c)? a : b)); return 0; }
ALGO
0.998345
3.74432
b09f348d-1978-4b4e-9b68-e51014965480
jaehyeonha/Study_Algorithm_SWM-practice-
suin/week3/2143.cpp
#include<iostream> #include<vector> #include<map> using namespace std; int N, A, B; vector<int> a; vector<int> b; int main(){ cin >> N; cin >> A; for(int i=0; i<A; i++){ int t; cin >> t; a.push_back(t); if(i!=0){ a[i] = a[i]+a[i-1]; } } cin >> B...
ALGO
0.999537
3.29472
a30c37b8-14e5-4fc6-a216-390266514909
Deepanshi-05/CrackYourInternship
Difficulty: Medium/Longest Palindrome in a String/longest-palindrome-in-a-string.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: bool check(int i, int j, string& s) { while(i <= j){ if(s[i] != s[j]){ return false; } i++; j--; } re...
ALGO
0.999772
6.493397
4acf42a7-aea4-47b7-94e6-d9b127e16590
C2H5CHO/C-learning
【lanqiao】C++/day01/CC01.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int a, b; cin >> a >> b; cout << a << ' ' << b << '\n'; return 0; }
ALGO
0.99612
4.03672
a2dd1bcc-a4ef-4b64-8bef-e40650a6787f
Yasg-uru/DSA-practice-
sliding window/medium/1456. Maximum Number of Vowels in a Substring of Given Length.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: // Helper function to check if a character is a vowel bool isVowel(char ch) { ch = tolower(ch); // Convert to lowercase to handle both cases return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch =...
ALGO
0.9999
6.378207
98c11386-cf70-4975-a316-b35c90f0a257
yanghaemi/baekjoon-hm
2444.cpp
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; int nn = n; int nnn = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < nn - 1; j++) { cout << ' '; } nn--; for (int j = 1; j < nnn *...
ALGO
0.999917
3.457396
bc333c1d-083d-4d22-a877-3d60aa5e9648
Vandan121/VS-code
Coding/Codeforces/Codeforces Round 878 (Div. 3)/D.cpp
/************************************** * * * sasta_samurai * * * **************************************/ #include<bits/stdc++.h> #include <ext/pb...
ALGO
0.999772
5.006121
2ec4bd29-9f1e-439d-9f98-cd8ae483e005
Apress/learn-cocos2d-2
Learn Cocos2d 2/Kobold2D_Projects/__Kobold2D__/libs/Box2D/Box2D/Dynamics/Contacts/b2CircleContact.cpp
#include <Box2D/Dynamics/Contacts/b2CircleContact.h> #include <Box2D/Dynamics/b2Body.h> #include <Box2D/Dynamics/b2Fixture.h> #include <Box2D/Dynamics/b2WorldCallbacks.h> #include <Box2D/Common/b2BlockAllocator.h> #include <Box2D/Collision/b2TimeOfImpact.h> #include <new> using namespace std; b2Contact* b2CircleConta...
ALGO
0.966147
6.887669
6bf4ee38-6a02-436e-8512-2000cf7a3744
kaus98/Coding-Practice
450DSA/DynamicProgramming/28_MinimumJumpToEnd.cpp
int minJumps(vector<int> &arr,int n) { // Write your code here. int jumpsCount = 0; int ma = arr[0]; if(n==1) { // if(arr[0] == 0) return 0; // else return 1; return 0; } vector<int> dp(n+1, 0); dp[0] = ma; for(int i = 1; i < n-1; i++){ dp[i] = max(dp[i...
ALGO
0.999988
5.079256
5251f9f0-ec3b-434a-b392-fed8552360d5
Moneemabdullah/problem_solving_journey
Codeforces Round #983 (Div. 2)/C_Arrow_Path.cpp
/* #### ### # # ##### ##### #### ##### ##### # # # # # # # # # # # ### ##### # # #### AND #### #### #### #### # # # # # # # # # # # #### # # # ##### # # # ##### ##### #...
ALGO
0.999971
5.336632
f7d35478-b50f-4a8c-9751-9b102c09add7
ishandutta2007/codeforces
rednextcentury/normal/1221/F.cpp
#include<bits/stdc++.h> using namespace std; #define L (x<<1) #define R (L+1) #define mid (l+r)/2 pair<long long,int> tree[4000100]; long long lazy[4000100]; void build(int x,int l,int r) { if (l==r)tree[x].second=l; else { build(L,l,mid);build(R,mid+1,r); tree[x]=max(tree[L],tree[R]); ...
ALGO
0.99997
3.775278
4d4a08c2-3201-43e0-879a-c02cac9c0260
gameoverhack/msalibs
MSABulletPhysics/lib/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp
//#define DISABLE_BVH #include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" #include "BulletCollision/CollisionShapes/btOptimizedBvh.h" ///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization. ///Uses an interface to access the triangles to allow for shar...
ALGO
0.882897
7.566226
331bc1e1-9d5d-453c-9334-9e4b97369a85
Seann0425/LeetCode
finished/3192. Minimum Operations to Make Binary Array Elements Equal to One II.cpp
#include <bits/stdc++.h> using namespace std; struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : val(x), next(nullptr) {} ListNode(int x, ListNode *next) : val(x), next(next) {} }; struct TreeNode { int val; TreeNode *left; TreeNode *righ...
ALGO
0.999958
5.671165
fce84de0-c56e-4de1-bced-038103c21313
KarsonKang/Leetcode_Solution
algorithm/6ZConvert.cpp
#include <iostream> #include <string> #include <vector> using namespace std; class Solution{ public: /* 方法一:利用二维矩阵模型,寻找变化的周期 设n为字符串的长度,r = numRows。对于r = 1或r >= n,可以直接返回s。 根据题意,在矩阵上填写字符时,会向下填写r个字符,然后向右上填写r-2个字符 最后回到第一行,完成一个周期,因此一个周期t = r + r - 2 = 2r-2 每个周期占用1 + r - 2 = r - 1列。一共有⌈n/t⌉(向上取整)个周期...
ALGO
0.999995
4.845542
1e28f18a-edab-4705-b87c-d069cf77807d
barjimal/cg
lib/boost_1_78_0/libs/sort/example/parallelstring.cpp
// See http://www.boost.org/libs/sort for library home page. #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int_distribution.hpp> #include <boost/sort/spreadsort/spreadsort.hpp> #include <boost/thread.hpp> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <algorithm> #incl...
ALGO
0.994749
4.754984
ed865552-62d9-4a57-86f3-64fd57971c18
mohitreddy1996/Competitive-Coding
CodeChef/SEAARRAYS.cpp
#include <algorithm> #include <stdio.h> #include <map> #include <math.h> #include <limits.h> #include <stack> #include <string.h> #include <queue> #include <iostream> #include <vector> using namespace std; #define mod 1000000007 #define MAX 10001 /* int solve() { .... Base Cases .... if ( DP[i][...
ALGO
0.999955
3.992769
5ddd77fd-d7f6-4af6-8dc2-b42854fff1c2
jmanday/Master
TFM/library/boost_1_63_0/libs/compute/perf/perf_erase_remove.cpp
#include <algorithm> #include <iostream> #include <vector> #include <boost/compute/system.hpp> #include <boost/compute/algorithm/remove.hpp> #include <boost/compute/container/vector.hpp> #include "perf.hpp" int rand_int() { return static_cast<int>((rand() / double(RAND_MAX)) * 10.0); } int main(int argc, char *...
ALGO
0.970852
6.542465
0aa4606d-c7b4-48d8-af91-c17009ed445c
yeohj0710/old-solutions
09000s/9085.cpp
#include<stdio.h> int main() { int T, n, sum, digit; scanf("%d", &T); for(int i=0; i<T; i++) { scanf("%d", &n); sum = 0; for(int j=0; j<n; j++) { scanf("%d", &digit); sum += digit; } printf("%d\n", sum); } }
ALGO
0.999215
3.498764
1f46caa7-a27c-4ac6-9ec9-c01e5a19e2d2
ppzzyy11/cpp_algorithm_datastructure_practice
FindAllDistinctPalindromicSubstringsOfAGivenString.cpp
#include<iostream> #include<list> #include<vector> #include<climits> #include<queue> #include<stack> #include<set> #include<algorithm>//make_heap #include<utility> #include<unordered_set> #include<unordered_map> using namespace std; ostream& operator<<(ostream& os,const set<string>& strs) { for(auto it=strs.begin();i...
ALGO
0.999562
4.392339
e45ecdab-1d35-4ad7-bec9-72d6479935b4
noah-zemba/CSE232
hw-20/CopyStockPrices_3/main.cpp
#include <iostream> #include "header.hpp" int main() { int const source_size = 7; double source[] = {3, 1, 2, 3, 67, -4, 13}; int const destination_size = 10; double destination[destination_size] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; CopyStockPrices(source, destination); for (int i = 0; i < destination_size; ++i) {...
ALGO
0.88918
4.184216
dab26829-d933-4e23-9d15-1fe654d1f814
aleung27/Competitive-Programming
CF680-D2-B/solution.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define X real() #define Y imag() #define EPS 0.000000001 #define M_PI 3.14159265358979323846 #define CROSSPROD(a, b) (conj(a)*b).Y #define FASTIO ios::sync_with_stdio(false); template <class T> T gcd(T a, T b) { ...
ALGO
0.99997
3.755734
0b0a8518-bdf4-44e1-8fe0-06e2ff0fff3f
OneCodeMonkey/Algorithm
leetcode_solved/leetcode_0768_Max_Chunks_To_Make_Sorted_II.cpp
class Solution { public: int maxChunksToSorted(vector<int>& arr) { long long sum1 = 0, sum2 = 0; int ans = 0; vector<int> t = arr; sort(t.begin(), t.end()); for(int i = 0; i < arr.size(); i++) { sum1 += t[i]; sum2 += arr[i]; if(sum1 == sum2...
ALGO
0.999978
5.334812
3e54cf55-a5ac-4494-9d07-f4ebf303c0c8
Champ2001/Cpp
APNA COLLEGE/factorial.cpp
#include<bits/stdc++.h> using namespace std; int fact(int x) { int f=1; for(int i=1;i<=x;i++) { f=f*i; } return f; } int main() { int num=5; cout<<"Factorial ="<<fact(num); }
ALGO
0.999583
4.282565
ca07b8c8-fb9c-4d51-ac49-dea2c06cdb60
dmkz/competitive-programming
e-olymp.com/7261 - difficult path.cpp
/* Problem: 7261. Difficult path Solution: dynamic programming, probability theory, O(n^2) Author: Dmitry Kozyrev, github: dmkz, e-mail: <EMAIL> */ #include <iostream> #include <iomanip> #include <vector> #include <algorithm> typedef long double ld; ld solve(const int steps, const int dist) { ...
ALGO
0.999698
4.130656
602b8507-f72c-4234-8da9-a351ab4279c4
woohyunjng/Coding-Practice
PS/Baekjoon/13000/13547.cpp
#include <bits/stdc++.h> #define int long long #define MAX 100100 #define MAX_VAL 1000100 using namespace std; typedef pair<int, int> pr; typedef array<int, 3> tp; int arr[MAX], ans[MAX]; int cnt[MAX_VAL]; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int N, ...
ALGO
0.999949
4.36866
d778af14-b742-41c2-a23a-80f0641d6fb4
honeyspoon/flutter-ffi-test-sox
android/.cxx/cmake/debug/armeabi-v7a/third/sox/src/amr/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp
/* Filename: shr.cpp ------------------------------------------------------------------------------ MODULE DESCRIPTION Shift right function with overflow control ------------------------------------------------------------------------------ */ /*--------------------------------------------------------------------...
ALGO
0.90651
6.475101
18cd565e-85bf-4c46-a080-0d356b08b68c
the-timoye/HSADP
hsadp.cpp
#include <iostream> #include <vector> #include <unordered_map> #include <optional> #define _LOG std::cout #define _ENDLOG std::endl #define _vector std::vector #define _optional std::optional #define _unorderedMap std::unordered_map #define _pair std::pair #define _STR std::string #define _NULLOPT std::nullopt // Fun...
ALGO
0.999554
4.667751
ebbba9f2-255c-494c-890d-8dd2b4c30389
MeshaZa/Alogs
treaps (France haters).cpp
struct Node{ll tree, heap; Node *l, *r;}; Node *merge(Node *L, Node *R){ // Нет ситуации кокгда L == R == NULL if(L == NULL) return R; if(R == NULL) return L; if(L->heap > R->heap){ L->r = merge(L->r, R); return L; } R->l = merge(L, R->l)...
ALGO
0.999658
3.954573
4e5ce229-8b5c-466e-9587-97ff0ee78d46
lantian-fz/test_cpp
test_278/test_278/main.cpp
#define _CRT_SECURE_NO_WARNINGS 1 #include <iostream> #include <map> using namespace std; int findLostCard(int* p, int pLen) { map<int, int> mp; for (int i = 0; i < pLen; i++) mp[p[i]]++; for (auto e : mp) { if (e.second < 4) return e.first; } return -1; } int main() { int arr[] = { 1, 2, 1, 2, 3, 1, ...
ALGO
0.999411
3.987074
ca677e65-544a-480e-a74d-2d43bdaa7e15
archermind/MTK_X20_BASE_AOSP
system/core/base/strings.cpp
#include "base/strings.h" #include <stdlib.h> #include <string.h> #include <string> #include <vector> namespace android { namespace base { #define CHECK_NE(a, b) \ if ((a) == (b)) abort(); std::vector<std::string> Split(const std::string& s, const std::string& delimiters) { CHECK...
TOOL
0.983417
7.371145
7666dd0b-da7b-4991-ac17-7fc6ae075f3b
a1393323447/leetcode-solution
src/easy/p94.cpp
#include <bits/stdc++.h> using namespace std; /** * 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...
ALGO
0.999974
6.619725
97826f32-6585-4dec-af50-b072d7b0270c
Mr-vabs/apps
Dev/areaByvalueByaddress.cpp
/****************************************************************************** Write a program to print area of triangle, rectangle and square by using the same member function name where calling of triangle, rectangle and square member functions will be done by using call by value, address and reference respe...
TOOL
0.995416
5.528213
4db0d8b2-fcb8-4c21-b5b2-31c76f6017cb
eclipse-oniro-mirrors/third_party_boost
libs/numeric/ublas/doc/samples/symmetric_matrix.cpp
#include <boost/numeric/ublas/symmetric.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; symmetric_matrix<double, lower> ml (3, 3); for (unsigned i = 0; i < ml.size1 (); ++ i) for (unsigned j = 0; j <= i; ++ j) ml (i, j) = 3 * i + j; st...
ALGO
0.987874
3.862846
36f224a1-4afa-4f8e-93e1-09e7b150c164
robot-mazeee/Algorithms-and-Data-Structures
Algorithms/HeapSort.cpp
#include <iostream> using std::cout; void heapify(int a[], int heap_size, int i) { int largest = i, temp; int left = i*2 + 1, right = i*2 +2; if (left <= heap_size-1 && a[largest] < a[left]) largest = left; if (right <= heap_size-1 && a[largest] < a[right]) largest = right; if (largest != i) { ...
ALGO
0.999941
4.91237
d5ed9702-e9dc-4024-94a5-a2502338851c
makio93/competitive-othersites
TopCoder/SRM/srm750/div1/Q1/main0-2.cpp
// 自力AC #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i=0; i<(int)(n); ++(i)) #define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i)) #define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i)) #define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i)) #defin...
ALGO
0.999958
4.455733
400491fe-7a75-4cd0-8b54-234510295cdd
kdsh627/PS
프로그래머스/3/43105. 정수 삼각형/정수 삼각형.cpp
#include <string> #include <vector> using namespace std; int solution(vector<vector<int>> triangle) { int answer = 0; for(int i = triangle.size()-2; i >= 0; i--) { for(int j = 0; j < triangle[i].size(); j++) { triangle[i][j] += max(triangle[i+1][j], triangle[i+1][j+1]); ...
ALGO
0.999887
5.63355
32ed8d79-4170-4c29-941e-be9d711bfa6e
AlmSmartDoctor/study-2023-03-algorithm-problem-solving
day08 bfs/assignment/13460 서민혁.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N, M; cin >> N >> M; queue<vector<int>> next; vector<vector<char>> map(N, vector<char>(M)); vector<int> initial_state(5); // state ...
ALGO
0.999759
4.816927
98eebfd8-0668-4407-9ba2-074158930bc8
manikanta2901/ubuntu
.history/practice/cpp/codeforces/THeGreatHero_20210319205039.cpp
#include <bits/stdc++.h> #include<vector> #include<iostream> #include<cmath> #include<algorithm> #include<iterator> #include<string> #include<map> #include<queue> using namespace std; #define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++) //Pre processors & typedefs ...
ALGO
0.999567
3.499643
6ccc92b8-9871-4e63-8402-44140a07b8b9
ihaagrawal/GFG-Problem-Of-The-Day
Day-0302: Activity Selection.cpp
// Activity Selection (MEDIUM) // https://www.geeksforgeeks.org/problems/activity-selection-1587115620/1 class Solution { public: static bool comp(pair<int,int>& a, pair<int,int>& b){ return a.second < b.second; } int activitySelection(vector<int> start, vector<int> end){ int ...
ALGO
0.99995
5.555054
0fdde804-4b31-4032-9298-001865a46ae3
GregBowyer/ManagedRuntimeInitiative
MRI-J/hotspot/src/share/vm/opto/doCall.cpp
#include "assembler_pd.hpp" #include "callGenerator.hpp" #include "callnode.hpp" #include "cfgnode.hpp" #include "ciStreams.hpp" #include "compile.hpp" #include "deoptimization.hpp" #include "parse.hpp" #include "runtime.hpp" #include "sharedRuntime.hpp" #include "stubRoutines.hpp" #include "atomic_os_pd.inline.hpp" #...
TOOL
0.852993
6.523217
751f166b-badf-48a0-b9dc-f6114ec401cf
GuilhermeJC13/algoexpert
src/algoexpert/arrays/medium/move_element_to_end/solution1.cpp
#include <vector> using namespace std; vector<int> moveElementToEnd(vector<int> array, int toMove) { int size = array.size(); for(int i = 0; i < size; i++){ if(array[i] == toMove){ array.erase(array.begin() + i); array.push_back(toMove); i--; size--; } } return array; }
ALGO
0.99238
5.13824
5ef5b16e-7302-4b59-91ba-671f7b88796b
hoangtoan232003/C-
erase insert.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector <int> v(n); for(int i=0;i<n;i++) { cin >> v[i]; } int t; cin >> t; while(t--) { int tt; cin >> tt; if(tt == 1) { int index, x; cin >> index >> x; if(index >=0 && index <= v.size()) { v.insert(v.begin() + index...
ALGO
0.999809
4.620293
c6c46fbd-7279-4015-8c3c-917c66a861f3
rasyt123/Leetcode-Solutions
diameter-of-binary-tree/Accepted/8-31-2021, 3_44_36 PM/Solution.cpp
// https://leetcode.com/problems/diameter-of-binary-tree /** * 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) {} * Tr...
ALGO
0.999832
6.733636
418ddffc-59b1-4b7b-a038-77a181f78240
serendipityConfusion/leetcode-pracitce
longest_common_prefix.cpp
//最长公共前缀 /* 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 */ string longestCommonPrefix(vector<string> &strs) { if (strs.size() == 0) { return {}; } sort(strs.begin(), strs.end()); string ans = strs[0]; for (auto &e : strs) { int i = 0; while (i < ans.size...
ALGO
0.999349
4.375554
44067c14-e5d8-4fcc-b035-0811be47ec2f
amanbhardwaj12072003/Full_DSA_Course
Uber/Ques3.cpp
int calculateShortestPath(int numStops, vector<int> credits, int numRoads, vector<vector<int>> roads, int source, int dest) { vector<vector<pair<int, int>>> adjacencyList(numStops); for (int i = 0; i < numRoads; i++) { int u = roads[i][0]; int v = roads[i][1]; int weight = roads[i][2]; ...
ALGO
0.999974
4.782547
3a98f28e-c027-47ed-96b2-985b30f50c72
Arushigandhi/DAA_Codes
Lab 9/TravellingSP.cpp
// C++ implementation of the approach #include <bits/stdc++.h> using namespace std; #define V 4 // Function to find the minimum weight Hamiltonian Cycle void tsp(int graph[][V], vector<bool> &v, int currPos, int n, int count, int cost, int &ans) { // If last node is reached and it has a link // to th...
ALGO
0.999994
5.599431
7a956d19-46af-4d0b-a082-42179bbcf4a2
InitGo/acwing
ac基础班/ch3/849Dijkstra.cpp
//https://www.acwing.com/activity/content/problem/content/918/ #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int N = 510; int n, m; int g[N][N]; int dist[N]; bool st[N]; int dijkstra() { memset(dist, 0x3f, sizeof dist); dist[1] = 0; //为什么这里不需要st[1] = true; /...
ALGO
0.999981
4.345453
0ce0ab4a-98ed-4521-89a9-9938df19cf8b
gradyjiang/LeetCodeProject
LeetCodeProject/CMaxProfit.cpp
//假设有一个数组,它的第 i 个元素是一个给定的股票在第 i 天的价格。 //设计一个算法来找到最大的利润。你可以完成尽可能多的交易(多次买卖股票)。然而,你不能同时参与多个交易(你必须在再次购买前出售股票)。 #include "CMaxProfit.hpp" using std::vector; int CMaxProfit::maxProfit(vector<int> &prices) { if (prices.size() == 0) { return 0; } int buyValue = INT_MAX; int gainSum = 0; ...
ALGO
0.999772
5.156322
5bee39cf-8e06-4e67-8fd2-c40ba1b6834c
NAIMKHAN3/Algorithtms_Ass-3
Building.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int const int N = 1e5 + 5; int parent[N]; int groupSize[N]; void dsuInitialize(int n) { for (int i = 1; i <= n; i++) { parent[i] = -1; groupSize[i] = 1; } } int dsuFind(int node) { if (parent[node] == -1) return no...
ALGO
0.999936
4.714137
fc8d3c91-2b6d-4d0d-9c0f-92cfb62e3b88
voletisailaja/Codechef-Solved-Problems
WATERCOOLER2.cpp
#include <iostream> using namespace std; int main() { // your code goes here int t; cin>>t; while(t--){ int x,y; cin>>x>>y; int p=y/x; if(x<y) cout<<(y-1)/x<<endl; else cout<<0<<endl; } return 0; }
ALGO
0.999558
4.720783
907bf5c0-12d3-4d4c-a503-d97d962f6d20
derinman/EB_Cpp-Note
ch05/ex05_14.cpp
#include <iostream> #include <iomanip> using namespace std; int main() { int ini, max; char days[7][7] = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日", }; cout << "輸入本月的總天數:"; cin >> max; cout << "上月最後一天星期幾:"; cin >> ini; cout << endl; for(int i=0; i<=6; i++)...
ALGO
0.998097
3.041011
ef393211-43e2-42a1-ad4a-db79c4843af6
vidsinghal/Cornucopia
HashEnabledLLVM/libc/src/math/remquof.cpp
#include "src/math/remquof.h" #include "src/__support/common.h" #include "utils/FPUtil/DivisionAndRemainderOperations.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *exp)) { return fputil::remquo(x, y, *exp); } } // namespace __llvm_libc
ALGO
0.903929
5.710754
56b9677d-2cf5-4be6-9743-276c691227fe
ayushi0809/leetcode-problem
0038-count-and-say/0038-count-and-say.cpp
class Solution { public: string mapfunction(vector<pair<char,char>>v, string n){ //cout<<n<<endl; string str = n; int s = str.size(); int start =0; int end = 1; char ch = str[0]; // cout<<str[0]<<endl; int len; while(end<s){ if(ch !=...
ALGO
0.999997
6.194484
bc29f6cd-cc5e-40a1-aa05-23bf9ae5a91e
rikux1204/CppGame
cocos2d/cocos/platform/winrt/CCFileUtilsWinRT.cpp
#include "platform/winrt/CCFileUtilsWinRT.h" #include <regex> #include "platform/winrt/CCWinRTUtils.h" #include "platform/CCCommon.h" #include "tinydir/tinydir.h" using namespace std; NS_CC_BEGIN static std::string s_pszResourcePath; // D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt static inline std::str...
TOOL
0.914478
6.392753
122599f7-94a6-481d-8fed-51baa98048ab
BezarHere/LoadScript
LoadScript/src/LoadScript.cpp
#include "pch.h" #include "LoadScript.h" #define out #define forceinline __forceinline using bite::BufferVector_t; using bite::StreamReader; using bite::StreamWriter; using namespace loadscript; typedef struct { Error error; std::vector<std::string> warnings; } Report_t; enum class WordTokenType : uint8_t { }; ...
TOOL
0.855953
4.994532
103ae12f-1d15-46d9-ba42-bdcbfc225f1e
PriyanshK09/Leetcode-Discord-Bot
solutions/find-the-value-of-the-partition.cpp
// Time: O(nlogn) // Space: O(1) // sort class Solution { public: int findValueOfPartition(vector<int>& nums) { sort(begin(nums), end(nums)); int result = numeric_limits<int>::max(); for (int i = 0; i + 1 < size(nums); ++i) { result = min(result, nums[i + 1] - nums[i]); ...
ALGO
0.999949
5.973502
322bfb8d-690b-4263-a353-271a892fd99c
EBRARORHAN/Rek-rsif-Fonksiyonlar
14.cpp
#include <stdio.h> int toplam(int n){ if(n<2) return 1; else return toplam(n-1)*toplam(n-1)+n; } int main(){ int x=3; printf("%d",toplam(x)); return 0; }
ALGO
0.999937
3.779335
9bbbf550-0d08-46ee-8d5b-203d41cedb21
GusSampaio/advanced_alg
backtracking/b-word_search/word_search.cpp
//Student: Gustavo Sampaio Lima //ID: 12623992 #include <bits/stdc++.h> #include <iostream> using namespace std; vector<string> matrix; int search_for_first_letter(string word, int matrix_y, int matrix_x); int search_for_word(string word, int y_pos, int x_pos, int word_letter, int word_size); int main(){ int mat...
ALGO
0.999931
4.479325
5a27b464-86f8-4d48-85af-98dc8d0d8095
kinishneema/Problem-Solving
question/missing_number.cpp
//missing number question from coding nijas /* int missingNumber(vector<int>&a, int N) { // Write your code here. int xor1=0,xor2=0; int n=N-1; for(int i=0;i<n;i++){ xor2=xor2^a[i]; xor1=xor1^(i+1); } xor1=xor1^N; return xor1^xor2; } */
ALGO
0.999893
4.922332
a0b63ded-5fd1-4723-8db2-55bbbbe18c55
Dipto-shaha/LeetCode-Daily-Challenge
0852-peak-index-in-a-mountain-array/0852-peak-index-in-a-mountain-array.cpp
class Solution { public: int peakIndexInMountainArray(vector<int>& arr) { int li=1,hi=arr.size(),mid; while(li<=hi) { mid=(li+hi)/2; if(arr[mid-1]< arr[mid]) li=mid+1; else hi=mid-1; } return li-1; } };
ALGO
0.99997
5.576148
83b95a9f-1168-42e1-a705-da3712ff025a
Strawberry9583/LeetCode
Challenge/30Day_LeetCoding_Challenge/Day9_backspace_string_compare/Day9_backspace_string_compare/Day9_backspace_string_compare.cpp
#include<iostream> #include<string> #include<algorithm> using namespace std; class Solution1 { public: bool backspaceCompare(string S, string T) { int s_size = 0, t_size = 0; for (int idx = 0; idx < S.size(); ++idx) { if (S[idx] == '#') { s_size = std::max(0, s_size-1); } else { if (s_size != id...
ALGO
0.999454
5.520247
36caeaa4-1c1f-4486-aeb2-e74f357e8160
bkoh1782291/Algorithms-And-Data-Structures
pracexam3/Heap.cpp
#include "Heap.h" using namespace std; Heap::Heap(int *a, int l){ // passing in pointer array and length arrsize = l; temparray = a; buildHeap(); } void Heap::buildHeap(){ for (int i = arrsize / 2 - 1; i >= 0; i--){ siftDown(i); } } void Heap::siftDown(int i){ int left = 2*i + 1; int right ...
ALGO
0.996187
3.628272
6db84e57-1d95-4207-ab83-1fe806b3ca46
seo-bo/ProblemSolving
백준/Gold/33156. 구간이 이븐하지 않아요./구간이 이븐하지 않아요..cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int ary[5005] = { 0, }; int main(void) { cin.tie(0)->sync_with_stdio(0); int n = 0; cin >> n; vector<pii>temp(n); for (int i = 0; i < n; ++i) { cin >> temp[i].first; temp[i].second = i; } sort(temp.begin(), temp....
ALGO
0.999992
4.552408
19ed8d0b-8baa-45c2-b16d-06c238cc7750
Altu-Bitu-2/Notice
05월 31일 - 최소 신장 트리/라이브 코딩/4386_prim.cpp
#include <iostream> #include <cmath> #include <queue> using namespace std; typedef pair<double, int> ci; const int INF = 1e5; double prim(int n, int start, vector<vector<ci>> &graph) { double sum = 0; // 간선 비용의 합 priority_queue<ci, vector<ci>, greater<>> pq; vector<bool> visited(n, false); //정점 방문 여부 (다익...
ALGO
0.999603
4.139249
99e41d7f-a159-46cb-8655-2ed05ad4b031
gunh0/algorithms
BOJ/2738_행렬 덧셈.cpp
#include <iostream> using namespace std; const int MAXN = 100; int A[MAXN][MAXN], B[MAXN][MAXN], C[MAXN][MAXN]; int main() { int N, M; cin >> N >> M; // 행렬 A 입력 받기 for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { cin >> A[i][j]; } } // 행렬 B...
ALGO
0.999946
4.024287
3a18e06d-f0e1-4788-b869-0f99ccea9b7a
gautamabhinav/DSA-Coding-Ninjas
2nd part/Arrays/1.cpp
#include <iostream> #include <climits> using namespace std; int main(){ //Take array input from the user int n; cin>>n; int input[100]; for(int i=0;i<n;i++) cin>>input[i]; //print arrray for(int i=0;i<n;i++) cout<<input[i]<<endl; //largest element of an array /...
ALGO
0.999259
4.07335
5f98b492-b946-4784-a21f-ae33853993be
aman-hood/CipherSchools
Day 14/Ques 2.cpp
#include <iostream> using namespace std; class Rectangle{ private: int length; int width; public: Rectangle(int l,int b) : length(l) , width(b) {} Rectangle(const Rectangle& other) : length(other.length), width(other.width) {} void Area(){ cout<<"Area: "<<length*width<<endl; } void ...
TOOL
0.868214
4.508729
ff6c68bb-9b0a-4188-99da-24d9c4c10a66
Nehagarg816/DSA-practice
st.cpp
#include <iostream> #include <stack> using namespace std; class Queue { public: stack<int> st1; stack<int> st2; void push(int ele) { st1.push(ele); } int pop(void) { if (!st2.empty()) { int ele = st2.top(); st2.pop(); return ele; ...
ALGO
0.996935
4.438759
1fde54b7-599b-4741-a6aa-aae2e51b2a51
TheFenrisLycaon/DSA-C--
cp/CodeForces/1100-1199/1144D.cpp
#include <cstdio> #include <vector> #include <map> struct action{long w, from, to;}; int main(){ long n; scanf("%ld", &n); std::vector<long> a(n); std::map<long,long> cm; long target(0), pos(-1), mx(-1); for(long p = 0; p < n; p++){ scanf("%ld", &a[p]); ++cm[a[p]]; if(cm[a[p]...
ALGO
0.999798
3.244961
10cc6c47-7f81-4b43-8b9a-3007a9d59cea
tech-rounak/DSA
Binary Search Tree/Search.cpp
#include <bits/stdc++.h> using namespace std; struct Node { int val; Node *left, *right; Node(int x) { val = x; left = right = NULL; } }; Node *insert(Node *root, int x) { if (root == NULL) { return new Node(x); } else if (x > root->val) { root->r...
ALGO
0.999972
4.487552
90911043-ac46-4d5d-bcf4-59393f201c03
delta4d/AlgoSolution
poj/1013.cpp
#include <cstdio> #include <memory> using namespace std; const int MAXN = 13; const char s[2][6] = {"heavy", "light"}; int w[MAXN]; struct node { char s1[MAXN]; char s2[MAXN]; char r[MAXN]; }f[3]; inline bool gao() { int i, j, k; int sum1, sum2; int len; for (i=0; i<3; ++i) { len = strlen(f[i].s1); sum1 = ...
ALGO
0.999055
3.242516
d5a74159-6e21-4899-a65b-c36e3928ff2c
ehnryx/acm
petrozavodsk-winter-2015-cf100956/virtual/d.cpp
#include <bits/stdc++.h> using namespace std; #define nl '\n' typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int INF = 0x3f3f3f3f; const int N = 1 << 17; int segt[2*N], lazy[2*N]; void push(int i) { if (lazy[i] != 0) { segt[2*i] += lazy[i]; segt[2*i+1] += lazy[i]; lazy[2...
ALGO
0.999962
3.971874
e062558f-7f7b-4725-9e99-5a6e3ba5665f
CoolSoumyadip/Facebook_Interview_Questions_Leetcode
2-add-two-numbers/2-add-two-numbers.cpp
class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode *head = new ListNode(0); ListNode *p = l1, *q = l2, *curr = head; int carry = 0; while(p != NULL || q != NULL) { int x = p ? p->val : 0; int y = q ? q->val : 0; ...
ALGO
0.999855
6.438886
0f6f2e70-a4da-4cb9-8d3e-01892c0b2fd1
cyberdstar/opencv_contrib
modules/optflow/src/sparsetodenseflow.cpp
#include "precomp.hpp" #include "opencv2/ximgproc/sparse_match_interpolator.hpp" using namespace std; namespace cv { namespace optflow { CV_EXPORTS_W void calcOpticalFlowSparseToDense(InputArray from, InputArray to, OutputArray flow, int grid_step, int k, ...
ALGO
0.996982
6.115517