uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
228df375-2331-424c-9ca2-73e5fe97833d | chrisdias2311/DSA_competetive | Backtracking/Tut45_N_Queens_problem.cpp | #include <iostream>
using namespace std;
#define N 4
bool isSafe(int** arr, int x, int y, int n){
for(int col=0; col<x; col++){ // Loop to check if that particular row is safe or not
if(arr[x][col]==1){
return false;
}
}
int row=x;
int col=y;
while(row>=0 &... | ALGO | 0.999721 | 4.701128 |
e2275401-7469-4747-b9e5-ca7fb3beebcf | TheOdd/Nork | Nork/IO/Input.cpp | #include "Input.h"
std::vector <std::string> Input::getInput() {
std::string input;
std::getline(std::cin, input);
return toLowerCase(splitString(input, ' '));
}
// Helper function to split string into individual "words" to be parsed later
std::vector <std::string> Input::splitString(std::string str, char delim) {... | TOOL | 0.904726 | 4.988129 |
593c2b08-407c-411d-84d5-93855c0f0937 | vivandro/AlgorithmPrep | data_structures/test_heap.cpp | #include <iostream>
#include <vector>
#include <list>
#include "heap.h"
using namespace std;
using namespace vvalgo;
template <typename T>
void printAll(T b, T e) {
cout << "************************************************\n";
for (T i = b; i != e; ++i) {
cout << *i << " ";
}
cout << "\n***********************... | ALGO | 0.996393 | 4.020474 |
e24a11bc-dc9f-4e41-8cd8-b5e3e93f712d | hrydgard/ppsspp | Common/Data/Format/IniFile.cpp | #include <cstdlib>
#include <cstdio>
#include <algorithm> // for sort
#include <inttypes.h>
// Hm, what's this for?
#ifndef _MSC_VER
#include <strings.h>
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include "Common/Data/Format/IniFile.h"
#include "Common/Dat... | TOOL | 0.98989 | 6.061625 |
3150e72d-0516-45cc-adfb-2f029ceda356 | Fy5tew/Labs-1-2 | СД/lab01/lab01/lab01/list_delete.cpp | #include <iostream>
#include <list>
#include "funcs.h"
using namespace std;
void list_delete() {
list<int> lst = { 4, 5, 6, 2, 7, 8, 3, 5, 7 };
cout << " : "; print(lst); cout << endl;
int to_delete;
cout << " : "; cin >> to_delete;
auto it = lst.begin();
int i = 0;
int delete_value;
for (auto v : lst) {
... | ALGO | 0.980157 | 4.464943 |
be97d717-2da2-4db1-b941-7aad59dc3664 | yyin-dev/cpp_primer_solution | ch4/test.cpp | #include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
int main() {
int array[5] = {9, 7, 5, 3, 1};
cout << sizeof(array) << endl;
cout << *array << endl;
cout << sizeof(*array) << endl;
return 0;
} | ALGO | 0.867638 | 3.423133 |
8e8d42c4-08a1-4f71-b348-5b48d9901ad5 | p3dm/IT3040 | src/lab_01/bai_1_10.cpp | /*
* Dữ liệu vào:
Dòng đầu tiên chứ số n là kích thước của ma trận.
n dòng tiếp theo, mỗi dòng n số nguyên mô tả các phần tử của ma trận thứ nhất.
n dòng tiếp theo, mỗi dòng n số nguyên mô tả các phần tử của ma trận thứ hai.
Kết quả:
In ra tổng và tích của hai ma trận đầu vào.
n dòng đầu tiên, mỗi dòng chứa n số... | ALGO | 0.998813 | 4.304158 |
73d72378-2b44-4185-9c31-6fddb5c9883b | denis-gubar/Leetcode | String/3211. Generate Binary Strings Without Adjacent Zeros.cpp | static vector<vector<string>> F;
static bool isInit = false;
static void init()
{
if (!isInit)
{
isInit = true;
F = vector<vector<string>>(19);
F[0].push_back({});
F[1].push_back({ "0" });
F[1].push_back({ "1" });
for (int i = 2; i < 19; ++i)
{
... | ALGO | 0.999992 | 6.266444 |
5237e296-4d8e-4300-978f-9aecd27d1ce8 | anstjaos/Algorithm | BOJ/6588.cpp | #include <iostream>
using namespace std;
bool primeNum[1000001];
int num;
void init()
{
for (int i = 2; i < 1000001; i++) primeNum[i] = true;
for (int i = 2; i < 1000001; i++)
{
if (primeNum[i] == true)
{
for (int j = i * 2; j < 1000001; j += i) primeNum[j] = false;
}
}
}
int main()
{
init();
while (... | ALGO | 0.999829 | 3.794 |
d94ec256-62ff-4ec9-bcc9-5ba31edb1926 | ned14/boost-release | libs/numeric/odeint/examples/mtl/implicit_euler_mtl.cpp | #include <iostream>
#include <fstream>
#include <utility>
#include "time.h"
#include <boost/numeric/odeint.hpp>
#include <boost/phoenix/phoenix.hpp>
#include <boost/numeric/mtl/mtl.hpp>
#include <boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp>
using namespace std;
using namespace boost::numeric::odeint;
... | ALGO | 0.996374 | 4.987206 |
46e7e449-50bf-426e-84f5-52d789960f2b | xaxiso/Algorithms-and-Design-Analysis | perm.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <queue>
using namespace std;
#define MAXN 130
vector<int> Q;
vector<int> Qmax;
int adj[MAXN][MAXN] = {0};
int vdeg[MAXN] = {0};
int matrix[MAXN][MAXN];
void constructGraph(int n, vector... | ALGO | 0.999908 | 3.341283 |
da0c6719-0d0a-4e41-89d3-501e642307de | ronee12/Uva-Solutions | fff.cpp | #include<stdio.h>
int main()
{
int i,t;
char ans[100];
scanf("%d",&t);
for(i=1;i<t+1;i++)
ans[i]=(ans[i]*i);
printf("%d\n",ans);
return(0);
} | ALGO | 0.999836 | 3.074744 |
b8a51ccb-0db9-422e-8859-62c8ca56a568 | Anshuu-Sharma/LeetCode-my-solutions | 0173-binary-search-tree-iterator/0173-binary-search-tree-iterator.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.999824 | 6.413276 |
dbced676-757c-491a-8384-04014098c9e7 | ReptilianEye/OI_etap_pierwszy_2021 | Druk/drukV2.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
//V2 ten sam algorytm z powrotmi, wyglada ze dziala
//wyszkiwanie wolnego punktu funkcja
using namespace std;
class przylozonySzablon
{
public:
int x, y;
int kierunekPolozenia;
... | ALGO | 0.999939 | 3.108197 |
6a9e6a68-1a1e-441b-9be4-81f609f7c895 | Pratham228cmd/leetcode-DSA | longest-string-chain/longest-string-chain.cpp | class Solution {
public:
int dp[1001];
bool static cmp(string &s1, string &s2){
return s2.size()>s1.size();
}
int longestStrChain(vector<string>& words) {
memset(dp,-1,sizeof(dp));
sort(words.begin(),words.end(),cmp);
unordered_map<string,int>mp;
int n=words... | ALGO | 0.999997 | 5.835905 |
a854fccb-a246-4d9a-9cc1-ccf288108bab | AdvancedX/LL1Generator | main.cpp | #include "common_header.h"
#define bufsize 300
using namespace std;
char sentence[bufsize];
int main() {
cout << "ķÿһװ Ctrl+Z һķַΪʼ" << endl;
input_grammar();
pick_up();
eliminateLeftRecursion();
getFirstN();
getFirstP();
getFollow();
generateTable();
saveAllInfoToFile();
printAllTerminator();
printAllNonTer... | ALGO | 0.940337 | 3.174802 |
8f6e93f0-246a-438f-ae0a-b62e662b3c84 | MUTHUSE/DSAPractice | 1. Basics/8.LoopingStatement/4.problem/10.armstrong.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout<<"\n Enter the number : ";
cin>>n;
int num = n,rem,arm=0;
while(num>0){
rem = num%10;
arm = (rem*rem*rem)+arm;
num = num/10;
}
if(n == arm){
cout<<n<<" is a armstrong";
}else{
... | ALGO | 0.999932 | 5.126464 |
d6fbb76c-0f7e-4b46-8c41-7189f658fef9 | Jay9874/LeetCode | 0863-all-nodes-distance-k-in-binary-tree/0863-all-nodes-distance-k-in-binary-tree.cpp | class Solution {
public:
vector<int> distanceK(TreeNode* root, TreeNode* target, int k) {
vector<int> ans;
unordered_map<int, TreeNode*> parent;
queue<TreeNode*> q;
q.push(root);
while(!q.empty()){
int si = q.size();
for(int i = 0; i < si; i++){
... | ALGO | 0.999997 | 6.307575 |
9a1837ad-5696-4007-8ff9-85850903d10d | INK-USC/PLE | Model/eigen-3.2.5/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.999596 | 4.186114 |
3cd12ab7-77c9-4ed5-86d4-eebe923c4727 | kakinumakoki/M2 | 50item_tests/testcase18/drone7/solve2.cpp | #include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<vector>
#include<string>
#include <iomanip>
#include <deque>
#include<list>
#include<cmath>
#include<fstream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
usin... | ALGO | 0.999576 | 3.484257 |
81eb412a-ed2f-4d4e-9392-887c4bda34ae | raviii21/Leetcode-Codes | add-to-array-form-of-integer/2-15-2023, 7_20_13 PM/add-to-array-form-of-integer.cpp | // Link: https://leetcode.com/problems/add-to-array-form-of-integer
/** Submission Info:
*
* AUTHOR: Ravi Savsani
* TITLE: add-to-array-form-of-integer
* RUNTIME: 26 ms
* MEMORY: 28.5 MB
* DATE: 2-15-2023, 7:20:13 PM
*
*/
// Solution:
class Solution {
public:
vector<int> addToArrayForm(vector<int>& ... | ALGO | 0.999954 | 6.246639 |
772386b8-ef62-4b9c-acea-089d35f30386 | jeetsavsani1173/LeetCode-Solution | 2448-minimum-cost-to-make-array-equal/2448-minimum-cost-to-make-array-equal.cpp | class Solution {
public:
long long minCost(vector<int>& nums, vector<int>& cost) {
vector<pair<int,int>> vpr;
for(int i=0;i<nums.size();i++)
vpr.push_back({nums[i],cost[i]});
sort(vpr.begin(),vpr.end());
long long sum=0;
for(auto it:cost)
sum+=it;
... | ALGO | 0.99999 | 5.232122 |
06daa34d-9f72-446e-b3b3-d433d61ce0a7 | axxonite/algorithms | EPI/Problems/5_Primitives/5.9_palindrome_number.cpp | #include "stdafx.h"
// #define TEST
bool IsPalindromeNumber(int x)
{
return false;
}
#pragma region Test
bool CheckAns(int x) {
auto s = to_string(x);
for (size_t i = 0, j = s.size() - 1; i < j; ++i, --j) {
if (s[i] != s[j]) {
return false;
}
}
return true;
}
void IsPalindromeNumberTest()
{
#ifdef TE... | ALGO | 0.994409 | 5.365059 |
a3fb554c-c869-41f9-bf72-bb5b0561bf3b | raincross7/code-similarity | codes/train_code/problem188/problem188_8.cpp | #include <bits/stdc++.h>
#define REP(i,x,y) for(int i=(int)x;i<=(int)y;i++)
#define PER(i,x,y) for(int i=(int)x;i>=(int)y;i--)
#define FOR(i,x,y) for(int i=(int)x;i< (int)y;i++)
#define fi first
#define se second
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long LL;
typedef long double db... | ALGO | 0.999943 | 3.690324 |
5affd548-495e-49af-b5bf-425422bd8947 | kavandoctor1/codeforces | live-competitions/570/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define For(x) for(int i = 0; i < x; i++)
#define For2(x) for(int j = 0; j < x; j++)
#define For3(x) for(int k = 0; k < x; k++)
#define Forv(vector) for(auto& i : vector)
#define Forv2(vector) for(auto& j : vector)
#define show(vector) for(auto& abcd : vector){cout<<abcd.fi... | ALGO | 0.999648 | 4.725881 |
a9e8dd0d-6bcf-4bc3-882e-3592dcd2c41e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10752_6.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
os << "(" << p.first << "," << p.second << ") ";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
for (auto i : v) os << i << " ";
retu... | ALGO | 0.999978 | 4.240619 |
325e0b1b-24bd-44ed-9ddd-f21561a9955a | parthpurwar/CP- | k-sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
int tc;cin>>tc;
while(tc--)
{
int n;
cin>>n;
vector<int> vec;
for(int i=0;i<n;i++){
int k;
cin>>k;
vec.push_back(k);
}
vector<int> diff;
int j=1;
while(j<n){
if(vec[j]<vec[j-1]){
int s... | ALGO | 0.999699 | 3.930088 |
85297dbf-c1ef-4c30-ac93-74a3f2b7b8e2 | wcsanders1/LeetCode | CountSubarraysWithFixedBounds/CPP/CountSubarraysWithFixedBounds.cpp | // https://leetcode.com/problems/count-subarrays-with-fixed-bounds/description/
// NOT MINE: https://leetcode.com/problems/count-subarrays-with-fixed-bounds/solutions/2708099/java-c-python-sliding-window-with-explanation/?orderBy=most_votes
#include <vector>
#include <unordered_set>
#include <string>
#include <algorith... | ALGO | 0.999672 | 5.962412 |
35173a72-205f-4dfe-b4f7-228db6dd5f9f | RealLushen/AquayoupCore624 | src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp | /*
* Comment: MAYBE need more improve the "Raptor Call".
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
{
SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled
SPELL_GRIEVOUS_BITE = 48... | TOOL | 0.873478 | 6.237024 |
8c0666dc-ce17-4515-9d7d-b2298ba33353 | routb68/Leetcode-pratice | 319-bulb-switcher/319-bulb-switcher.cpp | class Solution {
public:
int bulbSwitch(int n) {
return sqrt(n);
}
}; | ALGO | 0.999884 | 6.235899 |
492df03a-06be-4c62-a3c3-83abc668d0ad | chinmay-gupta-2003/POTD | 2025/2_February/11th_1910_Remove_All_Occurrences_of_a_Substring.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
string removeOccurrencesBrute(string s, string part)
{
while (s.find(part) != string::npos)
s.erase(s.find(part), part.length());
return s;
}
};
int main()
{
Solution sol;
string s = "axxxxyyyyb", part = "xy";
cout << s... | ALGO | 0.998946 | 5.987257 |
3f4593c8-60f4-4783-a646-44cbe5b15432 | yhy5847/BaekJoon | 10818/answer.cpp | #include <iostream>
using namespace std;
int main(void)
{
int n, max, min;
cin >> n;
int* arr = new int[n];
for (int i = 0; i < n; ++i)
{
cin >> arr[i];
}
max = arr[0];
min = arr[0];
for (int i = 0; i < n; ++i)
{
if (max < arr[i]) max = arr[i];
if (min > arr[i]) min = arr[i];
}
cout << min << " ... | ALGO | 0.999959 | 4.355257 |
a0f81ac2-37bb-4c1a-b579-3542cdfd14e0 | jiho7407/PS | BaekJoon/Gold/동전_뒤집기.cpp | #include <bits/stdc++.h>
#define ll long long
#define lll __int128
#define ld long double
#define rep(i,l,r)for(int i=(l);i<(r);i++)
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void fastio(){
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
}
void solve(){
int ... | ALGO | 0.999829 | 3.64936 |
a4a7b951-b84e-4591-bb50-37f96deee636 | ishandutta2007/codeforces | marcina007/normal/288/D.cpp | #include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<iostream>
#include<cstring>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define ... | ALGO | 0.999943 | 3.907885 |
62e245b6-03be-44d4-9ae3-97b2c62fc381 | archit120/CP-Submission | code jam 2018/1b1.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
i... | ALGO | 0.999683 | 3.050861 |
e31e1275-20b4-4c5d-93dc-d248017a0d25 | yogg17/CompetitiveProgramming | EvenOddDiff.cpp | // Even Odd Elements
// Problem Description
// You are given
// T(number of test cases) integer arrays.For each array A,
// you have to find the value of absolute difference between the counts of even and odd elements in the array.
#include<bits/stdc++.h>
using namespace std;
int main(){
... | ALGO | 0.999722 | 5.01991 |
cf968a10-8852-459b-a7b9-8324b85a65b6 | 24Ashiti/cpp-language | unaryover.cpp | #include<iostream>
using namespace std;
class box
{
int l,b,h;
public:
void setdata(int x,int y,int z)
{
l=x,b=y,h=z;
}
int getdata()
{
return l*b*h;
}
box operator ++(int)
{
box t;98897
t.l=l++;
t.b=b++;
t.h=h++;
return t;
... | ALGO | 0.965514 | 3.749551 |
c4213c93-8bd5-4e5b-85ba-bbbbf7b936bc | alexandrelea/oi-oj-codes | uva/uva10898/prog.cpp | #include<bits/stdc++.h>
// #pragma GCC optimize(3,"Ofast")
using namespace std;
const int S=1e6+10;
int n,m,t,pw[10];
struct dish{
int num,price;
dish(int num=0,int price=0):num(num),price(price){}
}di[20];
int dp[S]={};
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
pw[0]=1;
f... | ALGO | 0.999332 | 3.298181 |
e44f134d-6a22-4937-a8fc-cb9ee1a9b84d | HarshaVardhan31012007/Leetcode-and-Gfg-Codes | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.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.999908 | 6.081307 |
f2852d30-5d50-4ab4-adf0-c1040609cf7e | akramhany/ProblemSolving | ComptetiveProgramming/Azhar_Problems/LevelOne/Week3/O_Tickets.cpp | #include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <set>
#include <cstring>
#include <stack>
#include <queue>
#define ll long long
#define llu unsigned long long
using namespace std;
bool isPrime(ll n)
{
if (n == 2)
return true;
else if (n <... | ALGO | 0.999693 | 4.867558 |
0b815968-3d24-485d-8524-20256fa3b95a | rezashabrang/QueraAlgo | bricklaying.cpp | #include <iostream>
using namespace std;
int main() {
long int mod = 1.0e9 + 7;
int q;
int ans;
// Getting q
cin >> q;
int *questions = new int[q];
// brick function
long long int brick[static_cast<int>(1e5 - 3)];
// Getting Questions
for (int i = 0; i < q; i++)
cin >> ... | ALGO | 0.999673 | 3.775639 |
4b18339d-a377-4814-8b6e-c6bbac2ab2b2 | fbarulli/SEE-plusplus | old/c00/ex05/plusplus/ft_print_comb2.cpp | #include <iostream>
using namespace std;
void ft_putchar(int number)
{
char c;
if (number < 10)
{
c = number + 48;
std::cout.write("0", 1);
std::cout.write(&c, 1);
return ;
}
c = (number/ 10) + 48;
std::cout.write(&c, 1);
c = (number % 10) + 48;
std::cout.write(&c, 1);
}
void ft... | ALGO | 0.997757 | 4.916768 |
d4d483c1-2d7f-4c0a-9f98-0a3e8404baba | bubanalesumit157/CPP_DSA | cpp/L55 stacks/ieee_stack.cpp | #include<iostream>
#include<stack>
#include<vector>
using namespace std;
/*
Q) Suppose you are working as managrer in a Sports products Manufacturing Industry.
Your task is to design a line which assembles two halves of Cricket balls.The halves entering the assembly line are either left half '{' or right half '}'... | ALGO | 0.998632 | 4.813459 |
bda64f23-9451-4245-8529-63b2dc7c9684 | jahanOSTG/CodeChef-800-to-1000-difficulty-rating | Car Choice/Car Choice.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, x1, x2, y1, y2;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> x1 >> x2 >> y1 >> y2;
double cost1 = (double)y1 / x1;
double cost2 = (double)y2 / x2;
if (cost1 < cost2) {
cout << -1 << endl;
... | ALGO | 0.99984 | 3.777914 |
37a1265c-349a-4573-bff4-a90fa3dbfe7e | hambarzum/test1 | ardupilot/libraries/AP_Landing/AP_Landing_Deepstall.cpp | /*
* AP_Landing_Deepstall.cpp - Landing logic handler for ArduPlane for deepstall landings
*/
#include "AP_Landing_config.h"
#if HAL_LANDING_DEEPSTALL_ENABLED
#include "AP_Landing.h"
#include <GCS_MAVLink/GCS.h>
#include <AP_HAL/AP_HAL.h>
#include <SRV_Channel/SRV_Channel.h>
#include <AP_Common/Location.h>
#inc... | CONFIG | 0.944595 | 6.555229 |
73f3535b-17a5-4382-a40c-2c1830c6de55 | quynezz/LeetCodeProblems | easy and medium/783. Minimum Distance Between BST Nodes/minDif.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.999974 | 6.468972 |
565f80b3-4adf-49d9-b85f-7c116d38bf25 | phantomcoder11/All-codes | striver sheet/1. Array 1/3. Next Permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int i;
bool flag=true;
for(i=nums.size()-2;i>=0;i--){
if(nums[i]<nums[i+1]){
flag=false;
break;
}
}
if(flag){
sort... | ALGO | 0.999954 | 5.615086 |
7364183a-ee51-43b5-9885-7c003f1c42c2 | raincross7/code-similarity | codes/train_code/problem393/problem393_312.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
string N;
cin >> N;
for(int i = 0; i < N.size(); i++){
if(N[i] == '7'){
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
} | ALGO | 0.999417 | 3.755966 |
da622f3c-8f71-40d4-9076-b4c36b5beb63 | ishandutta2007/codeforces | qiqi20021026/normal/1741/D.cpp | #include<bits/stdc++.h>
using namespace std;
int n,a[1<<20];
int calc(int sum){
int t=0,k=0,ret=0;
for (int i=1;i<=n;++i){
t+=a[i];
++k;
ret=max(ret,k);
if (t>sum) return n+1;
if (t==sum) t=k=0;
}
if (t) return n+1;
return ret;
}
void solve(){
cin>>n;
... | ALGO | 0.999932 | 3.890192 |
9a2432c4-c019-4bcd-ae94-d8be987f43d4 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11565_2.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<list>
using namespace std;
static const int MAX = 100000;
vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;
void dfs(int u) {
V[u] = true;
for (int i = 0; i < G[u].size(); i++) {
int v = G[u][i];
if (!V[v]) {
dfs(v);
}
out.p... | ALGO | 0.999976 | 4.423001 |
d0557c08-ce24-46b4-a2b2-66ac177540f8 | anderlli0053/Godot-Engine | thirdparty/bullet/BulletCollision/CollisionShapes/btConvex2dShape.cpp | #include "btConvex2dShape.h"
btConvex2dShape::btConvex2dShape(btConvexShape* convexChildShape) : btConvexShape(), m_childConvexShape(convexChildShape)
{
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
}
btConvex2dShape::~btConvex2dShape()
{
}
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3... | ALGO | 0.898501 | 7.572961 |
dfad9800-718b-4178-8a23-f910a111114e | Shawn0630/Leetcode | src/92. Reverse Linked List II.cpp | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <cctype>
#include <algorithm>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(... | ALGO | 0.999911 | 4.356709 |
46904673-9124-4c7b-ae7c-75e9b2c0ea07 | wuliangwang/Face | Tool/stasm/shapemod.cpp | #include "stasm.h"
namespace stasm
{
static const int SHAPEHACK_MINPYRLEV = 2; // allow hacks only at coarse pyr levs
// Limit the values of b to make sure the generated shape is plausible.
// That is, clip each b[i] to bmax * sqrt(lambda_i).
// "b" is the name used for the eigenvector weights in Cootes' papers.
sta... | ALGO | 0.994929 | 4.946579 |
cde856b7-3cf6-4706-b2dd-a7a40fca752a | diwei00/Cpp_Study | 二维数组应用.cpp | //#include <iostream>
//using namespace std;
//int main()
//{
// int arr[3][3] = { {100,90,90},{90,90,90},{80,70,50} };
// int row = sizeof(arr) / sizeof(arr[0]);
// int col = sizeof(arr[0]) / sizeof(arr[0][0]);
//
//
// for (int i = 0; i < row; i++)
// {
// int sum = 0;
//
// for (int j = 0; j < col; j++)
// {
//... | ALGO | 0.997962 | 3.131941 |
e97164bd-60e0-4b15-9649-96bdbb0920f6 | CalvinNeo/ACM | SRC/icpc2015_2.1006.ans.cpp | //#include <iostream>
//#include <cstdio>
//#include <string>
//using namespace std;
//int main() {
// // freopen("in","r",stdin);
// int t;
// string str, str0, str1;
// scanf("%d", &t);
// getline(cin, str);
// int cnt = 0;
// while (t--) {
// getline(cin, str);
// if (str == "") {
// printf("Case #%d: %d\n", ++c... | ALGO | 0.982159 | 3.726446 |
4a3789e5-39aa-440e-bc5f-f8068d8a5d39 | selectivegravity/DSA_Practice | Lecture 153/topological_sort.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+2;
int main(){
int n,m;
cin>>n>>m;
vector<vector<int>> adj(n);
vector <int> indegree(n,0);
for(int i=0;i<m;i++){
int x,y;
cin>>x>>y;
adj[x].push_back(y);
indegree[y]++;
}
queue <int> q;
for(in... | ALGO | 0.999998 | 4.570353 |
69356974-dd92-4aeb-8377-4c64faa688c0 | Doffery/POJ | basic/1700/c1700.cpp | #include<cstdio>
#include<algorithm>
int data[1010];
int ttime = 0;
void Cross(int n) {
if(n == 1) {
ttime += data[0];
return;
}
else if(n == 2) {
ttime += data[1];
return;
}
if(n == 3) {
ttime += data[0] + data[1] + data[2];
return;
}
int x = 2 * data[1];
int y = data[0] + data[n-2];
if(x >= y)
... | ALGO | 0.999768 | 3.740608 |
2cf65175-978e-4b6c-a7e5-16ed79bdf658 | Ravi-kumar178/C-- | sumOfDigitOfArray.cpp | #include <iostream>
using namespace std;
int main(){
int arr[5];
int size = 5;
//taking input
for(int i = 0; i < size; i++){
cin >> arr[i];
}
int sum = 0;
for(int i = 0; i < size; i++){
sum = sum + arr[i];
}
cout<<"Sum of all the similar elements that in contained by an array is: "<<sum<... | ALGO | 0.99925 | 3.647665 |
82afa10d-96b8-4a21-b669-bd985073874b | STProgrammer/think-like-programmer-solutions | 3_3_is_sorted_function.cpp | #include <iostream>
#define D_ARRAY_SIZE 10
using namespace std;
bool isArraySorted(int arr[], int arrSize);
int main()
{
int arr1[D_ARRAY_SIZE] = {1,6,3,1,2,4,9,6,4,2};
bool isSorted = isArraySorted(arr1, D_ARRAY_SIZE);
if (isSorted)
{
printf("Array is sorted\n");
}
else
{
... | ALGO | 0.994195 | 4.768288 |
b1bc013e-e80c-40a4-976b-162722b43b96 | RandomDeveloperM/UE4_Hairworks | Engine/Source/Developer/TaskGraph/Private/SEventsTree.cpp | #include "SlateBasics.h"
#include "TaskGraphInterfaces.h"
#include "VisualizerEvents.h"
#include "SEventsTree.h"
#include "SSearchBox.h"
#define LOCTEXT_NAMESPACE "SEventsTree"
FName SEventsTree::NAME_NameColumn = FName(*NSLOCTEXT("TaskGraph", "ColumnName", "Name").ToString());
FName SEventsTree::NAME_DurationColumn ... | TOOL | 0.855321 | 7.23549 |
beb83df1-7b6e-4a18-a2e8-176df0344059 | eklavyaK/codeforces-solutions | SumGraph.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define int long long
typedef long long ll;
typedef long double ld;
using namespace std;
void code(){
int n; cin>>n;
int l = 1, r = n;
int dist[n], curr = 0;
cout<<'+'<<' '<<n+1<<endl<<flush;
cin>>curr;
cout<<'+'<<' '<<n... | ALGO | 0.999932 | 3.541388 |
7809d6cb-3eba-401b-930f-827083c96e2e | chalmersplasmatheory/DREAM | src/Equations/Fluid/HyperresistiveDiffusionTerm.cpp | /**
* Implementation of the hyperresistive diffusion of poloidal flux.
* Based on the section on hyperresistivity in DREAM/doc/notes/theory
*/
#include "DREAM/Equations/Fluid/HyperresistiveDiffusionTerm.hpp"
using namespace DREAM;
/**
* Constructor.
*/
HyperresistiveDiffusionTerm::HyperresistiveDiffusionTerm(
... | ALGO | 0.999703 | 6.244287 |
521f40f8-5661-415d-a077-58f2ae4c738a | adni03/YOLOXPP | demo/MegEngine/cpp/yolox.cpp | #include "megbrain/gopt/inference.h"
#include "megbrain/opr/search_policy/algo_chooser_helper.h"
#include "megbrain/serialization/serializer.h"
#include <iostream>
#include <iterator>
#include <memory>
#include <opencv2/opencv.hpp>
#include <stdlib.h>
#include <string>
#include <vector>
/**
* @brief Define names base... | DATA | 0.938839 | 5.639521 |
029e6d42-a58a-4192-9fd3-d1b17c5975f6 | raincross7/code-similarity | codes/train_code/problem051/problem051_464.cpp | #include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)
struct Problem {
void Solve() {
UL A, B, C; cin >> A >> B >> C;
if (A == B && B == C) cout << "Yes" << endl;
else cout << "No" <... | ALGO | 0.999959 | 4.191351 |
9217b47d-d421-46cd-94cb-965667dbb2e0 | CRESYM/ACDC_OPF | OPF_cpp/viz_opf.cpp | #include "viz_opf.h"
#include<matplot/matplot.h>
#include <cmath>
#include <utility>
#include <thread>
#include<unordered_set>
#include <algorithm>
#include <iomanip>
using namespace matplot;
namespace {
// custom
static const std::vector<float> oranges_stops = {
0.0f, 0.125f, 0.25f, 0.375f, 0.5f,... | ALGO | 0.911376 | 5.551388 |
f2f9fd68-d727-4284-affc-fbd6fb33c0ce | HPC-Fortran2CPP/Fortran2Cpp | data/CodeLlama/readable_format_HPEC/cpp/file028.cpp | #include <iostream>
#include <omp.h>
#include <thread>
int main() {
int i, j, k;
i = 0;
#pragma omp parallel
{
#pragma omp single
{
#pragma omp task depend(out:i)
{
std::this_thread::sleep_for(std::chrono::seconds(3));
i = 1;
... | ALGO | 0.988129 | 3.348926 |
5593d755-1f9d-48d0-9b03-7f186b65cd0e | iamsile/ACM | 二叉搜索树.cpp | #include <iostream>
#include <string.h>
using namespace std;
struct node {
char data;
}tree[1024],judge[1024];
bool eq(struct node c[],struct node e[])
{
int i;
for(i=1;i<1024 && c[i].data==e[i].data;i++);
if(i==1024)
return true;
return false;
}
int main()
{
int t;
while (cin >> ... | ALGO | 0.999935 | 3.749854 |
573afc95-0889-4315-9a51-9ea68f4f4e83 | Sudhanva-Nadiger/DSA | 0435-non-overlapping-intervals/0435-non-overlapping-intervals.cpp | class Solution {
public:
int eraseOverlapIntervals(vector<vector<int>>& intervals) {
sort(begin(intervals), end(intervals));
int n = intervals.size();
int e = intervals[0][1];
int c = 0;
for(int i = 1; i < n; i++) {
if(e <= intervals[i][0]) {
... | ALGO | 0.999969 | 6.155468 |
6b1e6823-3c61-4dc9-a2ac-d0bb5dba74f4 | zuselegacy/leetcode | tree/1026-max-difference-node-ancestor.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.999966 | 6.302761 |
6d0444a2-b8e9-45e6-9ff8-8c6ffcb4a337 | Djokovic0311/LeetCode | problems/max_chunks_to_make_sorted/solution.cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
int mx = -1;
int res = 0;
int n = arr.size();
for(int i = 0; i <= n; i++) {
if(i == n) return res;
mx = max(mx, arr[i]);
if(mx == i) res++;
}
return -1;
}
}; | ALGO | 0.999982 | 5.463905 |
38b17757-881a-4da6-a347-0543f82fb53b | zehuichen123/leetcode_solution | vijos/print_binary_tree.cpp | // 在一个 m*n 的二维字符串数组中输出二叉树,并遵守以下规则:
// 行数 m 应当等于给定二叉树的高度。
// 列数 n 应当总是奇数。
// 根节点的值(以字符串格式给出)应当放在可放置的第一行正中间。根节点所在的行与列会将剩余空间划分为两部分(左下部分和右下部分)。你应该将左子树输出在左下部分,右子树输出在右下部分。左下和右下部分应当有相同的大小。即使一个子树为空而另一个非空,你不需要为空的子树输出任何东西,但仍需要为另一个子树留出足够的空间。然而,如果两个子树都为空则不需要为它们留出任何空间。
// 每个未使用的空间应包含一个空的字符串""。
// 使用相同的规则输出子树。
// 示例 1:
// 输入:
// ... | ALGO | 0.999918 | 6.15602 |
a4119dfb-a176-4e28-98ba-d1bc72666bfa | NerdPotatoo/Problem-Solving | Codeforces/155A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
// CODE HERE
int n;
cin >> n;
int point[n];
for(int i = 0; i < n; ++i)
{
cin >> point[i];
}
int mx = point[0], mn = point[0], cnt = 0;
for(int i = 1; i < n; i++)
{
if(point[i] > ... | ALGO | 0.99995 | 4.373893 |
e2f5ced1-d61b-4c46-994d-79cb10b354b8 | catherinexrk/CodeExercise | 代码随想录/回溯算法/困难/37.cpp | #include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
#include <map>
using namespace std;
//https://leetcode.cn/problems/sudoku-solver/
/**
* 搜索单挑路径bool
* 搜索整个路径void
*/
class Solution {
public:
bool backTracking(vector<vector<char>>& board){
... | ALGO | 0.999102 | 5.450891 |
5085f5b2-5ae1-4b14-a53a-929179062ba8 | Abir-Ashab/NumberTheory | EnumeratingDivisors.cpp | //monkey way
#include<bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
cout << i << ' ';
}
}
return 0;
} | ALGO | 0.999976 | 4.940835 |
668191de-3c38-40ed-959d-a50331aa155d | Mrsandman327/windows-book-code-c- | C++ Standard Library Quick Reference/Chapter 4/02 - all_of.cpp | #include <iostream>
#include <algorithm>
#include <vector>
int main()
{
std::vector<int> vec{ 1,2,3,4,5,6 };
bool allOf = std::all_of(cbegin(vec), cend(vec),
[](auto& element) { return element % 2 == 0; }); // false
std::cout << allOf << std::endl;
}
| ALGO | 0.952835 | 4.999691 |
60967f55-da53-4d43-9d4d-e6b1844d2132 | karldd/ofxARToolkitPlus | addon/ofxARToolkitPlus/src/librpp/MATLAB/robust_pose.cpp | // Author: Thomas Pintaric <<EMAIL>>
#include <vector>
#include "../rpp.h"
#include "../rpp_types.h"
#include "../rpp_vecmat.h"
#include "mex.h"
using namespace rpp;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
const mxArray *model_p, *iprts_p;
double *model_v, *iprts_v, *R_... | ALGO | 0.999831 | 6.493517 |
5424619a-fa9e-4711-8c5b-54126c9ddbd5 | SingleKnife/Miku | bulletnative/src/main/cpp/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp | #include "btHashedSimplePairCache.h"
#include <stdio.h>
#ifdef BT_DEBUG_COLLISION_PAIRS
int gOverlappingSimplePairs = 0;
int gRemoveSimplePairs = 0;
int gAddedSimplePairs = 0;
int gFindSimplePairs = 0;
#endif //BT_DEBUG_COLLISION_PAIRS
btHashedSimplePairCache::btHashedSimplePairCache()
{
int initialAllocatedSize =... | TOOL | 0.946526 | 6.00602 |
284c2dc3-16fb-4074-8698-42453d727a68 | ABCChain/abcchain | src/chainparams.cpp | #include "assert.h"
#include "chainparams.h"
#include "main.h"
#include "util.h"
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
struct SeedSpec6 {
uint8_t addr[16];
uint16_t port;
};
#include "chainparamsseeds.h"
//
// Main network
//
// Convert the pnSeeds6 array into usable address ... | TEST | 0.943069 | 6.87261 |
b7c0cf49-d60a-46fa-ba97-20fbff66859d | deepsamanta/Competitive-programming-solutions | A_Robot_Program.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll test;
cin >> test;
while (test--)
{
ll a, b;
cin >> a >> b;
if (a == b)
{
cout << a + b << endl;
}
else if (a + 1 == b || b + 1 == a)
{
cout... | ALGO | 0.999925 | 4.665363 |
8fc6b048-f61c-4604-a876-c9b5e5be38ab | prabhash-varma/DSA-CP | Sorting/selection_sort.cpp |
//Selection sort
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >>n;
int arr[n];
for(int i=0;i<n;i++){
cin>> arr[i];
}
//Selection sort
for(int i=0;i<n;i++){
int minIndex = i;
for(int j=i+1;j<n;j++){
if(arr[j]<arr[minIndex]){
... | ALGO | 0.999965 | 4.53871 |
3a7cf957-b430-4d38-a96a-f42484208e8e | jyliew1912/Year2-2 | itsa_done/1-2-10.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int input;
cin >> input;
double kilom = input * 1.6;
kilom = round(kilom * 10) / 10.0;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(1);
cout << "km=" << kilom << endl;
return 0;
} | ALGO | 0.997489 | 3.960432 |
37c77f10-a8a7-447f-8b12-3927830917c0 | fallenfallen/nanogui-sdl2 | ext/eigen/test/visitor.cpp | #include "main.h"
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Index Index;
Index rows = p.rows();
Index cols = p.cols();
// construct a random matrix where all coefficients are different
MatrixType m;
m... | TEST | 0.859238 | 6.180578 |
5fe160f0-aaeb-4c49-b6ed-d42e6c9b8bf7 | gaia-platform/GaiaPlatform | third_party/production/TranslationEngineLLVM/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class piecewise_linear_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <vector>
#include <iterator>
#include <numeric>
#include <algorithm> // for sort
#include <cassert>
#include <limits>... | ALGO | 0.999446 | 4.43274 |
e7cecf3e-1acf-4293-960d-156e463cb4d1 | sudharsan12/problem_solving | construct_string_repeat_limit.cpp | // set the string is lexicographically strong with given limit
//
// ex : str = ccczazc k=3
//
// output: zzcccac
//
//
// ex: bbbbaaaa k=2
//
// output: bbabbaa omit last a because of k =2
//
#include<bits/stdc++.h>
using namespace std;
string fun(string str,int k)
{
int count_letter[26... | ALGO | 0.999997 | 4.020882 |
52700891-b5cf-4fef-996c-9118fde61009 | abhishek0777/CPCodes | Sorting/quickSort.cpp | /*
use gfg for better explanation
INSHORT : take a pivot element and place it correct position in array such that
all elements left to it are less than pivoted element and elements right to it are greater than it
*/
#include<bits/stdc++.h>
using namespace std;
int partition(int a[],int low,int high)
{
... | ALGO | 0.999989 | 4.933713 |
1f63aa26-e7db-4692-9d50-6b7ebd62c7cb | Ayushcodehere/Competitive_Programming | 30 Days of Code/day4.cpp | using namespace std;
#include <iostream>
class Person{
public:
int age;
Person(int initialAge);
void amIOld();
void yearPasses();
};
Person::Person(int initialAge){
// Add some more code to run some checks on initialAge
if(initialAge<0){
this->ag... | ALGO | 0.998825 | 5.232118 |
39f7ecfd-4533-49d5-a85d-5f9ad22f0d67 | sue4869/Algorithm | 0424/4.cpp | #include <iostream>
#include <cstring>
using namespace std;
/*
*cardlist 迭 ī尡 ֽϴ.
1. 빮 ĺ ī Է մϴ. ̴ ִ 15Դϴ.
2. Է ī忡 ī尡 ִ ã մϴ.
* DAT (Direct Address Table) Ͽ Ǯ ּ.
*/
//input16 Է
//input
//data200 ʱȭ
//input for data inputֱ
//cnt̿
//data for . >0 ã
int main()
{
char input[16];
cin >> input;
int len = strlen(... | ALGO | 0.999145 | 3.380475 |
5c41cff5-758f-4d72-9ae3-5bdac51db83b | mr-jestin-roy/LeetCode-TaskList | A_Integer_Diversity.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL)
#define int long long int
#define mod 998244353
#define endl "\n"
#define inf 1e15
void solve()
{
int n;
cin >> n;
map<int, int> hash;
for (int i = 0;i < n;i++){
int x;
cin >> x;
... | ALGO | 0.999783 | 5.000994 |
a98d184f-d84c-46e7-9b2e-ee6b1026a022 | userhyw/First-year | C++/c++作业/第七次作业/0701.cpp | //*********************************************************
//File name : 0701
//Author : he yang
//Date : 2021/11/27
//Student ID : 2021218148
//*********************************************************
#include <iostream>
#include <iomanip>
#include <stdlib.h>
//Լ
int Max(int a, int b);
using namespace std;... | ALGO | 0.998491 | 3.663772 |
3e65c2b9-e9ee-4ac7-b122-a6d10259a061 | ishandutta2007/codeforces | teja349/normal/522/A.cpp |
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16); cout << 100 << endl; Prints... | ALGO | 0.999692 | 3.68099 |
944ef03d-d76e-4b03-b95c-6743705094cd | jimitchavda/DSA | Learning Codes/12.cpp | #include <iostream>
using namespace std;
int binarySearch(int array[], int size, int key)
{
int start = 0;
int end = size - 1;
int mid = (start + end) / 2;
while (start <= end)
{
if (array[mid] == key)
{
return mid;
}
if (key > array[mid])
{
... | ALGO | 0.999889 | 5.543203 |
8f05b028-d45d-4563-94d5-c0ce97298a91 | Sameer-Pattnaik/leetcode | 0179-largest-number/0179-largest-number.cpp | class Solution {
public:
static bool compare(int x,int y)
{
string a=to_string(x);
string b=to_string(y);
return a+b>b+a;
}
string largestNumber(vector<int>& nums) {
sort(nums.begin(),nums.end(),compare);
string ans="";
for(int i=0;i<nums.size();i++)
... | ALGO | 0.999997 | 6.271361 |
7e23bcac-3ff4-4411-9e5e-494b0c587dc1 | GitProger/lksh | lksh_sch/day7/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll;
typedef long double ld;
typedef long long var;
typedef pair<int, int>prii;
typedef pair<ll, ll>prll;
typedef vector<int>veci;
typedef vector<ll>vecl;
typedef vector<veci> graph;
typedef map<int, int> mapii;
typedef set<int> seti;
typedef... | ALGO | 0.999929 | 3.989083 |
4bcff5a8-75d7-4180-a2ae-8dc37f2752c7 | ManishBisht777/Data-structures-and-algorithm | postfix.cpp | #include <iostream>
#include <stack>
#include <math.h>
using namespace std;
int postfix(string s)
{
stack<int> st;
for (int i = 0; i < s.length(); i++)
{
if (s[i] >= '0' && s[i] <= '9')
{
st.push(s[i] - '0');
}
else
{
int opt2 = st.top();
... | ALGO | 0.999801 | 4.437552 |
280fa74b-add1-4e31-a908-216ceefb206d | hocvn/Online-judge | LuyenCode/SUM2.cpp | #include <iostream>
using namespace std;
int main(){
long long n;
cin >> n;
cout << n*(n+1)*(2*n+1) / 6;
return 0;
}
| ALGO | 0.998585 | 4.204968 |
fbfeef7f-2f8e-4b30-a6e8-b7690f6eeb41 | albertsutz/AOC-2021 | Day-03/Day-03_part2.cpp | #include <bits/stdc++.h>
using namespace std;
int binary_to_int(string binary){
int size = binary.size();
int answer = 0;
int counter = 0;
for(int i = size - 1; i >= 0; i--){
answer += ((binary[i] - '0') * pow(2, counter));
counter++;
}
return answer;
}
int main(){
ios_base::sync_with_stdio(false);
ci... | ALGO | 0.999975 | 3.572664 |
a2eb2e5c-7acb-4451-91ab-7d381bbbb34e | pr7prashant/Leetcode | 135-candy/135-candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
vector<int> candies(ratings.size(), 1);
int ans = ratings.size();
for (int i = 1; i < ratings.size(); i++) {
if (ratings[i-1] < ratings[i] && candies[i-1] >= candies[i]) {
ans += candies[i-1] - candies[i] ... | ALGO | 0.999999 | 6.123642 |
a55aa411-4d9d-432c-a4ba-767aa9dffc80 | Mevaourse/Tugas-Alpro | pertemuan8/tugas pertemuan 8 2/main.cpp | #include <iostream>
using namespace std;
// Bubble Sort Descending
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] < arr[j+1]) {
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] ... | ALGO | 0.999959 | 6.012015 |
d85ba68e-474f-4450-b83e-577eb1825df6 | PhoinixPinkee/ArrayByLovebhaiya | pairsum.cpp | #include<iostream>
using namespace std;
#include<vector>
bool arrsum(int arr[],int n, int target){
int l=0;int h=n-1;
while(l<h){
if(arr[l]+arr[h]==target){
return true;
}
else if(arr[l]+arr[h]>target){
h--;
}
else{
l++;
}
return fa... | ALGO | 0.999848 | 4.765289 |
91f47314-a7c0-46c8-b5eb-67b25b1c7461 | mandaltj/gem5_garnet2_CHIPS | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.96762 | 5.695137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.