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 |
|---|---|---|---|---|---|---|---|
e50f6045-695d-4af2-9a0a-f7b41004b5e1 | DMU-XMU/PSR-MCTS-Offline | tiger/psrmcts-tiger/src/planners/mcp/psrmcts/psrmcts.cpp | #include "psrmcts.h"
#include <math.h>
#include <algorithm>
#include <iomanip>
#include "node.h"
using namespace std;
using namespace UTILS;
//-----------------------------------------------------------------------------
PSRMCTS::PARAMS::PARAMS()
: Verbose(0),
MaxDepth(100),
NumSimulations(1000),
Exp... | ALGO | 0.9998 | 4.129066 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2021-09-27T02:44:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5d104b91ac... |
ac524b7d-936d-4193-ac0f-34f4cf69ebf1 | itsmesuraj20/Leetcode-Practice | Vertical Traversal of Binary Tree - GFG/vertical-traversal-of-binary-tree.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999978 | 6.16947 | {
"github_metadata": {
"branch": "main",
"commit_count": 1782,
"repo_created_at": "2024-01-06T16:13:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee2ba4307... |
cfe438ee-67dc-4047-bb11-7ce107b1de20 | mihirsood/Leetcode_Monthly_Challenges | September Challenge/Week 1/CPP/Day_1/LargestTimeForGivenDigits.cpp | class Solution {
public:
inline int get_digit(vector<int> &digits, int i) {
for (; i>=0; --i){
if (digits[i]){
--digits[i];
return i;
}
}
return -1;
}
string largestTimeFromDigits(vector<int>& arr) {
vector<int> digits... | ALGO | 0.999855 | 5.690545 | {
"github_metadata": {
"branch": "master",
"commit_count": 351,
"repo_created_at": "2020-06-03T07:11:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc0df1c8... |
dcf8cec8-18a9-4dc7-8806-57bdb20e721b | flarish1138/Competitive-Programing | codeforces/practice/A_Cheap_Travel.cpp | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main()
{
double n, m, a, b;
long long int mn = LONG_LONG_MIN;
cin >> n >> m >> a >> b;
double c, d, e;
if(n==1){
mn = min(a,b);
cout<<mn<<endl;
}
else
if (n == 1000 )
{
c = ceil(b / m);
... | ALGO | 0.999795 | 3.066297 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-04-19T05:32: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": "5cab47def6... |
a6f4cea3-f0a0-4ce4-8de0-c2ead0620023 | aryan4593/Code-Help-love-babbar-DSA-series-code-topic-wise- | 5 - LECTURE 85 -101 Graphs/Lecture 85 - Graph info/3Implement.cpp | #include<iostream>
#include<map>
#include<list>
#include<unordered_map>
using namespace std;
template<typename T>
class graph {
public:
unordered_map < T , list<T> > adj;
void addEdge(T u , T v , bool direction){
// direc -> 0 means und graph 1 means directed graph
// crea... | ALGO | 0.999802 | 4.949549 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-01-25T08:42: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": "6a8e8797f8c1... |
f284c583-b97c-4883-a442-505f071f84d5 | solanki018/DSA-SUMMER | ARRAY/2MEDIUM/5_arr_pos_neg.cpp | // Problem Statement:
// There’s an array ‘A’ of size ‘N’ with an equal number of positive and negative elements. Without altering the relative order of positive and negative elements, you must return an array of alternately positive and negative values.
// Example 1:
// Input:
// arr[] = {1,2,-4,-5}, N = 4
// Output:... | ALGO | 0.999996 | 5.231344 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-04-18T14:30: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": "23c80d16eca0... |
bcf932d0-f186-4ead-9418-17ac228b66a8 | mansig20/DSA_Striver | pattern/pattern-1.cpp | #include <iostream>
using namespace std;
void printPattern1(int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cout << "*";
}
cout << endl;
}
}
void printPattern2(int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j <= i; j++... | ALGO | 0.999946 | 3.873571 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-03-07T08:01:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee2179a4f46... |
4a7e36bb-4134-4830-9a7d-2cd4eda07704 | littledou2013/PAT | pat_1060.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int N;
char str1[110], str2[110];
int getExp(char str[])
{
//这里只要找小数点和第一个不为0的数字就可以了
int index = 0;
int last = 0;
int length = strlen(str);
while (index < length)
{
if (str[index] == '.')
break;
++index;
}
while (last < length)... | ALGO | 0.999511 | 3.058468 | {
"github_metadata": {
"branch": "master",
"commit_count": 97,
"repo_created_at": "2014-07-30T08: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": "8546f0241... |
edc66cfa-a79f-47c4-b7af-24e6c9069e25 | yekesit/Algorithms | Leetcode/LT_0038_count_and_say.cpp | #include <iostream>
using namespace std;
class Solution {
public:
/*
* 难度不大,就是一个正常的处理流程。
* 关键是领会一下中间的计算过程
*
* 11122333
* 如何计算开始的3个1??
* j 从 0 开始 一直找。找到j + 1 和j不同 或者j + 1到头了 >> j + 1 == res.length()
* 那么j就停下来了。。
* j停在哪??
* j停在最后一个与开始j = 0 相同的字符处。
* 这个循环的作用要搞清楚。。。。... | ALGO | 0.999995 | 5.087629 | {
"github_metadata": {
"branch": "master",
"commit_count": 84,
"repo_created_at": "2021-04-23T05:39:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1284a1988... |
527252d0-9aea-4879-9a2a-221c510546c3 | WBowden/Dijkstra-in-openGL_GSP295 | William Bowden_iLab 6_Dijkstra/graph.h | #pragma once
#include <Windows.h>
#include "vec2.h"
#include <vector>
using namespace std;
class Node;
const int STD_COLOR_BLACK = 0x000000;
const int STD_COLOR_BLUE = 0xff00000;
struct Edge
{
Node * from, *to;
float cost;
Edge(Node * start, Node * end);
void draw();
};
class Node
{
public:
vector<Edge> edges... | ALGO | 0.985848 | 3.746843 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-03-15T06:42: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": "15c522aee1... |
3c2fb8ee-ecea-4f73-a202-1562f4c39871 | panther03/bombyx | tests/explicit/fib.cc | #include "cilk_explicit.hh"
THREAD(fib);
THREAD(sum);
THREAD(main_cont);
CLOSURE_DEF(fib,
int n;
);
CLOSURE_DEF(sum,
int arg1;
int arg2;
);
CLOSURE_DEF(main_cont,
int fibResult;
);
THREAD(sum) {
sum_closure *sum_args = (sum_closure*)(args.get());
SEND_ARGUMENT(sum_args->k, sum_args->arg1 ... | ALGO | 0.99475 | 5.632668 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2025-05-09T11:36:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 11,
"pull_requests": 0
},
"file_meta": {
"content_id": "10473c6105... |
d8b14ce0-d274-425c-a2a5-e6d31139a8a4 | official-mafuzalam/understanding_cpp | class_problem/class4/prob1.cpp | #include <iostream>
using namespace std;
class Rect2;
class Rect1
{
int hight, width;
public:
Rect1(int h, int w)
{
hight = h;
width = w;
}
friend void compare(Rect1 rt1, Rect2 rt2);
};
class Rect2
{
int hight, width;
public:
Rect2(int h, int w)
{
hight = h;... | TOOL | 0.983267 | 4.14165 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2024-01-18T03:54: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": "6a6a2b05d74... |
2f329ba1-be60-4114-8c61-e0583c1a3216 | teofrank10/Numerical-Simulation-Lab | Lab5/source/ex5.1_Unif.cpp | #include <iostream>
#include <fstream>
#include <random.h>
#include <vector>
using namespace std;
//==========================Wave functions=========================//
double psi_100(double pos[], int dim){
double r = 0;
for (int i = 0; i < dim; i++){
r += pos[i]*pos[i];
}
return exp(-2.* sqrt(r));
}
double p... | ALGO | 0.999386 | 3.049154 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2018-11-28T11:53: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": "bdac67f68... |
826b9da5-ad52-40c4-93ab-3895415566dd | syntnc/Competitive-Coding | HackerRank/Algorithms/Search/Maximum Subarray Sum.cpp | #include<bits/stdc++.h>
using namespace std;
long long maxSubarraySum(long long arr[], int n, long long m)
{
long long x, prefix = 0, max_sum = 0;
set <long long> S;
S.insert(0);
for (int i = 0; i < n; i++) {
prefix = ((prefix % m) + (arr[i] % m)) % m;
max_sum = max(max_sum, prefi... | ALGO | 0.999927 | 4.290179 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2017-06-17T17:29:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4583a4368... |
419bdb48-0871-41f8-ac15-b3ba8929a592 | Chitvan14/LearningCplusplus | Searching/Binary Search/SearchInRotatedSortedArrCN.cpp | #include <iostream>
#include <vector>
using namespace std;
int FindPivot(vector<int> arr, int size)
{
int start = 0, end = size - 1, mid = start + (end - start) / 2;
while (start < end)
{
if (arr[mid] >= arr[0])
{
start = mid + 1;
}
else
{
e... | ALGO | 0.999998 | 5.454796 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2022-07-01T13:39: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": "e37d72c98... |
aab5be78-b961-4093-b31e-1ce672b37ce3 | princekeshriabc/DSA | Heap/Medium_And_Hard_problems/Design Twitter.cpp | // Design Twitter
// https://leetcode.com/problems/design-twitter/solutions/5784646/simple-solution-heap-beats-100/
// Time complexity: O(10log(p.size()))
// Space complexity : O(p.size() + 501)
class Twitter
{
priority_queue<vector<int>> p, temp;
set<int> following[501];
int post = 1;
public:
Twitt... | ALGO | 0.999548 | 6.565959 | {
"github_metadata": {
"branch": "main",
"commit_count": 81,
"repo_created_at": "2024-06-02T07:15: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": "42e30b27058... |
cde38359-d66e-4915-8f82-f7f4869ff32d | Akanksha-1609/Sudoku-Solver | Sudoku_Solver.cpp | #include<iostream>
using namespace std;
void input(int sudoku[9][9])
{
cout<< "Enter the Unsolved Sudoku "<<endl;
for(int i=0 ; i<9 ; i++)
{
for(int j=0 ; j<9 ; j++)
{
cin >> sudoku[i][j];
}
}
}
void print_solution(int sudoku[9][9])
{
cout<<"The solution is "<<en... | ALGO | 0.99968 | 5.116333 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-08-21T16:43:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d957e11afd4f... |
8b448239-62ae-431b-9b3d-4969f7dc0055 | UMThorntonGroup/phaseField_ANN | src/matrixfree/reassignGrains.cc | #include "../../include/matrixFreePDE.h"
#include "../../include/FloodFiller.h"
#include "../../include/SimplifiedGrainRepresentation.h"
#include "../../include/OrderParameterRemapper.h"
//vmult operation for LHS
template <int dim, int degree>
void MatrixFreePDE<dim,degree>::reassignGrains () {
//log time
c... | ALGO | 0.965702 | 4.957432 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-03-13T20:35:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "493bdc2babb... |
7924fd73-8d47-4aa7-93e0-db4882e2ddff | suu3/Algorithm | 2022/baekjoon/큐, 덱/1966.cpp | // 1966 프린터 큐
#include <iostream>
#include <queue>
#include <vector>
#include <map>
using namespace std;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin >> T;
while(T--){
int n, m;
cin >> n >> m;
int arr[n];
map<int, i... | ALGO | 0.999991 | 4.036519 | {
"github_metadata": {
"branch": "master",
"commit_count": 110,
"repo_created_at": "2021-01-29T17:09: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": "c6f77f78... |
ef450229-539b-4bcc-8cda-d5277c3e9775 | viridia/Mint | include/mint/support/CommandLine.h | /* ================================================================== *
* Mint.
* ================================================================== */
#ifndef MINT_SUPPORT_COMMANDLINE_H
#define MINT_SUPPORT_COMMANDLINE_H
#ifndef MINT_COLLECTIONS_ARRAYREFREF_H
#include "mint/collections/ArrayRef.h"
#endif
#ifndef ... | TOOL | 0.91368 | 7.349557 | {
"github_metadata": {
"branch": "master",
"commit_count": 101,
"repo_created_at": "2011-11-01T23:51:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 1,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "9cbdb52d... |
3d185eee-f2a5-455f-996d-a23d0ddbfb22 | czhu1217/competitive-programming | Olympiads/coci15c1p4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int ... | ALGO | 0.999822 | 4.085247 | {
"github_metadata": {
"branch": "master",
"commit_count": 282,
"repo_created_at": "2019-10-11T16:26:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c090c77... |
dbd8ff4f-5103-4833-8017-2c198aef489e | SDC-GS-STUDY/21-autumn-datastructure-study | week07/eiloppang/eiloppang_연습문제5강10번.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#define MAX_QUEUE_SIZE 5
typedef int element;
typedef struct {
element data[MAX_QUEUE_SIZE];
int front, rear;
} QueueType;
// Error Handling
void error(const char* message)
{
fprintf(stderr, "%s\n", message);
exit(1);
}
// Queue initializat... | ALGO | 0.999762 | 4.25997 | {
"github_metadata": {
"branch": "main",
"commit_count": 319,
"repo_created_at": "2021-09-08T12:50:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b6353de2e2b... |
64d8898f-3cb8-4b1c-900a-47eead17bb45 | miguelAlessandro/CompetitiveProgramming | codeforces/616C.cpp | #include <bits/stdc++.h>
using namespace std;
struct point{
int x, y;
point(){}
point(int xx, int yy): x(xx), y(yy) {}
bool operator==(const point& p){
return x == p.x and y == p.y;
}
bool operator!=(const point& p){
return x != p.x or y != p.y;
}
};
const int N = 1005;
const int dx[4] = {1, 0, -1, 0},
... | ALGO | 0.99998 | 3.43956 | {
"github_metadata": {
"branch": "master",
"commit_count": 514,
"repo_created_at": "2016-02-16T22:01:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5ec051c2... |
a36df9d9-ecbd-41e5-9d8b-c3d9a2df11af | patrick-kook/Capstone-Design | core/path_planner/path_planner/include/path_planner/graph_planner/astar_planner.h | /**
* *********************************************************
*
* @file: a_star.h
* @brief: Contains the A* (dijkstra and GBFS) planner class
* @author: <NAME>
* @date: 2023-12-12
* @version: 1.2
*
* Copyright (c) 2024, <NAME>.
* All rights reserved.
*
* ---------------------------------------------------... | ALGO | 0.980422 | 6.038418 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2025-04-19T14:46:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efa5daee89bb... |
7bfa9bc0-e805-4bd0-8572-c8603f798c8b | canach3/Baekjoon-problem | 백준/Silver/25206. 너의 평점은/너의 평점은.cc | #include <iostream>
using namespace std;
int main() {
string subjectName;
double credit;
string grade;
double totalScore = 0;
double totalCredit = 0;
for (int i = 0; i < 20; i++)
{
cin >> subjectName >> credit >> grade;
totalCredit += credit;
if (grade == "A+") totalScore += credit * 4.5;
else if (gr... | ALGO | 0.98981 | 3.963354 | {
"github_metadata": {
"branch": "main",
"commit_count": 415,
"repo_created_at": "2023-09-02T04:11: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": "4c6937e0aa... |
18dcd3c0-799d-4c56-b59c-b0c4141aa795 | gilsaia/college-study | algorithm/welcome-to-nku/e.cpp | //思路应该是一样的···不知道自己写的哪个边界处理错了···找了半天找不到···
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#define mod 1000000007
using namespace std;
typedef long long ll;
int n,m;
int main()
{
int a[200001];
map<ll,ll> mp[11];
scanf("... | ALGO | 0.999806 | 3.459331 | {
"github_metadata": {
"branch": "master",
"commit_count": 531,
"repo_created_at": "2018-06-26T08:25: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": "bb1a384b... |
56f6c892-5e3f-4276-bae8-83148a2e2633 | alexandraback/datacollection | solutions_6404600001200128_1/C++/ponyopoppo/A.cpp | #include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i, a, b) for(int i = (a); i < (int)(b); i++)
#define rep(i, a) repi(i, 0, ... | ALGO | 0.999836 | 3.390545 | {
"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": "d87da8759... |
92d8b76c-552e-497a-b4ce-02d85adea15b | TimKingNF/leetcode | editor/cn/108.convert-sorted-array-to-binary-search-tree.h | //将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。
//
// 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。
//
// 示例:
//
// 给定有序数组: [-10,-3,0,5,9],
//
//一个可能的答案是:[0,-3,9,-10,null,5],它可以表示下面这个高度平衡二叉搜索树:
//
// 0
// / \
// -3 9
// / /
// -10 5
//
// Related Topics 树 深度优先搜索
#include "header.h"
namespace LeetCode108 {
st... | ALGO | 0.99999 | 6.29862 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2020-07-09T06:35:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd2be8c51... |
089bbfae-241c-49c2-b665-f178f73ab158 | ShreyanshKatiyar007/code_studio-coding_ninja | Ques_17.cpp | /*You are given an array of integers. You need to sort the array in ascending order using quick sort.
Quick sort is a divide and conquer algorithm in which we choose a pivot point and partition the array into two parts
i.e, left and right. The left part contains the numbers smaller than the pivot element and the right... | ALGO | 0.999984 | 6.197158 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2024-08-08T18:20: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": "0a5fdb136b2... |
8ebfc160-ed3f-4ce5-ae4e-5c820fb02c20 | TaoSama/ICPC-Code-Library | TODO/Meituan/Round 2/E.cpp | //
// Created by TaoSama on 2017-06-18
// Copyright (c) 2017 TaoSama. All rights reserved.
//
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define pr(x) cerr << #x << " = " << x << " "
#define prln(x) cerr << #x << " = " << x << endl
const int N = 1e5 + 10, INF... | ALGO | 0.999499 | 4.638357 | {
"github_metadata": {
"branch": "master",
"commit_count": 191,
"repo_created_at": "2016-03-24T05:56: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": "5832b582... |
040529ee-1796-4eba-8a4a-fa16dae181e6 | sagunms/ComputerVisionProjects | 3 - mvDetection/mvDetection/UnionFind.cpp | #include "UnionFind.h"
cUnionFind::cUnionFind() : elements(0), sets(0) {
}
cUnionFind::~cUnionFind() {
for (int i = 0; i < nodes.size(); i++) delete nodes[i];
nodes.clear();
}
node* cUnionFind::MakeSet(int i) {
if (elements + 1 > nodes.size()) nodes.push_back(new node);
nodes[elements]->parent = nodes[elements]... | ALGO | 0.991258 | 4.041733 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2013-07-21T13:06:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d262bca3... |
1c7a2691-8ce8-441e-9ae5-d7167ba383d8 | massquantity/LeetCode | 912_Sort_an_Array/quickSort2.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> sortArray(vector<int>& nums) {
int len = nums.size();
sortArray(nums, 0, len - 1);
return nums;
}
void sortArray(vector<int> &nums, int lo, int hi) {
if (hi <= lo) return;
... | ALGO | 0.999991 | 5.560936 | {
"github_metadata": {
"branch": "master",
"commit_count": 380,
"repo_created_at": "2018-05-29T13:04:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "72341d95... |
b0c92777-f755-4e78-841e-ad742d239bb1 | goswami-rahul/competitive-coding | HackerCup/23/Round1/c2.cpp | #ifdef Rahul
#include "RAHUL.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using i64 = int64_t;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline b... | ALGO | 0.999974 | 4.239276 | {
"github_metadata": {
"branch": "master",
"commit_count": 289,
"repo_created_at": "2018-07-27T19:31:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1b692f7... |
f1eafb9d-4d5f-4a1e-b53c-fa22d78376ee | 1122414/my_item | learn/algorithm/Bilibili_zuo/05_对数器/程序/Validator.cpp | #include<iostream>
#include<cmath>
using namespace std;
int global_n = 0;
void selectSort(int n, int arr[]){
for (int i = 0;i<n-1;i++){
int minIndex = i;
for (int j = i + 1;j<n;j++){
arr[j] < arr[minIndex] ? minIndex = j : minIndex;
}
swap(arr[i], arr[minIndex]);
}
}
void bubbleSort(int n, in... | ALGO | 0.995873 | 4.392967 | {
"github_metadata": {
"branch": "main",
"commit_count": 79,
"repo_created_at": "2025-02-04T03:22: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": "70345d57450... |
689226e3-74b5-4fd5-9ef5-d15476e0edff | jvujcic/cp | cpp/hackerrank/booking-com-back-end-code-sprint/good_memories_1.cpp | #include <iostream>
#include <unordered_map>
#include <algorithm>
#include <unordered_set>
#include <iterator>
#include <sstream>
#include <vector>
#include <chrono>
#include <thread>
using namespace std;
void dfs(unordered_map<string, unordered_set<string>> & graph, string s, unordered_set<string> & marked,
... | ALGO | 0.999845 | 4.820667 | {
"github_metadata": {
"branch": "master",
"commit_count": 50,
"repo_created_at": "2015-09-06T12:20:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 41,
"forks": 19,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f35e9bd... |
62bb8bcd-e349-4823-9ace-fc1869756ed1 | jobanpreetsinghnagra/AA_D | aad_lab/trav_graph.cpp | #include <bits/stdc++.h>
using namespace std;
class Graph {
private:
unordered_map<int, vector<int>> adjList;
public:
// Function to add an edge to the graph
void addEdge(int u, int v, bool isDirected = false) {
adjList[u].push_back(v);
if (!isDirected) {
adjList[v].push_back(u... | ALGO | 0.999967 | 6.737013 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2025-01-12T13:17: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": "538e1bdf6ce... |
939bfce7-f537-40bf-9e72-3ac3e4e80596 | google/monster-mash | third_party/libigl/include/igl/point_simplex_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.997509 | 6.164804 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2021-01-28T21:04:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1312,
"forks": 182,
"issues": 24,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0a985... |
4d2e1dea-ac4f-4701-a3f3-4db535176435 | ankitksh81/Trees | Top_view_BT.cpp | // Top view of a binary tree
/**
* 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... | ALGO | 0.99996 | 6.268475 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2021-08-21T13:00:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "44e5ad0387a... |
f0d39682-ec50-465f-924e-988043f2d279 | dygnyc/sum | mainT.cpp | //sums consecutive integers
//version using template class
#include <iostream>
#include <vector>
using namespace std;
const int N = 40;
// using template class
template<class T>
// sum function
// accum / p is passed by reference
inline void sum(int &accumulate, int n, T data)
{
for (int i = 0; i < n; ++i)
... | ALGO | 0.995897 | 5.841828 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-01-01T15:31: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": "3661100615e4... |
eb86fe1b-e3fa-42f2-a35d-942a6fa06a71 | grx62203/leetcode | 2、leetcode-multi/001-100/leetcode044通配符匹配-动态规划.cpp | /*
给定一个字符串 (`s`) 和一个字符模式 (`p`) ,实现一个支持 `'?'` 和 `'*'` 的通配符匹配。
```
'?' 可以匹配任何单个字符。
'*' 可以匹配任意字符串(包括空字符串)。
```
两个字符串**完全匹配**才算匹配成功。
**说明:**
- `s` 可能为空,且只包含从 `a-z` 的小写字母。
- `p` 可能为空,且只包含从 `a-z` 的小写字母,以及字符 `?` 和 `*`。
**示例 1:**
```
输入:
s = "aa"
p = "a"
输出: false
解释: "a" 无法匹配 "aa" 整个字符串。
```
*/
//这道题与Q10的区别是,这道题的* 不需要代... | ALGO | 0.999305 | 5.625 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-15T15:10: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": "8778780a0576... |
6edbb324-f92b-4448-acff-982f6b8de65e | fjtapia/countertree_2.0 | src/countertree/forest/sorted_tree.hpp | //----------------------------------------------------------------------------
/// @file sorted_tree.hpp
/// @brief
///
/// @author Copyright (c) 2010 2013 <NAME> (<EMAIL> )\n
/// Distributed under the Boost Software License, Version 1.0.\n
/// ( See accompanyingfile LICENSE_1_0.txt or copy at
/// ... | ALGO | 0.9837 | 5.632103 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2013-08-21T12:14:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "c33552cb7... |
d39eb972-07fb-48c3-b4ff-bfbd51fbf3a8 | selfix123/cpp-modules | module09/ex02/PmergeMe.cpp | #include "PmergeMe.hpp"
#include <chrono>
#include <cstdlib>
PmergeMe::PmergeMe() {}
PmergeMe::PmergeMe(const PmergeMe &inst){(void) inst;}
PmergeMe::~PmergeMe(){}
PmergeMe& PmergeMe::operator=(const PmergeMe &rhs){
if (this != &rhs) {
}
return *this;
}
double PmergeMe::getTime(){
static std::chrono::high_reso... | ALGO | 0.998794 | 5.604364 | {
"github_metadata": {
"branch": "master",
"commit_count": 49,
"repo_created_at": "2023-10-02T16:51: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": "d3f7f65e5... |
3c407874-9907-4f0a-8073-bd34021ee3c0 | Drtxdt/HNU-software-train-answer | 作业训练一/三角形的面积.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
double x1, y1, x2, y2, x3, y3;
while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3)
{
if (x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0 && x3 == 0 && y3 == 0)
break;
double ABx = x2 - x1;
do... | ALGO | 0.998886 | 4.896405 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-06-23T10:57:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "385a39f8e665... |
ec1cd6a8-08e0-4070-a3a8-2cfb37fd304a | Altu-Bitu-2/Notice | 04월 05일 - 그리디 알고리즘/라이브코딩/1931.cpp | #include <iostream>
#include <vector>
#include <algorithm> // sort 사용
using namespace std;
typedef pair<int, int> ci;
// 진행할 수 있는 회의의 최댓값을 리턴하는 함수
int getMaxCount(int n, vector<ci> &meetings) {
int count = 0; // 회의 수
int prev_end = 0; // 직전 회의의 끝나는 시간
for (int i = 0; i < n; i++) {
auto[ end, s... | ALGO | 0.999946 | 5.382594 | {
"github_metadata": {
"branch": "main",
"commit_count": 271,
"repo_created_at": "2022-02-22T12:42:17.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 34,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ff1c835f00... |
6b7e8d06-2102-439e-8308-1f2a136dd09b | SaiKrishna1207/DSA-Practice | Week-9/Day-63/palindromePartition.cpp | class Solution {
public:
vector<vector<string>> ans;
vector<string> t;
bool isPali(string x){
int i, l = x.length();
for(i = 0;i < l / 2; i++){
if(x[i] != x[l - i - 1])
return false;
}
return true;
}
void dfs(string s, int ind){
... | ALGO | 0.999992 | 6.129917 | {
"github_metadata": {
"branch": "master",
"commit_count": 399,
"repo_created_at": "2020-03-27T05:44: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": "525ce043... |
0425b6c1-675c-4443-896a-e54a722277f3 | NguyenTam-Wesley/DataStructuresAndAlgorithms | Sort/Insertion_Sort/insertion_sort.cpp | // https://www.hackerearth.com/practice/algorithms/sorting/insertion-sort/visualize/
#include <iostream>
using namespace std;
// Function to perform Insertion Sort and print array after each iteration
void insertionSort(int arr[], int n) {
for (int i = 1; i < n; ++i) {
int key = arr[i];
int j = i ... | ALGO | 0.999997 | 6.011889 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-07-11T12:39:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8ee25f917c9... |
cebb8628-e738-4a61-8ad6-1a13a1f56513 | Kulezi/oi | xxvi/etap2/dzien1/gwi/gwi.cpp | // Rozwiązanie do zadania 'Gwiazdy' z II etapu XXVI OI.
// Autor rozwiązania: <NAME>
// Złożoność czasowa: O(n * log(n))
// Złożoność pamięciowa: O(n)
// Punkty: 100 (upsolve)
#include <bits/stdc++.h>
#define dbg(x) #x << " = " << x << " "
using namespace std;
using ll = long long;
enum {
LEWO,
PRAWO,
OBOJ... | ALGO | 0.999905 | 3.330528 | {
"github_metadata": {
"branch": "main",
"commit_count": 110,
"repo_created_at": "2024-06-03T13:50:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b9541584d... |
15c06332-cea7-4c9f-9abe-1a7a2f03997f | hmazhar/physbam_public | PhysBAM_Tools/Grids_RLE_Interpolation/AVERAGING_RLE.h | //#####################################################################
// Copyright 2005, <NAME>, <NAME>.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
#ifnd... | ALGO | 0.990552 | 5.95599 | {
"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": "5f6c8c3... |
cb47ad13-f731-47e7-bf2c-daa8baedc7c3 | Vaveform/All_tasks_Coursera_belts | White_Belt/Week 2/Functions_week2/Functions_week2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int Factorial(int num)
{
if(num <= 1)
{
return 1;
}
return num * Factorial(num - 1);
}
void UpdateIfGreater(int first, int &second)
{
if(first > second)
{
second = first;
}
}
void MoveString... | ALGO | 0.999588 | 4.785442 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2020-05-18T16:00: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": "22f113bed... |
3b36dd8c-92ef-4fd4-845d-4b3883a149c6 | kamyu104/LeetCode-Solutions | C++/number-of-equal-numbers-blocks.cpp | // Time: O(klogn), k = len(set(nums))
// Space: O(1)
// binary search
class Solution {
public:
int countBlocks(BigArray* nums) {
const auto& binary_search_right = [](auto left, auto right, const auto& check) {
while (left <= right) {
const auto mid = left + (right - left) / 2;
... | ALGO | 0.999274 | 5.851757 | {
"github_metadata": {
"branch": "master",
"commit_count": 19395,
"repo_created_at": "2018-10-11T17:38:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4939,
"forks": 1616,
"issues": 1,
"pull_requests": 55
},
"file_meta": {
"content_id": ... |
f598de8f-19ef-43ae-a8b3-ed9c983baef2 | kss418/Atcoder | ABC/300/340/347/D.cpp | #include <bits/stdc++.h>
#define fastio cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
using namespace std; typedef long long ll;
using ull = unsigned long long;
using pll = pair<ll, ll>; using tll = tuple<ll, ll, ll>;
ll n, m, k, t; string s;
... | ALGO | 0.999924 | 3.990462 | {
"github_metadata": {
"branch": "main",
"commit_count": 1312,
"repo_created_at": "2024-09-16T15:54: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": "a1bd9ba15... |
83bd6ad3-71e2-49b8-a8e4-5463f0149c86 | tiankonguse/leetcode-solutions | contest/3/398/C.cpp | // #include <bits/stdc++.h>
#include "base.h"
using namespace std;
typedef long long ll;
class Solution {
public:
ll sumDigitDifferences1(vector<int>& nums) {
ll n = nums.size();
vector<vector<ll>> bits(12, vector<ll>(10, 0));
for (auto v : nums) {
for (int i = 0; i < 12; i++) {
int unit ... | ALGO | 0.999456 | 5.28487 | {
"github_metadata": {
"branch": "master",
"commit_count": 1037,
"repo_created_at": "2015-04-11T09:31:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 81,
"forks": 26,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "d3570... |
04b812fb-3c96-484f-a6a0-84bf233d524d | ishandutta2007/codeforces-l | leaf1415/normal/512/D.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
... | ALGO | 0.998725 | 3.586532 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:17:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cca03b37c10e... |
09d8508e-5b07-4d3d-a1f2-465d71afeeaf | Eduardofig/Competitive-Programming-Solutions | codeforces/codeforces-edu-107/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using l = long;
using ul = unsigned long;
using ll = long long;
using ull = unsigned long long;
const int MXN = 3e5 + 3;
const int INF = 0x3f3f3f3f;
const int MOD = 1e7 + 9;
int n;
int q;
int c[MXN];
int t[MXN];
//string s;
void solve()
{
... | ALGO | 0.99999 | 4.142332 | {
"github_metadata": {
"branch": "master",
"commit_count": 114,
"repo_created_at": "2021-02-21T04:11:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d0c76aab... |
877f8630-0e7b-4361-9705-2156cfb84c20 | Prateek-Anand07/DSA-Codes | LinkedList/5_reverseKnodes.cpp | #include<iostream>
using namespace std;
class node {
public:
int data;
node* next;
node(int val) {
data = val;
next = NULL;
}
};
void addAtTail(node* &head, int val) {
node* n = new node(val);
if(head==NULL) {
head = n;
return;
}
... | ALGO | 0.999969 | 4.40076 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2024-08-17T06:16: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": "90e7a83b9dd... |
03245bce-254e-417a-a85a-ffc3a8fe7fb8 | TelegramMessenger/Telegram-iOS | third-party/libjxl/libjxl/lib/jxl/base/bits.h | // Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#ifndef LIB_JXL_BASE_BITS_H_
#define LIB_JXL_BASE_BITS_H_
// Specialized instructions for processing register-sized bit arrays.
#include "lib/j... | ALGO | 0.904511 | 7.763193 | {
"github_metadata": {
"branch": "master",
"commit_count": 28524,
"repo_created_at": "2018-11-14T18:06:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6895,
"forks": 1916,
"issues": 531,
"pull_requests": 45
},
"file_meta": {
"content_id":... |
5321c81b-668e-48ef-98a0-2ff416069340 | vbieleny/SudokuSolver | main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <bitset>
#include <optional>
#include "Arguments.h"
const int SIZE = 9;
const int SECTION = 3;
using SudokuArray = std::array<std::array<int, SIZE>, SIZE>;
using AllowedNumbers = std::array<std::array<std::bitset<SIZE... | ALGO | 0.999709 | 6.694504 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-10-13T17:19: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": "e0fe1bed49... |
3c0c16f8-0b0e-4179-bc33-c206c225b29b | dimopoulosk/WSDM13 | QPtrec06/Wand.cpp | /*
* Wand.cpp
*
* Created on: May 20, 2012
* Author: constantinos
*/
#include "Wand.h"
#include "globals.h"
#include "profiling.h"
#include "utils.h"
inline bool Wand::pickCandidate(lptrArray& lps, const float& threshold, int& pivot, const int& threshold_unknown) {
//PROFILER(CONSTS::CAND);
// find pivot... | ALGO | 0.990677 | 5.517898 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2013-04-08T16:13:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a58bf706e7... |
c4ad6730-0d49-4b90-8891-1f153ef6b02e | chaojunhou/LeetCode | Algorithm/CPP/path_sum_ii.cpp | # include <stdio.h>
# include <iostream>
# include <vector>
# include <string>
# include <unordered_map>
# include <cctype>
# include <stack>
# include <algorithm>
# include <time.h>
# include <queue>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NU... | ALGO | 0.999976 | 5.198468 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2015-04-28T15:49: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": "2bc263de0... |
9bab1652-2e26-4cf1-bc6a-589f500ac0f7 | PRINCERAHUL1/CrackYourPlacement | Tree/Construct Binary Tree from Preorder and Postorder Traversal.cpp | class Solution {
public:
TreeNode* dfs(vector<int>& pre, int preStart, int preEnd, vector<int>& post, int postStart, int postEnd) {
if (preStart > preEnd)
return NULL;
TreeNode* root = new TreeNode(pre[preStart]);
if (preStart == preEnd)
return root;
int p... | ALGO | 0.999955 | 6.312009 | {
"github_metadata": {
"branch": "main",
"commit_count": 96,
"repo_created_at": "2024-07-16T17:25: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": "2d24a470002... |
459666db-4a9a-4d00-93d6-eee774d6eb35 | cea-trust-platform/trust-code | src/Kernel/Champs_dis/Champ_implementation_sommet.cpp | /****************************************************************************
* Copyright (c) 2022, CEA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retai... | ALGO | 0.973522 | 5.444588 | {
"github_metadata": {
"branch": "master",
"commit_count": 9704,
"repo_created_at": "2021-03-29T11:57:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 59,
"forks": 19,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "7c519e... |
c00a5b69-215b-4de1-81ae-ec2e98aeafc6 | Astro-boy-888/CODE | My_Inequality_HOlds.cpp | #include <bits/stdc++.h>
using namespace std;
/*
题目描述
给定一组不等式,判断是否成立并输出不等式的最大差(输出浮点数的整数部分)
要求:
不等式系数为 double类型,是一个二维数组
不等式的变量为 int类型,是一维数组;
不等式的目标值为 double类型,是一维数组
不等式约束为字符串数组,只能是:“>”,“>=”,“<”,“<=”,“=”,
例如,不等式组:
a11x1 + a12x2 + a13x3 + a14x4 + a15x5 <= b1;
a21x1 + a22x2 + a23x3 + a24x4 + a25x5 <= b2;
a31x... | ALGO | 0.999684 | 3.950262 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-27T03:33:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f02bf6ff769a... |
860730d8-db32-4b56-a2a9-9a2479f04261 | jordan-comlinee/algorithm | Algorithm_CPP/SamsungPractice/주사위 굴리기2/main.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 21;
int N, M, K; // 세로, 가로, 이동 횟수
int maps[MAX][MAX];
int scoreMap[MAX][MAX] = { 0 };
int result = 0;
pair<int, int> currentDice = { 0, 0 };
int dir = 0;
int dice[6] = {1, 6, 4, 3, 5, 2};
int currentTop = 1;
int diceUnderVal[7] = { 0, 6, 5, 4, 3, 2, 1 };
... | ALGO | 0.999907 | 4.130445 | {
"github_metadata": {
"branch": "main",
"commit_count": 365,
"repo_created_at": "2022-11-14T13:25:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "113adc6f7e... |
ecd0c31b-7aae-4cc6-97a5-b853a58466f7 | brocbyte/realtime-deformations | realtime-deformations/external/Eigen/src/Core/arch/AltiVec/MatrixProduct.h | // This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2020 <NAME> (<EMAIL>)
// Copyright (C) 2021 <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 fil... | ALGO | 0.996812 | 7.298326 | {
"github_metadata": {
"branch": "main",
"commit_count": 29,
"repo_created_at": "2023-02-04T08:16:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "979754f208a... |
9ac3c1e4-3e9b-4942-91af-09689a489222 | keithalewis/fms16 | test/bachelier.cpp | // bachelier.cpp - The Bachelier model
#include "../xll/xll.h"
#define _USE_MATH_DEFINES
#include "prob.h"
using namespace xll;
// In the Bachelier model of stock price as Brownain motion, the value of a call is
// E max{F_t - k, 0} = (f - k) N(d) + sigma sqrt(t) N'(d), where N is the normal cdf
// and d = (f - k)/si... | ALGO | 0.956486 | 6.343101 | {
"github_metadata": {
"branch": "master",
"commit_count": 115,
"repo_created_at": "2017-05-15T13:20: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": "f845f5dc... |
11265489-1eda-482e-a392-7dff0154a0ba | watercsu/leetcode | GasStation.cpp | /* There are N gas stations along a circular route, where the amount of gas at station i is gas[i].
You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations.
Return the starting gas sta... | ALGO | 0.999997 | 5.615182 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2014-11-01T12:49: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": "9a79bface... |
c3b1d371-6db0-46c9-8e7b-f0b45531a954 | ishandutta2007/codeforces-r | raveman/normal/806/B.cpp | #pragma comment(linker, "/STACK:60777216")
#include <cassert>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<cstdlib>
#include<memory.h>
#include<ctime>
#include<bitset>
#include<fstream>... | ALGO | 0.999742 | 3.12185 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:58: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": "e013bad96f95... |
47584b8b-e0dc-4e35-9f26-ae6c0ebd3722 | FromTheo/NeetCode | [C++] Math & Geometry/pow(x,n).cpp | #include <iostream>
using namespace std;
/* -------- Subject --------
Pow(x, n) is a mathematical function to calculate the value of x raised to the power of n (i.e., x^n).
Given a floating-point value x and an integer value n, implement the myPow(x, n) function, which calculates x raised to the power n. */
/* -... | ALGO | 0.99994 | 6.315445 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2024-06-04T12:52: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": "45a47d588ec... |
9e23f80d-223d-47d1-be80-0f346f0a336f | AlexGliesch/competitive-programming | competitions/URI - Westeros/G - Mapa do Meistre.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <ciso646>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int x, y; cin >> x >> y;
vector<string> m(y);
for (int i = 0; i < y; ++i) {
cin >> m[i];
}
if (m[0][0] == '*') {
cout << "*" << endl; return 0;
... | ALGO | 0.999964 | 3.585333 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2022-05-01T04: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": "b7903b8d0ba... |
b80bd4c9-ae5e-44ef-bda3-519a5304fafe | sh-arka22/LEETCODE-Problems | 34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
private:
int lower_bound(vector<int>& nums, int tar){
int idx = -1;
int l = 0, r = nums.size()-1;
while(l<=r){
int mid = (l+r)/2;
if(nums[mid] == tar){
idx = mid;
r = mid-1;
}
else if(nu... | ALGO | 0.999962 | 6.174832 | {
"github_metadata": {
"branch": "main",
"commit_count": 2955,
"repo_created_at": "2022-07-28T11:22:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5705915d9... |
6bdbf901-e9f3-45ef-b3d7-9c9bae5d43a2 | losvald/algo | zatemas/plocan2.cpp | #include <cstdio>
#include <iostream>
#define MAX 10
using namespace std;
int n;
int grid[MAX][MAX], sum[MAX][MAX], dp[MAX][MAX][MAX][MAX];
const int inf = 1000000000;
int get_sum(int r1, int c1, int r2, int c2) {
int a = r1 ? sum[r1-1][c2] : 0;
int b = c1 ? sum[r2][c1-1] : 0;
int c = (r1 && c1) ? sum[r1-1][c1-1... | ALGO | 0.999945 | 4.519495 | {
"github_metadata": {
"branch": "master",
"commit_count": 358,
"repo_created_at": "2014-11-14T07:50:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "62af25ff... |
c7ccccf0-75f1-49cb-b1f3-08345f5c334b | rp-code9/programming | problems/encoding-decoding/CountDecodedDigitSequence.cpp | // https://www.geeksforgeeks.org/print-all-possible-decodings-of-a-given-digit-sequence/
#include <iostream>
#include <string>
int countDecoding(std::string digits, int n)
{
if (n == 0 || n == 1) {
return 1;
}
int count = 0;
if (digits[n - 1] > '0') {
count = countDecoding(digits, n ... | ALGO | 0.999309 | 6.191391 | {
"github_metadata": {
"branch": "master",
"commit_count": 175,
"repo_created_at": "2020-04-22T09:32:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9c447a29... |
8c26e3c8-4cdc-4718-bdb2-95520a3f5404 | Preston-Kearnan/CSCI-2-Labs | Lab11a.cpp | //<NAME>
//Lab_11a Bubble sort
// 11-28-22
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
void swap(int& argX, int& argY);
void printArray(int arg[], const int size);
int bubbleSort(int arg[], const int size);
int main(void) {
srand(time(0));
const int n = 10;
int a[n];
int play... | ALGO | 0.999675 | 5.630385 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-02-14T22:17:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4b1b29e2541c... |
75e81616-38ca-43a4-ac9e-57a507f5689d | trilinos/Trilinos | packages/aztecoo/src/AztecOO_Scaling.cpp |
/*
//@HEADER
// ***********************************************************************
//
// AztecOO: An Object-Oriented Aztec Linear Solver Package
// Copyright (2002) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this wor... | TOOL | 0.977886 | 5.868718 | {
"github_metadata": {
"branch": "master",
"commit_count": 104031,
"repo_created_at": "2015-11-16T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 593,
"issues": 263,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
41f74c13-5762-4b68-9ff9-6f248f90dfb0 | lightjameslyy/lt-cpp | leetcode-clion/matrix/361.bomb-enemy.cpp | /*
* @lc app=leetcode id=361 lang=cpp
*
* [361] Bomb Enemy
*
* https://leetcode.com/problems/bomb-enemy/description/
*
* algorithms
* Medium (44.49%)
* Total Accepted: 38.8K
* Total Submissions: 87.2K
* Testcase Example: '[["0","E","0","0"],["E","0","W","E"],["0","E","0","0"]]'
*
* Given a 2D grid, eac... | ALGO | 0.999985 | 5.739027 | {
"github_metadata": {
"branch": "master",
"commit_count": 405,
"repo_created_at": "2018-04-10T09:21: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": "2736c161... |
879042d3-9628-408e-a6c2-27fb3b3a5894 | Ahmedre15/OOP-Lab | LAB TASK 02/Q05.cpp | #include <iostream>
#include <string>
using namespace std;
struct Person {
int id;
string name;
};
int main() {
int N;
cout << "Enter the number of people: ";
cin >> N;
Person people[N];
for (int i = 0; i < N; ++i) {
cout << "Enter ID for person " << i + 1 << ": ";
cin >> ... | ALGO | 0.999736 | 5.261866 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2025-01-30T19:02: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": "3c6101a92b6... |
b136d3c8-60d2-4e26-8f2a-ca4b18aa9e8b | Navin-Anto-Felix-Sagayasargunam/SKCET-Sophomore-Year | SingleBus.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
// Control Signals
enum ControlSignal {
LOAD_REG,
LOAD_MEMORY,
STORE_MEMORY,
PERFORM_ALU,
FETCH_INSTRUCTION,
DECODE_INSTRUCTION,
EXECUTE_INSTRUCTION,
BRANCH
};
// ALU Operations
enum ALUOperation {
ADD,
... | ALGO | 0.961128 | 6.197096 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2025-03-31T12:19:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe6ddaae0a9... |
f05a5b01-4c8c-463d-96a2-88f82cb96920 | ravi956/dsa-in-cpp | Deque/08_first_circular_tour.cpp | #include <bits/stdc++.h>
using namespace std;
//Naive Solution [Time Complexity = O(n*n) Space Complexity = O(1)]
// int firstPetrolPump(int petrol[], int dist[], int n)
// {
// for (int start = 0; start < n; start++)
// {
// int curr_petrol = 0;
// int end = start;
// while (true)
// ... | ALGO | 0.999982 | 5.239592 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2020-09-10T17:45:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f240314d6... |
952f8764-2780-42fb-944f-1542e3835e5e | Abunyawa/contests | 747/b.cpp | // chrono::system_clock::now().time_since_epoch().count()
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define debug(... | ALGO | 0.999972 | 4.861827 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2020-03-29T11:27:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6a744dda... |
55bbb420-03f9-4fe2-a898-ccce8213543b | xinchengxx/algorithm_contest | 树/2003. 每棵子树内缺失的最小基因值.cpp |
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
class Solution {
public:
// 首先是遍历
vector<int> smallestMissingValueSubtree(vector<int>& parents,
vector<int>& nums) {
int n = parents.size();
vector<int> ans(n, 1);
... | ALGO | 0.999861 | 4.763979 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2022-06-18T13:07:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "aded96ec1f4... |
86f9dcca-7b6a-46a7-bb9d-1387b57a01fd | daffaafiar/Basic-Graph | graph.cpp | #include "graph.h"
void createList_1301213215(Graph &G){
first(G) = NULL;
}
adrNode newNode_1301213215(char x){
adrNode p = new Node;
p->info = x;
p->child = NULL;
p->next = NULL;
return p;
}
void addNode_1301213215(Graph &G, adrNode p){
if (first(G) == NULL){
first(G) = p;
}els... | ALGO | 0.991666 | 3.084542 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-01-04T18:53: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": "ba0d5b47bd68... |
e71d0090-74ff-4da4-8bb3-ddb9df594201 | Valtriac42/DSA-sheet | 189. Rotate Array.cpp | #include <stdio.h>
void rotate(int* nums, int numsSize, int k) {
int temp[1000000], i;
// Adjust k if it's greater than numsSize
if (k > numsSize)
k = k % numsSize;
// Store the last k elements in temp
for (i = 0; i < k; i++) {
temp[i] = nums[numsSize - k + i];
}
// S... | ALGO | 0.999992 | 6.220883 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-09-05T12:47: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": "6a76faacae78... |
41077aac-8995-41e7-b6a8-a3b37e13bc40 | HughLocke/ACM-template | 数据结构/可持久化并查集.cpp | /*用可持久化数组维护并查集的fa数组,模板为BZOJ3674
强制在线,每个值 ^ lastans
n个集合 m个操作
操作:
1 a b 合并a,b所在集合
2 k 回到第k次操作之后的状态(查询算作操作)
3 a b 询问a,b是否属于同一集合,是则输出1否则输出0
*/
const int maxn = 2e5 + 10;
int N,M,K;
int T[maxn],tot;
struct Tree{
int lt,rt;
int fa,size;
}tree[maxn * 52];
int fa[maxn],Size[maxn];
void newnode(int &t){
t = ++tot;
... | ALGO | 0.999954 | 4.620186 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-03-11T06:27:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a300e8211... |
bef1008b-cf5b-48c2-ab5a-4a42b6c4e4b7 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/arc024/B/2230079.cpp | #include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;
int main(){
ios::sync_with_stdio(... | ALGO | 0.99999 | 3.398555 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-09-30T05:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 22,
"forks": 8,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "bce397c1... |
bd97dc81-6938-49be-8eb5-4b13bd121e22 | AaronFlower/leetcode | 002-AddTwoNumbers/solution.h | #ifndef LEETCODE_SOLUTION_H__
#define LEETCODE_SOLUTION_H__
#include <cstddef>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
int sum, carrier = 0;
ListNode *l3, *p3;
... | ALGO | 0.999854 | 6.33761 | {
"github_metadata": {
"branch": "master",
"commit_count": 120,
"repo_created_at": "2018-05-13T14:10:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc2f5932... |
ca1f36e6-8265-4f79-ae8e-26919ff2b361 | fazlerahmanejazi/Competitive-Programming | HackerEarth/July Circuits/Dremplay and Upside Down(Partially Correct).cpp | #include <bits/stdc++.h>
using namespace std ;
#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using p... | ALGO | 0.999971 | 3.615597 | {
"github_metadata": {
"branch": "master",
"commit_count": 102,
"repo_created_at": "2018-01-12T00:39:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 6
},
"file_meta": {
"content_id": "79202a9b... |
b344e7c1-ad6f-4dcc-9cfe-e3d800ed619e | SIP-2015/skeleton | tasks/sorting/sorting_main.cpp | /*
* sorting_main.cpp
*
* Created on: June 17, 2015
* Author: <NAME>
*/
#include <stdio.h>
#include <cstdlib>
#include <ctime>
#include "sorting.h"
int32_t MAX_SIZE = 65536;
std::clock_t STOPWATCH;
int32_t SIZE = 16;
/**
* @brief prints the contents of an integer array in human readable format
*
* @p... | ALGO | 0.998188 | 5.469497 | {
"github_metadata": {
"branch": "master",
"commit_count": 94,
"repo_created_at": "2015-05-27T18:22:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efde8b69ad... |
16cf9aef-dce1-454c-819d-e16c9e8bd4bb | temeddix/interview-practice | baekjoon/2444.cpp | #include <iostream>
void print_chars(const char letter, short repeat) {
for (short i = 0; i < repeat; i++) {
std::cout << letter;
}
}
auto main() -> int {
short number = 0;
std::cin >> number;
short rows = (number * 2) - 1;
for (short i = 0; i < rows; i++) {
short level = 0;
if (i < number) {... | ALGO | 0.999341 | 5.269975 | {
"github_metadata": {
"branch": "main",
"commit_count": 519,
"repo_created_at": "2024-10-15T12:54: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": "8730c5d71b... |
1b12acfc-685b-4c59-9e7a-7cc889cfd207 | Nitish9711/coding-blocks | graph/hasCycledfs.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define null NULL
void ReadCP()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
template <typename T>
class Graph
{
int V;
list<int> *l;
public:
Graph(int V)
{
this-... | ALGO | 0.999513 | 4.493649 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2020-10-02T21:12: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": "88fbabe20... |
bf4902b6-88cb-4278-9bc1-7626ab79e6c3 | snake0/spec-int-2006 | benchspec/CPU2006/450.soplex/src/spxfastrt.cc | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the class library */
/* SoPlex --- the Sequential object-oriented simPlex. */
... | ALGO | 0.999327 | 4.519881 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-10-16T06:18:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2208e7cdc... |
4bd1d1a4-9b98-4e9a-b39d-892c2d508b32 | Kowsar14238/URI_Problem_Solution | URI_Soluation_1165(2).cpp | //Count the case and test prime numbers
//#include<bits/stdc++.h>
#include <iostream>
#include <cmath>
using namespace std;
///This function will check that the input number is prime or not.
bool checkPrimeNumber(int number){
if (number <= 1){
return false;
}
if (number<= 3){
return true... | ALGO | 0.999252 | 4.724185 | {
"github_metadata": {
"branch": "main",
"commit_count": 90,
"repo_created_at": "2023-09-03T18:22: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": "1f5164550e7... |
1ebf3b7a-2d82-4f7f-97ae-e83387d17d81 | huww98/MyRobot | rmcore/src/command_computer.cpp | #include <iostream>
#include "command_computer.h"
#include "utillities/parameters.h"
#include "utillities/constants.h"
using namespace std;
using namespace std::chrono;
auto commandComputerLogName = "commandComputer";
FollowLine::FollowLine(ros::NodeHandle &nh)
{
visual_info_sub = nh.subscribe("visual_info", 1, ... | TOOL | 0.95845 | 4.753442 | {
"github_metadata": {
"branch": "simple",
"commit_count": 66,
"repo_created_at": "2018-02-04T03:37:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "636409afc... |
9e2a2b2d-22ef-4d39-94b3-2ca0599d28a5 | Mjp777/C- | Jump Game II.cpp | Jump Game II
You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].
Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:
0 <= j <= nums[i] and
i + j < n
Return t... | ALGO | 0.999999 | 6.189035 | {
"github_metadata": {
"branch": "main",
"commit_count": 738,
"repo_created_at": "2024-04-10T12:22:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cb07139658... |
b06c1413-fbb0-4509-ad1c-3f3812df876d | glensand/CPhysics | App/ComputationPhysicsTask/Task9.h | #pragma once
#include "ITask.h"
#include "DifferentialSolver/ImplicitEuler2SystemSolver.h"
#include "../LinearAlgebra/Matrix22.h"
class Task9 : public ITask
{
public:
Task9() = default;
virtual ~Task9() = default;
void Run(const Params* params = nullptr) override;
virtual void Clear() override {}
};
inline voi... | ALGO | 0.993494 | 5.518904 | {
"github_metadata": {
"branch": "master",
"commit_count": 143,
"repo_created_at": "2019-09-13T13:43:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 12,
"pull_requests": 0
},
"file_meta": {
"content_id": "7065719... |
34fc83c1-ba46-469e-bda6-8a7902ad92e6 | ychaaibi/leetcode | 18-4sum/4sum.cpp | class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int>> solutions;
vector<int> solu(4);
sort(nums.begin(), nums.end());
if (nums.size() < 4) return (solutions);
for (int i=0; i<nums.size()-3; i++)
{
... | ALGO | 0.999962 | 5.864024 | {
"github_metadata": {
"branch": "main",
"commit_count": 430,
"repo_created_at": "2024-04-14T15:06:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "da1bf669df... |
97f977a5-483f-481d-ac8f-afa06b3bff94 | healthykim/BOJ | src/1759.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int L, C;
vector<char> numbers;
vector<char> selected;
int aeiou = 0;
void dfs(int len, int index) {
if(len == L) {
if(aeiou >= 1 && len-aeiou >= 2) {
for(int i=0; i<L; i++) {
cout << selected[i];
... | ALGO | 0.99924 | 3.200967 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-07-01T15:57:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0e8079664cc... |
2a87f5b3-75dc-40ee-b727-3f9d63d8f81f | LibreOffice/online | wsd/FileServer.cpp | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* 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 o... | WEB | 0.929788 | 3.428068 | {
"github_metadata": {
"branch": "master",
"commit_count": 12489,
"repo_created_at": "2015-05-21T15:11:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 620,
"forks": 182,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8d... |
719b5b61-466f-4f7e-b2dc-de0f242b7fae | darshurathi/C_Learning_Code | program_for_shopping_list.cpp | #include<iostream>
using namespace std;
class list{
private:
int counter=0;
int item_code[5]={0};
float item_price[5]={0};
std::string name;
public:
void display_item();
void delete_item();
void add_item(int,float);
list(std::string &);
};
list::list(std::string &name)
{
this->name = name;
}
void l... | TOOL | 0.964405 | 3.385227 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-07-20T17:34: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": "5195d9176c... |
98465968-21a5-484e-986e-a661d7b53f66 | PetrGuan/Problem_Solving | Codeforces/Problem-A/P133-A.cpp | /*
HQ9+ is a joke programming language which has only four one-character instructions:
"H" prints "Hello, World!",
"Q" prints the source code of the program itself,
"9" prints the lyrics of "99 Bottles of Beer" song,
"+" increments the value stored in the internal accumulator.
Instructions "H" and "Q" are case-sensiti... | ALGO | 0.98753 | 3.58133 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2016-11-23T14:49: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": "8d1b576f9... |
cfa80fe6-ed41-42b4-8aa7-37bcb1fa9c8c | zhenxl/cpu_render | src/materials/disney_clearcoat.inl | #include "../microfacet.h"
Spectrum eval_op::operator()(const DisneyClearcoat &bsdf) const {
if (dot(vertex.geometric_normal, dir_in) < 0 ||
dot(vertex.geometric_normal, dir_out) < 0) {
// No light below the surface
return make_zero_spectrum();
}
// Flip the shading frame if it ... | ALGO | 0.979121 | 6.766242 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-13T10:20:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "60789c6733b7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.