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 |
|---|---|---|---|---|---|---|---|
e8b493a7-ebc2-4edc-bb63-4c4877cb1c20 | nqbao1501/doAn1 | codeDoAn1/mpuFunctions.ino | void calibrateMpu() {
AccXError = 0;
AccYError = 0;
AccZError = 0;
for (int i = 0; i < 1000; i++) {
mpu.getAcceleration(&AccX, &AccY, &AccZ);
AccXError += AccX;
AccYError += AccY;
AccZError += AccZ;
delay(3);
}
AccXError /= 1000;
AccYError /= 1000;
AccZError /= 1000;
}
void getMpuA... | TOOL | 0.942788 | 4.592794 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-01-17T18:59:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eec10fce84ca... |
e19134a9-3e5b-4806-98b9-84275f6cc34e | NuChitsanupong/prob-solve | 0-pdf-por/pdf-problem/mid59_jumpgame.cpp | <<<<<<< HEAD
#include <iostream>
using namespace std;
int a[100][100], n, k, Initial=1;
int walk(int i, int j, int cur){
int ans=0, next;
// cout << i << ' ' << j << ' ' << cur << endl;
if(i==n && j==n) return 1;
else if(i<=0 || j<=0 || i>n || j>n) return 0;
if(cur+k>=a[i][j]||Initial){
Ini... | ALGO | 0.999975 | 4.154735 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2019-04-26T14:12: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": "a6078f2dc... |
edda93e5-31a1-40b3-803d-63570b7c258d | anhkha2003/Algorithms | Graph/Flows/MaxFlow/dinic.cpp | // Use:
// Constructor: Dinic dinic(n)
// 0-index (dinic(n + 1) if 1-index)
// add edges: dinic.addEdge(u, v, c) (u -> v)
//
// trace: for (auto e: dinic.E) {
// if (e.flow && e.cap) {
// cout << e.u << " " << e.v << " " << e.flow << endl;
// }
// }
//
// minCut: i from (0 to dinic.N - 1): dinic.d[i] != dini... | ALGO | 0.9985 | 5.112352 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2022-03-21T06:52:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e79a621c... |
d261bc55-e621-4ffc-b14e-c917d9bd7300 | Schnee-B/SCAU_OJ | Advanced Progreamming/Advanced Progreamming/8635 气球.cpp | #include<cstdio>
int main()
{
int i, j, k, n, m, x, a[5] = { 0,0,0,0,0 }, b = 0, sum = 1;
scanf("%d %d", &n, &m);
for (i = 0; i<m; i++)
scanf("%d", &a[i]);
if (m == 1) printf("1");
else
{
for (i = 0; i<m - 1; i++)
{
if (a[i] == a[i + 1]) b++;
}
for (i = 0; i<m; i++)
{
for (j = n; j>a[i]; j--) su... | ALGO | 0.999998 | 3.365977 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2016-10-15T15:55:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d80e95e216... |
5d205edc-f3f1-4dd6-b9b6-b7a53bcae116 | yoyoqq/CodeForces | 3170. Lexicographically Minimum String After Removing Stars.cpp | // class Solution {
// public:
// string clearStars(string s) {
// // pq to get smallest -> char, idx
// priority_queue<pair<char, int>, vector<pair<char, int>>, greater<pair<char, int>>> pq;
// for (int i=0; i<s.size(); i++){
// char c = s[i];
// if (c == '*'){
// ... | ALGO | 0.999979 | 4.846566 | {
"github_metadata": {
"branch": "main",
"commit_count": 486,
"repo_created_at": "2024-03-01T13:04: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": "07df4b824a... |
f473869b-a20d-44b9-9da0-a1d99168db74 | PSukhalani-96/Programming-Practice | variation_in_Majority_element.cpp | /*
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.
Note: The algorithm should run in linear time and in O(1) space.
Example 1:
Input: [3,2,3]
Output: [3]
Example 2:
Input: [1,1,1,3,3,2,2,2]
Output: [1,2]
*/
class Solution {
public:
vector<int> majorityElement... | ALGO | 0.999972 | 6.14957 | {
"github_metadata": {
"branch": "master",
"commit_count": 145,
"repo_created_at": "2019-05-24T12:46:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29f1b8d3... |
a8fc346e-9939-4cd5-890e-f02212c2a333 | vaughn-k/Algorithm | greedy/directSpecify/P_bj12904.cpp | /*/////////////////////////////////////////////////////////////////////////
날짜 : 2021.03.19
소요시간 : 17m
문제명 - 백준 12904 - A와 B
알고리즘
- 그리디
- 다이렉트 접근
문제개요
A,B로 이루어진 문자열이 두개 주어지고 정해진 조건에 따라 두 문자열이 같아질수 있는지 구하는 문제
1. 문자열에 A추가 (x -> xA)
2. 문자열을 뒤집고 B추가 (x -> x'B)
조건에 따르면 어떤 문자열에 바로 A를 붙이거나 뒤집고 ... | ALGO | 0.999971 | 4.019793 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2021-02-20T16:06: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": "281a7875d... |
8a6b8928-7e17-49fd-908e-24d367325ecf | maksimdrachov/advent-of-code-2022 | day-2/main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
std::map<std::string, std::string> opponent_RPS = {
{"A", "rock"},
{"B", "paper"},
{"C", "scissors"}
};
std::map<std::string, std::string> player_RPS = {
{"X", "rock"},
{"Y", "paper"},
{"Z", "... | ALGO | 0.999853 | 4.873222 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-01-04T15:05: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": "ed705fee53... |
9700d6f4-9f3a-4de8-bac4-d6ddfe9a5ed1 | ppppkkkk/poj | ez_or_simulate/ez/2583.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <map>
using namespace std;
//f(x) = Ax2 + Bx + C,给出f(0), f(1), f(2),算出f(3), f(4), f(5)
int main()
{
double a, b, c;
int x, y, z;
while (cin>>x>>y>>z)
{
a = (z +... | ALGO | 0.998671 | 3.753373 | {
"github_metadata": {
"branch": "main",
"commit_count": 426,
"repo_created_at": "2022-06-07T13:58:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2cf583b93d... |
8a77abdf-1d67-449a-91c8-d70b77758c2d | Mr-Phoebe/ACM-ICPC | 比赛源码/2016 Multi-University Training Contest 05/K-wolf Number/std.cpp | #include <bits/stdc++.h>
using LL = long long ;
std::vector<int> L,R;
int K;
std::map<std::vector<int>,LL> dp[18];
LL calc(int at,std::vector<int> mask,bool samel,bool samer) {
if (at == -1) {
return 1;
}
bool save = !(samel | samer);
if (save && dp[at].find(mask) != dp[at].end()) {
re... | ALGO | 0.999424 | 4.310174 | {
"github_metadata": {
"branch": "master",
"commit_count": 421,
"repo_created_at": "2015-11-16T08:47:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aac8551... |
237d7813-6278-4125-bf68-6df2e7c75f72 | ishandutta2007/codeforces-t | tokusakurai/normal/1737/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define per(i, n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define per2(i, l, r) for (int i = (r)-1; i >= (l); i--)
#define each(e, v) for (auto &e : v)
#define MM << " " <<
#defin... | ALGO | 0.999792 | 4.12817 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:27: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": "9ee4bc50f50a... |
6e8673f2-f6e5-4991-8ebd-aab19ad5ec84 | pm306/procon | 企業コン/google code jam/Moons ans Umbrellas(Attempt1).cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define al... | ALGO | 0.999835 | 4.593623 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-02-28T10:20: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": "df31e1df98... |
01d7bde9-387f-4c43-8b49-43ced9a89613 | ibudiselic/contest-problem-solutions | tc 160+/ConversionMachine.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
long long A[145][145];
long long ret[145][145];
long long tmp[145][145];
long long foo[145][... | ALGO | 0.999929 | 3.866917 | {
"github_metadata": {
"branch": "master",
"commit_count": 75,
"repo_created_at": "2011-08-14T11:43:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e66d4837... |
3bdac4d9-6ced-4612-a790-936d026655b0 | rajarshighoshal/algorithmic-toolbox | week4_divide_and_conquer/4_number_of_inversions/inversions.cpp | #include <iostream>
#include <vector>
using std::vector;
long long inversion_merge(vector<int> &a, vector<int> &b, size_t left, size_t mid, size_t right) {
long long count = 0;
size_t i = left, j = mid, k = left;
while(i < mid && j < right) {
if(a[i] <= a[j]) {
b[k] = a[i];
i++;
k++;
}... | ALGO | 0.999949 | 4.513351 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2020-01-14T02:19: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": "a31d45373... |
9eb50bff-6435-4931-a9d2-477c4dd543cd | Ayusohm432/Coding | ProblemOfTheDay/Leetcode/2025/4. April/07.04.2025_416. Partition Equal Subset Sum.cpp | /*
Problem Link: https://leetcode.com/problems/partition-equal-subset-sum?envType=daily-question&envId=2025-04-07
*/
/*416. Partition Equal Subset Sum
Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or false otherwise.... | ALGO | 0.999974 | 6.297736 | {
"github_metadata": {
"branch": "main",
"commit_count": 1002,
"repo_created_at": "2024-06-14T10:35: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": "d80d93344... |
1fbc897e-06c9-4188-92aa-64c73c326b3c | kmmehedihassan/Data-Structure-Lab | Lab 4/Task_1.cpp | #include <bits/stdc++.h>
using namespace std;
class heap
{
int *arr;
int size;
public:
heap(int n, int *arrin)
{
size = n;
arr = arrin;
}
void heapify(int n)
{
int largest = n;
int leftChild = 2 * n + 1;
int rightChild = 2 * n + 2;
if (leftC... | ALGO | 0.99984 | 3.966539 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-07-17T20:19: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": "6a3c6bcd7b3e... |
0dbb9198-5a85-4539-8c92-395fcffd4ed0 | Seo-A-Nam/algorithm | 백준 alogrithm/greedy/11399_ATM.cc | #include <iostream>
#include <algorithm>
using namespace std;
/*
줄을 서 있는 사람의 수 N과 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어졌을 때,
각 사람이 돈을 인출하는데 필요한 시간의 합의 최솟값을 구하는 프로그램을 작성하시오.
*/
int main(void)
{
int n;
int p[1000];
int total;
int sum;
cin >> n;
for (int i = 0; i < n; i++)
cin >> p[i];
... | ALGO | 0.999913 | 4.488011 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-05-07T13:01: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": "20be8e558a22... |
e4d749ee-7eae-426f-8494-7393c13ab8e1 | donabe8898/atcoder | Education_DP/C-Vacation.cpp | //
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
const int mod = 998244353;
const int MOD = 1e9+7;
using namespace std;
template<class T>bool chma... | ALGO | 0.999979 | 4.191227 | {
"github_metadata": {
"branch": "main",
"commit_count": 77,
"repo_created_at": "2021-02-08T10:04: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": "c7424d04fb6... |
0c2e4cc6-a692-46fd-bf71-fe82df1d4924 | mijinko17/competitive-programming | Atcoder/AGC/040/b.cpp | #include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;
//セグメント木
// ref:https://ei1333.github.io/luzhiled/snippets/structure/segment-tree.html
template <typename Mnd>
struct segment_tree {
int sz;
vector<Mnd> data;
function<Mnd(Mnd, Mnd)> f;
Mnd e... | ALGO | 0.999978 | 4.517063 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2019-09-22T11:35:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6a3544647... |
70166150-b721-403c-94b6-ddff823edeb1 | HaibaoM55/pbinfo | maria/main.cpp | #include <fstream>
using namespace std;
ifstream fin("maria.in");
ofstream fout("maria.out");
int n, m, p, q;
int s[1001][1001];
int k;
int main()
{
fin >> n >> m >> p >> q;
fin >> k;
for(int i = 1; i <= k; i++){
int a, b;
fin >> a >> b;
s[a][b]++;
}
for(int i = 1; i <= n; i+... | ALGO | 0.99971 | 3.80987 | {
"github_metadata": {
"branch": "master",
"commit_count": 471,
"repo_created_at": "2024-08-15T07:52: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": "82495559... |
99e7bea4-b60b-4a5a-9f5c-5e5b7c6bd578 | adrian-stanciu/adventofcode | 2022/17/main.cpp | #include <bits/stdc++.h>
using namespace std;
static constexpr auto Width{7};
const string EmptyRow(Width, '.');
static constexpr auto BottomPadding{3};
static constexpr auto LeftPadding{2};
static constexpr auto Moving{'#'};
static constexpr auto Settled{'@'};
using Shape = vector<string>;
auto can_move_left(const... | ALGO | 0.999988 | 5.731213 | {
"github_metadata": {
"branch": "master",
"commit_count": 184,
"repo_created_at": "2019-12-29T08:05: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": "41a7b8c1... |
32d2d3c1-d9ee-44fb-9807-db530c58664e | dreyus95/AVSP_SourceQualityPrediction | CodeJamCrawler/dataset/14_23139_52.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <list>
#include <deque>
#include <algorithm>
using namespace std;
class Solution
{
static const int MAXN = 12;
st... | ALGO | 0.999862 | 3.487181 | {
"github_metadata": {
"branch": "master",
"commit_count": 70,
"repo_created_at": "2017-06-08T21:00: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": "e9150ed9f... |
5f8ba647-cb88-44f2-ac9b-643951343a0f | ishandutta2007/codeforces-n | nishant403/normal/1466/E.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
uniform_int_distribution<int> uid(l, r);
return uid(rng);... | ALGO | 0.999848 | 4.825849 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:35: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": "fbc9c9054a63... |
d16e5e49-488c-4dde-b19b-3b925b5067b9 | hwanzar/Code | Comp-programing/CP2-Lv1/Dijkstra/Dijkstra.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
vector<pair<int, int>> Edges[100005];
long long visit[100005];
long long L[100005];
int pre[100005];
int wei[100005];
int ans[100005];
int ansL;
class pkt
{
public:
long long l;
int w, a, b;
bool operator<(const pkt &k) const
{
return l... | ALGO | 0.999992 | 3.57958 | {
"github_metadata": {
"branch": "main",
"commit_count": 81,
"repo_created_at": "2021-10-30T04:37:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "872fa8d7779... |
07163f2b-fcde-42a7-8c93-cde7f4ba5240 | Ewenwan/MVision | 3D_Object_Detection/Object_Tracking/src/single_tracker.cpp | #include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstring>
using namespace std;
using namespace cv;
int main( int argc, char** argv )
{
// show help
//! [help]
//! [help]
// declares all required var... | ALGO | 0.984121 | 5.212143 | {
"github_metadata": {
"branch": "master",
"commit_count": 3396,
"repo_created_at": "2017-09-24T06:25:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8384,
"forks": 2800,
"issues": 17,
"pull_requests": 2
},
"file_meta": {
"content_id": "... |
4e1bf3e1-8ba6-48b6-8a90-ed5414b05943 | skygragon/Q.solution | leetcode/041.first-missing-positive.cpp | /*
* [41] First Missing Positive
*
* https://leetcode.com/problems/first-missing-positive
*
* Hard (25.12%)
* Total Accepted: 91718
* Total Submissions: 364704
* Testcase Example: '[]'
*
*
* Given an unsorted integer array, find the first missing positive integer.
*
*
*
* For example,
* Given [1... | ALGO | 0.999966 | 5.321941 | {
"github_metadata": {
"branch": "master",
"commit_count": 522,
"repo_created_at": "2017-03-02T02:05:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ebcc77a... |
a5be2282-ea70-41e4-a23c-f30dbeb2d6fe | satyam-software-developer/Introduction-to-CPP | tut40.cpp | /* Multilevel Inheritance Deep Dive with Code Example in C++
In this tutorial, we will discuss multilevel inheritance in C++
Multilevel Inheritance in C++
Multilevel inheritance is a type of inheritance in which one derived class is inherited from another derived class.
For example, we have three classes “animal”, “ma... | TOOL | 0.920188 | 6.528391 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-08-15T21:17:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2df6f74b0ea7... |
4d34ff1d-1ff6-4e94-86b6-77eb498a4377 | haoleeson/MyWorkspace | MyCpp/5_Dijkstra/DenseMatrixGraph.h | /**
* Encoding:utf-8
* Programming language:c++
* Coder:EisenHao
* */
#ifndef _DENSEMATRIXGRAPH_H
#define _DENSEMATRIXGRAPH_H
#include <cassert>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
#define MAX_VAL 999
// 构建稠密图类,使用邻接矩阵法表示
class DenseMatrixGraph {
private:
int n; ... | ALGO | 0.999931 | 5.216781 | {
"github_metadata": {
"branch": "main",
"commit_count": 815,
"repo_created_at": "2021-10-17T02:43: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": "d617267c84... |
25726b8f-1e62-419d-ab3f-4e1b93926ed2 | 2006jjj/lafore-solution-of-exercises | Chapter_10/03.cpp | /*10_03ex.cpp
Используйте массив указателей на строки, представляющие собой названия дней недели, из примера PTROSTR это главы. Напишите функции для сортировки этих строк
в алфавитном порядке, используя в качестве основы функции bsort() и order() из программы PTRSORT этой главы. Сортировать необходимо указатели на стро... | ALGO | 0.999803 | 4.548534 | {
"github_metadata": {
"branch": "main",
"commit_count": 427,
"repo_created_at": "2025-02-03T16:46: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": "65a12bc72a... |
67bb34a9-5aa3-439e-8aca-6495a68d5765 | prallhsu/LeetCode-Solution | Basic_Algorithm/DP/最长回文子串.cpp | #include <bits/stdc++.h>
using namespace std;
// 最长回文子串
int MaxPalindrome(string s) {
if (s.length() == 0) return 0;
int len = s.length();
vector<vector<int>> dp(len, vector<int>(len, 0));
int ans = 1;
for (int i = 0; i < len; i ++ ) {
dp[i][i] = 1;
if (i < len-1) {
if (... | ALGO | 0.999939 | 4.461935 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2019-05-04T04:19: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": "8b9e315df... |
0cd213a9-2679-4116-92f5-20cc36d96b27 | serkazi/tree_path_queries | src/benchmarking/utils/suites_normal_gbench_workflow.cpp | //
// Created by kazi on 2019-12-16.
//
#include <sys/resource.h>
// #include <benchmark/benchmark.h>
#include "benchmark/benchmark.h"
#include <fstream>
#include <string>
#include <vector>
#include <memory>
#include "path_query_processor.hpp"
#include "naive_processor_lca.hpp"
#include "pq_request.hpp"
#include "naive... | ALGO | 0.988041 | 3.47431 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2020-01-28T16:21: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": "0c67319af... |
205eaa57-9707-4333-98a1-f2ff92bd57c9 | jiaqiwang969/deal.II-mini | Translator_file/deal.II/base/mpi.h | //include/deal.II-translator/base/mpi_0.txt
// ---------------------------------------------------------------------
//
// Copyright (C) 2011 - 2021 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it und... | TOOL | 0.933482 | 5.839603 | {
"github_metadata": {
"branch": "main",
"commit_count": 174,
"repo_created_at": "2021-06-09T08:02:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f5eb59b4c0... |
2f3e7403-1a67-466a-894a-2a5f767ff455 | noko206/AtCoder | abc/51-100/74/c.cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,R... | ALGO | 0.999662 | 3.885823 | {
"github_metadata": {
"branch": "main",
"commit_count": 244,
"repo_created_at": "2023-05-21T12:02: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": "69f4e17622... |
7b13d00c-6a41-47d2-a655-50dfd3ca7296 | Ericstiefel/Chess | game/legal_king_moves.cpp | #include "legal_king_moves.h"
#include "utils.h"
#include "bitboard.h"
#include "bit_ops.h"
#include "constants.h"
#include <vector>
std::vector<Move> castleMoves(const State& state) {
std::vector<Move> moves;
uint8_t color = static_cast<uint8_t>(state.toMove);
uint64_t occupied = state.get_all_occupied... | ALGO | 0.995871 | 5.903071 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2025-06-22T03:54:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3260057aaf... |
ef0d117b-62fd-4810-91d8-ea06042fd926 | typedefn/quakenet | src/Utility.cpp | /*
* File: Utility.cpp
* Author: dervish
*
* Created on February 21, 2021, 8:55 AM
*/
#include "Utility.hpp"
#include "md4.hpp"
Utility::Utility() {
}
Utility::Utility(const Utility &orig) {
}
Utility::~Utility() {
}
void Utility::CRC_Init(unsigned short *crcvalue) {
*crcvalue = CRC_INIT_VALUE;
}
unsig... | TOOL | 0.913849 | 4.798784 | {
"github_metadata": {
"branch": "main",
"commit_count": 90,
"repo_created_at": "2021-04-24T17:14: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": "b2a7447a371... |
d5a4a32f-fe3a-4bb5-ba6e-a29dcec07f3b | JayKapadia389/DSA_Cpp_course | BT-least-common-ancestor.cpp | #include <iostream>
#include <vector>
using namespace std;
class node{
public:
int data;
node * left ;
node * right ;
node(int x){
data = x;
left = NULL;
right = NULL;
}
};
vector<int> LCAcore(node * root , int n1 , int n2){
vector<int> ans(3) ;
if(root =... | ALGO | 0.999994 | 4.453238 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2023-10-08T11:48:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f751df07... |
cc4da421-b474-4a7e-9a7c-f3e22215a696 | Ranvie/Cpp_Programs | Arvores/Binária/arvoreAutomatica.cpp | #include <iostream>
struct No{
int iNum;
No *strEsq;
No *strDir;
};
struct Arvore{
No *strRaiz;
};
void iniArv(Arvore *strArv)
{
strArv->strRaiz = NULL;
}
No *criaNo(Arvore *strArv, int iNum)
{
No *strItem = new No;
strItem->iNum = iNum;
strItem->strDir = NULL;
strItem->strEsq = NULL;
return strItem;
... | ALGO | 0.999942 | 3.910525 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2022-04-06T01:58:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "744626003e62... |
1c5b821b-ca9d-4e61-8be7-6192feef9bd8 | windie/leetcode | src/convert_sorted_list_to_binary_search_tree.h | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL)... | ALGO | 0.999993 | 5.63373 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2013-10-07T15:16:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c0d9ebbc... |
42151d32-37f5-4fcf-b78f-68e281e62b8b | rachit2905/cp-codes | B_Moderate_Modular_Mode.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long l1;
typedef long double ld1;
typedef pair<int, int> pi;
typedef pair<l1, l1> pl1;
typedef pair<double, double> pd... | ALGO | 0.999966 | 4.678027 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-08-03T13:37: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": "003dbb6aea55... |
fd573e9a-a8c9-4a9c-ba1b-99e31021a243 | AlaaAbuHantash/Competitive-Programming | Codeforces/245B - Internet Address.cpp | #include <cstdio>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
int i ;
string s , r ;
bool f = 1;
cin >> s ;
r="";
i= 0;
if (s[0] == 'h' ) { r = "http://"; i=4;}
else if (s[0] == 'f'){r="... | ALGO | 0.922518 | 3.084454 | {
"github_metadata": {
"branch": "master",
"commit_count": 112,
"repo_created_at": "2018-04-10T11:13:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "19416af9... |
3e853316-2e34-4eb6-9054-c8091a67adde | YodaMutou29/My-Work | UVa Solutions/MaximumSumII.cc | /* Maximum Sum (II) - UVa 10656
* @author <NAME>
*
* Since all numbers are non-negitive, we just remove zeroes to
* get the minimum subsequence with maximum sum.
*/
#include <iostream>
using namespace std;
int main() {
// keeps track of whether we've output anything or not
bool output = false;
int numbers;... | ALGO | 0.999697 | 3.870355 | {
"github_metadata": {
"branch": "Master",
"commit_count": 24,
"repo_created_at": "2021-02-03T19:53: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": "414bab9ee... |
6e36cdb5-dd79-4bea-a79a-06a839473109 | akhikolla/testpackages | fuzzedpackages/dtwclust/src/centroids/sdtw-cent.cpp | #include "R-gateways.h"
#include <algorithm> // std::fill
#include <math.h> // exp
#include <utility> // std::move
#include <RcppArmadillo.h>
#include <RcppParallel.h>
#include "../distances/calculators.h"
#include "../distances/details.h" // sdtw
#include "../utils/KahanSummer.h"
#include "../utils/ParallelWorker.h... | ALGO | 0.999945 | 6.583868 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-01-15T17:42:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "859280af12... |
e5a94315-e265-412f-ab07-0f8c4318711b | dbeurle/neon | src/geometry/projection.cpp |
#include "projection.hpp"
#include <Eigen/Geometry>
namespace neon::geometry
{
matrix2x project_to_plane(matrix3x const& nodal_coordinates)
{
auto const lnodes = nodal_coordinates.cols();
matrix2x plane_coordinates = matrix::Zero(2, lnodes);
auto const normal = unit_outward_normal(nodal_coordinates);
... | ALGO | 0.997624 | 6.330684 | {
"github_metadata": {
"branch": "master",
"commit_count": 1869,
"repo_created_at": "2017-08-06T09:51:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 8,
"issues": 15,
"pull_requests": 1
},
"file_meta": {
"content_id": "a4691... |
404b82b0-df14-4ff4-8119-2e24ef1f320f | RaviKumar-Nemala/DATA-STRUCTURES | BINARY_TREES/LOVE_BABBAR_B_TREES/Duplicate_sub_tree_of_size_2.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
char data;
struct Node *left;
struct Node *right;
Node(char x) {
data = x;
left = NULL;
right = NULL;
}
};
struct Node* buildTree(string str)
{
// Corner Case
if (str.length() == 0 || str[0] == 'N')
return NULL;
// C... | ALGO | 0.999666 | 5.187038 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-09-19T06:17: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": "d56d71b306... |
982761b4-2a88-490c-be66-c2abccb694de | InsightSoftwareConsortium/ITK | Modules/Numerics/FEM/include/itkFEMRobustSolver.hxx | /*=========================================================================
*
* Copyright NumFOCUS
*
* 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.o... | ALGO | 0.985476 | 7.008729 | {
"github_metadata": {
"branch": "main",
"commit_count": 57165,
"repo_created_at": "2010-07-27T15:48:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1517,
"forks": 701,
"issues": 268,
"pull_requests": 49
},
"file_meta": {
"content_id": "5... |
3196a12d-52db-4887-99d9-8c3357c9429f | ishandutta2007/codeforces-k | khadaev/normal/689/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
... | ALGO | 0.999992 | 3.851707 | {
"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": "2ce36837066c... |
16b1cfb3-f9e7-4eba-92a1-0704b4b3ebc0 | resilient-swarms/ASVLite | c_legacy/dependency/VTK-9.1.0/Filters/Modeling/vtkHausdorffDistancePointSetFilter.cxx | /*=========================================================================
Program: Visualization Toolkit
Module: vtkHausdorffDistancePointSetFilter.cxx
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software ... | ALGO | 0.994593 | 7.123116 | {
"github_metadata": {
"branch": "master",
"commit_count": 807,
"repo_created_at": "2018-11-13T16:27:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 26,
"forks": 10,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b072fee... |
302f3d47-f13a-4cf2-a617-0c85ce4cf9b1 | ROCm/rpp | src/modules/tensor/hip/kernel/non_linear_blend.cpp | /*
MIT License
Copyright (c) 2019 - 2025 Advanced Micro Devices, Inc.
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, including without limitation the rights
to use, copy, mo... | ALGO | 0.996472 | 5.919369 | {
"github_metadata": {
"branch": "develop",
"commit_count": 1433,
"repo_created_at": "2019-08-28T23:59:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 66,
"forks": 45,
"issues": 0,
"pull_requests": 9
},
"file_meta": {
"content_id": "4e520... |
37304a53-2aef-44ca-a376-42bc037924f8 | vbonnici/grafe-sim | analysis/data/p03170/s515790214.cpp | #include <bits/stdc++.h>
#define BPhuong "vsteps"
#define maxn 100004
#define maxm
#define bit(x, i) ((x>>i)&1)
#define fid(i,a,b) for(int i = a; i>=b; i--)
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define pii pair<int, int>
#define ll long long
#define f first
#define se seco... | ALGO | 0.999952 | 3.856452 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-07-10T13:21: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": "354a8321ada... |
832ef7d8-04d0-4657-97ab-3a4ccc04358a | InsightSoftwareConsortium/ITK | Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.hxx | /*=========================================================================
*
* Copyright NumFOCUS
*
* 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.o... | ALGO | 0.950596 | 7.200161 | {
"github_metadata": {
"branch": "main",
"commit_count": 57165,
"repo_created_at": "2010-07-27T15:48:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1517,
"forks": 701,
"issues": 268,
"pull_requests": 49
},
"file_meta": {
"content_id": "3... |
48d8ed42-c8d9-4316-883f-07ea53a7fde1 | boolsatellite/data_struct | JZ_offer/25_merge_two_sortedList.cc | //
// Created by bools on 2024-01-29.
//
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
ListNode* Merge1(ListNode* pHead1, ListNode* pHead2) {
if(pHead1 == nullptr) return pHead2;
else if(pHead2 == nullptr) return pHead1;
ListNode* head = nullptr;
... | ALGO | 0.99999 | 5.441804 | {
"github_metadata": {
"branch": "main",
"commit_count": 162,
"repo_created_at": "2023-08-29T15:08: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": "ddd2768322... |
f27c5398-002d-4c13-a308-62830ca71122 | yes6686/Algorithm | 백준/Silver/1913. 달팽이/달팽이.cc | #include <iostream>
using namespace std;
int arr[1001][1001];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int k;
cin >> k;
// 3->1 , 1->4, 4->2 , 2->3
int d = 3;
int s = n * n;
int x = 0;
int y = 0;
int m = 1;
int ansX, ansY;
while (true) {
arr[x][y] = s;
if (s == k... | ALGO | 0.999946 | 3.360523 | {
"github_metadata": {
"branch": "main",
"commit_count": 1370,
"repo_created_at": "2023-12-17T09:48: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": "fa2882913... |
5b6fd431-4096-48ed-915f-9ce8e9facf33 | MagdalenaPolac/spoj | NAKANJ.cpp | #include <cmath>
#include <deque>
#include <iostream>
#include <limits>
#include <string>
#include <vector>
const auto MAX_COST = std::numeric_limits<int>::max();
int decodeNodeNumber(const std::string& symbol)
{
auto letter = symbol[0];
auto number = symbol[1];
auto x = static_cast<int>(letter) - 96;
... | ALGO | 0.99991 | 5.644047 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2019-11-03T11:58: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": "f175b4281... |
37fb3c11-f3b3-4edd-95e4-21d78f2d751e | dhruvarora23/DSA-Questions | Queue/queuebasic.cpp | #include <iostream>
using namespace std;
typedef struct{
int element[10];
int f;
int r;
}queue;
queue init(){
queue q;
q.f = -1;
q.r = -1;
return q;
}
int isEmpty(queue q){
if(q.f == -1 || q.f > q.r){
return 1;
}
else{
return 0;
}
}
int isFull(queue q)... | ALGO | 0.99894 | 3.958137 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-09-13T04:54: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": "e0c14800df31... |
c32072a4-7ab8-4ca1-b127-da700af17692 | horacioand/TUP-Prog1 | Unidad 4/Ejercicio27.cpp | #include <iostream>
using namespace std;
/*
Una Universidad dispone de diez aulas para acomodar a una cantidad de
asistentes a una charla. Cada aula tiene una capacidad total de 60 personas. Se
necesita un programa que solicite la cantidad de asistentes a la charla y
determine la cantidad total de aulas necesarias para... | ALGO | 0.981494 | 3.554782 | {
"github_metadata": {
"branch": "main",
"commit_count": 63,
"repo_created_at": "2025-03-31T20:42: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": "197bff2e9d5... |
6e9faa1c-d898-45c5-a7ce-c882d1a1015c | yxlyes/2021-HUAWEI-EMBEDDED-SOFTWARE | 2021华为嵌入式大赛算法组复赛选手必备包/player/sdk/code/source/graphAlgorithm.cpp | #include "graphAlgorithm.h"
void DijkstraSP::relax(EdgeWeightedGraph& G, int v) {
for (Edge* e : G.getAdj(v)) {
if (e->hasUsed) continue;
int w = e->other(v);
int temp = distTo[v] + e->getWeight();
if (temp <= maxLen && distTo[w] > temp) {
distTo[w] = temp;
e... | ALGO | 0.999864 | 4.959209 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2021-06-12T13:26:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f646c116... |
dfad8b6a-b9c5-4d26-bb3f-96c178207a13 | blast3901/AoC2022 | 10_1.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <array>
namespace tube {
namespace {
std::array<int, 6> getFactors() {
std::array<int, 6> factors{};
for (int i = 0, j = 20; i < factors.size(); i++, j += 40)
factors[i] = j;
... | ALGO | 0.999888 | 6.461172 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2022-12-02T17:02: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": "a66acb1d2ab... |
34b0dde5-bd24-4ff0-9dcb-e950dfaecea2 | AndreaVargasAndia/K-means | K_means/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <fstream>
#include <sstream>
#include <algorithm>
using namespace std;
class Point{
private:
int pointId, clusterId;
int dimensions;
vector<double> data;
public:
Point(int id, string line){
dimensions = 0;
pointId = id;
... | ALGO | 0.998853 | 4.556169 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2020-12-07T04:49:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "27b870dba077... |
088ecbbd-73dc-4d1f-80e4-54ec98248f11 | wongxingjun/leetcode | linkedListRandomNode.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* head;
/** @param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains ... | ALGO | 0.999041 | 5.138794 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2016-07-04T14:04: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": "98b824bc1... |
97fa8cd8-62be-4faf-9a2a-d725f2dc15a6 | alexkaiser/heart_valves | FourierBodyForce.cpp |
// FourierBodyForce.cpp
// Created <NAME>, 6/2016
// Modified from:
// Filename: FeedbackForcer.cpp
// Created on 04 May 2007 by <NAME>
#include "FourierBodyForce.h"
/////////////////////////////// INCLUDES /////////////////////////////////////
#ifndef included_IBAMR_config
#include <IBAMR_config.h>
#define inclu... | ALGO | 0.966645 | 5.922763 | {
"github_metadata": {
"branch": "master",
"commit_count": 2421,
"repo_created_at": "2019-03-06T02:28:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a8b16... |
5f9dd0e7-7cd2-4747-979f-59a9c981dfaa | hokein/algorithm-course-solutions | practice/josephus_segment_tree.cpp | //
// n=7, k=3
// 0 1 2 3 4 5 6
// | |
//
// Killed person number | index(cnts)
// 2 3 = 2+1 = (0+k-1)+1
// 5 5 = 4+1 = (2+k-1)+1
//
// i (pos[i-1]+k-1)%n+1
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long... | ALGO | 0.999981 | 3.386142 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2013-10-13T07:34:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63fcde98a... |
3ee01044-1adc-4f1f-b4f0-9b11fe05b08a | HunkiKim/Algorithm_Study | Problem/CodeForces/276C.cpp | #include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
class Node {
public:
int l, r, nd, sum;
};
int A[200005];
Node T[200005];
int build(int nd, int n, int L, int R) {
int mid;
T[nd].r = R;
T[nd].l = L;
mid = (R + L) / 2;
... | ALGO | 0.999864 | 4.024007 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2021-05-11T01:32: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": "5e0743c22... |
4d7acac9-2460-4598-a62c-7a2d2500d8d6 | lacozhang/pinyin2word | lm/search_hashed.hh | #ifndef LM_SEARCH_HASHED__
#define LM_SEARCH_HASHED__
#include "lm/model_type.hh"
#include "lm/config.hh"
#include "lm/read_arpa.hh"
#include "lm/return.hh"
#include "lm/weights.hh"
#include "util/bit_packing.hh"
#include "util/key_value_packing.hh"
#include "util/probing_hash_table.hh"
#include <algorithm>
#include... | ALGO | 0.977833 | 6.042399 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2012-06-03T06:58:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 4,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "815014be9... |
43a0c8fd-a672-46d3-9a44-30eb2625d637 | ydb-platform/ydb | contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp | #ifndef PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP
#define PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP
#include "pythonic/include/types/dynamic_tuple.hpp"
#include "pythonic/include/utils/allocate.hpp"
#include "pythonic/include/utils/functor.hpp"
#include <iterator>
#include <vector>
PYTHONIC_NS_BEGIN
namespace i... | ALGO | 0.975586 | 7.158823 | {
"github_metadata": {
"branch": "main",
"commit_count": 35208,
"repo_created_at": "2022-02-07T14:52:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4512,
"forks": 701,
"issues": 2263,
"pull_requests": 682
},
"file_meta": {
"content_id": ... |
ac336267-f017-4d8c-a4f9-304c317b5171 | AIFM-sys/AIFM | shenango/apps/parsec/pkgs/apps/bodytrack/src/TrackingBenchmark/ParticleFilter.h | //------------------------------------------------------------------------
// ____ _ _
// / ___|____ _ _ ____ ____| |__ | |
// | | / ___| | | | _ \/ ___| _ \| |
// | |___| | | |_| | | | | |___| | | ||_|
// \____|_| \_____|_| |_|\____|_| |_|(_) Media benchmarks... | ALGO | 0.987335 | 6.625301 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2020-10-12T02:03:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 122,
"forks": 37,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "fef015e... |
c02b86d8-7327-45b9-8b40-b81cc808334f | simpa2k/Majsan2k | src/headers/utilities.h | /*
* Miscellaneous utility functions that are used
* both by the brain and the network. The computeThetaHidden and
* computeThetaVisible functions are taken from <NAME>'s
* Bayesian network example, and are just translations from his original
* python code. The article can be found at http://derandomized.com/post/... | ALGO | 0.984681 | 5.964613 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2017-01-07T22:14: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": "dcc3482e43... |
683fae03-6f60-4e5a-b521-e46b1d1f8378 | Gaurav05180/InfoSecurity-Assignments | Assignment02/ExtendedEuclideanAlgorithm.cpp | #include <iostream>
#include <tuple>
using namespace std;
// Function to perform the Extended Euclidean Algorithm
tuple<int, int, int> extendedEuclidean(int a, int b) {
// Base case: when b is 0
if (b == 0) {
return make_tuple(a, 1, 0); // gcd(a, b), coefficient for a, coefficient for b
}
... | ALGO | 0.999419 | 6.41746 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-09-06T12:00: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": "387fda4cbfb1... |
c8cf320a-561c-4d20-8bc4-e4b644dfc183 | nike0good/Template | LCT.cpp | #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) ... | ALGO | 0.999976 | 3.154651 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2016-11-06T05:52:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "e9ac8985b... |
85c95073-3fa7-4635-baee-4f9bf5cb6f6a | davidggarber/AoCode | aoc2022/Day9.cpp | #include "Utils.h"
#include "Stopwatch.h"
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <unordered_set>
#include <vector>
#include <algorithm>
using namespace std;
// https://adventofcode.com/2022/day/9
namespace Day9
{
class Point
{
public:
short x = 0;
... | ALGO | 0.997946 | 4.846203 | {
"github_metadata": {
"branch": "main",
"commit_count": 128,
"repo_created_at": "2022-09-08T22:31:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe748ce9e4... |
3736a8f1-0e53-42a4-b5e9-d84cbea58c68 | pranavr93/SPOJ | postfix.cpp | /* Author : Pranav
BITS <NAME> */
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
using namespace std;
#define sz(a) int((a).size())
#defi... | ALGO | 0.999826 | 3.491561 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2014-08-18T21:15: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": "755b54b2eb... |
2d2a1fc0-4bf2-4c55-94f9-53d5f64249d7 | mrblasco/macro | submission_001/submission_001.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265
#define USE_IMPROVED_VERSION 1
#define logout cerr
class EconomyParams
{
public:
double beta;
double eta;
double alpha;
double delta;
double rho;
double sigma;
int seed;
int case_index;
double score;
int N;
... | ALGO | 0.99973 | 4.411982 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-02-16T19:32: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": "55280b98e2... |
ef97049c-9d9d-4c31-a02f-b8b9904eb3c3 | hiteshkumain/pNoC--based-System-design-Techniques-Routing-Analysis- | Final_workNOC/Solution2/generateTraceFile.cpp | // Generate Trace file by taking commGraph.txt as an input and generate trace accordingly
// INPUT File = CommGraph.txt
// Output File = Trace.txt
// TRACE = t, Source,Destination , pkt
#include <iostream>
#include <fstream>
#include <string>
int M; // topology M*N
int N;
int MAT[128][128]={0};
bool MATbool[128]... | TOOL | 0.921723 | 3.886982 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-09-08T10:42: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": "c85bed658305... |
4551ed5d-d591-468c-ae04-9907c83075f9 | MariusVanDerWijden/gpusnarks | cuda/device_field_operators.h | /*****************************************************************************
Implementation of Fast Fourier Transformation on Finite Elements
*****************************************************************************
* @author <NAME>
* Copyright [2019] [<NAME>]
* Licensed under the Apache License, Version... | ALGO | 0.986788 | 5.738011 | {
"github_metadata": {
"branch": "master",
"commit_count": 106,
"repo_created_at": "2019-03-08T22:12:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 81,
"forks": 16,
"issues": 6,
"pull_requests": 0
},
"file_meta": {
"content_id": "f7d9fc... |
0abed2b8-8901-4e40-8e89-1aa2b47c0ccb | Xin546946/computer_vision_course | ch5_motion_based_segmentation/src/gmm.h | /**
______________________________________________________________________
*********************************************************************
* @brief This file is developed for the course of ShenLan XueYuan:
* Fundamental implementations of Computer Vision
* all rights preserved
* @author <NAME>, <NAME>
* @contact:... | ALGO | 0.995096 | 4.285987 | {
"github_metadata": {
"branch": "main",
"commit_count": 827,
"repo_created_at": "2020-10-24T18:40: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": "bd02fd44fa... |
bf7fc6c8-8444-4606-ad54-af80fc3df2e8 | avnyaswanth/leet-code | 4-median-of-two-sorted-arrays/4-median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int n1 = nums1.size();
int n2 = nums2.size();
if(n1 > n2)
return findMedianSortedArrays(nums2, nums1);
int total = n1 + n2;
int low = 0, high = n1;
while(low <... | ALGO | 0.999986 | 5.96265 | {
"github_metadata": {
"branch": "master",
"commit_count": 364,
"repo_created_at": "2021-10-12T11:28: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": "0d990609... |
0dd184e3-5079-44d2-b4a4-50cd0279f667 | umtclskn/miis-final-project | internal_simulation/include/internal_simulation/potential_field.hpp | #pragma once
#include <array>
#include <vector>
#include <string>
// Obstacle yapısı
struct ObstacleInfo {
std::array<double, 2> pos;
std::array<double, 2> vel;
};
class PotentialField {
public:
PotentialField();
void attractive_motion(const std::array<double,2>& robot_pos,
... | ALGO | 0.985659 | 6.011743 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2025-05-13T07:52:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "04a66dd754f... |
266d0463-4dee-46b0-b8c2-d077002eeba5 | nmViorel/LAB-12-POO | 2.cpp | #include <iostream>
using namespace std;
class Stiva{
public:
int peak;
int len;
int *p;
public:
Stiva(int dim){
this->peak = -1;
this->len = dim;
if(dim == 0)
p = 0;
else
p= new int[len];
}
Stiva(){
this->peak = -1;
th... | ALGO | 0.987001 | 3.757264 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-01-15T08:18: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": "71f34b2d9... |
cc363381-66ef-454b-b527-f773752dc335 | saifullah-talukder/Competitive_Programming | Codes/Codeforces/Accepted/CF_687_C.cpp | /*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/
#include <bits/stdc++.h>
using namespace std; /*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace __gnu_cxx;*/
#define fi first
#define se second
#define ... | ALGO | 0.999999 | 3.01698 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-05-10T06:16: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": "44bd20b7e57a... |
76b70ee0-d986-4ce1-afd2-8e65659fefcd | bcyran/tsp | TSPBFSolver.cpp | //
// Created by bazyli on 25.10.18.
//
#include <stdexcept>
#include <iostream>
#include "TSPBFSolver.h"
/**
* Solves TSP using brute-force approach.
*
* @return The shortest possible cycle.
*/
Path TSPBFSolver::solve() {
if (tsp.empty()) {
throw runtime_error("Cannot solve empty problem.");
}
... | ALGO | 0.999789 | 4.582798 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2018-10-28T18:28: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": "ba3ec339f... |
79033a01-f964-411c-8e5e-b8e3d991df8d | caoleiwuhan/USACO | section 3/3_3_4_HomeOnRange.cpp | #include <iostream>
#include <cstdlib>
#include <vector>
#include <set>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <list>
#include <map>
#include <cstring>
#include <cctype>
#include <queue>
#include <cmath>
#include <limits>
#include <cfloat>
#include <iomanip>
using namesp... | ALGO | 0.99958 | 3.056335 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2013-08-24T13:48:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a3999fcb64... |
0d8f3560-2db4-4174-bdc9-5a8e6311b66e | Flamingbanana15/Reversi | MonteCarloNode.cpp | #include "MonteCarloNode.h"
MonteCarloNode::MonteCarloNode(GameBoard* start, int player) {
currentBoard = start;
maximizingPlayer = player;
legalMoves = start->generateMoves();
memset(&move, 0, sizeof(move));
parentNode = NULL;
nodesViewed = 0;
nodeScore = 0;
}
MonteCarloNode::MonteCarloNode(MonteCarloNode* pa... | ALGO | 0.983953 | 5.262347 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2021-04-17T01:10:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab1d12b66d... |
87bb4827-9297-43f2-aaba-8b88296ff76f | lilililyzs/DS-homework | VSCPP/graph.h | #ifndef GRAPH_H
#define GRAPH_H
typedef struct arcnode {
int info;//1时为有向arc,10时为无向
int adjvex; //int 是vexnode数组的索引;如果是有向图,则特指该边的terminal vertex。
arcnode * nextarc;
arcnode(int info, int adjvex, arcnode* nextarc);
}arcnode;
arcnode::arcnode(int info, int adjvex, arcnode* nextarc) {
this->info = info; this->adjvex... | ALGO | 0.998478 | 3.342544 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-12-04T13:04: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": "524a3adf69... |
16207689-68da-4d2b-b12f-616bd8f715c2 | anishacharya/Cracking-Coding-Interviews | Graph/BFS.cpp | #include <iostream>
#include<list>
#include<queue>
using namespace std;
class Graph
{
int V; // No. of vertices
list<int> *adj; // Pointer to an array containing adjacency lists
public:
Graph(int V); // Constructor
void addEdge(int v, int w); // function to add an edge to graph... | ALGO | 0.999817 | 4.222958 | {
"github_metadata": {
"branch": "master",
"commit_count": 280,
"repo_created_at": "2014-10-22T21:01:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a17e412f... |
41c04151-9b2e-4e9f-a0c7-6b7ae9b58ead | DJ000011/UbiMoE | src/linear.cpp | #include "linear.hpp"
#include "gelu.hpp"
#include "moe.hpp"
wt_linear_block_t linear_weights_ping[ceildiv(MAX_LINEAR_DIM_PRODUCT, LINEAR_IN_SIZE * LINEAR_OUT_SIZE)];
wt_bias_block_t linear_bias_ping[ceildiv(MAX_LINEAR_OUT_DIM, LINEAR_OUT_SIZE)];
wt_linear_block_t linear_weights_pong[ceildiv(MAX_LINEAR_DIM_PRODUCT,... | ALGO | 0.928246 | 5.282979 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2025-01-28T09:34:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0a6002a85d... |
3511aa0d-28a0-454d-8c67-a5a10d461a3d | chadhogg/AdventOfCode | 2015/c++/2015Day02.cpp | /// \file 2015Day02.cpp
/// \author <NAME>
/// \brief My solution to Advent Of Code for 2015-12-02.
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using Number = int;
struct Box
{
Number height;
Number width;
Number length;
Number
getSurfaceArea () const
{
return 2 * he... | ALGO | 0.97662 | 5.313066 | {
"github_metadata": {
"branch": "main",
"commit_count": 272,
"repo_created_at": "2020-12-18T15:46:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9ae05f109f... |
7b5cdd9e-317e-44d8-a480-9adcef0a5f6b | dezhonger/LeetCode | Leetcode1493.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int update(int l, int r, int zero) {
//zero = 1;
if (zero > 0) return r - l + 1 - zero;
else return r - l;
}
int longestSubarray(vector<int>& nums) {
int ans = 0;
int sz = nums.size();
int l = 0;
int zero = 0;
... | ALGO | 0.999988 | 5.245689 | {
"github_metadata": {
"branch": "master",
"commit_count": 1308,
"repo_created_at": "2015-12-30T17:26: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": "b29a7ad... |
6d26beb2-8f95-4ced-a1bb-db6f30e3214f | gecko1112/ParticleSim | src/solver.hpp | #pragma once
#include <SFML/Graphics.hpp>
#include <vector>
struct Particle {
sf::Vector2f position;
sf::Vector2f prev_position;
sf::Vector2f acceleration;
float radius = 4.0f;
sf::Color color = sf::Color::Blue;
Particle(sf::Vector2f start_pos)
: position(start_pos), prev_position(st... | ALGO | 0.999612 | 5.899682 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-07-07T13:21: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": "ae322cf83176... |
370a1b36-0c30-4532-831f-b058111bd19d | AlanBui1/Competitive-Programming-Solutions | wossoly21s2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXSZ=1e6+5;
ll redPSA[MAXSZ], bluePSA[MAXSZ], greenPSA[MAXSZ];
int main() {
cin.sync_with_stdio(0);cin.tie(0);
ll n; cin >> n;
string lights; cin >> lights;
ll totRed=0, totGreen=0, totBlue=0;
for (int i=0; i<n; i++){
... | ALGO | 0.999691 | 4.143827 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-07-01T14:33:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a74c681b382e... |
27c6aeea-d0b0-46b2-83a7-d378964bf5cb | mrsayan/competitive-programming | KIIT/OOP/LAB 1 - Structures/Store_Student.cpp | /* Problem -
WAP to input name, roll number and marks in 5 subjects for n number of students. Write functions to:-
a. Find total marks and percentage of all n students.
b. Display details of a student with a given roll number.
c. Display the details for all the students having percentage in a given range.
d. Sort the ... | ALGO | 0.98543 | 3.994796 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-07-10T09:35:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d6defe7036b4... |
3e8aaff0-d069-4190-bb72-d0e550fb01e3 | JBlakd/self-study | binary-tree-inorder-traversal/inorder.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
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 *ri... | ALGO | 0.999978 | 6.388185 | {
"github_metadata": {
"branch": "main",
"commit_count": 430,
"repo_created_at": "2022-01-02T04:54: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": "0817b00afc... |
b62eb840-5ee0-4d8a-bb4e-ac4094d49a1c | rak3xh/DSA-Practice-in-CPP | DSA Resources/Cplusplus/codestudio/Boxesandchocolates.cpp | #include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int subsequenceOf3(vector<int> &arr, int n)
{
vector<vector<int>> dp(n, vector<int>(3, 0));
dp[0][arr[0] % 3] = dp[0][arr[0] % 3] + 1;
for (int i = 1; i < n; i++)
{
vector<int> temp(3, 0);
temp[arr[i] % 3] = temp[... | ALGO | 0.999905 | 4.323984 | {
"github_metadata": {
"branch": "main",
"commit_count": 1873,
"repo_created_at": "2023-12-01T19:23:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3f171b6b... |
c99aee42-3697-4dae-9af2-14d9df80b786 | MaksimTXP/practicum-cpp | cpp-transport-catalogue/transport-catalogue/graph.h | #pragma once
#include "ranges.h"
#include <cstdlib>
#include <vector>
namespace graph {
using VertexId = size_t; // Определение типа идентификатора вершины
using EdgeId = size_t; // Определение типа идентификатора ребра
template <typename Weight>
struct Edge {
std::string name;
si... | TOOL | 0.997925 | 6.513278 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-03-04T12:30: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": "dc1171403b76... |
6becf1cb-74b9-4ff7-b481-3ea26220938b | wolfjagger/polynomial_3-sat | Preprocessor.cpp | /*****************************************************************************
* Disclaimer:THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND *
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
* A... | ALGO | 0.994002 | 5.63595 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2019-06-24T14:16:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "963dd46f5... |
0bee6b86-7d52-4e15-88c5-160212597feb | ravi2320/LeetCode | Day_64_169_Majority _Element.cpp | /*
169. Majority Element
Solved
Easy
Topics
Companies
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Example 1:
Input: nums = [3,2,3]
Output: 3
Example 2:
In... | ALGO | 0.999992 | 6.056786 | {
"github_metadata": {
"branch": "main",
"commit_count": 576,
"repo_created_at": "2023-10-17T20:36:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cffaa79b93... |
08bc9f48-5263-4d39-a486-0336fcca033f | mauriciopoppe/competitive-programming | UVa/10000/10034.freckles.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define F(i,a) FOR(i,0,a)
#define MS(a, v) memset(a, v, sizeof a)
#define NL printf("\n")
#define PI acos(-1)
#define EPS 1e-9
#define TR(ar, it) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
typedef long long... | ALGO | 0.99968 | 4.571592 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2018-02-05T05:31:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6156eee2d... |
03f53e91-0b92-4907-82e6-c696dde9eea7 | SpeedOfMagic/CompetitiveProgramming | Topcoder/SRM312-D1-500.cpp | #include <bits/stdc++.h>
/**
Solution:
1. I want to condensate the whole graph.
Then, the cost of condensated vertex is minimum of all vertexes in it.
2. After that, I need to find such vertexes that if I won't get any of them,
then answer is invalid.
Obviously, those vertexes are roots of resulting forest.
3. To make ... | ALGO | 0.99924 | 3.516073 | {
"github_metadata": {
"branch": "master",
"commit_count": 90,
"repo_created_at": "2018-06-27T09:19:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9ff527d3a... |
4f4e3ad0-3f44-41ff-80cb-e12676e48a22 | GorvGoyl/data-structure | Binary Tree find height.cpp |
// Find height of a binary tree --RECURSIVE and ITERATIVE
#include<iostream>
#include<queue>
using namespace std;
struct bstnode{
int data;
bstnode* left;
bstnode* right;
};
bstnode* root;
bstnode* insert(bstnode* root,int data)
{
if(root==NULL)
{ bstnode* tmp= new bstnode();
tmp->data=data;
tmp->left=... | ALGO | 0.999997 | 4.767079 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2014-10-18T23:37:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a09d4ffa6e... |
268e63a6-fe87-474f-b287-b5ed5afa9b5b | catch4/JAEHO | 2nd-sep/prev-music.cpp | #include <string>
#include <sstream>
#include <iostream>
#include <vector>
using namespace std;
string m{"ABCDEFG"};
vector<string> musicinfos{"12:00,12:14,HELLO,CDEFGAB", "13:00,13:05,WORLD,ABCDEF"};
int main() {
string answer = "";
int time = 0;
for(auto music: musicinfos){
stringstream ss(music... | ALGO | 0.99992 | 3.91685 | {
"github_metadata": {
"branch": "master",
"commit_count": 97,
"repo_created_at": "2020-08-27T02:40:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f9ae6061da... |
3ed585b3-88c5-4ec1-bda1-593f072833ff | expect2004/Program-Store | NC210769.cpp | #include<bits/stdc++.h>
using namespace std;
template < typename Tp >
inline void read(Tp &x) {
x = 0; int fh = 1; char ch = 1;
while(ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if(ch == '-') fh = -1, ch = getchar();
while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
x *= fh;
}
templat... | ALGO | 0.999672 | 3.501046 | {
"github_metadata": {
"branch": "main",
"commit_count": 54,
"repo_created_at": "2020-10-06T13:29:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11cc69b4e4a... |
a805adbb-618c-48fb-9623-66e17272e1f1 | VINAY1072/SEM-5 | CN/LRC.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define vi vector<long long int>
#define f(i, a, b) for (long long int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()
#define nl cout << "\n";
#define out(v) cout << v;
string getString(char x)
{
string s(1, x);
return s;
}
int count_on... | ALGO | 0.999238 | 3.46739 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-09-02T15: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": "00c783f80d00... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.