uuid
stringlengths
36
36
repo_name
stringlengths
5
123
relative_path
stringlengths
5
4k
content
stringlengths
33
2.85M
category
stringclasses
6 values
algo_rel_score
float64
0.85
1
quality_score
float64
3
8.76
ce084b0d-4df8-4096-aea5-268bb82dd529
smafjal/AcmOnlinePractice
UVA/Old_Code/291 - The House Of Santa Claus.cpp
///Bismillahir Rahmanir Rahim #include<stdio.h> #include<stdlib.h> #include<math.h> #include<ctype.h> #include<string.h> #include<iostream> #include<vector> #include<list> #include<map> #include<queue> #include<set> #include<stack> #include<algorithm> #include<sstream> #define pi (2*acos(0)) #define oo 1<<29 #define p...
ALGO
0.999783
3.634959
a64b3f57-fa21-483d-a432-c76722c7cf22
Tanner-Davison/battle-simulation
HelloWorldDemo/MathFuncs.cpp
#pragma once int higherOfTwoInts(int Param1, int Param2) { if (Param1 > Param2) { return Param1; } else { return Param2; } } int higherOfThreeInts(int x, int y, int z) { return higherOfTwoInts(x, higherOfTwoInts(y, z)); }
ALGO
0.998272
4.511961
3386de76-d088-46b3-be4a-cddbaa909eea
dhairyapandya05/Data-Structures-and-Algorithms
Arrays/P_3229_Minimumnumberofoperationstomakenumsarrayequaltodiff.cpp
class Solution { public: // vector<int> getAbsoluteMaximums(const vector<vector<int>>& groups) { // vector<int> maxValues; // for (const auto& group : groups) { // int maxVal = 0; // for (int num : group) { // maxVal = max(maxVal, abs(num)); // } ...
ALGO
0.999995
6.129962
8d8aeef2-e740-4994-9e81-2c030cab768f
pranjalssh/CP_codes
anta/!DirectTree.cpp
//木の親→子の辺だけ残す void direct_tree(const vector<vi> &g, int i, int parent, vector<pii> &out_edges) { each(j, g[i]) if(*j != parent) { out_edges.pb(mp(i, *j)); direct_tree(g, *j, i, out_edges); } }
ALGO
0.999848
4.339004
3a3b6887-aeb4-49f6-ae65-c3ccaca3c3b3
niuniuaaa/Cprogram-week4
ch01/SearchTree.cpp
#include<stdlib.h> #include<stdio.h> struct TreeNode; typedef struct TreeNode *Position; typedef struct TreeNode *SearchTree; struct TreeNode { int data; SearchTree Left; SearchTree Right; }; //һÿ SearchTree MakeEmpty (SearchTree T) { if(T!=NULL) { MakeEmpty(T->Left); MakeEmpty(T->Right); free(T); } retu...
ALGO
0.99991
3.305424
fc00310e-7f81-4a3e-bdda-d293464263f7
scyllacore/algorithm
C++ 풀이/acmicpc.net/재풀이/2178(미로 탐색) - 재풀이.cpp
#include <iostream> #include <vector> #include <queue> using namespace std; struct pos { int y, x; int count; }; int dir[] = { -1,1,0,0 }; int n, m; vector<string> mirror; bool visited[100][100] = { {0} }; int bfs() { queue<pos> bfsQ; bfsQ.push({ 0,0,1 }); visited[0][0] = 1; for (; !bfsQ.empty();) { pos ...
ALGO
0.999967
5.096134
39d5f863-bfd8-4de4-be59-d2c354a224b9
Parth20401/DSA
Recursion & Backtracking/Generate Parentheses.cpp
class Solution { private: void generate(int n, int open, int close, string str, vector<string>& result){ if(open == n && close == n){ result.push_back(str); return; } //only add open parantheses if open < n if(open < n) generate(n, open + 1, close,...
ALGO
0.999902
6.476083
d05d0454-ab72-491a-86e8-e4972a8cbaee
liuhycn/algorithm-exercise
algorithm-exercise/algorithm-exercise/Huffman_tree.cpp
#include <iostream> #include <queue> #include <algorithm> using namespace std; int main() { // insert code here... int n; while(scanf("%d",&n) != EOF) { priority_queue<int,vector<int>,greater<int>> heap; //必须使用小顶堆 int temp; for (int i = 0; i<n; i++) { ...
ALGO
0.999914
3.469165
779befa2-f359-4fd8-9c1a-488a36687eb2
diespinoza/cpp_projects
old_courses/programming/hw1/digits.cpp
// // digits.cpp // purpose: report number of digits in an integer // modified by: Diego Espinoza Rodriguez // date: 1/29/2015 // #include <iostream> #include <cmath> using namespace std; int main() { int input; // Requests a number from the user cout << "Enter a number: "; cin >> input; // ...
ALGO
0.962265
6.131966
f7b98869-323d-4486-971e-a337dee765fa
ArbazHassan20/DSA
recursion and backtracking/Q1.cpp
#include <iostream> #include <vector> using namespace std; // Function to check if the current position is valid bool valid(int i, int j, int n) { return i >= 0 && j >= 0 && i < n && j < n; // Valid if within the matrix boundaries } // Function to find all possible paths from (0,0) to (n-1,n-1) void total(vector<...
ALGO
0.999978
6.307209
0cf487e9-f8a3-4a38-a988-205ce3603b9a
raincross7/code-similarity
codes/train_code/problem090/problem090_325.cpp
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <map> using namespace std; const double eps=1e-10; int main() { map<string,int> m; int fre=0,len=0;...
ALGO
0.998834
3.221763
52d973ce-10a4-49fc-85c6-1c828d7a3088
PhatMinhLe0905/THbuoi1PTTKTT
6251071071_LeMinhPhat_Buoi1/Bai1_0/6_GiamThieuViecGoiToiChuongTrinhCon/Vidu2/LoiGiai1.cpp
#include <iostream> using namespace std; int tonguoc(int a) { int t, s; s = 0; for (t = 1; t <= a / 2; t++) if (a % t == 0) s = s + t; return s; } int main() { for (int i = 1; i <= 10000; i++) { for (int j = i + 1; j <= 10000; j++) { if ((tonguoc(...
ALGO
0.9997
4.182662
93cd84aa-dd76-4acf-ad3d-ecfbb566898e
furszy/bitcoin
src/qt/transactionfilterproxy.cpp
#include <qt/transactionfilterproxy.h> #include <qt/transactiontablemodel.h> #include <qt/transactionrecord.h> #include <algorithm> #include <cstdlib> #include <optional> TransactionFilterProxy::TransactionFilterProxy(QObject *parent) : QSortFilterProxyModel(parent), m_search_string(), typeFilter(ALL_TYP...
TOOL
0.911375
6.753806
0f4d6758-beb2-442e-b0de-1b571ae00e2a
willisfree/ppp_book
chapter21/chapter21_try_this_4.cpp
/* Chapter 21, try this 4 13.11.2018 21:41 */ #include <iostream> #include <stdexcept> #include <unordered_map> #include <algorithm> #include <numeric> using namespace std; double weight_value(const pair<string,double>& a, const pair<string,double>& b) { return a.second*b.second; } int main() try { unordered_m...
TOOL
0.930666
5.835581
9e0a61a0-f5b0-491c-a6fe-c80aba04b28d
zzywhu/pnp_and_project
src/main.cpp
#include "config.h" #include "pnp.h" #include "projection.h" #include <iostream> #include <string> int main(int argc, char** argv) { if (argc != 2) { std::cout << "Usage: " << argv[0] << " <config_file_path>" << std::endl; return -1; } std::string config_file = argv[1]; std::cout <...
TOOL
0.942292
6.484425
92540bfe-d488-4fc0-a412-70fffe5182bd
SiyangShao/codes
codeforces/2022/R786/G.cpp
#include <algorithm> #include <array> #include <bits/stdc++.h> using namespace std; using ll = long long; auto solve() { ll n, m; cin >> n >> m; vector<ll> in, dp; vector<vector<ll>> E; in.assign(n, 0), E.assign(n, vector<ll>()); dp.assign(n, 0); for (int i = 0; i < m; ++i) { ll u, v...
ALGO
0.999218
5.056795
9cfe3c4f-0ca1-441f-83f5-a9842d1747a3
ChandiniGujju/personal_datastructures
binary_tree_searching.cpp
#include<iostream> using namespace std; class node{ public: int data; node* left; node* right; public: node(int val){ data=val; left=NULL; right=NULL; } }; void insertion(node* &root,int val){ node* n=new node(val); if(root==NULL){ root=n; return; ...
ALGO
0.999997
4.800113
2025b0ae-10d3-4f34-b37e-3e763584ada7
physicalist/ncbs-moose
moose/branches/async_multiscale_cmake/device/PIDController.cpp
// PIDController.cpp --- // // Filename: PIDController.cpp // Description: // Author: subhasis ray // Maintainer: // Created: Tue Dec 30 23:36:01 2008 (+0530) // Version: // Last-Updated: Tue Jun 11 17:00:51 2013 (+0530) // By: subha // Update #: 338 // URL: // Keywords: // Compatibility: // // ...
ALGO
0.939721
5.661633
5c58ea50-78b7-4147-915f-98ef8b88183d
ShawnTSH1229/XEngine
ThirdParty/boost_1_78_0/libs/compute/perf/perf_stl_partition_point.cpp
#include <algorithm> #include <iostream> #include <numeric> #include <vector> #include "perf.hpp" int rand_int() { return static_cast<int>((rand() / double(RAND_MAX)) * 25.0); } bool less_than_20(int value) { return value < 20; } int main(int argc, char *argv[]) { perf_parse_args(argc, argv); std::c...
ALGO
0.984256
6.115492
dd5d3061-f4e7-4667-b7ce-aaffb154d13f
Dasug/TaylorTrack
src/opencv_datareceiver.cpp
/** * @file * @brief Module to receive data and execute the tracking algorithm. */ #include <yarp/os/all.h> #include <yarp/sig/all.h> #include <string> #ifdef OLD_OPENCV_HEADERS #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #else #include "op...
ALGO
0.938757
5.266439
74a9b536-a6d7-4220-b867-c7840285c12a
KNayfar/TP5
A tp5/ex7.cpp
/*ce programme permet de lire une chaine de caractres et supprimer les multiple blancs afin de garder un seul espace */ #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main() { char ch[200]; int i,j; // Dclaration du compteur // Contrle de saisie do { printf("E...
ALGO
0.973165
3.007806
a8a00800-92bc-4838-bb14-8dcdff9ca5b1
AlleyNawaz/366DaysofLeetcode
0265_P386_Lexicographical_Numbers.cpp
/* Day: 265 Problem Number: 386 (https://leetcode.com/problems/lexicographical-numbers) Date: 21-09-2024 Description: Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. You must write an algorithm that runs in O(n) time and uses O(1) extra space. Example 1: Input: n = 13 ...
ALGO
0.999639
6.973078
a9c16994-ff99-486a-ad04-a3d7cbc2babf
avinashw50w/ds_algo
Leetcode/1032. Stream of Characters.cpp
/*Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. query(letter): returns true if and only if for some k >= 1, the last k characters queried (in order from oldest to newest, including this letter just queried) spell one of the words in the ...
ALGO
0.998803
6.55695
2048026e-b24c-400e-9f82-345406277ba2
AbbyNaomi/flutter_summer_course_tornado
day_13_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.998575
6.76073
6d995e8a-010c-4dba-aad8-cc74302e88bb
ausendzhikova/uni-data-structure-and-algorithms
Super_mario.cpp
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; int main() { int n; cin >> n; vector<int> keys; vector<int> doors; for (int i = 0; i < n; i++) { int key; cin >> key; keys.push_back(key); } for (int i = 0; i < n; i++) ...
ALGO
0.999871
4.113718
7aaa241f-39b5-4b34-a06b-fa88d9ca260f
ornob011/HackerRank
Funny_String.cpp
#include<bits/stdc++.h> using namespace std; int main() { freopen("/home/ornob/Downloads/Practice/input.txt", "r", stdin); freopen("/home/ornob/Downloads/Practice/output.txt", "w", stdout); int t, i; bool flag; string input, rev; cin>>t; while(t--) { cin>>input; rev=input; reverse(rev.begin(...
ALGO
0.999483
4.589287
d53ec775-a653-48cc-9bb4-1782f256548e
fredgrott/fluttertips_tricks
flutter_transparent_appbars/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.998712
6.785645
f1761b9b-6d78-4dd2-b1c8-5b752f53694c
skyway24/Coding_Library
Codeforces/Domino piling.cpp
/* You are given a rectangular board of M×N squares. Also you are given an unlimited number of standard domino pieces of 2×1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions: 1. Each domino completely covers two squar...
ALGO
0.99977
3.867555
e78625e8-700b-4e19-b55b-f06a75f4d253
adityanjr/code-DS-ALGO
CodeForces/misc/Benches.cpp
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define pie 3.14 typedef long long int ll; /* .d8b. d8888b. db db .d8b. d8b db d8' `8b 88 `8D `8b d8' d8' `8b 888o 88 88ooo88 88oobY' `8bd8' 88ooo88 88V8o 88 88~~~88 88`8b 88 88~~~88 88 V8o88 88 88 88 `88. 88 88 88 ...
ALGO
0.999979
3.625225
3e1f5fe0-653f-4ecb-adeb-38b4763c2537
3013216006/ACM
7-30/702B.cpp
#include <iostream> #include <stdio.h> #include <map> #include <string.h> using namespace std; map<int,int>M; int a[100100]; int main(){ int n; while(~scanf("%d",&n)){ M.clear(); for(int i=0;i<n;i++){ scanf("%d",&a[i]); M[a[i]]++; } long long ans=0; for(int l=1;l<32;l++){ int x=1<<l; for(int i=...
ALGO
0.999652
3.462409
bc0f5389-fc1c-485f-9552-7aa495c38b68
msgeden/llvm-sora
llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp
#include "VPlanPredicator.h" #include "VPlan.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #define DEBUG_TYPE "VPlanPredicator" using namespace llvm; // Generate VPInstruction...
ALGO
0.999806
7.193898
d848b552-21bd-456e-8637-fe36243d249e
jaARke/LeetCode
896.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: bool isMonotonic(vector<int>& nums) { if (nums.size() < 2) { return true; } bool inc = true, dec = true; for (int i = 1; i < nums.size() && (inc || dec); i++) { inc = inc && nums[i] >= n...
ALGO
0.99999
5.965774
3fb29a27-9676-4f77-b2a4-73ec2bc4a574
rocketman123456/GAMES202-Homework
homework2-prt/src/perspective.cpp
#include <nori/camera.h> #include <nori/rfilter.h> #include <nori/warp.h> #include <Eigen/Geometry> NORI_NAMESPACE_BEGIN /** * \brief Perspective camera with depth of field * * This class implements a simple perspective camera model. It uses an * infinitesimally small aperture, creating an infinite depth of field...
TOOL
0.990806
7.633757
86e7d035-dd69-4763-8b19-ca76a4daef68
paddumelanahalli/coen275
20-pointerExample.cpp
#include <iostream> #include <conio.h> using namespace std; int main() { int a, *ptr1, **ptr2; //clrscr(); ptr1 = &a; ptr2 =&ptr1; cout << "The address of a : " << ptr1 << endl; cout << "The address of ptr1:" << ptr2 << endl; cout << "After incrementing the addres values" << endl; p...
ALGO
0.996354
3.059791
fe3f115a-e941-4a68-ac23-5f022967e2f2
MengqingCao/opencv_contrib_dvpp
modules/ximgproc/samples/filterdemo.cpp
#include "opencv2/core/utility.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/ximgproc.hpp" #include <stdio.h> using namespace cv; using namespace std; int main( int argc, const char** argv) { float alpha = 1.0f; float sigma = 0.02f; ...
ALGO
0.972263
5.036714
d058a7bd-23dc-4670-94c6-48b60f5e8552
AksanaKuzmitskaya/introductiontocpp
merge.cpp
#include <iostream> #include <stdio.h> using namespace std; int temp[6]= {0}; void mergesort(int lstart,int lend,int rstart,int rend, int array[]) { int index = lstart; int size = rend - lstart + 1; while (lstart <= lend && rstart <= rend) { if (array[lstart] < array[rstart]) { temp[i...
ALGO
0.999983
4.22947
76aa8b49-fcaa-4334-aced-4a158d4f49e5
mohitmallick17/LeetCodeSolutions
135-candy/135-candy.cpp
class Solution { public: int candy(vector<int>& ratings) { int n=ratings.size(); vector<int> nums(n, 1); for(int i=1;i<n;i++){ if(ratings[i] > ratings[i-1]) nums[i]=nums[i-1]+1; } int ans=0; for(int i=n-1;i>0;i--){ if(r...
ALGO
0.999998
6.179017
ca3a4552-91ce-4a06-a73b-7ef85f8c9bb4
raptoravis/forwardplusrendering
thirdparty/boost_1_70_0/libs/geometry/doc/src/examples/algorithms/num_segments.cpp
// Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle //[num_segments //` Get the number of segments in a geometry #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> int m...
ALGO
0.990851
6.788631
170ce8e4-44ad-4df8-8be9-052fd8490b67
M0hamedIbrahim1/Problem-Solving-With-C-
random Problems/Drawing Task.cpp
//link: https://codeforces.com/group/MWSDmqGsZm/contest/223207/problem/A //author: Mohamed Ibrahim #include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int row,col,q; cin>>row>>col>>q; char arr[row][col]; for(int i = 0;i<row;i++){ for(int j=0;j<col;j++){ arr[i][j]= '.'; ...
ALGO
0.999121
3.450818
1ec8ec7c-06ca-417a-a539-028cdc780e7c
Saimatonni/uri
chosen.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n,a,d,i; double b,e=0.0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %lf",&a,&b); if(b>e) { e=b; d=a; } } if(e<8) printf("Minimum note not reached\n"); else printf("%d\n",d); return 0; }
ALGO
0.999942
3.282007
3f08ba60-d1be-4e60-9ce6-2168bcd88bb0
SaranshBangar/GeeksforGeeks-Solutions
Basic/Special Series Sum/special-series-sum.cpp
//{ Driver Code Starts // Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends // User function Template for C++ class Solution { public: long long int sumOfTheSeries(long long int n) { long long int count=0; for (long long int i=1;i<=n;i++) { ...
ALGO
0.999887
6.482212
a39734eb-5ee8-4f70-8920-d319044afca8
Anujdominoblack/DSA-using-c-
sorting/choclatedistributionproblem.cpp
// we are given packets of different sizes and we have m children now we want to distribute these choclate according to the rule // 1) every child should get exactly 1 packets // 2) we want to minimize the differences b/w the minimum choclate a child get and maximum another egt #include<iostream> #include<algorithm> us...
ALGO
0.999972
4.443599
67f8553f-e8a3-4728-ac08-afda7a80d875
TaZofia/sem4
aisd/lista3/zad5/quickSort.cpp
#include <iostream> #include <vector> #include <cmath> #include <sstream> #include "functions.h" #include "selectFunctions.h" int partition(std::vector<int>& A, int p, int r) { int x = A[r]; // Pivot int i = p - 1; for(int j = p; j < r; j++) { countComparisons(); if(A[j] <= x) { ...
ALGO
0.998754
4.756075
0bb32d0a-2450-4fbe-82ee-6643fde5ee10
KenetC/Procesamiento-de-Imagenes
eigen-3.4.0/bench/benchCholesky.cpp
// g++ -DNDEBUG -O3 -I.. benchCholesky.cpp -o benchCholesky && ./benchCholesky // options: // -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 // -DEIGEN_DONT_VECTORIZE // -msse2 // -DREPEAT=100 // -DTRIES=10 // -DSCALAR=double #include <iostream> #include <Eigen/Core> #include <Eigen/Cholesky> #include <bench/BenchUt...
TEST
0.973331
5.992048
2a669616-6af3-460b-84cf-75a6ced2442e
liehendi11/cpsource
google_apac_round_d_b.cpp
#include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; typedef struct Node { int start,end,count; int left, right; }; vector<Node> tree; int t,n,p; int a,b; int constructTree(int x, int y) { int pos; if (x > y) return -1; Node node; node.start = x; node.end = y; node.count = 0; tr...
ALGO
0.999431
3.694285
3ee6aca5-16ed-41ef-9051-782e4088ed9d
garinh/planeshift
src/npcclient/command.cpp
#include <psconfig.h> #include <stdio.h> #include <string.h> #include <memory.h> #include <stdlib.h> #include <ctype.h> //============================================================================= // Crystal Space Includes //============================================================================= #include <iu...
TOOL
0.854816
3.349991
c8217765-110a-473d-a476-84c8ded943a9
someOtherCoder/projectPractice
tests/core_tests/chaingen.cpp
#include <vector> #include <iostream> #include <sstream> #include "include_base_utils.h" #include "console_handler.h" #include "p2p/net_node.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_basic_impl.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "cryptonote...
TEST
0.853393
5.670667
46125e91-3a47-4113-972d-8e5f196668bd
aroradev314/competitive_programming
practice/rescheduleexam.cpp
#include <bits/stdc++.h> #define int long long using namespace std; bool valid(vector<int>& vec, int dist) { int last = 0; for (int i : vec) { if (i - last - 1 < dist) return false; last = i; } return true; } void print(vector<int>& a) { for (int i : a) cout << i << " "; cout << endl; } void solv...
ALGO
0.999948
4.695728
3d5fc550-e730-4548-9b54-dc645e6029b8
Iambharatkolhe/SY-PRACTICAL
ADVANCED_DS/ASS_6.cpp
#include<iostream> #include<iomanip> using namespace std; class hashing { public: int check[20]; int stored[20]; int size_Of_Hash_Table; hashing(int hashingsize) { size_Of_Hash_Table = hashingsize; for (int i = 0; i < hashingsize; i++) { chec...
ALGO
0.999723
5.996222
7a07b2cc-8317-42c6-ad84-f0cb73540c2a
bartsimpson89/C-_problem
title_23.cpp
#include <iostream> #include <stack> #include <vector> using namespace std; struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }; class Solution { public: bool VerifySquenceOfBST(vector<int> sequence) { ...
ALGO
0.999972
5.462943
4d0f88f6-a82a-4e4a-931f-5e29b6cb86b1
fejmiqaz/SP
sideExercises/exec15.cpp
#include<iostream> #include<cstring> using namespace std; /* From SI read N strings not longer than 80 chars. At the beginning of the program read two integers: N - number of strings you are going to read X - shifting size. Each of the read strings should be transformed in such a way that lowercase and u...
ALGO
0.999435
4.79579
63d278df-c495-4597-9bf0-81d1c9599496
raincross7/code-similarity
codes/train_code/problem103/problem103_188.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> int main(){ string s; cin>>s; map<char,int> mp; rep(i,0,s.size()){ mp[s[i]]++; if(mp[s[i]]>1){cout<<"no"<<endl;return 0...
ALGO
0.999985
4.012801
cc88362d-8bcd-49b9-8aed-7fe269695c5f
cubercsl/The-road-to-ACMer
Codeforces/435/435A.cpp
#include <bits/stdc++.h> using namespace std; #define clr(a,x) memset(a, x, sizeof(a)) #define mp(x,y) make_pair(x,y) #define pb(x) push_back(x) #define X first #define Y second #define fastin ios_base::sync_with_stdio(0);cin.tie(0); typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vect...
ALGO
0.999946
3.974868
ce9d16f3-d154-4407-9103-0cef29427cf9
ujjawalgupta29/Coding-Stuff
LeetCode/subtree_check.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.999981
6.291499
4f7fad24-328b-4c72-ad60-7e16f4b0fa72
sohan18011/Problem-Solving-In-different-online-judge
Uva/11547 - Automatic Answer.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n,i,x,s; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&x); s=(((x*567)/9+7492)*235)/47-498; s=s/10; s=s%10; printf("%d\n",abs(s)); } }
ALGO
0.999616
3.050257
3df0bd87-cbe6-45a1-b3fc-0960de317fb1
prashantdhaka1/codeforces_soln
F_Minimum_Maximum_Distance.cpp
/* **************************************************************************************** * Jai Bajrangbali * * codechef-prashantdhaka * * cf-dhakaprashant66...
ALGO
0.999905
4.778809
62726307-7999-4f3b-b67a-03d0c10ec9a8
olibd/pytorch-0.4.0-snapshot
third_party/ComputeLibrary/src/runtime/NEON/functions/NEOpticalFlow.cpp
#include "arm_compute/runtime/NEON/functions/NEOpticalFlow.h" #include "arm_compute/core/Error.h" #include "arm_compute/core/ITensor.h" #include "arm_compute/core/NEON/kernels/NELKTrackerKernel.h" #include "arm_compute/core/TensorInfo.h" #include "arm_compute/core/Window.h" #include "arm_compute/runtime/NEON/NESchedul...
ALGO
0.987823
6.847048
0f71fbab-23c0-43b2-99b2-2b278f049392
Host-Vedas/DSA-WITH-C-PLUS-PLUS
Phase 1/L19 STL/Algorithm/algo.cpp
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { vector<int> vak; vak.push_back(5); vak.push_back(7); vak.push_back(8); vak.push_back(9); vak.push_back(10); vak.push_back(12); cout << " finding 5 -> " << binary_search(vak.begin(), vak.end(), 5)...
ALGO
0.999711
4.440343
bd224c7b-7dc4-4c2c-b3ef-faa1de7628a9
pflyly/torzu-mirror
externals/dynarmic/src/dynarmic/frontend/A64/translate/impl/simd_three_same_extra.cpp
#include "dynarmic/frontend/A64/translate/impl/impl.h" namespace Dynarmic::A64 { namespace { using ExtensionFunction = IR::U32 (IREmitter::*)(const IR::UAny&); bool DotProduct(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd, ExtensionFunction extension) { if (size != 0b10) { return v.Re...
TOOL
0.908421
7.390836
99478555-83e4-4190-a749-b068824594ac
Cobb-Yoo/Algorithms
BOJ/14916 거스름돈/14916 거스름돈.cpp
#include <iostream> using namespace std; int main(){ int n; cin >> n; int five=0; int two=0; five = n/5; n %= 5; two = n/2; n %= 2; while(n){ if(five) { five--; n+= 5; } else break; two += n/2; n %= 2; } if(n) cout << -1; else cout << five+two; }
ALGO
0.999876
3.998852
adfabfcc-89a2-4f1b-876f-b66ca35a73c7
TanishqBhargava/Hackerearth
Data Structures/Advanced Data Structures/Segment Trees/Incremental queries.cpp
/*========================*\ | ID: tanishqbhargava2509 | | LANG: C++ | \*========================*/ //Tanishq Bhargava #include <bits/stdc++.h> using namespace std; struct Node { int mx, cnt[2]; long long sum; Node() { mx = sum = cnt[0] = cnt[1] = 0; } Node(int x) { ...
ALGO
0.999802
4.587555
800a7eca-f872-4747-b43d-60ded7217648
pandeypranavdeval/DSA-problem-solutions
Course Schedule - GFG/course-schedule.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function Template for C++ class Solution { public: vector<int> findOrder(int v, int m, vector<vector<int>> prerequisites) { vector<int>adj[v]; for(auto it: prerequisites){ adj[it[1]].push...
ALGO
0.999888
6.717705
9b596c67-afb8-49a0-9a49-78cf4c548d33
asdf2014/algorithm
Codes/shengyaqingfeng/leetcode/editor/cn/[11]ContainerWithMostWater.cpp
// title : [11]ContainerWithMostWater // date : 2021-02-11 20:37:43 // author : creazyboyone // note : 传统艺能,新年刷几道压压身。寓意开发者不能忘本。技术改变未来,朝着梦想前进!!! // 思路 : 暴搜,遍历所有长方形,然后计算面积,返回最大的 // 额,居然超时了,从中间试起?从外围试起?好像也不行,好像可以从最高的柱子开始 // 先依次找最高的记录下来,然后新找的较低和记录高的依次计算....好像也不行,还是要遍历一遍 // 看看能不能省下一部分计算,瞄了一眼题解,看到了双指针 emm...... // 意思是左右一个指针咯...
ALGO
0.999972
6.20785
67879d13-2238-4507-aeb6-a7350987852f
Renzo9710/mhp_review
mhp_planner/extern/eigen3/unsupported/doc/examples/SYCL/CwiseMul.cpp
#include <iostream> #define EIGEN_USE_SYCL #include <unsupported/Eigen/CXX11/Tensor> using Eigen::array; using Eigen::SyclDevice; using Eigen::Tensor; using Eigen::TensorMap; int main() { using DataType = float; using IndexType = int64_t; constexpr auto DataLayout = Eigen::RowMajor; auto devices = Eigen::get...
ALGO
0.892563
4.980069
f664c844-96b1-4ed0-836c-074ec9173980
rileytestut/GBA4iOS-2.0-Beta
emu-ex-plus-alpha/GBC.emu/src/common/resample/src/kaiser50sinc.cpp
#include "kaiser50sinc.h" #include "i0.h" #include <cmath> SysDDec kaiser50SincWin(const long n, const long M) { const SysDDec beta = 4.62; static const SysDDec i0beta_rec = 1.0 / i0(beta); SysDDec x = static_cast<SysDDec>(n * 2) / M - 1.0; x = x * x; x = beta * std::sqrt(1.0 - x); return i0(x) * i0beta_rec; ...
ALGO
0.999747
5.114074
334b7017-4300-46b1-a4e7-ca015484705f
imulan/procon
atcoder/yahoo-procon2017-final-open/a.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second const int INF=123456789; i...
ALGO
0.999724
3.606562
748101e0-d3c2-4766-9cfe-738f3fa76690
vvanthanh/N22DCDK087_monC
Chapter 07/bt_challenges/c7_bai_chall_11.cpp
#include <iostream> #include <fstream> #include <iomanip> using namespace std; const int NUM_QUESTIONS = 20; void readAnswersFromFile(const char* filename, char answers[]) { ifstream file(filename); if (!file) { cerr << "Error opening file: " << filename << endl; exit(1); } for (...
TOOL
0.947969
5.373633
6755d5c0-8068-4ac5-92a8-451392225697
joshualass/CP
Solutions/NonProblems/ACPC/Spring2025/othersolns/joshua_ovineomnipotence.cpp
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, c; cin >> n >> m >> c; vector<int> a(n); for(int &x : a) cin >> x; vector<vector<int>> adj(n); for(int i = 0; i < m; i++) {...
ALGO
0.999946
4.341339
41b3a5d6-b2ee-4608-92de-9cad15430058
saumyasrivastava08/Important_Coding_Problems
Contest/Codechef/Lunchtime/Feb_lunchtime/lunchtime_3.cpp
#include<bits/stdc++.h> using namespace std; bool prime [10000001]; void seive() { memset(prime, true, sizeof(prime)); for (long long i = 2; i * i <=10000001 ; i++) { if (prime[i] == true) { for (long long j = i * i; j <= 10000001; j += i) prime[j] = false; ...
ALGO
0.999616
3.948417
25978c3a-344d-412d-a1e7-a546de4b646d
ishandutta2007/codeforces
yfhuang/normal/1246/D.cpp
#include <cstdio> #include <algorithm> #include <cstring> #include <set> #include <iostream> #include <stack> #include <vector> #include <string> #include <map> #include <cmath> #include <queue> using namespace std; const int maxn = 1e5 + 5; vector<int> G[maxn]; vector<pair<int, int> > g[maxn]; int n; int dfn[maxn];...
ALGO
0.999953
4.221849
dcf2410a-01cb-4715-bade-3cb4afaee731
raincross7/code-similarity
codes/train_code/problem486/problem486_214.cpp
#include <bits/stdc++.h> using namespace std; #define forn(i, n) for(int i = 0; i < int(n); i++) #define fore(i, l, r) for(int i = int(l); i < int(r); i++) #define pb push_back #define deb(x) cout<<#x<<" "<<x<<endl; #define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl; #define deb3(x, y, z) cout<<#x<<" "<<x<<" "<...
ALGO
0.999812
3.834017
ac752a6d-9c73-4019-b06f-ca3849e11f84
abovethe-clouds/ACM
c++/cf/Educational Codeforces Round 15/C.cpp
#include<bits/stdc++.h> using namespace std; #define fir first #define sec second #define endl "\n" typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int mod = 1e9 + 7, inf = 0x3f3f3f3f, P = 131; int read() { int x = 0, w = 1; char ch = 0; whi...
ALGO
0.999995
4.350704
8e80157f-4bdb-401b-a619-ed1a5e39a282
Randowlh/Project_ACM_2021
code/competition/Codeforces Round #724/4.cpp
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; #pragma optimize(2) //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #define rbset(T) tree<T,null_type,less...
ALGO
0.999985
4.225956
924bcbbe-7d65-4494-b887-27fc37c904ab
adityanjr/code-DS-ALGO
CodeForces/misc/Array Splitting.cpp
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define pie 3.14 typedef long long int ll; /* .d8b. d8888b. db db .d8b. d8b db d8' `8b 88 `8D `8b d8' d8' `8b 888o 88 88ooo88 88oobY' `8bd8' 88ooo88 88V8o 88 88~~~88 88`8b 88 88~~~88 88 V8o88 88 88 88 `88. 88 88 88 ...
ALGO
0.999949
3.701787
6e0aced7-b142-46de-a1be-720645e552cf
hjiang13/LLMs-in-IR
POJ-104/2/467.cpp
#include <iostream> using namespace std; int main() { char a[1000][26], t; int b[1000], num[26] = { 0} , n, i, j, k, max, l[1000]; cin >> n; max = 0; for (i = 1; i <= n; i++) { cin >> b[i]; gets(a[i]); l[i] = strlen(a[i]); for (j = 1; j <= l[i]; j++) num[a[i][j] - 'A']++; } for (i = 0; i <= 25; i++) if (num[i] > ...
ALGO
0.999967
3.498489
7ce4a519-7f12-43e7-87fd-e0f029d6cc17
karandesai24/LeetCode
164-maximum-gap/164-maximum-gap.cpp
class Solution { public: int maximumGap(vector<int>& nums) { sort(nums.begin(),nums.end()); int count=0; for(int i=0;i<nums.size()-1;i++) { if(nums[i+1]-nums[i]>count) count=nums[i+1]-nums[i]; } return count...
ALGO
0.999913
5.133296
817f77cb-9172-4cae-9c31-77d5dade1481
ishandutta2007/codeforces
aryanc403/normal/911/C.cpp
/* Compete against Yourself. Author - Aryan Choudhary (@aryanc403) */ #pragma GCC optimize ("Ofast") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize ("-ffloat-store") #include<iostream> #include<bits/stdc++.h> using namespace std; #define fo(i,n) for(i=0;i<(n)...
ALGO
0.999941
3.681381
efb630b6-f030-42ec-91bc-5b198e8df221
en30/online-judge
atcoder/abc054_a.cpp
#include <bits/stdc++.h> #include "../include/template" int A, B; int main() { cin >> A >> B; if (A == 1) A += 13; if (B == 1) B += 13; if (A > B) { cout << "Alice"; } else if (A < B) { cout << "Bob"; } else { cout << "Draw"; } cout << endl; return 0; }
ALGO
0.999917
4.29083
80334534-6ebf-40c7-9f54-7b3772ebfdbb
ReinSwanSD/Programming-in-C-plus-plus
Data Structures and Algorithms/evenOdd2.cpp
/******* Reinier Swanepoel 2/28/2020 CS111 Even Odd part 2 Write a program that will read an unknown number of positive or negative numbers from the keyboard and output “even” if the number is even or “odd” if it is odd. The user will enter a zero when there are no more numbers to input. The program should display t...
ALGO
0.993108
4.938409
dc9b2bf8-0705-44ae-8ce5-1a788826170f
ishandutta2007/codeforces
intothenight/normal/1190/D.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; template<class T, class Compare = less<>> using ordered_set = tree<T, null_type, Compare, rb_tree_tag, tree_order_statistics_node_update>; template<class T, class U, cl...
ALGO
0.999887
5.11423
3a538602-e2b9-473e-a929-87b1ed6ddcde
yenluu2506/CODEOFLUU
OOP/A-baitapTH/bai1_12.cpp
#include<iostream> #include<conio.h> using namespace std; class mytime { private: int d,m,y; public: mytime(int dd=0,int mm=0,int yy=0) { d=dd; m=mm; y=yy; } void nhap() { cout<<"Nhap gio: "; cin>>y; cout<<"Nhap phut: "; cin...
ALGO
0.89972
3.07587
7e5c192b-7194-479a-a4d2-a9c41afc9220
Cat-bst/CSC-134
m4hw1.cpp
// CSC 134 // Cat Best // 3/19/2025 // M4HW1 Bronze #include <iostream> using namespace std; int main() { int firstNum, answer; firstNum = 5; int i = 1; while (i <= 12) { answer = firstNum * i; cout << firstNum << " times " << i << " is " << answer << endl; i++; } ...
ALGO
0.999555
4.275502
45889dfa-8d46-463e-8322-bd680de33bfe
Leo-rq-yu/Metro-graph
bfstest.cpp
#include <iostream> #include "graph.h" //#include "graph.cpp" #include <vector> #include <string> #include <map> using namespace std; //test case 1: randomly select two stations from the graph, and test whether the edge between them is DISCOVERY or CROSS bool bfstest1() { cout<<"test cross edge case 1"<<endl; ...
TEST
0.932128
3.224098
79f84169-0026-4262-a2ab-5a01d847e88b
Zapryanovx/FMI_2023_Introduction_to_Programming
00_other_repos_tasks/strings_angeld55/01_change_word_with_other.cpp
/*#include <iostream> int getSizeOfStr(char word[]); void saveChanges(char str[], int idxOfWord, int copyOfIdx, char wordTwo[], int sizeOfWordTwo); int main() { const int MAX_SIZE = 100; char str[MAX_SIZE] = ""; char wordOne[MAX_SIZE] = ""; char wordTwo[MAX_SIZE] = ""; std::cin.getline(str, MAX_SIZE); std::cin...
ALGO
0.999651
3.616876
5568904b-4685-4c34-b6f1-63b35ac3b95e
neurospin/pypreclin
pypreclin/preproc/resources/leuven/prod/mex/n_fftshift_mex.cpp
#include <stdlib.h> #include <string.h> /*#include <cmath>*/ #include <math.h> #include "mex.h" // // template <typename T> // // void fftshift1(const mxArray *mxX, mxArray *mxY, bool isComplex) { // // mwSize M = mxGetM(mxX); // // mwSize N = mxGetN(mxX); // // // // if(M == 1) { // // memcpy(mxGetData(mxY), ...
ALGO
0.978273
4.447023
ecbaf98c-16ae-4ba3-bd29-8e02ffcb85b5
aoaforever/C_trian
Labuladong_app/215.数组中的第k个最大元素.cpp
/* * @lc app=leetcode.cn id=215 lang=cpp * * [215] 数组中的第K个最大元素 * * https://leetcode-cn.com/problems/kth-largest-element-in-an-array/description/ * * algorithms * Medium (64.70%) * Likes: 1631 * Dislikes: 0 * Total Accepted: 607.7K * Total Submissions: 939.5K * Testcase Example: '[3,2,1,5,6,4]\n2' *...
ALGO
0.999978
5.363586
eb01db69-7ddb-43ef-b6fb-19ad76b050cd
Aditya-Mohite/GFG_Answers
Day_199/Missing in Array.cpp
class Solution { public: // Note that the size of the array is n-1 int missingNumber(int n, vector<int>& arr) { int s = (n*(n+1))/2; int a = accumulate(arr.begin(), arr.end(), 0); return (s - a); } };
ALGO
0.999866
5.394914
d857f285-3620-4dce-baee-c7862f59999f
srslyashh/Portfolio
cs161/assignment4_TextSurgeon/assign4_text.cpp
/***************************************************** ** Program: Assignment 4 - Text Surgeon ** Author: Kathleen Ashley ** Date: February 23 2020 ** Description: Taking the user input for the game ** Input: c string ** Output: The output depends on the user's choice, and the output will ** reflect on each func...
ALGO
0.995019
5.112801
b2aad595-fe9d-4102-be2c-1a604631475b
amubawrnaw/CPL_Solutions
Kattis/reachableroads/Template.cpp
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long long ll; typedef pair<int,ii> iii; bitset<1001> bs; int main() { //freopen("out.txt","wt",stdout); int nctr; scanf("%d", &nctr); while(nctr--){ int m,n; scanf("%d %d", &m, &n); ...
ALGO
0.999648
4.185555
7eea2785-d7ba-42cf-a238-2522f34deef8
Artyomkin6/email-hider
editor.cpp
#include <cmath> #include "editor.h" std::vector<std::string> read_file_mails(const std::string& path) { std::ifstream fin(path); std::vector<std::string> result; if (fin.is_open()) { while (!fin.eof()) { std::string current; fin >> current; result.push_back(current); } } fin.close(...
TOOL
0.930281
4.195886
c2820467-af8a-42f9-a1b8-c9534ca4a5d4
tihor04/practice-codes
practice/replacepi.cpp
#include "bits/stdc++.h" using namespace std; void replace(string s,int i){ if(i==s.length()) return; if(s[i]=='p'&&s[i+1]=='i') { cout<<"3.14"; i++; } else cout<<s[i]<<s[i+1]; replace (s,i+1); } int main() { string s="pipppppipipi"; replace(s,0); return 0; }
ALGO
0.999744
3.302468
cbfb4b7b-59b9-4b36-a47f-2b3256b87696
tsingke/Homework_Neumann
肖宜美/Experiment-3/例2.11.cpp
#include<iostream> using namespace std; void swap(int &x, int &y) { int t = x; x = y; y = t; } int main() { int a = 3, b = 5, c = 10, d = 20; cout << "a=" << a << " b=" << b << endl; swap(a, b); cout << "a=" << a << " b=" << b << endl; cout << "c=" << c << " d=" << d << endl; swap(c, d); cout << "c=" << c << ...
ALGO
0.998339
3.655387
44ae4bf8-3bc4-4b14-a049-c07db7fc06e0
TengFeiyang01/Algorithm
casual/Training/AcWing178.cpp
#include <bits/stdc++.h> #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) x.rbegin(), x.rend() #define pb push_back #define eb emplace_back #define lb std::lower_bound #define ub std::upper_bound const int inf = 0x3f3f3f3f; using ll = long long; using PII = std::pair...
ALGO
0.999989
5.345207
e005a3a0-469a-42be-b1a4-1d4a0adc4530
tangcy98/BooleanDagScheduler
src/importdag.cpp
/** * @file importdag.cpp * @brief Import a DAG in other forms * @author Chenu Tang * @version 2.0 * @date 2022-11-09 * @note */ #include <string> #include <cstring> #include <fstream> #include <iostream> #include <algorithm> #include "importdag.h" #include "booleandag.h" #include "memory.h" #def...
TOOL
0.990983
5.767632
a111f6da-97dd-4c16-b016-cc969aa2c1a3
Abdul-Samad-1020/DSA
DSA/LeetCode/LeetCode-master/LeetCode-master/C++/076. Minimum Window Substring.cpp
class Solution { public: string minWindow(string s, string t) { unordered_map<char, int>m; int i = 0, j = 0, count = 0, minLen = INT_MAX; string res = ""; for(auto x: t) m[x]++, count++; while(j < s.size()){ if(m[s[j++]]-- > 0) count--; if(count == 0){...
ALGO
0.999995
6.564114
c28dd6e5-301c-4451-8cbf-7a7a5bfff97b
PSCoder10462/dsa
a2oj/ladder/CodeforcesRating(1300)/19 Tram.cpp
/******************************************************/ #include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vi> #define all(v) v.begin(), v.end() #define pii pair<ll, ll> #define pb ...
ALGO
0.999953
4.224118
9b2bce0f-f149-4810-8627-86dd639cbcfb
fieryprofessor/cpp-codes-dsa-
11. binary search(Answers)/MedianOfTwoSortedArrays.cpp
//Given two sorted arrays nums1 and nums2 of size m and n respectively, // return the median of the two sorted arrays. //The overall run time complexity should be O(log (m+n)). #include<bits/stdc++.h> using namespace std; double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int n1 = nums1.si...
ALGO
0.999996
6.178893
61ab1fa7-8382-451e-b975-2e63179c4a76
Armaan42/Data-structure-and-algorithms-CPP
Day_2/loops/problems/exp_4.cpp
// WAP to print the sum of digits of given number #include<iostream> using namespace std; int main(){ int n; cin >> n; int sum = 0; if (n < 0){ n = -n; } while(n > 0){ int digit = n % 10; sum += digit; n = n / 10; } cout << sum << e...
ALGO
0.999872
5.452172
4903cc0c-5105-4027-a714-45ff60ea4086
GOR-OM/GFG-POTD
Easy/Move all zeroes to end of array/move-all-zeroes-to-end-of-array.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function template for C++ class Solution{ public: void pushZerosToEnd(int arr[], int n) { // code here // code here int ind=0; int num; for(int i=0;i<n;i++){ if(arr[i]!=0){ ...
ALGO
0.999336
6.386827
ec948ad2-6641-4162-a064-1c00041a4aae
prajwalbayari/C_plus_plus
Striver/Dynamic Programming/1D DP/FrogJump.cpp
//Given a array heights that represent the heights of the cosecutive stairs the frog can jump //from one stair to ith or (i+1)th stair find it will take height[j]-height[cur] energy to //jump to the stair where cur is the current stair and j is the stair we are about to jump to //Find the minimum energy needed to reach...
ALGO
0.999995
5.210177