uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
e7c4f5ac-49da-47c4-bde6-52905fbb07eb
ADARSH-41/CPP_BASICS
input-output.cpp
#include<iostream> using namespace std; int main() { int a,b,c; cout << " Value of a : "; // prompts user for value of 'a'. cin >> a ; // takes input value from user and stores it in address of 'a'. cout << "\n Value of b : "; // prompts user for value of 'b'. cin >> b ; // takes input value from use...
ALGO
0.971854
3.726909
66340e2a-cd62-4c53-9f8a-2eab5f4b7625
JJHWAN/Bakjoon
Math/2609.cpp
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> #include <algorithm> #include <memory.h> using namespace std; int gcd(int x, int y) { if (!y) return x; return gcd(y, x % y); } int main(void) { int a, b, r1, r2; scanf("%d %d", &a, &b); r1 = gcd(a, b); r2 = a * b / r1; printf("%d\n%d\n"...
ALGO
0.999735
3.934897
21d668c5-43d6-412a-aa74-e84abbf4677b
michaelhuo/cpp
find_buy_sell_stock_prices_2.cpp
#include <climits> #include <cstdlib> tuple<int, int> find_buy_sell_stock_prices(int* array, int size) { //TODO: Write - Your - Code if (!array || size < 2) { tuple<int, int> tmp(std::make_pair(-1, -1)); return tmp; } int buy_price = array[0], sell_price = array[1]; int min_buy_price = buy_price, ma...
ALGO
0.999226
5.539788
1f829c71-a2b5-471f-80f5-2eeaa4d3d1ac
anant-pushkar/competetive_programming_codes
competitive_programming/Query_on_a_tree_II/main.cpp
/* Project name : Query_on_a_tree_II Created on : Sun Aug 3 09:47:53 2014 Author : Anant Pushkar http://www.spoj.com/problems/QTREE2/ */ #include<iostream> #include<cstring> #include<cstdio> #include<deque> #include<queue> #include<utility> #include<vector> #include<climits> #include<algorithm> #include<stack> #includ...
ALGO
0.999103
4.267891
b5cd2371-46c1-41ca-9a00-fd84c139f678
shreyansh28801/StriverCpSheet
Math/q21.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long int li; typedef long double ld; #define lb lower_bound #define ub upper_bound #define pub push_back #define pob pop_back typedef long double ld; /* const int N = 1e7+10 ; vector<int> A(N) ; */ int main() { ios_base::sync_with_std...
ALGO
0.998991
3.708945
31d4b478-c118-48f4-8c4f-712b33ef9f1d
Suryadev25/Codeforces
GCD_LCM.cpp
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; cout << n - 3 << " 1" << " 1" << " 1" << endl; } ...
ALGO
0.998945
3.594961
04427f24-407d-46e1-beeb-2ff5b6ed3b93
n1ghtk1ng/DSA
Coding Blocks/lpfall 2016/Coding-Problems-master/Coding/Rough Codes/pqr.cpp
#include<iostream> #include<math.h> #include<cstdio> #include<fstream> using namespace std; #define int long long int checkSquare(int a) { int x,valid=1; while(a!=0){ x=a%10; a=a/10; if(x==9||x==4||x==1||x==0) continue; else return 0; } return valid; } main(){ int t,a,b,...
ALGO
0.99924
3.521686
2286395a-4b51-4abe-b4f2-d5494e2a4a25
dimensionofficial/Dimension-E
contracts/libc++/upstream/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp
// <algorithm> // template<InputIterator InIter, class OutIter, // Callable<auto, const InIter::value_type&> Op> // requires OutputIterator<OutIter, Op::result_type> && CopyConstructible<Op> // OutIter // transform(InIter first, InIter last, OutIter result, Op op); #include <algorithm> #include <functi...
TEST
0.86834
6.897259
56b1c935-e902-4713-832f-9af64f531388
tahsinsoha/Problem-solving-
Codeforces/free cash.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[100007],brr[100007]; for(int i=0; i<n; i++) { cin>>arr[i]>>brr[i]; } int cnt=1; int maxx=1; for(int i=0; i<n-1; i++) { if(arr[i]==arr[i+1] && brr[i]==brr[i+1]) { ...
ALGO
0.999855
3.638853
4a7a835f-2476-493d-9ba4-1b656c22106d
uhini0201/Career-Track-Coding-NInjas-
Introduction To C++/Operators and For Loop/Square Root(Integral).cpp
#include<iostream> using namespace std; int main() { int n; cin>>n; int i; for(i=1;i*i<=n;i++) cout<<i-1; }
ALGO
0.999889
3.005443
a3b3e7c5-eb9f-4cc3-8c75-36bb899c7e5f
Revolyssup/concurrency-in-cpp
atomcs and different memory modelss/mutex-condVar.cpp
/*Synchronizing two threads accessing shared variable using condition_variable library and non-atomic bool*/ #include<iostream> #include<condition_variable> #include<thread> #include<vector> #include <sstream> /*This conVar will create a channel between the threads where they can listen and notify each other throug...
TOOL
0.998483
4.89879
e3337fef-f9da-4b07-8c1b-aff217dcf9cf
RudraPankaj/Codeforces-Solutions
Contest2094-B.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m, l, r; cin >> n >> m >> l >> r; int current_l = 0, current_r = 0; int spread_cnt = 0; for (int day = 1; day <= m; day++) { if (current_l > l) { ...
ALGO
0.999786
3.273132
c73eaa63-c3f1-4876-a1b1-70418cdb1cc9
Scrubpai/Competitive-Programming
DMOJ/DMOPC/DMOPC '18 Contest 6 P3 - Wish Upon a Star.cpp
#include <bits/stdc++.h> using namespace std; int n, m, cnt, diset[200001]; int Find(int x){ return diset[x] == x ? x : diset[x] = Find(diset[x]); } void unite (int x, int y){ diset[Find(x)] = Find(y); } int main(){ cin.sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) dise...
ALGO
0.999991
5.11567
bebb4c52-c011-4250-9dd1-efe630ebfdb3
OpenNetworkingFoundation/xranc
enbsim/config.cpp
#include <iostream> #include <fstream> #include <jsoncpp/json/json.h> #include <config.h> #include <string.h> Config* Config::pInstance = NULL; Config* Config::Instance() { if (!pInstance) pInstance = new Config; return pInstance; } void Config::parse(string config_file) { Json::Reader reader; ...
CONFIG
0.896113
4.517876
6b0c34df-3f88-4b1a-af60-39fbdd6dde71
debobanerjee/MOBCCWR
Datasets/Amazon-1/create_graph.cpp
#include<bits/stdc++.h> using namespace std; double RATE = 1; signed main() { freopen("preprocess_data_generated.txt", "r", stdin); freopen("input_graph.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int numOutfits; cin >> numOutfits; int numItems = 0; ma...
ALGO
0.992851
4.035983
b2aad02a-2d6a-431b-aea3-58eed08c509c
eerrjhj/CP-Solutions
CodeChef/C++14/KOL15A/54301970.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { string s; cin >> s; int n=s.length(); int sum=0; for(int i=0;i<n;i++) { char c=s[i]; int b=(int)c; if(b>=48 && b<=57) {...
ALGO
0.999774
4.602229
8f609fe1-35e3-4c35-bc3d-aeb1c3f924ff
raincross7/code-similarity
codes/train_code/problem199/problem199_70.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define FOR(i,x,n) for(int i=x; i<(n); i++) #define ALL(n) begin(n),end(n) #define MOD (1000000007) #define INF (2e9) #define INFL (2e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; using vint=vec...
ALGO
0.999933
3.799804
34beb6ec-3b61-47db-9066-20893c26744b
cile/android_frameworks_av
media/libstagefright/codecs/amrnb/dec/src/d2_11pf.cpp
/* ------------------------------------------------------------------------------ Pathname: ./audio/gsm-amr/c/src/d2_11pf.c Functions: Date: 01/28/2002 ------------------------------------------------------------------------------ REVISION HISTORY Description: Modified to place file in the correct template...
ALGO
0.999327
6.461542
8d40fb1b-72d4-498f-9663-fcd7a0274d32
Domsmasher1/Realistic-Terain-Creation
Features/Erosion/Implementing/Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp
#include <iostream> #include <sstream> #include <string> #include <filesystem> #include <windows.h> #include <shlwapi.h> #include "BStrHolder.h" #include "ComPtr.h" #include "dte80a.tlh" constexpr int RETRY_INTERVAL_MS = 150; constexpr int TIMEOUT_MS = 10000; // Often a DTE call made to Visual Studio can fail after ...
TOOL
0.975822
6.947423
4b66f20f-cc3f-49e1-bf52-c016e9510138
swatantragoswami09/Amazon_SDE_Test_Series_solutions
Maximum of all subarrays of size k.cpp
#include <bits/stdc++.h> using namespace std; // } Driver Code Ends void max_of_subarrays(int *arr, int n, int k){ deque<int> dq; for(int i=0;i<k;i++) { while(!dq.empty() && arr[i]>=arr[dq.back()]) dq.pop_back(); dq.push_back(i); } for(int i=k;i<n;i++) { co...
ALGO
0.999975
5.087693
1db1c0d9-6478-4033-b497-b823fdf2d1a0
1253984007/unityphone
Unity-iPhone/Unity-iPhone/Il2CppOutputProject/IL2CPP/libil2cpp/icalls/mscorlib/System/RuntimeType.cpp
#include "il2cpp-config.h" #include "il2cpp-runtime-metadata.h" #include "il2cpp-api.h" #include "il2cpp-tabledefs.h" #include "mono-structs.h" #include "RuntimeType.h" #include "RuntimeTypeHandle.h" #include "Type.h" #include "metadata/GenericMetadata.h" #include "utils/Functional.h" #include "utils/Il2CppHashSet.h" ...
TOOL
0.945169
5.850255
c41408f1-910a-4e86-afaf-b1c78b859819
tal-tech/Solution_for_Classroom_Quality_Monitoring_of_English_Classroom_Teachers
offline-asr-sub-e2e-asr/chrome-base/third_party/icu/source/test/perf/howExpensiveIs/sieve.cpp
#include "unicode/utimer.h" #include <stdio.h> #include <math.h> #include <stdlib.h> #include "sieve.h" /* prime number sieve */ U_CAPI double uprv_calcSieveTime() { #if 1 #define SIEVE_SIZE U_LOTS_OF_TIMES /* standardized size */ #else #define SIEVE_SIZE <something_smaller> #endif #define SIEVE_PRINT 0 char si...
ALGO
0.999123
5.941725
170554e8-91cc-47c4-9fef-c6415aad39f1
ajioka2310/AtCoder
ABC/bk/abc073/d/main.cpp
// abc073 D - joisino's travel // abc046 B - Painting Balls with AtCoDeer #ifdef DEFINED_ONLY_IN_LOCAL #include "/workspaces/AtCoder-cpp-env-main/cpp-dump/cpp-dump.hpp" // <次のセクションの内容はここに追加する> #define dump(...) cpp_dump(__VA_ARGS__) namespace cp = cpp_dump; CPP_DUMP_SET_OPTION_GLOBAL(max_line_width, 80); CPP_DUMP_SET_O...
ALGO
0.999921
4.284038
c17ffb99-94a2-42c5-b01f-44f75f595ed5
Yang9999999/HDU-data_structure
实验1-4.cpp
#include <stdio.h> #include <stdlib.h> #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define INFEASIBLE -1 #define OVERFLOW -2 typedef int Status; typedef struct { char *ch; //Ƿǿմ򰴴洢chΪNULL int length; // } HString; //ѷ䴮Ͷ Status InitString(HString &S){ S.ch=NULL;...
ALGO
0.997727
3.508867
75b12102-0c17-44a8-a786-d9597b063ebf
3DPIT/study
02.studyData/10.Algorithm/2022/11/1105/AlgorithmStudy/AlgorithmStudy/구슬탈출2.cpp
#include <stdio.h> #include <iostream> #include <queue> #define NSIZE 14 #define MSIZE 14 using namespace std; int N, M, ret; char board[NSIZE][MSIZE]; int visit[NSIZE][NSIZE][NSIZE][NSIZE]; int dy[] = { 0,1,0,-1 }; int dx[] = { 1,0,-1,0 }; struct Data { int ry, rx, by, bx, cnt; }; Data initPos; bool safeZone(int y,...
ALGO
0.999818
4.335121
e2e9a7ec-ff0a-480b-b0bb-bc13ade63f39
rafcabezas/commadumps
selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.cpp
extern "C" { #include "acado_common.h" } #include "INCLUDE/QProblem.hpp" #if ACADO_COMPUTE_COVARIANCE_MATRIX == 1 #include "INCLUDE/EXTRAS/SolutionAnalysis.hpp" #endif /* ACADO_COMPUTE_COVARIANCE_MATRIX */ static int acado_nWSR; #if ACADO_COMPUTE_COVARIANCE_MATRIX == 1 static SolutionAnalysis acado_sa; #endif /* AC...
ALGO
0.99893
5.070384
1a3cf95e-0717-4aed-b9e2-bda8d5f5a7bb
abhijeetjadhav1427/leetcode
pascals-triangle/pascals-triangle.cpp
class Solution { public: vector<vector<int>> generate(int numRows) { vector<vector<int>> ans(numRows); for(int i=0; i<numRows; i++){ ans[i] = vector<int>(i+1); for(int j=0; j<=i; j++){ if(j==0 || j==i) ans[i][j]=1; else{ ...
ALGO
0.999971
5.766455
3496d90d-dbe1-41e2-8a85-ee539d19dff0
nagasai1155/cppcompleteandDSAalso
Striver/sortingtechniques/bubble.cpp
#include <iostream> using namespace std; void bubble_sort(int arr[], int n){ for(int i=n-1 ;i>=1 ;i--){ for(int j=0;j<=i-1;j++){ if(arr[j] > arr[j+1]){ int temp = arr[j+1]; arr[j+1] = arr[j]; arr[j] = temp; } ...
ALGO
0.999417
4.283316
d8084ea8-fbd2-433e-bd08-6e0c9f41ccbd
JrSousaJ/Uri-Solved-Problems
1790.cpp
#include<bits/stdc++.h> using namespace std; int k,a; vector<vector<int> > v; int vis[50]; void dfs(int x) { vis[x] = 1; for (int i=0;i<v[x].size();i++) { int u = v[x][i]; if(!vis[u]) { dfs(u); } else if(vis[u]==1) { vis[u] == 3; return ; } } vis[x] = 2; } int main() { while(~scanf("%d %...
ALGO
0.999228
3.452727
a7f580ca-e606-4767-b614-50908d51d946
trx594324215/lab4_test
software_1/查找/散列查找.cpp
#include <iostream> #define B 10000 #include <fstream> using namespace std; struct records { long int key; }; struct search_type { records data; search_type *next; }; typedef search_type *search_ptr; //ɢбͣBΪͰ typedef cellptr HASH[B] typedef search_ptr HASH[B]; int h_key(int k) { int m,n,o; m = k % 10000; ...
ALGO
0.999608
3.232288
93d618b5-1490-42ae-bf3c-522667185421
Bcoding21/HangMan2
Source.cpp
#include <iostream> #include "AI.h" #include "Game.h" int main() { int wordSize = 0; std::cout << "Enter length of word: "; std::cin >> wordSize; int numTires; std::cout << "Enter number of tries for AI: "; std::cin >> numTires; Game game(wordSize, numTires); AI computer(wordSize); while (true) { game...
TOOL
0.957388
5.132273
19d4f040-8982-4032-9ba5-0ef255806ed5
kkpan11/apple-llvm-project
libcxx/test/std/algorithms/alg.modifying.operations/alg.remove/ranges_remove_copy_if.pass.cpp
// UNSUPPORTED: c++03, c++11, c++14, c++17 // <algorithm> // template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, // class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> // requires indirectly_copyable<I, O> // constexpr remove_copy_if_result<I, O> // remove_copy...
TEST
0.941246
7.903327
758740f8-57ce-465a-9ac1-069cec50d56f
CharlieFour/ChainFlow
lib/sha256.cpp
#include "sha256.h" // SHA-256 implementation std::string sha256(const std::string& data) { // Padding the data to make it a multiple of 512 bits std::vector<unsigned char> message; for(size_t i = 0; i < data.size(); ++i) { message.push_back(static_cast<unsigned char>(data[i])); } // A...
ALGO
0.987839
7.188215
7b2d6cdf-3604-47a0-9721-503f15115673
lchacin/leetcodeQuestions
FindMinimumAreaToCoverOnes.cpp
/* 3195. Find the Minimum Area to Cover All Ones I You are given a 2D binary array grid. Find a rectangle with horizontal and vertical sides with the smallest area, such that all the 1's in grid lie inside this rectangle. Return the minimum possible area of the rectangle. Constraints: 1 <= grid.length, grid[i].le...
ALGO
0.999811
6.586315
34f476fb-b9dd-4473-9f28-b7b72c715792
mayankongithub/C--
Graphs/topological_sort.cpp
// #include<iostream> // #include<vector> // #include<stack> // using namespace std; // void dfs(int node,vector<vector<int>>&adj,vector<int>&ans,vector<bool>&visited,stack<int>&st){ // visited[node] = 1; // ans.push_back(node); // for(int i=0;i<adj[node].size();i++){ // if(!visited[adj[node][i]]){ ...
ALGO
0.999982
5.484962
693b6339-dc61-4d21-9a14-3fb5bfaefebc
GodSlayer32/Tarea-Algoco
Tarea 1/ord_mat/ord_opt.cpp
#include <iostream> #include <vector> using namespace std; /** * @brief Transpone una matriz, intercambiando filas por columnas. * * @param matrix Matriz original a transponer. * @return vector<vector<int>> Matriz transpuesta. */ vector<vector<int>> transposeMatrix(const vector<vector<int>>& matrix) { int...
ALGO
0.999952
5.036793
8ecc22c8-871a-4338-b294-47e5c681a370
neutrinoxtronicmaster/hello-algo
codes/cpp/chapter_searching/binary_search_edge.cpp
/** * File: binary_search_edge.cpp * Created Time: 2023-08-04 * Author: krahets (<EMAIL>) */ #include "../utils/common.hpp" /* 二分查找插入点(存在重复元素) */ int binarySearchInsertion(const vector<int> &nums, int target) { int i = 0, j = nums.size() - 1; // 初始化双闭区间 [0, n-1] while (i <= j) { int m = i + (j - i...
ALGO
0.999925
6.15285
5e6144f8-f4e8-4af9-861f-11edc913b972
theodorekim/QUIJIBO
src/TOUPEE/BLMVM.cpp
// This is a port of the Toolkit for Advanced Optimiation (TAO): // // http://www.mcs.anl.gov/research/projects/tao/ // // but with all the PETSc dependnecies removed. // TAO Without PETSc -> T W/O Pe -> TOUPEE #include "BLMVM.h" #include <iostream> using namespace std; ////////////////////////////////////////////...
ALGO
0.997272
6.089996
97019f94-c3f1-4d70-b6b4-dd58c84a36b2
Qkite1/ros_robot_tasks
aubo_ws/src/industrial_core/industrial_trajectory_filters/src/smoothing_trajectory_filter.cpp
/* Author: Chris Lewis */ #include <industrial_trajectory_filters/smoothing_trajectory_filter.h> #include <console_bridge/console.h> #include <moveit/robot_state/conversions.h> #include <stdio.h> #include <ros/ros.h> #include <ros/console.h> namespace industrial_trajectory_filters { SmoothingTrajectoryFilter::Smo...
ALGO
0.994694
5.222758
1aa43942-f464-44fa-8a46-65993716503d
Ayushkumar48/128DaysofCodeStreak
Day58.cpp
//LeetCode // 203. Remove Linked List Elements /** * 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) {} * }; */ cl...
ALGO
0.999698
3.278304
b7380806-7b7c-4c7c-9fd8-25c02582a3cf
ishandutta2007/codeforces
rivalq/normal/1148/C.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<vl> vvl; double EPS = 1e-9; int...
ALGO
0.999903
3.184241
30c05879-75a6-458a-b88f-9e540a92b640
ishandutta2007/codeforces
molamola/normal/1054/B.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> #include <unordered_set> #include <list> #include ...
ALGO
0.999972
3.513368
a89a9d83-99a3-449d-8e8c-59cb19e99d56
papum20/tasks__old
preparazione-OII/[OII]Historical revisionism/src/[OII]Historical revisionism.cpp
#include <iostream> //#include <unordered_map> //#include <vector> using namespace std; int N, mn = 299; int V[300]; //unordered_map <int, vector <int> > dpMn; //estremi mn //unordered_map <int, vector <int> > dpMx; //estremi mx void ricorsiva(int pos, int used, bool high, int higher, int lower) //bool high/low { c...
ALGO
0.999886
3.876194
08d7ffc5-ac8b-4f98-909e-1dc4d50d4999
Oleur/android-unity-as-library-sample
unityLibrary/src/main/Il2CppOutputProject/IL2CPP/libil2cpp/mono/ThreadPool/threadpool-ms.cpp
#include "il2cpp-config.h" #include <stdlib.h> #define _USE_MATH_DEFINES // needed by MSVC to define math constants #include <algorithm> #include <cmath> #include <complex> #include "math.h" #include "il2cpp-api.h" #include "gc/GarbageCollector.h" #include "gc/GCHandle.h" #include "gc/WriteBarrier.h" #include "icalls...
TOOL
0.965023
5.932903
56d6adc4-25b7-4084-8207-724e9ff63f7e
M-CreativeLab/nodejs-android
deps/icu-small/source/common/punycode.cpp
/* This ICU code derived from: */ /* * ICU modifications: * - ICU data types and coding conventions * - ICU string buffer handling with implicit source lengths * and destination preflighting * - UTF-16 handling */ #include "unicode/utypes.h" #if !UCONFIG_NO_IDNA #include "unicode/ustring.h" #include "unicod...
TOOL
0.875315
3.958666
a8c69309-35a9-4ac0-8072-b8f7d98097e8
amanullah7649/Programming
Codeforces/Problem_B/Replace and Keep Sorted.cpp
/* *************** BISMILLAH HIR RAHMANIR RAHIM *************** AUTHOR: MD.AMANULLHA UNIVERSITY OF LIBERAL ARTS BANGLADESH DATE: / / 2021 */ #include<bits/stdc++.h> #define endl '\n' #define PI acos(-1.0) #define pf printf #define sf scanf #defin...
ALGO
0.999929
3.962727
6ac48fbb-12f1-424d-a11f-905716dffd21
yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18
cpp/algorithms/dfs_directed.cpp
#include<iostream> #include<unordered_map> #include<list> using namespace std; //CB IDE - 15896 class Graph{ unordered_map<char,list<char> > m; public: void addEdge(char u,char v,bool bidir=true){ m[u].push_back(v); if(bidir){ m[v].push_back(u); } } bool isCyclicHelper(char s,unordered_map<char,bool> ...
ALGO
0.99995
4.733771
cfc9b488-bc70-4653-9e98-71e54e916813
foorhad/basic-data-structure
Mod 13 Stack implementation and STL/stack_using_array.cpp
#include <iostream> // Input/output streams (cin, cout, cerr, etc.) #include <fstream> // File streams (for file input/output) #include <iomanip> // Input/output manipulators (for formatting) #include <string> // String manipulation #include <vector> // Dynamic arrays #include <list> /...
ALGO
0.99603
4.0795
b9f0fed9-90fc-48d9-9cd0-1561a1dbd155
HuangYing22/ProjectEuler
PE003.cpp
//The prime factors of 13195 are 5, 7, 13 and 29. //What is the largest prime factor of the number 600851475143 ? //Bigger than max unsigned int 4294967295 #include <iostream> #include<vector> using namespace std; bool isPrime(int num) { for(int i = 2; (i*i) < num; i++) { if (num % i == 0) { r...
ALGO
0.999936
4.698413
fb886800-925a-4b23-b643-dfd701a1ce8a
sunputawan/POSNC-Archive
POSNC/2564/pre toi/camp/Day 3/robot.cpp
#include <bits/stdc++.h> using namespace std; char a[2005][2005]; bool visited[2005][2005]; int n,m; struct coor{ int x,y,cnt; }; vector<pair<int,int>> dir = {{0,1},{0,-1},{1,0},{-1,0}}; int main(){ queue<coor> q; cin>>n>>m; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; ...
ALGO
0.999962
3.965856
6c0192f4-e2b0-4775-b733-2bad366a9ab5
heiseish/Competitive-Programming
cf/contest/158/a/a.cpp
/** If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe. */ #include <bits/stdc++.h> using namespace std; auto solve() -> void { int n,k; cin >> n >> k; vector<int> a(n); int ans = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; ...
ALGO
0.999962
4.477505
88aee85a-1294-4af3-b1e1-1167d7568afd
jiadaizhao/LintCode
0401-0500/0412-Candy/0412-Candy.cpp
class Solution { public: /* * @param ratings: Children's ratings * @return: the minimum candies you must give */ int candy(vector<int> &ratings) { // write your code here int n = ratings.size(); vector<int> count(n, 1); for (int i = 1; i < n; ++i) { if ...
ALGO
0.999997
6.354892
8499dff9-d39d-4ddc-a743-6d965a5cd006
Soldann/MORB_SLAM
Thirdparty/g2o/g2o/core/optimization_algorithm_with_hessian.cpp
#include "optimization_algorithm_with_hessian.h" #include "solver.h" #include "optimizable_graph.h" #include "sparse_optimizer.h" #include <iostream> using namespace std; namespace g2o { OptimizationAlgorithmWithHessian::OptimizationAlgorithmWithHessian(Solver* solver) : OptimizationAlgorithm(), _solver(s...
ALGO
0.991705
6.811634
5d448f8d-f6a4-47cd-aca1-1f22417e63e6
vasavagyan/homeworks
amrapndoxner/amrapndox 28.cpp
#include <iostream> int odd_nums(int arr[], int col); int main(){ const int Size=5; std::cout<<"enter numbers:"<<std::endl; int array[Size]; for (int i=0; i<Size; ++i){ std::cin>>array[i]; } std::cout<<"the quantity of odd numbers is: " <<odd_nums(array, Size)<<std::endl; return 0; } int ...
ALGO
0.998258
4.966403
d0bae94f-d482-4e6d-be04-f991eed7f6d2
Slidejiveman/Programming1
programming2lab1task3/programming2lab1task3/sortingBenchmarks.cpp
#include <iostream> #include <fstream> using namespace std; //function prototypes void sortArray(int[], int, ofstream&); void selectionSort(int[], int, ofstream&); int main() { const int SIZE = 20; ofstream outputFile; outputFile.open("prgmAsn1.txt"); //array of unsorted values //int values[SIZE] = { 95, 90, 8...
ALGO
0.999367
4.526945
0a09d71c-8a45-4fc4-a0f7-00a3b247f97d
Sandstorm831/chessdom
stockfish/stockfish/src/movepick.cpp
#include "movepick.h" #include <algorithm> #include <cassert> #include <utility> #include "bitboard.h" #include "position.h" namespace Stockfish { namespace { enum Stages { // generate main search moves MAIN_TT, CAPTURE_INIT, GOOD_CAPTURE, QUIET_INIT, GOOD_QUIET, BAD_CAPTURE, BAD_QU...
ALGO
0.999509
7.810699
84c5320b-0956-4a11-bf18-c3130e4dc0c6
NkOffiCiAL07/Leetcode
0039-combination-sum/0039-combination-sum.cpp
class Solution { public: vector<vector<int>> ar; void solve(vector<int> &v, int tar, vector<int> a, int idx = 0){ if(tar == 0){ ar.push_back(a); return; } if(tar < 0){ return; } for(int i=idx; i<v.size(); i++){ ...
ALGO
0.999978
6.37443
3df2b863-49a2-4d4a-abba-665ec4e8ade4
ednaluna/Priority-Queue
DPQueue.cpp
// FILE: DPQueue.cpp // IMPLEMENTS: p_queue (see DPQueue.h for documentation.) //Edna Athziry Luna #include <cassert> // provides assert function #include <iostream> // provides cin, cout #include <iomanip> // provides setw #include <cmath> // provides log2 #include "DPQueue.h" using namespace std; namespac...
ALGO
0.996405
5.496376
e0fe09ee-8dd0-4077-9df8-290453835523
iains/LLVM-8-Branch
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp
// <algorithm> // template<InputIterator InIter, typename OutIter> // requires OutputIterator<OutIter, RvalueOf<InIter::reference>::type> // OutIter // move(InIter first, InIter last, OutIter result); #include <algorithm> #include <cassert> #include <memory> #include "test_macros.h" #include "test_iterators.h"...
TEST
0.947984
7.150619
71e30959-530a-4936-ad43-6438e3a235cb
anshuahi/LeetCode
daily-challenges-2023/02-Febuary/08-feb 45. Jump Game II/solution.cpp
class Solution { public: int jump(vector<int>& nums) { int n = nums.size(); int maxReach = 0; int currReach = 0; int ans = 0; for(int i = 0; i < n-1; i++) { if(i + nums[i] >= maxReach) { maxReach = i + nums[i]; } ...
ALGO
0.999999
6.166971
a5413029-72d8-43cf-9b4b-521886a61d6a
Nauman-Rehman/Cpp-beginning
Recursion/lec31.cpp
// when a function call itself or when a function let say A calls another function B and B again calls A then this type of this are called Recursion // Another definition of recursion is that when a big operation is done by the use of it's small variant // ex --> 5! = 5 * 4! , here 5! is a big operation done by it's sm...
ALGO
0.999744
5.608301
f36acd47-67cf-4397-8495-8ddf0a177873
czgggggggg/CUGBOJ
1323(铅笔)(WA).cpp
//̫ɵ⣬οACĴ𰸶ûá #include<iostream> #include<iomanip> using namespace std; #define PI 3.1415926535898 int main(){ int D,L; cin>>D>>L; double v=(2*PI*(D/2)*(D/2)*L)/3; cout<<fixed<<setprecision(3)<<v<<endl; return 0; }
ALGO
0.998909
3.96562
d0cb7075-ab00-4d9d-a334-7ec0cf1fe19f
GUM-i-RO/RL_Homework4
aruco_ros/aruco/src/aruco/fractallabelers/fractalposetracker.cpp
#include "fractallabelers/fractalposetracker.h" #include "levmarq.h" #include "ippe.h" #include "aruco_export.h" #include "timers.h" #include "opencv2/calib3d/calib3d.hpp" #include "aruco_cvversioning.h" namespace aruco { /* * KeyPoint cornersubpixel */ void kcornerSubPix(const cv::Mat image, std::vector<cv::KeyPo...
ALGO
0.997194
5.17177
67fc4686-9840-4c09-986b-7087ac2c13a8
sarvex/solution-cpp
1771.maximize_palindrome_length_from_subsequences.cpp
class Solution { public: int longestPalindrome(string word1, string word2) { string s = word1 + word2; int n = s.size(); int f[n][n]; memset(f, 0, sizeof f); for (int i = 0; i < n; ++i) f[i][i] = 1; int ans = 0; for (int i = n - 2; ~i; --i) { for (...
ALGO
0.999919
5.784096
3797b7cc-9c39-43d7-8d37-e9767b735036
TarunVenkataRamesh-0515/becomecoder
BubbleSort.cpp
#include<bits/stdc++.h> using namespace std; void bubble_sort(int arr[], int len) { for(int i=0; i<len-1; i++) { int swaps = 0; for(int j=0; j<len-i-1; j++) { if(arr[j] > arr[j+1]) { swaps++; // counts swaps swap(arr[j], arr[j+1])...
ALGO
0.999973
4.697778
e60228e3-587d-45b8-b67a-c2555c6b86d3
Bayhaqiindra/ExerciseProsedural_106
ExerciseProsedural_106/ExerciseProsedural_106.cpp
#include <iostream> using namespace std; int a[20]; int n; double rerata(double a, double b) { return (a + b) / 2; } string status(double rata, double nil) { if (rata >= 70 || nil >= 80) return "Asroni Lulus"; else return "Asroni Gagal"; } string status2(double rata, double nil) { if (rata >= 70 || nil >= 8...
ALGO
0.999041
4.632833
838ff0b4-ec07-4243-ab60-97030ddf4edd
Yeolar/accelerator
accelerator/scheduler/DAG.cpp
#include "accelerator/scheduler/DAG.h" namespace acc { DAG::Key DAG::add(VoidFunc&& func) { Key i = nodes_.size(); nodes_.emplace_back(std::move(func), [&, i]() { schedule(i); }); return i; } // a -> b void DAG::dependency(Key a, Key b) { nodes_[a].nexts.push_back(b); nodes_[b].waitCount++; nodes_[b].has...
ALGO
0.998893
6.510247
4ae0f597-162f-4829-bd9a-bb3cf97a17fc
Nithin1729S/NITK-IT-2026-Assignments
IT300 - Design and Analysis of Algorithms/divide/Random.cpp
#include <iostream> #include <climits> #include <cstdlib> #include <ctime> using namespace std; void swap(int *x, int *y) { int temp = *x; *x = *y; *y = temp; } int partition(int A[], int l, int h) { int pivot = A[l]; int i = l, j = h; do { do {i++;} while (A[i] <= pivot); ...
ALGO
0.999958
5.011646
8bfd9169-e67a-412e-9f1c-880f2e152737
Andrewyx/Thundersearch
sources/software/src/software/ai/hl/stp/play/corner_kick_play.cpp
#include "software/ai/hl/stp/play/corner_kick_play.h" #include "shared/constants.h" #include "software/ai/evaluation/possession.h" #include "software/ai/hl/stp/tactic/attacker/attacker_tactic.h" #include "software/ai/hl/stp/tactic/move/move_tactic.h" #include "software/ai/hl/stp/tactic/receiver/receiver_tactic.h" #inc...
ALGO
0.962425
5.406631
b20e01c8-a9fe-4d41-8fa2-1d7f212016be
alifalhasan/CP-code-vault
Codeforces/CodeTON Round/CodeTON Round 1 (Div. 1 + Div. 2/E - Equal Tree Sums/150966543.cpp
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include<ext/pb_ds/tree_policy.hpp> #include<ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long template<typename temp>using ordered_set = tree<temp, null_type, less<temp>, rb_tree_tag,tree_order_statistics_node_upda...
ALGO
0.999943
4.940506
93f41a0f-fc79-41ea-a335-6912df344723
JosephL8912/Competitive-programming
BackAndForth.cpp
#include <bits/stdc++.h> using namespace std; int possibleAnwers[2000]; void friday(int b1milk, vector<int> B1, vector<int> B2) { for (int i = 0; i < B2.size(); i++) { int x = B2[i]; possibleAnwers[b1milk + x] = 1; } } void thursday(int bucket1Milk, vector<int> bucket1, vector<int> bucket2) ...
ALGO
0.999322
3.551999
a38a2ec5-c998-451b-ae59-f90e4151bcc5
ishandutta2007/codeforces
dmga44/normal/1146/E.cpp
#include <bits/stdc++.h> #define db(x) cout << (x) << '\n'; using namespace std; typedef long long ll; typedef pair<ll,ll> pii; typedef pair<ll,pii> pip; typedef pair<pii,pii> ppp; #define MAXN 100005 int res[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,q,a; cin >> n >> q; ...
ALGO
0.999982
3.16224
70b0dec8-dfb2-4054-bc39-46b3410d7a95
tsingke/Homework_Neumann
陈若泓/Experiment_2/sourceCode/4-6.cpp
#include <iostream> using namespace std; void fun(int x, int &y) { x += y; y += x; } int main() { int x = 5, y = 10; fun(x, y); fun(y, x); cout << "x=" << x << "y=" << y << endl; system("pause"); return 0; }
ALGO
0.997859
4.430258
52aaee5b-6a18-4f73-9451-e4c26c4b72b7
cbkpar/BOJ
boj_16515.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); double dAns = 1; double dNum = 1; int iN; cin >> iN; for (int i = 1; i <= iN; ++i) { dNum *= (double)(i); dAns += 1.0 / dNum; } cout.precision...
ALGO
0.999591
3.815705
774e3701-661e-4d7a-a3f7-3b1707fe5c5c
dm-bit1/Leetcode_Solutions
Leetcode#1854/solution.cpp
class Solution { public: int maximumPopulation(vector<vector<int>>& logs) { map<int, int> freq; for (int i= 1950; i <= 2050-1;i++){ freq[i]; } int dif = 0; for (const vector<int>& i : logs){ dif = i[1] - 1 - i[0]; while (dif >= 0){ ...
ALGO
0.999901
5.698712
cee2919b-7671-4582-8ab2-8a6c49a2bd20
Anirban4511/DSA-CPP
Linkedlist/Palindrome.cpp
#include <bits/stdc++.h> using namespace std; struct node { int data; struct node *link = NULL; }; struct node *head, *temp, *curr = NULL; void create(vector<int> &nums) { for (int i = 0; i < nums.size(); i++) { struct node *temp = NULL; if (head == NULL) { temp = ne...
ALGO
0.999885
5.000905
6089e4f6-517a-4646-a3a3-8474bf701baf
sarvex/leetcode-piet
solution/1800-1899/1829.Maximum XOR for Each Query/Solution.cpp
class Solution { public: vector<int> getMaximumXor(vector<int>& nums, int maximumBit) { int xs = 0; for (int& x : nums) { xs ^= x; } int mask = (1 << maximumBit) - 1; int n = nums.size(); vector<int> ans(n); for (int i = 0; i < n; ++i) { ...
ALGO
0.999995
5.507905
ef33ca4d-dd1d-4b6b-a78c-617d066eeadf
ParagSenDeka/Leetcode-Solutions
C,C++/flattenBinaryTreeToALinkedList.cpp
#include <iostream> #include <vector> using namespace std; 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), left...
ALGO
0.999994
5.422042
fe1f5072-0ebd-41d7-a9f2-971307cc974f
side-projects-all/works
Leetcodes/array/q_448.cpp
/* Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums. Example 1: Input: nums = [4,3,2,7,8,2,3,1] Output: [5,6] Example 2: Input: nums = [1,1] Output: [2] Constraints: n == nums.length 1 <= n <= 10^5 ...
ALGO
0.999753
6.090876
862d74af-ab38-4aa8-8e8b-127ec9215a65
IrinaMBejan/Personal-work-contests
Algorithmics/Problems from various contests/ants.cpp
#include <cstdio> using namespace std; FILE* fin=fopen("ants.in","r"); FILE* fout=fopen("ants.out","w"); struct familie { int poz; int bob; } q[100001]; int n; int verifica(int m); int main() { unsigned long long int s=0; int i,m,ok=0,fi,st; fscanf(fin,"%d",&n); for(i=1; i<=n; i++) { ...
ALGO
0.999955
3.682418
f20dd13a-9345-49a3-87b2-788335b30d60
ishandutta2007/codeforces
shino16/normal/827/C.cpp
#line 2 "C:/Users/W/c/lib/template.cpp" #ifndef LOCAL #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx") #endif #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> ...
ALGO
0.999603
5.421275
c18cb581-11a0-423d-a1bc-eedb6eca9fc8
anipnwr7777/my-cp-template
gcd_lcm.cpp
#include <bits/stdc++.h> using namespace std; typedef long double ld; #define int long long //priority_queue <int, vector<int>, greater<int>> minheap int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a * b / gcd(a, b); } void solve() { ...
ALGO
0.999917
4.406377
a0a27945-641f-4b68-b781-28b39e3dbb70
matthias-steinkamp/design_patterns_cpp
Patterns/AdapterPattern/MediaPlayer02.cpp
// =========================================================================== // MediaPlayer02.cpp // Adapter Pattern // Class Adapter Approach // =========================================================================== #include <iostream> #include <string> #include <memory> namespace ApdaterPatternClassAdapterAp...
TOOL
0.920485
7.061266
adde96c1-5b1f-46c5-950d-bc76127c026f
JLorenzoCD/Competitive_Programming_UNC
UNC_Contest/4/D.cpp
// https://codeforces.com/group/gmV7IkT2pN/contest/525522/problem/D #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef unsigned int uint; void dfs(uint v, vector<vector<uint>> &g, vector<bool> &vis, vector<ull> &cost, pair<uint, ull> ...
ALGO
0.999583
4.212218
71ee170d-2462-412b-9d7f-97821eff436e
VedantWani/Server-side-for-HCI
UDPSocket/GRT/Util/EigenvalueDecomposition.cpp
#define GRT_DLL_EXPORTS #include "EigenvalueDecomposition.h" GRT_BEGIN_NAMESPACE EigenvalueDecomposition::EigenvalueDecomposition(){ warningLog.setKey("[WARNING EigenvalueDecomposition]"); } EigenvalueDecomposition::~EigenvalueDecomposition(){ } bool EigenvalueDecomposition::decompose(const MatrixFloat ...
ALGO
0.999901
3.863838
0efdae29-ffbe-4f4a-9da3-51d44226a094
ABHIYADAV01/DSA-learnings
Backtracking/string_subsets.cpp
//Note:Whenever Subsets or Combination is asked in the question go for recursion and backtracking i.e pick and not pick approach #include<iostream> using namespace std; void subsets_of_string(char *input,char *output,int i,int j){ if(input[i]=='\0'){ //add a null character to the output string and then pr...
ALGO
0.999155
4.977982
8ed47d5c-017b-4896-9d06-aaf1599654c6
eleusKUET/online-judge-solutions
UVa Online Judge/186 - Trip Routing.cpp
// #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #ifndef ONLINE_JUDGE #include "debug.h" #else #define debug(...) #endif using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using nam...
ALGO
0.99325
4.635422
e1cc36e9-3991-4f10-81d6-338df90fe7f1
ZainAmin/Advanced-Image-Processing-for-Medical-Imaging
previous years/2022/2022-04-13-traffic-light-recognition.cpp
// include aia and ucas utility functions #include "aiaConfig.h" #include "ucasConfig.h" #include <map> #include <list> namespace TLR { enum class Color { UNKNOWN, GREEN, ORANGE, RED }; // parameters double A_min = 50; // lights are assumed to be larger than 8 pixels in diameter double width_max_perc = 0.05; /...
ALGO
0.946836
6.899379
d2669cad-624c-4e31-ac1e-8e8f153c5f0f
chenfengshijie/LeetCode
LeetCode/1782.统计点对的数目.cpp
/* * @lc app=leetcode.cn id=1782 lang=cpp * * [1782] 统计点对的数目 */ #include <iostream> #include <vector> #include <unordered_map> #include <algorithm> using namespace std; // @lc code=start class Solution { public: vector<int> countPairs(int n, vector<vector<int>> &edges, vector<int> &queries) { vector...
ALGO
0.999807
5.976489
e58a62ca-9ae2-4a50-8b02-29bc615e6f65
yeohj0710/old-solutions
13000s/13506.cpp
#include <iostream> #include <vector> #include <string> using namespace std; vector<int> GetPi(string Pattern) { vector<int> Pi(Pattern.length()); for(int i=1, j=0; i<Pattern.length(); i++) { while(j>0 && Pattern[i] != Pattern[j]) j = Pi[j-1]; if(Pattern[i] == Pattern[j]) Pi[i] = ++j; } ...
ALGO
0.999975
4.102975
781d8b41-8f10-4faa-8b56-f52cecd9615d
lleviackermann/CpCodes
codechef/Divisible_By_8.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define endl "\n" #define fo(i, n) for (i = 0; ...
ALGO
0.999637
5.198884
5071767f-2094-4bbf-955c-893c7f73f82b
linjiafengyang/c-and-cpp
DataStructure/算法/WDigraph.cpp
#include <iostream> #include <string> using namespace std; #define INF 99999 class WDigraph { public: WDigraph( int size, int x ); ~WDigraph(); bool exist( int i, int j ) const; int getEdge() const; int getVertex() const; bool add( int i, int j, const int weight );//· bool erase( int i, int j, int &get );//ɾ· ...
ALGO
0.999855
4.022008
3f581f7d-9dc3-41f4-b5b6-c61d515279c1
InzamZ/Inzam-XCPC-Code
Leetcode/BiweeklyContest097/B.cpp
//InzamZ // #include <bits/stdc++.h> using namespace std; class Solution { public: int vis[10010]; int maxCount(vector<int> &banned, int n, int maxSum) { int ans = 0; for (int i = 0; i <= n; ++i) vis[i] = 0; for (auto x : banned) vis[x] = 1; for (int i ...
ALGO
0.999823
4.755841
b2e749f2-ad8d-43a9-bbeb-866b459275ad
ZrjaK/algorithm
OJ/codeforces/375/D.cpp
#ifdef ONLINE_JUDGE #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #endif #include <bits/stdc++.h> #include <ext/rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/trie_policy.hpp> #includ...
ALGO
0.999858
4.485135
ca147a3a-3a5e-4fbc-b0c9-71d17f1111af
wjwhhhhhh/ACM_
codeforces/江西省赛2023/k1.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<int> ans,a(n),q(n); for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=1;i<n;i++)ans.push_back(a[i-1]-a[i]); int t; cin>>t; sort(ans.begin(),ans.en...
ALGO
0.999702
3.704461
ced82e02-4eca-43d3-b712-3ebc38cd103e
karygauss03/Leetcode-Solutions
2239-find-closest-number-to-zero/2239-find-closest-number-to-zero.cpp
class Solution { public: int findClosestNumber(vector<int>& nums) { sort(nums.begin(), nums.end()); int idx = upper_bound(nums.begin(), nums.end(), 0) - nums.begin(); if (idx == 0) return nums[0]; if (idx >= nums.size()) return nums[nums.size() - 1]; if (abs(nums[idx]) <= abs...
ALGO
0.999997
5.773636
01bc0bbd-54e8-44a3-8bae-30e7a3b82928
raincross7/code-similarity
codes/train_code/problem135/problem135_5.cpp
#include<iostream> #include<stack> using namespace std; int main() { int x; stack<int> st; for (int n; cin >> n;) { if (n) { st.push(n); } else { cout << st.top() << endl; st.pop(); } } return 0; }
ALGO
0.999598
4.397805
dfd1a798-b1e2-48eb-b04d-3e7243eea923
cherry0697/Codes
bubble_sort.cpp
#include<bits/stdc++.h> using namespace std; void bubble_sort(int a[],int n) { for(int i=0;i<n-1;i++) { for(int j=0;j<n-i-1;j++) { if(a[j]>a[j+1]) swap(a[j],a[j+1]); } } } int main() { int n; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; bubble_sort(a,n); for(in...
ALGO
0.999879
4.007988
099a6b7b-3a40-4a20-a3e5-c6cc1342a42e
PrachiSinghal86/CodeChef-Solutions
TLG.cpp
#include <iostream> using namespace std; int main() { long int n,i; long long int s1=0,s,t1=0,t,w,l=0; cin>>n; for(i=0;i<n;i++) { cin>>s>>t; s1=s1+s; t1=t1+t; if (s1-t1>l) { l=s1-t1; w=1; } else if(t1-s1>l) { l=t1-s1; w=2; ...
ALGO
0.99991
3.353548
3b75854b-deb9-4357-ad49-018273b354a3
lonelam/SolveSet
uva11582crit.cpp
#include<cstdio> #include<vector> using namespace std; typedef unsigned long long LLU; const int maxn=1010; vector<int> f[maxn]; void init(){ for(int i=2;i<maxn;++i){ f[i].push_back(0); f[i].push_back(1%i); for(int j=2;;++j){ f[i].push_back((f[i][j-1]+f[i][j-2])%i); i...
ALGO
0.999883
3.996614