uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
b806588e-d886-4aaa-b86d-21101a3971a3
Nishant-Bhosale/Competitive-Programming-CPP
CodeChef_Problems/Easy_Problems/CanReach.cpp
#include<iostream> using namespace std; int main(){ int t; cin>>t; while(t--){ int x, y, k; cin>>x>>y>>k; if(x % k == 0 && y % k == 0){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } } return 0; }
ALGO
0.99941
3.791941
0b18d168-1e96-4c21-9b47-faa3b7ab9b0a
MoonOS-Project/frameworks_av
media/codec2/vndk/util/C2ParamUtils.cpp
#define __C2_GENERATE_GLOBAL_VARS__ // to be able to implement the methods defined #include <C2Enum.h> #include <util/C2Debug-log.h> #include <util/C2ParamUtils.h> #include <utility> #include <vector> /** \file * Utilities for parameter handling to be used by Codec2 implementations. */ /// \cond INTERNAL /* -----...
TOOL
0.92386
7.1872
58921044-050f-43a9-ab29-2171d928cda8
ishandutta2007/codeforces
sfiction/normal/201/A.cpp
/* ID: Sfiction OJ: CF PROB: 201A */ /* N N N1(N*N+1)/2 N1..(N*N+1)/21 1. 2. 3.12 4. (N*N+1)/2x N */ #include <stdio.h> int main() { int s,n,x; scanf("%d",&x); if (x==3) n=5; else for (s=1,n=1;s<x;s=(n*n+1)/2) n+=2; printf("%d",n); return 0; }
ALGO
0.999617
3.211882
1afd627f-b854-4920-bafd-1a681034bde9
bear-cpp-course/MPAGS-CPP-Code-Day-6
MPAGSCipher/CaesarCipher.cpp
// Standard library includes #include <iostream> #include <string> #include <vector> // Out project headers #include "Alphabet.hpp" #include "CaesarCipher.hpp" CaesarCipher::CaesarCipher( const size_t key ) : key_{key%Alphabet::size} { } CaesarCipher::CaesarCipher( const std::string& key ) : key_{0} { // We h...
ALGO
0.99412
7.106662
351d4df9-494e-4dd2-aad1-a7543123da03
pawan999333/Leetcode_GFG_Solutions
0415-add-strings/0415-add-strings.cpp
class Solution { public: string add(string num1,string num2){ string ans; int index1=num1.size()-1; int index2=num2.size()-1; int sum,carry=0; while(index2>=0){ sum=(num1[index1]-'0')+(num2[index2]-'0')+carry; carry=sum/10; char c='0'+sum...
ALGO
0.999987
6.378889
727dcdfe-fd86-4f87-80e1-027b0dcb2ecb
WIZARD-CXY/pl
lintcode2/wigglesort.cpp
class Solution { public: /** * @param nums a list of integer * @return void */ //ref http://www.cnblogs.com/grandyang/p/5177285.html void wiggleSort(vector<int>& nums) { // Write your code here // O(n) solution // for(int i=1; i<nums.size(); i...
ALGO
0.999994
5.612055
d4f32e15-c954-4d44-b3c4-6e4485ecb9e9
yujnkk/Leetcode
29.cpp
class Solution { public: int divide(int div, int divs) { long long dividend = div; long long divisor =divs; if(divisor==1) return dividend; if(divisor==-1) { if(dividend==-2147483648) return 2147483647; return -dividend; } if(divisor==0) return 2147483647; bool flag = false; if(divide...
ALGO
0.99993
4.664726
bed26d7f-6c95-4f2d-b577-28694076182f
pullasunil/elements-of-programming-interviews
Parity.cpp
#include <cassert> #include <iostream> #include <limits> #include <random> #include "./Parity1.h" #include "./Parity2.h" #include "./Parity3.h" #include "./Parity4.h" using std::cout; using std::default_random_engine; using std::endl; using std::numeric_limits; using std::random_device; using std::uniform_int_distrib...
TEST
0.994336
4.775198
507a9712-d416-47fc-ba3c-767ac3b7eb2b
PaukIsUha/optimizing_formating_code
predictions/submissions-aizu-cot-gpt35/Codenet/p00884/141696737/improved.cpp
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <complex> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #includ...
ALGO
0.997797
4.403794
902c05d4-53df-40bb-b52a-a2e03c0da46c
Gabp0/desafios-da-programacao
src/week7/dilumeros.cpp
#include <bits/stdc++.h> using namespace std; #define xx first #define yy second #define cord pair<ll, ll> #define edge pair<ll, ll> #define PN cout << "\n" using ull = unsigned long long; using ll = long long; using ld = long double; using s = short; using us = unsigned short; long long pinf = 9223372036854775807; lon...
ALGO
0.999489
5.215165
9fcd1c30-2a1e-454a-b6ea-b92cccd2577d
stone-SJH/DataStructure-works
lab2/city.cpp
#include <iostream> #include <fstream> using namespace std; #define ave 2.3 class Mycity{ public: int **map; int **virtual_map; int *ans; int max_score; int row; int col; Mycity(int r,int c); void process(int p); void check(); void transmap(int & row_t,int & col_t); bool test(int p); bool val...
ALGO
0.999522
3.001212
245fa26e-2b6c-4152-b3de-c3c8139458e0
aaryan-00/Practice-Leetcode
0349-intersection-of-two-arrays/0349-intersection-of-two-arrays.cpp
class Solution { public: vector<int> intersection(vector<int>& a, vector<int>& b) { sort(a.begin(),a.end()); sort(b.begin(),b.end()); vector<int> ans; int n=a.size(),m=b.size(),i=0,j=0; while(i<n && j<m) { if(a[i]==b[j]) { if(an...
ALGO
0.999987
5.108542
7b1f3c42-1d81-43a2-bb0f-b68da5244e2c
netbeen/UncleZhou_UI
eigen-eigen-b30b87236a1b/bench/geometry.cpp
#include <iostream> #include <Eigen/Geometry> #include <bench/BenchTimer.h> using namespace std; using namespace Eigen; #ifndef SCALAR #define SCALAR float #endif #ifndef SIZE #define SIZE 8 #endif typedef SCALAR Scalar; typedef NumTraits<Scalar>::Real RealScalar; typedef Matrix<RealScalar,Dynamic,Dynamic> A; type...
ALGO
0.867474
5.941781
af793c7c-d69d-4399-8255-ea1431491393
0xBADEAFFE/xray-16-old
Externals/NVTT/src/nvtt/squish/rangefit.cpp
#include "rangefit.h" #include "colourset.h" #include "colourblock.h" #include <cfloat> namespace squish { RangeFit::RangeFit( ColourSet const* colours, int flags ) : ColourFit( /*colours, flags*/ ) { SetColourSet( colours, flags ); // initialise the metric bool perceptual = ( ( m_flags & kColourMetricPerceptua...
ALGO
0.889031
6.887067
f9190345-dfdb-458a-9ce8-f649abb8da33
peteristhegreat/qt-redbook-nehe-opengl
Redbook Examples/qtdof.cpp
/* * dof.c * This program demonstrates use of the accumulation buffer to * create an out-of-focus depth-of-field effect. The teapots * are drawn several times into the accumulation buffer. The * viewing volume is jittered, except at the focal point, where * the viewing volume is at the same position, each...
TOOL
0.911463
6.001519
13fe0c65-94ea-4749-a0c3-a3861eccd15b
MikamiTetsuro365/Atcoder
ABC081/C.cpp
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; typedef unsigned long long ll; typedef pair<ll, ll > pi; typedef pair<pair<ll, ll >, ll > pii; typedef pair<ll, pair<ll, ll > > iip; vector<ll > vec; vector<vector<ll > > vec2; ll MOD = 1000000007; int main(){ ll N, K; cin >> N >> K ; ...
ALGO
0.999949
3.743789
d47b72bb-0e61-4670-96f5-3ef73766a3c2
kushgupta-official/All_Programs
LeetCode/Daily Temperatures.cpp
class Solution { public: vector<int> dailyTemperatures(vector<int>& temperatures) { stack <int> stack; int n=temperatures.size(); vector <int> res(n); for (int i=n-1;i>=0;i--){ while(!stack.empty() and temperatures[stack.top()]<=temperatures[i]){ stack.pop...
ALGO
0.999975
6.447716
9cabb904-feac-4133-a874-6843c19908d4
lbryio/lbrycrd-dependencies
boost_1_59_0/libs/graph/example/fr_layout.cpp
// Authors: Douglas Gregor // Andrew Lumsdaine #include <boost/graph/fruchterman_reingold.hpp> #include <boost/graph/random_layout.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/topology.hpp> #include <boost/lexical_cast.hpp> #include <string> #include <iostream> #include <map> #include...
ALGO
0.997649
5.34516
ef3f4e91-6df9-46b2-854b-ba13eb1e5cb6
hashir-mohd/Data-Structures-And-Algorithm
5.Strings/subsequence.cpp
#include <iostream> using namespace std; void subsequence(string str1,string str2){ int m = str1.length(); int n = str2.length(); int j =0; for( int i = 0 ; i<m && j<n;i++){ if(str2[j]==str1[i]){ j++; } } if(j==n){ cout << "yes"<< endl; } else{ ...
ALGO
0.999986
4.690646
f42eaf35-ff67-4b58-9059-a71d7d15dc69
shivanibhat24/CPP-Programs
Leetcode Programs/sumoflargestprimesubstrings.cpp
class Solution { public: #define ll long long bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (ll i = 5; i * i <= n; i += 6) { if (n % i == 0 || n % (i + 2) ==...
ALGO
0.999902
5.05242
27a1afc7-9084-41e3-a9ce-45969d0618c5
shiver/blaze-lib
blazemark/src/boost/TDMatSMatAdd.cpp
//================================================================================================= //================================================================================================= //************************************************************************************************* // Includes //****...
ALGO
0.998093
5.548893
3eeca7fc-8e20-4673-88c9-3072dc6caaf6
DavidColson/Polyscript
tests/third_party/bimg/3rdparty/astc/astc_decompress_symbolic.cpp
/*----------------------------------------------------------------------------*/ /** * This confidential and proprietary software may be used only as * authorised by a licensing agreement from ARM Limited * (C) COPYRIGHT 2011-2012 ARM Limited * ALL RIGHTS RESERVED * * The entire notice above must be reproduced on...
ALGO
0.995903
3.3684
c5ba4204-bab3-48e0-9c47-04bc1c14633f
Parkgod98/Algorithm_Cpp
SWEA/D3/2817. 부분 수열의 합/부분 수열의 합.cpp
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <queue> using namespace std; vector<int> v; int cnt; int N, K; void DFS(int idx, int sum) { if (sum == K) { ++cnt; return; } if (idx == N) return; DFS(idx + 1, sum + v[idx]); DFS(idx + 1, sum); } int main() { int T; cin...
ALGO
0.999758
3.915672
623da09c-50c0-4b3f-abb9-ac51a2bb491c
Beltranmu/RICARDO_BELTRAN
CPP/StrategyRPG/Antekeland/deps/ImGui/misc/fonts/binary_to_compressed_c.cpp
// dear imgui // (binary_to_compressed_c.cpp) // Helper tool to turn a file into a C array, if you want to embed font data in your source code. // The data is first compressed with stb_compress() to reduce source code size, // then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i...
TOOL
0.909765
6.618106
f42e475e-faf1-4faa-bc98-85481fd17329
aakritii-p/DSA
trees/level_order_traversal.cpp
#include<iostream> #include<bits/stdc++.h> using namespace std; struct node { int data; struct node* left; struct node* right; node( int value) { data=value; right=NULL; left=NULL; } }; void level_order(node* root) { if(!root) return; queue<node*> q; q.push...
ALGO
0.999878
4.106691
a7deb174-aba0-49b4-a5c4-59c6c86fa464
linhghg/rkm
rkm.cpp
#include "rkm.h" namespace RKM { rkm::rkm(const std::string& input_file_name) { // all kinds of settings to be read std::string task_name; std::string kernel_name; size_t n_feature = 0; size_t n_sample = 0; double gamma; eq_precomputed = false; ...
DATA
0.969236
5.687791
89daf3f5-8a83-479d-8fd6-f13a62c3816d
MantleOS/frameworks_native
libs/gui/Surface.cpp
#define LOG_TAG "Surface" #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #include <gui/Surface.h> #include <condition_variable> #include <cstddef> #include <cstdint> #include <deque> #include <mutex> #include <thread> #include <inttypes.h> #include <android/gui/DisplayStatInfo.h> #include <android/na...
TOOL
0.881213
6.776706
d46ace92-b490-42b5-abe5-955ee7bc52be
cosdt/torch_backend
backends/npu/aten/ops/base/opapi/NormalKernelNpuOpApi.cpp
#include "aten/AclOpsInterface.h" #include "aten/OpApiInterface.h" #include "aten/utils/op_api_common.h" #include "framework/utils/RandomOpAdapter.h" namespace op_api { using npu_preparation = at_npu::native::OpPreparation; at::Tensor& normal_( at::Tensor& self, double mean, double std, c10::optional<...
TOOL
0.8732
6.93378
8c32d351-05d3-4d01-b4eb-7d7cc72b0c8d
gkumar9891/cpp-data-structures
dynamic-programming/shortest-commom-superseqence.cpp
#include <bits/stdc++.h> using namespace std; int LCS(string &x, string &y, int m, int n) { if(m == -1 || n == -1) return 0; if(x[m] == y[n]) return 1 + LCS(x, y, m-1, n-1); else return max(LCS(x, y, m-1, n), LCS(x, y, m, n-1)); } int main() { string x = "geek"; string y ...
ALGO
0.999896
4.357387
6ba5a044-1c2c-4f92-9602-b9d5f94ab929
dgcnz/competitive-programming
atcoder/abc179_c-axb+c.cpp
#ifdef DBG_MACRO_NO_WARNING #include <dbg.h> #endif #include <bits/stdc++.h> #define all(c) c.begin(), c.end() #define isz(c) (int)c.size() using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; using mii = map<int, int>; const int NMAX = 1e7 + 11; // okay for range <= INT_MA...
ALGO
0.999971
4.890873
75bb7a51-c3ff-45b6-b668-cc5badd36728
lureevnat/codesdope
cpp/03_operators/level_2/p2.cpp
/* Problem: Take a 4 digit number. Write a program to display a number whose digits are 2 greater than the corresponding digits of the number TAKEN. For example, if the number which was taken is 5696, then the displayed number should be 7818. */ #include <iostream> using namespace std; int main() { int d4, out; ...
ALGO
0.997164
6.070323
c4ec2879-abfb-4c70-a6b9-87eece37c1f2
saqihere/PD--semester-1
task2(CP).cpp
#include<iostream> using namespace std; void Reverse(string trueFalse); main () { cout << "Enter 'true' or 'false': "; string trueFalse; cin >> trueFalse; Reverse(trueFalse); } void Reverse(string trueFalse) { if (trueFalse == "true") {cout << "false";} if (trueFalse == "false") {c...
TOOL
0.998141
3.322118
8eff96a7-3a94-483c-89f7-4d9550d9485b
AmamiyaRenn/GAMES202
homework2/prt/ext/openexr/OpenEXR/IlmImf/ImfRgbaYca.cpp
//----------------------------------------------------------------------------- // // Conversion between RGBA and YCA data. // //----------------------------------------------------------------------------- #include <ImfRgbaYca.h> #include <assert.h> #include <algorithm> using namespace IMATH_NAMESPACE; using namespa...
ALGO
0.960572
7.339673
d87d6b8d-6cfd-4d5a-984a-6e446bb43a7c
RahmanMoshiur00/Problem-Solving
CodeForces/CF 1169C.cpp
#include <bits/stdc++.h> using namespace std; typedef unsigned long long intu; typedef long long int intl; //-----------------directions-----------------// // int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; //4 Direction // int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction // int dx[]={2,1,-1,-2,-2,...
ALGO
0.999969
3.943467
57b61c8a-8617-4bdb-92f6-342bf82f4cf1
Chi-Time/DAC415-Programming-Fundamentals
Excercises/Week_04/Code/James_J_Tutorial_04_Excercise_08/James_J_Tutorial_04_Excercise_08/main.cpp
#include <iostream> #include <conio.h> #include <string> #include <locale> #include <vector> void DisplayMenu (); void Entry (); std::string GetWord (); std::vector<std::string> SplitString (std::string line, char delimiter); bool IsPalindrome (std::string word); std::string ToLower (std::string string); int main () ...
TOOL
0.983426
4.894597
c272dd09-04fb-4c1b-9df0-4231a498f914
sib1ain/exam-practicals-12-cs
practicals/Practical.13.2.5/array-operation.cpp
/* 13.2.5 Write a C++ program for adding/ subtracting/ multiplying two integer matrices of the order up to 4x4. */ #include <iostream> using namespace std; const int MAX = 4; void inputMatrix(int matrix[MAX][MAX], int rows, int cols) { for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols;...
ALGO
0.999506
5.255423
b439b663-9171-4fe2-89a5-86ebfa5584a4
DooxFonggg/Data_struct_ptit_cpp
SCTDL099.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; int a[n]; for(int i =0; i<n; i++) { cin >> a[i]; } stack<int> st; int res[n]; for(int i =n-1 ; i>=0; i--) { while(!st.empty() && st.top() <= a[i]) { st.pop(); } res[i] = (st.emp...
ALGO
0.999968
4.882345
e975589a-8d0a-43f7-98af-a67b769c3f48
nkirov/nkirov.github.com
2014/NETB201/slides/ch04/fibloop.cpp
#include <iostream> using namespace std; /** Computes a Fibonacci number. @param n an integer @return the nth Fibonacci number */ int fib(int n) { if (n <= 2) return 1; int fold = 1; int fold2 = 1; int fnew; for (int i = 3; i <= n; i++) { fnew = fold + fold2; fold2 = fold; fold = ...
ALGO
0.999785
6.068566
9defd04c-08c0-4211-91aa-da08f53c426b
adamgf/zxing_iphone_pdf_417
symbian/QZXing/source/zxing/common/detector/MonochromeRectangleDetector.cpp
#include <zxing/NotFoundException.h> #include <zxing/common/detector/MonochromeRectangleDetector.h> #include <sstream> namespace zxing { using namespace std; std::vector<Ref<ResultPoint> > MonochromeRectangleDetector::detect() { int height = image_->getHeight(); int width = image_->getWidth(); int halfHei...
ALGO
0.941632
5.677298
24b7a13b-e622-46a3-8e97-7ba3b290b5dd
KushalShah1/GoFish
player.cpp
// // Created by kusha on 11/9/2019. // #include <cstdlib> #include "player.h" Player::Player() { myName="Unknown"; } void Player::addCard(Card c) { myHand.push_back(c); } void Player::bookCards(Card c1, Card c2) { myBook.push_back(c1); myBook.push_back(c2); } Card Player::chooseCardFromHand() const {...
TOOL
0.856813
3.37377
94097840-146c-4b08-b0e6-8aea14cb54f5
yibo-wong/basic_programming_practice
zhaozimu.cpp
#include <iostream> #include <cstring> #include <algorithm> #include <string> using namespace std; int a[30]; string s; int main() { getline(cin,s); for(int i=0;i<s.size();i++) { if('A'<=s[i]&&s[i]<='Z') { s[i]=s[i]-'A'+'a'; } a[s[i]-'a']++; } //cout<<s<<endl; int temp=0;int p=0; for(int i=0;i<=25;i++...
ALGO
0.999654
3.360762
2b11f84b-3442-4a12-920c-fc112efd4952
pas-enzo/bcc-unesp-trabalhos
Programação Competitiva/CSES-1716.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define F first #define S second #define ll long long #define ull unsigned long long #define ld long double #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define vc vector #define L cout << '\n'; #defin...
ALGO
0.999956
5.209268
dcbdd4ac-9ecd-40e2-ba8e-01258c8a321d
Yernar111/C-
st_является_ли_колво_каждой_буквы_одинаковым.cpp
#include <iostream> /* Является ли количество каждой отдельной буквы одинаковой в двух строках */ using namespace std; int main(){ string s,t; int k=0,m=0; cin>>s>>t; for (int i=0;i<s.size();i++){ k+=int(s[i]); } for (int i=0;i<t.size();i++){ m+=int(t[i]); } if (k==m) cout<<"YES"; else cout<<"NO"; ret...
ALGO
0.99999
3.857683
30417cd5-d271-42fa-ae5e-795d566e33c2
shklqm/Hackerrank
quicksort3.cpp
#include <iostream> using namespace std; template <class DataType> void partition(DataType theArray[], int first, int last, int &pivotIndex, int N) { DataType pivot = theArray[last]; // copy pivot int i = first; // index of last item in S1 int j = first; //index of 1st item in unknown fo...
ALGO
0.999885
4.795352
b163e324-412c-4a90-927a-5a4e1b73ac7e
linouk23/epi
Ch 12. Searching/Find the min and max simultaneously.cpp
#include "bits/stdc++.h" using namespace std; class Solution { public: struct MinMax { int smallest, largest; }; MinMax FindMinMax(const vector<int>& A) { if ((int)A.size() <= 1) { return {A.front(), A.front()}; } pair<int, int> global_min_max = minmax(...
ALGO
0.999833
4.748986
e453d77b-950f-445f-a65b-b8d9d1f15fab
hdlopesrocha/lithos-engine
math/Frustum.cpp
#include "math.hpp" Frustum::Frustum(glm::mat4 m) { m = glm::transpose(m); m_planes[Left] = m[3] + m[0]; m_planes[Right] = m[3] - m[0]; m_planes[Bottom] = m[3] + m[1]; m_planes[Top] = m[3] - m[1]; m_planes[Near] = m[3] + m[2]; m_planes[Far] = m[3] - m[2]; glm::vec3 crosses[Combinations] = { glm::...
ALGO
0.97561
6.614033
1c30c04a-d9fc-42db-a1c1-ca88128b207e
Aswinsrini/Programming-Practice
DSA/permutation.cpp
#include<bits/stdc++.h> using namespace std; class Solution { public: vector<vector<int>> permute(vector<int>& nums) { vector<vector<int>> result; permuateRecursion(nums,0,result); return result; } void permuateRecursion(vector<int>&num,int begin,vector<vector<int>>&result){ ...
ALGO
0.999973
5.814195
64a746a0-b935-4b1b-82f9-aa731964f4df
maxrenke/gppc-2015
gppc/PathCompetition/gppc-2014/entries/FirstMoveCompression/balanced_min_cut.cpp
#include "balanced_min_cut.h" #include "adj_array.h" #include <metis.h> #include <cassert> // link with -lmetis // compile with -O3 -DNDEBUG std::vector<bool>balanced_min_cut(const ListGraph&g){ assert(g.is_valid()); #ifndef USE_CUT_ORDER return {}; #else std::vector<int>out_begin; std::vector<int>out_dest; ...
ALGO
0.996873
5.514607
c51b85eb-c7e3-459d-8e23-9c52373167ed
coldEr66/online-judge
atcoder/ARC106/pA.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; #define RST(i,n) memset(i,n,sizeof i) #define SZ(a) (int)a.size() #define ALL(a) a.begin(),a.end() #define X first #define Y second #define eb emplace_back #ifdef cold66 #define debug(...) do{\ fp...
ALGO
0.999829
3.577048
edfc72b7-9dda-4ad4-8f97-e8aec7443500
mohiuddin007/DS-Basic
merge_k_sorted_element/merge_k_sort.cpp
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> PAIR; int main(){ int k; cin>>k; vector<vector<int>> allValues(k); for (int i = 0; i < k; i++) { int size; cin>>size; allValues[i] = vector<int>(size); for(int k=0; k<size; k++){ cin>>...
ALGO
0.999985
3.769618
cc47b048-dd57-4192-a2d6-7480d5e12338
nvnamsss/leetcode
Minimum Operations to Convert Number/main.cpp
/* You are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and you want to perform operations on x such that it is converted to goal. You can perform the following operation repeatedly on the number x: If 0 <...
ALGO
0.999976
5.968913
e9602b88-eeaa-4bec-af8b-9d19a7c5f0f3
Mugdha001/Problem-Solving
Selection_Sort.cpp
//selection sort #include <iostream> using namespace std; int main() { int arrsize; int ele; cout<<"Enter size of array"<<endl; cin>>arrsize; int arr[arrsize]; cout<<"Enter array elements"<<endl; int i=0,j=0; for(i=0; i<arrsize; i++){ cin>>ele; arr[i]=ele; } int temp=0; ...
ALGO
0.99842
3.373315
796d6343-04ad-4a26-9157-d0c496d9c5f1
shreyatpandey/Coding-Challenges
C++/Queue-Stack/Basic Calculator III.cpp
class Solution { private: int Result(queue<char>&Queue); public: int calculate(string s) { queue<char>Queue; for(char c:s) { if ( c != ' ') { Queue.push(c); } } /* put placeholder in Queue*/ Queue.push(' ...
ALGO
0.999923
4.446645
2dad8896-38bd-4929-9d84-d5f40ac16a90
sarvex/leetcode-go
solution/1200-1299/1234.Replace the Substring for Balanced String/Solution.cpp
class Solution { public: int balancedString(string s) { int cnt[4]{}; string t = "QWER"; int n = s.size(); for (char& c : s) { cnt[t.find(c)]++; } int m = n / 4; if (cnt[0] == m && cnt[1] == m && cnt[2] == m && cnt[3] == m) { return 0; ...
ALGO
0.999994
5.372143
e5b327a2-7f6b-43c1-b289-c46862b784bc
edexheim/info_ext_calib
src/backend/SegmentAccumulator.cpp
#include "calibration/backend/SegmentAccumulator.h" #include "calibration/utils/gtsam_utils.h" #include <gtsam/slam/BetweenFactor.h> #include <gtsam/geometry/Pose3.h> #include "calibration/utils/gtsam_utils.h" #include "calibration/camera_models/camera_model_factory.h" SegmentAccumulator::SegmentAccumulator( const B...
TOOL
0.908388
6.648749
c53f3430-e0a3-450e-ba30-ee213afa2016
tarunrawat87/Online-IDE
OnlineCompiler/testing/abc.cpp
#include<iostream> #include<stdio.h> int main() { int testcase,size,x,y,z; scanf("%d",&testcase); while(testcase--) { scanf("%d",&size); int array[size]; x=0; while(x<size) { scanf("%d",&array[x++]); } bool hasZero=false; int flag=0; x=0; while(x<size) { y=0; while(y<size) { z=0; while(z<size) { if(z!=x&&x!=y) { if(...
ALGO
0.999148
4.109165
8be973c0-667b-413c-94cc-203b6ab40eb8
Sobuj54/DSA-with-CPP
semester_3_XPSC/module_1_STL-1/7_map.cpp
/* key characteristics of map 1. map stores key value pairs 2. map stores key value pairs in ascending sorted manner 3. map doesn't contain any duplicate values */ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); map<int, int> mp; ...
ALGO
0.966887
5.129341
3459b0a9-87d3-4897-9eb0-500afe443c1f
ani37/codes
sieve.cpp
/* Template for Eratosthenes sieve */ // calculate primality upto const int N = 1000003; int isPrime[N]; void sieve() { // initially we thought that all numbers are prime fill(isPrime, isPrime + N, 1); // 0 and 1 are not primes isPrime[0] = isPrime[1] = 0; // the iteration for (int i = 2...
ALGO
0.998581
4.804887
fa8c7d2f-95ed-4cf4-9efb-e8c76ab61c17
visho33/xd
Dijkstra.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,int> ii; int main(){ int v, e; cin>>v>>e; vector<vector<ii> > edges(v); vector<ll> pesos(v, 1e9); pesos[0] = 0; for(int i = 0; i<e; i++){ int a, b, c; cin>>a>>b>>c; ii x(c, a); ii y(c, b); edges[a].push_back(y); ed...
ALGO
0.99998
3.756516
6c6ffe9f-72d9-4cdb-8436-c1fd6a679391
kbc19b31/Game
GameTemplate/Game/bulletPhysics/src/Bullet3OpenCL/BroadphaseCollision/b3GpuParallelLinearBvhBroadphase.cpp
/* This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it f...
ALGO
0.945456
6.127395
f9cdc481-bb92-43ef-885b-57e7bbe5eadb
starsleep/SLAM
Library/eigen-3.4.0/bench/perf_monitoring/trmv_upt.cpp
#include "gemv_common.h" EIGEN_DONT_INLINE void trmv(const Mat &A, Vec &B, const Vec &C) { B.noalias() += A.transpose().triangularView<Upper>() * C; } int main(int argc, char **argv) { return main_gemv(argc, argv, trmv); }
ALGO
0.952233
4.898617
e5413579-427a-41c6-a9e0-9aa537934e02
zetapii/Algo-Engineering-Project
Tarjan.cpp
#include "bits/stdc++.h" using namespace std; vector< vector<int> > vec; vector< vector<int> > tree; vector< vector<int> > nontree; int edgcnt; void generateGraph(int n) { vec.resize(n+10); tree.resize(n+10); nontree.resize(n+10); cin>>edgcnt; for(int i=1;i<=edgcnt;i++) { int x,y; ...
ALGO
0.998233
4.397004
b317491a-f9f7-4062-9762-5a21d66fb39a
johnnessantos/programacao-competitiva
uri/Maratona/ERIMT- 2015/A - UOJ_1323 - (2264344) Accepted.cpp
#include<iostream> using namespace std; int fey(int n){ if(n==1){ return 1; }else{ return n*n + fey(n-1); } } int main (){ int N; while (cin>>N && N!=0){ cout<<fey(N)<<endl; } return 0; }
ALGO
0.999911
4.071633
508c5263-4f52-41ea-ad7d-55f758c23647
rQAQ/code
排序模板/ALDS 1_2_D Shell Sort.cpp
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<vector> using namespace std; long long cnt; int n,l,A[1000000]; vector<int> G; //指定了间隔g的插入排序 void insertionSort(int A[],int n,int g){ for(int i=g;i<n;i++){ int v=A[i]; int j=i-g; while(j>=0&&A[j]>v) { A[j+g]=A[j]; j-=g; c...
ALGO
0.999801
3.059418
93377654-0dca-4c8c-9031-d04073c6c711
restacksyj/codeforces
1927f.cpp
#include <bits/stdc++.h> #include <iostream> using namespace std; // Outputs #define yes cout << "YES" << endl #define no cout << "NO" << endl // Constants #define PI 3.141592653589793238 #define INF LONG_LONG_MAX #define MOD 1e9 + 7 // Faster Input Output #define FAST_IO (ios_base::sync_with_stdio(false), std::cin...
ALGO
0.999769
5.418237
2daa976b-35c9-48cf-8b29-2277f2581707
bjaraujo/netgen-cmake
libsrc/meshing/specials.cpp
#include <mystdlib.h> #include "meshing.hpp" namespace netgen { // A special function for Hermann Landes, Erlangen void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh) { int i, j; int nse = othermesh.GetNSE(); int onp = othermesh.GetNP(); int ne = mesh.GetNE(); PrintMessage (1, "other mesh has ", ...
ALGO
0.951121
4.107257
37432eb0-e102-4b9e-8fe3-5c5ad0d416e5
byrantwithyou/PhysBAM
Public_Library/Solids/Solids_Evolution/BW_BACKWARD_EULER_SYSTEM.cpp
using namespace PhysBAM; //##################################################################### // Constructor //##################################################################### template<class TV> BW_BACKWARD_EULER_SYSTEM<TV>:: BW_BACKWARD_EULER_SYSTEM(SOLID_BODY_COLLECTION<TV>& solid_body_collection,BW_COLLISION...
ALGO
0.998986
3.818212
c60f26bc-b9ec-4b1d-b79c-fcb6d5a3f027
adimuntoiu/subiecte-atestat-c-
17/main.cpp
#include <iostream> #include <fstream> using namespace std; ifstream fin("matrice.in"); int n,a[51][51]; void citire(){ fin>>n; for (int i=1; i<=n; i++) for (int j=1; j<=n; j++){ fin>>a[i][j]; } } bool verifSimetric(){ for (int i=1; i<=n; i++){ for (int j=1; j<=n; j++){ ...
ALGO
0.999872
4.09304
0c117671-b806-49c4-b480-767de4861ac5
sarvex/leetcode-powershell
solution/0000-0099/0051.N-Queens/Solution.cpp
class Solution { public: vector<vector<string>> solveNQueens(int n) { vector<vector<string>> res; vector<string> g(n, string(n, '.')); vector<bool> col(n, false); vector<bool> dg(2 * n, false); vector<bool> udg(2 * n, false); dfs(0, n, col, dg, udg, g, res); r...
ALGO
0.999737
6.423236
081e332e-2c91-4cbd-889e-637d9bed6a54
cvoznak/Udemy
Course_01/C++ Language/Vetores/dados_pessoais.cpp
#include <iostream> #include <iomanip> using namespace std; int main() { int i, n; cout <<"Quantas pessoas serao digitadas? "; cin >> n; double altura[n], menorAltura, maiorAltura, mediaF, somaF(0); char sexo[n]; int conteF(0); for (i = 0; i < n; i++) { cout <<"Altura da " << i ...
TOOL
0.956018
3.41982
656c42a3-7b9b-4d7d-98a5-e2b38f256529
ismdeep/ICPC
lightoj/1042/main.cpp
/* * Project : 1042 * File : main.cpp * Author : iCoding * * Date & Time : Thu Aug 30 14:03:49 2012 * */ #include <iostream> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <queue> #include <set> #include <algorithm> using namespace std; typedef long long int long...
ALGO
0.999938
4.292225
87c2072f-1454-400a-93c3-9f1745a6632f
Baibhavsingh07/Data-structures
165-compare-version-numbers/compare-version-numbers.cpp
class Solution { public: int compareVersion(string a, string b) { int i,j,c=0,s=0; vector<int>x; vector<int>y; for(i=0;i<a.size();i++){ string v; j=i; while( j<a.size() and a[j]!='.') v+=a[j++]; i=j; x.push_back(stoi(v));...
ALGO
0.999091
4.804048
4f82ef89-e80e-4af3-bb1c-5e9b12d5b7d3
RuiHuangNUS/MARS-FTCC
Dynamical_Trajectory/src/utils/include/igl/copyleft/cgal/order_facets_around_edge.cpp
#include "order_facets_around_edge.h" #include <Eigen/Geometry> #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <stdexcept> // adj_faces contains signed index starting from +- 1. template< typename DerivedV, typename DerivedF, typename DerivedI > void igl::copyleft::cgal::order_facets_aro...
ALGO
0.99881
7.538812
e85f08c7-666a-4638-a04d-e3a5f93e7697
qbit-t/qbit
boost/libs/numeric/odeint/examples/list_lattice.cpp
/* example showing how odeint can be used with std::list */ #include <iostream> #include <cmath> #include <list> #include <boost/numeric/odeint.hpp> //[ list_bindings typedef std::list< double > state_type; namespace boost { namespace numeric { namespace odeint { template< > struct is_resizeable< state_type > { //...
ALGO
0.949524
4.658546
afba3d19-b586-4fcf-a056-8abe2fc3253c
Aaryalegend/GFG-Codes
Difficulty: Medium/Directed Graph Cycle/directed-graph-cycle.cpp
class Solution { private: bool dfsCheck(int node, vector<vector<int>> &adj, int vis[], int pathVis[]) { vis[node] = 1; pathVis[node] = 1; // Traverse adjacent nodes for(auto it : adj[node]) { if(!vis[it]) { if(dfsCheck(it, adj, vis, pathVis) == ...
ALGO
0.999952
6.500327
b65fa0aa-1039-4f82-8d52-b90305e64c11
eXascaleInfolab/bench-vldb20
NewAlgorithms/cpp/Performance/Benchmark.cpp
// // Created by Zakhar on 16/03/2017. // #include <chrono> #include <iostream> #include <tuple> #include "Benchmark.h" #include <cassert> #include "../Algorithms/MeanImpute.h" #include "../Algorithms/LinearImpute.h" using namespace Algorithms; namespace Performance { void verifyRecovery(arma::mat &mat) { for...
TEST
0.943843
6.199501
b92b6183-b071-44c6-9de5-e045ef90f439
galliume/AdventOfCode2020
AdventOfCode2020/day10/day10.cpp
#include <fstream> #include <iostream> #include <algorithm> #include <vector> using namespace std; int tribonacci(int n) { if (n <= 1) { return 1; } else if (n == 2) { return 2; } else if (n == 3) { return 4; } else { return tribonacci(n - 1) + tribonacci(n - 2) + tribonacci(n - 3); } } void day1...
ALGO
0.999428
4.661106
b948978d-eb01-4c09-9860-f56d40961d59
kjsce-codecell/Intro-to-CPP24
Basics/10_pointers.cpp
#include <bits/stdc++.h> using namespace std; // you can read '*' as 'value at' and '&' as 'address of'. int main() { int a = 5; int *point_a = &a; // This is a pointer variable. It stores the address of the variable a. // To declare pointer variable, use the * sign before the variable name. ...
ALGO
0.998374
3.150991
2f8da310-fc60-47f5-8cf5-06439e35ec81
alvin-anto/Ants-and-Beetles-Game
Ant.cpp
#include <string> #include "Ant.h" //overridden constructor for Ant Ant::Ant() : Creature(){} //empty destructor Ant::~Ant(){} //move method takes in the distances to the beetle in the orthogonal directions as the arguments and //determine and return the direction the ant is to be moved std::string Ant::move(int nor...
ALGO
0.996796
4.201632
fe44f115-496a-4566-8646-e61a0f723c15
CyberLemonade/RayTrace
ext/eigen/test/denseLM.cpp
#include <iostream> #include <fstream> #include <iomanip> #include "main.h" #include <Eigen/LevenbergMarquardt> using namespace std; using namespace Eigen; template<typename Scalar> struct DenseLM : DenseFunctor<Scalar> { typedef DenseFunctor<Scalar> Base; typedef typename Base::JacobianType JacobianType; typed...
TEST
0.975995
5.862647
764a815a-9e4c-42a5-ac7f-d073d7ac5d1f
RafaelChavesPB/CompetitiveProgramming
uri_1094.cpp
#include <bits/stdc++.h> using namespace std; int main(){ char type; int total=0; int c=0,r=0,s=0; int n,q; ios::sync_with_stdio(false); cout<<fixed<<setprecision(2); cin>>n; while(n--){ cin>>q>>type; total+=q; switch(type){ case 'C': ...
ALGO
0.969425
3.610269
daeb3097-f316-4186-b6ad-8d6c7275a624
Fikazlf/CodeUnity_CodingClass
Pertemuan 3/Sorting.cpp
#include <iostream> // Library standar C++ yang menyediakan fungsi input dan output. #include <cstdlib> // Library standar C++ yang menyediakan fungsi untuk manajemen memori dinamis, pengaturan environtment, dll. #include <ctime> // Library standar C++ yang menyediakan fungsi-fungsi terkait waktu dan tanggal. using nam...
ALGO
0.999949
6.078228
1f1409cd-8126-4214-8119-6d78744dd527
thinhvip1/SPOJ
Inversion_Count.cpp
#include <bits/stdc++.h> using namespace std; // using ll = long long; typedef long long ll; ll merge(vector<int> &v, int l, int m, int r){ vector<int> x(v.begin()+l, v.begin()+m+1); vector<int> y(v.begin()+m+1, v.begin()+r+1); int i = 0, j = 0; ll cnt = 0; while(i < x.size() && j < y.size()){ ...
ALGO
0.999842
4.465194
91366a46-da0a-4f03-bc30-09fc234531a8
aditi2802/LeetCode
912-sort-an-array/912-sort-an-array.cpp
class Solution { public: vector<int> sortArray(vector<int>& nums) { vector<int> ans; priority_queue<int, vector<int>, greater<int>> minHeap; for(int i=0;i<nums.size();i++){ minHeap.push(nums[i]); } while(minHeap.size()!=0){ ans.push_b...
ALGO
0.999991
5.914338
77960673-fefb-44d2-af35-0b4ff3d5d2c1
Coach-Academy/Winter-1-2023
Level 1 Class 2/Practice G2/Week 06/C - Translation.cpp
#include <iostream> #include <algorithm> using namespace std; int main() { string s, t; cin >> s >> t; reverse(s.begin(), s.end()); if (s == t) cout << "YES\n"; else cout << "NO\n"; }
ALGO
0.99999
4.481948
23ab1851-88b2-47e0-ac79-ea0ba3c69620
jimmy-hsin/Leetcode-record
c++/1769. Minimum Number of Operations to Move All Balls to Each Box/Brute Force.cpp
class Solution { public: vector<int> minOperations(string boxes) { int n=boxes.size(); vector<int> res(n,0); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(boxes[j]=='1') res[i]+=abs(i-j); } } return res; } };
ALGO
0.999978
5.629554
967d8d7a-082c-4b26-8878-260ed849df0c
dzuizz/mrJudge
badpotato.cpp
#include <iostream> #include <vector> using namespace std; int main(){ int n, e, maxtotal=0, total = 0; cin >> n; for(int i=0;i<n;i++){ cin >> e; if(e>=0){ total += e; }else{ if(total>maxtotal){ maxtotal = total; } tota...
ALGO
0.999947
4.047506
6e88dfae-f68e-484f-92cf-77ff15ecfc46
mahaoming2022/lib
ATCoder/ABC265-ABC285/ABC271E.cpp
#include <bits/stdc++.h> #define rep(i,l,r) for(int i=l;i<=r;i++) using namespace std; typedef long long ll; typedef long double db; const int N=2e5+23; int n,m,k; ll a[N],b[N],c[N],dp[N]; int main() { #ifndef ONLINE_JUDGE freopen("in.in","r",stdin); freopen("out.out","w",stdout); #endif cin>>n>>m>>k; ...
ALGO
0.999968
3.953964
de1acc16-9ff1-4047-82ee-2f4d5d02963e
sxs-collaboration/spectre
src/Evolution/Systems/Cce/LinearSolve.cpp
#include "Evolution/Systems/Cce/LinearSolve.hpp" #include <cstddef> #include "DataStructures/ApplyMatrices.hpp" #include "DataStructures/DataVector.hpp" #include "DataStructures/Matrix.hpp" #include "DataStructures/SpinWeighted.hpp" #include "DataStructures/Transpose.hpp" #include "NumericalAlgorithms/LinearOperators...
ALGO
0.999765
6.418654
0eb512e9-1a97-47c9-b879-889c91dad87e
a1k2-c3/Leetcode
3024-type-of-triangle/3024-type-of-triangle.cpp
class Solution { public: string triangleType(vector<int>& nums) { sort(nums.begin(), nums.end()); int a = nums[0]; int b = nums[1]; int c = nums[2]; if (a + b <= c) return "none"; if (a + b < c && a * a + b * b == c * c) return "scalene"; ...
ALGO
0.999934
5.707022
e317575f-0331-467d-b2a8-e8b608d6a1a1
Jatin-Shihora/LeetCode-Solutions
0703-kth-largest-element-in-a-stream/0703-kth-largest-element-in-a-stream.cpp
class KthLargest { public: priority_queue<int, vector<int>, greater<int>> pq; int size; KthLargest(int k, vector<int> nums) { size=k; for(int i=0;i<nums.size();i++) { pq.push(nums[i]); if(pq.size()>k) pq.pop(); } } int add(int val) { pq.pus...
ALGO
0.999975
5.894912
2a5c0ba8-603a-401f-b2ce-c8a918df2d24
shu8Cream/atcoder-archive
atcoder.jp/abc164/abc164_b/Main.cpp
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main(){ int a,b,c,d; cin >> a >> b >> c >> d; int t=0; while(a>0 && c>0){ if(t%2==0) c-=b; else a-=d; t++; } if(a>0) cout << "Yes" << endl; else cout <<...
ALGO
0.999929
3.19272
7f709e25-08ff-4e6d-8b08-c1ffaf9dad1e
it5prasoon/DSAlgo-n-CP
Codeforces/DIV 3/Round 725/C_Number_of_Pairs.cpp
// Keep it simple #include <bits/stdc++.h> using namespace std; #define endl "\n" #define Br cout<<endl #define int long long #define fe first #define se second #define double long double #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define PT(x) cout << (x) << endl #define last(x) prev(x.end()...
ALGO
0.999797
4.408957
00f6c2bd-cac8-43e7-b063-141419d106d2
ishandutta2007/codeforces
depth_first_search/normal/796/F.cpp
#include<bits/stdc++.h> #define Tp template<typename Ty> #define Ts template<typename Ty,typename... Ar> #define Rg register #define RI Rg int #define Cn const #define CI Cn int& #define I inline #define W while #define N 300000 #define INF (int)1e9 using namespace std; int n,m,a[N+5],w[N+5],s[N+5];set<int> G; namespac...
ALGO
0.999981
3.441785
0d5a6a95-771d-41c6-93b1-1fef3d1b054d
weithegreat/fastmpcsolver
mpc_qt.cpp
// g++ mpc_test.cpp -o mpctest -std=c++11 -larmadillo #include <armadillo> #include <iostream> #include <stdlib.h> using namespace std; using namespace arma; mat A_d_all; mat B_d; mat H, C; int HORIZON; float dT = 0.01; void blkdiag(mat, mat, mat&); void bldMatrixDiag(float*, mat&, int); void pushMatrix_row(mat&...
ALGO
0.991727
4.073256
fc1f0323-2e42-435f-b12b-fa863bf7cadd
SI-Abid/Hello-world
Codeforces/1611c.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; vector<int> a,lt,rt; int l=0,r=n-1; for(int i=0;i<n;i++) { int x; cin>>x; a.push_back(x); } if(a[0]!=n...
ALGO
0.999913
3.749775
ad0b1888-8363-40a9-9217-4e977cb028a0
WeeWeektor/Task-2_Kursova_sys_prog
src/calculator.cpp
#include "calculator.h" int Add(const int a, const int b) { return a + b; } int Sub(const int a, const int b) { return Add(a, -b); }
TOOL
0.898998
5.274754
3d92c19e-5d90-4176-b8e9-351d0df8133e
hoango277/Data_Structures_Algorithms-PTIT
DSA06010 - SẮP XẾP CHỮ SỐ.cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; map<char, int> m; cin.ignore(); string s; getline(cin, s); for(auto i : s) m[i]++; for(auto i : m) cout << i.first << ' '; cout << endl; } }
ALGO
0.999401
3.917587
438ef72a-c849-440e-8f32-952384f6bcdb
BaoZhuhan/Awesome-SE-Box
00课程技术栈/ACMTrain/2023WinterTrain/WinterClass/Day1/标准并查集.cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 10; int fa[MAXN]; //存储每个元素的父节点 void init(int n){ for(int i = 1 ; i <= n ; i++){ fa[i] = i;//初始化阶段,每个节点的父节点都是自己 } } //不进行路径压缩的查询 int find(int i){ if(fa[i] == i){ //递归出口,如果到达了祖先位置,就返回祖先 return i; }else{ ...
ALGO
0.999918
4.010916
fdf3f29b-4a94-452e-9bfb-2be7285cc2b3
shubhamjaiswar43/cpp-templates
code-library/Dynamic Programming Optimizations/Persistent Li Chao Tree.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define eb emplace_back #define nl '\n' #define deb(x) cerr << #x" = " << x << nl #define in() ( { int a ; scanf("%d", &a); a; } ) const int N = 1e5 + 9; const int mod = 1e9 + 7; struct Line { ll k, d; ll eval(ll x) { return k * x + d; } }; ...
ALGO
0.999972
3.998137