uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
d4743ce1-7c38-42d5-8b49-a5ff1dc82445
KingCobra95/RedCodder
codeforse/643-E.cpp
#include <iostream> #include <cstdio> #include <vector> #include <map> #include <queue> #include <stack> #include <cstring> #include <algorithm> #include <cstdlib> #include <cmath> #include <set> #include <limits.h> #include <assert.h> //#include <unordered_map> using namespace std; #define mp make_pair #define pb p...
ALGO
0.999581
3.069458
059cc72c-403d-4ff6-84ac-8f735514b531
DavidAlphaFox/mongodb
src/mongo/db/index/btree_based_access_method.cpp
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kIndex #include "mongo/db/index/btree_access_method.h" #include <vector> #include "mongo/base/error_codes.h" #include "mongo/base/status.h" #include "mongo/db/curop.h" #include "mongo/db/index/btree_based_bulk_access_method.h" #include "mongo/db/inde...
TOOL
0.966541
7.883154
29eac83d-16b7-4a39-818a-aae1e57fe7de
Kim-jeongmin/algorithm_problem_solved
그리디 알고리즘/12931.cpp
#include <bits/stdc++.h> using namespace std; int N, result = 0; int arr[51]; bool is_zero(){ bool flag = true; for(int i=0;i<N;i++){ if(arr[i]) { flag = false; break; } } return flag; } int main(){ cin >> N; for(int i=0;i<N;i++) cin >> arr[i]; ...
ALGO
0.999985
4.080454
4e38c6e3-8fa8-4b64-8c13-c1a8290e1099
muhammadhasan01/cp
Online Judge/Codeforces/Contests/EDU-DIV2/EDU-DIV2-93/E.cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int INF = 2e9; int n; pair<int, int> p[N]; long long bit[N][2]; void add(int x, int it, long long val) { for (int i = x; i <= n; i += i & -i) { bit[i][it] += val; } } long long get(int x, int it) { if (x == 0) return 0LL...
ALGO
0.999973
3.829706
ae13ef57-8bf1-4dfa-8b2b-78456b2eebb2
SinBin10/DSA
Difficulty: Medium/Top View of Binary Tree/top-view-of-binary-tree.cpp
//{ Driver Code Starts //Initial Template for C++ #include <bits/stdc++.h> using namespace std; // Tree Node struct Node { int data; Node* left; Node* right; }; // Utility function to create a new Tree Node Node* newNode(int val) { Node* temp = new Node; temp->data = val; temp->left = NULL; ...
ALGO
0.999783
7.006396
39d8683d-9c55-42a4-92d6-a0712a39e948
ishandutta2007/codeforces
jiangly/normal/1548/C.cpp
#include <bits/stdc++.h> constexpr int P = 1000000007; using i64 = long long; // assume -P <= x < 2P int norm(int x) { if (x < 0) { x += P; } if (x >= P) { x -= P; } return x; } template<class T> T power(T a, int b) { T res = 1; for (; b; b /= 2, a *= a) { if (b % 2)...
ALGO
0.999899
3.973393
c7cecfe5-5132-418f-989f-755fe4aa89da
tpisto/rmongo
src/mongo-cxx-driver/boost/libs/graph/example/bron_kerbosch_print_cliques.cpp
//[code_bron_kerbosch_print_cliques #include <iostream> #include <boost/graph/undirected_graph.hpp> #include <boost/graph/bron_kerbosch_all_cliques.hpp> #include "helper.hpp" using namespace std; using namespace boost; // The clique_printer is a visitor that will print the vertices that comprise // a clique. Note t...
ALGO
0.999492
6.690554
3dc5b818-2547-44f8-b9bf-bd5de138f8af
ishandutta2007/codeforces
a_g/normal/1650/F.cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1e9+1e6; int main () { ios_base::sync_with_stdio(0); cin.tie(0); int T; cin >> T; while (T--) { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<vector<tuple<int, int, int>...
ALGO
0.999937
3.474722
3cb6d74f-32e2-4628-826f-4bfc4a5bd004
marianoqnk/MQTTto433
EstacionLidl433_Ver3_Toldo/persiana.cpp
/*#include "persiana.h" #include <Ticker.h> Persiana::Persiana() { } void Persiana::sube() { if(_estado==ssubiedo)return; else if(_estado==ssbajando || estado==sstop) _posicion=calculaPosicion(); _lastTime=now(); _estado=ssubiedo; //envia orden Persiana::fin.once(_tmaximo,Persiana::call...
ALGO
0.982383
5.045945
0c9c3f05-6caf-4a1f-a914-82ed30a1bbc8
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_5063_13.cpp
#include <bits/stdc++.h> using namespace std; long long F[60][2][2], k; int n, str[60]; long long DFS(int p, int x, int y) { long long &ans = F[p][x][y]; if (p * 2 - 1 > n) ans = 1; if (ans != -1) return ans; ans = 0; for (int i = 0; i < 2; i++) if (str[p] == i || str[p] == -1) for (int j = 0; j < 2...
ALGO
0.999991
3.527462
d590e999-c4f4-4185-a853-2f1e2458b7e1
drmeister/legacy-externals-clasp
boost/libs/spirit/classic/example/intermediate/lazy_parser.cpp
// // This example demonstrates the lazy_p parser. You should read // "The Lazy Parser" in the documentation. // // We want to parse nested blocks of numbers like this: // // dec { // 1 2 3 // bin { // 1 10 11 // } // 4 5 6 // } // // where the numbers in the "dec" block are wrote in ...
TOOL
0.884702
7.656245
2d2c6ebf-dbb0-4a7c-8a2c-fc7a99fd6443
KasanMoor/MachineLearning
ass2/rand.cpp
#include "rand.h" /////////////////////////////////////////////////// // // Simple 64 bit random number generators based on // a RNG called flea by Bob Jenkins. Thanks, Bob! // // http://burtleburtle.net/bob/rand/talksmall.html // // these constants are supplied to make the RNG return numbers // on the open interva...
TOOL
0.99154
4.551744
fe0a85b0-ac92-476d-8f0c-842151869f85
Prashantkumar2992/python-code
TRASH_SYCL/PI_buffer_SYCL.cpp
#include<math.h> #include<sys/time.h> #include <CL/sycl.hpp> #include<stdio.h> constexpr int N=16; using namespace std; using namespace sycl; #define N 99999999 int main() { int i, j; queue q; float area, pi,sum =0.0,step; float dx, y, x; step=1.0/(float)N; { buffer buf_sum(&sum,range(1)); q.su...
ALGO
0.999783
3.498498
c7aac1e8-3add-4de0-970b-44018115abc4
Xydon/CSES-Solutions-and-Extras
cp_edu/two_pointers/step1/2_Number_of_Smaller.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int * arr = new int[n]; for(int i =0 ; i < n; ++i) cin >> arr[i]; int * brr = new int[m]; for(int i=0; i < m; ++i) cin >> brr[i]; int i =0 , j = 0; while(j < m) { while(i < n and arr[i] < brr[j]) ++i; cout << ...
ALGO
0.999988
4.253135
78f5fd71-c9a8-4179-9814-5af6cf403987
PRINCERAHUL1/CrackYourPlacement
Tree/Path Sum III.cpp
class Solution { public: int helper(TreeNode* root, long s) { if(root == NULL) return 0; int res=0; if(root->val == s) res++; res+= helper(root->left, s-root->val); res+= helper(root->right, s-root->val); return res; ...
ALGO
0.999923
6.226727
d834890e-8fd2-45ae-9c7e-e4fbf3fa2ae4
harshhy2012/CodingPractice
REV/OOPS/complexNum.cpp
#include<bits/stdc++.h> using namespace std; class ComplexNumber{ private: int real; int imag; public: ComplexNumber(){ real = 0; imag = 0; } ComplexNumber(int r, int i){ real = r; imag = i; } void setReal(...
ALGO
0.877783
4.573731
1bb73848-782a-4510-9771-2ed81b4b5cc8
softnchewy/fuseVJ
v4-flockAudienceOSC/src/particle.cpp
#include "particle.h" #include "ofMain.h" //------------------------------------------------------------ particle::particle(){ setInitialCondition(0,0,0,0); damping = 0.01f; seperation.distance = 20; alignment.distance = 80; cohesion.distance = 40; seperation.strength = .03; alignment.strength = .01...
ALGO
0.993173
5.743308
c40c1ad5-a614-49bb-bea1-96e294154a80
siddharthkumarjha/experimental-stuff
2pow.cpp
#include <algorithm> #include <cstdint> #include <iostream> #include <vector> std::string uint128ToString(const unsigned __int128 &value) { static const char *charmap = "0123456789"; std::string result; result.reserve(40); // max. 40 digits possible ( uint64_t has 20) unsigned __int128 helper = value; do {...
ALGO
0.997873
5.575317
d859656f-e4aa-4c15-9a1b-820ae0e5ce56
DATx-Protocol/DATx
datxchain/contracts/libc++/upstream/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
// <algorithm> // template<BidirectionalIterator Iter> // requires ShuffleIterator<Iter> // && LessThanComparable<Iter::value_type> // void // inplace_merge(Iter first, Iter middle, Iter last); #include <algorithm> #include <random> #include <cassert> #include "test_iterators.h" #if TEST_STD_VER >= 11...
TEST
0.997149
6.501151
8b1c2e1e-3cfa-4599-97cf-6bb76cc193d7
CaDe27/Coding
ICPC/PrimeraFecha2019/InspectingPin.cpp
#include <iostream> #include <cmath> #include <algorithm> using namespace std; void generaPin(int pin[], int n){ int vp5[n+1], vp2[n+1], vp52[n+1]; long long pot2[n+1]; fill(vp2, vp2+n+1, 0); fill(vp5, vp5+n+1, 0); pin[1] = 1; vp52[1] = 1; int pot, mp, mm; pot = 1; mp =(int)(log(n)/log(2)); for(int i = ...
ALGO
0.99974
3.984133
4bb05e59-ae60-4dfd-b79b-a9ac875d2d77
1zhangbo/1.
2/main.cpp
#include <iostream> using namespace std; #include<stdio.h> #include<stdlib.h> #define OK 1 #define ERROR 0 typedef int ElemType; typedef int Status; typedef struct LNode { ElemType data; struct LNode *next; struct LNode *prior; } LNode,*LinkList; LinkList NewLNode(LNode *P,ElemType data) { P=(LNode*)mal...
ALGO
0.999236
3.104056
f98ec45d-10b1-4afb-87ab-b98be2954184
Hooni07/algorithm_2022
a_plus_b/B_10951(☆).cpp
#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int a, b = 0; while (cin >> a >> b){ cout << a+b << '\n'; } }
ALGO
0.996091
5.136076
1f246752-f779-4970-b221-731293cc4bb3
DungTran31/laptrinhonline.club
OLP2/bo_bestie.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int x, y, z; cin >> x >> y >> z; vector<int> pos = {x, y, z}; sort(pos.begin(), pos.end()); // Tính khoảng cách tối thiểu bằng cách lấy khoảng cách giữa con bò trung tâm (pos[1]) và con bò bên trái (...
ALGO
0.999852
4.507623
93bfd66e-4f7a-4794-906f-68439ce754bf
URLinkEVA/AC-holiday
2023winter/week4/出行计划.cpp
#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 200010; int q[N]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= n; i ++ ) { int t, c; cin >> t >> c; int l = t - c - k + 1, r = t - k; if (r <= 0 || l > 2...
ALGO
0.999887
3.182183
65c483ef-39c2-4a4b-a725-4ebe8a1f407d
openvinotoolkit/openvino
src/core/reference/src/op/reverse.cpp
#include "openvino/reference/reverse.hpp" #include <cmath> #include <cstring> #include <iterator> #include "openvino/core/except.hpp" #include "openvino/reference/utils/coordinate_range.hpp" namespace ov { namespace reference { void reverse(const char* arg, char* out, const Shape& arg_shape...
ALGO
0.926314
6.457919
40fc2487-2f87-48ad-80ff-eec017d0fbc6
Esheta10/LeetCode-Solutions
3555-final-array-state-after-k-multiplication-operations-i/3555-final-array-state-after-k-multiplication-operations-i.cpp
class Solution { public: #define P pair<int,int> vector<int> getFinalState(vector<int>& nums, int k, int multiplier) { //Approach-1 (Brute Force) //T.C : O(n * k) //S.C : O(1) /* int n = nums.size(); for(int i=0;i<k;i++) { int idx=0; ...
ALGO
0.999993
4.955316
4febcffa-1450-4817-8efa-91de52b381db
Chandramani04/CP
Practice/C_Sum_on_Subarrays.cpp
#include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #include <functional> // for less #include "bits/stdc++.h"; using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_se...
ALGO
0.999781
4.128408
f1feb681-aa0a-45be-8379-1c4b4be9d95e
JaeNew/Leetcode-MySubmit
26.删除排序数组中的重复项.cpp
/* * @lc app=leetcode.cn id=26 lang=cpp * * [26] 删除排序数组中的重复项 * * https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/description/ * * algorithms * Easy (42.88%) * Total Accepted: 93K * Total Submissions: 216.1K * Testcase Example: '[1,1,2]' * * 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除...
ALGO
0.999851
5.980691
561bfa8f-4641-456e-a4a2-8159498c20a1
Licious001/C-Pracitce
ConsoleApplication/Terms.cpp
/*#include <iostream> #include <string> #include <map> #include <algorithm> #include <cctype> using namespace std; typedef map<string, int> terms; terms term_union(terms &a, terms &b, int j){ terms c = a; for (terms::iterator it = b.begin(); it != b.end(); it++){ c[it->first] += j*it->second; if (!c[it->first])...
ALGO
0.997856
4.686285
d0662a90-c30e-4879-b26f-fff177a39f7f
Dmitry240281/codespaces-blank
DZ Netology/algocpp_DZ2_Task2_BezzabotnovDV.cpp
/// Числа Фибоначчи c использованием массива. Массив ускоряет работу. Алгосложность составляет O(n) и память O(n); #include <iostream> double* Fibonacci(double* arr, int size) { if (size == 0) { arr[0] = 0; return arr; } else if (size == 1) { arr[0] = 0; arr[1] = 1;...
ALGO
0.999907
5.207443
d3f8356c-9e1d-4b99-a15f-c0eaa931209f
mikhaeljonathan/online-judges
Kattis/licensetolaunch.cpp
#include <stdio.h> int main () { int n; scanf("%d", &n); int days[n]; for (int i = 0; i < n; i++){ scanf("%d", &days[i]); } int min = days[0]; int res = 0; for (int i = 1; i < n; i++){ if (days[i] < min){ min = days[i]; res = i; } } printf("%d\n", res); return 0; }
ALGO
0.999941
3.695092
1e6001ae-43a3-4c2e-817a-1bf498621b50
prabowo02/toki-regular-open-contest
troc-26/troc-26-naikturun/spec.cpp
#include <tcframe/spec.hpp> using namespace tcframe; class ProblemSpec : public BaseProblemSpec { protected: int N, M; long long X; string s; vector<vector<long long> >A; void InputFormat() { LINE(N,M); GRID(A) % SIZE(N,M); } void OutputFormat1() { LINE(...
ALGO
0.999798
4.104911
46716986-4cae-44e4-931f-b80c01ec4cd4
qiao-coder/Algorithm
leetcode/graph/node-with-highest-edge-score.cpp
#include <vector> #include <numeric> using namespace std; /* * ߻ߵĽڵ https://leetcode.cn/problems/node-with-highest-edge-score/description/ * * ڼ */ class Solution { public: int edgeScore(vector<int>& edges) { int n = edges.size(); //vector<int> r(n,0); vector<long long> r(n, 0); for (int i = 0; i < n; i++) {...
ALGO
0.999897
5.440518
e0c2cba3-cfd9-4a69-bd38-860327b43280
npinto/opencv
modules/imgproc/src/moments.cpp
#include "precomp.hpp" // The function calculates center of gravity and the central second order moments static void icvCompleteMomentState( CvMoments* moments ) { double cx = 0, cy = 0; double mu20, mu11, mu02; assert( moments != 0 ); moments->inv_sqrt_m00 = 0; if( fabs(moments->m00) > DBL_EPSIL...
ALGO
0.998342
4.886715
83759d4b-2a0f-4711-b091-23e4b5a00827
JooseRajamaeki/ICP
DistributionMapper/eigen_332/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; int main() { Eigen::MatrixXf mat(2,4); Eigen::VectorXf v(4); mat << 1, 2, 6, 9, 3, 1, 7, 2; v << 0,1,2,3; //add v to each row of m mat.rowwise() += v.transpose(); std::cout << "Broadcasting result: " << std::...
ALGO
0.998779
4.296038
f24abd3f-03bc-402e-8acc-27488a88f8b9
ashia-002/Data-Structure-and-Algorithm
STL/Map/unordered_map.cpp
/* 1. Inbuilt implementation -- uses hash 2. Time complexity 3. valid keys datatype difference between time complexity keys are inserted by comparesion insertion and access = O(1)-->Average */ #include<bits/stdc++.h> using namespace std; int main(){ unordered_map<int, string> m; m[1] = "abc" //O(1) m[2] =...
ALGO
0.997194
4.730581
6cecafe8-f354-4d26-842a-0579d276879d
tanjil-islam/Codeforces-Problem-Solve
Problem-122A.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n,temp=0; cin>>n; int A[14]= {4,7,44,47,74,77,444,447,474,477,744,747,774,777}; for(int i=0; i<14; i++) { if(n%A[i]==0) { temp=temp+1; break; } } if(temp==1) { cout<...
ALGO
0.999575
4.170527
34c5c114-6b98-487c-8bbc-b5ea7f9701c5
ameyjain99/InterviewBit
Arrays/RotateMatrix.cpp
void Solution::rotate(vector<vector<int> > &A) { long long n = A.size(); for (long long i = 0; i < n; i++) { for (long long j = 0; j < i; j++) { swap(A[i][j], A[j][i]); } } for (auto &row : A) { reverse(row.begin(), row.end()); } }
ALGO
0.99974
4.971674
ffd9bea5-a219-4a68-a557-275c8f02aebd
wownero/wownero
src/blockchain_utilities/blockchain_import.cpp
#include <atomic> #include <cstdio> #include <algorithm> #include <fstream> #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> #include <unistd.h> #include "misc_log_ex.h" #include "bootstrap_file.h" #include "bootstrap_serialization.h" #include "blocks/blocks.h" #include "cryptonote_basic/cryptonot...
TOOL
0.923766
6.154869
30c93d04-8418-4c6e-a786-ff9db74c1648
GimmeDanger/made-algo-2020-hw
11-graphs-shortest-path/D-belman-ford-shortest-paths.cpp
#include <bits/stdc++.h> using namespace std; #define dbg 0 #if dbg #define INPUT_SOURCE() ifstream cin("input.txt") #else #define INPUT_SOURCE() #endif #define FAST_IO() \ ios::sync_with_stdio(false); \ cout.tie(nullptr); \ cin.tie(nullptr) using ll = long long; using graph = vector<v...
ALGO
0.999964
3.991559
cae3da65-67fe-4b5c-98a6-7edffa49e955
okaybab/BOJ_Soliving
main.cpp
#include <iostream> using namespace std; int main() { int n = 0; cin >> n; while (n != 0) { int a = 0, b = 0; cin >> a >> b; cout << a + b << endl; n--; } return 0; }
ALGO
0.985322
3.869129
34b6f110-1818-4694-816b-5bf0169fc4df
kunutch/eos_delegatebw
src/cpuloan.cpp
#include <cpuloan.hpp> #include <eosio.token.hpp> #include <eosio/system.hpp> #include <cctype> ACTION cpuloandz::logstake(name from, time_point_sec unstakeTime, asset stake_value) { require_auth(get_self()); // Init the _message table staking_table data(get_self(), get_self().value); // Create a messa...
WEB
0.880754
4.762169
6e1e8bcf-77e5-45d7-b7c7-81203e9ee825
jiye-algorithm/Data-Structure
DataStruct_CppSTL/ch3/prg3_2.cpp
// File: prg3_2.cpp // the program prompts the user to enter a non-negative // decimal number and a corresponding base in the range // 2 <= base <= 10. it calls the recursive function // displayInBase() that outputs the number in the // desired base #include <iostream> #include <string> using namespace std; // outpu...
ALGO
0.998561
6.588897
5556e0e9-9f64-4fd4-8e92-0a48b22f5c93
JanMaciuk/Flow_networks_genetic_optimalisation
AGChallenge/Individual.cpp
#include "Individual.h" Individual::Individual(vector<int> genotype, CLFLnetEvaluator* evaluatorPointer) { this->genotype = genotype; // The actual solution carried by the individual this->evaluatorPointer = evaluatorPointer; // Pointer to the evaluator instance that will be used for fitness calculation fitness...
ALGO
0.980021
4.94453
d114714d-2b83-474b-8125-9ede49ac30c9
nickgammon/mushclient
scripting/methods/methods_info.cpp
// methods_info.cpp // General "information" methods #include "stdafx.h" #include "..\..\MUSHclient.h" #include "..\..\doc.h" #include "..\..\MUSHview.h" #include "..\..\mainfrm.h" #include "..\..\childfrm.h" #include "..\..\sendvw.h" #include "..\..\winplace.h" #include "..\..\png\png.h" #include "..\errors.h" #incl...
TOOL
0.925751
3.636358
82811f5e-9533-41b8-b638-902c44327913
jiguang123/Big-Data-Learning-Note
07_数据结构与算法/LeetCode_C++版本V2/strong-password-checker_1_AC.cpp
// It's just a headache to meet such problems in an interview. #include <algorithm> #include <cctype> #include <queue> #include <string> #include <vector> using std::isdigit; using std::islower; using std::isupper; using std::max; using std::min; using std::priority_queue; using std::string; using std::vector; struct ...
ALGO
0.998267
5.062421
41930eef-c769-4025-acdf-cf81bc624a64
silentknight17/Quick-Revision-Coding
Two-Pointer/Three-Sum.cpp
/* Question ---> Three Sum. We have to find wheteher there exists a triplet in an array whose sum is equal to the target. Algorithm ---> 1) Sort the array in increasing order. 2) Now, we will traverse the array and keep one element as fixed, we will use two pointers and try to find out if the sum of all the three elem...
ALGO
0.999994
4.895234
feded062-826f-4b34-a6c8-b5a57734a000
Splasher1804/Godot_engine_3.4.4_for_ARM64_Windows
thirdparty/oidn/mkl-dnn/src/cpu/gemm_inner_product.cpp
#include "c_types_map.hpp" #include "type_helpers.hpp" #include "mkldnn_thread.hpp" #include "gemm_inner_product.hpp" namespace mkldnn { namespace impl { namespace cpu { using namespace mkldnn::impl::status; using namespace mkldnn::impl::prop_kind; using namespace mkldnn::impl::data_type; using namespace mkldnn::imp...
ALGO
0.998192
7.549911
27d46b33-5812-4396-a0ba-730b301eb91d
Mitali-Potdar/LeetCode
0532-k-diff-pairs-in-an-array/0532-k-diff-pairs-in-an-array.cpp
class Solution { public: int findPairs(vector<int>& nums, int k) { //O(N) int n = nums.size(); unordered_map<int, int> m; int cnt = 0; for(int i = 0; i < n; i++){ m[nums[i]]++; } if(k == 0){ for(auto v: m){ if(v.second ...
ALGO
0.999867
5.807156
2ddaf542-d188-4ad8-9f1f-90a4399d028c
RedemptionEngine/redemption
src/utility/nodebuilder/nodebuild_events.cpp
#include <string.h> #include "doomtype.h" #include "nodebuild.h" FEventTree::FEventTree () : Root (&Nil), Spare (NULL) { memset (&Nil, 0, sizeof(Nil)); } FEventTree::~FEventTree () { FEvent *probe; DeleteAll (); probe = Spare; while (probe != NULL) { FEvent *next = probe->Left; delete probe; probe = next...
ALGO
0.987235
4.188711
458e2ddb-3426-4970-b3fc-86ed0b096be5
HiYellowC/ACM
杂/RMQ.cpp
#include <stdio.h> #include <math.h> inline int max(int a, int b) { return a > b ? a : b; } int Array[10] = {3, 2, 4, 5, 6, 8, 1, 2, 9, 7}; int f[10][5]; int main() { for(int i = 0; i < 10; i++) f[i][0] = Array[i]; for(int i = 1; i <= (int)(log(10) / log(2)); i++) for(int k = 0; k <= 10 - (int)pow(2, i); k++...
ALGO
0.9997
3.471649
d8a917b0-2cc5-4e6e-9571-d5be4f55ca1f
CogViEN/DSA-
2.Mảng 1 chiều/02.Product sum/product_sum.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; ll mod = 1e9 + 7; int arr[100005]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } ll tong = 0; sort(arr, arr + n); ...
ALGO
0.999948
4.546917
cc7aff42-6d1d-46a9-9104-2e4abece5fa9
abcvincent/opencv420_archive
opencv_contrib-4.2.0/modules/xphoto/src/learning_based_color_balance.cpp
#include "learning_based_color_balance_model.hpp" #include "opencv2/core.hpp" #include "opencv2/core/hal/intrin.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/xphoto.hpp" using namespace std; #define EPS 0.00001f namespace cv { namespace xphoto { inline void getChromaticity(Vec2f &dst, float R, float G, float...
ALGO
0.87507
5.667647
e5a5105f-0450-42e2-8fbf-373d30af529d
cssartori/programming-challenge
11286 - Conformity/11286.cpp
//Conformity - Carlo Sartori (218326) #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <map> using namespace std; int main(){ int N; while(cin >> N){ if(N == 0) break; map< vector<int>, int > combinations; for(int i=0;i<N;i++){ //Read combinations int read; v...
ALGO
0.999715
3.76615
19bbd8ac-0a5b-42d4-bc0e-3e5b4a0758e0
debrup416/Competitive-Programming
Random-Problem/Dynamic-Programming/equalSumParition.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n,i,j,target=0; cout<<"Enter the no of element in subset\n"; cin>>n; int s[n]; cout<<"Enter the number\n"; for(i=0;i<n;i++) { cin>>s[i]; target+=s[i]; } if(target&1) { cout<<"Not Possible"; return 0; } else target/=2; int T[n+1]...
ALGO
0.999978
3.855893
622abf99-473d-4e5b-bded-c58f980d3f7f
javagovindsharma/leetscode
solution/0200-0299/0217.Contains Duplicate/Solution.cpp
class Solution { public: bool containsDuplicate(vector<int>& nums) { sort(nums.begin(), nums.end()); for (int i = 0; i < nums.size() - 1; ++i) { if (nums[i] == nums[i + 1]) { return true; } } return false; } };
ALGO
0.999976
5.921118
d82bc0d0-0199-4255-81d3-33f97c80e032
Mohsin-Aalam/meal_app
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998762
6.786404
9d3ff994-eed4-40ab-bc75-be483fbc98dc
tht2005/OI
timus/1146.cpp
#include <bits/stdc++.h> using namespace std; int rd() { bool neg = 0; char c = getchar(); for(; c < '0' || c > '9'; c = getchar()) if(c == '-') neg = !neg; int n = 0; while('0' <= c && c <= '9') n = (n << 3) + (n << 1) + c - '0', c = getchar(); return neg ? -n : n; } void wr(int n) { static char o[11...
ALGO
0.999862
3.561027
3c78abee-454a-42f5-baea-a3925a1c5f17
gusttaleal/ENE118_Informatica_Industrial
Trabalho 4/Pilha_Dinamica.cpp
/* UNIVERSIDADE FEDERAL DE JUIZ DE FORA - FACULDADE DE ENGENHARIA GUSTAVO LEAL SILVA E SOUZA - 201469055B INFORM.TICA INDUSTRIAL */ #include "myfunc.h" #include <iostream> using namespace std; void main() { // Vari.veis de Controle: int opr1 = 0, opr2 = 0, opr3 = 0; // Vari.veis de Manipula..o: Pilha<char> pilh...
TOOL
0.850392
3.592034
0d38508b-eabb-43a4-89b3-9519405fb56d
VuHoaBinh/algorithm-library
sort/Counting-sort.cpp
/* Note: 0<= n =10^7 Function: compare and change the direction of elements in an array. Defect: limited of elements Advantages: easy to remember =>complexity = O(n) */ #include<bits/stdc++.h> using namespace std; #define int_min -1e9 int count_number[10000001]; int counting_sort( int *a,int n){ int m = int_min;...
ALGO
0.999967
4.544485
bbe3adde-5ba6-4d7c-8b60-a0ceabe474b3
TimothyHorscroft/competitive-programming
codeforces/1228/d.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) for (int i=0; i<(n); ++i) #define IREP(i, n) for (int i=1; i<(n); ++i) #define popcount __builtin_popcountll template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p....
ALGO
0.999931
4.248136
9db9aa1f-d7e2-4e86-b025-325e9fd144a1
Naganathan05/Leetcode_Solutions
Dynamic Programming/DP on Stocks/122. Best Time to Buy and Sell Stock II.cpp
/*-------------------------------- Method: Memoization Time Complexity: O(n) Space Complexity: O(n) + O(n) -----------------------------------*/ class Solution { public: int Stocks(vector<int> &prices, int i, int option, vector<vector<int>> &dp){ if(i == prices.size()) return 0; if(dp[i][optio...
ALGO
0.99997
6.206712
570f830d-7faa-405e-bacb-35d106b027fa
ishandutta2007/codeforces
mnbvmar/normal/547/D.cpp
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int MaxN = 200005; const int MaxDim = 200005; int N; vector<int> adj[MaxN]; vector<pair<int,int>> pointsX[MaxDim], pointsY[MaxDim]; void input(){ scanf("%d", &N); for(int i = 0; i < N; i++){ int x, y; scanf("%d%d", &...
ALGO
0.999672
3.711499
d1335d20-95e6-40e2-8d47-b341f06d4f93
ishandutta2007/codeforces
ko_osaga/normal/1666/E.cpp
#include<bits/stdc++.h> using namespace std; const int N = 100005; int l, n, a[N], dmn[N], dmx[N], tr[N]; bool can (int L, int R, bool TRK = false) { dmn[0] = dmx[0] = 0; for(int i=1;i<=n;i++) { dmn[i] = max(a[i], dmn[i-1] + L); dmx[i] = min(a[i+1], dmx[i-1] + R); if(dmn[i] > dmx[i]) return false; } if(dmx...
ALGO
0.999995
3.330675
9e058a79-bacf-465e-b2c5-79e7f5c808c0
varenius/ascot
src/ivg/lpSked/transits.cpp
/* * File: transits.cpp * Author: corbin * * Created on April 25, 2018, 9:52 AM */ #include "transits.h" namespace lps{ Transits::Transits() { } Transits::Transits( ivg::Session *session_ptr, unsigned int dt ){ log<DETAIL>("*** computing transits"); _session_ptr = session_ptr; Setting...
ALGO
0.993542
6.209072
48178efb-dc1a-449e-b4bf-dd257ef2dd2f
alisw/llvm-project-reduced
libc/src/math/generic/lrintl.cpp
#include "src/math/lrintl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(long, lrintl, (long double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode< long double, long>(x); } } // namespace __l...
TOOL
0.96205
5.716153
566b7011-8f0f-4731-a9fd-7c68c060a180
subsub-e/codetree-TILs
240417/트리의 지름 3/diameter-of-tree-3.cpp
#include <iostream> #include <algorithm> #include <vector> #include <climits> #include <cstring> #include <queue> using namespace std; int n; vector<pair<int, int> > v[100001]; int root, result; int d[100001]; bool visited[100001]; priority_queue<int> pq; void dfs(int x, int len){ if(visited[x]){ return; ...
ALGO
0.999657
3.872414
d54562c3-49fd-44e5-9d05-a30cbfcf10d3
Terpodia/Competitive-Programming
Problems Solved/Codeforces/Data Structures/Gambling.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 f first #define s second #define p...
ALGO
0.999747
3.905668
8de05545-4b7a-487d-a660-2c7beaeab81e
federica-sibani/progetto2021
main.graphs.cpp
#include <SFML/Graphics.hpp> #include <iostream> #include <vector> #include "SIR.hpp" #include "graph.hpp" namespace Con = Contagion; int main(int argc, char* argv[]) { try { int S0 = argc > 1 ? std::atoi(argv[1]) : 0; int I0 = argc > 2 ? std::atoi(argv[2]) : 0; double beta = argc > 3 ? std::atof(argv[...
ALGO
0.970203
5.530055
05b7f53c-d658-491f-bff7-5f4e9f8ef723
xhaktmchl/Algorithm_study
BOJ/브루트포스(Brute_Force)/[백준 1182 c++ V] 부분수열의 합(순차재귀 풀이).cpp
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <cstring> // memset 헤더 using namespace std; // [백준 1182 c++ V] 부분수열의 합 // 문제: 원하는 합이 되는 부분수열의 갯수 구하기 // 접근: 부분수열 갯수 구하기 -> 완전탐색(재귀,dfs) -> 재귀 사용 // 재귀인자(현재 수열의 인덱스, 현재까지 부분수열 합) // 시간복잡도: O(2^n) : 2^20 < 1억 // 풀이1...
ALGO
0.999982
4.342053
c39ca751-3207-4cdc-a553-f6275ea82250
Suhail98/Problem-Solving
HackRank-DataStructure/Array and Linked List/arrays ds.cpp
vector<int> reverseArray(vector<int> a) { for(int i = 0;i < a.size()/2;i++) swap(a[i],a[a.size()-i-1]); return a; }
ALGO
0.980592
4.584442
a06e736a-c487-479e-bbe1-e404a86545c6
matejvu/OptimizationProjects
BoardDrillingBestRoute/main.cpp
#include<iostream> #include<cmath> using namespace std; const int N = 12; //8 -> Primer pod a) //12 -> primer pod b) //L2 norma: sqrt(sum(|x_i|^2)) typedef int hole[2]; const hole h1 = { 27, 331 }; const hole h2 = { 27, 568 }; const hole h3 = { 91, 403 }; const hole h4 = { 91, 528 }; const hole h5 = { 151, 496 }; ...
ALGO
0.999608
3.32008
1265f22e-9248-4d9a-99b7-0bee7dad3995
Vishnu8989/Competitive-coding
Leetcode/Programming Skills/191. Number of 1 Bits.cpp
class Solution { public: int hammingWeight(uint32_t n) { int count = 0; while(n >= 1){ if((n & 1)==1){ count+=1; } n = n>>1; } return (int)count; } };
ALGO
0.99965
6.227623
ce6d6942-9791-4a1b-82d2-7a1bedb36307
Adomnr/MISC-Projects
PageRank_Algorithm/Cpp Code/Submission/main.cpp
#include <iostream> #include <fstream> #include <sstream> #include <vector> #include <unordered_map> #include <cmath> #include <chrono> using namespace std; using namespace std::chrono; const double DAMPING_FACTOR = 0.85; const int MAX_ITERATIONS = 100; const double TOLERANCE = 1e-6; double max_rank = 0; unorde...
ALGO
0.999785
6.590543
3287bccd-7a30-47d8-bb45-b782fc1a11cc
Mr-Phoebe/ACM-ICPC
OJ/Leetcode/Algorithm/308. Range Sum Query 2D - Mutable.cpp
// Binary Indexed Tree class NumMatrix { public: NumMatrix(vector<vector<int>> &matrix) { if (matrix.empty() || matrix[0].empty()) return; mat.resize(matrix.size() + 1, vector<int>(matrix[0].size() + 1, 0)); bit.resize(matrix.size() + 1, vector<int>(matrix[0].size() + 1, 0)); for (i...
ALGO
0.999914
6.263848
9f663a7d-5fdb-4841-a7da-638d5dac372d
shentoumengxin/2024Autumn
Data Structure and Algorithm Anlysis/CS203 DSAA Code/.history/lab6/test_20241128183005.cpp
#include <iostream> #include <vector> using namespace std; class Node { public: int val; int level = 0; // 巨人到达时间 bool is_visit = false; // 是否访问过 vector<Node*> children; bool gaint=0; Node(int val = 0) : val(val) {} }; void dfs(Node* root, int level,vector<int> &sorted_gaints) { if (root ...
ALGO
0.999981
5.045434
1932e7b9-bee5-48fc-85d3-dd94355b08a8
aswindevsp/cp
codeForces/50A.cpp
#include <iostream> using namespace std; typedef long long ll; /////////////////////////////////////////////////////////////// void solve(){ int a, b; cin >> a >> b; int areaDomino = 1 * 2; int area = a * b; cout << area/areaDomino; cout << "\n"; } int main(){ //int t; //cin >...
ALGO
0.987444
4.284536
c5c6cec6-d198-49ca-b2e5-911a960d560a
aurora1409/CPP_Pro
spoj/Untitled65.cpp
#include<bits/stdc++.h> using namespace std; int main() { long long a,b,c,d; double x1,x2; cin>>a>>b>>c; d=b*b-4*a*c; x1=-((double)b+sqrt(d))/(2*a); x2=-((double)b-sqrt(d))/(2*a); if(a==0) { if(b==0) { if(c==0) cout<<"-1"; else cout<<"0"; } else printf("1\n%.5lf",-((double)c/b)); } else { i...
ALGO
0.999857
3.66355
6f4a41ff-dbbf-43c6-8ed3-fec1c3d0c220
wincle626/OpenPilot
ground/openpilotgcs/src/libs/eigen/bench/sparse_cholesky.cpp
// #define EIGEN_TAUCS_SUPPORT // #define EIGEN_CHOLMOD_SUPPORT #include <iostream> #include <Eigen/Sparse> // g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/lin...
ALGO
0.995695
4.147974
06aea55e-dd22-4b33-a4a8-03ec0f80e971
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/Phi/top0-100/largest-color-value-in-a-directed-graph-Solution.largestPathValue/177780_DoS_Exec_Code_Overflow.cpp
GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, GfxColorSpace *colorSpaceA) { GfxIndexedColorSpace *indexedCS; GfxSeparationColorSpace *sepCS; int maxPixel, indexHigh; Guchar *lookup2; Function *sepFunc; Object obj; double x[gfxColorMaxComps]; double y[gfxColorMaxComps]; int i, j,...
ALGO
0.972917
5.638931
4128de6d-b4ce-4e62-852d-27175fdcb521
jeounpar/codingtest-with-cpp
basic-algo-lecture/1541.cpp
#include <bits/stdc++.h> using namespace std; int main(void) { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int sum = 0; int ans = 0; int sign = 1; for (int i = 0; i < s.length(); i++) { if (s[i] == '-' || s[i] == '+') { ans += sum * sign; if (s[i] == '-') sign = -1; sum = ...
ALGO
0.999926
4.509137
76bded32-54f2-4d8d-bb2e-8694510b0743
dingjiefeng/cpp_primer_exercise
8/8_10/main.cpp
/** * 8.10ϰ * д򣬽һļебһvector<string> * ȻʹһistringstreamvectorȡԪÿζһ */ #include <iostream> #include <fstream> #include <sstream> #include <vector> using namespace std; int main() { string path = "D:\\c-primer_test\\8\\8_10\\"; ifstream fin(path+"data",ios::in); if (!fin) { cerr << "ļʧܣ" << e...
TOOL
0.917668
4.1831
adfd978b-c303-43a4-8977-1476dbf49715
brohithkr/codeProjects
CPP/coprime.cpp
#include <iostream> using namespace std; bool isPrime(int n) { for (int i = 3;i<int(n / 2);i++) { if(n%i==0) { return false; } } return true; } bool isPalindrome(int n) { string s = to_string(n); for (int i = 0;i<int(s.length() / 2); i++) { if (s[i] != s[s.len...
ALGO
0.999739
4.767694
0f65aa23-8941-4100-bc4b-82d5d6fccdf7
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_1991_1.cpp
#include <bits/stdc++.h> const long long MAX_N = 2e5 + 10; const long long MOD = 1e9 + 7; using namespace std; map<char, int> mp; set<int> ps[3]; int a[MAX_N]; int fen[MAX_N][3]; int n, q; void add(int x, int l, int d) { for (; x <= n; x += (x & -x)) fen[x][l] += d; } int ask(int x, int l) { int ans = 0; for (; x...
ALGO
0.999733
4.167947
7d8631b2-43c9-43d2-b6bc-af6d6b55d696
danieeeld2/DGIIM
Primero/1 Cuatrimestre/FP/Sesión 11/Clase/SinNombre1.cpp
#include <iostream> #include <cmath> using namespace std; class SegmentoDirigido{ public: double x_1, y_1, x_2, y_2; public: SegmentoDirigido(double origen_abscisa, double origen_ordenada, double final_abscisa, double final_ordenada){ if (...
TOOL
0.98544
4.254479
89822879-a93f-44c3-a14c-cb958c838343
sujalmahalaha/Leetcode_Practice
0515-find-largest-value-in-each-tree-row/0515-find-largest-value-in-each-tree-row.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.999981
6.110047
5536aeb3-9287-49a1-b1e2-7dcac28b89a7
senthilnathan01/DSA
NeetCode/two_pointers/valid_palindrome.cpp
/* A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. LC Link: htt...
ALGO
0.995921
6.385894
c4e7047e-3113-4507-8522-20f25b895a22
prashanthr11/Leetcode
practice/Count Odd Numbers in an Interval Range.cpp
class Solution { public: int countOdds(int low, int high) { if(low%2 == 0) low++; if(high%2 == 0) high--; int ans = (high - low) /2; ans++; return ans; } };
ALGO
0.999847
5.270936
e6a5a349-6079-46b0-93f1-6d42d66a9ef8
psj98/Baekjoon_Solve
C++/0. 단계별에 없는 문제/Bronze4/5532.cpp
#include <iostream> using namespace std; int main() { int a, b, c, d, l; scanf("%d %d %d %d %d", &l, &a, &b, &c, &d); if(a%c!=0) a=a/c+1; else a/=c; if(b%d!=0) b=b/d+1; else b/=d; printf("%d", l-max(a, b)); return 0; }
ALGO
0.999725
3.35418
362ebd1a-948c-425b-abeb-571f8caaafd1
vork/PyNanoInstantMeshes
native/ext/eigen/bench/sparse_lu.cpp
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out #define EIGEN_SUPERLU_SUPPORT #define EIGEN_UMFPACK_SUPPORT #include <Eigen/Sparse> #define NOGMM #define NOMTL #ifndef SIZE #define SIZE 10 #endif #ifndef DENSITY #define DENSITY 0.01 #endif #ifnd...
ALGO
0.996792
4.187482
b4019d91-78ad-430b-b56c-2684484b1e76
ishandutta2007/codeforces
maroonrk/normal/1023/E.cpp
#include <bits/stdc++.h> using namespace std; using ll=long long; #define int ll #define rng(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,b) rng(i,0,b) #define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--) #define per(i,b) gnr(i,0,b) #define pb push_back #define eb emplace_back #define a first #define b second ...
ALGO
0.999958
3.72783
19b35c40-9c12-49a7-a172-fdc25f6edc61
vikttorv/Coursework-on-Object-Oriented-Programming
src/Wave.cpp
#include "Wave.h" namespace my_math { Wave::Wave( ) : drawn_sides_(BOTH_SIDES), wave_status_(ORDINARY_WAVE), diffraction_grating_(nullptr) { } Wave::Wave(const Wave &that) : front_elements_(that.front_elements_), drawn_sides_(that.drawn_sides_), wave_status_(that.wave_status...
TOOL
0.889252
5.508786
a0d3b81a-bfdb-49b1-8751-ff51aad82a2a
daehoon12/algorithm
C++/Dynamic Programming/정수 삼각형 (1932).cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int answer = 0; int n; vector<int> dp[501]; void input() { cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { int k; cin >> k; dp[i].push_back(k); } } } int main() { input(); for (int i = 1; i < ...
ALGO
0.999828
3.557041
14d14ec3-d4af-4039-9704-fa71ad38cb82
rohitsigar/Codeforces
1505/C.cpp
#include <bits/stdc++.h> using namespace std; #define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define int long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) ...
ALGO
0.999996
3.81497
a7716a24-f7d5-4871-b042-d7fb9ec41892
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_72_10.cpp
#include <bits/stdc++.h> using namespace std; int n, m, k; int a[1000010]; int blo[1000010]; int ri[1000010]; long long ans; const long long INF = 1e18; long long cal(long long x) { long long r = 0; long long res = 0; while (r < n) { if (ri[r] == -1) return INF; long long tmp = ri[r] + x; res++; i...
ALGO
0.999945
3.488935
b30bb12d-b6ea-4457-9d8e-b62d3a0b4d56
ngocdaitran2003/Cau_truc_du_lieu_va_giai_thuat_VT_PTIT
CTDL013_To_hop.cpp
#include <bits/stdc++.h> using namespace std; int n, k, a[100], ok; void in() { for(int i = 1; i <= k; i++) { cout << a[i]; } cout << " "; } void sinh() { int i = k; while(a[i] == n - k + i) i--; if(i == 0) { ok = 0; } else { a[i]++; for(int j = i + 1; j <= k; j++) { a[j] = a[j-1] + 1; } }...
ALGO
0.999816
3.355576
6772a902-5f73-48a8-bac0-1a60fa6c1d8e
Adam27X/cpp-reference-material
accelerated-cpp-exercises/Chapter_05/07/framing.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> std::string::size_type width(const std::vector<std::string> &v) { std::string::size_type maxlen = 0; for(std::vector<std::string>::size_type i=0; i!=v.size(); ++i) { maxlen = std::max(maxlen,v[i].size()); } return maxlen; } std::vect...
ALGO
0.982553
5.90583
300d88ae-16a8-4b29-aeb3-da20a8c0b72e
Spider8801/LeetCode
main.cpp
#include <iostream> using namespace std; int main() { // Implementing Selection Sort int arr[] = {3,5,22,31,12,65,10}; int n = sizeof(arr)/sizeof(arr[0]); for(int i=0; i<n;i++) { for(int j=n; j>i;j--) { if (arr[i]>arr[j]) { int c=arr[i]; ...
ALGO
0.999915
4.301799
b9ca8317-806b-45db-9a01-9ebf5a56857e
FennelDumplings/leetcode-maxed_out
algorithm/cpp/prob1001-1500/prob1060_medium_Missing-Element-in-Sorted-Array.cpp
// prob1060: Missing Element in Sorted Array /* * https://leetcode-cn.com/problems/missing-element-in-sorted-array/ */ #include <vector> using namespace std; class Solution { public: int missingElement(vector<int>& nums, int k) { int n = nums.size(); return solve(nums, k, 0, n - 1); } pri...
ALGO
0.999877
4.909419
0f70cf45-7204-45e8-b12d-0394d3b888bd
cberdejo/FitMatch_frontend
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.998809
6.763549