uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
f92d2938-6db0-4006-96d2-f757597de2a1
mapleclover/DirectX
GameLib/src/08_2DCollision/Reaction5/main.cpp
#include "GameLib/Framework.h" class Square{ public: void set( int x, int y, int halfSize ){ mX = x; mY = y; mHalfSize = halfSize; } bool solvePenetration( const Square& b ){ int al = mX - mHalfSize; //left A int ar = mX + mHalfSize; //right A int bl = b.mX - b.mHalfSize; //left B int br = b.mX + b.mH...
ALGO
0.982819
4.84139
da4b1278-bf69-449e-98bf-6f08e8dde09a
MIPS/external-chromium
third_party/icu/source/common/triedict.cpp
#include "unicode/utypes.h" #if !UCONFIG_NO_BREAK_ITERATION #include "triedict.h" #include "unicode/chariter.h" #include "unicode/uchriter.h" #include "unicode/strenum.h" #include "unicode/uenum.h" #include "unicode/udata.h" #include "cmemory.h" #include "udataswp.h" #include "uvector.h" #include "uvectr32.h" #includ...
TOOL
0.991622
6.128439
c93afe04-9c17-426b-abd4-ce50ac8de2e8
vlad907/algorithms
411/assignment 2/q1/assignment_2_q_1.cpp
// CSCI 411 - Fall 2024 // Assignment 2 Skeleton // Author: Vlad avdeev // Feel free to use all, part, or none of this code for the coding problem on assignment 2. #include <iostream> #include <memory> #include <vector> #include <deque> #include <climits> #include <algorithm> #include <queue> using namespace std; /...
ALGO
0.999962
5.797099
3e848d59-f410-49f0-a621-232a83dcd4ac
Shubham05178/leetcode
74-search-a-2d-matrix/74-search-a-2d-matrix.cpp
/** * Leetcode Problem - https://leetcode.com/problems/search-a-2d-matrix/ * Author - Shubham Nagaria * Date - 30th March 2022 Search a 2D Matrix **/ class Solution { public: bool searchMatrix(vector<vector<int>>& matrix, int target) { int n = matrix.size(), m = matrix[0].size(); int i = 0, j = m - ...
ALGO
0.99998
6.470581
75ea5214-1066-4863-992d-288e56bdbf66
yash2723/Codechef
Starters 59 Division 2 (Rated)/Alternative_Sufferings.cpp
#include <bits/stdc++.h> using namespace std; #define PI 3.141592653589793 #define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define ll long long #define vi vector <ll> #define vll vector < ll > #define pb push_back #define endl '\n' #define max3(a,b,c) max(max(a,b),c) #define min3(a,b,c) min(min(a,...
ALGO
0.999995
3.757445
33474a07-8fe4-4832-b434-49cb61afadbc
Corycle/OI-Codes
Bashu OnlineJudge/5695.cpp
/*====Corycle====*/ #include<algorithm> #include<iostream> #include<iomanip> #include<cstring> #include<cstdlib> #include<complex> #include<cstdio> #include<vector> #include<cmath> #include<ctime> #include<stack> #include<queue> #include<map> #define ll long long using namespace std; const ll inf=1e18; const ll N=1005;...
ALGO
0.999401
3.469574
99a60103-b33f-4453-925a-a4f73f925b8a
ayushjangid1/DSA
Graph/flood_fill.cpp
//{ Driver Code Starts #include<bits/stdc++.h> using namespace std; void dfs(int sr,int sc,vector<vector<int>>& image,vector<vector<int>>& ans,int initial_color,int new_color,int del_row[],int del_col[]){ ans[sr][sc] = new_color; int n = image.size(); int m = image[0].size(); for(in...
ALGO
0.998759
5.455774
06d465e0-68a4-4b55-a89e-5f0493fd28a9
souravkhan12/.dotfiles
vim/.config/nvim/templates/skeleton.cpp
#include <bits/stdc++.h> using namespace std; // Typedefs & Macros #define int long long #define endl '\n' #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define pb push_back #define ff first #define ss second #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i-...
ALGO
0.999057
4.095715
c7b21140-f30f-482a-bf09-49e690e711e7
PR2/pr2_mechanism
pr2_mechanism_model/src/pr2_gripper_transmission.cpp
/* * Author: Stuart Glaser */ /* * propagatePosition (from as to js) * as position and velocity are doubled to get js, since gripper is two sided * as torque is directly converted to gap_effort * as torque to passive joint is /4 since there are 4 links * propagateEffort (from js to as) * popluate only ...
ALGO
0.960676
6.386896
265a3890-4197-4dfc-ba83-360d648f3922
ishandutta2007/codeforces
sunset/normal/731/E.cpp
#include<bits/stdc++.h> using namespace std; const int maxn=200020; int dp[maxn]; int n; int f[maxn]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { int x; scanf("%d",&x); f[i]=f[i-1]+x; } dp[n]=f[n]; int maxx=dp[n]; for(int i=n-1;i>=2;i--) { dp[i]=f[i]-maxx; maxx=max(maxx,dp[i]); } int ...
ALGO
0.999931
3.281713
2b31c969-0f5a-418d-9e70-54db685dfc05
llukito/leetCode
3443-maximum-manhattan-distance-after-k-changes/3443-maximum-manhattan-distance-after-k-changes.cpp
class Solution { public: int maxDistance(string s, int k) { int ans = 0; int north = 0, south = 0, east = 0, west = 0; for (int i = 0; i < s.size(); i++) { char c = s[i]; if (c == 'N') north++; else if (c == 'S') south++; else if (c ==...
ALGO
0.999981
5.835143
42615290-f297-4754-8354-09374a053c55
vikash619/Codes_of_cpp
tree/binary search tree2.cpp
#include <bits/stdc++.h> using namespace std; struct node{ struct node* left; int roll; char name[30]; struct node* right; }; struct node* newNode(int roll, char name[]) { struct node* node =(struct node*)malloc(sizeof(struct node)); node->roll = roll; strcpy(node->name,name); node->le...
ALGO
0.999389
4.168913
68d25260-8dde-4faf-8bbe-742d60274353
anikdey095/codechef.cpp
game 11.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, m; long long int sum = 0; cin >> n >> m; int bat[n]; int ball[m]; vector<int> v; for (int i = 0; i < n;i++){ cin >> bat[...
ALGO
0.999885
3.590013
dede56ae-dcd1-4d90-9a29-700c287edcb5
Chandrashekharsk/dsa_cpp
day17/leetcode/treeNodeTraversal.cpp
// 144. Binary Tree Preorder Traversal // 94. Binary Tree Inorder Traversal // 145. Binary Tree Postorder Traversal #include<iostream> #include<vector> using namespace std; struct TreeNode{ int val; TreeNode* left; TreeNode* right; TreeNode(int n): val(n), left(nullptr), right(nullptr){}; }; void postOrder_...
ALGO
0.999926
5.622801
fe95f178-40fc-4045-bb7d-db8e9ef7477e
wenc13/Semantic-Object-Reconstruction
DepthSensingLabel/Include/Eigen_3.1.2/doc/examples/DenseBase_template_int_middleRows.cpp
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl; return 0; }
ALGO
0.965876
3.245548
891a9209-32c1-4ba9-8285-6fc3d5fb5a90
qhb1001/For-that-dream
专题/概率/uva11181.cpp
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> using namespace std; int n, r; double ans[25], people[25]; bool vis[25]; void dfs(int k, int cnt) { if (cnt == r) { double now = 1; for (int i = 1; i <= n; ++i) { if (vis[i]) now *= people[i];...
ALGO
0.999753
3.305789
87c030e0-ffa0-4055-98b7-beaf87bc6713
ishandutta2007/codeforces
kostroma/normal/806/C.cpp
#pragma comment(linker, "/STACK:512000000") #define _CRT_SECURE_NO_WARNINGS //#include "testlib.h" #include <bits/stdc++.h> using namespace std; #define all(a) a.begin(), a.end() typedef long long li; typedef long double ld; void solve(bool); void precalc(); clock_t start; //int timer = 1; int testNumber = 1; bool t...
ALGO
0.999977
3.745333
9bc803af-c9c9-4f75-82f9-e5056e8b2d5d
UestcXiye/Leetcode
1684.统计一致字符串的数目.cpp
/* * @lc app=leetcode.cn id=1684 lang=cpp * * [1684] 统计一致字符串的数目 */ // @lc code=start class Solution { public: int countConsistentStrings(string allowed, vector<string> &words) { vector<int> alpha(26, 0); for (char &c : allowed) alpha[c - 'a'] = 1; int ans = 0; fo...
ALGO
0.999885
6.141001
7b3c52a9-ee2d-4ad5-a71f-04529eaed34e
bachtran02/comp-prog
Material/16. DSU/Two Sets.cpp
/* Source: Codeforces Link: https://codeforces.com/problemset/problem/468/B */ /* ---------C++--------: #include <cstdio> #include <map> #include <algorithm> using namespace std; const int MAX = 1e5 + 5; int n, a, b, p[MAX], fa[MAX]; map<int, int> mp; // Union Find with Compression Path int Find(int x...
ALGO
0.999403
3.30408
85a4781c-c901-4548-ad11-0cc196a9b03b
raincross7/code-similarity
codes/train_code/problem252/problem252_160.cpp
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vll; #define int ll typedef pair<int,int> pii; #define fi first #define se second #define Sort(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i = 0;i < (n) ; i++) #define REP(i,n) for(int i = 0;i < (n) ; i++) #define MP(a,b)...
ALGO
0.999894
3.852847
bfca5b01-c1c9-4531-af88-8989288c951a
asmegithub/A2SV-repo
20-valid-parentheses/valid-parentheses.cpp
class Solution { public: bool isValid(string s) { stack<char> st; // create an empty stack to store opening brackets for (char c : s) { // loop through each character in the string if (c == '(' || c == '{' || c == '[') { // if the character is an opening bracket st.push(c...
ALGO
0.999206
6.627268
2f9ddc5c-5e3a-49c0-90b3-e5b8d3e33aa4
alecalmirp/Logica-de-Programacao
Lista 2/lista2 - 7.cpp
#include <stdio.h> #include <math.h> int main () { float num, qua, cub; printf ("Informe um número: "); scanf ("%f", &num); qua = pow (num,2); cub = pow (num,3); printf ("\nnúmero\t\tquadrado\tcubo\n%.2f\t\t%.2f\t\t%.2f", num, qua, cub); return 0; }
ALGO
0.908989
3.103438
3a39119c-7baf-4535-8849-3170b5bc2f64
LooOnGit/CODE_Student
OPENCV/opencv-master/modules/gapi/src/api/kernels_video.cpp
#include "precomp.hpp" #include <opencv2/gapi/video.hpp> namespace cv { namespace gapi { using namespace video; GBuildPyrOutput buildOpticalFlowPyramid(const GMat &img, const Size &winSize, const GScalar &maxLevel, ...
ALGO
0.990939
7.065443
def54ca9-35b5-4c27-8924-9bad675ec1fd
aaabriceno/progCompetitiva
Control1/c_Contest_Scoreboard.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <sstream> #include <cstring> using namespace std; struct Team { int teamNumber; int solved[12]; int penalty[12]; bool submit; Team(int i = 0) { teamNumber = i; fill(solved, solved + 12, 0); ...
ALGO
0.996464
3.722417
ac23c45a-6184-45dc-a3ae-9bc2c1ea352b
Nikh9123/DSAlgoSolutions
Array/combinationSUm.cpp
#include<bits/stdc++.h> using namespace std; void backtrack(vector<vector<int>>& res, vector<int>& temp, vector<int>& candidates, int target, int start) { if(target < 0) return; else if(target == 0) res.push_back(temp); else { for(int i = start; i < candidates.size(); i++) ...
ALGO
0.999973
5.849587
f38394c4-4361-4b7f-92a1-0d50efa9f471
riis/qgcbranding
qgroundcontrol/libs/eigen/bench/perf_monitoring/gemm/gemm.cpp
#include <iostream> #include <fstream> #include <vector> #include <Eigen/Core> #include "../../BenchTimer.h" using namespace Eigen; #ifndef SCALAR #error SCALAR must be defined #endif typedef SCALAR Scalar; typedef Matrix<Scalar,Dynamic,Dynamic> Mat; EIGEN_DONT_INLINE void gemm(const Mat &A, const Mat &B, Mat &C) {...
TEST
0.976323
5.689105
20f67cc7-20b8-408d-85b2-51b01c12cbfd
yuwei0922/WHURS-DSA
homework3/Kruskal.cpp
#include <iostream> using namespace std; const int MAXN = 1000; const int MAXM = 3000; struct edge { int u; int v; int w; } e[MAXM]; int f[MAXN], sum, m, n, ans; bool cmp(edge x, edge y)//Ȩ { return x.w < y.w; } int find(int x)//Ҳ鼯 { if (f[x] == x) { return x; } else { f[x] = find(f[x]);//·ѹ return f[x...
ALGO
0.999965
4.217459
864e4728-db58-4493-854e-985dd82059c9
MdRimon29/LeetCode
18-4Sum.cpp
#include<bits/stdc++.h> using namespace std; class Solution { public: vector<vector<int>> fourSum(vector<int>& nums,int target) { vector<vector<int>>vec; int n=nums.size(); sort(nums.begin(),nums.end()); for(int i=0; i<n; i++) { if(i>0 && nums[i]==nums[i-1]) con...
ALGO
0.999981
5.287948
a5661352-682d-4370-bec0-8d1f66bb9b3c
jynxmagic/LLMs-for-System-Identification
defaults/lib/Eigen/doc/examples/QuickStart_example2_fixed.cpp
#include <iostream> #include <Eigen/Dense> using namespace Eigen; using namespace std; int main() { Matrix3d m = Matrix3d::Random(); m = (m + Matrix3d::Constant(1.2)) * 50; cout << "m =" << endl << m << endl; Vector3d v(1,2,3); cout << "m * v =" << endl << m * v << endl; }
ALGO
0.992212
3.375595
21c34709-de9b-4acb-92ca-392ac2934b3d
AkshatPandey2006/Linked_List
Insert_GCD_in_LL.cpp
class Solution { public: ListNode* insertGreatestCommonDivisors(ListNode* head) { if(head == NULL) { return NULL; } if(head -> next == NULL) { return head; } ListNode *temp = head; while(temp -> next != NULL) { int num1 = temp ->...
ALGO
0.999984
5.534867
c98f1c7d-5caf-4edf-84e0-7554f9779285
tany071/leetcode-solutions
2108-FirstPalindromicString.cpp
class Solution { public: string firstPalindrome(vector<string>& words) { for(auto i: words){ string s =i; reverse(s.begin(),s.end()); if(s==i){ return s; } } return ""; } };
ALGO
0.999948
5.980972
fec4472d-1d81-45b5-a03f-2662d6404bd9
GauravCGS/DSA
Trees/leftViewOfBTree.cpp
vector<int> leftView(Node *root) { // Your code here Node* node = root; int level = 0; queue<Node*> q; map<int, int> m; vector<int>res; if(node == NULL) return res; q.push(node); while(!q.empty()){ int size = q.size(); for(int i = 0; i < size; i++){ Node* temp = ...
ALGO
0.999959
4.928452
fbdd8306-c12d-4162-b164-4cafa6dea3dd
rishabh-malik/Algorithms
Lecture 7/queueLibraryDemo.cpp
#include<iostream> #include<queue> #include<deque> using namespace std; int main(){ //this is not a circular queue queue<int> q; for(int i=0;i<7;i++) q.push(i); while(!q.empty()){ cout<<q.front()<<" "; q.pop(); } cout<<"\n"; //doubly ended queue //push_front,pop_front,push_back,pop_back deque<...
ALGO
0.988382
3.68525
a8aca688-35e9-42b7-8cec-6a3c4dc63005
wuzy12138/Leetcode
_151_reverse_words_in_a_string/main.cpp
#include <iostream> #include <vector> #include <string> using namespace std; class Solution { public: string reverseWords(string s) { int l = 0; int n = s.size(); int r = n - 1; vector<string> wordList(n, ""); int p = r; while (l < r) { while (s[l] == ' ') {...
ALGO
0.994807
4.870328
31261044-0e2a-4c1f-a6d6-cc542736eefd
A-Arrese/DAM
Lehenengo urtea/Entornos/C/Ariketak/menuentrega.cpp
#include <stdio.h> int main() { int n = 5; // The index n for F(n), starting from n=3, as n=1 and n=2 are pre-defined // F(n) to be computed // F(n-1), init to F(2) // F(n-2), init to F(1) // maximum n, inclusive for(int row =1;row<=n;row++){ for(int col = n; col >0;col--){ printf("...
ALGO
0.99986
3.222433
47fb49cc-727e-4927-8477-21a2b443343e
huzongyao/AggSDL2Android
app/src/main/cpp/agg-2.5/src/agg_bspline.cpp
#include "agg_bspline.h" namespace agg { //------------------------------------------------------------------------ bspline::bspline() : m_max(0), m_num(0), m_x(0), m_y(0), m_last_idx(-1) { } //----------------------------------------------------------------...
ALGO
0.998391
6.400813
3ee37fec-9093-4ccc-a11b-43e938a62cdc
Rafael-Suzin/Projeto
Complex/complex.cpp
/* * complex.c * * Created on: Oct 15, 2023 * Author: Rafael */ #include <iostream> #include <cmath> using namespace std; class Complex { double x; double y; double modulo; double arco; double Modulo_() { modulo=sqrt(x * x + y * y); return modulo; } double Arco_() ...
ALGO
0.97249
4.205424
0769c79d-63d1-4b02-aa0a-5c762c568af7
salihtangel/Object-Orianted-Programming
ps2/5.cpp
#include<iostream> using namespace std; int main(int argc, char *argv[]) { static int notes[10]; static int repeated[10]; int i=0; while(i<10){ cin>>notes[i]; i++; } for(i=0;i<10;i++){ if(notes[i]==0) repeated[0]+=1;; if(notes[i]==1) repeated[1]+=1;; if(notes[i]==2) repeated[2]+=1;; if(notes[...
ALGO
0.999337
3.417447
e74556fc-becb-48a1-a63d-3ac35ca7406b
atlantis-ar/matterport_utils
mpview/pkgs/R2Shapes/R2Dist.cpp
/* Source file for GAPS distance utility */ /* Include files */ #include "R2Shapes/R2Shapes.h" /* Public functions */ int R2InitDistance() { // Return success return TRUE; } void R2StopDistance() { } RNLength R2Distance(const R2Point& point1, const R2Point& point2) { // Return length of vector betwee...
ALGO
0.99561
6.102643
69b9747f-e3f4-44cb-b296-9f735fc1b386
sslab-skku/capacity
capacity/llvm-project/llvm/lib/CodeGen/LiveIntervals.cpp
#include "llvm/CodeGen/LiveIntervals.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/...
TOOL
0.988285
5.39993
4146310a-a297-4209-bdf9-c93a8ccb4c80
sushant-demn/cpp2
gfg/tempCodeRunnerFile.cpp
if (sum == target) { v.push_back(start + 1); v.push_back(end + 1); return v; }
ALGO
0.967722
4.520486
e0ec3696-6c62-4afa-b3ba-df867aabe3c4
danieltrt/SBFL
TransCoder_tokenized_test_set_functions/cpp/PROGRAM_REVERSE_STRING_ITERATIVE_RECURSIVE_2.cpp
void recursiveReverse ( string & str, int i = 0 ) { int n = str . length ( ); if ( i == n / 2 ) return; swap ( str [ i ], str [ n - i - 1 ] ); recursiveReverse ( str, i + 1 ); }
ALGO
0.999486
5.41826
dfe448d5-b1ba-429a-bffb-e9348bfa076e
nikhiljangra264/chess_cpp
src/hashing.cpp
#include "hashing.h" namespace Zobrist { std::array<std::array<std::array<hash_t, TOTAL_FILE>, TOTAL_RANK>, NUM_PIECES> piece_keys; std::array<std::array<hash_t, TOTAL_FILE>, 2> en_passant_keys; std::array<hash_t, NUM_CASTLING_RIGHTS> castling_rig...
ALGO
0.99517
6.420386
7f23bc7e-b9b5-4ca4-93e2-c109253dc4d3
Winterleaf/DNT-Torque3D-V1.0
Engine/lib/convexDecomp/NvRayCast.cpp
/* NvRayCast.cpp : A code snippet to cast a ray against a triangle mesh. This implementation does not use any acceleration data structures. That is a 'to do' item. */ #include "NvRayCast.h" #include "NvUserMemAlloc.h" #include "NvFloatMath.h" #pragma warning(disable:4100) namespace CONVEX_DECOMPOSITION { class R...
ALGO
0.942724
6.456855
91d39e30-efc5-4626-8e6a-b2ee94c7ec07
ishandutta2007/codeforces
xellos/normal/161/B.cpp
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <cstdlib> #include <vector> #include <set> #include <map> #include <tr1/unordered_map> #include <queue> #include <stack> #include <list> #include <cmath> #include <iomanip> #define dibs reserve #define OVER...
ALGO
0.999974
3.205106
b6d5beb4-9619-4f32-a1af-973b27a14ea0
tienpm/competitive-programming
codeforces/151D2/A.cpp
#include <bits/stdc++.h> using namespace std; void solution() { int32_t n, k, x; cin >> n >> k >> x; vector <int32_t> values; if (x != 1) { cout << "YES\n"; cout << n << "\n"; for (int32_t i = 0; i < n; i++) { cout << 1 << " "; } cout << "\n"; } ...
ALGO
0.999601
4.144815
01fc3055-bbd6-4083-93d0-dfeb080333a4
TarsorCase/Modularidad
exercises-1-intro-progra/exercise_13_2.cpp
#include <cmath> #include "exercise_13_2.h" long exercise_13_2(int n, int k) { int result = 0; for (int i = 1; i <= n; ++i) { int power = pow(i, k); result += power; } return result; }
ALGO
0.999585
4.133046
8daab94a-180c-4680-b57d-e16ca1d4d65b
hugginse/CppPrimerPlus
Chapter2/carrots.cpp
// carrots.cpp -- food processing program // use and displays a variable #include <iostream> using namespace std; int main() { int carrots; // 声明变量类型 carrots = 25; // 给变量赋值 cout << "I have "; cout << carrots; cout << " carrots."; cout << endl; carrots = carrots - 1; ...
TOOL
0.925263
4.262787
0d4081f7-1444-48c1-b1be-e96edf1c5f6c
Codeit88/Data-Structures-and-Algorithms
Graph_Find_disconnected_edges.cpp
/*You are given an integer n.There is an undirected graph with n nodes, numbered from 0 to n - 1. You are given a 2D integer array edges where edges[i] = [ai, bi] denotes that there exists an undirected edge connecting nodes ai and bi. Return the number of pairs of different nodes that are unreachable from each other.*...
ALGO
0.999849
5.330741
55ab8c67-cbf8-41e0-84af-c1a2e25e0a14
hjr265/sport-programming
LightOJ/Archive/1072.cpp
// In the name of Allah, Most Gracious, Most Merciful // LightOJ/1072 // Calm Down // *binary search, *geometry, implementation // // // AC (2011-09-19 21:04:18) #include <cstdio> #include <cmath> const double pi = acos(-1.0); const double eps = 1e-12; double fn(double R, double n, double r) { return ((R-r)*(R-r...
ALGO
0.999585
3.793267
18776ae4-189c-4846-9ad8-5042760117cc
lengmuzhaxi/Codeforces
Educational Codeforces Round 167 (Rated for Div. 2)Educational Codeforces Round 167 (Rated for Div. 2)/A.cpp
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b; cin>>a>>b; if(b<-1) { cout<<"NO\n"; } else { cout<<"YES\n"; } } }
ALGO
0.999768
3.864266
65a320e9-afc3-4394-be32-5dab75bd6e3a
Dipanjali1/Placement-Preparation-Module
Day-20_Binary_Search_Tree/inorder_pre_suc.cpp
/* Problem Link: https://practice.geeksforgeeks.org/problems/predecessor-and-successor/1# */ void findPreSuc(Node *root, Node *&pre, Node *&succ, int key) { // base case if(!root) return; // successor candidate if(root->key > key) { succ = root; // key lies in the left subtr...
ALGO
0.999999
5.172077
fffa9099-339b-4235-b6c7-8ca52836c959
zhaojiu34/mycode
24.12.29/源.cpp
#define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> #include<stdlib.h> #include<stdio.h> #define STACK_SIZE 51 using namespace std; typedef int SElemType; typedef struct { SElemType* base; SElemType* top; int stacksize; }SqStack; int CreatS(SqStack& S) { S.base = (SElemType*)malloc(STACK_SIZE * sizeof...
ALGO
0.999907
3.959754
e41dd88a-943a-4069-ac7b-9d6741df95c2
Amdev-5/Leetcode-Algorithmic-Problems
858-mirror-reflection/858-mirror-reflection.cpp
class Solution { public: int mirrorReflection(int p, int q) { int a = __gcd(p,q); int lcm = (p*q)/a; cout<<lcm<<" "; int x = lcm/p; cout<<x<<" "; if(x%2==0) return 0; int count = lcm/q; if(count%2==0) return 2; return 1; } };
ALGO
0.999935
4.555821
cdf46ced-9d0d-47c4-baf6-08b9c23c09e1
prachurjyo-ghub/Academic-Codes
DS Algorithm/Algorrithm Lab Report/exp3.cpp
#include <iostream> using namespace std; void insertionSort(int arr[], int n) { for (int i = 1; i < n; i++) { int key = arr[i]; int j = i - 1; while (j >= 0 && arr[j] > key) { arr[j + 1] = arr[j]; j--; } arr[j + 1] = key; } } void pr...
ALGO
0.99996
5.45939
5afb899f-a81c-4048-84e8-2d61a3670adc
ggome1/Algorithm_C
S.W.마에스트로/2579.cpp
#include <iostream> using namespace std; int arr[301]; int dp[301]; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> arr[i]; dp[1] = arr[1]; dp[2] = arr[1] + arr[2]; dp[3] = max(arr[1], arr[2]) + arr[3]; ...
ALGO
0.999962
4.279792
81685abb-1498-4597-9043-fcbb5e3bf622
Iffat-Bin-Hossain/CPP
PRIMSALGO.cpp
#include <bits/stdc++.h> using namespace std; int main() { priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> pq; int vertex, edges; cout << "Enter vertex and edges:"; cin >> vertex >> edges; vector<pair<int, int>> adjList[vertex]; v...
ALGO
0.999945
4.568801
957daaa3-08f4-413a-a128-80f4efdd83ce
dendisuhubdy/ntl
src/CheckThreads.cpp
#include <NTL/config.h> #include <NTL/new.h> #include <atomic> #include <thread> #include <cstdlib> #include <iostream> void TerminalError(const char *s) { std::cerr << s << "\n"; std::abort(); } void MemoryError() { TerminalError("out of memory"); } void ResourceError(const char *msg) { TerminalError(msg); } ...
TOOL
0.978611
3.935975
52ff9695-cdac-4602-8aca-f7fcaec86212
Parshant-12/900-rated-codeforces-
B_Array_Eversion.cpp
#include<bits/stdc++.h> using namespace std; #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #define ll long long int void solve(){ ll n; cin>>n; ll mx=0; vector<ll>arr(n); for(int i=0;i<n;i++){ cin>>arr[i]; mx= max(mx,arr[i]); } ll cnt=0; ll mmx=arr[n-1]; f...
ALGO
0.999671
4.888802
3741ec03-cf09-417c-ac10-0ab530fdc1ce
ZakirCodeArchitect/Data-Structures
Practice Programs/p11 Selection sorting.cpp
#include<iostream> using namespace std; void selection_sort(int arr[], int size) { for(int i=0; i<size-1 ; i++) // During each iteration of the outer loop, the minimum element found in the unsorted portion of the array is placed at the current position i. { int minIndex = i; // This variable keeps track of the in...
ALGO
0.99997
4.30164
1d1e6a1f-8211-4d25-aa5c-186138a46e06
kunalbandooni/InterviewBit
Addition without Summation.cpp
int Solution::addNumbers(int A, int B) { while (B != 0) { int carry = A & B; A = A ^ B; B = carry << 1; } return A; }
ALGO
0.999886
5.390434
e8d17479-e7fa-4a3a-99c7-b3b194c43a67
WidoutSyntax/Competitive-Solved-Questions
CSES/Graph/01_Counting Rooms.cpp
#include<bits/stdc++.h> #define int long long using namespace std; void IOS() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int arrX[] = {1, -1, 0, 0}; int arrY[] = {0, 0, 1, -1}; void dfs(in...
ALGO
0.999823
5.400131
52ea1a89-d19f-4fe6-a40f-9e70d572be30
zhuyonghao/LeetCode
226.翻转二叉树.cpp
/* * @lc app=leetcode.cn id=226 lang=cpp * * [226] 翻转二叉树 */ // @lc code=start /** * 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), ri...
ALGO
0.999993
6.972379
57064723-c626-4fcb-a2e9-b8c8a8d37f34
kaushiksimran/C_plusplusProgramming
natural_no.cpp
// write a program to sum all the natural numbers till n #include<iostream> using namespace std; int main() { int i,n; int sum=0; cout << "enter the number "; cin >> n; for (i=0;i<=n;i++) { cout << i << "\n"; sum = sum + i; } cout << "the additon of the entered number: "<< sum; }
ALGO
0.992307
3.41487
297badca-9325-4be4-a411-6fa4d2231d74
RobJames44035/StarshipOS
openjdk/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/compile.hpp" #include "opto/intrinsicnode.hpp" #include "opto/output.hpp" #include "opto/subnode.hpp" #include "runtime/stubRoutines.hpp" #ifdef PRODUCT #define BLOCK_COMMENT...
ALGO
0.920494
5.223311
ce58c75d-fda5-4c13-a567-11bddf391bde
Sumant3086/LeetCode-Solution
345. Reverse Vowels of a String.cpp
// 345. Reverse Vowels of a String // Easy // Topics // Companies // Given a string s, reverse only all the vowels in the string and return it. // The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once. // Example 1: // Input: s = "hello" // Output: "holle" // E...
ALGO
0.999189
6.115471
c6e899da-3f9b-4872-bc71-8c069651eeec
psuplus/CtChecker
lib/Transforms/IPO/LoopExtractor.cpp
#include "llvm/Transforms/IPO.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Ut...
TOOL
0.871125
7.865064
317bd047-b10b-4f2f-84ac-09ad04bf342f
wxl-98/OJ_Code
117.cpp
/*********************************************************** * &Author: Wang Xianling * &E-mail: wang <EMAIL> * &Motto: Believe in yourself. * &File Name: 117.cpp * &Created Time: 2019年11月28日 星期四 10时42分34秒 * &Description: *********************************************************...
ALGO
0.999967
4.177463
97d5c608-f6d5-47a6-a806-481326080ec1
AbuJubair7/CP
Topics/Data structure/Segment Tree/Topic Practice (Segment tree)/a.cpp
/*........... বিসমিল্লাহির রাহমানির রাহীম ................. Author: jubs Date: 20 Nov 2022 */ #include <bits/stdc++.h> using namespace std; #define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR(i,n) for(ll i = 0 ; i<n ; i++) #define endl "\n" #define pb push_back //#define jubs t...
ALGO
0.999974
4.596313
f143e842-5b4c-4788-81c5-51aa21640301
IshankSharma2178/Flutter-Projects
project5/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.998695
6.76775
19a68edf-65c3-419f-9072-c031350944d8
iamwind-dev/Excpp
.history/Lab3/DinhLeThaiDuong_22IT056_Lab33_20230530132908.cpp
#include <iostream> using namespace std; class Node { public: int data; Node *next; }; Node *front, *rear; int _size = 0; void enqueue(int x) { Node *new_node = new Node(); new_node->data = x; new_node->next = NULL; if (rear == NULL) { front = rear = new_node; } else { ...
ALGO
0.999992
4.545911
7d9e5025-16e1-4fc0-bb44-7be163a3c7de
PaolaMag/DET-LSH
test_create_index.cpp
#include <iostream> #include <vector> #include <random> #include <cassert> #include <chrono> #include "tree_node.h" #include "point.h" #include "Eigen/Dense" #include "indexing.h" #include "encoding.h" #include "reader.h" #include "LSH.h" #include "ann_query.h" using namespace std; using namespace std::chrono; ...
TEST
0.988178
6.794695
f81385e9-b3c8-43d3-b6dd-1a7ce341f44e
s5377689/ardupilot
ArduCopter/Attitude.cpp
#include "Copter.h" /************************************************************* * Attitude Rate controllers and timing ****************************************************************/ /* update rate controller when run from main thread (normal operation) */ void Copter::run_rate_controller_main() { // se...
ALGO
0.960505
4.887683
0ca08e65-9b9c-4e92-97db-bcb1bb514f49
ret1s/random-puzzles
150-leetcode/isPalindrome.cpp
class Solution { public: bool isPalindrome(string s) { vector<char> t; for (const auto& c : s) { if (c >= 'A' && c <= 'Z') t.push_back(c - 'A' + 'a'); else if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) t.push_back(c); } ...
ALGO
0.999252
6.376221
f47f2d0b-8a58-45ec-a976-3c4e1123c512
mehdok/test
C++/prime.cpp
#include <iostream> using namespace std; int main() { int control = 0 , input; // int j; cout<<"Enter a number:(2 or bigger)"<<endl; cin>>input; cout<<"primes less than " << input <<":" << endl << "2\t";//entered number:"<<endl<<"2\t"; for(int i = 3 ; i < input ; i += 2) { for(int j =...
ALGO
0.998967
3.586323
320bc8aa-47a9-4c1b-bf85-9b280a0b6176
pereiratf/teste
flapbird/main.cpp
/*Verso beta desenvolvida por Thiago Felski Pereira para disciplina de Algoritmos*/ #include <iostream> #include <windows.h> #include <conio.h> ///para o getch() ///https://stackoverflow.com/questions/34474627/linux-equivalent-for-conio-h-getch using namespace std; /** F L A P P Y B I R D (M2 Algoritmos) - Le...
TOOL
0.950284
3.336079
c40ec289-d0ab-4d4d-86c8-784822d6d8fd
michimani/atcoder
abc/001-100/078/cpp/b.cpp
#include <iostream> using namespace std; using ui = unsigned int; int main() { ui x, y, z; cin >> x >> y >> z; x -= 2 * z; ui ans = x / (y + z); if (x - (ans * (y + z)) >= y) ans++; cout << ans << endl; return 0; }
ALGO
0.999413
3.309659
ec043c55-7780-40ed-a24d-e6f9403bc5d3
imulan/procon
aoj/vol21/2185.cpp
#include <cstdio> #include <iostream> using namespace std; int main(){ long times; scanf(" %ld", &times); for(long t=0; t<times; ++t){ int x, y, w, h; int n; scanf(" %d %d %d %d", &x, &y, &w, &h); scanf(" %d", &n); int ans=0; for(int i=0; i<n; ++i){ int cx, cy; scanf(" %d %d", &cx, &cy); ...
ALGO
0.992156
3.133111
59857256-289b-419e-b7d3-9fbe507213ab
tsksnhr/programming_contest
atcoder/agc029a.cpp
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; map<int, int> wpos; for(int i=0; i<s.size(); i++){ if(s.at(i) == 'W'){ int buf = i+1; wpos[buf]++; } } long long pos = 1, cnt = 0; // overflowに注意 for(auto p: wpos){ ...
ALGO
0.999712
3.930267
a1cfc86e-88e3-4253-a4b2-3c821d5cae62
amit2000123/Leetcode
First negative integer in every window of size k - GFG/first-negative-integer-in-every-window-of-size-k.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; vector<long long> printFirstNegativeInteger(long long int arr[], long long int n, long long int k); // Driver program to test above functions int main() { long long int t, i; cin >> t; while (...
ALGO
0.999916
5.445813
59dabfb2-fe8f-4fb7-a454-4dea55c3e873
nikhilkumar0811/DSA-With-CPP
countprime.cpp
#include <bits/stdc++.h> using namespace std; bool isprime(int n) { if (n <= 1) { return false; } for (int i = 2; i <= n / 2; i++) { if (n % 2 == 0) { return false; } else { return true; } } } int main() { int n;...
ALGO
0.999748
3.155825
8e009ee5-2ba5-47e0-bcdd-bb72aba93be8
ManishNMR/Code_Forces
A_Stones_on_the_Table.cpp
// link - #include <iostream> #include <string> using namespace std; int main(){ int t; cin>>t; string s; cin>>s; char c=s[0]; int count=0; for(int i=1;i<s.length();i++){ if(c==s[i]) count++; else{ c=s[i]; } } cout<<count<<endl; } // I: // 3 //...
ALGO
0.999794
4.047997
313beaae-a261-475b-856b-f58f9151c457
CJuncheng/CSCode
LeeCode/dynamic_programming/63.UniquePathsII.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { const int nRow = obstacleGrid.size(), nCol = obstacleGrid[0].size(); if(obstacleGrid[0][0]==1||obstacleGrid[nRow-1][nCol-1]) return 0; vector<...
ALGO
0.999837
5.500337
a291e124-d024-4aba-a29a-2f9d63e669f3
abdelrhmanghaly-whp/Problems-Solutions
Counting Orders(1828C).cpp
/* if you are checking this bad solution enjoy this part from 'Undercover Martyn'~ You hid there last time You know we're gonna find you Sick in the car seat Cause you're not up to going Out on the main streets, completing your mission */ /*------------------------------------------------------------------------------...
ALGO
0.99988
4.674931
ad7c836b-8799-439a-9ec1-f5d9fcc403c4
Soumya14022002/Problem-Solver
106. Construct Binary Tree from Inorder and Postorder Traversal.cpp
class Solution { public: TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) { unordered_map<int, int> index; for (int i = 0; i < inorder.size(); i++) { index[inorder[i]] = i; } return buildTreeHelper(inorder, postorder, 0, inorder.size() - 1, 0, postorder.s...
ALGO
0.999974
6.515211
7651ee11-f908-4954-9428-085661b74209
thingk0/codetree-TILs
240423/숫자의 조건 여부 2/number's-condition-2.cpp
#include <iostream> using namespace std; int main() { int a; cin >> a; if (a == 5) { cout << 'A'; } else if (a % 2 == 0) { cout << 'B'; } return 0; }
ALGO
0.999839
3.701547
03a7028b-d635-49dc-ac3d-8310addf04b1
ThonggKunn/OOP-of-Cpp
Câu10.cpp
#include<iostream> #include<iomanip> #include<string> using namespace std; class NhanSu { private: string MaNV; string HoTen; int NamSinh; public: void Input() { cout<<"Nhap ma nhan vien: "; cin.ignore(); getline(cin,MaNV); cout<<"Nhap ho ten: "; getline(cin,HoTen); cout<<"Nhap nam si...
ALGO
0.988434
3.572257
0d9ceffa-45ba-4b40-8579-04f729bb3831
coin-or/CppAD
example/sparse/sparse_jac_for.cpp
/* {xrst_begin sparse_jac_for.cpp} Computing Sparse Jacobian Using Forward Mode: Example and Test ############################################################## {xrst_literal // BEGIN C++ // END C++ } {xrst_end sparse_jac_for.cpp} */ // BEGIN C++ # include <cppad/cppad.hpp> bool sparse_jac_for(void) { bool ok...
ALGO
0.97962
7.482009
ebc03e99-eb15-4047-9e99-a42e436a4061
greenplum-db/gpdb-archive
src/backend/gporca/libgpopt/src/operators/CPhysicalLeftAntiSemiHashJoin.cpp
#include "gpopt/operators/CPhysicalLeftAntiSemiHashJoin.h" #include "gpos/base.h" #include "gpopt/base/CDistributionSpecHashed.h" using namespace gpopt; //--------------------------------------------------------------------------- // @function: // CPhysicalLeftAntiSemiHashJoin::CPhysicalLeftAntiSemiHashJoin // // ...
ALGO
0.971632
5.826337
9fbea4bb-1f38-4b83-8b98-d4bf6e3cd786
dgboy2000/segmentation-svm
rwsegment/mrf/trw/trw_potts_wlabels.cpp
#include <iostream> #include <string> #include <cmath> #include "src/MRFEnergy.h" #ifdef __cplusplus extern "C" { #endif ///----------------------------------------------------------------------------- //extern __declspec(dllexport) double trw_potts_wlabels( int nnodes, // number of nodes int nla...
ALGO
0.999903
5.024733
6fbefe2d-9d99-4305-bab4-67d933d59a77
kartikbende/personal-portfolio-website
mywebsite/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.997762
6.761023
4edb02e2-3c0c-46bd-87da-f575ed911dfe
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_11794_8.cpp
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c> ...
ALGO
0.999962
4.682879
085bb55e-22f8-4590-9c0d-b5a2e54ff93b
parasrdr/SFND_Front-Collision-Detection
src/camFusion_Student.cpp
#include <iostream> #include <algorithm> #include <numeric> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include "camFusion.hpp" #include "dataStructures.h" using namespace std; // Create groups of Lidar points whose projection into the camera falls into the same bounding box void ...
ALGO
0.997159
4.425806
6a84dfe4-bd1a-4e82-a263-608d37bf9509
emilymryan/LAMMPS-SPH-Source-Code
src/region_prism.cpp
/* ---------------------------------------------------------------------- Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ #include "region_prism.h" #include "domain.h" #include "error.h" #include "math_extra.h" #include <cstring> using nam...
TOOL
0.986101
6.155308
183067e2-bc78-4a2d-be28-68990f6b3863
QuhiQuhihi/algorithm_test
solutiion/7/5.cpp
#include <bits/stdc++.h> using namespace std; // 이진 탐색 소스코드 구현(반복문) int binarySearch(vector<int>& arr, int target, int start, int end) { while (start <= end) { int mid = (start + end) / 2; // 찾은 경우 중간점 인덱스 반환 if (arr[mid] == target) return mid; // 중간점의 값보다 찾고자 하는 값이 작은 경우 왼쪽 확인 ...
ALGO
0.999995
5.886357
373c84b6-6d15-45e4-bf39-03d05b243767
ahmed777ismail/Level-B
B. Effective Approach/B. Effective Approach/B. Effective Approach.cpp
#include <iostream> #include <unordered_map> using namespace std; int main() { int n, m; cin >> n; unordered_map<int, int> indexMap; for (int i = 1; i <= n; i++) { int val; cin >> val; indexMap[val] = i; // Store position (1-based index) } cin >> m; long long vasy...
ALGO
0.999982
4.91035
c2ef473b-7901-43b3-86bb-c775f0978cc7
mujtaba1747/Algorithms
Fraction.cpp
// Author : Syed Mujtaba // Seek knowledge from the Cradle to the Grave !! // https://www.linkedin.com/in/syed-mujtaba // This is a struct that can be used for positive fractions // Can be inserted into maps and pushed into vectors and can be sorted as well. #include <bits/stdc++.h> using namespace std; #define int ...
ALGO
0.999464
3.273276
a180bdf3-80f3-4bc7-9881-1a720eecb571
NICTA/obsidian
src/fwdmodel/gravity.cpp
#include <glog/logging.h> #include "gravity.hpp" #include "world/voxelise.hpp" namespace obsidian { namespace fwd { //! Generate a cache object for a gravity forward model. //! //! \param boundaryInterpolation The world model interpolation parameters. //! \param worldSpec The world model specificat...
ALGO
0.997436
5.096834
982149e8-22f7-4665-938d-97539b766d1e
harrySentinel/DSA
String/NonRepeatingConsecutive.cpp
#include <iostream> #include <string> using namespace std; string removeConsecutiveDuplicates(const string& str) { if (str.empty()) return ""; string result = ""; result += str[0]; for (int i = 1; i < str.length(); i++) { if (str[i] != str[i - 1]) { result += str[i]; } ...
ALGO
0.99865
6.489311
37f8a7ef-e881-4191-b2d2-06be751f4d5d
anonimo-iv/scilammps
src/BPM/bond_bpm_spring.cpp
#include "bond_bpm_spring.h" #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" #include "fix_bond_history.h" #include "force.h" #include "memory.h" #include "modify.h" #include "neighbor.h" #define EPSILON 1e-10 using namespace LAMMPS_NS; /* -------------------------------------------------...
ALGO
0.991075
6.944864