uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
192dc35c-0b2e-4563-9775-31fcfba78270
yunzz999/Competitive-Programing
Ejercicios/CodeForces/1520B.cpp
#include <bits/stdc++.h> using namespace std; bool numero(int n){ bool ord_n=true; while(ord_n){ int N = n%10; if((n-n%10)%10!=N){ ord_n=false; break; } else if((n-n%10)%10==0){ break; } n=n-n%10; } if(ord_n){ r...
ALGO
0.999571
4.298288
b745fb10-e0d5-41a3-893e-a96153971574
krishnactive/CP-and-DSA-Questions
combitronics/Binomial Coefficients_cses.cpp
#include<bits/stdc++.h> using namespace std; const int mod = 1e9+7; const int mx = 1e6+7; int power(int a,int b){ a = a%mod; int c =1; while(b){ if(b&1){ c = 1ll*c*a%mod; } b>>=1; a = 1ll*a*a%mod; } return c; } int inv (int n ){ return power(n,mod-2);...
ALGO
0.999895
4.55277
b62980a7-5a1a-4263-b48f-4d6405814993
sujeetamberkar/DSA_PW_Skills
Pratice/Recursion/Lecture_2/3_Stair_path/code.cpp
/* **Question Explanation:** - This program aims to determine the number of distinct ways to climb a staircase with 'n' steps. At each step, one can either take a 1-step or a 2-step jump. **Mathematical/Recursive Expression:** - Let f(n) represent the number of ways to climb 'n' steps. f(n) = f(n-1) + f(n-2) - Bas...
ALGO
0.999994
7.482523
b219c9ca-6150-4068-b76f-3b37f223e5d3
joaobnetto/CN
boost_1_70_0/libs/fiber/src/numa/windows/topology.cpp
#include "boost/fiber/numa/topology.hpp" extern "C" { #include <windows.h> } #include <map> #include <set> #include <system_error> #include <vector> #include <boost/assert.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace { class procinfo_iterator { private: using SLPI = SYSTEM_LOG...
TOOL
0.927298
6.418592
f055e4f8-c6be-42ec-9eca-4b6b7990a77f
beelisais2793/FX
Synthesizer/Waves/tfp/thirdparty/eigen-3.3.4/doc/examples/class_VectorBlock.cpp
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; template<typename Derived> Eigen::VectorBlock<Derived> segmentFromRange(MatrixBase<Derived>& v, int start, int end) { return Eigen::VectorBlock<Derived>(v.derived(), start, end-start); } template<typename Derived> const Eigen::Vec...
TOOL
0.983803
4.383477
da87a854-a46f-443d-84f4-34b57b085750
kiyoony/donga-university
p10026.cpp
#include <stdio.h> #include <algorithm> using namespace std; typedef struct node { double per; int index; }node; bool comp(node a, node b) { if (a.per < b.per) return false; else if (a.per == b.per) { if (a.index < b.index) return true; else return false; } else return true; } int main() { FILE *i...
ALGO
0.999846
4.027771
3f27814b-5b1f-4d48-9a00-a045c6ab8486
CGAL/cgal
Principal_component_analysis/examples/Principal_component_analysis/barycenter.cpp
// Example program for the barycenter() function for 2D and 3D points. #include <CGAL/Simple_cartesian.h> #include <CGAL/barycenter.h> #include <vector> #include <iostream> #include <utility> typedef double FT; typedef CGAL::Simple_cartesian<FT> K; typedef K::Point_2 Point_2; t...
ALGO
0.999172
6.950618
d3dc764d-201b-40bb-a937-472221902084
MartinOpat/Algorithms-Implementation-In-cpp-python
Other problems/arraySmoothing.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll #define psh push_back const ll MOD = 1000000007ll; // 10e9+7 int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; vector<int> els(n, 0); for (int i = 0; i < n; i++) { cin >> els[i]; } ...
ALGO
0.999988
4.141258
4fed64d6-fedc-4abd-b096-c24845eb8013
vsavchenko2408/cpp
exchange/exchange/Source.cpp
#include <iostream> using namespace std; int main() { setlocale(LC_ALL,"RU"); double sum = 0; int curr; cout << " : " << endl; cin >> sum; try { cout << " (1 - , 2 - , 3 - ):" << endl; cin >> curr; if (curr != 1 && curr != 2 && curr != 3) throw curr; } catch(int) { cout << " ! " << endl;...
ALGO
0.994488
3.38996
72a889ad-3514-47c0-affa-48702dae88be
perchuts/CompetitiveProgramming
cf/random/1696D.cpp
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define sz(x) (int) x.size() #define endl '\n' #define pb push_back #define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; using ll = long long; using ull = unsigned long long; using ii = pair<int,int>; using iii = tup...
ALGO
0.999949
4.620635
c52fed1d-6532-42fc-a41c-2596eecb363e
shanmukhnaidu/OWLS
Medium/Product of Primes/product-of-primes.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: bool isPrime(int n){ for(int i=2;i*i<=n;i++) if(n%i==0) return false; return true; } long long primeProduct(l...
ALGO
0.999823
5.681625
2c8db6dc-4a64-4476-869b-47fc6d032800
anmolp14/summer17_codes
spoj/knapsack.cpp
#include<bits/stdc++.h> using namespace std; int main() { int maxw,n; cin >> maxw >> n; int w[n],v[n]; int m[maxw+1][n+1]; for( int i=0; i<n;i++) cin >> w[i] >> v[i]; for(int i=0; i<maxw+1;i++) m[i][0]=0; for( int i=0;i<n+1;i++) m[0][i]=0; for( int i=1;i<=maxw;i++) { for( int j=1; j<=n; j++) { m[i...
ALGO
0.999991
4.010044
0005630d-5c4c-4c51-b726-a09ec784f898
mohammedjasam/Technical-Interview-Guide
LintCode/lintcode_unique-characters.cpp
/* * * Tag: Sort or Hash * Time: O(nlgn) or O(n) * Space: O(lgn) or O(n) */ class Solution { public: /** * @param str: a string * @return: a boolean */ bool isUnique(string &str) { // write your code here string tmp_str = str; sort(tmp_str.begin(), tmp_str.end()); ...
ALGO
0.999943
5.779041
5e01bc67-69a1-4c11-8ca6-27707d339c4d
BuiNhienLoc/C-plus-plus--projects
ch19.5.2/main.cpp
#include <iostream> void myfunction(int& byreference) { byreference++; // we can modify the value of the argument std::cout << "Argument passed by reference: " << byreference << '\n'; } int main() { int x = 123; myfunction(x); std::cout << "Argument passed by reference: " << x; }
TOOL
0.911999
5.959497
2b25e356-216b-45bb-9b0b-d4a94de37525
starboy520/starboy
algorithm/tree/MultiTreeSum.cpp
#include <vector> using namespace std; struct TreeNode { int val; vector<TreeNode*> child; }; int TreeSum(TreeNode* root, int prefix) { if (root == NULL) return 0; prefix = prefix * 10 + root->val; if ((root->child).size() == 0) return prefix; int sum = 0; for (int i = 0; i < (root->child...
ALGO
0.999885
5.194347
53957d9d-4e13-4df1-b561-2ffdf3aaf212
TangentOne/40Everyday
22.9/3/LC 53 - I. 在排序数组中查找数字 I.cpp
#include<iostream> #include<vector> using namespace std; class Solution { public: int search(vector<int>& nums, int target) { int top = 0; int end = nums.size()-1; int count = 0; if (end < 0) return 0; if (nums[top] > target || nums[end] < target) ...
ALGO
0.999751
5.485756
4a38c25b-5844-46a0-a84d-908eab48869c
ryo-manba/AtCoder
ABC/ABC248/d/main.cpp
// #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #define rep1(n) for (int rep1_i= 0; rep1_i < n; rep1_i++) #define rep2(i, n) for (int i = 0; i < n; i++) #define rep3(i, m, n) for (int i = m; i <= n; i++) #define overload3(o...
ALGO
0.999897
5.377241
92cd187f-72f2-4a39-a304-2f83bffe6236
andjelatodorovic/CUDNNSamples
conv_sample/fp16_emu.cpp
#include "fp16_emu.h" #define STATIC_ASSERT(cond) do { typedef char compile_time_assert[(cond) ? 1 : -1]; } while (0) // Host functions for converting between FP32 and FP16 formats // Paulius Micikevicius (<EMAIL>) half1 cpu_float2half_rn(float f) { unsigned x = *((int*)(void*)(&f)); unsigned u = (x & 0x7ff...
TOOL
0.99003
6.882948
c0b9b49b-a047-4518-a9db-2199d1eecde3
Omar-Sharif/Competitive-Programming
CODEFORCES/CONTEST PROBLEMS/codeforces_219_div1_A.cpp
#include<bits/stdc++.h> using namespace std; #define mx 500010 #define lli long long lli ara[mx],n,l,h; lli bi(lli i) { lli mid,ans=0; h=n; while(l<=h) { mid=(l+h)/2; if(ara[mid]>=ara[i]*2){ ans=1; h=mid-1; } else l=mid+1; } l++; //c...
ALGO
0.999288
3.676424
1eb2d7b5-4592-4f5a-bd1e-2bf6fffc5705
FWYT/Mass-Spring-System
code/include/eigen3.2.5/unsupported/doc/examples/MatrixPower.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); Matrix3d A; A << cos(1), -sin(1), 0, sin(1), cos(1), 0, 0 , 0 , 1; std::cout << "The matrix A is:\n" << A << "\n\n" "The matrix power A^(pi/4) is:\n"...
ALGO
0.99988
3.790203
2c29bdec-2994-4d88-8b6d-09304631deef
AdsonFS/beecrowd-codes
codes/1173.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { int x[10]; cin >> x[0]; cout << "N[0] = " << x[0] << endl; for(int i = 1; i < 10; i++) { x[i] = x[i - 1] * 2; cout << "N[" << i << "] = " << x[i] << endl; } return 0; }
ALGO
0.996819
3.290078
a8ac2e2d-7351-4546-8caf-ba06e323c426
sezalmittal987/black-ravens-notes
15May/bipartite.cpp
/* https://practice.geeksforgeeks.org/problems/bipartite-graph/1 */ //{ Driver Code Starts #include<bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: bool dfs( int node, int* visited, vector<int> *adj){ bool ans = true; for( auto child : adj[node]){ if(...
ALGO
0.999959
5.991648
bd104afa-8436-441a-9812-aeb4701ebbc1
Overstars/Practice
OJ/Codeforces/图论/最短路/CF1220 E. Tourism(2200,缩点,最长路).cpp
//#pragma comment(linker, "/STACK:102400000,102400000") #include<bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef pair<int,int>pii; #define ff first #define ss second #define debug(x) std:: cerr << #x << " = " << x << std::endl; const int maxn=2e5+10,inf=0x3f3f3f3f,mod=1000000007; const ...
ALGO
0.99981
3.604156
1dacbffb-7376-467f-842f-38fe173b4bd8
xiaohaimiao/Cpp-Learning
DailyTest/20250214.cpp
#include <iostream> #include <iomanip> using namespace std; int main() { double x, y; cin >> x; if (x >= 20 || x < 0) return -1; // 超出范围 if (x >= 10) y = x / 2 - 1.5; else if (x >= 5) y = 2 - 1.5 * (x-3) * (x-3); else y = 2.5 - x; cout << fixed << setp...
ALGO
0.999306
3.75021
6fa55574-2b4d-4974-b572-e9456e8c940d
afrizagilleon/OptimizedDelivery
dfs/dfs_normal.cpp
#include <iostream> #include <climits> #include "../graph.h" int DFSNormal(Graph &G, const string &startKota, const string &destinationKota, outputDFS &output) { // tempList untuk menandai kota-kota yang sudah dikunjungi pada jalur saat ini tempList visited; CreateTemp...
ALGO
0.999732
5.198419
0edb7354-cf9c-4ae2-b119-669b901a7a55
usaopen5/mygit
math/1929 소수 구하기.cpp
#include <iostream> #include <algorithm> #include <vector> #include <cmath> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int M, N; cin >> M >> N; vector <int>v; for (int i = M; i <= N; i++) { int isPrime = 0; // 0이면 소수 if (i == 1) // 1은 소수가 아님 { isPr...
ALGO
0.999959
3.720382
4db58309-ae6d-458f-bbc1-257d8b8b185f
raincross7/code-similarity
codes/train_code/problem216/problem216_282.cpp
#include <bits/stdc++.h> using namespace std; #define INF 2000000000000000000LL typedef long long int ll; typedef pair<ll,ll> ii; typedef pair<ii,ll> iii; typedef vector<ll> vi; typedef vector<ii> vii; #define getbit(n,i) (((n)&(1LL<<(i)))!=0) #define setbit0(n,i) ((n)&(~(1LL<<(i)))) #define setbit1(n,i) ((n)|(1LL<<(i)...
ALGO
0.999889
3.673095
1938e01c-981a-4de9-b70a-aa980a45efab
shugaoye/platform_external_mesa
src/glsl/opt_copy_propagation.cpp
/** * \file opt_copy_propagation.cpp * * Moves usage of recently-copied variables to the previous copy of * the variable. * * This should reduce the number of MOV instructions in the generated * programs unless copy propagation is also done on the LIR, and may * help anyway by triggering other optimizations tha...
ALGO
0.91743
7.890268
e2113960-4baf-4f97-a266-d656436bf3bb
AadeeshJainB2K/Learning-DSA-in-CPP
Practice Questions/Practice Question 11/Variation 1 /Q11.cpp
#include <iostream> using namespace std; int main() { int n = 4; for (int i = 0; i <= n - 1; i++) { for (int j = 0; j < i + 1; j++) { cout << ("*"); } cout << ("\n"); } }
ALGO
0.99989
4.208256
3a09157a-aa91-455b-9e84-2d269aa1a532
Nezumi55/riverpod_reference
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.9988
6.76073
bf347ed2-15d1-4d77-aac4-54c4843c78ea
shoukailiang/algorithm
leetcode/algorithms/559. N 叉树的最大深度/1.cpp
#include <iostream> #include "vector" #include "algorithm" #include "set" #include "stack" #include "queue" using namespace std; /** * Definition for a binary tree node. */ class Node { public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val, ...
ALGO
0.999935
5.919305
3395e4a4-8ce5-4f4c-9079-1df18ee203af
ErikHK/inkscape_animation
src/libvpsc/block.cpp
#include <cassert> #include "pairingheap/PairingHeap.h" #include "constraint.h" #include "block.h" #include "blocks.h" #ifdef RECTANGLE_OVERLAP_LOGGING #include <fstream> using std::ios; using std::ofstream; using std::endl; #endif using std::vector; namespace vpsc { void Block::addVariable(Variable* const v) { v->bl...
ALGO
0.999666
3.452933
b7bbe6f7-34d8-498c-8d34-ed6f449c571b
tomotakaeru/atcoder
200510_ABC167/C - Skill Up.cpp
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define REP(i,s,n) for(int i=s; i<(n); ++i) #define ALL(n) begin(n),end(n) using ll = long long; const ll INF = 1e18; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chm...
ALGO
0.999932
4.747295
f4b66582-33e1-48c6-9087-036e400aaf37
Hyp-ed/Workshops-18-19
Workshop1/ex_4.cpp
#include <iostream> using namespace std; void sayHello(int n); int product(int x, int y); void half(int n); void sayHello(int n) { int i = 0; while(i < n) { cout << "Hello\n"; i++; } } int product(int x, int y) { return x*y; } void half(int n) { cout << n << endl; n = n/2; if (n > 0) { ha...
ALGO
0.897465
5.436057
1b1dd218-7b25-47a1-9893-e357dce2a265
lychees/ACM-Training
Note/集训队作业/2014/作业1/解题报告/sy2006/浙江-沈洋/2005 G - Tiling the Plane/std.cpp
#include <cstdio> #include <algorithm> using namespace std; const int N = 55; int n, len, half, f[N][N]; char a[N*2], b[N], fres[256]; void flip(int len, char a[], char b[]) { for (int i=1; i<=len; ++i) b[i] = a[i]; reverse(b+1, b+len+1); for (int i=1; i<=len; ++i) b[i] = fres[b[i]]; } bool match(int s1, int e2) { ...
ALGO
0.999285
3.773825
74de032d-424b-4839-8678-c83b205f3d76
heavenMOJANG/ICPC
programmes_C_Cpp/Codeforces/CF1849/A.cpp
#pragma GCC optimize(1) #pragma GCC optimize(2) #pragma GCC optimize(3,"Ofast","inline") #include<bits/stdc++.h> typedef long long ll; using namespace std; const ll inf=0x3f3f3f3f; ll _,b,c,h; void read(ll&n){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();} while(ch>...
ALGO
0.999254
3.693909
1be11876-7244-4540-9499-80fbe6e94430
Sriyansh2001/Leetcode
3210-count-beautiful-substrings-i/count-beautiful-substrings-i.cpp
class Solution { public: bool checkvowel(char s) { return (s=='a' || s=='e' || s=='i' || s=='o' || s=='u'); } int beautifulSubstrings(string s, int k) { int n = s.length(); int vol,con,ans=0; for(int i=0 ; i<n ; ++i) { vol=con=0; for(int j=i ; j<n ; +...
ALGO
0.999941
5.884456
b0da582e-55d6-41b2-840a-edd2ecff24b2
Aman2336/DSA_Questions
binary tree/q3.cpp
#include <iostream> #include <queue> using namespace std; class node { public: int data; node *right; node *left; node(int data) { this->data = data; right = NULL; left = NULL; } }; node *buildtree(node *root) { int data; cin >> data; root = new node(data); ...
ALGO
0.999996
4.491447
3884ee27-9234-4ccb-81ab-89cd9524b219
andaraiwin/lab8
lab8_3.cpp
#include<iostream> using namespace std; char before(char x){ //Write your function definition here char y = 48; if(x > 64 && x < 91){ if(x > 65){ return x-1; } if(x == 65){ return x + 25; } } return y; } int main(){ //Test Case cout << before('A') << "\n"; cout << before('B') << "\n"; cout << ...
ALGO
0.998643
3.598197
5f34f1f4-2269-40b8-85a4-907aed02f003
ItsLucas/acm
518D.cpp
#include <bits/stdc++.h> using namespace std; double f[2001][2001]; int main() { int n,t; double p; cin>>n>>p>>t; f[1][1]=p; f[0][1]=1-p; f[0][0]=1; for (int j=1;j<=t;j++){ for (int i=0;i<=n;i++){ if (!i){ f[i][j]=f[i][j-1]*(1-p); } else if (i==n){ f[i][j]=f[i][j-1]+f[i-1][j-1]*...
ALGO
0.999835
3.819704
c8c81125-b566-44c4-a2b6-0cd552cd192f
ThePixelMoon/OpenMod
src/game/server/tf/bot/behavior/scenario/raid/tf_bot_squad_attack.cpp
#include "cbase.h" #ifdef TF_RAID_MODE #include "team.h" #include "raid/tf_raid_logic.h" #include "bot/tf_bot.h" #include "bot/behavior/scenario/raid/tf_bot_wander.h" #include "bot/behavior/scenario/raid/tf_bot_squad_attack.h" #include "bot/behavior/medic/tf_bot_medic_heal.h" #include "bot/behavior/tf_bot_move_to_van...
TOOL
0.979571
5.553829
5171f157-ed6c-4c12-ae26-a7601e649323
prateekshyap/DSA
Arrays/GFG_UnionTwoArrays.cpp
/* https://practice.geeksforgeeks.org/problems/union-of-two-arrays3538/1# Union of two arrays */ // { Driver Code Starts //Initial template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function template in C++ class Solution{ public: //Function to return the count of n...
ALGO
0.999749
5.560738
725aa89a-16ac-47c7-a183-914585b715c0
raincross7/code-similarity
codes/train_code/problem415/problem415_61.cpp
#include <iostream> #include <cassert> #include <queue> #include <cmath> #define INF 922337203685477580 typedef long long ll; using namespace std; typedef struct { double x, y; } Point; void solve(int d, Point p1, Point p2) { if (d == 0) return; Point s, t, u; t.x = (p1.x + 2 * p2.x) / 3; t.y = (p1.y + 2...
ALGO
0.999957
4.213606
00f28dc3-b00f-46ef-a21e-16b8ff49db96
krnbatra/SPOJ-Solutions
ARMY.cpp
#include<bits/stdc++.h> #include<string.h> using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0); #define ll long long #define endl "\n" int main() { fast; int t,i; cin >> t; while(t--) { int ng, nm,max1=0,max2=0; cin >> ng >> nm; int arr1[ng], arr2[n...
ALGO
0.999847
3.377086
8a07e974-4556-4036-aa6a-6bd332d07fa2
moti9/iCode
cp/LC1498-Number-of-Subsequences-That-Satisfy-the-Given-Sum-Condition.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long // #define mod 1000000007 // TC- O(NlogN) // SC- O(N) class Solution { int mod = 1e9 + 7; vector<int> getpowlist(int &n) { vector<int> power(n); power[0] = 1; for (int i = 1; i < n; i++) { power[i...
ALGO
0.999993
5.811235
87a0e25d-e241-40ba-8a60-3ad2578b7462
campeasy/data_structures_and_sorting
Albero Binario.cpp
// ------------------------------------------------------------ // Salvatore Campisi // C++ PROGRAMMING // Anno Accademico 2016/2017 // Argomento: Strutture Dati : Albero Binario // ------------------------------------------------------------ #include <iostream> using namespace std; template <class H> class Nodo{ pr...
ALGO
0.999677
5.074349
3a68951d-cd6f-4b80-9510-06fc5b636d62
AryanAngral/CPP-DSA
DAY-20/4_leetcode_is_same_tree.cpp
// 4_leetcode_is_same_tree.cpp // LeetCode 100. Same Tree // https://leetcode.com/problems/same-tree/ #include <iostream> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; bool isSameTree(TreeNode* p, TreeNode* q) {...
ALGO
0.996671
6.682367
3b11685e-72e7-4d47-b78f-50cd690c4d5e
beet-aizu/library
test/aoj/3037.test.cpp
// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3037 #include<bits/stdc++.h> using namespace std; #define call_from_test #include "../../tools/chminmax.cpp" #include "../../toptree/toptree.cpp" #undef call_from_test using ll = long long; struct Vertex{ void* handle; ll va...
ALGO
0.999819
4.419951
f2a1194d-120b-4c23-bd06-ac9ecbd16049
ishandutta2007/codeforces
hujiwara/normal/601/C.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n,m; scanf("%d%d",&n,&m); if(m==1){ printf("%.9lf\n",1.); return 0; } int x[1000],s=0; for(int i=0;i<n;i++){ scanf("%d",x+i); x[i]--; s+=x[i]; } static double E[2][100010]={0},S[100010]; bool b=0; E[b][0]=1.; for(i...
ALGO
0.999955
3.129971
c7d3c73a-de40-4e20-8302-33ff7524d866
postech-dblab-iitp/turbograph-v3
third_party/velox/velox/functions/prestosql/ArrayIntersectExcept.cpp
#include "velox/expression/VectorFunction.h" #include "velox/functions/lib/LambdaFunctionUtil.h" #include "velox/functions/lib/RowsTranslationUtil.h" #include "velox/type/FloatingPointUtil.h" namespace facebook::velox::functions { namespace { constexpr vector_size_t kInitialSetSize{128}; template <typename T> struct ...
ALGO
0.976719
7.578398
dd9d00cb-8135-438a-96db-de9a8c404272
gogo-dev/GoGo
cockpit/src/packet/crypto.cpp
#include "crypto.h" using namespace boost; namespace cockpit { namespace packet { // toDecrypt is at &(packet[packetIndex]) uint8_t* decrypt(uint8_t* toDecrypt, size_t length, size_t packetIndex, const uint8_t* key) { uint8_t a, b; for(size_t loopEnd = packetIndex + length; packetIndex != loopEnd; ++packetIndex,...
ALGO
0.997243
6.066395
e5699530-fb83-44a6-b444-762f450d0dc4
PaulusZhou/LiveScheduler
liveServer/liveMedia/uLawAudioFilter.cpp
#include "uLawAudioFilter.hh" ////////// 16-bit PCM (in various byte orders) -> 8-bit u-Law ////////// uLawFromPCMAudioSource* uLawFromPCMAudioSource ::createNew(UsageEnvironment& env, FramedSource* inputSource, int byteOrdering) { // "byteOrdering" must be 0, 1, or 2: if (byteOrdering < 0 || byteOrdering > 2) { ...
TOOL
0.914203
6.319759
dc6763ea-7e8e-4b81-ab26-dee5da3e00e3
zyadhany/RoadToIcpc
Up_Solve/USACO/Silver/Spaced Out.cpp
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #define ll long long #define ld long double #define pl pair<ll, ll> #define vi vector<ll> #define vii vector<vi> #define vc vector<char> #define vcc vector<vc> #define vp vector<pl> #define mi map<ll,ll> #define ...
ALGO
0.999928
4.359137
1cfe39a8-7081-45f2-8824-f6dd5a8687fa
ns-sck/LeetCode
1520-number-of-steps-to-reduce-a-number-in-binary-representation-to-one/number-of-steps-to-reduce-a-number-in-binary-representation-to-one.cpp
class Solution { public: int numSteps(string s) { ios::sync_with_stdio; int ans = 0; while (s.size() > 1) { int i = s.size()-1; if (s[i]-'0') { s[i--] = '0'; while (~i && s[i]-'0') { s[i--] = '0'; } ...
ALGO
0.999982
5.489667
92dffdd4-2cc6-45c3-8cf8-73951f314fdd
Debangshu200/GFG-Answers
Medium/Is Binary Number Multiple of 3/is-binary-number-multiple-of-3.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function template for C++ class Solution{ public: int isDivisible(string s){ //complete the function here int i,odd=0,eve=0,n=s.size(); for(i=0;i<n;i++){ if(s[i]=='1'){ if(i%2)odd...
ALGO
0.999052
5.73712
ec0df9c3-a40a-4b24-ad63-2dff5384478e
Tejasjain19/LeetCode-Practice-Questions
2130-maximum-twin-sum-of-a-linked-list/2130-maximum-twin-sum-of-a-linked-list.cpp
/** * 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 *next) : val(x), next(next) {} * }; */ class Solution { public: int pairSum(ListNode*...
ALGO
0.99999
5.491615
723caa3d-d7e3-4297-b2fa-27c045cb6263
prakharg317/my_work
Permutations of a given string - GFG/permutations-of-a-given-string.cpp
// { Driver Code Starts #include<bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: void pos(vector<char>&ds, vector<string>&ans, string s,int fq[]) { if(ds.size()==s.size()) { string x=""; int i=0; while(i<ds.size()) { ...
ALGO
0.999962
5.870781
a85ce34f-9bbe-49c9-974a-41e29e8afb95
shareone2/HaiZeiOJ
35数数字.cpp
/************************************************************************* > File Name: 35数数字.cpp > Author: lsj > Mail: <EMAIL> > Created Time: Thu Sep 10 23:33:50 2020 ************************************************************************/ #include <iostream> using namespace std; int l, r, flog; int main() {...
ALGO
0.999915
3.852381
d84231b7-849d-45f2-84c2-d109fc9b1982
Rafael-Machado01/brain
Fema/Algoritimos/C++/codes/Lista 3 ( Enquanto )/doze.cpp
#include <iostream> #include <math.h> using namespace std; int main() { float r=1,v=0; while(r <= 20.0) { v = 4.0 / 3.0 * 3.14 * (r * r * r); cout << "O valor do raio e: " << r << " E o volume da esfera e: " << v << endl; r = r + 0.5; } }
ALGO
0.995246
3.605521
1acae468-88cf-4d81-84ca-dfbacd3cf6f7
rmonfort/Shunting_yard
Shunting_yard/Source.cpp
#include <iostream> #include <string> #include <cctype> #include <stack> using std::cin; using std::cout; using std::endl; using std::string; using std::stack; // Checks if character is an operator bool is_operator(const char& character_to_check) { switch (character_to_check) { case '^': case '*': case '/': cas...
ALGO
0.999891
6.221994
0826a4b6-7f78-4663-b794-a646da682763
Kou-shik2004/Leetcode
1758-minimum-changes-to-make-alternating-binary-string/1758-minimum-changes-to-make-alternating-binary-string.cpp
class Solution { public: int minOperations(string s) { int c=0; //comparing string 0101/1010 // for 0101 zero appears at even indices and 1 at odd for(int i=0;i<s.length();i++){ if(i%2==0){ //even index expected 0 if(s[i]=='1'){ ...
ALGO
0.999952
5.895495
efd13d3e-ad21-4121-8c68-25c27722ca27
ABigWalrus/DungeonCrawler
src/common/tangentspace.cpp
#include <vector> #include <glm/glm.hpp> #include "tangentspace.hpp" void computeTangentBasis( // inputs std::vector<glm::vec3> & vertices, std::vector<glm::vec2> & uvs, std::vector<glm::vec3> & normals, // outputs std::vector<glm::vec3> & tangents, std::vector<glm::vec3> & bitangents ){ for (unsigned int i=...
ALGO
0.9981
7.552636
12879f25-fc47-4abc-a832-7d0d5e788b86
adelnobel/Training-for-ACM-ICPC-problems
USACO/Chapter 1/Section 1.2/3.Name That Number.cpp
/* ID: adelnob1 PROG: namenum LANG: C++ */ #include <vector> #include <cstdio> #include <cstring> #include <queue> #include <cctype> #include <cmath> #include <algorithm> #include <iostream> #include <bitset> #include <map> #include <complex> #include <ctime> #include <numeric> #include <set> using namespace std; cha...
ALGO
0.999374
3.935268
38bb78d2-63ea-43c2-a9da-789d67ab763f
king-yyf/cpcode
codeforce/cf/contest/1995/c.cpp
#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; #define ar(x) array<int,x> #define all(c) (c).begin(), (c).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define f0(e) for(int i = 0; i < (e); ++i) #define f1(e) for(int i = 1...
ALGO
0.99907
4.060212
75c807f9-4bae-44d5-8e1f-2845b50263ed
qquynh217/DSA
tong_nho_nhat.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long const ll P = 1e9 + 7; ll tong(ll a[], int n) { ll t1 = 0, t2 = 0; sort(a, a + n); for (int i = 0; i < n; i++) { if (i % 2 == 0) t1 = a[i] + t1 * 10; else t2 = a[i] + t2 * 10; } return t1 + ...
ALGO
0.999679
4.892619
7ba15d7d-f315-4ae3-abcb-d83df7d3b8c1
lucasaytt/StartRocks
be/src/util/frame_of_reference_coding.cpp
#include "util/frame_of_reference_coding.h" #include <algorithm> #include <cstring> #include "util/bit_util.h" #include "util/coding.h" namespace starrocks { template <typename T> const T* ForEncoder<T>::copy_value(const T* p_data, size_t count) { memcpy(&_buffered_values[_buffered_values_num], p_data, count * ...
DATA
0.935846
7.262932
7fd08041-eac2-4fc6-92e6-237ff0b1b89d
muhammadhasan01/cp
Library/Data Structures/Trie_Strings.cpp
struct Trie { struct Node { Node *child[26]; int cnt; Node() { for (int i = 0; i < 26; i++) { child[i] = NULL; } cnt = 0; } }; Node *head; Trie() { head = new Node(); } void insert(string& val) { ...
ALGO
0.999865
5.485849
28fa8eb4-4a78-4699-9284-fd4e48a99f31
Shauryacious/CPP-Programing
Recursion/Recursion3/printArray.cpp
#include<iostream> using namespace std; void display(int arr[], int n){ if(n==0) { cout<<arr[0]<<" "; return; } display(arr, n-1); cout<<arr[n]<<" "; } int main(){ int arr[] = {1,2,3,4,5}; int n = sizeof(arr)/sizeof(int); //To get size of arr //#NOTE: sizeof() operator returns the size of array...
ALGO
0.990902
5.276725
83324409-549f-4823-bdfb-dda1392b4647
ameerkat81/LeetCode
code/20.cpp
class Solution { public: bool isValid(string s) { vector<char> needMatch; for(int i=0; i<s.length(); i++){ if(s[i] == '(' || s[i] == '{' || s[i] == '['){ needMatch.push_back(s[i]); }else{ if(needMatch.size() == 0) return...
ALGO
0.999289
6.002789
ad78a3a7-4f84-4d4f-a8b9-9dbd08375c7b
ZYLZhuPP/OI
YYOJ/2724.cpp
#include<bits/stdc++.h> using namespace std; #define pb push_back #define rFor(i, r, l) for (int i = (r); i >= (l); --i) #define For(i, l, r) for (int i = (l); i <= (r); ++i) typedef long long ll; const int N = 1e5 + 5; struct IO { char c; int f; #define gc() getchar() template<class C> inline IO& operato...
ALGO
0.999757
3.32142
6c647811-c53d-4662-8115-65cab55bb17b
vivian-dai/Leetcode-Solutions
Weekly Contests/Weekly Contest 348/Minimize String Length/Solution.cpp
class Solution { public: int minimizedStringLength(string s) { bool letters[26] = {false}; for(int i = 0;i < s.length();i++) { letters[s[i] - 'a'] = true; } int count = 0; for(int i = 0;i < 26;i++) { if(letters[i]) { count++; ...
ALGO
0.999959
5.747573
730ade2c-a308-4f5e-98ab-d0b9131d305a
autodesk-forks/OpenSubdiv
opensubdiv/vtr/fvarLevel.cpp
#include "../vtr/fvarLevel.h" #include <cassert> #include <cstdio> #include <cstring> #include <algorithm> // // FVarLevel: // Simple container of face-varying topology, associated with a particular // level. It is typically constructed and initialized similarly to levels -- the // base level in a Factory an...
TOOL
0.872985
5.650978
f5cd3616-4251-4c95-894b-e90b19612482
acodexm/panoramaPlusPlus
Comparator/matchImage.cpp
#include "..\ImageStitching\stdafx.h" #include "functions.h" #include "logger.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include <iostream> #include <string> #include <iomanip> #include "opencv2/opencv_modules.hpp" #include <opencv2/core/...
ALGO
0.991012
4.281219
8276b0d4-7c0f-4f92-8618-f8dcb7c6bda6
ishandutta2007/codeforces
anta/normal/460/A.cpp
#define _CRT_SECURE_NO_WARNINGS #include <string> #include <vector> #include <algorithm> #include <numeric> #include <set> #include <map> #include <queue> #include <iostream> #include <sstream> #include <cstdio> #include <cmath> #include <ctime> #include <cstring> #include <cctype> #include <cassert> #include <limits> ...
ALGO
0.999934
3.126446
156ea068-c451-4c65-bc38-85c16326b805
alexandraback/datacollection
solutions_5634947029139456_0/C++/Shiplu/A1A_small.cpp
#include<bits/stdc++.h> using namespace std; #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define pb push_back #define all(a) a.begin(),a.end() #define eps (1e-9) #define inf (1<<29) #define i64 long long #define u64 uns...
ALGO
0.999737
3.304887
98fd6738-7b24-4d7f-b1fa-7b7f34468a0c
nguyenchiemminhvu/DSA
Problems/AdvantageShuffle/main.cpp
/** https://leetcode.com/problems/advantage-shuffle/description/ You are given two integer arrays nums1 and nums2 both of the same length. The advantage of nums1 with respect to nums2 is the number of indices i for which nums1[i] > nums2[i]. Return any permutation of nums1 that maximizes its advantage with respect to...
ALGO
0.99996
5.906772
a8d443d0-fa21-47dd-8731-810128f1ba6a
ashutoshpandey15/DSA
Basic/1st.cpp
#include <iostream> using namespace std; int main(){ int n; cin>>n; int i =1; int sum = 0; while(i<=n){ sum = sum + i; i = i+1; cout<<sum<<" "; } }
ALGO
0.994041
4.067142
d39cf096-e3a8-478b-a8a9-3082f55b6f22
miejejaw/competitive-programming
codeforces-solutions/A_Rectangle_Cutting.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool check(ll x, ll y){ if(x&1) return false; ll a = x/2, b=y*2; if(max(a,b) != max(x,y) || min(a,b)!= min(x,y)) return true; return false; } void solve() { ll x, y; cin >> x >> y; if(check(x,y) || check(y,x)) ...
ALGO
0.999931
5.127656
5b4fb9c6-5e3c-4e30-a836-e79de3ebd54a
DraSoGo/Competitive_Programming
C2/2565/0007_C2_65_minesweeper.cpp
#include <bits/stdc++.h> using namespace std; queue <pair<int,int>> Q; int B[100][100]; int C[100][100]; bool vis[100][100]; int dx[8] = {0,0,1,1,-1,-1,1,-1}; int dy[8] = {1,-1,1,-1,1,-1,0,0}; int n; bool check(int x,int y) { if (x < 0 || x > n-1 || y < 0 || y > n-1) { return false; } if (B[y][...
ALGO
0.999752
3.989562
cdcbbaab-e4ef-4e50-9436-700c9ab05d31
raincross7/code-similarity
codes/train_code/problem243/problem243_452.cpp
#include <iostream> #include <bitset> #include <vector> #include <string> #include <algorithm> #include <set> #include <map> #include <cmath> #include <regex> using namespace std; using ll = long long int; using dd = long double; const ll MOD = 1e9 + 7; vector<string> dfs(string s, ll depth, vector<char> symbol) { ...
ALGO
0.999955
4.344242
5f67a86c-9618-40a1-a41d-f2bd2a5468bf
Micronet-Ltd/sc600-android-root
bionic/tools/versioner/src/VFS.cpp
#include <err.h> #include <fcntl.h> #include <fts.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <memory> #include <string> #include <android-base/unique_fd.h> #include <clang/Basic/VirtualFileSystem.h> #include <llvm/ADT/IntrusiveRefCntPtr.h> #include <llvm/Support/MemoryBuffer.h> #inc...
TOOL
0.961497
7.577415
3505197a-bcb8-4cd7-9c2a-248224be49d8
codingwithveer18/DSA
BinaryTree/check_identical.cpp
#include <bits/stdc++.h> using namespace std; class node { public: int data; node *left; node *right; node(int d) { this->data = d; this->left = NULL; this->right = NULL; } }; node *buildtree(node *root) { cout << "enter the data" << endl; int data; cin >> data; root = new node(data...
ALGO
0.999733
4.822858
69109afb-e90d-48b6-9d00-3b22c1975210
taxijjang/algorithm
10211.cpp
#include <iostream> #include <algorithm> using namespace std; int arr[1001]; int psum[1001]; int main(void) { int T; scanf("%d", &T); for (int t = 0; t < T; t++) { int N; scanf("%d", &N); for (int i = 1; i <= N; i++) { scanf("%d", &arr[i]); } psum[1] = arr[1]; int max = psum[1]; for (int i = ...
ALGO
0.99966
4.523318
13d2bbda-3c4e-40bf-a70a-d4e686873b6c
puttyfsya/flutter_Putri-Diana-Hafsyawati
10-Platform-Widget/Praktikum/tugas_putri/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.997904
6.76073
39bae79e-36b8-49f1-96c1-9232f6378e2a
ArraryChen/Codeup_Coding
第四章/4.6-two pointers/B-基础排序III:归并排序/2021.3.6.cpp
#include<cstdio> #include<iostream> using namespace std; const int maxn = 100010; void merge(int A[], int L1, int R1, int L2, int R2){ int i = L1, j = L2; int temp[maxn], index = 0; while ( i <= R1 && j <= R2 ) { if ( A[i] <= A[j] ) temp[index++] = A[i++]; else temp[index++] = A[j++]; } while ( i <= R1 ...
ALGO
0.999845
3.805589
8cc46b94-be95-48e7-bbdf-c7769bddd1c3
ishandutta2007/codeforces
somethingnew/normal/1523/C.cpp
#include "list" #include <iostream> #include <vector> #include <fstream> #include <map> #include "algorithm" #include <iomanip> #include "cmath" #include "set" #include <climits> #define all(x) (x).begin(), (x).end() using namespace std; void pr(vector<int> a) { for (int i = 0; i + 1 < a.size(); ++i) { cou...
ALGO
0.999859
3.914245
15e7eac1-7883-4549-8319-d804ff2e85f7
princeofcrows/--cp
contest/atcoder/abc-404/F_Lost_and_Pound.cpp
#include <bits/stdc++.h> using namespace std; // Data type #define int long long #define ll long long #define pii pair<int, int> #define piii pair<int, pii> #define vi vector<int> #define vll vector<long long> #define vpi vector<pii> #define mii map<int, int> #define msi map<string, int> #define si set<int> #define s...
ALGO
0.999756
3.616634
a4e82c20-dc0b-4f28-a4e2-13ff86cff76a
ishandutta2007/codeforces
ainta/normal/1479/A.cpp
#include <bits/stdc++.h> using namespace std; namespace Rec{ template<class Fun> class y_combinator_result { Fun fun_; public: template<class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {} template<class ...Args> decltype(auto) operator()(Ar...
ALGO
0.999864
3.118979
fb8d032e-97e2-4a12-a347-d45fa11e156b
0-jij-0/CompetitiveProgramming
Problems Archive/0000 - 0999/0128 - Cover It.cpp
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; struct edge { int u, v; edge() {} edge(int _u, int _v) : u(_u), v(_v) {} }; struct node { int id, dist; vector<edge> edges; node() {} bool operator <(const node &rhs) { return dist < rhs.dist; } }; vector<nod...
ALGO
0.999962
4.841953
214066b5-850a-4c08-ac38-e4bb25105079
sraihan73/Lucene-
core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.cpp
using namespace std; #include "MinShouldMatchSumScorer.h" namespace org::apache::lucene::search { using PriorityQueue = org::apache::lucene::util::PriorityQueue; // import static org.apache.lucene.search.DisiPriorityQueue.leftNode; // import static org.apache.lucene.search.DisiPriorityQueue.parentNode; // im...
ALGO
0.968884
6.487289
8eed141a-e3b2-4c02-8129-fdd95974d8ba
rbroesamle/Implementierung-von-in-place-Mergesort-Algorithmen
Chen/main.cpp
// // Created by Patrick on 29.11.2018. // #include "chen.h" #include <iostream> #include "wrapper.h" #include <time.h> #include <algorithm> #include <random> #include <chrono> #include<cmath> #include<functional> /* * Testmethode, die auf einer Kopie eines Vektors der Größe size sortiert * Falls stdSort = true, dan...
ALGO
0.997696
5.723246
5cdd73ea-4219-424d-bf15-f00bdcd074bc
alexandraback/datacollection
solutions_5658068650033152_0/C++/hyeonguk/Enclosure.cpp
#include <cstdio> #include <iostream> #include <climits> #include <algorithm> using namespace std; int n, m, k; int last; bool map[1024][1024]; int Dx[] = { 1, -1, 0, 0 }, Dy[] = { 0, 0, 1, -1 }, Deltas = 4; int run(int status) { { int i = 0, j = 0; for (int s = 1; s < last; s <<= 1) { map[i][j] = status ...
ALGO
0.999714
3.876229
2d4a511e-baa8-4299-90d9-00a882146298
vsieplus/typechart-studio
src/config/beatpos.cpp
#include "config/beatpos.hpp" #include "config/timeinfo.hpp" #include <numeric> BeatPos::BeatPos(int measure, int measureSplit, int split) : measure(measure), measureSplit(measureSplit), split(split) {} BeatPos operator+(const BeatPos & lhs, const BeatPos & rhs) { // make sure lhs / rhs measuresplit have the sam...
TOOL
0.857326
6.187388
ebd7fcff-2dfc-4dbf-9272-266f171f7705
hanswinderix/ami-toolchain
mlir/lib/Dialect/X86Vector/Transforms/AVXTranspose.cpp
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" #include "mlir/Dialect/X86Vector/Transforms.h" #include "mlir/IR/ImplicitLocOpBuilder.h" #include "mlir/IR/Matchers.h" #include "mlir/IR/PatternMatch.h" #include "llvm/Support/Fo...
ALGO
0.895378
7.287292
02b36906-6594-4a3f-936b-09714a7546fd
GengxinLiu/SWMP
NetworkDataExtract/OBBcalculation/SourceCode/symmetry/Intersection/Wm5IntrLine2Circle2.cpp
#include "Wm5MathematicsPCH.h" #include "Wm5IntrLine2Circle2.h" namespace Wm5 { //---------------------------------------------------------------------------- template <typename Real> IntrLine2Circle2<Real>::IntrLine2Circle2 (const Line2<Real>& line, const Circle2<Real>& circle) : mLine(&line), mCircle...
ALGO
0.999566
6.601766
13371c71-3b04-42cc-98f2-72965187fd42
rishav197/Strivers-A2Z-DSA-Sheet
BinaryTree/Lec3-Hard-Problems/Flatten-BT-to-LinkedList.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.999988
6.245032
5f2e2770-7798-426c-b68f-f16a2a4ba626
zilliztech/knowhere
thirdparty/faiss/tests/test_RCQ_cropping.cpp
#include <faiss/IndexAdditiveQuantizer.h> #include <faiss/IndexScalarQuantizer.h> #include <faiss/utils/random.h> #include <gtest/gtest.h> /* This test creates a 3-level RCQ and performs a search on it. * Then it crops the RCQ to just the 2 first levels and verifies that * the 3-level vectors are in a subtree that w...
TEST
0.863696
6.093033
99585ef9-438b-4338-b87c-7f197ba3eb91
shubham21699/My-LeetCode-Solutions
2845-count-of-interesting-subarrays/2845-count-of-interesting-subarrays.cpp
class Solution { public: long long countInterestingSubarrays(vector<int>& nums, int modulo, int k) { int n = nums.size(); unordered_map<int, int> mp; long long count = 0; int total = 0; mp[0] = 1; for(int i=0 ; i<n ; i++) { total = (total...
ALGO
0.999909
5.797342
36ca068f-6e17-4b12-8bdf-3f951f81ffd7
Strand2013/siguoya
AC_history/[剑指 Offer 14- I]剪绳子.cpp
//给你一根长度为 n 的绳子,请把绳子剪成整数长度的 m 段(m、n都是整数,n>1并且m>1),每段绳子的长度记为 k[0],k[1]...k[m-1] 。 //请问 k[0]*k[1]*...*k[m-1] 可能的最大乘积是多少?例如,当绳子的长度是8时,我们把它剪成长度分别为2、3、3的三段,此时得到的最大乘积是18 //。 // // 示例 1: // // 输入: 2 //输出: 1 //解释: 2 = 1 + 1, 1 × 1 = 1 // // 示例 2: // // 输入: 10 //输出: 36 //解释: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36 // // 提示: // // ...
ALGO
0.999996
5.817399
7f28640c-4a3b-4b65-ad7a-c8b15ab4b8fd
ishandutta2007/codeforces
emilan/normal/1203/A.cpp
#include <bits/stdc++.h> using namespace std; inline void ioThings() { ios::sync_with_stdio(0); cin.tie(0); #ifdef LOCAL freopen("io\\in.txt", "r", stdin); freopen("io\\out.txt", "w", stdout); #define debug(x) cerr << #x << ": <" << (x) << ">\n" #else #define debug(x) #endif } #define rep(i, n) for (int i = 0...
ALGO
0.999956
4.072709