uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
253b2082-01e3-4d6d-b794-765b320bfc00
Maserhe/Algorithm_practise
杂题/马走日.cpp
#include<iostream> #include<algorithm> #include<cstring> using namespace std; // 马走日 算法。统计一共有多少种走法。 const int N = 510; bool st[N][N]; int n , m ; int cnt = 0; int dx[8] = { 1 ,2 , 2 , 1, -1 , -2 , -2 , -1 }; int dy[8] = { -2 , -1 , 1 , 2 , 2 ,1 , -1 , -2}; void dfs( int x , int y , int sum){ if(sum == n...
ALGO
0.999059
3.846957
c5de6968-668b-4727-9b0f-412079ea80f9
cmse822/project-4-openmp-intro-team-4
Part_1/matrix_multiplication.cpp
#include <iostream> #include <cstdlib> #include <sys/time.h> #include <fstream> #include <omp.h> using namespace std; float** createMatrix(int rows, int cols) { // "Double" Pointer: Create pointer to memory that stores rows of pointers float** matrix = new float*[rows]; for (int i = 0; i < rows; i++) { ...
ALGO
0.928248
4.585284
8bbdd691-29c8-44f9-81e4-3980b93b64e9
uhdang/leetcode
771_20210615_EASY_CPP_Jewels_and_Stones/main.cpp
#include <iostream> #include <string> #include "Solution.h" using namespace std; int main() { Solution solution; string jewels = "aA"; string stones = "aAAbbbb"; int expected = 3; int output = solution.numJewelsInStones(jewels, stones); // cout << "expected: " + expected << ", output: " + o...
ALGO
0.991565
5.209125
bd6c85de-1bb8-458e-8483-2064b7cf2ea8
prathmesh36/Competitive-Coding
Dynamic Programming/Knapsack/DivisibleGroupSum.cpp
#include <iostream> #include<cstring> using namespace std; int n,q,d,m; long long int nums[205],memo[205][205][15];; int divi(int sum, int i, int cm) { if(cm==m) { if(sum==0) return 1; else return 0; } if(i==n) return 0; if(memo[i][sum][cm] != -1) return memo[i][sum][cm]; return memo[i][sum][cm]=div...
ALGO
0.999272
3.270661
6e8c1db6-873f-47e9-b90d-11ba929ffc0b
ishandutta2007/codeforces
crtsir/normal/278/C.cpp
#include<bits/stdc++.h> using namespace std; int n,m,a,x; vector<int>v[201]; bool vis[201]; void dfs(int s) { for(int i=0;i<v[s].size();i++) if(!vis[v[s][i]]) vis[v[s][i]]=1, dfs(v[s][i]); } int main() { cin>>n>>m; bool can=0; for(int i=0;i<n;i++) { cin>>a; can=(a|can); for(int j=0;j<a;j++) cin>>x...
ALGO
0.999857
3.61824
bd50743b-319e-4f69-b861-b7b33cc8ba11
axellbrendow/aed-ii
Trabalhos Feitos/Projetos de TPs/TP1/Parte1/ArquivoEmC/ArquivoEmC.cpp
/* PUC Minas - Ciencia da Computacao Nome: ArquivoEmC Autor: Axell Brendow Batista Moreira Matricula: 631822 Versao: 1.0 Data: 27/08/2018 */ #include <stdio.h> #include <stdlib.h> #include <string.h> void copyString(const char *string, char **destination) { free(*destination); /...
TOOL
0.920471
3.0132
1310be06-94bf-452f-bc41-18f9a037b174
shiivamkumar027/BOOTCAMP9-jan-feb-
inverteddoublepiramid.cpp
#include<iostream> using namespace std; void piramid(int n){ for(int i=0;i<n;i++) { for(int sp=0;sp<n-i;sp++) { cout<<" "; } for( int j=0;j<i;j++) { cout<<"*"; } for(int k=0;k<=i;k++) { cout<<"*"; } cout<<endl; } } void Invpiramid(int n){ f...
ALGO
0.999887
3.684128
428b0baf-922d-43ab-bc8e-a1b290fca3bf
ishandutta2007/codeforces
yuukakazami/normal/809/D.cpp
#include <bits/stdc++.h> typedef long long ll; typedef double db; #define rep(i,a,n) for (int i=a;i<n;i++) #define mp make_pair #define fi first #define se second #define per(i,a,n) for (int i=int(n)-1;i>=(a);i--) #define pb push_back using namespace std; const int md = int(1e9) + 7; ll mypow(ll a,ll e){ if(e==0) retu...
ALGO
0.999883
3.449474
3846b0fc-d7ac-4635-96a4-c94ccafac2d1
deb8192/DeadlyDanceDeb
OpenGL_Tutoriales/Lighting/FINAL_Lighting/librerias/reactphysics3d/src/collision/broadphase/DynamicAABBTree.cpp
// Libraries #include "DynamicAABBTree.h" #include "BroadPhaseAlgorithm.h" #include "containers/Stack.h" #include "utils/Profiler.h" using namespace reactphysics3d; // Initialization of static variables const int TreeNode::NULL_TREE_NODE = -1; // Constructor DynamicAABBTree::DynamicAABBTree(MemoryAllocator& allocato...
ALGO
0.99905
7.44249
ba54e7dd-e3a8-44bb-ae08-9c48c6ba4c3b
421zuoduan/Project-for-Statistical-Learning
UDL/mmcv/mmcv/ops/csrc/parrots/nms.cpp
Tensor nms_impl(Tensor boxes, Tensor scores, float iou_threshold, int offset) { return DISPATCH_DEVICE_IMPL(nms_impl, boxes, scores, iou_threshold, offset); } Tensor softnms_impl(Tensor boxes, Tensor scores, Tensor dets, float iou_threshold, float sigma, float min_score, int m...
ALGO
0.997397
6.155651
b595697e-0255-4ad6-adb2-28cb387e87d2
Domain-Cmap/assignments-day-1-to-day-9-krrishmittal
Day 5/Very Easy/3.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector<int> findTargetIndices(vector<int>& nums, int target) { sort(nums.begin(), nums.end()); // Sort the array vector<int> result; for (int i = 0; i < nums.size(); i++) { if (nums[i] == target) { result.pu...
ALGO
0.999947
7.093604
6d5fc8d5-1792-493a-bd14-fce25e4eee4a
raincross7/code-similarity
codes/train_code/problem119/problem119_49.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() using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int main() { string s, t; cin >> s >> t; int ans = t.length(); rep(i, s.length()-t.length()+1) ...
ALGO
0.999988
4.351995
bdd2ecc0-d06f-45e1-b750-c35bfebc200b
NVIDIA/libcudacxx
libcxx/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
// template <class charT> // explicit bitset(const charT* str, // typename basic_string<charT>::size_type n = basic_string<charT>::npos, // charT zero = charT('0'), charT one = charT('1')); #include <bitset> #include <cassert> #include <algorithm> // for 'min' and 'max' #inc...
TEST
0.8566
7.626345
b29a76b9-b751-4fae-b761-f3e7a214fac1
sungmen/Solve_Algorithms
LeetCode/1639_Number_of_Ways_to_Form_a_Target_String_Given_a_Dictionary.cpp
class Solution { public: int numWays(vector<string>& words, string target) { int MOD = 1e9 + 7; vector<vector<long long>> v(target.size(), vector<long long>(words[0].size(), 0)); map<char, map<long long, long long>> m; for (int i = 0; i < words.size(); i++) { for ...
ALGO
0.999997
6.181464
c94851bd-9002-463c-ae88-a9b6e0b9bc5f
pokaa3a/LeetCode
problems/0179_Largest_Number.cpp
#include <iostream> #include <vector> #include <string> using namespace std; bool myfunction (int i,int j) { return (to_string(i) + to_string(j) > to_string(j) + to_string(i)); } class Solution { public: string largestNumber(vector<int>& nums) { sort(nums.begin(), nums.end(), myfunction); st...
ALGO
0.999946
6.078528
b0585a5f-0164-414c-a0e0-04ca31b2a67a
tr1ten/DNA
2086D.cpp
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i,a,b) for (int i = (a); i < (b); i++) typedef vector<int> vi; const int MOD = 998244353; int solve(int i,int cur, int x, vi &a,vector<vector<int>> &dp) { if(cur>x) return 0; if(i==a.size()) return cur==x; if(dp[i][cur]!=-1) re...
ALGO
0.999786
4.869905
c49ec46a-ddf1-4a67-bea4-c6c4acd205e9
ishika-patel/Data-Structures
HW1/main.cpp
#include <iostream> #include <fstream> using namespace std; int insertIntoSortedArray(float myArray[], int numEntries, float newValue){ //adding in the new value to the end myArray[numEntries] = newValue; for (int i = 0; i < numEntries; i++) { for (int j = i+1; j< numEntries+1; j++){ i...
ALGO
0.986735
3.887206
af29edaa-a3b9-4fd8-b9e6-5944d758157f
eggag32/Competitive-Programming
Codeforces/Save the Nature.cpp
#define __AVX__ 1 #define __AVX2__ 1 #define __SSE__ 1 #define __SSE2__ 1 #define __SSE2_MATH__ 1 #define __SSE3__ 1 #define __SSE4_1__ 1 #define __SSE4_2__ 1 #define __SSE_MATH__ 1 #define __SSSE3__ 1 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math") #pragma GCC target("sse,sse2,sse3,ssse3,sse4.1...
ALGO
0.999429
3.391368
74adb88a-e37f-4d89-bd08-1630dd87acbc
ishandutta2007/codeforces
kazumin/normal/1392/B.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define int ll #define ld long double #defi...
ALGO
0.999963
3.826156
b0be1ed8-711d-4107-a5df-cb870f59a3f7
haiITne/baitapchuong2
BT trang 15-16.cpp
#include <stdio.h> #include <stdlib.h> // Hàm nhập mảng void nhapMang(int a[], int n) { for (int i = 0; i < n; i++) { printf("Nhap a[%d]: ", i); scanf_s("%d", &a[i]); } } // Hàm xuất mảng void xuatMang(int a[], int n) { for (int i = 0; i < n; i++) { printf("%d ", a[i]); } p...
ALGO
0.999207
4.363182
93deba26-7751-4caf-8e71-009341848514
sarvex/leetcode-boo
solution/2500-2599/2528.Maximize the Minimum Powered City/Solution.cpp
class Solution { public: long long maxPower(vector<int>& stations, int r, int k) { int n = stations.size(); long d[n + 1]; memset(d, 0, sizeof d); for (int i = 0; i < n; ++i) { int left = max(0, i - r), right = min(i + r, n - 1); d[left] += stations[i]; ...
ALGO
0.999962
5.618132
c94cc2a9-e103-48e2-831a-95b62cb1a496
SAgarwal-24/algorithms
slow-fast-pointer/remove-nth-node-from-end-of-list.cpp
#include "slow-fast-pointer.h" /* * Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Follow up: Could you ...
ALGO
0.999458
5.971679
cc92ae8b-ec2c-4b27-8b44-9aee09d9e997
GuiDev115/bachelor_science_comp
Ialg/Lista Avaliativa/02.cpp
//Feito por: GUILHERME FABRICIO BRITO DA ROSA //TURMA: 10A #include <iostream> using namespace std; int main(){ const int primo = 37, M = 15; long hash = 0; int n1, j, i; long hasht = 0; cin >> n1; string palavra[n1]; for(i=0; i < n1; i++) cin >> palavra[i]; for(i=0; i < n1; i+...
ALGO
0.999615
4.060705
ee6c2f70-5bb8-4a7e-99de-4ddf839a6668
aleafall/DS-A
leetcode/lc0290.cpp
// // Created by aleafall on 17-4-28. // #include <iostream> #include <unordered_map> #include <vector> #include <sstream> using namespace std; class Solution { public: bool wordPattern(string pattern, string str) { string now; vector<string> vs; unordered_map<string,char> mp; stringstream ss(str); while ...
ALGO
0.998585
5.42854
4100c51c-c975-41c9-b6c9-ca499338cc07
TAEMBO/cplusplus-assignments
Semester 2 (165)/5.40.cpp
#include <iostream> #include <vector> using namespace std; bool isPalindrome(vector<int> input) { for (int i = 0; i < static_cast<int>(input.size()) / 2; i++) { if (input[i] != input.at(input.size() - i - 1)) return false; } return true; } int main() { int count; int input; vector<int> list...
ALGO
0.999938
5.188715
29b671f0-0abc-482b-878d-9ca20530924a
nishgpt/competitive_programming
codechef/COG2018/COG1805.cpp
/* Author : Nishant Gupta 2.0 */ #include<bits/stdc++.h> #define LL long long int #define pb push_back #define mp make_pair #define MAX 100005 #define MOD 99991 using namespace std; LL c[MAX]; LL f[MAX]; LL dfs(int parent, int node, vector<int> adj[MAX]) { LL candies = 1; for(int i=0;i<adj[node].size();...
ALGO
0.999943
4.144921
a9702847-cadb-4292-b4f9-4c61c3773724
rohan-goyal-1/CP
CodeForces/Contests/Round918/C.cpp
#include <algorithm> #include <array> #include <cassert> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <utility> #include <v...
ALGO
0.999564
4.827771
18dbaca3-5854-44d7-8ef0-a1e6580ea357
BangKartavya/LeetCode
Remove Zero Sum Consecutive Nodes from Linked List/main.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* removeZeroS...
ALGO
0.999806
5.93067
1f7246d3-df01-4bf9-a0f5-6717c7d1bc00
1Vipul-Sharma/DSA
Recursion/av_printSubset.cpp
#include <bits/stdc++.h> using namespace std; // IBH se kara h // wohi socha chote ka sahi answer lekar aa bade current walo ko m smbhal lunga // void subset(string &str, vector<string> &result) { // if (str.length() == 0) { // result.push_back(""); // return; // } // char ch = str.back()...
ALGO
0.999973
5.879111
f4d19409-0651-452b-bebb-bcc71f9fd64d
sampada109/CodeChef_Cpp_Solutions
Bignner_Level/245_AC Please.cpp
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n; cin>>n; if( n > 30 ){ cout<<"YES"; } else{ cout<<"NO"; } }
ALGO
0.999245
3.019228
0d7fec6c-cf07-474d-af99-f84ed5e7014f
MoyuST/CSC4005-Distributed-System
assignment3/codes/MPI_OpenMP/imgui/misc/fonts/binary_to_compressed_c.cpp
// dear imgui // (binary_to_compressed_c.cpp) // Helper tool to turn a file into a C array, if you want to embed font data in your source code. // The data is first compressed with stb_compress() to reduce source code size, // then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i...
TOOL
0.932397
6.603965
2736fa60-f020-4a89-9a9f-8cf6dc12a53e
Icefin/LeetCode
0145-binary-tree-postorder-traversal/0145-binary-tree-postorder-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.999805
6.316853
1f54799e-0b6c-4550-b0c0-24c02acb1e74
benaisc/Picross
Fichiers Test/testSLG.cpp
#include "picross.h" using namespace std; int main(int argc, char** argv) { Picross P =Picross(15,15); int test[15]={1,1,0,0,-1,0,-1,0,0,0,-1,0,0,0,0}; afftableau(test,15); bool b=true; Liste L; L.putFin(3); L.putFin(1); L.putFin(2); L.putFin(2); cout<<L<<endl; Cell *c=L.getPremier(); P.SLG(te...
ALGO
0.982637
3.352939
ba7c28f3-ca55-4f63-9375-b443565bd386
brycemiller2/godot
thirdparty/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
#include "btOptimizedBvh.h" #include "btStridingMeshInterface.h" #include "LinearMath/btAabbUtil2.h" #include "LinearMath/btIDebugDraw.h" btOptimizedBvh::btOptimizedBvh() { } btOptimizedBvh::~btOptimizedBvh() { } void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const b...
ALGO
0.97317
6.780021
6884c186-d473-462e-9b04-28f014b88f18
TheApplePieGod/aoc
aoc2021/Day1/Part1.cpp
#include <iostream> #include "Base.h" #include "Utils.h" int main(char* argv, int argc) { std::vector<int> data = FilesystemUtils::ReadInts("../../../Day1/input.txt"); int count = -1; int prev = 0; for (int elem : data) { if (elem > prev) count++; prev = elem; } std::cout...
ALGO
0.995915
5.317982
5b7eb9c7-ea03-4dec-b8d4-80f5cff26ba3
truthspy/LeetCode
Session2/263_Ugly_Number.cpp
class Solution { public: bool isUgly(int num) { if(num <= 0) return false; while(num % 2 == 0) num = num / 2; while(num % 5 == 0) num = num / 5; while(num % 3 == 0) num = num / 3; return num == 1; } };
ALGO
0.999838
5.982762
5e714130-bf01-42d4-b423-fd2043dccedf
DrZhang818/my-first-project
Problems/Codeforces/Contests/Round1015/C.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef pair<int,int> PII; typedef unsigned long long ull; //https://codeforces.com/contest/2084/problem/C /* 构造 || 贪心 || 模拟 题意: 给定两个长度为n的排列a,b, 你最多可以进行n次操作: op: 选择两个不同下标i,j, 交换a[i]和a[j], b[i]和b[j] 判断能...
ALGO
0.999927
3.706707
b62c31b1-a280-4c99-897b-ae925b3f24be
osirisgothra/boostdoc-qch
libs/geometry/doc/src/examples/algorithms/return_envelope.cpp
// Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example //[return_envelope //` Shows how to return the envelope of a ring #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geomet...
TOOL
0.984532
6.602969
a8fce16b-ea3a-4ad0-b6bd-e7874de050a6
ishandutta2007/codeforces
hir180/normal/917/D.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef pair<ll,P> P1; typedef pair<P,pair<double,double> > P2; typedef pair<pair<double,double>,P> P3; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define mod 1000000007 #def...
ALGO
0.999928
4.003306
7091ea45-2288-4033-af2b-69bcc8a7d128
GunnerJW/Kattis-Solutions
threedigits.cpp
/* C++ solution for the problem Three Digits (https://open.kattis.com/problems/threedigits) Execution time: 0.05 s Submitted on 2020-02-08 22:13:42 Source code extracted automatically by the script https://github.com/GunnerJW/py_utilities/blob/master/kattis_solved_problems_code_extract.py */ #include <iostream> #inclu...
ALGO
0.999853
4.910284
84ae8155-aa78-44c6-9d1e-d28b35831f69
cainingw/gem5_adaptive_routing
src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/promote_extension/datawidth.cpp
/***************************************************************************** datawidth.cpp -- Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 *****************************************************************************/ /**************************************************************************...
ALGO
0.975355
5.759034
b107f762-78a7-461d-b807-491aecccd1d8
JAJAR94/Cpp
Hw6/q1.cpp
#include <iostream> void replace(char *s,char c1, char c2){ char* letter = s; while (*letter!='\0'){ if (*letter == c1){ *letter= c2; } letter++; } } void inverse_numbers(double* v,size_t n){ for(int i=0; i<n;i++){ v[i]*=-1; } } char *encode_hex(const c...
TOOL
0.936593
3.314256
91a98515-4ef1-4816-9db2-e80555c453b8
lxiaoyong/Arithmetic
get_minimum_difference.cpp
// // Created on 2020/10/12. // https://leetcode-cn.com/problems/minimum-absolute-difference-in-bst/ #include <algorithm> struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} }; void pt_dfs(TreeNode* root,int &pre_node_val,int &min_diff...
ALGO
0.999981
6.406934
61b9d20f-c990-4f99-a5e7-cd2bbf93803e
HAsNaaAbdelRahman/LeetCode__Solutions
34. Guess Number Higher or Lower.cpp
/** * Forward declaration of guess API. * @param num your guess * @return -1 if num is higher than the picked number * 1 if num is lower than the picked number * otherwise return 0 * int guess(int num); */ class Solution { public: int guessNumber(int n) { int l = 1 ,...
ALGO
0.999962
5.889162
477fa215-5f8e-436f-9cca-3c25af0da4d7
andres5493/Marlin-2.0.x_Artilery
buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp
#include "pins_arduino.h" #ifdef __cplusplus extern "C" { #endif // Pin number const PinName digitalPin[] = { PA_0, //D0 PA_1, //D1 PA_2, //D2 PA_3, //D3 PA_4, //D4 PA_5, //D5 PA_6, //D6 PA_7, //D7 PA_8, //D8 PA_9, //D9 PA_10, //D10 PA_11, //D11 PA_12, //D12 PA_13, //D13 PA_14,...
CONFIG
0.898856
3.666803
8ee558ab-c9f7-4d30-a126-2331e6523e0f
NehaMittal1616/Leetcode-and-GeeksForGeeks
3056-determine-if-a-cell-is-reachable-at-a-given-time/3056-determine-if-a-cell-is-reachable-at-a-given-time.cpp
#include <set> #include <utility> #include<bits/stdc++.h> class Solution { public: // bool dfs(int currow, int currcol, int fx, int fy, int currtime, int t, std::set<std::pair<int, int>>& visited, int rn[], int cn[]) { // if (currow == fx && currcol == fy && currtime == t) { // return true; ...
ALGO
0.999933
6.050712
e2f4e38f-4e9a-4d17-a3d7-d377a1482c0d
iSuneast/uva-codes-for-acm-icpc
UVa 100 - 9999/558 - Wormholes_0402_graph theory_bellman-ford.cpp
/* 558 - Wormholes bellman-ford.. һʷϵĴ󱯾... */ #include<iostream> #define min(a,b) ((a)<(b))?(a):(b) #define INF 2e9 #define MAXN 2010 using namespace std; int n,m,u[MAXN],v[MAXN],w[MAXN],d[MAXN]; bool bellman_ford() { int i,k; d[0]=0; for(k=0;k<n-1;++k) for(i=0;i<m;++i) d[v[i]]=min(d[v[i]],d[u[i]]+w[i]); ...
ALGO
0.999918
4.199136
6f16ac85-9893-4f24-a40d-02259599bace
zakki/openhsp
hsp3ll/llvm/lib/CodeGen/StackColoring.cpp
#include "llvm/CodeGen/Passes.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SparseSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/ValueTracking.h" #in...
ALGO
0.991226
7.901532
4ccfe2f9-2224-4201-b10b-f0b7b1cba42c
lumb98/PracticeCode
Niuk/HJ2.cpp
#include <iostream> #include <vector> #include <string> #include <unordered_map> using namespace std; int main(void){ string storage; char target; unordered_map<char,int> mp; getline(cin,storage); cin>>target; int count=0; if(target>64) for(char o:storage){ ...
ALGO
0.998697
4.00307
6364ed26-5d59-4c80-9f62-f23a5f135fec
Bitcoin-ABC/bitcoin-abc
src/minerfund.cpp
#include <minerfund.h> #include <blockindex.h> #include <chainparams.h> #include <common/args.h> #include <consensus/activation.h> #include <consensus/amount.h> #include <currencyunit.h> #include <key_io.h> // For DecodeDestination #include <primitives/transaction.h> /** * Percentage of the block reward to be sent t...
TOOL
0.925198
7.283239
2ca65be7-4184-4deb-8e6d-3cd655cefcd0
sgpritam/cbcpp
Hackerrank/Functions.cpp
#include <iostream> #include <cstdio> using namespace std; int max_of_four(int a,int b,int c, int d){ if(a > b){ if(a > c){ if(a>d)return a; else return d; } else { if(c > d)return c; else return d; } } else{ if(b > c)...
ALGO
0.999581
3.950063
8aecb952-076c-4637-9730-1f69a04160e0
Colloportus0/MLIRSmith11
llvm/tools/llvm-mca/CodeRegion.cpp
#include "CodeRegion.h" namespace llvm { namespace mca { bool CodeRegion::isLocInRange(SMLoc Loc) const { if (RangeEnd.isValid() && Loc.getPointer() > RangeEnd.getPointer()) return false; if (RangeStart.isValid() && Loc.getPointer() < RangeStart.getPointer()) return false; return true; } void CodeRegio...
TOOL
0.882582
7.913571
0a13e406-0e2b-4c71-9d3a-bbc58064209c
pcon-jsr/Data-Structures-and-Algorithms-Workshop
Workshop Day 2/Binary Search/Monotonic.cpp
#include <bits/stdc++.h> using namespace std; #define faster cin.tie(0);ios_base::sync_with_stdio(0) #define testcase int tc;cin>>tc;while(tc--) //Function to calculate f(x) ll val(ll a,ll b,ll c,ll x) { return ((a*x*x)+(b*x)+c); } //Binary Search Function ll bs(ll a,ll b,ll c,ll k) { if(val(a,b,c,0)>=k)return...
ALGO
0.999778
3.90204
113403e1-7cf9-458b-849d-524b72b13a87
its-asif/Graph-Theory
Course_Schedule_II_LeetCode.cpp
#include <bits/stdc++.h> bool cyclic = false; class Solution { private: void findIfCyclic(vector< vector<int>>& g, vector<int>& vis, vector<int>& curVis, int x){ vis[x] = 1; curVis[x] = 1; if(cyclic) return; for(auto i : g[x]){ if (curVis[i]) { cyclic = true; return; ...
ALGO
0.99999
6.044762
354d22b1-123e-416a-ba70-ebe2bcddee7c
sids278/Leetcode-Codes
0240-search-a-2d-matrix-ii/0240-search-a-2d-matrix-ii.cpp
class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int target) { int n=matrix.size(); int m=matrix[0].size(); int i=0; int j=m-1; while(i<n && j>=0){ if(matrix[i][j]==target)return true; else if(matrix[i][j]<target)i+=1; ...
ALGO
0.999962
6.193673
7dd79c13-be0c-4b7d-8749-c0dc9e8e261e
Hima0X2/codeforces
349A.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n,i,sobceyegorib=0,motamotigorib=0,people; bool deki=true; cin >> n; for(i=0;i<n;i++){ cin>>people; if(i==0 && (people==50 || people==100)){ deki=false; break; } if(peop...
ALGO
0.999918
3.812654
a37e74c1-57d0-4a24-9809-0254806837d1
abdallamaher/competitive_programming
Adhoc_Problems/Constructive_Algorithms/A_Parliament_of_Berland.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { int n, a, b; cin >> n >> a >> b; if (a * b < n)return cout << -1, 0; vector<vector<int>> g(a, vector<int>(b)); int odd = 1, even = 2; for (int i = 0; i < a; i++) { for (int j = 0; j < b; ...
ALGO
0.998941
4.141044
18363f6e-5064-4f17-9bb4-7e7a8e4b2370
sarvex/leetcode-lua
solution/2000-2099/2050.Parallel Courses III/Solution.cpp
class Solution { public: int minimumTime(int n, vector<vector<int>>& relations, vector<int>& time) { vector<vector<int>> g(n); vector<int> indeg(n); for (auto& e : relations) { int a = e[0] - 1, b = e[1] - 1; g[a].push_back(b); ++indeg[b]; } ...
ALGO
0.999988
6.28793
5341a779-bdcc-4150-b658-a322734fbbee
ShahzadKhichi/Learning-DSA-In-C-plus-plus
Stack/largest_rectangel_area_in_Binary_Matrix.cpp
#include <iostream> #include <stack> #include <vector> using namespace std; vector<int> next(vector<int> v, int n) { vector<int> ans(n); stack<int> s; s.push(-1); for (int i = n - 1; i >= 0; i--) { while (s.top() != -1 && !s.empty() && v[s.top()] >= v[i]) { s.pop(); ...
ALGO
0.999975
5.163633
ac1f7046-45a4-47f5-aece-eb7408375d62
PaleMintBlue/LeetCode
tag_array/768. Max Chunks To Make Sorted II.cpp
/*class Solution { public: int maxChunksToSorted(vector<int>& arr) { std::vector<int> sorted(arr.begin(),arr.end()); std::sort(arr.begin(),arr.end()); int sorted_count = 0; int count = 0; int ret = 0; for(int i = 0; i < arr.size() ; i++) { count +=...
ALGO
0.999973
5.358054
fd64439a-024a-4663-8765-be0559ff92e0
masoudbehzadinasab/Trilinos_12_11
packages/teuchos/numerics/example/DenseMatrix/cxx_main_sym.cpp
#include "Teuchos_SerialSymDenseMatrix.hpp" #include "Teuchos_SerialDenseMatrix.hpp" #include "Teuchos_SerialSpdDenseSolver.hpp" #include "Teuchos_SerialDenseHelpers.hpp" #include "Teuchos_RCP.hpp" #include "Teuchos_Version.hpp" int main(int argc, char* argv[]) { std::cout << Teuchos::Teuchos_Version() << std::endl ...
TEST
0.947032
5.992327
f18e6a97-96e9-45e1-a421-5b512ee12e53
kaloyankoyuv/fmi-projects
Introduction-to-programming-2023-2024/homework-problems/problem3.23.cpp
#include <iostream> void bubbleSort(int *a, int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n-1; j++) { if (a[j] > a[j+1]) { std::swap(a[j], a[j+1]); } } } } int main() { int arr[] = {4, 5, 3, 1, 2}; bubbleSort(arr, 5); for (int i = 0; i < 5; i+...
ALGO
0.999872
5.317185
07211a45-59d1-4d8e-b735-82ae4fbc2d0c
ishandutta2007/codeforces
user202729_/normal/933/B.cpp
#ifndef LOCAL #define NDEBUG 1 #endif #include<bits/stdc++.h> int main(){ std::ios::sync_with_stdio(0);std::cin.tie(0); int64_t p; int k; std::cin>>p>>k; std::vector<int> result; while(p){ auto mod=p%(-k); p/=-k; if(mod<0){ mod+=k; ++p; } result.push_back(mod); } std::cout<<(int)result.size()<<'\n'; for(...
ALGO
0.999953
3.322875
7625e501-6a9c-422f-8255-9517f88922cb
raunakkumarsingh/Cpp_Code
Algorithm/CountingSort_Algorithm.cpp
#include <iostream> using namespace std; int getMax(int a[], int n) { int max = a[0]; for (int i = 1; i < n; i++) { if (a[i] > max) max = a[i]; } // maximum element from the array return max; } // function to perform counting sort void countSort(int a[], int n) { int o...
ALGO
0.999991
5.218606
703a8505-f584-4ff3-8388-7c5a0a6d077d
rafikamindra98/Materi-Coolyeah
Algoritma Pemrograman/Kondisional dengan 3 kasus atau lebih/Tugas/Coding Grade.cpp
//PROGRAM Grade #include <iostream> using namespace std; int main(){ //DEKLARASI int nilai; //ALGORIMA cout<<"Masukkan Nilai: ";cin>>nilai; if (nilai>=80) cout<<"Nilai A"<<endl; else if (nilai>=70) cout<<"Nilai B"<<endl; else if (nilai>=60) cout<<"Nilai C"<<endl; else if(nilai>=50) cout<<"Nilai D"<<endl...
ALGO
0.984043
3.66089
7cc91aea-5814-41d7-9a27-e6c683c802ab
mohsystem/llm-generated-code-c-cpp
tests/gpt4o/Task156/Task156_test.cpp
#include <iostream> #include <sstream> #include <string> using namespace std; class Node { public: int key; Node* left, * right; Node(int item) { key = item; left = right = nullptr; } }; void inorder(Node* node, ostream& out) { if (node == nullptr) return; inorder(no...
TEST
0.99906
7.083539
1626e73e-d82f-4f71-bfa3-e96cfcb2c954
Debasispothal/security
chiper2.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include<stdint.h> using namespace std; int main() { int t; cout<<" CAN GIVE AY TYPE OF INPUT\n"; cout<<"GIVE THE NUMBER OF INPUTS YOU WANT TO GIVE FOR ENCRYPTION\n"; cin>>t; while(t--){ //INITALIZ...
ALGO
0.999757
4.101536
10cdec1d-83dd-4a9a-84c9-60bf6658af01
imilk23/cses
SortingSearching/FactoryMachines.cpp
//g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 #include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #ifdef LOCAL1 fstream input("test_input.txt"); #define cin input #endif void solve(int n){ } int main() { ios::sync_with_stdio(0); cin.tie(0); int ...
ALGO
0.999963
4.74696
c755c0a4-5937-4eec-97f5-3749d6f1e373
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/Gemma/top0-100/count-anagrams-Solution.countAnagrams/177875_Exec_Code_Overflow.cpp
s_aes_process(stream_state * ss, stream_cursor_read * pr, stream_cursor_write * pw, bool last) { stream_aes_state *const state = (stream_aes_state *) ss; const unsigned char *limit; const long in_size = pr->limit - pr->ptr; const long out_size = pw->limit - pw->ptr; unsigned char t...
ALGO
0.994668
6.277038
8090bdfc-5a2a-45d4-b127-ba9a152dce57
vlitas/vlitas
src/addrman.cpp
#include "addrman.h" #include "hash.h" using namespace std; int CAddrInfo::GetTriedBucket(const std::vector<unsigned char> &nKey) const { CDataStream ss1(SER_GETHASH, 0); std::vector<unsigned char> vchKey = GetKey(); ss1 << nKey << vchKey; uint64 hash1 = Hash(ss1.begin(), ss1.end()).Get64(); CDat...
ALGO
0.970691
6.083518
8a7203dc-c141-4786-9019-5a7aaa2aee76
aqfaridi/Competitve-Programming-Codes
SPOJ/SPOJ/PUCMM025.cpp
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int divide[10]; int nodigit[10]; int cnt; void division(string str) { int num,digit,l; l = str.length(); for(int i = 0; i < l; i++) { digit = str[i]-'0'; nodigit[digit] +=...
ALGO
0.999689
3.51478
0f7a6fa3-b3e5-4b3f-bf18-34c896361fbf
Kanha-Dehury-2001/DSA-question-Cpp
binarySearch.cpp
#include <iostream> using namespace std; bool binarySearch(int *arr,int s,int e,int k){ if(s>e){ return false; } int mid = (e+s)/2; if(arr[mid]==k){ return true; } if(arr[mid]<k){ s=mid+1; return binarySearch(arr,s,e,k); } else if(arr[mid]>k){ e=m...
ALGO
0.999647
5.037428
1ce44a17-eb26-4906-8d79-f406b180a47c
YongqianGit/DataStructure_and_Algorithm
FindMinimumInRotatedSortedArray.cpp
// assume no duplicate exists in the array. int findMin(vector<int>& nums) { int sz = nums.size(); int l = 0, r = sz - 1; while (l < r) { int m = l + (r - l) / 2; if (nums[m] < nums[r]) { // right sorted if (m == 0 || nums[m - 1] > nums[m]) { ...
ALGO
0.99999
5.135565
f5d87ae7-d61c-4fb3-b4d7-98ccd50809ed
MohammadYounus68/codeforce
graph.cpp
#include<bits/stdc++.h> using namespace std; int x, y, m, n; int root; int insta, cpc; const int nax = 1e5 + 5; const int inf = 1e9 + 5; vector<int> perr ( nax ), dis (nax ), g [ nax ], pp; vector<bool> vertex ( nax ), in ( nax ); void re_set () { for ( int i = 0 ; i < nax; ++i ) perr [i] = -inf; for ( int i = ...
ALGO
0.999897
4.355971
b8a17f83-7822-4810-bf83-e61d80f9e86e
yuecharlielee/c-
sprout/49(linked_lsit).cpp
#include <bits/stdc++.h> using namespace std; vector<int> boxes[100001]; int ans[100001]; bool inside[100001]; int check(int n) { int sum = 1; for (int i = 0; i < boxes[n].size(); i++) { sum += check(boxes[n][i]); } ans[n] = sum; return sum; } int main() { int t; cin >> t; wh...
ALGO
0.99993
4.385867
b7e50d45-8ca9-4a52-bfd4-1b239f9d0d13
neoVincent/LeetCodePlayground
LC_125_ValidPalindrome/main.cpp
#include <QCoreApplication> #include <string> #include <iostream> #include <vector> #include <iterator> using namespace std; bool isPalindrome(string s) { if (s.length() == 0) return true; char* begin = &s[0]; char* end = &s[s.length()-1]; while(end - begin > 0) { if (isalnum(*begin) && is...
ALGO
0.974059
4.542695
1808c367-7dc8-4287-8090-cb32f3fa9665
raphobt/SU2_OR
SU2_CFD/src/fluid/CSWTable_RESTORED.cpp
#include "../../include/fluid/CSWTable.hpp" // ATTENTION VERIFIER CE QUI EST INITIQLISE DANS IDEALGAS CSWTable::CSWTable() : CIdealGas(std::nan(""), std::nan("")) { // ATTENTION TOUT CA CEST DEFINI POUR LE CO2. ON S'EN SERT JUSTE COMME GUESS VALUES POUR LA TABLE double Tstar = 304.128; doub...
ALGO
0.942872
4.624336
3a2ec8a9-821f-4318-ad1f-3974b08cb648
aipowermeme/aipowermeme-node
src/test/fuzz/system.cpp
#include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> #include <test/fuzz/util.h> #include <util/system.h> #include <cstdint> #include <string> #include <vector> namespace { std::string GetArgumentName(const std::string& name) { size_t idx = name.find('='); if (idx == std::string::npos) { ...
TEST
0.884175
5.879777
b2094199-f2cb-47e3-bffc-fa7a3a6e113c
maxtnkrs/freespace2-apk
freespace2/src/math/spline.cpp
#include "vecmat.h" #include "2d.h" #include "3d.h" #include "alphacolors.h" #include "spline.h" // ------------------------------------------------------------------------------------------------- // SPLINE DEFINES/VARS // // -------------------------------------------------------------------------------------------...
ALGO
0.994335
4.198008
156cb2be-3818-4339-8212-f7aa808e624f
susmoysengupta/online-judge-solutions
Codeforces/1551A-polycarp-and-coins.cpp
/* author: Susmoy Sen Gupta email: <EMAIL> github: github.com/SusmoySenGupta Judge: Codeforces problem no: 1551A problem name: Polycarp and Coins problem link: https://codeforces.com/problemset/problem/1551/A Status: __Solved__ Solved at: Jul/27/2021 20:15 */ #include <iostream> #include <math.h> #define I...
ALGO
0.999659
5.019039
a4b6a5a3-7bd5-44d6-9a46-538c5d97204a
puzzlecollector/Random-Codeforces-Topcoder
euler7.cpp
/* Problem link: https://projecteuler.net/problem=7 From prime counting function π(x) = x/lnx, we know that when x ~ 10^6, we have nearly 80000 prime numbers (78498 to be exact), so let's reasonably loop for about 10^6 times. This algorithm would have time complexity O(1). Now Sieve of eratosthenes again... In th...
ALGO
0.999806
5.00019
714bc35b-3365-4df0-b9fd-14b406a2dc64
mono-1729/AtCoder_cpp
ABC/375/c.cpp
#include <bits/stdc++.h> #include <unordered_map> #include <stdlib.h> #include <boost/multiprecision/cpp_int.hpp> #include <atcoder/all> using namespace atcoder; using namespace boost::multiprecision; using namespace std; #define rep(i, a, n) for(ll i = a; i < n; i++) #define rrep(i, a, n) for(ll i = a; i >= n; i--) #d...
ALGO
0.999997
5.323424
1e497d4b-8725-4313-a35a-e880a1fd0950
gahyun615/cos-practice
3/problem.cpp
#include <iostream> using namespace std; int main (int argc, char *argv[]) { int a{}; int b{}; int result=0; cout << "Enter the first number: "; cin >> a; cout << "Enter the second number: "; cin >> b; if (a<b) { while (a<b+1) { result += a; a++; }...
ALGO
0.923731
3.778201
e879f90e-4e10-41b1-aa2c-5d20ba9a6836
CODEWITH-JAIVY/CPP
codingeven/largestNumber.cpp
/*Find Largest Number Given an array of integers, find the largest number. Example: Input: [10, 5, 8, 20, 3] → Output: 20*/ #include <iostream> #include <vector> using namespace std; int Largest(vector<int> num) { int max = num[0]; for (int i = 1; i < num.size(); i++) { if (num[i] > max) { ...
ALGO
0.999857
6.096793
c0ca4d8a-99de-4ff7-b26b-cf858407194f
TrishaSrivastava002/trisha-leetcode_solutions
1020-number-of-enclaves/1020-number-of-enclaves.cpp
class Solution { void solve(vector<vector<int>>& grid,int i,int j){ int m=grid.size(),n=grid[0].size(); if(i>m-1 || j>n-1 || i<0 || j<0 || grid[i][j]==0) return ; else{ grid[i][j]=0; solve(grid,i+1,j); solve(grid,i,j+1); solve(grid,i-1,j); solve(grid,i,j-1); } } public: in...
ALGO
0.999983
6.259997
25dcb06b-24fc-40ec-be7d-20cee5994781
Viktoria8888/Courses-at-Uni
PracticalAlgorithms/Assignment9/1shortest_path.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 const int N = 100000 + 3; vector<pair<ll,int>> adj[N]; // first elem of the pair is the weight ll dist[N]; void dijkstra(int n,int m) { priority_queue<pair<ll,int>,vector<pair<ll,int>>, greater<>> pq; pq.emplace(0,1); ...
ALGO
0.999833
4.017241
8ec2afbc-bf3a-4e74-b665-fff295da1fdd
czimm203/advent-of-code-21
day4/main.cpp
#include <iostream> #include <fstream> #include <sstream> #include <vector> using namespace std; vector<string> loadData(string file) { string line; vector<string> data; ifstream input (file); while( getline(input, line)) { data.push_back(line); } return data; } vector<int> parseStri...
ALGO
0.996128
5.007447
b4c2462e-320a-4745-a17c-2294474ddd09
rosekamallove/problem-solving
dsa/concepts/4-STL/codebuddy/3-sets.cpp
// print distinct charachters #include <iostream> #include <set> using namespace std; int main() { /* * => set doesn't store duplicate values * => set always stores in sorted order */ set<char> s; int n; cin >> n; char a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); }...
ALGO
0.999058
4.227907
df687840-5a93-43c4-bdaa-3f1ea42e9b26
anyfilatov/ROS-course
3303/Тан Голян/lab3/src/lost_robot.cpp
#include <cstdlib> #include <ctime> #include <ros/ros.h> #include <visualization_msgs/Marker.h> #include <tf/transform_listener.h> using namespace ros; double MinStep = -0.01; double MaxStep = 0.01; double OneDirectionStepsCount = 50; double StepForGoToExit = 0.01; double GenerateStep() { return (MaxStep-MinStep) * ((...
TOOL
0.933346
3.536412
e248c4ba-a2c8-4f2b-8574-c1439686603d
raincross7/code-similarity
codes/train_code/problem076/problem076_142.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using Graph = vector<vector<ll>>; int main(void) { ll n,m; cin >> n >> m; ll a,b; vector<ll> h(n),ma(n,0); for(int i=0;i<n;i++) { cin >> h[i]; } for(int i=0;i<m;i++) { cin >...
ALGO
0.999974
3.735762
db386f22-4a20-4335-96b9-529493967124
ManishBisht777/Data-structures-and-algorithm
array/minimizeHeight.cpp
#include <iostream> #include <algorithm> using namespace std; int minimize(int arr[], int k, int n) { int ans = arr[n - 1] - arr[0]; int small = arr[0] + k; int large = arr[n - 1] - k; for (int i = 0; i < n - 1; i++) { int mn = min(small, arr[i + 1] - k); int mx = max(large, arr[i]...
ALGO
0.999811
4.557218
2c2ae72d-7180-4c10-9b06-2dd9b9809a00
thanhhai0311/DSA_CPP_TRR_CODE_PTIT
saochepteptincmt.cpp
//#include <fstream> //#include <iostream> //#include <string> // //using namespace std; // //int main() { // string line; // ifstream in_file{ "PTIT.in" }; // ofstream out_file{ "PTIT.out" }; // while (in_file >> line){ // out_file << line << endl; // } // in_file.close(); // out_file.close(); // return...
ALGO
0.960423
3.766543
dc5049b2-3fa7-4fd8-9955-fea5e5e6b4df
antoine-chan-lock/PolarInterpolants
CommonLibraries/libigl/include/igl/slice_sorted.cpp
#include <vector> // TODO: Write a version that works for row-major sparse matrices as well. template <typename TX, typename TY, typename DerivedR, typename DerivedC> IGL_INLINE void igl::slice_sorted(const Eigen::SparseMatrix<TX> &X, const Eigen::DenseBase<DerivedR> &R, ...
ALGO
0.999131
5.900146
f2e3cdf0-ca0c-4a16-9544-b1be05dfcf89
jmpu/NoiseScope
Filter/midwt.cpp
#include <math.h> /*#include <malloc.h>*/ #include <stdio.h> #include "mex.h" #include "matrix.h" #include "midwt_r.h" #define max(A,B) (A > B ? A : B) #define min(A,B) (A < B ? A : B) #define even(x) ((x & 1) ? 0 : 1) #define isint(x) ((x - floor(x)) > 0.0 ? 0 : 1) void mexFunction(int nlhs,mxArray *plhs[],int nrhs...
ALGO
0.999733
4.853212
f34cba5c-ce9c-4588-9111-af24980eca2a
Raunak-Kumar7/Leetcode_DSA
BinarySearchTree/99RecoverBST.cpp
// Exactly 2 nodes are swapped // Method 1: Brute Force: Store the Inorder Traversal and sort it and again do the inorder traversal and overwrite where the value is not same void inorder(vector<int> &in, TreeNode *root) { if (root == nullptr) return; inorder(in, root->left); in.push_back(root->val)...
ALGO
0.999998
5.332728
a4d91e77-fba2-4aa0-b63d-db715f71b6f1
ishandutta2007/codeforces
axs7384/normal/1672/B.cpp
#include<bits/stdc++.h> using namespace std; int t; char s[500005]; int main() { scanf("%d",&t); while (t--) { scanf("%s",s); bool b=true; int n=strlen(s); int p=0; for (int i=0;i<n;++i) { if (s[i]=='A') ++p; else --p; if (p<0) b=false; } puts(b&&(s[n-1]=='B')?"YES":"NO"); } re...
ALGO
0.999916
4.663113
82e946ba-06b7-4f3a-a264-440b4b608076
ww-driving/nd013-c6-control-starter
project/pid_controller/eigen-3.3.7/doc/examples/tut_matrix_resize.cpp
#include <iostream> #include <Eigen/Dense> using namespace Eigen; int main() { MatrixXd m(2,5); m.resize(4,3); std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; std::cout << "It has " << m.size() << " coefficients" << std::endl; VectorXd v(2); v.resize(5); ...
ALGO
0.97321
3.882785
96260904-9576-4535-a98b-8c83fb35c218
CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021
joshuaCarpentier/assignments/subsets/lc78/lc78.cpp
// Problem Statement # // Given a set with distinct elements, find all of its distinct subsets. using namespace std; #include <iostream> #include <vector> class Subsets { public: static vector<vector<int>> findSubsets(const vector<int>& nums) { vector<vector<int>> subsets; // TODO: Write your code here ...
ALGO
0.999655
6.458117
daf7d52b-c7c8-42f2-91d5-088b32d73dea
z-prize/2023-entries
prize-1-fpga-gpu-proof/prize-1a-msm/fpga/SuperScalar/SuperScalar_Zprize2023/test_fpga_harness_for_ss/cxx/host/naive_driver/naive_driver.cpp
#include <iostream> #include <vector> #include "bls12_377_g1/bls12_377_g1.h" #include "bls12_377_g1/pippenger.h" #include "bls12_377_g1/rust_types.h" #define SCALAR_NUM_BITS 253 namespace { class ZprizeMsmFpgaDriver { private: std::vector<bls12_377_g1::Xyzt> points; public: ZprizeMsmFpgaDriver(const std::vec...
ALGO
0.989174
5.496307
f5f199bf-a825-4751-bbe0-93d9691a6d21
ssongms/REAL
5eungwon/2/2847.cpp
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int summ = 0; vector<int>box; for (int i = 0; i < n; i++) { //n ŭ Ӻ Է¹ int a; cin >> a; box.push_back(a); } for (int i = box.size() - 2; i >= 0; i--) { // ε -1 ŽϿ i i+1 ۾ -1 while (box[i] >= box[i + 1]) { ...
ALGO
0.99997
4.284976