uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
be522811-35b7-4754-ac3a-d35c6550057c | wisdompeak/LeetCode | Tree/1569.Number-of-Ways-to-Reorder-Array-to-Get-Same-BST/1569.Number-of-Ways-to-Reorder-Array-to-Get-Same-BST.cpp | class Solution {
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
long M = 1e9+7;
long comb[1001][1001];
long getComb(long m, long n)
{
if (comb[m][n]!=-1)
return comb[m][n];
... | ALGO | 0.999996 | 5.432317 |
f9315e4b-c2e1-41f2-8cf9-cd6222dfec7d | shady-cs15/visod | stereotest.cpp | #include "iostream"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include <pcl/common/common_headers.h>
#include <pcl/io/io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include "libelas/elas.h"
#include "libel... | ALGO | 0.979549 | 5.394622 |
ffb090b9-d28b-4ab0-9ff2-a40be48484bd | PavitraMahakulkar/cp- | code/testOfLove.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,m,k;
cin>>n>>m>>k;
string s;
cin>>s;
if(m>n) cout<<"YES"<<endl;
else{
bool flag=true;
int i=0;
while(i<n){
... | ALGO | 0.999616 | 3.198629 |
2b9d8f4e-858d-4429-bf55-fefd04270da0 | marshtv/12.5.2-Sorting | main.cpp | #include <iostream>
int main() {
const int N = 15;
float x[N];
std::cout << "Input 15 float numbers to sort:\n";
for (int i = 0; i < 15; i++) {
std::cin >> x[i];
}
int left = 0, right = N - 1;
while (right - left > 0) {
for (int i = left; i < right; i++) {
if (x[i] < x[left]) {
// std::cout << "x["... | ALGO | 0.999748 | 3.789379 |
7cd96978-47cf-4bef-8dc1-9c357a663eb1 | muhammadhasan01/cp | Library/Math/Matrix_Exponantion.cpp | // C++ program to find value of f(n) where f(n)
// is defined as
// F(n) = F(n-1) + F(n-2) + F(n-3), n >= 3
// Base Cases :
// F(0) = 0, F(1) = 1, F(2) = 1
#include<bits/stdc++.h>
using namespace std;
// A utility function to multiply two matrices
// a[][] and b[][]. Multiplication result is
// stored back in b... | ALGO | 0.999995 | 5.442201 |
2fa7a346-bb69-418b-a292-d28181a992bf | erickgonzalez2/Soluciones-Programacion-Competitiva | Recursividad/potencia_recursiva.cpp | #include <stdio.h>
int potencia(int n,int e){
int p;
if(e==0){
p= 1;
}
else{
p = n*potencia(n,e-1);
}
return p;
}
int main(){
int num;
int exp;
int producto;
scanf("%d %d",&num,&exp);
producto = potencia(num,exp);
printf("%d",producto);
}
| ALGO | 0.999996 | 4.031299 |
2c1e4134-2826-447d-b9d5-7ddac0c507de | JohannesOrland/Intervallarithmetik | intervall.cpp | #include "intervall.h"
Intervall::Intervall(double inf1, double sup1):inf(inf1), sup(sup1){
if(inf > sup){
double tmp;
tmp=inf;
inf=sup;
sup=tmp;
}
}
Intervall::Intervall(double infsup){
inf=infsup;
sup=infsup;
}
string Intervall::printToString(){
stringstream numb... | TOOL | 0.96699 | 4.502149 |
9707b285-a753-47c4-8681-dc5a442731e7 | TravHaran/premium_algo_100_cpp | heap/high_five/solution2.cpp | class Solution {
public:
vector<vector<int>> highFive(vector<vector<int>>& items) {
// min heap
unordered_map<int, priority_queue<int, vector<int>, greater<int>>> marks;
for(auto& el : items){
int id = el[0];
int score = el[1];
marks[id].push(score);
... | ALGO | 0.999899 | 5.906039 |
15fe07e4-15ae-4ef7-a8fe-d8d8398f7142 | SibtainAhmed/LeetCode-Repo | 1-two-sum/two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> numMap;
// for (int j=0; j<nums.size(); j++){
// numMap[nums[j]] = j;
// }
for (int i=0; i < nums.size(); i++){
int diff = target - nums[i];
if... | ALGO | 0.999689 | 6.150464 |
dde59756-3ed0-4778-a436-140dfb3017b7 | PaukIsUha/optimizing_formating_code | predictions/supersonic_predicted_submissions/Codenet/p02267/490365622/7.cpp | #include <stdio.h>
int main() {
int n, S[100], q, T[500], i, j, cnt = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &S[i]);
scanf("%d", &q);
for (j = 0; j < q; j++)
scanf("%d", &T[j]);
}
for (i = 0; i < q; i++) {
for (j = 0; j < n; j++)
if (T[i] == S[j]) {
cnt++;
... | ALGO | 0.999773 | 3.473378 |
b3997a1a-fdc5-4a91-9856-23b785dc13ae | fridec13/codetree | 241104/2021년 날짜의 유무/with-or-without-2021.cpp | #include <iostream>
using namespace std;
int year2021[13] = {
0, 31, 28, 31,30,31,30,31,31,30,31,30,31
};
bool IsExist(int m, int d)
{
if ( 1 <= d && d <= year2021[m]) return true;
return false;
}
int main() {
// 여기에 코드를 작성해주세요.
int m, d;
cin >> m >> d;
if (IsExist(m,d))
{
cou... | ALGO | 0.999976 | 3.898675 |
cc1e613a-a535-4b58-aa8f-67cc3fa52a85 | sarvex/leetcode-dart | solution/2300-2399/2381.Shifting Letters II/Solution.cpp | class Solution {
public:
string shiftingLetters(string s, vector<vector<int>>& shifts) {
int n = s.size();
vector<int> d(n + 1);
for (auto& e : shifts) {
if (e[2] == 0) {
e[2]--;
}
d[e[0]] += e[2];
d[e[1] + 1] -= e[2];
}... | ALGO | 0.999973 | 6.54686 |
eaf3e4ab-352c-4282-bb9c-76462e987ad1 | ashutosh1598/Codeforces | 431/4.cpp | #include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff firs... | ALGO | 0.994366 | 3.407196 |
007f065c-832f-497d-803d-b4a83cf9c7b2 | 24icewolf42/gtsam | gtsam/3rdparty/Eigen/test/sparse_solvers.cpp | #include "sparse.h"
template<typename Scalar> void
initSPD(double density,
Matrix<Scalar,Dynamic,Dynamic>& refMat,
SparseMatrix<Scalar>& sparseMat)
{
Matrix<Scalar,Dynamic,Dynamic> aux(refMat.rows(),refMat.cols());
initSparse(density,refMat,sparseMat);
refMat = refMat * refMat.adjoint();
for (i... | TEST | 0.926794 | 5.216745 |
2811d415-c8b6-43d6-9d6d-d367d62f44b9 | steward-fu/sdl2 | swiftshader/third_party/llvm-10.0/llvm/lib/Transforms/Utils/FunctionComparator.cpp | #include "llvm/Transforms/Utils/FunctionComparator.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/... | TOOL | 0.909977 | 6.710507 |
41f9a54a-aa9e-445e-a070-a79b0a5e6718 | wbf1015/Myleetcode | 字符串/151mid.cpp | class Solution {
public:
string delspace(string s){
bool findfirst=false;
int first_voc=0;
int last_voc=0;
string ret = "";
for(int i=0; i<s.size(); i++){
if(findfirst){
if(s[i]!=' '){
ret.push_back(s[i]);
}else{... | ALGO | 0.999952 | 5.588761 |
5a9b6166-514e-4cc4-8c1e-80865be9ee0d | isaaclo97/programacion-competitiva | Problemas/Acepta el Reto/350.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
while (!(a == 0 && b == 0))
{
printf("%.1f\n", a * (double) b/2);
cin >> a >> b;
}
return 0;
}
| ALGO | 0.999373 | 3.45984 |
31d5a123-954f-4299-9f39-b2e3521345fa | umaidansari12/CP | previous_codes/djikstra_algorithm.cpp | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the shortest distance of all the vertices
//from the source vertex S.
vector <int> dijkstra1(int V, vector<vector<int>> adj[], int S)
{
// Code here
vector<int> distance(V, IN... | ALGO | 0.999971 | 4.985262 |
d7ef524b-ccd9-4e4c-92ea-0a6704049be1 | pratikp2/Turing_Tasks | Task-75643/Turn1-ModelA.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <ratio>
#include <chrono>
// Function to perform resampling
std::vector<double> resample(const std::vector<double>& data, size_t new_size) {
if (data.empty() || new_size <= 0) {
return {};
}
double ste... | ALGO | 0.999607 | 6.739478 |
87bcbe87-36be-4557-b673-eaa6c2366335 | Horidas-Roy/Fundamental | DSA/DS/Week - 3/module - 10/reversedoubliList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node* next;
Node* prev;
Node(int val){
this->val = val;
this->next = NULL;
this->prev = NULL;
}
};
void printList(Node* head){
Node* temp = head;
while(temp != NULL){
cou... | ALGO | 0.999642 | 4.723863 |
a2c9b5ac-e424-4898-b4f4-70a42191f690 | quanglm1998/competitive-programming | codeforces/1257/g.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int MOD = 998244353;
inline int add(int u, int v) {
return (u += v) >= MOD ? u - MOD : u;
}
inline int sub(int u, int v) {
return (u -= v) < 0 ? u + MOD : u;
}
inline int mul(int u, int v) {
return (long long)u * v % MOD;
}
i... | ALGO | 0.999948 | 4.048281 |
2483a146-bf4f-45f1-86f4-28296c088520 | Steema/TeeChart-VCL-samples | TeeNew/Builder2006/CurveFitting_Coef.cpp | //---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "CurveFitting_Coef.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Base"
#pragma link "CurvFitt"
#pragma link "TeeTools"
#p... | TOOL | 0.981728 | 4.067751 |
909f298b-ad9d-4e08-98f1-6a5936d95fde | 308866567/MyHistory | acwing/DP/数位/1086.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, start, end) for (ll i = start; i <= end; i++)
#define rrep(i, start, end) for (ll i = start; i >= end; i--)
#define INF 0x3f3f3f3f
ll n;
const ll N = 20, P = 1e9 + 7;
struct F
{
ll s0, s1, s2;
//个数
//和
//平方的和
} f[N][10][7][7];
//长度,最高位... | ALGO | 0.999389 | 4.757907 |
837887d2-0b5b-4021-a219-533aad21a9ca | Md-Minhajul-Islam/Codeforces | _Random/Fighting_Tournament.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define yes cout << "YES\n"
#define no cout << "NO\n"
#ifndef ON... | ALGO | 0.99987 | 3.929508 |
33556258-7415-436f-9520-96abebf14a99 | LuisFelipeLeivaH/MODI-Retina | opencv-2.4.13.3/modules/features2d/src/blobdetector.cpp | #include "precomp.hpp"
#include <iterator>
//#define DEBUG_BLOB_DETECTOR
#ifdef DEBUG_BLOB_DETECTOR
# include "opencv2/opencv_modules.hpp"
# ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
# else
# undef DEBUG_BLOB_DETECTOR
# endif
#endif
using namespace cv;
/*
* SimpleBlobDetector
*/
S... | ALGO | 0.965329 | 6.592241 |
d7e605d4-c857-431a-b83f-bf5c5897b6ff | mochavin/codeforces | 2078/b.cpp | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define endl '\n'
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define loop(i, h) for (int i = 0; i < h; i++)
#define loop1(i, h) for (int i = 1; i <= h; i++)
using namespace std;
ll M = 998244353;
ll N = 2e5 + 10;
void solve()... | ALGO | 0.999931 | 5.161058 |
85bd5765-6d11-4147-bb04-b5ce8d0d5d6f | vidalmatheus/codes | LeetCode/Top/Easy/longestPalindrome.cpp | #include <bits/stdc++.h>
using namespace std;
static int speedUp=[](){
# define endl '\n'
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
class Solution {
public:
int longestPalindrome(string s) {
if (s.size() == 0)
return 0;
... | ALGO | 0.999867 | 5.829177 |
52c93c30-50b1-4654-ad57-21e9523dd1e0 | hako-975/file-dev-cpp | Binary Search 2.cpp | #include<iostream>
using namespace std;
void BinSearch(int data[], int n, int x, int *idx);
int main()
{
int data[] = {90, 80, 78, 65, 54, 45, 32, 23, 19, 4};
int idx, x, i, jmlData = 10;
cout<<"Elemen Array: ";
for(i = 0; i < jmlData; i++)
{
cout<<data[i]<<" ";
}
cout<<endl;
cout<<"Masukkan data yang a... | ALGO | 0.999382 | 5.198264 |
c067be12-f4cc-403b-a40c-19daf2864f4e | Subzero-10/leetcode | .history/150.evaluate-reverse-polish-notation_20200928163540.cpp | /*
* @lc app=leetcode id=150 lang=cpp
*
* [150] Evaluate Reverse Polish Notation
*/
// @lc code=start
class Solution {
public:
int evalRPN(vector<string>& tokens) {
stack<int> s;
int len = tokens.size();
for (int i = 0; i < len; i++)
{
int a = s.top();
s.... | ALGO | 0.999875 | 6.78248 |
f64690ca-7f69-4f4e-a4ce-e405534a2e23 | raincross7/code-similarity | codes/train_code/problem046/problem046_220.cpp | #include <bits/stdc++.h>
using namespace std;
#define M 1000000007
long long int power(int a,int b)
{
if(b==0)
return 1;
long long int k=power(a,b/2);
if(b%2==0)
return ((k%M)*(k%M))%M;
else
return ((k%M)*(k%M)*(a%M))%M;
}
int main()
{
ios_base::sync_with_stdio(false);
ci... | ALGO | 0.999945 | 3.689104 |
a8f1f269-a81f-41f8-a1ec-bbdc14e52eef | deepesh16b/STL | auto.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> v = {1,2,3};
// ------iterator------
vector<int> ::iterator i;
for(i = v.begin(); i != v.end(); i++)
cout<<(*i)<<" ";
cout<<endl;
// -------auto -------
for(auto i: v) //i is an iterator, that points 1st cha... | TOOL | 0.959132 | 3.652045 |
1f5a8b13-dd99-4ad0-a901-7461efb9d26e | efat1531/CP-Solutions | CodeForces/GNU C++17/385A | Bear and Raspberry/75272149.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int n,c;
cin>>n>>c;
vector<int>v;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
v.push_back(a);
}
vector<int>profit;
bool g=0;
for(int i=0;i<v.size();i++)
{
if(v[i]>v[i+1]&&i!=v.size()-1)
{
... | ALGO | 0.999975 | 3.167586 |
a363e5f4-f1cc-4c83-a344-c46acf2ce7d4 | nakshatraraghav/design-and-analysis-of-algorithms | graph-algorithms/network-flow/edmond-karp.cpp | #include <bits/stdc++.h>
using namespace std;
bool bfs(vector<vector<int>> &residue_graph, int source, int sink, vector<int> &parent, int nums_vert)
{
vector<bool> visited(nums_vert, false);
queue<int> q;
q.push(source);
visited[source] = true;
parent[source] = -1;
while (!q.empty())
{
int front = ... | ALGO | 0.999778 | 5.494594 |
0f85db20-44ce-4995-992d-92ec16d9c906 | nPr0nn/AdventOfCode2024 | day2.cpp |
#include <bits/stdc++.h>
using namespace std;
size_t split(const std::string &txt, std::vector<std::string> &strs, const char ch) {
size_t pos = txt.find(ch);
size_t initialPos = 0;
strs.clear();
while (pos != std::string::npos) {
strs.push_back(txt.substr(initialPos, pos - initialPos));
initialPos =... | ALGO | 0.999853 | 5.874062 |
cea9d701-fb07-453b-bf2a-a0b9f2600e5d | djplatt/code | intervals/int_double1.0.cpp | #define VERSION "1.0"
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <limits>
#include <ieeefp.h>
#define _fpu_getcw(cw) asm ("fnstcw %0" : "=m" (cw))
#define _fpu_setcw(cw) asm ("fldcw %0" : "=m" (cw))
unsigned short int old_cw,new_cw;
#define _fpu_with_rounding(id,iu) {_fpu_getcw(old_cw);\
new... | ALGO | 0.976207 | 4.90951 |
9011eb1c-a77a-44e3-a1cf-e81a44eb4649 | Kidist-Ayele/Codeforce_Solutions | Solutions_of_Codeforce/008-WordCapitalization.cpp | #include<iostream>
using namespace std;
int main(){
string m;
cin>>m;
m[0] = toupper(m[0]);
cout<<m;
return 0;
}
| ALGO | 0.992935 | 3.631599 |
6303f7d7-54bc-4835-9fb8-816f3919e616 | sjj118/OI-Code | POJ/3608/code.cpp | #include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define maxn 10010
#define eps 1e-8
#define inf 1e9
#define sqr(x) ((x)*(x))
using namespace std;
int n,m,ar,br,at,bt;
struct Point{
double x,y;
Point(double _x=0,double _y=0){x=_x;y=_y;}
}a[maxn],b[maxn],p[maxn];
Point operator+(Point a,Point b... | ALGO | 0.999799 | 4.478539 |
57aa1480-4482-4f0d-acde-b93d42cbbe32 | ankishb/Algorithm-DS-Problems | trees/find_largest_value_in_each_row.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// Time Complexity: O(n)
// Approach:
// 1. Use level order transversal
// 2. While shifting the level, track its maximum va... | ALGO | 0.999998 | 6.202219 |
97cd8d65-b6f5-450a-96d3-93907d4c24b0 | VictoriaBuchko/multidimensionalDynamicArrays-1- | multidimensionalDynamicArrays(1)/multidimensionalDynamicArrays(1).cpp | //ДЛЯ УДОБСТВА 2 ЗАДАНИЕ ЗАКОМЕНТИРОВАНО( 91 СТРОЧКА )
#include <iostream>
using namespace std;
//Задание 1. Транспонирование матрицы — это операция,
//после которой столбцы прежней матрицы становятся строками, а строки столбцами.Напишите функцию
//транспонирования матрицы.
// Функция для транспонирования матрицы
in... | ALGO | 0.996751 | 3.747616 |
48e8597c-41fe-40fb-b177-9be0dcff49dd | choisimo/CPP_LoadBalancing_algorithm | team_report_24/main.cpp | //
// Created by csimo on 24. 10. 21.
//
#include "JsonSaver.h"
#include "trafficFlow.h"
#include "csvLoader.h"
#include "sortAlgorithm/quickSort.h"
#include "sortAlgorithm/mergeSort.h"
#include "sortAlgorithm/heapSort.h"
#include "sortAlgorithm/greedySort.h"
#include <iomanip>
#include <sys/resource.h>
#include <chron... | ALGO | 0.997616 | 6.099922 |
ba54e8b7-05ab-42bb-9875-9cfa7711d02f | raincross7/code-similarity | codes/train_code/problem105/problem105_153.cpp | #include<bits/stdc++.h>
#define ll long long int
#define vll vector<ll>
using namespace std;
int main(){
ios_base::sync_with_stdio(true);
cin.tie(NULL);
ll x;
cin >> x;
double y;
cin >> y;
ll y1 = 100*y + 0.5;
x *= y1;
x = x/100;
cout << x << endl;
} | ALGO | 0.999783 | 3.168594 |
037545aa-8bee-4047-addc-d1f1efacd030 | codingwithritika/Cpp | 21_projects_and_practice/Number_Guessing_Game.cpp | #include<bits/stdc++.h>
using namespace std;
void play_game()
{
srand(time(nullptr));
int secret_number= rand() % 100 +1;
int guess,attempt=0;
cout<<"welcome to the number guessing game!\n";
cout<<"I've chosen a number between 1 and 100. Can you guess it?\n";
do
{
cout<<"enter your guess:";
cin>>gue... | TOOL | 0.887495 | 3.843916 |
385350f7-f56a-43ef-9470-801324a1cab5 | rPankaj05/Leetcode_Solutions | Max Level Sum in Binary Tree - GFG/max-level-sum-in-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str) {
// Corner Case
if (str.length()... | ALGO | 0.999369 | 7.21467 |
211b26de-a115-423c-aa8a-8006264ac254 | UsmanK7/CalculatorAppFlutter | calculator_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998685 | 6.763549 |
e41321cb-f00c-4b63-b504-a3beedc2fee9 | nikhiljaiswal9129/C- | DataStructures/Stack using two queues.cpp | #include <bits/stdc++.h>
using namespace std;
class Stack {
queue<int> q1, q2;
public:
void push(int x)
{
q2.push(x);
while (!q1.empty()) {
q2.push(q1.front());
q1.pop();
}
queue<int> q = q1;
q1 = q2;
q2 = q;
}
void pop()
{
if (q1.empty())
return;
q1.pop();
}
int top()
{
if (... | ALGO | 0.997774 | 4.654539 |
e2fdc62d-ac36-4faf-8992-740e51bbc9df | ankur-vatsa/Scaler-DSA | Recursion/recursion_print_decreasing_order.cpp | #include<iostream>
using namespace std;
void printRecursion(int n){
// base condition
if(n==0){
return;
}
//task
cout<<n<<endl;
//recursive call
printRecursion(n-1);
}
int main(){
int n=5;
printRecursion(5);
} | ALGO | 0.999835 | 5.226782 |
d3b2c20d-7d8f-4903-a982-0fa9de51b58d | tianlizhang/RM2020-NUAA-Dafu | main.cpp | #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "MarkerSensor.h"
using namespace std;
using namespace cv;
MarkSensor *markSensor = NULL;
bool is_red = 1, ifshow = 0;
int is_clockwise = -1;//˳ʱ+1ʱ-1
int cam_idx = 1;
bool is_windMill_mode = false;
void paraAdjust(MarkSensor* mk){
... | TOOL | 0.904226 | 3.980121 |
62dd39f7-d8e5-4480-9884-bd0bfdbfb1b6 | Alaxe/noi2-ranking | 2019/solutions/D/ISA-Sofia/square.cpp | #include<bits/stdc++.h>
using namespace std;
int arr[10000];
bool tochenkoren(int ch){
for(int i=1;true;i++){
if(i*i==ch){
return true;
}
if(i*i>ch){
return false;
}
}
}
bool delilise(int chislo,int sz){
for(int i=0;i<sz;i++){
if(chislo%arr[i]!... | ALGO | 0.999982 | 3.766283 |
991fbf94-0ecb-420f-a822-de246c7d5473 | DavTurns/Datastructures-And-Algorithms-University | lab5-matrix-as-bst/MatrixIterator.cpp | //
// Created by Latitude on 09.06.2023.
//
#include "MatrixIterator.h"
#include <exception>
/*
* pre:m E M, m ist eine matrix
* post: i E I, wobei i ist ein iterator, welches auf 0,0 zeigt
*
*
* best: 0(1)
* worst: 0(n)
* average: 0(logn)
* general: O(n)
* */
MatrixIterator::MatrixIterator(const Matrix &m) ... | ALGO | 0.933476 | 3.180012 |
b2942977-c913-4ad7-a9ee-7fe9807fd0e8 | bioexcel/bioexcel-code-releases | GROMACS/gromacs-2019-beta1/src/gromacs/fft/fft_mkl.cpp | #include "gmxpre.h"
#include <errno.h>
#include <stdlib.h>
#include <mkl_dfti.h>
#include <mkl_service.h>
#include "gromacs/fft/fft.h"
#include "gromacs/utility/fatalerror.h"
/* For MKL version (<10.0), we should define MKL_LONG. */
#ifndef MKL_LONG
#define MKL_LONG long int
#endif
#if GMX_DOUBLE
#define GMX_DFTI_... | TOOL | 0.949873 | 6.425857 |
8d14c898-b412-41d4-a04c-26affeb0411b | PancrasPan/Compiler_8slots | tools/clang/lib/AST/InheritViz.cpp | #include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/TypeOrdering.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <set>
using namespace llvm;
namespace clang {
/// I... | TOOL | 0.852017 | 7.64808 |
bdccfd0a-152d-4930-b123-f3572b8c2b0f | RohitKotha/geeksforgeeksprograms | Difficulty: Easy/Number of occurrence/number-of-occurrence.cpp | //{ Driver Code Starts
// Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int countFreq(vector<int>& arr, int target) {
// code here
unordered_map<int,int>mp;
for(int i=0;i<arr.size();i++){
mp[arr[... | ALGO | 0.999346 | 5.715643 |
2e3f1dbb-9ccc-4d3d-8b49-3cf5a4e4b6d3 | ankitkapoor8437/data-structures-and-algorithms | leetcode/BINARY_SEARCH.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int s = 0;
int e = nums.size()-1;
int mid = s + (e-s)/2;
while(s<=e)
{
if(nums[mid]==target)
return mid;
else if(nums[mid]<target)
{
s=mid+1;
}
... | ALGO | 0.999942 | 6.21239 |
ea3e1f42-6fda-48ac-9217-b59f7c46c505 | lumingzzz/TinyLIC | compressai/cpp_exts/rans/rans_interface.cpp | #include "rans_interface.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <numeric>
#include <stdexcept>
#include <string>
#include <vector>
#include "rans64.h"
namespace py = pybind11;
/* probability range, this could be a parameter...... | TOOL | 0.926136 | 7.564958 |
dff1d9c0-0863-4897-b3ee-9884e9fbb424 | mohittsinggh/OPTIFY | SinglyLL.cpp | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
class node{
public:
int data;
node*next;
node(int data){
this->data=data;
this->next=NULL;
}
};
node*head=NULL,*tail,*newnode;
void insert(){
int data;
cout<<"enter data : ";
cin>>data;
newnode=new node(d... | ALGO | 0.999266 | 3.516601 |
cff0e30d-1abd-4c96-ae25-74709778bd1d | SMiles02/CompetitiveProgramming | Codeforces/CF 1600 - 1699/CF1654/CF1654D.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353, N = 2e5 + 1;
int min_prime[N], f[N], cur[N], x, y, ans;
vector<int> primes;
vector<array<int, 3>> e[N];
int add(int a, int b) {
a+=b;
if (a>=MOD) a-=MOD;
return a;
}
int mul(int a, int b) { return (1LL*a*b)%MOD; }
int binpow(int a,... | ALGO | 0.999132 | 5.311242 |
244d29cd-88e9-484a-864a-0cee4b86e7cb | Zikriolloh123/cin-cout | Home work/task10.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
float L,S,r,p=3.14;
cout<<" r = ";
cin>>r;
L=2*p*r;
S=p*pow(r,2);
cout<<" L = "<<L<<endl;
cout<<" S = "<<S;
}
| TOOL | 0.982876 | 3.402626 |
1de3f28c-f9a3-43f0-a68b-eeeb6caec60f | AntoineMethot/PFE | 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.998733 | 6.76775 |
2c6a5fd2-6be3-4b8d-a3c3-6f5ec4bbd7bc | Abhinav2604/Competitive-Programming | Codeforces/FUZZYLIN.cpp | #include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);... | ALGO | 0.999683 | 3.403524 |
bdf4306b-068c-4038-9aa2-cbf1018099a2 | ppd324/FaceIdentificationAndroid | app/src/main/cpp/include/dlib/matlab/example_mex_function.cpp | #include "dlib/matrix.h"
using namespace dlib;
using namespace std;
/*!
This file defines a function callable from MATLAB once you mex it.
It computes the same thing as the following MATLAB function:
function [A, B] = example_mex_function(x, y, some_number)
A = x+y;
B = sum(s... | TOOL | 0.976534 | 5.823547 |
6999979a-2ea2-462a-b6f3-185ba5a8c6f5 | sumonmd/Data-Structure- | Binary to Decimal.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin>>n;
long long binary = n;
long long decimal = 0;
int pw = 0;
while(n!=0){
int rem = n%10;
decimal = decimal+rem*pow(2,pw);
n/=10;
pw++;
}
cout<<"Binary ->"<<binary<<endl;
cout<... | ALGO | 0.99947 | 4.705389 |
e89e3966-b7cc-4264-8fb7-484c1e756f36 | peacecoder229/systemp | oneDNN/examples/graph/sdpa.cpp | #include <cassert>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <memory>
#include <random>
#include <string>
#include <vector>
#include "oneapi/dnnl/dnnl.hpp"
#include "oneapi/dnnl/dnnl_graph.hpp"
#include "graph_example_utils.hpp"
using namespace dnnl;
using tag = memory::format_tag;
using nam... | TEST | 0.916005 | 4.697539 |
72ef06ce-8e3a-4cbb-8abf-c19ed72a0935 | PrateekRohilla/DSA-Fundamentals | stack/deleteMiddleFromStack.cpp | #include<iostream>
#include<stack>
using namespace std;
void solve(stack<int> &inputStack, int count, int size){
//base case
if(count == size/2){
inputStack.pop();
return;
}
int num = inputStack.top();
inputStack.pop();
//recursive call
solve(inputStack, count+1, size);
... | ALGO | 0.999903 | 4.933156 |
fd4d170e-7684-4252-b587-a4c712b998eb | mowangblog/C-Demo | 2018.10/max函数.cpp | # include <stdio.h>
int * max(int*,int);
int main()
{
int a[5]={3,4,6,9,13};
int n=max(a,5)[0];
printf("ֵ%d",n);
return 0;
}
int * max(int * a,int len)
{
int t;
for(int i=0;i<len;++i)
{
for(int j=i+1;j<len;++j)
{
if(a[i]<a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
return a;
}
| ALGO | 0.999917 | 3.900669 |
f17df821-0d27-4dba-bc34-4c20f3c8eabb | raincross7/code-similarity | codes/train_code/problem166/problem166_130.cpp | #include<stdio.h>
int main(){
int i,n,add;
int temp=1;
scanf("%d %d", &n,&add);
for(i=1;i<=n;i++){
//printf("Temp awal adalah %d\n", temp);
if(((temp*2)<=add)&&(temp<=add)){
temp*=2;
//printf("Temp untuk hasil perkalian adalah %d\n", temp);
}
else if((temp*2>=add)&&(temp<=add)){
temp*=2;
}
els... | ALGO | 0.999932 | 3.084592 |
310db00a-3ba1-44f6-afc4-29bc80e2aba1 | JeffTimoman/binusOnlineJudge | 00_onlineJudge/pUac/C/c_write.cpp | #include <stdio.h>
FILE *fp, *fp2;
void merge(int arr[], int l, int m, int r){
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++){
L[i] = arr[l + i];
}
for (j = 0; j < n2; j++){
R[j] = arr[m + 1 + j];
}
i = 0;
j = 0;
... | ALGO | 0.999968 | 4.083919 |
2d90ea1b-2607-4dce-9622-55bd99e4ecf4 | Tushar1805/coding_roadmap | GFG/Basic/findTriplets.cpp | //! Find triplets with zero sum
// Given an array arr[] of n integers. Check whether it contains a triplet that sums up to zero.
// Note: Return 1, if there is at least one triplet following the condition else return 0.
// Example 1:
// Input: n = 5, arr[] = {0, -1, 2, -3, 1}
// Output: 1
// Explanation: 0, -1 and ... | ALGO | 0.99095 | 5.856446 |
5e220e3e-8bf0-46a7-9db9-1c86cd829183 | rsk0315/library | algorithm/mo.cpp | #ifndef H_mo_algo
#define H_mo_algo
/**
* @brief Mo's algorithm
* @author えびちゃん
*/
#include <algorithm>
#include <numeric>
#include <tuple>
#include <utility>
#include <vector>
#include "integer/sqrt.cpp"
template <typename Rf, typename Args>
auto mo(Rf&& rf, std::vector<std::tuple<size_t, size_t, Args>> const& ... | ALGO | 0.999866 | 5.736741 |
28be4b92-a09a-4dd5-b89e-6d7f9bb4fde6 | liuguojun/OnlineJudge | POJ/1020/2732616_AC_203MS_84K.cpp | #include<stdio.h>
#include<stdlib.h>
#define maxlong 41
int cake[maxlong][maxlong];
int n,size;
int small[17];
int use[17];
int ok;
int cmp(const void *a,const void *b)
{
return *(int *)b-*(int *)a;
}
int searchfirst() //寻找第一个没有被切的小块,这个地方应该还能优化
{
int i,j,temp=1;
for(i=1;i<=size;i++)
for(j=1;j<=size;j++... | ALGO | 0.999826 | 3.060293 |
845f5233-df74-4b55-b7e0-8ece3313acf2 | iveney/algorithm | leetcode/clone-graph.cpp | #include <queue>
#include <unordered_map>
#include "leetcode.h"
class SolutionV2 {
public:
unordered_set<int> visited;
unordered_map<int, UndirectedGraphNode *> nodes;
UndirectedGraphNode *dfs(UndirectedGraphNode *node) {
if (node == NULL) return NULL;
if ( visited.find(node->label) != visited.end() )
... | ALGO | 0.999696 | 6.600788 |
bc657c92-fc24-4980-b0de-00be9fb59b99 | Lotuses-robot/Codes | Contest/Luogu/20230414/B/B.cpp | /*
# 冠军
## 题目描述
某校举行足球比赛,将从 $16$ 强中决出冠军。
以下是 $\dfrac{1}{8}$ 决赛的对阵图:

在蓝色方框中的数字代表场序数,队伍依次用字母 $\texttt{A} \sim \texttt{Q}$ 编号,规定一场比赛字母更靠前的队伍为主场队伍,更靠后的队伍为客场队伍。比分用 `p-q` 的形式给出,$p$ 为主队的进球数,$q$ 为客队的进球数。进球更多的队伍晋级下一轮比赛。
例如,对于场序 $1$ 和 $2$,若比分分别为 $1-2$,$4-3$,则 ... | ALGO | 0.999955 | 4.335642 |
01d572dd-c67a-41ca-bfff-5cb877fe8826 | ishandutta2007/codeforces | greymanesilverfang/normal/1239/D.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
const int N = 1000005;
int n, m, cur, num[N], low[N];
std::vector<int> adj[N];
void reset()
{
cur = 0;
for (int i = 1; i <= n; ++i)
{
adj[i].clear();
num[i] = low[i] = 0;
}
}
bool Tarjan(int u)
{
num[u] = low[u] = ++cur;
... | ALGO | 0.999977 | 4.677262 |
3d54ca76-481f-4f1a-8975-88a08006dd38 | kvnwng11/usaco | LeetCode/Medium/433. Minumum Genetic Mutation.cpp | class Solution {
public:
int minMutation(string startGene, string endGene, vector<string>& bank) {
deque<string> d;
unordered_set<string> seen;
d.push_back(startGene);
seen.insert(startGene);
int ans = 0;
while (!d.empty()) {
int size = d.size();
... | ALGO | 0.999925 | 5.556222 |
c188d9e6-6a32-42d4-a4a0-0aed589685f9 | Afra-937-Biva/algorithm-c- | knapsack.cpp | #include<bits/stdc++.h>
using namespace std;
int findmax(int n1,int n2)
{
if(n1>n2)
{
return n1;
}
else
{
return n2;
}
}
int k(int w,int wt[],int val[],int n)
{
int k[n+1][w+1];
for(int i=0;i<=n;i++)
{
for(int j=0;j<=w;j++)
{
if(i==0 || ... | ALGO | 0.999977 | 4.453783 |
22728cba-0d87-4c6c-9c11-557a43c3039d | AdamFull/Incenerate-Engine | tools/shader_compiler/library_compiler.cpp | #include "library_compiler.h"
#include "compiler_util.h"
#include "compiler_parse.h"
#include "shader_library_parse.hpp"
#include "sjson_parser.h"
#include <fstream>
#include <logger/logger.h>
#include <json.hpp>
std::string emplace_data(std::string base_string, const std::string& target, const std::string& replace... | TOOL | 0.985544 | 6.750989 |
69ee675d-a221-46a0-989b-2a670513ba89 | Sneaky-amxx/Godot4---Bullet-Physics-Engine | modules/ignition/src/scale_distance_ratio.cpp |
#include "scale_distance_ratio.h"
namespace Ign
{
ScaleDistanceRatio::ScaleDistanceRatio()
{
max_distance = 1000.0;
}
ScaleDistanceRatio::~ScaleDistanceRatio()
{
}
void ScaleDistanceRatio::set_max_distance( Float dist )
{
max_distance = dist;
}
Float ScaleDistanceRatio::get_max_distance() const
{
return max_di... | TOOL | 0.977866 | 6.466083 |
64322196-0af2-4612-8bd1-9733782e25bc | blackluv/junkcoin | src/core_read.cpp | #include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "serialize.h"
#include "streams.h"
#include <univalue.h>
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/... | TOOL | 0.88588 | 7.211846 |
4af9fd14-ce85-4b39-8130-f17168a417bd | Mohit21251139/stiver_sde_sheet | 0264-ugly-number-ii/0264-ugly-number-ii.cpp | class Solution {
public:
int nthUglyNumber(int n) {
vector<int> dp(n);
dp[0] = 1;
int x= 0,y =0,z =0;
for (int i =1;i<n;i++){
dp[i] = min(dp[x]*2,min(dp[y]*3,dp[z]*5));
if (dp[i] == 2*dp[x])x++;
if (dp[i]== 3*dp[y])y++;
if (dp[i] == 5*dp[z])z++;
}
... | ALGO | 0.999996 | 5.96058 |
6e5cdd5a-402d-4fcc-94b4-62afb036624c | aditiarya37/CPP | RECURSION/BINARY SEARCH/BSinSortedRotatedArray.cpp | #include<iostream>
using namespace std;
int pivotIndex(int *arr, int s, int e){
if(s==e){
return s;
}
int mid = s + (e-s)/2;
if(arr[mid]>=arr[0]){
return pivotIndex(arr,mid+1,e);
}
else{
return pivotIndex(arr,s,mid);
}
}
int binarySearch(int *arr, int s, int e, int k)... | ALGO | 0.999956 | 5.466686 |
41e76889-9803-4d5c-a685-39175cd14080 | Black-Iron-Project/frameworks_av | media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "ScalarArithmetic.h"
#include "VectorArithmetic.h"
void Add2_Sat_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
... | ALGO | 0.954517 | 5.691923 |
96d85557-9827-487e-9fb8-aa167bcf266b | Hajrah32/Data-Structures-And-Algorithms | Queue/Day 5/Implementation Of Deque Using Linked List/implementationOfDequeUsingLinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node *next, *prev;
node(int val){
data=val;
next=NULL;
prev=NULL;
}
};
class Dequeue{
public:
node *front,*rear;
Dequeue(){
rear=front=NULL;
}
void push_front(int val)... | ALGO | 0.997498 | 4.002868 |
03d230b2-3833-4357-b5f2-a662566ac194 | hkbenchan/cpp_math_interpreter | source/eval.cpp | /**
* \file eval.cpp
*
* The interface for the expression evaluator function.
*/
#include "eval.hpp"
#include <stdexcept>
#include <math.h>
#include "global_map.hpp"
/**
* A function that will evaluate the value of that cells and return it in a cell
*/
Cell* eval(Cell* const c)
{
/**
*
* Algorithm:... | ALGO | 0.999318 | 6.502033 |
15dedf39-7fa6-4b63-93fa-9fa408330726 | One-Fist-Man/UVA-solutions | 10679 I Love Strings!!!.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
cin>>n;
while(n--)
{
string s;
cin>>s;
ll a;
cin>>a;
cin.ignore();
while(a--)
{
string b;
getline(cin,b);
ll flag=0;
... | ALGO | 0.997884 | 4.148717 |
f82632ce-adbc-46ae-a28f-4a7379675e5e | youngsam-byun/my-notes.github.io | leetcode/src/test/java/Template/Diff_Array_2D/code.cpp | class Diff2d {
public:
vector<vector<int>>f;
vector<vector<int>>diff;
int m,n;
Diff2d(int m, int n)
{
this->m = m;
this->n = n;
diff.resize(m+1);
f.resize(m+1);
for (int i=0; i<m+1; i++)
{
diff[i].resize(n+1);
f[... | ALGO | 0.999431 | 5.016285 |
f9bb0852-20c2-4be8-9529-2298a800b101 | polarr/competitive-programming | CSES/String/1733.cpp | /**
* Solution by Charles Ran (polarity.sh)
* Date: 2025-03-13
* Contest: CSES Problemset
* Problem: 1733
**/
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
#define pb push_back
#define ... | ALGO | 0.999941 | 4.281824 |
8fa56ada-a5ba-49d6-bb24-88462d15c313 | oldlick/CompetitiveProgramming | atcoder/1 AGC/043/A2.cpp | #include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
typedef long long ll;
#define INF... | ALGO | 0.999945 | 3.930642 |
c07446f3-47cc-4470-85f7-6743006e0656 | faishalnafi/c-plus | TaskKuliah/Menghitung Kelipatan.cpp | /*
Created By FaishalNafi'
Basic c++ programming class
*/
#include <iostream>
using namespace std;
//start program
int main() {
//variabel
int a, b, c;
char loop = 'y';
while(loop == 'y'){
//code program
cout << "******** PROGRAM MENCETAK KELIPATAN **********";
cout << "\n=... | ALGO | 0.999373 | 3.209135 |
d5c628c7-b5d8-4a70-a2ed-f0422e937c72 | Sonalkri2004/Dsagfg | Difficulty: Medium/Majority Element/majority-element.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int majorityElement(vector<int>& arr) {
// your code here
int major=arr.size()/2;
unordered_map<int,int>m;
... | ALGO | 0.999777 | 5.754268 |
11b63a39-89ab-42d0-9373-261ebecd09ea | YangKai5t5/R-one | RMain/26/26.cpp | // Find the next prime number of given number
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int num)
{
if (num <= 1)
{
return false;
}
for (int i = 2; i * i <= num; i++)
{
if (num % i == 0)
{
return false;
}
}
return true;
}
int nex... | ALGO | 0.999918 | 4.914781 |
99b7d4c1-f414-4057-b352-b958eb1f2ac6 | SlashCoreProject/slash | src/slash-cli.cpp | #include "chainparamsbase.h"
#include "clientversion.h"
#include "rpc/client.h"
#include "rpc/protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#include <stdio.h>
#include <event2/event.h>
#include <event2/http.h>
#include <event2/buffer.h>
#include <event2/keyvalq... | WEB | 0.943028 | 6.637828 |
731bd926-dc90-4cf1-8be3-56b52d143e5b | Alexzo20/avesta74 | src/tools.cpp | #include "otpch.h"
#include "otsystem.h"
#include "tools.h"
#include "configmanager.h"
#include "md5.h"
#include "sha1.h"
#include <sstream>
#include <iomanip>
#include <cmath>
#include <boost/algorithm/string/predicate.hpp>
extern ConfigManager g_config;
bool fileExists(const char* filename)
{
FILE* f = fopen(fi... | TOOL | 0.945022 | 4.885991 |
025f6d7b-a5ad-4433-b39f-7712b1aa6347 | kt117/ProCom | atcoder/agc/052/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << end... | ALGO | 0.999609 | 3.453108 |
93db5546-d663-43a5-b50e-130476e21c96 | zwonlala/algorithm_cpp | boj2443.cpp | //
// Created by 송지원 on 2020/07/04.
//
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
for (int i=0; i<N; i++) {
for (int j=0; j<i; j++) {
cout << " ";
}
for (int j=0; j<2*(N)-2*i-1; j++) {
cout << "*";
}
cout << "\n";
... | ALGO | 0.99984 | 4.308867 |
7fc2e4dd-ad1d-4cc3-abff-0b7e651bba0a | jpstorm21/Proyectos-java-cplusplus | Hashing/TiposDeHashing.cpp | #include <cstdlib>
#include <iostream>
using namespace std;
struct nodo {
int dato;
nodo *next = NULL;
};
void limpiarArray(nodo *datos[], int n) {
for (int i = 0; i < n; i++) {
datos[i] = NULL;
}
}
void insertarEncadenamiento(nodo *datos[], int n, int dato) {
int hashing = dato % n;
... | ALGO | 0.999911 | 4.180161 |
75545604-2078-42c5-8b04-7eca40d61705 | koi2000/acwing | leetcode/v2/202.快乐数.cpp | /*
* @lc app=leetcode.cn id=202 lang=cpp
*
* [202] 快乐数
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
public:
bool isHappy(int n) {
set<int> st;
while (true) {
if (n == 1)
break;
int num = n;
n = 0;
... | ALGO | 0.999916 | 6.298479 |
7d070295-052f-4422-be2b-6a41d083de85 | MihailTsankov77/Automata | Main/Automata.cpp | #include "Automata.h"
#include <exception>
Automata::Automata(size_t num) : states(num) {}
void Automata::addState(State::Id id) {
addState(id, 0);
}
void Automata::addState(State::Id id, char status) {
assertIdDontExist(id);
states.push(StatePtr(new State(id, status)));
}
void Automata::addConnection(... | ALGO | 0.991435 | 4.801915 |
203f0063-ebe2-4893-8573-798b876e96c8 | amanamazing100/IPMP1921 | Week4/bit manipulation/pdf/first go/power of two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n==0)
return false;
while(n!=1){
if(n%2)
return false;
n/=2;
}
return true;
}
};
| ALGO | 0.999285 | 6.047195 |
9874a8a0-c1cf-44f0-a2fc-773118e93c62 | MarinaPaley/GuidForGit | Task 4/Task 4-1/main.cpp | #include <string>
#include <iostream>
#include <random>
/**
* \brief Считывает размер массива.
* \param message Сообщение пользователю.
* \return Размер массива.
*/
size_t getSize(const std::string& message = "", size_t maxSize = std::numeric_limits<std::size_t>::max());
/**
* \brief Считывает значения элементов масс... | TOOL | 0.962233 | 5.003263 |
059819f1-8217-4288-9709-c70976be999a | ishandutta2007/codeforces | awakeanay/normal/195/E.cpp | #include <iostream>
#include <vector>
#define int long long
const int MAXN = 100005;
const int MOD = 1000000007;
std::vector<int> par(MAXN, -1), depth(MAXN, 0);
std::pair<int, int> get(int x) {
if(par[x] < 0)
return {x, 0};
std::pair<int, int> next = get(par[x]);
par[x] = next.first;
depth[x] = (depth[x... | ALGO | 0.999783 | 3.968014 |
acced61a-721e-44d7-a24a-851732ad58ef | Letv1k58RU/LABA-1 | 1/main.cpp | #include "modAlphaCipher.h"
#include "modAlphaCipher.cpp"
#include <iostream>
using namespace std;
void check(const wstring& Text, const wstring& key)
{
wstring cipherText;
wstring decryptedText;
modAlphaCipher cipher(key);
cipherText = cipher.encrypt(Text);
decryptedText = cipher.decrypt(cipherText... | ALGO | 0.997323 | 3.580312 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.