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 |
|---|---|---|---|---|---|---|
3e73cbfa-3534-485b-8aa0-bfe9f15fae2e | ngthanhtrung23/CompetitiveProgramming | codeforces/100490/J.cpp | #include <bits/stdc++.h>
using namespace std;
int n, d[100100], c[100100], found;
vector <int> a[100100];
int get(int x)
{
return x == d[x] ? x : d[x] = get(d[x]);
}
void visit(int x, int lim)
{
for (int y : a[x])
if (y <= lim)
{
if (c[y] < 0)
{
c[y] = c[x] ^ 1;
visit(y, lim);... | ALGO | 0.999993 | 4.091555 |
e1bb99fa-2d18-466f-a5c4-abdbfda2e261 | ankitmohapatra966/LeetCode_Daily_solution | 3405. Count the Number of Arrays with K Matching Adjacent Elements.cpp |
const int mod=1e9+7;
class Solution {
public:
static constexpr array<int, 100000> compute_fact(){
array<int, 100000> fact;
long long product=1;
fact[0]=1;
for(int i=1; i<100000; i++){
product*=i;
if (product>=mod) product%=mod;
fact[i]=product;
... | ALGO | 0.999945 | 4.808208 |
d3a4b959-bdc1-4cd9-8d6f-df092def45fa | CrystalOS-Project/external_libcxx | test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class gamma_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main()
{
{
... | TEST | 0.958191 | 4.801749 |
67119672-a69e-4088-a24f-db8bf11053d2 | praveenss2806/Algorithmic-Toolbox-Solutions | week_3/3.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int d,m,n;
cin>>d>>m>>n;
int i,t=m,a[n+2],ok=1,ans=0;
a[0]=0;
for(i=1;i<=n;i++){
cin>>a[i];
}
a[n+1]=d;
for(i=0;i<=n;i++){
if(a[i]+m<a[i+1]){
ok=0;
break;
}
}
if(!ok){
... | ALGO | 0.999835 | 3.354855 |
daab2398-b0e7-4078-a908-3b9b295b9dc3 | joy-mollick/Problem-Solving-Solutions | SPOJ SHPATH - The Shortest Path.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ipair;
const int mx=1e4+1;
vector<ipair>adj[mx];
map<string,int>m;
vector<int>dist(mx);
#define inf 1e7
int n;
void shortest_path(int src)
{
priority_queue<ipair,vector<ipair>,greater<ipair> >pq;
bool vis[n+1]={false};
pq.push(make_... | ALGO | 0.999705 | 4.013863 |
e7bc4e28-e15e-4afe-9c09-bf18a5cb38ed | ritwik-jha/apna-college-cpp | code/intro/dec_to_oct.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int dec_oct(int n){
int counter = 0;
int newNum = 0;
while (n>0){
int quo = n%8;
float gradient = pow(10, counter);
newNum = newNum + quo*gradient;
n = n/8;
counter++;
}
return newNum;
}
int ma... | ALGO | 0.993757 | 4.759938 |
84d09db1-d3c8-4535-b511-bb6f684081b7 | ndhoang123/Practical-Algo | Study-Plan-Leetcode/Day19/DS2/MinimumNumberofVerticestoReachAllNodes.cpp | // https://leetcode.com/problems/minimum-number-of-vertices-to-reach-all-nodes/
#include <bits/stdc++.h>
using namespace std;
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>> &edges)
{
// The non in-degree element will be returned. Because non in-degree will not from the other. Otherwise,
// ... | ALGO | 0.99986 | 5.969614 |
d80012e4-0f8f-4b8f-bce5-bf7dcaf0f058 | qianbinbin/qianbinbin.github.io | code/leetcode/cpp/src/UniqueBinarySearchTrees.cpp | #include "UniqueBinarySearchTrees.h"
#include <vector>
using namespace lcpp;
int Solution96_1::numTrees(int n) {
typedef std::vector<int>::size_type SizeType;
std::vector<int> Dp(static_cast<SizeType>(n + 1));
Dp[0] = 1;
Dp[1] = 1;
for (SizeType I = 2; I <= n; ++I) {
for (SizeType Left = 0; Left != I; +... | ALGO | 0.999677 | 6.626997 |
46c42928-5940-4b3e-a5dc-09d1c6300f74 | arthurpd/icpc-notebook | combinatorial/surreal_numbers/surreal_numbers.cpp | #include "../../contest/header.hpp"
/*
General Theory for Two Player Game
Take a perfect information game involving two players,
Left and Right, where either one can start the game.
This is a partial game in which the allowable moves
depend on which of the two players is currently moving
(e.g chess).
There... | ALGO | 0.999852 | 4.470856 |
ce370a32-f162-4235-a70f-addf38416e68 | hjiang13/LLMs-in-IR | POJ-104/2/45.cpp | #include <iostream>
using namespace std;
main()
{
struct h
{
char name[27];
int mun;
struct h *next;
}
*p,*q,*head;
int k,j,i,l,n,a[26][1001],b;
cin >> "%d",&n);
p=len;
q=head=p;
for(i=0; i<26; i++)
for(j=0; j<1000; j++)
a[i][j]=0;
for(i=0; i<n; i++)
{
cin >> "%d %s",&p->mun,p->name);
l=strlen(p->name);
for(j=0; j<l; j... | ALGO | 0.99965 | 3.274438 |
3efe0b4c-12e1-4dc7-96c7-120d39b082a3 | ishandutta2007/codeforces | khsoo01/normal/573/A.cpp | #include<bits/stdc++.h>
int n,a,prev;
int main()
{
int i;
scanf("%d",&n);
scanf("%d",&a);
while(a%2==0)a/=2;
while(a%3==0)a/=3;
prev=a;
for(i=1;i<n;i++) {
scanf("%d",&a);
while(a%2==0)a/=2;
while(a%3==0)a/=3;
if(prev!=a) {puts("NO");return 0;}
}
puts(... | ALGO | 0.999959 | 3.318891 |
79fd6ae2-e515-4987-9589-e7623dadda13 | qcserenity/serenity | src/tasks/FDETask.cpp | /**
* @file FDETask.cpp
* @author Jan Unsleber, Kevin Klahr, Thomas Dresselhaus
*
* @date last reworked on Nov 11. 2016
* @copyright \n
* This file is part of the program Serenity.\n\n
* Serenity is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public... | TOOL | 0.905639 | 3.740674 |
38184b91-91a4-44f0-8eba-e3305c8d52dd | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_53_5.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, q;
int u[101010], v[101010], w[101010], id[101010];
struct UnionFind {
vector<int> uf;
UnionFind(int n) : uf(n, -1) {}
int operator[](int x) {
if (uf[x] < 0) return x;
return uf[x] = operator[](uf[x]);
}
bool merge(int x, int y) {
x = operato... | ALGO | 0.999993 | 4.644547 |
9b3b0707-c838-4d99-8e0a-cafe8a2c3a75 | lonnewolf120/DS_Algo | code-library-master/Graph Theory/System Of Difference Constraints.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
/*
Given some inequality on some variables (x_1, x_2, ...x_n)
in the form x_i-x_j <= w_ij
we need to determine whether we can assign values to the variables so that
all the given inequalities are satisfiable or not. If satisfiable, then output a solu... | ALGO | 0.999997 | 3.375144 |
39dcb217-d013-4f40-a508-6a64587bbd79 | SachRestated/Codeforces-submissions | Div 2. Round 704/A.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define sz(v) (int)v.size()
#define pr pair<int, int>
#define v1d vector<int>
#define mp make_pair
#define pb push_back
#define v1p vector<pr>
#def... | ALGO | 0.999884 | 3.822307 |
0c9fa35a-9acb-4026-a740-ea3bf68d6a6e | dwu4/genome-privacy | OTExtension/util/Miracl/williams.cpp | /*
* Program to factor big numbers using Williams (p+1) method.
* Works when for some prime divisor p of n, p+1 has only
* small factors.
* See "Speeding the Pollard and Elliptic Curve Methods"
* by Peter Montgomery, Math. Comp. Vol. 48. Jan. 1987 pp243-264
*
* Requires: big.cpp zzn.cpp
*
*/
#incl... | ALGO | 0.999972 | 5.78008 |
35c2fbe0-249f-4d5c-907a-624ef867cd57 | NafisUlAlam/Codeforces | E/Split Into Two Sets 1702/main.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
bool isBipartite(vector<vector<int>>& adj, int n)
{
vector<int> color(n, - 1);
queue<pair<int, int>> q;
for(int i = 0; i < n; i++)
{
if(color[i] == -1)
{
q.push({i, 0});
color[i] = 0;
... | ALGO | 0.999926 | 4.854016 |
24d6f486-2a22-4e42-86ab-98cc7048cdb2 | juniormalcom237/nkap_agent | 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 |
2c541145-c434-46d4-bfba-f4b5bb03d8cf | projectceladon/system-core | libutils/JenkinsHash.cpp | /* Implementation of Jenkins one-at-a-time hash function. These choices are
* optimized for code size and portability, rather than raw speed. But speed
* should still be quite good.
**/
#include <stdlib.h>
#include <utils/JenkinsHash.h>
namespace android {
#ifdef __clang__
__attribute__((no_sanitize("integer")))
... | ALGO | 0.984629 | 7.082112 |
8c1e5dc6-ff5e-4c34-96a8-82328a92a5c9 | 2261819266/Code | OI/CP-template/TEST/oj/uoj_170.cpp | #include "DS/SegmentBeat.h"
#include "IO/FastIO.h"
/*
[#170. Picks loves segment tree VIII](https://uoj.ac/problem/170)
*/
/**
* 本题难度极大,为了方便理清各种标记间的关系,我们不妨把区间里的数字分成三类:最大值,最小值,中间值
* 针对最大值,维护最大值的最近最小、最近最大
* 针对最小值,维护最小值的最近最小、最近最大
* 针对中间值,维护中间值的最近最小加、最近最大加
* 能快速修改的区间加,可以针对所有值
* 能快速修改的区间最小化修改,只能针对最大值
* 能快速修改的区间最大化修改... | ALGO | 0.999938 | 5.288349 |
19ef2223-e6aa-4265-b910-2cf176259179 | harrypotter0/algorithms-in-python | CP/LongChallenge/ March Challenge 2018/p9.cpp | // Akash Kandpal
// harrypotter0
// King is set for the hunt
// Best is the enemy of Good
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define boost ios_base::sync... | ALGO | 0.999429 | 4.114 |
a1391b92-e1f1-4bd9-9478-c53e2a2ac175 | wtripp/CarND-Path-Planning-Project | src/Eigen-3.3/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.998036 | 6.004565 |
e8137cd5-0a95-47f3-ae62-ee8d2eb675ca | YashSampat23154/GFG-DSA-SelfPaced | 2_Bit Magic/Problems/4. Check whether K-th bit is set or not.cpp | /*
Given a number N and a bit number K, check if Kth bit of N is set or not. A bit is called set if it is 1. Position of set bit '1' should be indexed starting with 0 from LSB side in binary representation of the number.
Example 1:
Input: N = 4, K = 0
Output: No
Explanation: Binary representation ... | ALGO | 0.999369 | 5.989272 |
7cef69cf-53c1-49b5-9698-c98a0fcf1c59 | junghochoi-playground/Competitive-Programming-Practice | GeeksForGeeks/matrixChainMultiplication.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Problem Statetment
https://www.geeksforgeeks.org/matrix-chain-multiplication-dp-8/
*/
// Recursive Algorithm
vector<vector<int>> DP;
int matrixChainOrder(vector<int>M, int i , int j){
if (i == j) return 0;
if (DP[i][j] != -1)
{
cout << "... | ALGO | 0.99998 | 4.410581 |
c8df1c81-e3a0-41f9-bad9-e1d1cbd34a5a | Clixxzydev/FN-UnrealBuildver4.26 | Engine/Source/Programs/UnrealLightmass/Private/LightmassCore/Math/LMMath.cpp | #include "LMMath.h"
#include "LMCore.h"
namespace Lightmass
{
/** Converts a linear space XYZ color to linear space RGB. */
FLinearColor FLinearColorUtils::XYZToLinearRGB(const FLinearColor& InColor)
{
FLinearColor SourceXYZ(InColor);
// Inverse of the transform in FLinearColor::LinearRGBToXYZ()
const FMatrix XYZT... | ALGO | 0.859926 | 6.731143 |
6be18405-c00f-459b-a1fd-65cceb76d253 | shohan2032/Competitive-Programming-Practice-Codes | Range_Xor_Queries.cpp | #include <bits/stdc++.h>
using namespace std;
#define db long long
#define ll long long
#define int ll
#define vi vector<int>
#define vs vector<string>
#define vpi vector<pair<int, int>>
#define vpd vector<pair<double, double>>
#define vps vector<pair<string, string>>
#define mp(x, y) make_pair(x, y)
#define pb(x) ... | ALGO | 0.999952 | 4.904281 |
c42c0615-23af-4e82-a32a-7e93207d8839 | yuhuoji/CPP | src/leetcode/editor/cn/Leetcode_136_single-number.cpp | #include "../../../../dependencies/include/bits/stdc++.h"
using namespace std;
namespace solution136 {
// leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
//位运算,出现两次的位置对2取余为0,出现一次的为1
int singleNumber(vector<int>& nums) {
int ans = 0;
for (int i = 0; i <... | ALGO | 0.999947 | 5.301552 |
8b2a9f01-bb60-4b74-b752-c2d0dfbb05b5 | TaeMochi12/Patterns | numericmirhfpymds.cpp | // 1 1
// 12 21
// 123 321
// 12344321
#include <iostream>
using namespace std;
int main()
{
int n = 6; // if we take user input
int space = 2 * (n - 1);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
cout << j;
}
for (int j = 1; j <=... | ALGO | 0.999954 | 4.085895 |
119638d7-0e99-4049-8667-dac35b4c040f | RigoLigoRLC/Fritzing-build | boost_1_82_0/libs/multiprecision/example/cpp_int_mul_timing.cpp | #include <algorithm>
#include <cstddef>
#include <cstdint>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <limits>
#include <iterator>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
class random_pcg32_fast_base
{
protected:
using itype = std::uint64_t;
static constexpr bool is_mc... | ALGO | 0.964486 | 5.892571 |
7fdcfa10-8e6f-496f-9990-fca19b295b39 | ParasAnxi/LeetCode-CPP | Q1501-1600/1550. Three Consecutive Odds.cpp | class Solution
{
public:
bool threeConsecutiveOdds(vector<int> &arr)
{
for (int i = 0; i < arr.size(); i++)
{
if (arr[i] % 2 == 0)
{
arr[i] = 0;
}
else
arr[i] = 1;
}
if (arr.size() < 3)
{
... | ALGO | 0.99988 | 5.352224 |
7e605650-849b-458b-8cae-6a12f247c02b | jiun73/NotConsoleRenderer | TIS-100 solver/main.cpp | #include "NotConsoleRenderer.h"
#include <set>
using std::set;
struct Node
{
vector<vector<int>> instructions;
};
struct NodeInfo
{
set<int> used_inputs;
set<int> used_outputs;
bool jro_check = false;
bool jez_check = false;
bool jnz_check = false;
bool jgz_check = false;
bool jlz_check = false;
};
int e... | TOOL | 0.85708 | 4.192816 |
7949ac9b-f1b7-442a-bbe1-665c61800a5c | clod182/tryhard-asd-2024 | ASD_2024/esami_anni_passati/2021-2022/2021-22_appello3_es2.cpp | #include <iostream>
#include <vector>
#include <climits>
#include <assert.h>
#include <unordered_map>
#include <algorithm>
using namespace std;
// <>
/* TESTO ESERCIZIO2 APPELLO3
Sia A un array di n numeri naturali. Si consideri il problema di stampare in ordine crescente tutti i numeri che
compaiono in A almeno ⌈n/k⌉... | ALGO | 0.99989 | 5.671161 |
16f34460-6338-4c17-ab96-0512e889be39 | sency90/allCode | cpbook_code/ch7/ch7_03_triangles.cpp | #include <cstdio>
#include <cmath>
using namespace std;
#define EPS 1e-9
#define PI acos(-1.0)
double DEG_to_RAD(double d) { return d * PI / 180.0; }
double RAD_to_DEG(double r) { return r * 180.0 / PI; }
struct point_i { int x, y; // whenever possible, work with point_i
point_i() { x = y = 0; } ... | ALGO | 0.999088 | 4.067304 |
989c87ea-3922-48a1-9051-22a2d05d0370 | SonamShrivastava2002/Cplusplus_Questions | Tree_Trie_Graph/merge2BST.cpp | #include <bits/stdc++.h>
using namespace std;
//Following is the Binary Tree node structure:
template <typename T>
class TreeNode
{
public:
int data;
TreeNode *left, *right;
TreeNode() : data(0), left(NULL), right(NULL) {}
TreeNode(int x) : data(x), left(NULL), right(NULL) {}
TreeNode(int x, TreeNod... | ALGO | 0.999987 | 5.26684 |
887806a8-e696-4e37-bc87-c40043d4ec35 | DevSWYoon/UntoC_Altudy | 18학번_김남희/week02/BJ02740_MatrixMult.cpp | /* 201824421 Kim Namhee
* Baekjoon 02740 : Matrix Multiplication - Get C = A * B
* Language : Python 3
* Code Length : 578 B, Time : 8 ms, Mem : 1,984 KB
*/
#include <iostream>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m;
// Set array A
int A[n][m];
for (int i = 0; i < n; i++)
for (i... | ALGO | 0.999094 | 3.630361 |
914be1b8-ba48-4466-b5d9-253d105436bd | mckel5/csc211 | labs/lab08/program8.cpp | #include <iostream>
#include <string>
bool pali(std::string str) {
if (str.size() == 1 || str.size() == 0) {
return true;
}
else if (str[0] != str[str.size() - 1]) {
return false;
}
else {
return pali(str.substr(1, (str.size() - 2)));
}
}
int main() {
std::stri... | ALGO | 0.998959 | 6.155277 |
80bbf7e3-9526-4616-ba07-060211aae4cd | liu-timothy/cs-32 | Homework 3/CPP Files/tree.cpp | //
// tree.cpp
// Homework 3
//
// Created by Timothy Liu on 5/7/23.
//
#include <stdio.h>
#include <string>
#include <iostream>
#include <cassert>
using namespace std;
int countIncludes(const string a1[], int n1, const string a2[], int n2);
void separate(string a[],
int n,
string separ... | ALGO | 0.996216 | 4.749609 |
c5e08682-4b92-4e5d-9dd0-5f6f3763c519 | Mengoe/AlgorithmPractice | 0x10/11659.cpp | /*
1. 테이블
D[i] = A[1] + ''' + A[i];
2. 점화식
D[k] = R[k] + D[k-1];
이걸 prefix sum 이라고 하며
이걸 잘 알아두길 바란다
*/
#include <bits/stdc++.h>
using namespace std;
int d[100002];
int r[100002];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
... | ALGO | 0.999986 | 4.552085 |
3be23440-2518-4850-b497-9b8b38ec18e2 | allwellll/cf_code_jiangly | 1742/1742A-A-Sum.cpp | // url:https://codeforces.com/contest/1742/problem/A
// time:2022-10-13 17:51:34
// name:A-Sum
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
int a[3];
std::cin >> a[0] >> a[1] >> a[2];
std::sort(a, a + 3);
if (a[0] + a[1] == a[2]) {
std::cout << "YES\n";
} else {
... | ALGO | 0.999938 | 5.540311 |
ce222ac1-d729-4ba7-ba5f-5ebc1aa819cf | DucatC/Ducat-Coin | src/pubkey.cpp | #include "pubkey.h"
#include <secp256k1.h>
#include <secp256k1_recovery.h>
namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = NULL;
}
/** This function is taken from the libsecp256k1 distribution and implements
* DER parsing for ECDSA signatures, ... | TOOL | 0.945709 | 7.450503 |
64efebdd-b86b-4394-b6b3-d1f1ce48c798 | raincross7/code-similarity | codes/train_code/problem291/problem291_287.cpp | #include <iostream>
#include <cstdio>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
int n;
while(1) {
if(scanf("%d", &n) == EOF) break;
int total = 0;
rep2(i,1,(600/n)) {
total += n * n * i * n * i;
}
cout << total << endl;
}
... | ALGO | 0.999001 | 3.194082 |
757f3ccf-f5bc-45c9-b641-fd1400daf496 | tungvtt1609/detect_object_jetson | c/experimental/homographyNet.cpp | #include "homographyNet.h"
#include "commandLine.h"
#include "cudaUtility.h"
#include "mat33.h"
#ifdef HAS_HOMOGRAPHY_NET
#include <opencv2/calib3d.hpp>
#endif
#define DEBUG_HOMOGRAPHY
//-------------------------------------------------------------------------------------
#ifdef HAS_HOMOGRAPHY_NET
namespace cv
{
... | ALGO | 0.948549 | 5.647359 |
9119037f-f191-44dc-a83b-e03b5eb16479 | TD2106/Competitive-Programming | Hacker Earth/The art of security [4].cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> bi;
int n,power[10]={0},sum=0,gate1,way=0,one;
int fac(int n){
if(n==1||n==0) return 1;
else return n*fac(n-1);
}
void recursion(int ti){
for(int i=0;i<2;i++){
bi.push_back(i);
if(ti==n-1){
//cout<<"YES\n";
gate1=one=0;
for(int j=0;j... | ALGO | 0.999924 | 3.55072 |
46cffd4f-b352-42d4-b3cd-d4af71a199de | eshaagarwa/GFG-POTD | Medium/Serialize and deserialize a binary tree/serialize-and-deserialize-a-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.999209 | 7.280845 |
c9a0f130-8fdc-4152-958d-f7b053236836 | GipsyPotter/PTNK | bt co ban/24.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
floar x,y,z;
cin >> x >> y >> z;
if (x<0) x =x*x;
if (y<0) y = y*y;
if (z<0) z = z*z;
cout << setprecision(2) << fixed;
cout x << " " << y << " " << z;
}
| ALGO | 0.999597 | 3.816956 |
e515f974-758b-4e85-8c1a-5811d485645e | preethamd98/My-Solutions | buildings-with-an-ocean-view/buildings-with-an-ocean-view.cpp | class Solution {
public:
vector<int> findBuildings(vector<int>& heights) {
vector<int> buildings;
stack<int> S;
buildings.push_back(heights.size()-1);
S.push(heights.size()-1);
for(int i=heights.size()-2;i>=0;i--){
while(S.size()>0 and heights[i] > heights[S.top()... | ALGO | 0.999977 | 6.179163 |
73d0e9d0-a03b-49fb-91ec-58b750181674 | Haidranoid/cpp-code | cpp-advanced/fractals/Mandelbrot.cpp | #include <complex>
#include "Mandelbrot.h"
Mandelbrot::Mandelbrot() {
}
Mandelbrot::~Mandelbrot() {
}
int Mandelbrot::get_iterations(double x, double y) {
complex<double> z = 0;
complex<double> c(x, y);
int iterations = 0;
while (iterations < MAX_ITERATIONS) {
z = z * z + c;
if (... | ALGO | 0.890606 | 4.745151 |
6a66ddec-9414-4c4f-868a-f2f7aa171a3d | Hima0X2/hackerrank | operators.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
double tip,tap,mealcost,total;
int ti,ta,x;
cin>>mealcost;
cin>>ti>>ta;
tip=mealcost*(ti/100.00);
//cout<<tip<<endl;
tap=mealcost*(ta/100.00);
// cout<<tap<<endl;
total=mealcost+tip+tap;
x=round(total);
cout... | ALGO | 0.999432 | 3.004892 |
d28f8299-cc90-45cb-84cb-6eb70c1a35e6 | CoderVerma/CB_FUNDAMENTAL | array/bubblesort.cpp | #include<iostream>
using namespace std;
void bubblesort(int a[],int n)
{
for(int itr=1;itr<=n-1;itr++)
{
for(int j=0;j<=n-itr-1;j++)
{
if(a[j]>a[j+1])
{
swap(a[j],a[j+1]);
}
}
}
}
int main()
{
int arr[]={5,4,1,3,... | ALGO | 0.9999 | 4.825826 |
764f6318-44ac-424c-899c-baf5263a72eb | gabrielfelipedy/algorithms | exercises/alunos.cpp | #include <iostream>
#include <cstring>
const int NOME = 0;
const int NOTA1 = 1;
const int NOTA2 = 2;
double calculaMedia(std::string nota1, std::string nota2)
{
return (stoi(nota1) * 2 + stoi(nota2) * 3) / (2.0 + 3.0);
}
void printAluno(std::string aluno[]) {
double media = calculaMedia(aluno[NOTA1], aluno[NOTA2... | ALGO | 0.999056 | 4.718868 |
616d0493-3105-4ed7-9571-6bbd08c02457 | sh-sho1kat/CODEFORCES | Educational Codeforces Round 73 (Rated for Div. 2)/C_Perfect_Team.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define mod 1000000007
#define fr(s,n) for(ll i=s;i<n;i++)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define nl '\n'
#define SH 0
#define ap(arr,n) for(ll i... | ALGO | 0.999965 | 3.770341 |
880bd312-4f20-4bbc-ab9c-b4f0d870eb48 | JakeTeeEm/3D-Renderer-1 | Concept4/points.cpp | #include "main.h"
double p_dist(S_Point p, S_Point s) {
return sqrtl((s.x - p.x) * (s.x - p.x) + (s.y - p.y) * (s.y - p.y) + (s.z - p.z) * (s.z - p.z));
} | TOOL | 0.965397 | 3.722066 |
37780889-2c14-43d3-9041-cde3e4b9a578 | cheatcodezky/algorithm_practice | CppPractice/CppPractice/range_sum_of_bst.cpp | #include<stdio.h>
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int rangeSumBST(TreeNode* root, int L, int R) {
if (root == NULL)
return 0;
if (root->val < L)
return rangeSumBST(root->r... | ALGO | 0.999997 | 5.998525 |
519e8b3a-d203-4916-acbd-8ea9752adb5c | marble234/LAMMPS | src/KSPACE/pair_born_coul_long.cpp | /* ----------------------------------------------------------------------
Contributing author: Ahmed Ismail (SNL)
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_born_coul_long.h"
#include "atom.... | ALGO | 0.984968 | 5.356151 |
397729cc-9c79-49bb-8e73-e55c544f6b6f | vaishnavisharma810/Daily-DSA-Ques- | Sheet 19 Strings/1. MaxmFreq.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
int n = s.length();
unordered_map<char, int> mp;
for(int i = 0; i < n; i++)
mp[s[i]]++;
int maxm = -1;
char ans;
for(int i = 0; i < n; i++)
{
if(mp[s[i]] > maxm)
{... | ALGO | 0.999838 | 3.840843 |
527d3a04-f479-4e1b-9442-4a4643735e33 | viiku/competitive-programming-problems | hackerearth/Costofballons.cpp |
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define REP(i,n) for(int i=0;i<n;i++)
#define REPJ(j,n) for(int j=0;j<n;j++)
#define PER(i,n) for(int i=n;i>0;i--)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define REPJ... | ALGO | 0.994341 | 3.219531 |
7ae5b6b4-5b42-436a-8ba9-3c3f549a1c0b | michaelyql/cp | cses/rangequeries/static_range_min.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define LSOne(S) ((S) & -(S))
#define all(x) (x).begin(), (x).end()
#define debug
#ifdef debug
#define db(x) cout << #x " = " << x << endl;
#define bp(x) cout << #x << endl;
#else
#define db(x)
#define bp(x)
... | ALGO | 0.999976 | 4.265877 |
16e80329-d119-4155-8749-2dbde3657975 | Nikhil-251/Code | 2240-number-of-ways-to-buy-pens-and-pencils/2240-number-of-ways-to-buy-pens-and-pencils.cpp | class Solution {
public:
long long waysToBuyPensPencils(int total, int cost1, int cost2) {
long long ans =0,val=0;
for(int i=0;;i++){
val = total-cost1*i;
if(val<0)
break;
ans+= (long)floor((long)val/(long)cost2)+1;
}
return ans;
... | ALGO | 0.999524 | 5.056677 |
25b109a0-3a97-4f0d-b183-ce4ed33b7f4f | ShahzadKhichi/Learning-DSA-In-C-plus-plus | Heap/kth_smallest.cpp | #include <iostream>
#include <queue>
using namespace std;
int solution(int arr[], int n, int k)
{
if (k > n)
{
return -1;
}
priority_queue<int, vector<int>, greater<int>> pq;
for (int i = 0; i < n; i++)
{
pq.push(arr[i]);
}
int ans = -1;
for (int i = 0; i < k; i++)
... | ALGO | 0.999964 | 4.650711 |
aa8b4318-17a4-4f61-a464-eeb15e4bcf4e | simonepalladino/Image-Processing-Exam | otsu.cpp | #include <opencv2/opencv.hpp>
#include <stdlib.h>
/*
L'algoritmo di Otsu è un metodo di binarizzazione automatica che determina una soglia ottimale per
separare un'immagine in due classi (solitamente, oggetti e sfondo) in modo che la varianza tra
le due classi sia massima. La varianza massima indica che le due class... | ALGO | 0.997951 | 6.290146 |
6e882de9-fba8-4bb3-94a6-a8d9ff778727 | 0xhiroki/CS-110-165 | COMSC-110/Loop-2015-02-09/Lab/personal_practice_1.cpp | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
int product;
string transfer;
do {
cout << "Input a number: ";
getline(cin, transfer);
int input_from_user;
stringstream(transfer) >> input_from_user;
product = input_from_us... | TOOL | 0.858074 | 3.308553 |
ebdf170e-72ec-4d89-a642-a7d792321422 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8034_3.cpp | #include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
constexpr int mul(int a, int b) { return 1LL * a * b % MOD; }
template <typename... T>
constexpr int mul(int a, int b, T... t) {
return mul(mul(a, b), t...);
}
template <class T>
inline T Min(const T &a, const T &b) {
return a < b ? a ... | ALGO | 0.999832 | 3.96547 |
0014a909-7ac3-480a-8f52-9c3cfdecff38 | huangallen2008/cppcode | code/AAhomework/Level4/cf1857F.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define int long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (in... | ALGO | 0.999833 | 3.994416 |
aadcc7ac-5e87-49a6-a162-2b2a66110f5f | SUTDNLP/ZPar | src/common/conparser/implementations/stanford_arc/rules/npadvmod.cpp | //"@ADVP|ADJP|WHADJP|WHADVP|PP|WHPP <# (JJ|JJR|IN|RB|RBR !< notwithstanding $- (@NP=target !< NNP|NNPS))",
inline const bool &npadvmod1(const unsigned long &cons){
if (cons==PENN_CON_ADVP||cons==PENN_CON_ADJP||cons==PENN_CON_WHADJP||cons==PENN_CON_WHADJP||cons==PENN_CON_PP||cons==PENN_CON_WHPP) {
... | ALGO | 0.921772 | 4.17601 |
d89ae7c6-5194-4a7d-96e8-7ae874a0e847 | Consortium3000/Consortium | src/consortium-tx.cpp | #include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "core_io.h"
#include "keystore.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "guiinterface.h" // for _(...)
#include <univalue.h>
#include ... | CONFIG | 0.939214 | 5.834957 |
d27cf15c-fc8c-4840-bc50-c229af970ddd | sabeelkhan99/HackerBlockAssignment | patternmountain.cpp | #include<iostream>
using namespace std;
int main(){
int i=1,j=1,k=1,rows,n;
cin>>rows;
n=(2*rows-1);
for(i=1;i<=rows;i++){
k=1;
for(j=1;j<=n;j++){
if(j<=i||j>=n+1-i){
cout<<k%10;
j<rows?k++:k--;
}
else{
... | ALGO | 0.999934 | 3.690939 |
2482a50f-cd2c-46e2-85d7-237defe49ec2 | lovelyzzkei/Baekjoon_cpp | Gold/5015.cpp | #include <iostream>
#include <string>
using namespace std;
int cache[101][101];
string wildCard;
string pattern;
void initCache()
{
for (int i = 0; i < 101; i++)
{
for (int j = 0; j < 101; j++)
{
cache[i][j] = -1;
}
}
}
bool matched(int w, int p)
{
int& ret = cach... | ALGO | 0.999855 | 3.976767 |
ea0cc020-07d4-4def-9507-3d84c7a81967 | MariaChrysafis/CompetitiveProgramming | Codeforces/1629D.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <cstring>
using namespace std;
typedef long long ll;
bool isPalindrome (string s) {
reverse(s.begin(), s.end());... | ALGO | 0.999853 | 4.908362 |
e46dda25-5953-49de-8491-4a6f5b61878b | hemant087/Data_Structure_and_Algorithm_practice | BinarySearch/Easy_Problem/02pivot_Index.cpp | #include<iostream>
using namespace std;
int pivotSearch(int arr[],int size)
{
int start=0,end=size-1;
int mid= start+(end-start)/2;
while(start<end)
{
if(arr[mid+1]<arr[mid]) // when mid>mid+1,,its obvious mid+1 is pivot,, 7>1
{
return mid+1;
break;
} ... | ALGO | 0.99997 | 4.796376 |
8b97238b-7542-4297-8868-7db228cc373b | psg-19/cp | lvl3/questions/1372b.cpp | #include<bits/stdc++.h>
#include <stack>
using namespace std;
#define ln "\n"
#define ll long long
#define forn(x,n) for(ll i=x;i<n;i++)
#define all(v) v.begin(),v.end()
#define debug1(v) for(auto it=v.begin();it!=v.end();it++)
#define ff first
#define ss second
#define pb push_back
const ll N=1e9+7;
ll mod_add(ll ... | ALGO | 0.999878 | 4.399568 |
00974566-5428-4ce6-bf6c-6e596b8c205e | jym8391/AlgorithmStudy | 삼분 탐색/BOJ 1087. 쥐 잡기/BOJ 1087.cpp | #include <bits/stdc++.h>
#define INF 2e9+7
#define pii pair<int,int>
typedef long long ll;
using namespace std;
int N;
struct M{
double x, y, vx, vy;
};
vector<M> mouse;
void input() {
cin >> N;
//쥐 N마리의 위치와 속도 정보 입력
for(int i=0;i<N;i++) {
double x,y,vx,vy;
cin >> x >> y >> vx >> v... | ALGO | 0.999934 | 4.193111 |
4f7fc8fa-fe47-4ceb-8fb5-f48ebb5b88ad | RutvikRJ6800/DSandAlgo | Leetcode/797_all_path_from_source_to_destination.cpp | class Solution {
public:
vector<vector<int>> ans;
void dfs(vector<vector<int>>& graph, int node, vector<int> &currPath){
currPath.push_back(node); // add this node to path
if(node == graph.size()-1){ //
ans.push_back(currPath); // add path to ans if this node is the last node
... | ALGO | 0.999838 | 6.169117 |
c5da3f34-9c85-466b-8489-bb469a8d039d | ishubhranshu/code_soln | 0526-beautiful-arrangement/0526-beautiful-arrangement.cpp | class Solution {
public:
vector<int> used;
int solve(int cnum, int &num)
{
if(cnum>num)
return 1;
int ans=0;
for(int i=1; i<=num; i++)
{
if(used[i]==-1 && (cnum%i==0 || i%cnum==0))
{
used[i]=1;
ans+=solve(cn... | ALGO | 0.999985 | 5.921404 |
2a38ded0-ab58-47c2-94bd-e39748ba7381 | DavidingPlus/algorithm | leetcode/3.无重复字符的最长子串.cpp | /*
* @lc app=leetcode.cn id=3 lang=cpp
*
* [3] 无重复字符的最长子串
*/
// @lc code=start
#include <iostream>
using namespace std;
#include <string>
const int N = 5 * 1e4 + 10;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
if (s.empty())
return 0;
// 滑动窗口在动态规划中的应用
... | ALGO | 0.99964 | 6.195802 |
7e1b3042-5ea5-467b-80ec-cb9fd03f8a4d | theadeshkhanna/DSA-Practice | Majority Element - GFG/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:
// Function to find majority element in the array
// a: input array
// size: size of input array
int majorityElement(int A[]... | ALGO | 0.999898 | 5.568058 |
8b54e938-db26-48be-be44-998ea9ec1818 | Vatsal-Shingala-1011/Data-Structures-And-Algorithms | problems/GFG 13july23/Replace_every_element_with_the_least_greater_element_on_its_right.cpp |
// // class Solution{ //self TLE
// // public:
// // vector<int> findLeastGreater(vector<int>& arr, int n) {
// // vector<int> sorted=arr;
// // sort(sorted.begin(),sorted.end());
// // for(int i=0;i<n;i++){
// // auto it=upper_bound(sorted.begin(),sorted.end(),arr[i]);
// /... | ALGO | 0.99999 | 5.179607 |
e837011a-a68a-43df-a304-d69075d2b598 | sanchi191/Plagiarism | plag-project/plagproject/media1/emma/66_jkT8Geq.cpp | #include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<limits.h>
using namespace std;
vector<int> invp;
vector<int> invq;
vector<int> r;
vector<int> p;
vector<int> q;
vector<int>perm;
vector<int> inverse_r;
int count_inv=0;
int flag=1;
int var1,var2,var3;
bool compare(int a,int b)
{ int co... | ALGO | 0.999962 | 3.387769 |
2011f274-e4bd-48b5-8021-6bf1182129cb | Pulakesh5/_DSA_ | JUNE 23/08 June/Find Kth permutation gfg.cpp | class Solution
{
public:
string kthPermutation(int n, int k)
{
// code here
vector<int> vec;
for(int i=1; i<=n; i++)
vec.push_back(i);
while(--k)
{
next_permutation(vec.begin(), vec.end());
}
string ans;
for(int i=0; i<n; i+... | ALGO | 0.999974 | 6.398389 |
40de1104-6bab-45e4-8b09-6a2189f6fb80 | dhwanish-3/Leetcode-CPP-Solutions | 1081. Smallest Subsequence of Distinct Characters.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string smallestSubsequence(string s) {
int lastIndex[26] = {0};
for (int i = 0; i < s.length(); i++) {
lastIndex[s[i] - 'a'] = i;
}
bool seen[26] = {false};
stack<char> st;
for (int i ... | ALGO | 0.999981 | 5.507037 |
dc2f0d96-2a02-4cfd-a573-0db5325a22fe | ptdotps2/ePT | src/GreenWallet/Fusion.cpp | /////////////////////////////
#include <GreenWallet/Fusion.h>
/////////////////////////////
#include "CryptoNoteConfig.h"
#include <iostream>
#include <Wallet/WalletGreen.h>
#include <Common/ColouredMsg.h>
#include <GreenWallet/Tools.h>
#include <GreenWallet/WalletConfig.h>
size_t makeFusionTransaction(CryptoNote:... | ALGO | 0.912374 | 3.25967 |
974bd302-5310-47e6-9cee-981637d5b8bf | kongsa0419/BarkingDog_algo | 0x09/2583.cpp | /**
* name:
* solved: N
* 차원이 바뀌는 경우 헷갈림
* 그냥 기존대로 해도 x축 대칭한것처럼 생각하고 진행
*/
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#define X first
#define Y second
#define PRE_PROC ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namesp... | ALGO | 0.999808 | 3.235496 |
137912d8-4c5f-4a84-8d1e-70ce263e547a | maxxmanish/CPP_DSA_CODE | SORTING.cpp/stack.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
class Stack{
Node* head;
public:
int size;
Stack(){
head = NULL;
size = 0;
}
void push(int data){
N... | ALGO | 0.996447 | 3.339657 |
76630f62-4993-4012-87f4-7a90182f5017 | X3n0nP0w3r3d/InputOutput | problemsets/live_contests/DIV3_2037/touristsolns/A_touristsoln.cpp | /**
* author: tourist
* created: 17.11.2024 06:34:32
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
... | ALGO | 0.999902 | 5.496122 |
282569fa-b7d7-4f10-b94c-26d80d659afc | regismeyssonnier/CSES | CSES/DP/counting_tilings.cpp | // CSES.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit.
//
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <limits>
#include <math.h>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
#define... | ALGO | 0.999994 | 5.111303 |
c7aa3931-e1be-4ed2-afce-825234c2f436 | shashikira02/Leetcode | 0838-push-dominoes/0838-push-dominoes.cpp | class Solution {
public:
string pushDominoes(string dominoes) {
int n = dominoes.size();
vector<int>left(n,0),right(n,0);
char prev = '.';
int count =1;
for(int i =0;i<n;i++){
if(dominoes[i]=='R'){
prev = 'R';
count =1;
... | ALGO | 0.999987 | 6.181906 |
cc23227f-d403-48d9-9503-83f438e2bb62 | manchikanthitejaswi/c-assignment-3 | ass3,1.cpp | #include <stdio.h>
int checkPrimeNumber(int n);
int main() {
int n1, n2, i, flag;
printf("Enter two positive integers: ");
scanf("%d %d", &n1, &n2);
if (n1 > n2) {
n1 = n1 + n2;
n2 = n1 - n2;
n1 = n1 - n2;
}
printf("Prime numbers between %d and %d are: ", n1, n2);
for (i = n1 + 1; i < n2; +... | ALGO | 0.999771 | 4.074297 |
0291ecae-e9ce-4a11-9f4d-558452354e8a | aidanmcb1/Yuzu | src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_add.cpp | #include "shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_helper.h"
namespace Shader::Maxwell {
namespace {
void HADD2(TranslatorVisitor& v, u64 insn, Merge merge, bool ftz, bool sat, bool abs_a, bool neg_a,
Swizzle swizzle_a, bool abs_b, bool neg_b, Swizzle swizzle_b, const IR::U32& s... | TOOL | 0.976689 | 7.012619 |
934666ea-ab48-4a79-a2ec-97cd4fda0104 | wotsushi/competitive-programming | abc/007/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL... | ALGO | 0.99926 | 3.957123 |
31e14a98-c52e-429c-8879-17e901781376 | mohitkadwe19/leetcode-solutions | successful-pairs-of-spells-and-potions.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> successfulPairs(vector<int> &spells, vector<int> &potions, long long success)
{
vector<int> res;
sort(potions.begin(), potions.end());
int n = spells.size();
int m = potions.size();
for (int i = 0; i < n; i++)
... | ALGO | 0.999725 | 4.814158 |
95e1841f-78c9-4de8-bda7-b2209d348b9c | dubeyKartikay/SafeC | llvm/lib/CodeGen/BranchRelaxation.cpp | #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/RegisterScavenging.h"... | ALGO | 0.96575 | 7.437816 |
abf3e302-08c3-4298-8b8c-40ff537aff2e | sankalp29/Competitve-Programming-Codes | 594A.cpp | #include<bits/stdc++.h>
typedef long long ll;
typedef double ld;
#define vll vector<ll>
#define vvll vector< vll >
#define vld vector< ld >
#define vvld vector< vld >
#define pll pair<ll ,ll >
#define nl <<endl
#define vllp vector< pll >
#define MOD 1000000007
#define endl "\n"
#define MAX 1000000007
#define f(i,a,b) f... | ALGO | 0.999714 | 4.025989 |
360429a5-9ccc-4533-b448-d7a896613646 | kimjunseoalta10/c | 1274.cpp | #include<stdio.h>
main()
{
int n,s=0,i;
scanf("%d", &n);
for(i=1; i<=n; i++)
{
if(n%i==0)
{
s++;
}
}
if(s==2)
printf("prime");
else
printf("not prime");
}
| ALGO | 0.999926 | 3.598423 |
31d5b753-c58b-4806-a5a9-e022f7c201be | ANANAzZzZz/Leetcode | 2231-largest-number-after-digit-swaps-by-parity/2231-largest-number-after-digit-swaps-by-parity.cpp | class Solution {
public:
int largestInteger(int num) {
unordered_set<int> odds;
priority_queue<int> Epq;
priority_queue<int> Opq;
int n = to_string(num).length();
for (int i = n - 1; num > 0; i--) {
int digit = num % 10;
if (digit % 2 != 0) {
... | ALGO | 0.999975 | 6.115171 |
880bbee5-58ce-4b2a-a28c-6f30e447db1a | HEETVICHHIVORA/ds-love-bbabr | qtns_leetcode/climbingstairs_recursion.cpp | class Solution {
public:
int counting(int n){
if(n==-1) return 0 ;
if (n==0) return 1 ;
return counting(n-1)+counting(n-2);
}
int climbStairs(int n) {
return counting(n);
}
}; | ALGO | 0.999952 | 6.095325 |
3a2ef5ef-c147-464e-b5c8-a3812bee84d5 | MArndt26/spec-hpc-tests | disk-image/spec-hpc/remotes/TeaLeaf_OpenMP/2d/c_kernels/kokkos/kokkos_src/example/tutorial/02_simple_reduce/simple_reduce.cpp | #include <Kokkos_Core.hpp>
#include <cstdio>
//
// First reduction (parallel_reduce) example:
// 1. Start up Kokkos
// 2. Execute a parallel_reduce loop in the default execution space,
// using a functor to define the loop body
// 3. Shut down Kokkos
//
// Compare this example to 02_simple_reduce_lambda, wh... | ALGO | 0.930269 | 6.497443 |
fa81cdec-0031-4fe2-8a0f-9f2a822566f0 | AarzooArora/cpp-programs | positive_negative_zero.cpp | #include<iostream>
using namespace std;
int main(){
int x;
cout<<"enter an integer ";
cin>>x;
if(x>0){
cout<<"Number is posiive";
}
else if(x<0){
cout<<"Number is negative";
}
else{"Number is zero";}
return 0;
} | ALGO | 0.983817 | 3.474718 |
4fd9b765-5ca4-4597-9386-a9913221dfe2 | Yaboi-Gengarboi/CS201GroupProject | Calculator/mathFunctions.cpp | //mathFunctions.h
//Justyn P. Durnford
//Izac Lorimer
//Created on 10/21/2019
//Last Updated on 11/25/2019
//Source file for functions relating to math
#include "mathFunctions.hpp"
#include "Error.hpp"
#include <algorithm>
#include <cmath>
using std::abs;
using std::log;
using std::sin;
using std::cos;
using std::tan... | TOOL | 0.853782 | 6.070799 |
ec4871a5-0072-46c1-aaba-04b7b83f7762 | AlgoZenithNITC/GFG_POTD_Solutions_AlgoZenithNITC | Merge_2_sorted_linked_list_in_reverse_order.cpp | class Solution{
public:
struct Node * mergeResult(Node *node1, Node *node2){
if(node1 == NULL and node2 == NULL){
return NULL;
}
Node *present = NULL;
while(node1 != NULL and node2 != NULL){
if(node1 -> data <= node2 -> data){
Node *temp = ... | ALGO | 0.999977 | 4.991894 |
2c1a3421-ab2f-4818-a281-cfddcd1b4fea | houes/CS518_Project | CS518_Project/draw_objects.cpp | #pragma once
#include "draw_objects.h"
#include "helperFunctions.h"
#include <sstream>
#include <iomanip>
#include <map>
bool showHalfEdge = true;
double delta = 0.005; // distance defining an edge separated into two halfedges
double omega = 0.035; // the length of the arrow head
extern double cursorX;
extern doubl... | TOOL | 0.869909 | 3.121135 |
7305052f-dfe3-4efc-bac1-3564e0fd4cb4 | shrey-creator/LeetcodeSolutions | 1. Search an Element in an array - GFG/1.-search-an-element-in-an-array.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// Function to search x in arr
// arr: input array
// X: element to be searched for
int search(int arr[], int N, int X)
{
// auto it=lower_bound(arr,arr+N,X);
for(... | ALGO | 0.999623 | 5.792914 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.