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 |
|---|---|---|---|---|---|---|---|
3ab67512-536c-426c-a98c-bb08b1899219 | JKOHLERS/Cpp_tests | polimorphism.cpp | //polimorphism use demonstration
#include <iostream>
using namespace std;
class Vehicle{
protected:
int regNo;
string color;
double weight;
public:
Vehicle(){
}
Vehicle(int r, string c, double w){
regNo = r;
color = c;
weight = w;
}
virtual void d... | TOOL | 0.970672 | 4.575288 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2022-05-31T18:51: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": "5408db224eb... |
30efba63-e23b-4ddc-b69a-903a742474b9 | NoelBird/chocochip | sites/baekjoon/16236_아기_상어/1.cpp | // 알고리즘: BFS에서 한꺼번에 같은 거리를 전부 탐색하고 그 중에서 가장 최선의 후보를 선택함
// 개선 가능 부분: queue => circular queue로 변경하면, 메모리 사용량 줄일 수 있음
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};
int mat[21][21] = { 0, };
int main()
{
// 1. get input... | ALGO | 0.999926 | 4.183892 | {
"github_metadata": {
"branch": "main",
"commit_count": 178,
"repo_created_at": "2021-11-01T14:49: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": "c96b0e39be... |
073d6e9e-1486-483f-803b-a895a8d5a25c | tranvansang/online-judge | vn-spoj/heap1/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define PII pair<int,int>
#define VI vector<int>
#define For(i,a,b) for(auto i = (a); i < (b); i++)
#define rep(i,n) For(i,0,(n))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define trav(it,x) for(auto i... | ALGO | 0.999684 | 4.224076 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2017-05-15T02:33: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": "3f4786a16... |
a2981e91-b9cc-4ba3-b4f7-4dcb71515193 | hrshammo/C-Cpp | The program of how a number can be inserted in any position in an.CPP | #include <iostream>
using namespace std;
struct Node
{
int data;
Node *next;
};
class LinkedList
{
private:
Node *head;
public:
LinkedList()
{
head = NULL;
}
void push_back(int newElement)
{
Node *newNode = new Node();
newNode->data = newElement;
newNo... | ALGO | 0.9999 | 4.49189 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2022-02-03T17:42: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": "773782a064b... |
0b107819-1810-492f-876c-237c6df8e824 | hussamEL-Hwary/my-problem-solving | a2oj code battle/round1/p3.cpp | //============================================================================
// Name :
// Author : hussam
// Version :
// Copyright :
// Description :https://a2oj.com/p?ID=480
//============================================================================
#include<bits/stdc++.h>
#include <iostream>
... | ALGO | 0.999675 | 3.329473 | {
"github_metadata": {
"branch": "master",
"commit_count": 72,
"repo_created_at": "2017-03-12T00:45:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfe0545db... |
b7fcbe85-392a-47e6-8094-df4e9dbec5b4 | SrgGrch/cw-cpp | cw-cpp/List.h | #pragma once
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
template <typename T>
class Node {
public:
int nextBin = 0;
int dataSize;
T data;
Node(T i); // конструктор с заполнением данных
Node() {}; // конуструктор по умолчанию
};
template<typename T>
inline Node<T>::Node(T i)
{
da... | TOOL | 0.974742 | 3.618017 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2018-11-27T07:26: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": "a83468cc5... |
9e188488-5dcf-4ea9-bf34-3d76f281a1b1 | nadavguy/SelfDriving | Common/Src/KalmanFilter.cpp | /*
* KalmanFilter.cpp
*
* Created on: Aug 22, 2021
* Author: raing
*/
#include "KalmanFilter.h"
KalmanFilter::KalmanFilter()
{
// TODO Auto-generated constructor stub
}
KalmanFilter::KalmanFilter(double process_noise, double sensor_noise, double estimated_error, double intial_value) {
/* The variables... | ALGO | 0.984326 | 5.978841 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2021-05-26T15:22:29.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e868bcae3d7c... |
62fd9a77-a9c0-494f-a322-9944d099aa0a | chandr33/Data-Structures-and-Algorithms | C++ Files/BST_AdditionalFunctions.cpp | #include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <utility>
using namespace std;
typedef struct TreeNode {
int key;
struct TreeNode * right;
struct TreeNode * left;
}Node;
struct qnode {
int distance;
Node * node;
};
Node * newNode(int data) {
Node * new_node = new Node();
new_nod... | ALGO | 0.999932 | 4.002033 | {
"github_metadata": {
"branch": "master",
"commit_count": 127,
"repo_created_at": "2018-05-18T22:28: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": "ed770e9c... |
0b8bb964-0c1a-4b47-9aaf-aff0681c38e9 | Harshitkumar07/DSA-in-cpp | Recursion/Sum of array.cpp | /*
Problem Statement:
Find the sum of elements in an array using recursion.
Approach:
1. Base Case:
If the array size is 0, the sum is 0.
2. Recursive Case:
The sum of the array is equal to the first element plus the sum of the rest of the array.
For an array arr[] of size n, the recursive step is:
sumAr... | ALGO | 0.999968 | 6.423696 | {
"github_metadata": {
"branch": "Main",
"commit_count": 997,
"repo_created_at": "2024-09-25T14:42:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e67c0ef8b... |
8f59dde2-0599-40d3-b30d-27008af397f7 | simonnguyen175/cp-repo | training/anh_dung_day/3-7-2021/WSEQ2.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e3+1;
ll m, n, k, a[N], b[N], dp[N][N];
int main(){
cin >> m >> n >> k;
for(int i = 1; i<=m; ++i)
cin >> a[i];
for(int i = 1; i<=n; ++i)
cin >> b[i];
for(int i=0; i<=m; ++i)
for(int j=0; j <= n; ++j... | ALGO | 0.999987 | 3.145313 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-11-16T14:21: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": "32cf53ca18... |
421fedba-e22b-4b38-b49d-9ddc77d8e340 | MariaChrysafis/CompetitiveProgramming | Codeforces/1370E.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <algorithm>
#include <queue>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
template<typename T>
T readVal() {
T n;
cin >> n;
return n;... | ALGO | 0.999979 | 3.62486 | {
"github_metadata": {
"branch": "main",
"commit_count": 2959,
"repo_created_at": "2020-11-28T04:57:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "6df1fec64... |
0ae40f58-ef28-4dc6-85a6-11071d846591 | neurodebian/freesurfer | include/gcamremovenegativenodes_cuda.hpp | /**
* @file gcamremovenegativenodes_cuda.hpp
* @brief Implementation of gcamRemoveNegativeNodes for the GPU
*
* Reference:
* "Whole Brain Segmentation: Automated Labeling of Neuroanatomical
* Structures in the Human Brain", Fischl et al.
* (2002) Neuron, 33:341-355.
*/
/*
* Original Author: <NAME>
* CVS R... | ALGO | 0.942547 | 5.420094 | {
"github_metadata": {
"branch": "debian-sloppy",
"commit_count": 24022,
"repo_created_at": "2016-02-25T15:13:37.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10,
"forks": 4,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": ... |
143cf5b5-cfa6-44c7-b49d-fb77cd8fa853 | liuq901/code | LOJ/l_1172.cpp | #include <cstdio>
#include <cstring>
unsigned N,a[260],one[260][260];
int sqr(int x)
{
return(x*x);
}
void init(int base)
{
memset(one,0,sizeof(one));
int m=sqr(base-1);
for (int i=1;i<m;i++)
for (int j=0;j<base;j++)
one[i*base+j][(i-1)*base+j]=1;
N=m*base;
unsigned f[30][10]... | ALGO | 0.999916 | 3.7106 | {
"github_metadata": {
"branch": "master",
"commit_count": 108,
"repo_created_at": "2013-09-18T08:58:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af96e5c6... |
8011c9e4-0d80-4b98-8594-e9fcc70f305a | dededec/PracticasMH | Practica4/software/FUENTES/src/individual.cpp | #include "individual.h"
#include "objetivo.h"
#include "random.h"
#include "operacionesVector.h"
#include <vector>
#include <iostream>
template<class T>
std::ostream& operator<<(std::ostream & os, const std::vector<T> &V)
{
typename std::vector<T>::const_iterator it;
for (it=V.begin(); it!=V.end(); ... | ALGO | 0.999353 | 3.801531 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-06-29T13:39:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ef1106ae8d1... |
651a995e-9839-48b7-b2b6-1761b7b75985 | wufan-home/algorithm_problem_set | cpp/0212.cpp | /*
Given a 2D board and a list of words from the dictionary, find all words in the board.
Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or
vertically neighboring. The same letter cell may not be used more than once in a word.
For example... | ALGO | 0.999923 | 6.296592 | {
"github_metadata": {
"branch": "master",
"commit_count": 872,
"repo_created_at": "2016-05-14T02:20: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": "e10cd788... |
e99037fc-edb2-4f64-9da7-ed19189cfcf1 | rongc5/test | item/sk_server/src/op_search_index.cpp | #include "op_search_index.h"
#include "sk_util.h"
#include "proc_data.h"
bool op_search_index::do_check_op_search(std::string &key, std::string &value, search_res & search)
{
std::vector<std::string> vec;
int pos = 0;
for (int i = 0 ; i < (int)value.size(); i++)
{
if (value[i] == '*' || value[... | ALGO | 0.999094 | 4.424546 | {
"github_metadata": {
"branch": "master",
"commit_count": 733,
"repo_created_at": "2015-04-14T02:09:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "81d41706... |
d7c40d7e-2017-4447-9ac1-fe2359abd7be | Provenance-Emu/Provenance | Dependencies/FFMpeg/xcframeworks/libcryptopp.xcframework/ios-arm64/Headers/cryptopp/hmqv.h | // hmqv.h - written and placed in the public domain by <NAME>
// Shamelessly based upon Wei Dai's MQV source files
#ifndef CRYPTOPP_HMQV_H
#define CRYPTOPP_HMQV_H
/// \file hmqv.h
/// \brief Classes for Hashed Menezes-Qu-Vanstone key agreement in GF(p)
/// \since Crypto++ 5.6.4
#include "gfpcrypt.h"
#includ... | ALGO | 0.975248 | 7.313882 | {
"github_metadata": {
"branch": "develop",
"commit_count": 6467,
"repo_created_at": "2013-08-27T20:34:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6133,
"forks": 702,
"issues": 269,
"pull_requests": 10
},
"file_meta": {
"content_id": ... |
931f6332-0c9a-442d-bca8-1f59c5d3b9ca | JasonZhangjc/parallel-local-search | src/QUBO.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include "QUBO.h"
using namespace std;
/*
In any constructor,
never initialize QUBO with random matrix,
only read QUBO matrix from qubo_NB_ID.txt
*/
// empty const... | TOOL | 0.963517 | 3.634881 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2022-02-14T04:02: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": "f60d6e3930e8... |
deb10494-d7c1-4141-b66a-589c8c209f95 | eesoymilk/I2P2 | practice13/guard.cpp | #include <iostream>
#include <vector>
#define L first
#define R second
using namespace std;
using Soldiers = vector<pair<int, int>>;
using Sections = vector<int>;
void PrintSec(Sections secs)
{
cout << "Sections: ";
for (int g : secs) cout << g << ' ';
cout << '\n';
}
int RemoveTwo(Soldiers soldiers, Sec... | ALGO | 0.999895 | 4.058152 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2021-09-24T09:12:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "be975f4c8... |
fb737855-e77f-4869-84c5-cdaa2c66fc8e | ishandutta2007/codeforces-l | laakeri/normal/445/C.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <iomanip>
#include <queue>
#define F first
#define S second
using namespace std;
int n,m;
double vs[501];
double es[150000];
int hasn[501];
int hase[150000];
vector<pair<int,int> > g[501];
vector<int> tc;
struct comp{
bool operator() (pair<in... | ALGO | 0.999874 | 3.777166 | {
"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": "63088d6400fa... |
2224c672-64a1-4a06-9031-fae8caf5691d | Arin0402/Data-structures-and-Algorithms | 12_Tree/T022_Construct_BT_from_inorder_and_preorder.cpp | #include <bits/stdc++.h>
using namespace std;
// https://www.youtube.com/watch?v=aZNaLrVebKQ
// https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int val)
{
this->val = val;
}
}... | ALGO | 0.999991 | 6.707487 | {
"github_metadata": {
"branch": "main",
"commit_count": 224,
"repo_created_at": "2022-12-08T07:13:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "44d2515a84... |
36e8e0e2-2ca0-4928-b719-2d615b7df543 | Ashraful-89/STL | Vector/problem381A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> v(n);
for(int i = 0; i < n; i++) {
cin >> v[i];
}
int s = 0 , d = 0, flag = 1;
while(!v.empty()) {
if(flag == 1) {
if(v[0] > v.back()) {
s = s + v[0];
... | ALGO | 0.999988 | 3.740712 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-12-21T12:41: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": "18c66fbdc32... |
f4c0478b-e3bd-4ec0-ac3c-d0138591316e | jostuh/SPOJ | CompleteTheSequence.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
typedef unsigned int uint;
typedef vector< vector<double> > matrix;
void outputMatrix(matrix &M)
{
for (int row = 0; row < M.size(); row++)
{
for (int col = 0; col < M.size() + 1; col++)
{
cout ... | ALGO | 0.999666 | 3.342968 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2015-04-20T00:11: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": "bcabd1464c... |
a4e19e33-857a-4ed0-82c6-bdec5fc2e121 | microsoft/CCF | include/ccf/json_handler.h | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#pragma once
#include "ccf/endpoint_registry.h"
#include <llhttp/llhttp.h>
#include <variant>
namespace ccf
{
/*
* For simple app methods which expect a JSON request these functions do the
* common decoding... | WEB | 0.912823 | 7.474333 | {
"github_metadata": {
"branch": "main",
"commit_count": 4603,
"repo_created_at": "2019-04-08T09:13:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 831,
"forks": 226,
"issues": 103,
"pull_requests": 6
},
"file_meta": {
"content_id": "f2af... |
8dd59498-63e7-4d86-8e30-449454670531 | VegaFromLyra/2Sigma | SortWordsAndNumbers2.cpp | // SortWordsAndNumbers.cpp : Defines the entry point for the console application.
//
// Given a string containing a combination of words and numbers, sort the string
// such that the words and numbers maintain their position in the string
// Input: car 2 bus 1
// Output: bus 1 car 2
// Time complexity O(n)
// Space... | ALGO | 0.999624 | 5.011906 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2014-02-01T07:47: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": "9e597f633c... |
3a2d2401-2f4e-4502-861b-68bb2f0d575f | xjy-boy/leetcode | 1189/1189/main.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int maxNumberOfBalloons(string text) {
int a[5] = { 0 };
for (int i = 0; i < text.size(); i++) {
switch (text[i])
{
case 'b':
a[0] += 1;
break;
... | ALGO | 0.999872 | 4.500859 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-09-05T08:54:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "17a2f8f45240... |
eeec00ad-dac0-4e90-a132-a2c1a8278652 | PrasannaPrabhakar666/IPMP_Tasks_Prasanna | Week 5/LL4.cpp | //PROBLEM 4 FROM LINKEDLIST
//WEEK 5 DAY 2
//DATE : 22/12/2021
#include<iostream>
using namespace std;
struct node
{
int data;
node *next;
node *prev;
};
void append(struct node **hea... | ALGO | 0.999557 | 4.633673 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2021-10-27T07:21: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": "e636a1540c5e... |
8803b281-a580-436f-9c29-3ae5a42623ab | ngotuananh122001/LearnCPP | KTLT/ref_2.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
bool arr_alloc(int* &a, int n)
{
a = new int[n];
if(a == nullptr) return false;
else return true;
}
void arr_free(int *a)
{
delete [] a;
}
void arr_input(int *a, int n)
{
cout << "Nhap cac phan tu: ";
for(i... | ALGO | 0.99959 | 3.201686 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2021-12-16T09:08: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": "78c76eeab15... |
665be7fa-5604-4bfb-9230-09cdd6dea1f2 | Dipto2611/OOPS | OOPS_Codes/template_overload.cpp | /*
Function template overloading is the process of defining multiple functions with the same name, where some are generic (using templates) and others are specific (non-template), allowing the compiler to choose the best match based on arguments.
*/
#include <iostream>
using namespace std;
// Template function
templa... | TOOL | 0.953838 | 6.124125 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2024-01-26T08:02: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": "cfc97883c... |
62561d5b-9595-4623-aada-8b12e17fc69f | ChangmooMoon/PS | boj/6064.cpp | #include <iostream>
using namespace std;
#define endl '\n'
#define FASTIO cin.tie(nullptr)->sync_with_stdio(false)
int dr8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dc8[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dr[] = {-1, 1, 0, 0};
int dc[] = {0, 0, -1, 1};
void calc(int m, int n, int x, int y) {
--x, --y;
bool flag =... | ALGO | 0.999084 | 4.084111 | {
"github_metadata": {
"branch": "main",
"commit_count": 269,
"repo_created_at": "2020-10-19T05:36: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": "f617c4845a... |
9f6cd084-3517-49a7-a82c-b1ba4e2ff64d | khanhbuiduc/ICPC | 2023_school_learning/lesson_14/re_do/bai 2 mexes/mexes.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a), end(a)
int main()
{
freopen("mexes.inp", "r", stdin);
freopen("mexes.out", "w", stdout);
// a: vector<int>;mex:int;B:vector<int>;
int n;
cin >> n;
vector<int> a(n);
for (int &i : a)
cin >> i;
// khi có 2 phần ... | ALGO | 0.999967 | 3.901805 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2024-11-06T15:17: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": "5ea4cceab75... |
4e8d97e7-c3c6-4b82-8acf-316191d0ab60 | jswigart/omni-bot | Omnibot/dependencies/WildMagic5/SDK/Include/Wm5DistLine2Line2.h | // Geometric Tools, LLC
// Copyright (c) 1998-2012
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.1 (2010/10/01)
#ifndef WM5DISTLINE2LINE2_H
#define WM5DISTLINE2LINE2_H
#includ... | ALGO | 0.930207 | 6.060216 | {
"github_metadata": {
"branch": "master",
"commit_count": 940,
"repo_created_at": "2015-03-15T01:21:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 80,
"forks": 23,
"issues": 5,
"pull_requests": 0
},
"file_meta": {
"content_id": "b14180... |
52d1643f-1b32-4757-862c-8d24be584140 | pranavidandu/MissionRnD-C-BinarySearchTree-Worksheet | src/SortedArraytoBST.cpp | /*
Given a Sorted Array of integers .Create a new Balanced Binary Search Tree from the Array
and return the head of the new BST .
Ex : Input : [1,6,10]
Output : A new BST which structure is as follows
6
/ \
1 10
A BST is said to be balanced ,when it satisifes the following property
Every node's Difference of L... | ALGO | 0.999962 | 4.453407 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2016-04-03T10:27: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": "96e0374ba... |
b45beb3a-5519-4b3b-a44f-34392af7067c | CenJieTeng/Tetris | WindowsProject1/block_J.cpp | #include "stdafx.h"
Block_J::Block_J() : State(1)
{
Shape[0] = { 5, 0 };
Shape[1] = { 5, 1 };
Shape[2] = { 6, 1 };
Shape[3] = { 7, 1 };
}
Block_J::~Block_J()
{
}
bool Block_J::ChangeBlock(int map[Width][Height])
{
int tempState = State;
POINT tempShape[4];
for (int i = 0; i < 4; i++)
{
tempShape[i].x = Sha... | ALGO | 0.969838 | 3.659731 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2019-03-06T05:34: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": "2b90d5bfa... |
0cad3c6c-f136-4454-a0a2-e0a7f4eee6a9 | Zzz-for-code/TongJi.oop | BigHW/90-01-b1/90-01-b1-hanoi_multiple_solutions.cpp | /* 大数据 2352847 张静敏 */
#include <iostream>
#include <iomanip>
#include <Windows.h>
#include <conio.h>
#include <math.h>
#include "../include/common_tools.h"
#include "../include/cmd_console_tools.h"
#include "90-01-b1-hanoi.h"
using namespace std;
int num = 0; //记录步数
int top[3] = { 0 }; //三个塔的栈顶指针
int tower[3][10] = {... | ALGO | 0.973707 | 3.211267 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-31T15:26:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f1c35611c1e... |
9ad9b085-74f9-4463-8cf6-c1243906d5f5 | alexandraback/datacollection | solutions_1595491_1/C++/ulzha/b.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int nmax = 100;
int n, s, p;
int main() {
int nc, ic;
cin >> nc;
for (ic = 1; ic <= nc; ic++) {
int i, x, nl = 0, ns = 0;
cin >> n >> s >> p;
for (i = 0; i < n; i++) {
cin >> x;
if ((x + 2) / 3 >= p) {
nl++;
} else if ((x %... | ALGO | 0.999791 | 3.519709 | {
"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": "bbfd6016e... |
525dd797-44d1-4f97-be0f-89dfe7cd0749 | OsamaSayegh/advent-of-code | 2019/day-06/answer-script.cpp | #include "../lib-aoc.cpp"
#include "map"
std::map<std::string, int> cache;
int count_orbits(std::string object, std::map<std::string, std::string> orbits) {
if (object == "COM") {
return 0;
}
if (cache.find(object) != cache.end()) {
return cache.find(object)->second;
} else {
int count = 1 + count_... | ALGO | 0.999777 | 5.709892 | {
"github_metadata": {
"branch": "main",
"commit_count": 66,
"repo_created_at": "2020-12-02T08:31:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ec92cc1f783... |
5137db58-6011-4d97-8a0a-fd3701a33245 | Normal-pcer/sync_code | AT_birthday0410_x_この問題はほんとうにひどい問題であるため,できれば先に他の問題のほうをお楽しみいただければと思っておりまして,ですので他の問題を通し終えて暇になり,かつその暇を.cpp | /**
* @link https://www.luogu.com.cn/problem/AT_birthday0410_x
*/
#include "./libs/debug_macros.hpp"
#include "./lib_v4.hpp"
#include "./libs/fixed_int.hpp"
using f64 = double;
using namespace lib;
std::array<i32, 9> dx8 { 1, 1, 0, -1, -1, -1, 0, 1 };
std::array<i32, 9> dy8 { 0, 1, 1, 1, 0, -1, -1, -1... | ALGO | 0.996351 | 3.344001 | {
"github_metadata": {
"branch": "main",
"commit_count": 525,
"repo_created_at": "2024-09-09T13:22: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": "d949343589... |
184b066c-822a-420f-90be-cca501a20c06 | ojasvagupta/Leetcode | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> v;
int n = matrix.size();
int m = matrix[0].size();
int a = 0;
int b = n - 1;
int c = 0;
int d = m - 1;
while (a <= b && c <= d) {
for (int i = c; i... | ALGO | 0.999998 | 6.505839 | {
"github_metadata": {
"branch": "main",
"commit_count": 2097,
"repo_created_at": "2024-06-18T07:56: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": "780a11ee5... |
8191557d-a776-4b56-8ae7-30114cf5d7cf | sunho/algorithms | old/개업 2.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, m;
cin >> n >> m;
const int inf = 1e9;
vector<int> A(m);
for (int i=0;i<m;i++) {
cin >> A[i];
}
vector<int> pos(n+1);
for (int i=0;i<m;i++){
pos[A[i]] = 1;
for (int j=i+1;j<m;j++){
if (A[i] + A[... | ALGO | 0.999982 | 3.715405 | {
"github_metadata": {
"branch": "master",
"commit_count": 294,
"repo_created_at": "2018-03-07T01:52:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "452e0be5... |
22b0298f-c911-40da-b896-d9965aab8692 | AngelOlanC/estructuras-avanzadas-OMI | UnionFind.cpp | #include <bits/stdc++.h>
using namespace std;
struct UnionFind {
vector<int> p, size;
int sets = 0;
void init(int n) {
p.resize(n);
size.resize(n);
for (int i = 0; i < n; i++) {
p[i] = i;
size[i] = 1;
}
sets = n;
}
int find(int u) {
... | ALGO | 0.999829 | 4.547672 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2023-07-04T02:25: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": "eb387af1148... |
e152623e-4edb-4ad4-92a3-d439f8380b77 | aqfaridi/Competitve-Programming-Codes | SPOJ/TICTOE.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define... | ALGO | 0.999954 | 3.282223 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2016-02-14T20:28: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": "62110ca18e... |
f5e27e91-4d42-4e34-875e-c50a5c6aed0f | akshat2109/DSA-Practice | Segregate 0s and 1s - GFG/segregate-0s-and-1s.cpp | // { Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void segregate0and1(int arr[], int n) {
// code here
int i=0;
while(i<n)
{
if(arr[i]==1)
... | ALGO | 0.999553 | 5.149764 | {
"github_metadata": {
"branch": "main",
"commit_count": 1001,
"repo_created_at": "2022-02-15T15:51: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": "89997d665... |
8533b3ba-1788-417f-8df4-bdf9be855ce2 | TomasRacil/C-vyuka | Vyuka2.0/PrikladyZHodin/2024-2025/UvodniTest/uvodni_test_reseni.cpp | #include <iostream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <ctime>
using namespace std;
int faktorial(int cislo)
{
if (cislo < 0)
{
throw invalid_argument("Cislo je mensi jak nula.");
}
int faktorial = 1;
for (int i = 1; i <= cislo; ++i)
{
faktorial *= ... | ALGO | 0.943943 | 3.950717 | {
"github_metadata": {
"branch": "master",
"commit_count": 91,
"repo_created_at": "2021-11-25T00:24:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 28,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00927014... |
310d56f6-ce16-4dd6-922c-6fd618471183 | PriyanshuKumarIndia/All-C-plus-plus-Journey | C++Tutorial/treeBuildTraverse.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node*left;
Node*right;
Node(int data){
this->data=data;
this->left=NULL;
this->right=NULL;
}
};
Node* buildTree(Node* root){
int data;
cout<<"Enter the data : "<<endl;
cin>>data;
root=ne... | ALGO | 0.999923 | 4.844804 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2023-07-21T11:53:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dc0df6c9d... |
b17378fa-c8b6-4280-a68e-42c894f83d22 | tmittal98/CPP-codes | sorting/quickSelect.cpp | #include <iostream>
using namespace std;
int partition(int *arr,int p,int s,int e){
int i , j;
i = j = s;
while(i <= e){
if(arr[i] > p){
i++;
}
else{
swap(arr[i], arr[j]);
i++;
j++;
}
}
return j-1;
}
int quickSelect(in... | ALGO | 0.999944 | 5.826272 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-10-29T18:51: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": "978e8efd3a3a... |
bbe0ad5b-f193-459e-ad53-b65e20853356 | raincross7/code-similarity | codes/train_code/problem374/problem374_314.cpp | #include <bits/stdc++.h>
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define rep(i,n) for(int i=0; i<(n); i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { co... | ALGO | 0.999977 | 4.27471 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb3103f8bace... |
2d29612f-678a-49fe-a3fb-05f3ba0eae83 | Phjorttos/RotorHazard | src/node/util/lowpass50hz-filter.h | #include "filter.h"
#define CIRCULAR_BUFFER_INT_SAFE
#include "CircularBuffer.h"
/*
* Based on
* http://www.schwietering.com/jayduino/filtuino/index.php?characteristic=be&passmode=lp&order=2&usesr=usesr&sr=1000&frequencyLow=50¬eLow=¬eHigh=&pw=pw&calctype=float&run=Send
*/
//Low pass bessel filter order=2 alp... | TOOL | 0.920826 | 5.144567 | {
"github_metadata": {
"branch": "5consecutives",
"commit_count": 1409,
"repo_created_at": "2020-08-08T13:14: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": "... |
b8956390-9610-4f25-8ab2-6cbcf9aecdd5 | singhsanket143/CppCompetitiveRepository | CompetitiveProgramming/AtcoderDPContest/Q.cpp | // Problem Link - https://atcoder.jp/contests/dp/tasks/dp_q
/* By <NAME> */
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long do... | ALGO | 0.999898 | 3.699924 | {
"github_metadata": {
"branch": "master",
"commit_count": 304,
"repo_created_at": "2018-06-26T07:06:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 348,
"forks": 160,
"issues": 1,
"pull_requests": 4
},
"file_meta": {
"content_id": "96c3... |
41b1168d-3bc3-42b3-9724-033328b180ca | QMCPACK/qmcpack | src/formic/utils/lmyengine/spam_solver.h | //////////////////////////////////////////////////////////////////////////////////////////////////////////
// \file spam_solver.h a class to solve generalized eigenvalue problem with SPAM method
//
// SPAM is short for Subspace Projected Approximation Matrix
// Cite this paper:
// The Subspace Projected Approx... | ALGO | 0.999863 | 5.190295 | {
"github_metadata": {
"branch": "develop",
"commit_count": 28915,
"repo_created_at": "2017-01-11T19:02:29.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 345,
"forks": 147,
"issues": 438,
"pull_requests": 16
},
"file_meta": {
"content_id": ... |
edb6158e-144c-4b7e-929c-19665ae9cbc1 | AbdallahHossam/TicTacToeNN | Model/Environment.cpp | #include "Environment.h"
int Environment::isWinning(int markType)
{
int i;
std::vector<short> tBoard = Board;
for(i = 0; i < tBoard.size(); i++)
if (tBoard[i] != markType)
tBoard[i] = 0;
if ( (tBoard[0] && tBoard[4] && tBoard[8]) || (tBoard[2] && tBoard[4] && tBoard[6])) // check for diagonals
return 1;
... | ALGO | 0.932721 | 3.837058 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2022-04-05T12:04: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": "0be4dbb52... |
96c76629-a74e-4853-8aa6-28c302f1f778 | bmalhotra03/Dynamic-Formula-Planning-System | Formula.cpp | // Author: <NAME>
// Filename: Formula.cpp
// Version: 1
// Description: This is the class implementation of the Formula object
#include "Formula.h"
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
Formula::Formula(int inSize, int outSize, int inputQuantity[], string inputName[], string o... | TOOL | 0.9534 | 4.865165 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-16T01:05: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": "1e0e676b368f... |
60a4bded-baf4-431f-9a7e-d81ececbb1ec | hlgzx/LeetCode | 130. 被围绕的区域.cpp | class Solution {
public:
vector<vector<bool>> v;
vector<vector<bool>> vis;
int n, m;
void dfs(int i, int j, vector<vector<char>>& board) {
if (i < 0 || i == n || j < 0 || j == m) return;
if (vis[i][j] == true) return;
if (board[i][j] == 'O') {
vis[i][j] = true;
... | ALGO | 0.999986 | 5.757779 | {
"github_metadata": {
"branch": "master",
"commit_count": 143,
"repo_created_at": "2020-10-23T13:55:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2b026987... |
b83e9646-0d09-4cc7-a0a0-7c3e6533f4d5 | VatsalSy/LaplacePoissonCylindrical | LaplaceCylin.cpp | #include "LaplaceCylin.h"
int main () {
// Input data
char filename[256];
sprintf (filename, "InputEcdm.dat");
InputOutput in(filename);
//Nodes::checkOut();
double alphaIn = (in.ThermalCond)/(in.rho*in.SpecificHeat);
double sourceTerm = in.source/(in.ThermalCond*in.Tref);
//std::cout << "sourceTerm i... | ALGO | 0.998867 | 5.255842 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2016-10-15T05:52:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7e1c910e8... |
f9ddb2c6-e750-4d47-b0ae-72c4b634764a | fookwood/zoj-solutions-fish_ball | 范例/Accpt/20XX/p2013_搜索.cpp | #include <stdio.h>
#include <string.h>
const int dx [4] = { 0 , 0 , -1 , 1 };
const int dy [4] = { -1 , 1 , 0 , 0 };
int N , M , Ans;
bool Searched [1000] [1000];
int Opt [1000] [1000];
char map [1000] [1001];
bool range ( int x , int y )
{
return x >= 0 && x < N && y >... | ALGO | 0.99995 | 3.539505 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2012-06-05T02:38:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 102,
"forks": 27,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "6acebda... |
f48b7524-b6ea-4dcc-a34a-0144f9d73f0d | Gurpreet1928/Algorithms_Stanford_University | algo_part1/week3/comparision_QuickSort.cpp | #include <vector>
#include <iostream>
#include <fstream>
using namespace std;
void swap(int* l, int* r ) {
int temp = *l;
*l = *r;
*r = temp;
}
//choosing the last ele as pivot
/*int partition(vector<int> &v, int l, int r ) {
int pivot = v[r];
//cout << "pivot " << pivot << endl;
int i = l;
... | ALGO | 0.999542 | 4.464223 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-03-20T16:10: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": "5fdc789515... |
5dc1cc55-a60e-425d-aad5-cfcc500071d4 | ishandutta2007/codeforces-b | brunovsky/normal/1674/G.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "code/formatting.hpp"
#else
#define debug(...) (void)0
#endif
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int N, M;
cin >> N >> M;
vector<set<int>> out(N), in(N);
vector<int> outdeg(N), indeg(N);
for (int i = 0... | ALGO | 0.99925 | 3.970617 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "042b1ff326ce... |
14ba2961-ed92-4f68-9f4e-d530b35b9d34 | khaledsliti/CompetitiveProgramming | IFHLC/2020/Indiv/IFHLC#02/H.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
const int N = 1e5;
const int E =... | ALGO | 0.999986 | 3.735597 | {
"github_metadata": {
"branch": "master",
"commit_count": 454,
"repo_created_at": "2019-02-20T20:20:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad851de2... |
a7f07778-39f4-4b1c-9c8a-1e619b970662 | wxx17395/Leetcode | c++ project/Question bank/Q1-Q99/Q96.cpp | #include <bits/stdc++.h>
using namespace std;
// class Solution {
// public:
// int numTrees(int n) {
// vector<int> dp(n + 1);
// dp[0] = 1;
// dp[1] = 1;
// for (int i = 2; i <= n; ++i){
// for (int j = 1; j <= i; ++j){
// dp[i] += dp[j - 1] * dp[i - j]... | ALGO | 0.999987 | 5.3046 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2020-07-21T11:02: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": "f90b0e977... |
84de04a3-e442-4263-bbc2-2cc490a5abf8 | bennywilson/advent_of_code_2024 | 07/7/7.cpp | #include <chrono>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stack>
#include <unordered_set>
#include <vector>
using namespace std;
using namespace std::chrono;
uint64_t ShiftDecimal(int x) {
if (x < 10) {
return 10;
}
else if (x < 100) {
return 100;
}
else if (x < 1000) {
return 1... | ALGO | 0.997312 | 5.265916 | {
"github_metadata": {
"branch": "main",
"commit_count": 72,
"repo_created_at": "2024-12-03T01:51:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "93cf7c1d4a6... |
c94c95d3-ae64-4062-8f68-330c9e761f9a | Aunabil4602/coding-problems | spoj/PERMUT1 - Permutations.cpp | #include <bits/stdc++.h> // O(nkn) or O(n^2.k)
#define LL long long
using namespace std;
const int N = 15;
const int K = 100;
int n, k, t;
int dp[N][K];
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
memset(dp, 0, sizeof dp);
for (int i = 0; i < N; i++)
dp[i][0] = 1;
... | ALGO | 0.999889 | 4.204567 | {
"github_metadata": {
"branch": "master",
"commit_count": 209,
"repo_created_at": "2020-04-11T11:39:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3de8a400... |
3286c2a6-2dd4-4c89-8a01-1ad5f7316989 | gbsphenx/skproject | SKWINDOS/src/c_rect.cpp | #include "util.h"
#include "c_rect.h"
#include "dm2data.h"
void c_rect::init(void)
{
x = y = w = h = 0;
}
void SKW_SET_SRECT(c_rect* r, x16 x, x16 y, x16 w, x16 h)
{
r->x = x;
r->y = y;
r->w = w;
r->h = h;
}
void SKW_SET_ORIGIN_RECT(c_rect* r, x16 w, x16 h)
{
r->x = 0;
r->y = 0;
r->w = w;
r->h = h;... | TOOL | 0.956506 | 4.54929 | {
"github_metadata": {
"branch": "master",
"commit_count": 225,
"repo_created_at": "2015-03-22T09:08:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "908d7d9... |
055a19cb-2763-4a8d-84c9-199d2b87e003 | rvthak/AlgoProject2 | src/GridHash.cpp | #include "VCurve.h"
#include "GridHash.h"
#include "distributions.h"
#include "utils.h"
#include <iostream>
using namespace std;
GridHash::GridHash(double delta, unsigned grid_amount, unsigned dim, int k, unsigned tableSize, unsigned v_size){
//cout << " Creating " << grid_amount << " Grids for hashing." << endl;
... | ALGO | 0.963224 | 5.477147 | {
"github_metadata": {
"branch": "main",
"commit_count": 75,
"repo_created_at": "2021-12-02T12:26:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "68b33dd1af2... |
b5ef64bb-0547-4f52-85ae-377a37f94f50 | daviyan5/estudos | prog-competitiva/correctbracket.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
int n;
vector<int> esq; vector<int> dir;
int ordem(vector<int> &dup,char o,int pos){
if(o=='R'){
return dir[pos];
}
if(o=='L'){
return esq[pos];
}
if(o=='D'){
int last = dup[pos];
... | ALGO | 0.999913 | 3.895805 | {
"github_metadata": {
"branch": "main",
"commit_count": 40,
"repo_created_at": "2020-11-09T18:10:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a966cb2cd87... |
564a4d22-1e18-493a-bf02-26f64681ab7b | vincent24345/topics_data | lightlyedited1/test5.cpp | #include <iostream>
#include <string>
using namespace std;
// Function to get the integer value of a character
int getIntFromChar(char c) {
return c - '0';
}
// Function to convert an integer to its character representation
char getCharFromInt(int number) {
return number + '0';
}
// Function that adds two ba... | ALGO | 0.999006 | 5.170463 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-10-27T04:07:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0918624082d0... |
2f04dbe1-b454-4e17-a56c-2d42471a8be9 | IlyaShvetsov/MIPT_2_term | Task_2/Task_3/task_3.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <cmath>
using namespace std;
class CBoard {
public:
explicit CBoard() = default;
CBoard(int _cells, short _null_pos, vector<char> _way) :
cells(_cells),
null_pos(_null_pos),
... | ALGO | 0.99992 | 4.555892 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2019-02-02T00:09: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": "9e8a18a172... |
5366e747-33d1-4c21-ae8c-10bff0c8ae13 | sianke1991/BOJ_CPP | 20240518_Dijkstra_BruteForce_Stochastic/5972.cpp | #include <bits/stdc++.h>
#include <stdio.h>
#define INFINITY 100000000
#define STARTING_NODE 1
using namespace std;
// 비용 테이블. priceTable[x] 는 1번 노드에서 x 번 노드까지 가는데 필요한 최소의 비용
int priceTable[50001];
// 인접 리스트: adjList[x]는 x 노드에서 뻗어 나가는 간선 정보. 각 간선은 {비용, 도착 노드}로 저장한다.
vector<pair<int, int>> adjList[50001];
// 헛간 개수 (그래... | ALGO | 0.99985 | 3.985899 | {
"github_metadata": {
"branch": "master",
"commit_count": 218,
"repo_created_at": "2022-08-21T06:54:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b4d12ee... |
d14c5413-0110-4b84-a690-b86df1c96f6a | TrMTan/Code-CPP-PTIT | c++ tren lop/tamgiac_friend_diem.cpp | #include <iostream>
#include <math.h>
using namespace std;
class Point;
class Tamgiac;
class Point{
private:
int x;
int y;
public:
Point(){
x=0, y=0;
}
void InIt();
void Print();
friend float Khoangcach(Point,Point);
friend class Tamgiac;
};
void Point::InIt(){
cout<<"\nNhap x = "; cin>>x;
cout... | ALGO | 0.998744 | 3.778992 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-07-03T02:42:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "30399e0526ee... |
6db1117e-0470-4a43-b2bd-3d211e38d9e9 | ibudiselic/contest-problem-solutions | tc 160+/ActivateGame.cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
using namespace std;
int G[50][50];
int my_abs(int x) {
return x<0 ? -x : x;
}
const int di[] = { -1, 0, 1, 0 };
const int dj[] = { 0, 1, 0, -1 };
struct S {
... | ALGO | 0.999787 | 4.119567 | {
"github_metadata": {
"branch": "master",
"commit_count": 75,
"repo_created_at": "2011-08-14T11:43:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0efb6bb33... |
353d8a8b-1bca-400c-9e1e-9ac32671558e | EyeEyeloving/Cpp-LeetCode-HJ-Practice | HJ48_指定链表节点操作_Edition01_4ms_416KB.cpp | #include <iostream>
/*用new的变量进行赋值就是有了另一个新的内存地址,那么之前的节点应该重新链接到这个新地址,否则会链表会断;
在有新增节点的时候必须用到new,因为目的就是开辟一个新的内存空间*/
struct ListNode {
int data;
ListNode* next;
};
ListNode* insertNodes(ListNode* node_insert, int nodedata_target, ListNode* head) {
// auto tmp = new ListNode();
// tmp = head;
ListNode*... | ALGO | 0.999861 | 3.991493 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2024-09-24T09:58: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": "47cef90d8... |
b00a3f60-565f-4657-8e74-f6cec2d30d0b | linguoliang/learning | data_strcture_and_algorithms/algorithms/dynamic_programming/src/egg_drop.cc | #include "egg_drop.h"
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>
#include "util.h"
using std::cout;
using std::endl;
using std::min;
using std::max;
using std::vector;
int Drop1(vector<vector<int>> &cache, int n, int k);
int Drop2(int n, int k);
void EggDrop() {
int n = 4;
in... | ALGO | 0.999672 | 5.325943 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2016-02-28T17:36:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "939c60176... |
5b4ce20a-5af1-47bd-b8c9-03a8863aa1c5 | zyuzhi/math_cpp | include/zyuzhi/math/gcd_lcm.hpp | // @author zyuzhi
#pragma once
#ifndef ZYUZHI_MATH_GCDLCM_HPP
#define ZYUZHI_MATH_GCDLCM_HPP
#include <cstdint>
#include <zyuzhi/math/macros.h>
MATH_NAMESPACE_BEGIN
template <typename T>
T gcd(T a, T b)
{
T t;
while (b > 0) {
t = b;
b = a % b;
a = t;
}
return a;
}
template <ty... | ALGO | 0.979304 | 6.525685 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2017-02-07T02:24: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": "87669edc3... |
e03ad33b-8b87-4912-8074-8d6d48abbd12 | AcademySoftwareFoundation/openexr | src/lib/OpenEXR/ImfLut.cpp | //
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.
//
//-----------------------------------------------------------------------------
//
// Lookup tables for efficient application
// of half --> half functions to pixel data,
// and some commonly applied functions.
//
//--... | TOOL | 0.968081 | 6.61918 | {
"github_metadata": {
"branch": "main",
"commit_count": 2704,
"repo_created_at": "2012-02-24T06:30:00.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1710,
"forks": 650,
"issues": 196,
"pull_requests": 15
},
"file_meta": {
"content_id": "ce... |
96b51352-b312-4677-b931-53b3631ad13b | lenaNzrva/Cpp_Development_Basics | WhiteBelt/Week2/MonthlyAffairs.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
void Print(const vector<string>& V)
{
for (auto v:V)
{
cout<<v<<" ";
}
}
int main()
{
//число операций Q
int Q;
cin >> Q;
int day;
vector<int> months = {31, 28,... | ALGO | 0.971245 | 4.711112 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2021-10-30T16:27: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": "b7f9aa8fd19... |
324806f6-3971-477d-a406-044a3ebf2abe | farnazkohankhaki/CPP-Codes-Archive | ProjectEuler/5.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int maxN = 1000 + 8;
bool mark[maxN];
int p[maxN];
int pow (int a, int b)
{
if (b == 0)
return 1;
else
{
if( b % 2 == 1)
return pow (a, b / 2) * pow(a, b / 2) *a;
else
return pow (a, b / 2... | ALGO | 0.999992 | 4.825292 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-12-28T22:25: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": "6d588bd89... |
9e4056ae-4959-47a2-a340-eb90546f7aef | mberaha/abc_partition | example_g&k_uni/code_CPP_MFM_gnk.cpp | // [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
using namespace arma;
//----------------- ABC-MCMC for random partitions
double my_quantile(vec V, double p){
vec temp = sort(V);
return(temp(V.n_elem * (p - 0.000000001)));
}
/*
* functions for the g&k distribution, in order
* - the quantile as f... | ALGO | 0.999943 | 3.696622 | {
"github_metadata": {
"branch": "master",
"commit_count": 87,
"repo_created_at": "2020-01-22T15:37:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d7d704bc... |
ac984469-ea4b-409c-af65-a2581a34d1c5 | rahul228646/DSA-and-CP | Binary Search/insert_index.cpp |
// https://leetcode.com/problems/search-insert-position/
// https://leetcode.com/problems/search-insert-position/discuss/423166/Binary-Search-101 --- see this
int searchInsert(vector<int>& a, int target) {
int idx = lower_bound(nums.begin(), nums.end(), target) - nums.begin();
return idx;
}
// or
int searchInse... | ALGO | 0.999907 | 5.827009 | {
"github_metadata": {
"branch": "main",
"commit_count": 800,
"repo_created_at": "2021-09-10T11:27:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7dc823e6a... |
16c42a2a-42a7-4b86-94ee-fe1071405710 | gefeng/cp | atcoder/abc387/E.cpp | #include <iostream>
#include <utility>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <array>
#include <string>
#include <vector>
void run_case() {
std::string S;
std::cin >> S;
int n = S.size();
if(n < 4) {
int l = stoi(S);
int r = l * 2;
for(int x = l;... | ALGO | 0.999926 | 4.50418 | {
"github_metadata": {
"branch": "main",
"commit_count": 980,
"repo_created_at": "2022-07-19T19:38: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": "6003500080... |
237219a2-baf0-4873-a0d4-5ff232d26328 | Prem-sharma34/DSA_in_Cpp | Stack/Remove_adjacent_duplicate.cpp | /* Remove all adjancent duplicates
Problem statement:
You are given a string a consisting of lowercase Englishh letter.
A duplicate removal consists of choosing two ajdacent and equal letter sand removing them.
we repeatedly make duplicate removals on s untilw e no longer can. Return
the final string after all suc... | ALGO | 0.999733 | 4.956095 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2025-06-09T13:36: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": "03b4c83db4a... |
eb2af94f-6441-4503-9eaa-a8efb92c11c3 | yerasiito/Ingenieria-Informatica-UGR | 2ºCurso/PrimerCuatri/SCD/(a) Seminario 1/scd-s1-fuentes/fumadoresversiongenerica.cpp | #include <iostream>
#include <cassert>
#include <stdlib.h>
#include <thread>
#include <mutex>
#include <random> // dispositivos, generadores y distribuciones aleatorias
#include <chrono> // duraciones (duration), unidades de tiempo
#include "scd.h"
using namespace std ;
using namespace scd ;
// numero de fumadores
... | ALGO | 0.987818 | 3.824102 | {
"github_metadata": {
"branch": "master",
"commit_count": 184,
"repo_created_at": "2024-01-04T21:11:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1de50b12... |
c774bdc3-2799-4ac3-bc54-194e06783ae7 | HangKeon/BaekJoon | BaekJoon/BaekJoon/14863(서울에서 경산까지) - 5.cpp | #include <iostream>
using namespace std;
int a[101][4]; //도보시간, 도보 모금액, 자전거 시간, 자전거 모금액
int dp[101][100001] = { 0, }; //a[구간개수][걸리는 시간]
int main()
{
int n, k;
int t = 0, time = 0, cnt; //t = t번째 구간, time = 걸리는 시간, cnt = 도보, 자전거 둘 다 k를 넘어가는지를 판단위한 변수
int max = 0, total = 1; // max = 최대 모금액, tota... | ALGO | 0.99962 | 3.318354 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2020-12-27T07:37: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": "aad17fa4b... |
c18271ad-86d6-4a09-af96-f710caef40bb | GaoLon/trikin_astar | src/Trikin_Astar/reference/mesh_generator.cpp | #include <CGAL/Simple_cartesian.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/IO.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/remove_outliers.h>
#include <CGAL/grid_simplify_point_set.h>
#include <CGAL/jet_smooth_point_set.h>
#include <CGAL/jet_estimate_normals.h>
#include <CGAL/mst_orient_normals.h>
... | ALGO | 0.967914 | 6.134499 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2021-11-11T03:34: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": "e99173d400... |
1121fb11-5049-4db6-8ef4-3e343b4a40d1 | tmwilliamlin168/CompetitiveProgramming | HackerRank/hourrank-31/basketball-tournament-1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxN=3e5;
int n, m, li, ri, ans[mxN];
array<int, 2> h[mxN];
ll ph[mxN+1], xi;
bool act[mxN];
vector<array<ll, 4>> es;
struct dsu {
int p[mxN], l[mxN], r[mxN];
int find(int x) {
return x==p[x]?x:(p[x]=find(p[x]));
}
void join(int x, int... | ALGO | 0.999994 | 4.451107 | {
"github_metadata": {
"branch": "master",
"commit_count": 1192,
"repo_created_at": "2018-05-07T06:37:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 551,
"forks": 120,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb7... |
e153b965-b036-47fb-94f0-b6f9d9995fe5 | starostinak/codingame | labyrinth.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cassert>
#include <set>
using namespace std;
int R; // number of rows.
int C; // number of columns.
int A; // number of rounds between the time the alarm countdown is activated and the time the alarm goes off.
enu... | ALGO | 0.999929 | 3.912866 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2016-11-23T19:02:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1053a28621... |
1d130e65-d780-46a3-b23b-ca4e9aa7aae3 | jk-jung/problem-solving | codeforces/Educational Round 03x/R033_div2_C.cpp | #include <cstring>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999901 | 3.626857 | {
"github_metadata": {
"branch": "main",
"commit_count": 1582,
"repo_created_at": "2021-06-24T13:40:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c0f2c9a13... |
da446c3d-9379-4f4c-84dd-33c47631a617 | Haut-Stone/algorithm | KMP.cpp | /*
* Created by ShiJiahuan(li) in haut.
* for more please visit www.shallweitalk.com
*
* Copyright 2017 SJH. All rights reserved.
*
* @Author: Haut-Stone
* @Date: 2017-04-25 21:29:00
* @Last Modified by: Haut-Stone
* @Last Modified time: 2017-10-30 10:00:47
*/
//这里先写一份注释吧,其实KMP算是实际上就是,利用相同部分的前缀和后缀,从而掉过了重复查找的部分。
/... | ALGO | 0.999961 | 4.190172 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2016-11-10T16:12:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5982bf737... |
1d7993ff-df58-4f6a-9a02-fee5f3f1083c | ishandutta2007/codeforces-x | xellos/normal/569/B.cpp | #include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserv... | ALGO | 0.999978 | 3.683813 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:38:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d29bf7e5d2a... |
3c3a735a-bd36-4791-8d7d-b88b4f40d5f6 | Gaurav-Tewatia/Leetcode | 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.999614 | 5.389785 | {
"github_metadata": {
"branch": "main",
"commit_count": 1328,
"repo_created_at": "2023-04-07T11:10: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": "f5716ddf3... |
9149d9f0-f7c2-42de-af6a-f9a5e517185a | Mahedi02/CP-WITH-PHITRON | WEEK WISE SOLVING/WEEK 14/W14-SUNDAY/C_Boring_Day.cpp | /* _AUTHOR_ : <NAME>
_CREATED_ : 2024-06-29 || 14:20:51 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vec vector<ll>
#define sorta(x) sort(x.begin(), x.end());
#define sortd(x) sort(... | ALGO | 0.999979 | 4.519706 | {
"github_metadata": {
"branch": "main",
"commit_count": 94,
"repo_created_at": "2024-03-16T16:16: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": "4088f199774... |
370755a0-60cf-4251-8f8e-dede31defe38 | Aditya-jain-wq/Good-Codes | kruskals.cpp | /*
You are given an undirected connected graph with n vertices and m edges
numbered from 1 to m. You have to apply Kruskal's algorithm for finding
the Minimum Spanning Tree in G. Every second you add 1 edge to
the spanning tree and thus complete the process in n - 1 seconds.
Initially at t=0 there is no edge in the... | ALGO | 0.999997 | 4.16629 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2020-06-17T13:01: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": "16ac753ee... |
a41945f3-123d-44ee-951a-1b6ad2c88f34 | nojima/aoj | 2311.cpp | #include <cstdio>
#include <cstring>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
char col... | ALGO | 0.999973 | 4.016213 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2012-03-21T09:51: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": "8977b045b... |
96f24b0f-8c67-481c-b2a2-db718a8f8875 | Galib35/Problem-Solving | Leetcode/Backtracking/22. Generate Parentheses.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i,n) for(i=0;i<n;i++)
#define deb(x) cout<< #x << "=" << x <<endl;
#define deb2(x,y) cout<< #x <<"="<< x<<","<< #y << "=" <<y<<endl;
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pai... | ALGO | 0.999945 | 4.601658 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2022-04-10T20:52: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": "7b8b76271eb... |
975a5de4-6bba-49c3-961d-1ec8a327d373 | SJAlgorithm/SJAlgorithm | hyeon-uk/2021/0324/8012.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
const int MAX_N = 30001;
int max_height = (int)floor(log2(MAX_N));
int n, m;
vector<vector<int>> v;
int depth[MAX_N];
int ancestor[MAX_N][30];
void dfs(int now, int parent, int d) {
depth[now] = d;
ancestor[now][0] = parent;... | ALGO | 0.999978 | 4.072935 | {
"github_metadata": {
"branch": "master",
"commit_count": 721,
"repo_created_at": "2020-03-18T13:38:57.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "aa40aa767... |
a4fe2c8b-6ea4-42e3-872a-d9f6d00200c5 | liz-murphy/rslam_dev | common_front_end/src/Triangulation.cpp |
#include <common_front_end/Triangulation.h>
#include <utils/PrintMessage.h>
////////////////////////////////////////////////////////////////////////////////////////////
/// Triangulate a 3D point from multi-view measurements
bool Compute3dPnt(
const Eigen::Vector2tArray &vPixels, ///< Input: vector of pixel mea... | ALGO | 0.995932 | 6.495879 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2014-09-16T02:14:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 13,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5dca540... |
d4899f25-f92b-4747-bc37-98567cc48af0 | TAFFO-org/TAFFO | test/axbench/blackscholes/src/blackscholes.cc | // Copyright (c) 2007 Intel Corp.
// Black-Scholes
// Analytical method for calculating European Options
//
//
// Reference Source: Options, Futures, and Other Derivatives, 3rd Edition, Prentice
// Hall, <NAME>,
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <fstream>
#include <... | ALGO | 0.936759 | 4.322098 | {
"github_metadata": {
"branch": "master",
"commit_count": 584,
"repo_created_at": "2021-11-26T18:18:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 18,
"forks": 12,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6fd0ad... |
bfc93ce2-afc1-4389-91e9-b316d092b76d | facug91/Competitive-Programming | problems_solved/icpcarchive.ecs.baylor.edu/EurekaTheorem.cpp | /*
By: facug91
From: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4908
Name: Eureka Theorem
Date: 28/04/2016
*/
#include <bits/stdc++.h>
#define endl "\n"
#define next sbjkdfh329re9fdshfd98fyh
#define EPS 1e-9
#define MP make_pair
#define F first
#define S ... | ALGO | 0.998061 | 3.995594 | {
"github_metadata": {
"branch": "master",
"commit_count": 117,
"repo_created_at": "2014-06-08T22:47:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "305be86a... |
306ea77f-500c-4f0e-a3ab-ac60244e65ee | valpo-DylanBrown/ECE252 | Exams/exam2/stacktest.cpp | #include <iostream>
using namespace std;
#define MAXSIZE 100
class IntStack {
private:
int stackArray[MAXSIZE]; //contains actual characters in stack.
int size; //contains the current number of characters on stack.
public:
IntStack(); //constructor
void push (int x);
bool isFull();
int pop(); //look... | ALGO | 0.911072 | 3.890993 | {
"github_metadata": {
"branch": "master",
"commit_count": 81,
"repo_created_at": "2019-01-11T19:28:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce620a2097... |
f217244f-6207-43bc-b2b1-56620d201a21 | tcOops/Go-F-L-A-G | Codeforces/373/duipai.cpp | #include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <bitset>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <functional>
#define fuck(x) cout<<"["<<x<<"]";
#define FIN fre... | ALGO | 0.999986 | 4.043082 | {
"github_metadata": {
"branch": "master",
"commit_count": 118,
"repo_created_at": "2016-08-17T14:24: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": "24d80623... |
f5dd51bd-f7ab-441d-bfe0-68d804fcf642 | kimminki20/My_c-_study | 03_24~03_30/03_28/BOJ_2607.cpp | //백준 2607 비슷한 단어
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
void init(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
int main(){
init();
int N; //단어의 개수
cin >> N;
vector<string> input(N);
string str;
for(int ... | ALGO | 0.999996 | 4.879277 | {
"github_metadata": {
"branch": "main",
"commit_count": 187,
"repo_created_at": "2024-11-15T01:14:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "318351b853... |
9bfc1379-092c-4bfb-8720-d958f4a41915 | sandordaroczi/Competitive-Programming | Codechef/2-D Point Meeting/solution.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int root(int k) {
int sq = floor(sqrt((float)(1+8*k)));
return (1+sq)/2;
}
bool on_line(ll x1, ll y1, ll x2, ll y2, int dir) {
if (dir == 1) return (y1 == y2);
if (dir == 2) return (x1 == x2);
if (dir == 3) re... | ALGO | 0.999984 | 3.674247 | {
"github_metadata": {
"branch": "main",
"commit_count": 42,
"repo_created_at": "2021-11-22T20: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": "18024871563... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.