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 |
|---|---|---|---|---|---|---|
717e6d98-42ea-4ab9-a47a-b91770645bba | THU-DSP-LAB/llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort_constexpr_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// sort(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <cassert>
#include <functional>
#include "test_ma... | TEST | 0.981821 | 7.190707 |
fddb5cbb-ee81-4239-a0b7-b65945964efd | tyrolcg/AtCoder_tyrolcg | AtCoder/ABC309/B.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<vector<int>> a(n, vector<int>(n));
for(int i=0;i<n;i++){
string s;
cin >> s;
for(int j=0; j<n; j++){
if(s[j]=='0') a[i][j] = 0;
else a[i][j] = 1;
}
}... | ALGO | 0.999985 | 3.779865 |
1addd9ac-47a8-47b0-b9b2-0267e5fd008f | AdnanMuzavor/PDS | Array/check_arithmatic_slices.cpp | /*
413. Arithmetic Slices
Medium
2542
221
Add to List
Share
An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences.
Given an integer array ... | ALGO | 0.999898 | 5.992971 |
8ff8bd3c-4d49-4da4-b4cd-ac91f893ff76 | AkshatAggarwal14/Competitive-Programming | CodeForces/1631/a.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
void Solution() {
ll n;
cin >> n;
vector<ll> a(n), b(n);
for (ll &A : a) cin >> A;
for (ll &B : b) cin >> B;
ll mx_a = *max_element(all(a));
ll mx_b = *max_element(all(b));
if (mx_b... | ALGO | 0.999982 | 4.690563 |
a077d0bb-d35d-4db6-9103-38c8280cbfe2 | beeping-io/beeping-raspberry-pi | include/Globals.cpp | #include "Globals.h"
#include <math.h>
namespace Globals
{
//float durToken = 0.1f; //dur in seconds for each token
//For mSizeBlockCircularBuffer = 70 > tokenSize = 35frames
//float durToken = 0.10158730f; //(35*(float)mSpectralAnalysis->mHopSize/mSampleRate) = 0.10158730158730159
float durToken = 0.104489796... | CONFIG | 0.887186 | 3.661353 |
8418c37a-ec38-4908-a479-bf7688d83f84 | Barbecki/StrukuryDanych_2 | heap/heap.cpp | #include "heap.h"
long long heapOPQ::globalOrder = 0; // Inicjalizacja licznika porządku dodania
// Konstruktor kolejki
heapOPQ::heapOPQ()
: heap(new NodeOPQ[INITIAL_CAPACITY])
, size(0)
, capacity(INITIAL_CAPACITY)
{}
// Destruktor kolejki
heapOPQ::~heapOPQ() {
delete[] heap;
}
// Funkcja pomocnicza do za... | ALGO | 0.998272 | 4.547752 |
78bb8b9a-a40f-46bd-ba6b-387df42a30f3 | manu-sankar/cpp.Training | assessments/cppbasics/prg24.cpp | #include<iostream>
using namespace std;
int main() {
int arr[] = { 1,2,3,4,5 };
int n = sizeof(arr) / sizeof(arr[0]);
int sum = 0;
for (int i = 0;i < n;i++) {
sum += arr[i];
}
cout << sum;
return 0;
} | ALGO | 0.995506 | 3.587266 |
e6dda2e6-106c-4638-bbf0-2e2b544d5d1d | NandiniMehta0603/450 | Strings/5. Check if string is a valid shuffle substring of the other.cpp | #include<bits/stdc++.h>
using namespace std;
bool comp(int arr1[],int arr2[]){
for(int i=0;i<26;i++){
if(arr1[i]!=arr2[i]){
return false;
}
}
return true;
}
bool check(string s1,string s2){
//base case
if(s1.length()>s2.length()){
return false;
}
int... | ALGO | 0.999992 | 4.567967 |
8176f603-d42b-4f8f-9df6-a626636af8de | nos8160/PlayingWithCPlusPlus | practise/stringToNumber.cpp | //convert string into number type
#include<iostream>
using namespace std;
template <typename T>
T toNumber( string str ) {
T = 0;
for(int i = 0 ;i< str.size();i++){
T = T*10+ str[i]-48;
return T;
}
}
int main(){
string str = "456";
cout<<toNumber(str)<<endl;
}
| ALGO | 0.933001 | 3.709224 |
a54f8c02-34bb-488f-bab8-274d873dfe13 | Gnaroshi/practice-algorithm-solvedac-mac | With_Levels/Bronze/Bronze_1/13858.cpp | // problem: Reading Digits
// id: 13858
// time taken:
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int k, p, iter;
string s, t;
cin >> k >> p >> s;
iter = s.length();
while (k--)
{
t = "";
for (int i = 0; ... | ALGO | 0.999831 | 3.49815 |
f589a203-e385-469b-9ac7-c6a072afd43f | ishandutta2007/codeforces | xh092113/normal/1528/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define rg register
#define In inline
#define ll long long
#define rep(i,l,r) for(rg int i = (l);i <= (r);i++)
#define dwn(i,r,l) for(rg int i = (r);i >= (l);i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define glc(u) (u << 1)
#define g... | ALGO | 0.999849 | 3.820622 |
aac986c7-9970-4d25-b407-c47cd87a6332 | melonattacker/atcoder | contests/ABC/ABC202/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<ll> A(N);
unordered_map<ll, vector<ll>> ab;
vector<ll> B(N);
vector<ll> C(N);
for(int i = 0; i < N; i++) {
cin >> A[i];
ab[A[i]].push_back(i+1);
}
for(int i = ... | ALGO | 0.999895 | 4.014276 |
ca1abcb3-77b3-4f3e-a942-5b0f5c4e2fdc | iamsiamhossen/XPSC-SOLVE | Week 2/Day-2/C_Most_Similar_Words.cpp | /**
* Author: iamsiamhossen
* Created: 23-03-2024 23:35:48
**/
#include <bits/stdc++.h>
#define fastread() (ios_base::sync_with_stdio(0), cin.tie(0))
#define endl "\n"
#define ll long long int
#define ld long double
#define pi pair<ll, ll>
using namespace std;
int main()
{
fastread();
int t;
cin >> t;
... | ALGO | 0.999779 | 5.554393 |
41e45eea-646d-4c5e-83e8-2fe1d4c02341 | mizobuchiy/Atcoder | ABC/140/140_b.cpp | //include
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <s... | ALGO | 0.999849 | 3.359706 |
c379197a-d717-430c-aafc-d1d441f84c26 | ishandutta2007/codeforces | tzxydby/normal/1601/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=300005;
int n,q,k,a[N],c[N],f[20][N];
long long v[20][N];
deque<int>s;
int main()
{
scanf("%d%d%d",&n,&q,&k);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
for(int i=n;i>=1;i--)
{
while(s.size()&&a[i]<=a[s.back()])
s.pop_back();
s.push_back(i);
while(i+... | ALGO | 0.999926 | 3.383518 |
ec1e11df-ef53-447b-89e9-47b48cfcba1c | ToBe2015/Ardupilot-stable | libraries/AC_PID/AC_PID.cpp | // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/// @file AC_PID.cpp
/// @brief Generic PID algorithm
#include <AP_Math/AP_Math.h>
#include "AC_PID.h"
const AP_Param::GroupInfo AC_PID::var_info[] = {
// @Param: P
// @DisplayName: PID Proportional Gain
// @Description: P Gain ... | ALGO | 0.998413 | 5.656847 |
754df9a9-f977-41d2-98f6-77f0a0c1c4b3 | ishandutta2007/codeforces | rosed/normal/1301/C.cpp | #include<bits/stdc++.h>
using namespace std;
namespace red{
#define int long long
#define eps (1e-6)
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
inline int read()
{
int x=0;char ch,f=1;
for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
if(ch=='-') f=0,ch=getchar();
while(ch>='0... | ALGO | 0.999948 | 4.289981 |
baa057dd-aa1f-4095-8e74-7f142128a382 | Volgarenok/spbspu-labs-2024-tp-a | erfurt.anna/T2/main.cpp | #include <iostream>
#include <algorithm>
#include <list>
#include <iterator>
#include <limits>
#include "DataStruct.hpp"
int main()
{
using namespace erfurt;
using input_it_t = std::istream_iterator< DataStruct >;
std::list< DataStruct > data{};
while (!std::cin.eof())
{
if (std::cin.fail())
{
... | ALGO | 0.967616 | 5.014942 |
13aad35e-eec3-4aec-9374-8ee24968d680 | fuchaili/CPP | algorithm/longInceasingSubsequence.cpp | #include <iostream>
using namespace std;
const int Max=1000;
int A[Max],F[Max],N,ans;
int main(){
cin>>N;
for (int i =1; i <=N; i++)cin>>A[i];
F[1]=1;
ans=1;
for (int i =2; i <=N; i++){
F[i]=1;
for (int j = 1; j <=i-1; j++){
if(A[j]<=A[i]&&F[j]+1>F[i])F[i]=F[j]+1;
... | ALGO | 0.999965 | 3.910419 |
ab433d41-d9fd-4814-a9ca-03b425935dcb | xzqiaochu/cpp | problem/NOIP/2014/Day2/road.cpp | // 寻找道路(road)
// author: xzqiaochu (Rewrite from kelvin's)
// status: AC
#include <cstdio>
#include <cstring>
#include <queue>
const int SZ = 1e4 + 7, ESZ = 2e5 + 7, INF = 0x3f3f3f3f;
int n, m, s, t;
int tot, head[SZ];
bool vis[SZ], valid[SZ];
struct Point
{
int id, dis;
} pt[SZ];
struct Edge
{
int u, v, next... | ALGO | 0.999952 | 4.076081 |
09d8f6ba-cb35-4e57-9f3b-353dbe877b99 | anu33hav/DSA | 09_char_array_&strings/01_charArray&Strings_01/02_findLengthOfCharArr.cpp | #include <iostream>
using namespace std;
int length(char arr[], int size) {
int count = 0;
int index = 0;
while (arr[index] != '\0') {
// jab tak ar me numm char nhi milta tab tak incremen kro
// aur aago badho
count++;
index++;
}
return count;
}
int main() {
c... | ALGO | 0.99688 | 3.505701 |
b0e690a9-762f-472b-ab33-f3775b26e0a3 | HenryNoh/Coding-Test | 1.KAKAO/KAKAO 2018/2-4.방금그곡.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
string solution(string m, vector<string> musicinfos)
{
string answer = "";
vector<vector<string>> infos(musicinfos.size());
for (int i = 0; i < musicinfos.size(); i++)
{
stringstream ss(musicinfos[... | ALGO | 0.998566 | 5.303505 |
7764676c-99fc-4a6e-8edc-3c9bc13f71fb | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12741_11.cpp | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
while (b != 0) {
a %= b;
swap(a, b);
}
return a;
}
long long bestPos(long long l, long long x, long long n) {
if (x <= (l + 1) / 2)
return 0;
else if (x >= n - (l + 1) / 2)
return n - l;
else
return x... | ALGO | 0.999882 | 3.549271 |
34188733-f347-4978-854d-3d951a9c37b9 | lssfau/hyteg | apps/cg_P1_blending.cpp | #include <core/Environment.h>
#include <core/config/Config.h>
#include "core/timing/Timer.h"
#include "hyteg/dataexport/VTKOutput/VTKOutput.hpp"
#include "hyteg/geometry/CircularMap.hpp"
#include "hyteg/p1functionspace/P1Function.hpp"
#include "hyteg/p1functionspace/P1VariableOperator.hpp"
#include "hyteg/primitivest... | ALGO | 0.882219 | 5.982742 |
5e7e9e94-5706-498a-8f7c-93245025f825 | eXistence/fastflow | tests/test_nodeselector.cpp | /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* Author: Massimo Torquati
* <EMAIL>
*
*/
// This simple test shows how to re-use the same task-farm engine for different computations
// (in this case kernel1 and kernel2) by using the ff_nodeSelector node.
// Another way is ... | ALGO | 0.916998 | 6.244529 |
1c1dfc32-f880-4dd8-b093-a924545510e7 | AmiEklasMohin/UvaOJ | HashmatTheBraveWarrior.cpp | #include <iostream>
#include <cmath>
int main() {
long sizeOfHashmatsArmy, sizeOfOpponentsArmy, absoluteDifference;
while (std::cin >> sizeOfHashmatsArmy >> sizeOfOpponentsArmy) {
absoluteDifference = std::abs(sizeOfHashmatsArmy - sizeOfOpponentsArmy);
std::cout << absoluteDifference << std::en... | ALGO | 0.999835 | 4.285733 |
45cd514d-8170-4a35-bda6-998ba0c9dca6 | LokeshSingh07/Data-Structures-and-Algorithms | 01 Arrays/TUF/01_largest.cpp | // Largest Element in Array
class Solution {
public:
int largest(vector<int> &arr) {
int n = arr.size();
int maxi = INT_MIN;
for(int i=0; i<n; i++){
if(arr[i] > maxi) maxi = arr[i];
}
return maxi;
}
}; | ALGO | 0.999723 | 5.220253 |
17d75c68-31d6-473b-8f16-78a092c0f449 | Hsue66/Algo | BOJ/AGAIN/14503.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int MAP[50][50];
int N,M;
int Cnt;
int Dir[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
void move(int Nx, int Ny, int dir){
int flag = 0;
int d = dir;
for(int i=0; i<4; i++){
d = (d+3)%4;
int tx = Nx+Dir[d][0];
int ty = Ny+Dir[d][1];
if(MAP[tx][t... | ALGO | 0.999742 | 3.953131 |
ecd61944-96b0-45c3-b4f1-5e69dcfb5560 | Diego-Gutierrez12/ISC1YD-FundamentosProgramacion-Practicas | DevC++_Unidad_4/03_Matrices version 3.cpp | // Luis Diego Gutiérrez Pérez - Número de control: 24041179
#include <iostream>
#include <time.h>
#include <windows.h>
using namespace std;
int main()
{
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
int m1[10][10], m2[10][10], m3[10][10];
int v1[10], v2[10], v3[10];
int i, j, n;
srand(time(0));
do
{
co... | ALGO | 0.913317 | 3.134622 |
cafffb4f-11df-450a-a8be-45fdfbbd8e4f | ishandutta2007/codeforces | maspy/normal/567/B.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vc<T>>;
template <class T> using v... | ALGO | 0.999969 | 4.530618 |
0afd96bb-a134-470c-b888-adbd6c66d68d | Mulab11/cntt2016-hw1 | TC-SRM-592-div1-300/Remilia.cpp | #include <bits/stdc++.h>
#define rep(x,a,b) for (int x=a;x<=(int)b;x++)
#define drp(x,a,b) for (int x=a;x>=(int)b;x--)
#define cross(x,a) for (int x=hd[a];~x;x=nx[x])
#define ll long long
#define inf (1<<29)
#define PII pair<int,int>
#define PDD pair<double,double>
#define mk(a,b) make_pair(a,b)
#define fs first
#defi... | ALGO | 0.999226 | 3.718647 |
4dfcc2f3-429c-4bd4-98c7-9562eb070e6a | SuperSlot0613/leetcodeProblem | 45-jump-game-ii/45-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& arr) {
int n=arr.size();
int count=0;
int currJump=0;
int farthestjump=0;
for(int i=0;i<n-1;i++){
farthestjump=max(farthestjump,arr[i]+i);
if(i==currJump){
currJump=farth... | ALGO | 0.999964 | 5.899735 |
0b16cda0-0853-4c85-b5e9-5308036e968c | devseunghan/flutter_riverpod_essential_course | future_provider/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.998716 | 6.76073 |
4337152d-2e81-43ea-af48-bd671561c65d | ng01233/testing | project/tries/t.cpp | #include<iostream>
using namespace std;
int main () {
int b;
cin >> b;
if (0<b<1000){
cout<<"yes"<<endl;
}
return 0;
} | ALGO | 0.934224 | 3.008754 |
dc70ce7b-4f22-4dad-a504-805ea0c2a93e | Redleaf23477/ojcodes | cses/1637.cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long int;
vector<int> find_digits(int i) {
vector<int> ans;
while (i > 0) {
ans.emplace_back(i % 10);
i /= 10;
}
return ans;
}
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
constexpr int ... | ALGO | 0.999957 | 5.143793 |
0cb5b2d3-73d9-45b6-8724-061595a2ec20 | aslezar/CompetitiveProgramming | Codechef/LearnDSA/T2/LAPIN.cpp | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
using namespace std;
#define ll long long
#define el << '\n'
#define ws << ' '
const unsigned int mod = 1e9 + 7;
const int maxn = 1e5 + 4;
int main()
{
ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(0);
ll t =... | ALGO | 0.999978 | 5.008667 |
d40c6b16-11c9-45ce-94ef-81549887c786 | weenchvd/Programming_Principles_And_Practice_Using_CXX | Chapter_03/C03_Exercise3.10.cpp | /* Exercise 3.10 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
string operation;
double val1, val2, result;
bool x;
cout << "Please enter an operation followed by two operands: ";
cin >> operation >> val1 >> val2;
x = false;
if (o... | ALGO | 0.889528 | 4.834095 |
aec39893-4f35-440e-b68b-9ec1e3627ba1 | langyanashish/Competitive-Programming | 2048.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define LD long double
#define PB push_back
#define LOOP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define mod 1000000007
int main()
{
int t;
cin>>t;
while(t--)
{
LL n;
cin>>n;
LL ans=0;
while(n != 1... | ALGO | 0.999982 | 4.693939 |
2410689c-fb5b-4950-9988-d05d549239b1 | gabrielthomazvieira/yale-poker-solver | solver/src/GetInput.cpp | // GetInput.cpp
#include "GetInput.h"
// Constructor: Initialize PokerSolver and GameTreeBuildingSettings
GetInput::GetInput(string resource_dir) : resource_dir(resource_dir) {
string suits = "c,d,h,s";
string ranks = "2,3,4,5,6,7,8,9,T,J,Q,K,A";
string compairer_file =
this->resource_dir + "/compairer/ca... | TOOL | 0.945349 | 6.908205 |
47d2a40c-28b0-447e-aacd-8eafe690594b | PrasadDalwee/CPP-Codes | Binary Trees/Lowest Common Ancestor.cpp | #include<iostream>
#include<vector>
using namespace std;
class Tree
{
public:
int data=0;
Tree *left=NULL, *right=NULL;
Tree(int x)
{
data=x;
}
};
int findpath( Tree* root, vector<Tree*> &path, int d)
{
if(root->data==d)
{
path.push_back(root);
return 1;
}... | ALGO | 0.999997 | 4.57389 |
93df148e-3a73-4c22-824d-be8f1b448c9c | Vivek-kumar-v/cpp | Sorting/bubble.cpp | #include<iostream>
using namespace std;
int main() {
int arr[6]={10,1,7,6,14,9};
for(int i=1;i<6;i++) {
for(int j=0;j<6-i;j++) {
if(arr[j]>arr[j+1]) {
swap(arr[j],arr[j+1]);
}
}
}
for(int i=0;i<6;i++) {
cout<<arr[i]<<" ";
}
} | ALGO | 0.999821 | 3.327069 |
0ab17302-7fc3-477a-b18e-65d8f49e62fe | Abhiramon/ioi-training | CodeForces/349B - Color the Fence.cpp | //11513883 2015-06-09 21:00:26 Hiasat98 349B - Color the Fence GNU C++ Accepted 62 ms 2100 KB
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int l[10] = {};
int len = 0,mn = 0,in = 0;
for(int i = 1 ; i < 10 ; i++){
cin >> l[i];
if(l[i] <= mn || mn == 0){
mn = l[i];
len = n/l[i];
... | ALGO | 0.999873 | 4.315613 |
2ae2d14d-e34e-49ce-be4f-fe4e11edf151 | 2459311/practice | MaxOfThree/MaxOfThree/StringSearch_BMMethod.cpp | //=========================================================
// TBoyer-Moore@
//=========================================================
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> // printf(),scanf()
#include <string.h> // strlen()
#include<limits.h>// UCHAR_MAX
// vg^Cv
int bm_match(const char* txt, const ch... | ALGO | 0.998005 | 3.68266 |
8032867a-507a-4aaa-a964-b7f440c3c84a | yukti-says/DSA | Recursion/StringReverse.cpp | #include<iostream>
#include<string>
using namespace std;
void stringreverse(int i , int j, string &str){
cout<<"call recursive for: "<< str<<endl;
//base case
if (i>j)
return ;
swap(str[i],str[j]);
i++;
j--;
stringreverse(i , j , str);
}
int main()
{
string str = "yukti sahu";
cout<<"before reve... | ALGO | 0.999899 | 4.904044 |
19ddd869-53f6-45fe-bc1b-1e9d97a6be49 | vishalchovatiya/PI | LINKED LIST/Nth Node from end of Linked List.cpp | #include <iostream>
#include <string.h>
#include <list>
#include <map>
#include <stack>
#include <queue>
using namespace std;
/*
Naive Method: Calculate size of LL and traverse to (size - n)
Efficient Method:
- Maintain two pointers reference pointer and main pointer.
- First move reference pointer to n n... | ALGO | 0.999949 | 5.273599 |
8b2dc8e5-c96d-40cc-860d-be522cbad63f | CandyRoms/frameworks_av-old | media/libstagefright/codecs/amrnb/enc/src/l_negate.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
Local Stores/Buffers/Pointers Needed:
None
Global Stores/... | TOOL | 0.987783 | 5.666788 |
990dfc74-ebd4-4205-b7d7-8ec979a510c6 | AswinViswajith/LeetCode | 742-to-lower-case/to-lower-case.cpp | class Solution {
public:
string toLowerCase(string s) {
int n = s.length();
for(int i=0;i<n;i++)
{
if(s[i]>='A' && s[i]<='Z')
{
s[i] = s[i] + ' ';
}
}
return s;
}
}; | ALGO | 0.973075 | 4.021442 |
5b6deaf8-2367-406e-ad2a-f4161df23f7e | surya3214/coding | HackerRank/MaximumElement.cpp | // AC
#include <bits/stdc++.h>
#define BUFFER 5
#define BUFF(x) x + BUFFER
#define N_MAX (int) 1e5
// #pragma GCC optimize "O4"
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int answers[BUFF(N_MAX)];
int top;
void pushToStack(int x) {
++top;
answers[top] = max(answers[top - 1], ... | ALGO | 0.999639 | 4.126867 |
d11601d8-cecf-40a0-a4ef-df23fed6d617 | sunkusaarthak/Data-structure-and-Algorithms | BinSearch.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int getFirstPos(vector<int> arr, int val) {
int s = 0, l = arr.size();
int pos = -1;
while(s<=l) {
int mid = s + (l-s)/2;
if(arr[mid] == val) {
pos = mid;
l = mid - 1;
}
else if(arr[mid] < val) {
s = mid + 1;
... | ALGO | 0.999878 | 5.231188 |
7374d473-fdb2-477d-9d8e-2ab90ca919b0 | travp624/frameworks_base | media/libstagefright/codecs/amrnb/common/src/reorder.cpp | /*
Filename: /audio/gsm_amr/c/src/reorder.c
------------------------------------------------------------------------------
REVISION HISTORY
Description:
1. Eliminated unused include file add.h.
2. Replaced array addressing by pointers
3. Eliminated math operations that unn... | ALGO | 0.99994 | 6.232624 |
298134a9-4822-4ff5-bfd1-337c99cabba0 | sarvex/leetcode-idris | solution/2100-2199/2125.Number of Laser Beams in a Bank/Solution.cpp | class Solution {
public:
int numberOfBeams(vector<string>& bank) {
int ans = 0;
int last = 0;
for (auto& b : bank) {
int t = 0;
for (char& c : b)
if (c == '1')
++t;
if (t) {
ans += last * t;
... | ALGO | 0.999933 | 6.485901 |
f778edb6-38ac-44db-b0b3-312146409e18 | kashyapp/the-kitchen-sink | code/codejam/ropeintranet/ropeintranet.cpp | #include <iostream>
using namespace std;
/**
* T <= 15
* Ai, Bi <= 10^4
*/
#define W 10000
int A[W], B[W];
int solve() {
int count = 0;
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> A[i] >> B[i];
}
for (int i = 0; i < n-1; ++i) {
for (int j = i+1; j < n; ++j)... | ALGO | 0.999839 | 4.469351 |
08d61ae3-94be-406e-825e-649dc40dbbb7 | arifSDE/Data-Structure | Module 14/queue_singly_linked_list.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* next;
Node(int val)
{
this->val=val;
this->next=NULL;
}
};
class myQueue
{
public:
Node*head=NULL;
Node*tail=NULL;
int sz=0;
void push(int val)
{
sz++;
Node*ne... | ALGO | 0.999979 | 4.170286 |
a134a82f-8404-4ee6-941c-b01922653406 | C10H16/study-notes-cpp | 剑指offer/51.cpp | #include <iostream>
using namespace std;
int InversePairsCore(int* data, int* copy, int start, int end)
{
if (start == end)
{
copy[start] = data[start];
return 0;
}
int length = (end - start)/2;
int left = InversePairsCore(copy, data, start, start+length);
int right = InversePai... | ALGO | 0.999961 | 4.470728 |
f08f68f2-189d-4c8f-a538-7fe99b34d925 | figurekim317/BOJ | cpp/BOJ_1023.cpp | #include <cstdio>
typedef long long ll;
ll n,m,a[30][55];
ll amel(ll p){
ll ret=0;
for(int i=n-1,zero=0,cnt=n>>1;i>=0;i--){
if(!(p&1ll<<i)) {zero++; continue;}
if(!i) return ret+(zero==1);
if(!zero) return ret+a[cnt][i-1];
ret+=a[cnt][i-1];
zero--; cnt--;
}
return... | ALGO | 0.999966 | 3.473974 |
e7ada523-5b60-4e0d-ad45-e04bda727c93 | a3a256/LeetCodeFun | algorithms/easy/2176. Count Equal and Divisible Pairs in an Array/solution.cpp | class Solution {
public:
int countPairs(vector<int>& nums, int k) {
map<int, vector<int>> mp;
int i, j;
for(i=0; i<nums.size(); i++){
mp[nums[i]].push_back(i);
}
int count = 0;
for(auto it: mp){
for(i=0; i<it.second.size()-1; i++){
... | ALGO | 0.999808 | 5.749639 |
08f4c454-b039-4f90-a24d-e5479db62ab6 | slitvinov/lammps-swimmer | src/USER-OMP/msm_omp.cpp | /* ----------------------------------------------------------------------
Contributing authors: Axel Kohlmeyer (Temple U), Stan Moore (SNL)
------------------------------------------------------------------------- */
#include "msm_omp.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#in... | ALGO | 0.999678 | 5.288987 |
a94646b4-12d1-4733-b9ee-a273ab612176 | tnqkr98/Algorithm-Study | BeakjoonOnlineJudge/baek05751(Head or Tail).cpp | #include <iostream>
using namespace std;
int main() {
while (1) {
int n; cin >> n;
if (n == 0) break;
int m = 0, j = 0;
for (int i = 0; i < n; i++) {
int a; cin >> a;
if (a) j++; else m++;
}
cout << "Mary won " << m << " times and John won " << j << " times" << endl;
}
return 0;
} | ALGO | 0.999809 | 3.555341 |
0bc02266-efff-4098-b268-2f3372e0fe90 | iiitu-force/hacktoberfest22 | CPP/Increasing.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t, k = 1;
cin >> t;
while(t--)
{
int n;
cin >> n;
vector<int> v(n);
for(int i = 0; i < n; i++)
{
cin >> v[i];
}
sort(v.beg... | ALGO | 0.999907 | 4.616807 |
53c5ee06-8bbd-4cf8-a439-d67d8f0d0f23 | AimotoRyosuke/atcoder | work/abc/C/260_C.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using ll = long long;
int main() {
ll N, X, Y;
cin >> N >> X >> Y;
map<ll, ll> B, R;
R[N] = 1;
auto canTransB = [&]() -> bool {
bool ok = false;
for (auto &[k, v] : B) {
if (k <=... | ALGO | 0.999982 | 3.631136 |
dfd26d81-af03-43d9-8b45-d3b5f7dc8e5e | iamrubayet/codeforces_solution | 263A-Beautiful Matrix.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int x=0;
int i;
int j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++){
cin>>x;
if (x==1){
cout<<abs(i-3)+abs(j-3)<<endl;
}
}
}
return 0;
}
| ALGO | 0.999628 | 3.051807 |
301d8be6-d493-42dc-816b-381d9d994481 | GaurangRastogi/Codeforces | B_Kuriyama_Mirai_s_Stones.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
long long int arr[n], v[n], u[n];
for(int i=0;i<n;i++){
cin>>arr[i];
if(i>0) v[i]=arr[i]+v[i-1];
else v[i]=arr[i];
}
sort(arr,arr+n);
u[0]=arr[0];
for(int i=1;i<n;i++){
u[i]=arr[i]+u[i-1];
}... | ALGO | 0.999808 | 3.995054 |
579393fb-9ec3-4e4c-9570-6c7d7ebaa978 | zhuangcheng05/2025aaia | week14/week14-2.cpp | //week14-2.cpp
//YEH013_gcd
#include <stdio.h>
int gcd(int a,int b)
{
if (a==0)return b;
if (b==0)return a;
return gcd (b,a%b);
}
int main()
{
int a,b;
scanf("%d %d",&a,&b);
int ans = gcd(a,b);
printf("%d",ans);
}
| ALGO | 0.999916 | 4.467096 |
ff0a5536-f64d-41f2-b78a-bd54da0de36b | sid1114911149/INTRODUCTION_TO_OOPS | class_usage.cpp | //23CS8005
//PASHAM.SIDDARDHA REDDY
#include<iostream>
using namespace std;
class total_cost{
float length,breadth,height,tcost,cost,dlength,dbreadth,wlength,wbreadth,tarea,area,warea,darea;
public:
total_cost(){
cout<<"CLASS IS CREATED SUCCESSFULLY\n";
}
~total_cost(){
cout<<"CLASS IS DESTRUCTED SUCCESSFULLY\... | ALGO | 0.912264 | 3.54451 |
6ad56ec0-0ff8-40e9-b505-a85f532b736f | mateor/pdroid | android-2.3.4_r1/tags/1.32/frameworks/base/media/libstagefright/codecs/amrnb/common/src/log2_norm.cpp | /*
Pathname: ./audio/gsm-amr/c/src/log2_norm.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for Log2_norm function.
Description: Synchronized file with UMTS version 3.2.0. Updated coding
template. Removed unneces... | ALGO | 0.997584 | 5.951026 |
af7c01e5-ab2a-4a1c-9364-867979bcc73b | HGray384/TAS | src/logML.cpp | //[[Rcpp::depends(RcppArmadillo)]]
//[[Rcpp::depends(BH)]]
#include <tuple>
#include <boost/math/tools/minima.hpp>
#include <boost/math/special_functions/beta.hpp>
#undef NDEBUG
#include <RcppArmadillo.h>
using namespace arma;
using namespace Rcpp;
using boost::math::tools::brent_find_minima;
using boost::math::ibetac;... | ALGO | 0.999787 | 6.117694 |
a7bcb16d-3f71-4b74-bf52-58f4598305ab | eugenis/boost-nacl | libs/numeric/ublas/doc/samples/triangular_matrix.cpp | #include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
triangular_matrix<double, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
ml (i, j) = 3 * i + j;
... | ALGO | 0.94895 | 3.772041 |
8222c27e-5234-443e-87f2-d9842be5974c | KaniamLaes/codeforces_solved_problems | B_-_Nice_Grid.cpp | // “Work like there is someone working 24 hours a day to take it away from you.”
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ld long double
#define db double
#define el '\n'
#define ld long double
#define pb push_back
... | ALGO | 0.999937 | 4.41538 |
a4e90e20-ec37-4442-a27d-a05e10e8fdce | khanebrahim/OPP-CPP | function.cpp | #include<iostream>
using namespace std;
int sum(int a, int b){
int c=a+b;
return c;
}
int main(){
int num1,num2,result;
cout<<"Enter first number"<<endl;
cin >> num1;
cout<<"Enter second number"<<endl;
cin >> num2;
result =sum(num1,num2);
cout<<"The result is "<<result<... | TOOL | 0.95083 | 3.715058 |
1c743e65-6bc9-43c2-b9f7-cf26258bd7bf | DerFelixPlayer2/HTL-Coding | Non-Java-Coding/Informatikolympiade/2023/Vorbereitung Wien/Teamcontest/Dnorm.cpp | #include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
vector<double> X;
vector<int> A;
const double b = .99999999999999999999e-6;
double findD(int a0) {
if (a0 > 10000) {
return -1;
}
double d = a0 / X[0];
A.push_back(a0);
for (int i = 1; i < X.size(); i++) {
double... | ALGO | 0.999562 | 4.026121 |
5d250de8-ba8e-4f17-b5ea-14820aae2bd0 | w407022008/librealsense-2.55.1 | third-party/rsutils/src/json.cpp | #include <rsutils/json.h>
#include <rsutils/json-config.h>
#include <rsutils/os/executable-name.h>
#include <fstream>
namespace rsutils {
json const null_json = {};
json const missing_json = json::value_t::discarded;
json const empty_json_string = json::value_t::string;
json const empty_json_object = json::object();... | TOOL | 0.918141 | 6.872955 |
951ff7e1-0151-4b22-a92b-30660ef6b2bc | FrancescoSaverioZuppichini/OneNet | detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp | namespace detectron2 {
template <typename T>
void box_iou_rotated_cpu_kernel(
const at::Tensor& boxes1,
const at::Tensor& boxes2,
at::Tensor& ious) {
auto num_boxes1 = boxes1.size(0);
auto num_boxes2 = boxes2.size(0);
for (int i = 0; i < num_boxes1; i++) {
for (int j = 0; j < num_boxes2; j++) {
... | ALGO | 0.990578 | 7.186255 |
1c3e6a6d-c028-4b2a-ba55-4c17afa2f761 | siwenhongyi/leetcodeAlgorithms | cpp/dynamic-programming/87.扰乱字符串.cpp | /*
* @lc app=leetcode.cn id=87 lang=cpp
*
* [87] 扰乱字符串
*/
#include "head.h"
using namespace std;
// @lc code=start
class Solution {
public:
bool isScramble(string s, string t) {
int n = s.size();
vector<vector<vector<bool>>> dp(n, vector(n, vector(n + 1, false)));
for (int i = n - 1; i >= 0; i--) {
... | ALGO | 0.99992 | 6.377934 |
e22e7c94-691b-4498-88b4-a738bd18a6f0 | phitronio/AlgorithmBatch3 | Graph/Problems/CSES/Shortest Routes 2.cpp | #include<bits/stdc++.h>
using namespace std;
void init_code()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const int N = 1e3+7;
const long long int INF = 1e18+7;
long long int g[N][N];
int main()
{
ios::sync_with_stdio(false... | ALGO | 0.999959 | 4.67025 |
aecd999d-5ed9-40d9-823c-9dd9bcbfbd38 | 082T/solving_pr-eu | 0016.cpp | #include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
cpp_int count(cpp_int a)
{
cpp_int suma = 0;
while (a > 0)
{
suma += a % 10;
a = a / 10;
}
return suma;
}
int main() {
cpp_int a = 1;
for (int i = 1; i <= 1000; i++... | ALGO | 0.99447 | 4.697233 |
1550add5-5a15-4f6e-9165-f5b80d873c92 | olroque/LeetCode | 171_excel_sheet_column_number/excel_sheet_column_number.cpp | #include <iostream>
#include <vector>
#include <math.h>
using namespace std;
class Solution {
public:
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int num = 0;
int columnLength;
int columnTitleSize;
int titleToNumber(string columnTitle)
{
columnTitleSize = columnTitle.size() - 1;
... | ALGO | 0.999027 | 5.454854 |
f6558a9c-3106-4c7e-b0d4-bc8e27978511 | bulatmain/algorithms | z-function/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
#define min(a, b) ((a) < (b) ? (a) : (b))
vector<i64> z_func(const string& s) {
int n = s.size();
vector<i64> z(n);
z[0] = n;
i64 l = 0, r = 0;
for (i64 i = 1; i < ... | ALGO | 0.999826 | 4.575274 |
835b18c6-6aee-46ca-b608-695bda47b7d1 | TeaqariaWTF/Qingyue | module/jni/libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp | // UNSUPPORTED: c++03, c++11
// <algorithm>
// template<class Iter>
// void make_heap(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include <random>
#include "test_macros.h"
struct Stats {
int compared = 0;
int copied = 0;
int moved = 0;
} stats;
struct MyInt {
int value;
explicit M... | TEST | 0.970784 | 5.831657 |
0058f69b-436b-48ab-b8f9-0e6b174c056c | qfu/LeetCode_1 | E_202_Happy_Number.cpp |
class Solution {
public:
int square(int n){
int y = 0;
while(n){
int digit = n % 10;
y += pow(digit,2);
n /= 10;
}
return y;
}
bool isHappy(int n) {
if (n == 1) return true;
set<int> loop;
int value = square(n);
... | ALGO | 0.999941 | 5.73549 |
ab018a21-f0a2-4152-9a02-ee11d89043cc | MichaelMMMMM/Bachelor | Bachelor/999_Backup/6_Software/Eclipse_WS/BBB_3D/Control/C1DStateReduction.cpp | /**
* @file C1DStateReduction.cpp
* @author Michael Meindl
* @date 14.03.2017
* @brief Method defintions for C1DStateReduction.
*/
#include "C1DStateReduction.h"
#include <cmath>
C1DStateReduction::C1DStateReduction()
{
}
const C1DStateReduction::OutputType& C1DStateReduction::calcOutput(const C1DStateReduction:... | ALGO | 0.95213 | 4.135484 |
da6811a1-d0a8-4d0c-992a-1e6192bdb1f1 | PAMCH/Coding_Magic_Bronze | ex13-2/ex13-2/ex13-2.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
pair<pair<int, int>, string> a[101];
string name;
int n, c, t;
void input()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> name >> c >> t;
a[i] = { {c,t},name };
}
}
void core(... | ALGO | 0.999438 | 3.921108 |
3d08ef2d-3b3e-495d-b4f3-d8582454671b | rzando-org/leetcode | solution/1400-1499/1432.Max Difference You Can Get From Changing an Integer/Solution.cpp | class Solution {
public:
int maxDiff(int num) {
auto replace = [](string& s, char a, char b) {
for (auto& c : s) {
if (c == a) {
c = b;
}
}
};
string a = to_string(num);
string b = a;
for (int i = 0; ... | ALGO | 0.999804 | 5.870156 |
c2657b7e-2f86-48c5-9ccf-db557e289db9 | JonothorDarry/Majster | Solution_psi.cpp | #include <stdio.h>
#include <vector>
#include <cmath>
#include "common.hpp"
using ll=long long;
using namespace std;
const ll MAX=100000000001ll, SQRT=ll(ceil(sqrt(MAX)));
const int BCv=25, Cv=1<<BCv, D=10001;
struct segtree_vertex{
int value;
int left;
int right;
int index;
};
vector <vector <segtree_vertex> > v... | ALGO | 0.999383 | 4.094436 |
4e0c3435-9ddc-4f5b-9f58-786427ba8011 | janursa/fuzzyABM | src/fuzzylite/src/activation/Highest.cpp | #include "fl/activation/Highest.h"
#include "fl/rule/RuleBlock.h"
#include "fl/rule/Rule.h"
#include "fl/Operation.h"
#include <queue>
namespace fl {
Highest::Highest(int numberOfRules) : Activation(), _numberOfRules(numberOfRules) { }
Highest::~Highest() { }
std::string Highest::className() const {
... | ALGO | 0.988189 | 6.015178 |
a3c2fc9d-5bff-4d3e-92da-8bdab5d05769 | jyotirmoy1997/Data-Structures-Files | Queue/LRUCache.cpp | #include<bits/stdc++.h>
using namespace std;
class LRUCache
{
struct Node
{
int key;
int val;
Node* next;
Node* prev;
Node(int k, int v)
{
key = k;
val = v;
next = NULL;
prev = NULL;
}
};
Node *head,... | ALGO | 0.999294 | 4.47713 |
3c21b063-a346-4144-b8f0-2a346cbb2d68 | Abdul-Rahimm/LeetCode_2023 | 5. August/239. (h) Sliding window max.cpp | #include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef vector<int> vi;
typedef priority_queue<int> pq;//max heap
void print(vi ans){
for(int i:ans)
cout << i << " ";
cout << endl;
}
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
vector<int> ans;
deque<int> deq; //deq... | ALGO | 0.999895 | 5.371636 |
6ba06be0-a1a7-4924-8a78-f4693bc0ffac | TANYASHARMA2226/POTD | tempCodeRunnerFile.cpp | You are given an integer array nums and an integer k. You may partition nums into one or more subsequences such that each element in nums appears in exactly one of the subsequences.
Return the minimum number of subsequences needed such that the difference between the maximum and minimum values in each subsequence is a... | ALGO | 0.999963 | 5.929228 |
6c4ec05e-e34a-4241-b2fc-af9cef26c72a | manikanta2901/ubuntu | .history/SRM/placementPractice/HackerRank/DataStructure/InsertingNodeInDoublyLL_20210310235233.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
struct Node* next = NULL;
struct Node* prev = NULL;
};
void printList(struct Node *a){
Node *last;
cout << "Iterate from front : ";
while(a != NULL){
cout << a->data << " ";
last = a;
a = a->next;
}... | ALGO | 0.999919 | 4.477659 |
68baf73c-3eef-4597-a788-1e412697e691 | jbm2593/Algorithm | Programmers/더 맵게/taxijjang/더 맵게.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cstring>
#include<functional>
#include<cmath>
#include<stack>
#define SIZE 1010
const int INF = 2000000000;
using namespace std;
typedef long long int ll;
priority_queue<int> pq;
int solution... | ALGO | 0.999803 | 4.61455 |
852ee614-4c4d-4ce9-a282-b7026f651eac | Chenghao-Tan/Practices | cpp/A+B for Input-Output Practice (IV).cpp | #include <iostream>
using namespace std;
int main()
{
int N = 2;
while (cin >> N)
{
if (N != 0)
{
int input = 0;
for (int i = 0; i < N; i++)
{
int former = input;
cin >> input;
input += former;
}
cout << input << endl;
}
else
break;
}
}
| ALGO | 0.998934 | 3.156604 |
14913b90-4a3d-4d27-b371-2bc521b6ba2b | QianQNanami/JSOI-WC25 | TG/judger/source/WC25-401/tree.cpp | #include <iostream>
#include <queue>
using namespace std;
const int N=1e5+10;
int fa[N],v[N];
bool leaf[N];
int sum[N];
int n,ans;
queue <int> q;
bool f(int x,int y)
{
if(x==y) return true;
if(x==0) return false;
return f(fa[x],y);
}
void bfs()
{
while(leaf[0])
{
for(int i=1;i<=n;i++)
if(!leaf[i])
q.pu... | ALGO | 0.999935 | 3.837771 |
f0111c5b-763d-4c57-873a-76c176405287 | KhoyaniChetan2224/DSA-all-Concept-Code-DSA-C- | C++ With Data Structures and Algorithams/22 counting_1.cpp | #include<iostream>
using namespace std;
void print (int n){
//base case
if (n == 0 ){
return ;
}
//Recursive relation
print (n - 1);
cout << n << endl;
}
int main (){
int n;
cin >> n;
cout << endl;
print(n);
return 0;
} | ALGO | 0.999909 | 4.642905 |
bac9934e-2f6a-4419-abf2-2ffaa4a0ddcc | RigoLigoRLC/Fritzing-build | boost_1_82_0/libs/compute/perf/perf_stl_rotate.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.978834 | 5.764708 |
d22cb57a-adfa-4bcb-ab8a-5b043cd641cd | aditya-672/C-_DSA | TCS PREP/2.cpp | // Problem Statement – Given a string S(input consisting) of ‘*’ and ‘#’. The length of the string is variable. The task is to find the minimum number of ‘*’ or ‘#’ to make it a valid string. The string is considered valid if the number of ‘*’ and ‘#’ are equal. The ‘*’ and ‘#’ can be at any position in the string.
// ... | ALGO | 0.999862 | 4.263331 |
c87d35f4-deb5-4822-84a5-8ef67b390cfb | hieu-ln/IT81-14 | CodeC2/ThienPhuc_C2_Bai6.cpp | //Project: C2_Bai6.cpp
#include <iostream>
using namespace std;
//khai bao cau truc stack
#define MAX 100
int a[MAX];
int sp;
// Khoi tao stack rong
void init(int a[], int &sp)
{
sp = -1;
}
// kiem tra stack rong
int isEmpty(int a[], int &sp)
{
if (sp == -1)
return 1;
else
return 0;
}
// kiem tra stack day
int ... | ALGO | 0.990774 | 3.510898 |
e483e8e4-c28f-4a3a-a3d3-db51092eddf4 | ishandutta2007/codeforces | kewth/normal/1266/F.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long ll;
struct {
inline operator int () { int x; return scanf("%d", &x), x; }
} read;
const int maxn = 500005;
int ans[maxn << 1];
std::vector<int> G[maxn];
int fa[maxn];
int flen[ma... | ALGO | 0.999734 | 3.887916 |
cf5f5988-8f10-4c83-841d-0fac68c32010 | MartinBanky/qt5-base | src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp | #include "compiler/translator/ForLoopUnroll.h"
#include "compiler/translator/ValidateLimitations.h"
#include "angle_gl.h"
bool ForLoopUnrollMarker::visitBinary(Visit, TIntermBinary *node)
{
if (mUnrollCondition != kSamplerArrayIndex)
return true;
// If a sampler array index is also the loop index,
... | ALGO | 0.870682 | 6.923152 |
70912462-354b-4b57-a327-f49d5adf1adf | zilinli0130/leetcode_algorithm_solution | Tree/Binary Tree/199. Binary Tree Right Side View/199. 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.999721 | 6.59657 |
c47a6d6f-b576-4922-ad21-d7049e10a09f | athuls/RL_Soar | Fall2011/boost_1_46_0/libs/math/test/test_find_location.cpp | // test_find_location.cpp
// Basic sanity test for find_location function.
// Default domain error policy is
// #define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error
#include <pch.hpp>
#include <boost/math/concepts/real_concept.hpp> // for real_concept
#include <boost/math/distributions/normal.hpp> // for normal_di... | TEST | 0.853354 | 7.082192 |
7d3179dd-83d4-4627-af6c-92c8a6a33206 | Wsh7Ash/LEETCODE | cpp/c501-1000/967.cpp | class Solution {
public:
vector<int> numsSameConsecDiff(int n, int k) {
vector<int> res;
queue<int> q;
for(int i = 1; i <= 9; i++){
q.push(i);
}
for(int level = 1; level < n; level++){
int size =q.size();
... | ALGO | 0.999909 | 7.0759 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.