uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
1faac0ce-613c-42dc-85f5-a843e10ee4b1
tush27/Solved-DSA-problems
2492-minimum-score-of-a-path-between-two-cities/2492-minimum-score-of-a-path-between-two-cities.cpp
class Solution { public: int minScore(int n, vector<vector<int>>& roads) { //create adjacency list of roads to make it a graph vector<pair<int, int>> adj[n+1]; for(int i=0; i<roads.size(); i++) { adj[roads[i][0]].push_back({roads[i][1], roads[i][2]}); ad...
ALGO
0.999879
5.889912
8a0b5406-3992-4711-9adb-5dbaa48639c2
charulp2499/Intel-oneAPI-Sample
Publications/GPU-Opt-Guide/slm/histogram-slm-1024.cpp
int main() { constexpr int N = 4096 * 4096; std::vector<unsigned long> input(N); srand(2009); for (int i = 0; i < N; ++i) { input[i] = (long)rand() % 1024; input[i] |= ((long)rand() % 1024) << 16; input[i] |= ((long)rand() % 1024) << 32; input[i] |= ((long)rand() % 1024) << 48; } sycl::que...
ALGO
0.962555
4.167641
3b06f070-29f7-4223-9068-e73e2b0bb554
marcinz/libcxx-ranges
test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/find.pass.cpp
// <string> // template<> struct char_traits<char16_t> // static const char_type* find(const char_type* s, size_t n, const char_type& a); #include <string> #include <cassert> int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS char16_t s1[] = {1, 2, 3}; assert(std::char_traits<char16_t>::find(s1, 3, char16_t(...
TEST
0.924725
6.328632
5f38e129-e99a-4b11-8817-e40f613a020c
LipsaDas0710/CPP-DSA-Daily-Grind
Linked List/Create.cpp
#include <iostream> #include <bits/stdc++.h> using namespace std; class Node{ public: int data; Node* next; public: Node(int data1,Node* next1){ data=data1; next=next1; } }; Node* create(vector<int> &arr){ Node* head=new Node(arr[0],nullptr);// Create the head node with the first ...
ALGO
0.999924
5.150564
ae2cdd2f-a3f6-432c-8faf-c52d80a68153
siddharthachandra/gcrf
caffe_deeplab2_lightweight/src/caffe/parallel.cpp
#ifndef CPU_ONLY #include <cuda_runtime.h> #endif #include <glog/logging.h> #include <stdio.h> #include <sstream> #include <string> #include <vector> #include "boost/thread.hpp" #include "caffe/caffe.hpp" #include "caffe/parallel.hpp" namespace caffe { enum Op { copy, replace_cpu, replace_gpu, replace_cpu_d...
TOOL
0.868236
7.542197
7fc01290-a25c-441e-9e6b-96f768fa3e14
Rawat-Sagar/CPP_Practice
array_insert2.cpp
// C++ Program to Insert an element // at a specific position in an Array #include <iostream> using namespace std; // Function to insert x in arr at position pos int* insertX(int n, int arr[], int x, int pos) { int i; // increase the size by 1 n++; // shift elements f...
ALGO
0.999957
5.522779
7dea15b7-3a2d-4047-8d46-c920964b2841
MaxWutw/codebook
Contents/Temp/DisjointSetV2.cpp
int Find(int a){ return (anc[a] == a ? a : anc[a] = Find(anc[a])); } bool merge(int a, int b){ a = Find(a); b = Find(b); if(a == b) return false; if(sz[a] < sz[b]) swap(a, b); anc[b] = a; sz[a] += sz[b]; return true; }
ALGO
0.999906
3.821069
487f6aca-6147-4b88-a991-cd1625831372
Bevia/CppChallenges
Advanced/DigitalSignalProcessing/LMS/lms.cpp
#include <iostream> #include <vector> #include <numeric> #include <cmath> #include <fstream> // Function to compute the dot product of two vectors double dotProduct(const std::vector<double>& a, const std::vector<double>& b) { return std::inner_product(a.begin(), a.end(), b.begin(), 0.0); } // LMS algorithm void ...
ALGO
0.999843
7.400006
73930ac6-85c9-4d7a-b185-345c0538efba
gairik99/DSA2024
Recursion/numberOfSubsequencesK.cpp
#include <bits/stdc++.h> using namespace std; int helper(vector<int> &nums, int k, int sum, int ind) { if (ind == nums.size()) { if (k == sum) return 1; return 0; } if (sum == k) return 1; int left = 0; if (sum < k) { sum += nums[ind]; lef...
ALGO
0.99996
5.409108
e69d46e6-02cd-4c7e-af5b-39f840c14893
ishandutta2007/codeforces
princebelkovetz/normal/1585/C.cpp
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_map> #include <iomanip> #include <queue> #include <cassert> #include <bitset> #include <string> #include <numeric> #pragma GCC optimize("O3") using namespace std; #define debug(x) cout << #x <...
ALGO
0.999929
4.766852
83b90147-77d7-4908-9e28-6e45b0575a92
alexandraback/datacollection
solutions_5658571765186560_0/C++/skrushch/main.cpp
#include <cstdint> #include <cstdio> #include <cmath> #include <ctime> #include <cctype> #include <limits> #include <string> #include <sstream> #include <vector> #include <algorithm> struct TestCase { int x; int r; int c; bool solution; TestCase(FILE* input) { fscanf(input, "%d %d %d\n", &x, &r, &c); ...
ALGO
0.999388
4.344282
fcfe0a79-407a-4daf-8008-7bb9204cbf59
ys-dirard/cpp
tessoku/ch5/abc270-c.cpp
#include <bits/stdc++.h> using namespace std; int N, X, Y; vector<int> to[200009]; vector<int> ans; bool dfs(int v, int p=-1){ if (v == X){ ans.push_back(v); return true; } for (int u : to[v]){ if (u == p) continue; if (dfs(u, v)) { ans.push_back(v); ...
ALGO
0.999991
3.84156
29a9e442-17b6-4c8e-972c-8c906b94ce0a
ANIKETRAJ28/DSA-and-CP
Searching/cses/concert_tickets.cpp
#include <bits/stdc++.h> #define ll long long int #define infp INT_MAX #define infn INT_MIN #define mod 1000000007 using namespace std; template <typename T> using vec = vector<T>; int main() { int n, m; cin >> n >> m; vec<int> tickets(n); vec<int> customer(m); for (int i = 0; i < n; i++) { ...
ALGO
0.999998
4.060737
db84c0dd-d61b-439a-9dec-98694f5f3642
Praveen240503/leetcode_practic_programs
55-jump-game/jump-game.cpp
class Solution { public: bool canJump(vector<int>& nums) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int canGo = 0; int pos = 0; while(pos < nums.size()){ canGo = max(pos + nums[pos],canGo); if(pos >= canGo)break; ...
ALGO
0.99998
6.056664
9599ac9b-8d94-4eb2-a153-e97349b96e9a
arasHi87/OnlineJudgeExercise
toj43.cpp
// #include <cstdio> // #include <queue> // using namespace std; // const int maxN=1e4+10; // const int INF=0x3f3f3f3f; // struct Edge { // int to, next, w; // } edge[maxN*2]; // int n, m, a, b, c, cnt=0; // int head[maxN], dis[maxN], vis[maxN]; // queue<int> q; // inline void addedge(int u, int v, int w) { // ...
ALGO
0.999968
4.726339
841752f4-9f24-4e42-807c-59ad198145e3
GMNazmul55/XPSC
week3/day4/A_Polycarp_and_the_Day_of_Pi.cpp
#include <bits/stdc++.h> #define endl '\n' #define ll long long int #define all(v) v.begin(), v.end() #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tst; cin >> tst; while (tst--) ...
ALGO
0.999877
4.148053
f7b1bf15-1d3f-4758-9017-2f6dd8b3e317
mumumu6/kyopro
atcoder/ahc/048/beam_solver.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const double EPS = 1e-9; struct Paint { double r, g, b, amount; Paint(double r = 0, double g = 0, double b = 0, double a = 0) : r(r), g(g), b(b), amount(a) {} Paint mix(const Paint& other) const { if (amount + other.amount < E...
ALGO
0.996686
4.440575
5b2d9381-5eb0-4fda-b93d-aad7ce78ff1a
atharv-bhadange/LeetCode
Medium/287_findDuplicate.cpp
class Solution { public: int findDuplicate(vector<int> &nums) { int n = nums.size(); int hare = nums[0]; int tort = nums[0]; // finding if cycle do { tort = nums[tort]; hare = nums[nums[hare]]; } while (tort != hare); tort =...
ALGO
0.999905
5.807611
1e0cd303-0cec-4149-9d91-68ef69f6a06b
ishandutta2007/codeforces
hollwoq_pelw/normal/628/D.cpp
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) #define ford(i, n) for (int i = int(n) - 1; i >= 0; i--) #define fore(i, l, r) for (int i = int(l); i < int(r); i++) #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m)) #define all(a) (a).begin(), (a).end() #define s...
ALGO
0.998744
4.115979
9acad085-aaca-4773-beaf-0354b5ab89e1
yongsen/elements-of-programming-interviews
Successor.cpp
#include <cassert> #include <iostream> #include <memory> #include "./Binary_tree_with_parent_prototype.h" using std::cout; using std::endl; using std::unique_ptr; // @include BinaryTreeNode<int>* find_successor( const unique_ptr<BinaryTreeNode<int>>& node) { auto* n = node.get(); if (n->right) { // Find ...
ALGO
0.99932
6.919003
c834baf0-0b85-4427-98a5-3ac2201c6660
thibault-ai/Pricing-et-hedging-dans-le-modele-de-Black-Scholes-Merton
functions.cpp
#include <iostream> #include "header.h" #include <cmath> #include <algorithm> #include <random> // Fonction de répartition de la loi N(0,1) double normalcdf(double x) { return std::erfc(-x/std::sqrt(2))/2; } // Densité de probabilité de la loi N(0,1) double norm_pdf(const double x) { return (1.0/(pow(2*M_PI,0....
ALGO
0.999469
6.01843
2cec44a8-93ae-4a9b-86a1-a6462ac5aa44
hunterkasa/codelibrary
Math/Project Euler/4.cpp
#include <bits/stdc++.h> using namespace std; #define io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define F( i, n ) for( int i = 0; i < n; i++ ) #define ll long long #define endl '\n' #define pb push_back #define ppb pop_back // ll solve(ll n, ll m){ // } bool isPalindrome( ll n ){ string s = to_s...
ALGO
0.999901
5.721043
39358774-40ac-4117-aec9-47bc0e897288
yash0patni/cp
cses/mathematics/counting_divisors.cpp
#include <bits/stdc++.h> #define ll long long #define testcase() ll t; cin>>t; while(t--) #define fo(n) for (ll i = 0; i < n; i++) #define M 1000000007 using namespace std; ll countDiv(ll n) { ll count = 0; for (ll i = 1; i*i <= n; i++) { if (n%i == 0) { if (n/i == i) ...
ALGO
0.999774
5.053484
23c5da03-7d59-4c47-b328-9c64653cf421
jenilgandhi2111/AA-Lab
Lab-3/KMP.cpp
/********************************************************* Written by: Jenil J Gandhi Subject: AA Lab-no: Lab-03 Description: Implementing KMP Algorithm for String Matching Guidance by: Prof Malay Bhatt Date: 23/07/2021 *********************************************************/ #include <bits/stdc++.h>...
ALGO
0.998604
5.055863
db9c372f-6df9-4fc3-9c41-c865a088deb3
anmolaman20/competitive_programming_
LINKEDLIST_USING_STL/Middle_M1.cpp
#include <bits/stdc++.h> using namespace std; // 1 2 3 4 5 6 7 //o/p = 4 //in case of even return second; // 1 2 3 4 5 6 7 8 //o/p = 5 class node { public: int data; node* next; node(int value) { data = value; next = NULL; } }; void middle_element(node* head) { node *s = head...
ALGO
0.999835
4.381593
d08f6d7f-9f5c-4600-85f2-8cc9a575e9ac
ansh997/algorithmic_tool_box
Desktop/algo_coursera/algotoolbox/week1_programming_challenges/1_sum_of_two_digits/APlusB.cpp
#include <iostream> int sum_of_two_digits(int first_digit, int second_digit) { return first_digit + second_digit; } int main() { int a = 0; int b = 0; std::cin >> a; std::cin >> b; std::cout << sum_of_two_digits(a, b); return 0; }
ALGO
0.994808
5.244339
be560ded-7cc0-428b-b5eb-48292118c31f
sarvex/leetcode-scheme
solution/0400-0499/0401.Binary Watch/Solution.cpp
class Solution { public: vector<string> readBinaryWatch(int turnedOn) { vector<string> ans; for (int i = 0; i < 12; ++i) { for (int j = 0; j < 60; ++j) { if (__builtin_popcount(i) + __builtin_popcount(j) == turnedOn) { ans.push_back(to_string(i) + ":" ...
ALGO
0.998277
6.699302
bc98f5f5-85b9-47a0-b6f1-21924cb22251
nityamittal/LeetCode-Questions
200-number-of-islands/number-of-islands.cpp
class Solution { public: void traverseIsland(vector<vector<char>>& grid, int i, int j, int m, int n) { if(i<0 or i>=m or j<0 or j>=n or grid[i][j]=='0') return; grid[i][j]='0'; traverseIsland(grid, i+1, j, m, n); traverseIsland(grid, i-1, j, m, n); traverseIsla...
ALGO
0.999977
6.472283
4a371e29-02ad-45b8-b315-42832f3574dc
angelscutipa/EDA
DIMEN_MALDITION/main.cpp
#include <iostream> #include <vector> #include <sys/time.h> #include <stdlib.h> #include <math.h> using namespace std; class puntos { public: puntos(){} vector<double> pts; void set_coordenadas(double a){ pts.push_back(a); } void give(int n){ for (int i =0; i<n; i++){ ...
ALGO
0.994249
3.528439
21468a97-a85c-4e7b-9908-f53f548cea06
jschembri/quasi
eigen/unsupported/doc/examples/PolynomialUtils1.cpp
#include <unsupported/Eigen/Polynomials> #include <iostream> using namespace Eigen; using namespace std; int main() { Vector4d roots = Vector4d::Random(); cout << "Roots: " << roots.transpose() << endl; Eigen::Matrix<double,5,1> polynomial; roots_to_monicPolynomial( roots, polynomial ); cout << "Polynomial:...
ALGO
0.998259
4.015535
b438656f-9f69-412a-8e3b-4f885616141c
Abhisek-Ray99/Ds-Algo-code
Linkedlist/Flatten-a-Linkedlist.cpp
#include<iostream> using namespace std; class Node{ public: int data; Node *next; Node *bottom; Node(int data){ this->data = data; next = NULL; bottom = NULL; } }; void PrintLL(Node *head){ Node *temp = head; while(temp != NULL){ ...
ALGO
0.999767
4.526942
8a9fb1f8-cb13-46d8-aad4-1962d63a0e59
martinezdiego/competitive-programming
solutions/Leetcode/December Challenge/Week 3/4sum_ii.cpp
class Solution { public: // find how many A[i] + B[j] + C[k] + D[l] == 0 // total time complexity: O(2N^2) = O(N^2) int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vector<int>& D) { map<int,int> mp; int N = A.size(); int ans = 0; // A[i] + B[j] = - (C[k] + D[...
ALGO
0.999611
6.019256
da2cd1b0-e58a-4d97-b652-93e110bfed39
tanishq252/myLeetcodeSolutions
513-find-bottom-left-tree-value/513-find-bottom-left-tree-value.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.999991
6.322913
637982dc-5977-4f30-9cde-37d0f8651682
MahmoudSamy1452/Problem-Solving-Solutions
Leetcode/Daily Problems/1752-Check-if-Array-Is-Sorted-and-Rotated.cpp
class Solution { public: bool check(vector<int>& nums) { int n = nums.size(); int dec = 0; for(int i = 0; i < n; i++) { dec += (nums[i] > nums[(i + 1) % n]); } return dec <= 1; } };
ALGO
0.999987
5.467272
9c78836c-2cef-4261-bc5b-d51aef92c965
UdaySharmaGitHub/DSA-CPP
GFG/Medium Problems/Construct_list_using_given_q_XOR_queries.cpp
/* Construct list using given q XOR queries Given a list s that initially contains only a single value 0. There will be q queries of the following types: 0 x: Insert x in the list 1 x: For every element a in s, replace it with a ^ x. ('^' denotes the bitwise XOR operator) Return the sorted list after performing the giv...
ALGO
0.999946
5.349808
e13054ff-9c1a-4d3e-a04d-dd3b1a1a2b5b
pastacolsugo/coderfarm
Lezione 14/dadi100.cpp
#include <iostream> #include <stdio.h> int N, X=3, Y=2, Z=1, t; char comandi[100007]; void x (void){ t = Y; Y = Z; Z = 7-t; } void y (void){ t = Z; Z = X; X = 7-t; } void z (void){ t = X; X = Y; Y = 7-t; } void T (void){ printf ("%d ", Z); } void F (void){ printf ("%d ", Y); } void R (void){ printf (...
ALGO
0.998774
3.350078
fd96cbc7-4a73-4889-9f94-eb0f98eef334
helloobaby/llvm_msvc
llvm/lib/CodeGen/StackColoring.cpp
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/MachineBasicB...
TOOL
0.893878
7.703067
cf90e68f-def8-4cbb-9c13-ae274e111a12
naringcode/cpp-examples
Regex/match_search.cpp
// #include <bits/stdc++.h> #include <iostream> #include <regex> using namespace std; #define MODE 1 int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); std::string str = "Hello, World!"; std::regex patternSub(R"(, \w{3})"); std::regex patternFull(R"((\w+), (...
ALGO
0.904593
3.542546
60d95b17-718e-4134-9f1b-ffdd06ce212e
Anshu202122/Daily_Questions
GFG/2025/Jun/01_CountPairsSumInMatrices.cpp
class Solution { public: int countPairs(vector<vector<int>> &mat1, vector<vector<int>> &mat2, int x) { int n = mat1.size(), ans = 0; set<int> st; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { st.insert(mat1[i][j]); ...
ALGO
0.999902
5.744855
6e694acb-d13a-4fbd-8603-0da9194b1f93
vgyashwanth/GCU2115
mw/NV_LOG/Test/mocks/CRC/UTILS_Crc.cpp
/** * @file [UTILS_Crc] * @brief The module provides easy API's to calculate different types * of CRC's * @version [Version number] * @module To LT1000 * @author Sudeep Chandrasekaran * @date 19th September 2018 * @author None * @date None * @copyrigh...
TOOL
0.887547
5.558108
549b872b-250a-437d-ad46-72363ff47ff2
kunge233/ws_movit_kinova_mtc
moveit/moveit_planners/sbpl/core/sbpl_interface/src/sbpl_interface.cpp
#include <sbpl_interface/sbpl_interface.h> #include <planning_models/conversions.h> //#include <valgrind/callgrind.h> namespace sbpl_interface { bool SBPLInterface::solve(const planning_scene::PlanningSceneConstPtr& planning_scene, const moveit_msgs::GetMotionPlan::Request& req, moveit_msgs::...
TOOL
0.968473
5.70603
40ab2038-172c-4d2f-8f6c-52d1126c374f
ZakRipoll/ACM
Introducción a C++/10812.cpp
#include <iostream> using namespace std; int main(){ int loop, first, second, team; cin >> loop; for (int i = 0; i < loop; ++i) { cin >> first >> second; if( second > first or second %2 != first %2 ) { cout << "impossible" << endl; continue; } team = ( first + second ) * .5; cout << team...
ALGO
0.999847
3.450751
78a2ad20-09f2-41d1-865a-e5ec39a2c1b3
HongSon28/Training
Online Judges/Codeforces/problems/459D.cpp
#include<bits/stdc++.h> using namespace std; const int N=1e6; int n; int a[N+5]; int cnt[N+5]; vector<int>cprs; int l[N+5],r[N+5]; int bit[N+5]; long long res; void update(int idx) { while (idx<=n) { bit[idx]++; idx+=idx&(-idx); } } int get(int idx) { int ans=0; while (idx>0) { ans+=bit[idx]; idx-=idx&(-idx...
ALGO
0.999838
3.731625
329a75d6-664b-410e-8c2f-13de495bd2c5
SambhavNITJ/dsa
Map/Intersection of Two Linked Lists.cpp
class Solution { public: Node* findIntersection(Node* head1, Node* head2) { unordered_set<int> elementsInList2; Node* temp = head2; while (temp != NULL) { elementsInList2.insert(temp->data); temp = temp->next; } Node* dummyNode = new Node(0);...
ALGO
0.999881
5.973976
4996e21e-ebc3-4223-86ce-2c6535bb051c
ishandutta2007/codeforces
ugly2333/normal/1446/D2.cpp
//CF1446D2 #include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<bitset> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; typedef long long LL; typedef double DB; const int N = 222222; int n,m,a[N],b[N],f[N...
ALGO
0.999963
3.365005
e4c476f5-4ee5-4044-968f-d104f77eb93f
ZigRazor/CXXGraph
examples/PrimExample/prim_example.cpp
#include <CXXGraph/CXXGraph.hpp> #include <memory> using std::make_shared; // example taken from // https://www.geeksforgeeks.org/prims-mst-for-adjacency-list-representation-greedy-algo-6/TEST(FWTest, // test_1) int main() { CXXGraph::Node<int> node0("0", 0); CXXGraph::Node<int> node1("1", 1); CXXGraph::Node<in...
ALGO
0.999576
5.379348
44aed7b6-62ee-412d-b4cd-6d307e2e50e1
rbtre/rbtre.github.io
assets/code/P1150.cpp
#include <iostream> using namespace std; int main() { int n, k, t, sum; cin >> n >> k; sum = n; for (sum = n; n >= k; sum += t) { t = n / k; n -= t * k; n += t; } cout << sum; return 0; }
ALGO
0.999957
3.412469
d2a5e397-4aff-4ef3-a6c4-d2925ea60f18
akhilbhartiya/dm-heom
dm-heom/src/app_linear_absorption.cpp
#include <exception> #include <fstream> #include <iostream> #include <boost/format.hpp> #include <noma/num/meta_stepper.hpp> #include "heom/command_line.hpp" #include "heom/common.hpp" #include "heom/constants.hpp" #include "heom/dipole_matrix.hpp" #include "heom/dipole_pseudo_pathway.hpp" #include "heom/handle_main_...
ALGO
0.921885
6.116718
4c58ac87-f450-4f23-860b-a27a7bf929d1
DavidWuthier/biblio-tools3.2
scripts/Utils/louvain2017/src/dp.cpp
#include "dp.h" using namespace std; DP::DP(Graph & gr, long double sum, long double max_w):Quality(gr,"Profile Difference"),kappa(size),sum_sq(sum),max(max_w) { n2c.resize(size); in.resize(size); w.resize(size); // initialization for (int i=0 ; i<size ; i++) { n2c[i] = i; in[i] = g.nb_selfloops(...
ALGO
0.998505
4.144933
f6049990-6cfd-400a-b472-96a299c8588a
MusshcaB/lynx_cplus
python_cpp/opencv-4.5.1/opencv-4.5.1/modules/video/src/camshift.cpp
#include "precomp.hpp" int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria ) { CV_INSTRUMENT_REGION(); Size size; int cn; Mat mat; UMat umat; bool isUMat = _probImage.isUMat(); if (isUMat) umat = _probImage.getUMat(), cn = umat.channels(), size = umat.siz...
ALGO
0.999702
6.413995
aab6f508-b022-452d-843f-e2eb44aad7be
NaCl-1374/perceptive_legged_control
OCS2_ws/src/ocs2/ocs2_ddp/src/lintTarget.cpp
#include <ocs2_ddp/DDP_Data.h> #include <ocs2_ddp/DDP_Settings.h> #include <ocs2_ddp/GaussNewtonDDP.h> #include <ocs2_ddp/ILQR.h> #include <ocs2_ddp/SLQ.h> // Riccati equations #include <ocs2_ddp/riccati_equations/ContinuousTimeRiccatiEquations.h> #include <ocs2_ddp/riccati_equations/DiscreteTimeRiccatiEquations.h> ...
TOOL
0.859434
3.852794
8dee1c41-44fe-421a-b2aa-18cd9dd09fa5
priyatosh-paul/Data-Structure
StackUsingQueu.cpp
/* Program to implement a stack using two queue */ #include <bits/stdc++.h> using namespace std; class Stack { // Two inbuilt queues queue<int> q1, q2; // To maintain current number of // elements int curr_size; public: Stack() { curr_size = 0; } void push(int x) { curr_size++; //...
ALGO
0.999626
5.549055
cd0fcfd0-d407-4c82-95a7-ebd999acfb03
blacknightX/freedom
d827.cpp
#include <iostream> using namespace std; int main() { int n,cost; while(cin>>n) { cost=n/12*50+(n-(n/12)*12)*5; cout <<cost; } return 0; }
ALGO
0.996332
3.232296
8c2c678f-8765-4c60-8654-2546976e3c68
alska95/HKH_baekJoon
baekjoon/baekJoon_1546.cpp
#include <iostream> using namespace std; int numGroup[1001]; int main() { int N; int grade[1001]; double sum = 0; int biggest = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> grade[i]; if (grade[i] > biggest) biggest = grade[i]; } for (int i = 0; i < N; i++) sum += (double)grade[i] / (double)biggest...
ALGO
0.999409
4.043101
bdf85a17-6959-4bac-ab4d-369575aff61c
HypedUpbOii/CSES-Solutions
Introductory Problems/Bit_Strings.cpp
#include <bits/stdc++.h> using namespace std; int main(){ long long ans = 1; int n; cin >> n; for(int i = 0; i < n; i++){ ans = (ans * 2) % 1000000007; } cout << ans << endl; return 0; }
ALGO
0.999937
4.283153
eb05a2c3-69bd-456c-83ba-1bfe122c92df
Rekamux/SwiftApplication
unit_tests.cpp
#include <iostream> #include "buzzfizz.h" using namespace bf; using namespace std; static constexpr IndexType overflow_val = 94; // Covers all the possible states static const Result expected[] = { { 0, 0, ResultState::Normal }, { 1, 1, ResultState::Normal }, { 2, 1, ResultState::Normal }, { 3, 2, R...
TEST
0.960674
6.99092
273f2022-aee5-40d9-bcc9-34efb0ecfd79
yangmingzi/MyLeetcode
316-Remove Duplicate Letters.cpp
/* Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Example: Given "bcabc" Return "abc" Given "cbacdcbc" Return "acdb" */ class Solution { ...
ALGO
0.999931
6.222474
98c7424a-2b0c-4e00-9998-998741310690
jiang3f/CodingInterviewCplusplus
TreeAndBST/LevelOrderTraversalInSpirallForm.cpp
// // https://practice.geeksforgeeks.org/problems/level-order-traversal-in-spiral-form/1/ // #include "stdafx.h" #include <iostream> #include <vector> #include <queue> #include <deque> #include <string> #include <sstream> // std::istringstream using namespace std; namespace LevelOrderTraversalInSpirallForm { ...
ALGO
0.999494
6.543161
f3ab92e8-6dbc-4ed0-946b-aa8be15bc06e
Taha-Adeel/CP
Educational Codeforces Round 141 (Rated for Div. 2)/B_Matrix_of_Differences.cpp
#include <bits/stdc++.h> using namespace std; #define FAST ios::sync_with_stdio(0); cin.tie(0) template<class T> struct V: vector<T>{using vector<T>::vector; void sort() {std::sort(this->begin(), this->end());} void sort_dsc() {std::sort(this->begin(), this->end(), greater<T>());} auto sum() {T sum = 0; for(...
ALGO
0.999423
3.919642
1dadbc78-1140-47ed-ae3a-ff59a3c3c468
grodowski/CarND-Path-Planning-Project
src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,2); m << 1, 2, 3, 4; //get location of maximum MatrixXf::Index maxRow, maxCol; float max = m.maxCoeff(&maxRow, &maxCol); //get location of minimum MatrixXf::Index minRow, m...
ALGO
0.999322
4.010038
3077967c-03c6-41c2-8dbf-ef632ca7b093
MinQuan-kun/Training
LUYENCODE/CONTETST/TRAIN LC 04/SCBN2 - Số cặp bằng nhau 2/SCBN2.cpp
#include<bits/stdc++.h> using namespace std; int main() { vector<long long> v; long long n; cin >> n; long long temp; for(long long i = 0; i < n; i++) { cin >> temp; v.push_back(temp); } // Map lưu số lượng xuất hiện của từng số map<long long, long long> freq; /...
ALGO
0.999829
5.146448
f525afff-bdd2-4051-a4d0-84e336d798d8
IluvatarTheReal/POTMLogParser
src/Source.cpp
#include <algorithm> #include "playerdata_container.h" #include "arg_container.h" #include "usage_area.h" void print_line(std::string line); void print_crawling_results(playerdata_container& pc_data); //bool vector_string_val_exist(std::vector<std::string>& the_vector, std::string the_value); bool print_console = fal...
TOOL
0.934486
4.106498
c43c87b3-9680-4c75-a284-5320da778110
SLIIT-FacultyOfComputing/tutorial-02b-IT21299070
tute03.cpp
/*Exercise 3 - Repeatition Convert the C program given below which calculates the Factorial of a number that you input from the keyboard to a C++ program. Please Note that the input command in C++ is std::cin. This is a representation of the Keyboard.*/ /*#include <stdio.h> int main() { int no; long fac; ...
ALGO
0.999612
4.250169
e7d3836a-e114-4ff6-85c4-34bb29c05c99
SaiTp/LeetCode-Codes
1261-find-elements-in-a-contaminated-binary-tree/1261-find-elements-in-a-contaminated-binary-tree.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.99969
6.413126
b9273bde-0485-4058-9b20-e2a2b8c065f1
TanushreeBorase/dsa-pathshala
Imp. Patterns/Squarestarpattern.cpp
#include<iostream> using namespace std; int main(){ int n; cin >> n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout << '*'; } cout << endl; } return 0; } /* Sample output: 5 ***** ***** ***** ***** ***** */
ALGO
0.999882
3.830654
a1de0441-bd25-41c5-a327-0709ba68e6c5
giangnamG/CppPTIT
CPP0274-DemSoPhanTuLapLai.cpp
// #include<bits/stdc++.h> // using namespace std; // int main(){ // int t,n; // cin >> t; // while(t--){ // cin >> n; // int a[n]; // for(int i=0;i<n;i++) // cin >>a[i]; // sort(a,a+n); // int count=0; // int b[n]={0}; // int flag=0; // for(int i=0;i<n-1;i++){ // if(a[i]==a[i+1]){ // if(!f...
ALGO
0.999742
4.024887
e1996605-3bba-47d1-a218-bdc71371c148
tumpji/WTlib
thirdparty/CImg-2.0.0_pre021617/examples/tetris.cpp
#include "img/tetris.h" #include "CImg.h" using namespace cimg_library; // Main procedure //---------------- int main(int argc,char **argv) { // Read command line argument (if any) cimg_usage("An implementation of the well known 'Tetris' game with CImg."); unsigned int blocdim = cimg_option("-blocdim",18,"S...
TOOL
0.861605
5.99135
a8d4573d-2347-43b0-b13e-ec5d0fd8b4c5
bonewell/trie
trie.cpp
#include "trie.h" #include <algorithm> #include <utility> namespace { struct MatcherKey { std::string find_key; size_t pos; std::string key; operator bool() const { return pos > 0 && key == find_key; } bool operator !() const { return pos == 0; } bool Partial() const { return pos > 0 && ...
ALGO
0.99876
6.198179
242a3407-cd1e-4d10-aaf7-8252cf169b71
chsinnnn/project
DS/SHORTESTPATH.cpp
# include <iostream> // cin,cout,endl # include <cstdlib> // atoi, system # include <algorithm> # include <stdio.h> # include <iomanip> # include <fstream> # include <vector> # include <string> # include <string.h> # include <map> # include <queue> # include <stack> # include <algorithm> # include <sstream> using nam...
ALGO
0.958461
3.177481
cf189d97-9b1f-43cf-817c-aff21125abc6
hightop0924/custom-godot-engine
servers/physics_3d/godot_step_3d.cpp
/**************************************************************************/ /* godot_step_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* ...
ALGO
0.972997
6.215129
e821be2a-fc1c-439c-97ac-6393265a95fe
Mrcsy8/CP
Codeforces/1473/C. No More Inversions/NoMoreInversions.cpp
#include <bits/stdc++.h> using namespace std; vector<deque<int>> results; int main() { int t; cin >> t; results.resize(t); for(int i = 0; i < t; i++) { int n, k; cin >> n >> k; for(int j = k; j >= 1; j--) { if(j <= -n + 2 * k - 1) { ...
ALGO
0.999896
3.518978
dbeb37ee-d8ee-4529-8fab-363408080b70
AsherAyub80/weather_app_with_getx
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.998756
6.772262
b11e9dca-9035-4cf4-b23b-c4f2a457e3b8
MichaelRabinovich/DOG-editor
ext/libigl/python/py_igl/py_barycentric_coordinates.cpp
m.def("barycentric_coordinates", [] ( const Eigen::MatrixXd& P, const Eigen::MatrixXd& A, const Eigen::MatrixXd& B, const Eigen::MatrixXd& C, const Eigen::MatrixXd& D, Eigen::MatrixXd& L ) { return igl::barycentric_coordinates(P, A, B, C, D, L); }, __doc_igl_barycentric_coordinates, py::arg("P"), py::arg(...
ALGO
0.997888
6.713926
57000010-ebb7-4833-906b-b09535111b6f
Darkknight1299/C-plus-plus
Misc/heightChecker_leetcode.cpp
#include<bits/stdc++.h> #include<vector> using namespace std; int heightChecker(vector<int> &height){ for(int i=0;i<height.size();i++){ for(int j=i;j<height.size();j++){ if(height[i]>height[j]){ swap(height[i],height[j]); } } } } int main() { #ifndef ONLINE_JUDGE freopen("input...
ALGO
0.999979
4.133342
d43f5e95-887d-4dac-a5f6-7d3f1eef80f9
Saifur-Rahman03/Codes
Codes/Codeforces/208A.cpp
#include <iostream> #include <vector> #include <string> using namespace std; int main() { string s; vector<char> r; cin >> s; int j = 0; int sp = 0; for(int i = 0; i < s.size(); i++){ if(s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B'){ if(j != 0 && sp == 0){ r.push_back(' '); sp++; } i += ...
ALGO
0.999882
3.028171
91584ba9-b8b7-48c0-85c4-71e5c81bee67
janisozaur/rosalind
dna.cpp
#include <iostream> #include <map> using namespace std; int main() { map<char, int> nt; while (cin) { char c; cin >> c; if (cin) { nt[c]++; } } cout << nt['A'] << " " << nt['C'] << " " << nt['G'] << " " << nt['T'] << endl; }
ALGO
0.989521
3.611065
00b648e9-d85b-46a1-9650-cc1316b6c53e
ghazal1998rabiei/Kattis
filip.cpp
#include <bits/stdc++.h> using namespace std; int main(){ string x, y; cin >> x >> y; reverse(x.begin(), x.end()), reverse(y.begin(), y.end()); int x2 = stoi(x), y2 = stoi(y); cout << max(x2, y2) << endl; }
ALGO
0.99927
4.491302
c3ff5259-e17a-4812-b72e-f858c16a7b2a
kvpz/Robot-Vision-and-Control-System
src/navigator.cpp
#include "navigator.hpp" Navigator::Navigator(){} //double getRobotAngleToPoseOrientation(std::shared_ptr<Map> map, double endpointOrientation) const double Navigator::getRobotToEndpointSlopeAngle(std::shared_ptr<Map> map, double endpointDesiredOrientation) const { ...
ALGO
0.934405
5.739974
3df4c59b-af02-4b9f-bb21-dd88ea17f0b5
the-punisher-29/leetcode
2509-minimize-xor/2509-minimize-xor.cpp
class Solution { private: int countSetBits(int n) { int count = 0; while (n) { count += n & 1; n >>= 1; } return count; } public: int minimizeXor(int num1, int num2) { int targetBits = countSetBits(num2); int result = 0; int bit...
ALGO
0.999933
5.983941
681c472b-257b-4fbe-b16a-6be4125dbf1b
smartzcy/My_vscode
C_learn/VJ/shu_DP/C.cpp
#include <iostream> #include <vector> using namespace std; const int N = 1e5; vector<pair<int, int>> vec[N]; int dp[N][3]; int n; void dfs(int u, int fa) { dp[u][0] = 0; dp[u][1] = 0; for (int i = 0; i < vec[u].size(); i++) { int v = vec[u][i].first, w = vec[u][i].second; if (fa != v) { ...
ALGO
0.999936
4.696117
d373e9cb-e763-4232-9cdf-1356e7abe46d
shubhamaryal/LearnCode
_College/DSA/8. Sort/selection.cpp
// Selection Sort #include <iostream> using namespace std; void selectionSort(int arr[], int n) { for (int i = 0; i < n - 1; i++) { int minIndex = i; for (int j = i + 1; j < n; j++) { if (arr[j] < arr[minIndex]) { minIndex = j; } } swap(arr[...
ALGO
0.99996
5.661425
33e922a7-b043-4830-8aee-e1cf7f731762
ViNN280801/codewars
C++/Fundamentals/Playing with digits.cpp
// Task: Some numbers have funny properties. For example: // 89 --> 8¹ + 9² = 89 * 1 // 695 --> 6² + 9³ + 5⁴= 1390 = 695 * 2 // 46288 --> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51 // Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p // we want to find a positive in...
ALGO
0.999855
6.520333
a19135ec-8422-4b0f-a0a4-7490cf821231
X-czh/Algorithms-LeetCode
200-299/242-Valid-Anagram.cpp
// Time complexity: O(n). // Space complexity: O(1) extra space. class Solution { public: bool isAnagram(string s, string t) { if (s.size() != t.size()) return false; unordered_map<char, int> m; for (char ch : s) ++m[ch]; for (char ch : t) { if (--m[ch] < 0) ret...
ALGO
0.99997
6.62413
7f0629e3-b52c-45cb-93ef-9acd4cc266ac
aswinikumar0509/Basic-Array
10.cpp
// duplicate #include<bits/stdc++.h> using namespace std; int duplicate(int arr[],int n){ int s = 0; int e = n-1; while(s<e){ for(int i=s;i<e;i++){ if(arr[i]==arr[i-1]){ return arr[i]; } } } } int main(){ int arr[] = {1,1}; int n = sizeof(arr)/...
ALGO
0.998782
3.603839
319e4e29-9632-41dc-b599-8565fc6f029a
zhixuwang/test
samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp
#include <iostream> // Console I/O #include <sstream> // String to number conversion #include <opencv2/core.hpp> // Basic OpenCV structures #include <opencv2/core/utility.hpp> #include <opencv2/imgproc.hpp>// Image processing methods for the CPU #include <opencv2/imgcodecs.hpp...
TOOL
0.933448
5.459361
884f1d20-927a-4c83-9745-21cd14489476
imabhinav-am/Competetive-Programming
he_oddevensubarrays.cpp
/* Author : Abhinav Modified : 22-08-2018 07:04:54 PM */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef map<ll,ll> mllmp; #define faster ios_base::sync_with_stdio(false);cin.tie(0); #define make_pair mp const ll mod = 1e9+7; #define rep(i,j,k) for(ll...
ALGO
0.999991
3.993803
4c025835-2a7a-40d9-8d60-447b16ca6927
Vishal-vb-29/Programming
DSA_Apna_college/8_Arrays/smallest.cpp
// Find smallest/largest in Array #include<Iostream> #include<limits.h> using namespace std; int smallest(int arr[],int sz){ int small = INT_MAX; for(int i=0;i<sz;i++){ if(arr[i]<small) small=arr[i]; // small=min(nums[i],smallest); } return small; } int main(){ int arr[10]; in...
ALGO
0.999279
3.711439
1194d3a1-d2d8-402a-96bb-ade8f574ce3c
sugikazu75/atcoder
submissions/atcoder.jp/arc104/arc104_b/Main.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define all(v) v.begin(), v.end() typedef long long ll; int main(){ int n; string s; cin >> n >> s; vector <vector <int> > table(4,vector<int>(n)); rep(i,4){//4n rep(j,n){ table[...
ALGO
0.999634
4.081059
166e7547-046b-4f61-bcb6-1d82e9d2d4c5
jma02/cpp-compprog
HSSC2023/a.cpp
#include <bits/stdc++.h> using namespace std; void solve(){ long long x, y, n; cin >> x >> y >> n; if(((n-1)*(n))/2 > y - x){ cout << -1 << '\n'; return; } vector<long long> ans; ans.push_back(y); int i = 0; int j = 1; int curr = y; while(i < n-2 && curr > 0){ ...
ALGO
0.999671
4.005352
c7f2e14c-b679-4c64-94e5-0e593088a37c
113bommy/deepmind_codecontests_refine
cpp_source_filter_file/cpp_train_11294_6.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> num(n); for (int i = 0; i < n; i++) cin >> num[i], num[i] += i; sort(num.begin(), num.end()); for (int i = 1; i < n; i++) if (num[i] == num[i - 1]) return cout << ":(", 0; for (int i = 0; i < n; i++) cout << num[i]...
ALGO
0.987312
3.14164
977fb40e-9c6e-4634-aef9-d5570d9440d0
ashutoshpandey15/DSA
Arrays/sort01.cpp
/** * The above code sorts an array of 0s and 1s by moving all the 0s to the left side and all the 1s to * the right side. * * @param arr The array containing the elements to be sorted. * @param n The parameter `n` represents the size of the array `arr`. In this case, `n` is equal to 8. */ #include<iostream> usi...
ALGO
0.999977
4.931441
55861f45-d4d5-4a77-b986-9527d4187fc4
2013612/CP-algorithm
codeforces/2109/2109B.cpp
#include<iostream> using namespace std; int n, m, a, b, ans; int cal(int h, int w) { h--; w--; int res = 0; while (h > 1) { res++; h /= 2; } while (w > 1) { res++; w /= 2; } return res + (h > 0) + (w > 0); } void solve() { scanf("%d %d %d %d", &n, &m, &a, &b); ans = min(cal(n - max(a - 1, n -...
ALGO
0.99932
4.558691
fa1a8e54-f29d-4f6d-8582-39574ab7c77f
SanjanaReddy2005/DAA-Lab
Lab1/q3.cpp
#include <iostream> #include <math.h> #include <fstream> #include <vector> using namespace std; class Graph{ public: int noOfNodes; vector<vector<int> > adjacency_matrix; Graph(int value){ noOfNodes=value; for(int i=0;i<noOfNodes;i++){ vector<int> v(noOfNodes); ...
ALGO
0.999851
3.902592
f0dd0a2f-f739-4955-9dca-7510ced04555
visheshgargavi/mission_faang
Recursion&Backtracking/26_Printing_Subsequences_Whose_Sum_Is_K.cpp
#include<bits/stdc++.h> using namespace std; void solve(int i,int arr[],int &sum,int k,int n,vector<int>&ds) { if(i==n) { if(sum==k) { for(auto it:ds) { cout<<it<<" "; } cout<<endl; } return; } ds.push_back(...
ALGO
0.999988
3.994661
4df5b3b5-8026-416e-b283-00ca136d54a1
GrootTheDeveloper/OLP-ICPC
800+BAI_CODE_HAY/Code/pairs.cpp
#include <bits/stdc++.h> using namespace std; #define int long long int a[200005], lim, n; void solve() { int res = 0; for (int i = 1; i <= n; i++) { for (int j = a[i]; j - i <= n; j += a[i]) { int x = j - i; if (x <= i) continue; res += (a[x] == j / a[i]); } } cout << res << '\n'; } void test() { ...
ALGO
0.999503
3.340729
07b2479c-b525-46d0-b2f9-a22102e3a9a9
AbhJ/some-cp-files-3
codeforces/1613B.cpp
/** * @author : abhj * @created : Wednesday Dec 01, 2021 20:31:09 IST * @filename : b.cpp */ #include "bits/stdc++.h" #define int long long int #define mp make_pair #define pb emplace_back #define F first #define S second using vi = std::vec...
ALGO
0.999765
3.813765
8f7269ad-f400-4561-ad1c-f726122d57d3
yurincmt/Cpp
ch07.Array-vector-exceptions/q4.cpp
#include <iostream> #include <iomanip> #include <array> using namespace std; int main(){ const size_t arraySize{4}; array<array<int, arraySize>, arraySize> twoDim; for(size_t count{1}, row{0}; row<twoDim.size(); ++row){ for(size_t column{0}; column<twoDim[row].size(); ++column){ twoD...
ALGO
0.905579
3.910413
1a052859-6ee6-4476-b6ef-7227de3532bc
amitskadam02/DSA
SearchingandSortingLevel3_6.cpp
// Find odd occurance using binary search #include <iostream> using namespace std; int findoddoccuringno(int arr[], int n) { int s = 0; int e = n - 1; int mid = s + (e - s) / 2; while (s <= e) { if (s == e) { return s; } if (mid & 1) {//even odd find // odd no if (arr[mid] ==...
ALGO
0.999942
5.090755
f6e0ae3c-ddbc-4bf1-a565-06b0ea8cdfbf
huutrungle2001/OLP_Practice
ICPC2021/Northern/E.cpp
#include <bits/stdc++.h> using namespace std; int char2int(char c) { return c - '0'; } int sumDigit(long long n) { string s = to_string(n); int answer = 0; for (char c : s) { answer += char2int(c); } return answer; } bool isPrime(int n) { if (n < 2) { return false; } ...
ALGO
0.999867
4.638056
b0ceacb2-1c07-4228-8506-24cc7d049986
upesacm/21DaysOfCode-2024
DSA/Advik/Day18/question1.cpp
#include <iostream> #include <map> #include <queue> using namespace std; struct TreeNode { int data; TreeNode* left; TreeNode* right; TreeNode(int val) : data(val), left(nullptr), right(nullptr) {} }; vector<int> topView(TreeNode* root) { if (root == nullptr) return {}; map<int, int> hdNodeMap; ...
ALGO
0.999997
6.438197