uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
4495bf15-5d81-4cbc-ab39-6e7b96826dd3 | lcheng-ENME202/cpp-lecture-notes | 5d_bubbleSort.cpp | // ENME 202
// 5d_bubbleSort.cpp
// Example: bubble sorting
#include <iostream>
using namespace std;
void bubbleSort(float*, int);
void fillRandArray(float*, int);
void displayArray(float*, int);
int main(void) {
srand(time(NULL));
int n = rand()%10 + 5; // random array size from 5-14
float* a = new float[n... | ALGO | 0.999653 | 5.248575 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-09-25T19:34:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 8,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "a849e5e18982... |
97dcfb72-bbb7-4f66-bab8-5908dc1dabe6 | omidm/nimbus | applications/physbam/physbam-lib/Public_Library/PhysBAM_Solids/PhysBAM_Deformables/Forces/DEFORMABLE_GRAVITY.h | //#####################################################################
// Copyright 2002-2009, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//##############... | ALGO | 0.980955 | 5.484238 | {
"github_metadata": {
"branch": "master",
"commit_count": 3869,
"repo_created_at": "2017-04-27T02:25:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 25,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "046a3... |
2af1b2b6-48f6-49d3-bd7c-736ae325efc8 | ishandutta2007/codeforces-i | ilovevoi/normal/1635/E.cpp | /*#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define F(i,a,b) for (... | ALGO | 0.999953 | 3.504952 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T05:39:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b89b9913df9d... |
f2a9b2b5-89ec-478d-96f0-dbc22690e4a0 | grungger/HIVE | base_components/lib/word_nand.hpp | /*********************************
* @file word_nand.hpp
*
* @brief Implementation of ByteNAND and WordNAND.
*********************************/
// Includes:
#include "wordmicrocircuit.hpp"
#include "word_splitter.hpp"
#include "word_maker.hpp"
#include "nand.hpp"
// Header Guards:
#ifndef WORD_NAND_H
#define WORD_... | TOOL | 0.979859 | 6.218921 | {
"github_metadata": {
"branch": "32bittest",
"commit_count": 20,
"repo_created_at": "2025-04-26T11:31:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ecbda... |
f032af68-a30a-42bf-bc2b-174b25b0249c | hivx/KTLT | thuchanh/@new/b2/2_9.cpp | // #include <vector>
// #include <algorithm>
// #include <cmath>
// #include <ctime>
// #include <algorithm>
// #include <cstdio>
// using namespace std;
// const int LIMIT = 100;
// const int NUM_ITER = 100000;
// const int NUM_INPUTS = NUM_ITER * 100;
// double sigmoid_slow(double x) {
// return 1.0 / (1.0 + e... | ALGO | 0.999711 | 4.9756 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-29T16:57:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5950d4b2b2be... |
d825960e-94e0-42a7-818c-a327b2288c37 | Pragnesh2208/LeetCode-Solution | Dynamic Programming/#123 Best_Time_To_Buy_And_Sell_Stock_III.cpp | /*
Solution Using Memoization
Time Complexity = O(N)
Space Complexity = O(N*2*3)
Auxilary Space Complexity = O(N)
*/
class Solution {
private :
int getMaxProfit(int ind , int buy , int cap , vector<int>&arr , vector<vector<vector<int>>>&dp ) {
if(cap == 0 || ind == arr.size() ) return 0;
if(dp[i... | ALGO | 0.99999 | 5.839494 | {
"github_metadata": {
"branch": "main",
"commit_count": 572,
"repo_created_at": "2021-08-25T12:49:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab1f5865ff... |
39088652-213b-461a-868f-ae70967de703 | dronelektron/MAI | sem3/da/labs/4/var_3_1.cpp | #include <exception>
#include <new>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "vector.h"
#include "queue.h"
struct TPos
{
int row;
int col;
};
int ToLower(int ch);
void PreBmBc(char* x, int m, int* bmBc, int size);
void Suffixes(char* x, int m, int* suff);
void PreBmGs(char* x, int m, int* bm... | ALGO | 0.996338 | 3.612156 | {
"github_metadata": {
"branch": "master",
"commit_count": 324,
"repo_created_at": "2014-03-28T11:12:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 24,
"forks": 19,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "938a05... |
989c303d-c449-4766-9ab4-ffd57ebf8450 | ITSJKS/Leetcode-Solutions | The Celebrity Problem - GFG/the-celebrity-problem.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 if there is a celebrity in the party or not.
int celebrity(vector<vector<int> >& M, int n)
{
// co... | ALGO | 0.999742 | 5.448668 | {
"github_metadata": {
"branch": "main",
"commit_count": 3261,
"repo_created_at": "2022-09-05T05:16:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e59344ec... |
df4be66e-70a2-4315-9e33-c3e6981c491e | prafulexperiment/ada | nqueen1.cpp | #include <iostream>
#include <cmath>
int count = 0;
int x[100];
int place(int k, int i) {
for (int j = 1; j < k; j++)
if (x[j] == i || std::abs(x[j] - i) == std::abs(j - k))
return 0;
return 1;
}
void nqueen(int k, int n) {
for (int i = 1; i <= n; i++)
if (place(k, i)) {
... | ALGO | 0.99998 | 4.557236 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-03-12T04:05:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "720b8c7dc2c5... |
8b5972bc-a081-4828-af19-6e16391f4130 | mingaleg/archimed2015 | archimed2015/contest/problems/roscomnadzor/solutions/at_roskomnadzor.cpp | #include <iostream>
#include <fstream>
char replace(char c) {
if (c == 'e') {
return '3';
}
if (c == 'o') {
return '0';
}
if (c == 'i') {
return '1';
}
if (c == 't') {
return '7';
}
if (c == 'a') {
return '4';
}
if (c == 's') {
... | ALGO | 0.999847 | 5.052507 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2015-06-22T13:13:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "821b89e8ed... |
5770c123-e0e5-4ac1-98fc-302b88925f01 | SuhJae/USACO | bronze/2023-dec/CandyCaneFeast.cpp | #include <vector>
#include <iostream>
typedef unsigned long long ull;
using namespace std;
int main() {
vector<ull> cowHeights;
vector<ull> candyHeights;
ull cowCount;
ull candyCount;
cin >> cowCount >> candyCount;
cowHeights.resize(cowCount);
candyHeights.resize(candyCount);
for (... | ALGO | 0.999995 | 3.68991 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-12-14T02:40:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bc787c4261e... |
04fbdadd-7cdc-479e-bba2-999d2c07cd5c | wvaughn409/Kobayashi-Maru | Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDJointConstraintUtilities.cpp | // Copyright Epic Games, Inc. All Rights Reserved.
#include "Chaos/PBDJointConstraintUtilities.h"
#include "Chaos/DenseMatrix.h"
#include "Chaos/ParticleHandle.h"
#include "Chaos/Utilities.h"
//PRAGMA_DISABLE_OPTIMIZATION
namespace Chaos
{
void FPBDJointUtilities::DecomposeSwingTwistLocal(const FRotation3& R0, const... | ALGO | 0.99929 | 6.391683 | {
"github_metadata": {
"branch": "master",
"commit_count": 341,
"repo_created_at": "2020-09-14T02:14:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0205fd51... |
ccb074b1-be43-407d-aa94-18ca978a453d | walker1239/estructura | AVL_/avl.inl | template <class K,class D>
node<K,D>::node(const K & k, const D & d){
key=k;
data=d;
BalanceFactor=0;
p_child[0]=NULL;
p_child[1]=NULL;
}
template<class K,class D>
void avl<K,D>::insert(const K & key,const D & data)
{
node<K,D>**searcher = &this->p_root;
insert(searcher,key,data);
}
template<class K,clas... | ALGO | 0.99072 | 3.912089 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2018-12-12T17:47:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76967aad0... |
cbcbed34-089c-40c7-80c0-3812302035cc | ruben-cohen/jcr_pde1d | mesh_spot.cpp |
#include "mesh_spot.hpp"
#include <vector>
#include <cmath>
#include <limits>
#include <iostream>
namespace project{
mesh::mesh(const double& spot, const double& maturity,const double& volatility, const long& time_step, const long& steps,PayOff* _option)
:
option(_option),
m_dt(maturity/time_step),
m_spot(spo... | ALGO | 0.990423 | 4.832121 | {
"github_metadata": {
"branch": "master",
"commit_count": 89,
"repo_created_at": "2019-11-27T16:25:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a0c244724... |
0ecb3c1a-3f09-45e6-8715-51cd5444f144 | BryanValeriano/marathon | uva/11753.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define eb emplace_back
#define endl '\n'
typedef long long ll;
typedef pair<int,int> ii;
typedef vector< pair<int,int> > vii;
const int INF = 0x3f3f3f3f;
const int T = 1e4 + 2;
const int K = 21... | ALGO | 0.999896 | 3.743613 | {
"github_metadata": {
"branch": "master",
"commit_count": 188,
"repo_created_at": "2018-07-19T13:13:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "268ca408... |
d40dc835-9854-4c75-8bb2-022adf0e0670 | xsligroup/chronusq_public | include/cibuilder/rasci/sigma.hpp | /*
* This file is part of the Chronus Quantum (ChronusQ) software package
*
* Copyright (C) 2014-2022 Li Research Group (University of Washington)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Softwa... | ALGO | 0.98037 | 4.645506 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2022-06-13T16:17:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 15,
"forks": 5,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "36009e80a7... |
9b12910e-d719-49ed-a7fe-094bc5817d5e | HUYTG17/ICPC | CTDL/Sapxep/SXCHON.cpp | #include <bits/stdc++.h>
using namespace std;
void InsertionSort(int a[], int n)
{
int x, pos;
for(int i = 1; i < n; i++)
{
x = a[i];
for(pos = i; (pos > 0) && (a[pos - 1] > x); pos--)
a[pos] = a[pos - 1];
a[pos] = x;
}
}
int main()
{
int x;
int a[100];
... | ALGO | 0.999796 | 4.504209 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2024-09-10T15:58:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3a448b57b... |
0635b49c-92d3-4e03-bbbb-907816c9a17d | UHeeJoon/C-study2 | BaekJoon/2096번.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int minDp[2][5] = { {987654321, 987654321 , 987654321 , 987654321 , 987654321},
{987654321, 987654321 , 987654321 , 987654321 , 987654321} };
int maxDp[2][5] = { 0, };
int n; cin >> n;
f... | ALGO | 0.999993 | 3.142552 | {
"github_metadata": {
"branch": "master",
"commit_count": 471,
"repo_created_at": "2022-01-14T09:36:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "332c9306... |
9b0ecbd7-bc6f-4cba-84fa-9f8f5283f4f5 | nopitaa/STD_Novita_Syahwa_Tri_Hapsari_2311104007 | 06_Double_Linked_List_Bagian_1/TP/soal01.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* prev;
Node* next;
};
class DoublyLinkedList {
public:
Node* head;
Node* tail;
DoublyLinkedList() {
head = nullptr;
tail = nullptr;
}
void insertFirst_2311104007(int data) {
Node* newNo... | ALGO | 0.999725 | 5.690547 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2024-09-27T08:21:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efd276b7759... |
977fda34-7e39-423d-b015-a8fbe1ac52ea | nicholasrosa/Codewars.com | C++/Kata3/CreatePhoneNumber.cpp | /*
Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form
of a phone number.
Example:
createPhoneNumber(int[10]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}) => returns "(123) 456-7890"
The returned format must be correct in order to complete this challenge.
Don... | ALGO | 0.996972 | 5.086549 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-10-25T20:48:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4f806a5372... |
70d4d2cb-f7bb-4a2f-a3f8-0c97f03b4485 | aadi1307/High-Performance-Computing | HW08/convolution.cpp | // convolution.cpp
#include "convolution.h"
#include <vector>
#include <cstddef>
void convolve(const float *image, float *output, std::size_t n, const float *mask, std::size_t m) {
int offset = (m - 1) / 2;
#pragma omp parallel for collapse(2)
for (std::size_t x = 0; x < n; ++x) {
for (std::size_t... | ALGO | 0.999504 | 6.53823 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-03-13T20:02:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9f362720966e... |
dee186b6-d334-457c-98b1-f62795b04dce | akiiishiii/oi_exercises | code/2388.cpp | // 2388.cpp
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
int const Maxn = 105, Maxm = 1005, Mod = 31011;
int prt[Maxn], ptmp[Maxn], g[Maxn][Maxn], mat[Maxn][Maxn];
std::vector<int> vec[Maxn];
bool vis[Maxn];
int n, m;
struct edges {
int u, v, w;
bool operator<(const edges &e) ... | ALGO | 0.999994 | 4.560361 | {
"github_metadata": {
"branch": "master",
"commit_count": 502,
"repo_created_at": "2022-01-01T12:41:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "18a5ee3a... |
b151dabb-a8d9-4998-b403-9dc48d702cc1 | yamate11/compprog | arc/arc147/a/cans.cc | #include <bits/stdc++.h>
#include <cassert>
using namespace std;
using ll = long long int;
using pll = pair<ll, ll>;
// #include <atcoder/all>
// using namespace atcoder;
#define REP(i, a, b) for (ll i = (a); i < (b); i++)
#define REPrev(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(coll) (coll).begin(), (coll).... | ALGO | 0.999972 | 4.365794 | {
"github_metadata": {
"branch": "main",
"commit_count": 219,
"repo_created_at": "2021-03-11T06:12:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ffe41d11f... |
18a0a8ba-15c6-4738-a3ce-e1eac3a87002 | tayu0110/atcoder | agc/agc31b.cpp | #include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
struct Ed... | ALGO | 0.999978 | 4.110931 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2021-05-02T14:14:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "79e2ff9e7... |
d4e38489-9836-47b7-89e1-5431d163f322 | ronak66/Data-Processing-Toolkit | v/implementation/Task5/EigenCalc.cpp | #include "EigenCalc.h"
// constructor
EigenCalc::EigenCalc(std::vector <std::vector <double> > data) {
ssm = SymmetricSquareMatrix(data);
}
// copy constructor
// EigenCalc::EigenCalc(const EigenCalc& ec) {
// ssm = SymmetricSquareMatrix(ec.ssm);
// _eigen_vectors = ec._eigen_vectors;
// _eigen_value... | ALGO | 0.998057 | 3.713287 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2018-11-28T03:31:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "091b95b4f... |
8fecc46c-c79c-4840-bc8b-b4dbbf146502 | gaochenxu/PedestrianDetection | ChnFtrsAdaboostOpencv - PedestrianDetection/ChnFtrsAdaboost/DollarMex.cpp | #include "StdAfx.h"
#include "DollarMex.h"
#include "wrappers.hpp"
#include <math.h>
#include "string.h"
#include <typeinfo>
#include "sse.hpp"
#define PI 3.1415926535897931f
typedef unsigned char uchar;
// compute x and y gradients for just one column (uses sse)
void grad1( float *I, float *Gx, float *Gy, int h, ... | ALGO | 0.976864 | 3.009856 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2017-03-06T01:47:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4151d4b3b... |
c5b02059-55f1-454a-b609-b5db9d67e551 | rusucosmin/cplusplus | Logs/main.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <deque>
using namespace std;
const char infile[] = "l... | ALGO | 0.999971 | 3.474372 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2014-02-06T08:06:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b159414f2... |
6da5b5de-cfca-4b34-820b-4c4c993a5873 | asterism45/MyCompProgramming | Atcoder/others/Tessoku/A07.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, l, r) for (ll i = (l); i < (r); i++)
#define INF ((1LL << 62) - (1LL << 31))
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define all(a) (a).begin(), (a).end()
using ll = long long;
using vl... | ALGO | 0.999973 | 4.311751 | {
"github_metadata": {
"branch": "master",
"commit_count": 77,
"repo_created_at": "2023-04-17T03:46:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c59bd1fa5... |
2ed304ab-8c78-4b7d-bd6a-fd838ab1a6a6 | pkgw/nrao-casacore | scimath/Functionals/Gaussian2D2.tcc | //# Gaussian2D2.cc: Two dimensional Gaussian class specialized for AutoDiff
//# Copyright (C) 2001,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# ... | ALGO | 0.979306 | 6.616112 | {
"github_metadata": {
"branch": "trunk",
"commit_count": 2083,
"repo_created_at": "2012-10-06T16:28:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "620f258e... |
9549b929-f6ae-4443-8ada-601be64afa3d | anik-ewu/C-O-N-T-E-S-T | Google/kick start round G 2022/c.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
#define read(x) freopen("in.txt","r",stdin);
#define write(x) freopen("out.txt","w",stdout);
#define what_is(x) cerr<<#x<<" is "<<x<<"\n";
#define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)... | ALGO | 0.999918 | 4.549129 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2020-09-20T15:31:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63cfeeec0... |
ee575b4d-a2c1-499f-bf84-a71858c455e4 | Nattime/cpp-practice | leetcode/GetEqualSubstringsWithinBudget.cpp | // Authored by <NAME>
// 5/28/24
// 1208. Get Equal Substrings Within Budget
#include "../resources/cpp_header.h"
void testcase1();
void testcase2();
void testcase3();
class GetEqualSubstringsWithinBudget {
public:
int equalSubstring(string s, string t, int maxCost) {
int len = s.size();
int st... | ALGO | 0.999975 | 5.725579 | {
"github_metadata": {
"branch": "master",
"commit_count": 79,
"repo_created_at": "2024-03-03T19:28:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b506a5d2... |
9e1f3e7c-5e9d-4b13-9723-44c97d25a143 | shashankch292/InterviewBit | DynamicProgramming/ShortestCommonSuperstring.cpp | /*
Given a set of strings. Find the length of smallest string which
has all the strings in the set as substring
Constraints:
1) 1 <= Number of strings <= 18
2) Length of any string in the set will not exceed 100.
Example:
Input: [“abcd”, “cdef”, “fgh”, “de”]
Output: 8 (Shortest string: “abcdefgh”)
LINK: https://www.... | ALGO | 0.999986 | 5.287035 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2018-08-03T16:26:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 132,
"forks": 66,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "a01198... |
2864888f-b16e-4f5d-bdf9-6ec563ac0294 | alexsvm/saod-graph | saod-graph/saod-graph.cpp | // saod-graph.cpp:
// Написать процедуру формирования ориентированного графа G, представив его в виде динамической структуры.
#include <memory>
#include <iostream>
#include <list>
#include <algorithm>
#include <map>
#include <iterator>
using namespace std;
class Graph {
public:
struct node {
int node_idx; //... | ALGO | 0.998512 | 5.180319 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2017-05-22T13:35:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4e8cc8514... |
ba036bad-0c1d-41f6-8261-8674f3953ac4 | UPBGE/upbge | extern/recastnavigation/Detour/Source/DetourCommon.cpp | //
// Copyright (c) 2009 <NAME> <EMAIL>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commer... | ALGO | 0.999915 | 6.528172 | {
"github_metadata": {
"branch": "master",
"commit_count": 159097,
"repo_created_at": "2015-11-24T20:45:21.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1607,
"forks": 197,
"issues": 130,
"pull_requests": 7
},
"file_meta": {
"content_id": ... |
01c35a62-f32a-4d06-ac79-f81bf98c76e7 | celeritas-project/GeoModel | GeoModelCore/GeoGenericFunctions/GeoGenericFunctions/Pi.h | //==========================================================================//
// Imported from the QAT library (qat.pitt.edu) by the copyright holder //
// <NAME>. Software licensed under the terms and conditions of the //
// GNU Lesser Public License v3. //
//========... | ALGO | 0.994354 | 6.303268 | {
"github_metadata": {
"branch": "celeritas",
"commit_count": 2685,
"repo_created_at": "2023-07-05T14:31:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "9e94d... |
4133cbae-5960-41be-b9d5-e8bcc4b7e8b2 | gopendrajangir/dsa | 9_merge_sort.cpp | // Q9. Perform merge sort on an array?
#include <iostream>
using namespace std;
void mergeSort(int *, int, int, int);
void merge(int *, int, int, int, int);
int main()
{
int size;
cout << "Enter the number of elements : ";
cin >> size;
if (size < 0)
{
throw "Invalid number of elements. Try Again.";... | ALGO | 0.999978 | 5.692268 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-12-07T18:12:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5fab9fe282f... |
c2977343-32d4-4b48-aaa1-94fb1f36b2ab | Modeling-Coding-Automation-Project/python_numpy_to_cpp | python_numpy/python_numpy_linalg_solver.hpp | /**
* @file python_numpy_linalg_solver.hpp
* @brief Linear algebra solver utilities for Python-like Numpy matrix
* operations in C++.
*
* This header provides a set of template classes and factory functions to
* perform linear algebra operations such as solving linear systems, matrix
* inversion, partitioned sol... | TOOL | 0.91191 | 7.658046 | {
"github_metadata": {
"branch": "main",
"commit_count": 68,
"repo_created_at": "2024-10-27T07:18:08.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "edbcad9c15ec... |
6248669c-848c-48a3-9270-942d25c34133 | Kichrum/C-Programming | lr20/2.CPP | #include <stdio.h>
#include <stdlib.h>
struct st {
int n;
st *sp;
} *first=NULL,*last,*q;
void Add (int N) {
q=(st*)malloc(sizeof(st));
if (first==NULL) first=q;
else last->sp=q;
q->n=N;
... | ALGO | 0.999957 | 3.675596 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2012-07-09T18:49:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0fd8a08d85... |
4647ca02-20df-4d96-a742-a5a35e539851 | rocket323/acm | hiho/hiho_1537_new.cpp | #include <stdio.h>
#include <cstring>
#include <algorithm>
#define maxl 1010
#define INF 0x3f3f3f3f
using namespace std;
int n, a[maxl];
int f[maxl], s[maxl], top;
bool up = true;
bool go(int i) {
top = 0;
s[top++] = i;
up = true;
for (int j = i + 1; j <= n; ++j) {
if (a[j] < a[i]) continue;
... | ALGO | 0.999933 | 3.767259 | {
"github_metadata": {
"branch": "master",
"commit_count": 144,
"repo_created_at": "2021-09-11T10:40:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "72b17845... |
ac283c6b-5bba-4c54-bf85-3e6d8c380aa7 | WuLC/LeetCode | Algorithm/C++/1000+/1008. Construct Binary Search Tree from Preorder Traversal.cc | /*
* Created on Tue Mar 12 2019 9:3:0
* Author: WuLC
* EMail: <EMAIL>
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
#include <vector>
using std::vector;
class... | ALGO | 0.99998 | 6.715023 | {
"github_metadata": {
"branch": "master",
"commit_count": 1491,
"repo_created_at": "2016-03-21T02:41:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 25,
"forks": 18,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1866f... |
038fee13-dbc7-49ed-8f8b-421d70696fe4 | nikolausmayer/Advent-of-Code-2018 | days/14/cpp/part-1.cpp | #include <cstdlib>
#include <fstream>
#include <iostream>
#include <list>
#include <stdexcept>
int main(int argc, char *argv[])
{
if (argc < 2)
return EXIT_FAILURE;
std::ifstream infile{argv[1]};
if (infile.bad() or not infile.is_open())
throw std::runtime_error("Could not read from file");
int num; ... | ALGO | 0.997307 | 4.900078 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2018-12-03T08:05:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6463bf148... |
93038d24-43b3-4ef9-b8e0-c5c9339e45c6 | Valekir/ASD | module 2/1_1.cpp | #include <iostream>
#include <string>
// Реализуйте структуру данных типа “множество строк” на основе динамической хеш-таблицы
// с открытой адресацией. Хранимые строки непустые и состоят из строчных латинских букв.
// Хеш-функция строки должна быть реализована с помощью вычисления значения многочлена методом Горнера.... | ALGO | 0.999427 | 5.300153 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-11-29T18:05:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f557b432b064... |
112ffa73-1000-42cb-8087-ecc15d62c900 | nival/Prime-World | pw/branches/r1117/Vendor/ACE_wrappers/apps/JAWS2/HTTPU/parse_http_request.h | // $Id: parse_http_request.h 80826 2008-03-04 14:51:23Z wotte $
#ifndef HTTPU_PARSE_HTTP_REQUEST_H
#define HTTPU_PARSE_HTTP_REQUEST_H
#include "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "HTTPU/http_headers.h"
class HTTPU_Export Parse_HTTP_Reque... | WEB | 0.933896 | 5.91072 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2024-09-20T17:05:17.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 154,
"forks": 62,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9fd4cb2e0... |
42d856cc-cbc3-4919-94fb-1b1291d48ddc | kavya-k243/100-Days-of-Code | Day 100/Solution.cpp |
#include <bits/stdc++.h>
using namespace std;
bool isAllStars(string &S1, int i) {
for (int j = 1; j <= i; j++) {
if (S1[j - 1] != '*')
return false;
}
return true;
}
bool wildcardMatching(string &S1, string &S2) {
int n = S1.size();
int m = S2.size();
vector<bool> prev(m... | ALGO | 0.999974 | 4.050333 | {
"github_metadata": {
"branch": "main",
"commit_count": 120,
"repo_created_at": "2024-01-25T18:28:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 16,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0cbe62a2d... |
6682100f-650a-461f-8ec8-e996e4ad42a1 | pchintan243/Striver_DSA | BInary/Floor_Ceil.cpp | pair<int, int> getFloorAndCeil(int arr[], int n, int x)
{
// Write your code here.
int low = 0;
int high = n - 1;
int floor = -1;
int ceil = -1;
vector<int> v;
// floor condition
// we need to find lower bound on that number & return the number of lower bound index
for (int i = 0; ... | ALGO | 0.999906 | 5.44313 | {
"github_metadata": {
"branch": "master",
"commit_count": 439,
"repo_created_at": "2023-09-14T09:41:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "deb45122... |
fa87b458-aea2-47f8-a744-2c62f3eca9e2 | NVIDIA/cutlass | include/cutlass/transform/collective/sm90_wgmma_transpose.hpp | /***************************************************************************************************
* Copyright (c) 2017 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are p... | ALGO | 0.989392 | 7.607718 | {
"github_metadata": {
"branch": "main",
"commit_count": 667,
"repo_created_at": "2017-11-30T00:11:24.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 8078,
"forks": 1336,
"issues": 322,
"pull_requests": 54
},
"file_meta": {
"content_id": "a7... |
6683e12a-bbaf-4a37-a84c-9b73fbc8d356 | zsmountain/leetcode | c++/add_strings.cpp | /*
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.
Note:
The length of both num1 and num2 is < 5100.
Both num1 and num2 contains only digits 0-9.
Both num1 and num2 does not contain any leading zero.
You must not use any built-in BigInteger library or convert the ... | ALGO | 0.999765 | 7.034079 | {
"github_metadata": {
"branch": "master",
"commit_count": 285,
"repo_created_at": "2014-10-26T02:22:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "77bb9312... |
84b8d2c5-bb32-453c-b7cb-7e736e601a61 | stonne-simulator/stonne | pytorch-frontend/aten/src/ATen/native/CPUBlas.cpp | #include <ATen/native/CPUBlas.h>
#include <ATen/Config.h>
#include <climits>
#if AT_BUILD_WITH_BLAS()
extern "C" void dgemm_(char *transa, char *transb, int *m, int *n, int *k, double *alpha, const double *a, int *lda, const double *b, int *ldb, double *beta, double *c, int *ldc);
extern "C" void sgemm_(char *transa,... | TOOL | 0.912234 | 6.775416 | {
"github_metadata": {
"branch": "master",
"commit_count": 90,
"repo_created_at": "2020-12-01T17:24:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 134,
"forks": 30,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "315a65... |
9bcb476f-e693-4ab9-9c40-8e1de278b898 | ayushpareek179/CPP-course | Part_Fifteen/Exercise#12.cpp | //Student Exercise #12
#include <iostream>
#include <cmath>
#define PI atan(1)*4
using namespace std;
void assign(double param, double* member)
{
if(param >= 0)
*member = param;
else
*member = 0;
}
class shape
{
public:
virtual void area() = 0;
virtual void perimeter() = 0;
};
c... | ALGO | 0.975268 | 4.21591 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2021-05-01T09:58:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd164f889... |
fa392ac7-26da-451f-8492-98d809b1f7d6 | ANARCYPHER/Nuclear-Engineering | Universal-Physics-mod/src/common/String.h | #pragma once
#include "Config.h"
#include <stdexcept>
#include <sstream>
#include <vector>
#include <string>
#include <limits>
#include <locale>
#include <ios>
#include "tpt-minmax.h"
/*
There are two "string" classes: ByteString and String. They have nearly
identical interfaces, except that one stores 8-bit octet... | TOOL | 0.969591 | 6.229327 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2022-03-13T23:37:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b486b732... |
40381577-cd1c-4ead-9107-7ae05a653e5d | adhikarilaxman/Computer-Graphics | House using Bresenham Line Drawing Algorithm/main.cpp | #include <GL/glut.h>
#include <iostream>
using namespace std;
void drawPixel(int x, int y) {
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
}
void init() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 500, 0, 500);
}
void drawline(int x1, int y1, int x2, int ... | ALGO | 0.999961 | 5.328636 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-12-27T07:41:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe4c9dc7eea... |
86dce477-0b9d-4ca1-acda-6bc929c32f12 | Mohammad-Yasfo/ACM_Problems | spoj/ABCDEF.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, n_c=0 ,n_c2= 0;
int num[109];
int couple[2][1000009];
int q1 = 0, q2 = 0;
long long sel = 0, sol = 0;
scanf("%d", &n);
for (int i = 0; i < n; ++i)
scanf("%d", &num[i]);
for (int a = 0; a < n; ++a)
for (int b = 0; b < n; ++b)
... | ALGO | 0.999985 | 3.385082 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-01-13T19:54:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9305165fca... |
4daffaaf-63e8-4e93-b478-40d936836a3c | PoorvKumar/LeetCode | 0113-path-sum-ii/0113-path-sum-ii.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.999982 | 6.061899 | {
"github_metadata": {
"branch": "main",
"commit_count": 2949,
"repo_created_at": "2022-09-10T04:29:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "84b1d2269... |
e08a9b67-b544-49e7-8fda-af8aa3342da5 | sjtly16/learning-ds-algo | stacks/Stock Span Problem.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
//for getting input from input.txt
freopen("input.txt", "r", stdin);
//for writting output to output.txt
freopen("output.txt", "w", stdout);
#endif
int arr[] = {100, 80, 60, 70, 60, 75, 85};
stack<pair<int, int>> s... | ALGO | 0.999929 | 3.637117 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2020-07-15T13:30:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a9a00db5... |
abc13e24-337c-4855-a10f-dffa107a0b24 | 1ambd4/leetcode | 0605.can_place_flowers.cpp | #include <iostream>
#include <vector>
#include "leetcode.h"
using std::vector;
bool can_place_flowers(vector<int>& f, int n)
{
int m = f.size();
for (int i = 0; i < m && n > 0; ) {
// 因为不能有两朵相邻的花,所以遇到花就跳两格
if (f[i] == 1) {
i += 2;
} else if (i == m - 1 || f[i+1] == 0) {
... | ALGO | 0.999997 | 4.839369 | {
"github_metadata": {
"branch": "main",
"commit_count": 155,
"repo_created_at": "2023-09-05T01:57:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "805fd6e035... |
46e8d5ca-2575-4ce8-8bcb-689100b8135f | ishandutta2007/codeforces-b | brunovsky/normal/1609/C.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "code/formatting.hpp"
#else
#define debug(...) (void)0
#endif
using namespace std;
vector<int> primes, lp, nxt;
auto least_prime_sieve(int N) {
lp.assign(N + 1, 0), nxt.assign(N + 1, 0);
nxt[1] = 1;
for (int P = 0, n = 2; n <= N; n++) {
if (lp[n] ==... | ALGO | 0.999896 | 4.725907 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8212d57c360c... |
846e5930-52a6-48f3-b156-f35778b9dd03 | lifecrazy/leetcode | leetcode118.cpp | /*************************************************************************
> File Name: leetcode118.cpp
> Author:
> Mail:
> Created Time: Wed 13 Jul 2016 05:46:26 PM PDT
************************************************************************/
#include<iostream>
#include<vector>
using namespace std;
//思路:1.确定边界问题,当n... | ALGO | 0.999934 | 4.743546 | {
"github_metadata": {
"branch": "master",
"commit_count": 283,
"repo_created_at": "2016-07-06T12:32:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2ad778e... |
94800f19-e43b-486c-bc8e-021e5642657c | JeffersonLab/sim-recon | src/libraries/include/DMatrix2x3.h | #include <align_16.h>
#ifndef USE_SSE2
// Matrix class without SIMD instructions
class DMatrix2x3{
public:
DMatrix2x3(){
for (unsigned int i=0;i<2;i++){
for (unsigned int j=0;j<3;j++){
mA[i][j]=0.;
}
}
}
DMatrix2x3(double c11, double c12, double c13,
double c21, double c22, double c2... | TOOL | 0.90867 | 5.394907 | {
"github_metadata": {
"branch": "master",
"commit_count": 8343,
"repo_created_at": "2015-07-16T04:35:19.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9,
"forks": 14,
"issues": 8,
"pull_requests": 0
},
"file_meta": {
"content_id": "d9d8794... |
998a25f9-063c-4b73-971c-f9ecd207c197 | FahadHasan8386/oNline_problem_solving | cf1873A.cpp | #include <bits/stdc++.h>
using namespace std ;
bool same(string s)
{
if(s == "abc")
{
return true ;
}
if(s[0] == 'a' && s[1] == 'b' && s[2] == 'c'){
return true;
}
else if(s[0] =='b' && s[1] == 'a' && s[2] =='c')
{
return true;
}
else if(s[0] =='a' && s[1] ... | ALGO | 0.999971 | 4.029469 | {
"github_metadata": {
"branch": "main",
"commit_count": 265,
"repo_created_at": "2023-05-17T10:10:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0bc308ccd4... |
00916ab4-cfd8-440e-a9e6-5a6214292025 | cuiwenyao/data-structure | tree/BRTree/BRTree.cpp | #include "BRTree.h"
BRTree init(BRTree tree)
{
return NULL;
}
BRTree create_node(int key = -1, BRTree parent = NULL, BRTree left = NULL, BRTree right = NULL, enum COLOR color = RED)
{
BRTree tree = (BRTree)malloc(sizeof(struct BRTREE));
tree->color = color;
tree->key = key;
tree->left = left;
... | ALGO | 0.999764 | 3.453672 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2021-07-28T13:45:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d8dfbd1b2... |
30b72041-fd7b-4071-9c30-811705a24861 | Rajveer-CSE-27/Coding-Journey-CPP | Graph/William Fiset Graph Theory/18_3_indexed_priority_queue.cpp |
//.....................................MIN Indexed Priority Queue.................................
#include <cstdio>
/*
* Indexed min priority queue
* Supports insertion in O(log N), deletion of any key (regardless of whether
* the key is the minimum key or not) in O(log N) and changes to key values
* in O(log N... | ALGO | 0.999788 | 4.133932 | {
"github_metadata": {
"branch": "main",
"commit_count": 673,
"repo_created_at": "2023-07-25T11:08:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfcc2f4874... |
eb04b8fa-48c8-468c-b5d9-4e9c44a3a001 | vedashree1028/DSA | heap.cpp | #include<iostream>
using namespace std;
void max_heapify(int a[] , int n , int i);
void min_heapify(int a[] , int n , int i);
void delete_max_heapify(int a[] , int n, int i );
void delete_min_heapify(int a[] , int n, int i );
void max_insert(int a[] , int &n , int key){
n=n+1;
a[n-1]=key;
max_heapify(a , ... | ALGO | 0.998931 | 3.861566 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-08-20T16:35:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb9b09d3cb9... |
1c53422c-da27-47cf-8a99-56909bfcda94 | farleyrai/TADS-SEGUNDO-PERIODO | 2-periodo/Algoritmos-2-Periodo/Listas/exer-ava-n2.cpp | #include <iostream>
using namespace std;
struct No
{
int valor;
No *proximo;
No *anterior;
};
struct dupla
{
No *primeiroNo;
void criar();
void menu();
void inserir(int valor);
void imprimir();
void ultimo();
void ordenar();
};
void dupla ::criar()
{
primeiroNo = NULL;
}
void dupla::inserir(int va... | ALGO | 0.99979 | 3.819288 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-03-30T13:25:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bd0cd9f1d0e2... |
71ec01a8-a0f4-40b2-992d-bf2df3dd7240 | maspypy/library | test/3_yukicoder/1548.test.cpp | #define PROBLEM "https://yukicoder.me/problems/no/1548"
#include "my_template.hpp"
#include "other/io.hpp"
#include "mod/modint.hpp"
#include "ds/segtree/lazy_segtree.hpp"
#include "alg/acted_monoid/powersums_assign.hpp"
using mint = modint998;
void solve() {
LL(N);
using Mono = Monoid_Add_Array<mint, 5>;
using... | ALGO | 0.998619 | 5.68188 | {
"github_metadata": {
"branch": "main",
"commit_count": 10525,
"repo_created_at": "2022-04-15T18:55:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 92,
"forks": 11,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "aee52a... |
50e3ab12-ce75-4edd-8c72-18e4d5da2937 | ShrishtiAgarwal/LeetCode-questions | merge-two-sorted-lists/merge-two-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.999981 | 5.841469 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2020-12-05T10:33:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf2f7b8b10b... |
4a72e244-80f0-4c1a-b023-ca221938df19 | vinay-y/Scilab-Image-Processing-Toolbox | sci_gateway/cpp/opencv_fsamp2.cpp | /********************************************************
Author: Vinay
Function: ind2gray(image, colormap)
********************************************************/
#include <numeric>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
#include <iostream>
#include <c... | ALGO | 0.965274 | 4.232059 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2015-12-02T06:56:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "13d83c684... |
07415e7c-5689-4526-820d-be1e652aba29 | bigstar96/StudyMySelf2 | StudyMySelf2/LinkedList.cpp | #include <iostream>
#include "LinkedList.h"
Monster* CreatMonster(MonsterList& list, const char* name, const int hp)
{
Monster* pNew = new Monster;
strcpy_s(pNew->name, NAME_LENGTH, name);
pNew->hp = hp;
pNew->pNext = nullptr;
if (list.pTail == nullptr)
{
list.pHead = pNew;
list.pTail = pNew;
}
else
{
... | TOOL | 0.997257 | 4.602883 | {
"github_metadata": {
"branch": "master",
"commit_count": 132,
"repo_created_at": "2022-12-30T14:09:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "983dc783... |
9a7ace92-a443-4b93-aac9-3b897780ff76 | shobhitguptavmc/GeeksForGeeks-5 | infixToPostfix.cpp | #include<iostream>
#include<stack>
#include<string>
#include<cctype>
using namespace std;
bool isOperator(char ch){
if(ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^')
return true;
return false;
}
//return the precedence of operator, + -: 1, * / : 2, ^: 3
int precedence(char ch){
switch(ch){
... | ALGO | 0.999919 | 4.386478 | {
"github_metadata": {
"branch": "master",
"commit_count": 29,
"repo_created_at": "2015-06-23T23:41:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e2750535... |
53d3eccb-3b3a-478f-be1b-6e3a7f04303c | hmazhar/physbam_public | PhysBAM_Tools/Grids_Dyadic/DYADIC_GRID_ITERATOR_CELL.h | //#####################################################################
// Copyright 2005, <NAME>, <NAME>.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Cl... | ALGO | 0.959895 | 6.495344 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2014-04-02T21:48:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 30,
"forks": 13,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "526e8b0... |
a3535713-323d-4428-a018-70dfbd074f27 | adityaprkshiitp/CP | cfa.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
int main(){
#ifndef ONLINE_JUDGE
freopen("error.txt", "w", stderr);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t; cin >> t;
while(t--){
int n; cin >> n;
... | ALGO | 0.999926 | 3.604041 | {
"github_metadata": {
"branch": "main",
"commit_count": 43,
"repo_created_at": "2023-04-04T17:09:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8f90a2810b... |
3e43b18b-65bc-4323-b049-04e4da1690b4 | mohamedGamalAbuGalala/Practice | Train/summer 2017/Randomly/cf/448.B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<int, int> ii;
void file() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
}
bool in(lli &x) {
// return scanf("%lf", &x); // double
// return scanf("%d", &x); // int
return scanf("%lld", &x); ... | ALGO | 0.99995 | 3.418698 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2017-11-24T03:37:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe4876758... |
c5099c6b-5198-4fca-9f76-01551e5bc2fd | k-kmw/algorithm | C++/정렬/7795-1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) {
int n, m;
cin >> n >> m;
vector<pair<int, int>> vec(n+m);
for(int i=0; i<n; i++) {
int x;
cin >> x;
... | ALGO | 0.999954 | 3.273969 | {
"github_metadata": {
"branch": "main",
"commit_count": 268,
"repo_created_at": "2023-01-13T00:55:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98205f14bf... |
d8c94d45-ad3d-4391-8d08-9b7af214b7c0 | nileshsah/Algorithms | BTCD1501.cpp | #include <bits/stdc++.h>
#define ll long long
#define get(a) scanf("%lld", &a);
#define rep(n) for( ll i = 1; i <= n; i++ )
#define repVector(v) for( typeof(v.begin()) it = v.begin(); it != v.end(); it++ )
#define repSet(s) for( typeof(s.begin()) it = s.begin(); it != s.end(); it++ )
#define all(c) c.begin(), c.end()
... | ALGO | 0.999984 | 3.456441 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2015-02-17T10:07:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4b08980d... |
b0f41b9f-7913-4dad-b7b0-51178def1cb9 | boozec/unict | Year_1/Programming_2/exercises/pop-stack.cc | #include<iostream>
#include<fstream>
using namespace std;
template<class T>
class node {
public:
node(T key, node<T>* next) : _key{key}, _next{next} {}
node(T key) : _key{key}, _next{nullptr} {}
const T& key() const { return _key; }
T& key() { return _key; }
const node<T>*& next() const { return _... | ALGO | 0.990821 | 4.157916 | {
"github_metadata": {
"branch": "master",
"commit_count": 235,
"repo_created_at": "2019-10-08T07:54:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7fae57b5... |
f1c05d77-84b1-432b-9ece-edb5e9a64567 | Ziruiwang409/CS225-FA2021-Final_Project | ziruiw3-weixuan6-hua13-zixuanl9/dsets.cpp | #include "dsets.h"
#include <iostream>
#include <vector>
void DisjointSets::addelements(int num) {
for (int i = 0; i < num; i++) {
data_.push_back(-1);
}
}
int DisjointSets::find(int elem) {
if (data_[elem] < 0) {
return elem;
} else {
int root = find(data_[elem]);
data... | ALGO | 0.985403 | 4.198927 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-09-18T16:59:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe9f8d4e709c... |
e793545c-16b6-40f8-87cf-269ef0382e13 | TosakaUCW/CompetitiveProgramming | Codeforces/Contest/Div2 990 2047/B - Replace Character.cpp | #include <bits/stdc++.h>
using i64 = long long;
#define int i64
#define pb push_back
#define ep emplace
#define eb emplace_back
using std::cerr;
using std::max, std::min, std::swap, std::array;
using std::cin, std::cout, std::string, std::vector;
int read(int x = 0, int f = 0, char ch = getchar()) {
while (ch < 48 ... | ALGO | 0.999964 | 4.128132 | {
"github_metadata": {
"branch": "master",
"commit_count": 506,
"repo_created_at": "2018-09-23T04:02:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a40b1d3... |
ca748124-1e60-436b-8bba-153212176f50 | Kennyarlexy/Competitive-Programming | PROBLEMS/UVA/UVA_10534/main.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int A[10005];
int I[10005];
int D[10005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while (cin >> n) {
for (int i = 1; i <= n; i++) {
cin >> A[i];
}
vector<int> V;
for (i... | ALGO | 0.999759 | 3.909655 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2024-08-12T09:13:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac3249d9520... |
a634359e-8d33-4f0f-a621-920647c825fc | kitchell/deformetrica_code | src/support/probability_distributions/NormalDistribution.h | /***************************************************************************************
* *
* Deformetrica *
* ... | ALGO | 0.985955 | 6.023817 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-09-25T14:25:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "869b07bb27... |
83864d52-c0dc-4123-8fe7-71333b0f8d32 | i-am-chitti/Coding-Hour | Competitive Programming/lighthouse.cpp | /*
Author : <NAME>
UID: 18BCS2295
*/
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
void calculateLeftSpan(ll A[], ll n, ll ans[])
{
ans[0] = 0;
// Calculate span values for rest of the elements
for (int i = 1; i < n; i++) {
int counter = 0;
... | ALGO | 0.999965 | 4.792902 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2021-02-21T15:31:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "17244fe07c4... |
b5e5c3bf-cf46-4037-8bd2-a6d10a93099b | ishandutta2007/codeforces-nonalphabetic | 4fecta/normal/1248/D1.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;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define ld long double
#define pii pair<int... | ALGO | 0.999952 | 3.374031 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:49:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "de5af9ab5d62... |
bf8b2765-3085-4c9c-a33d-3b74236d8024 | harshsharma78/data-structures-and-algorithms | Stack & Queue/infixtoprefix.cpp | #include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
int prece(char c)
{
if (c == '^')
{
return 3;
}
else if (c == '/' or c == '*')
{
return 2;
}
else if (c == '+' or c == '-')
{
return 1;
}
else
{
return 0;
}
}
st... | ALGO | 0.99982 | 4.552618 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2022-08-21T10:47:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "706f0d68c... |
02971701-795a-4538-810f-280fbff6bf4a | yubinbai/leetcode | src/design_snake_game/main.cpp | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
class SnakeGame {
public:
SnakeGame(int width, int height, vector<... | ALGO | 0.999891 | 5.221004 | {
"github_metadata": {
"branch": "master",
"commit_count": 686,
"repo_created_at": "2013-05-08T18:43:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 130,
"forks": 73,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "31135... |
c7686344-f5d0-465e-a424-15f3106a526a | rlawns1016/Algorithm_HW | 알고리즘PHW_05/알고리즘PHW_05/s131540_HW05.cpp | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MINIMUM(a,b)(a<b ? a:b)
void Edit_Distance (
// inputs
char *SS, // Source string array
char *TS, // Edited string array
int ins_cost, int del_cost, int sub_cost,
// insertion, deletion, substitution cost
// outputs
int **Table, // Cost ... | ALGO | 0.999894 | 3.161613 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-05-29T07:43:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c5d96ccd13... |
bfa788e1-a8f7-4543-a46b-7c0553b34f85 | neetcode-gh/leetcode | cpp/0877-stone-game.cpp | /*
Alice and Bob play a game with piles of stones. There are an even number of piles arranged
in a row, and each pile has a positive integer number of stones piles[i].
The objective of the game is to end with the most stones. The total number of stones across
all the piles is odd, so there are no ties.
Al... | ALGO | 0.999947 | 5.458469 | {
"github_metadata": {
"branch": "main",
"commit_count": 9682,
"repo_created_at": "2021-01-20T16:10:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6062,
"forks": 2417,
"issues": 330,
"pull_requests": 215
},
"file_meta": {
"content_id": ... |
7d63b777-8151-4001-8b37-65423d20968f | FancyCodeMaster/NCIT-SEM-III | DSA/Queue/Linear Queue/Linear Queue Algorithm Implementation/linear-queue-algorithm.cpp | #include <iostream.>
using namespace std;
#define maxi 3
int arr[15];
int Rear = -1;
int Front = -1;
int quit = 0;
void enqueue();
void dequeue();
void showQueue();
int main(){
int choice;
while(quit != 1){
cout<<endl<<"Following are your choices : "<<endl;
cout<<"1. Enqueue()"<<endl;
... | ALGO | 0.990543 | 4.076097 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2021-11-29T13:59:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b864ee2d07ed... |
bcf91cc3-9d9a-47cb-b732-7667e3451920 | ishandutta2007/codeforces-e | eecs/normal/1661/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200010;
int n, a[maxn];
ll m;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
scanf("%lld", &m);
auto F = [&](int x, int y) {
int z = x / (y + 1), r = x % (y + 1)... | ALGO | 0.999954 | 3.461255 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:34:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "568297fd9bd5... |
c4982e0d-1f21-42dc-8a08-ff6be1f70662 | ishandutta2007/codeforces-nonalphabetic | 2222/normal/73/D.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <complex>
#include <numeric>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <queue>
#include <cmath>
#include <map>
#include <set>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define sz(a) int((a... | ALGO | 0.99992 | 3.296055 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:49:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e0a03f17c288... |
a765e386-0e8b-49eb-82bc-a7e5c811d8b7 | nitinkaplas123/Galgotias_Batch-DSA | 29_may_heap/2)kth_smallest_element.cpp | https://www.geeksforgeeks.org/problems/kth-smallest-element5635/1
Solution 1-:
Steps-:
1)Using max_heap
2)Make a heap of size k
3)now traverse a loop from k to n-1 if pq.top()>arr[i] then remove the top element and push that arr[i]
4)At last we have kth smallest element at top of k size heap.
Code-: Time->O(nlog(k)... | ALGO | 0.999993 | 6.198209 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-08-06T11:13:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfd4864cd8be... |
b6880059-7c32-43b3-b172-0f52cbcfb9a4 | emilyju0314/gpt_code_plagiarism | dataset/code_content_classifier/ai_code/train/0_0_5211.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int countSticksOn(string s) {
int count = 0;
for(char c : s) {
if(c == '1') {
count++;
}
}
return count;
}
bool canAchieveNumber(vector<string>& digits, string target, int k) {
vector<vector<i... | ALGO | 0.999863 | 4.495357 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-04-28T03:59:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf56b54274b... |
d387dcbf-63cc-4bd5-9bd8-df58b091ba6b | taskflow/taskflow | benchmarks/graph_pipeline/gold.cpp | #include "levelgraph.hpp"
#include <fstream>
int pipe_helper(
LevelGraph& graph,
const int uid,
const size_t level,
const size_t index,
const int count) {
int retval = 0;
for (int i = 0; i < count; ++i) {
//retval = work(uid + retval);
retval = work(uid);
graph.node_at(level, index).set_val... | ALGO | 0.9517 | 4.022416 | {
"github_metadata": {
"branch": "master",
"commit_count": 2551,
"repo_created_at": "2018-04-18T13:45:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 11046,
"forks": 1291,
"issues": 12,
"pull_requests": 6
},
"file_meta": {
"content_id": "... |
89de03ef-937e-4e1e-9c0d-4612975d7c37 | kvantetore/PyProp | extern/blitz/source/blitz/vecproduct.cc | /*
* $Id: vecproduct.cc,v 1.1 2007/09/06 00:51:45 julianc Exp $
*
* Copyright (C) 1997 <NAME> <<EMAIL>>
* All rights reserved. Please see <blitz/blitz.h> for terms and
* conditions of use.
*
*/
#ifndef BZ_VECPRODUCT_CC
#define BZ_VECPRODUCT_CC
#ifndef BZ_VECGLOBS_H
#error <blitz/vecproduct.cc> must be includ... | ALGO | 0.995092 | 6.436301 | {
"github_metadata": {
"branch": "master",
"commit_count": 779,
"repo_created_at": "2010-01-07T08:38:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 16,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a3709d3... |
9972c8a6-e78f-4d22-a000-184b35404749 | yanglr/leetcode-ac | cpp-leetcode/leetcode189-rotate-array_reverse_solution1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
int shift = k % n;
// 翻转前 n - shift 个数.
// Index i (0 <= i < n - shift) 会变成 n - shift - i.
reverse(nums.begi... | ALGO | 0.999966 | 6.146076 | {
"github_metadata": {
"branch": "master",
"commit_count": 644,
"repo_created_at": "2016-04-23T08:14:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 130,
"forks": 135,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5909... |
b955cc48-42a3-4b7b-9487-4793182bc0c4 | gnoynait/homework | parallel/3/CG.cpp | #include<iostream>
#include<fstream>
#include<cstdlib>
#include<cmath>
using namespace std;
int N;
inline double dot(double *a, double *b) {
double r = 0.0;
for (int i = 0; i < N; i++) {
r += a[i] * b[i];
}
return r;
}
int main (int argc, char *argv[]) {
double *x, *b, **A, *Ap, *r, *p;
... | ALGO | 0.99971 | 3.434768 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2013-10-24T14:11:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "04a728d33... |
225e6bef-311e-4c80-9615-baf9d41648ab | 3DPIT/study | 02.studyData/10.Algorithm/2022/11/1105/AlgorithmStudy/AlgorithmStudy/10828_스택.cpp | #include<stdio.h>
#include<iostream>
#include<stack>
#include<string>
using namespace std;
stack<int>s;
void push(int X) {
s.push(X);
}
void pop() {
if (s.empty()) {
cout << -1 << endl;
}
else {
cout << s.top() << endl;
s.pop();
}
}
void size() {
cout << s.size() << endl;
}
void empty() {
if (s.empty()... | ALGO | 0.998405 | 3.962873 | {
"github_metadata": {
"branch": "master",
"commit_count": 1097,
"repo_created_at": "2019-10-31T10:47:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4cb9872... |
42214185-339e-4f8d-b462-b3f4659ab869 | ishandutta2007/codeforces-e | endagorion/normal/506/E.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define... | ALGO | 0.99997 | 4.304909 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:34:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "186aed3d975f... |
52f400d4-f02c-4fa3-9bb5-1f1a0ce3bb03 | ishandutta2007/codeforces-nonalphabetic | 666sb666/normal/776/D.cpp | #include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define gc getchar ( )
const int N=200100;
int n , m , fa ... | ALGO | 0.999969 | 4.024061 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:49:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7abf1ce7a050... |
cbcaf172-b1b9-4f70-aa4e-0fad288ddaaa | liuyaqiu/LeetCode-Solution | 553-Optimal-Division.cpp | #include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
template<typename T> void print(vector<vector<T>>& nums) {
for(auto row: nums) {
for(auto item: row)
cout << item << " ";
cout << endl;
}
cout << endl;
}
#define inf numeric_limits<d... | ALGO | 0.999773 | 4.990318 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2016-11-06T12:48:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8982a4406c... |
2c431760-e5e6-41c3-a923-b252db2cb22b | GabrieleBocchi/unitn-prog1 | esami_esercitazioni/Esame 27-07-2021/soluzioni studenti/217593/2/Attempt1_esercizio2.cc | #include <iostream>
#include <cstdlib>
using namespace std;
int intlen(int n){
if(n == 0){
return 0;
}else{
return 1+intlen(n/10);
}
}
int strlen(char * s){
if(*s == '\0'){
return 0;
}else{
return 1+strlen(s+1);
}
}
void get_digits(int n, char* s, int i){
... | ALGO | 0.999325 | 4.625025 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-01-03T17:06:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "225427c2d2... |
1fea9bb7-6ca9-4840-af6a-3bd8b497f8ff | emakryo/cmpro | src/tenkei90/d003.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
string sep = " ";
if(v.size()) os << v[0];
for(int i=1; i<v.size(); i++) os << sep << v[i];
return os;
}
template<typename T>
istream& operator>>(istream &is, vector<... | ALGO | 0.999571 | 3.740536 | {
"github_metadata": {
"branch": "master",
"commit_count": 264,
"repo_created_at": "2017-01-24T09:57:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "334a27c1... |
2e77ebaf-daea-4908-9557-aad88ec00369 | sandeep77-san/C-and-Cpp | Traning_HItachi_ABB_VS2017/Session1.4/Project_Training1.4/Project_Training1.4/CPP_concepts.cpp | #include <iostream>
#include <memory.h>// for smart pointers
#include <vector>
using namespace std;
// concept 1 - structure declaraion in C and C++
#if 0
struct myStruct {
int x;
// in c we cant define function inside the structure
void fun() { // but in c++ we can declare, this function is member function
}
};... | TOOL | 0.927156 | 3.549823 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2020-12-13T13:57:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "428662ced76d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.