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 |
|---|---|---|---|---|---|---|---|
008a7532-f6c0-4287-bb98-b7a91439f623 | Supriyasingh22/DSA-Binary-Search | LastOccurence.cpp | // to find last occurence of any given element
#include<iostream>
using namespace std ;
int lastOccurence(int arr[],int lb,int ub,int key,int &ans)
{
if(lb>ub)
{
return ans ;
}
int mid = lb+(ub-lb)/2 ;
if(arr[mid]==key)
{
ans = mid ;
lastOccurence(arr,mid+1,ub,key,a... | ALGO | 0.999808 | 4.134249 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2023-04-16T14:10:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "25f825634b... |
66d1d313-01a3-43e9-b2a9-010bb71604ec | danfis/fast-downward | src/search/landmarks/landmark_cost_assignment.h | #ifndef LANDMARKS_LANDMARK_COST_ASSIGNMENT_H
#define LANDMARKS_LANDMARK_COST_ASSIGNMENT_H
#include "../globals.h"
#include "../operator_cost.h"
#include "../lp/lp_solver.h"
#include <set>
#include <vector>
namespace landmarks {
class LandmarkGraph;
class LandmarkNode;
class LandmarkCostAssignment {
const std::... | ALGO | 0.987427 | 6.977345 | {
"github_metadata": {
"branch": "master",
"commit_count": 9693,
"repo_created_at": "2016-09-01T11:29:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f674058... |
f909b7d3-4ac8-4131-8718-43a1cd78b3cf | abhisheksuman413/A2Z_DSA_Course_Sheet | 02_Learn Important Sorting Techniques/Lec_02_02_Sorting 2/Theory_04_Quick_Sort.cpp | #include <bits/stdc++.h>
using namespace std;
/*
// Code for descending order
int partition(int arr[], int low, int high){
int pivot = arr[low];
int i = low;
int j = high;
while(i<j){
while(arr[i]>=pivot && i <= high-1){
i++;
}
while(arr[j]>pivot && j <= low+1){
... | ALGO | 0.99989 | 5.688027 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2023-08-12T10:12: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": "23fee2afe... |
f6fdd91f-502c-485d-acf0-3f97a992d7c6 | quangrtit/PTIT_C_PLUS | CPP0324-Phep_chia_du_cua_luy_thua_so_nguyen_lon.cpp | #include<iostream>
#include<unistd.h>
#include<math.h>
#include<string>
#include<cctype>
#include<set>
#include<limits.h>
#include<map>
#include<queue>
#include<algorithm>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define endl '\n'
void fast()
{
ios::sync_with_stdio(false);
cin.tie(0);
}
lon... | ALGO | 0.999359 | 3.810104 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2023-10-23T08:04: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": "2a3aad224f0... |
73ca3281-1ca8-48f5-9c8d-b2c5ba3f7bd0 | alexandraback/datacollection | solutions_5662291475300352_0/C++/filippoqua/c.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <fstream>
#include <climits>
#include <iostream>
#include <queue>
#define ii pair<int,int>
#define ll long long
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
struct li... | ALGO | 0.99975 | 3.392946 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "285f29c06... |
c68b153c-5b34-4a90-9133-cf87ef1f0a0e | sonwell/ib.cu | include/bases/geometry.h | #pragma once
#include <array>
#include "cublas/handle.h"
#include "cublas/operation.h"
#include "cublas/gemm.h"
#include "algo/cross.h"
#include "algo/dot.h"
#include "types.h"
#include "operators.h"
namespace bases {
inline constexpr struct {} reference; // tag for getting reference geometry data
inline constexpr st... | ALGO | 0.976687 | 7.426149 | {
"github_metadata": {
"branch": "master",
"commit_count": 143,
"repo_created_at": "2020-06-15T20:13: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": "74c5afba... |
ac7771f1-6ca6-4159-9ce0-9207e9d155e5 | aryan57/cp-archive | Codeforces/Educational Codeforces Round 114 (Rated for Div. 2)/C. Slay the Dragon.cpp | /*
group : Codeforces - Educational Codeforces Round 114 (Rated for Div. 2)
name : C. Slay the Dragon.cpp
srcPath : /home/aryan/Desktop/cp-workspace/C_Slay_the_Dragon.cpp
url : https://codeforces.com/contest/1574/problem/C
*/
/*
author : aryan57
created : 20-September-2021 20:53:28 IST
*/
#include <bits/stdc++.h>... | ALGO | 0.999984 | 4.66692 | {
"github_metadata": {
"branch": "master",
"commit_count": 990,
"repo_created_at": "2021-06-02T12:49:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f69954d... |
a0a18400-ad8e-4f1c-a7e7-f3779c4e619c | microsoft/pSDCA | src/SplitData/split_file.cpp | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <cstdio>
#include <cstdint>
#include <random>
#include <omp.h>
#include "utils.h"
#include "timer.... | DATA | 0.934253 | 5.325183 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2020-09-04T00:37:15.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "01c366cdd793e... |
ea4626ff-c24f-4c2c-ade7-54586bab1ebf | SamuelJosephs/Cross_Product_Calculator | Vector Calculator2.cpp | #include <iostream>
#include <string>
using namespace std;
void print_vector (float vector[3]){
for (int i = 0; i<3; i++) {
cout << vector[i] << endl;
}
}
int main() {
float first_vector[3];
for (int i = 0; i < 3; i++) {
cout << "What is your " << i+1 <<" vector entry?... | ALGO | 0.999636 | 5.039444 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-04-11T12:41:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c526244498aa... |
92b93f91-a512-42da-b459-a780086069f1 | NeelDigonto/dsa | src/patterns/string/EncodeDecodeString.cpp | #include <core/Common.hpp>
#include <iostream>
using namespace std;
class Codec {
public:
// Encodes a list of strings to a single string.
string encode(const vector<string> &strs) {
string encoded_string = "";
for (auto &str : strs) {
const uint8_t str_len = str.size();
strncpy(encoded_string... | TOOL | 0.952601 | 6.344347 | {
"github_metadata": {
"branch": "main",
"commit_count": 47,
"repo_created_at": "2022-12-24T11:34: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": "3304240985d... |
6c98349d-e8ae-4c6f-9d01-0523aa6ec892 | ishandutta2007/codeforces-s | ssrs_/normal/1650/E.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
for (int i = 0; i < t; i++){
int n, d;
cin >> n >> d;
vector<int> a(n + 1);
a[0] = -1;
for (int j = 1; j <= n; j++){
cin >> a[j];
a[j]--;
}
int tv = 0, fv = d;
while (fv - tv > 1){
int mid ... | ALGO | 0.999965 | 3.429393 | {
"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": "259f345a60e2... |
dab4b48f-f06b-4089-8dde-8cdb219d9049 | PaulFremont3/SIVZ_coexistence | Codes/trait_data/generate_traits.cpp | #include <fstream>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <map>
#include <algorithm>
#include <iterator>
#include <random>
#include <cstring>
#include <string>
#include <set>
#include <omp.h>
#include <cmath>
#include "functions.h"
using namespace std;
typedef vector<double> vec;
int main... | DATA | 0.952844 | 3.962195 | {
"github_metadata": {
"branch": "main",
"commit_count": 408,
"repo_created_at": "2025-06-09T18:27: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": "36bd0a4c17... |
23a08e9d-4f19-4dda-924d-98aac69edb3f | thabir303/Theory-of-Computation | cfg_assignment.cpp | #include<bits/stdc++.h>
using namespace std;
string m="A1B";
int main()
{
string s;
cin>>s;
bool a=false;
bool flag=false;
for(int i=0; i<s.size(); i++)
{
if(s[i]=='1')
a=true;
}
if(a)
{
cout<<"The input string is Accepted\n";
flag=true;
}
... | ALGO | 0.999906 | 3.367877 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-02-13T04:50: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": "913c5825810b... |
4c170104-5cd4-401e-abf1-07248c91986d | boozec/unict | Year_1/Programming_2/data_structures/list_double.cc | #include<iostream>
using namespace std;
template<typename T>
struct node {
T value;
node* prev;
node* next;
};
template<typename T>
class list {
public:
list() : _head{nullptr} {}
~list() {
while(_head != nullptr) {
node<T>* tmp = _head->next;
delete tmp;
... | ALGO | 0.999084 | 5.100757 | {
"github_metadata": {
"branch": "master",
"commit_count": 235,
"repo_created_at": "2019-10-08T07:54: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": "6f1d6888... |
8c209465-900e-4545-94b1-0883b705898c | dheenim/Algorithm | Programmers/programmers_신규아이디추천.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
string solution(string new_id) {
string answer = "";
//1단계 new_id의 모든 대문자를 대응되는 소문자로 치환합니다.
//2단계 new_id에서 알파벳 소문자, 숫자, 빼기(-), 밑줄(_), 마침표(.)를 제외한 모든 문자를 제거합니다.
for (int i = 0; i < new_id.length(); i++)
... | ALGO | 0.999717 | 5.063044 | {
"github_metadata": {
"branch": "main",
"commit_count": 447,
"repo_created_at": "2021-03-17T12:32: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": "96886a4d18... |
56dd750c-c78b-4cb4-89a9-0f0042c14bfe | Gvasa/voronoi_fracture | src/utils/Utils.h |
#ifndef UTILS_H
#define UTILS_H
#define GLM_FORCE_RADIANS
#define EPSILON 0.01
#define EPSILON_2 0.001
#define XMAX 0
#define XMIN 1
#define YMAX 2
#define YMIN 3
#define ZMAX 4
#define ZMIN 5
#define XPROJECTION 0
#define YPROJECTION 1
#define ZPROJECTION 2
#define MAX_VORONOI_POINTS 3
#define RECTANGLE 0
#define ... | TOOL | 0.941516 | 4.100939 | {
"github_metadata": {
"branch": "master",
"commit_count": 133,
"repo_created_at": "2015-10-09T11:18:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 5,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e031e42... |
ac87713d-577f-4930-8eb0-bd484709ecec | oguzhanayhan16/ALGOR-TMA-ANAL-Z--VE-TASARIMIKISASINAV-2-1.-KISIM- | Degistirilen.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#define A_SIZE 20
#define G_SIZE 10
#define MAX_W 10
//Max deger icin sonsuz sayi
#define INF INT_MAX
void generate(int a[], int size);
void quick_sort(int arr[],int left,int right);
int function2(int a[], int size);
void function3(int g[]... | ALGO | 0.999542 | 4.162722 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-05-15T10:31: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": "f88fb370ebe2... |
97b48c79-60f6-46d0-bf01-f45745034ad0 | bernielampe1/data_structs | BinTree.h | #pragma once
template <typename T> class BinTree {
private:
struct Node {
Node(const T &d) : _left(0), _right(0), _data(d) {}
Node *_left, *_right;
T _data;
};
private:
Node *_root;
unsigned _size;
void _insert(Node **n, const T &d) {
if (*n != 0) {
if (d < (*n)->_data) {
if ... | ALGO | 0.99893 | 4.955414 | {
"github_metadata": {
"branch": "master",
"commit_count": 29,
"repo_created_at": "2020-01-21T02:46: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": "6442fe3de... |
369e62d8-2991-4811-922c-7cd5651b8967 | sadianusratmunny51/Operating-System-Lab-Tasks | Scheduling Algorithms/SJRF_preemptive.cpp | #include<bits/stdc++.h>
using namespace std;
struct Process {
int pid;
int arrival;
int burst;
int remaining;
int finish;
int waiting;
int turnaround;
bool completed = false;
};
int32_t main() {
int n;
cout << "Enter the number of processes: ";
cin >> n;
vector<Process... | ALGO | 0.999994 | 4.95294 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-05-24T09:22: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": "69394129f597... |
0c1f50f0-4eeb-411b-8ddd-ccbd7a52be1b | IHR57/Competitive-Programming | UVA/10673 (Play with Floor and Ceil)-3.cpp | #include <bits/stdc++.h>
#define MAX 100005
using namespace std;
typedef long long lint;
lint x, y, GCD;
/*lint greatestCommon(lint a, lint b) //return the greatest common divisor
{
if(a % b == 0)
return b;
return greatestCommon(b, a % b);
}*/
void extendedEuclid(lint a, lint b)
{
if(b == 0)... | ALGO | 0.999644 | 4.839445 | {
"github_metadata": {
"branch": "master",
"commit_count": 80,
"repo_created_at": "2018-12-28T07:37:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a770ec55... |
8e19b004-de76-4971-b28a-4c3785e74e55 | AhmadBinMushtaq/Arduino-Drone | Drone/motor_powers.cpp | #include <Arduino.h>
#include "Structs.h"
#include "Constants.h"
#include "Functions.h"
//----------- PID CONFIGURATION-----------
struct ConstantsPID pid;
//----------- PID CONTROL LIMITS-----------
double ROLL_PITCH_CONTROL_SIGNAL_LIMIT = pid.KP_roll_pitch * QUADCOPTER_MAX_TILT_ANGLE * 2;
// PID error and control ... | ALGO | 0.991822 | 6.654913 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-05-04T17:17:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "93570d0920df... |
a42c5d78-88fa-4298-9e87-34fa450cbda7 | WorldOfWheat/CodeDepositary | C_C++/TCIRC-OJ/d079 P-6-17. 切棍子.cpp | #include <bits/stdc++.h>
#define int long long
#define V vector<int>
#define VP vector<pii>
#define VV vector<vector<int>>
#define pii pair<int, int>
#define F first
#define S second
#define rep(x, y ,z) for(int x = y; x < z; x++)
#define rep2(x, y ,z) for(int x = y; x <= z; x++)
#define rrep(x, y ,z) for(int x = y; x ... | ALGO | 0.999983 | 3.462478 | {
"github_metadata": {
"branch": "main",
"commit_count": 540,
"repo_created_at": "2022-07-25T08:13: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": "f72cc1534f... |
62cffac7-3baa-4977-9e00-931170b26560 | hmazhar/physbam_public | PhysBAM_Geometry/Grids_RLE_Computations/RIGID_GEOMETRY_RASTERIZATION_RLE.cpp | //#####################################################################
// Copyright 2009, <NAME>.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Namespace ... | ALGO | 0.940382 | 5.847716 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2014-04-02T21:48:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 30,
"forks": 13,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "c413319... |
f8770a33-46b7-4cb4-8a78-f23d4934e27b | creepysta/CP | prac/basic/recursion/all_balanced_parenthesis.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int n, vector<string> &ans, int n_open=0, int n_close=0, string _ans="") {
if(n_open + n_close == n) {
ans.push_back(_ans);
return;
}
if(n_open < n/2)
solve(n, ans, n_open+1, n_close, _ans + "(");
if(n_close < n/2 && n_clo... | ALGO | 0.995778 | 5.328487 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2020-12-28T04:38:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4b9d5be60... |
c3d20bd1-a398-46ba-bca1-1134f6519a86 | fatemehkarimi/uvaSolutions | uva-331.cpp | //uva 331
//Mapping the Swaps
#include <iostream>
#include <climits>
#include <vector>
#include <queue>
using namespace std;
void BFS(vector <vector <int> > & Graph, vector <int> & level);
int main(void)
{
int n = 0;
int tcounter = 0;
while(true){
cin >> n;
if(n == 0)
break;... | ALGO | 0.999954 | 4.104959 | {
"github_metadata": {
"branch": "master",
"commit_count": 213,
"repo_created_at": "2018-05-30T07:42:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3676421... |
7524345f-10f3-4dda-a7d9-ec1decc20887 | ALTH-Algorithm-Study/ALTH | WEEK6/week6_3_primAlgorithm/1922_Seul.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int, int> computer; // 입력 받는 위치와 가중치의 쌍 computer로 선언
int N,M;
vector<computer>graph[1001]; // 입력 받는 정보
bool visited[1001]; // 방문 여부
long long answer = 0;
void prim()
{
priority_queue<computer, vector<computer>, greater<computer>> ... | ALGO | 0.999974 | 4.252606 | {
"github_metadata": {
"branch": "main",
"commit_count": 155,
"repo_created_at": "2022-02-08T23:12:43.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "f4863fb2be6... |
d91e5619-edbd-44ae-98a4-7ac4e4df2fc2 | Alberto-SC/Competitive-Programming-solutions | Codeforces/Deltix round/cf/contest/1523/c/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
signed main(){__
int t= 1,n;
cin>>t;
while(t--){
cin>>n;
vector<int> nums(n);
for(auto &c:nums)cin>>c;
bool flag = true;
set... | ALGO | 0.999908 | 4.74518 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2020-07-20T03:18:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8690d098c7fb... |
4f94409a-53eb-4b5e-87bc-5c223760f58a | pratyaksh29/DSA-Leetcode | 0105-construct-binary-tree-from-preorder-and-inorder-traversal/0105-construct-binary-tree-from-preorder-and-inorder-traversal.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.999997 | 6.647056 | {
"github_metadata": {
"branch": "main",
"commit_count": 845,
"repo_created_at": "2023-09-11T11:31: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": "814c896f8a... |
0b3514e4-4dfa-4188-b04e-c4f9f15365f2 | mahendrarathore1742/dsa_notes | graph luv/floyd_warshall_codeforce.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 510;
const int INF = 1e9 + 10;
long long dis[N][N];
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j) {
... | ALGO | 0.999936 | 3.873339 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2023-01-23T09:53: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": "2c52d84e9a7... |
f99e1fb1-42cb-4217-8835-fd5bcbcb5b93 | ishandutta2007/codeforces-s | sert/normal/1064/B.cpp | #pragma GCC diagnostic ignored "-Wunused-result"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)1e6 + 34;
//const ll INF = (ll)1e18 + 41;
const int INF = (int)1e9 + 41;
const ll MD = (ll)1e9 + 7;
bool D = false;
void solve() {
/*int n = 123;
for (int a ... | ALGO | 0.999304 | 4.786146 | {
"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": "117e31204128... |
d0bf6267-8bb3-4cd2-9d01-0cb50b349faf | nawngs/CompetitiveProgramming | icpc/j.cpp | #pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pll pair < ll, ll >
#define pii pair < int, int >
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const string NAME = "";
const string NAME2 =... | ALGO | 0.999991 | 3.028005 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2021-06-19T07:51: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": "3b25eb66cc5... |
64dca071-c6fe-4134-91a7-ceccca23883e | alexluscan/Cpp-algorithms | Algoritmica/Paduri de multimi disjuncte/Iepuri/iepuri_matrice.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream is("iepuri.in");
ofstream os("iepuri.out");
const int MOD = 30011;
vector<vector<int> > G;
int n, k;
vector<vector<int> >a;
int root;
vector<int> grad;
void Dfs(int nod);
void Read();
int main()
{
Read();
Dfs(root);
int res... | ALGO | 0.9999 | 3.851909 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-12-29T14:48: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": "897a1f74c217... |
5867a446-5c31-44f9-8df0-52cbcc1b02f0 | svargasro/Wildfire-Smoke-Spread-Over-Bogot-Workshops | Workshops/Workshop_1/TrojanPlanets/puntoB/punto2.cpp | #include <iostream>
#include <cmath>
#include <fstream>
#include "vector.h"
using std::cout;
using std::sqrt;
using std::endl;
using std::fabs;
using std::sin;
using std::cos;
//Constantes del problema físico
const int N=2;
const double G=1.0;
//Constantes del algoritmo de integración
const double xi=0.1786178958448... | ALGO | 0.999706 | 3.744788 | {
"github_metadata": {
"branch": "main",
"commit_count": 206,
"repo_created_at": "2024-10-28T03:35:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a6e798a1d... |
5c430c66-ea14-4853-9620-f7fd18ef8b35 | Aryan9897/Round-Robin-Scheduler | main.cpp | #include <iostream>
#include "process.h"
#include "scheduler.h"
using namespace std;
int main() {
int numProcesses;
double quantumTime;
double contextSwitchTime;
//Ask the user for information
cout << "Enter number of processes: ";
cin >> numProcesses;
cout << "Enter quantum time: ";
... | ALGO | 0.995468 | 4.049683 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-02-08T21:49: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": "4b12b05245ea... |
9a51592d-7bed-401e-8ffb-c52d75a792f4 | umaidansari12/CP_Backup | previous_codes/sum_list.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
class Node {
public:
int data;
Node* next;
Node(int x)
{
this->data = x;
this->next = NULL;
}
};
class LinkedList {
public:
Node* head;
LinkedList()
{
head = NULL;
}
void insert(int x)
{
Node* newNode = new Node(x);
if (head == ... | ALGO | 0.999979 | 4.159466 | {
"github_metadata": {
"branch": "main",
"commit_count": 1213,
"repo_created_at": "2021-06-27T07:26:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5dfea68e5... |
489c9d41-2c01-4d3b-a802-a96463e214b3 | LavishGulati/Codechef | October Long 2022 (Div. 2)/TWOZERO.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma GCC optimize("O3")
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int, int> pii;
typedef pair< int, pair<int, int> > tii;
typedef pair< long long, pair<long long, long long> > tll;
typed... | ALGO | 0.999944 | 5.129238 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2018-12-14T17:22: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": "b4e1ed389... |
bb283fa6-1a0c-45cf-baac-1df2c7776917 | T2hhbmEK/cp | P1119.cpp | #include <bits/stdc++.h>
using namespace std;
#define MaxN 205
#define MaxM 20005
int n, m, t[MaxN], qn;
int dp[MaxN][MaxN];
void p() {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
printf("%d ", dp[i][j]);
}
printf("\n");
}
}
int main() {
// freopen("P1119.... | ALGO | 0.99999 | 4.281189 | {
"github_metadata": {
"branch": "main",
"commit_count": 100,
"repo_created_at": "2024-11-15T14:58: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": "5fe6fda210... |
50ef8623-033e-45ed-8c58-8b261c82ddaa | fan-linyu/leetcode | medium/11-Container With Most Water.cpp | // Given n non-negative integers a1, a2, ..., an , where each represents a
// point at coordinate (i, ai). n vertical lines are drawn such that the two
// endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together
// with x-axis forms a container, such that the container contains the most
// water.
//... | ALGO | 0.999975 | 6.044636 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-05-11T16:39: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": "67ae7857a5... |
5599b6b4-a3f8-4882-bfdf-c012eeda00bf | arimnrg16/CP | Contest & Online Judge/Kattis/Problems/bond.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 20;
double dp[1 << N];
int arr[N][N];
int n;
void read() {
scanf("%d", &n);
for(int i = 0 ; i < n ; i++)
for(int j = 0 ; j < n ; j++) {
scanf("%d", &arr[i][j]);
}
}
double work() {
dp[0] = 1;
for(int i = 1 ; i < (1 << n) ; i++) {
... | ALGO | 0.999456 | 3.74368 | {
"github_metadata": {
"branch": "master",
"commit_count": 120,
"repo_created_at": "2019-03-13T13:45:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a65eb4a... |
dbe6c099-273d-46bd-9c37-824bf04e398f | atique7465/Graph_theory_in_detail | Bellmen_ford_single_source_shortest_path.cpp | /// resource 01: https://www.youtube.com/watch?v=FtN3BYH2Zes&list=PLDN4rrl48XKpZkf03iYFl-O29szjTrs_O&index=53
/// resource 02: http://www.shafaetsplanet.com/planetcoding/?p=2044#bellman
/// time complexity O( v*e ) or O( n^2 ).
/// same work may be done by dijkstra but dijkstra dont work on negative edge and negative w... | ALGO | 0.999965 | 4.388884 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2019-05-27T07:03:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a682db0f... |
1c1639a0-d63e-4f07-bca2-b5490d2e3113 | siusiukim/COMP4411 | Animator/curveevaluator.cpp | #include "CurveEvaluator.h"
float CurveEvaluator::s_fFlatnessEpsilon = 0.00001f;
int CurveEvaluator::s_iSegCount = 16;
CurveEvaluator::~CurveEvaluator(void)
{
}
Mat4f CurveEvaluator::constructMGMatrix(const Mat4f& M, Point p1, Point p2, Point p3, Point p4) {
return Mat4f(M.get(0) * p1.x + M.get(1) * p2.x + M.get(2)... | ALGO | 0.903343 | 4.585193 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2019-05-02T16:47:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ff4bc98c2... |
59f19087-6df8-46d5-b385-e52977c70392 | liuyubobobo/Play-Leetcode | 2501-3000/2596-Check-Knight-Tour-Configuration/cpp-2596/main.cpp | /// Source : https://leetcode.com/problems/check-knight-tour-configuration/description/
/// Author : liuyubobobo
/// Time : 2023-03-25
#include <iostream>
#include <vector>
using namespace std;
/// Simulation
/// Time Complexity: O(n^2)
/// Space Complexity: O(n^2)
class Solution {
public:
bool checkValidGrid... | ALGO | 0.999961 | 5.838503 | {
"github_metadata": {
"branch": "master",
"commit_count": 2592,
"repo_created_at": "2016-12-01T17:08:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2732,
"forks": 718,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad... |
c7aaa4be-2ead-4953-bdf3-cd57367210b7 | RishabhRastogi-VT/Data-Structure-problems | linkedlist_merge.cpp | // merging 2 linked list in order.
#include<iostream>
using namespace std;
struct node
{
int data;
node* next;
};
node* push(int data,node* head)
{
if(head==NULL)
{
node* newnode=new node;
newnode->data=data;
head=newnode;
}
else
{
node* newnode=new n... | ALGO | 0.999937 | 4.643293 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-07-09T20:32:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "38dfa06aad... |
a0215a26-f5a2-4f90-ae64-8b79db4a4d8a | PedroAngeli/Competitive-Programming | Solutions/Atcoder/Contests/AtCoder Beginner Contest 192/e.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl '\n'
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ... | ALGO | 0.99997 | 3.975904 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2019-07-26T00:01:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "922533398... |
6c2874a4-198d-4b14-bbcf-11bbd995d1fa | ChuanqiTan/introduction-to-algorithms-notes | Introduction to Algorithms Projects/Intorduction to Algorithms/graphics.h | #pragma once
//////////////////////////////////////////////////////////////////////////
/// @file graphics.h
/// @brief 图的两种表示方法:(1)邻接表法;(2)邻接矩阵法
/// @details COPYRIGHT NOTICE
/// Copyright (c) 2011
/// All rights reserved.\n
///
///
/// @author 谭川奇 chuanqi.tan(at)gmail.com
/// @date 2011/06/17
/// @ver... | ALGO | 0.9713 | 4.573859 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2015-06-22T13:53:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "72f4548f8... |
c0a3a6f3-7fb7-4a50-98ad-c952af354ac7 | MichaelTenma/TopK | lab/simple.cpp | #include <mpi.h>
#include <CL/sycl.hpp>
#include<bits/stdc++.h>
#include <sys/time.h>
using namespace cl::sycl;
using namespace std;
sycl::queue q;
const long long N = 100000000;
#define NUM int
#define MPI_NUM MPI_INT
const int K = 144;
random_device rd;
priority_queue<int> tq;
uniform_int_distribution<long lo... | ALGO | 0.999969 | 4.805793 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-03-03T02:38: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": "358fa9e922a1... |
99ed353f-c889-471a-bd5a-c29def7c39be | ankursinghbisht/DSA_CheatSheet | C++/Stacks & Queues/14_sort_stack.cpp | /*
Idea:
Recursing while popping top elements and storing in function call stack &
Inserting elements at top if all below elements are smaller
[recursing till stack is empty or is smaller than target(elements are stored in function call stack).
inserting element and pushing rest elements]
*/
//{ Driver Code Starts
#in... | ALGO | 0.999944 | 6.329143 | {
"github_metadata": {
"branch": "main",
"commit_count": 627,
"repo_created_at": "2023-07-06T10:04: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": "0a80cad3c4... |
5423ef32-1b08-4cbc-99a9-4b747225cade | Kiran-Chaitu/GFG_CODES | Difficulty: Medium/Implement Atoi/implement-atoi.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int myAtoi(char *s) {
// Your code here
bool isMinus = false;
long long int ans=0,mini = -(1<<31),maxi=(1<<31)-1,i=0;
while(s[i]==' ') i++;
if(s[i]=='+' || ... | ALGO | 0.981393 | 5.053787 | {
"github_metadata": {
"branch": "main",
"commit_count": 575,
"repo_created_at": "2024-01-07T10:26: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": "50e9081257... |
3e45c831-28c1-4576-9b23-26519b75f8ce | lc19890306/Exercise | leetcode/Bitwise_AND_of_Numbers_Range.cc | // Fastest
class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
int diff;
// find the highest bit which differs m from n
for (int i(30); i >= 0; --i)
if ((m & (1 << i)) != (n & (1 << i))) {
diff = i + 1;
break;
}
// remove the differe... | ALGO | 0.999974 | 6.106061 | {
"github_metadata": {
"branch": "master",
"commit_count": 114,
"repo_created_at": "2015-08-16T04:26:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a26b97c0... |
cca16fa9-09b3-443b-be71-1d32aed99094 | aok-buran/CppMonotoneCubicInterpolation | hermite/include/monotone_cubic_interpolation.h | #pragma once
#include <iostream>
#include "base/cubic_hermite_spline.h"
#include "base/cubic_interpolation.h"
/**
* Класс монотонной кубической интерполяции,
* скорости в опорных точках рассчитываются по алгоритму,
* описанному в статье:
* <NAME>.; <NAME>. (1980). "Monotone Piecewise Cubic Interpolation".
* SIAM... | ALGO | 0.943666 | 6.594666 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2023-07-19T11:23:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9f5b40fcbb... |
41aceeb1-6820-410b-a0c1-ea9163682a39 | onewordstudios/sweetspace | cugl/include/cugl/math/dsp/CUTwoPoleIIR.h | //
// CUTwoPoleIIR.h
// Cornell University Game Library (CUGL)
//
// This class is represents a two-pole IIR filter. For second-degree filters,
// it is significantly more performant than IIRFilter.
//
// This class supports vector optimizations for SSE and Neon 64. In timed
// simulations, these optimizations p... | ALGO | 0.96123 | 6.763605 | {
"github_metadata": {
"branch": "master",
"commit_count": 2160,
"repo_created_at": "2020-02-18T18:00:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 8,
"forks": 1,
"issues": 9,
"pull_requests": 0
},
"file_meta": {
"content_id": "21e242e6... |
474a765d-86cf-480d-950c-64521bdc60e5 | ongyiumark/programming-problems | Atcoder/ABCs/100 - 199/ABC118/ABC118D.cpp | /*
If you try a greedy approach, you'll eventually realize that it doesn't work.
So, the next step is to try some DP.
Let DP[i] be the maximum number using i matchsticks.
We can't store the number in 64-bits so we use a string with a custom comparator.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_con... | ALGO | 0.999836 | 4.319461 | {
"github_metadata": {
"branch": "main",
"commit_count": 227,
"repo_created_at": "2020-10-09T05:36: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": "6f0e22cbd3... |
3b889b2b-12dd-4d7f-a426-254bb8dc11d7 | lastnova/CPP-IT-SCHOOL-2019-2020 | HomeWorks/HomeWork3/oftenNumber.h | #include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
int oftenNumber()
{
int count, change, number, frequence, maxFrequence;
printf("Введите размерность массива: ");
cin >> count;
int* arrayOfNumbers = new int[count];
printf("Массив со случайными числами: ");
for (i... | ALGO | 0.997557 | 3.36306 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-11-20T16:35: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": "2dec244d96... |
d969dbd6-a427-4c7c-b481-c28207b95bda | ishandutta2007/codeforces-k | kpw29/normal/759/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int>... | ALGO | 0.999666 | 3.253958 | {
"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": "fc98a047b708... |
9b9b75c4-8bde-46a5-9b4a-0c3ccb8126eb | N3dal/cpp-homework | cpp_files/q13.cpp | /* Question 13:
Write a C++ program to which reads n digits chosen from 0 to 9,
and counts the number of combinations where the sum of the digit equals the given number?
*/
#include <iostream>
using namespace std;
int main(void){
// note: max int number is '2147483647', any number above it,
// it will cause... | ALGO | 0.999263 | 5.02035 | {
"github_metadata": {
"branch": "main",
"commit_count": 45,
"repo_created_at": "2022-07-26T20:00:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1c0b9ff3de0... |
4b81f6b0-e5af-4362-ab66-d5a7de548295 | jxzhsiwuxie/cppPrimer | chap11/exercises/ex_11.9.cpp | //练习 11.9:定义一个 map,将单词与一个 list 的行号关联,list 中保存的是单词所出现的行号。
#include <cstddef>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <sstream>
#include <string>
using std::cout;
using std::endl;
using std::getline;
using std::ifstream;
using std::istringstream;
using std::list;
using std::map;
u... | TOOL | 0.967493 | 4.231429 | {
"github_metadata": {
"branch": "master",
"commit_count": 376,
"repo_created_at": "2020-01-13T12:29:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4cf59d2f... |
9032db9f-95c1-4fe3-bb94-4a94cc05c8ac | anik804/Competitive-Programming-Concepts | Data Structures & Algorithm Topics/Linked List/Deletion/Delete_A_Node_With_A_Given_Value.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
};
struct Node* Delete_Given_Value( struct Node* head , int value )
{
struct Node* p = head;
struct Node* q = head->next;
while( q->data != value && q->next )
{
p = p->next;
q = q->next;
... | ALGO | 0.999986 | 5.09412 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-09-22T17:48: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": "d62e8476ba75... |
a72b65bb-ee43-4f63-961f-7a1978746b16 | mwashief/step | Codeforces/1001-1250/1216/1216E1.cpp | /*
<NAME>
14 February 2021
Codeforces 1216E1
*/
#ifndef DEBUG
#pragma GCC optimize("O2")
#endif
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define rep(i, n) for (int i = 0; i < n... | ALGO | 0.999623 | 3.708508 | {
"github_metadata": {
"branch": "master",
"commit_count": 1440,
"repo_created_at": "2020-06-25T20: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": "321d13f... |
7344bc0f-6b0d-4a4c-b53b-9755091f4978 | heisenbuug/DSA | Arrays/Q25/main.cpp | #include <iostream>
using namespace std;
int main()
{
int m, n;
cout << "Enter both dimensions if the array: ";
cin >> m >> n;
int foo1[10][10], foo2[10][10];
cout << "Enter elements of first matrix: " << endl;
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
... | ALGO | 0.999838 | 4.095818 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-07-27T22:26:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "657cefbeb4... |
4f4e8604-5093-4a73-b555-ff1d7fbfdc45 | CHaron1244/SCUT_TEXTBOOKS | SCUT exam question/数据结构/自我总结ppt内容/Graph/Kruskal’s MST Algorithm.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int M = 200010;
const int INF = 0x3f3f3f3f;
int n, m;
int cnt = 0;//cnt存当前加了多少条边。
int p[N];//存储并查集(parentof)
int result = 0;//result存的是最小生成树中所有数边的权重之和
struct Edge {
int a, b, w;//点a和b之间存在权重为w的边
bool operator< (const Edge &W ){//重载一下小于号,方... | ALGO | 0.999877 | 4.55598 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-12-15T05:15: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": "028e69b7c48b... |
28c6fff2-ffee-48a8-af71-14ec38242322 | metehkaya/Algo-Archive | Problems/Codeforces/Div_2/Codeforces_Rounds/Round_726/B.Bad_Boy.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> pi;
int T;
LL X[4];
LL Y[4];
LL n,m,x,y;
int main() {
scanf("%d",&T);
for( int tc = 1 ; tc <= T ; tc++ ) {
cin >> n >> m >> x >> y;
X[0] = 1 , Y[0] = 1;
X[1] = 1 , Y[1] = m;
X[2] = n ... | ALGO | 0.999503 | 3.255221 | {
"github_metadata": {
"branch": "main",
"commit_count": 78,
"repo_created_at": "2023-04-04T19:44: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": "da7cf67e478... |
a31b3c65-9577-40ba-9d42-bc1a809dd1be | xiryss/Elderly-Passion-Fruit-teambook | content/math/XorConvolution.cpp | /**
* Author: <NAME>
* Date: 2022-11-08
* Description: Calculating xor-convolution of 2 vectors modulo smth
* Time: O(n\log(n))
*/
void fwht(vector<int>& a) {
int n = a.size();
for (int l = 1; l < n; l <<= 1) {
for (int i = 0; i < n; i += 2 * l) {
for (int j = 0; j < l; ++j) {
int u = a[i + j... | ALGO | 0.999994 | 5.937473 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2022-10-13T23:02:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f5ee9f2871d... |
2f44de40-6f00-4064-9eb7-57eb05c4a6c1 | ASSERT-KTH/Supersonic | predictions/submissions-aizu-cot-gpt35/Codenet/p01370/302816359/response_3.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, b) for (int i = 0; i < b; i++)
#define m_t 60
#define max (3 * m_t * (m_t + 1) + 1)
#define zero (max / 2)
#define mp make_pair
int dx[6] = {0, 1, -1, 1, -1, 0};
int dy[6] = {1, 1, 0, 0, -1, -1};
int main() {
int t, n;
whi... | ALGO | 0.999954 | 3.705018 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-02-03T10:33:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "03c70cc2f3955... |
f6498e9a-b04a-40db-81f1-4f9cfd9bf3e6 | jsambhav5/DSA | Revision/Hashing/TwoSum.cpp | // LeetCode : 1 - Two Sum (https://leetcode.com/problems/two-sum/description/)
// TUF+ : Two Sum (https://takeuforward.org/plus/dsa/arrays/faqs-medium/two-sum)
/*
Topics and Learnings:
Approach:
Used Hashing to solve this
Complexity Analysis:
TC: O(N)
SC: O(N)
*/
#include<bits/stdc++.h>
using namespace std;
class ... | ALGO | 0.999972 | 5.843149 | {
"github_metadata": {
"branch": "main",
"commit_count": 422,
"repo_created_at": "2023-11-20T08:52: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": "f1828cdf97... |
a5c80e15-303e-4465-9472-fd59a042f5ad | vitsalis/project-euler | prob-30/prob30.cpp | #include <cstdio>
#include <cmath>
using namespace std;
long long int powDigitSum( int num ) {
long long int sum = 0;
while ( num > 0 ) {
if ( num % 10 != 0 ) {
sum = sum + ( pow( num % 10, 5 ) );
}
num /= 10;
}
return sum;
}
int main() {
int len = 1, k = 10, curr = 2;
long long int sum = 0;
while... | ALGO | 0.999369 | 4.236373 | {
"github_metadata": {
"branch": "master",
"commit_count": 79,
"repo_created_at": "2012-08-27T20:45:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "8ea9c5078... |
a283e04b-1a6a-4749-985d-d649e81ee496 | IamLJT/huawei | bihua.cpp | /*
题目:笔画
要求:首先输入坐标系上的点数个数,然后输入点的坐标,请判断这张图是否可以一笔画出,
并输出画线顺序 (每条线段必须经过一次,且只能经过一次。每个端点可以经过多次。)
思路:首先判断该结构是否是图,即是否包含环,若是图结构,根据欧拉定理,其奇点数为
0或2才能1笔画完,否则不能。
*/
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>
using namespace std;
struct comp
{
comp(int const& s):_s(s){}
bool op... | ALGO | 0.999965 | 4.434472 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2016-07-08T12:25:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad2cca60c... |
0bf59034-8703-4c01-ac7c-b328f38f2688 | zaforf/competitiveprogramming | cses/introductory/string-reorder.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s; cin>>s;
int freq[26] = {0};
for (char c : s) freq[c - 'A']++;
if (*max_element(freq, freq + 26) > (s.length() + 1) / 2) {
cout << "-1";
return 0;
}
int l = s.length();
char last = -1;
while (true) {
... | ALGO | 0.999959 | 3.797363 | {
"github_metadata": {
"branch": "master",
"commit_count": 122,
"repo_created_at": "2021-12-23T22:57: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": "dce2d8e8... |
3fef5979-0956-47b9-8698-43fac73fc4a4 | MostafaAE/LeetCode | 0654-maximum-binary-tree/0654-maximum-binary-tree.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.999992 | 6.806385 | {
"github_metadata": {
"branch": "master",
"commit_count": 3923,
"repo_created_at": "2022-09-06T16:24:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac3b4c7... |
a5c4606a-c0bb-49c9-b396-dadc7165eba9 | juliet-bradford/leetcode-submissions | solutions/110_Balanced_Binary_Tree.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.999889 | 6.344652 | {
"github_metadata": {
"branch": "main",
"commit_count": 39,
"repo_created_at": "2023-07-31T20:06: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": "51b221d090b... |
0588f653-dea5-4fcb-8c31-f19c251e32ae | wujiapei/alldata | dataOlap/doris-versions/doris-1.0-SNAPSHOT/be/src/vec/common/volnitsky.h | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | ALGO | 0.996606 | 6.943071 | {
"github_metadata": {
"branch": "master",
"commit_count": 362,
"repo_created_at": "2022-08-23T06:26:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "676663d4... |
52df43ee-2382-4f6b-b3d7-1d5af4aba236 | piyushmishraji123/Striver_Sheet | basic maths/basicsfunction.cpp | // function in c++
/*#include <iostream>
using namespace std;
void print()
{
cout<<"<NAME> ";
}
int main()
{
print();
print();
}
*/
// function with parameter
/*#include <iostream>
using namespace std;
void printName(string name)
{
cout<<"<NAME>"<<name;
}
int main()
{
string name;
cin>>name;
printName(name);
}*/
/... | TOOL | 0.985104 | 4.929298 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-02-28T06:17:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cdb9720ca6c6... |
a696df43-f3b3-434d-b89d-95743400a55f | daniCh8/eth-algolab-2019 | week2/burning_coins/burning_coins.cpp | /**
* It's a dp where the memory saves how much coins you can win given the starting and ending position inside the vector of coin.
* Your "friend" will play to minimise your winnings, so he will always take the coin that will minimise your possible winnings in the next round.
* You, obviously, want to maximise your... | ALGO | 0.999946 | 5.210268 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2020-01-29T17:12:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 16,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "09d9fc15... |
aebecf84-4c14-494c-abf8-dd17aae4b884 | Ishanis-CoderMan/CPP-Program-Data-Structure | 08_strings/02_strlen_vs_length.cpp | /*
Different methods to find length using sizeof() | strlen() | length() | size()
- Using sizeof() Function
sizeof(variable)/sizeof(datatype) : It's output will be total number of varaiable(int, char, string, etc)
- Using strlen(const char *str) Function
strlen(charArr) : This function return... | TOOL | 0.979992 | 4.154676 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-12-31T04:24:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb71a30eb0... |
7d940892-ed1b-4f9c-a6d5-1de824ec187b | yxd0379/Basic-algorithm-exercise | src/cpp/ex9.cpp | #include <iostream>
#include <ostream>
#include <limits>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <iterator>
#include <ctime>
#include "../headers/ex9.h"
using namespace std;
namespace ex9
{
struct node_info
{
public:
node_info (int i,int w)
... | ALGO | 0.99947 | 3.335835 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-10-28T04:27: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": "9484b6046887... |
a72abfe3-b02d-457b-9a0b-c23f1719693d | nexif/Algorithms-and-Data-Structures-UJ | Graph with Dijkstra and AStar/graph.h | #pragma once
#include <cstdint>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <queue>
#include <optional>
#include <iostream>
using namespace std;
// Uwaga! Kod powinien być odporny na błędy i każda z metod jeżeli zachodzi niebezpieczeństwo wywołania z niepoprawnymi parametrami pow... | ALGO | 0.986884 | 6.004769 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2020-11-10T19:36: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": "c4b737cd8ec7... |
1201a365-8704-4749-992f-23671f1d3723 | ARUNULAGAPPAN/Leetcode_Solutions | 0662-maximum-width-of-binary-tree/0662-maximum-width-of-binary-tree.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.999589 | 5.540638 | {
"github_metadata": {
"branch": "main",
"commit_count": 1403,
"repo_created_at": "2025-06-01T16:15: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": "9ad5e28f0... |
dbf0ab26-f81d-4bde-b527-64226c3ee8e0 | st42597/BOJ-Storage | 소수-쌍/소수-쌍.cpp | #include <bits/stdc++.h>
using namespace std;
int arr[53], a[53], b[53], n;
bool sosu[2003], visit[53];
vector<int> ans;
bool dfs(int x)
{
if(visit[x]) return false;
visit[x] = true;
for(int i = 1; i <= n; i++)
{
if(sosu[arr[x] + arr[i]]) continue;
if(b[i] == -1 || dfs(b[i]))
{
... | ALGO | 0.999956 | 3.609722 | {
"github_metadata": {
"branch": "main",
"commit_count": 129,
"repo_created_at": "2022-01-04T19:21: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": "7f4ebe6097... |
e6cc3354-eed3-4672-9010-3102551c9540 | lausai/UVa | 2_stars/127.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class pile {
public:
vector<string> vs;
pile *pre_node, *next_node;
pile(string s);
};
pile::pile(string s)
{
vs.push_back(s);
}
void play(pile*);
void release();
bool isMovable(pile*, pile*);
void rmNodeFromList(pile*);
int piles();
... | ALGO | 0.99843 | 4.023388 | {
"github_metadata": {
"branch": "master",
"commit_count": 62,
"repo_created_at": "2014-05-29T13:00: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": "3800c8e0d... |
bf3831ce-fef6-4a8e-8840-72e08769ffb1 | zlarosav/competitive-programming | Theme Roadmap/Grafos/Flood Fill Alg.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.cpp"
#else
#define dbg(...)
#endif
using namespace std;
void solve() {
int N, M; cin >> N >> M;
vector<vector<int>> image(N, vector<int>(M));
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cin >> image[i][j];
}
}
int sr, sc, c... | ALGO | 0.999581 | 4.868527 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-04-25T23:07:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d247cca7446d... |
8f8b2af3-a91c-4006-9ea3-8f0937f0c6dd | lballabio/QuantLib | ql/math/matrixutilities/getcovariance.hpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2003, 2004, 2009 <NAME>
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
Q... | ALGO | 0.998801 | 7.213778 | {
"github_metadata": {
"branch": "master",
"commit_count": 17543,
"repo_created_at": "2015-12-17T16:29:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6151,
"forks": 1964,
"issues": 51,
"pull_requests": 11
},
"file_meta": {
"content_id":... |
aa8e2150-0eb0-4271-8efc-156a2956dcd8 | Minipoloalex/comp_prog | atcoder/problems/365/problemE/problemE.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &x: a) cin >> x;
int64_t ans = 0;
for (int b = 0; b < 31; b++) {
int pref = 0;
vector<int> freq = {1, 0};
for (int i = 0; i < n; i++) {
int bit = (a[i] ... | ALGO | 0.999953 | 4.525075 | {
"github_metadata": {
"branch": "main",
"commit_count": 529,
"repo_created_at": "2023-08-01T10:35: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": "546cab1d0c... |
0ce5b002-b8ce-4b19-bcab-6783cf45ed7e | chandakash/Leetcode | construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.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.999992 | 6.643756 | {
"github_metadata": {
"branch": "master",
"commit_count": 183,
"repo_created_at": "2021-05-05T05:20: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": "90f290cd... |
17136833-c1e0-401c-a3e7-83d2bdb840cd | immuntasir/competetive-programming | library/nthFibonacci.cpp | // This will hopefully generate the nth fibonacci number modulo something
// n is a 32-bit integer
// the modulus value is 10^9 + 7
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
void print(int ara[2][2]) {
for (int i=0; i<2; i++) {
for (int j=0; j<2; j++) printf("%d ", ara[i][j]);
... | TEST | 0.97244 | 3.508273 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2016-10-12T02:08: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": "74cd3b5bf... |
6797d0e3-d385-4bbb-9cdb-8cf9aeaf6f14 | Yashwantoo7/dsac- | algo/TopView BottomView/main.cpp | #include <iostream>
#include <queue>
#include <map>
using namespace std;
class Node{
public:
int data;
Node* left;
Node * right;
Node(){
data=0;
left=NULL;
right=NULL;
}
};
void topView(Node *root)
{
queue<pair<int ,Node * >> q;
map<int,vector<int>> Map;
q.pus... | ALGO | 0.999989 | 4.717906 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-02-24T04:03: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": "0920ce4d12... |
b73d9cf9-a5ee-4ac8-83c8-c47de5689b74 | AndrewChebli/evolutionary-algorithm | test.cpp | #include "evol-puzzle.h"
#include <assert.h>
#include <sstream>
/**
* @brief Compares two arrays for equality.
*
* This function checks if two arrays of integers are equal by comparing
* each element. The arrays are assumed to have a size of TILE_SIZE.
*
* @param arr1 The first array to compare.
* @param arr2... | TEST | 0.978091 | 6.288385 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2024-09-22T23:57:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af7739907de... |
08adf4cc-71aa-40e7-9ee3-8d1cc94e2505 | JiekangHuang/Arduino | p2_4_2For_Digit_SegmentV1/p2_4_2For_Digit_SegmentV1/p2_4_2For_Digit_SegmentV1.ino | //使用四位數七段顯示器當計數器
// 定義共陽極與 Arduino 的腳位對應關係
#define CA1 30
#define CA2 31
#define CA3 32
// 定義每個七段顯示器顯示的時間 (延遲時間), 預設 1ms
int delay_time = 4;
void setup() {
pinMode(2, OUTPUT); //14 > 2 A
pinMode(3, OUTPUT); //13 > 3 B
pinMode(4, OUTPUT); // 8 > 4 C
pinMode(5, OUTPUT); // 7 > 5 D
pinMode(6, OUTPUT); // 6 > ... | TOOL | 0.907741 | 5.514317 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2019-05-01T07:11:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b7c013db6... |
6da3f9d8-5dcd-451c-81f2-15f6e3aac81c | ngsengleng/aoc2023 | day1/part2.cpp | #include "parts.h"
class Part2 {
private:
bool hasKey(const std::unordered_map<std::string, std::string>& hashmap, std::string s) {
return hashmap.find(s) != hashmap.end();
}
std::string getNumber(std::string& s,
int idx,
... | ALGO | 0.976829 | 4.846153 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2023-12-02T18:00: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": "9fc311d43ed... |
6703344c-8f66-4a48-b37c-871848927fc6 | Sup3rFire/CP | loaling/A_Tavas_and_Nafas.cpp | #include <bits/stdc++.h>
using namespace std;
// loal is a cute girl
#define ll long long
#define ld long double
#define pow2(x) (x)*(x)
#define le left
#define ri right
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define pll pair<long, long>
#d... | ALGO | 0.993019 | 4.532294 | {
"github_metadata": {
"branch": "main",
"commit_count": 109,
"repo_created_at": "2023-08-15T16:33: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": "5fbbdecaf0... |
94a27854-cc3f-4414-a702-277430e838f4 | mathCrazyy/leetcode_test | cpp_code/datawhale_algrithom/lesson_4/hash_map.cpp | /*
链表法解决散列冲突的问题.https://blog.csdn.net/ynnusl/article/details/89343419
*/
#include<iostream>
using namespace std;
#define N_vec 20 //数组数量
#define NhashSlot 7 //哈希槽的数量,7个存储数据的一级位置,
#define N_R 200 //一共的上限?
//数据节点
class Node{
public:
Node();
void init_key_link(int key);//初始化第一个key落到的位置,将作为该位置的头节点。(initPnode)
int ... | ALGO | 0.9999 | 3.644168 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-04-13T15:05: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": "5c70359a6c... |
f55a4bf3-c9e0-4853-875a-11543f9769ca | Sort-Care/ACM | PC Code/uva11926.cpp | /*
* Uva 11926
* Author: <NAME>
* Input:
* First line: n m (n: the number of one-time task)
* (m: the number of repeating task)
* Following n lines:
* each line: two num, start and end time
* Following m lines: start, end, and interval
* All numb... | ALGO | 0.999874 | 3.357105 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-08-29T01:30: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": "33ac383a5b... |
6ccb2134-3e32-4336-8140-1aee5e1293fa | Vishesh-code-22/Coding-Questions | 01-Subtract the Product and Sum of Digits of an Integer-1281.cpp | class Solution
{
public:
int subtractProductAndSum(int n)
{
int prod = 1;
int sum = 0;
while (n)
{
int val = n % 10;
n = n / 10;
prod = prod * val;
sum = sum + val;
}
return prod - sum;
}
};
// Given an integer ... | ALGO | 0.999855 | 5.953186 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-05-19T11:33: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": "35952803555a... |
4bf3565a-e6df-4d7c-9d4d-50ba67bb1fc5 | DGankutsuou/Algorithmes_level_2 | Problem#18_2encrypt.cpp | #include <iostream>
#include <string>
using namespace std;
string read_text()
{
string text = "";
cout << "Enter your text: ";
getline(cin, text);
return text;
}
string encrypt(string text, short encryption_key)
{
int length = text.size();
for(int i = 0; i < length; i++)
{
text[i]... | ALGO | 0.994078 | 4.179081 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-11-13T15:49: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": "1d33347a80... |
082f77fc-28eb-4940-8356-6e56f7458fda | mongodb/mongo | src/third_party/boost/libs/graph/include/boost/graph/floyd_warshall_shortest.hpp | // Copyright 2002 Rensselaer Polytechnic Institute
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: <NAME>
// <NAME>
/*
This file implements the functions
template <class VertexListG... | ALGO | 0.999588 | 6.608881 | {
"github_metadata": {
"branch": "master",
"commit_count": 90314,
"repo_created_at": "2009-01-15T16:15:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 27329,
"forks": 5655,
"issues": 0,
"pull_requests": 82
},
"file_meta": {
"content_id": ... |
d0666c6c-988c-4277-afc0-e4f5bd047162 | Monirul1/Binary-tree | Binary tree/main.cpp | #include <iostream>
#include <queue>
using namespace std;
struct Node
{
int data;
struct Node *left, *right;
};
void printLevelOrder(Node *root);
Node* newNode(int data);
int main()
{
Node *root = newNode(3);
root->left = newNode(9);
root->right = newNode(20);
root->left->left = newNode(15);... | ALGO | 0.999994 | 5.377947 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-12-27T15:58:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4562b778e9... |
839e941c-a25f-4473-854d-a70e289a550c | ishandutta2007/codeforces-a | aid/normal/715/A.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long ll;
typedef long double ld;
const int inf = (int) 1e9 + 100;
cons... | ALGO | 0.98805 | 3.754834 | {
"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": "a5f944ae0854... |
f0cf0d31-6f64-431f-829c-081207481bd2 | emilyju0314/gpt_code_plagiarism | dataset/code_content_classifier/ai_code/train/0_0_10444.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define MOD 1000000007
using namespace std;
struct Barrier {
int row, left, right, height;
};
bool compareLeft(const Barrier& b1, const Barrier& b2) {
return b1.left < b2.left;
}
bool compareRight(const Barrier& b1, const Barrier& b2) {
return ... | ALGO | 0.999952 | 4.239412 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-04-28T03:59: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": "49990ae04f6... |
d450fe22-8bed-4378-9080-974ce506d969 | nirfast-admin/NIRFAST | toolbox/mex/meshing_mex/orient3d_mex.cpp | #include "mex.h"
#include "geomath.h"
#ifndef TinyZero
#define TinyZero 1e-10
#endif
// inflag = orient3d_mex(pa, pb, pc, pd)
/* Return a positive value if the point pd lies below the */
/* plane passing through pa, pb, and pc; "below" is defined so */
/* that pa, pb, and pc appear in counterclockwise order when... | ALGO | 0.999434 | 5.571491 | {
"github_metadata": {
"branch": "master",
"commit_count": 451,
"repo_created_at": "2015-11-16T20:50:50.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 28,
"forks": 20,
"issues": 8,
"pull_requests": 2
},
"file_meta": {
"content_id": "2dc534e... |
d16608c0-6b04-40d0-b110-4091c42c55fa | harshk461/Practice | Course_Schedule_II.cpp | class Solution
{
public:
bool findtopo(stack<int> &st, int i, vector<int> adj[], vector<int> &vis, vector<int> &dfsvis)
{
vis[i] = 1;
dfsvis[i] = 1;
for (auto node : adj[i])
{
if (!vis[node])
{
if (findtopo(st, node, adj, vis, dfsvis))
... | ALGO | 0.999995 | 5.9917 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2022-09-15T08:17:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6183ec926... |
6dd73c81-0543-4940-abc9-41b6d75965da | wenbowen123/BundleTrack | src/Thirdparty/igl/copyleft/cgal/point_segment_squared_distance.h | // This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2016 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.... | ALGO | 0.998403 | 6.385682 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-10-12T02:03:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 659,
"forks": 70,
"issues": 11,
"pull_requests": 1
},
"file_meta": {
"content_id": "d1a757... |
3e5a74af-d94d-4c58-8a67-2a033ff1cfa7 | ishandutta2007/codeforces-z | zeliboba/normal/226/B.cpp | #include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<l... | ALGO | 0.999813 | 3.145194 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:43: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": "03a9c67ceb4d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.