uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
1aff4797-fc71-45c4-ba1b-155e08f0ae64
Dup4/competitive-programming
nowcoder/4010/e/e.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #define dbg(x...) \ do { \ cout << "\033[32;1m" << #x << " -> "; \ err(x); \ } while (0) void err() { cout << "\033[39;0m" << end...
ALGO
0.999719
3.581914
b6936950-4d8c-4131-a70f-839a177516ba
qbolec/c
fibonachi_inline.cpp
#include<iostream> typedef unsigned int uint; typedef unsigned long long ll; uint m;//modulo uint fib(ll n){ uint f0=0,f1=1,f2; for(int b=64;b--;){ f2= ((ll)f1*(f1+2*f0))%m; f0= ((ll)f0*(f1*2+m-f0))%m; f1=(f2+m-f0)%m; if((n>>b)&1){ f2=(f0+f1)%m; f0=f1; f1=f2; } } return f...
ALGO
0.999993
3.925592
449c9749-105a-4acd-8934-15c3bd65e955
TeamVault/LLVM-CFI
source_code/lib/CodeGen/LiveVariables.cpp
#include "llvm/CodeGen/LiveVariables.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallSet.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/D...
ALGO
0.981668
7.912543
c5e2d1ca-3d6f-4f4a-a1fe-024eb08b68d1
jeremykvlim/kattis
open/gottacatchemall.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<int, int>> junctions(n - 1); for (auto &[u, v] : junctions) { cin >> u >> v; if (u > v) swap(u, v); } sort(junctions.begin(), junctio...
ALGO
0.999837
4.678818
7207145e-82ed-49c4-a852-8e264d52ad38
byzhang/blaze
blazemark/src/classic/DMatDMatAdd.cpp
//================================================================================================= //================================================================================================= //************************************************************************************************* // Includes //****...
ALGO
0.995661
6.212814
e7e373e5-bf78-4a67-bcad-c705e31428b1
JoseLu201/CSI
MH/P1/src/main.cpp
#include <iostream> #include <fstream> #include <vector> #include "MDD.hpp" #include <random> using namespace std; using namespace std::chrono; using Random = effolkronium::random_static; pair<int,int> read_dimension(string fichero){ ifstream file(fichero); string t1,t2; pair<int,int> ans; getline(fil...
ALGO
0.983108
3.733359
6a6e7a9b-93a8-4360-8783-42103dd5a7c1
amanpal8sss/flutter_
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
9dc8a69d-0aef-4182-ba44-35f3e1ea0272
Randowlh/Project_ACM_2021
code/competition/Codeforces Round #731/6.cpp
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; #pragma optimize(2) //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #define rbset(T) tree<T,null_type,less...
ALGO
0.999875
3.970141
36ebe9bb-dce0-40a4-bac0-f653b5dc8050
thanhchuc-hcmue-it46/lap-trinh-can-ban-cpp
cpp/Bai_chen_gia_tri_vao_vị_tri_theo_yeu_cau_mang.cpp
/* Chuc lap trinh */ // Nhập: // Dòng 1: nhập vị trí cần thêm và giá trị thêm (có giá trị <=100) // Dòng 2: nhập vào 1 dãy số (dãy số có tối đa 100 phần tử) // Xuất: // Mảng sau khi thêm // Lưu ý: mảng được đánh chỉ số bắt đầu từ 0 // ví dụ // input: // 2 5 // 1 2 3 4 // output: // 1 2 5 3 4 #include <iostream> us...
ALGO
0.999561
3.574075
ca2f10bd-4fb9-4afb-a338-cdffe26978e1
sam420369/DSA
Stack/Stack.cpp
#include <iostream> #include <string> #include "Header.h" using namespace std; int main() { string exp = "(a+b) * (b+c)"; stack one; one.paranthesisMatching(exp); return 0; }
ALGO
0.996718
4.76301
8e3b5567-5bd5-47b1-907f-8eeb77c96ab3
AdamYuWen/CPP_Primer_Plus
Chapter05/PE08.cpp
// Programming Exercise 5.8 #include <iostream> using std::cin; using std::cout; using std::endl; const int ArraySize = 20; int main() { char input[ArraySize]; int cnt = 0; cout << "Enter words (to stop, type the word done)\n"; cout << "(each input cannot be longer than 20 characters):" << endl; while (cin >> ...
TOOL
0.962724
4.440195
7d233681-d7d3-496a-ac82-90cdf7f44bf5
cstipkovic/academical-work
programming-language-1/c++/old_/lab-works/aula01/atividade02/main.cpp
/* Atividade 2- Algoritmo que lê 3 números inteiros e mostre o maior e o menor deles. */ #include <iostream> using namespace std; int main() { int num, maior, menor; cout << "Informe um numero: "; cin >> num; maior = menor = num; for (int i = 0; i <= 1; i++) { cout << "Informe um numero: "; cin >> num...
ALGO
0.997583
3.599955
762fcd43-b737-4b96-92f9-c49c25154fb3
caitouda/BNUOJ
UploadGitHub/1132.cpp
#include<cmath> #include<iostream> using namespace std; int main() { int cases; cin>>cases; for(int c=1; c<=cases; c++) { char left[3][6], right[3][6], status[3][6]; int time['L'+1]={0}; //標記各個字母被懷疑的次數 bool zero['L'+1]={false}; //標記絕對為真幣的字母(令天枰平衡的所有字母) for(int k=0; k<3;...
ALGO
0.998992
3.087845
90964e46-84a1-4a83-a399-5353aaf739a4
ishandutta2007/codeforces
danya.smelskiy/normal/753/A.cpp
#include <bits/stdc++.h> using namespace std; int n; int main(){ cin>>n; int l=1; int r=1000; while (l<r-1){ int mid=(l+r)/2; int x=(mid)*(mid+1)/2; if (x>n) r=mid; else l=mid; } cout<<l<<'\n'; for (int i=1;i<l;++i) cout<<i<<" "; int x=(l-1)*(l)/2...
ALGO
0.999958
3.767228
9ddabcee-9cb3-48bd-894e-2fa4622ebb16
polarr/competitive-programming
USACO/Silver/2025Jan/3_partials.cpp
/** * Solution by 1egend (polarity.sh) * Date: 2025-01-24 * Contest: USACO 2025 January Silver * Problem: 3 **/ #include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; using vi = vector<int>; using vl = vector<ll>; using pii = pair<int, int>; #define pb push_back #defin...
ALGO
0.999841
4.24739
52663109-78ef-4a63-ae3d-375f0e84ff67
chungers/lab616
third_party/cpp/boost_1_46_1/libs/graph/test/tiernan_all_cycles.cpp
#include <iostream> #include <boost/graph/graph_utility.hpp> #include <boost/graph/undirected_graph.hpp> #include <boost/graph/directed_graph.hpp> #include <boost/graph/tiernan_all_cycles.hpp> #include <boost/graph/erdos_renyi_generator.hpp> #include <boost/random/linear_congruential.hpp> using namespace std; using ...
TEST
0.943553
6.340573
a826812f-4802-44e3-ae2d-4eefb73adfe1
K-Shikhar/6Companies30Days
Microsoft/Sol4.cpp
class Solution { public: //Function to return a list of integers denoting spiral traversal of matrix. vector<int> spirallyTraverse(vector<vector<int> > matrix, int r, int c) { int left=0,right=c-1,up=0,down=r-1; vector<int> v; while(left<=right && up<=down) { ...
ALGO
0.999964
4.465456
80b27574-e27f-4a3a-bf21-51f2a52f57de
openucx/ODOS
llvm/lib/Support/SuffixTree.cpp
#include "llvm/Support/SuffixTree.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" #include "llvm/Support/SuffixTreeNode.h" using namespace llvm; /// \returns the number of elements in the substring associated with \p N. static size_t numElementsInSubstring(const SuffixTreeNode *N) { assert(...
ALGO
0.994794
7.758291
be16879b-0313-40f4-9495-453ef5db3505
rafatbiin/cses-problem-set
graph_algorithms/flight_discount.cpp
#include <bits/stdc++.h> using namespace std ; #define DEBUG(x) cout << '>' << #x << ':' << x << endl; #define mem(x,val) memset((x),(val),sizeof(x)) #define all(x) x.begin(),x.end() #define pb push_back #define mp make_pair #define PI acos(-1.0) #define N 1111111 #define M 1000000007 #define endl "\n" const long lo...
ALGO
0.999941
4.296245
ab427968-9098-4c70-b220-1ea3179ceff0
mdshemul48/codeforces-programming-contest
A_New_Year_Candles.cpp
#include<iostream> using namespace std; int main(){ int a, b; cin>>a>>b; int ans = a; while(a>=b){ ans= ans+(a/b); a = (a/b)+(a%b); } cout<<ans<<endl; return 0; }
ALGO
0.99993
3.317402
03ec6f69-c3eb-4734-b9e5-2e79ffb4a6d9
sahilwep/DSA-Workspace
GFG_Complete_A_Z/06_Arrays/30_code.cpp
/* // Maximum Appearing element in Range: I/p : left = [1, 2, 5, 15] right = [5, 8, 7, 18] O/p : 5 Explanation: [[1,2, 3, 4, 5], [2, 3, 4, 5, 6, 7, 8], [5, 6, 7], [15, 16, 17, 18]] - - - * Here maximum appearing element is "5" ...
ALGO
0.999991
5.163611
e538b5b6-fecc-45d9-9ff2-da35a67dbccf
kaushalkahapola/210266G
runningmedian.cpp
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; int main() { vector<int> nums; int n; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; nums.push_back(x); sort(nums.begin(), nums.end()); ...
ALGO
0.999871
4.746305
0d5c26d6-5bc6-4783-b957-69437792716b
emirisuu/Programming
c++/temp/main.cpp
#include <iostream> using namespace std; struct Patiekalas { string pavadinimas; int kalorijos; }; void Rikiavimas(Patiekalas meniu[]) { Patiekalas temp; int index; for(int i = 0; i < 10; i++) { index = i; for(int j = i + 1; j < 10; j++) if(meniu[j].kalorijos < meniu[index].kalori...
TOOL
0.944645
3.957884
2bb676da-2433-4655-92bf-445f563eccd1
202401005/Queue-Question-Codes
castle on the grid.cpp
int minimumMoves(vector<string> grid, int startX, int startY, int goalX, int goalY) { int n = grid.size(); vector<vector<int>> dist(n, vector<int>(n, -1)); queue<pair<int, int>> q; q.push({startX, startY}); dist[startX][startY] = 0; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; ...
ALGO
0.999958
5.822686
e5e0324d-82e9-49c8-b845-de5e7ac1bb9e
KRES-TR1/CPP-CODE
credit/credit.cpp
#include <iostream> #include <string> int main() { long long cc_number; std::cout << "Number: "; std::cin >> cc_number; int digit1 = 0; int digit2 = 0; int number_of_digits = 0; int sum_odds_2x = 0; int sum_evens = 0; while (cc_number > 0) { digit2 = digit1; di...
ALGO
0.999152
5.986572
a5dec877-fe6f-4162-aa76-bfd8b7a3be6e
TanYongF/algorithm
2022-1-22/B.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define ms(s,val) memset(s, val, sizeof(s)) const int inf = INT_MAX; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode() : val(0), left(nullptr), right(nullptr) {} TreeNode(int x) : val(x), l...
ALGO
0.999988
5.134925
8d7e5ede-30e5-48ab-bfb4-c2fdef255e21
orehusLina/uni-bullshit
inf-proga/3. HangOn/hangman.cpp
// Реализуйте аналог игры "Виселица": Создать контейнер, содержащий алфавит, и определяющий, угадывалась ли данная буква. Сгенерируйте слово, заменив буквы подчеркиванием, и запрашивайте у пользователя букву. Если буква угадана, выводите ее на нужном месте. В любой момент пользователь может набрать все слово целиком (д...
TOOL
0.993313
4.663092
c690f2d2-e633-4fb8-929c-d0607f1c0a6f
iammohitv/Leetcode-74-Hard
coinChangeMinCoins.cpp
class Solution { public: int coinChange(vector<int>& coins, int amount) { int n = coins.size(); vector<vector<int>> t(n+1,vector<int>(amount+1,-1)); for(int i=0;i<n+1;i++){ for(int j=0;j<amount+1;j++){ if(i==0){ t[i][j]=INT_MAX-1; ...
ALGO
0.999955
5.81596
5df081e9-fc98-430a-8d5d-5e813bc9bfc5
yinrx3/DataStructure2024
guanzhanyang/week5/classquestions/1002.twice.cpp
#include <iostream> #include <iomanip> #include <string> using namespace std; /* UPLOAD START */ int* getNext(string T){ int L = T.length(); int* next = new int[L]; if(L==0) return next; next[0] = -1; if(L==1) return next; next[1] = 0; for(int i=2;i<L;i++){ // calculate next[i] i...
ALGO
0.999399
3.435422
67198dd9-d6de-4a3b-936d-63b9f73687c8
heavenMOJANG/ICPC
.history/programmes_C_Cpp/AtCoder/abc411/F_20250621205727.cpp
#pragma GCC optimize(3, "Ofast", "inline") #include <bits/stdc++.h> #include <atcoder/modint> #define int long long using namespace std; using mint = atcoder::modint998244353; constexpr int INF = 0x7fffffff; void solve() { int n, m; cin >> n >> m; return; } signed main() { cin.tie(0) -> sync_with_stdio...
ALGO
0.999912
4.860055
ad40c91f-2340-4d6e-8ac7-8867c77f20d4
sarvex/leetcode-vala
solution/1600-1699/1669.Merge In Between Linked Lists/Solution.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: ListNode* mergeInBetw...
ALGO
0.999985
5.060581
8394deb8-b7f0-41df-9e9b-719f15692bee
balajirai/Codeforces
1927B_Following_the_String.cpp
#include <bits/stdc++.h> #define ll long long using namespace std; int main(){ int t; cin>>t; while (t--){ int n; cin >> n; string ans; vector<int>freq(26); for(int i=0; i<n; i++){ int x; cin>>x; for(int j=0; j<26; j+...
ALGO
0.999701
4.015356
d86b7b94-2a3c-4cf5-94df-8a954cd4f8f8
deepin-community/llvm-toolchain-16
llvm/tools/llvm-mca/CodeRegion.cpp
#include "CodeRegion.h" namespace llvm { namespace mca { bool CodeRegion::isLocInRange(SMLoc Loc) const { if (RangeEnd.isValid() && Loc.getPointer() > RangeEnd.getPointer()) return false; if (RangeStart.isValid() && Loc.getPointer() < RangeStart.getPointer()) return false; return true; } void CodeRegio...
TOOL
0.882582
7.913571
8bed3585-6579-430e-aecc-c05478c66925
ishandutta2007/codeforces
adam_gs/normal/1601/A.cpp
#include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() void solve() { int n; cin >> n; int T[n], ile[30]; rep(i, 30) ile[i]=0; rep(i, n) { c...
ALGO
0.999885
4.10614
d3f5e6cf-7449-4948-a75c-b754a2d8f2d7
ishandutta2007/codeforces
dreamoon_love_aa/normal/322/E.cpp
#include<stdio.h> #include<string> #include<math.h> #include<stdlib.h> #include<set> #include<bitset> #include<map> #include<vector> #include<string.h> #include<algorithm> #include<iostream> #define pb push_back using namespace std; #define SIZE 100010 vector<int>e[SIZE]; int bfs[SIZE],last[SIZE],used[SIZE],tt,v[SIZE],...
ALGO
0.99998
3.654755
6c1938ea-8a36-457e-a629-e91078d36903
ishandutta2007/codeforces
compute/normal/1140/E.cpp
#include<bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0) void err(){cout << "\033[39;0m" << endl;} template<template<typename...> class T,typename t,typename... A> void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);} te...
ALGO
0.999982
4.084788
a1876629-e546-4218-8860-99bdfe89a1eb
xyferr/Competitive-Programming
codeforces/C_Lexicographically_Largest.cpp
#include<bits/stdc++.h> #define ll long long using namespace std; void solve() { ll n; cin>>n; vector<ll> v(n); for(ll i=0; i<n; i++) cin>>v[i]; for(ll i=0; i<n; i++){ v[i]+=i+1; } sort(v.rbegin(),v.rend()); for(ll i=1; i<n; i++){ v[i] = min(v[i],v[i-1]-1); } for(...
ALGO
0.999895
4.390776
ddac174d-4a47-4ba8-b3fe-a61a8b38e08d
umr-dbs/mapping-core
src/operators/processing/features/point_in_polygon_filter.cpp
#include "datatypes/raster.h" #include "datatypes/raster/raster_priv.h" #include "operators/operator.h" #include "datatypes/pointcollection.h" #include "datatypes/polygoncollection.h" #include <string> #include <sstream> #include <algorithm> /** * Operator that filter a point collection by a polygon collection. * A...
TOOL
0.914014
7.390458
933a2cf6-ff90-4514-9217-8860445e5f97
Fayyez/cpp-homework-backup
data structures/DS assignments/22l-7987_fayyez_Q1.cpp
#include<iostream> using namespace std; class IntervalHeap { int count; int maxcount; int ** heap; int currentIndex; int leftHeapSize, rightHeapSize; //index 0 is a min heap and index 1 is a maxheap public: // constructor & destructor IntervalHeap(int s=15) { currentIndex = left...
ALGO
0.999369
4.671959
204eb31b-0ae9-4d23-bbb0-82fa78919a41
Ayush-Vish/DSA-CP-Codes
random-practice/B_Longest_Divisors_Interval.cpp
#include <bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define pll pair<int, int> const int modll = 1e17; const int mod = 1e9 + 7; const int INF = 1e18; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int prime[1]; bool seive(int n){memset(prime, 1, n+1);for(int i=2;i*i<n;i++)i...
ALGO
0.999561
4.405356
a1179471-3a95-4d8f-85e6-a4b84d19cef9
ishandutta2007/codeforces
kubic/normal/418/E.cpp
#include<bits/stdc++.h> using namespace std; #define N 100005 #define M 505 #define LIM 1000005 #define gc() (P1==P2 && (P2=(P1=buf)+fread(buf,1,LIM,stdin),P1==P2)?EOF:*P1++) char *P1,*P2,buf[LIM]; int n,m,B1,B2,a[N],nxt[N],w[N],bl[N],id[N*2],hd[N*2]; int ds[N*2],cnt[N*2],F[N][3];set<int> z[N*2];set<int>::iterator it; ...
ALGO
0.999929
3.848126
e5f65873-1315-4243-8fa8-5ac05fdb2ded
C0D1NG/Programming
C++/NexWeb_decimal_to_binary.cpp
#include <iostream> int main() { int a[10], n, i; std::cout<<"Enter the decimal number to convert to binary: "; std::cin >> n; for(i=0; n>0; ++i) { a[i]=n%2; n= n/2; } std::cout<<"Binary of the given number = "; for(i=i-1;i...
ALGO
0.998398
4.92956
6f25389d-4709-4a26-b463-ec5bad1ec3d6
LitQoo/DrawGirlsDiary
Classes/cryptopp/iterhash.cpp
// iterhash.cpp - written and placed in the public domain by Wei Dai #ifndef __GNUC__ #define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES #endif #include "iterhash.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte *input, size_t len) { HashW...
ALGO
0.998961
6.912704
86111767-acbf-4599-8ea4-0edd4189f102
3agwa/CompetitiveProgramming
CodeForces/CF342-D2-E.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<ll> vll; typedef pair<int, int> pii; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<double> vd; typedef vector<vector<int> > vvi; typedef vector<pii> vii; type...
ALGO
0.999679
4.555693
ad2f7b13-66ee-4836-9c46-1702fd3ebeca
raincross7/code-similarity
codes/train_code/problem096/problem096_300.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; string s1,s2,s3; cin>>s1>>s2; cin>>a>>b; cin>>s3; if(s3.compare(s1)==0){ a--; } else if(s3.compare(s2)==0){ b--; } if(a<0){ a=0; } if(b<0){ b=0; } cout<<a<<" "<<b<<e...
ALGO
0.999791
3.885055
32fe3042-08cb-4509-8936-fb02207b7e73
tasnim-zeba/Problem-Solving
Codeforces/1903C.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll t,n,k,i,j; cin>>t; while(t--) { cin>>n; ll a[n+1],suf[n+1]; for(i=1;i<=n;i++) { cin>>a[i]; } suf[n]=a[n]; for(i=n-1;i>=1;i--) { suf[i...
ALGO
0.999803
3.2614
d7486b1a-291e-42a5-849a-5370b31a968a
Lokesh-Kumar-121/leetcode
Minimum times A has to be repeated such that B is a substring of it - GFG/minimum-times-a-has-to-be-repeated-such-that-b-is-a-substring-of-it.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function Template for C++ class Solution { public: int minRepeats(string A, string B) { // code here int n=B.length()/A.length(); n+=2; int count=1; string t=A; ...
ALGO
0.999858
5.809607
facab929-682c-4a37-83b8-1831792c4728
skrj-gh/computer-networks
Assignment5/Submission/Question1.cpp
#include<bits/stdc++.h> using namespace std; int Router_ID = 0; const int inf = 100; class Router{ public: int id; vector<pair<int, int>>Neighbour; vector<pair<int, int>>DVR; Router(){ id = Router_ID; Router_ID++; DVR.push_back({-1, -1}) ; // T...
ALGO
0.999884
4.520404
139c28c1-4c6e-492e-814b-081f50e9483e
SAJEED006/File-Structures
7.cpp
#include<iostream.h> #include<conio.h> #include<fstream.h> #include<string.h> #include<stdlib.h> class lists { char name[10],l1[50][50],l2[50][50]; public:void insert(); void merge(); void sort(int); void display(); }s; fstream f1,f2,f3; int i,j,m,n; char temp[50]; void lists::insert() { f1.open("list6.txt",ios::...
ALGO
0.998254
3.227034
4e6f0748-327b-49b3-9e87-a83c4c7088c6
ishandutta2007/codeforces
bluediamond/normal/1621/E.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define int ll const int N=(int)1e5+7; int n; int a[N]; int sumofguys[N],ord[N]; vector<int> guys[N]; int ok[N]; int oklft[N]; int okrgh[N]; int where[N]; bool cmp(int i,int j){ return sumofguys[i]*((int)guys[j].size())>s...
ALGO
0.999896
3.515783
c84b8258-ade1-4fbc-9443-6401905346d1
KRITIKALai/FRAZ-DSA-Sheet
binaryLLToInteger.cpp
/************************************************************ Following is the linkedList class structure: class Node { public: int data; Node *next; Node(int val) { this->data = val; next = NULL; } ~Node() { if (next != NULL) { ...
ALGO
0.999976
5.165492
2695cc07-d747-4849-ad9c-e7c28da33f6a
faterazer/LeetCode
2024. Maximize the Confusion of an Exam/Solution.cpp
#include <string> using namespace std; class Solution { public: int maxConsecutiveAnswers_MK1(string answerKey, int k) { return max(maxConsecutiveAnswers(answerKey, k, 'T'), maxConsecutiveAnswers(answerKey, k, 'F')); } int maxConsecutiveAnswers_MK2(string answerKey, int k) { int t_...
ALGO
0.999949
6.17313
ddd51f0e-03e5-4032-a18f-855d9e1cb693
crispimraissa/lista-ponteiros
questao15.cpp
#include <iostream> #include <stdlib.h> using namespace std; int y[900]; int compare (const int a, const int b){ if(a == b){ //se forem iguais retorna 0 para nao trocar return 0; } else if(a > b){ //se for maior retorna 1 para nao trocar return 1; }else{ return -1; //se for meno...
ALGO
0.999914
3.891239
83476d09-e7ad-4c3e-8ead-4e105c9b06d0
ishandutta2007/codeforces
dreamoon_love_aa/normal/1419/C.cpp
/*{{{*/ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<string> #include<iostream> #include<sstream> #include<set> #include<map> #include<queue> #include<bitset> #include<vector> #include<limits.h> #include<assert.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).be...
ALGO
0.999794
3.025912
4303b228-6a70-4fcd-9907-bc2d61b65630
wladimirpetrov/BeBOT_cpp
bebot/knots.cpp
#include "../include/knots.h" #include <vector> std::vector<double> Knots(const std::vector<double>& Cp, int K) { int N = Cp.size() / K - 1; std::vector<double> cp_k; cp_k.reserve(2 * K); // Reserve space for 2*K points (first and last of each segment) for (int i = 0; i < K; ++i) { cp_k.push_...
ALGO
0.996013
4.248518
8eb635eb-57a3-4228-9482-d938d6c36402
pushpend3r/dsa-questions
171. Overlapping Intervals.cpp
// https://practice.geeksforgeeks.org/problems/8a644e94faaa94968d8665ba9e0a80d1ae3e0a2d/1 #include <bits/stdc++.h> using namespace std; /* Problem is to merge intervals that are **not** mutually exclusive. [1, 4] and [3, 5] = not mutually exclusive -> [1,5] [1, 4] and [5, 7] = mutually exclusive -> no change [1, 4] ...
ALGO
0.999995
5.625134
946cb67f-ea88-465e-b310-95c7db831b56
vanshavenger/Leetcode-Daily
July/14_July_TreeFromPreAndInorder.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.44565
9465a8e4-c0c8-4478-8429-4fab2d92450f
davidmartinezhi/leetcode
David Martínez/Easy/Array/Remove_Duplicates_from_Sorted_Array.cpp
#include <iostream> #include <vector> using namespace std; class Solution { public: int removeDuplicates(vector<int>& nums) { //1) Listen //Recibo un array con numeros ordenados de menor a mayor (non-decreasing order) //K siendo la cantidad de caráctees unicos //Debo qui...
ALGO
0.999494
5.423228
4b74c057-4644-4f2a-b591-4a0c8c8fef55
rahulrawat09/Codeforces-Solutions
527C - Glass Carving .cpp
#include<bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long //#define bint int1024_t #define ld long double #define vect vector<ll> #define unmap unordered_map #define pb push_back #define F first #define S...
ALGO
0.999869
3.682798
23ae3bef-9afa-4130-82cc-0b453e2cf060
StanfordVL/bullet3
src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp
#include "btConvex2dConvex2dAlgorithm.h" //#include <stdio.h> #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/Collisio...
ALGO
0.999654
6.671592
b49defaa-0440-4041-b6e6-da3932b2adb6
HuyVoDinh/Knowledge_CPP
Section20_TheStandardTemplateLibrary/17_AssociativeContainers-Maps/AssociativeContainers-Maps.cpp
/*** * [The STL Map containers] * * Associative containers * Collection of stored objects that allow fast retrieval using a key * STL provides Sets and Maps * Usually implemented as a balanced binary tree or hashsets * Most operations are very efficient * Maps * std::map * st...
TEST
0.92476
5.33599
4911afb1-7aa3-41f8-a953-5f859cd18ed1
ashishrajputji/cpp
arrays/linear-search.cpp
#include<iostream> using namespace std; int linear(int a[],int key){ for(int i=0;i<6;i++){ if(a[i]==key){ return i; } } return -1; } int main(){ int arr[] = {1,2,20,10,22,12}; int key,found; cout<<"Enter Element to find : "; cin>>key; found = linear(arr,key); if(found == -1){ ...
ALGO
0.998415
3.607081
421a2167-220a-4cfe-8aaa-81efd031c3db
asherushare/CppTimeAndSpaceComplexity
First week (Time and Space complexity)/Sub_of_product_and_sum_of_digit.cpp
#include <stdio.h> int main() { int num, digit, sum = 0, product = 1; // Input the integer printf("Enter an integer: "); scanf("%d", &num); // Ensure the integer is non-negative if (num < 0) { printf("Please enter a non-negative integer.\n"); return 1; } // Calculate ...
ALGO
0.999917
6.685774
302c4878-70ec-45d8-bd74-85155508c3cf
Namannr9/Data-Structure-and-algorithms
106-construct-binary-tree-from-inorder-and-postorder-traversal/106-construct-binary-tree-from-inorder-and-postorder-traversal.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.999994
6.108184
3b84d0f3-b476-4bd9-9c65-eb028179fa0f
heesangh/spmm-llm-optimization
optim2/doc/examples/TutorialLinAlgComputeTwice.cpp
#include <iostream> #include <Eigen/Dense> int main() { Eigen::Matrix2f A, b; Eigen::LLT<Eigen::Matrix2f> llt; A << 2, -1, -1, 3; b << 1, 2, 3, 1; std::cout << "Here is the matrix A:\n" << A << std::endl; std::cout << "Here is the right hand side b:\n" << b << std::endl; std::cout << "Computing LLT decom...
ALGO
0.999967
3.384699
cc553f41-0d12-4776-b728-10766ebe74ee
jadhavdurgesh/DSA
5.Functions/05.arith_progression_series.cpp
#include<iostream> using namespace std; int nth_term(int n) { int ans = 3*n + 7; return ans; } int main() { int n; cin>>n; cout<<nth_term(n); }
ALGO
0.999713
3.633138
6d13068b-9a81-4f76-b750-cdd2033111e9
priyanshi668/cpp_program
function prototype.cpp
#include <iostream> using namespace std; // Function prototype int findMax(int a, int b, int c); int main() { int num1, num2, num3; // Input three numbers from the user cout << "Enter three numbers: "; cin >> num1 >> num2 >> num3; // Call the findMax function and output the result int max = ...
ALGO
0.999964
5.617698
dc7188ee-bac5-4fc6-ac6d-b590ff0b2daa
ks0727/AtCoder-Archive
ABC/301-350/319/cr2.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i =0;i<(n);i++) using P = pair<int,int>; int main(){ vector<int> c(9); rep(i,9) cin >> c[i]; vector<int> order(9); rep(i,9) order[i] = i; int tot = 0; int event = 0; do{ tot++; bool disappointed = false; ...
ALGO
0.999727
3.177863
f6380b09-2a4a-408d-9433-607467dd4e0f
George-Polya/sophomore-DataStructure
2017_04_13/Queue_simulation/Source.cpp
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "Queue_simulation.h" void main() { int duration; srand(time(NULL)); while (current_time < MAX_SIMUL_TIME) { printf("\n----- time %d ----- \n", current_time); // 새 job이 들어오면 큐에 삽입 if (is_job_arrived()) { ++new_job_id; duration = get_ran...
ALGO
0.996714
4.075506
87cefda5-e0f9-4b54-829b-e61aaca6e9a5
xuda25/C-study
leetcode/416.分割等和子集.cpp
/* * @lc app=leetcode.cn id=416 lang=cpp * * [416] 分割等和子集 */ /* 转换为背包问题 因为每个元素只能取一次 所以为01背包 背包容量为 sum/2 1. dp[j] 表示剩余j容量的和 2. dp[j] = max(dp[j], dp[j-weight[i]] + value[i]) = max(dp[j], dp[j-num[i]]+ num[i]) 3. 正整数全为0 如果有负数 赋值为负无穷大 */ // @lc code=start class Solution { public: bool canPartition(vect...
ALGO
0.999977
5.806913
b207472c-5fd1-4a48-946e-6229eefdfbec
sxu39/TP-RPMD
lammps-stable_2Aug2023_update2/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp
// clang-format off #include "npair_half_size_multi_newton_tri_omp.h" #include "atom.h" #include "atom_vec.h" #include "domain.h" #include "error.h" #include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" #include "npair_omp.h" #include "omp_compat.h" using namespace LAMMPS_NS; /* ...
ALGO
0.998483
6.494692
9ef4ab88-65e4-4e5e-b9c4-975bcfa619dd
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_12154_4.cpp
#include <bits/stdc++.h> using namespace std; char s[200][200]; int mm[200][200], bb[200][200]; int x[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; int y[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; int lei[10001][2], co = 0; int n, m; void dismm() { for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { printf("%d ", mm[i...
ALGO
0.999847
3.519652
35869824-2595-4569-8f58-7c200e02fef3
Rvvijays/leetcode
975-range-sum-of-bst/range-sum-of-bst.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.999991
6.222898
2009e0e9-6cfc-4a98-853e-60da53046d91
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_13145_5.cpp
#include <bits/stdc++.h> using namespace std; const int MAX = 300; int c[10]; int main() { int T; scanf("%d", &T); while (T--) { long long x, y; scanf("%lld %lld", &x, &y); for (int i = 1; i <= 6; i++) scanf("%d", c + i); long long costX, costY; if (x < 0) costX = min(c[3], c[4] + c[2]);...
ALGO
0.999701
4.086176
6108e7ba-490e-4d83-8088-0558dba20eb7
ishandutta2007/codeforces
quailty/normal/474/D.cpp
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> using namespace std; const int MAXN=100005; const int Mod=1000000007; int dp[MAXN]; int main() { int t,k; scanf("%d%d",&t,&k); for(int i=0;i<=k-1;i++)dp[i]=1; for(int i=k;i<=100000;i++)dp[i]=(dp[i...
ALGO
0.999952
4.090104
5af9f67f-b3fc-45c1-9b7d-eda1c19b5a83
darkmatter18/leetcode
0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp
class Solution{ public: int minFallingPathSum(vector<vector<int>>& m){ int n = m.size(); for (int i = n-2; i >= 0; --i) for (int j = n-1; j >= 0; --j) m[i][j] += min({ m[i+1][max(j-1,0)], m[i+1][j], ...
ALGO
0.999981
6.264503
27b2f737-202d-4524-b9f4-bebaec68ecff
MustangWY/Learn_Cpp
cpp_multiple/DataStruct/List/List.cpp
#include <iostream> #include "List.h" Sqlist::~Sqlist(){ delete [] elem; length = 0; elem = NULL; length = 0; listsize = 0; } void Sqlist::clear(){ length = 0; std::cout<<"List cleared.\n"; } void Sqlist::destroy(){ delete [] elem; length = 0; elem = NULL; length = 0; ...
TOOL
0.928734
3.561083
c4451bca-53bc-468e-a002-85bb4af52d50
swetagoswami819/DSA-Practice-Journey
Binary_search/search_element_rotated_sorted_arr.cpp
#include<bits/stdc++.h> using namespace std; int search_rotated_1_brute(vector<int>arr, int n, int target){ for(int i=0;i<n;i++){ if(arr[i]==target){ return i; } } } int main(){ int n,x,target; cin>>n; cin>>target; vector<int>arr; for(int i=0;i<n;i++){ cin>...
ALGO
0.999954
5.889563
cc37a613-6781-42d9-8850-87098a8b792b
romeoahmed/pyssoier_ans_cpp
src/1025-1035/1027.cpp
#include <iostream> int main(int argc, char const *argv[]) { auto t = 0; std::cin >> t; const auto v = 25000 / t * 3.6; if (v > 100) std::cout << "超速" << std::endl; else std::cout << "正常" << std::endl; return 0; }
TOOL
0.991042
4.249588
b1c5dfd4-cd6c-45b0-9720-67c6fd6c20c2
miemie2013/ncnn_ppyolov2
src/layer/mips/swish_mips.cpp
#include "swish_mips.h" #if __mips_msa #include <msa.h> #include "msa_mathfun.h" #endif // __mips_msa #include <math.h> namespace ncnn { Swish_mips::Swish_mips() { #if __mips_msa support_packing = true; #endif // __mips_msa } int Swish_mips::forward_inplace(Mat& bottom_top_blob, const Option& opt) const { ...
ALGO
0.869118
5.83182
c2ffb657-a10b-4638-9209-2aaa230cfc4d
ithemal/DiffTune
llvm-mca-parametric/llvm/lib/CodeGen/LoopTraversal.cpp
#include "llvm/CodeGen/LoopTraversal.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/CodeGen/MachineFunction.h" using namespace llvm; bool LoopTraversal::isBlockDone(MachineBasicBlock *MBB) { unsigned MBBNumber = MBB->getNumber(); assert(MBBNumber < MBBInfos.size() && "Unexpected basic block number."); ...
ALGO
0.999614
7.633179
b3280f55-0eb8-43bf-84db-97eecfd5a622
Anupam-Roy16/Codeforce_Submission
codeforces/1139/A.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; string a; cin>>a; int c=0; int p=0; for(int i=0;i<n;i++) { if(((int)a[i]%2)==0) { c=c+i+1; } } cout<<c<<"\n"; return 0; }
ALGO
0.999891
3.486138
19be2d0b-a0e2-4c60-b4e7-c9aa4d3f7822
Avgustineiw/uni
cpp/cpp classwork/informatics/Before 29.02.24/Largest number/main.cpp
#include <iostream> #include <stdlib.h> #include <string> int largestNumber(std::string str, int &res, int &pos) { if (pos > str.length()) { return res; } else if (str[pos]-'0' > res) { res = str[pos]-'0'; pos++; return largestNumber(str, res, pos); } else { pos++; return largestNumbe...
ALGO
0.994968
4.497504
0993a7aa-47b3-4bb5-abb3-c11a65748c8d
triSYCL/sycl
llvm/lib/CodeGen/MachineInstrBundle.cpp
#include "llvm/CodeGen/MachineInstrBundle.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/TargetInstrInfo.h" #include "llvm/CodeGen/TargetRegisterInfo.h...
TOOL
0.897149
7.920131
cdd6aa2f-1c20-4416-a670-f04f18555f45
faizan346/Ds-Algo-Cplusplus
stack-queue/10postfixEvaluateConvert.cpp
#include<bits/stdc++.h> using namespace std; int cal(int a, int b, char c) { if(c == '*') return a * b; else if(c == '/') return a / b; else if(c == '+') return a + b; else if(c == '-') return a - b; else return -1; } void evaluateAndConvert(stack<string> &prefix, stack<string> &infix, stack<int> ...
ALGO
0.999621
3.971747
94469e03-e07d-4960-9019-6285f56ffa2d
harshu722/c-working-
leetcode4.cpp
#include <iostream> #include <unordered_map> class Node { public: int val; Node* next; Node* random; Node(int _val) { val = _val; next = nullptr; random = nullptr; } }; class Solution { public: Node* copyRandomList(Node* head) { if (!head) return nullptr; ...
ALGO
0.977216
5.261506
1e481a83-e4db-4b13-bc4b-46e77eb8295b
NayanB21/DSA-Journey
Linked list/Merge two sorted list.cpp
/* Q.You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. */ #include <iostream> using namespace std; // Definition for singly-...
ALGO
0.999948
6.365502
3ae0f0bd-e75c-430d-9404-145a1064a7b9
mds369-dot/phitron
Semester 1/Introduction to C++ for DSA/week 2/module 7/sort_arr_obj.cpp
#include <bits/stdc++.h> using namespace std; class Student { public: string name; int marks; int id; void set_data(string name, int marks, int id) { this->name = name; this->marks = marks; this->id = id; } void get_data(...
ALGO
0.99831
4.178978
a49a84b1-a4bc-4060-a3e5-097ce03fb138
mollah2022/code
141a.cpp
//Bismillahir Rahmanir Rahim #include<bits/stdc++.h> using namespace std; #define ll long long #define FAST ios_base::sync_with_stdio(0); cin.tie(0); #define tst int t; cin >> t; while(t--) #define yes cout << "YES\n"; #define no cout << "NO\n"; #define endl "\n" int32_t main(){ FAST ...
ALGO
0.999991
3.844354
6f888336-e004-495f-8664-261189531d91
Rishabh068/DSA-questions
0796-rotate-string/0796-rotate-string.cpp
class Solution { public: bool rotateString(string A, string B) { queue<int>q,q1; int n=A.size(); for(int i=0;A[i]!='\0';i++){ q.push(A[i]); q1.push(B[i]); } //if the string A and B are equal if(A==B){ return true; } int i=0; while(i<n...
ALGO
0.999989
5.926512
1b146364-aecb-4915-9175-ce3a68cfef6d
Schr0Smi1ey/GeekForGeeks
Binary Search/Square_root_of_a_number.cpp
class Solution{ public: long long int search(long long int x){ long long int low = 1,high = x,ans; while(low <= high){ long long int mid = low + (high-low)/2; if(mid*mid <= x){ ans = mid; low = mid + 1; } else{ ...
ALGO
0.999954
4.806118
ee26cd4b-a45b-4a11-9217-13820f26e3bb
sarvex/leetcode-free-pascal
solution/0900-0999/0981.Time Based Key-Value Store/Solution.cpp
class TimeMap { public: TimeMap() { } void set(string key, string value, int timestamp) { ktv[key].emplace_back(timestamp, value); } string get(string key, int timestamp) { auto& pairs = ktv[key]; pair<int, string> p = {timestamp, string({127})}; auto i = upper_boun...
ALGO
0.995713
7.132664
0a2c72aa-8c18-4e92-8b5b-581f0ee2d61d
ishandutta2007/codeforces
batman/normal/277/A.cpp
#include <iostream> #include <vector> #include <fstream> using namespace std; #define N 110 vector <int> e[N]; vector <int> lang[N]; vector <int> langperson[N]; vector <int> alones; bool mark[N]; int n,m,ans; ifstream fin("input.txt"); void input() { cin>>n>>m; int ex,ex2,ex3; for(int i=1;i<=n;i++) { ...
ALGO
0.999221
3.717731
cb700770-0810-471b-8825-c9124855f22b
tzlaine/swig_test
boost_1_60_0/libs/geometry/index/example/benchmark2.cpp
// Boost.Geometry Index // Compare performance with std::set using 1-dimensional object // (i.e. angle, or number line coordiante) #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/index/rtree.hpp> #include <boost/chrono.hpp> #include <boost/foreach.hpp> #include <boost/random.hpp> #include ...
TEST
0.989568
5.278455
63de03cb-87d4-4309-9507-ac71e8d51df6
Otamaa/Phobos-Minimal
src/Ext/Bullet/Body.cpp
#include "Body.h" #include <Ext/Anim/Body.h> #include <Ext/RadSite/Body.h> #include <Ext/WeaponType/Body.h> #include <Ext/BulletType/Body.h> #include <Ext/Techno/Body.h> #include <Ext/TechnoType/Body.h> #include <Ext/House/Body.h> #include <Ext/WarheadType/Body.h> #include <Misc/DynamicPatcher/Trails/TrailsManager.h>...
ALGO
0.902455
5.432467
7af1733e-a813-4cff-8860-a56b94ac6c10
itsAadi1/CP
chef_salary1.cpp
#include<bits/stdc++.h> using namespace std; int bc=0,bc1=0; int check(int n){ if(n==1) return 1; else return 0; } int bonus(int n){ if(n==1) bc++; if(n==0){ if(bc>bc1) bc1=bc; bc=0; } return bc1; } int main(){ int t; cin>>t; while(t--){ int x,y,i,wd...
ALGO
0.999752
3.293621
e11d6077-6a49-4264-9cde-9256009e02b8
Arshelle9912/Competitive-Programming
graphs/1093D.cpp
#include <bits/stdc++.h> using namespace std; int MOD = 998244353; int exponentiation(long long base, int power) { long long result = 1; while (power>0) { if (power&1) { result = (result*base)%MOD; } base = (base*base)%MOD; power>>=1; } return result; } int ma...
ALGO
0.999982
5.89466
9a437f52-2a0f-49c0-a589-b8b613b9b1df
Amit-S-Terdal/Leetcode_Practice
day_17.cpp
// 1910. Remove All Occurrences of a Substring // Hint // Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed: // Find the leftmost occurrence of the substring part and remove it from s. // Return s after removing all occurrences of part. // A su...
ALGO
0.999784
7.04211
dafad483-81ae-42cd-b020-34fe29ebf097
jakoo/leetcode
add_two_numbers.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode *p = NULL, *head = NULL; int carry = 0; int ...
ALGO
0.999934
6.300682
47ea9d4f-dfca-4ebd-a3f1-8ffc81d4d6b6
Iam-Sodhi/DSA
Sorting/mergesort_Countinversion.cpp
#include <iostream> using namespace std; // Find the number of inversions in the array not using brute force approach long long merge(int a[], int low, int high, int mid) { int i, j, k; i = low; j = mid + 1; k = low; int b[high]; long long inv=0; while (i <= mid && j <= high) // Remember to...
ALGO
0.999947
4.543041