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 |
|---|---|---|---|---|---|---|
15652fa9-2844-42ea-8de8-d41a7d60aaac | JerryZhou/Raccoon | examples/src/04physicalgame/Box2D/include/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.987309 | 7.939983 |
5b8940ce-6312-4eb6-9522-66cac2d6a693 | SimpleVlad/KG_lab1 | methods.cpp | #include "methods.h"
#include <vector>
#include <math.h>
using namespace std;
using namespace cv;
// Otsu's
//-------------------------------------------------------------------------------------------------------
// Алгоритм предполагает , что изображение содержит два класса пикселей следующих би-модальных гистогра... | ALGO | 0.997308 | 4.06272 |
bf754bd3-35ff-41ab-bdf1-cf3854f1b165 | maskadok/Introduction-to-Algorithm | lab6/a.cpp | #include <iostream>
#include <vector>
using namespace std;
int part(vector<int> &v, int low, int high){
int i = low - 1, pivot = high;
for(int j = low; j <= high - 1; j++){
if(v[j] < v[pivot]){
i++;
swap(v[i], v[j]);
}
}
swap(v[i + 1], v[pivot]);
return i + 1... | ALGO | 0.999664 | 4.727148 |
1802727c-9f2a-40f8-b29e-928ba45461c3 | tmak1000/practice | puzzle4.cpp | #include<iostream>
#include<cstdlib>
using std::cout;
using std::cin;
int main(){
for(int row = 0;row<4;row++){
for(int space=0;space <3-row;space++){
cout<<" ";
}
for(int i = 0;i<2;i++){
for(int col = 0;col<4-abs(3-row);col++){
cout<<"#";
}
}
cout<<"\n";
}
for(int ro... | ALGO | 0.997253 | 3.177013 |
50614281-44d5-4637-bd59-874e088a74cd | 0vitor/competitive-programming | leetCode/slideWindow/643.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
#define _ \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define db... | ALGO | 0.999847 | 4.80653 |
b344a90c-5996-4f78-9f47-b9cb7cf89146 | divyansingh/CPP-sample | binary_to_decimal.cpp | #include<iostream>
using namespace std;
double rpow(int b,int e)
{
double a=1.0;
for(int i=1;i<=e;i++)
{
a*=b;
}
return a;
}
int main()
{
int n,t,p=0,dec=0;
cin>>n;
while(n>0)
{
t=n%10;
n/=10;
dec+=t*(rpow(2,p));
p++;
}
cout<<dec;
... | ALGO | 0.999937 | 3.862151 |
48c28175-3df6-4ef8-92ff-0597e99f00df | NhatLe2002/CCDL-GT | Mang_Mot_Chieu/Find_Fibo_In_Array.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
int f[1001];
void ktao(){
int fibo[20];
fibo[0] = 0; fibo[1]=1;
for(int i = 2; i<=19; i++){
fibo[i] = fibo[i-1] + fibo[i-2];
}
for(int i = 0; fibo[i] <=100; i++){
f[fibo[i]]=1;
}
}
int main() {
ktao();
int TC; cin >> ... | ALGO | 0.999837 | 4.12168 |
576bd75b-4b38-4fe1-904c-4f401c55e639 | ishandutta2007/codeforces | rhodoks/normal/1173/E1.cpp | #include <bits/stdc++.h>
#define DB double
#define LL long long
#define MST(a,b) memset((a),(b),sizeof(a))
#ifdef _DEBUG_
#define MRK() cout<<"Mark"<<endl;
#define WRT(x) cout<<#x<<" = "<<(x)<<endl;
#else
#define MRK() ;
#define WRT(x) ;
#endif
#define MAXN 1010000
#define MAXM 2010000
#define MOD 998244353 //10000... | ALGO | 0.999981 | 3.781269 |
444d2699-3c87-4613-9e67-5e6f61ebf572 | begong313/algorithm_study | MinJe/Week 30/14002_가장긴증가하는부분수열4.cpp | #include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
int nums[1000];
int dp[1000];
int parents[1000];
int main(){
int n;
cin >> n;
for (int i = 0; i < n; i++){
cin >> nums[i];
}
// base case
for (int i = 0; i < n; i++){
dp[i] = 1;
parents[i] ... | ALGO | 0.999997 | 4.318098 |
8f38fadb-cd3e-443c-bf45-33cefecf71bb | Karelito00/problems | COJ/1297.cpp | #include <bits/stdc++.h>
using namespace std;
bool dvi3(string n){
int suma=0;
for(int u=0;u<n.size();u++)
suma+=(n[u]-'0');
if(suma%3==0)
return true;
else
return false;
}
bool dvi5(string n){
if(n[(n.size())-1]=='0' || n[(n.size())-1]=='5')
return true;
else
... | ALGO | 0.999641 | 4.886913 |
adafc5e7-4873-4c89-b07e-7547ba92aae0 | primiano/platform_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "set_sign.h"
#include "basic_op.h"
#include "inv_sqrt.h"
#include "cnst.h"
/*----------------------------------------------------------------... | ALGO | 0.999931 | 5.871158 |
b4301e17-152d-496e-8507-a7d14566924e | kallaballa/Poppy | third/opencv_contrib-4.x/modules/aruco/src/charuco.cpp | #include "precomp.hpp"
#include "opencv2/aruco/charuco.hpp"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
namespace cv {
namespace aruco {
using namespace std;
/**
*/
void CharucoBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderBits) {
CV_Assert(!outSize.empty());
CV_Asser... | TOOL | 0.97442 | 6.13584 |
33885c09-aa21-4668-a8c9-4ef4d337ccfe | Vinicius-Reis-da-Silva/problemas-resolvidos-de-maratonas | 1557 - Matriz Quadrada III - URI Online Judge.cpp | #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
//FUNCO PARA DETERMINAR O NMERO DE CASA DECIMAIS
int digito(int valor){
int n=1;
while(valor > 9){
valor = valor/10;
n++;
}
return n;
}
int main()
{
setlocale(LC_ALL,"Portuguese");
int valor;
cin ... | ALGO | 0.999267 | 3.921986 |
dcf3f1f8-ad2c-4295-985e-67e255981542 | aryarajnishu/DSA-practice | 0_LEC__1_to_10/LEC10pro4.cpp | #include<iostream>
#include<math.h>
using namespace std;
void intersection(int arr1[] , int arr2[]){
for(int i=0 ; i<5 ; i++){
for(int j=0 ; j<4 ; j++){
if(arr1[i] == arr2[j]){
cout<< arr1[i]<<" ";
}
}
}
}
int main(){
int arr1[5]={2,9,3,6,7};
int ... | ALGO | 0.999437 | 3.232036 |
bb756f03-aa6f-4832-ba70-88f6bd47bb16 | mentat/Hashish | src/crypto/md2.cpp | // md2.cpp - modified by Wei Dai from Andrew M. Kuchling's md2.c
// The original code and all modifications are in the public domain.
// This is the original introductory comment:
/*
* md2.c : MD2 hash algorithm.
*
* Part of the Python Cryptography Toolkit, version 1.1
*
* Distribute and use freely; there are n... | ALGO | 0.999421 | 6.97684 |
d5063f5d-3662-4ed3-8e43-e64ea3c4bbfd | mayank7jha1/CP_Live | Lecture 22/K_For_the_Price_Of_One.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 0;
#define int long long
int n, p, k;
int cost[200002];
//Greedy+DP: Sort: Greedy Approach: If i want to buy 10 items and k=3 is given
// i want to apply the offer on the most expensive items for that i have sorted the data.
//Dp : Even though maine data sort... | ALGO | 0.999851 | 4.307001 |
e5c15a9c-9d5a-4606-a13f-e0dad39e0876 | muschellij2/FSL6.0.0 | extras/include/boost/libs/graph/example/topo-sort2.cpp | int
main()
{
using namespace boost;
const char *tasks[] = {
"pick up kids from school",
"buy groceries (and snacks)",
"get cash at ATM",
"drop off kids at soccer practice",
"cook dinner",
"pick up kids from soccer",
"eat dinner"
};
const int n_tasks = sizeof(tasks) / sizeof(char *);
... | ALGO | 0.999143 | 5.273723 |
b9c98fe4-119d-47f4-92cf-3672b95eae19 | Terzi0N/Lab5 | Lab5/Complex.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include "Header.h"
double Complex::getReal() const
{
return this->real;
}
double Complex::getImaginary() const
{
return this->imaginary;
}
void Complex::setReal(double real)
{
this->real = real;
}
void Complex::setImaginary(double imaginary)... | ALGO | 0.999415 | 3.850403 |
e6c1b3a5-57f3-4877-9e85-507333dad455 | Devaanshraheja/CPP_DSA | CB-DSA/L8-Recursion/1_Factorial.cpp | #include <iostream>
using namespace std;
int fact(int n){
// base case
if (n == 0) return 1;
// recursive case
return n * fact(n - 1);
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
... | ALGO | 0.99997 | 5.705307 |
426e9c10-7b48-45c7-8fa1-b5ae6264df3f | shivamkr022/my-codes | codeforces/codeforces/43A.cpp | /*
------------------------------------------
| |
| Code Crafted by Shivam |
| |
------------------------------------------
\ , , /
\ | | /
\ \_/ /
\ ----- /
... | ALGO | 0.999858 | 5.092458 |
145e2858-9a51-49b6-9969-1b2addc2b9a6 | lon2graf/Tugushev_324_PP0101 | 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 |
944dcf63-2b10-47db-921a-e26851274d3d | icpc-uiuc/icpc-scc19 | problems/g-greenberg/Greenberg_Mass_Comparison.cpp | #include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define base 1000000000
#define width 9
template<typename T>
string to_string(const T& x){
stringstream ss;
ss<<x;
return ss.str();
}
struct bigN:vector<ll>{
bool negative;
void trim(){
... | ALGO | 0.999841 | 4.508255 |
981eb593-37e3-4d9e-9d75-0273986f8d60 | ssatwik975/leetcode-solutions | solutions/2610-closest-prime-numbers-in-range/solution.cpp |
vector<int> p{2};
bool sieve[1000001] = {};
class Solution {
public:
vector<int> closestPrimes(int left, int right) {
if (p.size() == 1)
for (long long i = 3; i < 1000001; i += 2)
if (!sieve[i]) {
p.push_back(i);
for (long long d = i * i; ... | ALGO | 0.99999 | 4.791682 |
5fa54e6e-92f5-4946-8b84-658374abbb20 | t2kasa/atcoder | old_atcoder/abc075/abc075a.cpp | // https://beta.atcoder.jp/contests/abc075
// status: [solve]
#define SUBMIT
//#define DEBUG
#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <queue>
#include <numeric>
#include <limits>
#include <set>
using namespace std;
using ui64 = unsigned long long;
usi... | ALGO | 0.999855 | 4.537066 |
95634a45-34b7-41bf-8c9b-7e21aa8838bf | Mr-Anurag-Gupta/cpp_programming_exercises | 14. Introduction to Standard Template Library/ex_14.2.cpp | /**
* Write a program using find() algorithm to locate the position of a specified
* value in a sequence container.
*/
#include <iostream>
#include <vector>
int main()
{
std::vector<int> v{1, 2, 3, 45, 6, 7};
auto result = std::find(std::begin(v), std::end(v), 6);
if (result != std::end(v))
s... | ALGO | 0.998663 | 5.733921 |
eb3d0807-adbd-4ced-85fe-db2025826cde | xXG4briel/loop-to-billion | scripts/cpp/billion.cpp | #include <iostream>
#include <iomanip>
#include <chrono>
int main() {
int billion = 1000000000;
auto start_time = std::chrono::high_resolution_clock::now();
for (int i = 0; i < billion; i++) {
}
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed_t... | TOOL | 0.941391 | 4.644726 |
55feb3d1-e165-4c76-88f5-93b53a63ab7f | Hansimov/cpp-primer | ch03/p-137 init vector with arr.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int arr[] = {0,1,2,3,4,5};
vector<int> vec(begin(arr),end(arr));
for (auto ele:vec)
cout << ele <<" ";
cout << endl;
cout << vec.size() << endl;
vector<int> vec2(arr+1,arr+4)... | ALGO | 0.886202 | 3.675015 |
f8912bf3-2c19-4ae8-a58c-60fa4304783d | TheDeepDaemon/very-simple-organism | cpp_code/eigen-3.3.8/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.983022 | 3.51303 |
45f13592-b448-4a77-8dde-733a30cd045c | aastha-0711/DSA | 0787-cheapest-flights-within-k-stops/0787-cheapest-flights-within-k-stops.cpp | #include <vector>
#include <queue>
#include <limits>
using namespace std;
class Solution {
public:
int findCheapestPrice(int n, vector<vector<int>>& flights, int src, int dst, int k) {
// Create an adjacency list to store the flights
vector<vector<pair<int, int>>> graph(n);
for (const auto... | ALGO | 0.999907 | 6.800544 |
f95257ea-6c19-4ef7-a295-d8ab3429b1dc | dormon/gshadow | app/fastAdjacency.cpp | #include"fastAdjacency.h"
#include<iostream>
#include<algorithm>
#include<cstring>
#include<sstream>
template<unsigned dim>
class Vertex{
public:
const float* data = nullptr;///<global data
unsigned index = 0; ///<this vertex starts here
Vertex(const float*data,unsigned i){
this->data = data;
... | ALGO | 0.996111 | 3.894135 |
9bf2262e-a9b2-42fd-a333-eb2f8083a649 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/Good_Matrix_Elements.cpp | #include<bits/stdc++.h>
using namespace std;
int n,a,s;
main(){
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cin>>a;
if(i==j||i==(n+1)/2||j==(n+1)/2||i+j==n+1)s+=a;
}
}
cout<<s;
}
| ALGO | 0.999784 | 3.283868 |
c1ed915d-2f90-4630-87f4-236b0f9d831e | ShubhamAgarwal-11/Leetcode | 0918-maximum-sum-circular-subarray/0918-maximum-sum-circular-subarray.cpp | class Solution {
public:
int maxSubarraySumCircular(vector<int>& nums) {
int n = nums.size();
int SUM = accumulate(begin(nums), end(nums), 0);
int k_sum_min = nums[0];
int min_sum = nums[0];
int k_sum_max = nums[0];
int max_sum = nums[0];
... | ALGO | 0.999964 | 6.071142 |
7a82f341-8600-4ece-bdbc-21e4af99bf52 | mcarlen/libbiarc | tools/curvesplit.cpp | /*!
\file curvesplit.cpp
\ingroup ToolsGroup
\brief Split a "closed" curve into segments for given arclength values.
Splits a closed curve c into segments given the values s0, s1, etc.
Initially written to be used with billiard_sigmas.py.
Example : ./curvesplit f3.1.pkf `python billiard_sigmas.py`
Re... | TOOL | 0.991537 | 4.651857 |
eb6c59c1-8f67-4857-a17d-1cf643563c3a | michaeljimson/learnAlgorithm | PKUOj/1007DNASorting.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef struct{
char s[51];
int num;
}DNA;
int InversionNumber(char *s, int n)
{
int num = 0;
for(int i = 0; i < n - 1; i++){
for(int j = i + 1; j < n; j++){
if(s[i] > s[j])
num++;
}
}
return num;
}
bool cmp(DNA a, DNA b){... | ALGO | 0.999933 | 3.84341 |
6bdf6d7e-fc97-46d2-9eed-fbdaae637f07 | harsh0620/DSA450 | BinaryTree/b14.cpp | // Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node *left;
Node *right;
};
// Utility function to create a new Tree Node
Node *newNode(int val)
{
Node *temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;... | ALGO | 0.999812 | 6.422171 |
729def43-bdd0-417d-ad42-668f1701de9f | Feline-A/HackerRank | Camel Case/Feline-CamelCase.cpp | #include <iostream>
using namespace std;
int main(){
string s;
int ans = 1;
cin >> s;
for(int i=0;i<s.size();i++){
if (s[i] >= 'A' && s[i] <= 'Z'){
ans++;
}
}
cout << ans << "\n";
return 0;
}
| ALGO | 0.999351 | 4.079488 |
859a107d-9ef4-47e8-9625-ddaab6d490d9 | viny3143/leetcode | 2076-sum-of-digits-of-string-after-convert/sum-of-digits-of-string-after-convert.cpp | class Solution {
public:
char letters[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
int size = 26;
int check(char target) {
int left = 0;
int right = size - 1;
while (left <= right) {
... | ALGO | 0.999973 | 5.24395 |
cac31518-c1d7-403d-bf45-641bac638ede | Smaranls/Leetcode | 0072-edit-distance/0072-edit-distance.cpp | class Solution {
private:
int solve(string word1 , string word2 ,int i,int j,vector<vector<int>> &dp){
int a=word1.length();
int b = word2.length();
if(a==i){
return b -j;
}
if(b==j){
return a-i;
}
int ans =0;
if(dp[i][j]!=-... | ALGO | 0.999998 | 6.019652 |
3b6a57fd-fc24-485f-aa0e-a7c41cbc5e78 | RevealMind/itmo | discrete_math/term_1/lab_3/task_6.cpp | #include<bits/stdc++.h>
std :: vector<int> arr;
std :: vector<std :: vector<int> > mas;
int n, k = 0;
void func(int i){
if(arr.size() == n)
{
mas.push_back(arr);
k++;
return;
}
arr.push_back(0);
func(i + 1);
arr.pop_back();
if(arr.empty() || !arr.back()){
arr.push... | ALGO | 0.999932 | 3.887851 |
233bcf4d-cfbe-4b29-82d7-ad3a0e9ab6ac | timmao955/Leetcode-hot100 | 10.回溯/39.cpp | // 组和总和
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> ans;
vector<int> path;
void backtracking(vector<int>& candidates, int target, int sum, int index) {
if (sum > target) {
return;
}
if (sum == target) {
ans.push_back(path);
return;
}
for... | ALGO | 0.999941 | 5.545164 |
ad591007-9061-4521-9fef-a364b09e5de9 | anis009/competitve-programming | maximize_the_array.cpp | #include<bits/stdc++.h>
using namespace std;
int maximizeArray(int arr1[], int arr2[], int n) {
vector<int>v1(100001);
vector<int>v2(100001);
vector<int>v3;
vector<int>v4;
for(int i=0;i<n;i++){
v1[arr1[i]] = i;
v2[arr2[i]] = i;
}
sort(arr1,arr1+n);
so... | ALGO | 0.999995 | 3.508376 |
70a70840-c754-47cb-9cbc-c846caf2658b | Sang20225664/Applied-Algorithm-2024.1 | Hustack LyThuyet/Chapter 8/Geometry Intersection 2 segments.cpp | #include <iostream>
using namespace std;
// Hàm kiểm tra thứ tự của 3 điểm (dùng cho bài toán định hướng)
int orientation(int x1, int y1, int x2, int y2, int x3, int y3) {
int val = (y2 - y1) * (x3 - x2) - (x2 - x1) * (y3 - y2);
if (val == 0) return 0; // Đồng thẳng
return (val > 0) ? 1 : -1; ... | ALGO | 0.999765 | 5.508982 |
eefd8b4c-2aec-4baf-8d5a-dd3b811a82f8 | ishandutta2007/codeforces | dreamoon_love_aa/normal/1250/N.cpp | /*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).be... | ALGO | 0.999993 | 3.711787 |
632f2cb6-969d-4097-8b86-fcd0d1d371b0 | varshadhanotiya/codes | Nth node from end of linked list - GFG/nth-node-from-end-of-linked-list.cpp | // { Driver Code Starts
// C program to find n'th Node in linked list
#include <stdio.h>
#include <stdlib.h>
#include<iostream>
using namespace std;
/* Link list Node */
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
/* Function to get the nth node from the last o... | ALGO | 0.999867 | 5.94816 |
b0f2255d-bea2-4019-9142-aea4b90c9a9d | jovechiang/solSGU | 121.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int Max = 100 + 20;
int n;
/******NEIGHBOR******/
vector <int> N[Max];
int color[Max][Max];
/******NEIGHBOR******/
/******MOALLEFE******/
int moallefe_num;
int hamband[Max];
vector <int> moal[Max];
void bfs(int start)
{
moallefe_num+... | ALGO | 0.999994 | 4.057074 |
61641ef8-7333-4693-a669-1d35fd5ec6c1 | Yunme/DataStructure | LinearList/DuLinkList.cpp | //
// Created by zzqni on 2024/4/17.
//
#include "DuLinkList.h"
DuLNode *GetElemP_DuL(DuLinkList &L, int i) {
DuLNode *p = L->next;
int j = 1;
while (p && j < i) {
p = p->next;
j++;
}
if (!p || j > i) {
return nullptr;
}
return p;
}
Status ListInsert_Dul(DuLinkList... | ALGO | 0.99943 | 3.662217 |
632aaeb0-9a2d-4ab9-b2be-c00aea1d97c6 | Muntaha-Islam0019/UVa-Solutions | P11945.cpp | #include <cstdio>
#include <clocale>
using namespace std;
void printfcomma (int n)
{
if (n < 1000)
{
printf ("%d", n);
return;
}
printfcomma (n/1000);
printf (",%03d", n%1000);
}
int main()
{
int T;
scanf("%d", &T);
setlocale(LC_ALL, "en_US.UTF-8");
for (int t = ... | ALGO | 0.972817 | 3.260176 |
9e6846ff-85fe-476d-bb68-003cefffb1a6 | Srijanakash/Coding | LeetCode/Practice/MaxAreaOfIsland.cpp | /*
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land)
connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is... | ALGO | 0.999948 | 6.670473 |
1cc93324-1f42-4b70-8408-546583a4deb8 | akothen/Hydride | frontends/halide/test/correctness/multiple_outputs_extern.cpp | #include "Halide.h"
#include <stdio.h>
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
extern "C" DLLEXPORT int flip_x_and_sum(halide_buffer_t *in1, halide_buffer_t *in2, halide_buffer_t *out) {
int min = out->dim[0].min;
int max = out->dim[0].min + out->dim[0].extent - 1;... | ALGO | 0.929727 | 6.80946 |
1e232762-ea5d-467e-b912-eaf1f9c7c99e | thb1314/mmyolo_tensorrt | TensorRT/plugin/common/reducedMathPlugin.cpp | #include <cstdint>
namespace nvinfer1
{
namespace plugin
{
namespace detail
{
// Count leading zeros - start from most significant bit.
int clz(int x)
{
for (int i = 31; i >= 0; --i)
{
if ((1U << i) & x)
{
return 31 - i;
}
}
return 32;
}
#define CUDNN_IS_POW_2(x) (0... | ALGO | 0.960383 | 6.069958 |
8f76215d-7aa5-449f-8a75-549caeba8523 | Saketmishra14/DSA-Supreme-3.0 | 06 Searching and Sorting/Searching and sorting class-03/nearlysortedarray.cpp | //given a sorted array arr[] of size N, some elements of array are moved to either of the adjacent positions, i.e., arr[i] may be present at arr[i+1] or arr[i-1] . The task is to search for an element in this array
//input: arr[]={10,3,40,20,50,80,70}, key=40
//output: 2
//explanation: output is index of 40 in given ar... | ALGO | 0.999964 | 5.638166 |
068a486f-c343-450c-85f8-813b3c1b7764 | maitreya-v/AOA_Practicals | NQueen.cpp | #include<iostream>
using namespace std;
int board[100];
void print_board(int n){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(board[i]==j){
cout<<"Q ";
}
else{
cout<<". ";
}
}
cout<<"\n";
}
};... | ALGO | 0.999835 | 4.927 |
93470754-6e4b-41db-a031-81c13852ff56 | Mugdha67/Leetcode | 1475. Final Prices With a Special Discount in a Shop.cpp | #include<bits/stdc++.h>
#include<vector>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define pi acos(-1)
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define no cout<<"no\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n... | ALGO | 0.999939 | 4.293652 |
9c80bcc1-e861-4f6f-9649-dcd01cf41831 | tsotnep/hackerrank | algorithms/strings/morgan-and-a-string.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <sstream>
using namespace std;
string a="ABBAAAA", b="AABBBAZZ", ans="";
inline void fillup(int ia, int ib, int sa, int sb){
// int da=sa-ia, db=sb-ib;
int d=(sa-ia)-(sb-ib);
// int c='Z'+1; char cc=(char)c; stringstream ss; string c... | ALGO | 0.99999 | 4.32918 |
d4ebf512-c8fd-428f-b9ca-93389fc971eb | ishandutta2007/codeforces | blackbori/normal/1566/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, s, k;
cin >> n >> s;
k = (n + 1) / 2;
cout << s / (n - k + 1) << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int tc = 1;
cin >> tc;
for (; tc--; ) solve();
return 0;
} | ALGO | 0.999424 | 3.22488 |
79168739-caeb-4509-b57b-c2ac86a19e08 | lbryio/lbrycrd-dependencies | boost_1_59_0/libs/graph/test/random_spanning_tree_test.cpp | // Authors: Jeremiah Willcock
// Andrew Lumsdaine
#include <boost/graph/random_spanning_tree.hpp>
#include <boost/graph/grid_graph.hpp>
#include <boost/array.hpp>
#include <boost/random.hpp>
#include <boost/property_map/shared_array_property_map.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#i... | ALGO | 0.873372 | 5.143466 |
82441023-94f8-40cd-b8a4-fc2877374402 | saltonmassally/NBIS | misc/nistmeshlab/meshlab/src/meshlabplugins/filter_texture/rect_packer_old.cpp | #include <stdio.h>
#include <assert.h>
#include <algorithm>
#include "rect_packer.h"
using namespace std;
class point2iConf
{
public:
const std::vector<Point2i> & v;
inline point2iConf( const std::vector<Point2i> & nv ) : v(nv) { }
inline bool operator() ( int a, int b )
{
return v[a]>v[b];
//return v[a][0... | ALGO | 0.997865 | 4.727853 |
9a757c13-362d-470b-b7e5-0ec86479ba0f | Alihanzhen/Algoritm-Lab-works | lab 3/H.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0;
int stepen_2 = 1;
for (int i = 0; i <= n; i++) {
sum += stepen_2;
stepen_2 *= 2;
}
cout << sum;
return 0;
} | ALGO | 0.999953 | 4.823475 |
d34df2ae-8520-4924-8594-b1bad57e0534 | shashank-vishnoi/interview_problems | DEMO/DESIGN_PATTERNS/cor_2.cpp | #include<iostream>
using namespace std;
enum handler {HANDLER1, HANDLER2, HANDLER3};
class BaseHandler{
public:
BaseHandler* next;
virtual void start(handler h)=0;
};
class Handler1:public BaseHandler{
public:
void setNext(BaseHandler* h){next=h;}
void start(handler h)
{
if(h == HANDLER1)
cout<<... | TOOL | 0.895793 | 4.302021 |
2be0249f-a44d-4bf6-8c0d-cde9cc58dd09 | cdlwhm1217096231/DataStruct_and_Algorithms | 剑指offer练习代码/39.栈_栈的压入与弹出序列.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
class Solution{
public:
bool IsPopOrder(vector<int> pushV, vector<int> popV){
// pushVѹУpopVǵ
if(pushV.size() == 0){
return false;
}
for(int i = 0, j=0; i < pushV.size(); ++i){
stac... | ALGO | 0.998952 | 5.547994 |
ed247e15-f0b5-4c6f-bdb8-2c19ea13fed6 | eugene225/SWEA | .cpp/기초학습/No39.cpp | #include <iostream>
using namespace std;
constexpr size_t MAX_N = 100001;
int arr[MAX_N];
int tmp[MAX_N];
long long answer = 0;
void merge(int l, int m, int r) {
int x = l; int y = m + 1; int k = l;
while (x <= m || y <= r) {
if (y > r || x <= m && arr[x] < arr[y]) {
tmp[k] = arr[x++];
}
else {
answer... | ALGO | 0.999747 | 4.668578 |
53928827-72c3-4538-856c-f7fa07bbba3b | honey3491/acmicpc | ~2024-06-19/1676.cpp | #include <iostream>
using namespace std;
int main()
{
int n, count = 0;
cin >> n;
for (int i = 5; i <= n; i += 5)
{
int dividend = i;
while (dividend % 5 == 0)
{
dividend /= 5;
count++;
}
}
cout << count;
} | ALGO | 0.999597 | 3.800634 |
26a17c1c-17e4-44dc-9fe9-aa083cc37372 | KevinMathewT/Competitive-Programming | OrderingTeams.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Author - Kevin Mathew
// Birla Institute of Technology, Mesra
void te(){
vector<vector<ll> > a(3);
for(ll i=0;i<3;i++)
for(ll j=0;j<3;j++){
ll val; cin >> val;
a[i].push_back(val);
}
vector<pair<ll, vector<ll> > > v;
for(ll i=0;i<3... | ALGO | 0.999543 | 4.039353 |
f7ff5bcf-e8a0-459d-a1a1-da750935eb46 | cosmo8724/Algorithm | BackJoon/Solved/2776 O.cpp | /* 23. 09. 08 */
#include <bits/stdc++.h>
using namespace std;
int T, N, M;
vector<int> noteA, noteB;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> T;
while (T--) {
cin >> N;
noteA.resize(N);
for (int i{ 0 }; i < N; ++i) { cin >> noteA[i]; }
sort(begin(note... | ALGO | 0.999952 | 5.699201 |
e7c91351-543d-480d-83ca-bbd316d228d0 | Esraamabrouk2022/Codeforces | E. Vlad and a Pair of Numbers/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void fast()
{
cin.tie(0);
cout.tie(0);
}
int main()
{
fast();
int t;
cin>>t;
while(t--){
int x;
cin>>x;//2
int a=x+(x/2); //2+1=3
int b=x/2;//1
if(x%2!=0)cout<<-1<<endl;
else {
... | ALGO | 0.999474 | 4.104249 |
2af87229-bb0f-4ca9-9e6c-417381a8f4be | 1092772959/My-ACM-code | 2018夏/7.23/D.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
#define LOCAL
int main() {
int T;
#ifdef LOCAL
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
scanf("%d", &T);
for (int cas = 1; cas <= T; ++cas) {
int n, m... | ALGO | 0.999974 | 3.92133 |
92c2f655-f156-42b1-85a1-90671be0d2e5 | james-zl/AUV_Project | ArduCopter/mode_rtl.cpp | #include "Copter.h"
#if MODE_RTL_ENABLED == ENABLED
/*
* Init and run calls for RTL flight mode
*
* There are two parts to RTL, the high level decision making which controls which state we are in
* and the lower implementation of the waypoint or landing controllers within those states
*/
// rtl_init - initialis... | ALGO | 0.855564 | 5.100406 |
f0ffa5b0-709d-4be0-8462-d13e2ec9fea0 | Thuthu2k/CodeTG | Order Statistics 10.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int a[n];
for(int i=0 ; i<n ;i++) cin >> a[i];
int l[n] ={0};
for(int i=0 ; i<n ;i++){
int lmax = 0;
for(int j=0 ; j<i ; j++){
if(a[j] < a[i] && lmax < l[j]){
lmax = l[j];
}
}
... | ALGO | 0.999758 | 4.442574 |
93e84162-8dab-4d49-a368-6ac33c60856c | hjiang13/LLMs-in-IR | POJ-104/21/453.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i,j,count=0;
float average=0,max=0,sum=0,a[300],tmp,x[300],gap;
cin >> "%d",&n);
for(i=0; i<n; i++)
{
cin >> "%f",&a[i]);
sum+=a[i];
}
average=sum/n;
max=fabs(a[0]-average);
for(i=0; i<n; i++)
{
gap=fabs(a[i]-average);
if(gap>max)
max=gap;
}
count=0;
for(i=0; ... | ALGO | 0.999955 | 3.294454 |
3b38e1f4-0fe0-4f28-9862-93f7a6c79d16 | zxf3627043/study | opencv_test.cpp | #include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main( )
{
Mat image;
image = imread("/home/zhangxf/opencv-2.4.13/modules/ocl/doc/images/adaptiveBilateralFilter.jpg", 1 );//Ŀ¼ԼĿ¼
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Di... | TOOL | 0.887728 | 3.79213 |
2ce12bd9-5e90-4ee1-9f3b-a30bc5464df5 | truongcntn2017/InterviewSoftware | easy/others/reverseBits.cpp | class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t sum = 0;
bitset<32> digits(n);
for (int i=0; i<32; ++i){
sum = sum << 1;
sum += digits[i];
}
return sum;
}
};
| ALGO | 0.999676 | 5.916067 |
b2c4ca74-eb85-4fca-a91c-e436d9ca7513 | Son0-0/Algorithm | leetcode/easy/first-unique-character-in-a-string.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int firstUniqChar(string s) {
unordered_map<char, int> um;
for (auto c : s) {
um[c]++;
}
for (int i = 0; i < s.size(); i++) {
auto temp = um.find(s[i]);
if (temp->second == 1) {
return i;
}
... | ALGO | 0.999378 | 5.572562 |
745a8a11-459a-4795-97ce-784bb0417f44 | p-vinh/CS4200 | ChessML/stockfish/src/thread.cpp | #include "thread.h"
#include <algorithm>
#include <cassert>
#include <deque>
#include <memory>
#include <unordered_map>
#include <utility>
#include <array>
#include "misc.h"
#include "movegen.h"
#include "search.h"
#include "syzygy/tbprobe.h"
#include "timeman.h"
#include "tt.h"
#include "types.h"
#include "ucioption... | TOOL | 0.989753 | 6.787882 |
32505b9e-1f2e-4df4-8153-75ddcd08ca7e | raincross7/code-similarity | codes/train_code/problem175/problem175_230.cpp | #include <stdio.h>
int N,a,b;
int main()
{
scanf ("%d",&N);
long long s = 0, mn = 0x7fffffff; bool ed = true;
for (int i=0;i<N;i++){
scanf ("%d %d",&a,&b);
s += a;
if (a > b){
if (mn > b)
mn = b;
}
if (a != b) ed = false;
}
printf ("%lld\n",ed?0:s-mn);
return 0;
} | ALGO | 0.999928 | 3.122515 |
f4fd94f3-6e73-4e4a-a171-9414be1fd862 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6673_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
const int M = 2000005;
int n, x, a[M], b[M];
int mn[M], mx[M], t[M];
void init() {
for (int i = (int)(2); i <= (int)(M - 1); i++)
if (!mn[i])
for (int j = (int)(1); j <= (int)((M - 1) / i); j++)
if (!mn[i * j]) mn[i * j] = i;
}... | ALGO | 0.999945 | 3.780682 |
daa0bb24-701f-458b-a559-c902d29d4b0f | Ming-J/LeetCode | 1020_Number_Of_Enclaves.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int numEnclaves(vector<vector<int>> &A) {
int total = 0, walk = 0;
vector<vector<bool>> visited(A.size(),
vector<bool>(A.front().size(), false));
for (int i = 0; i < A.size(); ++i) {
... | ALGO | 0.999924 | 5.768745 |
9a629437-efde-4865-b73c-0be7a924a8e6 | ishandutta2007/codeforces | skywalkert/normal/482/B.cpp | #include <cstdio>
const int maxn = 131072;
int n, m, seg[maxn << 1];
void update(int id, int L, int R, int l, int r, int val)
{
if(l == L && r == R)
{
seg[id] |= val;
return;
}
int M = L + R >> 1;
if(r <= M)
update(id << 1, L, M, l, r, val);
else if(M < l)
update((id << 1) + 1, M + 1, R, l, r, val);
else... | ALGO | 0.999995 | 3.577989 |
ce91ccca-799d-4f93-9a9e-16cfc2314172 | abdullahjohar23/newcomer-sheet-solutions | Sheet 4/X. Comparison.cpp | // Codeforces Handle: Abdullah_Johar
// Newcomer Sheet 4: X. Comparison
#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;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999934 | 4.584894 |
5273b0bf-d372-4574-8042-24dd90687859 | joaquindiazalvarez/leetCode | exploreArrays/C++/Ejercicio1.cpp | #include <vector>
#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int max = -1;
int cont = 0;
for(int i = 0; i < nums.size(); i++){
if(nums[i] == 1){
cont++;
}
... | ALGO | 0.999946 | 5.585696 |
b65d9aaa-62f8-4109-b225-a49088cda393 | AsavriKaur/CppCodes | assign_7_Q1.cpp | #include<iostream>
using namespace std;
class time{
int h,m,s;
public:
time(int a, int b, int c){
h=a;
m=b;
s=c;
}
time(){}
time operator+(time obj){
time temp;
temp.h=this->h+obj.h;
temp.m=this->m+obj.m;
temp.s=this->s+obj.s;
if(temp.s){
temp.m+=temp.s/60;
temp.s=temp.s%60;
}
if... | TOOL | 0.950563 | 3.88408 |
83843f84-ce32-4e75-8f54-9531ae9d79f8 | ishandutta2007/codeforces | dmitriy.belichenko/normal/1229/E1.cpp | #pragma GCC optimize("Ofast")
#include <iostream>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <math.h>
#include <string>
#include <set>
#include <iomanip>
#include <bitset>
#include <random>
#include <complex>
#include <random>
#include <cassert>
... | ALGO | 0.99991 | 3.735051 |
b5ec6d34-c77d-4888-af21-b27f6b1d5718 | huang123aini/Some_Libs | Opencv_Test/opencv-4.x/cmake/checks/cpu_neon_fp16.cpp | #include <stdio.h>
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
#include "arm_neon.h"
float16x8_t vld1q_as_f16(const float* src)
{
float32x4_t s0 = vld1q_f32(src), s1 = vld1q_f32(src + 4);
return vcombine_f16(vcvt_f16_f32(s0), vcvt_f16_f32(s1));
}
void vprintreg(const char* name, const fl... | ALGO | 0.970366 | 4.996369 |
1cd5882b-6eb4-4159-b86a-87e131b1257b | funnysunny08/Algorithm_cpp | 정렬/quickSort.cpp | #include <bits/stdc++.h>
using namespace std;
int n = 10;
int arr[10] = {7, 5, 9, 0, 3, 1, 6, 2, 4, 8};
void quickSort(int *arr, int start, int end) {
if (start >= end) return; // 원소가 1개인 경우 종료
int pivot = start; // 첫 번째 원소를 pivot으로 설정
int left = start + 1;
int right = end;
while (left <= right) ... | ALGO | 0.999977 | 5.16434 |
418cee50-1ad3-4dde-8b8c-0a1a7b034a7b | Ev3nS/C-Bac-2020-Solved-Problems | Test 12/S3e2.cpp | #include "iostream"
#include "cstring"
using namespace std;
//Eliminarea ultimei vocale, pt pozitie se cauta cu pointer
// si se scade din el sirul de caractere;
//In exemplul respectiv se elimina ultimul "u".
int main() {
char str[100] = "cuvantul ritm poate fi tradus rhythm";
char vocale[] = "aeiou";
char *pch;... | ALGO | 0.875419 | 3.962953 |
aa2da443-0299-4b0c-b851-a1eaacd877e5 | nhzc123/leetcode | LargestNumber.cpp | /**
* @file LargestNumber.cpp
* @brief
* @author nhzc <EMAIL>
* @version 1.0.0
* @date 2015-07-04
*/
class Solution {
public:
static bool cmp(const string &a, const string &b){
return (a + b) > (b + a);
}
string largestNumber(vector<int>& nums) {
vector<string> strNum(nums.size()... | ALGO | 0.999869 | 6.003907 |
21dede10-62d6-4a1d-a50e-eed8742634ed | LESSuseLESS/d2 | Detectron2/Structures/NMS.cpp | #include "Base.h"
#include "NMS.h"
#include <Detectron2/detectron2/nms/nms.h>
#include <Detectron2/detectron2/nms_rotated/nms_rotated.h>
using namespace std;
using namespace torch;
using namespace Detectron2;
////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.977374 | 6.802543 |
d4e307cd-858e-4138-9dc6-ad5be7a09950 | wassimalharaki/Codeforces | 1500/RestoringthePermutation.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define v vector
#define all(v) v.begin(), v.end()
#ifdef WASSIM
#include "debug.h"
#else
#define dbg(...)
#endif
void solve() {
int n; cin >> n;
v<int> nums(n);
for (int& a : nums) cin >> a;
set<int> have;
for (... | ALGO | 0.999976 | 4.102621 |
68e23202-6783-4e95-aa2b-65750a010610 | 2015zsl143066/xixi | di-11.cpp | #include "stdio.h"
int main()
{
int i;
int sum = 0;
for (i=1; i<=100; i++)
{
if (i%3==0)
sum = sum + i;
}
printf("sum = %d\n", sum);
return 0;
} | ALGO | 0.998463 | 3.283576 |
73983628-40f1-401a-b7f7-a854d217cb64 | souravjena/mooc_coding-ninjas-data-structures-and-algorithms-cpp | lec-12-binary_trees/12_2_input_print_recursively.cpp | #include <iostream>
#include "BinaryTreeNode.h"
using namespace std;
void print_BT(BinaryTreeNode<int>* root) {
// 1. Base Case
if(root == NULL){
return;
}
// 2. Current Problem
cout << root->data << ": ";
if(root->left != NULL){
cout << "L[" << root->left->data << "]\t";
... | ALGO | 0.99899 | 5.118903 |
3b38edbd-5fd3-48f2-bb93-0ad486169b97 | brunorohde/ESMERIL | Android_App/ESMERIL/src/ofeliaPath.cpp | #include "ofeliaPath.h"
#include "ofeliaWindow.h"
/* ________________________________________________________________________________
* static variables
*/
const char *t_ofeliaLoadPath2d::objName = "ofLoadPath2d";
unsigned int t_ofeliaLoadPath2d::counter;
vector<t_ofeliaLoadPath2dData> t_ofeliaLoadPath2d::pathData;
... | TOOL | 0.900807 | 7.274315 |
a53a0692-997a-46eb-b913-995d3230a637 | adrian-budau/work | Google Codejam/2014/Round 1B/The Bored Traveling Salesman/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
bool canReachAll(vector<int> stack, const vector< vector<bool> > &edge, vector<bool> used) {
if (stack.empty())
return false;
queue<int> Q;
for (auto nod : stack)
Q.push(nod);
while (!Q.e... | ALGO | 0.999996 | 5.680116 |
5747d88e-c958-4184-a2a9-e832cb4156a5 | SIRIUScoder1/competitive-programming | codechef/easy/jewelsAndStones.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <string.h>
using namespace std;
int main()
{
int test,count;
char a[101],b[101];
cin >> test;
while(test--)
{
scanf("%s",a);scanf("%s",b);count = 0;
for(int i = 0;i < strlen(b);i++)
{
... | ALGO | 0.999775 | 4.137659 |
6851c1a6-9754-4748-a05a-b9d8a2fc2de1 | cobra0411/cses | intro/trail_zeros.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n;
cin>>n;
ll p=5;
ll total=0;
while(p<=n){
total+=(n/p);
p=p*5;
}
cout<<total<<endl;
return 0;
} | ALGO | 0.999929 | 3.582003 |
65cb65e9-df03-417f-8b53-ac9ccccbc90d | anshyyy/CPP | Codeforces/1709C.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,n) for(int i=a;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define all1(v) (v).begin()+1,(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define allr1(v) (v).rbegin()+1,(v).rend()
#define ff first
... | ALGO | 0.999915 | 4.111238 |
2d50b26b-e1ce-44cd-b94d-bc385ec560d4 | Nickeron-dev/Codewars | c++/solving_problems_materials/competitive_template.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool is_prime(int number);
int gcd(int a, int b); // greatest common divisor
int lcm(int a, int b); // least common multiple
int main(void)
{
return 0;
}
//void solution(void)
//{
//}
//int main(void)
//{
//int t;
//cin >> t;
//while (t--... | ALGO | 0.999657 | 4.738713 |
a3391b3e-2d95-473f-95ee-2e0d33c7d8d5 | adityakr101/C-Language- | C++ language/recursive_fun_find_factorial.cpp | #include<iostream>
using namespace std;
int factorial(int n){
if(n<=1){
return 1;
}
return n*factorial(n-1);
}
int main(){
int a;
cout<<"Enter the value of a:"<<endl;
cin>>a;
cout<<"The factorial of " <<a<<" is "<<factorial(a);
return 0;
} | ALGO | 0.997659 | 3.446752 |
cf50a8b0-94c5-431d-9bb5-806b775354dd | 4nd0r4k0/Advent-Of-Code- | 2024/DAY_05.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DAY_05.cpp :+: :+: :+: ... | ALGO | 0.999299 | 5.372653 |
c7944037-5293-45a7-ab82-78eae2e510d4 | akanksham18/CPP | OOPS/ConstPointer.cpp | #include <iostream>
using namespace std;
int main()
{
// 1) constant value , non constant pointer
int x = 10;
int y = 20;
const int *ptr1 = &x;
// *ptr = 10; // cant reassign value
cout << *ptr1 << endl;
cout << &ptr1 << endl;
// 2) constant pointer , non constant value
int *const ... | TOOL | 0.993923 | 3.515871 |
6de06a0d-331a-46df-a06a-bd38bd6ae6bf | TahaLoghmari/CP-Templates- | Graph/dijkastra.cpp | vector<int> dijkstra(int src)
{
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
vector<int> dist(n+1, LONG_LONG_MAX);
pq.push({0, src});
dist[src] = 0;
while ( !pq.empty( ))
{
int u = pq.top().second;
pq.pop();
for ( auto x : graph[u]... | ALGO | 0.999909 | 4.714697 |
a71189de-c88b-4161-b00b-6bb6db7cd83e | Ridwan-Hussain/ECE264_DSA1 | Program3/ArraySort.cpp | // THIS IS THE PROVIDED CODE FOR PROGRAM #2, DSA 1, FALL 2022
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <vector>
#include <string>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cstdlib>
using namespace std;
// A simple c... | ALGO | 0.988708 | 5.290877 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.