uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ed8b57c2-31b0-43f1-9ea4-e3a15e845525 | Hima0X2/codechef-AtcoderSOLution | B - Tetrahedral Number.cpp | /// BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
long long int lcm(long long int a,long long b)... | ALGO | 0.999775 | 3.606292 |
26c2c614-c0c5-495d-90bb-cdbef77ed339 | guinao/LeetCode | Remove Nth Node From End of List.cpp | struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode *removeNthFromEnd(ListNode *head, int n) {
ListNode *a = head;
ListNode *b = head;
int cnt = 0;
while(NULL != a){
a = a->next;
++cnt;
}
if(cnt == n){
head =... | ALGO | 0.999991 | 5.693052 |
554ec0cf-3825-4da6-bc6f-475d8c07554f | akien-mga/godot-test | thirdparty/glslang/glslang/MachineIndependent/limits.cpp | //
// Do sub tree walks for
// 1) inductive loop bodies to see if the inductive variable is modified
// 2) array-index expressions to see if they are "constant-index-expression"
//
// These are per Appendix A of ES 2.0:
//
// "Within the body of the loop, the loop index is not statically assigned to nor is it used as t... | ALGO | 0.871691 | 8.200626 |
0c66d74a-3e05-4732-99cc-62109bb415b2 | ishandutta2007/codeforces | sert/normal/195/B.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
priority_queue <pair <int, pair<int, int> > > q;
int n, x, m;
int d[100100];
int k[100100];
int main()
{
cin >> m >> n;
for (int i = 0; i < n; i++)
d[i] = -(2 * abs((i * 2) - n + 1) + (i * 2) / n);
fo... | ALGO | 0.999988 | 3.12434 |
f912225e-d1a5-41ad-b506-2253f2877ecb | saurabhraj042/placement-prep | leetcode/backtracking/90.subsets-ii.cpp | // https://leetcode.com/problems/subsets-ii/
class Solution {
public:
vector<vector<int>> subsetsWithDup(vector<int>& a) {
sort(a.begin(),a.end());
vector<vector<int>> ans;
vector<int> temp;
dfs(a,ans,temp,0);
return ans;
}
void dfs(vector<int> &a,vector<vector<i... | ALGO | 0.999635 | 5.808426 |
99a74b68-2d5c-4c00-8bd9-e833c293837d | AndrewKapok/code | luogu/P1046.cpp | #include <cstdio>
int main()
{
int a[10], x;
for (int i = 0; i < 10; i++)
{
scanf("%d", &a[i]);
}
scanf("%d", &x);
x += 30;
int cnt = 0;
for (int i = 0; i < 10; i++)
{
if (a[i] <= x)
{
cnt++;
}
}
printf("%d", cnt);
} | ALGO | 0.999443 | 3.432738 |
b74ddf1e-1610-443a-9f7d-377e1f02b1d7 | ymatevva/FMI-UP | IS/PracticumIS04/5thProblemPracticumIS04.cpp | #include<iostream>
int main()
{
int n;
std::cin >> n;
for (size_t i = 1; i <= n; i++)
{
for (size_t j = 1; j <= i; j++)
{
std::cout << i << " ";
}
}
return 0;
} | ALGO | 0.999514 | 4.151959 |
5c828971-65e5-4283-98a7-9865d81ad0f8 | 7wataaa/atcoder | abc266/a/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
template <class T> using V = std::vector<T>;
template <class T>
std::ostream &operator<<(std::ostream &stream, const vector<T> v) {
for (ll i = 0; i < v.size(); i++) {
stream << v[i];
if (i != v.size() - 1) {
stream << ' ';
}
... | ALGO | 0.999731 | 3.274161 |
9f086752-263b-4100-8440-df29c3872d1c | vfolunin/archives-solutions | MCCME/1681.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int itemCount;
cin >> itemCount;
vector<int> itemWeights(itemCount);
int totalWeig... | ALGO | 0.999917 | 4.12645 |
9274925a-ffa7-441f-ac69-2af703c1475d | realzeroCha/Algorithm_solved | dfs/bfs/baek2178.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
vector<vector<int>> graph;
vector<vector<int>> visited;
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int n, m;
void bfs(int x, int y) {
queue<pair<int, int>> q;
q.push({x,y});
visited[x][y] = 1;
... | ALGO | 0.99992 | 4.994338 |
5781ca1a-b1e0-4c2f-86f5-5114f5fbeeb1 | beknazaarr/OOP | Потоки и файлы/task_9.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
class Frac {
private:
int num, den;
public:
Frac() : num(0), den(1) {}
Frac(int n, int d) : num(n), den(d) {}
friend istream& operator>>(istream& in, Frac& f) {
char slash;
in >> f.num >> slash >> f.den;
if (f.den == ... | TOOL | 0.939096 | 6.001009 |
3f8c6684-399c-47fa-903e-a97b246f3f0f | Areeba1718/godot | thirdparty/icu4c/common/filterednormalizer2.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/edits.h"
#include "unicode/normalizer2.h"
#include "unicode/stringoptions.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cpputils.h"
U_NAMESPACE_BEGIN
FilteredNormalizer2::~FilteredNormalizer... | TOOL | 0.901836 | 7.670245 |
ea7490ff-4710-43c8-9ff9-c1b0d3fcc3e6 | kuldeeprec/codeforces | lex.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
void maxi()
{
ll n,k;
cin>>n>>k;
ll a[n];
for(ll i=0;i<n;i++){
cin>>a[i];
}
for (ll i = 0; i < n; i++)
{
int d=min(k,a[i]);
a[i]-=d;
k=k-d;
a[n-1]+=d... | ALGO | 0.99996 | 3.206688 |
3558a3ce-24cd-4c9b-9a5d-31b499269242 | Tshzzz/OpenTLD_KCF | src/libopentld/tld/EnsembleClassifier.cpp | /*
* EnsembleClassifier.cpp
*
* Created on: Nov 16, 2011
* Author: Georg Nebehay
*/
#include "DetectorCascade.h"
#include <cstdlib>
#include <cmath>
#include <opencv/cv.h>
#include "EnsembleClassifier.h"
using namespace std;
using namespace cv;
namespace tld
{
//TODO: Convert this to a function
#defin... | ALGO | 0.971086 | 5.562009 |
4334f0d2-06d6-4b1f-8924-d014ed4d74c3 | ruiqini/traj-opt-admm | lib/libigl/include/igl/count.cpp | template <typename XType, typename SType>
IGL_INLINE void igl::count(
const Eigen::SparseMatrix<XType>& X,
const int dim,
Eigen::SparseVector<SType>& S)
{
// dim must be 2 or 1
assert(dim == 1 || dim == 2);
// Get size of input
int m = X.rows();
int n = X.cols();
// resize output
if(dim==1)
{
... | ALGO | 0.991323 | 5.326863 |
22e65248-bbf6-441f-b141-c3c1474ad6c2 | lechenyu/TSan-spd3 | compiler-rt/lib/gwp_asan/stack_trace_compressor.cpp | #include "gwp_asan/stack_trace_compressor.h"
namespace gwp_asan {
namespace compression {
namespace {
// Encodes `Value` as a variable-length integer to `Out`. Returns zero if there
// was not enough space in the output buffer to write the complete varInt.
// Otherwise returns the length of the encoded integer.
size_t... | ALGO | 0.886788 | 7.818335 |
0a2d04d0-350f-45f1-a3d5-08d3301da1a1 | 21omkarsase/CP | Codeforces/Practice/900/oddDivisor.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
ll n;cin>>n;
while(n){
if(n%2!=0){
cout<<"YES\n";
return;
}else{
cout<<"NO\n";
return;
}
n/=2;
}
cout<<"NO\n";
}
int main(){
int t;cin>>t;
while(t--)
solve();
return 0;
}
| ALGO | 0.999575 | 4.790217 |
7846151b-87c0-4ed8-8b41-9c455124e090 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10851_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 510;
const int inf = 1e9;
int n, m, a[N], v[N], op, ed;
pair<int, int> e[N][N];
int P(int a, int b) { return a * 2 + b; }
queue<int> q;
int pre[N], dis[N];
bool vis[N];
bool spfa() {
while (!q.empty()) q.pop();
for (int i = 1; i <= ed; ++i) dis[i] = inf, p... | ALGO | 0.99993 | 3.365885 |
924bef64-9421-4bf8-a524-5b26ffa6178e | josblax/ED | 09_Clases_y_Objetos/00_Clase_Alumno/claseAlumno4.cpp | // ConsoleApplication21.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Globales
int numMaterias;
//class
class Materias
{
public:
string materia;
double calificacion;
};
class Alumno
... | TOOL | 0.95655 | 4.062818 |
d889b61b-5fc8-40b0-9d97-718c3793dfc2 | itlezy/eMule-mods-archive | eMule-0.50a-DreaMule_2.12_sources/LastCommonRouteFinder.cpp | #include <algorithm>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
LastCommonRouteFinder::LastCommonRouteFinder() {
minUpload = 1;
maxUpload = _UI32_MAX;
m_upload = _UI32_MAX;
m_CurUpload = 1;
m_iPingToleranceMilliseconds = 200;
m_bUseMillisecondPingTolerance =... | TOOL | 0.98366 | 4.538143 |
c5ae47b1-b458-478f-b712-30fcf95cf415 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/minimize-manhattan-distances-Solution.minimumDistance/177799_Overflow.cpp | _XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorImage head;
XcursorImage *image;
int n;
XcursorPixel *p;
if (!file || !fileHeader)
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, ... | ALGO | 0.977416 | 4.395342 |
13d19910-58a1-481d-ba8c-1e807656b5af | matei-oltean/adventofcode2020 | day21/main.cpp | #include <string>
#include <iostream>
#include <regex>
#include <utils.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
void solution() {
uint64_t res = 0;
string line, list = "";
unordered_map<string, int> nb_present;
unordered_map<string, unordered_set<stri... | ALGO | 0.996168 | 4.643993 |
a0e3460c-4ea9-4132-8e83-9e851ae1eb48 | aleksandraleszczynska/MATURA_INFA_DOM | 2021 marzec/zad2.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
int main()
{
fstream file;
file.open("Dane_2103/galerie.txt");
string country, city, number;
vector <int> vector;
while (file >> country >> city)
{
vector.clear();
for (int i = 0; i < ... | ALGO | 0.983746 | 3.300248 |
4a40e0d4-d215-41ec-8412-c7b4c460531b | Priybhanu99/My-Codes | remove cylce from graph.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int totBackEdges;
int countAdj[MAX], small[MAX];
int isPossible[MAX], depth[MAX];
vector<int> adj[MAX];
int vis[MAX];
void change(pair<int, int>& p, int x)
{
if (p.second > x)
p.second = x;
if (p.first > p.second)
swap(p.fir... | ALGO | 0.999902 | 4.506988 |
21c2cbd5-33ed-4178-adb0-a1a2dd01f2c4 | paarasv/QUESTIONS | 206-reverse-linked-list/reverse-linked-list.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* reverseList... | ALGO | 0.99964 | 5.607882 |
698199a9-c42c-4296-8f63-ec1106518422 | Aditya99880/leetCode | 33-search-in-rotated-sorted-array/search-in-rotated-sorted-array.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int l=0,r=nums.size()-1,mid;
while(l<=r)
{
mid=(l+r)/2;
if(target==nums[mid]){
return mid;
}
if(nums[l]<=nums[mid]){
if(target >= nums[l] && ta... | ALGO | 0.99998 | 6.168324 |
a9ec4db5-3c77-4ded-b416-a3e560905373 | khuda-4th/KHUDA-Algorithm-Study | SangyeongPark/Programmers/Lv0/day3_noEven.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int n)
{
vector<int> answer;
for(int i=0; i<n; i++)
{
if((i+1)%2 != 0)
answer.push_back(i+1);
}
return answer;
} | ALGO | 0.999742 | 4.88729 |
3e56ac7e-21f1-4b75-bb65-5b07e179dab5 | mayankkaushik187/AlgoViser | CP-Solutions/k-LCM1.cpp | // ▒▒▒▒▒▒▒▒▒▒▒▄▄▄▄░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ▒▒▒▒▒▒▒▒▒▄██████▒▒▒▒▒▄▄▄█▄▒▒▒▒▒▒▒▒▒▒
// ▒▒▒▒▒▒▒▄██▀░░▀██▄▒▒▒▒████████▄▒▒▒▒▒▒
// ▒▒▒▒▒▒███░░░░░░██▒▒▒▒▒▒█▀▀▀▀▀██▄▄▒▒▒
// ▒▒▒▒▒▄██▌░░░░░░░██▒▒▒▒▐▌▒▒▒▒▒▒▒▒▀█▄▒
// ▒▒▒▒▒███░░▐█░█▌░██▒▒▒▒█▌▒▒▒▒▒▒▒▒▒▒▀▌
// ▒▒▒▒████░▐█▌░▐█▌██▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒
// ▒▒▒▐████░▐░░░░░▌██▒▒▒█▌▒▒▒▒▒▒▒▒▒▒▒▒▒
... | ALGO | 0.999779 | 4.480864 |
e1ccd4d7-1b1e-40d4-9cef-dca87998185c | AravJain007/DSA-CPP | RECURSIONS/recursionSum.cpp | #include<bits/stdc++.h>
using namespace std;
//this is the recursive function
int Sum(int n){
if(n==0)
return 0;
int prevSum=Sum(n-1);
return(n+prevSum);
}
int main(){
int n;
cin>>n;
cout<<Sum(n);
} | ALGO | 0.999961 | 4.348468 |
b6bf2250-3faf-427b-882f-75d644e54dbd | prasachin/DSA | backtracking/printsubstr.cpp | #include <bits/stdc++.h>
using namespace std;
/* TYPES */
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vll vector<long long>
#define vs vector<string>
#define vvll vector<vector<long long>>
#define vpi vector<pair<int, int>>
#define vpll vector<... | ALGO | 0.999826 | 4.959854 |
9c924f6c-3d0c-4b60-973c-575653f62c52 | Jeesh1702/CPC23 | Week 5/sum of middle elements.cpp | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution {
public:
int findMidSum(int ar1[], int ar2[], int n) {
int i=0,j=0;
while(i<n && j<n && i+j<n-1){
if(ar1[i]>=ar2[j])j++;
else i++;
... | ALGO | 0.999992 | 5.711347 |
01fc0f8f-a679-4c6f-9e74-5db916b81ad2 | angshn/algorithm | plats/poj/2566.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#define ll long long int
#define GETA(buf,size) for(int i=0;i<size;i++) cin>>buf[i];
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define FASTIO \
... | ALGO | 0.999949 | 3.434168 |
976d4470-7c11-4b83-bf56-0f8921d53791 | little-czy/codeup | 12.2/C.cpp | #include <iostream>
#include <string>
using namespace std;
string s, word;
int main()
{
cin >> s;
while (s[0] != '#')
{
cin >> word;
int pos = 0, ans = 0;
while ((pos = s.find(word, pos)) != string::npos)
{
ans++;
pos += word.length();
}
... | ALGO | 0.999338 | 3.545189 |
e26e09fc-1ce9-4da5-a2c1-6012055327c2 | Odenallen/Losing-Chess | ChessBoard.cpp | //
// DD1388 - Lab 4: Losing Chess
//
#include "ChessBoard.h"
#include "King.h"
#include "Queen.h"
#include "Rook.h"
#include "Bishop.h"
#include "Knight.h"
#include "Pawn.h"
#include <typeinfo>
#include <algorithm>
using namespace std;
void ChessBoard::movePiece(ChessMove chess_move) {
// Implementation goes he... | ALGO | 0.857484 | 3.833085 |
17b45032-b25c-4a40-8027-2f32c25e7c00 | GeeKY03/cppcodesolutions | hghdhffdf.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long int> vlli;
#define pb push_back
#define endl '\n'
#define all(x) x.begin(),x.end()
#define ff first
#d... | ALGO | 0.999927 | 3.77411 |
7ae8eba2-4484-45ef-b7de-ff335e82843a | Stenardt-9002/CODECHEF-Datastructure-and-algo | Gfg_list/POTD/2022/August/(16-08-2022)Fact_digit_sum.cpp | // https://practice.geeksforgeeks.org/problems/fact-digit-sum4125/1
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long int ll;
#define DEBUG_var 1
#define fastIO ios_base::sync_with_stdio(false);cin... | ALGO | 0.99956 | 6.367095 |
6aac61c0-831b-4ad8-8308-3354a2f92503 | wasiulhaque/leetcode-solves | 69-sqrtx/69-sqrtx.cpp | class Solution {
public:
int mySqrt(int x) {
long long i = 0;
while (i*i <= x) i++;
return (i-1);
}
}; | ALGO | 0.999853 | 5.328068 |
68730d6f-25ef-4651-b64b-db207365e67d | ishandutta2007/codeforces | ei133333/normal/1252/D.cpp | #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setpre... | ALGO | 0.999337 | 4.075124 |
5eaebdcd-6471-449b-bc56-7ab5a27e7dcc | jotac431/FEUP-AEDA | userhash.cpp | //
// Created by Duarte on 12/12/2020.
//
#include "userhash.h"
template <class U>
int UserHash<U>::hash(std::string nick) const {
nick = lowercase(nick);
int pos;
for(auto ch: nick) {
pos += ch;
}
pos %= table.size();
return pos;
}
template <class U>
int UserHash<U>::hash(int pos) con... | ALGO | 0.953101 | 5.549037 |
725fddfb-5b89-4add-907d-a26c9b1ede2d | arthurabello/dsa-final-project | src/bst/bst.cpp | #include "bst.h"
#include "../tree_utils.h"
#include <vector>
#include <cstring>
namespace TREE::BST {
InsertResult insert(BinaryTree* binary_tree, const std::string& word, int documentId){
InsertResult result;
int comparisons = 0;
Node* newNode = nullptr;
if(binary_tree-... | ALGO | 0.998304 | 6.091358 |
76247192-22e5-4bcc-8ba9-7e8bec7c5815 | wxxcl0825/BlackMamba | thirdParty/assimp/code/AssetLib/IFC/IFCCurve.cpp | /// @file IFCProfile.cpp
/// @brief Read profile and curves entities from IFC files
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
namespace Assimp {
namespace IFC {
namespace {
// --------------------------------------------------------------------------------
// Conic is the base class for Circle and ... | TOOL | 0.896046 | 7.547482 |
60e63c4c-f397-4770-a5f6-24072d761049 | niboukha/leetcode | 187-repeated-dna-sequences/repeated-dna-sequences.cpp | class Solution {
public:
vector<string> findRepeatedDnaSequences(string s)
{
unordered_map<string, int> hash;
vector<string> ans;
string str;
for(int i = 0; i < 10; i++)
str += s[i];
hash[str] += 1;
for(int i = 10; i < s.size(); i... | ALGO | 0.99962 | 4.915148 |
a6ff26f9-f6e0-4dc1-bffe-b37f66f61655 | TaeRaeKim/Backjoon | 백준/1978.cpp | #include <iostream>
using namespace std;
int N, M;
int ans = 0, sosu;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> N;
for (int i = 0; i < N; i++) {
sosu = 0;
cin >> M;
for (int j = 1; j < M; j++) {
if (M % j == 0)sosu++;
}
if (sosu == 1) ans++;
}
cout ... | ALGO | 0.999976 | 4.294132 |
9d4717bb-445f-4d45-8cc1-9492825a2ff5 | MarcoVitoC/compnest | Codeforces/2024/July/OddSelection.cpp | #include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
using namespace std;
void solve() {
int n, x;
cin >> n >> x;
vector<int> a(n);
int cntOdd = 0, cntEven = 0;
for (int &ai: a) {
cin >> ai;
if (ai % 2 == 0) cntEven++;
else cntOdd++;
}
f... | ALGO | 0.99995 | 5.212922 |
c8dad613-92c8-46c3-8075-c7b9631c7933 | m4oughi/100DaysofCode | pureCPP/0036. Day 36/Asynchronous Programming/017. Parallel Algorithms in C++ (stdfor_each, stdtransform, etc., with execution policies)/001. Sequential vs. Parallel stdfor_each/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <execution>
int main() {
std::vector<int> data(10, 1); // Initialize vector with 10 elements, all set to 1
// Sequential execution
std::for_each(std::execution::seq, data.begin(), data.end(), [](int& n) {
n += 1;
});
// ... | ALGO | 0.999909 | 6.082165 |
ec9576aa-1337-4764-9459-290813a57f2c | YordanPetkov/c-contest_trainnings | 2016-2018/trees.cpp | #include<iostream>
#include<cmath>
#include<stack>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int n,used[101],br=0;
pair<int,int> elnivo[30001];
vector<int>a[30001];
void dfs(int k,int br)
{
for(int i=0; i<a[k].size(); i++)
{
if(used[a[k][i]]) continue;
used[a[k][i]]=1;
d... | ALGO | 0.999999 | 3.631451 |
37ad76b8-4764-48fe-9d64-3afb3f2dbde6 | Apress/exploring-c-plus-plus | listings/list1202.cpp | /** @file list1202.cpp */
/** Listing 12-2. Local Variable Definitions */
#include <algorithm>
#include <cassert>
#include <iostream>
#include <iterator>
#include <ostream>
#include <string>
#include <vector>
int main()
{
std::vector<int> data;
data.insert(data.begin(), std::istream_iterator<int>(std::cin),
... | ALGO | 0.999908 | 5.604075 |
cf7d9be9-c47c-47bd-8bd8-4ae84f64e5f1 | sarvex/leetcode-prolog | solution/1800-1899/1836.Remove Duplicates From an Unsorted Linked List/Solution.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* deleteDupli... | ALGO | 0.999989 | 6.04007 |
c9fe8088-723a-48fb-ae32-f3483364be56 | leafeonia/leetcode | C++/code/剑指offer_12.cpp | class Solution {
public:
vector<vector<int>> visited;
string word;
int x_max;
int y_max;
bool dfs(int x, int y, int index, vector<vector<char>>& board){
if (index == word.length()) return true;
if (x < 0 || x >= x_max || y < 0 || y >= y_max) return false;
if (visited[x][y] ==... | ALGO | 0.999812 | 6.076518 |
ca3739f6-f840-4319-97fc-5d12f4c22c9c | syk22/kpro | problems/abc320/b/main2.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for (int i = (a); i < (n); ++i)
int ans = 0;
string S;
int main() {
cin >> S;
REP (i, 0, S.size()) {
REP (j, 1, S.size() + 1) {
string bun = S.substr(i, j);
int flag = 1, bsize = bun.size();
REP (k, 0, bsize / 2) {
... | ALGO | 0.999809 | 4.825352 |
a757fe97-8d52-46aa-89df-8b2a66a33caf | LumaKernel/lib-cpp | src/dynamic-programming/knapsack.cpp | // @import header
// #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// @@
// @ Knapsack
// @snippet knapsack
// @alias napsack
// x : cost
// y : value
// z : limit
// knapsack
// O(min{NW, N \sum {xz}}) < O(N^2 XZ) time
// O(W) space
// knapsack1(<ull>, <ll>, <uint>, uint) {{{
#include <cassert... | ALGO | 0.999783 | 4.380462 |
de1bff68-b4a7-4794-856a-ddd34d7c187d | Erick0825/CSE-165-Labs | CSE 165 lab#4/Problem #2/temp.cpp | #include <iostream>
using namespace std;
int num1;
int num2;
int& ptrAdd(int* a){
int &ref = num2;
ref = *a;
return ref;
}
int main() {
cout<< "Choose the number you want to be the designated pointer : " << endl;
cin>> num1;
num2 = num1++;
cout<< &num1 << "\a" << endl;
co... | ALGO | 0.969583 | 3.446546 |
4443b5bf-fc04-4cb9-9299-5863ef8dbcf3 | Aurora-73/LeetCode | 872E.leafSimilar.cpp | // Created: 2025-07-05
#include "MyTreeNode.h"
#include "MyUtils.hpp"
// #ifdef MY_UTILS_H
/* 872. 叶子相似的树
请考虑一棵二叉树上所有的叶子,这些叶子的值按从左到右的顺序排列形成一个叶值序列。
举个例子,如上图所示,给定一棵叶值序列为(6, 7, 4, 9, 8)的树。
如果有两棵二叉树的叶值序列是相同,那么我们就认为它们是叶相似的。
如果给定的两个根结点分别为root1 和root2的树是叶相似的,则返回true;否则返回 false。
示例 1:
输入:root1 = {3,5,1,6,2,9,8,EMPTY_NODE,EMP... | ALGO | 0.999426 | 5.496318 |
4e9255d5-c608-41df-abfb-cc0f6fc89c8f | tanvirakon/Data-Structure | ds lab mod 4 link list topic 2.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *next;
};
class linklist
{
private:
node *h, *q, *p, *temp;
int n, new_value = 0;
int x;
public:
linklist()
{
h = NULL;
q = NULL;
}
void create()
{
cout << "how many number... | ALGO | 0.999744 | 4.270978 |
b5f12317-5fa0-4f52-9795-785a28f4aa6c | wavescholar/numerical_libraries | itpp/itpp-4.3.1/itpp/base/math/error.cpp | #include <itpp/base/math/error.h>
#include <itpp/base/math/elem_math.h>
#include <itpp/base/itcompat.h>
namespace itpp
{
/*!
* Abramowitz and Stegun: Eq. (7.1.14) gives this continued fraction
* for erfc(z)
*
* erfc(z) = sqrt(pi).exp(-z^2). 1 1/2 1 3/2 2 5/2
* --- --- -... | ALGO | 0.997699 | 6.262566 |
6d8729c9-eab4-4911-81ae-4eb44a88114c | MorshedSazin/codeforces | 2035a.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
#define sf(n) scanf("%d", &n)
#define sff(n,m) scanf("%d%d", &n,&m)
#define sffff(n,m,r,c) scanf("%lld%lld%lld%lld", &n,&m,&r,&c)
#define pnt(n) printf("%d\n", n)
#define pntll(n) printf("%lld\n", n)
#define pnt... | ALGO | 0.999261 | 3.980281 |
c2c619ad-545e-43eb-8f65-1a4ab45661ff | alexandraback/datacollection | solutions_5634947029139456_1/C++/ZEROm/text.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
string a[200],b[200],c[200];
int main()
{
freopen("input.in","r",stdin);
freopen("output.txt","w",stdout);
int t,Case=0;
scanf("%d",&t);
while(t--)
{
int n,l;
scanf("%d%d",&n,&l);
... | ALGO | 0.999823 | 3.284775 |
7280fec8-b948-4c96-bb9f-1ee9e93e3cfb | ishandutta2007/codeforces | noimi/normal/982/A.cpp | #pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i>=b;--i)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb e... | ALGO | 0.999992 | 4.327872 |
b41a8696-b77e-422c-ac62-325fbb90ce89 | Ossww123/Algorithm | 프로그래머스/2/388353. 지게차와 크레인/지게차와 크레인.cpp | #include <string>
#include <vector>
#include <queue>
using namespace std;
int DX[4] = {0, 0, -1, 1};
int DY[4] = {1, -1, 0, 0};
int solution(vector<string> storage, vector<string> requests) {
int N = storage.size();
int M = storage[0].size();
vector<vector<char>> newStorage(N+2, vector<char>(M+2, '-... | ALGO | 0.999362 | 5.881431 |
11121bfb-8c5c-4f46-a628-552dab4e8e4d | amitoj-singh/HackerRank | interview preparation kit/Sorting/mark and toys.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the maximumToys function below.
int maximumToys(vector<int> prices, int k) {
int price_sum = 0, toy_count = 0;
for (int i = 0; i < prices.size()-1; i++) {
for (int j = i+1; j < prices.size(); j++) {
... | ALGO | 0.999908 | 5.434088 |
baf54920-93eb-46b9-8d5c-70b9b67a6c8f | sidrusiya/CP-AlgorithmsSol | duduplicates.cpp | #include<iostream>
using namespace std;
#include<vector>
int dup(vector<int> &A){
bool a[A.size()-1]={0};
for(int i=0;i<A.size();i++){
if(a[A[i]-1]==0){
a[A[i]-1]=1;
}
else
return A[i];
}
return -1;
}
int main(){
vector<int> A={3,1,4,1,4};
cout<<dup(A);
}
| ALGO | 0.999944 | 4.274299 |
a9e20815-65a5-4e96-bfc1-e9d5e0a9c6f7 | avBuffer/caffe_ssd-android-lib | caffe/src/caffe/util/io.cpp | #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <fcntl.h>
#include ... | TOOL | 0.963476 | 7.1029 |
8611bc3b-311d-45ae-8387-20e67fcbeed6 | patricknutt/CPP_Samples | myStack.cpp | #include<iostream>
#include<fstream>
#include"stack.h"
using namespace std;
int main()
{
Stack myStack;
ifstream inData;
char buffChar;
int charCount;
myStack.create();
inData.open("stack.txt");
charCount = 0;
if (!inData)
{
cout ... | ALGO | 0.908323 | 5.037803 |
cba8b42c-2cf4-4ea5-8479-43e600be5003 | phrock/acm | uva/694-The_Collatz_Sequence/1.cpp | #iinclude <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <strin... | ALGO | 0.999803 | 3.667603 |
092ad7bd-ba62-454c-a170-faefd04118b7 | Vishal-Agarwal12/Competitive-programming-codes | Problem_1_Angry_Cows.cpp | #include <bits/stdc++.h>
using namespace std;
char nl = '\n';
char sp = ' ';
using ll = long long;
using vb = vector<bool>;
using vl = vector<ll>;
using vvb = vector<vb>;
using vvl = vector<vl>;
using sl = unordered_set<ll>;
using tsl = set<ll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using mll = map<ll, l... | ALGO | 0.999965 | 5.691031 |
34c02e9a-2f78-4277-89ce-f1b2b9278453 | aeremin/Codeforces | alexey/Solvers/5xx/597/Solver597B.cpp | #include <Solvers/pch.h>
using namespace std;
// Solution for Codeforces problem http://codeforces.com/contest/597/problem/B
class Solver597B
{
public:
void run();
};
void Solver597B::run()
{
int nOrders;
cin >> nOrders;
vector<pair<int, int>> orders(nOrders);
for (auto& p : orders)
cin >... | ALGO | 0.999946 | 5.311473 |
a0ee0e74-cd9f-48b8-a62e-7b5fa0f56081 | abhiram4580/DSA_CODE_BABBAR | stack/Stack_using_two_queues.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct Stack{
queue<int>q1,q2;
int top(){
return q1.front();
}
int size(){
return q1.size();
}
int pop(){
int x=q1.front();
q1.pop();
return x;
}
void Push(int x){
while(q1.empty()==false){
q2.push(q1.fro... | ALGO | 0.995964 | 4.140468 |
c112beff-506f-4def-a806-3661f786e235 | mvancompernolle/ai_project | data/numerical_derivative_example.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4996) // assignment operator could not be generated.
#endif
# include <iostream>
# include <iomanip>
# include <limits>
# include <cmath>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/math/special_functions/next.hpp>... | ALGO | 0.998148 | 7.277137 |
f3d62b0c-3fcb-4104-a11a-e2c1d1e6aaab | pavlovvlad/CarND-MPC-Project | src/Eigen-3.3/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999545 | 5.613888 |
0614799f-b8cc-42d7-a921-8bd9ec7b6df5 | LSBsity/Cpp_Algorithm | 프로그래머스/lv0/120894. 영어가 싫어요/영어가 싫어요.cpp | #include <string>
#include <vector>
using namespace std;
long long solution(string numbers)
{
long long answer = 0;
for (int i = 0; i < numbers.size(); i++)
{
int n = 0;
if (numbers[i] == 'o')
n = 1, i += 2;
else if (numbers[i] == 't')
{
if (numbers... | ALGO | 0.99902 | 4.405552 |
1be919ca-1173-4af0-b8a7-29849b63e1f9 | liuq901/code | ZOJ/z_2334.cpp | #include <cstdio>
#include <cstdlib>
int v[100001],l[100001],r[100001],d[100001],f[100001];
int main()
{
int find(int),merge(int,int);
d[0]=-1;
int n;
while (scanf("%d",&n)!=EOF)
{
for (int i=1;i<=n;i++)
{
scanf("%d",&v[i]);
f[i]=i;
l[i]=r[i]=d[i]=0;
}
i... | ALGO | 0.999989 | 3.679051 |
1edec3cd-2838-4ea8-8d5f-a7b7c2d64ff8 | Werewolflsp/LeetCode | distinct_subsequences.cpp | /*************************************
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by
deleting some (can be none) of the characters without disturbing the relative positions
of the remaining ch... | ALGO | 0.999985 | 6.011192 |
485670f5-70a6-4ff4-9727-6d22f0366320 | heoboseong7/mygit | 2학기실습/TSPdp/소스.cpp | #include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#define inf 1000000000;
using namespace std;
int val[17][17];
int dp[17][1 << 16];
int n;
int go(int state, int now) {
if ((state & 1) && state != (1 << n) - 1)
return inf;
if (state == (1 << n) - 1)
return 0;
int&ret = dp[now][state];... | ALGO | 0.999829 | 3.463892 |
b3dd78e7-f194-47f9-a225-d3b9a029e380 | Ayushkkkkkkk/cpp | multidimensionalprefixSum.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define... | ALGO | 0.999826 | 4.997091 |
41c9bb93-fba0-4f6c-b78d-f3c00717ae78 | jv640/HackerRank | Problem Solving/Cavity Map.cpp | vector<string> cavityMap(vector<string> grid) {
int n = grid.size();
if(n<3)return grid;
vector<string> vect;
vect.push_back(grid[0]);
for( int i = 1;i<n - 1;i++){
string s = "";
s.push_back(grid[i][0]);
for(int j = 1;j<n-1;j++){
if( grid[i][j] > grid[i-1][j] &&
... | ALGO | 0.99993 | 4.773496 |
b2bbd32c-d370-4150-a853-a21489f2eab0 | parth-badhera/cpp-learning | conditionals/NUM-REVERSE.cpp | #include <iostream>
using namespace std;
int main(){
int a;
int b;
retry:
cout<<"Enter num1 -";
cin>>a;
cout<<"Enter num2 - ";
cin>>b;
if(b==0){
cout<<"Cannot divisible by 0";
goto retry;
}else{
cout<<a/b;
}
}
| ALGO | 0.882988 | 3.567261 |
f9ac23a5-1c4a-4fd4-a673-011b41030fb8 | 19Eliza/Algorithm_Data_Structure | Convex_Hull/alg_convex_hull.cpp | #include "alg_convex_hull.h"
namespace convex_hull {
bool cmp(Point p1, Point p2) {
if (p1.getX() < p2.getX()) {
return true;
}
if (p1.getX() > p2.getX()) {
return false;
}
if (p1.getX() == p2.getX() && p1.getY() < p2.getY()) {
return true;
}
if (p1.getX() == p2.getX() && p1.getY() > p2.get... | ALGO | 0.999988 | 5.828228 |
f22e278f-42bb-4fe9-b080-3d7e51fc3a39 | arm/arm-toolchain | llvm/lib/Support/IntervalMap.cpp | #include "llvm/ADT/IntervalMap.h"
#include <cassert>
namespace llvm {
namespace IntervalMapImpl {
void Path::replaceRoot(void *Root, unsigned Size, IdxPair Offsets) {
assert(!path.empty() && "Can't replace missing root");
path.front() = Entry(Root, Size, Offsets.first);
path.insert(path.begin() + 1, Entry(subtr... | ALGO | 0.957019 | 6.228896 |
cb2b348b-08cb-45cf-8927-bb8ba7701d59 | ishandutta2007/codeforces | zscoder/normal/1091/F.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsign... | ALGO | 0.998773 | 3.226135 |
b05b9ffe-1174-4932-9917-8ed32712b440 | TioMinho/CompetitiveProgramming | Roteiros_DCCUFMG/Roteiro3/URI1522.cpp | #include <iostream>
#include <stack>
#include <cstdint>
#include <vector>
using namespace std;
bool canWin(stack<int> p[3])
{
if(p[0].empty() && p[1].empty() && p[2].empty())
return true;
else {
int tops[] = { p[0].empty() ? 0 : p[0].top(),
p[1].empty() ? 0 : p[1].top(),
p[2].empty() ? 0 : p[2].top(... | ALGO | 0.999955 | 4.056104 |
af03a9f6-b402-45b1-b1a7-f08b8527cf74 | InfinityUniverse0/Mathematics_of_Information_Security | Hw01/1-3 算术基本定理.cpp | #include<iostream>
#include<math.h>
using namespace std;
void Eratosthenes(int n, bool*& A) {
//nΪΧ[2,n]A
A = new bool[n + 1]{ false };
for (int i = 2; i <= n; i++)
A[i] = true;//ʼΪtrue
if (n < 4)
return;//ݹ
int n_ = (int)(sqrt(1.0 * n));
bool* A_ = nullptr;
Eratosthenes(n_, A_);
for (int i = 2; i <= n_; i... | ALGO | 0.999528 | 3.580125 |
6102abc9-b464-4257-abcc-4bdc7703c805 | parthsarthiprasad/Competitive_Programming | mustdospeedrun/formpalindrome.cpp | /*
https://practice.geeksforgeeks.org/problems/form-a-palindrome/0
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
string s,k;
cin>>s;
k = s;
reverse(k.begin(), k.end());
/... | ALGO | 0.999866 | 4.997364 |
e92ca11b-f539-4377-a5e0-5182572cc0c0 | rishabh27goel/Daily-Coding-Practice | DSA_Sheet/Trees/Find_sibling_of_node_in_binary_tree.cpp | #include <iostream>
#include <queue>
#include <utility>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
Node* createTree(Node* root){
int data... | ALGO | 0.999992 | 4.756802 |
5bdf06dc-1647-4bd6-9af4-2ccf11cba826 | minttunii/Prog2 | student/02/grading/main.cpp | #include <iostream>
using namespace std;
// Before passing automated tests, do not touch the values of the following
// constants, even if they differ from those you see in Plussa.
// At the end of the course, if you use this program to count your final grade,
// you should update the constants to make them identical... | ALGO | 0.980896 | 4.153776 |
dbcaa5a3-5c2e-4135-99ae-0bbb2b4ff848 | ACM-TOMS/CALGO | 0940/Original-Submission/Nektar/library/Demos/MultiRegions/Deriv3DHomo2D.cpp | #include <cstdio>
#include <cstdlib>
#include <LibUtilities/Memory/NekMemoryManager.hpp>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/Communication/Comm.h>
#include <MultiRegions/ContField3DHomogeneous2D.h>
using namespace Nektar;
int main(int argc, char *argv[])
{
LibUtilities::Sess... | ALGO | 0.992044 | 4.774469 |
e0233198-fd10-4e98-b449-68d76f4fc25b | jiwonchoidd/CodingTest | 2023/Programmers_KeyPad/Programmers_RecommendedNewID.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<vector<int>> board, vector<int> moves) {
int answer = 0;
return answer;
} | ALGO | 0.999164 | 5.170201 |
b506fdcc-f19c-47e9-9c00-1916618bcb8c | godasesandeep/CPP_Programing | Addition.cpp | #include<iostream>
using namespace std;
int main()
{
int no1=0,no2=0;
cout<<"Enter First Number : "<<endl;
cin>>no1;
cout<<"Enter Second Number : "<<endl;
cin>>no2;
cout<<"Addition of number is : "<<(no1+no2)<<endl;
return 0;
} | TOOL | 0.915462 | 3.73739 |
3799b83e-4087-44ba-962e-93fe3e32485d | yoni-kg/Data_Structures | data_structures_/lab_ml/graph.cpp | #include "graph.h"
const Vertex Graph::InvalidVertex = "_CS225INVALIDVERTEX";
const int Graph::InvalidWeight = INT_MIN;
const string Graph:: InvalidLabel = "_CS225INVALIDLABEL";
const Edge Graph::InvalidEdge = Edge(Graph::InvalidVertex, Graph::InvalidVertex, Graph::InvalidWeight, Graph::InvalidLabel);
Graph::Graph(bo... | TOOL | 0.981165 | 6.169985 |
aae11a29-dd5b-4586-93c8-47b976995de4 | Um-ded/problem-solving | Codeforces Codes/778.Prob2039A(Shohag Loves Mod).cpp | ///*/////////////////////////////*///
/// IN THE NAME OF ALMIGHTY ALLAH ///
///*/////////////////////////////*///
///*///////////////*///
/// Author : Um_ded ///
///*///////////////*///
#include <bits/stdc++.h>
#define SS " "
#define endl "\n"
#define EPS 1e-18
#define gcd __gcd
#... | ALGO | 0.999736 | 4.316045 |
e0a45746-8100-4d63-8111-656da14fa298 | itzRaghav14/competitive-programming | templates/data-structures/segment-tree.cpp | // === Segment Tree ===
struct Node;
struct Update;
template <typename T, typename Node = Node, typename Update = Update>
class SegmentTree {
private:
int size = 0;
vector<Node> seg;
void build (int start, int end, int ind, vector<T> &arr) {
if(start == end) {
seg[ind] = Node(arr[start]);
ret... | ALGO | 0.999945 | 5.524928 |
9c64dac8-b193-4a9f-9634-5894eebe7881 | RicardoYam/DataEscrowSystem | attested_tls/server/host/boost_1_85_0/libs/stl_interfaces/example/node_iterator.cpp | #include <algorithm>
#include <array>
#include <iostream>
#include <cassert>
//[ node_defn
template<typename T>
struct node
{
T value_;
node * next_; // == nullptr in the tail node
};
//]
//[ node_iterator_class_head
template<typename T>
struct node_iterator
: boost::stl_interfaces::iterator_interface<
#... | TEST | 0.993128 | 5.517708 |
c405527d-7515-4433-8602-763056fd6303 | sushantphalke/DSandALGOinCPP | HighPerformanceComputing/ParallelQuickSort.cpp | #include <omp.h>
#include <cstdlib>
#include <iostream>
using namespace std;
void quicksort(int *arr, int left, int right);
int partition(int *arr, int left, int right);
void parallel_quicksort(int *arr, int left, int right, int threshold) {
if (left < right) {
if (right - left < threshold) {
quicksort(... | ALGO | 0.999935 | 6.18604 |
6db2414e-66c9-4b52-9280-32d22ecd9f63 | yugd1211/algorithm | baekjoon/17835_3.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define INF 100000000001
// 문제풀이
// 그래프를 역방향으로 바꾼다. (역방향 그래프로 바꿨을때 다익스트라 알고리즘을 실행하면 모든정점에서 해당 정점까지의 최단 거리가 구해진다.)
// 각 정점마다 다익스트라를 호출하면 N * NlogN이기 때문에 시간초과발생
// 다익스트라의 시작정점을 여러개로 두고 다익스트라를 한번만 실행한다.
// 이 결과물은 모든 목표 정점중 제일... | ALGO | 0.999943 | 4.286828 |
86df3c99-a37b-4e89-b07b-59852036b817 | cmottao/CompetitiveProgrammingSolutions | codeforces/B/1772.cpp | // Made by Cristian Motta (cmottao)
#include <bits/stdc++.h>
using namespace std;
void solve() {
vector<int> a(4);
string x = "";
for(int i = 0; i < 4; i++) {
cin >> a[i];
}
swap(a[2], a[3]);
for(int i = 0; i < 4; i++) {
x.push_back((a[i] < a[(i + 1) % 4]) ? '<' : '>')... | ALGO | 0.999898 | 3.934303 |
cee45685-1f1e-4dee-a515-54f3b9abfded | pd-l2ork/pd | externals/tb/sc4pd/source/AllpassC.cpp | #include "sc4pd.hpp"
#include "DelayUnit.hpp"
class AllpassC_ar : public FeedbackDelay_ar
{
FLEXT_HEADER(AllpassC_ar,FeedbackDelay_ar);
AllpassC_ar (int argc, t_atom *argv);
~AllpassC_ar ();
protected:
virtual void m_signal(int n, t_sample *const *in, t_sample *const *out)
{
m_signal_fun(n,i... | ALGO | 0.945513 | 4.762934 |
b3c71e11-e567-4485-877d-9b1eba450bc7 | kabirgoyal26/D-S-A | 2581-divide-players-into-teams-of-equal-skill/2581-divide-players-into-teams-of-equal-skill.cpp | class Solution {
public:
long long dividePlayers(vector<int>& skill) {
const int n = skill.size();
const int teamSkill = accumulate(skill.begin(), skill.end(), 0) / (n / 2);
long ans = 0;
unordered_map<int, int> count;
for (const int s : skill)
++count[s];
for (const auto& [s, freq] :... | ALGO | 0.999887 | 5.969086 |
d3bb9680-bd25-42a0-b650-1abd8ca7e147 | nv259/CS106.N21.KHCL | final-project-suggestions/Electric Vehicle Routing Problems-20230406/SampleCode/main.cpp | #include<iostream>
#include<stdlib.h>
#include<limits.h>
#include "EVRP.hpp"
#include "heuristic.hpp"
#include "stats.hpp"
using namespace std;
/*initialiazes a run for your heuristic*/
void start_run(int r){
srand(r); //random seed
init_evals();
init_current_best();
cout << "Run: " << r << " with random se... | ALGO | 0.99987 | 3.795714 |
fffd3b07-7e44-46b6-947b-bdfc3ef78ead | Tonn1Arm/Toi_Zero_2025 | A2/Toi_Zero_A2-019.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
string str,tmp;
cin >> str;
tmp=str;
transform(str.begin(),str.end(),str.begin(),::toupper);
auto it=str.begin();
int mx=0,mk=0;bool fin=0;
while(it!=str.end()){
if(*i... | ALGO | 0.999937 | 3.696454 |
c313f53e-e34a-431b-aa3d-4885e41bc21e | gerald-yang/iotivity-demo | iotivity-1.0.1/extlibs/boost/boost_1_58_0/libs/graph_parallel/test/distributed_connected_components_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
#include <boost/graph/distributed/connected_components_para... | ALGO | 0.948153 | 6.34248 |
bb002fbb-3c90-4ef1-851a-555fb3c2797c | rare0b/training-atcoder | Daily/202304/20230409_2.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
// https://atcoder.jp/contests/abc133/tasks/abc133_d
int main() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
a[i] *= 2;
}
vect... | ALGO | 0.999963 | 3.84825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.