uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
228dcc1c-1d56-4971-b84e-fd7fa97105db
shishir2305/CoderArmySheetSolutions
05_Stack/227.cpp
// string manipulation // algorithm -> use stack to check if the top of the stack is same as current element, if yes then pop the stack else push the element in the stack // t.c -> O(n) // s.c -> O(n) #include <bits/stdc++.h> using namespace std; int removeConsecutiveSame(vector<string> v) { stack<string> st; ...
ALGO
0.999849
5.766677
f323c68e-9829-4bd6-9910-808118d85adb
rikuTanide/atcoder_endeavor
abc126/abc126_c.cpp
#include <bits/stdc++.h> #include <cmath> //using namespace boost::multiprecision; using namespace std; typedef long long ll; //typedef unsigned long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < (n); ++i) //#define rep(i, n) for (ll i = 0; i < (n); ++i) //#define sz(x) ll(x.size()) typedef p...
ALGO
0.999142
3.361426
1b0d663d-9bcb-43f7-be45-7dc51827b152
iamabirakash/CPP
CSE 205/UNIT 4/LECTURE 26/DIVU INORDER/INORDER.cpp
// You are using GCC #include <iostream> using namespace std; struct Node { int data; Node* left; Node* right; Node(int v) : data(v), left(nullptr), right(nullptr) {} }; void printInorder(Node* node){ //Type your code here if(node==nullptr){ return; } printInorder(node->left);...
ALGO
0.999987
5.298034
e63a4be6-b147-4bbf-b86b-5608fcd147ae
ydnAkif/Deitel
Chapter_05/exercises/5.29/src/main.cpp
#include <iostream> #include <iomanip> #include <cmath> int main() { double amount{0}; double principal{24.0f}; std::cout << std::fixed << std::setprecision(2); for (double rate{0.05}; rate <= 0.10; rate += 0.01) { std::cout << std::endl << "Interest rate: " ...
TOOL
0.960336
5.218107
546b1271-7805-4548-8b74-5c9ba7c46ea1
YogeshSingh003/Cpp-Codes
Recursion/Power.cpp
#include <iostream> using namespace std; int power(int n, int pow) // O(n) { if (pow == 0) return 1; return n * power(n, pow - 1); } int power2(int n, int pow) // O(log(n)) { if (pow == 0) return 1; int answer = power2(n, pow / 2); if (pow & 1) return n * answer * answer; ...
ALGO
0.999932
5.007978
f6982cd1-427e-4b8c-afa0-f7f6f38f6d53
oldlick/CompetitiveProgramming
atcoder/2 ARC/120/C2.cpp
//ver 8.1 #include <bits/stdc++.h> using namespace std; void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);} using ll = long long; using ld = long double; using vl = vector<ll>; using vd = vector<ld>; using vs = vector<string>; using vb = vector<bool>; using vvl = vector<vector<ll>>; ...
ALGO
0.999897
3.627933
7f2c2806-0674-4fb4-9ae6-2ba10f1bb367
iamarjitgoyal/Leetcode_Practice
0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin...
class Solution { public: int lengthOfLIS(vector<int>& nums) { int n = nums.size(); if (n == 0) { return 0; } vector<int> dp(n, 1); for (int i = 1; i < n; ++i) { for (int j = 0; j < i; ++j) { if (nums[i] > nums[j]) { ...
ALGO
0.999988
6.446932
27cea5b4-a928-48d2-89d1-bc22154c936c
NazmushSakib/C_plus_plus
randomPractice/linearSearch.cpp
#include <bits/stdc++.h> using namespace std; void linearSearch(int n,int arr[],int value) { int position = -1; for(int i=0;i<n;i++) { if(value == arr[i]) { cout<<"The index position is "<<i<<endl; position++; break; } } if(position == -1) { cout<<"Wrong Ent...
ALGO
0.999354
4.272737
19136f15-4ff2-406e-9db9-d619ebd6ca4a
pallak8398/Codeforces
991A.cpp
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,n; cin>>a>>b>>c>>n; if(a==0 && b==0 && c==0 && n==0) { cout<<"-1"<<endl; return 0; } int d=(a+b)-c; if(d<0 || a<c || b<c) { cout<<"-1"<<endl; return 0; } if(n>d) cout<<n-d<<endl; else { cout<<"-1"<<endl; } return 0; }
ALGO
0.999905
3.603578
399e55a1-3fdb-4a98-855c-d0ccb2007b51
alexandru-andronache/adventofcode
2015/day19/main.cpp
#include "file.h" #include "utilities.h" #include "string_util.h" #include <iostream> #include <set> #include <string> namespace aoc2015_day19 { int part_1(std::string_view path) { std::vector<std::string> input = file::readFileAsArrayString(path); std::vector<std::pair<std::string, std::string>> r...
ALGO
0.93205
6.412941
a84a394f-8554-4696-a013-58613a95b760
SterbenDa/NYOJ-Linda
lj/nyoj1007.cpp
#include <iostream> #include <cstdio> #include <string.h> #include <cstdlib> const int mod=1000000007; //const int len=1000000000; //bool book[len]; using namespace std; int main(){ int gcd(int a,int b); int i,n,m,t,sum; /* for(i=2;i<=31623;i++){ if(book[i]==0) for(t=i*i;t<=len;t+=i) book[t]=1; }*/ cin>>t; ...
ALGO
0.999956
4.189141
89f6b983-96bf-4255-abbc-9224937361cf
HamzaMushtaq23/DSA-Assignments
14. Sorting array in Descending order.cpp
#include<iostream> #include<conio.h> using namespace std; int main() { int arr[5]; cout << "Enter the 'Array'" << endl; cout << "\n"; for (int i = 0; i < 5; i++) { cout << "Enter value of " << i + 1 << " : "; cin >> arr[i]; } cout << "\n Values of array are = "; for (int i = 0; i < 5; i++) { cout << arr...
ALGO
0.99965
3.627121
7ebdd2cf-8793-4ea8-af5d-d74cd205ae4a
Harsh1106/CAP--770
bfs.cpp
// BFS: Breadth First Search // It is just a traversal technique // TC: O(V + E) // SC: O(V) #include<iostream> #include<vector> #include<queue> using namespace std; void BFS(vector<vector<int>> &adjList, int start, vector<bool> &visited){ queue<int> q; visited[start] = true; q.push(start); while(!q.e...
ALGO
0.999979
5.500903
14892f5b-7ccf-4120-bf44-a4fc31b6a418
turinig/cs231
Code/CPP/GP-000A-GenericMaxFunctionInCPP/GP-000A-GenericMaxFunctionInCPP.cpp
// GP-000A-GenericMaxFunctionInCPP.cpp // Giuseppe Turini // CS-231 // 2024-05-29 #include <iostream> // For cout stream. #include <string> // For string class. // Generic "max" function, designed to work for all data types. // Note: Type parameter T must include operator ">" (must be overloaded for user-defined ty...
ALGO
0.947907
6.133916
153dd8a7-d30a-46b6-b4ec-a7960723e9c4
samiullah997/DSA
Patterns/StarPattern.cpp
#include <iostream> using namespace std; int main() { int n = 5; for (int i = 1; i <= n; i++) // start 1st loop from 1 to n { for (int j = 1; j <= n - i; j++) // start 2nd loop from 1 to n { cout << " "; // print spaces } for (int j = 1; j <= i; j++) // start 3...
ALGO
0.999976
3.97457
262ea5c3-8210-43b1-9307-32dc28bee87b
NelabCluster/Cluster-DE
Cluster20150816/Cluster/DE.cpp
#include "DE.h" #include "Tool.h" #include "PE_Tool.h" #include "LocalTool.h" #include <cstring> extern string EnergyName; DE_Individual* DE_Individual::Individual(int N) { DE_Individual *obj = (DE_Individual*)malloc(sizeof(DE_Individual)); obj->cood = (double *)malloc(3 * N * sizeof(double)); return obj; } void DE...
ALGO
0.999922
3.628076
302fb91f-e6c1-4ce6-a2a8-557bc764cd3c
sarvex/leetcode-pharo
solution/2500-2599/2580.Count Ways to Group Overlapping Ranges/Solution.cpp
class Solution { public: int countWays(vector<vector<int>>& ranges) { sort(ranges.begin(), ranges.end()); int cnt = 0, mx = -1; for (auto& e : ranges) { cnt += e[0] > mx; mx = max(mx, e[1]); } return qmi(2, cnt, 1e9 + 7); } int qmi(long a, lon...
ALGO
0.999926
6.019855
419d7b2c-5b55-4d65-8320-9fc08af6115c
xiegy1118/opencv
3rdparty/openexr/IlmImf/ImfFastHuf.cpp
#include "ImfFastHuf.h" #include <Iex.h> #include <string.h> #include <assert.h> #include <math.h> #include <vector> OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER // // Adapted from hufUnpackEncTable - // We don't need to reconstruct the code book, just the encoded // lengths for each symbol. From the lengths, we can...
ALGO
0.979236
5.705404
528059e1-1d78-4572-a5ba-d5f9426aa411
AKD-01/DSA-LeetCode
0129-sum-root-to-leaf-numbers/0129-sum-root-to-leaf-numbers.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.99993
6.856673
77facce1-bb7e-4289-bacc-bc9d6389945f
vikasbhalla05/DSA-2023
0. Basics of C++/2. Know Basic Maths/4. gcdORhcf.cpp
int calcGCD(int n, int m){ // Write your code here. int min, max,ans; if(n>m){ min = m; max = n; } else{ min = n; max = m; } while(max%min>0) { int temp = min; min = max%min; max = temp; }; return min; } //
ALGO
0.999849
5.25984
90d4d542-ab81-4ac0-9684-f196e937a12a
S-Mazigh/painless
libs/eigen-3.4.0/bench/bench_gemm.cpp
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out // icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out // Compilation options: // // -DSCALAR=std::complex<double> // -DSCALARA=double or -DSCALARB=double // -DHAVE_BLAS // -DDECOUPLED // #include ...
TOOL
0.884172
5.849003
2ba5b04b-b1cd-4d01-9b7f-eca92eb6cc57
clip968/algorithm
previous/진법_변환.cpp
#include<bits/stdc++.h> using namespace std; int main(){ string s; int num; cin >> s >> num; int result = 0; int val; int n = s.size(); int cnt = 0; for(int i=n-1;i>=0;i--){ if(isdigit(s[i])) val = s[i] - '0'; else{ val = s[i] - 'A' + 10; } re...
ALGO
0.999942
5.125235
82fd17bb-624a-4a6b-adc9-432c85aacb5d
Swapnilr1/Conundrum-2k18
source.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct cities { pair <ll,ll> coordinates; bool visited; double price; }; double distance(cities c1, cities c2) { double dist = sqrt(pow((c1.coordinates.first - c2.coordinates.first), 2) + pow((c1.coordinates.second - c2.coordinates.s...
ALGO
0.99977
3.829681
15de559b-750c-4ac4-8a93-d3d9c35bfe3b
NandiniMehta0603/450
Stacks and Queues/33. Next greater element II.cpp
class Solution { public: vector<int> nextGreaterElements(vector<int>& nums) { stack<int> st; int n=nums.size(); st.push(-1); for(int i=n-1;i>=0;i--){ st.push(nums[i]); } vector<int> ans(n); for(int i=n-1;i>=0;i--){ while(st.size()>1 && ...
ALGO
0.999982
5.778717
2afb0ed2-8360-433d-8400-692546a2a904
imankit1/leetcode
0435-non-overlapping-intervals/0435-non-overlapping-intervals.cpp
class Solution { public: int eraseOverlapIntervals(vector<vector<int>>& inter) { sort(inter.begin(), inter.end(), [](const auto &a, const auto &b){ return a[0]<b[0]; }); int maxii=inter[0][1]; int cnt=0; for(int i=1;i<inter.size();i++){ if(inter[i][0]...
ALGO
0.999928
5.927439
ccfcc451-39f0-4ea9-9bdb-35e1eb9ff044
MjStar24/striverCPsheet
maths/23.cpp
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(k, 0); // Count frequency of each drink type for (int i = 0; i < n; i++) { int val; cin >> val; v[val - 1]++; } // Sort drink typ...
ALGO
0.999983
4.57511
f52e3e36-bdf3-482f-b59f-081a74cdbf48
sarvex/leetcode-boo
solution/0000-0099/0022.Generate Parentheses/Solution.cpp
class Solution { public: vector<string> generateParenthesis(int n) { vector<string> ans; function<void(int, int, string)> dfs = [&](int l, int r, string t) { if (l > n || r > n || l < r) return; if (l == n && r == n) { ans.push_back(t); return;...
ALGO
0.999882
6.942809
f5da2d4a-4e9d-4490-86fd-096f33f9bb32
MISTLab/Intensity_based_LiDAR_SLAM
src/intensity_feature_tracker.cpp
#include "intensity_feature_tracker.h" #include "tic_toc.h" #include <tf2_ros/transform_broadcaster.h> #include <ceres/ceres.h> #include "lidarFeaturePointsFunction.hpp" using namespace intensity_slam; template <typename Derived> static void reduceVector(std::vector<Derived> &v, std::vector<uchar> status) { int j...
ALGO
0.900006
5.001129
d8f9bc63-27ff-4ee9-857d-779df7c1ef24
NaheedRayan/cheat
meetInTheMiddle.cpp
void solve(){ int n; cin >> n; ll t; cin >> t; vector < ll > a(n); for(int i = 0; i < n; i++) cin >> a[i]; int d1 = n / 2; int d2 = n - d1; vector < ll > v; for(int mask = 0; mask < (1 << d2); mask++){ ll s = 0; for(int i = 0; i < d2; i++){ if((1 <<...
ALGO
0.999948
5.683152
87832149-e5fc-465f-ac62-525c42e60b75
ujjujdp/CSES-Problem-Set
Introduction/Increasing Array.cpp
//#include<bits/stdc++.h> #include<iostream> #include<climits> using namespace std; int main() { int n; cin>>n; long long int arr[n]; for(int i=0;i<n;i++) cin>>arr[i]; long long int c=0; long long int x=0; for(int i=1;i<n;i++) { if(arr[i]<arr[i-1]) { ...
ALGO
0.999977
3.471887
b5e385ca-e209-4cd6-aac9-6c9e87f03a19
Sachin5411/Algo-Practice-C-
sumreplacementbinarytree.cpp
#include<iostream> using namespace std; #include<queue> class node{ public: int data; node*left; node*right; node(int d){ data=d; left=NULL; right=NULL; } }; node* buildtree(){ int d; cin>>d; if(d==-1){ return NULL; } node*root=new node(d); root->left=...
ALGO
0.999969
3.72385
94b3bf0f-c527-49d2-a451-0f7775d533f7
SarthakNarang/android_framework_av
media/libstagefright/codecs/amrwb/src/band_pass_6k_7k.cpp
/* ------------------------------------------------------------------------------ Filename: band_pass_6k_7k.cpp Date: 05/08/2004 ------------------------------------------------------------------------------ REVISION HISTORY Description: ---------------------------------------------------------------------...
ALGO
0.999867
5.574719
92c1bf2f-ab66-4ed4-9f7c-9fa662775645
Kim0914/AlgoGYM
JINSEOP/백준_혼자_풀기/자료구조/인사성 밝은 곰곰이.cpp
#include <iostream> #include <string> #include <unordered_map> using namespace std; unordered_map<string, int> name_map; int main() { int tc = 0, prev_size = 0, answer = 0, standard = 0; string name; cin >> tc; for (int i = 0; i < tc; i++) { cin >> name; if (name == "ENTER") { ...
ALGO
0.996851
3.882492
3381e30b-030b-4931-bb7e-36030feb4438
khj878/backjun
백준복습/9086. 문자열.cpp
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> using namespace std; #define R 1004 #define r(i, N) for(int i = 0; i < N; i++) #define rr(i, N) for(int i = 0; i <= N; i++) int T; string S; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin...
ALGO
0.999603
3.370764
6e04df4d-b3eb-410c-a115-f0b7cf1be505
yunzz999/Competitive-Programing
ICPC/Campamento/Preparacion/Number Theory/Odd Divisor/1475A.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool power_of_two(ll n){ while(n!=1){ if(n%2==0){ n=n/2; } else{ return false; } } return true; } int main(){ int t; cin>>t; while(t--){ ll n; cin>>n; ...
ALGO
0.998495
5.631732
fb9b8a59-a08a-4e48-add0-980197091f32
deliangyang/Data-Structure
chapter13/13.11/PostOrder_T.cpp
#include <iostream> #include "BinSTree.h" #include "Stack.h" #include "TreeNode.h" #include "TreeNodeFun.h" using namespace std; template<class T> void Postorder_I(TreeNode<T> * t, void visit(T &item)) { Stack<TreeNode<T> * > stack; TreeNode<T> * child; int state=0, scanOver=0; while(!scanOver) { if(state==0...
ALGO
0.999678
4.280441
372e8644-5742-4227-9f9d-49b20ef13a17
imistyrain/OpenWear
sdm/test_model.cpp
#include <vector> #include <iostream> #include <fstream> #include "mropencv.h" #include "ldmarkmodel.h" using namespace std; using namespace cv; int main() { ldmarkmodel modelt; std::string modelFilePath = "model/roboman-landmark-model.bin"; if(!load_ldmarkmodel(modelFilePath, modelt)){ std::cout ...
TOOL
0.907979
3.810592
468cd80b-3745-402c-b38a-84b50bda44f0
TacticalMeow/CollisionDetectionIGL
igl/random_points_on_mesh.cpp
template <typename DerivedV, typename DerivedF, typename DerivedB, typename DerivedFI> IGL_INLINE void igl::random_points_on_mesh( const int n, const Eigen::PlainObjectBase<DerivedV > & V, const Eigen::PlainObjectBase<DerivedF > & F, Eigen::PlainObjectBase<DerivedB > & B, Eigen::PlainObjectBase<DerivedFI > & ...
ALGO
0.97321
6.334238
e323ed13-ba47-4094-b536-d750be3368be
Dubutoto/grandCpp
c1/2675.cpp
#include <iostream> using namespace std; int main(){ int n; cin >> n; int r; string x; for(int i = 0; i < n; i++){ cin >> r >> x; for(int j = 0; j < x.length(); j++){ for(int k = 0; k < r; k++){ cout << x[j]; } } cout << '...
ALGO
0.999712
3.212615
401cf4d9-88bd-442a-810b-cc1599486751
Djokovic0311/LeetCode
problems/reorganize_string/solution.cpp
class Solution { public: string reorganizeString(string s) { vector<int> charCounts(26, 0); for (char c : s) { charCounts[c - 'a']++; } int maxCount = 0, letter = 0; for (int i = 0; i < charCounts.size(); i++) { if (charCounts[i] > maxCount) { ...
ALGO
0.999959
5.793889
c43ae57c-d807-47b3-8a3e-c1c8b271ce0f
Yash1547/DSA
15-8D1/Q1.cpp
//Write a program to reverse an array or string #include<iostream> using namespace std; int main(){ int n; cin>>n; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; } int start=0,end=n-1; while (start<end){ int temp = arr[start]; arr[start]=arr[end]; arr[end]=te...
ALGO
0.999793
4.838717
26dd2fa3-ea6d-4e40-ba4b-5ce13282a1cf
GeetanshJ/LeetCode_Sol
2215.cpp
#include <iostream> #include <vector> #include <unordered_set> using namespace std; class Solution { public: vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) { vector<vector<int>> res(2); unordered_set<int> set1(nums1.begin(), nums1.end()); unordered_set<int> set2(...
ALGO
0.999757
5.898086
20f2b64c-4bd6-4499-b68b-6e14afe03c18
cyf980906/Slam_test
mylib/back.cpp
// // Created by denghanjun on 2021/12/1. // #include "back.h" #include "g2o_types.h" #include "Feature.h" namespace myslam { myslam::Back::Back() { backend_running_.store(true); backend_thread_ = std::thread(std::bind(&Back::BackendLoop, this)); } void myslam::Back::UpdateMap() { std...
ALGO
0.977223
5.021042
41984f04-98a7-462e-9651-edfc034332c8
ravi2320/LeetCode
day_446_594. Longest Harmonious Subsequence.cpp
/* 594. Longest Harmonious Subsequence avatar Discuss Approach arrow-up Solved Easy Topics premium lock icon Companies We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array nums, return the length of its longest harmonious su...
ALGO
0.999977
6.363194
051907b5-d4a7-44fc-a163-8f439afecf00
Fhall6/SPC_CPP
hallCPP12.cpp
//Frank Hall III //January 18, 2023 © //Project: Chapter 4 Program /*Description: * * Write a program containing the following: Identify the program with your name and class meeting time. * Place a comment, properly indented, before each of the 7 points below. Chapter 5 will add to this program. * 1. Variable Defi...
ALGO
0.992476
3.351102
e5d42975-690c-401e-8729-69d89f2b2d2e
harrylin317/Ray-Tracing-Renderer
libs/glm-0.9.7.2/test/core/core_func_integer_bit_count.cpp
/////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentatio...
ALGO
0.994865
4.93878
91d6b177-79ee-4f11-a1ff-d8e8266ad0db
kirilliliych/Algorithms
3sem/3contest/a-scooter.cpp
#include <cassert> #include <climits> #include <iostream> #include <queue> #include <vector> long long dijkstra(const std::vector<std::vector<std::pair<int, int>>> &transitions, const int start, const int end) { std::vector<long long> min_distances(transitions.size(), INT_MAX); min_distances[start] = 0; st...
ALGO
0.999956
5.291368
1ea9696d-70c9-49ba-ab0d-0a262a0671f4
ishandutta2007/codeforces
icecuber/normal/1409/D.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { ll n, s; cin >> n >> s; ll ans = 0; while (1) { ll sum = 0; for (char c : to_string(n)) sum += c-'0'; if (sum <= s) break; ...
ALGO
0.999751
4.444407
95768041-b41c-45f6-80b4-1aa8b23df249
Soukhya7834/Coding-LeetCode-
103. Binary Tree Zigzag Level Order Traversal.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.999994
6.120763
2523956f-0861-41ef-a2bf-51b34d295e78
Max0409/LeetCode
395.cpp
// // Created by Max on 2019-11-11. // using namespace std; #include <map> #include <string> #include <vector> #include <iostream> int help(string s, int k,int start,int end){ if((end-start+1<k)){ return 0; } vector<int> count(26,0); for(int i=start;i<=end;i++){ count[s[i]-'a']++; ...
ALGO
0.999949
5.274741
13739da9-7665-4aad-a61a-75bc1f7b90ae
0xdomyz/cpp_collection
boost_tute/program_options/multiple_sources.cpp
/* Shows how to use both command line and config file. */ // g++ -I /usr/local/boost_1_82_0 -o multiple_sources multiple_sources.cpp /usr/local/lib/libboost_program_options.a // ./multiple_sources --help // ./multiple_sources -c multiple_sources.cfg // ./multiple_sources --optimization=4 -I foo a.cpp b.cpp // ./multi...
TOOL
0.924425
5.692983
dadd97c3-7a80-4714-a68a-e9801d9974da
GIRICHANDAN125/DSA
DSA all unit/dsa/marrge.cpp
#include<iostream> using namespace std; void mergeArrays(int arr1[], int arr2[], int n1, int n2, int arr3[]) { int i =0, j = 0, k = 0; while (i<n1 && j<n2) { if (arr1[i] <arr2[j]) arr3[k++] = arr1[i++]; else arr3[k++] = arr2[j++]; } while (i < n1) arr3[k++] = arr1[i++]; while (j<n2) arr3[k++] = arr...
ALGO
0.999882
4.496498
15ed9a32-75c7-4e4f-b8cc-50d8fa779e1f
yahaha-a/LeetCode
二叉树/二叉树的层序遍历(递归).cpp
#include <iostream> #include <vector> #include <queue> #include "二叉树定义.cpp" using namespace std; void levelOrder(TreeNode* cur, vector<vector<int>> result, int depth) { if (result.size() == depth) { vector<int> vec; result.push_back(vec); } result[depth].push_back(cur->value); if ...
ALGO
0.999907
5.205725
8082319c-50e2-455a-bc7e-38ef2cb9f3e7
Hajrah32/Data-Structures-And-Algorithms
Sorting/Insertion Sort/Sort In Ascending Order/sortingInAscendingOrder.cpp
#include<iostream> using namespace std; void insertionSort(int arr[],int n); void display(int arr[],int n); int main(){ int arr[]={7,4,8,5,3}; int n=sizeof(arr)/sizeof(arr[0]); insertionSort(arr,n); display(arr,n); return 0; } void insertionSort(int arr[],int n){ for(int i=1; i<n; i++){ ...
ALGO
0.999946
4.877167
441137c3-9d48-48ff-a28a-e9d2fc27c3d0
modlfo/AudioEngine
AudioEngine/JuceLibraryCode/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp
struct AudioThumbnail::MinMaxValue { MinMaxValue() noexcept { values[0] = 0; values[1] = 0; } inline void set (const int8 newMin, const int8 newMax) noexcept { values[0] = newMin; values[1] = newMax; } inline int8 getMinValue() const noexcept { return...
TOOL
0.856482
5.253577
49af8596-03c0-46b9-986d-351c728452f0
Project-Heavens/android_frameworks_av
media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
#include "LVM_Types.h" #include "LVM_Macros.h" #include "LVC_Mixer_Private.h" /************************************************************************/ /* FUNCTION: */ /* LVMixer3_VarSlope_SetTimeConstant */ /* ...
ALGO
0.943077
5.624213
9ca72163-015c-49d0-b2ea-51b7bee7e584
prerak2097/CpPractice
CodeForces/APanoramixPrediction.cpp
#include <iostream> using namespace std; // Function prototype bool isPrime(int n); int main() { int x, y; cin >> x >> y; for (int i = x + 1; i < y; i++) { if (isPrime(i)) { cout << "NO" << endl; return 0; } } if (isPrime(y)) { cout<<"YES"; } ...
ALGO
0.999958
4.701656
a446caae-23bd-400b-bfcd-ff574a3cd55f
tanmay777/DSA-Implementations
Queue/queue_using_array.cpp
#include<iostream> using namespace std; int insert(int arr[],int); int del(int arr[]); void display(int arr[]); const int size=5; int front=-1,rear=-1; int main(){ int arr[size],data; char ch; do{ cout<<"\nEnter your option\n1.Insert\n2.Delete\n3.Display\n0.Exit\n"; cin>>ch; swi...
ALGO
0.998336
4.01917
9e73849e-b491-4839-8300-925538a7a1bb
amityadav23112000/leetcode-solution
0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp
class Solution { public: string reverseWords(string s) { stringstream all(s); string word,ans = ""; while (all >> word) ans = word + " " + ans; return ans.substr(0,ans.length()-1); } };
ALGO
0.999871
5.939677
0018efc5-dc06-435f-a8b8-a55e747868e6
abahnasy/leetcode
lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: bool get_path(TreeNode* root, TreeNode* t, vector<TreeNode*>& path) { if(!root) return...
ALGO
0.999988
6.302055
f082f228-5afe-44d4-8a36-0290b5a0702f
alessblaze/magma
src/zgetrf_nopiv_batched.cpp
/* -- MAGMA (version 2.0) -- Univ. of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver @date @author Azzam Haidar @author Adrien Remy @precisions normal z -> s d c */ #include "magma_internal.h" #include "batched_kernel_param.h" /*********************************...
ALGO
0.999497
6.150834
fc01a81d-eb5b-4450-b431-cfd1aae16e21
bvds/andes
Algebra/src/dopurelin.cpp
/************************************************************************ * dopurelin extracts purely linear equations from the list eqn * * and solves for as many of their variables as possible. Writes * * out to file any fully solved variables, and returns a vector * * of partially solved variables as equatio...
ALGO
0.997986
3.513654
3cdc8fb3-4481-4dfd-9bfd-6a10008bbb1c
ishandutta2007/codeforces
ivan100sic/normal/293/A.cpp
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; char A[2000005],B[2000005]; int prvi,drugi,zajedni,N,i,r1,r2,napotezu; int main(){ scanf("%d%s%s",&N,A+1,B+1); N*=2; for (i=1; i<=N; i++){ if (A[i]=='1' && B[i]=='1') zajedni++; else if (A[i]=='1') prvi++; else ...
ALGO
0.999997
3.945751
f68eeb58-1122-49e7-a4a9-57c5dc5529d6
VishwajitPatil3028/LeetCode
242-valid-anagram/242-valid-anagram.cpp
class Solution { public: bool isAnagram(string s, string t) { unordered_map<char, int>mp; if(s.size() != t.size()) return false; for(int i=0;i<s.size();i++) { char currchar = s[i]; if(mp.find(currchar)!=mp.end()) { mp[cu...
ALGO
0.99999
6.182291
abcb6b96-2b10-46b3-998d-98bcdfb88f32
chitamha/CPlusPlus_HighSchool_Exercises
C++_Va_C/ThayQuang/QuyHoachDong/6_Bai3_XauConChungDaiNhat/bt1.cpp
#include <bits/stdc++.h> #define maxn 105 using namespace std; string s1, s2; int n, m; int F[maxn][maxn]; int main(){ //freopen("LCS.INP", "r", stdin); //freopen("LCS.OUT", "w", stdout); ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin>> s1>> s2; swap(s1, s2); int n=s...
ALGO
0.999994
3.780276
dfbfbf7a-5d6d-4f43-9df5-6f8f28e91789
nereagallego/MSA
Nori2/scenes/assignment-2/p2_800675_801950/src/direct_ems.cpp
NORI_NAMESPACE_BEGIN class DirectEmitterSampling: public Integrator { public: DirectEmitterSampling(const PropertyList& props) { /* No parameters this time */ } Color3f Li(const Scene* scene, Sampler* sampler, const Ray3f& ray) const { Color3f Lo(0.); // Find the surface that is visible in the requested di...
ALGO
0.914393
6.285852
4ecd549f-1243-45a7-a270-f38e7d5f7b66
uuyymilkyl/6Dof-Robotic-Arm-Kinematics
include/3rdParty/eigen-3.4.0/bench/benchGeometry.cpp
#include <iostream> #include <iomanip> #include <Eigen/Core> #include <Eigen/Geometry> #include <bench/BenchTimer.h> using namespace Eigen; using namespace std; #ifndef REPEAT #define REPEAT 1000000 #endif enum func_opt { TV, TMATV, TMATVMAT, }; template <class res, class arg1, class arg2, int opt> stru...
TEST
0.932653
6.062908
51267cfa-8825-4ec1-8f84-2141b5f26b68
adelelwan24/ITI-Intake-44-AI
C++ (OOP)/day7/dynamic-bind-shapes/main.cpp
#include <iostream> using namespace std; class Shape { protected: int dim1; int dim2; public: Shape(){ dim1 = dim2 =1;} Shape(int dim) { dim1 = dim2 =dim;} Shape(int d1, int d2) { dim1 = d1; dim2 = d2; } virtual void print(){cout<<"("<<dim1<<", "<<dim2<<")";} void s...
TOOL
0.958073
4.273317
32efeafb-8579-4701-a09d-b9b685600b01
YifeiNie/Lidar_SLAM
MR_SLAM/LoopDetection/src/fast_gicp/thirdparty/Eigen/bench/spbench/test_sparseLU.cpp
// Small bench routine for Eigen available in Eigen // (C) Desire NUENTSA WAKAM, INRIA #include <iostream> #include <fstream> #include <iomanip> #include <unsupported/Eigen/SparseExtra> #include <Eigen/SparseLU> #include <bench/BenchTimer.h> #ifdef EIGEN_METIS_SUPPORT #include <Eigen/MetisSupport> #endif using namesp...
ALGO
0.99668
4.273294
4abc8ccf-b9f6-4dc5-89f8-67a3e2e75da4
heros/ApocalypseCore5.2.0
dep/recastnavigation/Detour/DetourCommon.cpp
#include <math.h> #include "DetourCommon.h" ////////////////////////////////////////////////////////////////////////////////////////// float dtSqrt(float x) { return sqrtf(x); } void dtClosestPtPointTriangle(float* closest, const float* p, const float* a, const float* b, const float* c) { // Check if P in...
ALGO
0.999825
7.103926
0223dbb3-1332-4798-bb68-36451f97d8d1
Thalesbjp/C-PlusPlus
Exercicios/Estrutura de repetição/Ex7.cpp
/*Escreva um programa que abra um arquivo texto cujo nome será informado pelo usuário e conte o número de caracteres presentes nele. Imprima o número de caracteres na tela sem incluir espaços e fim de linha. Entradas: nome do arquivo Saídas: um valor inteiro que representa o total de caracteres do arquivo sem inclui...
ALGO
0.989409
4.515664
6146dc1b-df73-4933-8f6e-08f25a6fe3fd
znjRoLS/elektrijada
oop/2011/5.cpp
// // Created by rols on 4/6/17. // #include <iostream> using namespace std; class Operate { public: virtual void execute(int data[], int n) = 0; }; class Add : public Operate { int *coef; int n; public: Add() { n = 0; coef = NULL; }; Add(int *d, int no) { n = no; coef = new int[no]...
ALGO
0.999712
3.436163
7ac97724-7dc2-4d93-a813-968f331c1526
sekelj13/CSC3710-Printer-Project
printerType.cpp
#include <iostream> #include <string> #include <cstdlib> #include "simulation.h" #include "queueAsArray.h" using namespace std; /* ======================== printerType ======================== */ printerType::printerType() { status = "free"; printTime = 0; failure = false; maxPaper = 100; } printer...
ALGO
0.935219
4.275708
587a332f-2762-433a-b31e-9ccdef85788f
santi1475/asistenciaML
backend/entrenamientos opencv ruidos/opencv-master/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp
/** * @function generalContours_demo1.cpp * @brief Demo code to find contours in an image * @author OpenCV team */ #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include <iostream> using namespace cv; using namespace std; Mat src_gray; int thresh = 100; RNG rng(12...
ALGO
0.98972
7.319026
fcf89613-af86-415a-b19b-8bb3a4e0cc42
tanvirdheu/LAB
540206-Computer_Graphics_Lab/Question-5/main.cpp
#include <graphics.h> #include <iostream> #include <cmath> using namespace std; void midpointLine(int x1, int y1, int x2, int y2) { int dx = x2 - x1; int dy = y2 - y1; int x = x1; int y = y1; int dx1 = abs(dx); int dy1 = abs(dy); int sx = dx >= 0 ? 1 : -1; int sy = dy >= 0 ? 1 : -1; ...
ALGO
0.996001
4.299222
032dfdc9-9b7f-497f-885d-5475fa63da83
bato3/skype_part3_source
vc_proj/_old/_miracl/miracl/source/crdecode.cpp
#include <iostream> #include <fstream> #include "big.h" #include <cstring> using namespace std; Miracl precision(300,256); void strip(char *name) { /* strip extension off filename */ int i; for (i=0;name[i]!='\0';i++) { if (name[i]!='.') continue; name[i]='\0'; break; } } voi...
ALGO
0.983928
3.743865
f8fd833b-464e-44fa-b2ae-6e54612df825
Project-Flare/frameworks_av
media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
/********************************************************************************** INCLUDE FILES ***********************************************************************************/ #include "LVC_Mixer_Private.h" #include "LVM_Macros.h" #include "ScalarArithmetic.h" void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Priva...
ALGO
0.902854
5.177013
760e73fc-868e-4593-bc7a-e6dda7208b51
mike-ferenduros/ComicTagImporter
unrar/rijndael.cpp
/************************************************************************** * This code is based on Szymon Stefanek AES implementation: * * http://www.esat.kuleuven.ac.be/~rijmen/rijndael/rijndael-cpplib.tar.gz * * * * Dynamic table...
ALGO
0.998621
4.31284
f11a21d6-6b0e-46a0-8b6d-bdbe0c8a6f5c
varun-thota27/Leetcoding
3392-count-subarrays-of-length-three-with-a-condition/3392-count-subarrays-of-length-three-with-a-condition.cpp
class Solution { public: int countSubarrays(vector<int>& v) { int c=0; for(int i=0;i+2<v.size();i++){ if((v[i]+v[i+2])*2==v[i+1]) c++; } return c; } };
ALGO
0.999749
5.618844
a40c7099-aea2-4c47-81b1-0e89fb63255b
eogud7126/algorithm_study
Algorithm/baekjoon/200317_1463(1로만들기).cpp
#include<iostream> using namespace std; #define MAX 1000001 int D[MAX]; int makeOne(int n) { if (n == 1) return 0; if (D[n] > 0) return D[n]; D[n] = makeOne(n-1) + 1; if (n % 2 == 0) { int tmp = makeOne(n / 2) + 1; if (D[n] > tmp) D[n] = tmp; } if (n % 3 == 0) { int tmp = makeOne(n / 3) + 1; if (D[n] >...
ALGO
0.999981
4.726015
e81e6fa8-d014-46c8-b182-edb1b0106aed
dario-santos/Haifa-ICPC-Notebook
CP/SWERC TRAIN 2020/CompleteTheGraph.cpp
#include <bits/stdc++.h> #define int int64_t #define vi vector<int> #define ii pair<int,int> #define vb vector<bool> #define vvi vector<vi> #define vvb vector<vb> #define vii vector<ii> #define vvii vector<vii> #define x first #define y second #define pb push_back #define loop(i,s,e) for(int i=s;i<e;i++) #define loopr(...
ALGO
0.999988
3.404686
b9c8b510-e90a-4b82-a4d6-664cf825ce28
scivislab/Path-Mappings-with-Lookahead
ttk-lookahead/core/vtk/ttkEigenField/ttkEigenField.cpp
#include <ttkEigenField.h> #include <ttkMacros.h> #include <ttkUtils.h> // VTK includes #include <vtkDataSet.h> #include <vtkDoubleArray.h> #include <vtkFloatArray.h> #include <vtkInformation.h> #include <vtkObjectFactory.h> #include <vtkPointData.h> #include <vtkSmartPointer.h> vtkStandardNewMacro(ttkEigenField); t...
DATA
0.904499
5.660063
0309e075-a0c3-48fc-804c-050b7d58b3c9
kushalsng/Leetcode
0219-contains-duplicate-ii/0219-contains-duplicate-ii.cpp
class Solution { public: bool containsNearbyDuplicate(vector<int>& nums, int k) { if(k==0)return false; int n = nums.size(); unordered_set<int> us; for(int i=0;i<min(k,n);i++){ if(us.find(nums[i]) != us.end())return true; else us.insert(nums[i]); } ...
ALGO
0.999889
5.912971
923309c5-9f0b-4906-a32d-990fc81c5c5f
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_7449_9.cpp
#include <bits/stdc++.h> using namespace std; int n, k, x; long long a[200010]; set<pair<long long, int> > st; int main() { int op = 1, pos; long long val; scanf("%d%d%d", &n, &k, &x); for (int i = 1; i <= n; i++) { scanf("%I64d", &a[i]); if (a[i] < 0) op = -op; st.insert(make_pair(abs(a[i]), i)); ...
ALGO
0.999959
3.583071
51f8e082-7dbb-4ecc-9f4c-8b43be958de9
sparshsaxenain/vscodecpp
important/basics/primenumber.cpp
/* #include<iostream> using namespace std; int main() { int n; cin>>n; bool flag=0; for(int i=2;i<n;i++) { if(n%i==0) { flag=1; break; } } if(flag==0) { cout<<"\nprime number"; } else { cout<<"\nnot a prime num...
ALGO
0.999946
4.093974
133f333f-692e-4124-9536-4605fec43db0
Maria-Rayan-V/Flutter_FormC
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.9988
6.76073
96fc491a-61a3-4b42-b9d1-8bcfd0d8edbd
xegabriel/bigNumbers
bigNumbers/valid.cpp
int VerifValid(char s[]) { int ok=1; unsigned int i; for(i=1; i<strlen(s); i++) if(!strchr("0123456789",s[i])) ok=0; if(!strchr("123456789+-",s[0])) ok=0; if(ok) return 1; return 0; }
TOOL
0.883614
3.177888
2107656f-c384-4bdb-9ee6-d635cb52e702
Adarsh-gif-crypt/Echo-Echo
Left Recursion and Left Factoring/code1.cpp
#include <iostream> #include <string> using namespace std; int main() { int n, j, l, i, m; int len[10] = {}; string a, b1, b2, flag; char c; cout << "Enter the Parent Non-Terminal : "; cin >> c; a.push_back(c); b1 += a + "\'->"; b2 += a + "\'\'->"; ; a += "->"; cout << "E...
ALGO
0.999807
3.345566
65865a1f-ce21-4f28-9e55-a0ac00e273d2
Nih1tGupta/Leetcode-GFG
Difficulty: Medium/Directed Graph Cycle/directed-graph-cycle.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: bool help(int node,vector<int>&vis,vector<int>&rec,vector<vector<int>>&adj){ vis[node]=true; rec[node]=true; for(auto &x:adj[node]) { if(rec[...
ALGO
0.999829
6.42118
c67db068-e4fb-40ff-b07d-8264b85e330c
dominhquan12/CTDL
coban/bai13.cpp
#include <iostream> using namespace std; int res[60000],ans[60000],l; int tim(int n){ for(int i=0;i<l;i++) if(n==res[i]) return i; return -1; } bool checkPrime(int n){ while(n!=0){ int a=n%10; if(a!=2 && a!=3 && a!=5 && a!=7) return false; n/=10; } return true; } in...
ALGO
0.99978
3.898551
250f3425-d608-4e86-9fb1-f6f6b8fe95cd
INTr0py/BAA
Test/src/box2D/b2PulleyJoint.cpp
#include <Box2D/Dynamics/Joints/b2PulleyJoint.h> #include <Box2D/Dynamics/b2Body.h> #include <Box2D/Dynamics/b2TimeStep.h> // Pulley: // length1 = norm(p1 - s1) // length2 = norm(p2 - s2) // C0 = (length1 + ratio * length2)_initial // C = C0 - (length1 + ratio * length2) // u1 = (p1 - s1) / norm(p1 - s1) // u2 = (p2 -...
ALGO
0.979024
6.828827
54ed622d-32f9-4a76-b24c-9190ebe222c6
Aditya6688/DSA-Ques
1620-check-if-array-pairs-are-divisible-by-k/1620-check-if-array-pairs-are-divisible-by-k.cpp
class Solution { public: bool canArrange(vector<int>& arr, int k) { unordered_map<int, int> remainder_count; // Count the frequency of each remainder when divided by k for (int num : arr) { int rem = ((num % k) + k) % k; // To handle negative numbers correctly remainder_count[rem]+...
ALGO
0.999918
6.219459
33241dd2-8374-43a8-ad1c-1326917551d0
tlhasami/LeetcodeQuestionSolutions
gcd.cpp
#include<iostream> using namespace std; int mood(int num1,int num2){ while(num2!=0){ int temp=num1%num2; cout<<num1<<" % "<<num2<<" = "<<temp<<endl; num1=num2; num2=temp; if(temp==0){ cout<<"HCF : "; return num1; } } return -1; } int m...
ALGO
0.996637
3.753911
a617b414-de69-4960-ad78-96a376a84f89
TurtleZhong/leetcode
sort/mergeSort.cpp
// // Created by m on 8/9/18. // #include <iostream> using namespace std; void merge(int *a, int low, int mid, int high, int *tmp) { int i,j,k; i = low; j = mid + 1; k = 0; while(i <= mid && j <= high) { if(a[i] < a[j]) tmp[k++] = a[i++]; else tmp[k++] ...
ALGO
0.999967
4.784439
21913421-f84d-4e50-9482-4376b04c103b
lock3/meta
libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
// Older compilers don't support std::is_constant_evaluated // UNSUPPORTED: clang-4, clang-5, clang-6, clang-7, clang-8 // UNSUPPORTED: apple-clang-9, apple-clang-10 // <algorithm> // template<InputIterator InIter1, InputIterator InIter2, typename OutIter> // requires OutputIterator<OutIter, InIter1::reference> // ...
TEST
0.99584
7.518299
5d89dd53-4929-44cd-aaee-c3fb9cc8757e
ishandutta2007/codeforces
dmga44/normal/1340/C.cpp
#include <bits/stdc++.h> #define db(x) cout << (x) << '\n'; #define all(v) (v).begin(),(v).end() #define allr(v) (v).rbegin(),(v).rend() using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pii; typedef pair<double,ll> pdi; typedef pair<string,ll> psi; typedef pair<ll,string> pls; type...
ALGO
0.999986
3.435358
4d70e483-70be-41d2-96b9-3b216aa51254
lKryml/Algorithms
Sorting.cpp
#include <iostream> #include <vector> using namespace std; void solve(){ long long n; cin >> n; vector<int> arr; for(int i = 0;i<n;i++){ int element; cin >> element; arr.push_back(element); } for(int i = 0;i<n-1;i++){ for(int j = i+1;j<...
ALGO
0.999986
4.447134
e2b07fdf-d7e2-497b-942d-450bb5b973f6
jsnicholson/advent-of-code
aoc_2022/src/day1/Day1.cpp
#include "day1.h" #include <algorithm> #include <numeric> void Day1::Parse() { // parse input to a vector<int> for each elf (each set of calories) std::vector<int> calories = {}; for (std::vector<std::string>::iterator it = data.begin(); it != data.end(); it++) { if (it->empty()) { m_c...
ALGO
0.992745
4.949259
766a0df2-b9bf-4c94-a6af-cd7219376d3d
mejibyte/competitive_programming
UVa/10019 - Funny encryption method/10019.cpp
#include <stdio.h> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int casos; scanf("%d", &casos); while (casos--){ int x1, x2, temp, temp2; scanf("%x",&x2); //<---- read number in hexdecimal system(i.e. 265) //en x2 queda en hexadecimal, ahora converti...
ALGO
0.99876
3.742142
ca7b6f8f-2209-43dd-9ce6-4fb2980b50be
fanwu91/leetcode
solutions/0011_container_with_most_water.cpp
#include <vector> using namespace std; class Solution { public: int max_area(const vector<int>& height) { int result = 0, n = height.size(); int l = 0, r = n - 1; while (l < r) { int w = r - l; int h = min(height[l], height[r]); if (w * h > result) { ...
ALGO
0.999914
6.736778