uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
85a2bdfe-751a-4dd1-b3ed-93fe90665810
Myuku/Leetcode
Easy-104.cpp
#include <iostream> using namespace std; //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 *r...
ALGO
0.99925
6.40179
198f3e78-7288-4de3-9c96-f82726f09f9a
IBM/opencv-power
3rdparty/carotene/src/gaussian_blur.cpp
#include "common.hpp" #include "saturate_cast.hpp" #include "separable_filter.hpp" namespace CAROTENE_NS { bool isGaussianBlur3x3Supported(const Size2D &size, BORDER_MODE border) { return isSupportedConfiguration() && size.width >= 8 && (border == BORDER_MODE_CONSTANT || border == BORDER_MODE_...
ALGO
0.991544
6.777441
17b65c16-5887-4306-8519-0c5a60d634be
rashigupta01/450-DSA-Questions
Linked List/q1.cpp
// Iterative approach void reverse() { Node* prev = NULL; Node* cur = head; Node* next = NULL; while(cur != NULL) { next = cur->next; cur->next = prev; prev = cur; cur = next; } head = prev; } // Reccursive approach: https://www.geeksforgeeks.org/reverse-a-linked-list/ Node* reverse(Node* head) { if (he...
ALGO
0.999957
4.672836
89bf1542-892b-4ee3-901b-bd362e690535
TraiNguyenVan/cpp-2.0
testbro/CHUDEDUYET/INVERT.CPP
#include <bits/stdc++.h> using namespace std; int main() { ifstream fi("INVERT.INP"); ofstream fo("INVERT.OUT"); int n, q; fi >> n >> q; vector<int> a(n); for (int i = 0; i < n; i++) { fi >> a[i]; } for (int i = 0; i < q; i++) { int l, r; fi >> l >> r; i...
ALGO
0.999937
3.983025
77bc578c-b2d9-4c05-8b04-b8bc8872b188
beast-45/Leetcode
1643-number-of-nodes-in-the-sub-tree-with-the-same-label/1643-number-of-nodes-in-the-sub-tree-with-the-same-label.cpp
class Solution { public: vector<int> dfs(vector<vector<int>> &adj , int currentNode , int parent , vector<int> &result , string &labels){ vector<int> count(26,0); char label = labels[currentNode]; count[label-'a'] = 1; for(int &child : adj[currentNode]){ if(child == paren...
ALGO
0.999966
6.264503
2c992840-5a21-43e1-b7cb-c0b7c971eeb6
Riaj509/Leetcode
74-search-a-2d-matrix/74-search-a-2d-matrix.cpp
class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int target) { int lft=0,ri=matrix.size()*matrix[0].size()-1,sz=matrix[0].size(); while(ri>=lft){ int mid=(lft+ri)>>1; if(matrix[mid/sz][mid%sz]>=target && matrix[mid/sz][mid%sz]<=target)return true; ...
ALGO
0.999942
6.120423
921ee70f-7b7a-4652-b299-54899f386c5c
rzando-org/leetcode
solution/0500-0599/0557.Reverse Words in a String III/Solution.cpp
class Solution { public: string reverseWords(string s) { for (int i = 0, n = s.size(); i < n; ++i) { int j = i; while (++j < n && s[j] != ' ') ; reverse(s.begin() + i, s.begin() + j); i = j; } return s; } };
ALGO
0.99999
6.227853
4adaa04c-f16a-453a-91af-5fb4de7f241b
yopio/aoj
0074.cpp
#include <iostream> #include <cstdio> using namespace std; void compute(int S){ int h = 0; int m = 0; int s = 0; while(1){ if( S < 3600 )break; S -= 3600; h++; } while(1){ if( S < 60 )break; S -= 60; m++; } printf("%02d:%02d:%02d", h, m, S); cout << endl; } int main(v...
ALGO
0.995745
3.254196
f15a8d61-d445-41f7-b7c4-159a7a650087
rahul-aggarwal000005/Data-Structures-and-Algorithms
Day-8/Job sequencing Problem.cpp
class Solution { public: //Function to find the maximum profit and the number of jobs done. static bool cmp (Job a , Job b){ return a.profit > b.profit; } vector<int> JobScheduling(Job arr[], int n) { set<int> st; for (int i = 1 ; i<= 100 ; i++){ st.insert(i); } ...
ALGO
0.999836
5.645725
4a3885b4-4af9-4d87-b745-38d109c27c55
nmd1406/C
C03028.cpp
#include<stdio.h> int pascal(int k, int n) { if(k == 0 || k == n) return 1; else return pascal(k - 1, n - 1) + pascal(k, n - 1); } int main() { int n; scanf("%d", &n); for(int i = 0; i < n; ++i) { for(int k = 0; k <= i; ++k) printf("%d ", pascal(k, i)); printf("\n")...
ALGO
0.999937
3.801205
ba7bb4e1-5c4d-46b2-b929-a69afea839b3
Edu92337/CodeForces
499A.cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fo(i,n) for(int i = 0; i < n; i++) int main() { int n, x; cin >> n >> x; vector<pair<int, int>> horario(n); fo(i, n) cin >> horario[i].first >> horario[i].second; s...
ALGO
0.999916
4.144626
7afe0871-7f5d-47bb-b3c9-18b3a33a39d6
Krishnam2411/contests
24-12-17/B_Make_Almost_Equal_With_Mod.cpp
// Krishnam Maheshwari // 2212147 #include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #include "debug.cpp" #else #define debug(...) #define debugArr(...) #endif typedef long long int ll; typedef unsigned long long ull; typedef long double ld; #define MOD 1000000007 #define _MOD 998244353 #define INF...
ALGO
0.99988
4.740557
1854e443-06e8-4d09-8197-8ae29fffd9a8
MitanshPatel/DSA-Practice
Linked List/LL/Sort.cpp
#include<bits/stdc++.h> using namespace std; struct Node { int data; struct Node *next; Node(int x) { data = x; next = NULL; } }; //INSERTION Node* insertionSort(struct Node* head) { //code here Node *dummy=new Node(1000); while(head){ Node *nxt=head->next; Node *temp=dummy; ...
ALGO
0.999983
4.9735
c3d502f1-7799-45e4-971e-12a79748e0f0
sarvex/leetcode-cobol
solution/2100-2199/2196.Create Binary Tree From Descriptions/Solution.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.99992
6.832874
91511e48-b4cd-4956-a8b8-828e9a9bae9d
sarvex/leetcode-odin
lcof2/剑指 Offer II 003. 前 n 个数字二进制中 1 的个数/Solution.cpp
class Solution { public: vector<int> countBits(int n) { vector<int> res(n + 1); for (int i = 1; i <= n; i++) { res[i] = res[i & (i - 1)] + 1; } return res; } };
ALGO
0.999991
6.325447
5afc4520-a2c2-4104-a951-9588c2194555
4doe/enigma2
lib/gdi/region.cpp
#include <lib/gdi/erect.h> #include <lib/gdi/epoint.h> #include <lib/gdi/region.h> #include <lib/base/eerror.h> #undef max #define max(a,b) ((a) > (b) ? (a) : (b)) #undef min #define min(a,b) ((a) < (b) ? (a) : (b)) /* Region code. A region is basically a list of rectangles. In this implementation, rectangles...
TOOL
0.913392
7.294853
8d6d6db4-cc24-4d8b-a95d-39c5c472342a
baizeyv/Seraphel-Shooting
_cocos/frameworks/runtime-src/Classes/ide-support/RuntimeLuaImpl.cpp
// // RuntimeLuaImpl.cpp // Simulator // // #include "RuntimeLuaImpl.h" #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) #include <cstdio> #include <string> #include "lua_debugger.h" #include "CCLuaEngine.h" #include "LuaBasicConversions.h" #include "lua_module_register.h" #include "runtime/Runtime.h" ...
TOOL
0.932621
4.697533
a980e292-9774-4030-b8e7-2180f5c29bb8
poitrek/MandelbrotAssembly
CPP_Proj/Main.cpp
#include <iostream> #include <thread> #include <vector> #include <time.h> #include "bitmap_image.hpp" #include <Windows.h> using namespace std; // Definiujemy typ (?) typedef void(_fastcall *MainProcedure) (unsigned char**, int, int, int, double, double, double, double); typedef void(_fastcall *MainProcedure2)(unsign...
TOOL
0.892116
4.153761
b5465461-0001-4121-a4cd-b30db191d430
Henrik-Yao/NEUQ-ACM-Solution
week3/卞仁平/week3-3.cpp
#include <bits/stdc++.h> using namespace std; int n,m,k,l; const int X[8]={-1,-1,-1,0,1,1,1,0}; const int Y[8]={1,0,-1,-1,-1,0,1,1}; int ditu[25][25]; int dj[25][25]; void dianji(int a,int b) { int c=0; for(int i=0;i<8;++i) { int n1=a+X[i]; int n2=b+Y[i]; if(n1<1||n2<1||n1>n||n2>m) ...
ALGO
0.999897
3.577494
f5429f3b-c327-4155-adc4-a4814c5d5ae0
ishandutta2007/codeforces
74traktor/normal/612/E.cpp
#include <bits/stdc++.h> using namespace std; int const maxn = 1e6 + 5; int g[maxn]; vector < int > f[maxn]; int used[maxn]; int a[maxn]; int ans[maxn]; int gett[maxn]; int d[maxn]; vector < int > t; void dfs(int v) { t.push_back(v); used[v] = 1; if (used[g[v]] == 0) dfs(g[v]); } main() { //freopen(...
ALGO
0.999991
3.687546
3c4a404d-1aba-4f95-9e48-e5c8c957a4f1
JKSL12/cppchat
boost_1_83_0/libs/compute/example/transform_sqrt.cpp
//[transform_sqrt_example #include <vector> #include <algorithm> #include <boost/compute/algorithm/transform.hpp> #include <boost/compute/container/vector.hpp> #include <boost/compute/functional/math.hpp> namespace compute = boost::compute; int main() { // get default device and setup context compute::devic...
ALGO
0.998424
5.25276
ad138333-1cab-4630-9c60-46a1c3442e1f
tirthankar95/Codes
LeetCode/KClosestPointsToOrigin.cpp
// USING mutiset IS ALSO A SOLUTION. typedef vector<int> vi; typedef vector<vi> vvi; const int mxSize=1e4+1; vvi temp(mxSize); //retruns true if a is strictly greater than b. inline bool compare(vi& a,vi& b){ return ((a[0]*a[0]+a[1]*a[1])>(b[0]*b[0]+b[1]*b[1])); } class Solution { void mSort(vvi& arr,int lb,int...
ALGO
0.999992
4.810802
1af61189-58ad-456c-9ed3-b621529d65d7
Tutul-dhar/LeetCodeDaily
1295. Find Numbers with Even Number of Digits.cpp
class Solution { public: int findNumbers(vector<int>& nums) { int ans = 0; for(int ch : nums) { int p = ch,q = 0; while(p) { q++; p/=10; } if(q%2 == 0) ans++; } return ans; } };
ALGO
0.999195
5.872927
074d1e8e-ba62-4d4f-ba27-1994c935b1b9
aldonavarretefp/CPCFI-CPP
Clases/Segment tree/1648_CSES.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <queue> #include <deque> #include <bitset> #include <iterator> #include <list> #include <stack> #include <map> #include <set> #include <functional> #include <numeric> #include <utility> #include <limits> #include <t...
ALGO
0.999801
4.205642
87c479fb-735f-40f3-9947-6d3091425e68
benedikt20/CPSC524_FinalProject
GraphSim_barabasi.cpp
// Barabási–Albert Graph Generator (like social networks) #include <iostream> #include <fstream> #include <vector> #include <random> #include <chrono> #include <string> #include <unordered_set> #include <algorithm> using namespace std; struct Edge { int u, v; Edge(int uu, int vv) : u(uu), v(vv) {} }; class G...
ALGO
0.909908
6.968259
f6ea24d5-4a23-4bde-9b69-5511a46820c7
jman168/WiFi-Microphone-Firmware
clock.cpp
#include <inttypes.h> #include <math.h> #include <iostream> #define TARGET_FREQUENCY 24576000.0 #define XTAL 40000000.0 uint8_t best_sdm0, best_sdm1, best_sdm2, best_odiv; double best_diff = 10000000000000000000000000.0; double best_frequency = 0.0; int main(int argc, char *argv[]) { for(uint16_t sdm0 = 0; sdm0 ...
ALGO
0.999724
4.814384
0f0610c6-530d-4053-8003-dda8e211b3ef
schost/NTL-extras
code/ZZ_extra/src/ZZ_extra.cpp
#include <NTL/ZZ_pX.h> #include <NTL/lzz_pX.h> NTL_CLIENT void to_modular_rep(vec_long& x, const ZZ_p& a, const ZZ_pFFTInfoT *FFTInfo, ZZ_pTmpSpaceT *TmpSpace){ FFTInfo->rem_struct.eval(&x[0], rep(a), TmpSpace->rem_tmp_vec); } // NOTE: a gets destroyed void from_modular_rep(ZZ_p& x, Vec<long>& avec, const ZZ_pFF...
ALGO
0.908472
3.864506
4a7a1b44-1e74-4436-8db7-378d07fa456f
ishandutta2007/codeforces
rniya/normal/1006/E.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(x) (x).begin(),(x).end() const long long MOD=1e9+7; // const long long MOD=998244353; const int INF=1e9; const long long IINF=1e18; const int dx[4]={1,0,-1,0},dy[4]={0...
ALGO
0.999969
4.250676
bf246f31-15b0-4424-9f6b-e88db09cb745
AllenAndrew01123/Competitve-Programming
Contests/CodeChef Starters 176/D.cpp
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 typedef long long ll; void solve() { ll n, m; cin >> n >> m; vector<ll> ans; ans.push_back(n); for (ll i = 62; i >= 0; i--) { if ((n >> i) & 1LL) { continue; } else { ...
ALGO
0.999912
4.448442
5f85943d-27a2-48fb-8871-926f718c3b7f
haohaibo/tutorial
OpenMP/ex2.cpp
#include <omp.h> #include <stdio.h> #include <time.h> #include <iostream> using namespace std; int main(int argc, char** argv) { double for1_start, for1_end; double for2_start, for2_end; // set the number of threads, in general, the number // of threads set up not more than the number of CPU cores omp_set_n...
ALGO
0.995648
3.934154
b42162f2-0105-41f6-a47f-5c1bf1cf1579
Dodgerules/Marlin-2
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
#include "../../../inc/MarlinConfig.h" #if ENABLED(AUTO_BED_LEVELING_UBL) #include "../bedlevel.h" #include "../../../module/planner.h" #include "../../../module/motion.h" #if ENABLED(DELTA) #include "../../../module/delta.h" #endif #include "../../../MarlinCore.h" #include <math.h> //#define DEBUG_UBL_MOTION #d...
ALGO
0.990794
7.554648
3d291c1a-e008-412f-8243-7d6c649597ec
Ander-Ima/Mundo_de_Ram
Codeforces-Rounds-Repo/Div2Number832/twoGroups.cpp
#include <bits/stdc++.h> using namespace std; #define ENDL '\n' #define ll long long int main(){ int casos; cin >> casos; while (casos -- ){ ll tam; cin >> tam; vector<ll> arr(tam); ll sum1 = 0; ll sum2 = 0; for(int i = 0; i < tam; i++){ cin >>...
ALGO
0.999665
4.598465
9c61dc41-2ebe-412d-ba13-aa527c33dbfc
sinhadiptiprakash/dsa
Array/best_time_to_buy_sell_stock.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: int maxProfitLeetCode(vector<int> &prices) { int buyingPrice = INT_MAX; int maxprofit = 0; for (int i = 0; i < prices.size(); i++) { //if we get a lower price than before we will update the buyingP...
ALGO
0.99952
5.859108
e0373567-be05-4e07-b5e5-ec9113463c6f
tuhh-softsec/APR4Vul
experiments/RepairThemAll/libs/z3/src/ast/macros/macro_util.cpp
#include "ast/macros/macro_util.h" #include "ast/occurs.h" #include "ast/ast_util.h" #include "ast/rewriter/var_subst.h" #include "ast/ast_pp.h" #include "ast/ast_ll_pp.h" #include "ast/for_each_expr.h" #include "ast/well_sorted.h" #include "ast/rewriter/bool_rewriter.h" macro_util::macro_util(ast_manager & m): m_...
TOOL
0.902857
5.474105
51713e93-1f7f-4635-859a-01de336a59e3
ParasMoulekhi/Cpp-Repositieries
PracticeStar_Pattern/reverseStart.cpp
#include<iostream> using namespace std; int main(){ int n; cin>>n; int i=n; while(i>=1){ int k=1; while(k<=i){ cout<<'*'; k++; } cout<<endl; i--; } }
ALGO
0.999954
3.777326
a9a4a99d-b042-454d-b8d3-cf474e54aa1c
jagadeeshnelaturu/codeforces_solutions
258A.cpp
#include <iostream> int main() { std::string s; char c; bool done = false; while(std::cin >> c) { if((!done) && (c == '0')) { done = true; } else { s += c; } } if(!done) s = s.substr(1); std::cout << s << '\n'; }
ALGO
0.99814
4.294118
97636d82-7903-4268-8972-ad2e413e6499
luismoax/Competitive-Programming---luismo
COJ_ACCEPTED/3146 - Firefly.cpp
/* Author: Luis Manuel Daz Barn (LUISMO) Problem: 3146 - Firefly Online Judge: COJ Idea: Same idea of the overlapping intervals problem. Take the height as an array and treat each stalagmite of length L as an interval from H - L + 1 to H, and each stalactites of lenght L as an interval from 1 to L. S...
ALGO
0.999962
3.83144
81d0068e-e794-4ca4-ab21-79d88f7d872d
qxiong133/cpp_framework
icebridge_svn/trunk/workers/small_map_worker/_army_build_queue_manager.cpp
#include "_army_build_queue_manager.h" #include "_small_map.h" extern vector<int> combat_union_limit[6]; TimerQueue::TimerQueue(asio::io_service &io):timer(io), is_block(false)/*,begin_build_time(second_clock::universal_time())*/ { } void TimerQueue::push_back(short soldier_type, short soldier_level, short sold...
TOOL
0.917789
3.60496
5a24e94a-0cb1-48bc-b4ad-1fe3c28b2aed
DianweiCHEN/Carla
Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/StopSignComponent.cpp
#include "StopSignComponent.h" #include "TrafficLightState.h" #include <queue> #include <compiler/disable-ue4-macros.h> #include <carla/road/element/RoadInfoSpeed.h> #include <compiler/enable-ue4-macros.h> void UStopSignComponent::InitializeSign(const carla::road::Map &Map) { const double epsilon = 0.00001; aut...
TOOL
0.886844
5.923234
dd8eb587-0de6-4acb-b661-133a7075b132
ML-UCV/ML-CodeBert-DistinctSolutions
Raw Dataset/ctc/kosaraju/test/fdabd3b1-0a5c-48ab-a1d6-972fba70d27b.cpp
#include <fstream> #include <iostream> #include <vector> #include <bitset> #include <stack> using namespace std; const int N = 1e5 + 5; vector <int> L[N], T[N], scc[N]; int n, nr_scc; void Read () { ifstream fin ("ctc.in"); int m; fin >> n >> m; while (m--) { int x, y; ...
ALGO
0.999903
4.900348
cf53e3f4-4098-4da9-9840-62230483ec8d
sonapraneeth-a/competitive-programming_submissions
platforms/binarysearch/practice/medium/986__image-intersection/solutions.cpp
// clang-format off /** * FILE DESCRIPTION * * Filename: 986__image-intersection/solutions.cpp * Created on: 05 September 2021 * Last modified: 05 September 2021 * Author: sonapraneeth_a * Description: BinarySearch submission for 'Image Intersection' problem */ /** * CHANGELOG * ...
ALGO
0.999821
6.167831
908a4d62-d4ec-46aa-b6da-4fcef85330c8
platzdoudouche/SchoolProject
src/28.cpp
#include <iostream> using namespace std; int main() { int x = 5; int y = 10; if (x > y) { cout << "x is greater than y." << endl; } else { cout << "y is greater than x." << endl; } return 0; }
ALGO
0.99595
3.520267
59839c7f-48d1-4831-8ea0-cbef9180b601
ashokabairwaideology/Leet-code-problem
solution/2500-2599/2503.Maximum Number of Points From Grid Queries/Solution.cpp
class Solution { public: const int dirs[5] = {-1, 0, 1, 0, -1}; vector<int> maxPoints(vector<vector<int>>& grid, vector<int>& queries) { int k = queries.size(); vector<pair<int, int>> qs(k); for (int i = 0; i < k; ++i) qs[i] = {queries[i], i}; sort(qs.begin(), qs.end()); ...
ALGO
0.999967
5.984578
82a4f7d6-7a01-4e74-8c56-9f0758e66b25
BudaRazvan/exercitiiscoala
L05/ex17.cpp
#include<iostream> #include<stdio.h> using namespace std; int main(){ int nr, rezultat = 0, putere = 1; scanf("%d", &nr); while( nr != 0){ int cifra = nr % 10; rezultat = rezultat + cifra * putere; putere = putere * 2; nr = nr / 10; } printf("Rezultatul este %d", ...
ALGO
0.999838
4.026197
7a44c030-08f3-462d-826e-33042603c89d
siddharth12s/LeetCode-
63-unique-paths-ii/63-unique-paths-ii.cpp
class Solution { public: int f(int i,int j,vector<vector<int>> &a,vector<vector<int>> &dp){ if(i==0 and j==0) return 1; if(i<0 or j<0) return 0; if(a[i][j]==1) return 0; if(dp[i][j]!=-1) return dp[i][j]; int up = f(i-1,j,a,dp); int l...
ALGO
0.999767
5.590792
23abaff4-88ed-44b2-ac8b-7d291ef88e28
thisisnitish/cp-dsa
LinkedList/reverselinkedlist.cpp
/* Leetcode Question 206. Reverse Linked List https://leetcode.com/problems/reverse-linked-list/ */ //Iterative //Time O(N), Space O(1) class Solution { public: ListNode *reverseList(ListNode *head) { ListNode *prevptr, *nextptr, *curr; curr = head; prevptr = nextptr = NULL; whi...
ALGO
0.999612
6.004401
56209a85-1bd9-47f0-b3fc-5aac7d4914d4
asmilos/LABORATORIOS_GRUPO_A_20190049_ALEJANDRO_GONZALES
LAB01_GRUPO_A_EJECUTABLE_20190049_ALEJANDRO_GONZALES/laboratorio1_ejercicio7.cpp
//7. Elabore un algoritmo que lea por teclado dos nmeros enteros y determine si uno es divisor del otro. #include <iostream> using namespace std; int main(int argc, char *argv[]) { int num1, num2; cout<<"Ingrese el primer numero: "; cin>>num1; cout<<"Ingrese el segundo numero: "; cin>>num2; if (num1%num2==0 ){...
ALGO
0.921659
3.456551
38add4e6-7455-400e-b556-fad401017af6
plumzero/querecord
16_DataStruct/02_List/first_common_node.cpp
// 52 两个链表的第一个公共节点 // 问题: 输入两个链表,找出它们的第一个公共节点。 // 例如如下的两个链表,其第一个公共节点的值是 6 // 1 -> 2 -> 3 // ↓ // 6 -> 7 // ↑ // 4 -> 5 // 分析: // 依次遍历两个链表,得到各自的长度,计算长度的差值为 k 。长链表从头节点移动 k 步,之后 // 长, 短链表同时移动,直到遇到第一个公共节点为止。 // 关于代码优化: // 1. 对于多次使用的操作,应该将其独立为一个函数,比如这里的获取链表的长度 // 2. 初版中的 k 可能为负值,在 for ...
ALGO
0.998414
4.524961
8f9cce30-e8d2-46c1-b55d-6971904373a8
guxism/guxism.github.io
blog/code/algorithms/raw/tree.cpp
#include "graph.h" #include <queue> using namespace std; using namespace graph; void test() { string tree = R"( digraph A { node [margin=0, shape=circle, penwidth=2] ordering=out NULL_G_LC [shape=point] NULL_I_RC [shape=point] F -> B F...
ALGO
0.898863
5.639662
160a82da-9f06-41f8-bb8e-f12954a4e8b4
sruucodes/Strivers_A2Z_Sheet
Graphs/6. Other Algorithms/02. Strongly Connected Components.cpp
/* QUESTION:- Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, Find the number of strongly connected components in the graph. Approach: 1. We can use Kosaraju's algorithm to find the number of strongly connected components (SCCs) in a directed graph. 2. Kosaraju's algorithm performs two DFS...
ALGO
0.999956
7.034118
c8ce8b5b-d585-4fe6-a0ec-cf5711f88084
Najma-Lopa/Codeforces
A_Greg_s_Workout.cpp
// بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ #include <bits/stdc++.h> using namespace std; #define optimize() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl '\n' #define ll long long int main() { optimize(); int n; cin >> n; int arr...
ALGO
0.999959
4.051079
36881ad5-82b8-4879-87e5-6decac7854c3
JobayerFaisal/Data_Structure_Algorithm
Linked list/Insert_at_First.cpp
#include <bits/stdc++.h> using namespace std; struct node { int val; struct node *next; }; struct node *head = nullptr; struct node *tail = nullptr; void createList(int n) { int value; cout << "Please,Enter the Numbers: "; for (int i = 0; i < n; i++) { cin >> value; struct nod...
ALGO
0.99962
4.384499
ca187b4f-c245-484f-ac4a-891fb002fba0
hardik302001/leetcode
problems/verify_preorder_serialization_of_a_binary_tree/solution.cpp
class Solution { public: bool isValidSerialization(string preorder) { if (preorder.empty()) return false; vector<string>pre; stringstream check(preorder); string intermediate; // Tokenizing w.r.t. space ',' while(getline(check, intermediate, ',')) { ...
ALGO
0.998977
6.22803
574b4bf0-e959-44d2-9fbb-ea9bb786202b
jesuswr/cp-codes-and-problems
gym_103483/F.cpp
#include <iostream> #include <vector> #include <queue> #include <stack> #include <algorithm> #include <math.h> #include <string> #include <cstring> #include <set> #include <map> #include <unordered_map> #include <assert.h> #include <array> #include <random> #include <chrono> using namespace std; typedef long long ll;...
ALGO
0.993291
3.683632
b1540dfa-ac56-4b50-9c8d-d444bbc594d6
PerfectLifeG/Algorithm-Competition
Codeforeces/Div2.956/c.cpp
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(),x.end() #define no cout<<"No"<<endl #define yes cout<<"Yes"<<endl #define endl '\n' #define x first #define y second typedef pair<int,int> PII; const int N=200010; const int mod=998244353; const int INF=0x3f3f3f3f3f3f3f3f; void ...
ALGO
0.999894
4.203465
b0ccd6ca-bde8-46bf-a128-56cfbcc10a77
ankit039/Competitive_Programming_Solutions
C++/Anagram_String.cpp
// C++ program to check whether two strings are anagrams // of each other #include <bits/stdc++.h> using namespace std; /* function to check whether two strings are anagram of each other */ bool areAnagram(string str1, string str2) { // Get lengths of both strings int n1 = str1.length(); int n2 = str2.leng...
ALGO
0.999781
6.35037
cd223189-529b-473e-ae57-1d5d4cbe1eb3
boatinw99/CompetitiveProgramming
SSWT 2.1/Sabuza.cpp
#include<bits/stdc++.h> using namespace std ; typedef long long ll ; typedef long double ld ; typedef pair<int,int> pii ; const int N = 1e5+9 ; #define fi first #define se second struct cht { struct line { ll m,c ; line (ll m,ll c):m(m),c(c){} ll f(ll x){return m*x+c;} }; vector<...
ALGO
0.999552
3.530356
e67785d1-a0f8-4011-b8f1-328e30f404e9
liubingzsd/Project6
Project6/core/src/mathfuncs_core.dispatch.cpp
#include "precomp.hpp" #include "mathfuncs_core.simd.hpp" //#include "mathfuncs_core.simd_declarations.hpp" // defines CV_CPU_DISPATCH_MODES_ALL=AVX2,...,BASELINE based on CMakeLists.txt content #if 0 namespace cv { namespace hal { ///////////////////////////////////// ATAN2 //////////////////////////////////// ...
TOOL
0.902384
6.372835
6c3977f2-a803-4653-82ed-b05017de283e
TaeCV/Algorithm-Design
grader/DP/Tile/tile_reduced_mem.cpp
#include "stdio.h" int min(int a, int b) { return a < b ? a : b; } int N, M, width, newWidth, DP[2][10005], area, areaLeft, now, prev; const int INT_MAX = 2147483647; int main() { scanf("%d%d", &N, &M); prev = 0, now = 1; for (int i = 1; i <= M; ++i) { DP[prev][i] = INT_MAX; } DP[prev][0] =...
ALGO
0.999982
3.822394
a35cc40c-0fdc-4e33-9e51-ba07a235da75
bwrsandman/raytracer
src/hittable/plane.cpp
#include "hittable/plane.h" #include "hit_record.h" #include "ray.h" using Raytracer::Aabb; using Raytracer::hit_record; using Raytracer::Ray; using Raytracer::Hittable::Object; using Raytracer::Hittable::Plane; using Raytracer::Math::vec2; using Raytracer::Math::vec3; Plane::Plane(vec3 _min, vec3 _max, vec3 _n, uin...
ALGO
0.856398
7.33307
42314aa1-2f2f-4228-abb3-dce844029238
linyasha/BSU
C++/7.3.cpp
#include <iostream> #include <string> #include <assert.h> using std::cout; using std::cin; using std::string; struct Node { char name[28]; int cource; double ball; string date; Node* next; }; class LinkedList { private: Node* head; int count = 0; public: LinkedList() { this->head = nullptr; } b...
TOOL
0.965238
3.451793
e3167ff6-b238-421b-aace-5320e92dff59
Shrishesha4/CPP
C++Array/arrSortDesc.cpp
#include <iostream> using namespace std; int main() { int n; cout << "Enter the size of the array: "; cin >> n; int arr[n]; cout << "Enter the elements of the array: "; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i...
ALGO
0.999909
4.288672
3edf97fd-c968-4f3a-8f71-a3d30674f7fd
axelu/leetcode
cpp/00500-00999/designhashset.cpp
// 705. Design HashSet // https://leetcode.com/problems/design-hashset/ // using a Skiplist // https://leetcode.com/problems/design-skiplist/ class MyHashSet { private: struct Node { int val; int height; // size of next Node* next[]; }; int h; Node* sentinel; Node* stack[3...
ALGO
0.999707
5.492234
ba8d42f4-8023-4057-a371-bd1489ad9707
tylera277/Cpp_practice
4_07/solar_eclipseV2/src/main.cpp
#include <iostream> #include <vector> #include "simulation/simulation.hpp" int main(){ Simulation sim; int T = 365*86400*10; double dt = 86400.0/24.0; int t = 0; sim.initialize_positions(); sim.initialize_velocities(); sim.print_earth_position(); //sim.print_moon_position(); while(t<T){ ...
ALGO
0.992597
3.017295
e6113ad5-b850-496d-a600-5e92c98412b0
raincross7/code-similarity
codes/train_code/problem492/problem492_388.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <queue> #include <cmath> #include <climits> #include <iomanip> #include <set> #include <map> using namespace std; typedef long long ll; int main(){ ll n = 0; cin >> n; string s; cin >> s; ll open = 0; ll close = 0; for(i...
ALGO
0.999949
4.541084
bd772def-d901-4e5f-8fe0-5b85e4d70d9f
ivayloknchv/DSA_2024_2025
Week 11/pathExistsChecker.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; // https://www.hackerrank.com/contests/sda-2020-2021-test9-wefnkcsdw/challenges/challenge-2763/problem bool graph[1000][1000]{}; int main() { int M = 0; cin>>M; for(int i = 0; i < M; i...
ALGO
0.999923
5.04417
e6e5cf40-2710-4ee8-8d73-6bc55718e460
mrloa/-Akueb-Exam-practicals-2025
Practical no 5.cpp
#include <iostream> using namespace std; int main() { int i = 1; // while loop from 1 to 5 while (i <= 5) { cout << i << " "; ++i; } return 0; }
TOOL
0.990725
3.059817
09eb2942-ae5d-4731-adf1-f69f0dd0f01a
Jrelli/CSC-1310
Labs/Lab1/1310 lab 1 given files/example to help with lab 1/circleAllInOneFile.cpp
/* Title: circle.cpp Author: April Crockett Date: 9/1/2019 Purpose: This program uses a function to return a structure. */ #include "circle.h" #include <iostream> #include <iomanip> #include <cmath> // For the pow function using namespace std; const double PI = 3.14159; // Structure declaration struct Cir...
ALGO
0.996918
5.777067
d0d671db-8dc1-4c61-a457-60b9023c0f80
satyamsingh-stack/Striver-Sheet
Recursion/Print all Permutations.cpp
// Time Complexity: O(N! X N) // Space Complexity: O(1) class Solution { public: void rec(int index,vector<int> &nums,vector<vector<int>> &ans){ if(nums.size()==index){ ans.push_back(nums); return ; } for(int i=index;i<nums.size();i++){ swap(nums[index],...
ALGO
0.999998
6.232583
3d51e134-d906-4b4f-95cf-4b0c54b86594
lopesreiz/calcimcfeita
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
c387fa82-69a3-432d-b8e0-83575f150c07
kaby76/Domemtech.TrashBase
supported_grammars/templates/Cpp/Program.cpp
// Template generated code from trgen <version> #include \<iostream> #include \<string> #include \<chrono> #include \<atomic> #include "ANTLRInputStream.h" #include "ErrorListener.h" <tool_grammar_tuples:{x | #include "<x.GeneratedIncludeFileName>" } > #include "CaseChangingCharStream.h" std::string formatDuration(ui...
TEST
0.899016
6.255752
f4974efd-fa27-46a1-96a2-1c2980ee7fd6
towmiess/DSA_PTIT
web_DSA/012doitien.cpp
#include<bits/stdc++.h> using namespace std; using ll = long long; int b[35], n, s; bool flag; void Try(int i, int cur = 0, int cnt = 0){ if(flag) return; if(cur > s) return; if(cur == s){ flag = 1; cout << cnt << endl; return; } for(int j = i; j <= n; ++j) Try(j + 1, cur + ...
ALGO
0.999957
3.648565
3c963667-c282-4012-8bdd-d493817a83d0
hexu1985/cpp_book_code
cpp.func.handbook/ch06/6-5-7.cpp
#include <set> #include <iostream> using namespace std; #define len 5 int print(multiset <int> c) //ڴӡһmultiset { multiset <int>::const_iterator cp; for(cp=c.begin();cp!=c.end();cp++) //cpcĿʼӡcpӦֵ cout<<*cp<<" "; return 0; } int main( ) { multiset <int> ctr; multiset <int>::iterator cp...
ALGO
0.977518
3.818621
bf15452b-728c-4990-bf64-9025ad21b0b7
AreebAhmadSiddiqui/DSA-Prep
DSA Topics/Sliding Window/Fixed/1)-Max-Sum-Subarray-of-Size-K.cpp
class Solution{ public: long maximumSumSubarray(int k, vector<int> &Arr , int n){ long sum=0; for(int i=0;i<k;i++){ sum+=Arr[i]; } long maxi=sum; for(int i=k;i<n;i++){ sum-=Arr[i-k]; sum+=Arr[i]; if(maxi<sum...
ALGO
0.999958
5.14301
713914f8-69ee-4c16-aa9e-40a195ea7ff2
deepin-community/mozjs115
third_party/rust/glslopt/glsl-optimizer/src/compiler/glsl/opt_vectorize.cpp
/** * \file opt_vectorize.cpp * * Combines scalar assignments of the same expression (modulo swizzle) to * multiple channels of the same variable into a single vectorized expression * and assignment. * * Many generated shaders contain scalarized code. That is, they contain * * r1.x = log2(v0.x); * r1.y = log2...
ALGO
0.959016
7.666008
38c30601-93ff-407b-86ec-3737294545e3
conlacda/algo-practice
codeforces/gym/ACM International Collegiate Programming Contest, Damascus University Collegiate Programming Contest(2018)/B. Amer and Graphs.cpp
// https://codeforces.com/gym/101808/problem/B // B. Amer and Graphs #include<bits/stdc++.h> typedef long long ll; // double long double const ll mod = 1000000007; // 998244353 1000000009 1000000007 // đừng dùng ull #define int long long // __int128 const int INF = std::numeric_limits<int>::max() / 2; // INT32_MAX ...
ALGO
0.999879
4.708924
fdb558e3-3ed4-4346-bc29-b75b72e58435
sagarpol3008/Quotidian-Programs
Day 2/largest.cpp
#include<iostream> using namespace std; int is_Largest_Number(int a, int b, int c){ if(a >= b && a >= c){ return a; }else if(b >= a && b >= c){ return b; } return c; } int main(){ int a, b, c; cout << "Enter three integer numbers to check which is largest among them" << endl; ...
ALGO
0.999066
3.760719
89c21665-6cf1-4efb-864a-c49de3f6233b
EgorOrachyov/SpBench
thirdparty/clbool/src/coo/coo_utils.cpp
#include <cstdint> #include "coo_utils.hpp" #include "../library_classes/matrix_coo.hpp" #include "libutils/fast_random.h" #include "../library_classes/matrix_dcsr.hpp" #include <vector> #include <iostream> #include <algorithm> namespace coo_utils { using cpu_buffer = std::vector<uint32_t>; std::pair<matrix_...
TOOL
0.910402
4.243432
22c639da-faeb-4cef-9f64-01fea02d3b8f
caosong/minimal_scene
lib/Eigen/unsupported/doc/examples/MatrixExponential.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); MatrixXd A(3,3); A << 0, -pi/4, 0, pi/4, 0, 0, 0, 0, 0; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix exponential ...
ALGO
0.999658
3.706936
670c1690-8784-4ec2-a8a0-5ee1f55f5d55
rajput-vishal01/dsa-in-cpp
15_BinaryTrees/01_.cpp
#include <iostream> #include <queue> using namespace std; class Node { public: int data; Node *left; Node *right; Node(int val) { this->data = val; left = NULL; right = NULL; } }; /* * buildBST * -------- * Inserts a value into the BST. * Time Complexity: * - Average: O(log n) * - Wor...
ALGO
0.999979
4.929173
a3d493c0-a5fc-4060-bc6d-390b3e3d93b7
fazlerabbi13/cpp-programs
interval2.cpp
#include <iostream> using namespace std; int main() { int N; cin >> N; int in_count = 0; int out_count = 0; for (int i = 0; i < N; ++i) { int X; cin >> X; if (X >= 10 && X <= 20) { in_count++; } else { out_count++; } } ...
ALGO
0.998734
4.416264
d08b2bba-7050-49a1-9c0b-360341ae5ca3
biou/Jump-Puke
JumpNPuke/libs/Box2D/Collision/b2Distance.cpp
#include <Box2D/Collision/b2Distance.h> #include <Box2D/Collision/Shapes/b2CircleShape.h> #include <Box2D/Collision/Shapes/b2EdgeShape.h> #include <Box2D/Collision/Shapes/b2ChainShape.h> #include <Box2D/Collision/Shapes/b2PolygonShape.h> // GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates. int3...
ALGO
0.999951
3.300407
02ba4ac4-0e12-461b-b621-8280ac2a43be
hahi79/Practice
CopyArray_Reverse/CopyArray_Reverse.cpp
//========================================================== // 配列の反転コピー //========================================================== #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> // printf() #include <stdlib.h> // srand(),rand() #include <time.h> // time() // 関数プロトタイプ void CopyArrayReverse(int srcArray[], in...
ALGO
0.990824
4.355634
d8254e49-47f9-4267-a397-450b7e163245
GaspareG/CodeFlows.io
Round1/C.cpp
#include <bits/stdc++.h> using namespace std; string ltrim(const string &); string rtrim(const string &); #define MOD 1000000007 /* * Complete the 'countMessages' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. STRING_ARRAY keys * 2. STRI...
ALGO
0.999953
5.384682
4bb540e9-2dfe-4de5-93a9-6af0098d2e72
ishandutta2007/codeforces
-is-this-fft-/normal/341/C.cpp
#include <iostream> #include <set> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; struct Modint { ll val; Modint (ll _val = 0) : val(_val % MOD) {} Modint operator+ (Modint other) const { return Modint(val + other.val); } void operator+= (Modint other) { val += other...
ALGO
0.999958
4.154047
5f879440-384d-4fe5-a568-d604a86d29fb
Upasana1216/Leetcode_Daily
134-gas-station/134-gas-station.cpp
class Solution { public: int canCompleteCircuit(vector<int>& gas, vector<int>& cost) { int n = gas.size(); int total(0), subsum(INT_MAX), start(0); for(int i = 0; i < n; ++i) { total += gas[i] - cost[i]; if(total < subsum) { subsum = total; ...
ALGO
0.999988
5.786324
1e1660df-1141-4440-ad92-b84c581b562f
Barkole/sudoku
src/Condition.cpp
// Condition.cpp: implementation of the CCondition class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "Sudoku.h" #include "Cell.h" #include "Condition.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif //////////...
ALGO
0.99015
4.011946
b725bbe6-b2e4-4cf3-97f5-1db442aa4bec
anagorko/kinf
zajecia/KTrzaskowski/foobar.cpp
#include <iostream> /* Napisz program, który wyświetla liczby od 1 do 100, zamiast liczb podzielnych przez 3 wypisując „foo”, zamiast liczby podzielnych przez 3 ale nie podzielnych przez 5 wypisując „bar” a zamiast liczb podzielnych przez 3 i przez 5 wypisując „foobar”. */ using namespace std; int main() { int n=1; ...
DATA
0.994181
3.572131
04815b15-7311-45fa-9165-a812dba4e3c8
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/CodeLlama/top0-100/minimum-cost-to-equalize-array-Solution.minCostToEqualizeArray/177842_+Info.cpp
_PUBLIC_ codepoint_t next_codepoint_handle_ext( struct smb_iconv_handle *ic, const char *str, charset_t src_charset, size_t *bytes_consumed) { /* it cannot occupy more than 4 bytes in UTF16 format */ smb_iconv_t descriptor; size_t ilen_o...
ALGO
0.998908
4.048007
93695a8d-6a38-4d05-b4f5-8456b5fb6fee
phamdathdvip1/bullet3-2.87
bullet3-2.87/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp
#include "btSubSimplexConvexCast.h" #include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h" #include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h" #include "btPointCollector.h" #include "LinearMath/btTransformUtil.h" btSubsimplexC...
ALGO
0.997386
6.699706
c3bc631c-e34b-42f2-b972-c1a9470827fc
raincross7/code-similarity
codes/train_code/problem012/problem012_312.cpp
#include <iostream> #include <iomanip> #include <algorithm> #include <bitset> #include <string> #include <cmath> #include <complex> #include <numeric> #include <cassert> #include <vector> #include <array> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <utility> #define PI 3....
ALGO
0.99997
3.834602
afe6d581-57f3-4516-9a57-aac0e0b2063d
Sakurai00/Contest-Code
Cpp/AtCoder/ABC/140-159/148/d.cpp
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() using llint = long long; using vint = vector<int>; using vvint = vector<vector <int>>; const llint INF = 1e9; const llint llINF = 1e18; int main () { int n; c...
ALGO
0.99993
3.720999
cce48b1e-1e1f-493f-af31-816af872e335
yasharth291/CPP-tutorials-and-CP-questions-
Codechef/ZCOPRAC/ZCO14001.cpp
#include <stdio.h> #include <vector> using std::vector; int main() { int N = 0, H = 0, val1 = 0; vector<int> heights; heights.reserve(100000); scanf("%d %d", &N, &H); for(int i = 0; i < N; i++) { scanf("%d", &val1); heights.push_back(val1); } int pos = 0, crane = 0; while(scanf("%d", &val1), val1) { ...
ALGO
0.999995
3.357568
9002ab06-a6ce-4881-a99d-02922d8f9ee5
nono19972020/atcoder
ATC/ATC001/a.cpp
#include <iostream> #include <cstdio> using namespace std; char c[500][500]; bool visited[500][500]; int h, w; void search(int x, int y){ if(x < 0 || x >= w || y < 0 || y >= h || c[y][x] == '#'){ return; } if(visited[y][x] == true){ return; } visited[y][x] = true; search(x, y...
ALGO
0.999921
3.324763
8254ef2e-0e19-4a9a-9b09-622fec429b47
jellingwei/Static-Program-Analysis
source/CNode.cpp
#include <stdio.h> #include <iostream> #include <string> #include <vector> #include <algorithm> #include "boost/dynamic_bitset.hpp" #include "PKB.h" #include "CNode.h" CNode::CNode() {} /** * Set a CNode. * @param cfgNodeType the type of CNode which can be Assign/While/If/Call/Proc/EndProc/EndIf * @param procLi...
ALGO
0.96524
4.474611
39d58756-508f-48f6-86f9-970f0942cd56
deepraj16/DSA
2-linked list/flatten.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.999978
5.118095
fb3f20d8-16aa-4d56-b0cd-aecb8e92e32c
nazmulh24/Basic_Data_Structures_CPP
Basic Data Structures/Week 1/24_06_10_mod_2.5_P1/prob_1.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v1(n); vector<int> v2(n); for (int i = 0; i < n; i++) cin >> v1[i]; for (int i = 0; i < n; i++) cin >> v2[i]; v2.insert(v2.begin() + n, v1.begin(), v1.end()); for (auto u : v2) ...
ALGO
0.999906
3.078754
fe3ec06d-9497-407e-bf7e-da7663b66ae3
Coach-Academy/Spring-1-2024
Level 2/CPU - Regular - L2 - C101/Practice/Week 04/X - Make Them Odd.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long void solve() { int n; cin >> n; set<int> st; for (int i = 0, x; i < n; ++i) { cin >> x; if (x % 2 == 0) { st.insert(x); } } int cnt = 0; while (not st.empty()) { int mx = *(--st.end()); st.erase(prev(st.end()));...
ALGO
0.999655
5.026387
3b614c3d-ee36-4255-b642-2c4babc6934d
TheGupta2012/Coding-Blocks
Recursion/Theory-and-Practice/Implementation/towerofhanoi.cpp
#include<bits/stdc++.h> using namespace std; void move(int n,char src, char through, char dest) { char a,b,c; a = src; b = through; c = dest; if(n==0) return ; else { move(n-1,a,c,b);//through becomes the destination. //cout<<n-1<<" disks shifted from "<<a<<" to "<<b<<e...
ALGO
0.999943
5.220042
6e7a0fc2-e31c-4a04-807d-f0523a349f78
mkp0/CP
CodeForce/753A - Santa Claus and Candies.cpp
#include <bits/stdc++.h> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long #define pi (3.141592653589) #define all(x) (x).begin(), (x).end() #define vi vector<int> #define vll vector<long long> #define pii pair<int, int> #define pll pair<...
ALGO
0.999814
4.165431