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 |
|---|---|---|---|---|---|---|---|
4ec20851-edd2-4ddc-978e-3e4e8e1dae2a | cmyatt/Exploring_Direct2D | Vector2D.h | #ifndef VECTOR_2D
#define VECTOR_2D
#include <d2d1.h>
#include <cmath>
class Vector2D
{
public:
typedef enum {
BY_X, BY_Y, BY_XY, BY_YX, BY_MAGNITUDE
} comparison_type;
Vector2D(double i = 0, double j = 0);
~Vector2D(void);
int compareTo(Vector2D& v, comparison_type ct) const; // -1 if this < v, +1 if this... | TOOL | 0.903576 | 6.559781 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2012-10-02T13:24:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bce4158e84... |
c0ab6ecd-6530-434d-9f57-60e2ef5514a2 | Taha-Adeel/CP | Hard-75/D_GCD_Queries.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort() { std::sort(this->begin(), this->end()); }
void sort_dsc() { std::sort(this->begin(), this->end(), greater<T>()); }
auto sum()... | ALGO | 0.999932 | 3.774987 | {
"github_metadata": {
"branch": "main",
"commit_count": 353,
"repo_created_at": "2022-08-04T08:25:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "62cb934e42... |
d01c1d7f-0ca2-4bf1-a5e7-1411c4d717dc | linhanpi/code | code/数据结构/平衡树/P4567_ 「AHOI2006」_文本编辑器.cpp | /*
* @Author: watering_penguin
* @Date: 2023-02-03 21:49:31
* @Last Modified by: watering_penguin
* @Last Modified time: 2023-02-03 21:49:31
*/
#include<bits/stdc++.h>
#define int long long
// #define ll long long
// #define double long double
//#define pii pair <int,int>
#define lowbit(x) (-x&x)
#define lso... | ALGO | 0.998566 | 4.188011 | {
"github_metadata": {
"branch": "main",
"commit_count": 95,
"repo_created_at": "2023-02-03T02:40:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d721038ece2... |
f4859459-2ae2-4331-93d1-7e8967bbcf0a | vivekpradhan736/DSA-Series | Lecture058 Stack Questions/NStackWithArray.cpp | #include<iostream>
#include<stack>
using namespace std;
class Node {
public:
int index;
Node* next;
Node(int x){
index = x;
next = NULL;
}
};
class NStack {
public:
stack<int>st;
int *arr;
Node **Top;
NStack(int N, int S){
arr = new int[S];
Top... | ALGO | 0.999849 | 4.005571 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-09T14:08: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": "c585100631b0... |
21160167-3911-45d6-b800-6b8de019d12a | ssezmar/my_algorithms | implementations/DSU.cpp | #include <bits/stdc++.h>
/* Classical realization of disjoint set union
Methods: int getPar(int) return parent of node,
bool isConnected(int u, int v) return is connected u and v
void connect(int u, int v) connect node u with node v
Using path compression heuristic.
*/
struct DSU {
std::vector<in... | ALGO | 0.999354 | 5.018097 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2024-08-25T09:53: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": "2584f9124... |
84629231-f6bf-42f1-b229-7b7dfafda5d1 | martasocha/CPP_Zadania | Zad 5.1/Zad5_1soultion.cpp | #include "Zad5_1solution.h"
#include <iostream>
void taskA(int num[], int size)
{
std::cout << "A: " << std::endl;;
for (int i = 0; i < size; i++)
{
//std::cout << num[i] << std::endl;
std::cout << num[i] << "; "; // wersja w jednej linii
}
std::cout << std::endl;
}
void taskB(int n... | ALGO | 0.983469 | 3.515369 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2022-05-12T16:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ca84883bbc... |
e8e9bc85-75b7-41b2-9771-d82777fd7d21 | darthsuogles/phissenschaft | algo/leetcode_218.cxx | /**
* The skyline problem
*/
#include <iostream>
#include <vector>
#include <utility>
#include <cassert>
#include <climits>
#include <queue>
#include <algorithm>
#include <tuple>
using namespace std;
class Solution {
public:
vector<pair<int, int>> getSkyline(vector<vector<int>> &buildings) {
// Build a ... | ALGO | 0.999916 | 5.808117 | {
"github_metadata": {
"branch": "develop",
"commit_count": 190,
"repo_created_at": "2017-03-12T05:28: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": "3673288... |
bd6e60d6-3bf9-4993-a2c8-1aae042c2455 | Caltech-IPAC/libtinyhtm | src/htm/htm_tree_s2circle.cxx | #include <iostream>
#include <sys/mman.h>
#include "tinyhtm/htm.h"
#include "tinyhtm/tree.h"
#include "tinyhtm/varint.h"
#include "htm.hxx"
#include "htm/_htm_s2circle_htmcov.hxx"
#include "_htm_subdivide.hxx"
#include "htm/htm_v3_distance2.hxx"
template <typename T>
int64_t htm_tree_s2circle_template (const struct... | ALGO | 0.992818 | 5.219419 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2015-03-20T21:24:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "089f214312... |
fb1b031b-5462-4e9d-a068-41cbaa2a9f78 | sachiniitbae/CFD-Code | 2D_Cavity_Flow_Vortex/Doublet+Uniform/2D_Cavity_Flow_Doublet_Uniform.cpp | #include <iostream>
#include <math.h>
using namespace std;
#define nx 243
#define ny 81
#define nt 400
#define nit 50
void Cavity_flow(float u[nx][ny],float v[nx][ny],float p[nx][ny],float u_doublet[nx][ny],float v_doublet[nx][ny],float rho, float nu, float dt, float dx, float dy)
{
FILE *fp; FILE *fpv; FILE *fpu;... | ALGO | 0.995094 | 3.875954 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2020-08-03T15:48:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1349dd0cf... |
9e70c727-e499-41f6-b0f2-a8a45a467510 | switchkiller/sandbox | random/miscellaneous/company/microsoft/challenges/MAXPRO.cpp | #include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i < (b); i++)
#define RREP(i,a,b) for (int i = (a); i > (b); i--)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define TRvi(it, c) for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define inf 0x3f3f3f3f
#define EPS 1e-1... | ALGO | 0.999951 | 3.843356 | {
"github_metadata": {
"branch": "master",
"commit_count": 371,
"repo_created_at": "2015-07-10T19:24:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0bb22b2... |
61d822bd-6d3c-4493-ac21-7bce4c3ccd89 | parvez-ahammed/online-judge-solves | codeforces/784_div_4/H_Maximal_AND.cpp |
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define SetBit(x, k) (x |= (1LL << k))
#define CheckBit(x, k) ((x >> k) & 1)
#define rep(start, x) for (int i = start; i < x; i++)
void solve()
{
int n, k;
cin >> n >> k;
vi v(n, 0);
vector<int> mask(33, 0);
rep(0, n)
{
... | ALGO | 0.999871 | 4.574311 | {
"github_metadata": {
"branch": "master",
"commit_count": 508,
"repo_created_at": "2022-07-12T22:20: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": "fd7e5645... |
c20a14b0-54e0-47c4-a5c0-360d7ea016e3 | riazul9807/CPP-Exercise | Programe to delete an element in an array.cpp | #include <iostream>
using namespace std;
int main()
{
int ara[100];
int i, siz, pos;
cout << "Enter array size >>> ";
cin >> siz;
cout << "Enter array elements >>> ";
for(i = 0; i < siz; i ++){
cin >> ara[i];
}
cout << "Enter element position to delete >>> ";
cin >> pos;... | ALGO | 0.996201 | 4.190754 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2020-12-19T13:38:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d28bac79e900... |
9b7b0445-0ec3-4593-8cdc-3468832bbcfc | srabonx/Bindu | Math/Matrix.h | #ifndef BINDU_MATH_MATRIX_H
#define BINDU_MATH_MATRIX_H
#include <stdexcept>
#include <array>
// Matrix internally uses Vector class
#include "Vector.h"
namespace BINDU
{
// Class pre declaration
template<size_t rowCount, size_t columnCount>
class Matrix;
// Function prototypes
template<size_t n... | TOOL | 0.903533 | 6.615829 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2024-07-26T12:17: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": "802bc7d1e... |
79825128-019c-43cc-bff2-7482112e07a4 | iseq1/University | I course/Algorithms and algorithmic languages/Practices/21.03.2022/main.cpp | #include <iostream>
#include <queue>
using namespace std;
class Queue{
struct Node {
int info;
Node* next;
Node (int info){this->info=info; next=nullptr;}
};
Node* head, *tail;
public:
Queue();
~Queue(); // деструктор
bool Empty(); // проверка на пустоту очереди
v... | ALGO | 0.996606 | 3.745223 | {
"github_metadata": {
"branch": "main",
"commit_count": 90,
"repo_created_at": "2024-06-27T16:53:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3b7309f30d9... |
d2e52ce1-8fb1-4a4c-930b-56b63db816c5 | AngelKitty/review_the_national_post-graduate_entrance_examination | books_and_notes/professional_courses/C++_Programming/sources/cpp_code/exam/Chapter3/3_6/3_6.cpp | //3_6.cpp
#include <iostream>
#include <cstdlib>
using namespace std;
//投骰子、计算和数、输出和数
int rollDice() {
int die1 = 1 + rand() % 6;
int die2 = 1 + rand() % 6;
int sum = die1 + die2;
cout << "player rolled " << die1 << " + " << die2 << " = " << sum << endl;
return sum;
}
enum GameStatus { WIN, LOSE, PLAYING };
i... | ALGO | 0.997001 | 3.542735 | {
"github_metadata": {
"branch": "master",
"commit_count": 242,
"repo_created_at": "2019-03-30T09:23:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1026,
"forks": 205,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "69e... |
2c378158-acaf-4441-9547-8cb7e2c95c30 | Karanveer-Mul/CipherSchools_Assignment | Assignment5/Q7.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
class node {
public:
int data;
node* left;
node* right;
node* nextRight;
node(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
this->nextRight = NULL;
}
};
void connectRecur(node* p);
void connect... | ALGO | 0.999733 | 4.85993 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2021-02-13T10:54: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": "18b2030ed... |
c5491c69-ffe0-469c-8567-d8988c2bf0dd | Xilinx/Vitis_Libraries | codec/L2/demos/jxlEnc/third_partys/lib/jxl/dec_noise.cc | // 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.
#include "lib/jxl/dec_noise.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <numeric>
#include <uti... | ALGO | 0.971295 | 7.603892 | {
"github_metadata": {
"branch": "main",
"commit_count": 471,
"repo_created_at": "2019-09-23T19:13:46.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 988,
"forks": 381,
"issues": 0,
"pull_requests": 12
},
"file_meta": {
"content_id": "cab205... |
7d89b60b-1eac-4ee9-8425-f15c98570f17 | keshavsingh4522/hacktoberfest | DP/KadanesAlgorithm.cpp | /*
Kadane's Algorithm
Given an array Arr[] of N integers. Find the contiguous sub-array(containing at least one number)
which has the maximum sum and return its sum.
Example 1:
Input:
N = 5
Arr[] = {1,2,3,-2,5}
Output:
9
Explanation:
Max subarray sum is 9
of elements (1, 2, 3, -2, 5) which
is a contiguous subarray.
E... | ALGO | 0.999977 | 4.353609 | {
"github_metadata": {
"branch": "master",
"commit_count": 1792,
"repo_created_at": "2020-09-24T18:11:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 864,
"forks": 3955,
"issues": 175,
"pull_requests": 2716
},
"file_meta": {
"content_id"... |
0c0235c0-2fde-4be4-847f-6b1b2c6e9e33 | laraconda/cp | cf1332B/sol.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<int> used(35);
for (int i=0; i<35; i++) {
used[i] = 0;
}
vector<int> cols(n);
int c = 0;
vector<int> ps = {2,3,5,7... | ALGO | 0.999927 | 3.495715 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-06-21T01:41: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": "2ad187f441... |
f979b690-a789-47f5-8516-80c62b84059d | JHOJAN2550B/presentacion-jhojan | trabajo de los 19 archivos ultimos/archivo5.10.cpp | #include <iostream>
int euclides(int a, int b) {
// Aplicar el algoritmo de Euclides
while (b != 0) {
int resto = a % b;
a = b;
b = resto;
}
return a;
}
int main() {
int num1, num2;
std::cout << "Ingrese el primer número entero positivo: ";
std::cin >> num1;
... | ALGO | 0.99996 | 5.967807 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-06-26T02:28: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": "a8b5f2bc46... |
8ffba60e-e88f-4e90-9f0d-5042048c72c2 | hbdhj/spoj-cpp | 3407_SAMER08C.cpp | //
// 3407_SAMER08C.cpp
//
//
// Created by <NAME> on 13-5-24.
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
/*
TASK: Candy
ALGO: dynamic programming
Input:
5 5
1 8 2 1 9
1 7 3 5 2
1 2 10 3 10
8 4 7 9 1
7 1 3 1 6
4 4
10 1 1 10
1 1 1 1
1 1 1 1
10 1 1 10
2 4
9 10 2 7
5 1 1 5
0 0
... | ALGO | 0.999853 | 3.697851 | {
"github_metadata": {
"branch": "master",
"commit_count": 498,
"repo_created_at": "2013-01-05T13:42:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "487fadb8... |
b97470ae-ea0f-4396-aa66-b0de804718d3 | chitamha/CPlusPlus_HighSchool_Exercises | C++_Va_C/Self-Study/C++/DSA_LapTrinhThiDau/QHD/QHD Binh Thuong/45_BaiToan27_MuaXiMang_ChuaXong/bt1.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define ii pair<int, int>
#define maxn 105
using namespace std;
int n, q, M[maxn], C[maxn], Slmax=0;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin>> n>> q;
for (int i=1; i<=n; i++){
cin>> M[i];... | ALGO | 0.99999 | 3.243891 | {
"github_metadata": {
"branch": "main",
"commit_count": 122,
"repo_created_at": "2024-06-10T13:57: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": "900cd52893... |
20372eac-d81c-460e-8c72-33a7e4a08794 | Pavankumardontha/Graphs | Standard Graph Algorithms/Minimum_Spanning_Trees(Krushkals_algo).cpp | /*Krushkals Algorithm for MST(coding in hacker-earth as well as geeksforgeeks) */
/*
Given a weighted undirected graph. Find the sum of weights of edges of a Minimum Spanning Tree.A minimum spanning tree (MST)
or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that... | ALGO | 0.999993 | 4.465288 | {
"github_metadata": {
"branch": "main",
"commit_count": 200,
"repo_created_at": "2020-12-30T22:28:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7f93e305e... |
f348eb92-7fbe-4638-9810-801ed9c4f438 | alaneos777/club | project euler/392C_.cpp | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const lli mod = 1e9 + 7;
lli power(lli a, lli b){
lli ans = 1;
while(b){
if(b&1) ans = ans * a % mod;
b >>= 1;
a = a * a % mod;
}
return ans;
}
lli rec(const vector<lli>& P, const vector<lli>& init, lli n... | ALGO | 0.999992 | 4.596489 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2018-08-06T04:13:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b952889bd... |
f8831c6a-17cb-424b-a2f7-33df957f0349 | JimmyZhengyj/Parallel-Computing | hw2-1/openmp-1.cpp | #include "common.h"
#include <omp.h>
#include <cmath>
#include <vector>
#include <iterator>
#include <algorithm>
#include <unordered_set>
using namespace std;
// Put any static global variables here that you will use throughout the simulation.
#define BINSIZE (cutoff * 2.3)
#define NUMTHREADS 20
#define CHUNKSIZE 100... | ALGO | 0.999962 | 5.353717 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2023-02-05T05:25:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f789ee6e75... |
1548dcd7-4871-4730-bf07-e8d2dfd87458 | GungCheoul/CppAlgorithm | CppAlgorithm/BFS/1012.cpp | #include <iostream>
#include <queue>
using namespace std;
#define X first
#define Y second
int board[51][51];
bool dist[51][51];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
queue<pair<int, int>> q;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int t, m, n, k;
cin >> t;
while... | ALGO | 0.999842 | 4.011487 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2022-01-13T01:15:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f1c9ffd85... |
b5b115ba-4dc8-4776-9f72-0c9cfe7c482b | nitinkedia7/CS210-Data-Structures | practice/dfs_stack.cpp | #include <iostream>
using namespace std;
struct adj_node {
int index;
adj_node *ptr;
};
struct node {
int color, parent, d, f;
adj_node *head;
};
void push(adj_node **pHead, int i) {
adj_node *temp = new adj_node;
temp->index = i;
temp->ptr = *pHead;
*pHead = temp;
}
int pop(adj_node **pHead) {
if (*pHead ... | ALGO | 0.999961 | 4.870958 | {
"github_metadata": {
"branch": "master",
"commit_count": 98,
"repo_created_at": "2017-08-22T22:12:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2dc644837... |
34f9ee43-f451-474e-8d59-e38df399031c | gustavobiage/URI_Solutions | AD-HOC/2421.cpp | #include <stdlib.h>
#include <stdio.h>
#include <utility>
using namespace std;
int WIDTH, HEIGHT;
pair<int, int> B[2], A[2];
int x, y;
int max(int a, int b) {
if (a > b) {
return a;
}
return b;
}
int main() {
scanf("%d %d ", &HEIGHT, &WIDTH);
scanf("%d %d ", &x, &y);
A[0] = make_pair(x, y);
A[1] = make_pa... | ALGO | 0.999818 | 3.036715 | {
"github_metadata": {
"branch": "master",
"commit_count": 540,
"repo_created_at": "2019-01-08T17:32:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ef6f137a... |
fdfe7744-e228-406b-b86f-ccc8dd6f217d | hitdshu/hitdsp | filter/filter_fir_kaiser.cc | #include "filter/filter_fir_kaiser.h"
#include "common/macro.h"
#include "common/maths.h"
#include <cassert>
#include <algorithm>
namespace hitdsp {
namespace filter {
void FilterFirKaiser::InitFilterFir(const FilterFirBaseParam ¶m) {
float delta_p = 1 - ::std::pow(10, - param.rp_db / 20);
float delta_s =... | ALGO | 0.954949 | 6.267544 | {
"github_metadata": {
"branch": "master",
"commit_count": 48,
"repo_created_at": "2019-07-31T13:17:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "899549c19... |
d2ea1203-18c8-4639-9035-1c1c03c6d395 | aoapc-book/aoapc-bac2nd | ch8/UVa1451.cpp | // UVa1451 Average
// <NAME>
#include<cstdio>
using namespace std;
const int maxn = 100000 + 5;
int n, L;
char s[maxn];
int sum[maxn], p[maxn]; // average of i~j is (sum[j]-sum[i-1])/(j-i+1)
// compare average of x1~x2 and x3~x4
int compare_average(int x1, int x2, int x3, int x4) {
return (sum[x2]-sum[x1-1]) * (x4... | ALGO | 0.999972 | 3.635547 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2014-06-01T16:48:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2739,
"forks": 998,
"issues": 44,
"pull_requests": 7
},
"file_meta": {
"content_id": "332... |
f06690f3-a523-4079-92a2-5e716622dc3f | msjtw/Algorithmics | advent_of_code/2024/day21/part1_v2.cpp | #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<char, char> pcc;
typedef pair<int, int> pii;
char kp1[4][3] = {{'7','8','9'},{'4','5','6'},{'1','2','3'},{'x','0','A'}};
char kp2[2][3] = {{'x','^','A'},{'<','v','>'}};
vector<pii> val_pos_1 ... | ALGO | 0.999913 | 3.406966 | {
"github_metadata": {
"branch": "main",
"commit_count": 157,
"repo_created_at": "2020-12-01T17:05:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7d7ce4abd8... |
347ddfdc-1077-4dac-a385-8d56c365e6f2 | arnavarora1710/Competitive_Programming | Codeforces/1975B.cpp | // https://codeforces.com/contest/1975/problem/B
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define mp make_pair
#define MULTI_TEST (1)
const int maxn = 2e5 + 5, ... | ALGO | 0.999912 | 4.249437 | {
"github_metadata": {
"branch": "main",
"commit_count": 513,
"repo_created_at": "2023-11-05T09:57: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": "3a5f8ae5aa... |
568db9d7-83d9-41e7-a886-1b0684b76b1b | pedrosoutinho/cp-dump | 2032D.cpp | #include "lib/template.hpp"
#include "lib/graph-base.hpp"
#include "lib/tree.hpp"
void solve(int tc) {
auto ask = [&](int a, int b) {
ps("?", a, b);
cout.flush();
Int(x);
return x;
};
Int(N);
Graph<int> G(N);
V<vi> B;
rep(i, 2, N) if (ask(1, i) == 0) {
... | ALGO | 0.999906 | 4.5512 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2025-03-26T03:09: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": "848c241a51... |
442f7ce6-f6f4-4f3b-a31e-083400b1a6aa | realmelan/leetcode | solutions/fiveStarReviews.cpp | //
// fiveStarReviews.cpp
// leetcode
//
// Created by <NAME> on 11/10/20.
// Copyright © 2020 <NAME>. All rights reserved.
//
#include "common.h"
using namespace std;
namespace fiveStarReviews {
/*
// TODO: copy problem statement here
Platform: HackerRank
Position: SDE2
Date: SEP 2020
Country: US
Given the... | ALGO | 0.999629 | 5.737474 | {
"github_metadata": {
"branch": "master",
"commit_count": 138,
"repo_created_at": "2018-02-06T17:48:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a005c8d3... |
9286caa7-7efc-4dd4-a992-905887a57f51 | beru/DrawCircleTest | graphics/graphics_DrawCircleGradient.cpp | #include "graphics_impl_common.h"
#include <math.h>
#include <algorithm>
#include <smmintrin.h>
namespace Graphics {
void DrawCircleGradient(
float cx, float cy, float diameter1, float diameter2,
const ClippingRect& clippingRect,
const uint16_t* distanceTable, uint8_t distanceTableShifts,
const pixel_t* colorTabl... | ALGO | 0.992696 | 5.993106 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2013-02-16T21:52:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "ec1b2acb7... |
db773baf-d6b5-4ecd-b343-4da23505b257 | alexandraback/datacollection | solutions_1485490_0/C++/jumpingKey/main.cpp | #include <iostream>
using namespace std;
struct Node
{
long long c; int num;
}box[105],toy[105];
int T,n,m;
long long min(long long a,long long b)
{
if (a > b) return b;
else return a;
}
int main()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
scanf("%d",&T);
for (int ca = 1;ca <= T;++ca)
... | ALGO | 0.999965 | 3.312276 | {
"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": "5be1972f2... |
477e49f5-ba85-4e0c-85eb-5f2465b01597 | Hell0Kitty/pku-online-judge | 3688.cc | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAX_N = 10000;
const int MAX_M = 100000;
int n, m;
int a[MAX_N];
bool dp[MAX_M][2]; // dp[i][0]:保存奇数能到
void solve() {
memset(dp, false, sizeof(dp));
dp[0][1] = true;
for (int i = 0; i < n; i++) {
for (int j = m - a[i]; ... | ALGO | 0.999951 | 3.372244 | {
"github_metadata": {
"branch": "master",
"commit_count": 4334,
"repo_created_at": "2017-03-03T05:44: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": "7df9237... |
e7f630a5-3c03-4067-87a5-34f83b653f94 | sejung-hong/Study_Recode | 프로그래머스/level2/뉴스 클러스터링.cpp | //프로그래머스 뉴스 클러스터링
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(string str1, string str2) {
int answer = 0;
vector <string> s1;
vector <string> s2;
//str1 집합
for (int i = 0; i < str1.size() - 1; i++) {
string s = "";
... | ALGO | 0.999967 | 4.624266 | {
"github_metadata": {
"branch": "main",
"commit_count": 283,
"repo_created_at": "2021-01-21T09:39: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": "dbf9995089... |
04abbe2c-9d08-4c8b-afbf-830f2e209cf9 | kunyavskiy/competitive-programming-archive | opencup/18-19/180916/D.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>... | ALGO | 0.999932 | 4.355488 | {
"github_metadata": {
"branch": "main",
"commit_count": 53,
"repo_created_at": "2022-10-08T20:56: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": "aec5b6e459c... |
542c46f5-0421-4ebb-b312-c4e19356b125 | tfg1434/cp | HackerRank/VimWar.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#endif
#define f first
#define s second
template<class T> using V = vector<T>;
using vi = V<int>;
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
... | ALGO | 0.999988 | 4.682273 | {
"github_metadata": {
"branch": "master",
"commit_count": 1550,
"repo_created_at": "2022-01-03T21:50: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": "ebfe580... |
bf360d47-3f5b-48e4-8017-b64daf4780d2 | AndrewJKHumphrey/CPP-Programming-Language | C++ Primer/Chapter 6/Exercise_6.15.cc | /*
Exercise 6.15: Explain the rationale for the type of each of find_char’s parameters
In particular, why is s a reference to const but occurs is a plain reference? Why are
these parameters references, but the char parameter c is not? What would happen if
we made s a plain reference? What if we made occurs a reference ... | TOOL | 0.991322 | 3.9661 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2023-11-28T21:11: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": "2f878a6a8d4... |
93aef7a4-7c26-437a-a151-5cf4ca16adb0 | fpagyu/note | algorithm/caribbean.cc | #include <iostream>
#include <algorithm>
const int N = 1000005;
using namespace std;
double w[N]; // 古董的重量数组
int main() {
double c;
int n;
cout << "请输入载重量C及古董个数n: " << endl;
cin >> c >> n;
cout << "请输入每个古董的重量, 用空格分开: " << endl;
for (int i = 0; i < n; i++) {
cin >> w[i]; // 输入每个物品的... | ALGO | 0.999975 | 3.835138 | {
"github_metadata": {
"branch": "master",
"commit_count": 64,
"repo_created_at": "2018-08-28T01:43:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 22,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd1d69c6... |
6c1f6ae1-e94d-41d9-a6d7-c5e8da27b22a | windmaomao/fjlib | src/fjlib_root.cpp | #include "fjlib_root.h"
namespace fjlib {
bool TFJRoot_Bracket::brac(float_t& _x1,float_t& _x2)
{
const int NTRY=50;
const float_t FACTOR=1.6;
float_t f1,f2;
if (_x1 == _x2) throw "\nBad initial range in fjlib_root.cpp\n";
f1=call_xf(_x1);
f2=call_xf(_x2);
for (size_t j=0;j<NTRY;j++) {
if (f1*f2 < 0.0) retu... | ALGO | 0.999801 | 5.469062 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2013-02-03T18:07: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": "4d9152534f... |
22e011c8-2e70-4031-894d-4a58afaf3179 | nevin-joshy/Data_Structures_cpp | HW10/priority_queue.h | #ifndef priority_queue_h_
#define priority_queue_h_
#include <cassert>
#include <iostream>
#include <vector>
#include <map>
// The DistancePixel_PriorityQueue is a customized, non-templated
// priority queue that stores DistancePixel pointers in a heap. The
// elements in the heap can be looked up in a map, to quic... | ALGO | 0.993669 | 5.98614 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2023-07-02T21:26: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": "45fc923dbc7... |
8547edce-cc6c-40bd-84aa-55ede6fd4db3 | ketankr9/leetcode-solutions | 912.sort-an-array.cpp | /*
* @lc app=leetcode id=912 lang=cpp
*
* [912] Sort an Array
*
* https://leetcode.com/problems/sort-an-array/description/
*
* algorithms
* Medium (63.15%)
* Total Accepted: 26.1K
* Total Submissions: 41.3K
* Testcase Example: '[5,2,3,1]'
*
* Given an array of integers nums, sort the array in ascending... | ALGO | 0.999996 | 6.121834 | {
"github_metadata": {
"branch": "master",
"commit_count": 748,
"repo_created_at": "2018-12-11T03:23:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "433df863... |
3800b832-8a7e-4887-91e8-e82e9ab93682 | eulerphi/usaco | milk3/milk3.cpp | /*
ID: eulerphi
PROG: milk3
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cstdint>
#include <algorithm>
#include <vector>
#include <unordered_set>
uint8_t A, B, C;
std::vector<uint8_t> result;
std::unordered_set<uint32_t> seen;
struct Combo {
uint8_t a;
uint8_t b;
uint8... | ALGO | 0.999922 | 3.391838 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-09-26T21:35:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7d17b66fd9... |
b3e176e9-77ad-492a-8f72-4cc06444cbbb | ishandutta2007/codeforces-k | krk/normal/909/E.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;
const int Maxn = 100005;
int n, m;
int E[Maxn];
vector <int> neigh[Maxn];
int in[... | ALGO | 0.999837 | 3.465338 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "316b2787d7ec... |
85f5dc31-9622-43b3-8923-a327229af373 | Sumitkk10/CP-Solutions-Archive | CodeChef/C++14/TWTCLOSE/33052652.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
int main(){
fast;
ll n, k;
cin >> n >> k;
vector<ll> a(n+1);
for(int i = 0; i <= n; ++i)
a[i] = 0;
while(k--){
... | ALGO | 0.999736 | 3.807939 | {
"github_metadata": {
"branch": "main",
"commit_count": 1538,
"repo_created_at": "2022-06-02T10:50: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": "ebe99baf1... |
572cf84a-fc34-4aef-bd00-350b96cca6f5 | Jackent2B/My-DSA | bst/isBST method1.cpp | #include<bits/stdc++.h>
using namespace std;
struct BstNode {
int data;
BstNode* left;
BstNode* right;
};
bool isSubtreeLesser(BstNode* root, int value){
if(root == NULL)
return true;
if(root->data < value
&& isSubtreeLesser(root->left,value)
&& isSubtreeLesser(root->right, value)
)
return true;
e... | ALGO | 0.999811 | 4.131202 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2021-03-10T07:45: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": "b36e0701b6f3... |
32c0fd97-962e-4db9-b680-d547f05d8358 | Andreshk/AlgorithmNotes | DynProgSolutions/MinimumCoinCount.cpp | #include "DynProgProblems.h"
#include <print>
#include <vector>
// T(n,S) = O(nS), M(n,S) = O(S)
void minimumCoinCount(std::span<const int> coins, const int S) {
assert(S >= 0);
constexpr int infinity = std::numeric_limits<int>::max();
std::vector<int> M(S + 1, infinity);
M[0] = 0;
for (int x = 1; ... | ALGO | 0.999609 | 5.311234 | {
"github_metadata": {
"branch": "master",
"commit_count": 75,
"repo_created_at": "2017-05-16T14:56:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 18,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ea9a0fcd... |
5ab66cdd-6fb2-4ba9-9f6b-1c2880817d3f | fantasy-08/puzzels | CF/Functions again.cpp |
// Problem : A. Functions again
// Contest : Codeforces - Codeforces Round #407 (Div. 1)
// URL : https://codeforces.com/problemset/problem/788/A
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//#pragma GCC optimize "trapv"// WA to RE int!!
#include <b... | ALGO | 0.999981 | 3.897172 | {
"github_metadata": {
"branch": "master",
"commit_count": 224,
"repo_created_at": "2020-03-05T04:36: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": "c32d529c... |
5fee342d-70ec-4018-afab-c1d663faf984 | zadinvit/BIGpluginMitsuba | MIFlib/src/MIF.cpp | /**
* MIFlib - Multi-Image Format Library - version 0.4
* --------------------------------------------------------
* Copyright (C) 2021, <NAME> (<EMAIL>) and <NAME>
* Report bugs and download new versions at https://github.com/RadomirVavra/MIFlib/
*
* This library is distributed under the 3-clause BSD license. See noti... | TOOL | 0.931767 | 6.053256 | {
"github_metadata": {
"branch": "main",
"commit_count": 40,
"repo_created_at": "2021-03-01T14:52:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a51ec417495... |
8c309cf8-676f-42ef-9237-3fc20671ec02 | WhiZTiM/coliru | Archive2/69/0b634d0eb23095/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <funzioni.h>
#define DESTRA 1
#define SINISTRA 2
#define SU 3
#define GIU 4
int mat[100][2];
int direzione=DESTRA;
int lunghezza=1;
int x_cibo,y_cibo;
bool esci=false;
void generacibo();
void cornice();
void coordinate(int );
void controllo();
int ... | ALGO | 0.996136 | 3.973964 | {
"github_metadata": {
"branch": "master",
"commit_count": 42630,
"repo_created_at": "2016-04-21T16:34: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": "471681... |
b0a2b7ec-a389-4ca4-8749-3daf2349052a | ytsaurus/ytsaurus | contrib/clickhouse/src/Processors/QueryPlan/Optimizations/actionsDAGUtils.cpp | #include <Processors/QueryPlan/Optimizations/actionsDAGUtils.h>
#include <Core/Field.h>
#include <Functions/IFunction.h>
#include <Columns/ColumnConst.h>
#include <stack>
namespace DB
{
MatchedTrees::Matches matchTrees(const ActionsDAG::NodeRawConstPtrs & inner_dag, const ActionsDAG & outer_dag, bool check_monotonic... | ALGO | 0.965184 | 6.426982 | {
"github_metadata": {
"branch": "main",
"commit_count": 83261,
"repo_created_at": "2022-12-05T16:32:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2063,
"forks": 164,
"issues": 335,
"pull_requests": 38
},
"file_meta": {
"content_id": "0... |
2b47db5e-2bb8-4741-b80e-804b2cd4204f | apache/brpc | src/brpc/builtin/sorttable_js.cpp | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | TOOL | 0.953269 | 4.880654 | {
"github_metadata": {
"branch": "master",
"commit_count": 3401,
"repo_created_at": "2017-09-04T09:28:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 17198,
"forks": 4042,
"issues": 371,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
30e4c5d2-27c8-4881-ae6a-25b9a1a9f45f | ilvokhin/cses-problem-set | introductory_problems/apple_division.cpp | #include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>
using namespace std;
using ll = long long;
const ll INF = numeric_limits<ll>::max... | ALGO | 0.999952 | 4.423492 | {
"github_metadata": {
"branch": "master",
"commit_count": 136,
"repo_created_at": "2020-03-09T14:17:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f5b0043d... |
108ff4db-30ee-444b-bd0e-14c48478f70e | otaGran/uva | UVa1594.cpp | //
// Created by beans on 2017/1/11.
//
#include <iostream>
#include <set>
#include <cmath>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
//typedef int[] Set;
void next_ducci(int *x, int n) {
int tmp = x[0];
for (int i = 0; i < (n - 1); ++i) {
x[i] = abs(x[i] - x[i + 1... | ALGO | 0.9998 | 3.585406 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2017-09-24T08:44: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": "ddad4420f... |
a590abca-e690-4822-b9e5-e509eb1a981e | Misttgun/physics-2d | game/src/physics/CollisionDetection.h | #pragma once
#include "RigidBody.h"
#include "physics/Shape.h"
struct Contact
{
RigidBody* a;
RigidBody* b;
Vec2 start;
Vec2 end;
Vec2 normal;
float depth;
};
inline bool IsCollidingCircleCircle(RigidBody* a, RigidBody* b, std::vector<Contact>& outContacts)
{
const CircleShape* aCircleShape = dynamic_cast<C... | ALGO | 0.996774 | 6.780225 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2022-11-26T22:24:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a3ab57bb... |
39e74b53-49b8-462b-8112-f356ef9fd098 | wangyupin/DS_project3 | algorithm_ST.cpp | #include <iostream>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include "../include/player.h"
#include "../include/algorithm.h"
using namespace std;
int minimax_alpha_beta(Board board,int depth,int a,int b,Player player);
int val_func(Board board,Player player);
int get_val(bool my_turn,Board board,int... | ALGO | 0.999108 | 4.00597 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-09-07T06:15:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e19d7d2a8ba7... |
f2b50719-4770-435e-8d25-7acb30e0cb17 | enzo1982/smooth | classes/misc/hash/sha1.cpp | /* The smooth Class Library
* Copyright (C) 1998-2018 <NAME> <<EMAIL>>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of "The Artistic License, Version 2.0".
*
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WIT... | ALGO | 0.970641 | 6.81604 | {
"github_metadata": {
"branch": "master",
"commit_count": 1379,
"repo_created_at": "2017-08-20T16:44:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 29,
"forks": 12,
"issues": 4,
"pull_requests": 1
},
"file_meta": {
"content_id": "47b97... |
9a053f4f-0c09-41f9-ab24-46fe48886760 | ShahilGuptaa/CDC | 3. DSA/DP-Standard/F_Bit_Mask_DP/B4_Number_Of_Hamiltonian_Cycle.cpp | #include<bits/stdc++.h>
using namespace std;
using lli = long long int;
using ii = pair<lli,lli>;
int n,m, init; //n<=20
vector<vector<lli>> g,dp;
map<ii,int> freq;
//Find number of hamiltonian Cycles
lli ways(int nn, int mask) //no. of hamiltonian walks from nn to 0 with visited as mask
{
if(mask+1==(1<<n)){
... | ALGO | 0.99948 | 3.79132 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-07-16T10:42: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": "8ececbc49b24... |
a60699d2-3732-4b44-93c3-5a21756df469 | LouiseBC/Tetris | Tetris/src/AI.cpp | #include "AI.hpp"
#include <iostream>
#include <numeric>
void AI::init(Board* tetrisboard)
{
board = tetrisboard;
isComputer = true;
}
void AI::update()
{
if (moveQueue.size() > 0)
push_move();
else
choose_move();
}
void AI::choose_move()
{
possibleStates.clear();
possibleMove... | ALGO | 0.998464 | 5.318925 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2017-01-30T15:48:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "383888fb4... |
728deef7-fe90-4601-9522-b8fe842910de | WavesUR/leetcode-study | 47/src.cpp | #include <iostream>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <climits>
#include <unordered_map>
using namespace std;
class Solution {
public:
bool * arr;
vector<vector<int> > permuteUnique(vector<int>& nums) {
... | ALGO | 0.999973 | 5.147129 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2017-01-03T22:06: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": "3ba405aff... |
19d42677-b8a9-43a2-8900-26b9ed0e4299 | wongswk/magi | MATLABmagi/src/solveMagi.cpp | #include "mex.h"
#include "armaMex.hpp"
#include "../../cmagi/MagiSolver.h"
using namespace arma;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
const mat yFull = armaGetPr(prhs[0]);
const vec tvecFull = armaGetPrVec(prhs[2]);
const vec sigmaExogenous = armaGetPrVec(prhs[3]... | ALGO | 0.999726 | 6.212388 | {
"github_metadata": {
"branch": "master",
"commit_count": 1513,
"repo_created_at": "2017-05-25T18:25:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a65c03... |
ffc01bfa-577d-4f98-9f8a-fa747afa816f | dev001hajipro/aoj_cpp | ALDS1_8_A/main.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <cstdlib>
using namespace std;
struct Node
{
Node *parent;
Node *left;
Node *right;
int key;
};
const int MAX = 500000;
void insert(Node **root, int num)
{
Node *newNode = (Node *)malloc(sizeof(Node));
newNode->key = num;
... | ALGO | 0.999829 | 4.841682 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2018-01-09T09:11: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": "7a7b5d239... |
271cd47d-02d6-4e0a-bde5-a1da2f06000f | danielhanchen/cuml | cpp/src/umap/runner.h | /*
* Copyright (c) 2019, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... | ALGO | 0.999179 | 6.513594 | {
"github_metadata": {
"branch": "branch-0.9",
"commit_count": 4317,
"repo_created_at": "2019-07-26T15:30:10.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "rapidsai/cuml",
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content... |
7ca2f379-73ce-4804-ace6-0d647db59d56 | Nginze/cpp-tictacktoe | tictactoe.cpp | #include<iostream>
#include<ctime>
using namespace std;
void drawBoard();
void resetBoard();
void playerMakeMove();
void cpuMakeMove();
bool isDraw();
char hasWinner();
char board[3][3];
int main()
{
resetBoard();
drawBoard();
while(!isDraw()){
playerMakeMove();
if(hasWinner() != ' '... | ALGO | 0.994358 | 4.21786 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2022-08-02T00:17: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": "3af61495f3... |
6ec6c343-0afa-4de4-a304-fcee7474e093 | thehamzaihsan/DSA | [01] Questions/stack.h | #include <iostream>
using namespace std;
class Stack
{
public:
Node *head;
Stack()
{
head = NULL;
}
void push(int data);
int pop();
void display();
bool isEmpty(){
if(head == NULL){
return true;
}
else{
return false;
}
... | ALGO | 0.995628 | 4.497853 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-02-22T09:42:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c62bd2f02b0... |
02d4701c-cb0a-4e70-8c75-d8ae2204c390 | arshiabehzad/assignment2 | Cell.cpp | #include "cell.h"
#include <iostream>
using namespace std;
bool isAlive;
char status;
int rowPos;
int colPos;
Cell::Cell()
{
status = '-';
isAlive = false;
rowPos = -1;
colPos = -1;
}
Cell::Cell(char status)
{
this->status = status;
if (status == '-')
isAlive = false;
else if (s... | ALGO | 0.993523 | 4.391691 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-09-28T01:17: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": "908cbdadd1... |
48ad1b9f-451e-445a-ba11-fa2c71069398 | nyvek28/avl-binary-tree | main.cpp | /*
* Tarea 3
* Curso: Estructuras de Datos 2
* Integrantes: <NAME>, <NAME>, <NAME> y <NAME>
*/
#include <iostream>
#include <string>
#include "Gestor.h"
using namespace std;
void print(string message) {
cout << message << endl;
}
void blankLine() {
cout << endl;
}
void singleLine(string message) {
blankLine(... | ALGO | 0.921163 | 4.725382 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-10-03T23:38: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": "c36b8d538e... |
89968107-5d36-4d65-8282-cc03c09e7daf | TJFord/sard | USER-OMP/pair_beck_omp.cpp | /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
<NAME>, <EMAIL>
This software is distributed under the GNU General Public License.
See the README file in t... | ALGO | 0.999459 | 6.363788 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2013-05-25T01:38:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed0c0b408... |
4ceeb233-744b-4b4e-b220-560db44bdf76 | chosanglyul/PS | NYPC/2020/2/C1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<ll, pl> pll;
#define fi first
#define se second
const ll LLINF = 1e10+1;
ll gety(pl x, ll t) { return x.fi*t+x.se; }
void rev(vector<pl>& E) {
for(auto &i : E) { i.fi *= -1; i.se *= -1; }
}
ll findx(pl a, pl b... | ALGO | 0.999954 | 3.626009 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2021-02-15T09:25:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ba43ae0f68a... |
3c0c3f03-6f28-45ca-863f-f7ba44e4603a | educatedpolarbear/Rep1 | CapSoCoTongBangK.cpp | #include <bits/stdc++.h>
using namespace std;
long long check(int a)
{
if (a==0) return 0;
if (a==1) return 1;
return a + check(a-1);
}
int main()
{
int N;
cin>>N;
while (N--)
{
int a,b;
cin>>a>>b;
int C[a];
for (int i=0; i<a; i++) cin>>C[i];
sort (C,C... | ALGO | 0.999735 | 3.493883 | {
"github_metadata": {
"branch": "main",
"commit_count": 296,
"repo_created_at": "2021-05-31T03:03:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee2b925bb9... |
4c3ba588-92fa-434d-a454-3f7b97a4fbe1 | raincross7/code-similarity | codes/train_code/problem379/problem379_106.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define erep(i, n) for (int i = 0; i <= (n); i++)
#define erep1(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
int main() {
int x, y;
cin >> x >> y;
str... | ALGO | 0.999933 | 3.400073 | {
"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": "74075d29aabf... |
524a1916-1067-415c-93cc-9d9e5440faa9 | duguseo1213/algorithm-problems | 백준/Silver/12026. BOJ 거리/BOJ 거리.cc | #define _CRT_SECURE_NO_WARNINGS
#define P printf
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int N;
string str;
int dp[1001];
int main() {
cin >> N;
cin >> str;
for (int i = 0; i <= 1000; i++) {
dp[i] = 21e8;
}
dp[0] = 0;
for (int i = 1; i < str.size(); i++) {
if (s... | ALGO | 0.999928 | 3.480906 | {
"github_metadata": {
"branch": "main",
"commit_count": 313,
"repo_created_at": "2024-02-13T14:39: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": "d35c867a7c... |
88b9568d-3d91-4b71-9d72-c7986e3344fa | yjkim0306/baekjoon | #3009.cpp | // 네 번째 점
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
int x1 = 0;
int x2 = 0;
int x3 = 0;
int y1 = 0;
int y2 = 0;
int y3 = 0;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
if(x1 == x2) cout << x3 << " ";
else if(x... | ALGO | 0.999967 | 3.906755 | {
"github_metadata": {
"branch": "main",
"commit_count": 302,
"repo_created_at": "2023-03-30T08:53: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": "89c9bdf2ef... |
4d69f292-c98d-4997-b699-f7c89a3fddc2 | sssazer/LeetcodeRecoder | 2023.07.20/2023.07.20/918环形子数组的最大和.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
class Solution {
public:
int maxSubarraySumCircular(vector<int>& nums) { // 贪心
// 有两种情况:
// 1:最长子数组在数组中间,没有跨越头和尾,这种情况直接求最长子数组就可以了
// 2:最长子数组跨越了头尾,这种情况相当于数组总和减去了中间的最短子数组,求最短子数组就可以了
int max... | ALGO | 0.999977 | 5.152204 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-06-30T11:32: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": "bff2250b1df... |
bff64307-7c4b-4a6e-8a42-566778fa891b | Kullsno2/C-Cpp-Programs | RemoveLeafAtDistanceLessK.cpp | #include<stdlib.h>
#include<iostream>
using namespace std ;
struct node{
int val ;
struct node * left ;
struct node * right ;
node(int x) : val(x) , left(NULL) , right(NULL) {}
};
void MorrisTraversal(struct node * root)
{
if(!root)
return ;
struct node * cur = root;
while(cur)
{
//cout<<cur->val<<endl;
... | ALGO | 0.999932 | 3.287368 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-03-19T12:11: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": "9ff612cd26... |
f79c5606-a021-4187-b164-0db4131c3ccf | NanyoungKim/Programmers_Skill_Test | 프로그래머스_스킬테스트/라인1.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int solution(vector<vector<int>> boxes) {
int answer = 0;
vector<int> vec1, vec2;
int row = boxes.size();
int col = boxes[0].size();
for (int i = 0; i < boxes.size(); i++) { //행크기만큼
vec1.push_back(boxes[i][0... | ALGO | 0.999977 | 5.121862 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2020-08-22T07:45: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": "651d8dfa2... |
d98950aa-230e-4d73-92b2-eaf5e2e992d2 | BaoHsuanHuang/Programming-I | Final Exercise/Lab/Lab #6/Sorting 2D array.cpp | #include <stdio.h>
#include <stdlib.h>
//#include "function.h"
int compare (const void *pa, const void *pb);
int main(void){
int **array;
int i, number;
scanf("%d", &number);
/** Dynamically create 2d array **/
array = malloc(number * sizeof(int*));
for (i = 0; i < number; i++){
arra... | ALGO | 0.999638 | 3.228662 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-03-14T14: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": "9bfe234275... |
f6ae3f72-468e-4a68-9cf7-89955e86c0c7 | ROAM-Lab-ND/GCWF | CWC_MOSEK/CWC_Lin.cc |
#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include "fusion.h"
#include <chrono>
using namespace std;
using namespace mosek::fusion;
using namespace monty;
using namespace chrono;
// #define DEBUG
// Defien ma... | ALGO | 0.985112 | 4.263372 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2022-09-25T18:41:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1f6e3a44bd77... |
d0284dfa-27e3-438f-a247-fa63865d143e | minjoony/BaekJoon_algorithm | 탐색_14919_분포표 만들기.cpp | /*
BaekJoon #14919 분포표 만들기
<ADT>
1. 엔터를 입력받아야 입력이 끝나므로 string으로 입력을 받는다.
2. string에서 실수에 해당하는 정보만 실수화 해준다. ( 0. 이후의 숫자들을 1/10, 1/100 에 곱해주고 이 값들을 더해준다.)
3. sort함수로 오름차순 정렬해준다.
4. 탐색을 통해 각 L에 해당하는 수를 세준다.
<오답노트>
indicator를 초기화해주는 과정에서 indicator = 1 / m; 이라고 명시했더니 int로 형변환이 되었다. 따라서 (double) 1/ m; 이라고 작성해 주어야 한다.
1. 맨... | ALGO | 0.999577 | 3.258055 | {
"github_metadata": {
"branch": "master",
"commit_count": 101,
"repo_created_at": "2020-01-05T14:48: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": "2f0de224... |
75cd63b5-e3e6-4e47-a872-40e1d4ae6614 | louisfghbvc/Other-Online-Judge | HackerEarth/October Easy '20/Let's swap.cpp | // Well, a observe. hard to think.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e5+5;
LL arr[N];
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; ++i) cin >> arr[i];
LL res = 0;
LL mn = 1e7;
LL mx = -1;
for(LL i = 1; i <= n; ++i){
res += abs(arr[i]-i);
mx = max... | ALGO | 0.999979 | 4.277043 | {
"github_metadata": {
"branch": "master",
"commit_count": 837,
"repo_created_at": "2018-10-29T11:02:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "313042c0... |
608c352e-8d0f-48f3-8ae7-af8ab0b82e44 | yanglr/leetcode-ac | cpp-leetcode/leetcode140-word-break-ii_trie_and_dfs.cpp | #include<vector>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
class Solution {
struct TrieNode
{
TrieNode* next[26];
bool isEnd;
TrieNode()
{
isEnd = false;
for (int i = 0; i < 26; i++)
next[i] = nullptr;
... | ALGO | 0.999406 | 5.221268 | {
"github_metadata": {
"branch": "master",
"commit_count": 644,
"repo_created_at": "2016-04-23T08:14:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 130,
"forks": 135,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1e3... |
18d9ce67-874a-4179-9634-834b09c74af0 | dungprolhvn/PTIT-codes | dsa/DSA04024.cpp | #include <bits/stdc++.h>
#define pb push_back
typedef unsigned long long ll;
using namespace std;
const long mod = 1e9+7;
vector<vector<ll>> multiply(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
vector<vector<ll>> rs(n, vector<ll>(n, 0));
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n... | ALGO | 0.99991 | 4.933032 | {
"github_metadata": {
"branch": "main",
"commit_count": 73,
"repo_created_at": "2023-10-02T14:25: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": "bef2e1ce0d3... |
797eb015-8bad-46e8-8979-45a9c686c03b | cbclayton/parallel-minimum-spanning-forest | src/main.cpp | #include <cstdlib>
#include <iostream>
#include <string.h>
#include "timing.h"
#include "graph.h"
#include "boruvka.h"
#include "prim.h"
#include "parallel_boruvka.h"
#include "parallel_prim.h"
#include "merge_boruvka.h"
#include "boruvka_FAL.h"
#include "simple_parallel_prim.h"
void run_prim(std::shared_ptr<Graph> G)... | ALGO | 0.999478 | 4.183552 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2019-11-03T19:44:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bd5c00093... |
4baa97c7-c766-4945-8028-e9dd91ca96a2 | nagacek/SATsolver | src/priority.h | //
// Created by natalia on 02.08.23.
//
#ifndef SATSOLVER_PRIORITY_H
#define SATSOLVER_PRIORITY_H
#include <vector>
#include "lit.h"
#include <ctime>
class assignment;
class cnf;
class priority {
private:
std::vector<double> prio;
double variable_enhance;
double variable_diminish;
std::vector<dou... | ALGO | 0.999918 | 6.111602 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2023-07-30T05:30: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": "4a28a67fa46... |
a06bb258-f6f5-4b1b-859d-ce26249edc91 | Cellul4r/Comp_Programming | Codeforces/1367C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll ceil(ll a, ll b) {
return (a + b - 1) / b;
}
ll cal(ll x, ll k) {
return ceil(x,k+1);
}
void solve() {
int n,k;
cin>>n>>k;
string s;
cin>>s;
ll ans = 0;
ll now = 0;
for(int i=0;i<n;i++) {
... | ALGO | 0.999932 | 3.94176 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2024-09-26T13:58:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bbfd12e... |
d3490bdf-5abb-475b-99a7-2ad66de3a744 | lakshyasaxena/CP-Algorithms-in-C_plus-plus | ComponentsOfAGraph.cpp | Connected components in a graph refer to a set of vertices
that are connected to each other by direct or indirect paths.
In other words, a set of vertices in a graph is a connected component
if every node in the graph can be reached from every other node in the graph.
Algorithm:
step-1 Mark all vertices as non visi... | ALGO | 0.999884 | 6.281309 | {
"github_metadata": {
"branch": "master",
"commit_count": 144,
"repo_created_at": "2020-04-16T14:18:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 10,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "ae01691... |
8d10da89-40fe-4720-93c4-9fbf69ec15a4 | quasar0204/Problem-Solving | BOJ/7579.cpp | #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <set>
#include <deque>
using namespace std;
#define all(v) (v).begin... | ALGO | 0.999982 | 3.456216 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2020-08-26T10:56: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": "bf9d6f984... |
f4866383-0bbf-41b8-abb0-c65a51118e39 | Jary-lrj/leetcode-codes | code/1170.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int mostCount(string &s)
{
int cnt[27];
memset(cnt, 0, sizeof(cnt));
sort(s.begin(), s.end());
for (int i = 0; i < s.size(); i++)
cnt[s[i] - 'a']++;
for (int i = 0; i < 26; i++)
{
... | ALGO | 0.999966 | 4.77163 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2021-07-28T08:52: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": "d6085b7bd26... |
2ad7aa62-f541-4ba3-8877-150fe627070b | RajAdwaita/DATA-STRUCTURES | labfat2.cpp | #include <iostream>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
int arr[n] = {};
for (int i{}; i < n; i++)
{
cin >> arr[i];
}
int max = -1;
int front[k];
int back[k];
front[0] = arr[0];
for (int i{1}; i < k; i++)
{
front[i] = ar... | ALGO | 0.999969 | 3.943758 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2021-08-23T14:43:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e953aa2982... |
717f008a-b81b-4f65-a54f-afaca8786891 | cnavneet/CtCI | Stacks_and_Queues/StackOfPlates/StackOfPlates.cpp | #include<bits/stdc++.h>
using namespace std;
class Stacks
{
vector<int> arr;
vector<int> top;
vector<int> next;
int n;
int size;
public:
Stacks(int n);
void push(int item);
bool isFull()
{
return (size == n);
}
bool isEmpty()
{
return (size == 0);
... | ALGO | 0.999171 | 3.86095 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2019-02-17T10:34: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": "f96ded2e1... |
0182fd3c-fb4f-4301-a2a8-2bf425e51a64 | boatinw99/CompetitiveProgramming | Codeforces/549C.cpp | /*
waste ten minutes, mislead!
8 Case analysis : 1 hour 40 minutes
*/
#include<bits/stdc++.h>
using namespace std ;
void pr(char c) {
if(c=='s') {
cout << "Stannis" << '\n';
}
else cout << "Daenerys" << '\n' ;
}
int main() {
int n,k,x=0,y=0 ;
cin >> n >> k ;
for(int i=1,d ;i<=... | ALGO | 0.999955 | 3.840236 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2020-01-19T08:11: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": "0b1a8c078... |
6273d2ea-106a-42cd-8113-9affbbfa329e | urbanGY/problemSolving | programers/level2/후보키.cpp | #include <string>
#include <vector>
#include <iostream>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;
vector<string> set_list;
bool cmp(string a, string b){
return a.size() < b.size();
}
bool is_unique(vector<vector<string>>& relation, string set){
if(set.empty()) return false;
... | ALGO | 0.999793 | 4.882463 | {
"github_metadata": {
"branch": "master",
"commit_count": 200,
"repo_created_at": "2018-07-23T12:37: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": "68dcc787... |
75499e29-656d-450c-af29-873ce91d6ff4 | ronaldosvieira/log-edges | src/parallel/pthreads/log-edges.cc | /*
============================================================================
Name : log-edges.cc
Author : <NAME>
Version : 0.0.1
Copyright : MIT License
Description : Edge detection in images using a parallel and distributed
laplacian-of-gaussian filter.
====================================... | ALGO | 0.995639 | 5.617817 | {
"github_metadata": {
"branch": "master",
"commit_count": 35,
"repo_created_at": "2016-10-01T00:14:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "2976160ef... |
ac07bf06-e071-4302-93d1-f8887703f08d | davidmartinezhi/leetcode | David Martínez/Easy/Array/Contains_Duplicate.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
//1)Listen
//Me llega un array de integers llamado nums
//Regreso true si existen elementos duplicados
//Regreso false si todos ... | ALGO | 0.999102 | 4.517853 | {
"github_metadata": {
"branch": "main",
"commit_count": 903,
"repo_created_at": "2021-12-14T23:48: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": "8ca79ba577... |
d8a8f59f-7780-4029-bb69-324e097bf0e3 | EaindrayFromEarth/Sir_Abdul_Bari_C_DS_Lessons | Part3/004_Linked_List/merge_two_LL.cpp | #include <stdio.h>
#include <stdlib.h>
// Sorted Version
struct Node
{
int data; // Node data
struct Node *next; // Pointer to next node
} *first = NULL, *second = NULL, *third = NULL; // Global pointers for linked lists
void Display(struct Node *p)
{... | ALGO | 0.999997 | 5.285047 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2024-12-09T03:47: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": "cb89e5fe... |
8b9b5dd8-c83f-4d38-8504-338ed7c38e59 | santi2019/UCC-Santiago-Vietto | 2do/Programacion 3/Practico/Parciales/Parciales-Finales/Resolucion de todos/Ej3.cpp | /*[Ejercicio 3]:
Describir qué hace la siguiente función; si es recursiva o iterativa. Si es una
función recursiva, realizar su versión iterativa. Si es una función iterativa, realizar su
versión recursiva.
*/
/* La funcion anterior es iterativa ya que no se esta llamando a si mismo, por lo tanto busca un
numero en... | ALGO | 0.99979 | 5.011356 | {
"github_metadata": {
"branch": "main",
"commit_count": 36,
"repo_created_at": "2023-06-10T22:48:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b11640d8afb... |
90343c23-ea64-476b-8a3d-825ea0b2ad95 | kamyu104/LeetCode-Solutions | C++/closest-nodes-queries-in-a-binary-search-tree.cpp | // Time: O(n + qlogn)
// Space: O(n)
// iterative dfs, binary search
class Solution {
public:
vector<vector<int>> closestNodes(TreeNode* root, vector<int>& queries) {
const auto& iter_dfs = [&]() {
vector<int> inorder;
vector<pair<int, TreeNode *>> stk = {{1, root}};
wh... | ALGO | 0.999985 | 6.198722 | {
"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": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.