uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
ebad8e46-c6f8-44fc-93a8-7307887bbc5e
dogukan-c/dsa-in-cpp
1_Arrays/move_zeros.cpp
// move_zeros.cpp // Problem: Move all 0s to end without changing order of non-zero elements // Technique: Two-pointer overwrite (O(n)) #include <iostream> #include <vector> using namespace std; void moveZeroes(vector<int> &nums) { int insertPos = 0; for (int num : nums) { if (num != 0) nums[insertPos++] = ...
ALGO
0.999921
7.581196
7b2721f8-a737-40cc-aa13-70ff8258247e
DivyankSisodia/DSA-Problem-set
0050-powx-n/0050-powx-n.cpp
class Solution { public: double myPow(double x, int n) { if(n == 0){ return 1; } if(n<0){ n = abs(n); x = 1/x; } if(n%2 == 0){ return myPow(x*x, n/2); } else{ return x * myPow(x*x, n...
ALGO
0.999737
5.861021
cde99821-6433-4bac-ae92-c2175d63b5bf
zjxjwxk/PAT
C++/Advanced Level/A1078.cpp
#include <cstdio> #include <cmath> const int maxn = 100000; bool is_prime(int n) { if (n <= 1) { return false; } int sqr = (int) sqrt(1.0 * n); for (int i = 2; i <= sqr; i++) { if (n % i == 0) { return false; } } return true; } int main() { int m_size, ...
ALGO
0.999987
4.3231
38418a9a-ca57-4e1b-9f5d-2fc369950afc
NirajPudasaini/ompl
src/ompl/geometric/planners/kpiece/src/LBKPIECE1.cpp
/* Author: Ioan Sucan */ #include "ompl/geometric/planners/kpiece/LBKPIECE1.h" #include "ompl/base/goals/GoalSampleableRegion.h" #include "ompl/tools/config/SelfConfig.h" #include <cassert> ompl::geometric::LBKPIECE1::LBKPIECE1(const base::SpaceInformationPtr &si) : base::Planner(si, "LBKPIECE1") , dStart_([this]...
ALGO
0.998822
6.77607
481ab1af-4e8d-46b4-8871-e784383960af
ishandutta2007/codeforces
18michael/normal/1672/D.cpp
#pragma GCC optimize("O3") #pragma GCC target("avx2") #include<bits/stdc++.h> #define LL long long using namespace std; int n,Test_num;bool ok; int a[1000002],b[1000002],cnt[1000002],cnt1[1000002]; bool u[1000002]; template<class T>void read(T &x) { x=0;int f=0;char ch=getchar(); while(ch<'0' || ch>'9')f|=(ch=='-'),c...
ALGO
0.999984
3.807162
99e0fdfc-5666-42c4-97f6-49a93ed60a87
mdsiaofficial/ProblemSolving
CodeForces/Codeforces Round 913 (Div. 3)/A_Rook.cpp
#include <bits/stdc++.h> #include <iostream> #include <iomanip> #include <cmath> #include <string> #define pi 3.14159 #define forn(i, n) for (int i = 0; i < int(n); i++) #define ll long long #define ld long double #define ull unsigned long long #define mod 90000007 #define fs(n) fixed<<setprecision(int(n)) #define s(...
ALGO
0.999367
5.017419
a2491574-e034-453b-9805-a370ae97bb7d
partho-das/CompetitiveProgrmming
CP_CODE/Tamplate/Normal/Codeforces Round #838 (Div. 2)/b.cpp
#include <bits/stdc++.h> using namespace std; //____________________________________________________________________________________________________________________________________ #define PI 2*acos(0.0) #define pf printf #define sc scanf #define ff first #define ss second #define pb push_back typedef long long l...
ALGO
0.998456
3.537622
917050ec-56d4-41ce-ac60-04240d285473
Octavi-Testing/frameworks_av
media/codecs/amrwb/dec/src/lagconceal.cpp
/* ------------------------------------------------------------------------------ Filename: lagconceal.cpp Date: 05/08/2007 ------------------------------------------------------------------------------ REVISION HISTORY Description: --------------------------------------------------------------------------...
ALGO
0.99897
7.799687
86d348ba-ba8c-4d93-8984-c09f22fa4cdf
alim-buet/DSAII
maxflow/escapeGrid.cpp
#include <iostream> #include <vector> #include <queue> #include <algorithm> using namespace std; const int INF = 1e9; int n; // Directions: right, down, left, up int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; // Mapping (i,j) → unique id int cellID(int i, int j) { return i * n + j; } int bfs(vector<vector<...
ALGO
0.999987
5.784683
c3ea0df0-5238-484f-aeda-6e747bd6bd4b
TheFenrisLycaon/DSA-C--
cp/CodeForces/0900-0999/909C.cpp
#include <cstdio> #include <vector> int main(){ const long MOD = 1000000007; long n; scanf("%ld\n", &n); std::vector<long> f; f.push_back(1); for(long p = 0; p < n; p++) { char ch; scanf("%c\n", &ch); if(ch == 'f'){f.push_back(0);} else{for(long q = 1; q < f.size(); q++){f[q]...
ALGO
0.99985
3.729657
b88e6bc3-bbc4-4311-b6ea-8ffffc37ad51
boostpro/boost-release
libs/algorithm/string/example/find_example.cpp
// Boost string_algo library example file ---------------------------------// // See http://www.boost.org for updates, documentation, and revision history. #include <string> #include <iostream> #include <algorithm> #include <functional> #include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/stri...
TOOL
0.996337
4.969246
86441471-5355-48fc-93d4-44b3e773cad7
vaz1e/OOP_labs
lab4/tree.cpp
#include "tree.h" #include <stdexcept> TBinaryTree::TBinaryTree() { t_root = nullptr; } void TBinaryTree::Push(const Fiveanglefigure& fig) { TreeElem* curr = t_root; if (curr == nullptr) t_root = new TreeElem(fig); while (curr) { if (curr->get_fig() == fig) { ...
ALGO
0.962285
4.392025
a4e69c38-f09e-489a-ad87-b004b77f5c31
JianCong-WENG/IterCluster
IterCluster/IterCluster-MCL/src/eigen-eigen-b9cd8366d4e8/doc/examples/matrixfree_cg.cpp
#include <iostream> #include <Eigen/Core> #include <Eigen/Dense> #include <Eigen/IterativeLinearSolvers> class MatrixReplacement; template<typename Rhs> class MatrixReplacement_ProductReturnType; namespace Eigen { namespace internal { template<> struct traits<MatrixReplacement> : Eigen::internal::traits<Eigen::S...
ALGO
0.998868
4.483037
de9f5b94-bf71-4f05-b423-9feafdcac762
NicolasBoeno/poke_app
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998733
6.76775
e5f61596-fc29-447c-908f-b19bd5d24a7a
xmyqsh/leetcode2016
1367_linked-list-in-binary-tree.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), le...
ALGO
0.999963
5.420059
0dd44c9d-c150-42f3-88f7-ecd8f767b426
lcomment/OOP_by_cpp
02_Practice/Ch07/book7-1.cpp
#include <iostream> #include <string> using namespace std; class Book { string title; int price, pages; public: Book(string title="", int price=0, int pages=0){ this->title = title; this->price = price; this->pages = pages; } // Book& operator+=(int b2){ // this->pri...
TOOL
0.929081
3.982015
4bacd792-05f3-4b64-813a-83aa3b320efa
GaijinEntertainment/DagorEngine
prog/tools/libTools/util/prepareBillboardMesh.cpp
#include <math/dag_mesh.h> #include <math/dag_Point4.h> #include <math/dag_Point3.h> #include <math/dag_Point2.h> #include <math/dag_TMatrix.h> #include <math/dag_bounds3.h> #include <generic/dag_sort.h> #include <math/random/dag_random.h> #include <shaders/dag_shaderCommon.h> #include <fx/dag_leavesWind.h> #include <u...
ALGO
0.97693
5.603627
ff5e0860-733f-45e6-a883-480e393f1fe6
MdAlSiam/My-Codeforces-Solutions
1337B t4.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ull unsigned long long int #define dd double #define scl(x) scanf("%lld", &x) #define scll(x, y) scanf("%lld %lld", &x, &y) #define scd(x) scanf("%lf", &x) #define scdd(x, y) scanf("%lf %lf", &x, &y) #define prl(x) printf("%lld\n", x) #de...
ALGO
0.999666
3.405906
f2276785-e26d-45a7-b970-3a72877ab617
passer-by-Wang/mujoco_go2
src/NMPC_solver.cpp
/***************************************************************************** BQR3 simulation Copyright (C) 2023 Hua Wang <EMAIL>. This file is part of BQR3. @file NMPC_solver.cpp @brief NMPC_solver Details. @author Hua Wang @email <EMAIL> @version 1.0.0 @date 2023/12/25 @licens...
ALGO
0.998248
4.624381
e391604d-a441-4b2a-b01c-9865a50de3b3
sheikh-Zulkifal/Leetcode-problems
226-invert-binary-tree/invert-binary-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.999969
6.365448
ea206e91-76a1-4d9f-8d7e-010e2169b58d
LonxunQuantum/Lammps_for_PWMLFF
lammps_neigh_mlff_20230508/lib/linalg/dlas2.cpp
#ifdef __cplusplus extern "C" { #endif #include "lmp_f2c.h" int dlas2_(doublereal *f, doublereal *g, doublereal *h__, doublereal *ssmin, doublereal *ssmax) { doublereal d__1, d__2; double sqrt(doublereal); doublereal c__, fa, ga, ha, as, at, au, fhmn, fhmx; fa = abs(*f); ga = abs(*g); ha = abs(*...
ALGO
0.999524
4.946771
05dbe20f-81b4-4842-ae14-7329b8409cd9
Dratopia18/PA-Proiectarea-Algoritmilor-
lab pa/demo/lab05/01-perms/perms_ref.cpp
#include <bits/stdc++.h> using namespace std; /* deoarece numerele sunt sterse din domeniu odata ce sunt folosite, solutia generata este garantata sa nu contina * duplicate. Astfel, atunci cand domeniul ajunge vid, solutia este intotdeauna corecta */ bool check(vector<int> solution) { return true; } void printSo...
ALGO
0.99992
5.50004
7bf31f10-7403-43a9-ba6d-a077a11351bd
Dawodu-Johnson/A2SV
kth-largest-element-in-an-array.cpp
class Solution { public: int findKthLargest(vector<int>& nums, int k) { priority_queue<int>store; for(int x: nums) store.push(x); while(k>1){ store.pop(); --k; } return store.top(); } };
ALGO
0.999934
5.126361
9dd14ea5-12c9-4b19-919b-8a90e78639a8
wassimalharaki/Codeforces
1300/Particles.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define INF LONG_LONG_MAX #define nl << '\n' #define v vector #define pb push_back #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define mp make_pair #define F first #define S second using pii = pair<int, int>; using vi = v<...
ALGO
0.999624
6.042457
ebfee81d-cac1-4145-a341-81cfd16db8b3
ishandutta2007/codeforces
lhic/normal/710/F.cpp
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> #define mp make_pair #define pb push_back typedef long long ll; typedef long double...
ALGO
0.999744
4.002196
ed0554ce-7e61-4a1d-97cf-9287e2c7b530
heartforge/leetcode
cpp/balancedBinaryTree.cpp
#include <algorithm> #include <cstdlib> #include <vector> class TreeNode { public: int val; TreeNode *left = nullptr; TreeNode *right = nullptr; TreeNode(int val) { this->val = val; } }; class Solution { public: bool isBalanced(TreeNode *root) { return dfs(root)[0] == 1; } std::vector<int> dfs(TreeNode *...
ALGO
0.999782
6.770711
0a76a3aa-0cb3-4846-9a02-88317fd53603
bsarvan/code_algorithms
UniqueFunction.cpp
#include <iostream> #include <vector> using namespace std; int main() { vector<int> v = {1,2,3,3,3,4,5,5,6}; vector<int>::iterator it; it = unique(v.begin(),v.end()); v.erase(it,v.end()); for(auto c:v){ cout<<c<<" "; } cout<<endl; return 0; }
ALGO
0.99914
4.118568
ce9ca332-636b-4499-9c74-3fe964f8299c
Dorshir/dorshir
cpp/src/algebra/rational.cpp
#include "rational.hpp" #include <numeric> // gcd, lcm #include <stdexcept> // invalid_argument, overflow_error #include <iostream> // cout, endl, ostream #include <climits> // INT_MAX namespace algebra { Rational::Rational(int numerator, int denominator) : m_numerator{numerator} , m_denominator{deno...
TOOL
0.936846
6.538095
2361c530-9029-456d-aa4e-78f6dba7b46e
ravi956/dsa-in-cpp
Binary Search Tree (GFG)/14_top_view_of_binary_tree.cpp
#include <bits/stdc++.h> using namespace std; struct Node { int data; Node *left; Node *right; Node(int k) { data = k; left = right = NULL; } }; // Time Complexity => O(nLog(hd)) // Space Complexity => O(hd + breadth of tree) // hd -> total no. of possible horizontal distance ...
ALGO
0.999975
5.408523
1f8cfc7f-1265-4d7f-9e7d-be9e0f350ee8
limeandonyy295/SchoolProject
src/32.cpp
#include <iostream> using namespace std; int main() { int n; cout << "Enter an integer: "; cin >> n; if (n % 2 == 0) { for(int i = 1; i <= n; ++i) { cout << "*"; } } else { for(int i = 1; i <= n - 1; ++i) { cout << " "; } cout << "*"; ...
ALGO
0.998955
4.592133
1db31b54-c77f-4cb3-a8c9-fc9883d3d9ef
MohamedElbashar/ProblemSolving-Archive
Training/Codeforces/Kefa and Company.cpp
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<pi> vpi; #define ll long long #define mem(a,b) memset(a,b,sizeof a) #define oo 1e8 #define minn(a, b, c) min(min(a, b), c) #define maxx(a, b, c) max(max(a, b), c) int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }; int...
ALGO
0.999964
3.577301
9e7ba53b-6dda-4a04-9989-7db582327864
DIPJOY10/CPPGraphSeries
Prim'sAlgoOptimal.cpp
#include <bits/stdc++.h> using namespace std; //optimal prim's algo implementation using priority queue. int main() { int n, m; cin >> n >> m; vector<pair<int, int>> adj[n + 1]; for (int i = 0; i < m; i++) { int u, v, wt; cin >> u >> v >> wt; //we consider the graph is undi...
ALGO
0.999994
4.927848
6d0ea9fe-64e6-498b-b97f-cfe283a8d913
robot-Yang/Ewenwan_vision
CNN/HighPerformanceComputing/example/fasterrcnn.cpp
#include <math.h> #include <stdio.h> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include "net.h" struct Object { cv::Rect_<float> rect; int label; float prob; }; static inline float intersection_area(const Object& a, const Object& b) { ...
ALGO
0.993096
7.025797
67037267-d381-494e-a4f4-96af85018243
huyenanhdang/17.11.2024
Bai 14.cpp
#include <stdio.h> int main() { int n; int arr[30]; int x; do { printf("Nhap so luong phan tu (0 < n < 30): "); scanf("%d", &n); if (n <= 0 || n >= 30) { printf("So phan tu khong hop le. Vui long nhap lai!\n"); } } while (n <= 0 || n >= 30); printf(...
ALGO
0.999446
3.880169
95776b92-a96f-4807-837e-1e125d370e8f
Aspetto33/leetcode
c++/剑指Offer34.二叉树中和为某一值的路径/剑指Offer34-二叉树中和为某一值的路径.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.999967
6.320258
250f62df-f835-4d46-a96c-dbf9708db6b6
ishandutta2007/codeforces
qwqcorz/normal/1503/D.cpp
#include<bits/stdc++.h> using namespace std; const int N=2e5+5; int read() { int s=0; char c=getchar(),lc='+'; while (c<'0'||'9'<c) lc=c,c=getchar(); while ('0'<=c&&c<='9') s=s*10+c-'0',c=getchar(); return lc=='-'?-s:s; } void write(int x) { if (x<0) putchar('-'),x=-x; if (x<10) putchar(x+'0'); else write(x/10...
ALGO
0.999838
3.508532
22e18d63-5d00-4bdc-bd07-9c6098ad83b7
ishandutta2007/codeforces
joisino/normal/427/B.cpp
#include <bits/stdc++.h> #define FOR(i,a,b) for( int i = (a); i < (int)(b); i++ ) #define REP(i,n) FOR(i,0,n) #define YYS(x,arr) for(auto& x:arr) #define ALL(x) (x).begin(),(x).end() #define SORT(x) sort( (x).begin(),(x).end() ) #define REVERSE(x) reverse( (x).begin(),(x).end() ) #define UNIQUE(x) (x).erase( unique( ...
ALGO
0.999983
3.769625
db422824-9ec6-4217-934f-ae14206df9aa
Richard-m-j/LeetCode
2634-MinimumCommonValue/2634-MinimumCommonValue.cpp
// Last updated: 7/24/2025, 8:23:42 AM class Solution { public: int getCommon(vector<int>& nums1, vector<int>& nums2) { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // if(nums1[nums1.size() -1] < nums2[0] || nums2[nums2.size() -1] < nums1[0]) // return -1; in...
ALGO
0.99999
5.43013
4d245a26-8222-455f-9f57-767e67735ad2
sora-taka/online-contest
codeforces/edu/180/2112B.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; void solve() { int n; cin >> n; vector<int> a(n); for (auto &e : a) cin >> e; ll d = a[1] - a[0]; bool f = true; for (int i = 1; i < n; ++i) { if (abs(a[i] - a[i - 1]) <= 1) ...
ALGO
0.999633
4.422662
a77419ab-c4b0-4e2e-a8ac-f0b24a74cd99
Sp-177/CODEFORCES
C_Valera_and_Elections.cpp
#include <iostream> #include <unordered_map> #include <unordered_set> #include <cstdio> using namespace std; #define ll long long unordered_map<ll, unordered_map<ll, ll>> adj; unordered_set<ll> candidates; void fastIO() { ios::sync_with_stdio(false); cin.tie(nullptr); } ll dfs(ll node, ll par) { ll sum...
ALGO
0.999801
4.595322
20f9e8be-c845-43b4-bc83-6060e44fe89d
gromacs/gromacs
src/gromacs/modularsimulator/velocityscalingtemperaturecoupling.cpp
/*! \internal \file * \brief Defines a velocity-scaling temperature coupling element for * the modular simulator * * \author Pascal Merz <<EMAIL>> * \ingroup module_modularsimulator */ #include "gmxpre.h" #include "velocityscalingtemperaturecoupling.h" #include <cmath> #include <cstdio> #include <algorithm> #...
ALGO
0.975591
6.950387
8d16cc7b-fb00-469b-bc55-72a2eb373ad4
p4lang/open-p4studio
pkgsrc/tofino-model/src/shared/checksum-engine-shared.cpp
#include <string> #include <rmt-log.h> #include <parser.h> #include <checksum-engine.h> namespace MODEL_CHIP_NAMESPACE { ChecksumEngineShared::ChecksumEngineShared(RmtObjectManager *om, int pipeIndex, int ioIndex, int prsIndex, ...
TOOL
0.93797
6.797805
d42821f3-849d-4f42-a2ad-25c2af76046c
KOL305/nutrimood-mobile
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.99887
6.783439
ff7714e2-eccf-4f82-932b-f3095fc9db74
Windrocer/olb_gr
examples/thermal/rayleighBenard3d/rayleighBenard3d.cpp
/* rayleighBenard3d.cpp: * Rayleigh-Benard convection rolls in 3D, simulated with * the thermal LB model by Z. Guo e.a., between a hot plate at * the bottom and a cold plate at the top. */ #include "olb3D.h" #include "olb3D.hh" // use only generic version! using namespace olb; using namespace olb::descriptors; ...
ALGO
0.999122
5.524581
56b51d6a-48cc-48a8-9495-b4bfbc816d66
hyperUnicorns/android_frameworks_av
media/libstagefright/codecs/amrnb/enc/src/cor_h_x2.cpp
/*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ #include "typedef.h" #include "cnst.h" #include "cor_h_x.h" #include "cor_h_x2.h" // BX #include "basic_op.h" /*--------------------------------------...
ALGO
0.99987
4.748839
3a2ccee3-5a75-4f92-980d-c983fb516d01
rock112233/ads
bellmanFord.cpp
#include <iostream> using namespace std; int *bellmanFord(int **arr, int size) { int weightList[size]; for (int i = 0; i < size; i++) weightList[i] = INT32_MAX; weightList[0] = 0; for (int i = 0; i < size - 1; i++) for (int j = 0; j < size; j++) for (int k = 0; k < size; k...
ALGO
0.999734
4.417789
02196327-28d9-4263-8dd2-b34611835059
Nemo21/Random-Bullshit-Go
DSA questions/Pattern questions/pattern3.cpp
#include <iostream> using namespace std; int main(){ int n; cin>>n; int row=1; while(row<=n){ int col=1; while(col<=row){ cout<<col+row-1<<" "; col=col+1; } cout<<endl; row=row+1; } return 0; }
ALGO
0.999872
4.011696
ce391c3f-580e-4a8d-89c6-4ad1c74e000e
AvianNetwork/Avian
src/assets/rewards.cpp
#include <utilstrencodings.h> #include <hash.h> #include <validation.h> #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/split.hpp> #include <chainparams.h> #include <univalue/include/univalue.h> #include <core_io.h> #include <net.h> #include <base58.h> #include <consensus/validatio...
TOOL
0.995341
6.543192
1c3b4978-1796-4c3b-9f17-0cebbf6204d3
ashishg2004/Leetcode-questions
540-single-element-in-a-sorted-array/single-element-in-a-sorted-array.cpp
class Solution { public: int singleNonDuplicate(vector<int>& arr) { int n=arr.size(); if(n==1) return arr[0]; if(arr[0]!=arr[1]) return arr[0]; if(arr[n-1]!=arr[n-2]) return arr[n-1]; int low=0,high=n-1; while(low<=high) { int mid=(low+high)/2; ...
ALGO
0.999958
5.565183
1bcd3374-79c7-47cd-abbb-588e0d060581
PhoenixAthens/DataStructures-Essentials
DataStructures-Essentials/NeetCode/Sort-Colors.cpp
#include <iostream> #include <vector> using std::cout; using std::cin; using std::vector; using std::swap; void sort_colors_1(vector<int>& nums){ //2-pass solution! int i=0; for(int j=0;j<nums.size();j++){ if(nums[j]==0){ swap(nums[j], nums[i++]); } } for(int j=i;j<nums.size(...
ALGO
0.999623
5.248698
798ec3b3-cb82-49e9-9e25-c482f898ab3e
Alwasib/Codeforce_Problem_Solving
1858A-Buttons.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c; if(a>b) { cout<<"First"<<endl; } else if(a<b) { cout<<"Second"<<endl; } else if(a==b) { ...
ALGO
0.999985
4.029744
c6268b48-4e72-4cf5-9311-03713763fbd2
Junichi-K/codeForces
Div 4/Round 964/F.cpp
#include<iostream> #include<vector> #include<algorithm> #include<unordered_map> #include<unordered_set> #define ll long long using namespace std; const int N = 2e5 + 1, mod = 1e9 + 7; ll fact[N]; ll pw(ll a, ll b) { ll r = 1; while(b > 0) { if(b & 1) r = (r * a) % mod; b /=...
ALGO
0.999946
4.848647
2d7446f9-7e58-410a-8711-65d6174c6f4a
dcode2004/TLE_CP-31_Sheet
C_Division_and_Union.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> PBDS; #define int long long #define f(i, s, e) for (int i = s; i < e; i++) #...
ALGO
0.999736
4.699195
ad2c6a24-f7b7-4fc1-b05e-e4217c23e460
xumingxsh/linux_hi_library
linux_hi_library/hicommon/impl/mutex/semaphoreImpl.cpp
#include "semaphoreImpl.h" #include "common/hiScopeGuard.h" using namespace std; namespace Hi { SemaphoreImpl::SemaphoreImpl(int max): handle_count_(max), isExit_(false) { } SemaphoreImpl::~SemaphoreImpl() { } bool SemaphoreImpl::request(const function<bool()>& fun) { if (isExit_) { fun(); return false; } is...
ALGO
0.881214
5.576791
a04e59bb-05a1-4b17-a1c6-17f3669e1bcc
naimulcsx/online-judge-solutions
Codeforces/919B - Perfect Number.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int k, cnt = 0; cin >> k; int i = 1; while( cnt < k ) { // calculate sum of the number int sum = [&](int n) -> int { int sum = 0; while( n / 10 ) { ...
ALGO
0.999855
3.901368
4ff3ef0e-f961-4523-87c2-2ca44d2cadd5
omkarharade/Competitive-Programming
Sanket Singh/segment trees/lis_using_segmentTree.cpp
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define MOD1 998244353 #define INF 1e18 #define nline "\n" #define pb push_back #define ppb pop_back #define mp make_pair #define ff first #define ss second #define PI 3.141592653589793238462 #define set_bits __builtin_popcountll #define sz(x) ((int)...
ALGO
0.99988
4.493842
01f2f460-6b67-437e-81b4-65e42ccd3ed0
merlinepedra/Mergecoin-master
src/masternode-pos.cpp
#include "sync.h" #include "net.h" #include "key.h" #include "util.h" #include "amount.h" #include "script.h" #include "base58.h" #include "protocol.h" #include "activemasternode.h" #include "masternodeman.h" #include "spork.h" #include <boost/lexical_cast.hpp> #include "masternodeman.h" using namespace std; using nam...
WEB
0.952627
4.759743
597e8107-c7d4-4113-912e-ba392a4eb250
Moongss/ps
Baekjoon/30000-39999/30648.cpp
#include <bits/stdc++.h> #include <ext/rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define endl "\n" #define fastio cin.tie(0)->sync_with_stdio(0) #define x first #define y second #define all(v) v.begin(), v.end() #define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end()...
ALGO
0.99997
4.31907
84409792-8785-4c3f-b2bb-14da13db9126
shajib-das/Programming-School-by-Outsbook
107.cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, d1, d2, ap; cin >> x >> d1 >> d2; ap = ((x * d1) / d2) - x; cout << ap << endl; return 0; }
ALGO
0.999502
3.122513
b5e39dd1-6cb6-46ae-9821-8bc0890a5715
yu3mars/proconVSCodeGcc
atcoder/abc/abc085/c.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { int n, y; cin >> n >> y; int a=-1,b=-1,c=-1; for(int i = 0; i <= n; i++) { for(int j = 0; j <= n - i; j++) { int k = n-i-j; if(i*10000+j*5000+k...
ALGO
0.999632
3.134376
f5ca176c-2180-4538-8584-02ee46a0a93b
mwilden/stosh
Engine/application.cpp
//// //// Includes //// #include "bitboard.h" #include "direction.h" #include "endgame.h" #include "evaluate.h" #include "material.h" #include "mersenne.h" #include "misc.h" #include "movepick.h" #include "position.h" #include "search.h" #include "thread.h" #include "ucioption.h" /// Application class is in charge of...
TOOL
0.949412
6.269094
b94fdb5c-df60-4886-acbd-17db15c9cee4
choiyounji/algorithm
프로그래머스/1/12982. 예산/예산.cpp
#include <iostream> #include <stdio.h> #include <string> #include <vector> #include <algorithm> using namespace std; int solution(vector<int> d, int budget) { int answer = 0; int cost=0; sort(d.begin(),d.end()); for(int i=0;i<d.size();i++){ cost+=d[i]; if(cost>budget) break...
ALGO
0.999549
4.746719
2b4535bf-2227-4c6d-8560-1530405a6e8f
avendramini/leetcode
solved_problems/0236-lowest-common-ancestor-of-a-binary-tree/solution.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: vector<TreeNode*> padriP; vector<TreeNode*> padriQ; int hP; int hQ; int lol; ...
ALGO
0.999984
5.818952
58c4778f-916b-4395-b3a5-82d701e4c6d4
shivanikush/march_leetcode_challenge
Day3_leetcode_413.cpp
//O(N*N) method class Solution { public: int numberOfArithmeticSlices(vector<int>& nums) { // if nums size is less than 3 return false if(nums.size() < 3) return 0; int cnt = 0, diff; for(int i = 0; i<nums.size()-2; ++i) { // storing diff of first 2...
ALGO
0.999902
5.959065
36f4b629-7750-4851-809c-bc938dae7074
salRoid/DS_Interview
Singly Linked List/104_DeletePos.cpp
/** Problem: Delete a linked list node at a given postion. @author salroid www.salroid.me */ #include <bits/stdc++.h> using namespace std; struct Node { int data; struct Node *next; }; void printList(struct Node *head) { while (head != NULL) { cout << head->data << " "; head = head->next; } co...
ALGO
0.999922
5.151716
0a6b102b-b75f-4340-a6f8-854718a8225e
MRM-AIA-TP-2026/MRM_SahilSinha
C++ course/Course 2/Module 2/exercise1.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { int a = atoi((argv[1])); int b = atoi((argv[2])); int *p1 = &a; int *p2 = &b; //add code below this line if (*p1>*p2) {cout<<"The larger number is "<<*p1;} else if (*p2>*p1) {cout<<"The larger number is "<<*p2;} els...
ALGO
0.996774
3.066829
06a214e2-7423-49d5-ae45-c10a6a684562
YALOKGARua/leetcode
1900. The Earliest and Latest Rounds Where Players Compete.cpp
class Solution { using P = std::pair<int, int>; std::unordered_map<long long, P> memo; static long long kkey(int n, int a, int b) { if (a > b) std::swap(a, b); return (static_cast<long long>(n) << 20) | (static_cast<long long>(a) << 10) | b; } P dfs(int n, int a, int b) { if ...
ALGO
0.999803
5.382788
6972dcd8-9960-46e4-b0f6-4c466c9305cd
hrtwt/kyopuro
atcoder/abc/abc172/a/main.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; void solve() { int a; cin >> a; cout << a + a * a + a * a * a << endl; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); solve(); return 0; }
ALGO
0.998479
3.441641
cc5a8844-e856-4098-a813-3ea40f098ac5
jimmyhalimi/AndroidOpenCV
read_frame/toolchain/android-ndk-r17c/sources/cxx-stl/llvm-libc++/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
// <queue> // priority_queue(const priority_queue&) = default; #include <queue> #include <cassert> #include <functional> template <class C> C make(int n) { C c; for (int i = 0; i < n; ++i) c.push_back(i); return c; } int main() { std::vector<int> v = make<std::vector<int> >(5); std::prio...
TEST
0.931255
4.653155
0ea17d2f-757f-499c-a159-9d8caa4abc11
Asevenx174/CP-source-code-
02_OJ_solution/Cf contest/780 div3/c.cpp
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define pf printf #define ff first #define ss second #define sef second.first #define ses second.second #define PI 3.14159265 /// tan inverse = atan(value)*(180/PI) #define ms(a,b) memset(a, b, sizeof(a)) #define lp(i,a,b)...
ALGO
0.999863
4.048862
25176204-a9ce-43d5-bf03-6753b1a83e8b
Jikky1618/AtCoder
ABC/ABC300-349/ABC311/e-1.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include <debug_print.hpp> #define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else #define debug(...) (static_cast<void>(0)) #endif int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed...
ALGO
0.999655
4.757855
1a0e978a-fb78-48c9-924a-a244f228916d
raghavvs/axbycz_probabilistic_method
eigen-3.4.0/lapack/cholesky.cpp
#include "lapack_common.h" #include <Eigen/Cholesky> // POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A. EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info)) { *info = 0; if(UPLO(*uplo)==INVALID) *info = -1; else if(*n<0) ...
ALGO
0.998014
6.004565
c103a14a-1d3d-4fdb-9eb3-4d59436cd590
NalinDalal/codeforces
620.1912L.cpp
/*L. LOL Lovers time limit per test3 seconds memory limit per test1024 megabytes There are 𝑛 food items lying in a row on a long table. Each of these items is either a loaf of bread (denoted as a capital Latin letter 'L' with ASCII code 76) or an onion (denoted as a capital Latin letter 'O' with ASCII code 79). There...
ALGO
0.999991
3.699034
9e520ef0-6e24-474e-9861-64397718ca40
omarsalem33/problems-of-Leetcode
7-reverse-integer/7-reverse-integer.cpp
class Solution { public: int reverse(int x) { int ans=0; while(x) { if(ans>INT_MAX/10 || ans<INT_MIN/10) return 0; else { ans=ans*10+x%10; x/=10; } } return ans; } };
ALGO
0.999969
5.804396
d0cc1720-0e56-49bc-8e9e-fff2cfa44882
Amos-Q/Code
2020_6_27/2020_6_27/test.cpp
#define _CRT_SECURE_NO_WARNINGS 1 //#include <iostream> //#include <vector> //using namespace std; // //int Max_divisor(int a,int b) //{ // int max = 0; // for (int i = 1; i <= a; i++) // { // if (a%i == 0 && b%i == 0) // { // if (i > max) // max = i; // } // } // return max; //} // //void Pow(int n, int a) //{...
ALGO
0.999668
4.075429
488a6f00-ba03-49a3-af6e-23d34f251999
ANUNAY-NALAM/interview_prep
vector practice.cpp
#include<bits/stdc++.h> #include<vector> using namespace std; bool myCompare(int x,int y) { return y<x; } int main() { vector<int> vec; int x; for(int i=0;i<5;++i) { cin>>x; vec.push_back(x); } // for(int i=0;i<5;++i) // { // cout<<vec[i]<<endl; // } vector<int>::iterator itr; sort(vec.begin(),v...
ALGO
0.999763
3.998744
e079984a-537f-4e96-a4ef-f49cf6013d8a
CookLand/CUDA-Brute-Force-Mnemonic-Legacy-SegWit-Limit-Words
bitcoin/consensus/tx_verify.cpp
#include <consensus/tx_verify.h> #include <chain.h> #include <coins.h> #include <consensus/amount.h> #include <consensus/consensus.h> #include <consensus/validation.h> #include <primitives/transaction.h> #include <script/interpreter.h> #include <util/moneystr.h> bool IsFinalTx(const CTransaction &tx, int nBlockHeight...
ALGO
0.93805
7.821357
a54a5e65-62d0-4424-a5c7-59b1008cfcbf
ArchitKumar1/LeetCode-Submissions
house-robber/Runtime Error/1-17-2019, 2:00:29 AM/Solution.cpp
// https://leetcode.com/problems/house-robber class Solution { public: int rob(vector<int>& nums) { int n=nums.size(); int dp[n+1]; dp[0]=0; dp[1]=nums[0]; for(int i=2;i<nums.size();i++) dp[i]=max(dp[i-1],dp[i-2]+nums[i-1]); return dp[n]; } }...
ALGO
0.999956
6.031737
85be1829-c35f-4f6a-9f21-6f8ef63474d6
airen3339/pytorch
torch/csrc/jit/codegen/cuda/lower_shift.cpp
#include <torch/csrc/jit/codegen/cuda/arith.h> #include <torch/csrc/jit/codegen/cuda/index_compute.h> #include <torch/csrc/jit/codegen/cuda/instrumentation.h> #include <torch/csrc/jit/codegen/cuda/ir_iostream.h> #include <torch/csrc/jit/codegen/cuda/ir_utils.h> #include <torch/csrc/jit/codegen/cuda/kernel_expr_evaluato...
ALGO
0.939564
5.326699
0582731c-9a63-49a2-9638-7faa77413224
harsh809/Codes
hashmap/1001. Grid Illumination.cpp
//1001. Grid Illumination class Solution { public: vector<int> gridIllumination(int n, vector<vector<int>>& lamps, vector<vector<int>>& queries) { vector<int> ans; if(n==0){ return ans; } unordered_map<int,int> x,y,dig1,dig2; set<pair<int,int>> s; for(aut...
ALGO
0.999926
6.022849
32c486c5-e26c-4cd1-8fdf-4e82a6a92126
ishandutta2007/codeforces
rivalq/normal/507/B.cpp
//https://codeforces.com/problemset/problem/507/B #include<bits/stdc++.h> using namespace std; long long int isq(long long int n){ if(n==1||n==0) return n; long long int u=n/2,l=1,mid; while(l<=u){ mid=(l+u)/2; long long unsigned int t=mid*mid; if(t==n) return mid; else if(t>n) { ...
ALGO
0.999785
3.693877
bb3718d1-94ce-4710-bb17-48fc669922e8
syntacore/snippy
llvm/lib/Transforms/Utils/SSAUpdater.cpp
#include "llvm/Transforms/Utils/SSAUpdater.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/TinyPtrVector.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" #inclu...
TOOL
0.992795
3.345326
40abf831-fe0a-4d28-bbd4-d1a3db7de58c
djm06294/CODINGTEST_prep
SWEA/SWEA_D3_1206.cpp
// 24.04.16 TUE // JooYoung Kim // "[S/W 문제해결 기본] 1일차 - View" // https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV134DPqAA8CFAYh&categoryId=AV134DPqAA8CFAYh&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=&pageSize=10&pageIndex=1 #include <iostream> ...
ALGO
0.999049
3.700348
0872820c-269a-44b6-8993-668fab17bc73
vishal-m25/LeetTracks
1056-capacity-to-ship-packages-within-d-days/solution.cpp
class Solution { public: int shipWithinDays(vector<int>& weights, int days) { int l=*max_element(weights.begin(), weights.end()),r=accumulate(weights.begin(), weights.end(), 0),mid,da,sum; while(l<r){ mid=(l+r)/2;da=1;sum=0; for(int & i:weights){ if((sum+i>mid...
ALGO
0.999993
5.847855
43118e68-cba0-466b-ae22-9ceac7444da3
walkccc/LeetCode
solutions/362. Design Hit Counter/362.cpp
class HitCounter { public: void hit(int timestamp) { const int i = timestamp % 300; if (timestamps[i] == timestamp) { ++hits[i]; } else { timestamps[i] = timestamp; hits[i] = 1; // Reset the hit count to 1. } } int getHits(int timestamp) { int countHits = 0; for (int i...
ALGO
0.931894
7.339273
984dd718-d38e-4225-9e1e-39374d2b48b5
frank-castillo/AI-Implementation
JuanFCastillo_VGP332_Final/X/Src/XMath.cpp
//==================================================================================================== // Filename: XMath.cpp // Created by: Peter Chan //==================================================================================================== #include "Precompiled.h" #include "XMath.h" using namespace X; ...
ALGO
0.998747
7.367863
e78b40a9-83e6-4ab6-a12d-04df52865e88
ishandutta2007/codeforces
cheetose/normal/1455/D.cpp
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define X first #define Y second #define y0 y12 #define y1 y22 #define INF 987654321 #define PI 3.141592653589793238462643383279502884 #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c)) #define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c)) #defin...
ALGO
0.999917
3.987624
853092aa-dded-4af1-a6ea-1fd71da9e189
mcolula/CaribbeanOnlineJudge-Solutions
frankzappa-p3147-Accepted-s820941.cpp
#include <iostream> using namespace std; int count(int * a, int * b, int n) { for (int i = 0; i < n; i++) for (int j = i; j < n; j++) { b[j - i] += a[j]; if (b[j - i] == 0) return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, t; int zero; cin >> t...
ALGO
0.999615
3.980462
244d96dc-ee47-4420-b3c5-b820ca2aa045
kyleruss/emu-server
GameServer/crypto/vmac.cpp
// vmac.cpp - written and placed in the public domain by Wei Dai // based on Ted Krovetz's public domain vmac.c and draft-krovetz-vmac-01.txt #include "pch.h" #include "vmac.h" #include "argnames.h" #include "cpu.h" NAMESPACE_BEGIN(CryptoPP) #if defined(_MSC_VER) && !CRYPTOPP_BOOL_SLOW_WORD64 #include <intrin.h> #en...
ALGO
0.971447
6.08424
80ac438f-1b17-4fbf-8f80-fcdb47490550
ishandutta2007/codeforces
dragoon/normal/342/E.cpp
#pragma warning(disable:4786) #pragma warning(disable:4996) #include<list> #include<bitset> #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<map> #include<functional> #include<string> #include<cstring> #include<cstdlib> #include<queue> #include<utility> #include<fstream> #...
ALGO
0.999892
4.695577
18416b80-8e1f-4745-9758-3ea39730e74e
OnlyFuture/dualarmrobot
eigen-eigen-323c052e1731/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,4); Eigen::VectorXf v(2); m << 1, 23, 6, 9, 3, 11, 7, 2; v << 2, 3; MatrixXf::Index index; // find nearest neighbour (m.colwise() - v).colwise().squaredNorm()...
ALGO
0.999956
4.138078
0cfb7a69-a711-4b8e-b38a-88add1bc96e4
ishandutta2007/codeforces
emthrm/normal/1728/A.cpp
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constex...
ALGO
0.999851
5.744836
913e335d-88ef-40c6-9ad3-e512565b7a03
Eduardofig/Competitive-Programming-Solutions
gema/roberterson.cpp
#include <bits/stdc++.h> using namespace std; using ui = unsigned int; using l = long; using ul = unsigned long; using ll = long long; using ull = unsigned long long; const int MXN = 2e5 + 3; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; int n, k; int x[MXN]; int add_mod(int a, int b, int mod) { int...
ALGO
0.999989
4.399693
477b06e7-74a0-45f5-9482-586c14e72f20
SherAndrei/msu_mechmath_II_year
ForwardList/list.cpp
#include "list.h" ListNode::ListNode(int val) : value(val), next(nullptr) {} ListNode::~ListNode() { next = nullptr; } List::List() : head_{nullptr}, size_(0ul) {} List::~List() { while (size_ > 0ul) { RemoveFront(); } } void List::PushFront(int value) { ListNode* temp = new ListNod...
ALGO
0.998121
5.697864
91dd5e45-d7fe-41ed-9de0-c1e5fbbf8d21
icirauqui/cppfea
src/fea/elts/element2d.cpp
#include "element2d.hpp" void Element2D::computeElasticityMatrix() { //double mult = _E/(1.0+_nu)/(1.0-2.0*_nu); //_D = Eigen::MatrixXd::Zero(3, 3); //_D(0, 0) = _D(1, 1) = (1-_nu); //_D(0, 1) = _D(1, 0) = _nu; //_D(2, 2) = 0.5 - _nu; //_D *= mult; //std::cout << "D: " << std::endl << _D << std::endl; ...
ALGO
0.999049
4.992939
4b1d386b-da53-4a2f-82e8-9a957e770e4c
satyam4565/Competitive-Programming-CP-
Level-2/B_AND_0_Sum_Big.cpp
#include "bits/stdc++.h" #define yup cout<<"YES"<<"\n" #define nope cout<<"NO"<<"\n" #define int long long #define uint unsigned long long #define vi vector<int> #define vvi vector<vi > #define vb vector<bool> #define vvb vector<vb > #define fr(i,n) for(int i=0; i<(n); i++) #define frc(v,i,n) for(int i=0; i<(n); i++){c...
ALGO
0.999906
4.3424
f84ec15a-ce84-411c-9958-4fe4be021101
JR-Jahed/library
Fenwick Tree.cpp
#include <bits/stdc++.h> using namespace std; template<typename T> class Fenwick { private: int n; vector<T> fen; public: Fenwick(int _n) : n(_n) { fen.resize(n); }; template<typename U> Fenwick(vector<U>& a) { n = (int) a.size(); fen.resize(n); build(a); } t...
ALGO
0.999879
4.7382
dbdb3bc2-1447-488b-b256-565e49a6522e
keshavjaiswal39/Coding-Block-Algo-plusplus
COUNT N QUEEN Backtracking Challenge.cpp
#include<iostream> using namespace std; int count=0; bool isSafe(int board[][11],int row,int col,int n) { // you can check for the col for(int i=0;i<row;i++) { if(board[i][col]==1) { return false; } } // you can check for the left diagonal int x=row; int y=col; while(x>=0 and y>=0) { if(board[...
ALGO
0.999902
5.634998
8e7c18fb-4a22-4d3c-be88-c2f8b154dc1a
adi271001/POTD
Day-10_Backtracking/print_permutations.cpp
/* Problem Link: https://leetcode.com/problems/permutations/ */ // backtracking helper function void permute_helper(vector<vector<int>> &results, vector<int> &nums, int idx) { // base case if(idx == (int)nums.size() - 1) { results.push_back(nums); return; } // recursive calls: fix t...
ALGO
0.999978
7.342239
6830a05a-d504-4c2b-aabc-1f47f9367f28
Princechorasiya/leet_code
Difficulty: Easy/Find XOR of numbers from L to R./find-xor-of-numbers-from-l-to-r..cpp
//{ Driver Code Starts // Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends // User function Template for C++ class Solution { public: int findx(int r){ if(r%4==1)return 1; if(r%4==2)return r+1; if(r%4==3)return 0; return r; } in...
ALGO
0.999946
5.501252