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 |
|---|---|---|---|---|---|---|---|
d6175777-ac1e-4499-8235-30ee27260aa6 | h-hg/data-structure-and-algorithm | sort/heap-sort/code/heap-sort.hpp | #ifndef _HEAP_SORT_H
#define _HEAP_SORT_H
#include <algorithm>
#include <vector>
template <typename T, typename Compare>
void siftDown(std::vector<T> &arr, int n, int x, Compare &cmp) {
while(!(n/2 <= x && x < n)) /* judge whether x is a leaf*/{
//get the max/min child
int lc = x * 2 + 1, rc = lc + 1; //lc i... | ALGO | 0.99992 | 4.947627 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2020-03-24T12:05:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "db70a7b20... |
3a7ef416-830b-43eb-9d38-54ad9f0a8b3a | apache/nifi-minifi-cpp | extensions/kubernetes/ApiClient.h | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | TOOL | 0.928538 | 5.963511 | {
"github_metadata": {
"branch": "main",
"commit_count": 1899,
"repo_created_at": "2016-04-21T07:00:06.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 158,
"forks": 95,
"issues": 0,
"pull_requests": 17
},
"file_meta": {
"content_id": "bac514... |
fdf1931d-8ab1-432c-b45a-2198b818cbe9 | addiegupta/InterviewBitProblems | Hashing/Longest Substring Without Repeat.cpp | /*
InterviewBit : Longest Substring Without Repeat
Link : https://www.interviewbit.com/problems/longest-substring-without-repeat/
Asked in:
Amazon
Given a string,
find the length of the longest substring without repeating characters.
Example:
The longest substring without repeating letters for "abcabcbb" is "abc... | ALGO | 0.99991 | 4.93804 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2019-02-03T10:35:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4b9efacc... |
cf3c607c-3dfc-451b-8bd7-b476561c9355 | scp020/cp-template | TEST/oj/luogu_p2216.cpp | #include "DS/ZkwTree2D.h"
#include "IO/FastIO.h"
/*
[P2216 [HAOI2007] 理想的正方形](https://www.luogu.com.cn/problem/P2216)
*/
/**
* 本题为二维线段树模板题
*/
struct Pair {
uint32_t min, max;
};
struct MinMaxNode {
using value_type = Pair;
using modify_type = Pair;
static value_type op(const value_type &x, const valu... | ALGO | 0.999784 | 4.068463 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-04-24T06:12: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": "c1e049f4bb25... |
d989aef5-6dd4-46b5-9571-4ef36496eded | matei0tutiu/tema-matrici | tema-patratice/81/81.cpp | #include <iostream>
#include "../../helper.cpp"
using namespace std;
void c_81()
{
size_t n, counter = 0;
std::cin >> n;
int **data = Utils::allocate_matrix<int>(n + 2, n + 2);
Utils::FillMatrix(data, n + 2, n + 2, 0);
for (size_t r = 1; r <= n; r++)
for (size_t c = 1; c <= n; c++)
... | ALGO | 0.999964 | 4.89425 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-07T18:03:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "482380905d42... |
43c25e29-a2ee-47e5-a5f4-3d0da26f7c05 | xjj59307/icpc | usaco/usaco-spin.cpp | /*
ID: xjj_hdl1
PROG: spin
LANG: C++
*/
#include <utility>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
struct Wheel {
int speed;
int count;
pair<int, int> ranges[5];
Wheel() {}
Wheel(int speed_, int count_, pair<int, int>* ranges_) {
speed = speed_;
count = cou... | ALGO | 0.99989 | 4.311623 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2012-08-06T10:28:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "80d8e8fe4... |
40da396d-8e00-4fdd-8adb-1ad697165993 | ma5terdrag0n/Competitive-Programming | Kickstart/2020/Round-A/Workout.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <t... | ALGO | 0.999929 | 3.547836 | {
"github_metadata": {
"branch": "master",
"commit_count": 142,
"repo_created_at": "2018-05-01T04:53:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "69503311... |
1a713fee-4e6a-4c81-ade1-6eeaa655fd49 | anushat-sjce/CPlusPlus | swap.cpp | #include <iostream>
using namespace std;
int sum(int a, int b){
int c = a+ b;
return c;
}
int swap1(int a, int b){
int temp = a;
a = b;
b = temp;
}
int swap2(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
int main(){
int a = 5, b = 10;
cout << "Enter two numbers: ";
... | ALGO | 0.996801 | 4.621837 | {
"github_metadata": {
"branch": "main",
"commit_count": 47,
"repo_created_at": "2025-06-19T05:02: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": "bbfd91e8c94... |
1ebf3bdb-839e-4e7a-8e7a-e9ebefd2c322 | Anup0099/450DSA_Question | out/production/DSA_Babber/Cpp/stl/sorts.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> sortVector(vector<int>v)
{
//Your code here. Use library function
sort(v.begin(),v.end());
return v;
}
vector<int> reverseVector(vector<int>v)
{
//Your code here. Use library function
reverse(v.begin(),v.end());
return v;
}
void sum(vect... | ALGO | 0.999328 | 4.428098 | {
"github_metadata": {
"branch": "main",
"commit_count": 2046,
"repo_created_at": "2021-08-16T08:40: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": "aeb439e24... |
c2e0aa46-cd7c-400f-9b6d-0116de395f85 | kloetzl/mugsy | mugsy-seqan/projects/library/seqan/find/find_score.h | /*==========================================================================
SeqAn - The Library for Sequence Analysis
http://www.seqan.de
============================================================================
Copyright (C) 2007
This library is free software; you ... | ALGO | 0.996916 | 6.228529 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2020-04-02T09:44:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "9c16c58f1... |
15b4a071-1e64-40a8-a385-d327c284d45c | teknoman117/cse179projects | assignment03/utilities.cpp | #include <iostream>
#include "utilities.hpp"
using namespace std;
void PrintGrid(ostream& stream, unsigned char *grid, size_t gridWidth, size_t gridHeight, const char* name)
{
// Generate a random starting grid
stream << name << ":\n------\n";
for(int i = 0; i < gridHeight; i++)
{
for(int j = ... | ALGO | 0.999463 | 5.594238 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2015-02-24T14:19: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": "c367b6e2e... |
b1a1efc5-2743-458f-8724-a3a18ea2f1e3 | trilinos/Trilinos | packages/stokhos/example/simple/pecos_hermite_example.cpp | // @HEADER
// *****************************************************************************
// Stokhos Package
//
// Copyright 2009 NTESS and the Stokhos contributors.
// SPDX-License-Identifier: BSD-3-Clause
// *****************************************************************************
// @... | ALGO | 0.973379 | 6.44058 | {
"github_metadata": {
"branch": "master",
"commit_count": 104031,
"repo_created_at": "2015-11-16T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 593,
"issues": 263,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
ff384944-fd73-4c0a-b94e-c51a06543899 | idiot-kitto/algorithm | BOJ/7511.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
ty... | ALGO | 0.999952 | 4.836046 | {
"github_metadata": {
"branch": "master",
"commit_count": 505,
"repo_created_at": "2020-08-13T09:33: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": "15928aed... |
984ed3e2-3ce0-4475-9d06-e5dd662d094a | snes9xgit/snes9x | win32/render.cpp | /*****************************************************************************\
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
This file is licensed under the Snes9x License.
For further information, consult the LICENSE file in the root directory.
\*************************... | TOOL | 0.952218 | 5.57242 | {
"github_metadata": {
"branch": "master",
"commit_count": 2591,
"repo_created_at": "2010-09-25T18:14:02.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2896,
"forks": 484,
"issues": 186,
"pull_requests": 2
},
"file_meta": {
"content_id": "f... |
e5aae56d-f008-4797-adec-d00295cea84e | Arshjeet-Singh/DSASheet2022 | Graph/Practice/Cycle Detection In Undirected Graph.cpp | //Using both bfs and dfs
#include<bits/stdc++.h>
bool bfs(unordered_map<int,list<int>> &adj,unordered_map<int,bool> &vis,int node)
{
unordered_map<int,int> p;
p[node]=-1;
vis[node]=1;
queue<int> q;
q.push(node);
while(!q.empty())
{
int t=q.front();
q.pop();
for(auto i... | ALGO | 0.999982 | 5.99268 | {
"github_metadata": {
"branch": "main",
"commit_count": 363,
"repo_created_at": "2022-06-10T09:50:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "062f39565e... |
767d8fae-c197-4f98-8e2b-22019e8928d8 | bollig/rbffd_gpu | external/opencl_libraries/include/viennacl/linalg/hankel_matrix_operations.hpp | #ifndef VIENNACL_LINALG_HANKEL_MATRIX_OPERATIONS_HPP_
#define VIENNACL_LINALG_HANKEL_MATRIX_OPERATIONS_HPP_
/* =========================================================================
Copyright (c) 2010-2013, Institute for Microelectronics,
Institute for Analysis and Scientific Computin... | ALGO | 0.998058 | 6.694767 | {
"github_metadata": {
"branch": "master",
"commit_count": 1464,
"repo_created_at": "2012-01-27T23:08:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 12,
"pull_requests": 0
},
"file_meta": {
"content_id": "e703e0... |
c0d686bc-6ecc-42ac-bfce-ec05a4e15d64 | chinhhi102/GiaiThuat | kattis/String/Genetic Search.cpp | #include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <list>
#include <ctype.h>
#include <stack>
#include <itera... | ALGO | 0.998985 | 3.49466 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2019-12-01T05:23:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "24033a2719... |
d6fd2755-a3ad-4eec-bd2a-eef296b6c09b | SongHayoung/LeetCode | 437-path-sum-iii/437-path-sum-iii.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.99999 | 5.682321 | {
"github_metadata": {
"branch": "master",
"commit_count": 13354,
"repo_created_at": "2021-01-06T12:46:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a8161... |
b3095313-f9ab-45e3-9489-019bdc724b72 | vzsky/competitive | Codeforces/contest/2013f1.cpp | #include<bits/stdc++.h>
#include <queue>
using namespace std;
#define max(x, y) (x>y?x:y)
vector<int> g[200100];
int from[200100];
int path[200100];
void dfs (int u, int v) {
from[u] = v;
for (auto x: g[u]) {
if (x == v) continue;
dfs(x, u);
}
}
long long dfs2 (int u, int v) {
long long now = 0;
f... | ALGO | 0.999952 | 3.773777 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2021-01-12T13:52:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "326643513fa... |
cd49e8ba-5e88-4876-bbf3-f312835cfb25 | bichsonnhat/Algorithms | Algo/CP/DREAM.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
const int N = 1e5 + 5;
int n, k, m;
ii a[N];
bool cmp(ii x, ii y) {
if (x.first == y.first)
return x.second < y.second;
return x.first < y.first;
}
int main() {
ios::sync_with_stdio(0);
// freopen("DREAM.INP","r",stdin... | ALGO | 0.999952 | 3.767807 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-12-19T02:23: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": "ff77b7ccba57... |
921bc752-beb8-4877-97d5-15734530d8fa | AlexGliesch/critical-coloring | src/color.cpp | /*
* A new heuristic for finding verifiable k-vertex-critical subgraphs
*
* Copyright (c) 2022 <NAME>, <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, includin... | ALGO | 0.997547 | 4.756074 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2022-04-26T19:02:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d9190ffc3... |
38df9fd7-5165-4b3c-93cf-e6648ac7f4df | evan-hossain-zz/competitive-programming | contests/Others/cf_160_C.cpp |
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cs... | ALGO | 0.999975 | 3.112396 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2017-06-02T09:04:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "83f346b70... |
b1114f1c-e6f9-42a8-930c-d403986e399a | ianloic/unladen-swallow | Util/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp | //===--- CompilerInvocation.cpp -------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | TOOL | 0.979356 | 5.774287 | {
"github_metadata": {
"branch": "llvm-re",
"commit_count": 443,
"repo_created_at": "2009-08-18T18:14:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7b522e... |
59f10d67-56a1-466a-8580-2cba35d0443a | veg/tn93 | src/fasta_digest.cpp |
#include "tn93_shared.h"
#include "argparse_fasta_digest.hpp"
#include <map>
#include <list>
#include <string>
using namespace std;
using namespace argparse;
Vector* patterns[13] = {NULL};
// bit masks for
const unsigned long masks [16] = {
0b00000000000000000000000000000011,
0b00000000000000000000000000001... | ALGO | 0.982934 | 4.561359 | {
"github_metadata": {
"branch": "master",
"commit_count": 212,
"repo_created_at": "2014-06-12T19:06:35.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 18,
"forks": 7,
"issues": 10,
"pull_requests": 1
},
"file_meta": {
"content_id": "6d66cdf... |
2d0959d3-e808-4610-9188-7128f92d2b8d | woodart8/Learning-Algorithm-CPP | 9328.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //-2^63 ~ 2^63-1
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;... | ALGO | 0.999657 | 3.981888 | {
"github_metadata": {
"branch": "main",
"commit_count": 148,
"repo_created_at": "2023-12-11T12:31: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": "e76c260e2e... |
79d769f1-3e0a-413d-b85d-32aab8dc76a7 | Naotchi/AtCoder | m-solutions2020/a/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a >... | ALGO | 0.998936 | 3.196954 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-07-26T08:34: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": "b43c6c4d92... |
340992d5-e014-44d1-b25a-99db0543ae9c | auto3181/robo_competition | task1/task1.ino | #define M1_DIR 4
#define M1_PWM 5
#define M2_DIR 7
#define M2_PWM 6
#define LS A0
#define RS A1
#define BUZ 8
#define BLACK_LEVEL_LOW 700
#define BLACK_LEVEL_HIGH 950
#define WHITE_LEVEL_LOW 500
#define WHITE_LEVEL_HIGH 580
int t1 = 1330;
int t2 = 8030 + 800;
int t3 = 2560;
int t4 = 1100;
int t5 = 2010;
int x_time = 0... | TOOL | 0.931394 | 5.10043 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-10-20T20:03: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": "04a596d591ee... |
c4b6e57e-b50c-4ba6-8dc2-d6e8c4c6bcc7 | Veljko28/cpp-data-algrtms | codeforces/TubeTubeFeed.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <queue>
#include... | ALGO | 0.999953 | 4.317699 | {
"github_metadata": {
"branch": "master",
"commit_count": 2176,
"repo_created_at": "2021-06-11T09:14:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f594e53... |
04f810a0-c4be-484f-aafe-0c2f8719d323 | kianaross/CSC212Finalproject | kochsnowflake/koch.cpp | #include <string>
#include <iostream>
#include <fstream>
#include <cmath>
//L-system rules
//F : Move forward
//- : Turn left by some degree
//+: Turn right by some degree
//starter code given in lab
//2 functions in program
std::string koch_snowflake(int order);
void snowflake(int order, std::string &commands);
//m... | ALGO | 0.998656 | 4.967726 | {
"github_metadata": {
"branch": "main",
"commit_count": 72,
"repo_created_at": "2020-12-02T02:52: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": "f329f70c0c4... |
a6ff1868-5449-4da4-8684-427dc8ce6bf9 | vesk4000/Informatics | Problems/Bulgarian National Competitions/Autumn 2021/lzw.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
vector<int> encode(string input) {
vector<int> output;
unordered_map<string, int> dict;
for(int i = 0; i <= 255; ++i) {
string chr = "";
chr += char(i);
dict[chr] = i;
}
int curr = 256;
string c = "";
s... | ALGO | 0.999906 | 3.608163 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2018-03-15T12:37:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dd7e0bbcb... |
e2732217-892d-4917-8c03-afd92304f738 | ishandutta2007/codeforces-a | axiomofchoice/normal/1519/E.cpp | // #pragma GCC optimize(3)
#include <bits/stdc++.h>
#define repeat(i,a,b) for(int i=(a),ib=(b);i<ib;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,ib=(a);i>=ib;i--)
#define mst(a,x) memset(a,x,sizeof(a))
#define fi first
#define se second
// #define int ll
using namespace std;
namespace start{
typedef long long ll; c... | ALGO | 0.999731 | 3.916402 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-04-11T00:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "14188e9997c6... |
ce090923-f3bc-4b3f-8bb6-296b91640e4e | miraehab/LeetCode-April-Daily-Challenges-2022 | 173. Binary Search Tree Iterator.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.999938 | 6.133884 | {
"github_metadata": {
"branch": "main",
"commit_count": 57,
"repo_created_at": "2022-04-01T17:26: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": "236d77d44ed... |
549d961c-f78f-4f0c-91f4-1540eaf96e7e | pablopalou/ICPC | fraizen/C++/codeforces/1400-1700.cpp/295AdifferenceArray.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(a,b) for(int i = a; i<b; i++)
#define rep(i,a,b) for(int i = a; i<b; i++)
#define fre(s) for(auto e:s)
#define pb push_back
int maxn = 1001000;
void solve() {
ll n,m,k; cin >> n >>m>>k;
ll a[maxn]; fr(0,n) cin >> a[i];
a[n] = 0... | ALGO | 0.999983 | 3.467448 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2023-10-02T22:43: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": "5c51ab512b6... |
2ace3d21-7e40-4526-aebd-eebab0ddbb51 | UnderOneBreath/Basics_of_programming | DULUSTAAN/1 term/LAB-06-B2.cpp | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int solve(string s)
{
int a = 0;
int max = 0;
for (int i = 0; i <= s.size(); i++)
{
if (tolower(s[i]) == 'a')
a += 1;
else
{... | ALGO | 0.999033 | 4.686816 | {
"github_metadata": {
"branch": "main",
"commit_count": 81,
"repo_created_at": "2022-11-17T17:29:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c7357b4eb4... |
5c96272c-3bdd-4148-825e-53bcc7a00384 | ishandutta2007/codeforces-o | okrut/normal/933/C.cpp | #include <bits/stdc++.h>
#define rep(i,a,b) for (int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mitte (lewy+prawy)/2
#define debug //
using namespace std;
typedef long long ll;
typedef long double ld;
int ile[1<<3];
pair <ll, ll> S[3];
ll R[3];
const ll L = 400... | ALGO | 0.999005 | 3.801417 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:45: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": "8f1e874f1c15... |
c2b0be53-c032-49d6-8b3b-a623bc7848c3 | LeTrongDat/competitive-programming | Csacademy/CSA82-E.cpp | /*
Author: <NAME>.
Idea: In a connected component, the best option is to build a fountain at the vertex with the smallest cost.
The most optimal connected component must be a tree.
=> The most optimal construction method will include multiple connected components
where t... | ALGO | 0.999954 | 3.741412 | {
"github_metadata": {
"branch": "master",
"commit_count": 130,
"repo_created_at": "2019-06-02T11:07:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98b64c30... |
78c32cfc-69eb-4bde-8353-f70ee7ec5f8d | RasPlex/OpenPHT | xbmc/network/ZeroconfBrowser.h | #pragma once
/*
* Copyright (C) 2005-2012 Team XBMC
* http://www.xbmc.org
*
* 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 Software Foundation; either version 2, or (at your option)
* any late... | TOOL | 0.930733 | 4.271721 | {
"github_metadata": {
"branch": "openpht-1.9",
"commit_count": 25886,
"repo_created_at": "2015-11-08T18:03:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 599,
"forks": 106,
"issues": 178,
"pull_requests": 2
},
"file_meta": {
"content_id... |
cda2bf4a-4b89-49bf-9b0c-ad7d2cc6b124 | HeadInAMicrowave/Programming | Single-Linked List.cpp | #include <iostream>
using namespace std;
template<typename Key, typename Info>
class Sequence{
private:
struct Node{
Key key;
Info info;
Node *next;
Node(const Key& k, const Info& inf, Node *vnext=nullptr):key(k), info(inf), next(vnext){}
};
Node *head;
public:
Sequence... | ALGO | 0.995759 | 4.483273 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2022-04-07T10:32: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": "130b8e8559d... |
32565515-f934-46f6-95d7-fd737e17a235 | SKBshahriar/Codes | uva/10929/uva_10929.cpp | #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
string str;
int eleven = 11;
while (1)
{
int flg = 0;
cin >> str;
if (str[0] == '0' && str.length()==1)
break;
int lenght = str.length();
if (str.length()<2 || (str[0] == '1' && str[1] == '0' && lenght == 2))
cou... | ALGO | 0.994759 | 3.551775 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2018-01-03T17:03: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": "e4ba65435... |
43387bc8-1c54-4451-aa06-71a42fdb4d3b | forevermzm/s096-1 | assignment2/mst/mst.cpp | #include <vector>
#include <queue>
#include <set>
#include <iostream>
#include <fstream>
class State {
size_t _node;
double _dist;
public:
State( size_t aNode, double aDist ) : _node{aNode}, _dist{aDist} {}
inline size_t node() const { return _node; }
inline double dist() const { return _dist; }
inline v... | ALGO | 0.997865 | 4.765334 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2014-11-17T18:59:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c291318007... |
20efb5a8-9560-45b4-9b57-a01255abbeb0 | DimaAndreev30/yandex-alg-2021 | 6 контест/J.cpp | #include <iostream>
#include <vector>
#include <cstdint>
using Sequence = std::vector<int_fast16_t>;
int getLeftMedian(const Sequence& a, const Sequence& b, int L)
{
if (a.back() <= b.front())
return a.back();
if (b.back() <= a.front())
return b.back();
int left = 0, right = L - 1;
while (true)
{
int ... | ALGO | 0.999916 | 3.732996 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2021-06-25T08:13:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "46ef0c376... |
22809e7e-5240-4552-ad37-8cbb384fa23d | mkh527443/DSA-Assign1Task1 | DSA-Assign1Task1/DSA-Assign1Task1.cpp | #include<iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
};
class List {
private:
Node* head;
public:
List()
{
head = NULL;
}
bool IsListEmpty()
{
if (head == NULL)
{
return true;
}
else
{
return false;
}
}
void insert_begin(int value)
{
Node* temp;
tem... | ALGO | 0.994001 | 5.022992 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-09-25T18:26:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b83c8e3af4... |
dec29db3-42ac-4186-8f96-06a64b4df3b6 | Mootikins/kattis | primeSieve/primeSieve.cpp | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
long long int sieve( long long int n, vector<bool>& primes ) {
primes[0] = primes[1] = false;
int count = 0, m = sqrt( n );
for ( int i = 2; i <= m; ++i ) {
if ( primes[i] ) {
count++;
for ( int k = 2 * i; k <= n; k += i ) primes... | ALGO | 0.999755 | 4.313583 | {
"github_metadata": {
"branch": "master",
"commit_count": 35,
"repo_created_at": "2018-09-22T15:41:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b7ff48843... |
1b597a90-8b5f-42b2-84f1-f063ffd1a1bc | aatman-24/DSA | Uva Online Judge/230 - borrower.cpp | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;
void display(std::vector<pair<int,string>> temp)
{
for (double i=0; i < temp.size() ; i++)
{
cout << temp.at(i).second << '\n';
}
}
void seperate_by_space(string book,vector<string> &all_word)
{
for (double i = 0 ; i < boo... | ALGO | 0.996705 | 3.66762 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2021-04-13T13:29: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": "6a821a5d56e... |
383e8e72-cd57-4c7a-82b4-cdf39a7af133 | openmm/openmm | platforms/reference/include/ReferenceNeighborList.h | #ifndef OPENMM_REFERENCE_NEIGHBORLIST_H_
#define OPENMM_REFERENCE_NEIGHBORLIST_H_
#include "openmm/Vec3.h"
#include "openmm/internal/windowsExport.h"
#include <set>
#include <vector>
namespace OpenMM {
typedef std::vector<Vec3> AtomLocationList;
typedef unsigned int AtomIndex;
typedef std::pair<AtomIndex, AtomIndex>... | TOOL | 0.987794 | 6.734805 | {
"github_metadata": {
"branch": "master",
"commit_count": 7207,
"repo_created_at": "2013-05-20T17:42:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1644,
"forks": 558,
"issues": 408,
"pull_requests": 22
},
"file_meta": {
"content_id": "... |
e08b882a-f793-49d3-a636-0d964203d6e4 | Cadiducho/UGR-Metodologia-Programacion | Practica3/src/16_PosMayor.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "16_PosMayor.h"
using namespace std;
int main(int argc, char *argv[]) {
const int TOPE = 100;
int vector[TOPE];
int n;
int d;
int i;
switch (argc) {
case 1:
n = TOPE;
i = 0;
d = TOPE - 1;
break;
case 2:
n... | ALGO | 0.998567 | 3.509666 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-10-24T11:56: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": "641a5405cc... |
5a160c9f-0cff-475e-a2de-9592777d9573 | OpenQBMM/OpenQBMM | applications/solvers/multiphase/phaseCompressibleTurbulenceModels/kineticTheory/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
--------... | ALGO | 0.957007 | 6.571222 | {
"github_metadata": {
"branch": "master",
"commit_count": 1295,
"repo_created_at": "2015-09-04T02:15:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 105,
"forks": 51,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "87dd7... |
9a65b866-1836-48ba-a808-50b6fbdb4e7b | YangBin1729/algorithm | 02-linkedlist/141.环形链表.cpp | /*
* @lc app=leetcode.cn id=141 lang=cpp
*
* [141] 环形链表
*
* https://leetcode-cn.com/problems/linked-list-cycle/description/
*
* algorithms
* Easy (44.82%)
* Likes: 425
* Dislikes: 0
* Total Accepted: 87.5K
* Total Submissions: 195K
* Testcase Example: '[3,2,0,-4]\n1'
*
* 给定一个链表,判断链表中是否有环。
*
* 为了... | ALGO | 0.999964 | 5.825836 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2020-03-21T01:35:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d818d35726... |
f6aaa083-eb81-48b6-8487-8531ed2f8b22 | JeongY00n/MINCODING | Level36_Dijkstra와 Floyd/36-1.알뜰 기차여행.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
struct NODE {
int to;
int cost;
};
struct cmdstruct {
bool operator()(NODE A, NODE B) {
if (A.cost < B.cost) return false;
if (A.cost > B.cost) return true;
if (A.to < B.to) return false;
if (A.to > ... | ALGO | 0.999955 | 4.08051 | {
"github_metadata": {
"branch": "main",
"commit_count": 185,
"repo_created_at": "2022-07-27T14:09: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": "498752c242... |
5740cd87-6930-4da1-840f-873a6d8c68cd | liangkyle08/competitive-programming | CodeForces/alices-adventures-in-chess.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int MOD = 1e9+7;
const int INF = (1<<30);
const int ALP = 26;
const long long LL_INF = (1LL<<60);
int T, N, A, B;
string s;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> T;
while (T--) {
... | ALGO | 0.99992 | 4.98525 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-06-26T21:56:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae7c60c1aa2... |
76ee6d8e-7d1b-4091-80d3-5ec3746183e4 | Sookmyung-Algos/2021algos | algos_assignment/3rd_grade/송혜민_songfox00/week1/4963.cpp | #include<iostream>
#include<cstring>
using namespace std;
bool visit[51][51] = { false, };
int w, h;
int map[51][51];
int dx[8] = { 1,-1,0,0,1,1,-1,-1};
int dy[8] = { 0,0,-1,1,1,-1,-1,1 };
void dfs(int a, int b) {
visit[a][b] = true;
for (int i = 0; i < 8; i++) {
int nx = a + dx[i];
int ny = b + dy[i];
if ... | ALGO | 0.998872 | 4.294458 | {
"github_metadata": {
"branch": "master",
"commit_count": 5558,
"repo_created_at": "2021-02-22T06:32:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4,
"forks": 38,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7e41687... |
d1178af1-ba30-4013-9502-0b8c58703c4d | jianningzhuang/CS2040C-Data_Structures_and_Algorithms | Week 4/frosh_week.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
int binary_position(ll a[], ll value, int low, int high){
if (high <= low){
if (value > a[low]){
return low + 1;
}
else{
return low;
}
}
int mid = (low + high)/2;
if (value == a[mid]){
return mid + 1;
... | ALGO | 0.999907 | 4.166217 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-07-03T13:56: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": "6e87c1142361... |
13c16efd-da56-4098-9c3c-db0123a9bf8c | DanielTLouis/HackerRank | 4WeekInterviewPreperation/Prepare_InterviewPreperationKit_1MonthPreperationKit_Week1_DiagonalDifference.cpp | /*
Given a square matrix, calculate the absolute difference between the sums of its
diagonals.
For example, the square matrix arr is shown below:
1 2 3
4 5 6
9 8 9
The left-to-right diagonal = 1+5+9=15. The right to left diagonal = 3+5+9=17. Their
absolute difference is |15-17|=2.
Function descr... | ALGO | 0.999994 | 5.711066 | {
"github_metadata": {
"branch": "main",
"commit_count": 229,
"repo_created_at": "2022-08-24T17:39:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1f7b435c8b... |
e03f7b5e-c7a2-43ed-8a92-db543e87a4df | MichaleGo/Algorithm | DataStructure/2.一元多项式相加.cpp | /*
编写一元多项式加法运算程序。要求用线性链表存储一元多项式(参照课本)。该程序有以下几个功能:
1. 多项式求和
输入:输入三个多项式,建立三个多项式链表Pa、Pb、Pc
(提示:调用CreatePolyn(polynomial &P,int m)。
输出:显示三个输入多项式Pa、Pb、Pc、和多项式Pa+Pb、多项式Pa+Pb+Pc
(提示:调用AddPolyn(polynomial &Pa, polynomial Pb), 调用PrintPolyn(polynomial P))。
0. 退出
输入:
根据所选功能的不同,输入格式要求如下所示(第一个数据是功能选择编号,参见测试用例):
1
多项式A包含的项数,... | ALGO | 0.999556 | 4.282611 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2018-10-30T08:28: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": "38b33bdc4... |
2d63965d-567a-4aef-b020-5879bc7b5f1d | KrAbhas/green-code | codeforces/1385/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define intl int64_t
#define pb(x) push_back(x)
#define unmap unordered_map
#define unset unordered_set
#define bit_set_count(x) __builtin_popcountll(x)
// use for unordered map (for high collison) with 2^x:
// um.... | ALGO | 0.999905 | 3.720979 | {
"github_metadata": {
"branch": "master",
"commit_count": 505,
"repo_created_at": "2021-07-23T09:57: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": "29b40219... |
d8f2179b-4f94-4ce2-b28b-ba28e4cc2180 | arin2002/leetcode | 1020-number-of-enclaves/1020-number-of-enclaves.cpp | class Solution {
public:
int n,m;
vector<int> drs = {-1,0,1,0,-1};
void dfs(int i, int j, vector<vector<int>>& grid){
if(i<0 || i>=n || j<0 || j>=m || !grid[i][j]){
return;
}
grid[i][j] = 0;
for(int k = 0; k<4; k++){
dfs(i+drs[k],j+drs[k+... | ALGO | 0.999981 | 6.010801 | {
"github_metadata": {
"branch": "main",
"commit_count": 4845,
"repo_created_at": "2022-05-19T14:50: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": "c0119da57... |
09b9de48-d92b-4835-a28b-1d23859adf38 | fevrem/TROPIC | casadi/casadi-osx-matlabR2015a-v3.5.1/include/casadi/core/dot.cpp | /*
* This file is part of CasADi.
*
* CasADi -- A symbolic framework for dynamic optimization.
* Copyright (C) 2010-2014 <NAME>, <NAME>, <NAME>,
* <NAME>. All rights reserved.
* Copyright (C) 2011-2014 <NAME>
*
* CasADi is free software; you can redistribute it and/or
... | ALGO | 0.979911 | 6.45466 | {
"github_metadata": {
"branch": "develop",
"commit_count": 325,
"repo_created_at": "2020-02-18T15:49:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 55,
"forks": 12,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "12430... |
43a2114d-f3b8-4116-a050-6f4b2e5a15a7 | nguyenhoang4875/CompetitiveProgramming | codeforces/div2_645/B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) (int)(a).size()
#define el '\n'
#define F first
#define S second
#define For(i, a, b) for (int i = (a); i <= (int)(b); i++)
#define Rof(i, a, b) for (int i = (a); i >= (int)(b);... | ALGO | 0.999949 | 4.482507 | {
"github_metadata": {
"branch": "main",
"commit_count": 328,
"repo_created_at": "2023-02-28T01:38:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2f4d92eb0... |
f572d77c-4f2b-4fdd-aac0-19d6fd611e3b | zinhoCerqueira/my_beecrowd | Here/q2551.c++ | #include <iostream>
using namespace std;
/* beecrowd | 2551
Novo Recorde */
int main()
{
int n,km,tempo,dia,dias_record[2048],num_print; //treino [dia] [0=duracao treino em minutos] [1= distancia percorrida em km]
float media, recorde;
num_print=0;
while(cin >> n)
{
recorde=0;
... | ALGO | 0.999775 | 3.712537 | {
"github_metadata": {
"branch": "main",
"commit_count": 183,
"repo_created_at": "2023-06-22T18:31:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fcfac2b831... |
716c6431-021b-4afa-a696-366c649ae032 | abdel2000-dply/propeller-led-display | partsOfCode/1245inloop.ino | // Representation of numbers in 5x7 grid (8 rows for extra space)
// the row 8 is not used, but it's there for better visualization
const byte numbers[10][8] = {
{0b01110, 0b10001, 0b10001, 0b10001, 0b10001, 0b10001, 0b01110, 0b00000}, // 0
{0b00100, 0b01100, 0b00100, 0b00100, 0b00100, 0b00100, 0b01110, 0b00000}, ... | TOOL | 0.974212 | 5.606325 | {
"github_metadata": {
"branch": "main",
"commit_count": 46,
"repo_created_at": "2024-10-21T23:23:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5367b8970bb... |
85106260-df8d-4424-92b1-d5f6dd936e55 | PengyanQin/cracking-the-coding-interview | 7_3.cpp | //
// 7_3.cpp
//
//
// Created by <NAME> on 7/6/15.
//
//
#include <iostream>
#include <cmath> // for abs()
using namespace std;
// pay attention: limitations of floating point representations, never check for equality
// with ==, check if the difference is less than an epsilon value
struct point{
int x;
... | ALGO | 0.996402 | 4.989556 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-10-20T00:10:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dac9e57456... |
2473807b-2731-457f-88d4-212ba8e5c4e5 | Munawertaj/Codeforces | F_Eating_Candies.cpp | // https://codeforces.com/problemset/problem/1669/F
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<int>
#define vll vector<ll>
#define vull vector<ull>
... | ALGO | 0.999946 | 4.956827 | {
"github_metadata": {
"branch": "main",
"commit_count": 438,
"repo_created_at": "2022-04-21T10:06:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45d95a45fe... |
cf7e2401-e3e9-40de-85ba-c2b262fade43 | mkhaled87/SENSE | examples/prolonged_ncs/dint/scots-files/dint.cc | /*
* dcdc.cc
*
* created on: 31.08.2015
* author: m.khaled
*/
#include <array>
#include <iostream>
#include "cuddObj.hh"
#include "SymbolicSet.hh"
#include "SymbolicModelGrowthBound.hh"
#include "TicToc.hh"
#include "RungeKutta4.hh"
#include "FixedPoint.hh"
/* state space dim */
#define sDIM 2
#define iD... | ALGO | 0.999279 | 5.540996 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-08-09T05:50:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "47ab6b9b7... |
ca5babe5-b7e4-4870-8f9f-b6a677451eaf | priyanshuranjan2024/dsa | GenericTrees/serializingAndDeserializingTheGenericTree.cpp | #include<bits/stdc++.h>
using namespace std;
//Serialize and Deserialize an N-ary tree.
// Serialization is the process of converting an object into a format that can be stored or transmitted.
// Deserialization is the process of converting the serialized string back into an object.
// Serialization is to store ... | ALGO | 0.995173 | 4.767636 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2023-08-18T05:59:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "395d55bc0... |
a008cae3-459d-43c6-8dfa-23d1345eca52 | NitishPuri/coding-gym | leetcode/string/encrypt-and-decrypt-strings.cpp | // https://leetcode.com/problems/encrypt-and-decrypt-strings/
// array, hash-table, string, design, trie, hard
// a b c z
// aa bb cc zz
// aa aaa aaaa aaaaa aaaaaa
// aaaa -> aa -> 1
// aa -> a -> 0
#include <unordered_map>
using namespace std;
class Encrypter {
// struct Trie {
// // char key;
... | ALGO | 0.999889 | 5.903329 | {
"github_metadata": {
"branch": "master",
"commit_count": 185,
"repo_created_at": "2017-09-04T16:52: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": "15429a54... |
2e2ed312-28b5-4c2f-b948-bb8e772a94a5 | ishandutta2007/codeforces-y | yuu/normal/600/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#defi... | ALGO | 0.999943 | 3.2428 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:40: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": "d6258496a811... |
33ef12ee-f776-4649-861d-de1c49cddc0d | sonugiri1043/LeetCode | LeetCode_977_Square_of_sorted_array.cpp | vector<int> sortedSquares(vector<int>& A) {
vector<int> posSq, negSq, result; // store +ve square, -ve square and final result
for( auto a : A ) {
if( a >= 0 ) posSq.push_back( a*a );
else negSq.push_back( a*a );
}
// merge the +ve and -ve square using two pointer method
// on -ve squares we iterate i... | ALGO | 0.999935 | 5.696429 | {
"github_metadata": {
"branch": "master",
"commit_count": 294,
"repo_created_at": "2019-06-03T17:55:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0e743c8f... |
8de53596-3c3e-42fc-a69b-9358a0c9a0e4 | kabhinayak02/DS-Algo | Sliding window/1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold.cpp | /*
fixed size sliding window
tc: o(n)
sc: o(1)
*/
class Solution {
public:
int numOfSubarrays(vector<int>& arr, int k, int threshold) {
int n = arr.size();
int i = 0, j = 0;
int sum = 0, ans = 0;
while (j < n) {
sum += arr[j];
if (j - i + 1 == k... | ALGO | 0.99999 | 6.480543 | {
"github_metadata": {
"branch": "master",
"commit_count": 241,
"repo_created_at": "2023-07-27T00:12: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": "4019a05a... |
36ca5abf-180a-4860-8e83-5e0d0f9ac173 | mridulcr7/vscode | graph/bipartite_bfs.cpp | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isBipartite(int n, vector<int>adj[]){
// Code here
vector<int> color(n,-1);
for(int i=0;i<n;i++)
{
if(color[i]==-1)
{
if(!usingbfs(i,adj,color))
return 0;
... | ALGO | 0.999941 | 5.712921 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-09-26T13:02: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": "50c7dc2ad92... |
aabeec16-cf50-4855-8cdb-f5e705f2c838 | kkishi/atcoder | contests/abc276/abc276_g/main.cc | #include <bits/stdc++.h>
#include "atcoder.h"
#include "modint.h"
using mint = ModInt<998244353>;
void Main() {
ints(n, m);
if (m < n - 1) {
wt(0);
return;
}
// let f(x) = C(n-1, x)
// step 1: sum[i] = f(i)
// step 2: sum[i] = f(0) + f(1) + ... + f(i)
// step 3: sum[i] = (i+1)*f(0) + i*f(1) + .... | ALGO | 0.999945 | 4.77808 | {
"github_metadata": {
"branch": "master",
"commit_count": 924,
"repo_created_at": "2020-05-17T21:30:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8d050d23... |
0f05bd98-5d1e-41d5-a655-a82a811f13f6 | alemanjosh7/cp-training | Problems/IOI/'21 DNA.cpp | #include "dna.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
#define f first
#define s second
#define tcT template<class T
#define tcTU tcT, class U
tcT> using V = vector<T>... | ALGO | 0.999959 | 3.956287 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2022-03-29T02:22:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0d6ee6275cb... |
0601ca94-01ca-4070-a191-23b34d429083 | imtyaz-17/LeetCode | 0142-linked-list-cycle-ii/0142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
//#1
// unordered_set<ListNode*> u_set;
// ListNode* curr = head;
//... | ALGO | 0.999929 | 5.766607 | {
"github_metadata": {
"branch": "main",
"commit_count": 534,
"repo_created_at": "2022-10-10T03:53:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fd386b175... |
8e39ef83-9e79-453e-bc5b-5cdb7002ee10 | Yindong-Zhang/nowcoder | reverseK.h | //
// Created by so_go on 2020/4/23.
//
#ifndef UNTITLED_REVERSEK_H
#define UNTITLED_REVERSEK_H
# include <bits/stdc++.h>
using namespace std;
struct list_node{
int val;
struct list_node * next;
};
list_node * input_list()
{
int val, n;
scanf("%d", &n);
list_node * phead = new list_node();
li... | ALGO | 0.999926 | 5.068356 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2019-08-13T03:49:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1befc0db... |
16be1afa-7f96-4eeb-b7bd-09c7d6c66541 | Renyu-Wang/Studies_QECC | q1_Rotated_surface_codes/b_v2/q1b.cpp | #include<iostream>
#include<tuple> //for multiple returens of a function
#include <itpp/itbase.h> //for vectors and matrixes
#include <chrono> //for showing run-time
#include "q1b_func.hpp" //separation of functions from main file
//#include <itpp/base/gf2mat.h> //for binary matrix
//compi... | ALGO | 0.969705 | 3.936291 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-04-26T20:48:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "42130383f9... |
737a5c78-424d-4e1e-9a4d-ad5d53ba208e | NishantWankhade/tasks | Q2-ArrayProblem.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
You are given an array of N size. Find the maximum possible subarray such that its elements are arranged alternately
either even and odd or odd and even.
Ex:: Input : a[] = {10,14,12,7,8}
Output : 3
Explanation : That subarray is {12,7,8}.
... | ALGO | 0.999823 | 4.101551 | {
"github_metadata": {
"branch": "main",
"commit_count": 52,
"repo_created_at": "2021-06-15T10:01: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": "3f6a5bf6fa1... |
23eb9099-3a12-4345-b893-82426c4e3aa3 | ishandutta2007/codeforces-k | krk/normal/1420/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> ii;
const int Maxn = 300005;
const int mod = 998244353;
int fac[Maxn], ifac[Maxn];
int n, k;
vector <ii> seq;
int toPower(int a, int p)
{
int res = 1;
while (p) {
if (p & 1) res = ll(res) * a % mod;
p... | ALGO | 0.999974 | 4.559415 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "66a87eadd2fc... |
dd2d03a0-9f9a-45b4-92af-596fcee6f9ab | atobaum/BOJ | 2000/2887/2887.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
#define mp(a, b) make_pair(a, b)
#define X first
#define Y second
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define in1(a) cin >> a;
#define in2(a, b) cin >> a >> b;
#define in3(a, b, c)... | ALGO | 0.999228 | 4.168691 | {
"github_metadata": {
"branch": "main",
"commit_count": 147,
"repo_created_at": "2020-03-26T15:24: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": "4f5d5a3900... |
216575e8-867f-4ee2-83a1-94b98b0722a9 | yigitskaplan/CMPE-225-Object-Oriented-Programming-Fall-2024-2025 | HW2/YIGITSEVKI_KAPLAN_hw2..cpp | #include <iostream>
using namespace std;
const double PI = 3.141592653589793;
class Shape{
public:
virtual string getName(){
return "Shape class";
}
virtual void calcArea(){
cout<<"Area of the shape not calculated in this function."<<endl;
}
virtual... | ALGO | 0.924685 | 4.751491 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2025-04-11T08:58: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": "fb2dacf2ef9... |
89fc70c1-2b33-47ef-a8d5-1060b2f6642d | akgmage/data-structures-and-algorithms | Trees/Binary Search Trees/search.cpp | // Binary Search Tree : Searching in Binary Search Tree
// Program Author : <NAME>
/*
Input : 7 3 9 2 4 8 10 -1
Value to be searched : 99
Output :
7
/ \
3 9
/ \ / \
2 4 8 10
Not present in BST
Value to ... | ALGO | 0.999995 | 4.778207 | {
"github_metadata": {
"branch": "main",
"commit_count": 3839,
"repo_created_at": "2021-02-21T17:38:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 150,
"forks": 216,
"issues": 17,
"pull_requests": 0
},
"file_meta": {
"content_id": "008d... |
4b9299b0-7873-4ce7-af74-343c5a287036 | zudydy/problem-solving | 백준/Gold/1918. 후위 표기식/후위 표기식.cc | #include <iostream>
#include <stack>
using namespace std;
int main() {
string s;
cin >> s;
stack<char> stack;
for (char c : s) {
if (c >= 'A' && c <= 'Z') {
cout << c;
continue;
}
if (c == '+' || c == '-') {
while (!stack.empty() && stack.to... | ALGO | 0.999973 | 4.439526 | {
"github_metadata": {
"branch": "main",
"commit_count": 992,
"repo_created_at": "2021-12-14T17:57: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": "ea74e3a008... |
f9842aec-e215-4609-9f9d-f10b0745328e | projeto-de-algoritmos/Lista1_EricoBandeira_AndreFreitas | lista.cpp | #include <iostream>
#include <list>
#include <stack>
using namespace std;
class Graph
{
int V;
list<int> *adj;
void fillOrder(int v, bool visited[], stack<int> &Stack);
void DFSUtil(int v, bool visited[]);
void DFSUtilChecked(int v, bool visite[]);
public:
Graph(int V);
void addEdge(int v, int w);
void addE... | ALGO | 0.999318 | 5.345151 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-09-01T21:54:39.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "82aac05a655... |
16cc1eff-fbc1-495b-9c6e-bcfe76860214 | szmer/aburatan | src/path.hpp | // [path.hpp]
// (C) Copyright 2000-2002 <NAME>
#if !defined ( PATH_HPP )
#define PATH_HPP
#include "point.hpp"
#include "list.hpp"
#include "types.hpp"
class Path {
public:
enum type {
//pt pathtype
pt_straight, // Direct route
pt_shortest, // Path of least resistance - for AI
... | TOOL | 0.968418 | 4.206706 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-02-12T20:46:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e796cffd31... |
2a457e49-02a3-42b0-81a0-d6be415470e9 | itohdak/Competitive_Programming | AtCoder/ARC/060/D.cpp | #include <bits/stdc++.h>
#include <print.hpp>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(... | ALGO | 0.999811 | 3.925434 | {
"github_metadata": {
"branch": "master",
"commit_count": 98,
"repo_created_at": "2020-10-16T18:27:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e4f63dd72... |
49cea2fd-5eba-48d5-9701-5e7d6be4227d | juliazhuzhu/cplusplus_study | leetcode328.cpp | #include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
ListNode* createLists(int arr[],int len){
if (len == 0)
return NULL;
ListNode* head = new ListNode(arr[0]);
ListNode* cur = head;
for (int i=1; i< le... | ALGO | 0.999934 | 5.473341 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-01-14T01:01: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": "9cf22e0e5... |
3486c13b-f0bd-4372-9984-ab00b9f0f6cb | nurzhan-saktaganov/cmc_master | parallel_prac/2017autumn/task3/parallel_sort.hpp | #pragma once
#include <mpi.h>
#include "Schedule.hpp"
template<typename T>
void merge_up(T *a, T *b, T *c, const int size)
{
int i, j, k;
i = j = k = 0;
while (k < size) {
if (a[i] < b[j]) {
c[k++] = a[i++];
} else {
c[k++] = b[j++];
}
}
}
template<type... | ALGO | 0.999843 | 5.801946 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2015-09-12T10:15:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b75b7bb3... |
f59269a7-1ff0-4b31-94e8-bb6b41af8918 | saqibameen/CGT-MCTS-Solver-for-Clobber | Players/ClobberPlayerDiff.cpp | #include "ClobberPlayerDiff.h"
#include <stdlib.h>
#include <iostream>
using namespace std;
int ClobberPlayerDiff::RandInt(int lb, int ub) {
uniform_int_distribution<int> dist(lb, ub);
return dist(this->rng);
}
ClobberPlayerDiff::ClobberPlayerDiff(int color) {
random_device rd;
this->rng = mt19937(rd());
t... | ALGO | 0.966669 | 5.959548 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-01-02T19:30: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": "596e9a1162fa... |
f21372f6-dd8e-43eb-91c5-f149e6189d47 | Harry-kp/Cp | Codechef/Triple Inversions.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0)
#define MP make_pair
#define EB emplace_back
#define MOD 1000000007
#define int long long int
#define S second
#define F first
#define debug1 cout << "debug1" << '\n'
#define debug2 cout... | ALGO | 0.999983 | 4.457975 | {
"github_metadata": {
"branch": "main",
"commit_count": 79,
"repo_created_at": "2020-11-13T18:52:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5b75fe6dd4... |
55432b60-5b0f-48b9-9c2c-703d488206c5 | Esaak/ComputationalMathematics | src/Integration.hpp | #ifndef COMPMATH_INTEGRATION_HPP
#define COMPMATH_INTEGRATION_HPP
#include <array>
#include <type_traits>
#include <cmath>
#include <utility>
#include <exception>
#include <stdexcept>
#include <algorithm>
#include <numeric>
#include <ranges>
template<typename A>
struct ArgumentGetter;
template<typename R, typename ... | ALGO | 0.960151 | 5.885504 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2023-09-10T17:09: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": "b1d23f3da... |
b1493019-f0cc-4352-b28a-2c0a8ef9a374 | wannabe-X/2021-Job-hunting | LeetCode/第二轮/877.石子游戏/1.cpp | /*
* @Description: 877. 石子游戏
* @Author: <NAME>
* @Date: 2021-06-16 15:16:00
* @LastEditTime: 2021-06-16 17:37:28
* @LastEditors: <NAME>
*/
#include <iostream>
#include <vector>
using namespace std;
/*
定义二维数组 dp,其行数和列数都等于石子的堆数,dp[i][j] 表示当剩下的石子堆为下标 i 到下标 j 时,
当前玩家与另一个玩家的石子数量之差的最大值,注意当前玩家不一定是先手 Alex。
*/
... | ALGO | 0.999931 | 4.490648 | {
"github_metadata": {
"branch": "master",
"commit_count": 350,
"repo_created_at": "2021-04-12T06:05:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e869d48f... |
8fd21df3-4e6b-4064-a885-f92a6e393497 | Manav-Agg/Coding-Blocks-2023 | Data Structure and Algorithm/October 2023/October 08 Queue/Queue using Array.cpp | #include<iostream>
using namespace std;
template<typename T>
class Queue{
T *a;
int f, e, cs, n;
public:
Queue(int size){
n = size;
a = new T[n];
f = cs = 0;
e = n - 1;
}
void push(T data){
if(cs < n){
e = (e + 1) % n;
a[e] = dat... | ALGO | 0.997348 | 4.037057 | {
"github_metadata": {
"branch": "master",
"commit_count": 514,
"repo_created_at": "2023-07-08T14:26: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": "82d80701... |
8c16f4b7-5242-4c00-8c47-59fe6b28e0a6 | ramsanka/pratice_problems | dynamic/min_cost_dp.cpp | //Dynamic programming.
//Min cost.
//DP-6
//travel in the following combinations.
//traverse down, right, daigonally lower.
//(m-1,n), (m,n-1),(m-1,n-1)
#include <bits/stdc++.h>
using namespace std;
#define R 3
#define C 3
#define MAX 100
int min(int x, int y, int z);
//Top down approach
//Base case
//recursion
/... | ALGO | 0.99987 | 4.259888 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2021-01-29T13:39:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45feddf63... |
fbf6b3b1-c569-43a3-be67-8795cf65a3c4 | tdlib/td | tdutils/td/utils/find_boundary.cpp | //
// Copyright <NAME> (<EMAIL>), <NAME> (<EMAIL>) 2014-2025
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/utils/find_boundary.h"
#include <cstring>
namespace td {
bool find_boundary(ChainBuf... | TOOL | 0.939663 | 6.6072 | {
"github_metadata": {
"branch": "master",
"commit_count": 15345,
"repo_created_at": "2017-12-31T20:23:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7874,
"forks": 1656,
"issues": 99,
"pull_requests": 9
},
"file_meta": {
"content_id": "... |
8b1d674b-221a-45b1-bd8f-bbc71fc3e43d | towhid1zaman/UVA-Problem-solve | 579 ClockHands.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector<pii>vip;
#define all(v) (v).begin(),(v).end()
#define sp(x,k) cout<<setprecision(k)<<fixed<<x<<endl;
#define rep(i,a,b) for(int i =(a); i <=(b); ++i)
#define mi... | ALGO | 0.999885 | 3.333558 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2019-10-27T09:40: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": "5ca1aba6f... |
e6ce7bda-8ccf-462c-86bf-1dbcb895dd5b | cms-pepr/HGCalML | modules/compiled/local_distance_kernel.cu.cc | //#define GOOGLE_CUDA 1
#if GOOGLE_CUDA
#define EIGEN_USE_GPU
#include "local_distance_kernel.h"
#include "helpers.h"
#include "tensorflow/core/util/gpu_kernel_helper.h"
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#include "cuda_helpers.h"
namespace tensorflow {
namespace functor {
t... | ALGO | 0.995597 | 6.521039 | {
"github_metadata": {
"branch": "master",
"commit_count": 982,
"repo_created_at": "2020-01-29T13:25:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9,
"forks": 19,
"issues": 1,
"pull_requests": 3
},
"file_meta": {
"content_id": "72d81621... |
b379efac-d589-4828-b15a-6a54075412a1 | rdkit/rdkit | Code/Geometry/Transform2D.cpp | // $Id$
//
// Copyright (C) 2003-2006 Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/Invaria... | TOOL | 0.944499 | 6.968765 | {
"github_metadata": {
"branch": "master",
"commit_count": 8182,
"repo_created_at": "2013-05-12T06:19:15.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3003,
"forks": 931,
"issues": 110,
"pull_requests": 25
},
"file_meta": {
"content_id": "... |
b3809b35-157e-4adb-ac25-872ecbe949fe | hwsonnn/42_CPP | CPP08/ex01/span_1.cpp | #include "span_1.hpp"
Span::Span(unsigned int N)
{
this->N = N;
arr = new int[N];
for (unsigned int i = 0; i < N; i++)
arr[i] = 0;
}
Span::Span(const Span &ref)
{
N = ref.N;
arr = new int[N];
for (unsigned int i = 0; i < N; i++)
arr[i] = ref.arr[i];
}
Span::~Span(void)
{
delete[] arr;
}
Span& Span::opera... | ALGO | 0.999044 | 4.189255 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2021-05-31T02:20: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": "10bef01f2... |
78340ccd-44cc-491f-92ce-549d3fe530e0 | ltf0501/Competitive-Programming | Codeforces/62E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const ll INF = 1e14;
ll dp[1 << 5], dp2[1 << 5];
int n, m;
int row[5][maxn], col[5][maxn];
int main() {
scanf("%d%d", &n, &m);
for(int i = 1; i < m; i++)
for(int j = 0; j < n; j++) scanf("%d", &row[j][i]);
for(int i = 0;... | ALGO | 0.999982 | 3.414518 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2020-03-07T09:08: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": "ac12bfa21... |
582ce10b-1001-4c0c-b78a-c0af96c2a982 | artem-shig/Homework-Lesson47-Solution | Task02 Project/logic.cpp | #include "logic.h"
int find_max_value(int* arr, int size) {
int maxValue = *(arr + 0);
for (int i = 1; i < size; i++)
{
if (maxValue <= *(arr + i)) {
maxValue = *(arr + i);
}
}
return maxValue;
}
int find_min_value(int* arr, int size) {
int minValue = *(arr + 0);
for (int i = 1; i < size; i++)
{
i... | ALGO | 0.998929 | 4.691204 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2025-04-10T17:05:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45553a2575... |
5bfa0c13-5b08-4729-a65a-3f347d23148b | JaechanAn/algorithm-study | dbtkd1711/codejam/qualification/foregone_solution.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int T, input, i;
vector <int> numbers;
void print_divided(int test_number, int N);
int main() {
cin >> T;
for(i = 0 ; i < T ; i++) {
cin >> input;
numbers.push_back(input);
}
for(i = 0 ; i < T ; i++) {
... | ALGO | 0.999721 | 4.017366 | {
"github_metadata": {
"branch": "master",
"commit_count": 137,
"repo_created_at": "2019-03-16T05:41: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": "8ccd5597... |
ec5c33fc-75c4-43cd-a4ea-f42f0ba5243b | benardp/Wickbert | ism/NewtonDegenerate.h | /**
* This file contains the class declaration for a NewtonDegenerate object,
* which redefines the NewtonInput method to use the gradient and interval
* Hessian.
*
* @file NewtonDegenerate.h
* @author <NAME>
* @date October 18, 2002
*/
#ifndef NEWTONDEGENERATE_H
#define NEWTONDEGENERATE_H
#include "Newton.h"... | ALGO | 0.978316 | 5.983008 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2018-04-26T10:40: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": "e6a6951c1d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.