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 |
|---|---|---|---|---|---|---|---|
e042f9ba-99f7-4247-bfb0-5607050e10c1 | kmykoh97/My-Leetcode | solutions/reverse_only_letters.cpp | // Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions.
// Example 1:
// Input: "ab-cd"
// Output: "dc-ba"
// Example 2:
// Input: "a-bC-dEf-ghIj"
// Output: "j-Ih-gfE-dCba"
// Example 3:
// Input: "Test1ng-Leet... | ALGO | 0.9997 | 5.686821 | {
"github_metadata": {
"branch": "master",
"commit_count": 81,
"repo_created_at": "2020-05-11T12:10: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": "27638f149... |
e36cb768-edb6-4814-b280-76be836a7680 | wineone/c-algoritmos | c-algoritmos/aulas/knn.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cmath>
using namespace std;
class Individuo{
public:
double a,b,c,d;
string classe;
Individuo(double a, double b, double c, double d, string classe){
this->a = a;
this->b = b;
this->c = c;
this->d = d;
thi... | ALGO | 0.998915 | 4.039286 | {
"github_metadata": {
"branch": "master",
"commit_count": 59,
"repo_created_at": "2018-04-29T17:31:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a9b1e1d53... |
0000da28-69e0-4879-91ec-29a1d5b4c7a7 | wakanapo/cracking_the_coding_interview | cpp/chapter3/3_2.cpp | /*
* stack.cpp
*
* Author: <NAME> <<EMAIL>>
* URL: http://wknp16.tumblr.com
* License: 2-Clause BSD License
* Created: 2017-03-09
*
*
* Copyright (c) 2017, <NAME>
* All rights reserved.
*
* Redistribution and use in source and bina... | ALGO | 0.992155 | 5.03866 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2017-03-01T05:06: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": "322352006... |
71151298-d2b3-4e8c-9495-244912f34762 | sadeeabdullah/CSE_fundamental_X_c-_programming | Module 3/Practice Problem/N_Shift_Zeros.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
// we will check which index element is not 0 when we get the index
int insertPos = 0; // we assume that the first insert position of the non zer... | ALGO | 0.999982 | 3.963516 | {
"github_metadata": {
"branch": "main",
"commit_count": 71,
"repo_created_at": "2025-05-25T08:59:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e9cc6bd5c1... |
7ee1226d-2955-4c83-943e-9c763f45af71 | QianMo/GPU-Gems-Book-Source-Code | GPU-Gems-3-CD-Content/content/12/demo/gpuocclusion_standalone/gpuscattering/DiscTree.cpp | /*! \file DiscTree.cpp
* \author <NAME>
* \brief Implementation of DiscTree class.
*/
#include "DiscTree.h"
#include <limits>
#include <algorithm>
#include <assert.h>
struct AxisSort
{
unsigned int axis;
inline bool operator()(const unsigned int &lhs,
const unsigned int &rhs) const
... | ALGO | 0.997336 | 6.426652 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2018-04-21T15:43:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1080,
"forks": 449,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "f41c... |
1b402773-b3c1-499b-8c3e-7b10167cba45 | mayank7jha1/ISA_22A | Lecture 32/Sleeping_Schedule.cpp | #include<bits/stdc++.h>
using namespace std;
// const int N = 0;
#define int long long
int n, l, h, r;
int a[2001];
int dp[2001][2001];
int Sleeping_Schedule(int i, int walking_hour) {
if (i == n) {
return 0;//Because i is 0 based and when you reach i==n that means
//you must have already calculted the no of goo... | ALGO | 0.999898 | 3.876954 | {
"github_metadata": {
"branch": "main",
"commit_count": 44,
"repo_created_at": "2022-08-23T12:12:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4f0afe2ed7c... |
f16ed173-f608-483c-8000-8c0399a2e56d | TankNee/Pat_Solutions | nowcoder/examination/1013.cpp | //
// Created by tanknee on 2021/1/30.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
bool is_prime(int num) {
if (num <= 1) return false;
if (num == 2) return true;
int sqr = sqrt(num), i = 2;
while (i <= sqr) {
if (num % i == 0) return fa... | ALGO | 0.999939 | 4.06104 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2021-01-23T04:48:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 10,
"pull_requests": 0
},
"file_meta": {
"content_id": "789b7e1f... |
25401bf7-9135-4349-ad3c-7ef72ede5342 | sugyan/aoj | volume-06/0621/0621.cc | #include <iostream>
#include <utility>
#include <queue>
using namespace std;
const int MAX_SIZE = 1000;
typedef pair<int, int> P;
typedef pair<int, P> Q;
int calc(int f[][MAX_SIZE], queue<Q> q, int H, int W) {
P d[] = {P(-1, -1), P(-1, 0), P(-1, 1), P(0, -1), P(0, 1), P(1, -1), P(1, 0), P(1, 1)};
int n = 0;
whi... | ALGO | 0.999901 | 4.212751 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2015-12-13T11:04:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cef56d122... |
c1386b81-8592-48f7-a77d-f631c7e7d3ce | schlechter-afk/competitive-programming | trees/github_push/tree_painting.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pa;
typedef vector<pa> vp;
#define pb push_back
#define sz(a) (int)(a.size())
#define endl "\n"
#define speed \
ios_base::sync_with_stdio(false); \
... | ALGO | 0.999762 | 4.287836 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-05-16T07:57: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": "04444d37c78b... |
c637a6ae-29e0-49fb-bc2b-22d669399d1c | kean0212/learning | palindromePartition.cpp | #include <vector>
#include <string>
#include <iostream>
using namespace std;
//class Solution {
// bool isPalindrome(string s) {
// int left, right, n = s.length();
// if (n == 1) return true;
// left = n / 2 - 1;
// if (n % 2) right = left + 2;
// else right = left + 1;
... | ALGO | 0.999984 | 6.263351 | {
"github_metadata": {
"branch": "master",
"commit_count": 174,
"repo_created_at": "2015-10-09T20:52:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f18f197... |
02ce37cd-4d0d-486c-9970-7bf16e33c81f | ProgramCaiCai/THU_DS_Code | CST/2_5_Penetration.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
typedef long long LL;
const int N=100010;
int w[N];
struct Node{
Node *l,*r;
LL sum;
int num;
void fix(){
sum=num=0;
if(l) sum+=l->sum,num+=l->num;
if(r) sum+=r->sum,num+=r->num;
}
};
Node pool[N*150];
Node ... | ALGO | 0.999954 | 3.801998 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2014-10-10T04:36: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": "f0c0b8f90c... |
fc66465f-ce08-4460-9175-15bed1b73bc9 | ishandutta2007/codeforces-w | wangzhikun/normal/1191/B.cpp | //determined
#include <cmath>
#include <cstdio>
#include <cstring>
#include <complex>
#include <cassert>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define debug(x) cerr<<#x<<'='<<x<<endl
using namespace std;
typedef long long ll;
template<typename T> void read(T &x){
x = 0;char ch ... | ALGO | 0.999686 | 3.119576 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:34: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": "486b9b2dded8... |
de705fba-7663-4a96-a0a2-48c0a29ff090 | JokubasKul/Strukt-rinis-programavimas | Jokubas_Kulbokas_PI24_K2_Programa2/main.cpp | //2. Sukurti sarasa, realizuojant duomenu ivedima, iterpima pries ir po nurodyto elemento,
//norimo elemento pasalinima bei didziausio elemento radima. Realizuoti funkcijas, kurios:
//a. Pirmus 8 neigiamus skaicius perkelia i vienkrypti ciklini sarasa.
//b. Apskaiciuoja kiek cikliniame sarase esanciu elementu suma paga... | ALGO | 0.997451 | 3.674343 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2024-09-05T11:31: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": "ff52018bbdb... |
f5a4f697-50a9-4f54-af20-40e3121a689e | saketrule/hackerrank_top_solutions_dataset | kruskalmstrsub/cpp/Shadowfirex.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <cstdio>
#include <string.h>
#include <string>
#include <map>
#include <math.h>
#include <sstream>
#include <queue>
#include <set>
#include <stack>
#include <cmath>
#include <algorithm>
#include <list>
#include <deque>
#include <utility>
#define mp make... | ALGO | 0.999853 | 3.65714 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-03-12T09:26: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": "39eaf13b60... |
26461e37-ec61-4d16-b01c-fe1b9e2f13ee | MD-MAFUJUL-HASAN/CodeForces_Problem_Solving | 1 - 100/6/6D - Lizards and Basements 2/6D - Lizards and Basements 2.cpp | #include <algorithm>
#include <iostream>
#include <unordered_map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <math.h>
#include <fstream>
using namespace std;
#define LL long long
//#define LOCAL
void solve(int h[], int n, const int dep, int a, int b, vector<int>... | ALGO | 0.999982 | 3.292781 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-04-28T17:37: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": "e286692bd16c... |
0ac19243-a94d-4821-8f68-4f38f8031947 | lokeshs333/Sliding_window | sw3.cpp | #include <bits/stdc++.h>
using namespace std;
bool is_possible(string possible, unordered_map<char, int> &mpp)
{
unordered_map<char, int> mppp;
for (int i = 0; i < possible.size(); i++)
{
mppp[possible[i]]++;
}
return mpp == mppp;
}
int sliding_window(string &text, unordered_map<char, int>... | ALGO | 0.999995 | 4.743654 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2023-07-27T09: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": "a5969a54e9ab... |
2884ae4b-4ffd-4245-9ea9-4e5cd8dcc821 | neolight1010/coursera-algo-data-structures | algorithmic-toolbox/week2_algorithmic_warmup/6_last_digit_of_the_sum_of_fibonacci_numbers/fibonacci_sum_last_digit.cpp | #include <iostream>
#include <cassert>
int fibonacci_sum_naive(long long n) {
if (n <= 1)
return n;
long long previous = 0;
long long current = 1;
long long sum = 1;
for (long long i = 0; i < n - 1; ++i) {
long long tmp_previous = previous;
previous = current;
... | ALGO | 0.998938 | 4.373279 | {
"github_metadata": {
"branch": "main",
"commit_count": 79,
"repo_created_at": "2021-04-01T18:01: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": "a047cf8ef7b... |
71c01532-3f7e-458d-9ddf-16f1eb1b39c7 | msisdev/KNU | 20212 Algorithm2/hw6_bellman_ford.cpp | /*
INPUT:
(vertices) (edges)
(u) (v) (w)
...
*/
#include <iostream>
#include <fstream>
#include <limits.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INF INT_MAX
#define NIL -1
using namespace std;
struct _node {
int v;
int w;
struct _node* next;
};
struct _node_head {
struct _node* f... | ALGO | 0.999992 | 4.084075 | {
"github_metadata": {
"branch": "main",
"commit_count": 88,
"repo_created_at": "2022-04-05T10:27: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": "0dfe9df8aaa... |
09b73844-b16b-4b2f-9ef3-37a92b7fe2b5 | ishandutta2007/codeforces-s | scott_wu/normal/623/D.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
const int MAXN = 101;
int N;
int rval[MAXN];
double cprob[MAXN];
priority_queue <pair <double, int> > pq;
int ma... | ALGO | 0.999119 | 3.781347 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07: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": "f6fec23416ab... |
b6de66e9-c138-4f51-b3e7-5d189628294e | jonatas57/maratona | cf/gym/102021/b/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef pair<int, int> ii;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3... | ALGO | 0.999853 | 3.776041 | {
"github_metadata": {
"branch": "master",
"commit_count": 225,
"repo_created_at": "2019-02-13T13:09:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9c22e34... |
64a375b9-e9c5-4a2b-8f14-1f20fd8350c0 | tommasopeduzzi/soi-2020 | camp-2021/convexhull.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include <math.h>
#include <iostream>
#define rep(x) for(int i = 0; i <x; i++)
using namespace std;
struct point{
int x;
int y;
};
int n;
point origin;
long long crossproduct(point a, point b){
return a.x * b.y - a... | ALGO | 0.999996 | 4.507817 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2020-12-01T08: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": "5d9a8e7e5... |
1b696693-09ee-4583-b17a-9e95a6aa9c97 | Superm4n97/competetive-programming | Classical/String/Z.cpp | #include<bits/stdc++.h>
#define ll long long int
#define show(x) cout << #x << " : " << x << endl
using namespace std;
void Z_function(string s , ll Z[])
{
//takes a string s & saves z value in Z[]
//aba$ababaaaabbc Z[] = 001030301112000
ll N = s.size();
Z[0] = 0;
for (int i=1, L = 0 , ... | ALGO | 0.995117 | 3.175673 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-12-16T18:34: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": "c7a2e21a3f... |
c035fd8b-6b85-4855-8746-01a267729f5b | 1846585870/c-language | 迷宫算法(非递归).cpp | #include <iostream>
#define maxsize 10
using namespace std;
//data type
typedef struct PosType
{
int i;
int j;
}PosType;
typedef struct SElemType
{
int num;
PosType a;
int direction;
}SElemType;
typedef struct StackNode
{
SElemType data;
struct StackNode *next;
}StackNode,*LinkStack;
//data type
PosType start... | ALGO | 0.999938 | 3.258221 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2017-12-12T02:26: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": "f0c4d911f... |
73536a02-4f0f-4daa-a062-38634640403c | Artivaa/Bisection-Method | Main.cpp | #include <iostream>
#include <cmath>
#include <chrono>
#include <locale>
using namespace std;
double function(double x)
{
return x - 1.0 / (3 + sin(3.6 * x));
}
int main()
{
setlocale(LC_ALL, "Rus");
double a = 0.0;
double b = 0.85;
double epsilon = 0.00001;
double x;
int iteration = 0;... | ALGO | 0.999977 | 4.845732 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2024-12-16T21:14: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": "0be48b2c20... |
5824d04f-002e-41c9-9cc4-f935fbf0f9bd | Unstopable18/Breadth-first-search-algorithm-in-C-. | breadthfirstsearch.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<bool> v;
vector<vector<int>> g;
void beadthfirst(int b)
{
queue<int> q;
q.push(b);
v[b] = true;
cout<<"*******************************************\n";
cout<<"\t-:The BFS Traversal is:-\n";
while (!q.empty())
{
i... | ALGO | 0.999853 | 4.790328 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-03-17T12:15:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f28cf92236be... |
1d6f5343-cca6-4f51-bd45-6a5892369b93 | qwaker00/Olymp | CodeChef/November Challenge 2014/Sereja and Permutations/hax.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <functional>
#include <numeric>
#include <sstream>
#include ... | ALGO | 0.999937 | 3.778197 | {
"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": "5aa836395... |
1d0445bd-e0c8-4492-ad58-d247de162c80 | kyledavelaar/C-Plus-Plus-Fundamentals | quiz/3.cpp | #include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <random>
enum class CardSuit {
club,
diamond,
heart,
spade,
max_suits
};
enum class CardRank {
rank_2,
rank_3,
rank_4,
rank_5,
rank_6,
rank_7,
rank_8,
rank_9,
rank_10,
rank... | TOOL | 0.923591 | 4.856814 | {
"github_metadata": {
"branch": "main",
"commit_count": 29,
"repo_created_at": "2022-04-26T15:19:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f32ae9541a... |
b7ce1ef4-9d1b-4a3e-8205-2a965e653a14 | thobl/external-validity | code/src/stats/avg_dist.cpp | #include "stats/avg_dist.hpp"
#include <iostream>
#include <numeric>
#include <utility>
#include <algorithm>
#include "bfs/bfs.hpp"
#include "bfs/bfs_bi_balanced.hpp"
#include "framework/graph.hpp"
#include "framework/random.hpp"
std::vector<std::pair<node, double>> sample_nodes(const Graph& G, double k,
... | ALGO | 0.999503 | 6.089054 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2022-05-27T09:05:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e37122e6ab8... |
462ffde9-94f5-44a1-af11-8e88e002d72d | wiizii/Algorithm_solution | 14003.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;
struct Trace {
int pos, val;
};
int n;
int arr[1000001];
int lis[1000001];
Trace trace[1000001];
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
lis[0] = arr[0];
trace[0].pos = 0;
trace[0].val ... | ALGO | 0.999999 | 4.00278 | {
"github_metadata": {
"branch": "master",
"commit_count": 555,
"repo_created_at": "2020-05-11T06:56: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": "77016db4... |
e2dc968b-2025-4934-b2b5-43ea4e569aee | AlgebroHeavyGuns/Programming | Basics/27_SemiPiramide.cpp | /*
(C)Algebro.
Dado un entero para la longitud base,
'dibujar' media piramide.
por ejemplo, para longitud 3:
1
12
123
*/
#include <iostream>
using namespace std;
int main(){
int longitud;
cout << "Longitud base : ";
cin >> longitud;
for(int i=1;i<=longitud;i++){
for(int j=1;j<=i; j++){ //Hay qu... | ALGO | 0.999891 | 4.546441 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2018-07-09T08:22: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": "74f503ff3... |
81e968f9-c89b-401c-b72f-0623914a3b5e | whoyouknowswho/Template | Balance_Binary_Search_Tree.cpp | struct Node {
Node *left, *right;
ll weight, size;
ll val, sum, minx;
bool check;
Node(ll x) {
left = 0LL;
right = 0LL;
check = 0LL;
weight = rand();
val = x;
minx = x;
sum = x;
size = 1LL;
}
void pull() {
minx = val;
sum = val;
size = 1LL;
if (left) {
minimize(minx, left->minx);
s... | ALGO | 0.999938 | 4.195108 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2022-12-04T11:11: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": "965f169904f... |
2ad945ce-07a7-498e-bfb6-a23a1b364263 | idarose/FYS3150 | project_1/prob_10.cpp | #include <time.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <string>
#include <fstream>
#include <algorithm>
int main ()
{
std::ofstream ofile;
ofile.open("time_algorithms.csv");
int time_steps = 20;
int power = 6;
//generate x_vector and the vectors to ... | ALGO | 0.998427 | 4.753984 | {
"github_metadata": {
"branch": "main",
"commit_count": 194,
"repo_created_at": "2022-08-04T10:53:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aff45b90ed... |
7cf39ba5-407c-402b-ac29-22096c940063 | rakesh-chinta/Big4_Interview_Preparation | tree_problems/levelOrderTraversalRecursive.cpp | /*
* Level order BST traveral iterative
*/
#include <iostream>
struct Node
{
int data;
Node *left;
Node *right;
};
Node* newNode( int data )
{
Node *temp = new Node;
temp->data = data;
temp->left = temp->right = nullptr;
return temp;
}
void insert( Node* & node, int data)
{
if ( ... | ALGO | 0.999963 | 5.006783 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-06-25T18:07:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "724ffa3505... |
8f9890e8-dd40-46f2-93b9-ca967620499c | nmwsharp/geometry-central | include/geometrycentral/surface/stripe_patterns.h | #pragma once
#include "geometrycentral/surface/embedded_geometry_interface.h"
#include "geometrycentral/surface/intrinsic_geometry_interface.h"
#include <vector>
namespace geometrycentral {
namespace surface {
// Implementation of "Stripe Patterns on Surfaces" [Knoppel et al. 2015]
// Based on <NAME>'s original impl... | ALGO | 0.980153 | 6.959599 | {
"github_metadata": {
"branch": "master",
"commit_count": 536,
"repo_created_at": "2017-11-20T15:40:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1217,
"forks": 166,
"issues": 77,
"pull_requests": 16
},
"file_meta": {
"content_id": "c... |
a1906dcd-5b54-4372-89bd-9dced32fe698 | mruxim/codeforces | 772/CF772B.cpp | // .... .... .....!
// ...... ......!
// .... ....... ..... ..!
// ...... ... ... .... ... .... .....!
// ... .. ... .... ...?
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; i++)
#define fer(i, x, n) for (int i = (int)(x), _n = (int)(n); i < _n; i++)
#define rof(... | ALGO | 0.999972 | 4.111413 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-04-10T12:10:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "211e049dc7... |
164be723-b6ad-4a96-928e-6f4f1361388c | duckdb/duckdb | src/include/duckdb/common/sort/sort.hpp | //===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb/common/sort/sort.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb/common/sort/sorted_block.hpp"
#include "duckdb/commo... | ALGO | 0.995928 | 5.203129 | {
"github_metadata": {
"branch": "main",
"commit_count": 59407,
"repo_created_at": "2018-06-26T15:04:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 31074,
"forks": 2450,
"issues": 412,
"pull_requests": 112
},
"file_meta": {
"content_id":... |
20550a36-4d43-47b3-82e6-d929edb2e620 | Wandyez/Wayne-State-University---CSC-2110 | Assignment/CSC2110_gq5426_Assingment4_QuickSorter.cpp | /******************************************************************************
Write a program in C++ to sort the array using quick sort technique and print
out the sorted result:
Array = 45, 78, 12, 11 , 33, 7, 19, 2, 13
*******************************************************************************/
#include <ios... | ALGO | 0.999991 | 5.977047 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-08-16T21:13: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": "84c6eb7ca629... |
54616aec-0e1f-4189-92e1-e5d9ccadb40a | agentmishra/DSA | CodeChef/ZCO15004.cpp | #include <bits/stdc++.h>
#define ll long long
#define newline "\n";
#define loop(from,to) for(int i=from;i<to;i++)
#define OJ \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
using namespace std;
int main()
{
// fix points'y as height since base is x, then find left and right limit... | ALGO | 0.999907 | 4.053188 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2023-01-12T17:08: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": "0c66c64b0... |
d2b9519e-082d-4da1-8a72-8ca092473ac2 | rjehangir/simple-rov | src/Control.cpp | #include "Control.h"
#include "APM.h"
namespace {
float controlRoll, controlPitch, controlYaw;
float controlForward, controlStrafe, controlVertical;
}
namespace Control {
int16_t thruster[6];
void calculate() {
controlRoll = Data::in.pilotRoll;
controlPitch = Data::in.pilotPitch;
controlYaw = ... | TOOL | 0.911942 | 5.18907 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2014-07-20T15:36: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": "daef71dda... |
92a69b45-27ea-4640-98d3-023111fb96cc | ishandutta2007/codeforces-k | krk/normal/1152/F1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn = 100005;
const int Maxk = 13;
const int Maxm = 1 << 4;
const int mod = 1000000007;
int bits[Maxm];
int n, k, m;
int dp[Maxn][Maxk][Maxm];
int res;
int main()
{
scanf("%d %d %d", &n, &k, &m);
for (int i = 1; i < 1 << m; i++)
... | ALGO | 0.999979 | 3.906524 | {
"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": "8f26a036e115... |
5bc87bb8-789a-4e4b-a716-ce7faf28f4a6 | Misfittech/nano_stepper | firmware/stepper_nano_zero/calibration.h | /**********************************************************************
Copyright (C) 2018 MisfitTech LLC, All rights reserved.
MisfitTech uses a dual license model that allows the software to be used under
a standard GPL open source license, or a commercial license. The standard GPL
license requires that all... | TOOL | 0.910348 | 4.346086 | {
"github_metadata": {
"branch": "master",
"commit_count": 104,
"repo_created_at": "2016-08-07T18:43:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 438,
"forks": 178,
"issues": 14,
"pull_requests": 2
},
"file_meta": {
"content_id": "a35... |
170f5540-545e-491c-a7d5-29f8d216b8ed | rushil180101/dsa-course-1-learning | Binary_Search_Tree/bst1.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
class BSTNode
{
public:
T data;
BSTNode *left;
BSTNode *right;
BSTNode(T data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
// Recusrive destructor
~BSTNode()
{
delete... | ALGO | 0.999817 | 4.679159 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2024-03-30T15:53: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": "f065b54efa4... |
a7b8dc96-f93d-40a1-ad3c-abf462503700 | haosen-yao/weird | path_image.cc | #include "path_image.hpp"
#include <iostream>
int Min(int a, int b, int c, int d) {
int tempone = 0;
if (b >= a) {
tempone = b - a;
} else {
tempone = a - b;
}
int temptwo = 0;
if (c >= a) {
temptwo = c - a;
} else {
temptwo = a - c;
}
int tempthree = ... | ALGO | 0.985364 | 5.264227 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-02-06T06:40: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": "fde78509f751... |
c1e55e28-559b-4ec9-b3b5-a90643904b66 | Ciphrox/Hacktoberfest2021 | C++ & C/fast_fib.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
//driver code
int main(){
ll n ;
cout << "Enter no of terms : " ;
cin >> n ;
//using DP (storing previously calculated terms in array) to achieve a fast fibonacci series
ll dp[n+1];
//F0 = 0
/... | ALGO | 0.999937 | 4.090837 | {
"github_metadata": {
"branch": "main",
"commit_count": 708,
"repo_created_at": "2021-10-03T19:18:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 42,
"forks": 213,
"issues": 2,
"pull_requests": 16
},
"file_meta": {
"content_id": "305e8e... |
1ad20a10-c46c-4025-841b-746d67c2e0c9 | pedroaugsf/Sistema-Biblioteca | main.c++ | #include <iostream>
#include <vector>
using namespace std;
class Livro{
public:
string titulo;
string autor;
bool disponivel;
Livro(const string& titulo, const string& autor) : titulo(titulo), autor(autor), disponivel(true) {}
};
class SistemaBiblioteca{
private:
vector<Livro> livros;
public:
void adi... | TOOL | 0.964304 | 6.124813 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-07-19T01:50: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": "240d760a0673... |
422b933b-af36-420f-9ae4-4c1dbfcc19be | milosevic81/matrix-mul | cpp/rmatrix.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <cmath>
// #include </opt/homebrew/opt/libomp/include/omp.h>
using namespace std;
typedef vector<int> Vec;
typedef vector<Vec> Mat;
Mat init(int n) {
Mat m = Mat(n, Vec(n, 0));
for (int i=0;i<n;i++) {
for (int j=0; j<n;j++) {
... | ALGO | 0.999029 | 5.001205 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-10-20T10:59: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": "f7a9af0dbea1... |
632b8ab7-8829-40c3-b380-90da880273cb | dzro0923/BOJ_Practice | baekJoon_1260.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n, m; // 각각 vertex의 개수와 edge의 개수
int s, e; // 각각 시작 정점과 끝 정점 ==> 간선 잇는 곳에 사용된다.
int v; // 탐색 시작하는 정점
vector<vector<int>> adjArray; // vector - vector를 선언
vector<int> visited; // DFS
vector<int> visited2; // BFS
que... | ALGO | 0.999975 | 4.369534 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-09-18T15:01: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": "e4cd5c49871... |
76138127-bee8-45ab-9148-0fa955374f13 | xanthospap/doris | src/atmosphere/exponential_atmospheric_model.cpp | #include "atmosphere.hpp"
#include <cassert>
#include <cmath>
#ifdef DEBUG
#include <cstdio>
#endif
struct AtmLayer {
int limit_low; // [km]
int limit_high; // [km]
int base_altitude; // [km]
double nominal_density; // [kg/m3]
double scale_height; // [km]
};
const AtmLayer AtmTable[... | ALGO | 0.980073 | 5.57263 | {
"github_metadata": {
"branch": "main",
"commit_count": 372,
"repo_created_at": "2021-05-17T14:59:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8e57745531... |
a782a666-8ecc-4bc1-b240-ef8e8db7bcfe | peeradonthien/Algorithm-Design | shortestpathingrid.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main(){
int r,c;
cin >> r >> c;
vector<vector<int>> v(r,vector<int>(c));
string x;
for(int i =0;i<r;i++){
cin >> x;
for(int j = 0 ; j < c;j++){
if(x[j] == '.') v[i][j] = 0;
if(x[j]... | ALGO | 0.999888 | 4.507815 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2025-01-26T11: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": "db534e31aa1... |
0e38328d-fa02-4bd6-bf30-538c9a85e0c5 | raunak-dev-edu/My-CP-Notes | LoveBabbar_dsa/DP/questions/partition_equal_subset_sum.cpp | // https://practice.geeksforgeeks.org/problems/subset-sum-problem2014/1
/*
-> Partition eqaul subset sum -Given an array arr[] of size N, check if it can be partitioned into two parts such that the sum of elements in both parts is the same.
// using recurssion
bool solve(int index, int arr[],int N, int target){
//... | ALGO | 0.999513 | 4.805171 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2022-10-06T14:32:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "36831766d5b... |
8a65f1da-1652-4dd7-a512-25153a6acc54 | Viktordvlpr/unik | 5_5/5_5/Source.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double recursive_sequence(int n, int level, int& depth) {
if (level > depth) {
depth = level;
}
cout << "level = " << level << endl;
if (n == 1) {
return 1.0;
}
else {
double prev = recursive... | ALGO | 0.999985 | 4.964382 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2024-09-25T21:18:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d95e8c656... |
cd37ac42-78a0-43e7-bebf-8bd036ae16c5 | alptv/algorithms | lab10/d.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <deque>
#include <queue>
#include <cassert>
#include <iomanip>
#include <fstream>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long ll;
typedef unsigned long long ull;
typ... | ALGO | 0.99979 | 3.366022 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-06-14T16:47: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": "4e6d83f34d... |
9c65c421-d92e-4180-9559-1ece7192dce9 | gouldmatt/MapReduce | primeNumber/guestPrimeNumber.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include "guestPrimeNumber.hpp"
using namespace std;
vector<string> inputReader(ifstream& file){
vector<string> inputReaderVec;
string number;
while (file >> number){
inputReaderVec.push_back(number);
}
return i... | ALGO | 0.998188 | 4.05943 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2018-10-12T03:41: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": "a61812daf... |
6a8d34bd-8e89-47cc-a24d-72618cd977bf | Higgsboson-X/vg101-2019su | rc/rc8/code/ex/array.cpp | #include <iostream>
#include <cstring>
#include "array.h"
using namespace std;
// utils;
// ================================================================== //
int binary_search(int* seq, int left, int right, int elt) {
// search the position to insert the element;
if (left == right) {
return seq[right] <= elt... | ALGO | 0.99705 | 4.530396 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2019-05-19T01:49: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": "650bb4c4d... |
e01845fc-307c-458e-a540-08dd2496e847 | S-S-Karthika/C-ProblemSolving | BinarySearch/upperbound.cpp | #include <iostream>
#include <vector>
using namespace std;
int upperbound(vector<int>& arr, int num) {
int low = 0, high = arr.size();
while (low < high) {
int mid = low + (high - low) / 2;
if (arr[mid] >num) {
high = mid;
} else {
low = mid+1 ;
}
... | ALGO | 0.999868 | 5.162837 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2025-01-22T12:34: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": "a0f4522b76... |
82230905-1b1d-472c-8beb-5a3d7823fdcc | spark0308/DS_ALGO_Codes | striver sheet/graphs/courseSchedule.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> isPossible(int N, int P, vector<vector<int>> &prerequisites)
{
vector<int> adj[N];
for(auto it: prerequisites)
{
adj[it[1]].push_back(it[0]);
}
int indegree[N] = {0};
for(int i=0; i<N; i++){
for(auto it: adj[i]){
... | ALGO | 0.999956 | 4.714231 | {
"github_metadata": {
"branch": "main",
"commit_count": 94,
"repo_created_at": "2023-03-31T19:57:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e20df3ca509... |
ff79b280-6400-4a2e-8f94-a35fbf9588ba | ccd97/cp_solutions | codeforces/0-976/DIV2-C/231C.cpp | #include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long cs[100005];
long long mx[100005];
int getFloor(int i, int l, int r, long k){
long long val;
int m, idx = -1;
while(l <= r){
m = l + (r-l)/2;
val = mx[m+1]*(m-i+1) - (cs[m+1] - cs[i]);
if(k < val) r = m - ... | ALGO | 0.999986 | 4.678734 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2018-04-24T09:38:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b987ed84e... |
3d36cbc7-69c7-46f7-b171-8c3321097d6e | ishandutta2007/codeforces-y | yeputons/normal/178/C2.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
typedef ... | ALGO | 0.999878 | 3.849387 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:40:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b1021b7a1f23... |
19c220f0-e322-4d53-a8ca-ad06129b0155 | liuchuo/PAT | AdvancedLevel_C++/1141. PAT Ranking of Institutions (25) .cpp | #include <iostream>
#include <algorithm>
#include <cctype>
#include <vector>
#include <unordered_map>
using namespace std;
struct node {
string school;
int tws, ns;
};
bool cmp(node a, node b) {
if (a.tws != b.tws)
return a.tws > b.tws;
else if (a.ns != b.ns)
return a.ns < b.ns;
else... | ALGO | 0.999921 | 3.799406 | {
"github_metadata": {
"branch": "master",
"commit_count": 703,
"repo_created_at": "2016-01-06T05:06:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3399,
"forks": 809,
"issues": 44,
"pull_requests": 9
},
"file_meta": {
"content_id": "fd... |
852cd9ea-f530-4d8c-8cab-5ffff5f8313c | redbird-arch/push-multicast-artifact | push-multicast/benchmarks/rodinia/openmp/hotspot/hotspot.cpp | #include <malloc.h>
#include <omp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#ifdef GEM_FORGE
#include "gem5/m5ops.h"
#endif
// Returns the current system time in microseconds
#define BLOCK_SIZE 16
#define BLOCK_SIZE_C BLOCK_SIZE
#define BLOCK_SIZE_R BLOCK_SIZE
#define STR_SI... | ALGO | 0.999883 | 5.438682 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-12-09T18:33:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7cc493a340db8... |
8b186dca-d144-42aa-ab0f-6140a385ec43 | AliElSaleh/MathMagic | MathMagic/MathUtility.h | #pragma once
#include <chrono>
#include "MathMacros.h"
namespace MathMagic
{
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long ... | TOOL | 0.954706 | 6.42521 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2019-09-29T05:40:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ca8e9e487... |
be8fef3e-4e96-4641-8424-48e64d274159 | catch4/Song | 2020/week13/7575_virus.cpp | /*
Catch study 13주차
백준_7575 바이러스
https://www.acmicpc.net/problem/7575
*/
/*-----------------
풀이
1. 첫번째와 두번째 프로그램에서 바이러스 후보를 모두 생성
2. 나머지 프로그램에서 되는지 확인한다. 단, n=2인 경우 바이러스 후보가 있다면 바로 yes
-----------------*/
#include <iostream>
#include <vector>
#include <algorithm>
#define vecs std::vector<std::vector<int>>
#define pi st... | ALGO | 0.999992 | 4.885862 | {
"github_metadata": {
"branch": "master",
"commit_count": 183,
"repo_created_at": "2020-06-01T10:04:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb15cf2c0... |
75e6a3eb-2f31-4990-b0d4-6bc40e0f46dd | NyvexWu/CS012 | week 5/Lab_5.9/Lab_5.9/main.cpp | //include any standard libraries needed
#include<iostream>
#include<fstream>
using namespace std;
double mean(const double array[], int arraySize);
void remove(double array[], int &arraySize, int index);
void display(const double array[], int arraySize);
const int ARR_CAP = 100;
int main(int argc, char *argv[]) {
... | ALGO | 0.99495 | 5.228968 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2020-10-20T01:29: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": "b068644d12a8... |
7903e480-e0b5-4f50-9c03-6b137d7f3968 | janina280/Dijkstra | Dijkstra-MPI/Dijkstra_MPI/Dijkstra_MPI.cpp | // #include <iostream>
// #include <chrono>
// #include <mpi.h>
// #include <fstream>
//
// #define INFINITE 1000000
//
// MPI_Datatype create_block_column(int, int);
// void share_matrix(int*, int[], int, MPI_Datatype, int, MPI_Comm);
// void dijkstra(int[], int[], int[], int, int, int, int, MPI_Comm);
// void init(co... | ALGO | 0.999868 | 5.220999 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2024-04-21T20:32:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0afe7e478451... |
dc90ac11-bd5f-45d0-8c36-e5d221f2494e | kajal55965/os_project | 1. Task Management Module.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
// Structure for priority queue
struct priorityqueue {
int pid;
int priority;
int arrtime;
int burst;
int burst_copy;
struct priorityqueue *left;
struct priorityqueue *right;
} *q1 = NULL, *q2 = NULL, *q3 = NULL;
// Structure for ... | ALGO | 0.999975 | 4.576439 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-03-23T15:02: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": "08f896b127ed... |
65ad89e0-1628-460d-9699-5f1158df5320 | hs05june/CP | cses/graph/course_schedule_stack.cpp | #include<bits/stdc++.h>
#define rp(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i--)
#define ll long long
#define ld long double
#define deq vector<ll>
#define mii map<ll,ll>
#define pii pair<ll,ll>
#define pb push_back
#define f first
#define s second
#define sz(a) (int)a.size()
#define all(x) (x).b... | ALGO | 0.999974 | 3.929865 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2022-07-20T13:09: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": "2a03f2c1cb3... |
9187a3a9-adfe-4126-85a7-32a06e9f2fe3 | Mityai/contests | cf/361-div2/C.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
ll cub(ll n) {
ll lb = 0, rb = 1;
while (rb * rb * rb <= n) rb *= 2;
while (lb + 1 < rb) {
ll mb = (lb + rb) / 2;
if (mb * mb * mb <= n) lb = mb;
else rb = mb;
}
return lb;
}
ll cnt(ll n) {
... | ALGO | 0.999989 | 3.852218 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2017-02-04T09:44:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5ebabf6720... |
ffefc965-1939-4da2-89e2-dc5b629fcaa2 | jwseph/competitive-programming | alphastar/silver/basic_b/acorn_collection.cpp | #include <bits/stdc++.h>
using namespace std;
int N, K, J = 0, P = 1;
vector<string> W[30];
vector<vector<string>> A;
vector<string> rep(int i) {
vector<string> res;
for (int j = 0, p = P; j < J; ++j) {
p /= W[j].size();
res.push_back(W[j][i/p]);
i %= p;
}
return res;
}
int so... | ALGO | 0.999881 | 3.9829 | {
"github_metadata": {
"branch": "main",
"commit_count": 121,
"repo_created_at": "2023-02-23T23:41:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "421f78e269... |
0116d24c-03e2-428b-afd5-cee5eab79d6a | kiwiwin/topcoder | srm_354_div1_300.cpp | #include <string>
#include <vector>
#include <sstream>
using namespace std;
class Date {
public:
Date(string date) {
int mm, dd;
sscanf(date.c_str(), "%d/%d", &mm, &dd);
m = mm; d = dd;
}
Date(int mm, int dd) : m(mm), d(dd){}
bool canUS() {
if (m > 12) return false;
if (m == 1 || m == 3 || m == 5 || ... | ALGO | 0.99969 | 4.893821 | {
"github_metadata": {
"branch": "master",
"commit_count": 222,
"repo_created_at": "2012-04-28T08:49:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd6b6951... |
86508c94-50f7-4b65-b877-52695778112e | winterspite/AdventOfCode | Day04Problem01.cpp | #include "Advent.h"
const char* filename = "04_input.txt";
std::set<std::string> lines;
// Day 04 Stuff
int activeGuard = 0;
int startSleepMinute = 0;
int stopSleepMinute = 0;
std::map<int,std::vector<int> > SleepMap;
void processNap()
{
// If the key isn't in the map, add it.
if (SleepMap.find(activeGuard) == ... | ALGO | 0.987338 | 5.239507 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2018-12-01T20:23: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": "734b41dbc... |
a539e386-ce37-4f01-8e96-83bb0e0ab2cc | Nirob-Barman/LeetCode | Problems/0110_Balanced_Binary_Tree.cpp | #include <bits/stdc++.h>
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 *right) : val(x), left(left), righ... | ALGO | 0.999773 | 5.865687 | {
"github_metadata": {
"branch": "main",
"commit_count": 206,
"repo_created_at": "2024-02-21T08:50: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": "da02b91807... |
9c4bf055-7e29-443b-bbd5-cb06284041ba | koba-e964/contest | yukicoder/281.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
const int inf = 1.1e9;
int f(int d, int h1, int h2, int h3) {
assert (h1 != h3);
if (h1 < h3) {
swap(h1, h3);
}
if (h3 < 0) { return -1; }
if (h2 > ... | ALGO | 0.999938 | 3.620157 | {
"github_metadata": {
"branch": "master",
"commit_count": 2836,
"repo_created_at": "2013-09-13T04:48:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 25,
"forks": 5,
"issues": 20,
"pull_requests": 0
},
"file_meta": {
"content_id": "ccd0c... |
632a921f-bbbe-470b-abaf-144cad31bbe3 | juangonzalez22/tareas-programacion-2 | Taller de Vectores/Ejercicio8.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
int bigger;
cout << "EJERCICIO 8" << endl;
cout << "Dado un vector de enteros, escribe un programa que encuentre y muestre el valor maximo dentro del vector." << endl;
cout << "Ingresa el numero de elementos que tendra... | ALGO | 0.995679 | 4.293947 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-08-21T22:44: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": "67892884733... |
d949ace2-6e76-48f2-96c6-07873af53973 | paraggoyal28/cp | codeforces/A_Directional_Increase.cpp | #include <bits/stdc++.h>
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define int long long
#define ld long double
#define pb push_back
#define all(v) v.begin(), v.end()
#define back(v) v.rbegin(), v.rend()
#define nl "\n"
#define yes cout ... | ALGO | 0.999902 | 4.676804 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2024-01-07T13:21: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": "a8aee1317... |
5e92fbd2-3f83-4e93-8123-b8a117d6fc62 | kennent/for_scsc_code_save | contest/boj/suapc/l.cpp | #include <iostream>
#include <queue>
#include <math.h>
#include <algorithm>
using namespace std;
priority_queue<int> pq[12];
int cur[12] = {0};
int main() {
int n, k;
cin >> n >> k;
int p, w;
for (int i = 0; i < n; i++) {
cin >> p >> w;
pq[p].push(w);
}
for (int i = 0; i < k; i++) {
for (int... | ALGO | 0.999886 | 3.46472 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-16T23:16:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2db6ba996205... |
41ae37c7-885f-4edb-aa9c-849626b44078 | Pavankumardontha/linked_list | delete_middle_node_of_ll.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999341 | 5.921336 | {
"github_metadata": {
"branch": "main",
"commit_count": 86,
"repo_created_at": "2021-11-26T16:45: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": "9a94d83ee2f... |
7a49a9b3-3cfc-47be-95bf-87fb97446a3e | EduardoAntillon/Progra1F | Abril/Semana 8-14/Miercoles/Tarea-10-de-abril (3).cpp | #include <iostream>
using namespace std;
void Datos();
void Funcion(int num);
int i, num, fact = 1, selector, multiplo;
int main() {
Datos();
Funcion(num);
return 0;
}
void Datos(){
cout<<"Ingrese un numero entero: ";cin>>num;cout<<endl;
cout<<"Elija una funcion a realizar: "<<endl;
cout<<endl;
cout<<"B... | TOOL | 0.994919 | 3.53673 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2024-04-01T15:18:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f44e5f07574... |
c6de442e-6c36-40d0-bbc1-168ee8c780d4 | deepdarshan21/leetcode-solutions | 1416. Restore The Array/Recursion.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Approach:
Edge Cases:
Time Complexity: O() Space: O()
Status: Time Limit Exceeded
Runtime: ms faster than: %
Memory Usage: MB less than: %
Remarks:
*/
class Solution {
public:
int numberOfArrays(string s, int k) {
int n = s.size... | ALGO | 0.999757 | 5.757064 | {
"github_metadata": {
"branch": "main",
"commit_count": 889,
"repo_created_at": "2022-01-07T14:50:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d9de5a6968... |
39adc3fe-1d7a-465b-8251-b66e2c481747 | ItsukiYoshida/Atcoder | atcoder.jp/typical90/typical90_ab/Main.cpp | using namespace std;
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define yes cout << "Yes\n";
#define no cout << "No\n";
template <typename T>
using vc = vector<T>;
template <typename T>
using pQ = priority_queue<T, vc<T>, greater<T>>;
template <typename T>
us... | ALGO | 0.999933 | 3.876627 | {
"github_metadata": {
"branch": "main",
"commit_count": 921,
"repo_created_at": "2022-09-01T00:49: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": "e40ed710e0... |
2b02eb46-34c7-4a89-8e12-683816bd2653 | ShahjalalShohag/ProblemSolving | codeforces/466/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 2020, mod = 1e9 + 7;
int a[N], n, h, dp[N][N];
int yo(int i, int open) {
if (i == n + 1) return open == 0;
int &ret = dp[i][open];
if (ret != -1) return ret;
long long ans = 0;
if (open == a[i]) {
ans += 1LL * open * yo(i + 1, open - 1);
ans += yo(i ... | ALGO | 0.999985 | 4.022182 | {
"github_metadata": {
"branch": "master",
"commit_count": 2261,
"repo_created_at": "2020-12-20T21:28:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 37,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f753a... |
26f6a84d-e0d6-4819-9818-4b795ec199c3 | Vipul1407/DSA--Leetcode-Ques.. | 3570-count-of-substrings-containing-every-vowel-and-k-consonants-i/count-of-substrings-containing-every-vowel-and-k-consonants-i.cpp | class Solution {
public:
//METHOD-2
//OPTIMIZED
//SLIDING WINDOW..
//TC= O(N)
bool complete(unordered_map<char, int> &mp, int &conso, int &k)
{
if (mp['a'] == 0 || mp['e'] == 0 || mp['i'] == 0 || mp['o'] == 0 || mp['u'] == 0)
{
return false;
}
return c... | ALGO | 0.999913 | 5.940316 | {
"github_metadata": {
"branch": "main",
"commit_count": 1936,
"repo_created_at": "2024-07-08T18:09:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5886b4ab... |
81d6bbfe-259b-4a58-8bf8-6f07f501a2c1 | HTH24/Washtenaw | cps271MP7/cps271MP7.cpp | //
// cps271MP7.cpp
// cps271MP7
//
// Created by <NAME> on 3/30/24.
//
#include "cps271MP7.hpp"
void Grid::userMakeMove() {
/*
assuming both r and c are within respective
set the position the user chooses
*/
int c; // select a column index
cout << "Human Player: choose a column number b... | ALGO | 0.969938 | 5.025861 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-03-31T07:08: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": "3f514b7755de... |
f8ab7af8-0f8a-417f-b1bb-2a99d1f1fc2c | BCLCommons/bcl | source/assemble/bcl_assemble_aa_neighbor_list_container_generator_sse_pair.cpp | // (c) Copyright BCL @ Vanderbilt University 2014
// (c) BCL Homepage: http://www.meilerlab.org/bclcommons
// (c) BCL Code Repository: https://github.com/BCLCommons/bcl
// (c)
// (c) The BioChemical Library (BCL) was originally developed by contributing members of the Meiler Lab @ Vanderbilt University.
// (c)
// (c) T... | TOOL | 0.935873 | 6.270648 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2022-05-21T17:35:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 29,
"forks": 19,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "9e5879a1... |
63b1a80e-7e02-4e48-bf63-93290091bfd5 | HsiaoWeiChih/LeetCode | cpp/combination-sum-ii.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
private:
vector<int> sortVec(vector<int> v)
{
int vSize = v.size();
int temp;
for (int i = 0; i < vSize - 1; i++)
{
for (int j = i + 1; j < vSize; j++)
{
if (v[i]... | ALGO | 0.999994 | 5.814822 | {
"github_metadata": {
"branch": "master",
"commit_count": 120,
"repo_created_at": "2024-07-28T11:24: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": "94be5976... |
86b2b58f-634e-4e68-8866-735011d675bc | rtrius/Bullet-FLUIDS | bullet-2.81-rev2613/src/BulletFluids/Hf/btFluidHfRigidCollisionAlgorithm.h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 <NAME> http://bulletphysics.com
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to a... | ALGO | 0.965563 | 7.209452 | {
"github_metadata": {
"branch": "master",
"commit_count": 134,
"repo_created_at": "2012-05-21T06:33:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 40,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "be5aad6... |
9d933d96-a81e-4fa0-80bc-c90d5d6f6f9a | ysyisyourbrother/My-Leetcode | Leetcode 剑指offer 面试题库/面试题40. 最小的k个数.cpp | #include "headfile.h"
using namespace std;
class Solution {
public:
// 使用堆排序的方法
vector<int> getLeastNumbers(vector<int>& arr, int k) {
vector<int> res;
if(arr.size()==0) return res;
int length = arr.size()-1;
buildMaxHeap(arr,length); // 先构建小顶堆
// 使用小顶堆选出前k个元素
w... | ALGO | 0.999994 | 5.179633 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2019-05-05T03:46:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 62,
"forks": 12,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fa5c3b... |
d9557fe5-5d81-4b61-aa3d-0686402bedff | sxs-collaboration/spectre | src/Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions/Tags/GaugeCondition.tpp | // Distributed under the MIT License.
// See LICENSE.txt for details.
#pragma once
#include "Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions/Tags/GaugeCondition.hpp"
#include <cstddef>
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/IndexType.hpp"
#include "DataStructures/Tensor/... | ALGO | 0.998375 | 6.850249 | {
"github_metadata": {
"branch": "develop",
"commit_count": 17103,
"repo_created_at": "2017-04-07T17:28:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 168,
"forks": 202,
"issues": 530,
"pull_requests": 57
},
"file_meta": {
"content_id": ... |
3196d6c5-be4a-42ca-9074-5b253bf8732f | raincross7/code-similarity | codes/train_code/problem371/problem371_10.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >>s;
int sl = s.size();
bool kaibun = true;
for (int i = 0; i < sl; i++) {
if (i < sl/2 + 1) {
if (s.at(i) != s.at(sl - i - 1)) {
kaibun = false;
break;
}
... | ALGO | 0.999987 | 3.362001 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e7cbf57a99af... |
658b7b08-3c30-4372-86cb-a1a1bdc21484 | George-E/MyECOOSolutions | SolutionsInC++/2-2016p1.cpp | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
using namespace std;
int main()
{
ifstream infile;
infile.open("DATA11.txt"); //change
for (int testcase = 0; testcase < 10; testcase++) {//change
try {
string x;
getline(... | ALGO | 0.996854 | 4.209266 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2016-06-16T00:11: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": "65f00ae43b... |
61cf2df4-9478-429b-a67d-a47455e7b6fd | arthurflor23/text-segmentation | src/imgproc/cpp/WordSegmentation.cpp | #include "WordSegmentation.hpp"
WordSegmentation::WordSegmentation() {};
bool compareXCords(const Rect &p1, const Rect &p2){
return (p1.x < p2.x);
}
void WordSegmentation::printContours(Mat image, vector<vector<Point>> contours, vector<Vec4i> hierarchy, int idx){
for(int i = idx; i >= 0; i = hierarchy[i][0]){
... | ALGO | 0.942555 | 4.264892 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2019-02-19T20:30:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 124,
"forks": 43,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8c186... |
138af58d-82ba-436c-807a-f833b5482130 | ishandutta2007/codeforces-c | cz_xuyixuan/normal/1172/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 5;
const int MAXLOG = 20;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
template <typename T>... | ALGO | 0.999843 | 4.130785 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:17: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": "204dee2441f0... |
9f38fba4-9b95-49b9-ac26-45ac19c64abb | mhenson44/AdvProgWithDataStructures | lab12/lab12files/unorderedLinkedList.h | /*
Name:<NAME>
Class:csc1720
Date:04/06/21
Path:~/mhenson/csc1720/lab12/lab12files/unorderedLinkList.h
Desc:creating a 2 lists and deleting a node in those lists. Finding the average of the unorderedList as well.
*/
#ifndef UNORDEREDLINKEDLIST
#define UNORDEREDLINKEDLIST
#include "linkedList.h"
using namespace st... | ALGO | 0.995622 | 3.918619 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-05-01T14:43:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c394feee32aa... |
0d82483f-eb5d-457c-8a0b-aa486da5ab97 | CaravelGames/drod | DRODLib/RedSerpent.cpp | // $Id$
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Softw... | ALGO | 0.931997 | 6.05774 | {
"github_metadata": {
"branch": "master",
"commit_count": 881,
"repo_created_at": "2017-04-25T20:41:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 61,
"forks": 19,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "2b756e0... |
fe5c844a-1bf9-4de0-a0b8-1006be1f6b6a | bhavyakalra19/cpp_comp_prog_dsa | LevelUp/Striver/Dynamic Programming/ninjaTraining.cpp | // https://www.naukri.com/code360/problems/ninja%E2%80%99s-training_3621003?utm_source=striver&utm_medium=website&utm_campaign=a_zcoursetuf&leftPanelTabValue=SUBMISSION
int getAns(vector<vector<int>> &points, int idx, int n, int last, vector<vector<int>> &dp){
if(dp[idx][last] != -1){
return dp[idx][last];... | ALGO | 0.999846 | 5.530393 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2024-08-16T10:48: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": "7ad78c129... |
dd268d9b-cb88-4b1d-9b2b-1a2e4d9d478a | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/10/1004/personal_submission/cf922c_Equinox.cpp | #include <bits/stdc++.h>
// #define DEBUG
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
constexpr int inf32 = 1E9 + 7;
constexpr i64 inf64 = 1E18 + 7;
void solve() {
i64 n, k;
std::cin >> n >> k;
for (i64 i = 1; i <= k; ++ i) {
if ((n % i) != i - 1) {
... | ALGO | 0.999958 | 4.491398 | {
"github_metadata": {
"branch": "main",
"commit_count": 20410,
"repo_created_at": "2024-02-26T01:04:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 478,
"forks": 302,
"issues": 0,
"pull_requests": 7
},
"file_meta": {
"content_id": "d12b... |
b8977b18-1740-4afa-8526-096dfe3da69c | asifmahmud/algorithm_projects | add_two.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
if (l1 == NULL && l2 == NULL) return NULL;
ListNode* sum = new ListNode(0)... | ALGO | 0.999977 | 6.042248 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2017-03-31T03:14: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": "1888368c7... |
ab7801ab-00df-47d3-a19f-a5cf578ba3d2 | akshitasinghal4444/leetcode-gfg | 132-palindrome-partitioning-ii/132-palindrome-partitioning-ii.cpp | class Solution {
public:
int minCut(string s)
{
int n=s.length();
int i,j,k;
vector<vector<bool>> palindrome(n,vector<bool>(n));
for(k=0;k<n;k++)
{
for(i=0,j=k;j<n;i++,j++)
{
if(k==0)
palindrome... | ALGO | 0.999972 | 5.036355 | {
"github_metadata": {
"branch": "main",
"commit_count": 4860,
"repo_created_at": "2022-01-25T18:07: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": "6a0bc7e53... |
babd3b11-73d7-48dd-84e9-20d8cb118b80 | eleonoradgr/CompetitiveProgramming | Lecture03/inversionCount.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>
#include <climits>
std::pair<std::vector<uint64_t>, uint64_t>
mergeCount(std::pair<std::vector<uint64_t>, uint64_t> left, std::pair<std::vector<uint64_t>, uint64_t> right) {
std::pair<std::vector<uint64_t>, uint64_t> result(std::vector<... | ALGO | 0.999732 | 4.423776 | {
"github_metadata": {
"branch": "master",
"commit_count": 103,
"repo_created_at": "2019-09-22T14:59: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": "9cc0f69c... |
e42b7843-e561-4bdb-8d35-cd03da36c0e0 | LuizFelipeLemon/PA | Unidade 1/Exercícios/numeros_por_extenso.cpp | #include <iostream>
#include <string>
using namespace std;
string valorPorExtenso(unsigned int valor);
int main()
{
unsigned int V;
string E;
do {
cout << "Digite o valor total (entre 0 e 999): ";
cin >> V;
} while (V>999);
E = valorPorExtenso(V);
cout << "Valor por extenso:\n" << E << endl;
}... | ALGO | 0.995798 | 3.968475 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2018-02-22T20:00:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eca9fce348... |
2a55e752-d6f3-494c-bb7d-da35791c64e0 | Kleiber/competitive-programming | UVA/BipartiteMatching/12168_Cat_Dog.cpp | #include<bits/stdc++.h>
#define MAX 1005
using namespace std;
bool visitados[MAX], M[MAX][MAX];
int match[MAX];
int votos[2][MAX];
int C, D, V;
bool dfs(int u){
for(int i = 0; i < V; i++){
if(!visitados[i] && M[u][i]){
visitados[i] = 1;
if(match[i] == -1 || dfs(match[i])){
match[i] = u;
return 1;
}... | ALGO | 0.999797 | 3.93198 | {
"github_metadata": {
"branch": "master",
"commit_count": 251,
"repo_created_at": "2017-01-14T15:17:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f14b7af... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.