uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
2b6c87d4-a1a5-45c5-a4d1-af680ade2a05
humanbeeng/competitive-programming
CP Sheet/A_Snow_Footprints.cpp
/* Author : humanbeeng */ #include <bits/stdc++.h> using namespace std; #define fo(i, init, n) for (int i = init; i < n; i++) #define pb(num) push_back(num) #define ppb pop_back() #define all(arr) arr.begin(), arr.end() #define pi(arr) \ for (int i = 0; i...
ALGO
0.998822
3.137806
5176e278-c64b-45cc-ba9b-7668484cfffb
lazy-chess-player/daily_problem
Problem_CodeForces/2024/10/11/Complete_the_Projects_easy_version.cpp
#define _CRT_SECURE_NO_WARNINGS 1 #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <chrono> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #in...
ALGO
0.999859
3.730627
18cf4838-7fc8-43a8-a43b-7b2968fb615c
PrinceCuet77/UVa
Cpp/10812 beat the spread!.cpp
#include<iostream> using namespace std; int main() { int x,y,test,a,b; cin>>test; while(test--){ cin>>a>>b; if(b>a || (a-b)%2!=0) cout<<"impossible"<<endl; else{ y=(a-b)/2; x=b+y; cout<<x<<" "<<y<<endl; } } return 0; ...
ALGO
0.999772
3.949336
01acfe3f-43cb-4547-9d2b-7e6b2a8cabb7
Nahin-CDR/CodeForces
(A) Twins.cpp
#include<bits/stdc++.h> using namespace std; //Solver : Nahin the Coder //Date : 12-03-2020 //Time : 10:21 am int main() { int size; cin>>size; float store = 0; float arr[size]; float equal; for(int i = 0; i<size; i++) { cin>>arr[i]; store = store + arr[i]; } ...
ALGO
0.999968
3.638375
e247dfca-d696-451b-b6ed-01483dc984dd
Harshit1487/DSA
Day 12/5LinkedList100e.cpp
class Solution { public: //Function to sort a linked list of 0s, 1s and 2s. Node* segregate(Node *head) { // Add code here Node* temp=head; int z=0,o=0,t=0; while(temp!=NULL){ if(temp->data==0) z++; else if(temp->data==1) o++; else...
ALGO
0.999989
5.630366
fd0993ec-d50d-498a-bf33-35de11786f6a
whatalnk/cpsubmissions
atcoder/cpp/abc126/abc126_a/6123153.cpp
// Contest ID: abc126 // Problem ID: abc126_a ( https://atcoder.jp/contests/abc126/tasks/abc126_a ) // Title: A. Changing a Character // Language: C++14 (Clang 3.8.0) // Submitted: 2019-06-26 01:17:22 +0000 UTC ( https://atcoder.jp/contests/abc126/submissions/6123153 ) #include <algorithm> #include <iostream> #includ...
ALGO
0.999873
4.228348
b3836c9c-8d92-4e40-9851-427ad8c6303b
jainakshitagithub/dsaPractise
2-Darrays/one.cpp
#include <bits/stdc++.h> using namespace std; // Mycode -->so destructive😶 // vector<int> downwardDigonal(int n, vector<vector<int>> A) // { // // Your code goes here // vector<int> v; // for (int i = 0; i < 1; i++) // { // for (int j = 0; j < n; j++) // { // if (A...
ALGO
0.999981
4.185008
f4660916-2d91-471f-8efe-b419b4792d93
KIMJUHEEEEE/SWEA
1258.cpp
#include<iostream> #include<queue> #include<algorithm> using namespace std; int arr[101][101]; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; int n = 0; vector<pair<pair<int, int>, int>> v; queue<pair<int, int>> q; void sorting() { for (int i = 0; i < v.size() - 1; i++) { for (int j = i + 1; j < v.size(); j++) ...
ALGO
0.999338
3.69552
a23e308f-be33-4f16-bd41-36f27f4b816e
sarvex/leetcode-carbon
solution/0300-0399/0375.Guess Number Higher or Lower II/Solution.cpp
class Solution { public: int getMoneyAmount(int n) { vector<vector<int>> dp(n + 10, vector<int>(n + 10)); for (int l = 2; l <= n; ++l) { for (int i = 1; i + l - 1 <= n; ++i) { int j = i + l - 1; dp[i][j] = INT_MAX; for (int k = i; k <= j; +...
ALGO
0.999959
5.438869
55b6a432-b276-4763-b418-fb441d9bfee0
lechenyu/Arbalest-Vec
llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" #include "llvm/Suppo...
ALGO
0.966334
7.925101
a0f3827f-9751-4559-ac17-3902377697a0
piyush-24/Data-Structures-and-Algorithms
804-unique-morse-code-words/804-unique-morse-code-words.cpp
class Solution { public: vector<string> v = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."}; int uniqueMorseRepresentations(vector<string>& words) { set<string> set; for(int i=0; i<words.size(...
ALGO
0.999899
6.098203
55416a97-e754-4d76-9326-c222c82e445a
gy5461/UnrealEngine544
Engine/Source/ThirdParty/Intel/Embree/Embree2140/src/kernels/bvh/bvh_intersector_single.cpp
#include "bvh_intersector_single.h" #include "../geometry/intersector_iterators.h" #include "../geometry/triangle_intersector.h" #include "../geometry/trianglev_intersector.h" #include "../geometry/trianglev_mb_intersector.h" #include "../geometry/trianglei_intersector.h" #include "../geometry/trianglei_mb_intersector...
ALGO
0.996963
6.289237
f87a9f7e-e464-471d-9bbd-5812890143f5
aalmakhan/competitive-programming
codeforces/gb2015/C/sol.cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <set> #include <map> #include <vector> #include <string> #include <cmath> #include <cstring> #include <queue> #include <stack> #include <algorithm> #include <sstream> #include <numeric> #include <cassert> using namespace std; #define f first #define s s...
ALGO
0.999616
3.795077
09f03814-9e41-431d-8959-9337d6e1eb40
vatsalya16/DSA
string/palindrome.cpp
#include<iostream> using namespace std ; int length(char ch[]) { int count = 0; for(int i=0 ; ch[i]!='\0'; i++) { count++ ; } return count ; } bool palindrome(char ch[], int n) { bool ans = true ; int s = 0 ; int e = n-1 ; while(s<=e) { if(ch[s]!=ch[e]) { return false ; ...
ALGO
0.999919
3.310761
643c1163-2a1f-4b72-9b1e-a4405a6ce1af
ellenmellon/ReQuest
code/Model/eigen-3.2.5/doc/examples/DenseBase_middleRows_int.cpp
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl; return 0; }
ALGO
0.930811
3.307581
51912341-7b0a-4bc6-ad9e-f6d867d41350
kshitij86/didactic-octo-spork
sample/id.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <set> #include <algorithm> #define flag(i) printf("\n------FLAG %d------\n", i); using namespace std; int main() { int T, n; cin >> T; while (T--) { cin >> n; int a[n]; for (int i = 0; i < n; i++...
ALGO
0.999772
3.810833
c011e292-cf56-4ab1-a379-733967ec1ee0
HosamEissa/Competitive-programming-
UVA/11709.cpp
/* Author: Hossam Eissa Idea: standard SCC problem */ #include <bits/stdc++.h> #include <cstdio> #include<stack> #include <stdio.h> #include<iostream> #include<string> #include<algorithm> #include<iomanip> #include<stdio.h> #include <map> #include<unordered_map> #include<complex> using namespace std; #define sf(a) scan...
ALGO
0.999909
4.271304
8e272c34-434c-4165-85e9-d6f2e091a15d
masha15litvinova/Katusha-2.0
LineBot-3523a47b8350b1bb9cfd37442402d93caf77cc79/stm32duino/LineBot_backup_line/stm32duino/RescueLine23/libraries/SdFat_-_Adafruit_Fork/src/FatLib/FatVolume.cpp
#include <string.h> #include "FatVolume.h" //------------------------------------------------------------------------------ cache_t* FatCache::read(uint32_t lbn, uint8_t option) { if (m_lbn != lbn) { if (!sync()) { DBG_FAIL_MACRO; goto fail; } if (!(option & CACHE_OPTION_NO_READ)) { if (...
TOOL
0.853382
5.96399
0890cb4d-5dd4-4221-9434-30399b7ed11d
Cmput416F21/PyGlueTokenizer
CodeGen-main/data/transcoder_evaluation_gfg/cpp/COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2_1.cpp
#include <iostream> #include <cstdlib> #include <string> #include <vector> #include <fstream> #include <iomanip> #include <bits/stdc++.h> using namespace std; int f_gold ( int n ) { int x = 0, yCount, res = 0; for ( yCount = 0; yCount * yCount < n; yCount ++ ); while ( yCount != 0 ) { res += yCount; x...
ALGO
0.995636
5.204121
b86558f7-00a4-43af-9811-45b0697bbc41
Gpossas/codeforces
977A - Wrong Subtraction.cpp
#include <iostream> int main(void){ int number, nSubtractions; std::cin >> number >> nSubtractions; for (int i = 0; i < nSubtractions; i++){ if (number % 10 == 0){ number /= 10; } else{ number--; } } std::cout << number; }
ALGO
0.999584
3.974096
c6fc6207-2b2e-49fd-9fa4-333ae92aa1c1
JiHyeok-Kim/SAF-STUDY
2022-10/221012 - A형 대비 SWEA 문제 풀이/221012_스터디_이준호/숫자 만들기.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int n, ans; int map[12]; int op[12]; int maxi, mini; void init() { ans = 0; maxi = -21e8; mini = 21e8; for (int i = 0; i < 12; i++) { map[i] = 0; } } void input() { cin >> n; for (int i = 0; i < 4; i++...
ALGO
0.999912
4.262042
59f3907c-06ef-441c-bc6b-8ebb7b9ecedc
Akash-Ingle/DSA_in_CPP
Stack/ArraybasedStack.cpp
#include <iostream> using namespace std; #define n 100 class stack{ int *arr; int top; public: stack(){ arr = new int[n]; top = -1; } void push(int x){ if(top==n-1){ cout<<"Stack Overflow"<<endl; return; } top++; arr[top]=x...
ALGO
0.997978
4.083889
7d5a7b9e-6885-4ba2-a46c-80d9e6cc8644
Riaj509/Leetcode
0038-count-and-say/0038-count-and-say.cpp
class Solution { public: string countAndSay(int n) { if (n == 0) return ""; string res = "1"; while (--n) { string cur = ""; for (int i = 0; i < res.size(); i++) { int count = 1; while ((i + 1 < res.size()) && (res[i] == res[i + 1])){ count++; ...
ALGO
0.999992
7.130719
5a3f21ef-0905-4bb6-bf26-6034c81984d7
CoderOJ/contests
CodeForces/cts/549/e/main.cpp
#include "/home/jack/cm/debug" #include "/home/jack/cm/scanner" #include "/home/jack/cm/util" // #include "/home/jack/cm/intm" // #include "/home/jack/cm/string" #include <algorithm> #include <limits> cm::scanner<cm::optimal_reader> sc(stdin); struct point_t { int x, y; constexpr point_t() : x(0), y(0) {} cons...
ALGO
0.999984
4.982068
edf441a9-89e5-4acc-949f-cbc9675ec59c
ttnhathuy313/cp-career
Codeforces/Contest604/TaskC.cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int dp[N][2][3], n; string s; void update(int &a, int b) { a = max(a, b); } int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(0); cin.tie(0); freopen("TaskC.INP", "r", stdin); freopen("TaskC.OUT", "w", stdout); cin >> n; ci...
ALGO
0.999897
3.652364
475a1e0a-bdd4-4136-8e75-455938b3ee15
balr0g/mame-rr
3rdparty/lzma/CPP/Common/TextConfig.cpp
// Common/TextConfig.cpp #include "StdAfx.h" #include "TextConfig.h" #include "UTFConvert.h" static inline bool IsDelimitChar(char c) { return (c == ' ' || c == 0x0A || c == 0x0D || c == '\0' || c == '\t'); } static AString GetIDString(const char *s, unsigned &finishPos) { AString result; for (finishPos =...
TOOL
0.940635
6.015606
ecb3c115-c06c-4407-a8a7-df34eea96452
Sudipta-Trisha/AtCoder-Problems-Solutions
AtCoder - Educational DP Contest/C - Vacation/sol.cpp
/** * author : Sudipta Banik Trisha * created : August 07, 2020 4:32 PM * Problem Name : C - Vacation * Problem Limit : 2000 ms , 1024 MB * Problem Url : https://atcoder.jp/contests/dp/tasks/dp_c * @genarated by : ai-virtual-assistant **/ #include<bits/stdc++.h> using namespac...
ALGO
0.999953
4.364672
ca6c5cbe-029f-4ef8-9053-d9f82e0220d4
envyaims/CSES
CSES/1068 - Weird Algorithm.cpp
num = int(input()) nums = [str(num)] while True: if num % 2 == 0: num //= 2 nums.append(str(num)) else: if num == 1: nums.append(str(num)) break else: num = (num*3) + 1 nums.append(str(num)) nums.pop() print(" ".join(nums))
ALGO
0.999975
4.664355
d3e13b1a-0fcc-4c7d-b6b1-dcce2f680ef2
ChakradharG/CompetitiveCoding
CodeForces/Chakradhar/281A.cpp
#include <iostream> #include <string> using namespace std; #define Log(x) cout << x << "\n" void func() { string s; cin >> s; cout << char(toupper(s[0])); for (int i = 1; i < s.length(); i++) { cout << s[i]; } cout << endl; } int main() { ios::sync_with_stdio(false); func(); }
ALGO
0.996604
3.780395
8c3cc2ed-6f62-434d-9aba-99a6702991e5
Sharpless298/adventofcode
2024/Day 12/part2.cpp
#include <cassert> #include <iostream> #include <numeric> #include <vector> using namespace std; pair<int, int> operator+(pair<int, int> a, pair<int, int> b) { return {a.first + b.first, a.second + b.second}; } vector<int> parent, sizes; void init(int n) { parent.resize(n); sizes.resize(n); iota(parent.begin(), ...
ALGO
0.999329
4.838832
dab7ae18-d323-44d6-b266-15530e496f1d
hardik17771/WebApp_Profile_Dropdown
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.998784
6.761023
2c150d36-716c-4e31-a6a0-1e1954db6855
venkyvt7/competitive-programming-1
OSN/2018/Day 1/Jembatan Layang.cpp
#include<bits/stdc++.h> #define ll long long using namespace std; const int MAXX = 100005, MOD = 1000000007; int N, G; ll fak[MAXX], K[MAXX], A_atas[MAXX], A_sama[MAXX], A_bawah[MAXX], B_atas[MAXX], B_sama[MAXX], B_bawah[MAXX]; void precompute () { fak[0] = 1; for (int i = 1; i <= MAXX - 3; i ++) fak[i] = (fak...
ALGO
0.999912
3.701125
ee59eba8-28d2-44ba-99a5-0fd8f0cba3a8
OMENDRA1604/CPP-PROGRAMS
Basic Program/Sorting/MergeSort.cpp
#include<iostream> using namespace std; void MergeSort(int *arr , int n ) { } int main() { int n; cin>> n; int arr[n]; for(int i =0; i<n ; i++) { cin>> arr[i]; } MergeSort( arr , n); for(int i =0; i<n ; i++) { cout << arr[i] << " "; } return 0; }
ALGO
0.999954
4.575859
b3b5d3ae-eea7-4f1b-9b52-cc4f70a82d4e
dinhthigaamer/ITK65
IT_K65/Day22/Pro C/main.cpp
#include<bits/stdc++.h> using namespace std; #define MAX 500005 vector<int> ans; int q,t[MAX],x[MAX],y[MAX],p[MAX]; int n; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>q; for(int i=1;i<=q;++i) { cin>>t[i]; if(t[i]==1) cin>>x[i] ,++n; else cin>>x[i]>>y[i]; } ...
ALGO
0.999964
3.875681
786876c6-b233-4ef4-8ae1-271f54925b14
deepakdeepu000/GFG_solved
Difficulty: Medium/Palindrome Linked List/palindrome-linked-list.cpp
//{ Driver Code Starts #include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <ios> #include <iostream> #include <random> #include <sstream> #include <string> #include <vector> using namespace std; struct Node { int data; struct Node *next; Node(int x) { data = ...
ALGO
0.993972
6.006261
d5cbab4d-d1a5-4a97-a4bd-4f2f9824a5c7
shivanshsanoria1/LeetcodeSolutions
CPP [1-500]/28.find_the_index_of_the_first_occurence_in_a_string [1].cpp
class Solution { public: // T.C.=O(n1*n2), S.C.=O(1) // Sliding-window (fixed-length) int strStr(string haystack, string needle) { int n1=haystack.length(), n2=needle.length(); // s2 cannot not be longer than s1 if(n1 < n2) return -1; for(int start = 0; start <...
ALGO
0.999982
5.989553
8cc03c78-75c4-4592-935b-d1f0dbd40c2a
shreyan-haldankar/Data-Structures-and-Algorithms
CPP_Learning/STL/lists_learning.cpp
#include<bits/stdc++.h> using namespace std; int main() { list<int> v; v.push_back(2); for(auto it: v) { cout << it; } cout << "\n"; v.emplace_back(4); for(auto it: v) { cout << it << " "; } cout << "\n"; v.push_front(10); for(auto it: v) { cout << it << " "; } }
ALGO
0.965692
3.448224
b59611cc-6a65-40ca-9640-c46d1c5cb6b2
GitHub-LYY/interestingresources
datastructure/list/jz18.cpp
/* ** Author: Yangyang Liu ** Date: 2022-08-01 ** Description: 剑指 Offer 18. 删除链表的节点 ** link: https://leetcode.cn/problems/shan-chu-lian-biao-de-jie-dian-lcof/ ** reference: */ #include <iostream> using namespace std; // 链表节点定义 struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NUL...
ALGO
0.999974
5.899969
f82f5512-24fd-47ef-9805-2fd632f0b0af
szenekonzept/Ekita-master
src/key.cpp
#include <map> #include <openssl/ecdsa.h> #include <openssl/obj_mac.h> #include "key.h" // Generate a private key from just the secret parameter int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key) { int ok = 0; BN_CTX *ctx = NULL; EC_POINT *pub_key = NULL; if (!eckey) return 0; const EC_...
TOOL
0.959335
7.315616
e1d22b77-2925-48ae-a2c8-b9fe4feab097
201710757/cpp_study
230110/test3.cpp
#include<iostream> using namespace std; const int MAX_N = 1001; const int MAX_k = MAX_N; const int MAX_x = 10000; int arr[MAX_N]; int N, k; int main(void) { cin >>N>>k; for(int i=0;i<N;i++) { cin>>arr[i]; } for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { if(...
ALGO
0.999986
3.428906
a5a53534-802f-436d-a107-3c24336992cd
youssifalshafey/C-
loops/forLoop/traingle.cpp
#include<iostream> using namespace std; int main(){ for(int i = 1 ; i <= 12 ; i ++ ){ for ( int j = 1 ; j <= i ; j++){ cout<<"*" ; } cout<<endl; } }
ALGO
0.999854
3.25743
765d1099-9169-4a1a-9db5-c3bfb4d81955
tomektiger/CPP-STUDIA
Semestr 2/Test/test.cpp
#include <iostream> using namespace std; int fun(int &suma, int &iloczyn) { int number, ilosc = 0; iloczyn++; do { cout << "Wpisz liczbe: "; cin >> number; if (number > 0) { suma += number; iloczyn = iloczyn * number; if (number % 2 =...
ALGO
0.998222
4.234353
2e8e13ac-0e29-4005-ae64-b1d5e466a3f3
cty0613/veda_cpplecture
doit_excercise/doit_ch3.cpp
#include <iostream> using namespace std; int fibo(int n); int main() { int size, gap; cout << "배열의 전체 크기를 입력하세요" << endl; cin >> size; cout << "배열의 간격을 입력하세요" << endl; cin >> gap; int* array = new int[size]; for (int i = 0; i < size; i++) { array[i] = fibo(i); } for (i...
ALGO
0.985542
4.003311
d2bf5ed0-cac6-49da-bc46-a4cb0435b390
MengjiaoH/Probabilistic-Marching-Cubes-C-
main.cpp
#include <iostream> #include <string> #include <vector> #include <chrono> #include "load_data.h" // #include "covariance.h" #include "cov_helper.h" int main(int argc, char** argv) { Eigen::initParallel(); Eigen::setNbThreads(56); // std::string file_dir = "/Users/mengjiao/Desktop/Uncertainty/LCP_C++/datas...
ALGO
0.98425
4.241371
b47cb198-1455-4fd9-8614-3253ce3499f0
lozimski/bitcoindiamond
src/rpcnet.cpp
#include "net.h" #include "bitcoinrpc.h" using namespace json_spirit; using namespace std; Value getconnectioncount(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getconnectioncount\n" "Returns the number of connections to other nodes."); ...
WEB
0.926101
6.646237
9bd0a8cf-9a3a-44f2-a7b7-e68b72a60cfb
prateek27/Coding-Problems
Coding/Spoj/CLONES.cpp
#include<iostream> #include<cstdio> using namespace std; int a[1000000]; int main(){ int t,i; int n,temp=1; long long ninja=1; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=0;i<n;i++) cin>>a[i]; ninja=1; for(i=0;i<n;i++){ ninja=ninja-a[i]; if(ninja<0) { temp = 0 ;break; } ...
ALGO
0.99977
3.211543
36c43131-cea6-4398-803a-6f93b65c1f27
DopeChicCity/DopeCoin
src/qt/guiutil.cpp
#include <QApplication> #include "guiutil.h" #include "bitcoinaddressvalidator.h" #include "walletmodel.h" #include "bitcoinunits.h" #include "util.h" #include "init.h" #include <QDateTime> #include <QDoubleValidator> #include <QFont> #include <QLineEdit> #if QT_VERSION >= 0x050000 #include <QUrlQuery> #else #inclu...
TOOL
0.869468
6.962831
63671f4d-bce9-4ac1-be71-3c34c5b83207
pdonda06/LeetCode
2050-count-good-numbers/2050-count-good-numbers.cpp
class Solution { public: const int MOD = 1e9 + 7; long long power(long long base, long long exp) { long long result = 1; while (exp > 0) { if (exp % 2 == 1) result = (result * base) % MOD; base = (base * base) % MOD; exp /= 2; } ...
ALGO
0.999986
6.057642
8ad492ed-81e4-47d1-a02a-028eb240b8d0
mahad2006/dsa-learning-apnacollege
09-vectors/vector-capacity.cpp
#include <iostream> #include <vector> using namespace std; int main() { vector<int> vec; // Create an empty vector // Display initial capacity cout << "Initial capacity: " << vec.capacity() << endl; // Add elements and observe capacity doubling for (int i = 1; i <= 10; ++i) { vec.push_bac...
ALGO
0.945894
6.047242
912fc6ab-5dc3-407a-b1e1-05f918b3ae5a
ishandutta2007/codeforces
dmitrygrigorev/normal/696/E.cpp
#include <iostream> #include <vector> #include <algorithm> #include <stdio.h> #include <sstream> #include <string> #include <map> #include <set> #include <stdlib.h> #include <cmath> #include <math.h> #include <fstream> #include <bitset> #include <unordered_map> #define int long long #define please int using namespace s...
ALGO
0.999925
3.783839
5c97fb6e-e333-4b46-8025-be603d9fde48
ds-sww/codebase
13307130265/assignment4/B.cpp
// File Name: B.cpp // Author: YangYue // Created Time: Mon Oct 20 18:43:53 2014 //headers #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <cstring> #include <cmath> #include <ctime> #include <string> #include <queue> #include <set> #include <map> #include <iostream> #include <vec...
ALGO
0.999774
3.67233
2b3af1cf-4663-4b15-a3c3-0442e5bf84f7
SiddiqueSahb/DSASeries
DSA Series/DS/Trees/17.ReplaceWithDepth.cpp
/* Replace with depth Send Feedback You are given a generic tree. You have to replace each node with its depth value. You just have to update the data of each node, there is no need to return or print anything. Input format : The first line of input contains data of the nodes of the tree in level order form. The order ...
ALGO
0.99991
5.628928
f2d3e760-23a6-42ec-aa90-bce1761c3b45
Lys-san/T-Linkage
src/demo.cpp
/** * Author : Lysandre M. (<EMAIL>) * Created : 04-26-2023 * Last modified : 06-28-2023 * * Implementation of the T-linkage algorithm for multi-model estimation. * Using the Imagine++ library. * * Inspired by L. Magri and A. Fusiello work 'T-Linkage : a Continuous * Relaxation of J-Linkage for ...
ALGO
0.996511
4.246898
d0e577f0-1f6b-473e-b834-21c2455769d7
rockieCao/LeetCodeSolution
Sort/IntersectionOfTwoArrays.cpp
#include <iostream> #include <cstdlib> #include <string> #include <vector> #include <hash_set> using namespace std; class Solution { public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { hash_set<int> hset(nums1.begin(), nums1.end()), res; for (vector<int>::iterator it = nums2.begin(); it != ...
ALGO
0.999029
5.24003
a0ee56a6-b3ee-4d51-93dd-aaee831e9413
thaiduc123/thaiduc_HN-JPN24C_c_session8
bai4.cpp
#include <stdio.h> int main(){ int arr[3][3]={{2,1,3},{21,57,68},{31,645,62}}; int max=arr[0][0]; for (int i=0; i<3; i++){ for (int j=0; j<3; j++){ if (max<arr[i][j]){ max=arr[i][j]; } } } printf("Max: %d", max); return 0; }
ALGO
0.998908
3.269266
a5e89b89-c0a4-4985-8138-41133b19cc7b
SafiyatulHoque/Bootcamp-NSU
Pre Bootcamp Contest 8 (1)/N.cpp
#include<iostream> #include<cmath> using namespace std; int main() { int x1,y1,x2,y2; cin>>x1>>y1; cin>>x2>>y2; int a=abs(x1-x2); int b=abs(y1-y2); if(a>b) cout<<a<<endl; else cout<<b<<endl; return 0; }
ALGO
0.999796
3.14265
6ddb6cae-1b72-4e56-b3c0-989fc8f86a35
thestupendous/cpp-again
practice/samplProj/addNums.cpp
int addNums(int a,int b) { return a+b; }
TOOL
0.934676
3.208739
b5840ce9-b14e-4f42-b8d1-70595a6d0465
mirror-of/inkscape
src/3rdparty/adaptagrams/libcola/tests/max_acyclic_subgraph.cpp
#include <iostream> #include <vector> #include <assert.h> #include <libcola/cola.h> #include <libcola/max_acyclic_subgraph.h> #include "graphlayouttest.h" using namespace std; using namespace cola; using vpsc::Rectangle; int main() { MaxAcyclicSubgraph *mas; Edges case_a, case_b, case_c, case_d, case_e, case_f; ...
TEST
0.900982
5.938651
973101c1-bf43-43a9-b89d-8dfc679c0de8
Aiden885/ConsoleApplication1
eigen/doc/examples/nullary_indexing.cpp
#include <Eigen/Core> #include <iostream> using namespace Eigen; // [functor] template<class ArgType, class RowIndexType, class ColIndexType> class indexing_functor { const ArgType &m_arg; const RowIndexType &m_rowIndices; const ColIndexType &m_colIndices; public: typedef Matrix<typename ArgType::Scalar, ...
ALGO
0.990609
6.750382
66675237-471b-4cc9-a7bb-771da8001c32
VikasKumarRoy/Leetcode
Problem-1685.cpp
// Problem - 1685 // https://leetcode.com/problems/sum-of-absolute-differences-in-a-sorted-array/ // O(n) time complexity and O(n) space complexity solution class Solution { public: vector<int> getSumAbsoluteDifferences(vector<int>& nums) { int n = nums.size(); vector <int> ans(n), right(n); ...
ALGO
0.999947
5.867392
5f449b54-2cb5-4dd8-9162-dfbe1b9d135c
nihal866/Codeforces_Questions
1539B.cpp
#include<bits/stdc++.h> #include<string> #include<string.h> #include<cmath> #include<iterator> #include<algorithm> #include<vector> #include<stack> #include<set> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); long n, q; cin>>n>>q; string s; cin>>s; long arr[...
ALGO
0.99981
4.428111
059714ac-76a2-46cf-9c70-4131fdba1a7a
yfuka86/pc
yukicoder/358/2057/2057.cpp
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define rep_r(i,n) for(ll i=(ll)(n)-1;i>=0;i--) #define rep2(i,sta,n) for(ll i=sta;i<(ll)(n);i++) #define rep2_r(i,sta,n) for(ll i=(ll)(n)-1;i>=sta;i--) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v)...
ALGO
0.999671
3.427242
c979ac76-217f-4b5e-be7e-8b7197c1dcd9
coderajdeep/SDE-AZ
09--heap/10--taskSchedular--621.cpp
// Task Scheduler -- leetcode 621 // Time complexity O(NlogN) // Space complexity O(3*D) --> D : total distinct task int leastInterval(vector<char>& tasks, int n) { unordered_map<char, int> umap; for(char task : tasks) { umap[task]++; } priority_queue<int> maxHeap; for(pair<int, int> p : uma...
ALGO
0.999869
6.86595
76fc43d5-6674-426d-9474-fc6a81bf6815
ramapnd18/dasar_pemograman
L3_Operasi/L3_Operasi.cpp
#include <iostream> using namespace std; int main() { int x,y, kurang; float a,b,tambah; x= 100, y= 55; a=10.5, b=7; kurang =x-y; tambah =a+b; cout<<"Hasil Kurang = "<<kurang<<endl; cout<<"Hasil Tambah = "<<tambah<<endl; return 0; }
ALGO
0.995477
3.299832
c4cb7423-1a6a-4c20-9585-12ccbe7cf36f
gotorius/Atcoder
ABC271/A.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) using ll = long long; using P = pair<int,int>; int main(void){ int n; cin >> n; map<int,char> mp; mp[10] = 'A', mp[11] = 'B', mp[12] = 'C', mp[13] = 'D', mp[14] = 'E', mp[15] = 'F'; int cnt = n / 16; int cnt...
ALGO
0.999283
4.190062
8b02e225-e60a-47f3-aee2-0f410cc74d03
liyunfan1223/oceanbase-2022
src/sql/engine/expr/ob_expr_estimate_ndv.cpp
#define USING_LOG_PREFIX SQL_ENG #include "sql/engine/expr/ob_expr_estimate_ndv.h" #include "sql/engine/aggregate/ob_aggregate_processor.h" using namespace oceanbase::common; namespace oceanbase { namespace sql { ObExprEstimateNdv::ObExprEstimateNdv(ObIAllocator &alloc) : ObFuncExprOperator(alloc, T_FUN_SYS_ESTIMATE...
ALGO
0.865513
5.888348
4dc83885-6ea1-41cd-ac67-ed20a318c0f8
Relintai/pmlpp
modules/auto_encoder/auto_encoder.cpp
/*************************************************************************/ /* auto_encoder.cpp */ /*************************************************************************/ /* This file is part of: */ /* ...
ALGO
0.991944
4.67298
8d808ed6-8ddd-40c0-b4a0-d0cf3f5cecc9
taehyeonk/Physics-simulation
frameWork_Spring/Cyclone/pcontacts.cpp
#include <pcontacts.h> using namespace cyclone; // Contact implementation void ParticleContact::resolve(real duration) { resolveVelocity(duration); resolveInterpenetration(duration); } real ParticleContact::calculateSeparatingVelocity() const { Vector3 relativeVelocity = particle[0]->getVelocity(); ...
ALGO
0.999109
6.595451
91eac8bf-0caa-4899-b9d8-2912e521d0e6
Dhruv942/Leetcode
Combination sum 2.cpp
class Solution { public: void solve(vector<int>& candidates, int target, vector<int> curr, vector<vector<int>>& result, int idx) { if(target < 0) return; if(target == 0) { result.push_back(curr); return; } for(int i = idx; i<candidates.siz...
ALGO
0.999957
6.423618
f564aad1-5b9c-4bd7-9d6a-0a676ee77745
Devupadhyayaa/ReviseWithArsh-6Companies30Days-Challenge.
Maximum Sum BST.cpp
int sum; vector<int>solve(TreeNode* node){ if(node==NULL){ vector<int>temp(3); temp[1]=INT_MIN; temp[2]=INT_MAX; return temp; } vector<int>lft=solve(node->left); vector<int>rt=solve(node->right); int x=node->val; if(lft[1]<x&&rt[2]>x){ int ans=lft[0]+rt[0]...
ALGO
0.999998
6.633116
6651b87e-76f3-4dde-a72d-93560fce6cca
KmrAman/LeetCode-Problems-Solutions
2181-merge-nodes-in-between-zeros/2181-merge-nodes-in-between-zeros.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* mergeNodes(...
ALGO
0.999963
5.321656
051cd4a9-cf5b-4082-b3d5-ce0272d79072
SMiles02/CompetitiveProgramming
AtCoder/ZONE2021D.cpp
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size() using namespace std; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //uniform_int_distribution<int>(1000,10000)(rng) ll binpow(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res = r...
ALGO
0.999921
3.912173
7e1da057-0758-4f9f-8f15-5c2f562b8003
BrandonHe/leetcode
94.Binary_Tree_Inorder_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) {} }; **/ // Solution 1: Traversal Solution class Solution { public: vector<int> inorderTraversal(TreeNode *root) { vector<int> inorderT; stack<TreeNode ...
ALGO
0.999996
6.250872
f5e98977-e638-49f2-b4ae-a976530a2281
zhehaoli1999/DiffFR
SPlisHSPlasH/Utilities/PoissonDiskSampling.cpp
#include "PoissonDiskSampling.h" #include <algorithm> #include <limits> #include <iostream> #include <fstream> #include <string> #define _USE_MATH_DEFINES #include "math.h" using namespace std; using namespace Eigen; using namespace SPH; PoissonDiskSampling::PoissonDiskSampling() { } void PoissonDiskSampling::sam...
ALGO
0.999212
3.638354
06372af4-f432-486b-b82f-240bec6d81b1
syxm1/competitive-programming
online-judge/cses/graph/building-roads.cpp
#include <bits/stdc++.h> using namespace std; #ifdef debug #define trace(x) cerr << #x << ": " << x << '\n' #else #define trace(x) #endif #define int int64_t int n, m; vector<int> par, sz; int get(int u) { return par[u] = (par[u] == u ? u : get(par[u])); } void merge(int u, int v) { u = get(u); v = get(v); ...
ALGO
0.999981
4.813418
e34a8360-69ba-447b-84b8-15f133c6cd13
PappAZsolt/CodeForces-Solutions
A/281/281A.cpp
#include <cstring> #include <iostream> #include <string> using namespace std; int main() { string a; cin >> a; a[0] = toupper(a[0]); cout << a; }
ALGO
0.987836
4.108979
e2ece0eb-4358-40da-9334-3555e3edaff8
stefanreuther/c2ng
game/msg/browser.cpp
/** * \file game/msg/browser.cpp * \brief Class game::msg::Browser */ #include "game/msg/browser.hpp" #include "game/msg/configuration.hpp" #include "game/msg/mailbox.hpp" class game::msg::Browser::Acceptor { public: virtual bool accept(size_t index) const = 0; }; class game::msg::Browser::BrowseAccepto...
TOOL
0.918158
6.436331
f31db4c8-8753-44fc-b2dd-5b82fb84b18e
raincross7/code-similarity
codes/train_code/problem216/problem216_291.cpp
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,b,a) for(int i=b;i>=a;i--) #define fori(a) for(auto i : a ) #define all(a) begin(a), end(a) #define set(a,b) memset(a,b,sizeof(a)) #define sz(a) a.size() #define pi 3.14159 #define ll long long #define ull unsigned long long #define pb push...
ALGO
0.999977
4.257303
7203e635-18c9-4227-ae79-21bbd493252c
ishandutta2007/codeforces
timmyfeng/normal/1491/E.cpp
#include <bits/stdc++.h> using namespace std; const int N = 200000 + 1; const int L = 32; vector<int> adj[N], component; int f[L], par[N], sub[N]; void dfs(int u) { sub[u] = 1; for (auto c : adj[u]) { if (c != par[u]) { par[c] = u; dfs(c); sub[u] += sub[c]; ...
ALGO
0.999988
4.795981
6ec8b5d0-69ad-4b58-8e8b-bb0feb56e2ee
AkashKumarSingh11032001/GeeksForGeeks---Self_Paced_Course
4. Recurssion/rough.cpp
#include<iostream> using namespace std; int main(int argc, char const *argv[]) { int n; cin>>n; if(n==1) { cout<<1; return 0; } for(int i=1;i<n;i++){ cout<<" "; } cout<<'1'<<endl; //Upper for(int i=2;i<=(n+1)/2;i++){ //Print Spaces for(int j=1;j<=n-(2*i-1);j++){ cout<<" ...
ALGO
0.999982
3.659858
ead43315-a234-4348-b85f-e3bd988d633e
raincross7/code-similarity
codes/train_code/problem286/problem286_76.cpp
#include<iostream> #include<string> #include<string.h> #include<algorithm> #include<stdio.h> #include<cmath> #include<vector> #include<utility> #include<stack> #include<queue> #include<list> #include<bitset> #include<functional> #define FOR(i, a, b) for(long long int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(long lo...
ALGO
0.999643
3.728113
d9e653af-9449-473e-9ef1-c7a7f9aecc48
burugaria7/AtCoder
HHKB プログラミングコンテスト 2020/C.cpp
#include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long...
ALGO
0.999287
3.558667
46218117-8563-41de-8830-c4c7e156b3e4
joha546/Competitive-Programming-Practice
Basics/Arrays/palindrome.cpp
// Online C++ compiler to run C++ program online #include <iostream> using namespace std; int main() { int n; cin>>n; int arr[n]; for(int i=0; i<n; i++){ cin>>arr[i]; } bool flag=true; for(int i=0; i<n; i++){ if(arr[i] !=arr[n-i-1]){ flag=false; } } ...
ALGO
0.999993
4.213155
95f9f320-e2cc-4891-b85c-6f2427478aa5
mayank7jha1/ISA_FEB2
19. lecture, STL/main.cpp
#include <iostream> using namespace std; int main() { int var = 5; int* ptr; ptr = &var; cout << "value of var: " << var << '\n'; cout << "Address of var: "<< &var << '\n'; cout << ptr << '\n'; cout << *ptr << '\n'; cout << &ptr << '\n'; }
ALGO
0.928741
4.023811
1c201044-9b11-4d25-8d6c-77402f4e608f
aniketraj1615/CPP_Codes
queue_using_array.cpp
#include <bits/stdc++.h> using namespace std; struct queuee { int size; int *s; int front; int rear; } ; void create(struct queuee *q) { cout << "enter the size of queue" << endl; cin >> q->size; q->front = -1; q->rear = -1; q->s = (int *)malloc(q->size*sizeof(int)); } void enqueuee(...
ALGO
0.997012
3.8758
aa26b108-414e-4bf8-a9d5-10cdd0c46232
rohandagale28/DSA-CPP
StriverProblem/UsingVector.cpp
#include <iostream> // preprocessor directive #include <vector> using namespace std; class Solution { public: void setZeroes(vector<vector<int>> &matrix) { int rows = matrix.size(); int cols = matrix[0].size(); // Initialize row and col vectors to store the rows and columns to be zeroe...
ALGO
0.999528
7.685524
3c2def19-b87d-4d8e-aa13-0913973207ae
Alien166/Vjudge
1535A - Fair Playoff.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n,a,b,c,d; cin>>n; while(n--){ cin>>a>>b>>c>>d; if(max(a,b)>min(c,d) && max(c,d)>min(a,b)) cout<<"YES\n"; else cout<<"NO\n"; } }
ALGO
0.999757
3.8929
38362efc-0a16-48bc-a44b-9368463a1c8f
mustafizz007/os_algorithms
New folder/producer consumer problem.cpp
#include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #define BUFFER_SIZE 5 #include<bits/stdc++.h> #define BUFFER_SIZE 5 int buffer[BUFFER_SIZE]; // Shared buffer int count = 0; // Keeps track of how many items are in the buffer sem_t empty, full; // Semaphores for ma...
ALGO
0.98641
5.932862
0e6f7d89-2850-4709-8359-2e4e8bee733e
dretoba91/flutter-widgets
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.9988
6.76073
459f6ae1-ca96-43a3-b04a-1fdf1d13b56f
STkirito/maquetadodesine
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.998859
6.785645
595af656-9ad0-443a-a7f6-81aa247a32bb
AfiaNahian/Problem-Solving-with-C_C_plus_plus
CodeForces_training_contest/8M.cpp
#include <iostream> #include <algorithm> using namespace std; int main() { int a,b,c,d,e,f; cin >>a>>b>>c; int x[]={a,b,c}; sort(x,x+3); d=x[2]-x[1]; e=x[1]-x[0]; f=d+e; cout<<f<<endl; return 0; }
ALGO
0.999825
3.215806
e9823c92-8749-472c-b3cb-b49430773380
abdulrahman9901/LeetCode-solutions
Manually added/lru-cache/Wrong Answer/7-18-2023, 4_11_21 PM/Solution.cpp
// https://leetcode.com/problems/lru-cache class LRUCache { map<int, pair<int, int> > cache; int cap = 0 ; bool used[10001] = {false}; int timestamp = 0; public: LRUCache(int capacity) { cap = capacity; } int get(int key) { if(used[key]){ cache[key].second =...
ALGO
0.999645
6.591983
bb6dcda8-2333-4b37-bc14-6dda52e57b74
Ananya281/LeetCode
2188-minimized-maximum-of-products-distributed-to-any-store/minimized-maximum-of-products-distributed-to-any-store.cpp
class Solution { public: long long fun(vector<int>&quantities,int mid) { int n=quantities.size(); long long total=0; for(int i=0;i<n;i++) { total=total+(long long)ceil((double)quantities[i]/mid); } return total; } int minimizedMaximum(int n, ve...
ALGO
0.999995
5.942259
59ee5916-94f9-45b8-ab29-bc1133267dbe
muschellij2/FSL6.0.0
src/miscmaths/Simplex.cpp
/*! \file Simplex.cpp \brief Contains definitions of Simplex class that can be used for Nelder-Mead simplex minimisation. \author Jesper Andersson \version 1.0b, Oct., 2013. */ #include <iostream> #include <cfloat> #include <cmath> #include <limits> #include <string> #include <vector> #include "newmat.h" ...
ALGO
0.999959
6.013022
1f743abf-5962-45bb-979d-f5f3bb768466
Donglidishu/Cpp_Beginner_Tutorial
Part3_C++提高编程/224.set大小和交换.cpp
#include <iostream> #include <set> using namespace std; void printSet(set<int> &s) { for (set<int>::iterator it = s.begin(); it != s.end(); it++) { cout << *it << " "; } cout << endl; } void test01() { set<int> s1; s1.insert(10); s1.insert(40); s1.insert(30); s1.insert(20);...
TOOL
0.927704
3.990017
e449d908-11dd-4f3e-b2a7-3bfffcd081ea
Nekel-Seyew/Complex-3D-Vector-Fields
dlib-18.18/examples/train_shape_predictor_ex.cpp
/* This example program shows how to use dlib's implementation of the paper: One Millisecond Face Alignment with an Ensemble of Regression Trees by Vahid Kazemi and Josephine Sullivan, CVPR 2014 In particular, we will train a face landmarking model based on a small dataset and then ev...
ALGO
0.975849
6.7321
f563bfec-0796-48e6-af07-7ca0db67f083
ldnelson16/routeOptimizer
Map/location.cpp
#include "Location.hpp" #include "Path.hpp" #include "Route.hpp" // FORWARD DECLARATION class GeoMap; using namespace std; std::string Location::str(bool concise) const { if (concise) { return "Name: "+name; } else { ostringstream loc_info; loc_info << "Name: "<<name<<"\n(Lat,Lon): "<<*coords<<")\n...
TOOL
0.863981
6.306019
0701a955-3cc7-4d97-9baa-ad25c6887215
AayushPratapBansal/DSA-QUESTION
382-linked-list-random-node/linked-list-random-node.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* head; int sz = ...
ALGO
0.998859
5.313221
db02f9c2-63e2-45fb-9d12-742905d53224
Kardel-Chen/Sol
Solution.cpp
// // Created by kardel on 4/12/22. // #include "Solution.h" #include <iostream> using namespace std; /* * Overview: * 1. determine the decoding method: utf-8/unicode/GBK (to-do) * 2. According to the decoding method, find the range of chinese character * 3. normally english character takes 1 byte, and is positive...
ALGO
0.999256
4.535781
cacdf3ed-9391-4782-a629-442fb9ce7b62
Jaechan-So/ps-public
problems/leetcode/0100/122.cpp
// 122. Best Time to Buy and Sell Stock II // https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/ using namespace std; #include <vector> class Solution { public: int maxProfit(vector<int> &prices) { int n = prices.size(), profit = 0; for (int i = 1; i < n; i++) { int diff =...
ALGO
0.999199
6.385921