uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
19dcc876-f797-43c9-be1b-1d59eaa0b2fb
hixio-mh/pytorch-1
aten/src/ATen/native/cpu/SoftMaxKernel.cpp
#include <ATen/native/cpu/SoftmaxKernel.h> #include <algorithm> #include <iterator> #include <numeric> #include <ATen/Dispatch.h> #include <ATen/Parallel.h> #include <ATen/cpu/vec256/functional.h> #include <ATen/cpu/vec256/vec256.h> #include <c10/util/Optional.h> // [Note AVX-SSE transitions] In general we avoid cal...
DATA
0.976526
7.19067
2496299e-3e4e-45c4-ba7b-538234efbb70
eemoreira/biblioteca-de-problemas
cf/790/h.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int,int> ii; typedef vector<ii> vii; typedef priority_queue<ii, vii, greater<ii>> pqmin; #define mp make_pair #define fst first #define snd ...
ALGO
0.999889
4.694102
bf1ab822-3650-4caa-aff3-acc010d8be3e
AnujMishra1/-CrackYourPlacement
Day29/3.Rat in a maze.cpp
#include<bits/stdc++.h> using namespace std; // User function template for C++ class Solution{ private: bool valid(int i,int j,vector<vector<int>> &m,vector<vector<int>>visited,int n) { if(i>=0 && i<n && j>=0 && j<n && visited[i][j]==0 && m[i][j]==1) { return true; } ...
ALGO
0.999951
5.98043
8ad2fc0c-7a20-4979-92fe-9327ccceadc0
phumipatc/C_Competitive_Programming
Website/Codeforces/1244/1244E_Minimizing_Difference.cpp
/* Author : Phumipat C. School : RYW Language: C++ */ #include<bits/stdc++.h> using namespace std; map<long long ,long long > countt; set<long long > sett; set<long long > ::iterator it,it2,nextt; int main(){ long long n,k,num; scanf("%lld %lld",&n,&k); for(long long i=1;i<=n;i++) scan...
ALGO
0.999976
3.242194
caa69717-e0d4-45ae-895f-2f24dcde55ae
hackerguy2000/Coding_Journey
c++/array_sorting_half_wise.cpp
#include <bits/stdc++.h> using namespace std; int main() { int arr[] = {2, 5, 7, 6, 1, 99, 3, 7, 1, 9}; int n=sizeof(arr)/sizeof(arr[0]); int j=0; int temp =0; for (int i = 0; i < n / 2; i++) { for (j = i + 1; j < n / 2; j++) { if (arr[j]<arr[i]) { ...
ALGO
0.999964
3.496259
f6d5b010-e20e-424a-afc1-e02dc8565331
Bharat2044/365-days-coding-challanges
Day_061/01_bestTimeToBuyAndSellStock2.cpp
// Question Link: https://www.interviewbit.com/problems/best-time-to-buy-and-sell-stocks-ii/ /* Best Time to Buy and Sell Stocks II Problem Description: Say you have an array, A, for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as man...
ALGO
0.997463
6.10125
087544d3-5621-4c02-a328-7c59698958f4
aplqo/exercises
others/2020.09/2020.09.04-Exam/T146546-GetAns.cpp
#include <algorithm> #include <fstream> #include <numeric> using namespace std; const unsigned int maxn = 30; bool able[maxn + 1][maxn + 1]; bool sel[maxn + 1], ans[maxn + 1]; unsigned int seq[maxn + 1], n; void dfs(const unsigned int x) { if (x == n) { for (unsigned int i = 0; i < n; ++i) ans[i] = ans[i]...
ALGO
0.99996
4.52986
7cdffa39-aca1-4fe1-ad52-51ebfa372a1d
rishab1729/Data-strucutres-and-algorithms-C-
heap_sort.cpp
/* Heapsort can be thought of an improved selection sort: like selection sort, heapsort divides its input into a sorted and an unsorted region, and it itertively shrinks the unsorted region by extracting the largest element from it and inserting it into the sorted region. However, heapsort does not waste time with a l...
ALGO
0.998394
4.194155
d27699e2-03b3-459b-8a56-2abda0b1248d
Jasmeet-Chicmic/Flutter_Morphing
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
87a3d417-237d-40d3-9ff3-bfc6f54efd3a
njuptlogic/Pillar_fusion
pcdet/ops/pointnet2/pointnet2_stack/src/interpolate.cpp
#include <torch/serialize/tensor.h> #include <vector> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <cuda.h> #include <cuda_runtime_api.h> #include "interpolate_gpu.h" #define CHECK_CUDA(x) do { \ if (!x.type().is_cuda()) { \ fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, ...
DATA
0.857018
6.042449
c66bde4e-c07b-4220-bb3e-87d2bace65d8
Romaules/emulators
Snes9x/src/snes9x/spc7110dec.cpp
#ifdef _SPC7110EMU_CPP_ uint8 SPC7110Decomp::read() { if(decomp_buffer_length == 0) { //decompress at least (decomp_buffer_size / 2) bytes to the buffer switch(decomp_mode) { case 0: mode0(false); break; case 1: mode1(false); break; case 2: mode2(false); break; default: return 0x00; ...
ALGO
0.982255
4.878635
6259d759-0ced-4eb8-a6b4-7ea681934962
BriamTurmeque/Sripts_C--
practicaPunteros/main.cpp
#include <iostream> using namespace std; void mostrar(int*, int,int); int main (){ int mat1[3][3]={{1,3,4},{5,6,7},{6,8,9}}; int *p1; p1=&mat1[0][0]; mostrar(p1,3,3); return 0; } void mostrar(int *pp, int n,int m){ cout<<"Su matriz es: \n"; for(int j=0;j<n;j++){ for(int i=0;i<m;i++){ cout<<...
ALGO
0.992136
3.184574
2c102a0d-83df-4cf4-943b-5f33a02b588c
sergigarciacanton/EA-Minim-2-Sergi-Garcia-Canton
EAFrontend/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.998722
6.797273
33c4e8d2-edab-40c7-aac9-0942d1b0f08a
pcb9382/FaceAlgorithm
include/Eigen/unsupported/doc/examples/MatrixSine.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { MatrixXd A = MatrixXd::Random(3,3); std::cout << "A = \n" << A << "\n\n"; MatrixXd sinA = A.sin(); std::cout << "sin(A) = \n" << sinA << "\n\n"; MatrixXd cosA = A.cos(); std::cout << "cos(A) = \n" << cos...
ALGO
0.987026
5.878768
f0f584ef-736d-49cf-81bf-5c7b2340cc0e
BHAVISHAYA/GFG-Question-Solution
Outermost Parentheses - GFG/outermost-parentheses.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: string removeOuter(string& s) { // code here string ans = ""; stack<char> st; for(int i = 0 ; i < s.size() ; i++) { if(st.empty()) { if(s...
ALGO
0.99919
6.203015
0b0d9af4-22fb-4d24-b045-c50f3cba4429
alexandraback/datacollection
solutions_5688567749672960_0/C++/Jungyhuk/A.cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <cctype> #include <algorithm> #include <queue> #define maxn 1000005 using namespace std; int test,ttest,n,f[maxn]; bool flag[maxn]; queue<int>q; void init() { scanf("%d\n",&n); } void bfs...
ALGO
0.999588
3.933747
16d9363e-dd90-4c7b-a04b-7c3273384786
agx/icedove
mozilla/gfx/skia/skia/src/utils/SkRTConf.cpp
#include "SkRTConf.h" #include "SkOSFile.h" SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) { SkFILE *fp = sk_fopen(configFileLocation(), kRead_SkFILE_Flag); if (!fp) { return; } char line[1024]; while (!sk_feof(fp)) { if (!sk_fgets(line, sizeof(line), fp)) { brea...
TOOL
0.903382
6.811204
471d400e-2969-4b8b-bbdc-4c74190917de
Mathis-Werner/FMR-PX4-Autopilot
src/lib/npfg/npfg.cpp
/* * @file npfg.cpp * Implementation of a lateral-directional nonlinear path following guidance * law with excess wind handling. Commands lateral acceleration and airspeed. * * Authors and acknowledgements in header. */ #include "npfg.hpp" #include <lib/geo/geo.h> #include <px4_platform_common/defines.h> #includ...
ALGO
0.999703
6.861149
7a5a1a4e-d171-4923-a3c7-99f7f6e49ee2
Saurav1928/Hard75_Challenge
2Jan/q2.cpp
#include <bits/stdc++.h> using namespace std; long long BS(long long d, vector<long long> &x) { long long s = 0, e = x.size() - 1, mid, ans = -1; while (s <= e) { mid = s + (e - s) / 2; if (x[mid] <= d) { ans = mid; s = mid + 1; } else ...
ALGO
0.999952
5.289187
407d7207-98ac-407d-b558-877e2e048c7d
kingrui/xen_scheduler
xen_scheduler/kmeans.cpp
#include "kmeans.h" #include <cmath> #include <iostream> using namespace std; //#define KMEANS_DEBUG node::node(double value[]){ this->value = value; } double* node::initilizeW(){ static double* w = new double[node::n]; /* for(int i=0;i<node::n;i++){ w[i] = 1.0; } */ w[0] = 1.0; w[1] = 1.0; return w; } do...
ALGO
0.999739
4.703809
d12aee4f-b201-42ec-97a0-9315aa2c1efa
rgfadel01/CamerasAndRobots
MyPythonProjects/opencv-4.x/opencv-4.x/modules/imgproc/src/phasecorr.cpp
#include "precomp.hpp" #include <vector> namespace cv { static void magSpectrums( InputArray _src, OutputArray _dst) { Mat src = _src.getMat(); int depth = src.depth(), cn = src.channels(), type = src.type(); int rows = src.rows, cols = src.cols; int j, k; CV_Assert( type == CV_32FC1 || type == C...
ALGO
0.992435
6.047103
63067599-b4ba-4091-b25c-47e4157da9b3
Overload-Technologies/Overload
Dependencies/bullet3/bullet/BulletInverseDynamics/IDMath.cpp
#include "IDMath.hpp" #include <cmath> #include <limits> namespace btInverseDynamics { static const idScalar kIsZero = 5 * std::numeric_limits<idScalar>::epsilon(); // requirements for axis length deviation from 1.0 // experimentally set from random euler angle rotation matrices static const idScalar kAxisLengthEpsil...
TOOL
0.997455
7.515061
100c73cc-db4c-4f87-aa85-a971fec5410d
Recoil2002/Stop
Stop/main.cpp
#include <fstream> #include "primesieve.h" #include <algorithm> #include "primesieve.hpp" using namespace std; typedef unsigned long long ull; enum shablony{s_16=15,s_17,s_18,s_19,s_20,s_21,s_22,s_23,s_24,s_25,s_26,s_27,s_28,s_29,s_30,s_31,s_32,s_33}; const int dl_int = 2000000000; const int chislo_shablonov = 18; c...
ALGO
0.97713
3.236772
4abd37c1-40d4-4178-97f4-422d91325824
sarvex/leetcode-small-basic
solution/0200-0299/0274.H-Index/Solution.cpp
class Solution { public: int hIndex(vector<int>& citations) { int n = citations.size(); int cnt[n + 1]; memset(cnt, 0, sizeof(cnt)); for (int x : citations) { ++cnt[min(x, n)]; } for (int h = n, s = 0;; --h) { s += cnt[h]; if (s >= ...
ALGO
0.999958
6.447913
7c179c76-28a6-4b02-8b8e-8e51264a3218
Ryan-Ala/Leetcode-
1162. 地图分析/1162. 地图分析.cpp
class Solution { public: int maxDistance(vector<vector<int>>& grid) { int m=grid.size(),n=grid[0].size(); int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0}; //vector<vector<bool>> Hash = vector<vector<int>>(m,vector<bool>(n)); queue<pair<int,int>> q; for(int i=0;i<m;i++) for(int...
ALGO
0.999913
5.580026
0c73849f-26e7-4c21-8383-f230eb09644b
Shuvoahmed29/CSE-Academic-Sessional-Course
CSE 2102 Data Structures Sessional/3. Pattern matching with string and replace substring. Pattern matching with string and replace substring.cpp
// 3. Pattern matching with string and replace substring. #include <bits/stdc++.h> using namespace std; int main() { cout << "Input Main String: "; string main; cin >> main; cout << "Input Sub-string: "; string sub; cin >> sub; vector<int> vec(sub.size(), 0); int i = 0, j = 1; while ...
ALGO
0.999786
3.819686
c889ba47-5487-43e3-a456-5716e0aafdaf
daninavagar/Ejercicios-C
1_DAM/cuarentena/Reenganche/ejer2.cpp
#include <stdio.h> #include <stdlib.h> void title() { printf ("\n\n"); system ("clear"); system ("toilet -f pagga --gay NUMEROS ENTEROS"); system ("\n\n"); } int main (int argc, char *argv[]) { int tot = 2, elec; title (); printf ("DIME LA FORMA DE HACER EL EJERCICIO, 1-for, 2-while, 3-do...
ALGO
0.999548
3.194907
ffbb55f3-9932-4b03-a278-03616df85135
Rikon07/Codeforces-Rik_on
C_LIS_or_Reverse_LIS.cpp
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back int LIS(int n) { vector<int> ar(n); map<int, int> mp; for(int i=0; i<n; i++) { cin >> ar[i]; mp[ar[i]]++; } int cnt1 = 0, cnt2 = 0; for(auto it : mp) { if(it.second>1) ...
ALGO
0.999819
5.115048
f1696488-9452-469c-af25-719839c16073
XuanNguyen0203/DSA_24CCT3_HKII
WEEK_07/Binary Tree.cpp
#include <iostream> #include <vector> using namespace std; struct NODE { int key; NODE* p_left; NODE* p_right; }; // De yeu cau NODE* createNode(int data); vector<int> NLR(NODE* pRoot); vector<int> LNR(NODE* pRoot); vector<int> LRN(NODE* pRoot); vector<vector<int>> LevelOrder(NODE* pRoot); int countNode(NODE* pRoot...
ALGO
0.999954
4.138967
0e22ae11-e2f7-461b-ba40-90e713e12c4e
hieupham1103/TINHOC
ONLINE OJ/CODE MELY/Codemely Training Contest 01 - Greedy Algorithm/B.cpp
#include<bits/stdc++.h> #define ii pair <int,int> #define fi first #define se second #define int long long #define endl '\n' using namespace std; signed main(){ //freopen("input.INP", "r", stdin); //freopen("output.OUT", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);...
ALGO
0.999804
3.747802
470fa4b3-1d64-4dc0-ad05-a581e9afcfb6
prachiMeshram/Data-Structures-and-Algorithm
Practice/Stacks/maxRectangle.cpp
// https://practice.geeksforgeeks.org/problems/max-rectangle/1 #include<bits/stdc++.h> using namespace std; class Solution{ private: vector<int> nextSmallest(int *heights, int n) { vector<int> ans(n); stack<int> st; st.push(-1); for(int i = n-1; i>=0; i--) { ...
ALGO
0.999894
5.040851
9924e614-9f6c-47e9-81a1-4e577665d361
SSsssujin/ParlandTactics
Source/park.cpp
#include "framework.h" #include "park.h" park::park() { } park::~park() { } HRESULT park::init() { SOUND->addSound("", "sound/bgm10_뷡.mp3", true, false); IMAGE->addImage("", "images/.bmp", 19, 14, true, RGB(255, 0, 255)); IMAGE->addImage("ٹ", "images/ٹ.bmp", 38, 30, true, RGB(255, 0, 255)); _isoX = 0; _isoY =...
TOOL
0.909665
4.393566
0ca74ac9-3de5-4d59-be6a-a9eb3d5ce7b1
imovishek/coding-practice
USACO/Name That Number.cpp
/* ID: ovishek1 LANG: C++11 PROB: namenum */ #include<bits/stdc++.h> #define pii pair<int,int> #define mkp make_pair #define fs first #define sc second #define pb push_back #define ppb pop_back() #define pf printf #define pf1(a) ...
ALGO
0.999647
4.342161
3b1151bb-4338-46ba-b27f-b1777221340b
manxiaolou/LeetCode
1008. 字符串转整数 (atoi).cpp
class Solution { public: int myAtoi(string str) { int i = 0; if (str.size() == 0) { return 0; } while (str[i] == ' '&&i<str.size()) { i++; } if (i == str.size() || isalpha(str[i])) { return 0; } string temp = ""; temp += str[i]; i++; while (str[i] != ' '&&!isalpha(str[i]) && i<str....
ALGO
0.999636
4.8234
9a2e6e81-ad79-46b5-9b0e-3a2859739e6d
toh1n/phitron_batch_4
semester_2_c++_for_DSA/module_7/F_Equation.cpp
//https://codeforces.com/group/MWSDmqGsZm/contest/223205/problem/F #include <bits/stdc++.h> using namespace std; long long int power(int base, int exponent) { long long int result = 1; while (exponent > 0) { result *= base; exponent--; } return result; } int main() { int X, N; ...
ALGO
0.999975
4.439041
1a4d5a62-f7b9-4bc2-ad42-ffbb723e42fb
KrishMMavani/CodeForces
CodeForces/cdfrcs1895B.CPP
#include <bits/stdc++.h> #define yes cout << YES << endl #define no cout << NO << endl #define fi(s, e) for (int i = s; i < e; i++) #define fj(s, e) for (int j = s; j < e; j++) #define fk(s, e) for (int k = s; k < e; k++) using namespace std; int main() { int t; cin >> t; while (t--) { int n; ...
ALGO
0.998905
3.361729
16c6e54d-a0d4-4128-b136-bc0cdeda5591
Rounak-Ghosh/Cpp-Programs
linkedlistintersection.cpp
#include<iostream> #include<cmath> using namespace std; class Node { public: int data; Node* next; }; void printList(Node *n) { while(n != NULL) { cout << n->data << "->"; n = n->next; } cout << "NULL"; } void insertAtEnd(Node* &head, int val) { Node* n = new Node(); ...
ALGO
0.999805
3.811933
48eb34cf-c1d8-451c-9f7d-436c42109879
Mauro-J/Practicing-programming
C++/1197.cpp
#include <iostream> using namespace std; int main() { int v, t; while(cin >> v >> t){ cout << v*t*2 << endl; } return 0; }
ALGO
0.999412
3.815034
d32bc09e-024d-45bc-bf1b-a2edb0700166
NIKHILmgs/leetcode-solutions
0706-design-hashmap/0706-design-hashmap.cpp
class MyHashMap { public: static const int sz = 1000001; int v[sz]; MyHashMap() { memset(v,-1,1000001*sizeof(int)); } void put(int key, int value) { int a = key; int b = value; v[a]=b; } int get(int key) { return v[key]; } void remo...
ALGO
0.998282
6.175071
63a8ffe8-1624-4df7-8c15-f7aaa6f5937f
sakshi-06/Leetcode-daily-tasks
2462-total-cost-to-hire-k-workers/2462-total-cost-to-hire-k-workers.cpp
class Solution { public: long long totalCost(vector<int>& costs, int k, int candidates) { priority_queue<int,vector<int>,greater<int>> pq1,pq2; long long ans=0; int cnt = 0,i=0,j=costs.size()-1; while(cnt<k){ while(pq1.size()<candidates && i<=j) pq1.push(costs[i++]); ...
ALGO
0.999895
5.492862
76658a0c-d4be-41ea-9360-df29b872dd0a
fernandes-natanael/high-frequency-trading
examples/8-simple-market-maker.cpp
#include <unordered_map> #include <vector> #include <thread> class MarketMaker { private: std::unordered_map<std::string, double> prices; void adjustPositions() { // Logic to adjust positions based on current prices } public: void updatePrice(const std::string& security, double price) ...
TOOL
0.964866
6.175453
2ed05a0a-751b-4642-90b6-0fd0e44c8c22
Pundiraryan/AC_Solutions_CPH
Codeforces/MEXimize_the_Array.cpp
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int int64_t #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> using namespace std; using namespace __gnu_pbds; template <class type1> using ordered_multiset = tre...
ALGO
0.999904
5.275674
424bbf21-c6b3-4b69-96df-4edcd2153793
NREL/JModelica
ThirdParty/CasADi/CasADi/experimental/greg/examples/rocketSnopt.cpp
#include <iostream> #include <core/std_vector_tools.hpp> #include <core/sx/sx_tools.hpp> #include <core/function/sx_function.hpp> #include <Ode.hpp> #include <Ocp.hpp> #include <MultipleShooting.hpp> #include <SnoptInterface.hpp> #include <string> #include <map> using namespace casadi; using namespace std; void dx...
ALGO
0.999524
5.959141
f928a5d0-e554-4bfc-a378-60c3d7e1ed7b
BoHauHuang/PCCA-exercise
Codeforces/Contest/582/B.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int t, n, in, total; cin >> t; while(t--){ stack<int> price; cin >> n; total = n; while(total--){ cin >> in; if(price.empty() || price.top() <= in) price.push(in); else{ while(!price.empty() && price.top() > in) price.pop(); price.pus...
ALGO
0.999641
4.125494
ec6af081-eb0b-4a08-a0d4-58fe531ed01d
DakshNsut/Data_Structures_and_Algorithms
Linked_List/merge_sort_LL.cpp
#include <iostream> using namespace std; class Node{ public: int data; Node* next; Node(int data){ this -> data = data; this -> next = NULL; } }; void print(Node* hptr){ if(hptr == NULL){ cout << "Empty List" << endl; return; } while(hptr){ cou...
ALGO
0.999997
5.668829
669369b8-a185-4063-88d9-79fb3fe261b4
WaelLasheen/IEEE_PS
W3/First Missing Positive solution 1.cpp
class Solution { public: int firstMissingPositive(vector<int>& nums) { set<int>p; for(int i:nums){ if(i>0){ p.insert(i); } } int n=1; for(int i:p){ if(n !=i){ return n; } n++; ...
ALGO
0.999865
4.940958
9ff8b6d7-7994-4d22-9a06-2545541de1dc
aakashmaity/code-with-akash
1916-find-center-of-star-graph/find-center-of-star-graph.cpp
class Solution { public: int findCenter(vector<vector<int>>& edges) { int s = edges.size(); vector<vector<int>> adjList(s+2); for(auto edge : edges){ adjList[edge[0]].push_back(edge[1]); adjList[edge[1]].push_back(edge[0]); } int n = adjList.size()-1;...
ALGO
0.999903
5.576293
a3b87ee6-21b0-40c4-b4a8-b85ea171d6fc
ishandutta2007/codeforces
riano_/normal/1620/E.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(int i=0;i<n;i++) #define rrep(i,n) for(int i=n-1;i>=0;i--) #define rrep2(i,n,k) for(int i=n-1;i>=n-k;i--) #define vll(n,i) vector<long long>(n,i) #define v2ll(n,m,i) vector<vector<long long>>(n,vll(m,i)) #define v3ll(n,m,k,i) vector...
ALGO
0.999986
4.485881
9cadccf6-f47d-4ee7-ba33-997c4b24e98c
kaushalchugh/CodeHelp-DSA-Busted-Series
Lecture033 Recursion Day3/linearSearch.cpp
#include<iostream> using namespace std; void print(int arr[], int n) { cout << "Size of array is " << n << endl; for(int i=0; i<n; i++) { cout << arr[i] << " "; } cout << endl; } bool linearSearch(int arr[], int size, int k ) { print(arr,size); //base case if(size == 0) retu...
ALGO
0.99957
4.716673
0a943077-6c68-4d17-96ca-3266749c0eb9
Tokesh/ADS
deikstra/dekstra.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int INF = 1e6; int main() { int n, s, end; cin >> n >> s >> end; s--; end--; vector<pair<int,int>> g[n]; for (int i = 0; i < n; i ++){ for (int j = 0; j < n; j ++){ int w; cin ...
ALGO
0.999937
3.703388
9e720df5-6f24-43fd-9e6b-0907520f9721
liuyubobobo/OJ-Project-Euler
ProjectEuler/0014/main2.cpp
/// Source : https://projecteuler.net/problem=14 /// Author : liuyubobobo /// Time : 2017-09-27 /*** * Using memory search */ #include <iostream> #include <vector> #include <fstream> using namespace std; class Solution{ private: int* record; int* maxLength; int* startNumber; int maxNum; public...
ALGO
0.999936
4.69906
5cbd9393-bd41-46c2-8daa-b9bd70f17d46
Abid003/data-structure-and-algorithm
rod cutting mattrix.cpp
#include <bits/stdc++.h> using namespace std; int main() { freopen("rc.txt","r",stdin); int n; cin >> n; int val[n+1];//ignore 0 index for(int i=1;i<=n;i++) { cin >> val[i];// input n numbers } int table[n+1][n+1]; memset(table,0,sizeof(table)); for(int i=1;i<=n;i++) ...
ALGO
0.999874
3.244474
7b72a88d-4c5b-4b54-9dc7-91d67a085400
yzcmf/Lintcode_FirstTime
165_merge-two-sorted-lists/merge-two-sorted-lists.cpp
/* @Copyright:LintCode @Author: yzcmf @Problem: http://www.lintcode.com/problem/merge-two-sorted-lists @Language: C++ @Datetime: 16-08-22 01:15 */ /** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode(int val) { * this->val = val; * thi...
ALGO
0.999916
5.573088
87ffc65c-d14d-4843-a9bc-5fa2e73ea06f
tejwhatsnew/Leetcode-Problems
151-reverse-words-in-a-string/reverse-words-in-a-string.cpp
class Solution { public: string reverseWords(string s) { int left=0; int right = s.length() - 1; string ans = "", temp = ""; while(s[left] == ' ') left++; while(s[right] == ' ') right--; while(left <= right) { if(s[left] != ' ') temp += s[left]...
ALGO
0.999967
5.836673
7158568f-b866-449f-9656-4e6b7cf9e189
Indahrani07/uas_21312065
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.998841
6.783336
daf7db68-9446-43aa-8a47-f6195442b35f
kiran-creator568/kiran-creator568
day4/prg22.cpp
/*create a pattern of number and print continous a,b,c,d using for loop*/ #include <iostream> using namespace std; int main() { int n; cout << "Enter the number of rows: "; cin >> n; char count = 'A'; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { ...
ALGO
0.998002
4.190132
b981d25e-a06b-49be-a0ab-86b3899a390d
long64/AS-BFS
code/old/blackhole.cpp
#include <fstream> #include <string> #include <iostream> #include <vector> #include <queue> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <sstream> std::unordered_map<int, std::unordered_map<int, std::vector<int>>> as_rel; std::unordered_map<int, std::vector<int>> as_cone; ...
ALGO
0.987098
3.136159
174467d3-437b-4f03-9b62-cb8036a1a642
aswan-1840/cpp
ARRAY 8 .CPP
#include <iostream> using namespace std; int main() { int arr[3][3]; int i,j; cout << "enter the elements : \n"; for(i = 0;i < 3;i++) { for(j = 0;j < 3;j++) { cin >> arr[i][j]; } } int value; bool found = false; cout << "enter the value to search"; cin >>...
ALGO
0.999195
3.90128
4216521c-584f-458d-940a-0f075468344a
Nih1tGupta/Leetcode-GFG
0023-merge-k-sorted-lists/0023-merge-k-sorted-lists.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*mergeTwo(Lis...
ALGO
0.999942
5.833534
8b68c18b-5a1c-4b61-80bc-06426b587ad8
RainPPR/oi-archive
20230805 思维好题/Kruskal 重构树.cpp
#include <bits/stdc++.h> #define rr read() using namespace std; // INPUT GRAPH const int N = 2e5 + 10; const int M = 2e5 + 10; // NEW GRAPH const int NN = N + M; const int MM = M + M; // 4LCA const int K = 20; // FAST READ inline int read() { int num = 0, flag = 1; char ch = getchar(); for (; !isdigit...
ALGO
0.999964
4.712139
62a65876-97bb-4103-a1ee-2655251ca053
BurhaanRasheedZargar/OOP_LAB
code11.cpp
#include<iostream> using namespace std; int main() { int n; cout<<"Enter the size of the array:"; cin>>n; int a[n]; cout<<"Enter the elements:"; for (int i = 0; i < n; i++) { cin>>a[i]; } for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { ...
ALGO
0.999869
3.157228
ee35cf14-9122-4598-b2a8-8f830ce47de4
Ibn-Omar-Romel/Competitive_Programming_YouKnowWho
Basics/Loop/Shape_2.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int space = n-1, star = 1; for(int i = 0; i < n; i++) { for(int j = 0; j < space; j++) { cout << " "; } space--; for(int j = 0; j < star ; j++) { cout << "*"; }...
ALGO
0.999975
3.904344
ef0acb10-1f3f-4420-bcbd-7875e8b9fc25
yvanLuzin/CS106B-Homework
Fractals/src/fractals.cpp
/* * File: fractals.cpp * -------------------------- * Name: * Section leader: * This file contains fractal problems for CS106B. */ #include "fractals.h" #include <cmath> #include "complex.h" using namespace std; const int LEAF_COLOR = 0x2e8b57; /* Color of all leaves of recursive tree (level 1) */ const int...
ALGO
0.995231
5.667974
79674c59-55c9-4b6f-b131-9f8a6cee2a84
August6676/Algorithm-Playground
leetcode/hot100/hot100_240.cpp
#include <iostream> #include <vector> using namespace std; bool searchMatrix(vector<vector<int>>& matrix,int target) { if (matrix.empty() || matrix[0].empty()) return false; int rows = matrix.size(),cols = matrix[0].size(); int row = 0,col = cols - 1; while (row < rows && col >= 0) { if (matrix[row...
ALGO
0.999527
5.516052
21831eb6-5b50-4c96-898d-b91883660f35
NirobNabil/CP
CF/random CF/1453B.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define vv vector<int> #define pp pair<int,int> #define pb(x) push_back(x) #define in(x) insert(x) #define del(x) erase(x) #define emp(x) emplace_back(x) #define mt make_tuple #define X first #define Y second #define A begin #define B end #define ...
ALGO
0.999675
3.952052
b1928e0e-9572-41de-9543-4bb2bc641921
CoderOJ/contests
CodeForces/cts/1497/d/main.cpp
#include "/home/jack/code/creats/Scanner.h" #include "/home/jack/code/creats/log.h" #include "/home/jack/code/creats/range.h" #include "/home/jack/code/creats/util.h" // #include "/home/jack/code/creats/STree.h" // #include "/home/jack/code/creats/Tree.h" // #include "/home/jack/code/creats/Graph.h" // #include "/home...
ALGO
0.999842
4.604522
7e793ece-98eb-4f79-94c7-65acbb8adba7
kaorulego5x/comp
abc/007/A-植木算.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0; i < ll(n); i++) #define repd(i, n) for(ll i = n-1; i >= 0; i--) #define ford(i, a, b) for(ll i = a; i >= ll(b); i--) #define fora(i, I) for(const auto& i:I) #define all(x) x.begin(), x.end() #define PB push_back #define ...
ALGO
0.999638
3.210306
933d8ffa-bae3-450f-8852-984e822ba369
raincross7/code-similarity
codes/train_code/problem192/problem192_354.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int,int>; const ll INF = (ll)1e18 *4 +9; int f(vector<int> v, int k){//ソート済みの配列からk個取る時の差の最小値を返す int n = v.size(); int ans = v[k-1] - v[0]; for(int i=k; i<n; ++i){ ans = min(ans, v[i] - v[i-k+1]); } return ans; } int main(...
ALGO
0.999982
4.19955
3ad870c9-8c1e-4cd4-99bc-a6e6b8c4afca
Mahin008/Codeforces_Problems
vanyaAndFence.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n , h ,count=0; cin >> n >> h; int arr[n]; for(int i=0 ; i<n ; i++) { cin >> arr[i]; if(arr[i]<=h) count++; else if(arr[i]>h) count += 2; } cout << count; return 0; }
ALGO
0.99986
3.391344
2fc523d2-26ad-406a-a43f-987f96c7acd9
endo1322/AtCoder
tessoku-book/b13/main_2.cpp
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; #define rep(i,n) for (int i = 0; (i) < (int)(n); ++ (i)) #define rep3(i,m,n) for (int i = (m); (i) < (int)(n); ++ (i)) #define rrep(i,n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) #define rrep3(i,m,n) for (int i = (int)(n) -...
ALGO
0.99993
5.344828
e30d0009-66c7-4bfd-9bc7-1d701654ed06
mdmccra/programming-2
Genealogy.cpp
#include <iostream> #include <fstream> #include <string> #include "p2map.h" using namespace std; int main() { //declare variables ifstream fin; ofstream fout; string input_filename, father, son, name; Map<string, string> fs; Map<string, string> sf; //initialize maps initialize(fs); initialize(sf); //get i...
ALGO
0.901472
3.912987
90e79f4a-244a-40ee-913a-b8b2ddc9abaa
MuhammedAKh/C-lab
T2p1.cpp
#include<iostream> #include<string.h> using namespace std; double *momentum(double velocity[3], double mass) { double *arymntm = new double[3]; for (int i=0; i<3; i++) { arymntm[i] = velocity[i] * mass; } return arymntm; } int main() { double mass; double velocity[3]; cout<<"Enter the three velocity values from -100.0 ...
ALGO
0.99877
3.415393
4e48d239-1f04-462a-8080-41c26431655a
sshakya31397/HandsOnAssignment1
conversion_app/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.998852
6.76775
07ee66f5-067e-4693-b98e-9d91672a9296
kaiumuddin/DSA-Codes
Dynamic_Programming_Phitron/22.knapsack/1.0_1_knapsack__kaium_2.cpp
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 5; // int knapsack(int n, int v[], int w[], int s) // { // if (s < 0) return INT_MIN; // // if (s < 0) return 0; // if (s == 0) return 0; // if (n == 0) return 0; // int take = knapsack(n - 1, v, w, s - w[n]) + v[n]; // // if ret...
ALGO
0.999985
3.939406
92cfd607-9b95-4ba7-97a3-7d6cec8d184a
kgbook/live555
liveMedia/uLawAudioFilter.cpp
#include "uLawAudioFilter.hh" ////////// 16-bit PCM (in various byte orders) -> 8-bit u-Law ////////// uLawFromPCMAudioSource* uLawFromPCMAudioSource ::createNew(UsageEnvironment& env, FramedSource* inputSource, int byteOrdering) { // "byteOrdering" must be 0, 1, or 2: if (byteOrdering < 0 || byteOrdering > 2) { ...
TOOL
0.899111
6.319759
d6c4d6ae-00c2-445a-8f0c-4be187aabc33
wenjiesun1024/Leetcode
Cpp/601~/674. Longest Continuous Increasing Subsequence.cpp
class Solution { public: int findLengthOfLCIS(vector<int>& nums) { if (nums.empty()) return 0; int res = 1, left = 0, n = nums.size(); for (int i = 1; i < n; i++) { if (nums[i] <= nums[i-1]) left = i; else res = max(res, i-left+1); } return res; } ...
ALGO
0.999953
6.279514
eaaf17b0-3af8-40f2-83ce-87bb52915c3d
halilbeytorun/FunProblems
Permutation/main.cpp
#include <iostream> #include <string> #include <utility> /// @brief Permutation of a string, in here only printing operation is applied but another essential operations could be done. /// @param S The input string /// @param l the lower index required for the permutation /// @param h the high index required for the pe...
ALGO
0.999605
6.242345
ccf7b78f-a902-49b0-81cc-98328ccdb3b5
satyam3128/DSA-code
4_2D_ARRAY/5_reverse_of_each_row_of_matrix.cpp
#include <iostream> using namespace std; int main(){ int arr[10][10]; int row; int col; cout<<"Row of Matrix:"; cin>>row; cout<<"Column of Matrix:"; cin>>col; for(int i = 0;i<row;i++){ for(int j = 0;j<col;j++){ cout<<"Enter "<<i<<" "<<j<<" Element of Array:"; ...
ALGO
0.997697
3.34726
bf151030-ea70-4dad-ace4-defe2db8d9be
phdsky/ORBSLAM24Windows
Thirdparty/DBoW2/DBoW2/ScoringObject.cpp
#include <cfloat> #include "TemplatedVocabulary.h" #include "BowVector.h" using namespace DBoW2; // If you change the type of WordValue, make sure you change also the // epsilon value (this is needed by the KL method) const double GeneralScoring::LOG_EPS = log(DBL_EPSILON); // FLT_EPSILON // ------------------------...
ALGO
0.995184
5.906807
17d2f9da-9d85-46b6-834f-55d811ecf44b
os-moussao/algorithms-and-data-structures
MatrixExpo.cpp
const int MOD = (int)(1e9+7); class Matrix{ int n,m; vector <vector <int>> a; Matrix(int n, int m) { this->n = n; this->m = m; a.resize(n,vector <int>(m)); } Matrix operator*(const Matrix& other) { assert(m == other.n); Matrix product(n,other.m); for(int i=0;i<product.n;i++) { for(int j=0;j<produ...
ALGO
0.999779
4.116888
187943d1-ea45-4bd9-af78-139740f9833c
pauldepalma/CPSC121CHS
older/4-Functions/ex2.cpp
//exponentiating with integers and the predefined function #include <iostream> #include <cmath> using namespace std; int main() { int x, y; cout << "Enter base " << endl; cin >> x; cout << "Enter exponent " << endl; cin >> y; cout << "result is : " << pow(static_cast<double>(x),static_cast<double>(y)); ...
ALGO
0.969321
4.430584
839a1eff-94dd-488a-825f-67d10fafaa48
woaixiaoxiao/CMU15445
test/primer/starter_trie_test.cpp
#include <bitset> #include <functional> #include <numeric> #include <random> #include <thread> // NOLINT #include "common/exception.h" #include "gtest/gtest.h" #include "primer/p0_trie.h" namespace bustub { // Generate n random strings std::vector<std::string> GenerateNRandomString(int n) { std::random_device rd;...
TEST
0.86482
7.391714
394ee678-86ca-4cc8-8016-3ca63f6f68d6
nazmulfahim3010/DS_BASIC_code
SORTING_algorithm/INSERTATION_sorting.cpp
#include<iostream> #include<vector> using namespace std; int main() { int n,j; cin>>n; vector<int>v(n); for(int i=0;i<n;i++) { cin>>v[i]; } for(int i=1;i<n;i++) { int current =v[i]; for(j=i-1;j>=0 && v[j]>current;j--) { v[j+1]=v[j]; ...
ALGO
0.999994
4.032365
45c65eb4-85a6-4d10-8363-46dcc33ed12d
pjw6468/ParkJunWoo
자료구조&디자인패턴/자료구조와알고리즘/예제/Chapter_5/InsertionSort/InsertionSort.cpp
#include <stdio.h> void InserSort(int arr[], int n) { int i, j; int insData; for (i = 1; i < n; i++) { insData = arr[i]; // insData for (j = i - 1; j >= 0; j--) { if (arr[j] > insData) arr[j + 1] = arr[j]; // ĭ ڷ б else break; // ġ ã Ż! } arr[j + 1] = insData; // ã ġ ! ...
ALGO
0.999995
4.248601
ca6c042b-8808-4a95-9049-596d919fb57a
gyeongpunch/SSAFY-13th-Embedded-Algorithm-Study
flyski3/2025_05/week_2/BOJ-움직이는미로탈출(16954) copy.cpp
/* 플러드 필 방식 몇초(st)일때 위치할 수 있는 공간 표시 -> 현재 st보다 낮은 위치는 탐색 가능 벽인 곳은 탐색x, 벽이 움직여서 충돌하면 그 위치에서 탐색x st가 9초이상 or 벽이 더이상 없음 경우 도착 가능 */ #include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; int field[8][8]={0}; //map vector<pair<int,int>> wall; //wall queue<pair<int,int>> qu;...
ALGO
0.999724
4.889091
026f423c-dd96-41ec-8f9c-dcb2c753454e
Zia6/Acm
onlineJudge/neuoj/search/4-3.cpp
#include<cstdio> #include<algorithm> using namespace std; const int maxn = 2e5 + 5; struct movie{ int st, en; bool operator < (const movie &m)const { return en < m.en; } }mo[maxn]; int main(){ int n; scanf("%d", &n); for (int i = 0; i < n;i++){ scanf("%d %d", &mo[i].st, &mo[i].en...
ALGO
0.999799
3.934218
3e1e49cb-84f4-4818-8d28-d07ff683645e
PajarKharisma/TugasPraktikumAlgoritmaPemrograman
1 - Pengenalan C/Coba.cpp
#include <iostream> #include <conio.h> using namespace std; struct Segitiga{ private: int alas; int tinggi; public: void setSegitiga(int alas, int tinggi){ this->alas = alas; this->tinggi = tinggi; } int getSegitiga(){ return (this->...
TOOL
0.920548
3.80534
7864e007-7019-4a24-bb61-e336bc2fe551
asmanya/CppCode-DSACourse
cpp practice/simple prograns/ContoBinary.cpp
#include<iostream> using namespace std; int main() { int num, rem[20], i = 0, j; cout << "Enter the number." << endl; cin >> num; while(num > 0){ rem[i] = num % 2; i++; num = num /2; } cout << "Equivalent binary number is "; for(j = i-1; j >= 0; j--){ cout <...
ALGO
0.999912
4.269711
fc111861-8676-4394-8fbd-68b419ef21c2
bdcbqa314159/leetCodeWork
design-hashmap/design-hashmap.cpp
class MyHashMap { public: int size = 10; vector<list<pair<int,int>>> mp = vector<list<pair<int,int>>>(size); int hash(int key){ return key%size; } MyHashMap() { } void put(int key, int value) { int i = hash(key); for (auto it = mp[i].begin...
ALGO
0.999291
6.199491
fcf40f84-19ba-4af9-90db-2a5b1bf5541c
mchini/Yang_Chini_et_al
Figures_5-7_(MATLAB)/ExternalToolboxes/GenLouvain-master/GenLouvain-master/MEX_SRC/group_handler.cpp
// // group_handler.cpp // group_handler // // Created by Lucas Jeub on 21/11/2012. // // usage: // // [output]=group_handler('function_handle',input) // // implemented functions are 'assign', 'move', 'moverand', 'return' // // assign: takes a group vector as input and uses it to initialise the "group_index" ...
ALGO
0.9992
5.159534
e734c1ff-da7a-433a-8435-068766e96fe0
andeplane/AtomifyVisionPro
LAMMPS/src/fix_spring_self.cpp
// clang-format off /* ---------------------------------------------------------------------- Contributing author: Naveen Michaud-Agrawal (Johns Hopkins University) ------------------------------------------------------------------------- */ #include "fix_spring_self.h" #include "atom.h" #include "domain.h" #incl...
TOOL
0.889078
6.51981
6e61b799-7b51-4197-acc2-3b27487b8a2f
jdg824/CodingTestArchive
프로그래머스/0/181853. 뒤에서 5등까지/뒤에서 5등까지.cpp
#include <string> #include <vector> #include <algorithm> using namespace std; vector<int> solution(vector<int> num_list) { sort(num_list.begin(), num_list.end()); vector<int> answer; for(int i=0; i<5; i++) answer.push_back(num_list[i]); return answer; }
ALGO
0.999866
4.786197
96fab389-bf66-459a-9f47-99dc233960a0
canopus-aarin/CPP
Arrays/RearArBySignOpt.cpp
#include<iostream> #include<vector> using namespace std; vector<int> RearrangeBySign(vector<int> A){ int n = A.size(); vector<int> ans(n,0); int posIndex = 0; int negIndex = 1; for(int i =0;i<n;i++){ if(A[i]<0){ ans[negIndex] = A[i]; negIndex = negIndex + 2; ...
ALGO
0.999983
4.785962
bbfa39e5-74fd-497a-b8e0-cd21c08d9c87
arnavjaiswal2803/DSA
0085-maximal-rectangle/0085-maximal-rectangle.cpp
class Solution { int largestRectangleArea(vector<int>& heights) { int n = heights.size(), maxArea = 0; stack<int> st; for (int idx = 0; idx <= n; idx++) { while (!st.empty() && (idx == n || heights[st.top()] >= heights[idx])) { int height = heights[st.top()]; ...
ALGO
0.999976
6.914746
1965c2fe-9991-4e50-a46e-a1ee9b2166e8
Mobile-Programming-MDP/materi-latihan-flutter-Arachne01
hallo_widget/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.997895
6.76073
158c31cc-bc8d-485f-b6f3-6711af8d33b6
ggjini1/gp22
libigl/include/igl/remesh_along_isoline.cpp
template < typename DerivedV, typename DerivedF, typename DerivedS, typename DerivedU, typename DerivedG, typename DerivedJ, typename BCtype, typename DerivedSU, typename DerivedL> IGL_INLINE void igl::remesh_along_isoline( const Eigen::MatrixBase<DerivedV> & V, const Eigen::MatrixBase<Deriv...
ALGO
0.961069
5.352683
480c7e0c-9abb-4c84-814a-5fa202fcb28d
ChinnamPoojithaSuryaRajeswari/BECOME_CODER
fibo_usng_dynamic_programming.cpp
#include<bits/stdc++.h> using namespace std; int fib(int n,vector<int>&dp) { if(n==0) return 0; if(n==1) return 1; if(dp[n-1] == -1){ dp[n-1] = fib(n-1,dp); } if(dp[n-2] == -1) { dp[n-2] = fib(n-2,dp); } dp[n]=dp[n-1]+dp[n-2]; return dp[n]; } int main() { vector<int>dp(30,-1); int n; cin>>n; cout<<fib(...
ALGO
0.999992
5.026416
ffe6a33d-6df9-462d-a4ad-c1af56241bae
devanshmishra25/DSA_Personal
Binary Search/firstocc_recur.cpp
#include <iostream> using namespace std; int firstOcc(int arr[], int low, int high, int x) { if(low > high) return -1; int mid = (low + high) / 2; if(x > arr[mid]) return firstOcc(arr, mid + 1, high, x); else if(x < arr[mid]) return firstOcc(arr, low, mid - 1, x); else { if(mid == 0 || arr[mid - 1] !...
ALGO
0.999902
5.529544
e8e36826-7969-4e2b-a1b7-defaa3f07a1f
The-atama/Library
String/Trie.cpp
struct Trie { const static int alphabet_size = 26; const int root = 0; const char base = 'a'; Trie() : T(1) {} struct Node { vector<int> child; // children of this node in Trie bool leaf; int par; // parent char par_c; // character on the edge from parent to this node Node(int par = -...
ALGO
0.999706
5.790438
0eb08d8e-63f7-4c34-9022-0c5de038776f
PowerSl1d3/algorithms
6_sprint/C.DFS/main.cpp
#include <iostream> #include <vector> #include <stack> #include <utility> #include <algorithm> enum class color { WHITE = 0, GRAY = 1, BLACK = 2 }; enum class stage { first_visit = 0, return_visit = 1 }; namespace new_algorithm { void DFS(const std::vector<std::vector<int>>& list_of_adjace...
ALGO
0.999741
4.815293