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 |
|---|---|---|---|---|---|---|---|
1b680994-e7cc-42db-9a7d-cc0c25ed154b | AgentM12/aoc_2021 | AdventOfCode2021/src/Days/Day10.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include <stdexcept>
#include <stack>
#include <algorithm>
#include "../AdventOfCode2021.hpp"
namespace Day10 {
constexpr bool TEST = false;
constexpr auto INPUT_FILE_PATH = "data/day10_input.txt";
constexpr auto TEST_INPUT_FILE_PATH = "data/day10_test_inpu... | ALGO | 0.994638 | 5.911872 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2021-12-01T19:59: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": "3b204e703... |
8ece517b-137c-4106-822b-26fa7b389aeb | qt-lam/DataStructure-Learning | 排序/源.cpp | #include <iostream>
using namespace std;
//线性表结构
struct SqList {
int* elem;
int length;
};
typedef SqList HeapType;
void HeapAdjust(HeapType& H, int s, int m) {
int rc = H.elem[s];
for (int j = 2 * s; j <= m; j *= 2) {
if (j<m&&H.elem[j]>H.elem[j + 1])
j++;
if (rc < H.elem[j])
break;
H.elem[s] = H.... | ALGO | 0.999882 | 4.066323 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-09-17T08:29: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": "b8408991e5... |
91b64c96-4124-4fbe-8d3d-23cab61e1e92 | gvin27/Problem_Solving | BOJ/P06500s/P06549/P6549.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
ll h[100001];
ll histogram(int s, int e)
{
if(s == e) return h[s];
if(s+1 == e) return max(max(h[s], h[e]), 2*(min(h[s], h[e])));
int mid = (e+s)/2;
ll ret = max(histogram(s, mid), histogram(mid+1, e)), minv =... | ALGO | 0.999881 | 3.743405 | {
"github_metadata": {
"branch": "master",
"commit_count": 603,
"repo_created_at": "2020-06-06T10: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": "513f34fc... |
8a1bfec8-1f7e-4297-b1a3-b41f2d70ba15 | VienThanh12/C- | Codeforces Round 933 (Div. 3)/C.cpp | #include <iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define For(type, i, a, b) for (type i = (a); i <= (b); ++i)
#define endl '\n'
#define YES cout << "YES\n"
#define NO cout << "NO\n"
ll ans = 0, res = 0, temp = 0;
ll n;
string s;
void solve() {
cin >> n;
cin >> s;
res = 0;
... | ALGO | 0.999819 | 4.215938 | {
"github_metadata": {
"branch": "main",
"commit_count": 228,
"repo_created_at": "2022-07-26T09:27:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73512d67f3... |
74afef2a-9932-42a4-98a0-49f3bfccc7fe | hecrw/code-forces | C. Greg and Array.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <tuple>
using namespace std;
int main() {
int n, m, k, count = 1;
cin >> n >> m >> k;
vector<long long>el(n), operations(n + 1), query(m + 1);
unordered_map<int, tuple<int, int, long long>>h;
for (long long& e : el)
c... | ALGO | 0.999947 | 4.850165 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-08-25T09:38: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": "a9c2be9e7843... |
d6478ccb-78d6-4d86-a671-50d058aa1175 | Dhirajpt1234/codeforces-solved-problems | 2022.08.04/3colony.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<string, string> pss;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<long long> vl;
typedef vector<vl> vvl;
... | ALGO | 0.999793 | 4.413675 | {
"github_metadata": {
"branch": "master",
"commit_count": 47,
"repo_created_at": "2022-05-17T04:31:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c2388f339... |
4c33b024-3e93-4064-99b6-b1c01f0502e6 | CZ-CE3004-MDP-Group10/MDP-Group-10 | Arduino/Libraries/Movement/Movement_Forwards.cpp | // MULTIDISCIPLINARY DESIGN PROJECT SEMESTER 2 YEAR 20-21 GROUP 10 MOVEMENT FORWARDS IN STEPS OF 10CM FILE.
// Include the movement header file.
#include "Movement.h"
// Move Forwards.
void Movement::forwards()
{
// ########################################################
// FOR FASTEST PATH ONLY:
// The normal dis... | ALGO | 0.998312 | 3.345638 | {
"github_metadata": {
"branch": "master",
"commit_count": 165,
"repo_created_at": "2021-01-17T04:17:12.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8562ce1a6... |
c0e2fe63-9fb4-4962-b499-45922a816e65 | walkccc/LeetCode | solutions/2430. Maximum Deletions on a String/2430.cpp | class Solution {
public:
int deleteString(string s) {
const int n = s.length();
// lcs[i][j] := the number of the same letters of s[i..n) and s[j..n)
vector<vector<int>> lcs(n + 1, vector<int>(n + 1));
// dp[i] := the maximum number of operations needed to delete s[i..n)
vector<int> dp(n, 1);
... | ALGO | 0.99985 | 5.623857 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2019-02-23T15:46:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1254,
"forks": 437,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45588a3... |
fcd09a22-adc2-4455-92b7-d0e5c0f807ca | danesinoo/bachelor-s_notes | programmazione_oggetti/lezioni/template/albero.cpp | #include <iostream>
// dichiarazione incompleta
template <class T> class Albero;
template <class T> std::ostream &operator<<(std::ostream &, const Albero<T> &);
template <class T> class Albero {
friend std::ostream &operator<< <T>(std::ostream &, const Albero &);
private:
T info;
class nodo { // template di c... | ALGO | 0.977955 | 5.224251 | {
"github_metadata": {
"branch": "main",
"commit_count": 88,
"repo_created_at": "2022-07-17T15:52: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": "283e133c3af... |
2b295bf5-c72e-4d3f-a53e-33031b3d9552 | acard6/CS225-class | mp_traversals/imageTraversal/BFS.cpp | #include <iterator>
#include <cmath>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include "../cs225/PNG.h"
#include "../Point.h"
#include "ImageTraversal.h"
#include "BFS.h"
using namespace cs225;
/**
* Initializes a breadth-first ImageTraversal on a given `png` image,
* starting at `star... | ALGO | 0.998573 | 4.507133 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2023-08-17T22:55:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "749a56104... |
80589453-1821-4a7e-94b9-e4944b9636ad | peduajo/AlphaZeroChess | C_project/lib/alphazero.cpp | #include "alphazero.h"
#include <torch/torch.h>
#include <torch/script.h>
#include <vector>
#include <tuple>
#include <algorithm>
#include <random>
#include <c10/cuda/CUDACachingAllocator.h>
#include <future>
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <cuda_runtime.h>
#include "cuda.h"
#include ... | ALGO | 0.905998 | 5.214798 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-05-07T14:31:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76afaa9e7760... |
93e8a29d-c92b-48c3-862e-51ba18842ef3 | HerbertyFreire/GraphAlgorithms- | Dijkstra/dijkstra.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <fstream>
using namespace std;
const int INFINITO = 1000000;
string dijkstra(vector<vector<pair<int, int>>> &grafo, int inicio) {
int tamanho = grafo.size();
vector<int> distancia(tamanho, INFINITO);
distancia[inicio] = 0;
vector<bool>... | ALGO | 0.999746 | 4.606774 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2023-05-24T21:04:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "db830e26f01... |
12392f72-4982-48a0-8ec4-1227ca1297a8 | citizenfx/fivem | code/client/citicore/console/OptionTokenizer.h | #pragma once
#include <console/ProgramArguments.h>
#include <boost/tokenizer.hpp>
inline auto TokenizeCommandLine(const std::string& argumentString)
{
boost::escaped_list_separator<char> tokenInfo("\\", " ", "\"");
boost::tokenizer<boost::escaped_list_separator<char>> tokenizer(argumentString, tokenInfo);
std::ve... | TOOL | 0.910376 | 6.361421 | {
"github_metadata": {
"branch": "master",
"commit_count": 12090,
"repo_created_at": "2017-01-16T21:18:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3859,
"forks": 2340,
"issues": 469,
"pull_requests": 118
},
"file_meta": {
"content_id"... |
769760eb-d212-4557-9196-6ffb834602a6 | google-deepmind/lab | deepmind/level_generation/text_maze_generation/algorithm.h | // Copyright (C) 2016 Google Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distribut... | ALGO | 0.986405 | 7.187787 | {
"github_metadata": {
"branch": "master",
"commit_count": 509,
"repo_created_at": "2016-11-30T13:41:26.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7250,
"forks": 1389,
"issues": 61,
"pull_requests": 4
},
"file_meta": {
"content_id": "33... |
d1b631aa-3cb9-49ca-aef4-c6b3c13e4f75 | IshanGarg123/Love-Babbar-Coding-Course | Love Babbar/Queue/Lec-60/C++3.cpp | #include<iostream>
using namespace std;
class CircularQueue{
public:
int* arr;
int size;
int capacity;
int front;
int rear;
CircularQueue(int n)
{
arr = new int[n];
size = 0;
capacity = n;
front = -1;
rear = 0;
}
void enqueue(int value)
... | ALGO | 0.997304 | 4.535232 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-10-03T09:44: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": "3a1977ab4b72... |
80125ae1-ae90-4e70-bc9a-58ec5a78879f | ishandutta2007/codeforces-k | kpw29/normal/722/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define sc... | ALGO | 0.998855 | 3.210645 | {
"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": "bc482124b61b... |
5b0bf198-cece-4f94-ba3e-d94d05cab837 | Yestercafe/oj | codeforces/Educational Codeforces Round 157 (Rated for Div. 2)/d_.cpp | #include <bits/stdc++.h>
using i64 = long long;
void sol() {
int n;
std::cin >> n;
std::vector<int> a(n - 1);
for (int i = 0; i < n - 1; ++i) {
std::cin >> a[i];
}
std::vector<int> b(n);
for (int i = 0; i < n - 1; ++i) {
b[i + 1] = (b[i] ^ a[i]);
}
for (int k =... | ALGO | 0.999992 | 4.146272 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2022-12-29T08:59:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5b9baa92d... |
c728acf2-003c-4365-bade-89a61011e076 | GabrielLins64/Competitive_Programming | URI/1021.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
double vr; // Valor real
scanf("%lf", &vr);
int notas[6] = {100, 50, 20, 10, 5, 2}; // Valor das cédulas
int moedas[6] = {100, 50, 25, 10, 5, 1}; // Valor dos centavos (em int para usar o operador %)
int vr_notas = (int) vr; // Pega apenas o valor em cé... | ALGO | 0.972968 | 3.943978 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2020-05-08T17:26: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": "29a2cbe6b... |
7198e2d9-2327-43a5-8fb6-fec5faaf100d | lamphanviet/competitive-programming | uva-online-judge/accepted-solutions/10080 - Gopher II.cpp | //*****************
// <NAME> **
// UVA 10080 - Gopher II
// Time limit: 3.000s
//********************************
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define FileIn(file) fr... | ALGO | 0.99982 | 3.703205 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2014-06-20T02:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 83,
"forks": 56,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "5cb3524c... |
c343579f-feea-4628-a501-abe4051fbbba | subsub-e/codetree-TILs | 240124/C-TAG/c-tag.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
#define MAX_N 500
// 변수 선언
int n, m;
int ans;
string A[MAX_N], B[MAX_N];
unordered_set<string> s;
bool TestLocation(int x, int y, int z) {
// x, y, z번째 자릿수를 선택했을 때 A와 B 그룹이
// 완벽하게 구분되면 true, 그렇지 않다면 false를 반환합니다.
s.clear();
// A의 원소를... | ALGO | 0.999951 | 4.133089 | {
"github_metadata": {
"branch": "main",
"commit_count": 1087,
"repo_created_at": "2023-12-17T08:25: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": "0c736e713... |
a09fcd9e-c3c8-416c-8818-741d7a1424ce | Garagekeeper/PS | 백준/Gold/11404. 플로이드/플로이드.cc | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int M,N;
int main()
{
cin >> N;
cin >> M;
vector<vector<int>> cost(N+1,vector<int>(N+1,INT_MAX));
while (M--)
{
int from, to, weight;
cin >> from >> to >> weight;
cost[from][to] = min(weigh... | ALGO | 0.999993 | 4.130795 | {
"github_metadata": {
"branch": "main",
"commit_count": 236,
"repo_created_at": "2021-02-10T01:26: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": "3bb470a1ee... |
04b31872-45ac-455f-8972-bc548ec4a14c | MohamedNagyMostafa/robot-localization | main.cpp | #include <cstdio>
#include <vector>
#include <string>
typedef std::vector<float> vector_c;
typedef std::string string_c;
// Sensor Faulty.
const static float pHit = 0.6;
const static float pMiss = 0.2;
// Movement Uncertainty
const static float BACK_PROB = 0.1;
const static float FORW_PROB = 0.1;
const ... | ALGO | 0.991657 | 4.931922 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-02-08T17:06: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": "4139fae4d3... |
ea00d058-4bfc-4177-a691-0cba5f6273d8 | SiddhantAttavar/Competitive-Programming | Codeforces Contests/CF-Round-895/B. The Corridor or There and Back Again.cpp | #include <bits/stdc++.h>
using namespace std;
template<typename T> inline void input(T& inVar) {cin >> inVar;}
template<typename T, typename... S> inline void input(T& inVar, S&... args) {cin >> inVar; input(args ...);}
template<typename T> inline void print(T outVar) {cout << outVar << '\n';}
template<typename T, type... | ALGO | 0.999986 | 4.366149 | {
"github_metadata": {
"branch": "main",
"commit_count": 607,
"repo_created_at": "2021-09-16T08:14:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d995c6a07... |
9701bd1c-3888-45b0-b1c8-a22e3711178e | virajchandra51/CodeForces | F_Maximum_modulo_equality.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
long long val;
Node()
{
val = 0;
}
Node(long long p1)
{
val = p1;
}
void merge(Node &l, Node &r)
{
val = gcd(l.val, r.val);
}
};
struct SegTree
{
vector<Node> tree;
vector<long long> arr... | ALGO | 0.999916 | 4.320724 | {
"github_metadata": {
"branch": "main",
"commit_count": 420,
"repo_created_at": "2022-03-12T06:31:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2dc7e7dd2... |
a8a5f5a1-d6c7-4b8e-a6f3-ca364a9d0901 | bhav380/DSA | c++/CodeForces/twoDtravelling.cpp |
#include <bits/stdc++.h>
using namespace std;
long twodTraveling(int data[][2],int n,int k,int a,int b,bool visited[]){
if((a<=k && b<=k) || a==b){
return 0;
}
visited[a] = true;
long ans = LONG_MAX;
for(int i=1; i<=n; i++){
i... | ALGO | 0.999977 | 4.166145 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-06-05T10:56:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bacc02aa6652... |
68542743-5081-48f9-8222-214ebd924771 | Algorithm17/programmers | lkc263/202108/42898/42898.cpp | #include <string>
#include <vector>
#define SHORTESTPATH 1000000007
using namespace std;
int dp[101][101]; // n, m (행, 열)
int solution(int m, int n, vector<vector<int>> puddles) {
int answer = 0;
// 물이 잠긴 지역 -1로 저장
for(int i=0;i<puddles.size();i++){
dp[puddles[i][1]][puddles[i][0]] = -1;
}
... | ALGO | 0.99993 | 5.479625 | {
"github_metadata": {
"branch": "main",
"commit_count": 63,
"repo_created_at": "2021-08-16T00:30:59.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "43beb8ea7b0f... |
a9ceebaa-4c47-4a87-a907-aaf42dfbdcc4 | MRT4R1KUL1SL4M/BasicDataStructure | MODULE-08 (Assignment-02)/Queries.cpp | #include <iostream>
using namespace std;
class Node {
public:
int val;
Node* next;
Node(int val) {
this->val = val;
this->next = NULL;
}
};
void insert_head(Node *&head, Node *&tail, int val) {
Node *newNode = new Node(val);
newNode->next = head;
head = newNode;
if... | ALGO | 0.9999 | 4.782073 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-03-19T16:35: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": "2b9674289f14... |
06ab0019-dbaf-44a1-a96c-f686ded05c88 | willmlam/aomdd | lib/cvo/ARP/Sort.hxx | /*
This module contains sorting function's declarations.
<NAME>, March 2002.
*/
#ifndef SORT_HXX_INCLUDED
#ifdef LINUX
typedef int64_t INT64 ;
#else
typedef __int64 INT64 ;
#endif
void QuickSortShort(short *input_key, unsigned long len, long *input_data,
// stack; passed in, to make this function thread-safe
... | ALGO | 0.999331 | 4.792581 | {
"github_metadata": {
"branch": "master",
"commit_count": 127,
"repo_created_at": "2011-04-01T01:32:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c0eefb8e... |
890ea63e-e5e8-4196-831d-fa2cc627b0aa | fuzzyaxioms/mbie-pomdp | mstiger.cpp | #define ARMA_DONT_USE_WRAPPER
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <random>
#include <armadillo>
#define NUM_BELIEFS 20
#define EM_USE_RO false
#define EST_T false
#define EST_... | ALGO | 0.99946 | 4.270722 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2013-12-04T20:53:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8ff2e072... |
11e1334c-d4f1-4223-85b6-0fac95966b81 | leexsh/LeetCode | 06_medium/102-BinaryTreeLevelOrderTraversal.cpp | #include "bits/stdc++.h"
using namespace std;
/*
LeetCode-102 题目:二叉树的层次遍历
给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。
例如:
给定二叉树: [3,9,20,null,null,15,7],
3
/ \
9 20
/ \
15 7
返回其层次遍历结果:
[
[3],
[9,20],
[15,... | ALGO | 0.999982 | 5.717413 | {
"github_metadata": {
"branch": "master",
"commit_count": 128,
"repo_created_at": "2019-11-04T09:01:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b077d90a... |
c9094299-926f-4a86-80d5-6b024b850c15 | sabide/cpp | 01-C++_sans_les_classes/02-array_and_co/solution/Pointers/der.hpp | #ifndef MY_CLASS_H // include guard
#define MY_CLASS_H
double* build_mesh( double &h, int const n ){
double *x = new double[n]; // Allocation dynamique pour le tableau x
h = 1./(n-1);
for (int i = 0; i < n; ++i) {
x[i] = i * h;
}
return x;
};
double* set_values( double *x, int const n ){
... | TOOL | 0.953709 | 3.912589 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2024-08-09T08:38: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": "07bfcf52c72... |
cdf5bb27-1265-44a6-b2c2-c879eaf5bdf7 | Alpro-1B/TugasPraktikum_ZakkiKhairulAbdulaziz | Pertemuan 4/TugasNo1.cpp | #include <iostream>
using namespace std;
int main()
{
//perkenalan program atau introduction
cout<<"Hai, saya Zell.\n";
cout<<"Saya akan membantu anda untuk menampilkan bilangan ganjil, genap, dan prima dari angka 1 hingga angka yang diinginkan.\n";
cout<<"Selain itu saya akan menjumlahkan bilangannya d... | ALGO | 0.995384 | 3.470051 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2023-10-14T03:52:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0cf1410819... |
40a8e82e-3872-4bbe-85f8-552821c0d545 | Nih1tGupta/Leetcode-GFG | 0494-target-sum/0494-target-sum.cpp | class Solution {
public:
int dp[21][2001];
int f(int i, vector<int>& nums, int t, int curr) {
if (i == 0) {
if (nums[0] == 0) {
// If the first element is 0, both +0 and -0 lead to the same target
return t == curr ? 2 : 0;
}
// Check if either +nums[0] or -nums[0] can satisfy ... | ALGO | 0.999978 | 5.544963 | {
"github_metadata": {
"branch": "main",
"commit_count": 4679,
"repo_created_at": "2023-10-04T09:44:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c2c5c2dff... |
8c8cb827-2647-4489-8254-0f5368bad6ee | mostafa-saad/MyCompetitiveProgramming | Olympiad/POI/official/2008/code/poc/prog/poc0.cpp | /*************************************************************************
* *
* XV Olimpiada Informatyczna *
* *
* Zadanie: Pocia... | ALGO | 0.999966 | 3.969025 | {
"github_metadata": {
"branch": "master",
"commit_count": 439,
"repo_created_at": "2017-02-05T22:26:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 415,
"forks": 85,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1377... |
f2131350-6eb3-46ea-a288-8d5d63ee4f49 | Sociosarbis/cpp-boilerplate | src/makeConnected.cpp | #include <vector>
#include "gtest/gtest.h"
using namespace std;
class Solution {
public:
int makeConnected(int n, vector<vector<int>>& connections) {
if (n - 1 > (int)connections.size()) return -1;
vector<int> c_to_g = vector<int>(n, 0);
vector<vector<int>> groups;
groups.push_back... | ALGO | 0.997592 | 5.620027 | {
"github_metadata": {
"branch": "master",
"commit_count": 76,
"repo_created_at": "2020-12-14T15:15: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": "c8c14e72c... |
c20a991d-ee5c-468f-9913-5d25297a7c6c | UOS841/ProblemSolving | handal95/p1967(트리의지름).cpp | #include <iostream>
#include <vector>
using namespace std;
struct Node{
int index;
vector<pair<int, int>> edges;
};
void dfs(int v, int value, vector<bool> visited);
vector<Node> nodes;
int max_value = 0;
int root = 0;
int main(){
int N;
cin >> N;
nodes.resize(N+1);
for(int i = 0; i <= N; i+... | ALGO | 0.999897 | 4.034069 | {
"github_metadata": {
"branch": "master",
"commit_count": 308,
"repo_created_at": "2020-09-05T08:10:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7884ab73b... |
c1f6fbaf-c730-44d6-9d6e-69d28ee3b1cc | mostafa-saad/MyCompetitiveProgramming | Olympiad/JOI/official/JOISC/2015/2015-sp-d4-walls-sample.cpp | #include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int MAXN = 200200;
const int MAXM = 200200;
int N, M, M0, A[MAXN], B[MAXN], P[MAXM];
vector<int> laser;
set<pair<int, int> > diffs;
set<pair<int, int> > gaps;
vector<pair<int, in... | ALGO | 0.999984 | 4.1797 | {
"github_metadata": {
"branch": "master",
"commit_count": 439,
"repo_created_at": "2017-02-05T22:26:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 415,
"forks": 85,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "affda... |
f3375eda-6b93-4723-8695-f1658fcf9c86 | kakuai-coder/training-cp | TraiHe/ThayDong/d5gpath/d5gpath.cpp | /*
Author: tinhnopro
created: 2025.06.17 00:31:21
*/
#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 10
#endif // LOCAL
using namespace std;
using i64 = long long;
template <typename T> bool maximize(T &a, const T &b) { return a < b ? a = b, true : false; }
template <typename T>... | ALGO | 0.999924 | 4.095287 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-06-19T10:17: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": "fc35e540f775... |
731dba3f-4c06-4634-b89f-b6895d3278df | brankomilosevic/c-cpp-specialization | c03 C++ For C Programmers part A/wk04-mst-bm.cpp | #include <iostream>
#include <vector>
#include <list>
#include <limits>
#include <string>
#include <sstream>
#include <utility>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <iterator>
const int MAX_GRAPH_SIZE = 50;
// Class representing the Node in the graph
template <typenam... | ALGO | 0.998521 | 4.508194 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2020-11-17T09:12: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": "b79a469a20c2... |
2f8f41db-f283-45b7-bf8f-563fe6a48e76 | sgc109/leetcode-solutions | toeplitz-matrix/toeplitz-matrix-follow-up.cpp | class Solution {
class Node {
public:
int num;
Node* next;
Node(int _num) : num(_num), next(nullptr) {}
};
Node* vector2list(vector<int>& v) {
Node* root = new Node(0);
Node* last = root;
for(int num : v) {
last->next = new Node(num);
... | ALGO | 0.999966 | 6.755148 | {
"github_metadata": {
"branch": "main",
"commit_count": 1114,
"repo_created_at": "2021-08-15T14:38:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e6a80ee3... |
45a493c2-85ae-4c46-a65f-1e2ad1382021 | xuefengsi/atom-C-algorithm | 编程习题/数据结构/单链表.cpp | #include<iostream>
#define N 5
using namespace std;
typedef char DataType;
typedef struct node
{
DataType data;
struct node *next;
}LinkedNode,*LinkList;
LinkList createList(DataType a[])
{
LinkedNode *headList = new LinkedNode();
headList->data = a[0];
headList->next = NULL;
for(int i=N-1;i>=1;i--)
{
... | ALGO | 0.999828 | 3.891745 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-10-17T02:27: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": "140320fe70... |
f659d446-92d0-42b1-a797-87ee12f59f39 | hhe44/CourseWork | CS211/A09.cpp | #include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
/*Note2Self
i = current man
c = new man
q[i] = current woman
q[c] = new woman */
bool ok(int q[], int c){
int mp[3][3]={{0, 2, 1},
{0, 2, 1},
{1, 2, 0}};
int wp[3][3]={{2, 1, 0},
... | ALGO | 0.999696 | 3.016362 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-01-12T05:18:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a543bc828e... |
06f1757e-d33c-42c3-84a3-495516d71ef8 | kamehamehaa0000/Strivers-A2Z-DSA-Sheet-Practice- | Step 6 - Linked List/Medium Problems On Doubly Linked List/RemoveDuplicatesFromSortedDLL.cpp | #include <bits/stdc++.h>
using namespace std;
// List will be sorted
// Definition of doubly linked list:
class Node
{
public:
int data;
Node *prev;
Node *next;
Node()
{
this->data = 0;
this->prev = NULL;
this->next = NULL;
}
Node(int data)
{
this->data ... | ALGO | 0.999948 | 4.679482 | {
"github_metadata": {
"branch": "main",
"commit_count": 143,
"repo_created_at": "2024-03-07T15:41:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2d88e57f34... |
6bd8c5bf-ffad-47c5-8f48-f077523038b6 | dilmanpreet/algorithms-data-structure | lab9/RadixSort.cpp | // Author : <NAME>
// date: 12 November 2018
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int temp[10];
void radixsort(vector<int> input, int ArrSize, int Range)
{
int divident=0;
int div = 1;
for (int j = divident; j < Range; j++) {
int rem = 0;
int index = 0;
while (rem < ArrS... | ALGO | 0.999923 | 4.963504 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2017-09-22T08:02: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": "7a9d6b595... |
91b018de-0efa-4a88-9725-13796569cf4b | OSCC-Project/iMap | include/database/network/details/node_hash.hpp | // ***************************************************************************************
// Copyright (c) 2023-2025 Peng Cheng Laboratory
// Copyright (c) 2023-2025 Shanghai Anlogic Infotech Co.,Ltd.
// Copyright (c) 2023-2025 Peking University
//
// iMAP-FPGA is licensed under Mulan PSL v2.
// You can use this softw... | ALGO | 0.948759 | 6.667309 | {
"github_metadata": {
"branch": "main",
"commit_count": 145,
"repo_created_at": "2023-03-27T09:30:55.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 19,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce1d8d2181... |
ceadbc4f-6e2f-42c2-a6de-bead55fdc5a6 | wangqifan/bitcs | 2018/2018.1.cpp | #include <iostream>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int _val)
{
val = _val;
next = NULL;
}
};
void deletmin(ListNode *&head)
{
if (head == NULL)
return;
int min = head->val; //记录最小值
ListNode *minptr = head; //记录最小值前一个节点... | ALGO | 0.999992 | 4.117314 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2018-11-03T16:40: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": "e2a80e73e... |
baf54f2b-be8f-442d-b8e0-676fdfae2b19 | Sudipkarmakar25/Leetcode-Solutions | Recursion&DP.cpp/Best_Time_To_Buy&SellStocks_II.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int solve(int index, int buy, vector<int> &prices, vector<vector<int>> &dp)
{
if (index == prices.size())
{
return 0;
}
if (dp[index][buy] != -1)
{
return dp[index][buy];
... | ALGO | 0.999992 | 5.242462 | {
"github_metadata": {
"branch": "main",
"commit_count": 72,
"repo_created_at": "2024-05-29T17:50: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": "61aa37d414f... |
afaeca96-4305-4d90-9b3f-b2f48639035e | aGatovski/Introduction-To-Programming- | UP_Homework_1/04. Interval Between Dates.cpp | /**
*
* Solution to homework assignment 1
* Introduction to programming course
* Faculty of Mathematics and Informatics of Sofia University
* Winter semester 2023/2024
*
* @author <NAME>
* @idnumber 6MI0600280
* @task 4
*
*/
#include <iostream>
using namespace std;
bool isLeapYear(int y, int month) {
if (y <= 19... | ALGO | 0.999712 | 4.978512 | {
"github_metadata": {
"branch": "main",
"commit_count": 211,
"repo_created_at": "2023-10-03T20:47:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f82c9391fe... |
6b43638c-b21f-4764-aa2f-ae1a34a73b69 | qwaker00/Olymp | Trains/10112012/G/hax.cpp | #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <functional>
#include <numeric>
typedef long double LD... | ALGO | 0.999957 | 3.450157 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2012-09-04T15:56:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bbd19498... |
03dedcba-bdd6-4e26-ab40-b3681aa3728c | ioqoo/PS | Samsung Academy/day10/10714_topdown.cpp | #include <iostream>
#include <cstring>
#define MAX 2005
#define ll long long
using namespace std;
int N;
ll cakes[MAX];
ll dp[MAX][MAX];
// dp[i][j] : 현재까지 i ~ j번 조각이 없어졌을 때, 남은 조각들에서 JOI가 가져올 수 있는 총 값의 최댓값
// 구간 이용하는 사선 dp랑 비슷하지만 보는 구간이 (i ~ j)의 여집합인 것이 다름
int goright(int pos) {
return (pos+1)%N;
}
int goleft(... | ALGO | 0.999987 | 3.772909 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2019-12-27T07:31: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": "eabfc33b1... |
0fbac13f-f7ff-4cb0-8abd-2d8546cc0889 | clingfei/LeetCode | 1345.cpp | #include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
class Solution {
public:
int minJumps(vector<int>& arr) {
if(arr.size() == 1) return 0;
unordered_map<int, vector<int>> index;
for (int i = 0; i < arr.size(); ++i) {
if (index.find(arr[i]) == inde... | ALGO | 0.999993 | 5.393083 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2021-12-31T23:54:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a21b74c968... |
1875a22e-6a6b-4490-b9e7-6e64cdc12b7b | howardrya/HONRPHYS | factorial.cpp | #include<iostream>
using namespace std;
int main() {
int i, n, factorial = 1; //defines variables
cout<<"Enter a positive integer to find its factorial: " ; //displays prompt to enter number
cin>>n; //allows user to enter a number and defines it as n
for (i = 1; i <= n; ++i) {
factorial *= i; // factor... | ALGO | 0.999359 | 3.945093 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2016-09-20T16:03:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "846ed9cae6... |
c9b9504e-fd46-4bc6-b1fa-b4db8f355743 | dealii/dealii | source/base/polynomials_rt_bubbles.cc | // ------------------------------------------------------------------------
//
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2018 - 2024 by the deal.II authors
//
// This file is part of the deal.II library.
//
// Part of the source code is dual licensed under Apache-2.0 WITH
// LLVM-exception OR LGPL-... | TOOL | 0.984387 | 6.261983 | {
"github_metadata": {
"branch": "master",
"commit_count": 65304,
"repo_created_at": "2014-07-17T14:00:26.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1530,
"forks": 789,
"issues": 533,
"pull_requests": 92
},
"file_meta": {
"content_id": ... |
7e552aad-1f8b-4f26-9435-bf3a6dc9be38 | vrublevskiyvitaliy/cuda-kd-tree | CUDA_1/QuickSelect.cpp | //
// QuickSelect.cpp
// V1
//
// Created by <NAME> on 3/25/17.
// Copyright © 2017 <NAME>. All rights reserved.
//
#include "QuickSelect.hpp"
void QuickSelect::sort(std::vector<glm::vec2> & points, int _dim, int left, int right, int m) {
if (points.size() == 0) return;
dim = _dim;
quickfindFirstK(... | ALGO | 0.999821 | 5.710437 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-06-27T18:57:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fafbcabb4b... |
1765c7b8-6276-4ca8-9b9f-59345a2403ab | ishandutta2007/codeforces-a | aropan/normal/161/C.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <ctime>
#define L first
#define R second
using namespace std;
int l1, r1, l2, r2;
int rec(int k, int l1, int r1, int l2, int r2)
{
int res = max(0, min(r1, r2) - max(l1, l2) + 1);
if (r1 - l1 + 1 == res || r2 - l2 + 1== res) return res;
... | ALGO | 0.998936 | 3.937638 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-04-11T00:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e9a12bf9104... |
f28d95ec-2bd8-42a2-ab6e-6768d557e139 | Ahmedaltu/Cpp_Labs | Cpp_Labs/Lab1/rand() function.cpp | /*
In this exercise we play with the elementary features of C++ language.
Hint: Visual Studio reformats the selected source code by ctrl-k ctrl-f command. This can be useful when importing code from different sources.
Excercise 1 (Basic input and output, arrays and pointers 4p)
Write a program that first asks from the ... | ALGO | 0.983377 | 4.58533 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-02-02T11:08: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": "55eb6f8dfc94... |
602aba83-cd0f-441d-a08f-698df3edd8a2 | h2o/h2o | deps/brotli/research/deorummolae.cc | #include "./deorummolae.h"
#include <array>
#include <cstdio>
#include "./esaxx/sais.hxx"
/* Used for quick SA-entry to file mapping. Each file is padded to size that
is a multiple of chunk size. */
#define CHUNK_SIZE 64
/* Length of substring that is considered to be covered by dictionary string. */
#define CUT_... | ALGO | 0.987952 | 5.013346 | {
"github_metadata": {
"branch": "master",
"commit_count": 12247,
"repo_created_at": "2014-08-16T23:59:03.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 11150,
"forks": 859,
"issues": 594,
"pull_requests": 114
},
"file_meta": {
"content_id"... |
0836ad44-a33d-4407-a51a-e619af55b8ed | rafael-radkowski/HCI-557-CG | gl_common/GLSphere.cpp | //
// GLSphere.cpp
// OpenGL_Transformations
//
// Created by <NAME> on 9/12/15.
//
//
#include "GLSphere.h"
static const string vs_string_GLSphere_410 =
"#version 410 core \n"
" \n"
"uniform mat4 ... | TOOL | 0.980509 | 6.187667 | {
"github_metadata": {
"branch": "master",
"commit_count": 173,
"repo_created_at": "2015-08-14T20:01:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ba1b0... |
854c2e79-4020-4278-80ee-5b5b6bc101db | luqmanarifin/cp | 0-unclassified/zuma.cpp | // too easy to AC
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[N][N], a[N];
int dfs(int l, int r) {
if(dp[l][r] != -1) return dp[l][r];
if(l > r) return 1;
int& ret = dp[l][r] = (a[l] == a[r]? dfs(l + 1, r - 1) : N);
for(int i = l; i < r; i++) {
ret = min(ret, dfs(l, i) + dfs(... | ALGO | 0.999968 | 4.015262 | {
"github_metadata": {
"branch": "master",
"commit_count": 772,
"repo_created_at": "2016-02-09T04:26:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f796cb6... |
633303eb-0bca-4244-bd2d-232cf9bacc8a | Yindong-Zhang/leetcode | minWindow_76.h | //
// Created by so_go on 2020/2/12.
//
/*
* 给你一个字符串 S、一个字符串 T,请在字符串 S 里面找出:包含 T 所有字母的最小子串。
示例:
输入: S = "ADOBECODEBANC", T = "ABC"
输出: "BANC"
说明:
如果 S 中不存这样的子串,则返回空字符串 ""。
如果 S 中存在这样的子串,我们保证它是唯一的答案。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/minimum-window-substring
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注... | ALGO | 0.999728 | 7.493784 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2019-05-26T15:09: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": "5390ba9eb... |
8b2393c1-75d3-4a0a-9dea-c56b07d31065 | Abraham10VelGlez/learningC | PRISCILA/boster/Ej 1.cpp | /* 1.- Se requiere controlar el numero de habitantes de un edificio con 6 pisos y 4 puertas (A, B, C y D) en cada iso.
Realizar un programa que pida al usuario que introduzca el numero de habitantes de cada puerta del edificio.
El programa debe decir la vivienda (piso y puerta) que mas habitantes tiene del edificio.*/
... | ALGO | 0.998701 | 3.17745 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-07-18T22:51: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": "5abbf7644fde... |
890911e3-40cc-43d4-a6e1-6c82565df007 | JMacfield/2024_10days | YTEngine/Math/Quaternion/Quaternion.cpp | #include "Quaternion.h"
#include <cmath>
#include <numbers>
#include "Vector3.h"
#include "VectorCalculation.h"
Quaternion QuaternionMultiply(const Quaternion& lhs, const Quaternion& rhs) {
Quaternion result = {};
Quaternion q = lhs;
Quaternion r = rhs;
//wはそのまま
//xはi部分
//yはj部分
//zはk部分
... | TOOL | 0.956141 | 5.959581 | {
"github_metadata": {
"branch": "master",
"commit_count": 69,
"repo_created_at": "2024-09-04T05:37:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7412ab6d6... |
c624cc20-7394-42d8-b9d5-f4a318cce89e | ROCm/OpenFOAM_HMM | src/atmosphericModels/fvOptions/atmBuoyancyTurbSource/atmBuoyancyTurbSource.H | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-----------------------------------... | TOOL | 0.941902 | 5.854776 | {
"github_metadata": {
"branch": "suyash/hmm",
"commit_count": 25733,
"repo_created_at": "2022-10-27T12:31:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 25,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "3e... |
f063daa5-94cb-4b0a-bc6c-57a093ce64c3 | gjha133/Leetcode | 437-path-sum-iii/437-path-sum-iii.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999989 | 5.434887 | {
"github_metadata": {
"branch": "main",
"commit_count": 2428,
"repo_created_at": "2022-03-18T06:40:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d90a5cfa5... |
5ab07467-6f1f-4907-b0e4-9cbf2432851c | fahrican/HackerRank | 30DaysOfCode/Day21_Generics.cpp | /*
***** Task *****
Write a single generic function named printArray; this function must taken an array of generic elements as a parameter (the exception to this is C++, which takes a vector). The locked Solution class in your editor tests your function.
NOTE: You must use generics to solve this challenge. Do not write... | ALGO | 0.999219 | 5.748009 | {
"github_metadata": {
"branch": "master",
"commit_count": 115,
"repo_created_at": "2017-09-08T11:43: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": "233636f6... |
e68c8823-3c43-444d-8208-3e179901751d | efficient/cuckoofilter | src/packedtable.h | #ifndef CUCKOO_FILTER_PACKED_TABLE_H_
#define CUCKOO_FILTER_PACKED_TABLE_H_
#include <sstream>
#include <utility>
#include "debug.h"
#include "permencoding.h"
#include "printutil.h"
namespace cuckoofilter {
// Using Permutation encoding to save 1 bit per tag
template <size_t bits_per_tag>
class PackedTable {
stat... | ALGO | 0.921192 | 5.698554 | {
"github_metadata": {
"branch": "master",
"commit_count": 68,
"repo_created_at": "2013-05-24T20:44:58.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 998,
"forks": 174,
"issues": 16,
"pull_requests": 6
},
"file_meta": {
"content_id": "83444... |
923d195c-292a-48e8-9fd7-ccb7084d9a51 | KimUJin3359/Algorithm_Hash_String-2- | RabinKarp/RabinKarp/main.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int hash_max = 1;
map<int, vector<int>> hash_table;
int make_hash(char str[], int len, int before_hash = 0)
{
int hash_v = 0;
if (before_hash == 0)
{
for (int i = 0; i < len; i++)
{
hash_v *= 2;
hash_v += str[i];... | ALGO | 0.99995 | 4.288425 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2021-02-25T15:21: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": "82bd37ac4c... |
889ce73b-a124-44b1-97fb-73a142f7a9cb | Thiagoncg/Aulas-C | Scripts/estudoProvaParcial/mediaAunos.cpp | #include <iostream>
#include <string>
using namespace std;
struct Aluno {
string nome;
float nota;
};
int main() {
Aluno alunos[5]; // Vetor para armazenar 5 alunos
float somaNotas = 0.0;
// Loop para inserir os dados dos 5 alunos
for (int i = 0; i < 5; i++) {
cout << "Digite o n... | ALGO | 0.995035 | 6.137506 | {
"github_metadata": {
"branch": "main",
"commit_count": 37,
"repo_created_at": "2023-08-09T13:48:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8e72b1b61c6... |
f2e28a98-a95f-4111-8d8e-1225f1bafd9d | Kishgla/DSA-Labs | DSA Labs/BST.h | /*
File: BST.h
Author(s):
Base: <NAME>
<EMAIL>
Student:
Created: 03.05.2021
Last Modified: 03.21.2021
Purpose: A binary search tree
Notes: Property of Full Sail University
*/
// Header protection
#pragma once
/************/
/* Includes */
/************/
#include <string>
/***********/
/* Defines */
/**... | TEST | 0.92559 | 3.461519 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2022-05-09T04:48: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": "db0cfc56aa... |
f6d59a4c-d196-445f-839a-78781c1e42a5 | luruiwu/work | navigation/navigation/cvte_hd_map/include/hdmap_impl.hpp | /**
* @file hdmap_impl.hpp
* @author linyanlong (<EMAIL>)
* @brief
* @version 0.1
* @date 2021-12-13
*
* @copyright Copyright (c) 2021
*
*/
#ifndef HDMAP_IMPL_HPP_
#define HDMAP_IMPL_HPP_
#include <string>
#include <vector>
#include "aabox2d.h"
#include "map_c5_area.pb.h"
#include "aaboxkdtree2d.h"
#include ... | ALGO | 0.962961 | 3.872444 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-12-12T06:50: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": "9f9a12ad1b25... |
9f33bdcd-fd77-4b6f-b9b1-331f42b8d13f | SKRTEEEEEE/plus | basics/func--sinergia/scope.cpp | #include <iostream>
int num = 3; // Variable global, se puede utilizar en todas las funciones. Prioriza la local si hay dos iguales.
void mostrarNumero();
int main() {
int num = 1; // Variable local, solo se puede utilizar dentro de esta función
// std::cout << num;
std::cout << ::num << std::endl; // :: es... | ALGO | 0.959389 | 4.40977 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-12-06T01:22: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": "fd07f564580... |
62a8390b-ec6c-484a-b4be-a8cc5ac37275 | OsirisLambert/CPSC323-complier-Syntax_analyzer | syn.cpp | #include <iostream>
#include <map>
#include <stack>
#include <fstream>
#include <string>
#include <string.h>
using namespace std;
char operators[] = "*+-=/><%";
char separator[] = "'(){}[],:;";
char keywords[18][10] = { "int", "float", "bool", "if", "else", "then", "endif", "while", "whileend", "do", "doend","for", ... | TOOL | 0.916735 | 3.171849 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-11-17T21:08: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": "965cb37e47... |
736ccb31-1321-4220-8b3c-d6874f034229 | younglin90/rigid-ipc-win | src/ipc/broad_phase/aabb_broad.cpp | #include "aabb.hpp"
#ifdef IPC_USE_TBB
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#endif
#include <cfenv>
namespace ipc {
AABB::AABB(const ArrayMax3d& _min, const ArrayMax3d& _max)
: min(_min)
, max(_max)
{
assert(min.size() == max.size());
assert((min <= max).all());
// half_e... | ALGO | 0.998221 | 7.1089 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2025-02-19T16: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": "e2617c2199... |
31152001-5af9-4ed2-8eac-81791625b68e | yeaseoPark/CodingTestAsCpp | 04. UnionFind/UnionFind.cpp | #include <iostream>
using namespace std;
// 부모 노드를 구하는 함수
int getParent(int parent[], int x){
if(parent[x] == x) return x;
return parent[x] = getParent(parent, parent[x]);
}
// 두 부모 노드를 합치는 함수
int unionParent(int parent[], int a, int b){
a = getParent(parent, a);
b = getParent(parent, b);
if(a < b) parent[b... | ALGO | 0.999892 | 4.844826 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2023-08-02T06:32: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": "43465f6a8... |
959766ba-bd01-4ce6-b62d-4f145dfb7713 | dreyus95/AVSP_SourceQualityPrediction | CodeJamCrawler/dataset/11_24752_61.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
int map[410][410] ;
int n ;
int ans ;
int used[410] ;
typedef struct
{
int con[410] ;
int step ;
int id ;
} record ;
record rec[410000] ;
int top, rear ;
int cnt(int *str)
{
int i ;
int out = 0 ;
for(i=1;i<n;i++)
{
if(str[i])
{
out++ ;
}
}
... | ALGO | 0.999793 | 3.392362 | {
"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": "a5d0f2244... |
98fecf15-e71f-49f1-9040-0f29fcebd2e5 | sivannagau/HSG-2023 | bai 3.cpp | /*
∧,,,∧
( ̳• · • ̳)
/ づ♡ ~ Louiszn ~
##################################################################################
Lập trình tìm tất cả các hoán vị của chuỗi. VD: ABC ACB BAC BCA CAB CBA
##################################################################################
*/
#include <... | ALGO | 0.99993 | 5.303587 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-06-10T14:58: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": "fe78bc01a522... |
b831e7ae-9fa8-4da7-bf4b-6bc964600949 | Sillyplus/Solution | Timus/1135.cpp | /*******************************************************************************
> File Name: 1135.cpp
> Author: sillyplus
> Mail: <EMAIL>
> Created Time: Fri Jun 5 23:41:59 2015
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
cons... | ALGO | 0.999917 | 3.283402 | {
"github_metadata": {
"branch": "master",
"commit_count": 116,
"repo_created_at": "2014-07-11T11:21: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": "cceec0c4... |
daf92a30-9fe6-42d6-b97a-f242cb2458a0 | tusharjaiswal123/Data-Structure-and-Algorithms | Quick sort.cpp | #include<iostream>
using namespace std;
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
int partition (int arr[], int low, int high)
{
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j <= high - 1; j++)
{
if (arr[j] < pivot)
{
i++;
... | ALGO | 0.999978 | 5.187091 | {
"github_metadata": {
"branch": "master",
"commit_count": 347,
"repo_created_at": "2019-08-28T12:47:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6ac55505... |
0d4f6658-6e5d-475d-b9ba-ff9e3841caa0 | ClickHouse/ClickHouse | src/Interpreters/JIT/CompileDAG.cpp | #include <Interpreters/JIT/CompileDAG.h>
#if USE_EMBEDDED_COMPILER
#include <llvm/IR/BasicBlock.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <Common/SipHash.h>
#include <Common/FieldVisitorToString.h>
#include <Columns/ColumnConst.h>
#include <DataTypes/Native.h>
#include <IO/WriteBufferF... | TOOL | 0.922621 | 7.568105 | {
"github_metadata": {
"branch": "master",
"commit_count": 183246,
"repo_created_at": "2016-06-02T08:28:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 41764,
"forks": 7471,
"issues": 4250,
"pull_requests": 622
},
"file_meta": {
"content_... |
a7b2def6-f131-4411-a8ab-53e14fc10427 | Seim2k17/UdemyAdvCpp | Exceptions/STL/Vectors.cpp |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
/*
int main()
{
vector<string> strings;
strings.push_back("bla");
strings.push_back("cat");
strings.push_back("poo");
strings.push_back("maeh");
// not recommend!!! use push_back for adding (otherwise an exception c... | TOOL | 0.961914 | 3.361811 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2019-10-25T08:41: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": "2ddce5273... |
54ccc841-48fa-4d9c-a3ba-0d797833ba2a | lclpsoz/competitive-programming | ARCHIVE/2019-01-06-1845/80A.cpp | #include "bits/stdc++.h"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define len(x) ((int)(x).size())
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;
const ld EPS = 1e-9... | ALGO | 0.999976 | 4.003816 | {
"github_metadata": {
"branch": "master",
"commit_count": 274,
"repo_created_at": "2020-07-09T09:09:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "12ddf238... |
056e1980-4cb6-492e-831e-ef7e47d4b62a | Kingsford-Group/micorrectiontest | src/scrna_uncorrected_mi.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <omp.h>
#include <mutex>
#include <numeric>
#include <algorithm>
#include "boost/algorithm/string.hpp"
#include "Eigen/Dense"
#include "ProgressBar.hpp"
#include "cnpy.h"
using namespace std;
Eigen::MatrixXd load_normal... | DATA | 0.996802 | 5.50299 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-11-09T00:23:07.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ca259da3cd... |
df90d704-35e4-4346-a87e-b5b5e9e0cdc5 | roshanbellary/Competitive-Programming | CSES/Range_Queries/ListRemovals.cpp | /*
Problem: List Removals
Problem Link: https://cses.fi/problemset/task/1749/
Notes:
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> inde... | ALGO | 0.99999 | 4.179591 | {
"github_metadata": {
"branch": "main",
"commit_count": 581,
"repo_created_at": "2021-09-13T03:54: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": "6a54204eb1... |
f8d7f1fe-1a9c-4c4d-8ec3-72f570bf056e | aakash811/Leetcode-Solutions | 3108-minimum-cost-walk-in-weighted-graph/3108-minimum-cost-walk-in-weighted-graph.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<int> prnt, minCst;
int findRoot(int node) {
if (prnt[node] != node) {
prnt[node] = findRoot(prnt[node]);
}
return prnt[node];
}
vector<int> minimumCost(int n, vector<vector<int>>& edges, vector... | ALGO | 0.999992 | 5.778678 | {
"github_metadata": {
"branch": "main",
"commit_count": 1543,
"repo_created_at": "2025-01-02T16:36: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": "c846335d9... |
ed14b5b2-8bb9-4bb4-a0c6-ea36819eb1f6 | cran/elections.dtree | src/irv_node.cpp | /******************************************************************************
* File: irv_node.cpp
*
* Author: <NAME> <<EMAIL>>
* Created: 02/26/22
* Description: This file implements the IRVNode class as outlined in
* `irv_node.hpp`.
**********************... | ALGO | 0.999824 | 7.594843 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2022-09-14T15:41:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a47aa86142d... |
29d4fc26-89f8-4551-99b1-c82be3f8834b | amitdu6ey/Online-Judge-Submissions | codeforces/1214/C.cpp | // [amitdu6ey]
// g++ -std=c++11 -o2 -Wall filename.cpp -o filename
#include <bits/stdc++.h>
#define hell 1000000009
#define bug1(x) cout<<"$ "<<x<<" $"<<endl
#define bug2(x) cout<<"% "<<x<<" %"<<endl
#define bug3(x) cout<<"# "<<x<<" #"<<endl
#define ll long long
#define pb push_back
#define mp make_pair
#define tr(z)... | ALGO | 0.999878 | 3.711789 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2020-06-21T12:25:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6653c2651... |
e5466365-fee5-4aa5-8df2-5d4f2e228383 | Strand2013/siguoya | AC_history/[面试题 04.10]检查子树.cpp | // 检查子树。你有两棵非常大的二叉树:T1,有几万个节点;T2,有几万个节点。设计一个算法,判断 T2 是否为 T1 的子树。
//
// 如果 T1 有这么一个节点 n,其子树与 T2 一模一样,则 T2 为 T1 的子树,也就是说,从节点 n 处把树砍断,得到的树与 T2 完全相同。
//
// 示例1:
//
// 输入:t1 = [1, 2, 3], t2 = [2]
// 输出:true
//
//
// 示例2:
//
// 输入:t1 = [1, null, 2, 4], t2 = [3, 2]
// 输出:false
//
//
// 提示:
//
//
// 树的节点数目范围为[0, 20000... | ALGO | 0.999841 | 6.340512 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-09-11T03:17:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "65efd8d5ba04... |
3d6f455f-3ff0-4cde-8f89-2b843b5914ee | Rohit-8/Leetcode | 530-minimum-absolute-difference-in-bst/530-minimum-absolute-difference-in-bst.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.999932 | 6.280313 | {
"github_metadata": {
"branch": "main",
"commit_count": 2195,
"repo_created_at": "2022-06-26T18:05:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "169b8056c... |
8097ef31-d1a7-4eb8-9fd6-73c9b676fa8c | lunatic-7/college-git | c_college_3rd/deletion.cpp | #include <iostream>
using namespace std;
void traversal(int arr[], int size)
{
for (int i = 0; i < size; i++)
{
cout << arr[i] << " ";
}
cout << "\n";
}
void deletion(int arr[], int size, int index)
{
// starting from given index and going till the last second element
for (int i = ind... | ALGO | 0.999652 | 4.924651 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2021-11-13T14:16: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": "f34a1686e6d... |
eb6bbd25-1d8a-4fcd-b681-8cbb27d2bfe1 | AmalgamatedHarmonics/Prism | src/LPF.cpp | /*
* lpf.c - Low Pass Filter utilities
*
* Author: <NAME> (<EMAIL>)
*
* 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... | ALGO | 0.994463 | 5.777471 | {
"github_metadata": {
"branch": "master",
"commit_count": 197,
"repo_created_at": "2019-07-09T17:24:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 27,
"forks": 10,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "e2aa15... |
8dccd9c4-6c1b-4907-913e-9af3f81c3b0a | Palmkonde/CompetitiveProgramming | TOI/TOI12_secret/TOI12_secret.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1005;
string a,b,q;
int n,m,k;
int dp[N][N];
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin >> a >> b;
n = a.size();
m = b.size();
cin >> k;
while(k--)
{
cin >> q;
memset(dp,0,sizeof(dp));
... | ALGO | 0.99999 | 4.411309 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2024-08-26T13:54: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": "5a8197676d... |
a1579ec8-4250-49a5-a57d-67f0baa4f144 | ahazhangxin/algorithm | Desktop/Git/Huffman/Huffman/FileCompressHuffM.cpp | #include "FileCompressHuff.h"
#include <iostream>
#include <assert.h>
using namespace std;
FileCompressHuffM::FileCompressHuffM()
{
_charInfo.resize(256);
for (size_t i = 0; i < 256; ++i)
_charInfo[i]._ch = i;
}
void FileCompressHuffM::CompressFile(const std::string& strFilePath)
{
// 1. 获取源文件中每个字符出现的次数
FILE* ... | ALGO | 0.988339 | 3.954052 | {
"github_metadata": {
"branch": "2019_8_10",
"commit_count": 71,
"repo_created_at": "2019-08-14T13:28:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c06762... |
3505fc57-77e3-43f6-887e-3223dc1225e3 | nowek7/competitive-programming-solutions | LeetCode/easy/1582_special_positions_in_a_binary_matrix.cpp | #include <cassert>
#include <vector>
int numSpecial(std::vector<std::vector<int>>& mat)
{
const int numRows = mat.size();
const int numCols = mat[0].size();
std::vector<int> rows(numRows);
std::vector<int> cols(numCols);
for (int i = 0; i < numRows; ++i) {
for (int j = 0; j < numCols; ++j) {
rows[... | ALGO | 0.999772 | 6.211506 | {
"github_metadata": {
"branch": "main",
"commit_count": 76,
"repo_created_at": "2023-09-10T09:58: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": "c2bdfec5af7... |
be19eefe-9809-4bd0-8e8e-ebeec7ce30ab | DungxLas/Robot_Tim_Duong | Robot_Tim_Duong/map_2Direction.cpp | //
// main.cpp
// Robot_Tim_Duong
//
// Created by <NAME> on 13/09/2022.
//
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
struct map
{
int numRow, numCol;
int **location;
int targetY, targetX;
};
struct bot
{
int locationY, locationX;
bot *lef... | ALGO | 0.999833 | 3.898269 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-09-13T15:14: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": "9ecf02a0219... |
6fd34e3f-1fe6-4d53-809b-b70dd450e4c4 | AVBelyy/CG-ITMO-HW | triangulation/triangulation.cpp | #include <cstdint>
#include <cstdio>
#include <vector>
using namespace std;
int n;
// point
struct point {
int x;
int y;
int line;
point() : x(0), y(0), line(-1) {}
point(int x, int y, int line) : x(x), y(y), line(line) {}
};
struct triangle {
int a;
int b;
int c;
triangle(... | ALGO | 0.999987 | 4.436574 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2016-01-18T03:29:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe4d08d177... |
5b8b1988-c891-4bed-ae57-5d3b63589e38 | PX4/PX4-Autopilot | src/modules/mc_att_control/mc_att_control_main.cpp | /****************************************************************************
*
* Copyright (c) 2013-2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Red... | TOOL | 0.960157 | 6.147412 | {
"github_metadata": {
"branch": "main",
"commit_count": 47555,
"repo_created_at": "2012-08-04T21:19:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9767,
"forks": 14212,
"issues": 1547,
"pull_requests": 574
},
"file_meta": {
"content_id"... |
b54c86de-dcf2-4d46-b45c-5ea6624f9757 | Mohamed-Khairy-SWE/DSA-in-cpp | Data_Structures/Linear-Data-Structures/Arrays/Circular_array.cpp | /*
An array is called circular if we consider the first element
as next of the last element.
Circular arrays are used to implement queue.
*/
/*
An example problem:
Suppose n people are sitting at a circular table with names
A,B,C,D,...
Given a name, we need to print all n people (in order... | ALGO | 0.99998 | 6.415089 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2024-12-22T01:42:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "333200e3d41... |
abffb6ca-82fe-4a35-a913-bb86adf77bbd | Jayantkhandebharad/cp | zold/A2OJ/A_The_Child_and_Homework.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int i, j, k;
int n, m, cnt = 0, idx;
n = 4;
int len[n];
string s;
for (i = 0; i < n; i++)
cin >> s, len[i] = s.length() - 2;
for (i = 0; i < n; i++)
{
k = 0;
m = 0;
for (j = 0; j < n; j++)
... | ALGO | 0.999935 | 3.022981 | {
"github_metadata": {
"branch": "main",
"commit_count": 434,
"repo_created_at": "2021-09-25T08:00:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "115753292d... |
da18763e-e081-43df-b9b2-63c16069901d | Yukiiceeee/Algorithm-practice-library | acwing/【3】搜索与图论/spfa求最短路_Ⅱ.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pp;
const int N = 150010;
// 分析Dijkstra算法,最耗费时间的操作在查找所有点到起点距离最小的那个点的操作上
// 这个操作可以用小根堆优化,每次从堆顶直接拿到距离最小的那个点即可
// 更新dis时,也就相当于修改堆中的值,每次修改都需要logn
// 因此用一个小根堆数据结构(也就是STL库里的优先队列)来存dis
// 利用dijkstra... | ALGO | 0.999816 | 3.751522 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2025-03-08T15:25:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "754f677b050... |
5242a328-04a1-49b2-be9b-b1031424a26e | KatsuyaKikuchi/ProgrammingContest | AtCoder/AtCoder Beginner Contest/ABC109/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
ll A[505][505];
struct Data {
pll a;
pll ... | ALGO | 0.999917 | 3.074798 | {
"github_metadata": {
"branch": "master",
"commit_count": 87,
"repo_created_at": "2020-12-04T21:42: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": "f9dfbd7e4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.