uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
ec2fc19e-efa0-42db-b3b5-322b823a627c
Dipankar-Kumar-Singh/Codeforces
C_Inversion_Graph.cpp
#include <bits/stdc++.h> using namespace std; #define t_case int ttt {} ; cin >> ttt ; while(ttt--) #define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define nl "\n" void observation() { int n; cin >> n; vector<int> v(n); for (auto &x : v) cin >> x; int m = 0; ...
ALGO
0.999817
5.301759
846b503d-2051-466d-9a04-0e04f3cc3c08
stresiden/_3dposeopencv
modules/objdetect/src/qrcode.cpp
#include "precomp.hpp" #include "opencv2/objdetect.hpp" #include "opencv2/calib3d.hpp" #ifdef HAVE_QUIRC #include "quirc.h" #endif #include <limits> #include <cmath> #include <iostream> #include <queue> #include <limits> #include <map> namespace cv { using std::vector; static bool checkQRInputImage(InputArray img, ...
ALGO
0.999104
3.818687
e0336f98-023e-4d8b-9329-6a8dfc881546
ishandutta2007/codeforces
sohsoh/normal/584/C.cpp
/* Soheil Mohammadkhani I will change this text here when i've got "Candidate Master":) */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; #define all(x) (x).begin(),(x).end() #define X first ...
ALGO
0.999993
4.31062
d215a20d-1d0c-4adc-a0f0-4bd89f0e9f73
ammar2912/RESTAPI1
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998859
6.785645
60bf90e6-29ed-4b63-906e-9692eeb7ee09
alexjball/project-euler
problem1.cpp
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int sum = 0; for (int i = 0; i < 1000; i++) { if (i % 3 == 0 || i % 5 == 0) { sum += i; } } cout << "Sum: " << sum << endl; }
ALGO
0.999553
4.881828
afb7879d-8900-46e5-9770-ebb3d0d45804
begla/Intrinsic
IntrinsicCore/src/IntrinsicCoreRenderingIBL.cpp
// Precompiled header file #include "stdafx.h" #define PRE_FILTERING_BLOCK_SIZE 32u namespace Intrinsic { namespace Core { namespace Rendering { namespace IBL { namespace { _INTR_INLINE void _preFilterGGXOpt(const gli::texture_cube& p_Input, gli::texture_cube& p_Output, ...
ALGO
0.997092
5.721501
4ffe6da5-6afe-4ff9-a157-01105c7500e5
kit-cml/2drugFDC
modules/drug_sim.cpp
#include "drug_sim.hpp" #ifdef TOMEK_2019 #include "../cellmodels/Tomek_model.hpp" #else #include "../cellmodels/Ohara_Rudy_2011.hpp" #endif #include "commons.hpp" #include <cmath> void do_drug_sim(const double conc_a, const double conc_b, std::array<double, 14> ic50_a, std::array<double, 14> ic50_b, std::array<d...
ALGO
0.998685
5.674953
ae271abd-ddb0-46a9-971f-55c048110770
legendsovermyths/DSA
C++/KnapSackDP.cpp
#include <iostream> #include <algorithm> using namespace std; int solutionToProblemDuh(long long int n, long long int m, long long int arr1[]) { long long int arr[m + 1][n + 1] = {}; for (long long int i = 1; i <= m; i++) { for (long long int j = 1; j <= n; j++) { if (j >= arr1[i...
ALGO
0.999979
3.944414
1b4dc11c-c43c-4d97-8e57-77161d8cd6c6
Vit7Z/origin
02_base_progr_cpp/02_task_0503/02_task_053.cpp
#include <iostream> #include <fstream> #include <string> #include <clocale> #include <locale.h> #include <windows.h> //----------------------------------------------------------------------------- class Figure { protected: std::string name; unsigned short numberOfSides; Figure(std::string name_, unsigne...
TOOL
0.855392
3.319035
fb5c872a-1259-457d-8cec-6e4ffa9731a1
ishandutta2007/codeforces
kmjp/normal/892/A.cpp
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZER...
ALGO
0.999924
3.212688
5e47c65a-c674-4d4f-b2de-f4d10f816c46
royun0307/baekjoonstart
1764/1764.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> int main() { int n, m; std::map <std::string, int> list; std::vector <std::string> result; std::cin >> n >> m; for (int i = 0; i < n + m; i++) { std::string tmp; std::cin >> tmp; list[tmp]++; if (list[tmp] > 1) {...
ALGO
0.999982
3.512797
8dd8d390-ecc6-4de6-b201-e8378f612024
Asrarul320/Cplus_plus_DSA_Assignment_PW
(12) Advance Sorting/Lecture 33/question3.cpp
// Q3 Given an integer array nums of length n where all the integers of nums are in the range [1, // n] and each integer appears once or twice, return an array of all the integers that appears // twice. // You must write an algorithm that runs in O(n) time and uses only constant extra space. // [Leetcode 442] // Ex...
ALGO
0.999863
6.851274
f07a9a90-c4d3-4688-bc8e-739baeba4c0c
sangne-lyer/C-PTIT-2024
b19.cpp
#include<stdio.h> int demtu(char s[]){ int count = 0; for(int i = 0; s[i] != 0; i++){ if(s[i] >= 'a' && s[i] <= 'z' || s[i] >= 'A' && s[i] <= 'Z') ++count; } return count; } void doctep(char s[]){ FILE *f; f = fopen("input.txt", "r"); fgets(s, 1000, f); fclose(f); } int main(){ char s[1000]; doctep(s); ...
ALGO
0.996373
3.557925
4a3e699c-1739-4469-864e-a4f60cc6a085
FranciscoMoretti/coding-challenges
hackerrank/sherlock_and_anagrams.cpp
#include <bits/stdc++.h> using namespace std; // Complete the sherlockAndAnagrams function below. long long int sherlockAndAnagrams(string s) { int len = s.size(); map<string, int> ordered_subs; for (size_t i = 0; i < len; i++) { for (size_t j = i + 1; j <= len; j++) { stri...
ALGO
0.999824
4.977345
ccf11306-0f14-411a-8cb7-981e9cde0773
dajasko/PiAAprojekt2
dijkstra.cpp
#include <iostream> #include <random> #include <chrono> #include <vector> #include <queue> #include <chrono> #include <functional> #include<fstream> using namespace std; #include <C:\Users\admsl\projects\helloworld\graph\graphclass.hpp> #include<C:\Users\admsl\projects\helloworld\graph\graphgenerator.hpp> template <ty...
ALGO
0.938975
4.199777
65836234-d99d-4d5e-8d05-a75e87e8e662
mayazach/K-means
gridcurves.cpp
#include <iostream> #include <cmath> #include "curve.h" #include "gridcurves.h" #include "randomnum.h" #include "distance.h" using namespace std; /** Takes a curve, converts it to k grid curves using k values of t (tvalues array) between 0 and d, and returns an int value to be used for hashing. hash value decided w...
ALGO
0.998999
5.738046
742e8953-cd99-4b81-8643-e860340748fa
Batishavo/Competitive-programing
2024/04-abril/14/108. Convert Sorted Array to Binary Search Tree.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.999996
6.705296
61cf265b-4ee3-4e9a-a60b-312fc8482510
PieroM97/Computer-Vision-Chess
stockfish-10-win/src/material.cpp
#include <algorithm> // For std::min #include <cassert> #include <cstring> // For std::memset #include "material.h" #include "thread.h" using namespace std; namespace { // Polynomial material imbalance parameters constexpr int QuadraticOurs[][PIECE_TYPE_NB] = { // OUR PIECES // pair pawn k...
ALGO
0.9971
6.509744
7bd6e686-69d6-4278-9b25-e29cc31e448b
firiexp/contest_log
codeforces/1138C.cpp
#include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> static const int MOD = 1000000007; using ll = int64_t; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::ma...
ALGO
0.99993
3.395663
b7002886-8e4a-4030-9fc6-0b6dd0b6f4ac
euchangxian/LeetCode
C++/2375-ConstructSmallestNumberFromDIString/Solution.cpp
#include <algorithm> #include <cstddef> #include <cstdlib> #include <string> #include <string_view> class Solution { public: std::string smallestNumber(std::string_view pattern) { // Starting with an increasing sequence, // we can reverse contiguous substrings corresponding to sequences of Ds const int ...
ALGO
0.999928
7.515094
ef43baca-10ae-450c-9c5e-6aed475d8530
ishandutta2007/codeforces
dreamoon_love_aa/normal/343/A.cpp
#include<stdio.h> #include<string> #include<math.h> #include<stdlib.h> #include<set> #include<bitset> #include<map> #include<vector> #include<string.h> #include<algorithm> #include<iostream> #include<queue> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ...
ALGO
0.999446
3.712851
abc7f049-1561-4689-b3a6-041c68ee42e3
revbayes/revbayes.archive
src/core/moves/proposal/scalar/SlideUpDownProposal.cpp
#include "DistributionNormal.h" #include "SlideUpDownProposal.h" #include "RandomNumberFactory.h" #include "RandomNumberGenerator.h" #include "RbException.h" #include "TypedDagNode.h" #include <cmath> #include <iostream> using namespace RevBayesCore; /** * Constructor * * Here we simply allocate and initialize th...
ALGO
0.987028
7.843074
e839f4fa-4576-4989-9f8a-e3a7e29d4e0f
adityapadwal/Data-Structures-And-Algorithms
Practise_DSA/Basic Logic Building/tempCodeRunnerFile.cpp
#include<iostream> using namespace std; int main() { int i, j, k; int num; cout<<"\n How many lines???:"; cin>>num; for(i=0; i<num; i++) { cout<<endl; for(k=1; k<=i; k++) { cout<<" "; } for(j=1; j<num; j++) { cout<<j; } } return 0; }
ALGO
0.985606
3.002362
d7008e53-9079-448f-8dc1-0e0b0476aa89
ishandutta2007/codeforces
gtrhetr/normal/1190/D.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define lowbit(x) ((x)&(-(x))) struct node { int x,y; }a[200010]; vector<int> v[200010]; int h[200010],lst[200010],c[200010],n,t1,t2,tt; inline int rd() { int x=0;char ch=getchar(); for (;ch<'0'||ch>'9';ch=getchar()); for (;ch>='0'&&ch<='9';ch=get...
ALGO
0.999811
3.781029
ce3f2b77-43f6-4941-b373-91c59733182c
alps-jbnu/ALPS_2020_Summer_Study
Jihyeon/week7.BFS/boj1260.cpp
#include <iostream> #include <queue> #include <vector> #include <algorithm> using namespace std; vector<int>vec[10001]; int c[10001]; queue<int>q; void dfs(int s) { c[s] = true; cout << s<<" "; sort(vec[s].begin(), vec[s].end()); for (int i = 0; i < vec[s].size(); i++) { int num = vec[s].at(i); while (!c[...
ALGO
0.999992
4.348793
140ac4d7-921a-4757-b37b-70ef7de0d01a
SahilChharra/Leetcode-Questions
1511-count-number-of-teams/count-number-of-teams.cpp
class Solution { public: int numTeams(vector<int>& ratings) { // Find the maximum rating int maxRating = 0; for (int rating : ratings) { maxRating = max(maxRating, rating); } // Initialize Binary Indexed Trees for left and right sides vector<int> leftBIT(...
ALGO
0.999991
6.36565
371c38a4-28cf-4763-a9b6-dad723b486ba
Ahammad204/Programming-Problem-solving
Codeforces/A_Tram.cpp
#include <iostream> using namespace std; int main() { int n; cin >> n; int currentPassengers = 0; // To keep track of current number of passengers int maxCapacity = 0; // To keep track of the maximum number of passengers at any point for (int i = 0; i < n; i++) { int a, b; cin >...
ALGO
0.999925
5.956684
accacaf5-fc86-49e0-8dd9-63910447f938
ishandutta2007/codeforces
anadi/normal/1666/J.cpp
#include<bits/stdc++.h> using ll = long long; using namespace std; const int N = 210; int n, p[N]; ll c[N][N], d[N][N]; pair<ll, int> dp[N][N]; int build(int l, int r) { if (l > r) return 0; int mid = dp[l][r].second; p[build(l, mid - 1)] = mid; p[build(mid + 1, r)] = mid; return mid; } int main() { cin.tie(...
ALGO
0.999992
3.317069
09d88351-0f01-45c0-bd96-103d60f7c9f0
altrohit/sem7
IS/vignere cipher.cpp
#include<iostream> #include<conio.h> #include<string.h> using namespace std; int row(char a[27][26],char b) { int i; for(i=1;i<27;i++) { if(a[i][0]==b) return i; } } int col(char a[27][26],char m) { for(int i=0;i<26;i++) { if(a[0][i]==m) return i; } } void encrypt(char a[27][26],char *msg,char *key,cha...
ALGO
0.999949
3.319193
c13de9d1-e47e-4a61-825f-ee04273c9b08
nikhil-robinson/opencv-esp32
opencv_contrib/modules/alphamat/src/infoflow.cpp
#include "precomp.hpp" #include <Eigen/Sparse> using namespace Eigen; namespace cv { namespace alphamat { static void solve(SparseMatrix<double> Wcm, SparseMatrix<double> Wuu, SparseMatrix<double> Wl, SparseMatrix<double> Dcm, SparseMatrix<double> Duu, SparseMatrix<double> Dl, SparseMatrix<double> T, ...
ALGO
0.999779
5.766928
f286440b-0975-4722-a255-fb6e81b29a1e
raincross7/code-similarity
codes/train_code/problem391/problem391_15.cpp
#include<iostream> #include<string> using namespace std; int main(){ int m,a,b,t=0,s; while(cin>>m>>a>>b){ t=0; if(m==0){ break; } int p[m]; for(int i=0;i<m;i++){ cin>>p[i]; } for(int i=a;i<=b;i++){ if(t<=p[i-1]-p[i]){ t=p[i-1]-p[i]; s=i; } } cout<<s<<endl...
ALGO
0.999981
3.166651
77926eb8-2850-4f5d-a709-4b9637cd0b0f
joy-mollick/Problem-Solving-Solutions
HackerEarth- DAY 3 - Engineering Entrance Exam.cpp
#include<bits/stdc++.h> using namespace std; const int mx=1e5+1; typedef pair<long,long>pii; bool vis[mx]={false}; long dist[mx]; vector<pii>adj[mx]; priority_queue<pii,vector<pii>,greater<pii> > pq; void dijkstra() { while(!pq.empty()) { int u=pq.top().second; pq.pop(); if(vis[u])...
ALGO
0.99997
3.903916
415ecdee-e0f5-4a4d-a327-5aa1157fcddc
erolmutlu/android_frameworks_av
media/libstagefright/codecs/amrnb/common/src/int_lpc.cpp
/* Pathname: ./audio/gsm-amr/c/src/int_lpc.c Functions: ------------------------------------------------------------------------------ REVISION HISTORY Description: Updated template used to PV coding template. Changed to accept the pOverflow flag for EPOC compatibility. Description: Per review comments, replac...
ALGO
0.994999
6.3164
5b18cabd-2159-42a2-bd39-075cd863d79c
demKyr/LeetCode
0219-contains-duplicate-ii/0219-contains-duplicate-ii.cpp
class Solution { public: bool containsNearbyDuplicate(vector<int>& nums, int k) { unordered_map<int, int> mp; for(int i=0; i<nums.size(); i++){ if(mp.count(nums[i]) > 0) if(i - mp[nums[i]] <= k) return true; mp[nums[i]] = i; } ...
ALGO
0.999853
6.052011
005f82d8-c9fc-4551-8caa-944f3d9b1a10
gavinband/bgen
3rd_party/boost_1_55_0/libs/signals/example/maximum.cpp
// Boost.Signals library // For more information, see http://www.boost.org #include <algorithm> #include <iostream> #include <boost/signals/signal2.hpp> template<typename T> struct maximum { typedef T result_type; template<typename InputIterator> T operator()(InputIterator first, InputIterator last) const {...
ALGO
0.936271
5.350942
8325c176-8c7a-4f13-af53-87fbbf43abd9
Tunaa2002/Data_structure_and_algorithm
code.ptit/gia_tri_nho_nhat_cua_bieu_thuc.cpp
#include <bits/stdc++.h> using namespace std; bool cmp(long long a, long long b) { return a > b; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; long long s = 0; vector<long long> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int...
ALGO
0.999907
3.211743
b62eb34e-3363-4db3-ac13-dc58d806dbc0
manikanta2901/ubuntu
.history/SRM/placementPractice/HackerRank/insertionSort1_20201101133709.cpp
#include<bits/stdc++.h> #include<vector> #include<iostream> #include<cmath> #include<algorithm> #include<iterator> #include<string> #include<map> #define vv vector #define F first #define S second #define MP make_pair #define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define printM...
ALGO
0.999991
3.10091
01f6ae6d-dc7c-4507-95f3-9931ada1f99f
Yasirraiyan/Leet-Code-SolvIing-Problem
Leetcode 1464 Mximum Product of Two Elements in an Array/Approach.cpp
Amar 1 ta int er array ase jar nam nums. amake 2 ta different indices nite bolse and maximum product chaise. So, 1st e ami 1 ta variable nei max_product ja initial 0. [Eta nibo karon product er sathe max_product compare kore max_product return korbo]. 1 ta for loop chalai i=0 to n porjonto pura array traverse kor...
ALGO
0.999953
5.5807
656f1e6a-a34b-4435-af2b-1730380213f6
iamslash/learntocode
leetcode/FindMinimuminRotatedSortedArrayII/a.cpp
#include <cstdio> #include <vector> // l // r // m // 2 2 2 0 1 // 8ms 100.00% 9MB 6.25% // O(lgN) O(1) class Solution { public: int findMin(std::vector<int>& V) { int l = 0; int r = V.size()-1; int m; while (l < r) { m = (l+r)/2; if (V[m] > V[r]) l = m + 1; els...
ALGO
0.999952
5.211046
0d49459e-2cb2-475c-b7f4-fc2e88126e9b
Chris1221/mchg
lib/boost_1_61_0/libs/compute/example/point_centroid.cpp
//[point_centroid_example #include <iostream> #include <boost/compute/algorithm/copy.hpp> #include <boost/compute/algorithm/accumulate.hpp> #include <boost/compute/container/vector.hpp> #include <boost/compute/types/fundamental.hpp> namespace compute = boost::compute; // the point centroid example calculates and di...
ALGO
0.99911
4.58674
15c6f01e-2b13-446d-8370-97364fdef129
ravenxrz/MyLeetCode
4.CodingInterviews/NewVersion/51. 节点之和最大的路径.cpp
#include "leetcode_base.h" /** * 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, ...
ALGO
0.99989
6.608016
23543c83-acde-4600-8bff-241af0af4b58
DavidGiurgia/Troop-flutter
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998733
6.76775
3db745b3-751e-4a0c-a728-4d503c25e063
ADVRHumanoids/tutorial_iros2018
opensot/src/IKProblem.cpp
#include <IKProblem.h> OpenSoT::IKProblem::IKProblem(XBot::ModelInterface::Ptr model, const double dT): _model(model) { Eigen::VectorXd q; // We gate the actual joint position from the model _model->getJointPosition(q); // Initialization of Cartesian tasks including task ids, joint position, model...
ALGO
0.942747
5.983767
c5cdbe41-68ea-4cee-97ba-6f4f3f4e42e8
my-hoang-huu/My-hh
1. Nhap mon lap trinh_chuong03_mang mot chieu/bai068.cpp
#include<iostream> #include<iomanip> using namespace std; void Nhap(int[], int&); void Xuat(int[], int); int TanSuat(int[], int, int); void Dem(int[], int); int main() { int a[100], b[100]; int n, m; /*cout << "Mang a: ";*/ Nhap(a, n); Xuat(a, n); //cout << "\nMang b: "; //Nhap(b, m); //Xuat(b, m); cout << "\...
ALGO
0.998464
3.508218
a187cb58-a742-4704-978f-25917a26c68e
ishandutta2007/codeforces
yaobig/normal/1096/E.cpp
#include<bits/stdc++.h> #define rep(i,a,n) for(int i=a;i<=n;i++) #define per(i,a,n) for(int i=n;i>=a;i--) #define pb push_back #define mp make_pair #define FI first #define SE second #define maxn 5100 #define mod 998244353 #define inf 0x3f3f3f3f using namespace std; typedef long long ll; typedef pair<int,int> pii; type...
ALGO
0.999897
4.070676
3fcde5d9-eee8-4035-b7a4-dbf5279321d0
sarvex/leetcode-raku
solution/2600-2699/2615.Sum of Distances/Solution.cpp
class Solution { public: vector<long long> distance(vector<int>& nums) { int n = nums.size(); vector<long long> ans(n); unordered_map<int, vector<int>> d; for (int i = 0; i < n; ++i) { d[nums[i]].push_back(i); } for (auto& [_, idx] : d) { int m...
ALGO
0.999991
5.103293
b49e4e8e-abbe-4702-929e-2ec515d1f9be
VyasNml/LeetCode_Practice
0094-binary-tree-inorder-traversal/0094-binary-tree-inorder-traversal.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.999977
6.53
260e7a8d-36f7-4e6b-8eac-8c7cdf32caf9
winmutase21/WinMutASE21Artifact
lib/CodeGen/MachineCopyPropagation.cpp
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/iterator_range.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFuncti...
ALGO
0.927253
7.861965
42017edc-cb0e-4ff7-b9af-3357d539a040
NYD64/NPS-APP
nps/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.99857
6.76073
2093bf35-6d97-47c5-afd0-d33d5e7b71f2
nirdesh17/codeforces
Marathon.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t; cin>>t; for(ll i=0;i<t;i++) { ll a[4]; ll count=0; for(ll j=0;j<4;j++) { cin>>a[j]; if(a[0]<a[j]) ...
ALGO
0.999621
3.706364
be98388c-4a4b-4468-b285-5e93029826b1
ShyamNandanKumar/coding-ninja2
8_bit_manipulation/4_flip_i.cpp
// flip the ith bit of a number => 1->0 | 0->1 // sample ip - 5 2 // op 1 // 5 - 00000101 // 1<<2 - 00000100 // 5^1<<(2) - 00000001 = 1 so, 2nd bit has been flipped #include<bits/stdc++.h> using namespace std; int flip_i(int n,int i){ n=n^1<<i; return n; } int main(){ int n,i; cin>>n>>i; cout<<...
ALGO
0.999899
3.570082
75ad9f85-115c-483a-b839-28823517aa9a
sarvex/leetcode-haskell
solution/2300-2399/2315.Count Asterisks/Solution.cpp
class Solution { public: int countAsterisks(string s) { int ans = 0, ok = 1; for (char& c : s) { if (c == '*') { ans += ok; } else if (c == '|') { ok ^= 1; } } return ans; } };
ALGO
0.999707
5.315439
1a76dbc1-7cee-4aa0-a0f0-18be1eefee33
kishanrajput23/Love-Babbar-CPP-DSA-Course
Lectures/Lecture_91/Lecture_Codes/topological_sort.cpp
#include <bits/stdc++.h> // using bfs vector<int> topologicalSort(vector<vector<int>> &edges, int v, int e) { // adjacency list unordered_map<int, list<int>> adj; for (int i=0; i<edges.size(); i++) { int u = edges[i][0]; int v = edges[i][1]; adj[u].push_back(v); } // f...
ALGO
0.99993
5.12815
e9c44828-b684-449e-8a3d-ac6442e5e2be
113bommy/PathRepair
variable_trace/cpp/cpp_code/cpp_incorrect/cpp_incorrect_test_160_3.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int rb, cb, rd, cd; cin >> rb >> cb >> rd >> cd; int x1, x2; if (rb <= rd) { x1 = rd - rb; } else if (rb > rd) { x1 = 2 * (n)-rb - rd; } if (cb <= cd) ...
ALGO
0.999612
3.39143
257c1768-945e-494a-9de9-8411d0fff6f7
hjiang13/LLMs-in-IR
POJ-104/95/1388.cpp
#include <iostream> using namespace std; int main() { char s1[100]={ 0} ,s2[100]={ 0} ; int n,m,i,k; gets(s1); gets(s2); n=strlen(s1); m=strlen(s2); for(i=0; i<=n-1; i++) { if(s1[i]>='a'&&s1[i]<='z') s1[i]=s1[i]-32; } for(i=0; i<=m-1; i++) { if(s2[i]>='a'&&s2[i]<='z') s2[i]=s2[i]-32; } k=strcmp(s1,s2); { if(k==0) cout ...
ALGO
0.999984
3.07181
3dcc1545-be01-4cb6-aabe-8d24522e376e
Shivuu2803/LeetCode-Problems
20-assign cookies.cpp
class Solution { public: int findContentChildren(vector<int>& g, vector<int>& s) { sort(g.begin(), g.end()); sort(s.begin(), s.end()); int childrenCount = g.size(), cookiesCount = s.size(); int cookie = 0, answer = 0; for(int i=0; i < childrenCount && c...
ALGO
0.999712
5.713785
35026f82-98c4-4e8a-a3a8-ce48a98b829c
tmarques/waheela
amarok-1.4.1/amarok/src/fht.cpp
#include <math.h> #include <string.h> #include "fht.h" FHT::FHT(int n) : m_buf(0), m_tab(0), m_log(0) { if (n < 3) { m_num = 0; m_exp2 = -1; return; } m_exp2 = n; m_num = 1 << n; if (n > 3) { m_buf = new float[m_num]; m_tab = new float[m_num * 2]; makeCasTable(); } } FHT::~FHT() { delete[] m_buf...
ALGO
0.998727
4.42485
16306b6b-4682-4d60-b1c4-11adebfa2062
SaranyaDas/CS141Lab8
4.cpp
#include <iostream> using namespace std; //required libraries included int* merge(int a1[],int a2[],int s1,int s2,int& size3)//function to merge the elements of the two arrays { size3=0; int arr[s1+s2];//a new array is created for(int i=0;i<s1;i++)//loop to store the elements of the first array arr[size3++]=a1[i];...
ALGO
0.999691
3.970705
ac6c4b28-fdd0-4dd4-aaeb-1dda3fa7466f
0xWave-Flow/android-10.0.0_r45-C2
av/media/libstagefright/codecs/amrnb/dec/src/a_refl.cpp
/* ------------------------------------------------------------------------------ Filename: /audio/gsm-amr/c/src/a_refl.c Functions: a_refl Date: 02/05/2002 ------------------------------------------------------------------------------ REVISION HISTORY Description: Removing unneeded include files and the ...
ALGO
0.999865
5.786362
0986d3dd-a981-48a9-8d60-b212a1a1beeb
ishandutta2007/codeforces
yancouto/normal/521/B.cpp
#include <bits/stdc++.h> using namespace std; #define fst first #define snd second typedef pair<int, int> pii; typedef unsigned long long ull; typedef long long ll; typedef long double ld; #define pb push_back #define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++) template<typename T> inline T ...
ALGO
0.999975
3.858788
a67f3199-5582-4a62-8d21-b23706cdd40c
dernDren161/DataStructuresAndAlgorithms
DSACheatSheet/Matrix/MedianInARow-wiseSortedMatrix.cpp
// Problem Link: https://practice.geeksforgeeks.org/problems/median-in-a-row-wise-sorted-matrix1527/1# class Solution{ public: int median(vector<vector<int>> &matrix, int r, int c){ // code here int min=INT_MAX,max=INT_MIN; for(int i=0;i<matrix.size();i++) { if(matrix[...
ALGO
0.999996
5.676756
3ff58006-f105-4fb4-9497-c603e52d99c7
NaanPradeep/CppAlgorithm
Matrix/matrix.cpp
#include <iostream> #define N 3 #define M 4 using namespace std; struct Arrstruct { double arr[N][N]; }; struct Arrstruct2 { double arr1[N][M]; }; class Matrix { public: double rows[N][N]; Matrix(double m[N][N]){ for(int i=0; i<N; i++){ for(int j=0; j<N; j++...
ALGO
0.999994
4.024154
28562441-397f-4181-b1bc-81d59bd95c01
rajko-z/matrix_multiplication_TBB
src/Serial/matrixSerial.cpp
#pragma once #include "matrixSerial.h" void matrix_multiplication_serial(Matrix& A, Matrix& B, Matrix& C) { int n = A.getN(); int m = B.getM(); int r = A.getM(); for (int i = 0; i < n; ++i) { for (int k = 0; k < r; ++k) { for (int j = 0; j < m; ++j) { C(i, j) += A(i, k) * B(k, j); } } } }
ALGO
0.990311
3.90238
b3867f25-7f56-4536-b34a-845bb0154fcb
bioyoshoo/atcoder
review-contest/ABC241/d.cpp
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int Q; cin >> Q; multiset<ll> s; rep(i, Q) { int q; ll x; cin >> q >> x; if (q == 1) s.insert(x); else {...
ALGO
0.999886
4.822722
42764cb7-48a8-44da-989c-ba15ab1c2301
ma5terdrag0n/Competitive-Programming
Spoj/GLJIVE - GLJIVE.cpp
/* * Author : pritish.thakkar */ #include<bits/stdc++.h> #define pb push_back #define mkp make_pair #define inf 1000000007 #define rep(i,n) for(int i=0;i<n;i++) #define fr first #d...
ALGO
0.999763
3.351414
b5dfa255-afb9-4bf7-b160-f2ab912bcf40
ishandutta2007/codeforces
137_345_2814/normal/1534/F2.cpp
#include<cstdio> #include<algorithm> using namespace std; #define N 400500 int n,m,a[N],sl[N],sr[N],vl[N],ti; char s[N]; int getid(int x,int y){if(x>n||x<1||y>m||y<1)return 0;return x*m-m+y;} void dfs1(int x,int y) { if(x<1||x>n||y<1||y>m)return; if(sl[getid(x,y)])return; sl[getid(x,y)]=ti; dfs1(x+1,y); if(s[getid...
ALGO
0.999918
3.231344
4031834e-21d8-426e-a109-7fcd0ad1bfae
hagmllc/UngDungThuatToan
Cashier_Al/main.cpp
#include <iostream> using namespace std; bool Ktr(int *C,int m,int n,int *S) { for(int i=0;i<m;i++) { S[i] = 0; } int i=0; while(n>0 && i>=0){ while(n-C[i]>=0){ S[i]++; n= n -C[i]; } i++; } if(n>0) return false; else return true; ...
ALGO
0.999767
3.514703
b2a4e8d4-d4ae-4357-b1b1-c90c871ecc8f
singlarohan/leetcode_sol
0097-interleaving-string/2023-06-22 16.26.23 - Accepted - runtime 0ms - memory 6.2MB.cpp
class Solution { private: vector<vector<int>> dp; public: bool solve(int i, int j, string &s1, string &s2, string &s3){ if(i >= s1.size() && j >= s2.size()) return true; if(dp[i][j] != -1) return dp[i][j]; bool ans = false; if(i < s1.size() && s1[i] == s3[i + j]) ...
ALGO
0.999961
5.904132
e3e12296-833b-451c-8a57-2c383a5ca2aa
barbarabod/jimp2
lab5/matrix/main.cpp
// // Created by patrycja on 01.04.17. // #include <iostream> #include "Matrix.h" using namespace algebra; using namespace std; int main(int argc, char* argv[]) { Matrix m1(argv[1]); Matrix m2(argv[2]); cout << "Macierz pierwsza: " << m1.Print() << endl; cout << "Macierz druga: " << m...
ALGO
0.883275
3.822269
beec9628-ea0f-4cc4-9781-936d1d9e5290
akshatchhabra/TransLRPL
CodeGen/data/transcoder_evaluation_gfg/cpp/PAINTING_FENCE_ALGORITHM.cpp
#include <iostream> #include <cstdlib> #include <string> #include <vector> #include <fstream> #include <iomanip> #include <bits/stdc++.h> using namespace std; long f_gold ( int n, int k ) { long total = k; int mod = 1000000007; int same = 0, diff = k; for ( int i = 2; i <= n; i ++ ) { same = diff; d...
ALGO
0.999935
5.659891
c9384acc-e4d6-4b85-9b69-2ad1761bc309
zxyDEDIRE/ACM_CODE
CodeForces/Codeforces Round 855 (Div. 3)/B.cpp
/* 嵌套变量重复 特殊样例 0 1 2 n 数组越界 开long long */ #include<bits/stdc++.h> using namespace std; #define endl "\n" #define pp(x) array<int,x> using ull=unsigned long long; using ll=long long; using pii=pair<int,int>; const int dx[]={0,0,1,-1,1,-1,1,-1}; const int dy[]={1,-1,0,0,1,-1,-1,1}; const int mod=998244353; const int ...
ALGO
0.999928
4.269593
afa68856-6861-40c2-ac26-7265dfa30a73
ddanielcruz/Competitive-Programming
URI/Ad-Hoc/1943.cpp
#include <cstdio> int main() { int N, p = 0; int v[]{100, 50, 25, 10, 5, 3, 1}; scanf("%d", &N); while(p != 6 && N <= v[p+1]) ++p; printf("Top %d\n", v[p]); return 0; }
ALGO
0.999507
3.139242
73c4a4d2-0f10-464b-afe5-18b7158e4fe2
FarmerJohnLYH/shareOI
HDU/2516.cpp
#include <map> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define oo ((1ll<<31)) #define fo(i,x,y) for (int i=(x);i<=(y);++i) #define fi first #define se second using namespace std; typedef pair<int,int> PI; const int N=20002000; int f[50]; int n; map<int,int> mp; int main() { freope...
ALGO
0.99995
3.854953
627911a9-3efc-456e-b7ab-9fbda7f6e299
EshaanVaswani/college
AOA/SumOfSubset.cpp
#include <iostream> #include <vector> using namespace std; int totalCalls = 0; // Global variable to count the number of recursive function calls // Function to print the current subset void printSubset(const vector<int>& subset) { cout << "{ "; for (int num : subset) { cout << num << " "; } ...
ALGO
0.999972
6.906826
546e4502-2a36-4ccf-abe5-684afddac6d4
mdferojmiah/C-plus-plus
all_divisors.cpp
#include <bits/stdc++.h> #include <iostream> using namespace std; void printDivisors(int x){ for(int i = x; i > 0; i--){ if (x % i == 0) { cout << (x / i) << " "; } } } int main() { int n; cin >> n; printDivisors(n); return 0; }
ALGO
0.999701
4.957023
88c5064f-320c-42a7-91cc-6fd3362aa142
SungwookLE/PCCP
2_히든퀘스트1/브루트포스/boj19532.cpp
#include <bits/stdc++.h> using namespace std; int a,b,c,d,e,f; int main(){ cin >> a >> b >> c >> d >> e >> f; for(int x = -999 ; x <= 999 ; x++){ for(int y = -999 ; y<=999 ; y++){ if((a*x+b*y == c)&&(d*x+e*y==f)){ cout << x << " "<< y; return 0; ...
ALGO
0.999688
3.049726
b738cb68-00dc-4c53-94a8-83342b223d74
jasspn2014/CodingPractice
DivideandConquer/quicksort.cpp
#include<iostream> using namespace std; void swap(int *i, int *j) { int temp = *i; *i = *j; *j = temp; } int partition(int *arr, int beg, int end) { int pivot = arr[end]; int i = beg-1; for(int j = beg;j<=end-1;j++) { if(arr[j] < pivot) { i++; swap(...
ALGO
0.999989
4.882843
99c38802-48e4-4afe-8fec-a5da6b318872
imam-bagus/programmingLogicDesign
CH3-desicion-sructure-and-boolean-logic/EX9-time-calculator/timeCalculator.cpp
#include <iostream> using namespace std; int main() { int second; int result; cout << "Enter a second :"; cin >> second; if (second < 60) { result = second; cout << result << " Second" << endl; } else { if (second >= 60 && second < 3600) { ...
TOOL
0.914606
3.680786
637ca26e-64ec-4db3-b00c-6f1abb274a21
ezzycodes/kasipayz
kasipayz/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.998687
6.76775
ecf9dd0c-78af-474e-bd07-6a1396a6b01b
nikhilnagrale2/Leetcode_Practice
Easy/367.Valid_Perfect_Square.cpp
// Cheating class Solution { public: bool isPerfectSquare(int num) { int x = sqrt(num); return x * x == num ? true : false; } }; // Linear Search // Time Complexity - O(n) // Space Complexity - O(1) class Solution { public: bool isPerfectSquare(int num) { long long x = 1; ...
ALGO
0.999863
5.765993
7b937ec7-0ab5-4752-88bb-13e07f7eb206
Zijun0819/RepoForLeetCode
PraticteLeetCode/ccTest.cpp
#include <bits/stdc++.h> using namespace std; int main(){ vector<int> a; vector<int> o; map<int, int> m1; int n; cin >> n; for(int i = 0; i < n; i++) { int tmp; cin >> tmp; a.push_back(tmp); m1[tmp] = i; } for(int i = 0; i < n; i++) { int tmp; cin >> tmp; o.push_back(tmp); } // // õʵ // for...
ALGO
0.999997
3.921406
588907b0-882f-4eff-8bf0-64aec86c55f5
dhoehna/RipOutDOL
Source/Core/Common/StringUtil.cpp
#include <algorithm> #include <cinttypes> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <istream> #include <iterator> #include <limits.h> #include <locale> #include <sstream> #include <string> #include <vector> #include "CommonFuncs.h" #includ...
TOOL
0.900293
4.873303
7d2f8970-7e73-4c27-acd7-15cc3067a7a6
lusjenka/origin1
Lesson16/task2_L16/task2_L16/task2_L16/task2_L16.cpp
// task2_L16.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include <iostream> #include <string> int real_string_hash(std::string s, int p, int n) { int hash; long long sum = 0; long long k = static_cast<long long>(p); char* char_arr...
ALGO
0.999372
4.700619
adb71f1f-ca17-46cb-814b-1c65f652a53d
songrunxian/computerScienceStudy
002-coding_test/0022-test.cpp
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> #include <stdint.h> #include <time.h> int gcd(int , int); int main () { int a, b; while ( ~scanf("%d%d", &a, &b)) { printf("%d\n", gcd(a, b)); } return 0; } /* int gcd (int a, int b) { ...
ALGO
0.999839
4.38943
70094805-63c3-45d8-bb43-1c122d9b6473
scmisa/fromc-classes
Wyklady P. progr/w5p02.cpp
#include <iostream> #include <cstdlib> #include <ctime> #include <algorithm> using namespace std; int main() { srand(static_cast<unsigned int>(time(0))); // Create an array of numbers from 1 to 49 int numbers[49]; for (int i = 0; i < 49; ++i) { numbers[i] = i + 1; } // Shuffle th...
ALGO
0.999666
5.479311
e55bd721-c637-4fb6-a4f6-87e558047177
MilaFirso/1102
1102.cpp
#include <iostream> #include <string> #include <vector> #include <math.h> #include <algorithm> class BigInteger { private: std::string bigInteger_; std::vector<int> bigIntegerTemp_{}; std::string bigIntegerResult_; int base_ = 10; size_t size_ = 0; public: BigInteger(const std::string& value) : bigInteger_{ va...
ALGO
0.999271
5.178557
9ed35b50-21a9-4906-8762-8fd4e9ff14bf
sean-engelstad/a2d-shells
src/bpmat/TACSSerialPivotMat.cpp
#include "TACSSerialPivotMat.h" /* Compare integers for binary searches */ int compare_integers(const void *a, const void *b) { return (*(int *)a - *(int *)b); } /* Create a serial CSC matrix compatible with TACS This class serves as a simple wrapper for the BCSCMat class. The main difficulty in using thi...
ALGO
0.979061
5.429828
fb7b1fb5-5ffd-4c98-9b77-9060d742a65e
cenciW/wechat
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998733
6.76775
43b459af-f5c9-495b-a780-6498dd8def41
3NCRY9T3R/H4CKT0B3RF3ST-2020
Programs/Repeated_String.cpp
/* Given a string ,s, of lowercase English letters that can be repeated infinitely many times. Given an integer,n, find and print the number of letter a's in the first n letters of this infinite string. For example, if the string s="abcac" and n=10, the substring we consider is abcacabcac, the first 10 characters of in...
ALGO
0.998025
4.704879
1ea5eb74-30c7-4821-9635-b5e1dc7085d9
imranZMiko/Algorithm
Graph/BFS/grid.cpp
#include<bits/stdc++.h> #define WHITE 0 #define GREY 1 #define BLACK 2 using namespace std; queue<int>q; int depth[1005][1005]; int color[1005][1005]; char grid[1005][1005]; int n,m; int dx[4] = {0,0,-1,1}; int dy[4] = {-1,1,0,0}; int bfs(int sx, int sy) { int i,vx,vy,ux,uy; while(!q.empty()) q.pop(); q....
ALGO
0.99983
4.219501
ff9594bc-b1a7-418d-bcf9-99b91fb29955
Kawser-nerd/CLCDSA
Source Codes/AtCoder/abc121/C/4666704.cpp
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <map> #include <string> using namespace std; int main(){ int n,m; map <long long,int> ab; cin >> n >> m; vector<long long> a; long long q; int p; for(int i = 0;i<n;i++){ cin >> q >> p; auto i...
ALGO
0.99994
3.700605
e2dcf99c-114f-48df-80d6-1ec9b1d1d445
Aks32216/Daily-Practice
linkedList/intersectionOfTwoLinkedList.cpp
class Solution { public: /* int findLength(ListNode* head) { int len=0; while(head!=NULL) { len++; head=head->next; } return len; } ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) { ListNode* temp1=headA; ...
ALGO
0.999514
5.2457
d7a7f62d-47a9-4beb-aed9-bf9dc3caa508
adarshnarayan04/Codeforces
2110C.cpp
#include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #include "debugging.h" #else # define debug(x...) #endif #define int long long #define ll long long #define w(t) int testcase; cin>>testcase; for (int tc = 1; tc <= testcase; ++tc) #define vin(v,n) for(int i = 0; i < n; ++i){int x;cin>>x;v.push_bac...
ALGO
0.99987
4.244339
cb142ce0-f28f-4918-9c59-bf226ef0605f
Moozaheed/All
PROGRAMMING--main/Dynamic programming/knapsack/01knapsack/top-down.cpp
#include<bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0...
ALGO
0.999998
4.316874
32cdfe6b-bb3c-4a56-85bb-6b293a3ad464
bexel963/study
cpp/CH2/03_getinfo.cpp
#include <iostream> int main() { using namespace std; int carrots; cout << " ִ?" << endl; cin >> carrots; cout << " ִ. "; carrots = carrots + 2; cout << " " << carrots << "̴. " << endl; return 0; }
TOOL
0.993448
3.035897
e374477d-ed48-445d-a58b-2baf5a451d0f
njrafi/Competitive-Programming-Solutions
CodeForces/834C - The Meaningless Game - 29370547.cpp
#include <bits/stdc++.h> #define gc getchar #define pc putchar using namespace std; #define vi vector<int> #define si set<int> #define vs vector<string> #define pii pair<int, int> #define vpi vector<pii> #define pri priority_queue<int> #define rev_pri priority_queue<int, vector<int>, greater<int>> #define mpi map<int, ...
ALGO
0.999916
4.733342
0cf1d126-e3b0-4872-a5d0-4ece48475433
arinasaffanah/daa
tugas/daaKombinasi.cpp
#include <iostream> using namespace std; int factorial (int n){ if ( n == 0 || n == 1){ return 1; } else { return n * factorial(n-1); } } int kombinasi(int n, int r){ if (n < r){ return 0; } else{ return (factorial(n) / (factorial(r) * factorial(n-r))); } } int main(){ int bil; int er; cout << "--...
ALGO
0.999183
5.250785
85da8a6c-1282-4996-81a7-d551045028dc
pathikritsyam/LeetCode
1493-longest-subarray-of-1s-after-deleting-one-element/1493-longest-subarray-of-1s-after-deleting-one-element.cpp
class Solution { public: int longestSubarray(vector<int>& A) { int i=0,j,res=0,k=1; for(j=0;j<A.size();j++){ if(A[j]==0)k--; if(k<0&&A[i++]==0)k++; } return j-i-1; } };
ALGO
0.999885
5.875257
3d8b182c-5272-4759-a239-7ce2a25d70f3
ankit-345/dsa_problems
Patterns/pascals_triangle/pascals_trangle.cpp
// Pascals triangle // 1 // 1 1 // 1 2 1 // 1 3 3 1 // 1 4 6 4 1 #include <bits/stdc++.h> using namespace std; vector< vector<int>> generate(int numRows){ vector< vector<int> > r(numRows); for(int i=0; i<numRows; i++){ // resizing means => first row should have one ...
ALGO
0.999983
6.270643
bbe6e03e-6837-4371-8ce8-3bb0429df5fb
cmiyachi/CygWinAlgorithms
Google/Design/minStack.cpp
// A user defined stack that supports getMin() in // addition to push() and pop() #include <bits/stdc++.h> using namespace std; class MinStack2 { public: void push(int x) { curSta.push(x); if(minSta.empty() || x<=minSta.top() ) minSta.push(x); } void pop() { ...
ALGO
0.999975
5.590162