uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
60b1c167-7870-44a0-b905-983e3d2764f6
GAarushi123/DSA
c++/pattern programs/12hollowinvertedpyramid.cpp
#include<iostream> using namespace std; int main(){ int n ; cout<<"Enter the value of n:"; cin>>n; for(int row=0;row<n;row++) { for(int col=0;col<row;col++) { cout<<" "; } for(int col=0;col<n-row;col++) { if(col==0||col==n-row-1) ...
ALGO
0.999618
3.287719
ced44c75-5597-4a35-94cc-022ba51bae07
apple/turicreate
src/toolkits/feature_engineering/word_trimmer.cpp
#include <vector> #include <string> #include <model_server/lib/toolkit_class_macros.hpp> #include <model_server/lib/variant_deep_serialize.hpp> #include <toolkits/feature_engineering/transform_utils.hpp> #include <toolkits/feature_engineering/word_trimmer.hpp> #include <toolkits/feature_engineering/topk_indexer.hpp> ...
DATA
0.905997
7.213933
a30922d2-dba5-45c0-a0b5-f0db9596c48f
WangX0111/op_fusion
mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
#include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/GPU/Passes.h" #include "mlir/Dialect/MemRef/IR/MemRef.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/BlockAndValueMapping.h" #include "mlir/IR/Builders.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Pass/Pass.h" using namespace mli...
ALGO
0.983473
7.818539
5c8b038d-2b8d-4469-84da-12372ac27f9c
ishandutta2007/codeforces
alexandra_udristoiu/normal/1286/D.cpp
#include<iostream> #include<algorithm> #include<cstdio> #define DIM 100005 #define mod 998244353 using namespace std; int n, i, inv, nr, sol, ii, jj; int v[DIM], x[DIM]; int p[DIM][2], aint[4 * DIM][2][2], a[DIM][2][2]; struct str{ double t; int t2, ind, st0, st1; }; str w[2 * DIM]; int cmp(str a, str b){ r...
ALGO
0.999948
3.479123
16c2ac4b-43ce-4abc-821b-500982b33379
sslab-gatech/juxta
analyzer/libs/z3/src/ast/expr_substitution.cpp
#include"expr_substitution.h" #include"ref_util.h" typedef obj_map<expr, proof*> expr2proof; typedef obj_map<expr, expr_dependency*> expr2expr_dependency; void expr_substitution::init() { if (proofs_enabled()) m_subst_pr = alloc(expr2proof); if (unsat_core_enabled()) m_subst_dep = alloc(expr2...
TOOL
0.912983
5.399078
af795658-d141-4879-bd8e-8c33b1cd81f6
aneeqaf/Quantum-Simulation
QuantumSim/compression/compression/gnuplot-iostream/boost_1_75_0/libs/numeric/ublas/doc/samples/matrix_range_project.cpp
#include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/matrix_proxy.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matrix<double> m (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) ...
ALGO
0.998295
3.857002
02c5321e-a37d-4506-9acd-8ed5556b5390
yash-93/Coding-Practice
Leetcode/Graphs/959. Regions Cut By Slashes.cpp
class DSU { int *parent; public: DSU(int N) { parent = new int[N]; for (int i = 0; i < N; ++i) parent[i] = i; } int find(int x) { if (parent[x] != x) parent[x] = find(parent[x]); return parent[x]; } void unionn(int x, int y) { parent[...
ALGO
0.999565
5.163696
9e82b118-4fbe-4bdb-a875-ea7ec42848d7
changjunpyo/algorithmPS
leetcode/majority-element.cpp
class Solution { public: int majorityElement(vector<int>& nums) { unordered_map<int,int> hash; for (int i=0; i<nums.size(); i++){ if (hash.find(nums[i]) == hash.end()){ hash.insert(make_pair(nums[i],1)); if (hash[nums[i]] > nums.size()/2) ...
ALGO
0.999955
5.520101
9d554955-d296-47fb-8965-f7b19a22ba91
RosaMariaFdez/Arco-Lab
lab4-b1-diegocordero-rosamariafernandez-main/results/task1/matmul_annotated.cpp
#include <cstdlib> #include <iostream> #include <cmath> #include <ctime> #include <omp.h> #include "advisor-annotate.h" using namespace std; int main(); void timestamp(); int main() { #define SIZE 300 auto a = new double[SIZE][SIZE]; double angle; auto b = new double[SIZE][SIZE]; auto c = new double[...
ALGO
0.999197
4.535292
ebff0d9c-a5b1-46d1-9d89-4946b30aa55e
Pavgkel/MPI_p
Example4/Example4e.cpp
#include <stdio.h> #include <stdlib.h> #include <mpi.h> int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); // Get number of processes and check that 4 processes are used int size; MPI_Comm_size(MPI_COMM_WORLD, &size); if (size != 4) { printf("This application is meant to be run...
ALGO
0.949769
3.613549
8d6ae343-b45d-4bd8-9f7b-18d0d5322779
akhilsharmaa/Competitive-Programming
Codeforces-Practice/B_Water_Lily.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define MOD 1000000007 #define vt vector #define pYes cout << "YES" << endl; #define pNo cout << "NO" << endl; // 1199B - Water Lily ACCEPTED :) void solve(){ double H, L; cin >> H >> L; cout << fixed << ...
ALGO
0.999202
3.893408
5f166e24-fa87-4ee4-97cd-0fde04d6ee06
krishnak2002/DSA_CPP
2D Array/Transpose.cpp
#include<iostream> using namespace std; int main() { int m; cout<<"Enter The no of rows : "; cin>>m; int n; cout<<"Enter the no of columns : "; cin>>n; int arr[m][n]; for(int i=0;i<=m-1;i++){ for(int j=0;j<=n-1;j++){ cin>>arr[i][j]; } } cout<<"\n"...
ALGO
0.999845
3.006768
407ee9e8-4af9-4663-b30c-31f114bdd362
littleyu0820/Tiny_STL
My_Project/My_Vector_V2.cpp
#include <iostream> #include <memory> //struct Iterator //We can think iterator as a pointer since it represents the position //{ // // Iterator(int* ptr) :m_ptr(ptr) {} //constructor // // int& operator*() const { return *m_ptr; } //get the value from the pointer // int* operator->() { return m_ptr; } //make the obje...
TOOL
0.875509
3.695724
50369e37-527b-4c1b-ad5b-55bc62b9fbed
ramonjunquera/GlobalEnvironment
ArduinoPlatformio/02_demos/27 M5bala/02_demoLib/Platformio/src/main.cpp
/* Autor: Ramón Junquera Fecha: 20200221 Tema: Librería para M5Bala Objetivo: Demo de librería RoJoM5Bala Material: Módulo M5Bala, M5Stack Fire Descripción: Comprobamos cuánto tiempo tarda en que la velocidad se vuelva constante al aplicar una potencia fija. Aplicamos potencias distintas a las dos...
TOOL
0.897331
5.265103
bf644758-e35d-4cbd-b590-0707cce0d66b
brorae/Algorithm-PS
BOJ/1920.cpp
#include<iostream> #include<vector> #include<algorithm> using namespace std; vector<int> v; int binarySearch(int d) { int s = 0; //시작 int e = v.size() - 1; //끝 int m; while (s <= e) { m = (s + e) / 2; if (v[m] == d) return 1; else if (v[m] > d) e = m - 1; else s = m + ...
ALGO
0.999985
4.892694
3e0e51a3-eb1f-4b43-941c-8953affc7f9b
jatin-kumar09/leetcode-practice-cpp
24. Swap Nodes in Pairs.cpp
/* Runtime:0ms Memory: 7.6MB */ /** * 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 { ...
ALGO
0.999996
5.951238
14aaae4c-a6ab-41a8-8319-30b2230d7125
Zlin0509/Zlin_ACM
_CF/CONTEST/1500-1999/1932/C.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<long long>; using vi = vector<int>; void solve() { int n, m; cin >> n >> m; vi a(n); vl ans(n); for (int i = 0; i < n; i++) cin >> a[i]; string x; cin >> x; int l = 0, r = n - 1; for (int ...
ALGO
0.999964
3.706064
b2289f80-a57c-484a-b2c4-0c2f0fab5d06
niknarra/LeetCode-and-other-solutions
Trees/404_Sum_of_Left_Leaves.cpp
class Solution { public: int sumOfLeftLeaves(TreeNode* root) { if(root == nullptr) return 0; int sum = 0; if((root->left) && (root->left->left == nullptr && root->left->right == nullptr)){ sum += root->left->val; } sum += sumOfLeftLeaves(root->left); s...
ALGO
0.999876
6.391356
f4806125-0007-41dd-acab-0148fc328781
tanmoymondal1312/Dp-problem
Lab assingment 2. 21,04,2023/Problem 4 I.cpp
class Solution { public: long long dp[38]; Solution() { for(int i=1; i<38; i++)dp[i]=-1; dp[0]=0; dp[1]=1; dp[2]=1; } int tribonacci(int n) { for(int i =3; i<=n; i++) dp[i] = dp[i-1] + dp[i-2] + dp[i-3]; return dp[n]; } };
ALGO
0.999983
5.373064
ff9aaa70-0def-42d3-bdd5-62f39883734a
biswass101/Codeforces_solutions
Practice/Ja korchi/Fuctions Problem/J_Average.cpp
#include<bits/stdc++.h> using namespace std; double meanOfArray(vector<double> v, int n) { double sum = 0.0; for(int i = 0; i < n; i++) { sum = sum + v[i]; } return sum/n; } int main() { int n; cin >> n; vector <double> v(n); for(int i = 0; i < n; i++) { cin >> ...
ALGO
0.997159
5.1229
56686447-8b95-4121-b189-ace7dfcc22cd
A-Spiral-Forge/Strivers-SDE-Sheet-Challenge
Stacks-and-Queues/Implement-Stack-Using-Array.cpp
#include <bits/stdc++.h> using namespace std; // Stack class. class Stack { private: vector<int> st; int sz, index; public: // Constructor to initialize the stack. Stack(int capacity) { st.resize(capacity); index = 0; sz = capacity; } // Pushes the given number into t...
ALGO
0.994162
5.182198
9e35f6ed-4ba2-4eb0-bdb9-b792d011c02b
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_6256_3.cpp
#include <bits/stdc++.h> using namespace std; int a[1000005]; int drvo[1000005]; void build(int i, int j, int node) { if (i == j) { drvo[node] = a[i]; return; } int mid = i + (j - i) / 2; build(i, mid, 2 * node + 1); build(mid + 1, j, 2 * node + 2); drvo[node] = min(drvo[2 * node + 1], drvo[2 * node...
ALGO
0.999991
3.676527
7acdcc38-f04a-4c28-b28d-87c958d71d08
DGolgovsky/Unsorted_Practice
unsorted_sources/sqrt.cpp
#include <iostream> unsigned sqrt_cpu_newton(long L) { unsigned rslt = (unsigned) L; long div = L; if (L <= 0) return 0; while (1) { div = (L / div + div) / 2; if (rslt > div) rslt = (unsigned) div; else return rslt; } } /* * The following code is the fast inverse square root implementation from Q...
ALGO
0.999785
4.340997
6cb614e8-504f-4c46-8771-a5ebdb901a25
Ekam3000/CppAndDataStructure2
11_bitmasking/1_DP_Bitmasking/2_minimum_cost_iterative.cpp
#include<bits/stdc++.h> using namespace std; int minCost(int cost[4][4], int n) { int *dp =new int[1<<n]; for(int i=0; i<(1<<n); i++) { dp[i]=INT_MAX; } dp[0]=0; for(int mask=0; mask<((1<<n)-1); mask++) { int temp=mask; // count number of set bits int k=0; ...
ALGO
0.999896
4.597591
403c38db-7dff-42a9-97ee-7b42936c39df
xi-guo-0/leetcode-solutions
cpp/0222-count-complete-tree-nodes.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: int countNodes(TreeNode *root) { int result = 0; TreeNode *cur = root, *prev = nullptr; ...
ALGO
0.999884
6.565943
6440b4f7-57a9-4294-ae3b-aafc60d2116e
Ni1kko/CSGO-Dump
Hacks/Project SorryHack/base/utilities/memory.cpp
// std::setfill, setw #include <iomanip> #include "memory.h" // used: bad patterns logging #include "logging.h" std::uintptr_t MEM::FindPattern(const char* szModuleName, const char* szPattern) { const HMODULE hModule = GetModuleHandle(szModuleName); if (hModule == nullptr) throw std::runtime_error(fmt::format(Xo...
TOOL
0.910454
6.525774
fdfd1bda-fee0-4e1c-b381-bbf21dbd1d63
divyendr/HACKER-RANK-CPP
si-basic-print-multiplication-table/48974354_AC_79ms_0kB.cpp
#include <iostream> using namespace std; void mult(int n,int i) { if (i > 10) { return; } cout<<n<<" * "<<i<<" = "<<n*i<< endl; mult(n,i+1); } int main() { int n; cin>>n; mult(n, 1); return 0; }
ALGO
0.999261
3.706555
1cb78393-ac91-404f-a809-0303989069a8
GustavoAC/Raytracer
src/depthMapIntegrator.cpp
#include "depthMapIntegrator.h" #include "ray.h" #include "surfaceInteraction.h" void DepthMapIntegrator::preprocess(const Scene& scene) { auto w = camera->getWidth(); auto h = camera->getHeight(); for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { SurfaceInteraction si; Ray r1 = camera...
ALGO
0.991486
5.209171
01d8d8f3-4177-4c25-a97f-97242d18d4e9
SunilKumarPradhan/C_Plus_Plus_DSA
15. Tree/17CheckforBalancedBinaryTree.cpp
#include <bits/stdc++.h> using namespace std; struct node { int key; node *left; node *right; node(int k) { key = k; left = right = NULL; } }; int isBalanced(node *root) { if (root == NULL) return 0; int lh = isBalanced(root->left); if (lh == -1) return -1; int r...
ALGO
0.999854
6.092002
22471354-39ef-4b66-8df5-205e94f4e910
jeshwanthc/Path-Planning
src/Eigen-3.3/bench/product_threshold.cpp
#include <iostream> #include <Eigen/Core> #include <bench/BenchTimer.h> using namespace Eigen; using namespace std; #define END 9 template<int S> struct map_size { enum { ret = S }; }; template<> struct map_size<10> { enum { ret = 20 }; }; template<> struct map_size<11> { enum { ret = 50 }; }; template<> struct ...
TOOL
0.952985
5.102006
51013c0f-a2bf-4d8d-8907-df535e697a21
KaterinaOsipenko/Personal-Expenses-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.998859
6.785645
3356faa0-ef37-435d-a1c5-4ea5213679fa
hyunsik-yoon/study
leetcode/src/557_Reverse_Words_in_a_String_III.cpp
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <set> #include <vector> using namespace std; // https://leetcode.com/problems/reverse-words-in-a-string-iii/description/ class Solution { public: string reverseWords(string s) { return method_1(s); } ...
ALGO
0.999927
5.75219
766e7ac9-9c55-4d0e-8943-e5de5ffcd2ce
EvergreenHZ/codes
pat/a1102.cpp
#include <cstdio> #include <utility> #include <cstring> #include <string> #include <queue> #include <iostream> using namespace std; class Node { public: int parent; int id; int left, right; Node(): parent(-1), left(-1), right(-1) {} }; const int MAXN = 11; Node nodes[MAXN]; int N; in...
ALGO
0.999762
4.092369
194dcb8e-55f3-498a-ba5a-dcaf1baba040
ValdemarOrn/Polyhedrus
Polyhedrus.Native/FilterDualSvf.cpp
#include "FilterDualSvf.h" #include "AudioLib/ValueTables.h" #include "AudioLib/Utils.h" #include "AudioLib/Biquad.h" namespace Polyhedrus { FilterDualSvf::FilterDualSvf() { fsinv = 0; samplerate = 0; modulationUpdateRate = 0; Drive = 0; Cutoff = 0; Resonance = 0; CutoffMod = 0; ResonanceMod = 0; D...
TOOL
0.907291
5.547239
9393e141-6656-4fda-904a-f9eb5b61859d
shobhit907/CP-templates
Matrix_class.cpp
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define mod1 998244353ll #define endl "\n" #define inf (ll)1e18+1 using namespace std::chrono; const ll mod=1000000007ll; const ll mod2=mod-1; class Matrix{ public: vector<vector<ll>> mat; int rows,cols; Matrix(ll rows,ll cols){ ...
ALGO
0.999944
4.282006
6de2c466-5542-424c-95d3-95703dcab4ec
colour-science/alshaders
alNoise/alCellNoise.cpp
#include "Remap.h" #include <ai.h> #include <cmath> #include <cstring> AI_SHADER_NODE_EXPORT_METHODS(alCellNoise) enum CellNoiseSpaceEnum { NS_WORLD = 0, NS_OBJECT, NS_PREF, NS_UV }; static const char* cellnoiseSpaceNames[] = { "world", "object", "Pref", "UV", NULL }; enum CellNoiseModeEnum { CN_FEATURES ...
TOOL
0.942262
6.350534
4c7af76a-f05c-41ee-94a5-2e47074cf002
daehee87/fuzzcoin-llvm
libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
// <set> // class multiset // iterator lower_bound(const key_type& k); // const_iterator lower_bound(const key_type& k) const; #include <set> #include <cassert> #include "test_macros.h" #include "min_allocator.h" #include "private_constructor.h" int main(int, char**) { { typedef int V; ty...
TEST
0.969713
4.688297
22a0a812-7d50-4ead-9527-d4357fbe8416
abhiXsliet/Solved-DSA-Problems
Pratice Problems Topic Wise/Backtracking/permutations.cpp
// https://leetcode.com/problems/permutations/ #include <bits/stdc++.h> using namespace std; class Solution { private: // Generating all permutations for an array of size n takes O(n!) time. // TC = O(n! * n) // SC = O(n) recursive-depth void solve(vector<int>nums, vector<vector<int>>& ans, int index...
ALGO
0.999994
6.795519
bfbae83d-9895-42f3-b661-f2a2721d5991
PRADEEPRAWAT55/CPPCode
day-of-the-week.cpp
#include <bits/stdc++.h> using namespace std; int dayofweek(int d, int m, int y) { unordered_map<int, string> map; static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m < 3; return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7; } int main() { ...
ALGO
0.990061
4.075462
6fc8d875-fc18-4931-8b6c-fb8555ac8990
tsengliwei/UCLA-CS-32-HW-4
HW 4/sort.cpp
#include <iostream> #include <algorithm> #include <numeric> // for std::accumulate #include <vector> #include <string> #include <cstdlib> // for std::rand #include <cassert> using namespace std; //======================================================================== // Set this to false to skip the insertion so...
ALGO
0.986559
6.011693
2b3be8eb-9c72-48c1-8dec-6c6a94523322
prashant601/Leetcode-Practice
n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.cpp
/* // Definition for a Node. class Node { public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val, vector<Node*> _children) { val = _val; children = _children; } }; */ class Solution { public: void solve(Node* root, vect...
ALGO
0.99997
5.868978
1c553eee-ffe1-4396-a0c2-27bf736a2fcf
raincross7/code-similarity
codes/train_code/problem248/problem248_24.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <stack> #include <queue> using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<int> t(n+1), x(n+1), y(n+1); t[0] = 0, x[0] = 0, y[0...
ALGO
0.999993
3.836116
91793b7c-ece1-4d2d-9a57-986441ff1480
Ismail-Upal/CP-Trash
Solved Problem/B_AB_Flipping.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define dl double #define endl "\n" #define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int main() { optimize(); ll t; cin>>t; while(t--){ ll n;cin>>n; string s; cin>>s; int i=0,j=i+1; int a...
ALGO
0.999544
4.409156
9eabb0c5-999f-4573-afeb-7e6f3fb0f7a5
lionelfung7/luogu
p1071.cpp
#include <bits/stdc++.h> using namespace std; unordered_map<char,char> dict, r_dict; int main(void){ string cipher, plain, to_be_decrypted; bool failed(false); getline(cin, cipher); getline(cin, plain); getline(cin, to_be_decrypted); for(string::size_type i = 0; i < cipher.size(); i++){ if(!dict[cipher[i]]...
ALGO
0.999966
4.534028
0decc49d-988d-49d8-82be-0113abe913fc
gheorghital75/ProiectDesignPatterns
ProiectDesignPatterns/AlgoritmSortareCrescatoare.cpp
#include <vector> #include "Document.cpp" class AlgoritmSortareCrescatoare { void schimba(Document*& x, Document*& y) { Document* tmp = x; x = y; y = tmp; } bool comparare(Document*& a, Document*& b) { if (a->prioritate > b->prioritate) return true; ...
ALGO
0.999408
5.047609
b2796fe1-80b3-4521-a014-6cf81b017220
hemant-45/Coding-Interview-Questions
Remove-Adjacent-Duplicates-From-String.cpp
// Program to Remove Adjacent Duplicates from String (In-Place) // https://www.techiedelight.com/in-place-remove-all-adjacent-duplicates-from-string/ // https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string/ // "ABBCD" -> "ACD" #include<bits/stdc++.h> using namespace std; /************** METHOD 1 ***...
ALGO
0.999967
6.413539
73f2ecb7-3e44-45c4-9370-d5a3faabf24f
Riki-Coddee/Data-Structure-Algorithm
Binary Tree/leverlOrderTraversal.cpp
#include<iostream> #include<queue> using namespace std; class Node{ public: int data; Node* left; Node* right; Node(int val){ data = val; left = NULL; right = NULL; } }; void printLevelOrder(Node* root){ if(root == NULL){ return; } queue<Node*> q; ...
ALGO
0.999975
4.766797
e49441d9-feab-4dda-ab71-2b80ab44ea3e
ThatColdToast/Mandlebrot
Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp
#include <iostream> #include <sstream> #include <string> #include <filesystem> #include <windows.h> #include <shlwapi.h> #include "BStrHolder.h" #include "ComPtr.h" #include "dte80a.tlh" constexpr int RETRY_INTERVAL_MS = 150; constexpr int TIMEOUT_MS = 10000; // Often a DTE call made to Visual Studio can fail after ...
TOOL
0.939718
6.947423
3ded92ec-7d16-4ec2-be38-fbf85885775c
bin06012001/LEETCODE_HUB
905-sort-array-by-parity/905-sort-array-by-parity.cpp
class Solution { public: vector<int> sortArrayByParity(vector<int>& nums) { vector<int> output; for (auto it = nums.begin(); it != nums.end(); it++) { if((*it) % 2 == 0) output.push_back(*it); } for (auto it = nums.begin(); it != nums.end(); it++) ...
ALGO
0.999962
5.603134
17237fda-21cc-4e2c-af1d-fc7b6e00a7db
pradyumn07/LeetCode
3548-find-the-count-of-good-integers/3548-find-the-count-of-good-integers.cpp
class Solution { public: long long countGoodIntegers(int n, int k) { unordered_set<string> st; long long ans=0; int d=(n+1)/2; int start=pow(10,d-1); int end=pow(10,d)-1; for(int i=start;i<=end;i++){ string left=to_string(i); string full=""; ...
ALGO
0.999611
5.319177
7a80b430-5441-4b2e-aed8-63e4722934dc
DincyJiang/Codes
LeetCode/LeetCode-Algorithm/LeetCode_35_搜索插入位置.cpp
// 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 // 你可以假设数组中无重复元素。 // 示例 1: // 输入: [1,3,5,6], 5 // 输出: 2 // 示例 2: // 输入: [1,3,5,6], 2 // 输出: 1 // 示例 3: // 输入: [1,3,5,6], 7 // 输出: 4 // 示例 4: // 输入: [1,3,5,6], 0 // 输出: 0 #include <vector> using namespace std; // 二分搜索 class Solution { public: i...
ALGO
0.999988
6.295797
a737ff40-2f5d-4f1c-8ccd-58bf4c720bb9
iotresearchunisa/pqc-on-microcontroller
ESP/Saber_Ligh_on_ESP8266/src/Saber/fips202.cpp
/* Il codice implementa un generatore di numeri casuali crittograficamente sicuro (CSPRNG) basato su AES-256. */ /* Based on the public domain implementation in * crypto_hash/keccakc512/simple/ from http://bench.cr.yp.to/supercop.html * by Ronny Van Keer * and the public domain "TweetFips202" implementation * from...
ALGO
0.990497
5.761854
3c13a2e3-7ab7-4a5a-9aac-a12e1ae82eaa
Arghya0802/LeetCode-GFG-Daily-Challenges
Binary Tree & BST/Find Duplicate Subtrees.cpp
// Link: https://leetcode.com/problems/find-duplicate-subtrees/description/ /** * 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(nu...
ALGO
0.999342
6.474756
a709ada4-d2ac-4bc4-8a1f-d6e29f8347f0
devenderpahadia/LeetcodeSolutions
235-lowest-common-ancestor-of-a-binary-search-tree/235-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: TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) { if(root==NU...
ALGO
0.999979
6.109266
844ca20b-f362-440d-8a53-5f6743245c90
danielfms/competitive-programming
lightoj/beginners/1109.cpp
// 1109 - False Ordering // http://www.lightoj.com/volume_showproblem.php?problem=1109 #include <bits/stdc++.h> using namespace std; int divs[1001]; int nums[1001]; void comp(int n){ for(int i=1;i<=n;i++){ if(n%i == 0){ divs[n]+=1; } } } void div(){ for(int i=1;i<1001;i++){ comp(i); } } void order...
ALGO
0.999913
4.430097
5cce40fc-fcaa-499c-9388-2bbebe554d42
NoobCoder2k24/CodeChef-800-1000
Chef_and_SnackDown.cpp
#include <bits/stdc++.h> #include <complex> #include <queue> #include <set> #include <unordered_set> #include <list> #include <chrono> #include <random> #include <iostream> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <map> #include <unordered_map> #include <stack> #include <ioman...
ALGO
0.999509
4.911065
3a6b8d55-dd19-416f-a506-e8d12c97d9f5
xyzyzl/compprog
probs/cf/edu77/d.cpp
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; #define MAXN 200005 #define FOR(i, n) for (int i = 0; i < n; i++) #define FORR(j, i, n) for (int i = j; i < n; i++) #define FORD(i, n) for (int i = n - 1; i >= 0; i--) #define FOBIR(i, n) for (int i = 1; i <= n; i++) #define pb push_back #defi...
ALGO
0.999986
3.93682
74eaf70a-2634-4cd7-a876-0407e7020ba4
srivaayush/LeetHub-Practice
78-subsets/78-subsets.cpp
class Solution { private: void helper(vector<int>& nums,int i,int n,vector<int> &sub,vector<vector<int>> &ans){ if(i==n){ if(sub.size()==0) ans.push_back({}); else ans.push_back(sub); return; } //condition to pick su...
ALGO
0.999967
6.17378
ac3e5037-1155-4e8d-97be-9db2647a3af6
jacob3015/algorithm
Reviews/baekjoon_1009.cpp
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { // 테스트 케이스의 개수 T를 입력 받는다. int T; cin >> T; // 답을 저장할 vector를 초기화한다. vector<int> answer(T); for (int& result : answer) { // a와 b를 입력 받는다. int a, b; cin >> a >> b; // b가 4...
ALGO
0.999629
5.714365
e44c7403-d722-455e-a42e-06ccd457fe92
tushar-3549/Problem_Solving
Codeforces/1469B - Red and Blue.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; std::vector<int> arr(n); for(int i = 0; i < n; i++) cin >> arr[i]; int sum1 = 0, mx1 = 0; for(int i = 0; i < n; i++) { sum1 += arr[i]; mx1 = max(mx1, sum1); } //cout << mx1 << endl; ...
ALGO
0.999652
3.304176
72cd2ece-67de-4387-9d2f-c401f9e3858a
TRDizer/CSC417_rigid-body-collision
extern/libigl/tutorial/506_FrameField/main.cpp
#include <igl/avg_edge_length.h> #include <igl/barycenter.h> #include <igl/frame_field_deformer.h> #include <igl/frame_to_cross_field.h> #include <igl/jet.h> #include <igl/local_basis.h> #include <igl/readDMAT.h> #include <igl/readOBJ.h> #include <igl/rotate_vectors.h> #include <igl/copyleft/comiso/nrosy.h> #include <i...
ALGO
0.963133
6.34309
001547a1-88b3-41e1-a6b4-8eec4016e5f1
Jackarain/avpn
third_party/boost/libs/spirit/example/karma/calc2_ast_rpn.cpp
/////////////////////////////////////////////////////////////////////////////// // // A Calculator example demonstrating generation of AST which gets dumped into // a reverse polish notation afterwards. // // [ JDG April 28, 2008 ] // [ HK April 28, 2008 ] // ////////////////////////////////////////////////////////...
ALGO
0.948765
7.703927
e7ef976d-47ae-444e-9d26-864cdc60ed93
ParCIS/Magicube
SpMM/SpMM/spmm_benchmark.cpp
#include <cuda_runtime.h> #include <random> #include <assert.h> #include <math.h> #include <algorithm> #include <stdio.h> #include "include/bm_test_utils.h" #include "include/cuda_spmm.cuh" #include "include/wmma_spmm.cuh" #include "include/cublas_gemm.cuh" #include <fstream> #include <string> #include <cuda_profiler_a...
TOOL
0.967737
4.591267
e4e16a59-2f99-4286-a89c-9febd135a5b6
ThaiMinhNguyen/CPP_PTIT
biendoidayso.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; int a[n+1]; for(int i = 0; i < n;i++){ cin >> a[i]; } int count = 0; int i = 0; int j = n-1; while(i < j){ if(a[i] == a[j]){ i++; j--; } if(a[i] > a[j]){ j--; a[j] = ...
ALGO
0.999775
3.650984
e5ae666f-0b68-41ed-b165-aaa4a6d08f06
vatanaksoytezer/zephyr
rotors_simulator/rotors_control/src/attitude_controller.cpp
#include "rotors_control/attitude_controller.h" AttitudeController::AttitudeController() : gravity_(9.81), mass_(1.56779) { } AttitudeController::~AttitudeController() { } std::shared_ptr<ControllerBase> AttitudeController::Clone() { std::shared_ptr<ControllerBase> controller(new AttitudeController); ...
ALGO
0.957581
6.523511
050ec7f9-691a-49bb-b779-b9307be77d27
5an7y/CPProblemGenerator
Problems/Contest/OMIYUC/2023/Selectivo1/Subsecuencia_de_contrasena/solution/solution.cpp
#include <bits/stdc++.h> using namespace std; string a, b; int N, M; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> a >> b; N = a.size(); M = b.size(); for (int i = 0, j = 0; i < M; i++, j++) { while (j < N && a[j] != b[i]) j++; if (j == N) { cout <...
ALGO
0.99999
4.62166
f9c6499e-127d-45fd-93f9-72d527ccb6dc
mausimus/rvx
include/nfd/nfd_common.cpp
/* Native File Dialog http://www.frogtoss.com/labs */ #include <stdlib.h> #include <assert.h> #include <string.h> #include "nfd_common.h" static char g_errorstr[NFD_MAX_STRLEN] = {0}; /* public routines */ const char *NFD_GetError( void ) { return g_errorstr; } size_t NFD_PathSet_GetCount( const nfdpaths...
TOOL
0.882429
5.663252
8aedaffd-352a-406a-9c09-1d7514251256
king-yyf/cpcode
codeforce/cf/gym/104493/h.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ar2 = array<int, 2>; using ar3 = array<int, 3>; using ar4 = array<int, 4>; #define all(c) (c).begin(), (c).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define f0(e) for(int i = 0; i < (e); ++i) #define f1(e) for...
ALGO
0.999951
4.30071
a3e6c4c2-a90c-408c-a81d-5d6b705f37bf
mcdonaldcm7/Chess
src/check.cpp
#include "../headers/game.h" #include "../headers/pieces.h" // Overload the << operator to print Piece objects std::ostream& operator<<(std::ostream& os, const Piece& piece) { os << "Piece: "; os << "Type: "; switch (piece.getPieceType()) { case KING: os << "King"; break; case QUEEN: o...
ALGO
0.963546
5.085535
6ea0bcb0-7863-4f59-846c-1a4db67a731d
ishandutta2007/codeforces
benq/normal/883/E.cpp
#include <bits/stdc++.h> // #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_stati...
ALGO
0.999974
3.890924
970f8650-382e-4f9b-936a-54844128889e
ftiasch/acm-icpc
hdoj/p5759.cpp
#include <cstdio> #include <cstring> #include <vector> #define foreach(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i) const int N = 300001; int n, q, dfs_count, parent[N], prefer[N], chain[N], head[N], position[N]; unsigned weight[N], count[N], delta[N], multiplier[N][3], size[N], son[N][3],...
ALGO
0.999925
3.778831
08adeb77-0997-4316-9e46-b24302ee8316
ehtesam75/Codeforces-Solutions
Basics/C. Traffic Light.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); #define endl '\n' const int N = 2e5 + 7; int a[N]; void solve(){ int n; cin >> n; char ch; cin >> ch; string s; cin >> s; int first_g = -1, ch_idx = -1, maxi = INT_MIN...
ALGO
0.999282
4.686851
b9b823d8-2e98-446c-95ea-d1b7fa67d4e3
HCY-ASLEEP/llvm-study
libc/src/math/generic/acoshf16.cpp
#include "src/math/acoshf16.h" #include "explogxf.h" #include "hdr/errno_macros.h" #include "hdr/fenv_macros.h" #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/PolyEval.h" #include "src/__support/FPUtil/cast.h" #include "src/__support/FPUtil/except_valu...
ALGO
0.997675
7.396103
22107323-165f-438e-bc60-08789df58146
Muchangi001/tic_tac_toe
src/tictactoe.cpp
#include "../include/tictactoe.hpp" // Global variables definition std::string grid[3][3]; // Game grid std::string symbols[2] = {"O", "X"}; // Symbols for players std::string playerSymbol = ""; // Player's chosen symbol std::string compSymbol = ""; // Computer's symbol std::string winner = ""; // Winner of the game s...
ALGO
0.99296
7.054005
85159d99-becb-4a99-8e8a-9d5dff4e7983
yapatta/ant_book
2/2-5/road_blocks.cpp
#include <iostream> #include <algorithm> #include <queue> #define MAX_N 5005 #define INF 1e9+7 using namespace std; typedef long long ll; typedef pair<int,int> P; typedef struct { int to, cost; } edge; int N, R; vector<edge> G[MAX_N]; // first: 距離 ,second: 点 int dist[MAX_N], dist2[MAX_N]; int dijkstra() { priority...
ALGO
0.999779
3.225144
f5a31fbc-d661-48aa-b8d5-b2e31ce6154e
varshap17/DSA
Trees/left view of a bt.cpp
#include <bits/stdc++.h> using namespace std; // Tree Node struct Node { int data; Node* left; Node* right; }; vector<int> leftView(struct Node *root); // Utility function to create a new Tree Node Node* newNode(int val) { Node* temp = new Node; temp->data = val; temp->left = NULL; temp->...
ALGO
0.999832
6.464094
a7626c03-bfcc-4f48-891e-0c3d3ceb159f
ishandutta2007/codeforces
ttklwxx/normal/1303/C.cpp
#include<iostream> #include<cstdio> #include<cstring> using namespace std; inline int read() { int n=0,f=1,ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { n=n*10+ch-'0'; ch=getchar(); } return n*f; } int ans[27],vis[27]; int lt[27][27],rd[27],cnt; char st...
ALGO
0.999996
3.716621
13b3c3e1-0af4-4ad7-aa1e-d6368b996354
gpsnmeajp/VirtualMotionTracker
eigen-3.3.7/unsupported/doc/examples/MatrixSquareRoot.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); MatrixXd A(2,2); A << cos(pi/3), -sin(pi/3), sin(pi/3), cos(pi/3); std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix square root of A is:...
ALGO
0.999533
3.930508
7d03fdc3-0daa-4cba-ac73-8c2d4e7a7ec0
arifulnoman/Competitive-Programming
B_Rudolf_and_121.cpp
#include<bits/stdc++.h> #define ll long long const int INF = 1e9 + 7; using namespace std; void solve() { int i,j,n; cin >> n; vector<int> v(n); for(i = 0;i < n;i++) { cin >> v[i]; } for(i = 0;i < n - 2;i++) { if(v[i] > 0) { int temp = v[i]; ...
ALGO
0.999869
4.333841
a55d261a-57c0-404b-a8e9-70cacb5df06e
raincross7/code-similarity
codes/train_code/problem205/problem205_264.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int h,w,d; scanf("%d%d%d",&h,&w,&d); for(int i=0;i<h;++i){ for(int j=0;j<w;++j){ int x=i+j,y=i-j+w; bool f=((x/d)%2==0),g=((y/d)%2==0); if(f){ if(g) printf("R"); else printf("Y"); }else{ if(g) printf("G"); else printf("B"); } ...
ALGO
0.996691
3.347726
f2ba3bb4-36cc-498a-b38e-f5a018851e15
wisdompeak/LeetCode
Greedy/442.Find-All-Duplicates-in-an-Array/442.Find-All-Duplicates-in-an-Array_v1.cpp
class Solution { public: vector<int> findDuplicates(vector<int>& nums) { int n = nums.size(); nums.insert(nums.begin(),0); for (int i=1; i<=n; i++) { while (nums[i]!=i && nums[i]<=n && nums[i]!=nums[nums[i]]) swap(nums[i], nums[nums[i]]); } ...
ALGO
0.999945
5.543664
a3dcb0a1-9b01-446d-94b3-0a0bb85ef68e
nitinkaplas123/SDE-SHEET
Binary_Tree/binary_tree_level2/6)diamter_of_tree_543.cpp
Solution 1-: Steps-: 1)Using heights of max(root->left+root->right),max(fun(root->left),fun(root->right)); Code-: Time->O(n^2) Space ->O(1) there is only space using for recursion int height(TreeNode* root) { if(root==NULL) return 0; return 1+max(height(root->left),height(root->right)); } int diam...
ALGO
0.999999
6.60639
1b6638d6-17f1-4bcb-ad6e-5d6afb2db88a
sarvex/leetcode-clisp
solution/1100-1199/1102.Path With Maximum Minimum Value/Solution.cpp
class Solution { public: int maximumMinimumPath(vector<vector<int>>& grid) { int m = grid.size(), n = grid[0].size(); vector<tuple<int, int, int>> q; vector<int> p(m * n); iota(p.begin(), p.end(), 0); for (int i = 0; i < m; ++i) { for (int j = 0; j < n; ++j) { ...
ALGO
0.999995
5.844103
a7effdbe-bc08-495f-8fba-c32caa442ac3
a41s/ProgrammingAdvices.com
DSA_Lev_1/28-SumOddNumbersFrom1ToN.cpp
#include <iostream> // Include iostream for input/output operations. #include <string> // Include string for potential future use. using namespace std; // Use the standard namespace to avoid prefixing std:: to standard functions. // Enum: enOddOrEven // Purpose: Defines two possible classifications for numbers...
ALGO
0.999808
6.447404
401adfaa-09cc-41af-a612-652ba367fe56
Mahesh192210312/CSA0405-Operating-Systems
22.to implement best fit algorithm of memory management..cpp
#include <stdio.h> #include <stdlib.h> #define MAX_MEMORY 100 struct memory_block { int size; int allocated; }; void bestFit(struct memory_block mem[], int n, int process_size) { int i, bestFitIdx = -1; for (i = 0; i < n; i++) { if (!mem[i].allocated && mem[i].size >= process_size) { ...
ALGO
0.99937
5.234341
d64f515e-c682-40e6-ae1c-5efa77c54a2b
remon99/codeforce
B_A_and_B_and_Compilation_Errors.cpp
#include<bits/stdc++.h> using namespace std; #define pys cout<<"YES"<<endl #define pyn cout<<"NO"<<endl #define loop(i,n) for(int i=0;i<n;i++) #define MOD 1000000007 #define pb push_back #define mp make_pair #define nl cout<<endl typedef vector<int> vi; typedef long long ll; void solve(){ int n,a[100005],b[10000...
ALGO
0.999945
3.381355
81de2a64-ae10-400c-a39e-2975437544af
ishandutta2007/codeforces
-is-this-fft-/normal/317/D.cpp
#include <iostream> #include <vector> #include <set> using namespace std; typedef long long ll; const int grundy [] = {0, 1, 2, 1, 4, 3, 2, 1, 5, 6, 2, 1, 8, 7, 5, 9, 8, 7, 3, 4, 7, 4, 2, 1, 10, 9, 3, 6, 11, 12}; int main () { int n; cin >> n; int xr = 0; set<int> inter; for (int i...
ALGO
0.999994
4.210834
b819e2ce-44af-412c-92fa-e9b1dd7eaa71
redwa-n/Data-Structure-with-cpp
Bubble shot/Bubble_Sort.cpp
#include <iostream> using namespace std; void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void bubbleSort(int arr[], int n) { int i, j; for (i = 0; i < n-1; i++) { for (j = 0; j < n-i-1; j++) /// (n-1) - i = n-i-1 { if (arr[j] > arr[j+1]) ...
ALGO
0.999556
5.126581
d59c6a2c-836e-42a4-9404-881f9486ee06
ishandutta2007/codeforces
fastmath/normal/833/B.cpp
#include <iostream> #include <vector> #include <set> #include <map> #include <cmath> #include <random> #include <time.h> #include <algorithm> using namespace std; const int INF = 1e9 + 7; const int MAXN = 5e4; int nxt[MAXN]; int prv[MAXN]; int dp[57][MAXN]; int n; void calc(int k, vector <pair <int, ...
ALGO
0.999979
4.615596
1886afb1-8c0c-476d-9154-6cf082a9a6e2
qingguang/lammps-sph
couple/lammps_quest/lmpqst.cpp
// lmpqst = umbrella driver to couple LAMMPS + Quest // for MD using quantum forces // Syntax: lmpqst Niter in.lammps in.quest // Niter = # of MD iterations // in.lammps = LAMMPS input script // in.quest = Quest input script #include "mpi.h" #include "stdio.h" #include "stdlib.h" #inc...
ALGO
0.895398
5.547382
ad596753-3430-4f72-976c-72b02afcc5d3
itaruf/FinancialTradingSystems
OrderMatchingSystem/order_book.cpp
#include "order_book.h" OrderBook::OrderBook(std::string symbol) : m_symbol(symbol) {} void OrderBook::insert_order(const Order& order) { // Check the side in which we'll insert the order auto& order_set = (order.get_side() == Order::Side::BUY) ? buy_orders : sell_orders; auto pair = order_set.insert(ord...
ALGO
0.905176
5.417516
e19eb859-f7db-41ca-8584-ffee94713e49
CryptoXChan/MenjameLCoin
src/key.cpp
#include <openssl/ecdsa.h> #include <openssl/rand.h> #include <openssl/obj_mac.h> #include "key.h" // anonymous namespace with local implementation code (OpenSSL interaction) namespace { // Generate a private key from just the secret parameter int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key) { int ok =...
TOOL
0.975555
7.523015
3ad4d4ba-e1ab-474d-8162-d145267942a3
DocRAID/boj
5086.cpp
#include<iostream> int main() { while(1){ int a,b; std::cin>>a>>b; if(a==0&&b==0){ break; } if(a%b==0){ std::cout<<"multiple\n"; }else if(b%a==0){ std::cout<<"factor\n"; }else { std::cout<<"neither\n"; } ...
ALGO
0.999907
4.105209
c5c47472-ff83-4297-a00e-e7ad82875566
TCGBench/TCGBench
data/partially_correct_code/partially_correct_code_noip/P1044/80-100_5.cpp
#include<bits/stdc++.h> using namespace std; int c[50][50]; int main() { int n; cin>>n; c[0][0]=1; for(int i=1;i<=2*n;i++) { c[i][0]=1; for(int j=1;j<=i;j++) { c[i][j]=c[i-1][j]+c[i-1][j-1]; } } cout<<c[2*n][n]/(n+1); return 0; }
ALGO
0.999938
3.077629
040a6e98-6676-445a-855a-4625d189d93e
caoleiwuhan/JobDu
41-50/49_StringToInt.cpp
#include <iostream> #include <string> using namespace std; int StringToInt(string str) { if (str.empty()) { throw exception("Invalid Parameter"); } int len = str.length(); if (len == 0) { return 0; } if (len > 10) { throw std::exception("Too Long"); } int ans = 0; int pos = 0; bool bNeg = false; i...
ALGO
0.958066
4.767146
a7450876-2572-4026-87ea-7b8a25e195c5
Rakib1958/DSA
DynamicProgramming/subsetsum.cpp
#include<bits/stdc++.h> using namespace std; bool SubsetSum(vector<int> &arr, int n, int sum, vector<vector<int>> &dp) { if (sum == 0) return true; if (n == 0) return arr[n] == sum; if (dp[n][sum] != -1) return dp[n][sum]; bool notTake = SubsetSum(arr, n-1, sum, dp); bool Take = false; if (sum ...
ALGO
0.999988
5.15818
f6017c49-0317-44c0-a7f5-d12ea14e9155
AntoCardCosta/SFV
freeglut project 3D/PSystem.cpp
#include "PSystem.h" #include <iostream> #include <time.h> PSystem::PSystem() { location.set(0.f, 0.f, 0.f); radius = 1.0f; Vector nSpeed(0.f, -2.f, 0.f); speed = nSpeed; setup(nSpeed); np = 5; gravity = false; debug = false; } PSystem::~PSystem() { for (int i = 0; i < sistema.size(); i++) { delete sistema...
TOOL
0.866652
3.885756
f1d1d8ee-d7db-4471-8335-9fea0565afea
DrowYue/LeetCode
src/Convert Sorted Array to Binary Search Tree.cpp
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode *buildBST(vector<int> &num, int sta, int end) { if (sta > end ) return NULL; if (sta == end) ...
ALGO
0.999967
5.891756
63043fc9-92b1-4932-8c62-df804f7674ff
jayesh-685/leetCode
746-min-cost-climbing-stairs/746-min-cost-climbing-stairs.cpp
class Solution { public: int minCostClimbingStairs(vector<int>& cost) { int a=cost[0], b=cost[1], c, n=cost.size(); if (n<3) return min(a, b); for (int i=2; i<n; i++) { c = min(a,b) + cost[i]; a=b; b=c; } return min(c, a);...
ALGO
0.999933
6.057437
c1f7b4ba-a212-486a-be0f-4ddd65123b04
DaAlG/code_studying
code.plus_Algorithm/bruteforce_재귀2/9663_N-Queen(재귀1)_ljy.cpp
/* !!!!!!!!-Ʈŷ!!!!!!! <N-Queen> N*Nũ ü N N ־ , ϴ α׷ ۼϽÿ (Է) ù° ٿ N ־ (1 N < 15) () ù° ٿ N */ #include <iostream> using namespace std; bool a[15][15]; int n; bool check_col[15]; bool check_dig[40]; bool check_dig2[40]; //, Ʒ, 밢⿡ return true bool check(int row, int col) { //ش (column) ִ° i...
ALGO
0.999939
4.950644