uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
be30805d-a6d3-4ed6-afb8-73745b329b7c
GarageGames/Torque3D
Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp
#include "btDiscreteDynamicsWorldMt.h" //collision detection #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h" #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" #include "BulletCollision/CollisionShapes/btCollisi...
ALGO
0.98448
4.64743
e1b3c5e0-886d-44a8-ac01-4b9c79a6a60e
AftabIB/DSA
Striver sheet patterns/pattern7.cpp
#include<iostream> using namespace std; void pattern1(int n) { for(int i=0;i<n;i++) { for(int j=0;j<n-i-1;j++) { cout<<" "; } for(int j=0;j<2*i+1;j++) { cout<<"*"<<" "; } for(int j=0;j<n-i-1;j++) { cout<<" "; } cout<<endl; } } int main() { int t; for(int i=0;i<t;i++) { int n; ...
ALGO
0.999522
3.687002
a9b50eca-0a43-485a-9d96-83e302962783
tanupawalia/DSApractise
Assignment 26/preordertraversal.cpp
class Solution { public: vector<int>ans; vector<int> preorderTraversal(TreeNode* root) { if (root == NULL) return ans; ans.push_back(root->val); cout<<root->val; preorderTraversal(root->left); preorderTraversal(root->right); return ans; } };
ALGO
0.999904
6.041793
acad62c0-50f8-4fb0-b866-1999a5d35eac
girishsuthar229/Leetcode
buy-two-chocolates/buy-two-chocolates.cpp
#include <vector> #include <climits> class Solution { public: int buyChoco(vector<int>& prices, int money) { int minSum = INT_MAX; for (int i = 0; i < prices.size() - 1; i++) { for (int j = i + 1; j < prices.size(); j++) { int sum = prices[i] + prices[j]; ...
ALGO
0.99936
5.760291
a58c1bdd-c1f5-48a8-b0fe-195735d7a0c0
maikehenrique/Beecrowd
Iniciante/1051.cpp
#include <iostream> using namespace std; int main () { double sal, rest, calc, calc2 ; cin >> sal; if (sal > 0.00 && sal < 2000.00){ printf("Isento\n"); } else if (sal >= 2000.01 && sal <= 3000.00){ calc = (sal-2000.00) * 0.08; printf("R$ %.2lf\n", calc); } else if (sal >= ...
ALGO
0.999422
4.026096
15078a24-d424-4054-9132-9cac29a63e1c
vinci-grape/Rectifier
output/ChatGPT/avatar/Python/C++/atcoder_ABC129_E.cpp
#include <iostream> #include <string> using namespace std; const int mod = 1000000007; int main() { string l; cin >> l; int n = l.length(); int dp[n+1][2] = {0}; dp[0][0] = 1; for (int i = 0; i < n; i++) { char c = l[i]; if (c == '0') { dp[i+1][0] += dp[i][0]; ...
ALGO
0.999987
4.834966
5f40e538-5bc2-474a-bc86-c2f96916b1ea
hwiryong-jung/lsd_noros
thirdparty/eigen-3.2.1/unsupported/doc/examples/MatrixLogarithm.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { using std::sqrt; MatrixXd A(3,3); A << 0.5*sqrt(2), -0.5*sqrt(2), 0, 0.5*sqrt(2), 0.5*sqrt(2), 0, 0, 0, 1; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "...
ALGO
0.999189
3.621207
fd76bf91-3539-4b3b-89ec-563fdae6d838
ifce-prof-thiago/ip_ads_2025.1
exercicios/06.cpp
/* Crie um programa que calcule e exiba o perímetro de uma circunferência, solicitando o raio ao usuário. C=2*PI*r */ #include <iostream> #include <cmath> using namespace std; int main() { float raio; cin >> raio; cout << "Perímetro: " << 2 * M_PI * raio << endl; }
ALGO
0.986121
4.553691
a9a3b176-d389-4376-8e27-c682ee043dc2
AllianceRom/android_packages_apps_OTAUpdates
jni/boost_1_57_0/libs/math/example/f_test.cpp
#ifdef _MSC_VER # pragma warning(disable: 4512) // assignment operator could not be generated. # pragma warning(disable: 4510) // default constructor could not be generated. # pragma warning(disable: 4610) // can never be instantiated - user defined constructor required. # pragma warning(disable: 4180) // qualifier...
ALGO
0.9358
5.571537
73747179-5e01-4bd9-a882-6faf4825cebd
usgs-coupled/phreeqc3
src/cl1.cpp
#include <stdio.h> #include <string.h> #include <cmath> #include <stdlib.h> #include "Phreeqc.h" #include "phqalloc.h" /* debug #define DEBUG_CL1 #define CHECK_ERRORS */ #if defined(PHREEQCI_GUI) #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #endif int Phreeqc:: cl1...
ALGO
0.999918
3.185486
f612bd71-0bf1-4b5a-8b47-af58200a1b8e
weihuayi/whysc
example/parallel_hexmesh_optimization0.cpp
#include <string> #include <iostream> #include <list> #include <vector> #include <set> #include <mpi.h> #include <time.h> #include "geometry/C6H6.h" #include "geometry/C6.h" #include "geometry/Geometry_kernel.h" #include "geometry/CubeWithSpheresModelHexMesh.h" #include "mesh/HexahedronMesh.h" #include "mesh/Parallel...
ALGO
0.991702
3.847651
fedbb00e-95c4-4551-b807-9693f3faa652
BVibhu/Cplusplus-Practicals-B.Sc-Hons-CS
PRACTICAL 19.cpp
#include<iostream> using namespace std; int recursion(int y) { if (y == 1) return 1; else return y * recursion(y - 1); } int iteration(int x) {int sum=1; for(int i=x;i>=1;i--) sum=sum*i; return sum; } int main() { int no,choice,answer; cout<<"Enter the no to calculate factorial of "; cin>>no; c...
ALGO
0.999859
4.609115
efd190ae-6e4a-4bec-9345-e777b75820b5
ishandutta2007/codeforces
dorijanlendvaj/normal/1244/A.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define x first #define y second #define pii pair<int,int> #define pb push_back #define eb emplace_back #pragma GCC optimize("unroll-loops") #define shandom_ruffle(a, b) shuffle(a, b, rng) #define vi vector<int> #define vl vector<ll> #define popcnt __bui...
ALGO
0.999638
3.485981
f9ff8469-6879-46f4-9d64-8580d6ae263c
ArunRoshan123/LeetCode-
First non-repeating character in a stream - GFG/first-nonrepeating-character-in-a-stream.cpp
//{ Driver Code Starts #include<bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: string FirstNonRepeating(string A){ // Code here queue<int>q; unordered_map<char,int> count; string ans; for(int i=0;i<A.length();i++) { char ch= A[i]; co...
ALGO
0.999935
5.547319
e98da6aa-ce44-4287-b99e-e249d34b1c4c
zedfeng/OJ
OJ/LC_Remove Duplicates from Sorted List II .cpp
#include<iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: ListNode* deleteDuplicates(ListNode* head) { if (head == NULL || head->next == NULL) { return head; } ListNode* curr = head->next; if (curr->val == head-...
ALGO
0.999899
4.939186
64927fe0-7752-4de6-952c-42e560f31eea
dongb94/University-classes
강의/16년 2학기/c++/13장-예외처리,namespace/mainBalance.cpp
//13 ó class Account { double balance; public: Account() { balance = 0; } Account(double initialDeposit) { balance = initialDeposit; } double getBalance() { return balance; } double deposit(double amount) { if(amount > 0) balance += amount; else return -1; // ڵ return balance; } double withdraw(...
TOOL
0.907435
4.63922
9647a226-3b71-469e-8423-d4b745967985
ishandutta2007/codeforces
vercingetorix/normal/1296/D.cpp
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <ctype.h> #include <queue> #include <cstring> #include <set> #include <bitset> #include <map> #include <chrono> #include <random> #include <unordered_map> #include <stdio.h> using namespace std; typedef long long ll; typedef long do...
ALGO
0.999772
3.120923
428fed1c-5f79-4c9b-8771-b45bf28a9f85
loyinglin/Codeforces
1845/D/Codeforces/main.cpp
/************************** 题解 ********************** [题目链接](https://codeforces.com/contest/1845/problem/D) **题目大意:** 小明在参加比赛,一共做了n道题目; 初始状态0分,每道题目有得分a[i],如果是正数则加分,如果是负数则扣分; 现在可以选定一个整数k,在计算得分的过程中,如果小明分数大于等于k,则后续分数不会再小于k分(如果遇到负数,扣分之后最小分为k); 问整数k为多少,才能使得小明最后分数最大。 **输入:** 第一行,整数𝑡 表示t个样例 𝑡 (1≤𝑡≤1000) 每个样例2行 ...
ALGO
0.99998
4.645072
44942c01-2224-4f7d-98d1-26996c332551
ComputerProgrammerStorager/DataStructureAlgorithm
CLRS/Graph/CloneGraph.cpp
/* Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. class Node { public int val; public List<Node> neighbors; } Test case format: For simplicity sake, each node's value...
ALGO
0.999967
6.477557
3a0f2f84-0fc1-48fd-aac4-ef14943f6d33
semenInRussia/cf
codef/167/a.cpp
// semenInRussia 2024 #include <iostream> using namespace std; using ll = long long; const int maxn = 1000; int x[maxn], y[maxn], ok[maxn]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; // (A. B) = (x[i], y[i] - h) // b = y[i] - h // h >= max(A, B) for (int i = 0; i ...
ALGO
0.999996
5.179454
fd81605e-8d5a-444f-b98d-ff4ba2b0d6a4
harsh-panchal-804/CodeForces-Solutions
1696B.cpp
#include<iostream> #include<vector> #include<iomanip> #include<string.h> #include<algorithm> using namespace std; void solve(){ int n; cin>>n; vector<int>vec(n); bool flag=true; for(int i=0;i<n;i++){ cin>>vec[i]; flag =flag &&(vec[i]==0); } if(flag){ cout<<0<<endl; ...
ALGO
0.999554
4.41032
cc767ee2-48bf-4456-b398-9e4fb6e92920
goelshivam15/leetcode-solutions
Triangle Path Sum - GFG/triangle-path-sum.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: int f(int i , int j , vector<vector<int>>&triangle,vector<vector<int>>&dp){ int n = triangle.size(); if(i==n-1){ return triangle[n-1][j]; } if(dp[i][j...
ALGO
0.999969
6.763535
2418b238-9cad-44a3-b790-9f0f3d4013d8
raincross7/code-similarity
codes/train_code/problem205/problem205_36.cpp
#include <cstdio> #include <algorithm> #include <cassert> #include <cstdlib> using namespace std; int N,M,D; char a[999][999]; char t[2][2]={{'R','Y'},{'G','B'}}; void solve(){ for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ int x = (-i+j+N)/D, y = (i+j+N)/D; x%=2, y%=2; a[i][j]=t[x][y]; } } for(int i=0...
ALGO
0.998344
3.595525
1850a7fb-aa16-421b-ad8c-ea1369591018
Kourin1996/CompetitiveProgramming
AtCoderProblems/ARC/025/a.cpp
#include <iostream> #include <vector> #include <algorithm> std::vector<int> D(7,0), J(7,0); int main(void){ int i; for(i=0; i<7; ++i){ std::cin >> D[i]; } for(i=0; i<7; ++i){ std::cin >> J[i]; } int ans = 0; for(i=0; i<7; ++i){ ans += std::max(D[i], J[i]); } s...
ALGO
0.999958
3.040435
28351d4c-3d81-4d0d-bb15-28358236b7ad
armandix23/DAM
DAM2/Programacion multimedia y servicios moviles/Preparacion examen/hilos/hilos2.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #define MAX 1000 struct Tpila{ unsigned *num; unsigned cont; } primos; void push(struct Tpila *numeros,int dato){ numeros->num[numeros->cont++] = dato; } bool es_primo(unsigned num){ for(unsigned i = 0; i<primos.cont;i++) if(num %...
ALGO
0.997086
3.74472
05054f43-a0d8-4eb3-b1f2-1798dec0648f
JayThummar024/c--
searching & sorting/quickSort.cpp
#include<bits/stdc++.h> using namespace std; //typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds; //typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pbtrie; #define ll long long int #define ld ...
ALGO
0.999902
4.616511
ae91cccd-75f0-42bc-ae20-34ecabb54507
rezagvn/Face-Recognition
opencv-master/modules/core/src/command_line_parser.cpp
namespace cv { namespace { static const char* noneValue = "<none>"; static String cat_string(const String& str) { int left = 0, right = (int)str.length(); while( left < right && str[left] == ' ' ) left++; while( right > left && str[right-1] == ' ' ) right--; return left >= right ? Stri...
TOOL
0.988593
6.557032
64bcf6ca-7dc5-4eeb-b9aa-d09d505cc980
midjji/mlib
cuda/klt/internal/tracker.cpp
#include "klt/tracker.h" #include "klt/featurepool.h" #include "klt/internal/pyramid.h" #include "klt/internal/pyramid_utils.h" #include "klt/internal/scharr.h" #include "klt/internal/klt_kernels.h" #include "klt/internal/texture.h" #include "klt/internal/pyramid.h" #include "klt/cornerdetector.h" #include <mlib/uti...
ALGO
0.892062
6.089395
a51e3360-6472-4dbf-bd48-3e606cb7f217
prajwalsuvarnaa/Dlithe
main.cpp
#include <iostream> #include <fstream> using namespace std; class Node { public: int data; Node* prev; Node* next; Node(int value) : data(value), prev(nullptr), next(nullptr) {} }; class DoublyLinkedList { private: Node* head; public: DoublyLinkedList() : head(nullptr) {} void insert(i...
ALGO
0.990113
6.765591
5d209395-eba1-481d-8033-a2bd4103319f
PacktPublishing/The-Modern-Cpp-Challenge
Chapter04/problem_32/main.cpp
#include <string> #include <iostream> #include <cmath> unsigned int number_of_digits(unsigned int const i) { return i > 0 ? (int)log10((double)i) + 1 : 1; } void print_pascal_triangle(int const n) { for (int i = 0; i < n; i++) { auto x = 1; std::cout << std::string((n - i - 1)*(n / 2), ' '); ...
ALGO
0.999346
5.294137
99d2122b-a66c-4c96-94f1-a8fdf3d1b556
Abhi-0324/LeetcodeSolutions
513-find-bottom-left-tree-value/513-find-bottom-left-tree-value.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l...
ALGO
0.999994
6.53393
05ced3e8-aa30-4613-a325-00986c743fee
LouisNguyen25/NGCP_Software_2021_2022
opencv-master/samples/cpp/convexhull.cpp
#include "opencv2/imgproc.hpp" #include "opencv2/highgui.hpp" #include <iostream> using namespace cv; using namespace std; static void help(char** argv) { cout << "\nThis sample program demonstrates the use of the convexHull() function\n" << "Call:\n" << argv[0] << endl; } int main( int argc, c...
ALGO
0.997447
6.011001
96f19ee3-3f84-4e1a-afdf-3fb7141ff30c
dvaitam/codeforces
1000-1999/1400-1499/1490-1499/1491/solG.cpp
#include<bits/stdc++.h> using namespace std; typedef int i_t; typedef int o_t; constexpr size_t iSIZE=1<<23,oSIZE=1<<23; char buf1[iSIZE],buf2[oSIZE],*p1=buf1,*p2=buf2; inline i_t get(){ i_t x=0,f=1; while(*p1<'0'||*p1>'9')if(*(p1++)=='-')f=-1; while(*p1>='0'&&*p1<='9')x=x*10+(*(p1++)^48); return f*x; } ...
ALGO
0.99985
3.627582
9ea7f011-a3b0-499c-b13d-a1c837f37894
xu582/Note
CS/C++/Dev-C++/ExerciseBook/07.17/07.17.cpp
#include <stdio.h> #include <stdarg.h> // ṩva_listva_startva_argva_end #include "Status.h" //**01 **// #include "OLGraph.h" //**07 ͼ**// /* * 붥 * * ָĶv׷ӵ㼯УδöĹϵ */ Status InsertVex_7_17(OLGraph* G, VertexType v); /* * ɾ * * Ӷ㼯ɾָĶvעҪصĶϵ */ Status DeleteVex_7_17(OLGraph* G, VertexType v); /* * /<v, w> * ...
ALGO
0.985501
3.716935
5df808ef-18c1-4b83-a966-e4e86b417e2a
aprateek29/Coding
DP/07_Kashish/06_comb_sum_4.cpp
#include <iostream> #include <climits> using namespace std; int solve(int arr[], int n, int target) { if (target == 0) return 1; if (n == 0) return 0; if (arr[n-1] > target) { return solve(arr, n-1, target); } else { return solve(arr, n, target-arr[n-1]) + solve(arr, n-1, target); ...
ALGO
0.999977
5.72065
3573d0de-a644-41d9-b530-fdbda761a16c
vaibhavsharma7221/DSA_Ab
15) Deleting Node if only one pointer to that node is given.cpp
//Deleting Node if only one pointer to that node is given #include <iostream> using namespace std; struct node { int data; node *next; } node *head=NULL; void deletenode(node *ptr) { node *temp; temp=ptr->next; ptr->data=temp->data; ptr->next=temp->next; free(temp); }
ALGO
0.998555
3.701377
5f1f59b1-5573-404f-8f33-fce527a96852
AndreMouche/algorithms_study
leetcode/longest-substring-without-repeating-characters.cpp
/** * https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/ * find the longest substring without repeating characters * hashmap,two point(left & right) */ #include<stdio.h> #include<string> #include<iostream> using namespace std; class Solution { public: int lengthOfLongestSubstring(...
ALGO
0.999812
4.162079
901ed52c-ca3e-4e5e-9ea3-8325ae019298
DedsecKnight/kattis-competitive-programming
math/luggage.cpp
#include <bits/stdc++.h> using namespace std; using ui = unsigned int; using ll = long long; using ld = long double; template <typename K, typename V> using umap = unordered_map<K, V>; #define null NULL #define len(a) int((a).size()) #define present(c, x) (c.find(x) != c.end()) #define inrange(val, start, end) (val...
ALGO
0.999975
4.071085
3c3d1288-9d34-4fa2-87e4-748b88b637bc
raincross7/code-similarity
codes/train_code/problem017/problem017_437.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define whole(x) (x).begin(),(x).end() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) using P = pair...
ALGO
0.999674
4.025108
021b9129-d380-49b3-bc2e-98dc743cb3fe
mirthfulLee/AlgorithmExecise
PAT/Advanced Level/Tree/AVLTree/1123 Is It a Complete AVL Tree.cpp
#include<iostream> #include<cmath> #include<queue> using namespace std; struct node { int val; node* left, * right; }; int N, temp, flag = 1; node* root = NULL; queue<node*> q; int getHeight(node* root) { return root == NULL ? 0 : max(getHeight(root->left), getHeight(root->right)) + 1; } int getBalanceFactor(node*...
ALGO
0.999996
4.554354
00d2e5d5-1541-4260-a93c-7c8c6d7ec10b
ishandutta2007/codeforces
feecie6418/normal/1528/B.cpp
#include<bits/stdc++.h> using namespace std; const int mod=998244353; int n,s[1000005],f[1000005]; int main(){ cin>>n; for(int i=1;i<=n;i++)for(int j=i;j<=n;j+=i)f[j]++; for(int i=1;i<=n;i++)f[i]=(f[i]+s[i-1])%mod,s[i]=(s[i-1]+f[i])%mod; cout<<f[n]%mod; }
ALGO
0.999969
4.465518
9a59f763-6ca3-43c6-9175-5dc3fd557df3
Andwerpz/Competitive-Programming-Practice
- cpp -/treexor.cpp
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; //Codeforces - 1882D //came up with O(20n) solution, which is too slow. vector<vector<int>> c; vector<vector<int>> c_ind; vector<vector<bool>> bits; vector<vector<int>> sub_size; //i : node, j : parent index vector<vector...
ALGO
0.999781
4.544373
239a51b3-3c12-405a-9af9-33c874257f70
224kmk/Algorism-C
Algorism-C/BitSetTest.cpp
// BitSetTest // Ʈͷ ǥ #include <stdio.h> #include "BitSet.h" enum { ADD, RMV, SCH }; // Է int scan_data(int sw) { int data; switch (sw) { case ADD: printf("߰ : "); break; case RMV: printf(" : "); break; case SCH: printf("˻ : "); break; } scanf_s("%d", &data); return data; } ...
TEST
0.91719
4.64493
67e336a1-57b1-41bb-aaa8-6f40903c0335
someblue/ACM
hdu/bc7/A/main.cpp
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <vector> #include <map> #include <utility> #include <queue> #include <stack> using namespace std; const int INF=1<<30; const double eps=1e-6; const int N = 100010; int fa[N],n,a[N]; vector<int> ans[N]; int find(int...
ALGO
0.998652
4.251689
1983fc56-0b76-46a4-bc6a-200b4cf65b4d
biTreel/huaweiOJ
huawei_OJ/express.cpp
/* * Author: biTree * Date: July,04,2016 */ #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stdexcept> using namespace std; bool toPostfix(string infixExp,vector<string>& postfixExp); bool isHighEq(char,char); int getResult(const vector<string> postfixExp); long str2L(string s...
ALGO
0.999911
4.247915
306c5d87-3c8c-4b4a-ae0c-c61733324789
ptt743/atcoder
problems/abc299_c.cpp
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<queue> #include<stack> #include <atcoder/all> using namespace std; using namespace atcoder; //*****taipt*****// void solve(){ int n; string s; cin>> n; cin>> s; vector<int> sum(n+1); for(int i =0;i< n;i++){ if(s[i]=='-')su...
ALGO
0.999798
4.316415
7dc1c0eb-2692-4f1c-895f-43c83060ba5f
meowmeow321/cp-snippets
some good fuckin snippets/USACO-master/Contests/USACO Solutions/2016-17/Jan 2017/Silver/17 Jan S2.cpp
// #include<iostream> #include<fstream> #include<set> #include<map> #include<unordered_map> #include<cmath> #include<cstring> #include<string> #include<bitset> #include<algorithm> #include<vector> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gn...
ALGO
0.999559
3.560793
c56aaa6d-dc2e-407f-b98b-a0afaba99479
cxlove/ACM_ICPC
Regional/Jakarta2013/J.cpp
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cctype> #include <cstring> #include <vector> #include <sstream> #include <set> #include <ctime> #include <queue> #include <map> #include <stack> #include <cmath> using namespace std; const int N = 1000000; const int MOD = 1000000007;...
ALGO
0.99942
3.671213
3f2e33f9-5c69-454d-bd8c-2a9c3c9dcb4c
lammps-qmdff/lammps-qmdff
lammps-modified/src/USER-OMP/bond_table_omp.cpp
/* ---------------------------------------------------------------------- Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ #include "bond_table_omp.h" #include "atom.h" #include "comm.h" #include "force.h" #include "neighbor.h" #include "dom...
ALGO
0.999248
6.518344
08f7074d-6018-4839-ba30-c11775a6a78a
Meherab151175/graph_tree_stack_que_linked_list
tree_revision/review_algo/algo-week-02/ass2-1.cpp
#include <bits/stdc++.h> using namespace std; class Edge { public: int a, b, c; Edge(int a, int b, int c) { this->a = a; this->b = b; this->c = c; } }; int main() { bool cycle = false; int n, e; cin >> n >> e; int dis[1005]; vector<Edge> edge_list; whil...
ALGO
0.999986
4.617398
8f8cb278-87fd-48d3-bd81-e3a18d35a266
mrinmoy96/LeetCode-Solve
0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp
class Solution { public: int removeDuplicates(vector<int>& nums) { sort(nums.begin(), nums.end()); int j=1; for(int i=1; i<nums.size(); i++){ if(nums[i]!=nums[i-1]){ nums[j]=nums[i]; j++; } } return j; } };
ALGO
0.999926
6.102698
c9b613c6-0a2d-415c-a426-c1bd90994ad6
nehcoah/algorithm-template
leetcode/weekly/407/a.cpp
class Solution { public: int minChanges(int n, int k) { int ans = 0; for (int i = 30; i >= 0; i--) { if (n >> i & 1) { if ((k >> i & 1) == 0) ans += 1; } else { if (k >> i & 1) return -1; } } return ans; } };
ALGO
0.999923
5.377311
3936a773-58e2-4e02-a115-105338f45632
13751080/2025aaib
week13-4.cpp
/// week13-4.cpp gQѪDD, C++ Ӽg /// LeetCode 3335. Total Characters in String@After Transformations I /// 'a'|'b', 'b'|'c' ... 'z'|2Ӧr 'a' M 'b' class Solution { public: int a[200000] = {}; int helper(int t) { if( a[t] > 0 ) return a[t]; if( t<26 ) return 1; a[t] = (helper(t-26) + helper...
ALGO
0.999925
5.719094
2cacabd9-13ea-4d1d-b532-61561b209718
zexTira/leetcode-with-cpp
Leetcode/Q.61 Rotate List/61.cpp
/*// // The specific description can be seen below. //*/ // 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 { pu...
ALGO
0.999982
5.967453
d0b1ed3d-d3b2-42cf-bf29-775a4f6a21cc
raincross7/code-similarity
codes/train_code/problem201/problem201_393.cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) long long mo = 1e9 + 7; typedef long long ll; typedef pair<int,int> P; int main(){ ll N; cin >> N; vector<ll> A(N), B(N); vector<pair<ll,ll>> C(N),D(N); rep(i,N){ cin >> A[i] >> B[i]; C[i] = make_p...
ALGO
0.99998
3.860207
25f4f32e-6475-4d4c-af08-3ba7bc62e743
codedbykav/gfg-potd
[11-01-2025]longest substring with distinct characters.cpp
int longestUniqueSubstr(string &s) { // code here int n = s.size(), i = 0, j = 0, ans = 0; vector<bool> freq(26, false); while(j<n) { int val = s[j]-'a'; while(freq[val]) { freq[s[i]-'a'] = false; i++; } ans ...
ALGO
0.999876
5.529718
ca7773ef-1675-4009-ba5c-0f5f86abebc0
akien-mga/godot-test
core/math/rect2.cpp
/**************************************************************************/ /* rect2.cpp */ /**************************************************************************/ /* This file is part of: */ /* ...
TOOL
0.854476
7.360169
5207d1e6-35ea-494f-8b50-4c16778e7049
FalseG0d/Algorithm-Data-Structure
LeetCode/Medium/PrintLIS.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: vector<int> longestIncreasingSubsequence(int n, vector<int>& arr) { // Code here if(n == 1) return arr; vector<int>dp(n, 1); vector<int>prev(n, -1); ...
ALGO
0.999972
6.306373
b1705334-bb9c-42cc-84e2-4f358f715bdd
SJMA11723/Problem-solving
codeforces/Codeforces Round 504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)/E.cpp
/** * Author: Jorge Raul Tzab Lopez * Github: https://github.com/SJMA11723 */ #include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string ans_l; int r = 1, c = 1; while(n - r + n - c > n - 1){ string res; if(r < n){ cout << "? " << r + 1 << ' ' << c <...
ALGO
0.999841
3.31996
54ed90e2-36a7-4c6d-a43e-b9b1b305fd72
ishandutta2007/codeforces
noimi/normal/1328/D.cpp
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define...
ALGO
0.999899
3.460979
e360baad-b6be-4494-927c-846c9c1720de
ZhdanovaAnna/Tyuiu.ZhdanovaAA.Sprint0
Tyuiu.ZhdanovaAA.Sprint0.Task4.V2/Tyuiu.ZhdanovaAA.Sprint0.Task4.V2.cpp
// Tyuiu.ZhdanovaAA.Sprint0.Task4.V0.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include "../Tyuiu.ZhdanovaAA.Sprint0.Task4.V0.Lib/Tyuiu.ZhdanovaAA.Sprint0.Task4.Lib.cpp" using namespace std; int main() { ISprint0Task4* service = new Service3(); cout...
TOOL
0.899505
3.314455
41084500-017d-4749-8a66-1d7e2d06c1ba
TheShivamChand/Codes-and-Algos
SPOJ/Adding Reversed Numbers ADDREV.cpp
#include<bits/stdc++.h> #define ll unsigned long long int using namespace std; ll reverse(ll n) { ll rev=0; while(n>0) { rev=rev*10+n%10; n/=10; } return rev; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll t; cin>>t; while(t--) { ll a,b; cin>>a>>b; a=reverse(a);...
ALGO
0.999615
5.536901
0a55cc73-e9b1-4572-b99b-06655fc3b48f
Soli1065/habit_tracker
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.998799
6.776823
5be68653-0bb0-43f7-94da-84dba3e32407
CodyChilders/Minotaur
Source/CPP/PrimMazeGenerator/PrimMazeGenerator/Graph.cpp
//Cody Childers //<EMAIL> //Kyle Sullivan //<EMAIL> #include <iostream> #include <cstdlib> #include <fstream> #include <climits> #include <vector> #include "List.h" #include "Graph.h" #define and && #define or || #define not ! using namespace std; //colors! :D typedef enum colors{ red, green, blue, rg, rb, gb, rg...
ALGO
0.985703
3.798296
31691603-b133-48df-b213-33172c009729
sarvex/leetcode-fortran
solution/0900-0999/0913.Cat and Mouse/Solution.cpp
const int HOLE = 0; const int MOUSE_START = 1; const int CAT_START = 2; const int MOUSE_TURN = 0; const int CAT_TURN = 1; const int MOUSE_WIN = 1; const int CAT_WIN = 2; const int TIE = 0; class Solution { public: int catMouseGame(vector<vector<int>>& graph) { int n = graph.size(); int res[n][n][2]...
ALGO
0.999927
5.477991
028c1de9-be75-430d-a0cd-03e953c63f53
Shravan40/Algorithms
topological_sort.cpp
#include <iostream> #include <list> #include <stack> using namespace std; class Graph { int v; list<int> *adj; void topological_sort_util(int v, bool visited[], stack<int> &Stack); public: Graph(int v); void add_edge(int v, int w); void topological_sort(); }; Graph::Graph(int v) { this->v...
ALGO
0.999992
5.995586
037c3b7c-9e44-4c4d-a847-e3408816c984
BlackFrogKok/test
src/libigl/igl/setdiff.cpp
template < typename DerivedA, typename DerivedB, typename DerivedC, typename DerivedIA> IGL_INLINE void igl::setdiff( const Eigen::DenseBase<DerivedA> & A, const Eigen::DenseBase<DerivedB> & B, Eigen::PlainObjectBase<DerivedC> & C, Eigen::PlainObjectBase<DerivedIA> & IA) { using namespace Eigen; usi...
ALGO
0.981818
6.075979
5ae5b31c-f7e8-4c06-8edf-31d71e183eb2
DuCLeK65t/LTNC_25
Week 2/C2.cpp
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 1;i <= n;i++) { for (int j = 1;j < i;j++) cout << " "; for (int k = i;k <= n;k++) cout << "*"; cout << endl; } return 0; }
ALGO
0.999894
3.673512
3fc24177-2704-4517-a661-d4f41a316ab4
Redleaf23477/ojcodes
uva/1588.cpp
#include <bits/stdc++.h> using namespace std; int run(const string &t, const string &p) { int ans = t.size() + p.size(); // right for (size_t i = 0; i < t.size(); i++) { bool good = true; for (size_t j = 0; j < p.size() && i + j < t.size(); j++) { if (p[j] == '2' && t[i+j] == '2...
ALGO
0.996602
4.776217
5816010d-7c0f-47f0-8b1a-ce823c605f4c
anujcontractor/CSES--Problems
Dynamic Programming/countingTowers.cpp
#include <algorithm> #include <iostream> #include <vector> #include <bits/stdc++.h> using namespace std; #define int long long int MOD = 1e9+7; vector<int> ans(1e6+1); int32_t main() { // Your code goes here; int t; cin>>t; int prev0 = 1, prev1 = 1; for (int i = 1; i <= 1e6; i++) { ...
ALGO
0.999785
4.363397
304977f5-9b67-44a5-a709-861873d3ee43
JasmitKaur/Programming-practice
general problems/DP/dp_optimal_startegy_for_a_game.cpp
#include "math.h" #include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <climits> #include <deque> #include <queue> #include <stack> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <cstdlib> #include <fstream> #include <numeric> #include <sstream> #inc...
ALGO
0.999986
4.007141
761974ef-8ec8-4308-8491-168302e1f5a6
Wencelsav/2048
001.cpp
#include <iostream> using namespace std; int bmp[4][4]; bool up(int uper[4][4]){ bool any=true; for(int j=0;j<4;j++){ int n=0; while(n<4){ if(uper[j][0]!=0){if(uper[j][0]==uper[j][1]){uper[j][1]+=uper[j][0]; uper[j][0]=0;n=3; }else{any=false;break;}} for(int i=0;i<3;i++){ uper[j][i]=upe...
ALGO
0.999657
3.049192
adc2f78d-b239-401a-8edd-9e26a61cb701
anushri2325/6Companies30days
Goldman Sachs/07_distribution.cpp
Problem Link : https://practice.geeksforgeeks.org/problems/find-the-position-of-m-th-item1723/1 ****************************************************************************************************** class Solution { public: int findPosition(int N , int M , int K) { int ans= (K+M-1)%N; if(ans==0)...
ALGO
0.999951
4.249394
fd9ca51a-50a1-4e87-a2f8-90b6126a0e20
freebsd/freebsd-ports
biology/gcta/files/patch-main_mkl.cpp
--- main/mkl.cpp.orig 2023-11-20 14:09:49 UTC +++ main/mkl.cpp @@ -365,7 +365,9 @@ bool gcta::comput_inverse_logdet_LDLT_mkl(eigenMatrix #if GCTA_CPU_x86 dpotrf(&uplo, &int_n, Vi_mkl, &int_n, &info); #else - dpotrf_(&uplo, &int_n, Vi_mkl, &int_n, &info); + // OpenBLAS 0.3.25 requires a length argument. I...
ALGO
0.995821
6.65293
fc475700-f474-4189-8f30-56b560095eab
st117165/2023-cpp-autumn
2023.12.14-homework-7/Project2/Source.cpp
#include<iostream> #include<fstream> #include<string> #include<cstring> /*find the most common word. realise function defining palindrom*/ bool isSyntax(char c) { return (c == '.' || c == '?' || c == '!' || c == ',' || c == ';' || c == ':'); } void Syntax(std::string* word, int n) { for (int i = 0; i < n; ++i) { ...
ALGO
0.99912
4.706153
b7a3dc4f-11fa-4654-b5eb-f036dbb0eba4
ojusvini/DAA-Codes
daa lab3/dp/matriz.cpp
#include<stdio.h> #include<limits.h> int main(){ int n,i; scanf("%d",&n); int arr[n]; for(i=0;i<n;i++) { scanf("%d",&arr[i]); } int m[n][n]; int l,j,k,q; for(i=1;i<n;i++) { m[i][i]=0; } for(l=2;l<n;l++) { for(i=1;i<=n-l+1;i++) { j=i+l-1; m[i][j]=INT_MAX; for(k=i;k<j;k++) { q=m[i][k]+m[k+1][...
ALGO
0.999959
3.020751
c5f55981-6bc1-4c76-8880-a916e1527793
IvanPopJovanov/AR-projekat-2023
Completion.cpp
#include "Completion.h" #include "Rewrite.h" #include "LPO.h" #include <set> #include <queue> #include <list> void getVars(Term t, set<string>& vars) { switch (t->getType()) { case BaseTerm::TT_VARIABLE: vars.insert(t->getVariable()); break; case BaseTerm::TT_FUNCTION: for (auto arg : t->getOperands()) { ...
ALGO
0.999841
3.795104
ef462080-d37c-40d7-8278-87a8666b476a
vaudaine/Comparing_embeddings
Snap/snap-core/flow.cpp
namespace TSnap { // Returns the NId where the two directions of search meet up, or -1 if no augmenting path exists. ##TSnap::IntFlowBiDBFS int IntFlowBiDBFS (const PNEANet &Net, const int& CapIndex, TIntV &Flow, TIntQ &FwdNodeQ, TIntH &PredEdgeH, TIntQ &BwdNodeQ, TIntH &SuccEdgeH, const int& SrcNId, const int& SnkNId...
ALGO
0.999914
4.826702
0e3788a0-cdd1-48f2-b20a-c5aa677b009e
projectchrono/chrono
src/chrono/functions/ChFunctionFillet3.cpp
#include "chrono/functions/ChFunctionFillet3.h" namespace chrono { // Register into the object factory, to enable run-time dynamic creation and persistence CH_FACTORY_REGISTER(ChFunctionFillet3) ChFunctionFillet3::ChFunctionFillet3(const ChFunctionFillet3& other) { m_width = other.m_width; m_val_start = othe...
TOOL
0.976597
6.258818
7d770983-f774-4440-88a1-06b40648c241
ahmedibrahim404/CompetitiveProgramming
CF Contests/Contest_Div2_561/C/main.cpp
#include<bits/stdc++.h> using namespace std; int n; int a[200010]; int main(){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&a[i]); if(a[i]<0) a[i] = -a[i]; } sort(a,a+n); long long ans = 0; for(int i=0;i<n;i++){ ans += upper_bound(a,a+n,2*a[i])-a-1-i; } printf("%lld",ans); }
ALGO
0.999857
3.7198
53225b6d-896e-49b7-b89c-e0e7eb2d2f39
noahc66260/C-PrimerPlus
Chapter3/pe3-5.cpp
// pe3-5.cpp -- computes miles per gallons driven by a vehicle // This is exercise 5 of chapter 3 in C++ Primer Plus by Stephen Prata #include<iostream> int main(void) { using namespace std; cout << "How many miles have you driven? "; double miles; cin >> miles; cout << "How many gallons have you used? "; doubl...
ALGO
0.982761
3.762422
1f027d63-5276-46be-913b-2d646f86fc4d
lekleoni/Wisata-candi-leonii
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.9988
6.76073
32e843f8-f8d5-4536-a251-18c08ccb1cb5
raincross7/code-similarity
codes/train_code/problem415/problem415_207.cpp
#include <cmath> #include <iostream> #include <algorithm> #include <list> struct Point { double x; double y; }; typedef std::list<Point> List; Point GetU(const Point& s, const Point& t) { const double thete = 60. / 180. * M_PI; Point st = {t.x - s.x, t.y - s.y}; Point su = {st.x * std::cos(thete) -...
ALGO
0.9999
3.777011
fa2d3a6a-15c3-41de-89ba-4038d90a3322
TakumaSato777/Atcoder
20230202/a2.cpp
#include <iostream> using namespace std; int main() { int a,b; string s; cin >> a >> b; if (a*b % 2 == 0){ s = "Even"; } else{ s = "Odd"; } cout << s << endl; return 0; }
ALGO
0.999966
4.485902
a273726a-0f34-435c-a66a-b2473148cfc1
dmkz/competitive-programming
acmp.ru/0994.cpp
/* Решение двумерным ДП: 1. Предподсчитаем pref[i][j] = len - длина совпадающего суффикса на префиксе a[0..i] и b[0..j] 2. Предподсчитаем suff[i][j] = len - длина совпадающего префикса на суффиксе a[i..n) и b[i..n) 3. Предподсчитаем best_pref[i][j] = {pos, len} - н...
ALGO
0.999968
4.814213
aab1532d-0058-45da-b2ca-d03ca2280a8b
ishandutta2007/codeforces
radal/normal/1594/E1.cpp
#include <bits/stdc++.h> #pragma GCC optimize("O2") #pragma GCC target("avx2,fma") #define rep(i,l,r) for (int i = l; i < r; i++) #define repr(i,r,l) for (int i = r; i >= l; i--) #define X first #define Y second #define pb push_back #define endl '\n' #define debug(x) cerr << #x << " : " << x << endl; using namespace st...
ALGO
0.99993
4.980804
4da87324-2b84-4358-91bb-b682dccf6f9f
hoshinohikari/learning
test16.cpp
#include <iostream> #include <string> #include <cmath> int main() { std::string A, B; char DA, DB; double PA, PB, ca = 0, cb = 0; long long sum = 0; std::cin >> A >> DA >> B >> DB; PA = (int)DA - 48; PB = (int)DB - 48; for(int i = 0; i < A.length(); i++) if (A[i] == DA) ca++; for(int i ...
ALGO
0.999206
4.065045
1eea7f24-f8a5-43df-96b5-5201b331f72a
starrykss/ProblemSolving
Baekjoon Online Judge (BOJ)/Codes/BOJ1463.cpp
#include <iostream> #include <cmath> using namespace std; int N; int dp[1000001]; void Input() { cin >> N; } int Solution(int n) { dp[1] = 0; // 1의 경우 연산 횟수 0 for (int i = 2; i <= n; i++) { dp[i] = dp[i - 1] + 1; if (i % 2 == 0) { // 2로 나누어 떨어질 경우 dp[i] = min(dp[i], dp[...
ALGO
0.999936
5.284708
16ffa998-d712-42cf-a3aa-667d6f85442f
rahul897/cs_cpp_old
tree/bfftree.cpp
#include<iostream> using namespace std; int d=1; struct bnode {int *data; bnode **child; bnode *pt; int c; bnode(){data=new int[2*d+1],child=new bnode*[2*d+2];c=0;pt=NULL; for(int i=0;i<2*d+1;i++){data[i]=-1;child[i]=NULL;}child[2*d+1]=NULL;} }; bnode *root; int isleaf(bnode *&t) {return t->child[0]==NULL?1:0;} int ...
ALGO
0.999953
4.245548
f767a6e5-e205-43c2-9c11-ae9b3580e2b7
jjjano/MLFNet
lib/regressor/eigen/doc/examples/TutorialLinAlgInverseDeterminant.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Matrix3f A; A << 1, 2, 1, 2, 1, 0, -1, 1, 2; cout << "Here is the matrix A:\n" << A << endl; cout << "The determinant of A is " << A.determinant() << endl; cout << "The inverse of A is:\n...
ALGO
0.999586
4.186114
ecd536ad-97cd-448c-b41a-7886193eb313
TiagoMLucio/Competitive-Programming
codeforces/Problems/B_Monsters.cpp
#include "bits/stdc++.h" #include <chrono> using namespace std; using ll = long long; using ld = long double; using str = string; #define sz(x) static_cast<int>((x).size()) #define endl '\n' #define int ll using ii = pair<int, int>; #define mp make_pair #define f first #define s second using iii = tuple<int, int, i...
ALGO
0.999748
3.987494
dd36f82f-fe17-47d5-80d8-e08bed087dbc
A-nnonymous/psoTsetlinMachine
src/tsetlin/io.cpp
#include "io.h" bool DNA2SIG (std::string raw_inputpath, std::string raw_outputpath, int buffer_size, bool cleave_zero) { // (A)denine represented by -1 // (T)hymine represented by 1 // (C)ytosine represented by -2 // (G)uanine represented by 2 std::ifstream input (raw_inputpath...
DATA
0.98938
5.238027
246ce83d-6330-4235-817e-e4ad99c2f184
epulhisham/fileuploader-frontend
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998756
6.772262
d626cd17-2387-42ed-b1c7-18c549b2a221
liviaceciliags/projetos-algoritmos
rec potencia.cpp
#include <iostream> #include <cmath> using namespace std; int rec(int a, int n) { if (n == 0) return 1; else return a * rec(a, n - 1); } int main() { int a; int n; cin >> a; cin >> n; cout << rec(a, n); return 0; }
ALGO
0.99989
3.880737
f3799fe8-6084-41ff-84a1-ec906373bac7
HanYouyang/Computer
数据结构与算法/PATCode/乙级/PAT (Basic Level) Practise/1008_arrayRotateRight.cpp
// (14 point)This version is wrong with two testpoint #include <stdio.h> #define maxn 105 void reverse(int * a, int low, int high){ while(low < high){ int temp = a[low]; a[low] = a[high]; a[high] = temp; low++; high--; } } int main() { int N, M; // int tag = 1; int array[maxn]; scanf("%d%d", &N, &M);...
ALGO
0.999982
3.249191
52f59783-ffd9-4a3f-969d-3a50f8de53ef
F3lixxx/Algorithm_and_struct_data
HW05_Pyramids_and_search_trees/HW01_Output_of_a_pyramid_on_an_array/main.cpp
#include <iostream> void print_pyramid( int *arr, int size) { int levels = 0; int index = 0; while (index < size) { int elementsInLevel = 1 << levels; // 2^levels for (int i = 0; i < elementsInLevel && index < size; ++i) { std::cout << "Level " << levels << " "; if (levels == 0) { std::cout << "(root): "; } ...
ALGO
0.998832
4.486978
e4979d83-57f6-48a6-8d4d-13288461dafb
ravishankar01661/ravishankar01661
C++/Patterns/Hollow Diamond Pattern.cpp
#include <iostream> using namespace std; int main() { int size = 5; // Change the size of the square pattern int spaces = size - 1; for (int i = 1; i <= size; i++) { for (int j = 1; j <= spaces; j++) { cout << " "; } spaces--; for (int j = 1; j <= 2 * i - 1; j...
ALGO
0.999516
4.425991
b69d060a-9b1b-4338-b14b-608d9f75103b
NalinDalal/codeforces
215.1325A.cpp
/*A. EhAb AnD gCd time limit per test1 second memory limit per test256 megabytes You are given a positive integer 𝑥 . Find any such 2 positive integers 𝑎 and 𝑏 such that 𝐺𝐶𝐷(𝑎,𝑏)+𝐿𝐶𝑀(𝑎,𝑏)=𝑥 . As a reminder, 𝐺𝐶𝐷(𝑎,𝑏) is the greatest integer that divides both 𝑎 and 𝑏 . Similarly, 𝐿𝐶𝑀(𝑎,𝑏) ...
ALGO
0.999864
5.01166
7cf021bf-ece5-4ff3-a186-8f5f25d31159
MaithreyanJK/Operating-system
program 18.cpp
#include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> // for usleep function #define BUFFER_SIZE 5 sem_t empty, full; pthread_mutex_t mutex; int buffer[BUFFER_SIZE]; int in = 0, out = 0; void *producer(void *arg) { int item = 1; while (1) { sem_wait(&empty); // Wait for a...
ALGO
0.988413
6.358038
b3115a93-769f-49b7-b6d6-b8d7ee2e99ae
GBO/epsi-2023-sn1
corrections/exercice-2.1.cpp
// Inclusion de la librairie iostream qui permet d'utiliser entre autre `cin` & `cout` #include <iostream> // Utilisation du namespace std pour s'économiser quelques caractères plus bas. // Sans cette instruction, il faudrait toujours utiliser `std::cout` au lieu de `cout` using namespace std; // Déclaration et implém...
TOOL
0.941461
3.506793