uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
56e25b86-7e45-4732-80a3-91050bd8f87b
istiaque010/BTCECC_Linuxkali
src/interfaces/chain.cpp
#include <interfaces/chain.h> #include <chain.h> #include <chainparams.h> #include <primitives/block.h> #include <sync.h> #include <txmempool.h> #include <uint256.h> #include <util/system.h> #include <validation.h> #include <memory> #include <utility> namespace interfaces { namespace { class LockImpl : public Chain...
TOOL
0.867265
5.533288
01ed68fb-b516-4970-8235-776152bebb1b
bashirafarhin/leetcode-potd
452-minimum-number-of-arrows-to-burst-balloons/minimum-number-of-arrows-to-burst-balloons.cpp
class Solution { static bool comp(vector<int>& a, vector<int>& b) { return a[1] < b[1]; } public: int findMinArrowShots(vector<vector<int>>& points) { sort(points.begin(), points.end(), comp); int ans = 0; // int left = points[0][0]; int right = points[0][1]; for (int...
ALGO
0.999988
6.285099
f3c091c7-18f8-4ce0-b70d-3b49a0d88059
alexandraback/datacollection
solutions_5662291475300352_0/C++/kojingharang/Cs.cpp
#include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <numeric> #include <sstream> #include <iostream> #include <iomanip> #define _USE_MATH_DEFINES #include <cmath> #include <climits> #include <cstdlib> #include <cstring> #include <cfloat> #include <cmath> #include <ctime> #incl...
ALGO
0.999282
3.554585
576fb178-4e43-4fe7-a251-c535a1dc999d
Nitesh-Lad/DSAL
DSAL9.cpp
/* 9.Given sequence k = k1 <k2 < ... <kn of n sorted keys, with a search probability pi for each key ki . Build the Binary search tree that has the least search cost given the access probability for each key? */ #include <bits/stdc++.h> using namespace std; int sum(int frequency[], int i, int j) { int sum = 0; ...
ALGO
0.99997
5.115654
29080b4f-6d33-4f51-99a6-e4eb9b377750
Pulkith/Competitive
CodeForces/162/d/d.cpp
/** * author: DespicableMonkey * created: 07.31.2021 17:25:07 * Potatoes FTW! **/ #include<bits/stdc++.h> #if LOCAL #include <DespicableMonkey/Execution_Time.h> #include <DespicableMonkey/Debug.h> #define debug_active 1 #endif using namespace std; #define pb push_back #define f first #define s secon...
ALGO
0.997877
4.562346
fb3eb17a-4b3b-48dc-991c-458ef4a4ac58
sigus/solutions
cf/149A.cpp
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int k; cin >> k; vector<int> a(12); for (int i = 0; i < a.size(); i++) cin >> a[i]; sort(a.begin(), a.end()); int c = 0, h = 0; while (c < 12 && h < k) { h += a[a.size() - 1 - c]; ...
ALGO
0.999962
3.78928
64ae2269-0569-4fb8-ba02-4daa1c0c2385
0-jij-0/CompetitiveProgramming
Problems Archive/1000 - 1999/1881 - Banana Bunches.cpp
#include <iostream> #include <vector> #include <numeric> #include <unordered_map> using namespace std; typedef long long ll; vector<ll> v, pref; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; cin >> T; for (int t = 1; t <= T; t++) { int n, k; cin >> n >> k; v.resize(n); pref.resize(n)...
ALGO
0.999739
4.428052
1714cc5a-70ad-4660-bc84-eed4cba3b506
ob22a/Leetcode
874-backspace-string-compare/backspace-string-compare_1.cpp
class Solution { public: void helper(string s,string &a){ for(char c:s){ if(c=='#'){ if(!a.empty()) a.pop_back(); } else a.push_back(c); } } bool backspaceCompare(string s, string t) { string a="",b=""; helper(s,a); helper(t...
ALGO
0.999797
5.905923
2e4877ea-c37f-4a8b-aa6b-911dacfe8519
hhhhaura/competitive-programming
AA3/pC_2.cpp
#define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC loop-opt(on) #define rep(i, a, b) for(int i = a; i <= b; i ++) #define rrep(i, a, b) for(int i = b; i >= a; i--) #define ceil(a, b) ((a + b - 1) / (b)) #define all(a) a.begin(), a.end() #define int long long int #define lld long double ...
ALGO
0.999803
3.75254
abbec355-9d6e-4ca6-9b8a-b4dbd95d9513
sayakbanerjee1999/Coding-Notes
C++/Binary Trees/diagonalSum.cpp
vector <int> diagonalSum(Node* root) { // Add your code here vector<int> res; if(!root) return res; queue<Node*> q; q.push(root); while(!q.empty()){ int sum = 0; int size = q.size(); for(int i = 0; i < size; i++){ Node*...
ALGO
0.999911
5.328424
85088beb-9d4a-4a0b-b345-4bc824b42900
fredhur/BOJ_PS
BOJ_1xxxx/boj_12891.cpp
// Title : DNA 비밀번호 https://www.acmicpc.net/problem/12891 #include <cstdio> char str[1000007]; struct Data { int cntA; int cntC; int cntG; int cntT; int minA; int minC; int minG; int minT; Data(const int &A, const int &C, const int &G, const int &T) { cntA = cntC = cntG =...
ALGO
0.999685
3.798155
35ee7e15-ca13-4326-9fe0-68dd996a6adc
Erfaniaa/competitive-programming
Codeforces/616A-ComparingTwoLongIntegers.cpp
/* SubmissionId : 16616082 ContestId : 616 Index : A ProblemName : Comparing Two Long Integers ProblemTags : ['implementation', 'strings'] ProgrammingLanguage : GNU C++11 Verdict : OK */ #include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; if (s1.length() < s2.length()...
ALGO
0.999952
4.284596
c2c863bb-9c26-4549-bd36-addc69d67c4b
mushkul/Vanderbilt-CP
solutions/claude-3-5-haiku-20241022/1743.cpp
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<int> freq(26, 0); for (char c : s) { freq[c - 'A']++; } priority_queue<pair<int, char>> pq; for (int i = 0; i < 26; i++) { if (freq[i] > 0) { pq.push({freq[i], 'A' + i...
ALGO
0.999993
5.36944
62f58c2e-df51-4d2f-ab60-7e727fc75cef
megabigpower/bencoin
src/rpcmining.cpp
#include "main.h" #include "db.h" #include "init.h" #include "bitcoinrpc.h" using namespace json_spirit; using namespace std; // Return average network hashes per second based on the last 'lookup' blocks, // or from the last difficulty change if 'lookup' is nonpositive. // If 'height' is nonnegative, compute the esti...
WEB
0.960526
5.456201
aa7bcd59-b77f-4a5c-bfc8-f2ee8cd54c30
tirthgandhi9905/SLEEP-INDUCER__BigOBrigade_
MAIN/main1.cpp
/* INFO: In this code we didn't use any complex data structure like Class, Stack, Queue , etc. Also we took all the input in the console directly from the user in the terminal. So if you run this code then you need to give inout in terminal console and then only it will run. */ #include <bits/stdc++.h> using namespace...
ALGO
0.992685
4.752574
e1bd25d9-e46d-413f-8c91-a421fbda40a9
JiHyeok-Kim/SAF-STUDY
2022-08/220810 - DFS, BFS/220810_2조_스터디_황채연/DFS의 탑_4번_사전순.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int N; int cnt[150]; char cnt_char[150]; int counter; typedef struct { char left = '#'; char right = '#'; }NODE; vector <vector<NODE>> v(150); string strs[1001]; bool compare(string t, string v) { int len = 0; int si...
ALGO
0.99997
4.507414
c6f72ffb-9866-46d9-bb61-b9f75b57d0d7
PrajaktaSelukar/Interview-Preparation
Dynamic Programming/Matrix Chain Multiplication/5. eggDroppingProblem.cpp
#include<iostream> #include<climits> using namespace std; int solve(int e, int f) { if(f==0 || f==1) return f; if(e==1) return f; int mn=INT_MAX; for(int k=1; k<=f; k++) { int temp= 1+ max(solve(e-1, k-1), solve(e, f-k)); mn = min(mn, temp); } return mn; } int main() { int e, f; cin>>e>...
ALGO
0.999961
3.756235
99f51247-018f-4c5d-8508-00bfb606d9b8
ftiasch/mithril
2013-05-10/B.cpp
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <complex> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <c...
ALGO
0.999919
3.387824
c9fa25f5-83ef-4ea5-b138-2b2ac5bf3754
ethanh6/LeetCode
src/0075-sort-colors.cpp
#include "leetcode.hpp" class Solution { public: void sortColors(vector<int> &nums) { int L = 0, R = nums.size() - 1, cur = 0; while (cur <= R) { if (nums[cur] == 0) { swap(nums[L++], nums[cur++]); } else if (nums[cur] == 1) { cur++; } else if (nums[cur] == 2) { swap...
ALGO
0.997307
6.001145
706bcf10-4740-43f4-b7cd-536ed852c7a6
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_527_8.cpp
#include <bits/stdc++.h> using namespace std; int fun(string str, int n, int k) { set<char> st; for (int i = 0; i < n; i++) { st.insert(str[i]); } string s = ""; for (auto i : st) { s = s + (i); } sort(s.begin(), s.end()); if (k > 26) return -1; if (n >= 1 && k == 1) return 1 + (s[0] - 'a'); ...
ALGO
0.999991
4.346838
7fc98e50-8ff3-4fb4-b697-2ba649a46881
DerpFest-bullhead/platform_frameworks_native
libs/cputimeinstate/cputimeinstate.cpp
#define LOG_TAG "libtimeinstate" #include "cputimeinstate.h" #include <dirent.h> #include <errno.h> #include <inttypes.h> #include <mutex> #include <set> #include <string> #include <unordered_map> #include <vector> #include <android-base/file.h> #include <android-base/parseint.h> #include <android-base/stringprintf...
TOOL
0.852756
6.911218
29cfaf5e-17cd-41dc-a5db-7470524448f0
thangitus/LeetCode-Solution
C++/Depth-first Search/814. Binary Tree Pruning.cpp
#include <bits/stdc++.h> #include "../Tree/TreeNode.h" using namespace std; class Solution { public: TreeNode *pruneTree(TreeNode *root) { if (!root) return nullptr; root->left = pruneTree(root->left); root->right = pruneTree(root->right); if (root->val == 1 || root->left || root->...
ALGO
0.999908
5.840867
2a6864c5-f4a7-4aed-ada9-c966e8c668d0
ishandutta2007/codeforces
wiwiho/normal/1196/E.cpp
#define NDEBUG #include <bits/stdc++.h> #define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define iter(a) a.begin(), a.end() #define riter(a) a.rbegin(), a.rend() #define lsort(a) sort(iter(a)) #define gsort(a) sort(riter(a)) #define mp(a, b) make_pair(a, b) #define pb(a) push_back(a)...
ALGO
0.999895
3.874449
3b661ba8-26a3-493f-9a72-83b194144464
rockysingh2003/File-Compression-Using-Huffman-Coding-
source/huffman_test.cpp
// C++ program for Huffman Coding #include <bits/stdc++.h> using namespace std; // A Huffman tree node struct MinHeapNode { // One of the input characters char data; // Frequency of the character unsigned freq; // Left and right child MinHeapNode *left, *right; Mi...
ALGO
0.999982
5.597406
8e74cfdd-4fce-4acb-9ed2-32a34a991ef2
hasuq33/C-
recursion/Day1/power_n.cpp
#include<iostream> using namespace std; int power(int n){ // Base case if(n==0)return 1; return 2*power(n-1); } // 2power->n int main(){ int n=2; cout << power(n) << endl; }
ALGO
0.999682
4.968096
e8582ed8-187b-46d2-8ad7-14c2def1b83a
ishandutta2007/codeforces
300iq/normal/1367/E.cpp
#include <cmath> #include <functional> #include <fstream> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #include <random> #include <deque> #include <queue> #include <cassert> #include <unordered_map> #includ...
ALGO
0.99994
3.82211
5910b792-1dbf-4ccc-9e97-66fe50dacdac
sarvex/leetcode-julia
solution/0200-0299/0221.Maximal Square/Solution.cpp
class Solution { public: int maximalSquare(vector<vector<char>>& matrix) { int m = matrix.size(), n = matrix[0].size(); vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0)); int mx = 0; for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { if (matrix...
ALGO
0.99982
6.450754
ccaf7bf7-f9c3-45c7-a147-fe49c782f1ee
aralab-unr/CoSM-ICP
external_libraries/pcl_1_9/filters/src/voxel_grid.cpp
#include <iostream> #include <pcl/common/io.h> #include <pcl/filters/impl/voxel_grid.hpp> typedef Eigen::Array<size_t, 4, 1> Array4size_t; /////////////////////////////////////////////////////////////////////////////////////////// void pcl::getMinMax3D (const pcl::PCLPointCloud2ConstPtr &cloud, int x_idx, int y_idx, ...
ALGO
0.995601
5.056281
5714ed11-66b6-4660-af7e-812cf13bddf0
james-sungjae-lee/2018_CPP
STUDY/MidTerm/05/선택 정렬.cpp
#include <iostream> using namespace std; const int SIZE = 10; void selectionSort(int list[], int n); void printList(int list[], int n); int main(int argc, char const *argv[]) { int grade[SIZE] = {3, 2, 9, 7, 1, 4, 8, 0, 6, 5}; printList(grade, SIZE); selectionSort(grade, SIZE); printList(grade, SIZE); re...
ALGO
0.999812
4.814509
7df6add8-50bc-48c6-8ad0-dc25bed3a362
Tillkoeln/Tillkoelns-World-Domination-Machine
src/bloom.cpp
#include "bloom.h" #include "main.h" #include "script.h" #include "hash.h" #define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455 #define LN2 0.6931471805599453094172321214581765680755001343602552 using namespace std; static const unsigned char bit_mask[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x4...
ALGO
0.960469
6.82032
cb0e4d61-2669-48e4-a6f4-d63386847341
gt-retro-computing/llvm-I8080
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp
// <algorithm> // template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter> // constexpr OutIter // constexpr after C++17 // copy(InIter first, InIter last, OutIter result); #include <algorithm> #include <cassert> #include "test_macros.h" #include "test_iterators.h" // #if TEST_STD_VER >...
TEST
0.916843
6.868766
8a6fd657-80f6-4804-b27b-4630546d47be
Adastra0121/LB
LB10/1272.cpp
#include<iostream> using namespace std; int main(){ string s1,s2 = "666"; cin >> s1; int p = s1.find(s2); if(p == -1) { cout << s1; return 0; } s1.insert(p,"codethinking"); cout << s1; return 0; }
ALGO
0.995901
3.30614
d6587edb-b9ba-4fa0-b0aa-023c2c728a1a
joshuawins/horizon
src/board/board_rules_check.cpp
#include "board.hpp" #include "board_layers.hpp" #include "board_rules.hpp" #include "common/patch_type_names.hpp" #include "rules/cache.hpp" #include "util/accumulator.hpp" #include "util/util.hpp" #include <thread> #include <future> #include <sstream> namespace horizon { static std::string get_net_name(const Net *n...
TOOL
0.895726
6.473221
c6f4fc4b-eda4-4798-b5bb-37cacbe8ce89
weiweimonster/CS184
p3-2-pathtracer-sp22-heathcliff3-2/CGL/src/matrix4x4.cpp
#include "matrix4x4.h" #include <cmath> #include <iostream> using namespace std; namespace CGL { double &Matrix4x4::operator()(int i, int j) { return entries[j][i]; } const double &Matrix4x4::operator()(int i, int j) const { return entries[j][i]; } Vector4D &Matrix4x4::operator[](int j) { return entries[j]; } ...
ALGO
0.996277
5.951124
001a8704-da17-4731-bf3d-25eadcacd874
thienmai909/OnThiOLP
ELEC.cpp
#include <iostream> #include <algorithm> using namespace std; int main(){ int n, k, x = 1; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a+n, greater<int>()); if (n == 1) { cout << 0; return 0; } int sum = a[0]; for (int i = 1; i <= n; i++){...
ALGO
0.99998
4.423085
6e58c26e-890b-411a-a034-7b31d5cc4a5f
kidclone3/CP
hamic_algo/greedy_and_math/Division.cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back #define vi vector<int> #define vb vector<bool> #define ll long long #define pii pair<int, int> #define all(x) x.begin(), x.end() #define FORIT(i, s) for (auto it=(s.begin()); it!=(s.end()); ++it) #define F_OR(i, a, b, s) for (int i=(a); (s)>0? i<(b) : ...
ALGO
0.999958
4.460814
7afaf84a-467d-4443-b655-7bdaf63c1292
Ddelval/Competitive-programming
Past Contests/SEERC/2019-2020/G.cpp
// G.cpp // Created by David del Val on 28/02/2021 // // #include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) (x).begin(), (x).end() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll>...
ALGO
0.999678
3.136277
46c3592b-23f0-435d-b55a-39b52e2e5e9b
grimreapermanasvi/leetcode-ms
C++/144.BTpreorder.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),...
ALGO
0.999869
5.40013
5f291a2e-b62e-4c7e-93e6-3d018bb9a00d
ntq12341/Numerical-analysis-algorithms
Gts/LU-Choleski/Cholesky.cpp
#include "matrix.h" void Cholesky(matrix &a,matrix &u){ int n = a.row; double s; for(int i = 0;i < n;i++){ for(int k = 0;k < i;k++){ s += u.mat[k][i]*u.mat[k][i]; } u.mat[i][i] = sqrt(a.mat[i][i] - s); s = 0; for(int k = i+1;k < n;k++){ for(int h = 0;h < i;h++){ s += u.mat[h][i]*u.mat[h][k]; ...
ALGO
0.999942
3.357177
c65f4475-9488-46f9-bc74-4633260d8ea5
StoneCodingg/Android9.0
dalvik/libdex/sha1.cpp
/* * Tweaked in various ways for Google/Android: * - Changed from .cpp to .c. * - Made argument to SHA1Update a const pointer, and enabled * SHA1HANDSOFF. This incurs a speed penalty but prevents us from * trashing the input. * - Include <endian.h> to get endian info. * - Split a small piece into a he...
ALGO
0.994053
5.830642
d97fc243-91e7-4caf-90d3-350dd4bcb37e
brenimcode/CompetitiveProgramingSolving
Contests/Revisao/Strings/baralho.cpp
#include <bits/stdc++.h> #define DEBUG(x) cout << #x << " >>>> " << x << endl using namespace std; int main() { string a,b; getline(cin,a); int t = a.size(); vector<int> naipes[4]; // [C] [E] [U] [P] for (int i = 0; i < t; i+=3) { int num = 10*(a[i] - '0') + (a[i+1] - '0'); ...
ALGO
0.999897
3.782105
588bb31c-ba99-4ea6-a681-a04937f220c3
rekhav55/LeetcodeSolutions
Steps by Knight - GFG/steps-by-knight.cpp
// { Driver Code Starts #include<bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: //Function to find out minimum steps Knight needs to reach target position. // void dfs(int pr,int pc,int tr, int tc, vector<vector<int>>&chess,int &ans,int count){ // if(pr<=0 || ...
ALGO
0.999929
6.021841
297254d4-1970-4f60-80e4-f70c23eaddd7
ishandutta2007/codeforces
lzr_010506/normal/1320/B.cpp
#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <i...
ALGO
0.999816
4.319724
21445a6d-fef7-4a7c-bcbb-a325a4b46261
farhad-mahmud/Competitive-Programming
CP 2025/cses_sliding_window_median.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define nl "\n" #define yes cout << "YES\n"; #define no cout << "NO\n"; #define all(x) x.begin(),x.end() #define allr(x) x.rbegin() ,x.rend() #define dbug(x) cerr << (#x) << " is " << (x) << nl; #define output(a) for(auto &it: a) cerr<...
ALGO
0.999997
3.931598
77359038-b3ed-4a86-bc13-90806aa5088d
Noodle3D/ZCookie
algorithm/POJ/POJ2299 Ultra-QuickSort.cpp
#include<cstdio> using namespace std; int n, num[500000],temp[500000]; long long ans; void merge(int start, int end) { if(start==end) return; int mid=(start+end)/2; if(end-start>1) { merge(start,mid), merge(mid,end); } int i=start, j=mid, k=0; while(i<mid && j<end) { if...
ALGO
0.999936
3.808424
6f46f499-a52d-4fa0-980b-bf177f921cd2
ZhaiKai0922/701B
experiment_ws/ICP_zk/src/front_icp_two.cpp
/* *@Author: Zhai Kai *@Data:2021-10-28 09:39 */ #include <iostream> #include <fstream> #include <iostream> #include <deque> #include <vector> #include <eigen3/Eigen/Dense> #include <boost/make_shared.hpp> #include <pcl-1.8/pcl/io/pcd_io.h> #include <pcl-1.8/pcl/point_representation.h> #include <pcl-1.8/pcl/filters...
DATA
0.904414
4.407811
d1cb4811-3127-48db-a3fb-43af415d6f9d
argos-research/sumo
src/microsim/trigger/MSTriggeredRerouter.cpp
/****************************************************************************/ /// @file MSTriggeredRerouter.cpp /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Mirco Sturari /// @date Mon, 25 July 2005 /// @version $Id: MSTriggeredRerouter.cpp 22961 2017-02-15...
TOOL
0.929976
6.657547
bbb21ab6-ffa3-4ef1-a019-3dcc37841cb2
STREIN-11/ConCepts
Daily/Minimum_number.cpp
/* You are given an array arr of n elements. In one operation you can pick two indices i and j, such that arr[i] >= arr[j] and replace the value of arr[i] with (arr[i] - arr[j]). You have to minimize the values of the array after performing any number of such operations. Example 1: Input: n = 3 arr = {3,2,4} Output:...
ALGO
0.999978
5.793135
47eb5de4-909f-4995-a1de-a0d4e31142a4
Eliud-Garcia/Programa2-Notebook
cpp/Math/ExtendedEuclid.cpp
ll euclid(ll a, ll b, ll &x, ll &y) { if(b == 0) { x = 1; y = 0; return a; } ll xi, yi; ll g = euclid(b, a % b, xi, yi); x = yi; y = xi - yi * (a / b); return g; } int main() { //hallar Ax + By + C = 0 ll a, b, c; cin >> a >> b >> c; ll x, y; ll...
ALGO
0.999979
4.369448
3fb0c62d-87b1-4d45-aba7-b64b6ea612f0
rahulnagurtha/Mycode
tc/DivFreed2.cpp
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define FF first #define SS second #define pb push_back #define fill(a,v) memset(a,v,sizeof a) #define ceil(a,b) (((a)%(b)==0)?((a)/(b)):((...
ALGO
0.999958
4.345554
e45af1a2-48b9-4929-bbee-ba16d344e2e8
oddjoey/OpenGL-spoon
Libraries/include/glm/test/core/core_func_integer_find_msb.cpp
#include <glm/glm.hpp> #include <cstdio> #include <cstdlib> // To define "exit", req'd by XLC. #include <ctime> #define LE 1 // 1 for little-endian, 0 for big-endian. int pop(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0...
ALGO
0.999031
3.60046
e54fdc80-3672-497e-96b5-e0b6acd14af3
ishandutta2007/codeforces
zh0ukangyang/normal/1637/D.cpp
#include<bits/stdc++.h> #define L(i, j, k) for(int i = (j); i <= (k); ++i) #define R(i, j, k) for(int i = (j); i >= (k); --i) #define ll long long #define vi vector <int> #define sz(a) ((int) (a).size()) #define me(f, x) memset(f, x, sizeof(f)) #define uint unsigned int using namespace std; const int N = 107; int n, ...
ALGO
0.999973
3.447675
8f1bb501-c776-4ead-a05b-7d9d484ef15d
chosh95/STUDY
BaekJoon/2019/K번째 수.cpp
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> using namespace std; int p[5000000 + 1]; int main() { int N, K; cin >> N >> K; for (int i = 1; i <= N; i++) { scanf("%d", &p[i]); } sort(p + 1, p + N + 1); cout << p[K]; }
ALGO
0.999932
3.342836
a12a2ff3-7a31-4fdf-8683-08a6de67145f
SoumenBaral/CPP-for-Data-Structue
week 1 : Introduction to cpp/4.Mid/tempCodeRunnerFile.cpp
#include<bits/stdc++.h> using namespace std; class Person { public: char Name[100]; int age; float height; Person(char* nm,int a,float h ) { strcpy(Name,nm); age = a; height =h; }; }; int main () { char name[100]="Soumen"; Person* soumen= new Person(name,24,179.90...
TOOL
0.866596
3.493003
aff30ca2-182d-42b1-b472-beeba5ae79ae
SamuellH12/Competitive-Programming-Algorithms
Solutions/Beecrowd/2446 - Troco.cpp
#include <bits/stdc++.h> #define optimize ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define ALL(x) x.begin(), x.end() #define endl "\n" #define ll long long #define vi vector<int> #define pii pair<int,int> #define INF 0x3f3f3f3f const int MAXN = 1e6 + 5; using namespace std; //https://www.beecrowd.com...
ALGO
0.999974
3.9697
d0ec2dbb-254f-4443-8083-991f784658cd
sarvex/leetcode-csh
solution/1200-1299/1272.Remove Interval/Solution.cpp
class Solution { public: vector<vector<int>> removeInterval(vector<vector<int>>& intervals, vector<int>& toBeRemoved) { int x = toBeRemoved[0], y = toBeRemoved[1]; vector<vector<int>> ans; for (auto& e : intervals) { int a = e[0], b = e[1]; if (a >= y || b <= x) { ...
ALGO
0.999956
6.306602
e9ab1192-3441-4740-966a-e877bad6e7c3
thetapandeshmukh/CODESOFT
task1.cpp
// Create a c++ program that generates a random number and asks the // user to guess it. Provide feedback on whether the guess is too // high or too low until the user guesses the correct number. #include <iostream> #include <cstdlib> #include <ctime> int main() { srand(static_cast<unsigned int>(time(0))); // Seed...
TOOL
0.945839
6.523708
89c15a3c-0ffd-48d4-a15a-f49be24c5a8d
ChoiJangSeop/codenet-c-cpp-codeql-test
cpp/s586993279.cpp
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main() { int a, b; while (cin>>a>>b) { char s[7]; sprintf(s, "%d", a + b); cout << strlen(s) << endl; } return 0; }
ALGO
0.994827
3.642973
32394023-86f5-4c6f-8104-330e33adf0f6
bira37/problem-solving
Codeforces/Official Rounds/559/Div2B.cpp
#include <bits/stdc++.h> #define int long long #define double long double #define ff first #define ss second #define endl '\n' #define ii pair<int, int> #define mp make_pair #define mt make_tuple #define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define pb push_back #define vi vector<int> #defin...
ALGO
0.999882
3.647763
710d8233-3e96-4515-93fb-fbd127341e05
EgusquizaOreJesus/Programacion_Competitiva
Codeforces Round 878 (Div. 3)/p2B.cpp
#include <iostream> #include "cmath" using namespace std; void result(){ int m,c; cin >> m >> c; if (m < (pow(2,c)-1)){ cout << m + 1 << endl; } else{ cout << int(pow(2,c)-1) + 1 << endl; } } int main() { int t; cin >> t; while (t--){ result(); } re...
ALGO
0.999808
4.562539
fab7a6cf-4dcf-43ac-9a63-9d6d2f9d3344
Ahnaf-41M/Codeforces_AtCoder
atcoder/abc213/D.cpp
#include "bits/stdc++.h" #define ff first #define ss second #define MX 100005 #define pb push_back #define int long long #define PII pair<int,int> #define endl "\n" #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i = a; i <= ...
ALGO
0.999952
4.537302
ef4c7f79-2c21-4e75-b371-e45d68fed297
anoobzg/qi
src/pcl/src/registration/src/correspondence_rejection_distance.cpp
#include <pcl/registration/correspondence_rejection_distance.h> ////////////////////////////////////////////////////////////////////////////////////////////// void pcl::registration::CorrespondenceRejectorDistance::getRemainingCorrespondences ( const pcl::Correspondences& original_correspondences, pcl::Corresp...
TOOL
0.924073
6.457454
958573a0-a1c2-4b2e-b166-855b8894f6af
udaykiran04/1BM17CS120_ADA
6b_topological.cpp
#include <iostream> #include <list> #include <stack> using namespace std; class Graph { int V; list<int>* adj; void topologicalSortUtil(int v, bool visited[], stack<int>& Stack); public: Graph(int V); void addEdge(int v, int w); void topologicalSort(); }; Graph::Graph(int V) { this->V = V; ...
ALGO
0.999996
5.737517
fb94906f-5777-4fde-ac2e-7da2708bef36
bhanupgpt/leetcode-practice
1475-final-prices-with-a-special-discount-in-a-shop/1475-final-prices-with-a-special-discount-in-a-shop.cpp
class Solution { public: vector<int> finalPrices(vector<int>& prices) { int n = prices.size(); // Create a copy of original prices array to store discounted prices vector<int> result = prices; for (int i = 0; i < n; i++) { // Look for first smaller or equal price that co...
ALGO
0.999973
6.671706
135708af-2ca1-499e-bd97-aaf7022b1c02
liphx/code
src/cplusplus/leetcode/problem-8.cpp
// https://leetcode.cn/problems/string-to-integer-atoi/ #include "leetcode.h" class Solution { public: int myAtoi(string s) { if (s.empty()) return 0; int i = 0, n = s.length(); while (s[i] == ' ') ++i; int f = 1; if (s[i] == '-') { ++i; f = -1; ...
ALGO
0.998441
5.473429
190dd12e-64c5-4345-aa22-d406d34c7319
ZhouXinghi/Peano4
applications/exahype2/swe/Rusanov.cpp
#include "Constants.h" #include "tarch/Assertions.h" #include "tarch/NonCriticalAssertions.h" #include "VariableShortcuts.h" using s = applications::exahype2::swe::VariableShortcuts; #if defined(GPUOffloadingOMP) #pragma omp declare target #endif double applications::exahype2::swe::rusanov( const double* __restrict...
ALGO
0.999915
5.249408
f7512c17-174a-48c1-b031-91edf05f6b39
ishandutta2007/codeforces
kostroma/normal/67/D.cpp
#include <cstdlib> #include <iostream> #include <stdio.h> #include <math.h> #include <algorithm> #include <string> #include <vector> #include <string.h> #include <set> #include <map> #include <queue> #include <memory.h> using namespace std; #define pb push_back #define mp make_pair typedef long long li; typedef long d...
ALGO
0.99998
3.693599
9eee8d04-d0ad-439e-b3a0-51abe0e5259f
kikimo/third-party
boost_1_83_0/libs/spirit/classic/phoenix/example/fundamental/sample3.cpp
#include <vector> #include <algorithm> #include <iostream> #include <boost/spirit/include/phoenix1_functions.hpp> #include <boost/spirit/include/phoenix1_primitives.hpp> using namespace std; using namespace phoenix; struct is_odd_ { template <typename ArgT> struct result { typedef bool type; }; template...
ALGO
0.992868
5.420149
b05a9b22-1651-4eaf-a687-dce7e2e8b301
ishandutta2007/codeforces
jiangly/normal/1375/A.cpp
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; std::cin >> t; while (t--) { int n; std::cin >> n; for (int i = 0; i < n; ++i) { int a; std::cin >> a; a = std::abs(a); std::c...
ALGO
0.99953
4.523864
c2dc7083-9a6f-411e-9637-b6293b7ae47b
astrograzl/astro123
externals/deap/examples/gp/ant/AntSimulatorFast.cpp
#include "AntSimulatorFast.hpp" AntSimulatorFast::AntSimulatorFast(unsigned int inMaxMoves) : mMaxMoves(inMaxMoves), mNbPiecesAvail(0), mRowStart(0), mColStart(0), mDirectionStart(AntSimulatorFast::eAntEast), mNbMovesAnt(0), mNbPiecesEaten(0), mRowAnt(0),...
ALGO
0.988754
5.63032
008f7acd-ea69-4a91-b6fc-767a9fb2454f
hjmjohnson/vv
utilities/CxImage/ximaint.cpp
// xImaInt.cpp : interpolation functions /* 02/2004 - Branko Brevensek * CxImage version 6.0.0 02/Feb/2008 - Davide Pizzolato - www.xdp.it */ #include "ximage.h" #include "ximath.h" #if CXIMAGE_SUPPORT_INTERPOLATION //////////////////////////////////////////////////////////////////////////////// /** * Recalculat...
ALGO
0.998223
6.835073
cd617745-a1de-4cb9-bea4-e7a3ff234812
sarvex/leetcode-solidity
solution/1000-1099/1028.Recover a Tree From Preorder Traversal/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: TreeNode* recoverFromPreorder(string S) { stack<TreeNode*> st; int depth = 0; ...
ALGO
0.999887
4.902589
cf0a2bc1-6d04-4136-9f98-f68168785c00
shashwat001/my-codes
sport_prog/Algorythmus2014/4.cpp
//shashwat001 #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <iostream> #include <string> #include <vector> #include <set> #include <queue> #include <stack> #include <map> #include <list> #include <utility> #include <algorithm> #include <cassert> using namespace std; #define INF 21...
ALGO
0.999734
3.062924
bd0e3683-314b-4879-964a-a37e127edcb1
vengi-voxel/vengi-archive
src/modules/backend/entity/ai/movement/SelectionSeek.cpp
/** * @file */ #include "SelectionSeek.h" #include "backend/entity/ai/AI.h" #include "backend/entity/ai/common/Math.h" namespace backend { namespace movement { SelectionSeek::SelectionSeek(const core::String&) : SelectionSteering() { } MoveVector SelectionSeek::execute(const AIPtr& ai, float speed) const { glm...
TOOL
0.852623
6.248387
0bf5b4ff-4896-407c-9d87-4900ce386454
DutraIRS/Studying-Cpp
Drills/drills_9.cpp
#include <iostream> using namespace std; /* Circular Lists Problem 1: Previously, we implemented for the other structures the insert function, which adds a certain element to the list. This time, assume that the list can only receive integers, and implement another version of insert, so that it inserts the elements ...
ALGO
0.999733
4.962495
9e4c33e7-e0b9-4f99-b041-129c4a680476
miruddin11/Algorithms
1349-check-if-it-is-a-straight-line/1349-check-if-it-is-a-straight-line.cpp
class Solution { public: bool checkStraightLine(vector<vector<int>>& coordinates) { int x1=coordinates[0][0]; int y1=coordinates[0][1]; int x2=coordinates[1][0]; int y2=coordinates[1][1]; for(int i=2;i<coordinates.size();i++) { int x=coordinates[i][0]; ...
ALGO
0.9999
5.554058
b4d51793-bc35-4cf7-83eb-3d0c08c400b5
zhenyuwei2003/DataStructure
Test/Test 2/T3.cpp
#include <iostream> #include <cstring> using namespace std; #define FOR(alpha, start, end) for(int (alpha) = (start); (alpha) <= (end); ++(alpha)) const int maxN = 1e6 + 5; int n, cnt, head, tail; int trie[maxN][26], fail[maxN], queue[maxN]; bool exist[maxN]; string s; inline void file() { string op = "1"; st...
ALGO
0.999949
4.164297
ab28170f-bece-4e70-9cdf-5ffea2499527
SlimRoms/frameworks_av
media/libstagefright/codecs/amrnb/enc/src/p_ol_wgh.cpp
/* ------------------------------------------------------------------------------ Pathname: ./audio/gsm-amr/c/src/p_ol_wgh.c Funtions: p_ol_wgh_init p_ol_wgh_reset p_ol_wgh_exit Lag_max Pitch_ol_wgh Date: 02/05/2002 ---------------------------------------------------...
ALGO
0.997347
3.347188
d1b89cbd-9ee5-40a7-9c99-cda0b1b18e49
guptaa98/100DaysOfCode
Car Pooling.cpp
class Solution { public: bool carPooling(vector<vector<int>>& trips, int capacity) { vector<pair<int,int>>t; for(int i=0;i<trips.size();i++) { t.push_back( make_pair (trips[i][1],trips[i][0]) ); t.push_back( make_pair (trips[i][2],-trips[i][0]) ); } ...
ALGO
0.999718
6.322345
36441807-46c5-4c87-a5bd-19227bbd4bbd
AayushSharma54652/DSA-Practice
14) Strings/Factorial of a large No.cpp
#include <bits/stdc++.h> using namespace std; vector<int> factorial(int N) { vector<int> ans(1, 1); while (N > 1) { int carry = 0; int res; int size = ans.size(); for (int i = 0; i < size; i++) { res = ans[i] * N + carry; ans[i] = res % 10; ...
ALGO
0.999958
4.871477
4bd0de9b-d54c-4636-abe9-44da3bdd5aed
dataluscorp/browser
modules/fdlibm/src/s_expm1.cpp
/* @(#)s_expm1.c 5.1 93/09/24 */ /* expm1(x) * Returns exp(x)-1, the exponential of x minus 1. * * Method * 1. Argument reduction: * Given x, find r and integer k such that * * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 * * Here a correction term c will be computed to compensate * the erro...
ALGO
0.999919
4.556137
e4f6bd9c-cfec-4d7c-b167-f7670c7db82b
sparxvidya/C--DSA
linersearch.cpp
#include<iostream> using namespace std; int main(){ int A[7]={5,6,7,4,7,3,4},i,key; cout<<"enter the no to search-"; cin>>key; for(i=0;i<10;i++){ if(key==A[i]) { cout<<"element found="<<i<<endl; exit(0); } } return 0; }
ALGO
0.999054
3.47593
bfbcbae2-beef-4ac7-a3c7-d290f0494469
iCoder0020/Competitive-Coding
InterviewBit/Strings/Reverse the String.cpp
/* ID: ishan-sang PROG: Reverse the String LANG: C++ */ void Solution::reverseWords(string &A) { vector<string>words; int N = A.size(); int i = 0; int start, end; while(i<N) { while(i<N && A[i] == ' ') i++; start = i; while(i<N && A[i]!= ' ...
ALGO
0.999943
5.14504
b4ed28c9-6096-4ed0-847e-44bd58b8d351
qkrtjdrbs/algorithm
11724.cpp
#include <iostream> #include <vector> using namespace std; bool visit[1001]; vector<int> v[1001]; int com=0; int n,m,a,b; void dfs(int x) { for(int i=0;i<v[x].size();i++){ if(!visit[v[x][i]]){ visit[v[x][i]]=true; dfs(v[x][i]); } } } int main(){ cin.tie(nullptr); ...
ALGO
0.999772
4.445851
7b209e17-d7d3-48d4-ab58-24f8f4cc26e7
A-BCDe/BOJ-Solutions
Problems/10165.cpp
#include <algorithm> #include <iostream> #include <utility> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ll n, m; cin >> n >> m; auto a = new pair<pair<ll, ll>, ll>[m << 1]; for (ll i = 0; i < m; i++) { cin >> a[i << 1].first.fir...
ALGO
0.999989
3.119525
42293fdc-fa2e-49fe-9e69-49197a9140ad
wangxianghust/leetcode
3LongestSubstring.cpp
#include <iostream> #include <string> #include <set> #include <vector> using namespace std; const int MAXNUM = 200; void print(set<char> &s){ for(auto i : s) cout << i << " "; } int LengthOfLongestSubstring(string s){ int size = s.size(); set<char> substring; int ret = 0; for(int i=0; i<size; ++...
ALGO
0.99983
4.577182
95a35ff9-1ab6-403d-a6ea-163943a8ff5e
dhkwon03/programming_problem_practice
c_problems/baekjoon/2261/main.cpp
#include <stdio.h> #include <stdlib.h> #include <algorithm> #include <math.h> #include <vector> typedef struct __POINT { int x; int y; }POINT; int n; POINT arr[100005]; int ans; bool compare(POINT a, POINT b) { return (a.x < b.x); } bool compare_y(POINT a, POINT b) { return (a.y < b.y); } int find_closest(int ...
ALGO
0.999604
4.304006
e57944e4-5eff-4df6-b940-6586314fd267
eliot-exdev/boost-morphos
libs/coroutine2/example/same_fringe.cpp
#include <cstddef> #include <cstdlib> #include <iostream> #include <iterator> #include <string> #include <utility> #include <boost/coroutine2/all.hpp> struct node { typedef std::shared_ptr< node > ptr_t; // Each tree node has an optional left subtree, an optional right subtree // and a value of its ow...
ALGO
0.984426
6.588078
6713785e-0d9e-4737-b3a2-5583969fa3cd
fithisux/FSL
extras/include/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp
#include "./regex_comparison.hpp" #include <cassert> #include <boost/timer.hpp> #include <boost/xpressive/xpressive.hpp> namespace dxpr { double time_match(const std::string& re, const std::string& text) { boost::xpressive::sregex e(boost::xpressive::sregex::compile(re, boost::xpressive::regex_constants::optimize...
TEST
0.960178
5.89948
7ef55391-d7f7-4456-96ad-9fff0a186e5b
kalil-caf/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
5c437ee0-476f-4baa-9143-dd061a78d7ae
esperaumbocado/feup-prog
P04/hstr-to-integer.cpp
#include <iostream> using namespace std; int size_of_hstr(const char hstr[]){ int counter = 0; for (int i=0;hstr[i]!='\0';i++){ counter+=1; } return counter; } unsigned long hstr_to_integer(const char hstr[]){ int len = size_of_hstr(hstr); unsigned long result=0; for (int i=0;...
ALGO
0.930503
4.319596
56130102-b937-4593-8070-625b25cfce6e
mikechen66/CPP-Programming
A-Tour-of-CPP/Supplements/algorithm/ch21_drill_1_vec.cpp
// // Stroustrup - Programming Principles & Practice // // Chapter 21 Drill 1 - vector // #include <iostream> #include <stdexcept> #include <string> #include <vector> #include <fstream> #include <list> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 1. Define a struct Item struct It...
ALGO
0.99938
5.594946
5a24930f-2ac7-4a86-9097-987bb02147d2
anlsys/llvm-project
libc/src/math/generic/remainderl.cpp
#include "src/math/remainderl.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long double, remainderl, (long double x, long double y)) { int quotient; return fputil::re...
TOOL
0.950953
5.832368
2ee2de36-448d-4275-a8be-4574faffa387
tianbiandeshenghuo/OI-Code
CodeForces/cf1878/E_Iva_Pav.cpp
#include<bits/stdc++.h> #define int long long using namespace std; const int MAXN = 2e5 + 5; int n, q, a[MAXN], tr[4 * MAXN]; void js(int id, int l, int r){ if (l == r){ tr[id] = a[l]; return ; } int mid = (l + r) >> 1; js(id * 2, l, mid); js(id * 2 + 1, mid + 1, r); tr[id] = (tr[id * 2] & tr[id * ...
ALGO
0.99992
4.656242
5887f6b5-136b-4299-973e-094fe0402da7
BredaUniversityGames/pitmpl24
PCContent/include/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
#include "btSphereTriangleCollisionAlgorithm.h" #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/CollisionShapes/btSphereShape.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "SphereTriangleDetector.h" #include "BulletCollision/CollisionDispatch...
ALGO
0.996256
7.107666
64ed8083-c9f9-48ab-810f-fff933d1a8bd
Allenem/LeetCode
everyday/202410/20241023.cpp
/* 3185. 构成整天的下标对数目 II 给你一个整数数组 hours,表示以 小时 为单位的时间,返回一个整数,表示满足 i < j 且 hours[i] + hours[j] 构成 整天 的下标对 i, j 的数目。 整天 定义为时间持续时间是 24 小时的 整数倍 。 例如,1 天是 24 小时,2 天是 48 小时,3 天是 72 小时,以此类推。 示例 1: 输入: hours = [12,12,30,24,24] 输出: 2 解释: 构成整天的下标对分别是 (0, 1) 和 (3, 4)。 示例 2: 输入: hours = [72,48,24,3] 输出: 3 解释: 构成整天的下标对分别...
ALGO
0.9999
5.617383
f31cbc02-ef9d-4f72-b261-71e56a963d42
KevinDaly1/1st-2nd-Year-Misc
Labsheet 9/Labsheet 9/Q3.cpp
//Name: Kevin Daly //Login: C00259089 //Date: 13/Jan/2021 //---------------------------------------------------------------------------------- // question 3: ask the user how many numbers they wish to enter and take in those // numbers to find the sum, how many of them are odd and the sum of the odd numbers // --------...
ALGO
0.991676
3.951444
a9d1d004-4db5-4ccb-9f5c-5fb20fcdad3f
divinenaman/basic-coding-lib
Graphs/cycle_directed.cpp
#include<iostream> #include<list> #include<vector> #include<map> using namespace std; bool cycle_dfs(map<int,list<int>> &adj, vector<bool> visited,vector<bool> recur,int src) { if(!visited[src]) { visited[src] = true; recur[src] = true; for(int node: adj[src]) { if(!visited[node] && cycle_dfs(adj,visited,re...
ALGO
0.999826
4.678997
0bae31b0-41ea-4351-8f70-75127757bdfe
sonal3yadav/DSA
Linked List 1/Insert node(recursive).cpp
/* Insert node (recursive) You have been given a linked list of integers. Your task is to write a function that inserts a node at a given position, 'pos'. Note: Assume that the Indexing for the linked list always starts from 0. If the given position 'pos' is greater than length of linked list, then you should return t...
ALGO
0.999678
5.45422
d08d552f-d611-4020-8c21-2ab359556282
Jett-Tinik/Microprocessor-Systems
360HW/LinkedList.cpp
// I agree to abide by the Stevens Honor System - Jett Tinik #include <iostream> using namespace std; class Node { public: int value; Node *next; Node() { value = 0; next = NULL; } }; class LinkedList { public: Node *head; int length; LinkedList() { head = NULL; length = 0; } voi...
ALGO
0.998298
3.61916