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 |
|---|---|---|---|---|---|---|---|
7d4b2d1e-5a38-4481-86a1-a700f4d27196 | meherajmithun/problem-solving | codechef/Chococut.cpp | #include<bits/stdc++.h>
using namespace std;
int solve() {
int n, m, k;
cin >> n >> m >> k;
if (k == 0) {
return n * m;
}
int mx = 0;
for (int i = 1; i < m; i++) {
int piece1 = n * i;
int piece2 = n * (m - i);
if (piece1 >= k) {
if (pie... | ALGO | 0.999974 | 4.01279 | {
"github_metadata": {
"branch": "main",
"commit_count": 321,
"repo_created_at": "2024-07-06T18:51:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6f0e1f0090... |
fb81825c-8701-4817-9410-1ea84923ab81 | gabriel88766/C-CPP-AlgorithmsAndContests | At-Coder/Beginner/382/D.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f, MOD = 998244353; //1e9+7
const int INF_INT = 0x3f3f3f3f;
const long double PI = acosl(-1.), EPS = 1e-9;
using namespace std;
vector<vector<int>> ans;
vector<int> cur;
void solve(int &n, int &m)... | ALGO | 0.999962 | 3.825835 | {
"github_metadata": {
"branch": "master",
"commit_count": 436,
"repo_created_at": "2020-08-21T00:21:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "381205bd... |
b333ae89-5717-489e-934a-bcb89c4e13bc | npdwuy/cses | dwuy/1076.cpp | /** - dwuy -
/> フ
| _ _|
/`ミ _x ノ
/ |
/ ヽ ?
/ ̄| | | |
| ( ̄ヽ__ヽ_)_)
\二つ
**/
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se secon... | ALGO | 0.999994 | 3.522935 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2023-05-25T09:12:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b49878e1b80... |
d15ef876-20d4-4528-be04-8a08179a4468 | Sharafabdullah/CompetitiveProgramming | seeLater/H_Almost_Equal_Strings.cpp | // #pragma GCC optimize("O3,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define rep(i, begin, end) for (int i = (begin); i < (end); ++i)
#define pb push_back
#define ppb pop_back
#define F ... | ALGO | 0.999934 | 4.699445 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2023-05-31T06:13:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9b9938fc0... |
a16d1b4b-a380-4a00-92c6-d84440f1e84a | MuhammadSawalhy/IEEE-ZSB-Technica1-Rookies-23 | Task-6/Binary Search Tree : Insertion.cpp | #include <cstddef>
#include <iostream>
class Node {
public:
int data;
Node *left;
Node *right;
Node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
class Solution {
public:
void preOrder(Node *root) {
if (root == NULL)
return;
std::c... | ALGO | 0.999991 | 5.403371 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2022-11-11T14:06:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "699b70d229f... |
66c1fdfe-92a3-478c-a774-e9450ee99657 | zhangxm99/AVLTree | avl_tree.h | //
// Created by 张晰铭 on 2022/9/3.
//
#ifndef AVLTREE_AVL_TREE_H
#define AVLTREE_AVL_TREE_H
#include "vector"
#include "node.h"
#define depth(n) (n?n->depth:0)
template<typename T>
class avl_tree {
private:
Node<T> *root;
Node<T> *insert(Node<T> *node, T data);
Node<T> *rightRotate(Node<T> *root);
... | ALGO | 0.998933 | 5.488399 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2022-09-03T12:10: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": "3688ed65f5... |
4f35adbe-711f-422f-ba89-50bcdd841eab | tZxxxxx/first-project | genetic_flow_order.cpp | #include "genetic_flow_order.h"
#include "loss_function_order.h"
#include "selection.h"
#include "crossover.h"
#include "mutate.h"
#include "util.h"
#include <algorithm>
extern const int ORDER_N_GENERATEION;
Eigen::MatrixXi best_order_generic(
MatrixList& populations,
std::map<std::string, Node*> nodes,
std::vect... | ALGO | 0.999792 | 5.314497 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-01-07T11:45:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1360c8182d77... |
797a9494-b921-4586-bbfc-a5340abbda47 | JonathanGusching/IN203 | Seance1/Circulation_jeton.cpp | # include <iostream>
# include <cstdlib>
# include <mpi.h>
int main( int nargs, char* argv[] )
{
// On initialise le contexte MPI qui va s'occuper :
// 1. Créer un communicateur global, COMM_WORLD qui permet de gérer
// et assurer la cohésion de l'ensemble des processus créés par MPI;
// 2. d'attribuer... | ALGO | 0.996159 | 3.835759 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2021-11-17T17:20:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d77b195d4... |
fb4dc7e7-ae04-4f4a-99bd-2ed4d9e261b3 | Viraj-Pansuriya/atcoder_dp_soln | que14.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iterator>
... | ALGO | 0.999976 | 4.337871 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2025-03-01T17:23:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a30d8920e4... |
c724e2e9-6b9c-4702-8e21-e441a06f6c9f | HabibaBaraka/codeForces | unwanted divisors.cpp | /*
"صلي على النبي"
* قَالُوا سُبْحَانَكَ لَا عِلْمَ لَنَا إِلَّا مَا عَلَّمْتَنَا ۖ إِنَّكَ أَنتَ الْعَلِيمُ الْحَكِيمُ *
*/
#include<vector>
#include <iostream>
#include<climits>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
using namespace std;
#defi... | ALGO | 0.999638 | 4.293585 | {
"github_metadata": {
"branch": "master",
"commit_count": 272,
"repo_created_at": "2025-03-17T07:45:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "67356a51... |
5ee738f6-723f-4500-8d3e-eff3af941546 | Tumypmyp/algorithms_labs | lab02,03/Jchat.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Node{
ll v, read, sz, par;
};
vector<Node> a;
ll get_sum(ll x) {
if (a[x].par == x)
return a[x].v;
return a[x].v + get_sum(a[x].par);
}
ll get(ll x) {
if (a[x].par == x)
return x;
return get(a[x].par);
}
void merge(ll x, ll y) {
... | ALGO | 0.999855 | 3.765249 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2019-03-18T10:50:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "36eb561e0... |
575883a6-0dc1-47ed-b628-ce51d09d81f7 | NeighborUncleWang/Leetcode | Cpp/321_CreateMaximumNumber/001.cpp | class Solution {
public:
vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {
int nums1Size = nums1.size();
int nums2Size = nums2.size();
vector<int> result;
for (int k1 = max(k - nums2Size, 0); k1 <= nums1Size && k1 <= k; ++k1) {
result = max(result,
... | ALGO | 0.999997 | 5.78436 | {
"github_metadata": {
"branch": "master",
"commit_count": 1229,
"repo_created_at": "2015-05-25T20:32: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": "88970c9... |
3895bd29-2651-4389-b0ab-47b999dd922f | rahulX001/cpp | A_Word.cpp | #include <bits/stdc++.h>
using namespace std;
string upperCase(string s)
{
for (int i = 0; i < s.length(); i++)
{
s[i]=toupper(s[i]);
}
return s;
}
string lowerCase(string s)
{
for (int i = 0; i < s.length(); i++)
{
s[i]=tolower(s[i]);
}
return s;
}
int main()... | ALGO | 0.99991 | 4.408715 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-07-29T05:02: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": "be4924b4b728... |
0a5181fe-2673-439c-996b-80fbe8a70af0 | glucky1024/myUSACOsol | section_3_4_heritage/heritage.cpp | /*
ID: jockeys1
TASK: heritage
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <cassert>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <climits>
#include <numeric>
#include <set>
#include <bitset>
#include <cstring>
#include <u... | ALGO | 0.999978 | 3.13518 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2023-06-11T19:58:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98f8f7fb8b9... |
b077f207-245f-4be3-9abb-3e3b92a3921f | kushal123478/Dynamic-Programming | Dynamic_Programming_1.cpp | /* Author : <NAME>
Date : 2/7/2019
Purpose: Practice C++ and planning algorithms*/
#include "pch.h"
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <limits>
#include <algorithm>
using namespace std;
class DynamicProgramming {
// This class i... | ALGO | 0.999251 | 3.95743 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-02-13T00:36: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": "b14e03f676... |
87f3ce52-6966-497c-98d4-ac52a95d8286 | satyajit-patel/code | rajVikramaditya/sdeSheet/graph/prerequisites/findCycleWithParent.cpp | //link --->
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int, int>>
int vis[100005];
vpi adj[100005];
bool bfs(int root) {
vis[root] = 1;
queue<pair<int, int>> q;
q.push({root, 0});
while(!q.empty()) {
... | ALGO | 0.999989 | 4.376726 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2022-08-14T20:03:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3737ab818b... |
61887ee0-6614-43cf-9353-1c295e43a318 | SssunSsshine/PpKulagin | L1N19/L1N19/L1N19.cpp | /*19. Каждый процесс обменивается сообщениями со всеми остальными
и выводит номера тех процессов,
у которых ни одно значение не совпадает с его собственными значениями.*/
#include <iostream>
#include <mpi.h>
#include <iomanip>
#include <sstream>
#include <vector>
#include <iostream>
#include <algorithm>
#include <ran... | ALGO | 0.999186 | 3.718583 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-05-21T11:07: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": "17ba4a5d3b9f... |
1a09d1fe-2e38-418c-b79a-6cc079be8fc3 | raincross7/code-similarity | codes/train_code/problem329/problem329_103.cpp | #pragma GCC optimize("unroll-loops")
#include <cstdio>
#include <vector>
using namespace std;
using int64 = long long;
bool dp1[5050][5050];
bool dp2[5050][5050];
template<class T> inline void fastin(T &num) {
T c;
num = 0;
c = getchar_unlocked();
for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (n... | ALGO | 0.999951 | 3.721579 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07: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": "e4ec3fa6a635... |
0a3bec44-0f34-45e0-bab8-428df0e461ca | zoolib/zoolib_cxx | Old_not_in_use/zoolib/ZTextCollator.h | // Copyright (c) 2003 <NAME> and Learning in Motion, Inc.
// MIT License. http://www.zoolib.org
#ifndef __ZTextCollator_h__
#define __ZTextCollator_h__ 1
#include "zconfig.h"
#include "zoolib/CountedWithoutFinalize.h"
#include "zoolib/FunctionChain.h"
#include "zoolib/UnicodeString.h"
#include "zoolib/ZCompat_operat... | TOOL | 0.902148 | 3.233433 | {
"github_metadata": {
"branch": "master",
"commit_count": 5634,
"repo_created_at": "2012-02-04T20:54:08.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 16,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "56d6c1a... |
70428ee5-71ca-422e-9733-f758e5308ff6 | Chaste/Old-Chaste-svn-mirror | cell_based/src/population/pdes/SimpleUniformSourcePde.hpp | /*
Copyright (c) 2005-2016, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... | ALGO | 0.925201 | 6.516025 | {
"github_metadata": {
"branch": "master",
"commit_count": 12524,
"repo_created_at": "2012-08-24T09:29:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 17,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ddc120... |
9a32879f-8709-49de-8ca9-b079497f6bc0 | liuchuo/PAT | AdvancedLevel_C++/1059. Prime Factors (25) .cpp | #include <cstdio>
#include <vector>
using namespace std;
vector<int> prime(50000, 1);
int main() {
for(int i = 2; i * i < 50000; i++)
for(int j = 2; j * i < 50000; j++)
prime[j * i] = 0;
long int a;
scanf("%ld", &a);
printf("%ld=", a);
if(a == 1) printf("1");
bool state = fal... | ALGO | 0.999911 | 3.658263 | {
"github_metadata": {
"branch": "master",
"commit_count": 703,
"repo_created_at": "2016-01-06T05:06:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3399,
"forks": 809,
"issues": 44,
"pull_requests": 9
},
"file_meta": {
"content_id": "9f... |
21fcb45c-a82a-49c8-8a2c-651056398614 | MinervaExpt/MAT-MINERvA | utilities/PhysicsVariables.cxx | #include <iostream>
#include <cmath>
#include "utilities/PhysicsVariables.h"
namespace PlotUtils{
//===============================================================================================
// Assume CCQE Kinematics, formula differs slightly for nu vs anti-nu, return units are GeV-type.
// Q^2 calc also comput... | ALGO | 0.908728 | 4.160414 | {
"github_metadata": {
"branch": "main",
"commit_count": 171,
"repo_created_at": "2021-07-07T17:22:55.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 6,
"pull_requests": 3
},
"file_meta": {
"content_id": "5f7867ebad8... |
a122c52d-ec41-46dd-9256-6dc20a17f19c | Muses-lbz/Daily-Practice | 2021_04/2021_04_11.cpp | #include <iostream>
#include <vector>
using namespace std;
//问题描述,ABC + EFG = HIJ,其中A...J对应1-9中的某个数,使得等号成立,求出可能的情况
//EFG + ABC = HIJ和上面的算是一种情况
//这一问题可以用暴力枚举循环,因为某个数被用过之后就不能在被别的地方用,所以需要用桶标记法来标记该数是否被用过
//但这就需要嵌套10层循环,然后如果如果用到了某个数,则将桶置为1,最后看所以桶之和是否为9,为9说明每个数都被用了一次
//但你是否觉得过于复杂,所以我们引入了:深度优先搜索算法,该算法的基本思路是:重点是解决当前的问题,然后解决... | ALGO | 0.999888 | 4.304861 | {
"github_metadata": {
"branch": "main",
"commit_count": 707,
"repo_created_at": "2021-04-27T15:05: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": "7cd91931a9... |
7cd919a5-8ac2-46e8-9470-fffe7914801d | MonerMo/Competitive-Programming-Journey | Contests/CF/Div4-937/E.cpp | //
// Created by orabi on 3/28/2024.
//
#include <bits/stdc++.h>
using namespace std ;
int main(){
int t;
cin >> t ;
while(t--) {
int n;
cin >> n;
string s;
cin >> s;
vector<int> freq(26, 0);
for (int i = 0; i < n; i++) {
freq[s[i] - 'a']++;
... | ALGO | 0.999815 | 3.979814 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2024-02-07T21:30: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": "8010d1d95... |
55fabaf6-b700-440b-b780-653c45bd90d1 | EthanRay/summerEx1 | ex9.cpp | #include"stdfx.h"
int reverse23(int x){
long long r = 0;
long long t = x;
t = t > 0 ? t : -t;
for (; t; t /= 10)
r = r * 10 + t % 10;
bool sign = x > 0 ? false : true;
if (r > INT_MAX || (sign&&r > INT_MAX)){
return 0;
}
else{
if (sign){
return -r;
}
else{
return r;
}
}
}
bool isPalindro... | ALGO | 0.999839 | 4.177435 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2017-07-26T00:52:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8a8da684... |
6a41f0cb-4ece-43e5-bc09-07a0fc10d941 | ocarinamat/SumProductGraphMod | Factor.cpp |
#include "Factor.h"
using namespace std;
//todo stack derivative only for right in and out state
void CPTfactor::EMupdate(Real uniformPrior)
{
bool verbose = m_verbose;
if (verbose)
std::cout << "#####EMupdate for following factor \n" << this->ToString() << "with following beta \n" << m_logBeta.ToS... | ALGO | 0.998037 | 5.091729 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-03-27T16:04:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c4939f49d... |
80e3ed04-0bf1-4ff9-8c67-dfb0c6664598 | tungtokyo1108/SVBPhylo-Stochastic-Variational-Inference-for-Bayesian-Phylogenetics | SubMatrix.h |
/********************
PhyloBayes MPI. Copyright 2010-2013 <NAME>, <NAME>, <NAME>, <NAME>.
PhyloBayes 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 3 of the License, or (at your option) any late... | ALGO | 0.988089 | 5.105132 | {
"github_metadata": {
"branch": "master",
"commit_count": 124,
"repo_created_at": "2016-01-22T14:10:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "10047030... |
69dff9d8-9791-4061-ad40-851c508a3f15 | Arunganesh02/Leetcode-solutions | 0023-merge-k-sorted-lists/0023-merge-k-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTw... | ALGO | 0.99976 | 6.077385 | {
"github_metadata": {
"branch": "main",
"commit_count": 1081,
"repo_created_at": "2024-11-10T05:46: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": "1a700d5d9... |
0462cdca-3bc1-41cc-bd1e-ed03eb118472 | liangzongping/c- | 链表的插入与删除.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
typedef struct stu{
int num;
int score;
struct stu* next;
}STU;
void menu()
{
printf("1-----创建链表\n");
printf("2-----输出链表\n");
printf("3-----插入链表\n");
printf("4-----删除\n");
printf("0-----退出\n");
}
STU* create()
{
int n=0;
STU* head=NULL;
STU... | ALGO | 0.999409 | 3.212574 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2022-12-28T01:45:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8fc45b5a... |
205db4cf-7b9b-4a85-9984-5f31c24e4327 | gky360/contests | atcoder/arc076/d/d.cpp | // AtCoder Regular Contest 076
// D - Built?
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
const int MAX_N = 100000;
class UnionFind {
public:
vector<int> data;
void init(int size) {
... | ALGO | 0.999934 | 4.165601 | {
"github_metadata": {
"branch": "master",
"commit_count": 1196,
"repo_created_at": "2017-12-10T10:00:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efbac29... |
073a595b-2769-4db1-bbfe-b899ac139b47 | ashishgopalhattimare/LeetCode | Medium/binary-tree-coloring-game.cpp | // https://leetcode.com/problems/binary-tree-coloring-game/submissions/
// Medium
// Time Complexity : O(n)
// Space : O(height)
// Little Tricky
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), r... | ALGO | 0.999991 | 6.101311 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2018-08-17T11:47:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c3e360a25... |
e8a63600-8e86-450d-89a3-5bbffd3eba54 | Gieted/AiSD | Stosy i kolejki/zad6.cpp | #include <iostream>
using namespace std;
struct Kolejka
{
int el[100];
int zajete;
};
void addTab(Kolejka &kol, int x)
{
if (kol.zajete < 100)
{
kol.el[kol.zajete] = x;
kol.zajete++;
}
else
{
cout << "Kolejka jest pelna!" << endl;
}
}
int nextTab(Kolejka &kol)... | ALGO | 0.996001 | 3.210715 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-12-08T19:41:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "64c1add5ea... |
d4a4fd51-3521-4da7-b607-597c35ad5e0e | okmd/leetcode | backtracking/lb-12-largest-number-in-k-swaps.cpp | void helper(string& str, string& ans, int n, int k, int index) {
if (k == 0) return;
int mx = str[index];
for (int i = index + 1; i < n; i++) {
if (mx < str[i]) {
mx = str[i];
}
}
if (mx != str[index]) k--;
for (int i = n - 1; i >= index; i--) {
if (str[i] == ... | ALGO | 0.999996 | 5.146908 | {
"github_metadata": {
"branch": "main",
"commit_count": 529,
"repo_created_at": "2021-04-26T11:40:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f5a5723152... |
ffe2dfb0-8fe9-4cb3-9988-408cd2cfaf0c | GSGFs7/algorithm | template/欧拉函数.cpp | // 欧拉函数φ(n)
// 表示小于等于n的正整数中与n互质的数的个数 如:φ(6)=2 (1和5)
// 容斥原理
// 1~N中与N互质的个数
// 1.从1~N中去掉p[1],p[2]...p[k]的所有倍数
// 2.加上p[i]*p[j]的倍数
// 3.减去p[i]*p[j]*p[k]的倍数
// 以此类推,得到φ(n)=N(1-1/p[1])*(1-1/p[2])...(1-1/p[k])
// /
// 欧拉定理 a^φ(n) ≡ 1 (mod n)
// 费马定理 a^(p-1) ≡ 1 (mod p)
// 取模后的结果相等
// 同余
// a≡b(mod m)
// a... | ALGO | 0.999956 | 5.18134 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2024-08-28T14:53: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": "e2cc951d6d6... |
bd619955-9e38-4437-99fc-5238aee0e9ad | EduardoESS/AED2024_2-Tareas | homeworks/hw4/hw4_impl.h | #ifndef HW4_IMPL_H
#define HW4_IMPL_H
#include <string>
#include <vector>
#include "hw4.h"
using namespace std;
//########################## Funciones de Ayuda #############################
vector<int> computePrefix(string const & pattern){
size_t pathLength = pattern.size();
vector<int> prefix(pathLength, 0);
... | ALGO | 0.999572 | 5.10723 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-10-07T21:03:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "1212e2f6ceb... |
44a5fe53-237f-4e1c-a95f-b3d5b4358b5a | sravya273/DataStructures | Stack/CelebrityProblem.cpp | /*
A celebrity is a person who is known to all but does not know anyone at a party. If you go to a party of N people, find if there is a celebrity in the party or not.
A square NxN matrix M[][] is used to represent people at the party such that if an element of row i and column j is set to 1 it means ith person knows ... | ALGO | 0.999848 | 4.177088 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2020-06-09T18:32:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d0a309c08... |
7bc338a5-33b5-4139-989d-6ca0fd346575 | encrypted-def/Connect6-Web | cpp-backend/Connect6.h | #include <iostream>
#include <assert.h>
#include <time.h>
#include <vector>
#include <algorithm>
#include <set>
#include <assert.h>
#include <queue>
#include <stack>
using namespace std;
typedef unsigned int POSITION;
typedef unsigned int MOVES;
typedef unsigned int uint;
typedef unsigned long long ull;
// limitPos엔 최... | ALGO | 0.998607 | 3.875638 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2020-03-31T06:48:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "529f6a884c... |
5fb05fde-03dc-4334-86b1-b531aa1482fd | RodrigoRossetti/URI-OJ | Volume 26 (2600 - 2699)/2697/2697.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int k, n, x;
cin >> k >> n;
map<int, int> mapa;
for (int i = 1; i <= k; i++) mapa[i] = 0;
for (int i = 0; i < n; i++) {
cin >> x;
mapa[x]++;
}
vector<pair<int, int>> v;
for (auto... | ALGO | 0.999997 | 3.527707 | {
"github_metadata": {
"branch": "master",
"commit_count": 220,
"repo_created_at": "2020-07-05T17:19:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "02e7cbb2... |
6e747571-7956-4c24-baa5-ccfaf78e37ac | amit-haritwal/competitive | code chef/Byterace IIT Patna/Cybalphabit.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.999228 | 3.548055 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2020-12-20T11:16: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": "6ec8101738a... |
7a6e3dff-caf8-4d12-92e7-c480e5db5d98 | singh651/Coding-Journey | Striver_Arrays/Longest subarray with sum k (contains only positives).cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[1000],n;
cout << "Enter the number of elements : ";
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
int k;
cout << "Enter the required sub-array sum : ";
cin >> k;
int right = 0;
int left = 0;
i... | ALGO | 0.999886 | 3.882289 | {
"github_metadata": {
"branch": "main",
"commit_count": 82,
"repo_created_at": "2024-01-20T12:59:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b4df1dbe12a... |
110604c4-d1aa-468d-9ad6-dfbb970db80b | Suhao07/Xfeat-SLAM | xfeatc/src/Matcher.cc | //
// Created by d on 2024/7/13.
//
#include "Matcher.h"
void Matcher::Match(const cv::Mat &descs1, const cv::Mat &descs2,
std::vector<cv::DMatch> &matches, float minScore) {
cv::Mat scores12 = descs1 * descs2.t();
cv::Mat scores21 = descs2 * descs1.t();
std::vector<int> match12(descs... | ALGO | 0.982255 | 5.283624 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-08-09T09:29:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "602e187a4efd... |
7b020db7-f4bd-4c1c-a6f5-fb98fc0169fd | Grupo-4-IA/A_asterisco | A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ROW 9
#define COL 10
typedef pair<int, int> Pair;
typedef pair<double, pair<int, int> > pPair;
//Estructura de cuadros
struct cell {
// Notar que 0 <= i <= ROW-1 & 0 <= j <= COL-1
int parent_i, parent_j;
// f = g + h
double f, g, h;
};
// Verific... | ALGO | 0.99989 | 3.088537 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-04-11T20:04:15.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac8889ae74455... |
9b35a338-2ec2-4f76-b426-4e5418f1ee4d | bpanthi977/sph | grid.cpp | #include "vec2.h"
#include "types.h"
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iostream>
GridId grid_id(vec2 pos) {
GridId result;
result.x = floor(pos.x / (2 * SUPPORT_RADIUS));
result.y = floor(pos.y / (2 * SUPPORT_RADIUS));
return result;
}
bool grid_id_equal(GridId &g1, GridId &g2) ... | ALGO | 0.986651 | 5.662728 | {
"github_metadata": {
"branch": "main",
"commit_count": 57,
"repo_created_at": "2024-12-12T00:41:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "820cbd2af88... |
b3373d3c-95c4-4983-9712-a58c13850d0d | KhMontik/algolist | Data Structures/Interval Tree/RMQ top/step.cpp | /*
Finding maximal 10101.... segment length O(1)
Updating element O(logN)
<NAME>
*/
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 262144;
struct node {
int ans;
int suf0, suf1;
int pre0, pre1;
}a[4*N];
int n;
void upd (int i) {
i += N-1;
if (a[i].suf0) a[i].suf1 = a[i].pre1... | ALGO | 0.999943 | 3.533909 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2015-08-18T14:30:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29b1ebdf81... |
6c585321-8c79-491b-8d6c-2522771db27a | AliOsm/CompetitiveProgramming | SPOJ/MSE07E - Showstopper.cpp | /*
Idea:
- Binary Search
- If the summation of the range from low to mid is
even, then the required number is in range from
mid + 1 to high, otherwise the required number
is in range from low to mid.
*/
#include <bits/stdc++.h>
using namespace std;
vector<long long> x, y, z;
int main() {... | ALGO | 0.999934 | 3.378405 | {
"github_metadata": {
"branch": "master",
"commit_count": 595,
"repo_created_at": "2016-10-14T11:29:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 138,
"forks": 49,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8b5b2... |
cbacfb90-d91d-44c9-ba3f-d3bf9b542a26 | sigblips/SonATA | sig-pkg/dx/src/dedrift.cpp | /*******************************************************************************
File: dedrift.cpp
Project: OpenSonATA
Authors: The OpenSonATA code is the result of many programmers
over many years
Copyright 2011 The SETI Institute
OpenSonATA is free software: you can redistribute it and/or modify
... | ALGO | 0.959903 | 6.278332 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2011-03-02T21:14:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 29,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "da025010... |
901140b0-ef06-4646-8210-cff88902290a | BackupTheBerlios/placian-svn | trunk/libplacian/poly.h | #ifndef POLY_H
#define POLY_H
#include <iostream>
#include <vector>
template<typename T>
class polynomian{
std::vector<T> coeffs;
public:
//constructors
polynomian(){};
polynomian(const std::vector<T>&); //initalizing with zeros
polynomian(const polynomian<T>&x):coeffs(x.coeffs){} //copi... | TOOL | 0.937297 | 4.658301 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2015-08-15T07:45: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": "2fdb5adda... |
8516c869-4655-4215-9457-f9923364bd3b | ichyo/atcoder-submissions | cpp/ABC018/D.cpp | // Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;
template<typename T1, typename T2>
ostream& operator << (ostream& os, const pair<T1, T2>& p) {
os << "(" << p.first << ", " << p.second << ")";
return os;
}
template<typename T>
o... | ALGO | 0.999786 | 3.697504 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2017-07-01T01:14: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": "d94d00c6e... |
e508fb8d-e314-47da-9ccd-c60e50555c70 | WebKit/WebKit-http | Source/ThirdParty/libwebrtc/Source/webrtc/common_audio/real_fourier_ooura.cc | /*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... | ALGO | 0.998633 | 6.993312 | {
"github_metadata": {
"branch": "master",
"commit_count": 231005,
"repo_created_at": "2011-01-11T13:50:19.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4992,
"forks": 1983,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "... |
374b5184-6749-405f-9439-b76f872cc310 | paritybit-ai/XSCE | src/logreg/include/lr.h | /**
* Copyright 2022 The XSCE Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... | CONFIG | 0.913138 | 6.254457 | {
"github_metadata": {
"branch": "master",
"commit_count": 97,
"repo_created_at": "2022-07-12T07:55:39.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 18,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ce4b97a5... |
3a4f96d3-6fa3-4d8c-80ff-418e329ada55 | Jeonghwan-Yoo/BOJ | Samsung/17837.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int constexpr dr[4] = { 0, 0, -1, 1 };
int constexpr dc[4] = { 1, -1, 0, 0 };
enum Color
{
White = 0,
Red = 1,
Blue = 2,
};
struct Piece
{
int r, c, d;
Piece(int r, int c, int d) : r(r), c(c), d(d) {}
};
int N, K;
p... | ALGO | 0.99952 | 4.262864 | {
"github_metadata": {
"branch": "master",
"commit_count": 642,
"repo_created_at": "2020-03-09T16:38: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": "d2c55bd3... |
c89370ee-4f42-4b97-8213-7c76c7bcf5b0 | cocm1324/dingjigi-legacy | cho/_1037.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define CAPA 1000000
using namespace std;
int main(){
vector<int> temp, temp1;
vector<int> prime;
int capa = CAPA;
int n;
int temp_int;
long int temp_long_int = 1;
for(int i = 0; i <= capa; i++){
temp.push_back(i);
... | ALGO | 0.999982 | 4.99954 | {
"github_metadata": {
"branch": "master",
"commit_count": 118,
"repo_created_at": "2017-12-20T04:24: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": "8cac9e58... |
5af18360-404d-48d0-8704-4803427d592b | jeyong/realalg | graph_vector.cpp |
#include <iostream>
#include <map>
#include <vector>
using namespace std;
struct Graph {
map<int, vector<int>> vs;
};
void breadth_traversal(Graph& g, int source);
int main(int argc, const char * argv[])
{
Graph g;
g.vs.insert({0, {1, 6, 8}});
g.vs.insert({1, {0, 4, 6, 9} });
g.vs.insert({2, {4... | ALGO | 0.999917 | 4.886672 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2018-07-17T03:15:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "110755469... |
7714dfc6-ceca-4cba-a471-208ceca80cdd | zhugezy/codeforces | 1301/b.cpp | #include <bits/stdc++.h>
#define LL long long
using namespace std;
int T, n;
int a[100008];
int check(int m)
{
int l = 0, r = 1000000000;
for (int i = 1; i < n; ++i)
{
if (a[i] >= 0 && a[i + 1] >= 0)
{
if (abs(a[i] - a[i + 1]) > m)
return -1;
}
else if (a[i] >= 0)
{
l = max(l, a[i] - m);
r =... | ALGO | 0.999931 | 3.70262 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2020-03-31T03:30:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e2ce46d33... |
cf5c2c87-cece-4025-a2c1-5f3cb6942f44 | Giovanni-Verza/excursion_set_functions | src/cpp/excursion_set_cholensky.cpp | #include <iostream>
#include <array>
#include <vector>
#include <random>
#include <thread>
#include <map>
#if defined(_OPENMP)
#include <omp.h>
#endif
#include <math.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/numpy.h>
using namespace std;
namespace py = pybind11;
vector<... | ALGO | 0.999328 | 4.369536 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-02-05T16:11:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc711e39cd7... |
ecb764c4-0ce4-483d-b5ff-67cb28534b90 | imsangamesh/DSA | RESTART/04_WEEK_2_ASS/12_even_or_odd.cpp | #include <iostream>
using namespace std;
bool isEven(int n) { return n % 2 == 0; }
bool isEvenByBitwise(int n) {
//* Least Significant Bit (LSB) is 0 for even &
//* Least Significant Bit (LSB) is 1 for odd
if ((n & 1) == 0) {
return true;
} else {
return false;
}
}
int main() {
int n;
cin >> n;... | ALGO | 0.999617 | 5.039765 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2023-04-04T02:53:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5dd613cf8... |
6fbda923-cb1f-400f-a945-e362c5ac4c13 | huyluongme/PTTKTT-CTU | Sort/SelectionSort.cpp | #include <iostream>
#include <fstream>
#include <vector>
typedef int keytype;
typedef float othertype;
typedef struct {
keytype key;
othertype otherfields;
}recordtype;
void read_data(const char filename[], std::vector<recordtype>* data) {
std::ifstream input(filename);
if (input.fail()) {
std::cout << "Cannot... | ALGO | 0.992748 | 4.001064 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2022-04-30T16:57:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3c3a8caa0a4... |
487e07c0-7637-4c63-b93b-1066343cb4b8 | cosmicray001/academic | problem_solving/SPOJ/TDPRIMES/12696119_AC_530ms_64512kB.cpp | #include <bits/stdc++.h>
#define le 100000008
using namespace std;
bool n[le >> 1];
vector <int> v;
void se(){
int rt = sqrt(le) + 1, k;
v.push_back(2);
v.push_back(2);
for(int i = 3; i <= rt; i += 2){
if(!n[i >> 1]) for(int j = i * i, k = i << 1; j <= le; j += k) n[j >> 1] = 1;
}
... | ALGO | 0.993989 | 3.320413 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2020-04-11T01:01:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "c34663eca... |
adfabbce-1d02-4d2c-9dcd-56838ba28a1d | romanpogodin/k-cliques-k-partite-graphs | partite_binary_graph.cpp | //
// Created by <NAME>, 2018.
//
#include "partite_binary_graph.h"
PartiteBinaryGraph::PartiteBinaryGraph(std::vector<std::vector<bool>> adjacency_matrix,
std::vector<int32_t> vertex_partitions)
: adjacency_matrix_(std::move(adjacency_matrix)),
vertex_partitions_(std:... | ALGO | 0.999951 | 6.719635 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2018-10-23T10:58:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "41ca18d150... |
261238dd-3a67-4860-9c3a-7338a8819940 | LuisGoncalves05/P | Programas/TT1/mandelbrot.cpp | #include <iostream>
#include "complex.h"
using namespace std;
void mandel(complex c, int n, complex z[]);
complex mandel_single(complex c, int n);
complex op(complex comp, complex c);
int main() {
{ complex c = { 0, 0 };
const int n = 1;
complex z[n];
mandel(c, n, z);
print(z, n); }
//[ 0 ]
{ complex c = { 0... | ALGO | 0.999217 | 5.09461 | {
"github_metadata": {
"branch": "Prog",
"commit_count": 9,
"repo_created_at": "2024-04-24T15:53: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": "fb9deb3b67c8... |
97b158ca-14e1-465e-8cc2-22d7bb5e05f5 | coolfluid/coolfluid3 | cf3/mesh/Integrators/GaussImplementation.hpp | // Copyright (C) 2010-2013 <NAME> for Fluid Dynamics, Belgium
//
// This software is distributed under the terms of the
// GNU Lesser General Public License version 3 (LGPLv3).
// See doc/lgpl.txt and doc/gpl.txt for the license text.
#ifndef cf3_mesh_Integrators_GaussImplementation_HH
#define cf3_mesh_Integrators_Gau... | ALGO | 0.948962 | 6.201463 | {
"github_metadata": {
"branch": "master",
"commit_count": 6081,
"repo_created_at": "2011-08-08T12:37:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 78,
"forks": 77,
"issues": 60,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1211... |
4bcc9049-8bce-4356-82a5-d6833bec31a8 | keshavsingh4522/hacktoberfest | CPP/fastModularExponentiation_recursion.cpp | #include<iostream>
using namespace std;
int fasExpo(int a, int n, int mod)
{
// base condition
if(n == 0)
return 1;
// a ^ n % mod
if(n % 2 == 0)
// a ^ n = ((a ^ 2) ^ (n / 2))
return fasExpo((1LL * a * a) % mod, n / 2, mod);
// since if statement is a return statemen... | ALGO | 0.999924 | 4.616006 | {
"github_metadata": {
"branch": "master",
"commit_count": 1792,
"repo_created_at": "2020-09-24T18:11:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 864,
"forks": 3955,
"issues": 175,
"pull_requests": 2716
},
"file_meta": {
"content_id"... |
7c17f441-d269-4d70-a26e-3502053c5dee | Hemant2A2/Codeforces | Astrophysicists.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <math.h>
#include <vector>
#include <utility>
#include <stdio.h>
#include <string>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
using namespace std;... | ALGO | 0.999934 | 3.303169 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-10-02T13:21:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "411816713128... |
9de4cc42-4dab-4035-a395-db39db4a9517 | yoon-yk/LeetcodeSubmission | 257-binary-tree-paths/257-binary-tree-paths.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.999972 | 6.101977 | {
"github_metadata": {
"branch": "main",
"commit_count": 6029,
"repo_created_at": "2021-05-29T13:24: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": "17d081877... |
f888c301-b0ea-4213-a328-e83a14c5bee0 | pratyush2331/DSA_Love-Babbar | XX. AAA_Platform/Codeforces/Contests/Codeforces Round 962 (Div. 3)/B_Scale.cpp | // <NAME>
// Codeforces : https://codeforces.com/contest/1996/problem/B
#include<bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << '[' << __FILE__ << ':' << __LIN... | ALGO | 0.999452 | 4.165608 | {
"github_metadata": {
"branch": "master",
"commit_count": 538,
"repo_created_at": "2023-06-24T10:52:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5feac1ac... |
e070ee51-3c9f-4f7b-909b-70623a60af69 | tanishq1306/DSA-Solved-Questions | Array/4_sort_array_of_0_1_2/sort_the_array_0_1_2.cpp | /**
* author: tanishq
* created: 15.10.2020
**/
#include <bits/stdc++.h>
using namespace std;
//This approach count the number of 0, 1, and 2s
void approach1 ();
//This approach uses dutch flag method
void approach2 ();
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999983 | 3.963403 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2020-10-17T09:30:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73e1ccd11f... |
451359dd-7ad5-4e7e-8f03-3580ad2f8139 | upupming/algorithm | AdvancedLevel_C++/1159. Structure of a Binary Tree (30).cpp | #include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
struct TreeNode {
int key, level;
TreeNode* parent;
TreeNode* left;
TreeNode* right;
TreeNode(int key) : key(key) {}
};
bool is_full = true;
unordered_map<int, TreeNode*> nodes;
TreeNode* Build(int* postorder, in... | ALGO | 0.999981 | 4.739829 | {
"github_metadata": {
"branch": "master",
"commit_count": 1248,
"repo_created_at": "2019-10-25T07:41:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 328,
"forks": 38,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c180... |
d4ae59f6-7b4e-426f-be5b-acd6e5d5e352 | dpkass/HHU-Competitive-Programming | B10 - Contest 8/knapsack.cpp | //
// Created by dpkass
//
#include <bits/stdc++.h>
using namespace std;
#define Speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define print(i) cout << i << endl
#define print_col(a) for(auto item: a) cout << item << ' '
#define int ... | ALGO | 0.999969 | 4.027442 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2023-07-22T12:01:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94845f494... |
84a9c2d1-8de7-4896-8415-bf21f83d2d46 | lekemula/compile_scheduler | src/algorithm/greedy_constructor.cpp | //
// Created by <NAME> on 30.11.19.
//
#include "algorithm/greedy_constructor.h"
#include <iostream>
#include <random>
#include "helpers.h"
unique_ptr<Solution> GreedyConstructor::construct(Problem& problem) {
int step = -1;
bool solutionComplete = false;
while (!solutionComplete) {
step += 1;
std::... | ALGO | 0.999783 | 5.436351 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2019-09-16T21:48: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": "2820508bc... |
23c8b535-b2c3-4dad-b652-880aef66433b | GurleenRajpal/DS-Cpp-Codes | _17_BST/_14_path_sum_to_leaf.cpp | // Path Sum Root to Leaf
// Send Feedback
// For a given Binary Tree of type integer and a number K, print out all root-to-leaf paths
// where the sum of all the node data along the path is equal to K.
// Input Format:
// The first line of input will contain the node data, all separated by a single space. Since -1 ... | ALGO | 0.999834 | 4.593589 | {
"github_metadata": {
"branch": "main",
"commit_count": 503,
"repo_created_at": "2022-02-23T06:35:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "84426838ff... |
c6bc2f14-2954-4f38-97b0-dec9234e19f8 | ethz-asl/segmap | segmatch/include/segmatch/normal_estimators/incremental_normal_estimator.hpp | #ifndef SEGMATCH_INCREMENTAL_NORMAL_ESTIMATOR_HPP_
#define SEGMATCH_INCREMENTAL_NORMAL_ESTIMATOR_HPP_
#define PCL_NO_PRECOMPILE
#include <pcl/search/kdtree.h>
#include "segmatch/normal_estimators/normal_estimator.hpp"
namespace segmatch {
/// \brief Incremental version of least squares normal estimation.
class Incr... | ALGO | 0.990126 | 7.398088 | {
"github_metadata": {
"branch": "master",
"commit_count": 229,
"repo_created_at": "2016-09-20T15:42:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1095,
"forks": 392,
"issues": 63,
"pull_requests": 3
},
"file_meta": {
"content_id": "d97... |
ce8cfb97-0e01-4cea-9e23-c64d32cec66d | johanafl/FYS3150-4150 | project4/src/energy_solver.h | #ifndef ENERGY_SOLVER_H
#define ENERGY_SOLVER_H
#include "circular_matrix.h"
class IsingModel
{
protected:
double* exp_delta_energy = new double[17]; // pre-calculated energy values
int row; // row index, will be randomly drawn
int col; // column index, will be randomly drawn
double metropolis... | ALGO | 0.999367 | 5.300365 | {
"github_metadata": {
"branch": "master",
"commit_count": 502,
"repo_created_at": "2019-08-22T08:27:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b71d353a... |
ed5397b4-84b4-48e0-b3b9-fa822427ab6b | jonatas57/maratona | uva/00459-GraphConnectivity.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef pair<int, int> ii;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f... | ALGO | 0.999586 | 3.724451 | {
"github_metadata": {
"branch": "master",
"commit_count": 225,
"repo_created_at": "2019-02-13T13:09:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5d4aad1... |
87400d4b-651b-4ba2-b56a-3bce3eed1a5d | aronpetko/integral | src/engine/evaluation/nnue/accumulator.h | #ifndef INTEGRAL_ACCUMULATOR_H
#define INTEGRAL_ACCUMULATOR_H
#include "../../../../shared/nnue/definitions.h"
#include "../../../../shared/simd.h"
#include "../../../chess/board.h"
#include "../../../utils/fused.h"
#include "nnue.h"
namespace nnue {
constexpr U8 kBucketDivisor =
(32 + arch::kOutputBucketCount -... | ALGO | 0.98287 | 7.246156 | {
"github_metadata": {
"branch": "main",
"commit_count": 654,
"repo_created_at": "2023-10-25T17:47:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 73,
"forks": 10,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "23682aa3... |
4840e712-6833-4179-881d-01fdd1ef1109 | 543877815/algorithm | leetcode/c++/LCP 07. 传递信息.cpp | // 深度优先搜索
// 时间复杂度:O(n^k)
// 空间复杂度:O(n+m+n^k)
class Solution {
public:
void dfs(vector <vector<bool>> &graph, int k, int curr, int &res) {
int n = graph.size();
if (k == 0) {
if (curr == n - 1) res++;
return;
}
for (int i = 0; i < n; i++) {
if (cur... | ALGO | 0.999991 | 5.889238 | {
"github_metadata": {
"branch": "master",
"commit_count": 283,
"repo_created_at": "2019-05-26T12:35: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": "408d8f74... |
ea74f842-109c-4ddf-9611-9e8157d0555f | YudhaPutraRamadhan/062_BubbleSort | PertemuanKetiga/PertemuanKetiga/PertemuanKetiga.cpp | #include <iostream>
#include <string>
using namespace std;
int arr[20]; //Deklarasi variabel global array a dengan ukuran 20
int n; // Deklarasi variabel global n untuk menyimpan banyaknya elemen pada array
void input() { //Prosedur input
int d;
while (true) {
cout << "Masukan banyaknya elemen... | ALGO | 0.990637 | 3.996372 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2024-03-08T09:44: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": "cacf12adb... |
f6113595-55c9-41ed-8907-516d5fb57179 | shengsli/stencil | dev_stencil_code_v1/ShengExamples/Median2D/median2D.cpp | /**
* g++ median2D.cpp -std=c++11 -O2 -lpthread -DNTHREADS=4 -DNDATABLOCKS=100 -DRADIUS=1 -DNROWS=4 -DNCOLS=5 -DPADDING=0 -DNITERS=4 -DOUTPUT -o median2D
* ./median2D
*/
#include <cassert>
#include <sys/time.h>
#include "../../Stencil2D.hpp"
void print_arr(int *arr, int size)
{
int i;
for (i=0; i<size-1; i++)
... | ALGO | 0.999879 | 5.860114 | {
"github_metadata": {
"branch": "master",
"commit_count": 134,
"repo_created_at": "2019-02-18T18:00: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": "074ad70a... |
975da82d-1f78-4d8a-9d43-a02b6b747c76 | majerler/Scientific_Computing_HW | homework3/Homework3/main.cpp |
#include <iostream>
#include <../classes/grid2d.h>
#include <../classes/math_tools.h>
#include <../classes/sl_method.h>
#include <../classes/godunov.h>
#include <vector>
#include <math.h>
#include <cmath>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
// Set up for grid
double xmin =... | ALGO | 0.999771 | 4.666368 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-10-05T05:29: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": "b2cf5765e1... |
ddcc93c0-b06b-4608-9fc5-1b279671944e | notusedusername/udprog | szimmat.cpp | //Helytakarékosan ábrázolt szimmetrikus mátrix 28 elemű vektorban felírt formáját
//alakítja szembarátabb mátrixos ábrázolásba. Nem feltétlen helyes algoritmus, but
// I guess I will pass. Továbbfejleszthető custom vektor beolvasására, és a méret alapján,
//hiba vagy a mátrix kiírására.
#include <iostream>
#include <... | ALGO | 0.999693 | 3.261557 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2018-02-21T18:40: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": "efb7834d9... |
da3e28f8-4679-4411-932c-d7e256262e44 | proRamLOGO/Competitive_Programming | JAN2019_LONG/Distinct_Pairs.cpp | #include <iostream>
#include <vector>
using namespace std ;
int main() {
int n, m ;
cin >> n >> m ;
vector< int > a(n), b(m) ;
for ( auto i = 0 ; i < n ; ++i )
cin >> a[i] ;
for ( auto i = 0 ; i < m ; ++i )
cin >> b[i] ;
for ( auto i = 1 ; i < m ; ++i ) {
cout <... | ALGO | 0.99992 | 3.109762 | {
"github_metadata": {
"branch": "master",
"commit_count": 48,
"repo_created_at": "2018-10-01T07:05:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 10,
"issues": 1,
"pull_requests": 4
},
"file_meta": {
"content_id": "6206674f... |
70797747-b5ec-4aeb-b959-c970b9440b8a | chenhongqiao/USACO | convention/convention.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> t;
int n, m, c;
int check(int v)
{
int l = t[0];
int cnt = 0;
int k = 0;
for (int i = 0; i < n; i++)
{
if (t[i] - l > v || k == c)
{
k = 0;
l = t[i];
cnt++;
}
k++;
}
... | ALGO | 0.999997 | 4.311319 | {
"github_metadata": {
"branch": "master",
"commit_count": 208,
"repo_created_at": "2020-06-10T17:06:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63a72e24... |
043ea59e-a63e-4a01-9cab-41c7cfcc3e35 | D4rkMn/ProyectoEDA | content/Algorithms/MMR/MMR.tpp | #include "Algorithms/MMR/MMR.h"
#include <unordered_set>
#include <iostream>
#include <limits>
template<typename T>
double MMR<T>::objective_function(const Data<T>& o_i, const Data<T>& o_q, std::vector<Data<T>>& R) const {
double result = (1 - this->lambda) * this->distance_sim(o_i, o_q);
double sum = 0;
f... | ALGO | 0.999869 | 5.669533 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2024-11-18T02:25: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": "172ba364005... |
751bcd8a-ef27-4ae3-8a26-e4271a5c4459 | Kamrul-Hasan-1971/SPOJ.com | PR003004 - Digit Sum.cpp | #include<bits/stdc++.h>
using namespace std;
const int NX = 30 ;
#define ll long long int
#define pb push_back
ll dp[20][2][2][185];
int vis[20][2][2][185];
int lim, tt ;
vector < int > inp ;
ll DP( int pos, int isSmall,int isStart , int sum )
{
if( pos == lim )
return sum ;
ll &ret1 = dp[pos][isSmall... | ALGO | 0.999943 | 3.927413 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2019-05-12T13:19: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": "6912a7c21... |
09b08647-732d-4550-8ad5-6adc8b8d5a52 | csm9278/Algorithm-Solve | 프로그래머스/1/67256. [카카오 인턴] 키패드 누르기/[카카오 인턴] 키패드 누르기.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int CheckCost(int number, int target)
{
int cost = 0;
while(number != target)
{
cost ++;
if(target > number)
if(target >= number + 3)
number += 3;
else
numbe... | ALGO | 0.999993 | 5.374279 | {
"github_metadata": {
"branch": "main",
"commit_count": 183,
"repo_created_at": "2023-10-19T00:36: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": "35b1a711dc... |
a7621e54-2acf-48ed-ad67-5956e41f6c75 | chaeeun0409/Cpp_study | 수행평가/2115/2115/2115_merge_9.cpp | // 2115 이채은
#include <iostream>
using namespace std;
void Sort(int* n, int len) {
for (int i = 0; i < len; i++) {
for (int j = i + 1; j < len; j++) {
if (n[i] > n[j]) {
int tmp = n[i];
n[i] = n[j];
n[j] = tmp;
}
}
}
}
int main() {
int A[5];
int B[5];
int cnt = 0;
cout << "첫번째 병합 데이타 5개 입력... | ALGO | 0.999993 | 3.945761 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2022-04-13T02: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": "f79632576a... |
bae1bff0-d217-4b8d-8d6f-d0d90326f117 | Haileamlak/learning-cpp | permute.cpp | #include"std_lib.cpp"
using namespace std;
void triangle();
void work();
int getnumber();
long long permutation(int a, int b), combination(int a, int b), fatorial(int a);
int main()
{
work();
return 0;
}
void work()
{
int a, b;
char choice;
cout<<"Enter two numbers!\nnumber 1 : ";
a = getnum... | ALGO | 0.999858 | 3.788836 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-03-09T09:57: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": "29752f8a1193... |
c63d01a4-6839-484f-a6f7-ffa0d6d5def9 | vedant1508/fds-Practicals | 11.Job Queue.cpp | #include<iostream>
using namespace std;
class que
{
int jobId,jobTime;
que *next;
public:
static que *front,*rear;
que()
{
cout<<"\nEnter the Job ID:";
cin>>jobId;
cout<<"\nEnter the Job time:";
cin>>jobTime;
next=NULL;
if(front==NULL)
{
... | ALGO | 0.996132 | 4.525995 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2023-01-01T07:53:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "79f00dd3628... |
e296c1dd-daa4-4f16-8065-8acdb0e997e4 | NearXdu/leetcode | leetcode72/72.cpp | class Solution {
private:
int myMin(int a, int b, int c)
{
if (b < a)
a = b;
if (c < a)
a = c;
return a;
}
public:
int minDistance(string word1, string word2) {
int len1 = word1.length();
int len2 = word2.length();
vector<vector<int>>dp(len1 + 1,... | ALGO | 0.999995 | 5.131164 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2017-01-03T12:54: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": "2dbc6cefc... |
7021dd64-54ee-4051-a1ec-11671dee07c2 | projectchrono/chrono | src/chrono/collision/bullet/BulletCollision/BroadphaseCollision/cbtDbvt.cpp | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 <NAME> http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is ... | ALGO | 0.998194 | 4.776507 | {
"github_metadata": {
"branch": "main",
"commit_count": 18253,
"repo_created_at": "2013-09-03T15:34:23.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2460,
"forks": 515,
"issues": 101,
"pull_requests": 4
},
"file_meta": {
"content_id": "c0... |
20deb243-a5fc-4521-9bb2-e23df0c8f94f | guyutongxue/ica2022 | docs/public/ica/66bfd3bf775f4aac89faca45634fa4d1.cpp | #include <iostream>
#include <cctype>
using namespace std;
bool tryParse(const char* str, int* n) {
int multiplier = 1;
if (*str == '-') multiplier = -1, str++;
else if (*str == '+') str++;
if (*str == '\0') return false;
int x = 0;
while (*str) {
if (isdigit(*str)) {
x = x... | ALGO | 0.982279 | 3.639423 | {
"github_metadata": {
"branch": "main",
"commit_count": 71,
"repo_created_at": "2022-09-07T16:34:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "327bf17698e... |
94cfd6d5-e437-43a5-adf4-ed83e85c6649 | anantatapase/SPOJ | CCHESS.cpp | #include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
void bfs(int a,int b,int c,int d) ;
int check(int a,int b,int c,int d,int cs);
int main()
{
int a,b,c,d;
while(scanf("%d",&a)!=EOF)
{
scanf("%d %d %d",&b,&c,&d);
bfs(a,b,c,d);
}
return 0;
}
int check(int a,... | ALGO | 0.999848 | 3.496423 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-08-02T09:12:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dd77ea8cc0... |
577e6934-5db6-4008-b510-ccb2680e4323 | korbiniak/SolverMachine | Solver3/src/gen.cpp | #include "include/gen.h"
Gen::Gen() {}
void Gen::generate(uint8_t level) {
if(level > 6) {
cout << "Pruning table will be too big, 6 is maximum.";
return;
}
cout << "Generating..." << "\n";
queue<pair<pair<Cube, string>, uint8_t>> q;
unordered_map<Cube, bool, HashStruct> vis;
Cube cube((int)0);
ofstream p... | ALGO | 0.996052 | 4.223022 | {
"github_metadata": {
"branch": "my-branch",
"commit_count": 3,
"repo_created_at": "2019-02-18T21:19:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59e690b... |
84d3a326-66ff-4477-8b66-613ac2662159 | klzgrad/naiveproxy | src/third_party/boringssl/src/crypto/stack/stack.cc | // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless... | TOOL | 0.941497 | 6.679755 | {
"github_metadata": {
"branch": "master",
"commit_count": 66,
"repo_created_at": "2018-01-27T16:02:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7097,
"forks": 903,
"issues": 6,
"pull_requests": 0
},
"file_meta": {
"content_id": "5dd4... |
d4ba3968-c319-4381-b3f7-ed32c2f65d55 | RogDum/OI2024 | p9751.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,k;
struct Edge {
int u, v, w, a;
Edge(int _u, int _v, int _w, int _a) : u(_u), v(_v), w(_w), a(_a) {}
};
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> Q,R;
vector<vector<Edge>> adj; // 邻接表,每个索引代表一个节点,向量存储边
int d[20010][],p[20... | ALGO | 0.999991 | 3.480373 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-08-07T01:46: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": "8c92b680076c... |
732042f1-33f0-4916-9e0c-eac5fc930ade | thijsjanzen/onco_viral_sim | Simulation/node.cpp | //
// node.cpp
// Cancer_v1
//
// Created by <NAME> on 13/11/2019.
// Copyright © 2019 <NAME>. All rights reserved.
//
#include <cassert>
#include <iostream>
#include <array>
#include <cmath>
#include <array>
#include <fstream>
#include "node.hpp"
#include "random_thijs.hpp"
node::node() {
node_type = empty;
... | ALGO | 0.999075 | 5.058436 | {
"github_metadata": {
"branch": "master",
"commit_count": 273,
"repo_created_at": "2019-11-13T18:20:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "7432e08d... |
1164b98e-2390-447f-aec7-609e4d42c922 | themeelanoid/Algorithms_Data_Structures | trees&friends/heap.cpp | /*
ОПИСАНИЕ
Реализуйте двоичную кучу.
Обработайте запросы следующих видов:
insert x — вставить целое число x в кучу;
getMin — вывести значение минимального элемента в куче (гарантируется, что к этому моменту куча не пуста);
extractMin — удалить минимальный элемент из кучи, выводить его не нужно (гарантируется, что к эт... | ALGO | 0.999802 | 5.199641 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2023-04-09T20:11:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "78a5adb0fc2b... |
dd4ca719-ef73-4841-ab03-7575ba24044a | donbasta/leetcode-submissions | Easy/401.cpp | class Solution {
public:
vector<string> readBinaryWatch(int turnedOn) {
vector<vector<int>> c1(5), c2(7);
for (int i = 0; i <= 11; i++) {
c1[__builtin_popcount(i)].push_back(i);
}
for (int i = 0; i <= 59; i++) {
c2[__builtin_popcount(i)].push_back(i);
... | ALGO | 0.994261 | 5.988178 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-11-05T03:05:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f0ea55bb654f... |
65cde122-25fd-40bf-b2dc-7f3cb794748d | cheuk-fung/Programming-Challenges | Codeforces/Div2/R128/D.cc | #include <iostream>
#include <cstdio>
using namespace std;
const double eps = 1e-8;
inline bool ls(double x, double y) { return x + eps < y; }
inline bool gr(double x, double y) { return x - eps > y; }
int main()
{
int a, b, m;
while (cin >> a >> b >> m) {
int vx, vy, vz;
cin >> vx >> vy >> ... | ALGO | 0.999846 | 3.66929 | {
"github_metadata": {
"branch": "master",
"commit_count": 423,
"repo_created_at": "2011-03-05T17:28:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d0a972a0... |
81316d3d-5f2a-48b4-b7fc-a9bcf6fe62fb | jacklynchiaentsai/leetcode-practices | 122. Best Time to Buy and Sell Stock II/122.cpp | /*
the way to gain maximum profit is by getting the profit every time possible
time: O(N)
space: O(1)
*/
class Solution {
public:
int maxProfit(vector<int>& prices) {
// stores the indices of current maximum and minimum positions
int curmin = 0, curmax = 0;
int profit = 0;
for(int i ... | ALGO | 0.999964 | 6.034081 | {
"github_metadata": {
"branch": "main",
"commit_count": 297,
"repo_created_at": "2023-07-09T12:17: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": "64b78be781... |
dc3664e6-c782-417f-8d9d-3cca2e7bf0c6 | Gaurav9651/DSA_Important_questions | arrays/Imp/Trapping_rain_water.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
// Function to find the trapped water between the blocks.
public:
int min(int a,int b)
{
if(a<b)
{
return a;
}
return b;
}
int trappingWat... | ALGO | 0.99999 | 6.423254 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2021-06-14T17:44:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f7061fc1a3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.