uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
60302ac9-17fb-456d-8808-38e7bad708fd
jkl1385/BAEKJOON
BAEKJOON/BOJ_2588.cpp
#include <iostream> using namespace std; int main() { int n1, n2; cin >> n1 >> n2; cout << n1 * (n2 % 10) << '\n' << n1 * (n2 % 100 / 10) << '\n' << n1 * (n2 / 100) << '\n' << n1 * n2 << '\n'; return 0; }
ALGO
0.998794
3.559564
8f13d656-4e10-4d63-ae3b-c8d80384dda9
laiwei-rice/hpc-applications
laghos/dependencies/mfem-laghos-v2.0/linalg/blockmatrix.cpp
#include "../general/array.hpp" #include "../general/globals.hpp" #include "matrix.hpp" #include "sparsemat.hpp" #include "blockvector.hpp" #include "blockmatrix.hpp" namespace mfem { BlockMatrix::BlockMatrix(const Array<int> & offsets): AbstractSparseMatrix(offsets.Last()), owns_blocks(false), nRowBlocks(of...
TOOL
0.930742
5.154035
764b6242-5abd-4df2-a5cd-c384cd4e3a34
adityarathore063/DSA
Arrays/maximum_difference.cpp
#include<bits/stdc++.h> using namespace std; // Naive solution int difference(int arr[], int n){ int max_diff = INT_MIN; for(int i = 0; i<n-1; i++){ for(int j = i+1; j<n; j++){ int diff = arr[j]-arr[i]; max_diff = max(max_diff, diff); } } return max_diff; } // Ef...
ALGO
0.999965
4.583105
055656e2-1f30-401b-80d4-b69e02d6f782
cmu-ci-lab/mitsuba_clt
src/libbidir/mut_bidir.cpp
#include <mitsuba/core/statistics.h> #include <mitsuba/bidir/mut_bidir.h> #include <mitsuba/bidir/geodist2.h> MTS_NAMESPACE_BEGIN static StatsCounter statsAccepted("Bidirectional mutation", "Acceptance rate", EPercentage); static StatsCounter statsGenerated("Bidirectional mutation", "Successful generation rate", ...
ALGO
0.998796
7.752789
74d8274b-671c-4359-bd82-0780c1f2b1b3
retr0717/leetcode-ques
dynamic-prog/ninjaRecursion.cpp
#include <bits/stdc++.h> using namespace std; int MaxMerit(int day, int last, vector<vector<int>> &activity) { int maxVal = 0; if(day == 0) { for(int i = 0 ; i < 3 ; i++) { if(i != last) maxVal = max(maxVal, activity[0][i]); } return maxVal; } maxVal = 0; for(int i = 0 ; i < 3 ; i++) { if( i...
ALGO
0.999859
4.651806
e3d1b0e7-e82c-4a84-9b17-172e86e369ab
Soubhik752blaze/DSA
Stacks/getminofstack.cpp
/*Question :- Design a stack which return min element in 0(1) time*/ #include<bits/stdc++.h> using namespace std; class MinStack { public: private: stack<int> stack; int minele = INT_MAX; public: void push(int val) { if (stack.empty() || val > minele) stack....
ALGO
0.999598
4.994552
f111d653-ff81-4a88-9d30-9367b83c4fc7
samek567/ZadaniaAlgorytmiczne
OKI_2020_Zawansowane/bitmapa100pkt_challange4_BFS.cpp
#include <iostream> #include <vector> #include <queue> using namespace std; struct Pole { int y; int x; }; int n = 0, m = 0, delta_SIZE = 4; char wczytany_znak; vector<vector<int>> dp; vector<int> delta_Y = {-1,1,0,0}; vector<int> delta_X = {0,0,1,-1}; queue<Pole> Q; int main() { // O(N*M), BFS rownoleg...
ALGO
0.999861
4.228486
fc09c0be-ec1a-4e35-9f63-f4494f2ba0a7
RamAIbot/Self_Driving_car_Highway_driving
src/Eigen-3.3/test/sparseLM.cpp
#include "main.h" #include <Eigen/LevenbergMarquardt> using namespace std; using namespace Eigen; template <typename Scalar> struct sparseGaussianTest : SparseFunctor<Scalar, int> { typedef Matrix<Scalar,Dynamic,1> VectorType; typedef SparseFunctor<Scalar,int> Base; typedef typename Base::JacobianType JacobianT...
TEST
0.981304
6.130261
9f9f2865-14c5-4fec-bbbd-f15bf89a8312
jaimenurbina/blessingcoin
src/uint256.cpp
#include "uint256.h" #include "utilstrencodings.h" #include <stdio.h> #include <string.h> template <unsigned int BITS> base_uint<BITS>::base_uint(const std::string& str) { SetHex(str); } template <unsigned int BITS> base_uint<BITS>::base_uint(const std::vector<unsigned char>& vch) { if (vch.size() != sizeof...
ALGO
0.906604
6.478078
d2dfafc9-7ed3-4829-8b33-db7d8ac6ddd1
Souvik0901/SDE-Sheet
LinkedList/09. Reverse Node of k groups.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ Recursion Solution : Time Complexity: 0(N) ...
ALGO
0.99999
5.850042
8ef954c7-7f2c-4dad-983b-eaf640a44589
leebarang/cpp-week8
router.cpp
#include "router.h" // 패킷을 받아 재전송한다. void Router::onReceive(Packet* packet) { bool existDestination = false; for(RoutingEntry r : routingTable_) { if(r.destination == packet->destAddress()) { existDestination = true; std::cout << "Router #" << id() << ": forwarding packet (from: " << packet->srcAdd...
TOOL
0.938466
5.123034
4d9e0592-ca9c-4506-9b6e-6bc00f26dca7
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/Phi/top0-100/most-frequent-prime-Solution2.mostFrequentPrime/177811_DoS.cpp
aspath_put (struct stream *s, struct aspath *as, int use32bit ) { struct assegment *seg = as->segments; size_t bytes = 0; if (!seg || seg->length == 0) return 0; if (seg) { /* * Hey, what do we do when we have > STREAM_WRITABLE(s) here? * At the moment, we would write out a par...
ALGO
0.999309
3.453354
e4193fe2-ce0a-4e19-a934-af7654d6e268
ishandutta2007/codeforces
denisson/normal/1526/E.cpp
#include <bits/stdc++.h> #define ll long long #define db long double #define ull unsigned long long #define x first #define y second #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() using namespace std; #define pper(a) cerr << #a << " = " << a << endl; void per() { cerr << endl; } template...
ALGO
0.99998
4.250814
c118b6e8-5784-4514-b28d-4a0274dc0676
Autumnal-Joy/leetcode
0001-1000/0785/main.cpp
#ifdef LEETCODE #include <bits/stdc++.h> using namespace std; #endif static auto _ = []() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }(); #ifdef LEETCODE struct TreeNode { int val; TreeNode *left; TreeNode *right; explicit TreeNode(const int x) : val...
ALGO
0.999911
5.789563
9bd7093b-562e-4864-8ebc-04c95318dcbd
tuktik/backjoon
3055_탈출.cpp
#include <iostream> using namespace std; int row, col; char arr[52][52]; bool visited[52][52]; class point { public: int x, y; int dept; point(){} point(int x, int y, int dept):x(x),y(y),dept(dept){} }; class queue { point data[2600]; int front, rear; public: queue() :front(0), rear(0){} point get_front(...
ALGO
0.999954
4.173486
5f8d7bfc-3b13-4486-b284-f3357b202fc0
sahilduhan/Placement_Prepration
ApnaCollege/arrays/PairSumBetter.cpp
#include <bits/stdc++.h> using namespace std; bool PairSum(vector<int> arr, int key) { int st = 0, end = arr.size()-1; while (st < end) { if(arr[st]+arr[end] == key) return true; else if(arr[st]+arr[end] > key) end--; else st++; } return false; } int main() { vector<int> ...
ALGO
0.999831
5.503519
64e4220a-ff2b-4bc9-9551-4de54785a131
Phil-Cao/LeetCode
20.有效的括号.cpp
/* * @lc app=leetcode.cn id=20 lang=cpp * * [20] 有效的括号 */ // @lc code=start class Solution { public: bool isValid(string s) { string left = "({["; string right = ")}]"; stack<char> stk; for(auto c : s){ if(left.find(c) != s.npos){ stk.push(c); ...
ALGO
0.999791
6.878301
4e133d4b-c747-468c-b848-8051edae9346
shaswata56/Algorithm_Design_and_Analysis
matrix_chain_multiplication/sir2.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n = 4; int p[4] = {1, 2, 3, 4}; int j, min, q; int M[4][4], S[4][4]; memset(M, 0, sizeof(M)); memset(S, 0, sizeof(S)); for (int d = 1; d < n-1; ++d) { for (int i = 1; i < n-d; ++i) { j = i + d; min ...
ALGO
0.999965
3.734511
8c3f3e28-c7ad-445f-baf6-1da39b63f8c1
Harshit16112000/DSA
199-binary-tree-right-side-view/binary-tree-right-side-view.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.999901
6.216302
24fcf95b-052e-46f3-a8ab-f79af5d1704a
UNICAAS2/as2-project-NicolaLoiZedda
cg3lib/cg3/data_structures/trees/avlleaf.cpp
/* * This file is part of cg3lib: https://github.com/cg3hci/cg3lib * This Source Code Form is subject to the terms of the GNU GPL 3.0 * * @author Stefano Nuvoli (<EMAIL>) */ #include "avlleaf.h" #include <stdexcept> #include <algorithm> #include <utility> #include "includes/bstleaf_helpers.h" #include "includes/...
ALGO
0.997645
6.640744
e0e15319-fba9-4d10-a78f-8ffdb727add6
Sumonta056/Learning-DataStructure-and-Algorithms
AlgorithmsAndDataStructure-master-copy/C++/Algorithms/RecursionAlgorithms/powUsingRecursion.cpp
// C++ program to calculate pow(a,b) #include <iostream> using namespace std; int power(int a, int b) { //base case if (b == 0) return 1; //recursive cases if (b % 2 == 0) //b is even { return power(a, b / 2) * power(a, b / 2); } else //b is odd { return a * power(a, b / 2) * power(a, b / 2); } } int...
ALGO
0.999809
6.206112
72e2bcef-911b-4d2b-8bb9-558a8c9a5c7c
NeedleFung/Data-Structures-and-Algorithms
Data Structures & Algorithm/Data Structures & Algorithm/2. Data Structures/week4_hash_tables/1_phone_book/phone_book.cpp
#include <iostream> #include <vector> #include <string> #include <unordered_map> using std::string; using std::vector; using std::cin; using std::unordered_map; struct Query { string type, name; int number; }; unordered_map<int, string> queryMap; vector<Query> read_queries() { int n; cin >> n; v...
ALGO
0.997138
5.317095
24394089-ee71-436c-b5e7-7a4f2bb1fe1d
hselbi/WebServ
config/Tools.cpp
#include "../includes/config/Tools.hpp" int replace(std::string &original, std::string word1, std::string word2) { unsigned long pos = original.find(word1); int result = 0; while (pos != std::string::npos) { result = 1; original = original.replace(pos, word1.length(), word2); pos = original.find(word1); } ...
TOOL
0.863924
4.476662
60d114e4-e8e0-4e69-9640-34720a26239c
jenishk20/LeetCode-GFG
1367-linked-list-in-binary-tree/1367-linked-list-in-binary-tree.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ /** * Definition for a binary tree node. * struc...
ALGO
0.999967
5.280272
18c16e86-4a75-4d51-9f9a-a68b034e95ef
sikha22/LeetCode_Practice
Minimum Amount of Time to Collect Garbage.cpp
class Solution { public: int garbageCollection(vector<string>& garbage, vector<int>& travel) { long long totalMinutes = 0; // Total minutes needed for garbage collection long long currentTravelTime = 0; // Current travel time // Add the initial minutes required to collect garbage at the f...
ALGO
0.999644
6.792422
e8f1b6d1-8cbd-48b7-b13d-05ad50cc61ec
PetterS/easy-IP
third-party/Eigen/bench/spbench/sp_solver.cpp
// Small bench routine for Eigen available in Eigen // (C) Desire NUENTSA WAKAM, INRIA #include <iostream> #include <fstream> #include <iomanip> #include <Eigen/Jacobi> #include <Eigen/Householder> #include <Eigen/IterativeLinearSolvers> #include <Eigen/LU> #include <unsupported/Eigen/SparseExtra> //#include <Eigen/Sp...
ALGO
0.989908
4.29849
db5bc73f-3530-473b-bb72-113931663daa
nxtsourav7/Competitive-Programming
Codeforces/1909/C_Heavy_Intervals.cpp
/** * author : nxtsourav7 * created : 2024-02-03 22:02:30 **/ #include<bits/stdc++.h> long long int T = 1; using namespace std; #define endl "\n" #define f first #define s second #define int long long #define double long double #define vi vector<int> #define pii pair<int,int> #define sz(x) (int)x.size() #define...
ALGO
0.999982
3.956495
be0a85cc-bfff-4409-8d87-a7c7b8d14f32
jess-churchill/Photon-Code
thermal_photon_yield.cpp
#include <iostream> #include <cmath> #include <math.h> #include <iomanip> #include <fstream> #include <vector> #include <stdio.h> #include <stdlib.h> #include <cstdio> #include <ctime> #include <gsl/gsl_math.h> #include <gsl/gsl_interp2d.h> #include <gsl/gsl_spline2d.h> #include <gsl/gsl_integration.h> using namesp...
ALGO
0.970386
3.416364
f6d13f3a-4953-403d-98d3-2e2f0d1cdd95
arthurzaczek/Hacking-INF-Demo-Examples
_CPP/Pr0721/src/main.cpp
#include <cmath> // defines the sqrt() function #include <iomanip> // defines the setprecision() function #include <iostream> // defines the cout object using namespace std; double derivative(double (*)(double), double, double); const double P=3.141592653589793; const double P6=P/6; int main() { cout << setpre...
ALGO
0.999742
4.772409
99bf5a4a-70a3-443e-9cbe-a1235d758355
PriyanshiG7/CPP-DSA_FULL
patterns/19.cpp
#include<iostream> using namespace std; int main (){ //pattern int n; cin>>n; int i=1; while(i<=n){ int j=i; while (j<=n){ cout<<" "<<j<<" "; j=j+1; } cout <<endl; i=i+1; } }
ALGO
0.999923
4.01585
40ba9211-a72c-43a7-b283-4d510b239aea
glerium/acm-life
contest/240819-astar-2024-final/7.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr int maxn = 3e5+10; int n,m,k,cnt,head[maxn],dep[maxn],fa[maxn][20],cf[maxn],son[maxn]; struct Edge{ int to,nxt; ll w; }a[maxn<<1]; void add(int x,int y,ll w) { a[++cnt] = {y,head[x],w}; head[x] = cnt; } ll ps[maxn]; struct BIT...
ALGO
0.999984
4.1333
e198ae5f-38fe-405e-bb86-1c60e3b93713
StudyingFather/my-code
uva/1194.cpp
/* Name: UVa 1194 Author: StudyingFather Date: 2019/08/14 11:42 Website: https://studyingfather.com */ #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #define INF 0x3f3f3f3f using namespace std; struct edge { int v,w,next; }e[10005]; int head[205],cur[205],dist[205],s,t,cnt; void addedge...
ALGO
0.999851
3.450166
79bbed49-b502-494d-bcb5-c6d9859a455f
karimaechihabi/lernaean-hydra
hydra2/code/faiss/demos/demo_ivfpq_indexing.cpp
#include <cmath> #include <cstdio> #include <cstdlib> #include <sys/time.h> #include "../IndexIVFPQ.h" #include "../IndexFlat.h" #include "../index_io.h" double elapsed () { struct timeval tv; gettimeofday (&tv, NULL); return tv.tv_sec + tv.tv_usec * 1e-6; } int main () { double t0 = elapsed(); ...
ALGO
0.996721
6.044209
a7548e98-17fb-4845-b4bb-a47d16ee1784
payaldhakulkar/cv_code
box_filter.cpp
#include<opencv/highgui.h> #include <iostream> #include <opencv2/opencv.hpp> using namespace cv; using namespace std; int kernel_parsing(int i, int j, unsigned char *temp, int width) { int array_kernel_x[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; int k, l, sum; sum=0; for(k=0 ; k<3 ; k++) { for (l=0; l<3;...
TOOL
0.939642
3.558245
c6111e90-5ae8-4efc-8554-a0ceb92aea60
sepehrnour/Data-Structures-Codebase
Programs/p4.cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <cctype> #include <stack> #include <cmath> #include <unordered_map> using namespace std; const int TABLESIZE = 100; class Node { public: string variable; int value; Node *next; Node(const string &va...
ALGO
0.934479
5.276234
05b7af4f-dad0-4f75-bf1d-c859cb0f714a
cs-moushuai/leetcode
ex_617.cpp
#include <bits/stdc++.h> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode() : val(0), left(nullptr), right(nullptr) {} TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), righ...
ALGO
0.999989
5.756267
12c63206-2bff-4e8d-92dc-5e77e3827263
aryankatiyar15/dsa-practice-log
Recursion/GFG-tower-of-hanoi.cpp
// GFG - Tower of Hanoi // for small test cases you can print the steps for the disk movements else it will give TLE class Solution { public: int moves = 0; // Keeps track of total moves made during the process // Recursive helper function to solve Tower of Hanoi void solve(int n, int from, int to, int au...
ALGO
0.999961
6.272345
b76ca536-c57f-44ee-ae39-281a180cea82
Giulian617/FMI-NO-STRESS-13
IPv4/sol_mity_0.cpp
// Mity // O(Q*32) #include<cstdio> #include<cstdlib> #define assert(cond, msg) do if(!(cond)) { printf("%s", msg); abort(); } while(0) struct net { unsigned int mask; int sz; net() : mask(0), sz(0) {} net(const char* ip) : mask(0) { int i; unsigned int x; for(i=3;i>-1;--i) { for(x=0;*ip>='0' && *ip<...
ALGO
0.987484
3.618037
e9bbb258-5eca-407a-89ee-287f3601d0b1
ishandutta2007/codeforces
archuser84/normal/706/D.cpp
#define _USE_MATH_DEFINES #define FAST ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); #include <bits/stdc++.h> #define Loop(x, l, r) for(int x = l; x < r; ++x) #define LoopR(x, l, r) for(int x = r-1; x >= l; --x) #define all(x) x.begin(), x.end() #define Kill(x) return cout << x << '\n', 0 #define YN(flag) (flag? ...
ALGO
0.999988
4.07338
ba4d7582-31f8-4c2f-801e-2b01c5dc78a9
WAmp-Community/WAmp-CE
src/external_dependencies/cpr/cpr/util.cpp
#include "cpr/util.h" #include <algorithm> #include <cassert> #include <cctype> #include <chrono> #include <cstdint> #include <fstream> #include <iomanip> #include <ios> #include <sstream> #include <string> #include <vector> #if defined(_Win32) #include <Windows.h> #else // https://en.cppreference.com/w/c/string/byte...
TOOL
0.980159
6.472965
f876116e-3a66-4761-b0b1-23d4acbeb839
TwilightZrui/LeetCode
job/huawei_intern2/2.cpp
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <queue> #include <string> // #include <stringstream> #include <vector> using namespace std; vector<string> split(const string &str, char delim = '+') { vector<string> tokens; stringstream ss(str); string token; while (getline(ss,...
ALGO
0.999869
4.051868
86a89703-7694-4d4d-a895-8ddc510dee37
AMReX-Codes/amrex-backup
Tutorials/Amr/Advection_AmrCore/Source/main.cpp
#include <iostream> #include <AMReX.H> #include <AMReX_BLProfiler.H> #include <AMReX_ParallelDescriptor.H> #include <AmrCoreAdv.H> using namespace amrex; int main(int argc, char* argv[]) { amrex::Initialize(argc,argv); // timer for profiling BL_PROFILE_VAR("main()", pmain); // wallclock time ...
ALGO
0.972656
4.071873
2f24e6f7-26e8-4b5c-bdbf-3b4d453400d4
jeire/Algorithm
C++/프로그래머스/0/181932. 코드 처리하기/코드 처리하기.cpp
#include <string> #include <vector> #include <sstream> using namespace std; std::ostringstream oss; string solution(string code) { int mode = 0; for (int i = 0; i < code.size(); i++) { if (code[i] == '1') { mode = !mode; } else if (mode && (i % 2)) { ...
ALGO
0.999927
5.092942
f84542e5-639e-4b2e-a202-308f4a577d54
ishandutta2007/codeforces
demoralizer/normal/1418/C.cpp
#include "bits/stdc++.h" using namespace std; #define int long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) (x).begin(),(x).end() #define uniq(v) (v).erase(unique(all...
ALGO
0.999938
4.176256
a7bc4a27-79bc-482a-ac2c-7df58feff0de
lbcgi/webrtc_aec_using_kalmanAdaption
splitting_filter_impl.cpp
/* * This file contains the splitting filter functions. * */ #include "checks.h" #include "signal_processing_library.h" // Maximum number of samples in a low/high-band frame. enum { kMaxBandFrameLength = 320 // 10 ms at 64 kHz. }; // QMF filter coefficients in Q16. static const uint16_t WebRtcSpl_kAllPassFil...
ALGO
0.999294
5.674867
87214782-eebd-4c1d-ba7d-c057c7d6b1cd
weiyi-bitw/Leetcode
ZigZagConversion/zigzagConvert.cpp
/* * ===================================================================================== * * Filename: zigzagConvert.cpp * * Description: * * Version: 1.0 * Created: 09/18/2013 10:37:31 PM * Revision: none * Compiler: gcc * * Author: Wei-Yi Cheng (weiyi-b...
ALGO
0.999922
5.844953
1a589cad-17d4-40ca-a4bf-0b40ae316042
tharusalgadu/Competitive-Programming
ieeetreme/rooted_bts.cpp
#include <bits/stdc++.h> using namespace std; class Node { public: char data; int column; Node *left; Node *right; }; int searchIn(string arr, int strt, int end, char value) { int i; for (i = strt; i <= end; i++) { if (arr[i] == value) return i; } } int preIndex...
ALGO
0.999854
5.101334
b16ebb71-aad8-4026-9727-a7f67c6f3a63
dylan007/Coding
codechef/ialg1.cpp
/*======================= Author : Shounak Dey Filename : ialg1.cpp ======================= */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; #define PB push_back #define MK make_pair #define SZ(a) (int)(sizeof(a)) #define F first #define S second #de...
ALGO
0.999932
3.848054
1a8b5631-8cbb-4dca-ba79-a046633aa845
Mrinal321/Competitive-Programming-Problem
D_Skibidi_Table.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long int #define lld long double //Ordered set(tree) #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<ll, null_type, less<ll...
ALGO
0.999577
4.056493
f41cc945-836b-4a9e-8667-f1c2179e6ab1
nicecapj/crossplatfromMmorpgServer
ThirdParty/boost_1_61_0/libs/graph_parallel/test/distributed_page_rank_test.cpp
// Authors: Douglas Gregor // Andrew Lumsdaine #include <boost/graph/use_mpi.hpp> #include <boost/throw_exception.hpp> #include <boost/graph/distributed/page_rank.hpp> #include <boost/test/minimal.hpp> #include <boost/graph/distributed/adjacency_list.hpp> #include <boost/graph/distributed/mpi_process_group....
ALGO
0.998239
5.240413
1afb88d9-01e6-491a-83d7-562de26e1dc3
phantom23333/3D-Gaussian-Reconstruction
submodules/tetra-triangulation/CGAL-5.6.1/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Periodic_2_Delaunay_triangulation_2.h> #include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h> #include <CGAL/Periodic_2_triangulation_face_base_2.h> #include <CGAL/Periodic_2_triangulation_vertex_base_2.h> #include <CGAL/Triangulation...
ALGO
0.994776
6.897103
d2c7a83e-a2ee-49bb-8cd2-d6d1e63153ad
satyaswarup129/Data-Structure-And-Algorithms
Day-40/potd/gfg-Job Sequencing Problem.cpp
class Solution { public: bool static comp(pair<int, int>&a, pair<int, int>&b){ return a.first>b.first; } vector<int> jobSequencing(vector<int> &deadline, vector<int> &profit) { // code here int n=profit.size(); vector<pair<int, int>>v; for(int i=0; ...
ALGO
0.999988
5.756533
62f08f28-734f-4edc-a8eb-859dfdaa74ff
BacklitCat/LeetCodeCpp
newcoder/BM8 链表中倒数最后k个结点.cpp
struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(nullptr) {} }; class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param pHead ListNode类 * @param k int整型 * @return ListNode类 */ ListNode *FindKthToTail(Lis...
ALGO
0.999744
5.025102
5e6458e7-5848-4058-83c9-09a25e2e5a73
reinzler/solitude_case
src/PX4-Autopilot/src/modules/local_position_estimator/sensors/land.cpp
#include "../BlockLocalPositionEstimator.hpp" #include <systemlib/mavlink_log.h> #include <matrix/math.hpp> extern orb_advert_t mavlink_log_pub; // required number of samples for sensor // to initialize // static const uint32_t REQ_LAND_INIT_COUNT = 1; static const uint32_t LAND_TIMEOUT = 1000000; // 1.0 s void Bl...
ALGO
0.967264
5.908751
93817131-217a-42f7-b6e7-5a815b70e6f2
Raysangar/BadPrincess-Game
dependencies/CEGUI/dependencies/src/FreeImage-3.15.0/Source/OpenEXR/Imath/ImathMatrixAlgo.cpp
//---------------------------------------------------------------------------- // // Implementation of non-template items declared in ImathMatrixAlgo.h // //---------------------------------------------------------------------------- #include "ImathMatrixAlgo.h" #if defined(OPENEXR_DLL) #define EXPORT_CONST __dec...
ALGO
0.904562
4.351667
c832b1ee-fdbc-4d5f-a912-100a097077c0
kussshh/Code-It-Out
codeforces 1157C1 Increasing Subsequences(Easy Version).cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n,k,ans,p,i,j,c,m; cin>>n; vector<long long int>a; vector<char>ch; for(i=0;i<n;i++) { cin>>p; a.push_back(p); } i=0;j=n-1;p=0; while(i<=j) { if(a[i]<...
ALGO
0.999995
3.349837
72062e0c-e16c-452b-b6ad-3213c5f58352
shouryam01/Data_Structures-3
Arrays/reverse_array.cpp
// To reverse an Array: #include<bits/stdc++.h> //header files #include<iostream> //header files using namespace std; int main(){ int array[10] = {1,2,3,4,5,6,7,8,9}; //array declaration for (int i = 0,j = 10-1;i < 10/2;i++,j--){ //loop for reversing the array int temp = a...
ALGO
0.998179
4.538249
ff113695-f368-41d4-bd96-ebb314368663
ZaBarudo/tiny-gpu-lang-backend
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
#include <climits> #include <cmath> #include <cstddef> #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Math/IR/Math.h" #include "mlir/Dialect/Math/Transforms/Approximation.h" #include "mlir/Dialect/Math/Transforms/Passes.h" #include "mlir/Dialect/Utils/IndexingUtils.h" #include "mlir/Dialect/Vector/IR/...
TOOL
0.977362
5.19676
d2bcd64b-7150-4d66-bfd3-0950f0e4780f
datablade-io/daisy
src/Compression/examples/cached_compressed_read_buffer.cpp
#include <iostream> #include <iomanip> #include <limits> #include <Compression/CompressionFactory.h> #include <Compression/CachedCompressedReadBuffer.h> #include <IO/WriteBufferFromFile.h> #include <IO/createReadBufferFromFileBase.h> #include <IO/copyData.h> #include <Common/Stopwatch.h> int main(int argc, char ** a...
TOOL
0.859884
5.877603
df858968-86b7-4f9e-9140-3fac852ae47c
Dipankar-Kumar-Singh/Codeforces
E_Split_Into_Two_Sets.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define TestCases int TOTALTC ; cin >> TOTALTC ; for(_case = 1 ; _case <= TOTALTC ; _case++) #define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin() , (x).end() #define nl "\n" int _case = 1 ; vector<ve...
ALGO
0.999948
5.296511
3b64a0db-7412-4227-832e-a944bac5177a
next-step-for-interview-prep/Coding-Ninjas-DSA-course_code_and_notes_cpp
Milestone-3=DSA/questions and solutions/Lec-5=Time_and_space-complexity/03-Array_intersection.cpp
// #include <iostream> // #include <vector> // using namespace std; // void recursive(int n, vector<int> &ans) // { // if (n == 0) // { // return; // } // ans.push_back(n); // recursive(n - 1, ans); // } // int main(int argc, char const *argv[]) // { // int n; // cin >> n; // v...
ALGO
0.999924
6.318519
5865e0e6-7619-4aab-af67-babd23cdfbb8
sarvex/leetcode-assembly
solution/0200-0299/0241.Different Ways to Add Parentheses/Solution.cpp
class Solution { public: vector<int> diffWaysToCompute(string expression) { return dfs(expression); } vector<int> dfs(string exp) { if (memo.count(exp)) return memo[exp]; if (exp.size() < 3) return {stoi(exp)}; vector<int> ans; int n = exp.size(); for (int i ...
ALGO
0.99999
6.236426
ee4cc2b8-20db-44a9-8afc-9784c47a55b7
Mayank1909/C--
arraypointer.cpp
#include <iostream> using namespace std; void fun(int *arr,int n) { // int n = sizeof(arr) / sizeof(arr[0]);//it is wrong way inside a function for (int i = 0; i < n; i++) { cout << arr[i] << endl; } } int main() { int arr[] = {10, 20, 30, 40}; int n = sizeof(arr) / sizeof(arr[0]); f...
ALGO
0.959577
4.019886
3dcc17d4-0d8b-4567-94cd-70827fa0245f
quadratech188/baekjoon
solutions/2213.cpp
#include "modules/Graph.h" #include <iostream> #include <array> #include <forward_list> std::vector<std::array<std::pair<std::forward_list<int>, int>, 2>> cache; std::pair<std::forward_list<int>, int> solution(Graph<int>::Node root); std::pair<std::forward_list<int>, int> solution(Graph<int>::Node root, bool used) {...
ALGO
0.999985
4.929453
32afab95-c2df-45c3-be11-be8556dc303a
barndone/CustomPhysicsEngine
raygame/Shape.cpp
#include "Shape.h" #include "glm/glm.hpp" bool CheckCircleCircle(const glm::vec2& _posA, const Circle& _circleA, const glm::vec2& _posB, const Circle& _circleB) { float radii = _circleA.Radius + _circleB.Radius; float distance = glm::length(_posB - _posA); return distance < radii; } bool CheckCircleCircle(const g...
ALGO
0.994274
5.510857
0ca59626-9ef6-46cf-b17d-a6acc25cdebd
chaemon/atcoder-workspace
arc060/D/main.cpp
// #includes {{{ #ifdef MY_DEBUG #include "header/header.hpp" #else #include <bits/stdc++.h> #endif using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);++i) #define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i) #define LET(x,a) __typ...
ALGO
0.999627
3.392549
cc13795f-e391-4b68-b98f-c823e8e7c805
mpatwa/CCEtoODB_Translator
Sprint35_8_30_2012_commandline/5.0/PcbComponentPinAnalyzer.cpp
// $Header: /CAMCAD/5.0/PcbComponentPinAnalyzer.cpp 31 3/12/07 12:43p Kurt Van Ness $ /*****************************************************************************/ #include "StdAfx.h" #include "PcbComponentPinAnalyzer.h" //_____________________________________________________________________________ CString boo...
TOOL
0.908663
5.312945
44df3831-b474-4430-9728-c99e9f02e43f
Real32/ParallelP
OpenMP_InvariantMatrix.cpp
#include <QCoreApplication> #include <QDebug> #include <QTime> #include <iostream> #include <omp.h> #define THREAD_NUMS 4 void inversion(double **A, int N) { double temp; double **E = new double *[N]; // E - matrix for (int i = 0; i < N; i++) E[i] = new double [N]; #pragma omp parallel for ...
ALGO
0.999938
3.395471
3092388b-be6f-42f4-96ea-55b3d3a2731f
hassansalehe/DFinspec
src/tests/adf_benchmarks/dwarfs/structured_grid/razno/2D_block_row_matrix_structured_grid_adf.cpp
#include <stdio.h> #include <getopt.h> #include <math.h> #include <string> #include <iostream> #include <vector> #include "adf.h" using namespace std; typedef char mychar; bool print_results; char *input_file_name; int num_threads; int matrix_size = 512; double epsilon = 1.0; int num_blocks;...
ALGO
0.999774
3.767697
71b72cde-8d90-475e-8810-70aee6d33fac
Najma099/CompetitiveProgramming
USACO/PrefixSum/GoodSubarray.cpp
#include <iostream> #include <vector> #include <map> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n; cin >> n; string s; cin >> s; long long pfx = 0; long long cnt = 0; map<long, long> m; m[0] = 1; ...
ALGO
0.999578
4.175891
8d223f48-5d63-415f-ab66-2012637a3a37
SergeiGL/Rust_MCS_Cpp
Cpp_sample_code/src/main.cpp
#include <vector> #include <memory> #include "../include/main.hpp" #include <iostream> extern "C" double simple_func_c(const double* x, size_t n) { // build a std::vector<double> view over the C array std::vector<double> vx(x, x + n); return -123456.0; } int main() { // Problem dimension const siz...
ALGO
0.999358
6.262793
480e2f6e-2210-4720-b12c-ab2fe1614939
yoonjaehee/STL-algorithm
src/graph/bak1012_dfs.cpp
#include <iostream> #include <vector> using namespace std; int num,rows,cols; vector<vector<bool>> visited; vector<vector<bool>> arr; vector<int> bug_count; int px[4] = {1,-1,0,0}; int py[4] = {0,0,1,-1}; void dfs(int x,int y){ visited[x][y] = true; for(int i=0;i<4;i++){ int nx = x + px[i]; int ...
ALGO
0.998852
3.618218
9e5e6d6c-1859-4778-963a-142fe5dc5d41
GitHub-Traveler/leetcode
src/1.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: static bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; } vector<int> twoSum(vector<int> &nums, int target) { vector<pair<int, int>> num_pairs; for (int i = 0; i < nums.size(); i++) { num_pairs....
ALGO
0.999904
5.550457
c1276bd4-772c-401a-89c1-96073666aa0e
ayushpareek179/CPP-course
Part_Six/RollNo&GreatestOfTwo.cpp
//To print the greater of two inputs and checking validity of a roll number #include <iostream> using namespace std; void RollVal() { cout<<"-----------------------\n"; cout<<"Enter a roll number and the batch strength\n"; int roll, batch; cin>>roll>>batch; if(roll <= 0) cout<<"Invalid input\nA roll ought not t...
ALGO
0.910448
3.415053
f14d6321-1154-476b-b684-4c16ad10d741
friweber/Quantum-thermostat
src/micromagnetic/calculate_alpha.cpp
// Vampire headers #include "micromagnetic.hpp" // micromagnetic module headers #include "internal.hpp" #include "material.hpp" namespace micromagnetic{ namespace internal{ // Calculates the intrinsic damping constant of each cell from the atomsitic parameters in each cell. //alpha = sum(alpha)/N fo...
ALGO
0.998579
4.564186
b22014b5-b1c7-410f-83c7-ce6fdcee9f9f
CPFL/guc
compiler/llvm/lib/Analysis/LiveValues.cpp
#include "llvm/Analysis/LiveValues.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopInfo.h" using namespace llvm; namespace llvm { FunctionPass *createLiveValuesPass() { return new LiveValues(); } } char LiveValues::ID = 0; INITIALIZE_PASS(LiveValues, "live-values", "Value Livene...
ALGO
0.995762
7.982601
d3610edc-25f3-4d05-bfaf-841563b9c228
koba-e964/contest
codeforces/edu39/a.cpp
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <str...
ALGO
0.999824
4.032065
6d55d651-2c4f-44d6-b9ab-64bc7c6f1f26
ishandutta2007/codeforces
kimden/normal/1494/E.cpp
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ull = unsigned long long; using ll = long long; using ld = long double; using pii = pair<int, int>; map<pii, char> g; int aa = 0; int ab = 0; void recalc(int coeff, int u, int v) { a...
ALGO
0.999943
4.811755
96f1fcfc-a098-4b93-8609-543d3c27c8a3
udellc/OptronMini
Code/dependencies/FastLED/noise.cpp
#define FASTLED_INTERNAL #include "FastLED.h" #include <string.h> FASTLED_NAMESPACE_BEGIN #define P(x) FL_PGM_READ_BYTE_NEAR(p + x) FL_PROGMEM static uint8_t const p[] = { 151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94...
ALGO
0.989754
6.316689
746aec62-5118-42b5-812d-eaa28765ad1e
aKiii017/SolSearch
implementation/z3/src/muz/base/dl_boogie_proof.cpp
/** Example from Boogie: (derivation (step s!4 (main_loop_LoopHead true true) rule!3 (subst (= assertsPassed@@1 true) (= assertsPassed@2@@0 true) (= main_loop_LoopHead_assertsPassed true) ) (labels @950 +895 +668 +670 +893 +899 ) (ref true )) (step s!3 (main true false) rule!1 (subst (= a...
ALGO
0.997683
3.055131
63d7b82c-9e8b-44f8-8220-b6b46c65d372
rdr2211/6Companies30Days
GoldmanSachs/Question02.cpp
/* Company :- Goldman Sachs 2. Valid Square Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square. The coordinate of a point pi is represented as [xi, yi]. The input is not given in any order. A valid square has four equal sides with positive length and...
ALGO
0.999586
5.775947
68ff8a9d-1a61-4840-ac4f-066e275c1b5a
sagitovich/LabWorkFifthSem
Системы реального времени/lab8/LockFreeStack.cpp
#include <iostream> #include <thread> #include <vector> #include "node.hpp" #include "lockfree_stack.hpp" namespace { // typedef int lf::Position; // комментирование этого под огромным вопросом size_t readers_num = 4; lf::LockFreeVersionedStack<lf::Position> stack(readers_num); // СТАРЫЙ writer() - ...
ALGO
0.976013
4.2839
9212d184-a920-4100-afdb-507f8e4720c6
meabefir/splay-tree
SplayTree.cpp
#include "SplayTree.h" SplayTree::SplayTree() { } SplayTree::~SplayTree() { delete this->root; } Node* SplayTree::getRoot() { return this->root; } void SplayTree::fixTree() { //std::cout << this->root->data << '\n'; this->root->calcMax(); this->root->applyOffset(); /*this->inorder(); ...
ALGO
0.998832
3.855181
4f92bd59-59bd-493d-9f7b-503bfad3040c
liandd/Competitive_programming_2020_2024
BeeCrowd/1153.cpp
#include <bits/stdc++.h> using namespace std; int main() { long arr[15]={ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800}; /* long res=1; cout<<1<<"\n"; for(long i=1;i<=13;i++){ res*=i; cout<<res<<"\n"; }*/ int n=0; cin>>n; cout<<arr[n]<<"\n"; return 0; }
ALGO
0.999966
4.487176
69c03e41-a0da-48b2-b8a8-e433459bf5e1
ishandutta2007/codeforces
sexpert/normal/1132/A.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; if(a + b + c + d == 0) { cout << 1 << endl; return 0; } if(a == 0 && c > 0) { cout << 0 << endl; return 0; } if(d != a) { cout <<...
ALGO
0.99977
3.615371
84dfb108-8076-468b-b6de-b9cd546e858d
Dcoder10M/DSA-solved-questions
1296-kth-ancestor-of-a-tree-node/1296-kth-ancestor-of-a-tree-node.cpp
class TreeAncestor { public: vector<vector<int>> v; TreeAncestor(int n, vector<int>& parent) { vector<vector<int>> par(n,vector<int>(20)); for(int i=0;i<n;i++){ par[i][0]=parent[i]; } for(int j=1;j<20;j++){ for(int i=0;i<n;i++){ if(par[i][j...
ALGO
0.999972
5.882182
c1ed7763-f6bb-436a-8f3b-c3db1694256a
mahmoudelbassiony/Embeddedcpp2
c++ practice/try.cpp
#include <iostream> //stl #include <stack> int main() { std::stack<int> stack; stack.push(10); stack.push(20); stack.push(30); stack.push(40); stack.push(50); }
TOOL
0.974405
3.578915
eba083ba-a2fd-4686-9350-e3f05d8a15c8
WizardPenguin/competative-programming
827 div4/1742C.cpp
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> p...
ALGO
0.9978
4.640082
660a692b-9bb3-46d7-aafd-ece6eaded379
shanto86/problem-book-1-solutions
STL/UVa 540 - Team Queue.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> ii; int main(int argc, char const *argv[]) { int n, co = 0; while(cin >> n && n) { queue<int> teamQ[n+1], mainQ; map<int,int> teamNo; for(int i=0; i<n; i++) { int m, num; cin>>m; while(m--) { cin>>num; te...
ALGO
0.999708
3.467028
4b823c3c-299d-4c5e-bd62-4668e99a2732
Aaryan2705/leetcode
3217-delete-nodes-from-linked-list-present-in-array/3217-delete-nodes-from-linked-list-present-in-array.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* modifiedLis...
ALGO
0.999988
5.779336
cfa03ef4-7d36-4d16-8f41-be563e3a1e87
ishandutta2007/codeforces
keewrem/normal/1400/C.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; ll N,T,K; int main(){ cin >> T; string s; while(T--){ cin >> s; N = s.size(); cin >> K; string r(N,'1'); for(int i = 0; i < N; i++){ if(i+K < N && s[i+K]=='0')r[i...
ALGO
0.999594
4.177953
3a569a94-1a6e-4f6b-bd63-2351199e1193
Darptolus/DERFAST
Visualizations/gameoflife_1.cpp
#include <iostream> #include <vector> #include <fstream> #include <cstdlib> #include <ctime> #include <mpi.h> #include <omp.h> void print_grid(const std::vector<std::vector<int>>& grid, int width, int height, int rank) { std::cout << "Rank " << rank << " grid:\n"; for (int i = 1; i < height - 1; ++i) { // Ski...
ALGO
0.999865
6.132579
9f6fbecc-a380-418f-8280-79605d45e31d
maxgallup/llvm-blade
llvm-project-16.0.1.src/bolt/lib/Passes/LoopInversionPass.cpp
#include "bolt/Passes/LoopInversionPass.h" #include "bolt/Core/ParallelUtilities.h" using namespace llvm; namespace opts { extern cl::OptionCategory BoltCategory; extern cl::opt<bolt::ReorderBasicBlocks::LayoutType> ReorderBlocks; static cl::opt<bool> LoopReorder( "loop-inversion-opt", cl::desc("reorder unc...
ALGO
0.985525
7.73289
7c95a25d-bc50-4f46-8c2f-8179246ced2e
yuntianyi-chen/Artifacts-of-ADS-Bug-Fix-Pattern-Study
data/bug-fix file-change dataset/autowarefoundation_autoware.universe/621/before/motion_velocity_smoother_node.cpp
#include "motion_velocity_smoother/motion_velocity_smoother_node.hpp" #include "motion_velocity_smoother/smoother/jerk_filtered_smoother.hpp" #include "motion_velocity_smoother/smoother/l2_pseudo_jerk_smoother.hpp" #include "motion_velocity_smoother/smoother/linf_pseudo_jerk_smoother.hpp" #include "tier4_autoware_util...
TOOL
0.984702
7.142073
85bce622-ec2c-4b01-8b35-45a98d2e0a51
Reriiii/Algorithms
NUMBER THEORY/FIBONACCI/dp_without_array.cpp
#include <bits/stdc++.h> using namespace std; int fibo(int n) { int a = 1, b = 1, c; if (n == 1) return a; if (n == 2) return b; for (int i = 3; i <= n; ++i) { c = a + b; a = b; b = c; } return c; } int main() { int n; cin >> n; cout << fibo(n); }
ALGO
0.999976
5.128623
c8a99c1e-7be9-45f8-9101-c675a0a46243
htadg/ADA-Algorithms
exp9/rabinKarp.cpp
#include <bits/stdc++.h> using namespace std; void rabinKarp(string txt, string pat){ int N=txt.length(), M=pat.length(); int i, j, p=0, t=0, h=1, D=256, prime=101; for(i=0; i<M-1; i++) h = (h*D)%prime; for(i=0; i<M; i++){ p = (D*p + pat[i])%prime; t = (D*t + txt[i])%prime; } for(i=0; i<=N-M; i++){ if(p ==...
ALGO
0.999964
5.700076
196ecbdd-da0b-4642-b5dc-04bb877cd2ca
delsin97/essential_cpp
chapter3/exercise4.cpp
#include <iostream> #include <iterator> #include <vector> #include <algorithm> #include <fstream> using namespace std; class even_elem { public: bool operator()(int element) { return element % 2 ? false : true; } }; int main() { vector<int> input; cout << "please input the numbers, q to q...
TOOL
0.964378
3.758394
da0a915a-918d-40be-8ce1-bdf0c5e8b6d7
raghuvanshraj/Competitive-Programming-Archive
Coding Ninjas/bfs-rec.cpp
#include <bits/stdc++.h> using namespace std; void BFS(int **edges, int v, bool *isVisited, int start, list<int> &queue) { if (queue.empty()) { return; } int curr = queue.front(); cout << curr << " "; queue.pop_front(); isVisited[curr] = true; for (int i = 0; i < v; ++i) ...
ALGO
0.999939
4.147165
cf2a38ff-d6a6-4c41-abf1-505ca8953c60
HongryeolSeong/StudyCplusplus21
09Chapter/ex1_trycatch.cpp
#include <stdio.h> // trycatch ó int main() { int a, b; while (1) { try { printf(" ԷϽÿ : "); scanf("%d", &a); if (a < 0) throw a; // a catch printf(" ԷϽÿ : "); scanf("%d", &b); if (b == 0) throw "0δ ϴ."; printf(" %dԴϴ.\n", a / b); } catch (int a) { printf("%d ̹Ƿ ź\n", a);...
ALGO
0.876121
3.605124
9db507f6-bc3e-4933-9d51-070a6cbf0070
iamnotalone1993/dds
bcl/examples/benchmarks/mer-bench/all-to-all-async.cpp
#include <cstdio> #include <cstdlib> #include <vector> #include <chrono> #include <cassert> #include <bcl/bcl.hpp> int main(int argc, char** argv) { BCL::init(); using T = int; std::vector<BCL::GlobalPtr<T>> ptrs(BCL::nprocs(), nullptr); std::vector<BCL::GlobalPtr<int>> counters(BCL::nprocs(), nullptr); /...
TOOL
0.952281
4.853926