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
eeea9831-e3a8-466f-8a86-2e27b801d753
ishandutta2007/codeforces
leapfrog/normal/622/C.cpp
#include<bits/stdc++.h> using namespace std; int n,m,a[1000005],b[1000005],pos[1000005]; int main() { while(scanf("%d%d",&n,&m)!=EOF) { for(int i=1;i<=n;i++) { scanf("%d",a+i); if(a[i]==a[i-1]) pos[i]=pos[i-1];else pos[i]=i; } for(int l,r,x;m--;) { scanf("%d%d%d",&l,&r,&x); if(a[r]==x) {if(pos[r...
ALGO
0.999963
3.623465
24dca61f-f36b-4262-95cf-72f4e4576022
0xedb/algo-ds
c++/leetcode/88. Merge Sorted Array.cpp
class Solution { public: void merge(vector<int> &nums1, int m, vector<int> &nums2, int n) { int i = m - 1; int j = n - 1; auto it = nums1.rbegin(); while (j >= 0 && i >= 0) { if (nums1[i] > nums2[j]) *it = nums1[i--]; else *it = nums2[j--]; ++it; } w...
ALGO
0.999933
5.418716
13217567-cdb2-4b7f-af34-fa2ad1c810ed
mgiridhar/code
hackerRank/range_minimum_query.cpp
#include<iostream> #include<algorithm> #include<limits> using namespace std; void build_seg_tree(long int arr[], long int seg_tree[], unsigned long int low, unsigned long int high, unsigned long int pos) { if(low > high) return; if(low == high) { seg_tree[pos] = arr[low]; return; } unsigned long int mid = l...
ALGO
0.999972
4.76993
d8aad0a2-dab0-4f87-a0b5-22b15ddccd50
akashkothi/Computer-Networks
IPC/synchronization_semaphores/p3.cpp
#include "../cn.h" int main() { char ch; sem_unlink("s34"); sem_t *s23 = sem_open("s23",0); sem_t *s34 = sem_open("s34",O_CREAT|O_EXCL,RWX,0); cout<<"I am process P3 ..."<<endl; cout<<"I am waiting for semaphore signal S23 ..."<<endl; sem_wait(s23); cout<<"I got semaphore S2...
TOOL
0.932574
3.568828
e0bf74f0-ba21-4509-9580-00630cd88b75
ArchSecLab/xui
accel/src/systemc/tests/systemc/misc/user_guide/chpt11.3/mean.cpp
/***************************************************************************** mean.cpp -- Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 *****************************************************************************/ /***************************************************************************** ...
ALGO
0.998989
4.530694
407321c9-631d-4a63-b945-01198915b3de
BuyWell11/Parall-Labs
lab1/main.cpp
#include <iostream> #include <vector> #include <string> #include <fstream> #include <cstdio> #include <cmath> #include <pthread.h> #include "timer.h" #define DT 0.05 #define E 1e-4 #define THREAD_COUNT 16 pthread_barrier_t barrier_forces; pthread_barrier_t barrier_calculate; pthread_barrier_t barrier_thread; int bodi...
ALGO
0.998274
4.420962
e17fc102-9072-4e79-9ea6-f9ec47f9b2e1
dev-usama/boost
libs/mpi/example/generate_collect_optional.cpp
// An example using Boost.MPI's split() operation on communicators to // create separate data-generating processes and data-collecting // processes using boost::optional for broadcasting. #include <boost/mpi.hpp> #include <iostream> #include <cstdlib> #include <boost/serialization/vector.hpp> #include <boost/serializat...
TOOL
0.994379
6.554121
de11a811-cb1d-4f66-821c-5f9ef0428895
Harsimrank23/6Companies30days
1011-capacity-to-ship-packages-within-d-days/1011-capacity-to-ship-packages-within-d-days.cpp
class Solution { public: bool func(int mid ,vector<int>weights,int days) { int sum=0; int d=1; for(auto w:weights) { if(sum+w<=mid) sum+=w; else { sum=w; d++; } } if(d<...
ALGO
0.999994
5.611135
474647dd-0b94-4560-ba90-27c60aa9c9b1
holicmiku/SolvedAlgorithm
BOJ/CLASS 1/단어_공부.cpp
#include<iostream> #include<string> using namespace std; int main(){ string str; string answer; int alphabet[26] = {0,}; getline(cin, str); for(int i=0; i<str.length(); i++){ if(str[i] - 97 >= 0){ alphabet[str[i] - 97]++; } else{ alphabet[st...
ALGO
0.999911
3.61
99d8a59a-0d76-403e-9dcc-7c16c066bda9
Apress/learn-cocos2d-2
Learn Cocos2d 2/CH12/PhysicsBox2D01/cocos2d-2.x-Box2D-ARC-iOS/libs/Box2D/Collision/Shapes/b2ChainShape.cpp
#include <Box2D/Collision/Shapes/b2ChainShape.h> #include <Box2D/Collision/Shapes/b2EdgeShape.h> #include <new> #include <cstring> using namespace std; b2ChainShape::~b2ChainShape() { b2Free(m_vertices); m_vertices = NULL; m_count = 0; } void b2ChainShape::CreateLoop(const b2Vec2* vertices, int32 count) { b2Asser...
ALGO
0.954421
6.244783
e1d85443-2b03-4325-9191-6d15d99355c6
ImranJaved1073/Data-Structures-Algorithms-DSA
Binary Trees/Link Binary Tree/Driver.cpp
#include <iostream> #include <stack> #include "BTNode.h" #include "LinkBinaryTree.cpp" using namespace std; void Menu() { cout << "\t\t\t\t1. Set Root" << endl; cout << "\t\t\t\t2. Set Left Child" << endl; cout << "\t\t\t\t3. Set Right Child" << endl; cout << "\t\t\t\t4. Get Root" << endl; cout << "\t\t\t\t5. Ge...
ALGO
0.999847
3.565036
9cf2b20a-ee50-4117-830a-0ca14cf8f67b
DevSukanta/DSA
holopiramidPattern/code.cpp
#include <iostream> using namespace std; int main() { int n=4; //top for(int i=0; i<n; i++){ //space for(int j=0; j<n-i-1; j++){ cout << " "; } cout <<"*"; if(i!=0){ for(int j=0; j<2*i-1; j++){ cout << " "; } ...
ALGO
0.999936
4.045327
b87bd0f8-1d5e-4363-9ffa-7d9b97c7d6cd
BilalSajid173/LeetcodeSolutions
475-heaters/475-heaters.cpp
class Solution { public: int findRadius(vector<int>& A, vector<int>& H) { sort(A.begin(), A.end()); sort(H.begin(), H.end()); vector<int> res(A.size(), INT_MAX); // For each house, calculate distance to nearest RHS heater for (int i = 0, h = 0; i < A.size() && h < ...
ALGO
0.999953
5.267362
a5381d0e-9337-452e-9732-ced6ceea0b5f
wrisov/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.999972
6.281408
1aad2644-ef34-4232-9bef-2dc12c6359a3
rohanxxx/leetcode
1682-most-visited-sector-in-a-circular-track/1682-most-visited-sector-in-a-circular-track.cpp
class Solution { public: vector<int> mostVisited(int n, vector<int>& rounds) { vector<int> frequency(n+1, 0); int maxVisited = 0; for(int i = 0; i < rounds.size()-1; i++){ maxVisited = max(maxVisited, ++frequency[rounds[i]]); if(rounds[i+1]-rounds[i] > 1){ ...
ALGO
0.999996
6.260767
d8afcd39-05d5-4aa7-904b-a1c2999c6e4c
Aditya-raj123/DSA-
combandper.cpp
#include<iostream> using namespace std; int fact(int x){ int f = 1; for(int i=2;i<=x;i++){ f*=i; } return f; } int combination(int n,int r){ int ncr = fact(n)/(fact(r)*fact(n-r)); return ncr; } int permutation(int n,int r){ int npr = fact(n)/fact(n-r); return npr; } int main(...
ALGO
0.998561
3.984741
af23ca6c-10b4-496c-bb77-c28dc7203657
pankaj69/Data-structure
postfix.cpp
#include <iostream> #include <stdlib.h> #include <math.h> #include<conio.h> using namespace std; const int MAX = 50; class postfix { int stack[MAX]; int top, nn; char *s; public: postfix(); void setexpr(char *str); void push(int item); int pop(); void calculate(); void show(); }; postfix ::postfix() { ...
ALGO
0.99873
3.592972
68c1ff4a-4198-496a-a981-9c6803ef141b
user-kk/leetcode
include/lc/40.组合总和-ii.cpp
/* * @lc app=leetcode.cn id=40 lang=cpp * * [40] 组合总和 II */ #include "common.h" // @lc code=start class Solution { public: vector<vector<int>> ret; vector<int> path; int _target; void dfs(const vector<int>& candidates, int start, int cur) { if (cur > _target) { return; ...
ALGO
0.999983
6.678324
c864e1f4-5f6b-4feb-a990-e9bdfd89707d
Jay7221/competitve-programming
other_contests/tcs_codevita23/round2/G.cpp
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast,unroll-loops") //#pragma GCC target("avx,avx2,avx512,fma") template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container,...
ALGO
0.999691
4.125072
19487370-34ee-438f-9e8c-4a41de87704d
choudhary-pratham/Striver-SDE-Sheet
Day_06/intersection_of_two_linkedlist.cpp
#include <bits/stdc++.h> /**************************************************************** Following is the class structure of the Node class: class Node { public: int data; Node *next; Node(int data) { this->data = data; this->next...
ALGO
0.99997
4.33506
77ce6fd3-a185-4206-a160-dc4e081e2618
surajl7/Technologies
Software/C++/Chapter 3 - Functions and Recursion/2K230118/func_numberSwappingUsingPointers.cpp
// Functions // Ex. Swapping two numbers using pointers #include<iostream> using namespace std; void swap(int*, int*); /*Function declaration*/ int main(int argc, char* argv[]) { int a, b; // int *p1, *p2; cout << "\nEnter 1st number: "; cin >> a; cout << "Enter 2nd number: "; ...
ALGO
0.999031
5.276336
c231837f-88a7-4d16-90e5-19d02a11be9e
azabrod1/CStuff3
Tarjan5/Tarjan/Archive/singleThreadedTarjan.cpp
#include <stdio.h> #include <iostream> #include "singleThreadedTarjan.h" SCC_Set* SingleThreadedTarjan::run(){ std::cout << graph.size() <<std::endl; std::unordered_set<Vid>* verts = graph.getVerticies(); for(auto& vertex: *verts){ if(!lookup.count(vertex)){ SingleCell* root ...
ALGO
0.998767
4.758672
22f60b8c-c272-49b6-86e3-3d8651221626
JohnLulzh2002/Templates-for-CBYJD
模板题_from_ZZY/P3375 KMP.cpp
#include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #include<string> #include<queue> #include<cmath> #define Lint long long using namespace std; const int inf=0x7fffffff; const double eps=1e-10; const double pi=acos(-1.0); inline int read(){ int x=0,f=1;char ch;ch=getchar(); wh...
ALGO
0.99979
3.611297
212edba8-fbbc-4473-ba9f-30879e75d205
morinokami/intro-to-cpp
ch04/list0416.cpp
#include <iomanip> #include <iostream> using namespace std; int main() { float sum = 0.0F; cout << fixed << setprecision(6); for (int i = 0; i <= 1000; i++) { float x = static_cast<float>(i) / 1000; cout << "x = " << x << '\n'; sum += x; } cout << "sum = " << sum << '\n'; }...
ALGO
0.989919
3.666328
22f52a67-e757-405f-b592-f83bd3901f78
silvest/HEPfit
LeftRightSymmetricModel/src/LRSMquantities.cpp
#include "LRSMquantities.h" #include "gslpp.h" #include "LeftRightSymmetricModel.h" LRSMquantities::LRSMquantities(const LeftRightSymmetricModel & LRSM_in) : myLRSM(LRSM_in), Msqneutral(5, 5, 0.) { } //LRSMquantities::LRSMquantities(const StandardModel& SM_i) //: myLRSM(static_cast<const LeftRightSymmetricModel*> (&S...
ALGO
0.994709
6.068369
1e000be6-6a7b-449d-8e42-a64f1ae44f4b
dlp03/Cpp-Class
Triangle.cpp
//=============================================================== //Triangle.cpp -- This program computes the area of a triangle // Daria Pacheco - Saint Leo University - 25 January 2021 //=============================================================== #include <iostream> using namespace std; int main (int argc,...
TOOL
0.902263
7.316377
5e999de2-e457-4177-ae1e-ebf759eafb48
ishandutta2007/codeforces
maroonrk/normal/1609/A.cpp
#ifndef LOCAL #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #endif #include <bits/stdc++.h> using namespace std; using ll=long long; #define int ll #define rng(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,b) rng(i,0,b) #define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--) #define per(i,b...
ALGO
0.999825
4.084961
12309992-1fe3-4015-a7b8-668dda4a4477
mikolalysenko/mesa-js
src/glsl/opt_if_simplification.cpp
/** * \file opt_if_simplification.cpp * * Moves constant branches of if statements out to the surrounding * instruction stream, and inverts if conditionals to avoid empty * "then" blocks. */ #include "ir.h" namespace { class ir_if_simplification_visitor : public ir_hierarchical_visitor { public: ir_if_simpl...
ALGO
0.982035
7.732594
9aab3a64-bd60-4475-a021-72a3a5edd6c0
Xilinx/Vitis-Tutorials
AI_Engine_Development/AIE/Design_Tutorials/04-Polyphase-Channelizer/hls/m16_ssr8_permute_fb_o/m16_ssr8_permute_fb_o.cpp
#include "m16_ssr8_permute_fb_o.h" // ------------------------------------------------------------ // Constructor // ------------------------------------------------------------ m16_ssr8_permute_fb_o::m16_ssr8_permute_fb_o( void ) { } // ------------------------------------------------------------ // Unpack samples ...
ALGO
0.998839
5.799772
caabddd4-7557-4783-b900-54b57467d73c
SemyonSemenov/Basics-of-Cpp-Development-White-Belt
Week 2/Moving strings.cpp
#include <iostream> #include <string> #include <vector> using namespace std; void MoveStrings(vector<string>& source, vector<string>& destination){ for (auto w : source){ destination.push_back(w); } source.clear(); } int main() { vector<string> source = {"a", "b", "c"}; vector<string> destination = {"z"}; Mov...
ALGO
0.9805
4.903393
a3e6f6be-bd93-4a8a-b64d-5f3c2f69f7d1
Tardo/DocumentOCR
libraries/tess-two-9.0.0/tess-two/jni/com_googlecode_tesseract_android/src/textord/strokewidth.cpp
#ifdef _MSC_VER #pragma warning(disable:4244) // Conversion warnings #endif #ifdef HAVE_CONFIG_H #include "config_auto.h" #endif #include "strokewidth.h" #include <math.h> #include "blobbox.h" #include "colpartition.h" #include "colpartitiongrid.h" #include "imagefind.h" #include "linlsq.h" #include "statistc.h" #...
TOOL
0.959978
4.878515
4839711c-07fa-4853-9b26-01c6c3fce985
hirbu/pbinfo-solutions
fractiimax.cpp
#include <iostream> #include <regex> using namespace std; bool check(int a, int b, int c, int d) { return double(a) / b > double(c) / d; } int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (check(a, b, c, d)) { // 1 - a, b int e = __gcd(a, b); // 0 - c, d cout << a / e << ' ' ...
ALGO
0.999905
5.049982
096387a8-558b-4cbc-95d1-7de61f7f3811
sarvex/leetcode-wren
solution/2400-2499/2435.Paths in Matrix Whose Sum Is Divisible by K/Solution.cpp
class Solution { public: int numberOfPaths(vector<vector<int>>& grid, int k) { int m = grid.size(), n = grid[0].size(); int mod = 1e9 + 7; vector<vector<vector<int>>> f(m, vector<vector<int>>(n, vector<int>(k, -1))); function<int(int, int, int)> dfs; dfs = [&](int i, int j, i...
ALGO
0.999981
6.23741
c3d2c6c1-925a-4c8d-8b61-926dd50349cb
Sean0628/algorithms
algorithmic_toolbox/w6/2/partition3_test.cpp
#include <iostream> #include <cassert> #include <vector> #include <numeric> using namespace std; const int k = 3; int partition3(vector<int> &A) { int sum = accumulate(A.begin(), A.end(), 0); int m = A.size(); if (sum % k != 0) { return 0; } vector<int> row(m + 1, 1); vector<vector<int>> table(sum ...
ALGO
0.99983
5.211637
bc1bc251-6d3a-4fc4-82e8-6be543d2a755
mammothb/boost_1_54_0
libs/math/src/tr1/cyl_bessel_kf.cpp
extern "C" float BOOST_MATH_TR1_DECL boost_cyl_bessel_kf BOOST_PREVENT_MACRO_SUBSTITUTION(float nu, float x) BOOST_MATH_C99_THROW_SPEC { return c_policies::cyl_bessel_k BOOST_PREVENT_MACRO_SUBSTITUTION(nu, x); }
TOOL
0.896842
3.030694
a86c4b78-d1b4-4231-9f30-9c71a73d8add
Soban-Abbas/DSA
bubblesort.cpp
#include <iostream> using namespace std; void bubblesort(int array[], int size) { for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - 1 - i; j++) { if (array[j] > array[j + 1]) { int temp = array[j]; array[j] = array[j + 1]; ...
ALGO
0.999165
4.212357
0d380672-cda6-4fe7-a24e-ce94fc3704cc
Aeroraven/Stargazer
Algorithm/ComputationalGeometry/lc335/lc335-cpp.cpp
class Line { public: Line(int _id,int _v,int _s,int _t):id(_id),s(_s),t(_t),v(_v){} int s, t; int v; int id; bool operator ==(const Line& p)const { return (s == p.s && t == p.t && v == p.v && id == p.id); } }; class Solution { public: bool isSelfCrossing(vector<int>& distance) { const int GOLEFT = ...
ALGO
0.999975
4.649481
83931f3a-1861-4266-91aa-52c2c04029ec
ranahamid/CSELAB
CSE_LAB-3rd year/303/10015406-lab 303-rana/10.cpp
/* 3+9*1 7+2 2+8-7 (3) (2+3-8) . .3 a.2 */ #include<stdio.h> #include<conio.h> #include<string.h> #include<iostream> using namespace std; int main() { while(true) { char input[100],stack[100]; int i,j,l; cout<<"Enter string"<<endl; gets(input); l=strlen(input); for (i=0,j=0; i<l; i++) { ...
ALGO
0.999762
3.497824
7bbc03a2-065a-442d-91b8-4e35d85189e0
rajveer-09/HustlerWorkspaceLeetcode
1422-divide-array-in-sets-of-k-consecutive-numbers/divide-array-in-sets-of-k-consecutive-numbers.cpp
class Solution { public: bool isPossibleDivide(vector<int>& nums, int k) { int n = nums.size(); if (n % k != 0) return false; map<int, int> freq; for (int num : nums) { freq[num]++; } while (!freq.empty()) { int start = freq.begin()->first; ...
ALGO
0.99994
5.758348
9aac94d2-3294-4e05-8389-cd7d92bf2467
Vivekrathore2002/DSA-Coding
0907-sum-of-subarray-minimums/0907-sum-of-subarray-minimums.cpp
// https://www.youtube.com/watch?v=9-TXIVEXX2w class Solution { public: int sumSubarrayMins(vector<int>& A) { stack<int> s1,s2; int n = A.size(); vector<int> next_smaller(n),pre_smaller(n); for(int i=0;i<n;i++) { next_smaller[i] = n-i-1; pre_smaller[i]...
ALGO
0.999997
5.908563
5dc740a4-3a79-45e9-8d33-489c14b73c22
TheResilient/100daysofdsa
day66/target_sum.cpp
#include <bits/stdc++.h> using namespace std; // target sum int targetsum(int a[], int n, int sum) { // Initializing the matrix int dp[n + 1][sum + 1]; // Initializing the first value of matrix dp[0][0] = 1; for (int i = 1; i <= sum; i++) dp[0][i] = 0; for (int i = 1; i <= n; i++) ...
ALGO
0.999985
4.487537
372b1e77-ba0c-4df4-89c3-9f48d52aa08b
dgheig/Ba2-inf2-labo03
Enigma.cpp
/* ----------------------------------------------------------------------------------------------- Laboratoire : Test_Labo03 Fichier : enigma.cpp Auteur(s) : Nils Basset Date : 28.03.2020 But : Remarque(s) : Compilateur : MinGW-g++ 6.3.0 -------------------------------------------------...
ALGO
0.998469
4.280679
ac8c0bb9-89a9-460e-803c-bf3ad13abfd5
dipanshusankhala/DSA-S
impkeywords/macrows.cpp
#include<iostream> using namespace std; // macro ceation #define PI 3.14 int main() { int r=5; double area = PI*r*r; cout<<"Area is "<<area<<endl; //Area is 78.5 return 0; }
ALGO
0.850494
3.411492
85f2129b-19b5-444a-b35f-c796e12b0520
Kibiandkimi/stu
Problem/YDXY/WF-Train/day4-xcpc/A.cpp
// // Created by kibi on 24-10-6. // #include <bits/stdc++.h> using namespace std; template<typename T> T read() { T s = 0, w = 1, c = getchar(); while (!isdigit(c)) { if (c == '-') { w = -1; } c = getchar(); } while (isdigit(c)) { s = s * 10 + c - '0'; ...
ALGO
0.99998
4.050769
a3bd600c-5528-46d1-87ae-ee8c97e4f8d6
Ismail2527/450_DSA-questions
Greedy/Smallest Subset with Greater Sum.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 minSubset(vector<int> &Arr,int N){ long long sum =0 , sum2 =0; int count=0; for(int i=0; i<N; i++){ ...
ALGO
0.999609
5.963043
6bc73443-8c6e-4557-97a6-5465ed9e3fcc
UserUnauthorized/OI-Codes
Luogu/P3167.cpp
//HZ - 37.4 //Luogu - P3167 #include <bits/stdc++.h> typedef std::array<long long, 256> tableType; constexpr static const tableType HASH_TABLE = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
ALGO
0.999985
4.648965
9ea1697b-e585-4ca2-ab76-d00cd38eb48f
Galaxies99/Algorithms-of-Strings
Compaction Algorithm/Huffman-2.cpp
// 596 / 1600 Huffman right # include "core.h" # include <cstring> # include <vector> # include <queue> # include <deque> # include <map> typedef unsigned char uchar; const bool IS_DIV = 1; constexpr int NODE_MAXSIZE = 1024 * 512 + 8; struct bufferEncode { std :: deque <bool> buf; bufferEncode() { w...
ALGO
0.999352
3.588504
f6d3c302-66bc-4bc3-a1c7-3a6f89b2511a
MaartenJongeneel/FSM-Bin-Packing
src/states/Operation.cpp
#include "Operation.h" #include "../FSMSequenceOne.h" #include<iostream> #include<sstream> #include<fstream> #include<iomanip> #include<unistd.h> void Operation::configure(const mc_rtc::Configuration & config) { } void Operation::start(mc_control::fsm::Controller & ctl_) { auto & ctl = static_cast<FSMSequenceOne...
ALGO
0.860802
4.108294
9d0b6df5-713f-48ab-85fd-0b408725aa5a
walkccc/LeetCode
solutions/1570. Dot Product of Two Sparse Vectors/1570-2.cpp
class SparseVector { public: SparseVector(vector<int>& nums) { for (int i = 0; i < nums.size(); ++i) if (nums[i]) v.push_back({i, nums[i]}); } // Returns the dot product of the two sparse vectors. int dotProduct(SparseVector& vec) { int ans = 0; for (int i = 0, j = 0; i < v.size() &...
ALGO
0.999322
6.132113
84dbc9f4-631d-4c1a-b161-9080349b36f1
shetkari03/LeetCode
2552-maximum-sum-of-distinct-subarrays-with-length-k/2552-maximum-sum-of-distinct-subarrays-with-length-k.cpp
class Solution { public: long long maximumSubarraySum(vector<int>& nums, int k) { int n=nums.size(); int m=0; for(auto it:nums)m=m>it?m:it; vector<int>hash(m+1,0); long long int left=0,right=0,sum=0,ans=0; while(right<n){ hash[nums[right]]++; s...
ALGO
0.999978
5.762152
cd5f9083-8547-40f8-ae06-dee217cf6398
joan0802/Leetcode_practice
977. Squares of a Sorted Array.cpp
class Solution { public: vector<int> sortedSquares(vector<int>& nums) { int n = nums.size(); vector<int> ans(n); int s = 0, e = n-1; for(int i = n - 1; i >= 0; --i) { if(abs(nums[s]) >= abs(nums[e])) { ans[i] = nums[s] * nums[s]; s++; ...
ALGO
0.999992
5.996461
99b6bcd9-e55a-4b9f-a9d0-40c313dbcc1d
PauloMitsi/Trabalhos_Faculdade
Algoritmo 2/Codigos/Exercicios/Ex1/main.cpp
// Algorithm created by Paulo Mitsi // The main purpose of this code is to read a number that user inputs and tell if the number is odd or even. #include <iostream> using namespace std; //Function responsible for read what user inputs and return it to a variable int NumberRead() { //local variable int n; ...
ALGO
0.994578
5.394866
c886428c-2b7a-4526-9209-c2fd1c0f6469
chelsey0527/TECHIN514_Final
esp32s3-server/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/ceil.cpp
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/ceil.h" #include "edge-impulse-sdk/tensorflow/lite/c/common.h" #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" #include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h" #include "edge-impulse-sdk/tensorflow/lite/...
ALGO
0.872574
7.842594
bb79eb48-5b49-4b61-9337-e83e5cdfdecf
nico/llvm-project-20170507
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
#include "ValueEnumerator.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Argument.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constant.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DerivedT...
TOOL
0.95979
7.874916
8721b289-4de0-445d-b7ce-5375a0ae0fe4
codingsoham/CodeForces
Doremy 's Paint 3/main.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; vector<int> vec(n); for(auto &assgn:vec) cin>>assgn; int cnt1=1; int cnt2=0; int el1=vec.at(0); int el2=0; fo...
ALGO
0.999941
4.020763
f73eb40a-2710-41be-87cf-4838c031c565
marine5575/BOJ
1837 암호 제작.cpp
#include <iostream> #include <vector> #include <string> #include <cstdio> using namespace std; int num[1000001]; // 체망 vector<int> prime; // k 미만 소수 모음 string s; // input 암호. 10^100까지 담을 수 있음 int k; // input 숫자 int main(void) { cin >> s >> k; // 이거로 받으면 자동으로 string은 char의 배열로 됨 // 에라토스테네스의 체망 for (int i = 2; i <...
ALGO
0.999685
4.536142
55a3b430-1974-405a-bdc1-0057ab20b1de
ivandad1/CodeForces
368B - Sereja and Suffixes/Source.cpp
#include<stdio.h> #include<math.h> #include<algorithm> #include<stdlib.h> #include<cstring> using namespace std; int main(void){ int n, m, x, array[100001], ans[100001]; scanf("%d %d",&n,&m); for(int i=1;i<=n;++i) scanf("%d",&array[i]); bool used[100001]; memset(used,false,sizeof used); ans[n]=1; used[array...
ALGO
0.999943
3.523524
c800b9d0-466b-4522-9d99-341dd37a0166
mohammadamanpatel/LinkedList
Copy List with Random Pointer(2).cpp
class Solution { public: Node*ClonedList(Node*head) { if(!head) return nullptr; Node*oldList = head; while(oldList) { Node*clonedList = new Node(oldList->val); clonedList->next = oldList->next; oldList->next = clonedList; oldList = ...
ALGO
0.994068
5.28013
8b38a113-7f91-4e31-9ff4-0c81813a22ea
ZoroMak/SiAOD
СиАОД2-7/LZ77.cpp
#include "LZ77.h" #include <vector> #include <string> #include <iostream> using namespace std; void lz77Encode(const string& phrase) { vector<Pair> encoded; int phraseLength = phrase.length(); int currentIndex = 0; while (currentIndex < phraseLength) { Pair currentPair; currentPair.o...
ALGO
0.976616
4.311044
3df3576f-9fe9-4326-af08-30519096e0f5
avanivaish/DSA
LINKED LIST/partitionLL.cpp
#include<iostream> using namespace std; class node{ public: int data; node* next; node(int val){ data = val; next=NULL; } }; void insertAtTail(node* &head, node* &tail, int val){ node* n = new node(val); if(head==NULL){ head=n; tail=n; return; } ...
ALGO
0.999996
4.731094
7fc6b639-0bec-412b-b05c-7e30c646e332
jackkolokasis/teraheap
jdk8u345/hotspot/src/share/vm/opto/divnode.cpp
#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/connode.hpp" #include "opto/divnode.hpp" #include "opto/machnode.hpp" #include "opto/matcher.hpp" #include "opto/mulnode.hpp" #include "opto/phaseX.hpp" #include "opto/subnode.hpp" // Portions of code courtesy...
ALGO
0.998131
5.408884
f41aa849-f447-4fd0-9f36-971b8a0b296f
unnati-dot/Problem-solving
Sorting techniques/Insertion sort.cpp
//Insertion sort /* TIME COMPLEXITY: O(n^2) SPACE COMPLEXITY : O(1) */ #include <iostream> using namespace std; void insertionSort(int arr[],int n){ for(int i=0;i<n;i++){ int key = arr[i]; int j= i-1; while(j>=0 and arr[j]>key){ arr[j+1] = arr[j]; j--; ...
ALGO
0.999971
5.557436
c45d19dd-3f6c-4355-815d-68e042c8373f
ishandutta2007/codeforces
somuchdrama/normal/771/C.cpp
#pragma GCC optimize("O3") #include <bits/stdc++.h> using std::cerr; using std::cin; using std::cout; using std::abs; using std::min; using std::max; using std::swap; using std::map; using std::pair; using std::set; using std::string; using std::vector; using ll = long long; using uint = unsigned int; using pii = p...
ALGO
0.999952
4.199931
2278a058-8f6f-4445-9b39-eb71be1a54a8
18-RAJAT/ONLINE-JUDGE
L_Lazyland.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define sza(x) ((int)x.size()) #define all(x) x.begin(), x.end() #define revall(x) x.rbegin(), x.rend() #define sortall(x) sort(all(x)) const int MAX_N = 2e5 + 5; const int MAX_NN = 2e5 + 8; const ll MOD = 10e9 + 7; const ll INF = 1e18+20; #define r...
ALGO
0.999924
3.529143
c648ce20-348e-48b5-9bf3-f9b61231479d
euchangxian/LeetCode
C++/1791-FindCenterOfStarGraph/Solution.cpp
#include <unordered_map> #include <vector> class Solution { public: int findCenter(std::vector<std::vector<int>>& edges) { // The center must be contained in every edge, thus, it suffices to check // the first two edges if (edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1]) { return edges[0...
ALGO
0.99987
6.075972
df11c0bb-f5ee-4eeb-9bcc-8cc993e30d86
BrunoCrestani/z3ReversedGOL
utils.cpp
#include "utils.h" #include <iostream> #include <vector> void readMatrix(std::vector<std::vector<int>>& matrix) { for (size_t row = 0; row < matrix.size(); row++) { for (size_t col = 0; col < matrix[0].size(); col++) { std::cin >> matrix[row][col]; } } } int verifyGameState(std::ve...
ALGO
0.999749
6.049911
de5ae4ac-7fd6-436e-b23d-e133e230a13f
puma10100505/documents
demos/simple-udp/playground/ode_learning.cpp
#include "ode/ode.h" #include "drawstuff/drawstuff.h" #include <cstdio> using namespace std; #ifdef dDOUBLE #define dsDrawSphere dsDrawSphereD #endif static dWorldID world; dBodyID ball; const dReal radius = 0.2f; const dReal mass = 1.0f; static void step(int pause) { const dReal *pos, *R; dWorldStep(world...
ALGO
0.978847
4.426566
fd865e89-1d89-46d5-9635-bd1ccd8a23da
harshabangi/leetcode
cpp/recursion_and_dp/subsequence/increasing_subsequences.cpp
// // Created by Harsha Vardhan on 18/05/22. // #include <iostream> #include <vector> #include <set> using namespace std; // 4, 6, 7, 7 void findSubsequencesHelper(vector<int> &nums, int idx, vector<int> tmp, set<vector<int>> &set) { if (tmp.size() >= 2) set.insert(tmp); for (int i = idx + 1; i < nums.size(...
ALGO
0.99996
5.368905
31237885-31bc-4bcd-94c1-7ceb0dd7c4c3
Krish-Gupta-13/Udemy-GFG
GFG/Tree/02_inorder_traversal.cpp
//Code bhi krle kitna game khelega// #include<bits/stdc++.h> #include<iomanip> using namespace std; struct Node{ int key; struct Node *left; struct Node *right; Node(int k){ key=k; left=right=NULL; } }; void inorder(Node *root){ if(root!=NULL){ inorder(root->left); ...
ALGO
0.999927
3.910791
76796194-806c-4a8a-a5d5-189b1998e972
zl90/CMU-Databases-Course
third_party/libpg_query/src_common_keywords.cpp
/*-------------------------------------------------------------------- * Symbols referenced in this file: * - ScanKeywords * - NumScanKeywords * - ScanKeywordLookup *-------------------------------------------------------------------- */ #include "pg_functions.hpp" #include <string.h> #include <string> #include ...
TOOL
0.921312
6.24166
d453ff3e-a55c-4908-9c1a-511bb0751a96
lazybones1/Algorithms
leetcode/30-Day LeetCoding Challenge/week 2/1. Middle of the Linked List.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* middleNode(ListNode* head) { ListNode* ans; ListNode* p = head; int middle = 0; while (p ...
ALGO
0.999833
5.835059
28cc9ba7-7a8e-47bf-9d47-bef890ad9bb5
cosmin-andrei/DunareaHighschool-Work
BACALAUREAT/2016/MODEL2016 - III.4/main.cpp
#include <iostream> #include <fstream> using namespace std; ifstream fin("date.in"); int main() { int nr, pmax=999999999, pmin=-1, ok=1; while(fin>>nr && ok==1) { if(nr%2==0 && pmin>nr)ok=0; else if(nr%2==0) pmin=nr; else if(pmax<nr)ok=0; else pmax=nr; } if(ok==1) ...
ALGO
0.997394
3.931636
dba5ae75-2449-4c57-91d9-128cdb3120d4
Kimel-PK/Programowanie_obiektowe_w_Cpp_2022-2023
Zestaw 1/zadanie5.cpp
#include <iostream> #include <vector> using namespace std; template <typename T> class Stack { private: vector<T> vect; public: typedef T value_type; void push(const T &x) { vect.push_back(x); } T pop() { T x = vect.back(); vect.pop_back(); return x; } T top() { return vect.back(); } bool emp...
ALGO
0.999027
5.540704
faf70282-d7c0-40e8-b6bf-6c8a7eb50fc1
onenewarm/codetree-TILs
240109/개발자의 능력 3/ability-of-developer-3.cpp
#include <iostream> #include <cmath> using namespace std; int main() { // 여기에 코드를 작성해주세요. int totalSum = 0; int algorithmStats[6]; for(int iCnt = 0; iCnt < 6 ;++iCnt) { cin >> algorithmStats[iCnt]; totalSum += algorithmStats[iCnt]; } int ans = 1 << 30; for(int iFir...
ALGO
0.999776
4.243278
fd48a030-72a4-4360-915c-7e1691c48ad8
sunilkumarmaurya786693/solution-leedcode-codechef-codeforces-gfg-interviewbits-hackerEarth-HackerRank
pepcoding solution/dynamic programming pepcoding/3ClimnbStairWithVariableJump.cpp
#include <bits/stdc++.h> #define SPEED ios::sync_with_stdio(false);cin.tie(0); cout.tie(0); #define pii pair<int,int> #define inf_neg -100000000000000ll using namespace std; typedef long long int ll; ll m=1000000007; map<vector<int>,int>m1; int solve(int arr[],int n,int size1,int i,vector<int>&ans){ // cout<<n<<"\...
ALGO
0.999985
4.063177
85f98670-8600-46fe-bb77-f9539c3e6a01
Emma2805/DSA-WITH-CPP
day1/printNumber1ToN.cpp
#include<iostream> using namespace std; int main(){ int n; cout<<"take the input :"; cin>>n; for(int i =1 ; i<=n;i++){ cout<<i<<" "; } }
ALGO
0.998603
3.450233
c603cddd-c301-44a6-87ec-15348dca8b70
HawieLong/sgx-pytorch
torch/csrc/jit/tensorexpr/bounds_overlap.cpp
#include <torch/csrc/jit/tensorexpr/bounds_overlap.h> #include <torch/csrc/jit/tensorexpr/ir_simplifier.h> namespace torch { namespace jit { namespace tensorexpr { namespace analysis { OverlapKind boundOverlap(Bound a, Bound b) { // If they're equal they're equal. bool startEqual = exprEquals(a.start, b.start); ...
ALGO
0.940461
7.767935
334c6343-6227-4256-8e89-8d544cacc16c
Salil-ux/Movie-Database-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
62c0c4db-7981-47ea-a850-af6ef6f3acae
Arthurx-07/dsa-in-c-
lecture15-recursion/002part2/004issorted.cpp
#include<iostream> using namespace std ; bool issorted( int X[], int n , int i ){ // base case if( i == n-1 ) { // check if X[ i ... n-1 ] = {X[N-1 ]} return true ; } // recursive case // check if the X[I ... N-1] is sorted return X[i] < X[i+1] and issorted(X,n,i+1 ) ; } i...
ALGO
0.999927
4.564443
08f37920-7907-4b57-a9ec-fc7058877237
tvtaqa/enPAC_BETA3_9
RG.cpp
// // Created by lewis on 19-7-21. // #include "RG.h" /*********************Global Functions**********************/ void DecToBinary(index_t DecNum, unsigned short *Binarystr) { int i = 0; while(DecNum) { Binarystr[i++] = DecNum%2; DecNum = DecNum/2; } } void BinaryToDec(index_t &DecNu...
ALGO
0.991608
3.467098
99864e70-4ca6-4b7c-a17c-f9598fbfeb4d
hussain2004/cryptography
Write a C program for ECB, CBC, and CFB modes.cpp
from Crypto.Cipher import AES from Crypto.Random import get_random_bytes from Crypto.Util.Padding import pad def ecb_encrypt(plaintext, key): cipher = AES.new(key, AES.MODE_ECB) ciphertext = cipher.encrypt(plaintext) return ciphertext def cbc_encrypt(plaintext, key, iv): cipher = AES.new(key, AES.MODE_CBC, i...
ALGO
0.937202
4.030747
5409a709-c0eb-448a-ac51-d61f138cac91
Ti64CLi/nace
src/engine/bitboards.cpp
#include "bitboards.h" #include "types.h" #include <cassert> #include <cstdint> #include <iostream> #include <vector> namespace Engine { namespace Bitboard { inline Square lsb(bitboard_t bb) { assert(bb); return Square(__builtin_ctzll(bb)); } inline Square msb(bitboard_t bb) { assert(bb); return S...
CONFIG
0.932274
6.06176
f37c9ab7-08fa-46a5-b805-98eef4d8ad90
Weikang01/learn_opengl
libraries/assimp-3.1.1/code/SplitLargeMeshes.cpp
/** @file Implementation of the SplitLargeMeshes postprocessing step */ #include "AssimpPCH.h" // internal headers of the post-processing framework #include "SplitLargeMeshes.h" #include "ProcessHelper.h" using namespace Assimp; // ------------------------------------------------------------------------------------...
TOOL
0.868689
6.530207
f0c8b1c1-3d06-4730-ab59-f47dbbc9ded0
doug16rogers/oldstuff
dos/cpp/PENROSE.CPP
#include <stdiostr.h> #include <conio.h> #include <graphics.h> #include <math.h> #include "turtlegr.hpp" #define _36_DEG (M_PI/5.0) #define PHI (1.618033988749894903) #define SCALE 40.0 typedef struct { int x; int y; } iPoint; typedef struct { double x; double y; } dPoint; typedef struct { double a; double ...
ALGO
0.997691
3.778519
d0f2ecd1-ccef-493a-a63f-7dac94f45cfe
ojassm/stabletaskflow3
3rd-party/eigen-3.3.7/unsupported/doc/examples/EulerAngles.cpp
#include <unsupported/Eigen/EulerAngles> #include <iostream> using namespace Eigen; int main() { // A common Euler system by many armies around the world, // where the first one is the azimuth(the angle from the north - // the same angle that is show in compass) // and the second one is elevation(the angl...
ALGO
0.995983
5.125681
5d962502-548a-4ebb-8a2c-e20fc1643220
khadija1114/Online-Judge-Solutions
Codeforces/1739a.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t, cs = 0; scanf("%d", &t); while (t--) { int n, m; scanf("%d %d", &n, &m); if (n > 1 && m > 1) puts("2 2"); else puts("1 1"); } }
ALGO
0.999577
4.408746
3a6b0686-e4da-436b-ab7a-753a927174f4
DeepakSharma72/StriverSDESheet
flattenaLL.cpp
#include <bits/stdc++.h> /**************************************************************** Following is the class structure of the Node class: class Node { public: int data; Node* next; Node* child; Node(int data) { this->data = data; this->next = NULL; this->child = NULL; } }; *********************...
ALGO
0.999993
4.797232
74dcca64-798c-4af5-93dc-5d0eaf0ccff9
jh000/jhPrimeminer
src/primecoinMiner/mpn/addcnd_n.cpp
#include "./../global.h" #include "gmp-impl.h" mp_limb_t mpn_addcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd) { mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask; ASSERT (n >= 1); ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n)); mask = -(mp_li...
ALGO
0.999123
4.652488
726930bf-5893-466c-8cb5-b28989681413
algoamigoo/Leetcode
155-min-stack/min-stack.cpp
class MinStack { public: vector<pair<int, int>> arr; pair<int, int> p; int mini; MinStack() { p.first = 0; p.second = 0; mini = INT32_MAX; } void push(int data) { if (arr.empty()) { p.first = data; p.second = data; arr.push_bac...
ALGO
0.999834
6.26937
17e095ab-feda-48fc-b340-263b365e9c5b
searleser97/competitive-programming-reference
Reference/Geometry/Segment-Segment Intersection.cpp
// 7 #include "Data Structures/Point.cpp" int sign(ld x) { return x < 0 ? -1 : x > 0; } void swap(Point& a, Point& b) { swap(a.x, b.x), swap(a.y, b.y); } // 17 // 0: no point, 1: single point, -1: infinity points pair<int, Point> ssintersection(Point a, Point b, Point u, Point v) { ...
ALGO
0.999762
4.703843
67a6c4ca-1514-4e43-b9c8-336127650b07
jasonbunk/InvertedPendulumVisualControl
Source/main.cpp
#include "stdafx.h" #include "main.h" #include "SFML_Inputs.h" #include "Utils/CaseInsensitiveSearch.h" #include <stdlib.h> #include <stdio.h> #include <math.h> #include <list> #include <deque> #include <algorithm> using std::cout; using std::endl; #include "InitSimulations.h" #include "SimplerGameSimSystem.h" #incl...
TOOL
0.905494
3.951765
b87e8bde-9757-47f8-942b-60dded447d56
manredeshanxiren/Algorithm
codeforce/A_Sakurako_and_Kosuke.cpp
#include <iostream> #include <algorithm> using namespace std; typedef long long LL; typedef unsigned long long ULL; void solve() { int n; cin >> n; int cur = 0; int i; for(i = 1; abs(cur) <= n; ++i) { int temp = 2 * i - 1; if(i % 2) cur -= temp; else cur += temp; ...
ALGO
0.998973
4.176487
7ddfe62b-9ff8-4073-acc7-fc1094c61f93
floreaadrian/AlgCodes
CodeChef/BINOP.cpp
#include <iostream> using namespace std; int o,e,i,unu,z; char s1[1000010],s2[1000010]; int main() { int t; cin>>t; while(t--) { o=e=0;unu=z=0; cin>>s1>>s2; for(i=0;s1[i];i++) { if(s1[i]=='0') z++; else unu++; } if(z==i||unu==i) { cout<<"Unlucky Chef\n"; continue; } for(i=0...
ALGO
0.999877
3.796125
eed0a2ea-0060-4562-86d0-35319fd60e3d
raihansikdar/Competitive_Programming
CodeForces/Contests Code/Codeforces Round #826 (Div. 3)/1.A. Compare T-Shirt Sizes.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define S(a) scanf("%lld",&a); #define SS(a,b) scanf("%lld %lld",&a,&b); #define SSS(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define SSSS(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d); #define ...
ALGO
0.999892
3.568627
7eeb7981-9080-404b-ad49-3f3cdf27c191
alexandraback/datacollection
solutions_5769900270288896_0/C++/Zark/CJ201511B.cpp
#include <cstdio> #include <iostream> #include <vector> #include <cmath> #include <fstream> #include <list> #include <stack> #include <algorithm> #include <queue> #include <map> #include <cstdlib> #include <set> #include <string> #include <cstring> #include <memory> #pragma comment(linker, "/STACK:104857600,104857600"...
ALGO
0.999856
3.577679
ec9a3d6f-4fda-4576-961d-6023cbf27940
bioconductor-source/BiocNeighbors
src/build_annoy.cpp
#include "annoy.h" template<class Distance> Rcpp::RObject build_annoy_internal (Rcpp::NumericMatrix Mat, int Ntrees, const std::string& Fname) { const int ndim=Mat.nrow(); const int ncells=Mat.ncol(); typename Annoy<Distance>::_index obj(ndim); std::vector<typename Annoy<Distance>::Data_t> tmp(ndim); ...
ALGO
0.990788
5.985815
2bd6b08e-0f8f-45db-a303-c2dc54816d96
Princeton21/Data-Structures-and-Algorithms
Code/binarytree_CPP/balanced tree.cpp
#include <bits/stdc++.h> using namespace std; struct Node { int data ; struct Node* left ; struct Node* right ; Node ( int val ) { data = val ; left = NULL ; right = NULL ; } }; bool balancedTree ( Node* root , int* h ) { if ( root == NULL ) { *h = 0 ;...
ALGO
0.999997
4.621881
e6dc6102-4bb7-498f-a01e-1754072cbd4c
heiseish/Competitive-Programming
spoj/CTRICK.cpp
/** People who continue to put their lives on the line to defend their faith become heroes and continue to exist on in legend. */ #include <bits/stdc++.h> #define forn(i, l, r) for(int i=l;i<=r;i++) #define all(v) v.begin(),v.end() #define pb push_back #define nd second #define st first #define debug(x) cout<<...
ALGO
0.999917
3.781599
45bafc93-14fb-44d5-bfc1-07c17e916e71
ankursinghbisht/DSA_CheatSheet
C++/Greedy/16_max_sum_in_arri.cpp
/* Idea: sorting and summing with multiplication (using mod, with each multiplication) and addition in answer */ //{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: int mod = 1e9 + 7; int Maximize(int a[], int n) { sort(a, a + n); ...
ALGO
0.999925
5.836097
474a4149-730d-4616-bcb3-be8a3382cd6c
Shubham2816/DSA_Problems
2707-merge-two-2d-arrays-by-summing-values/merge-two-2d-arrays-by-summing-values.cpp
class Solution { public: vector<vector<int>> mergeArrays(vector<vector<int>>& nums1, vector<vector<int>>& nums2) { map<int, int> mergedMap; // Insert elements from nums1 for (auto& pair : nums1) { mergedMap[pair[0]] += pair[1]; } // Insert elements from nums2 for (auto& pair :...
ALGO
0.999973
6.507037