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 |
|---|---|---|---|---|---|---|---|
dc3eefd5-df66-4b33-b566-dcae45ec9939 | AntennaeVY/CP | CodeForces/Gym/2024-2025 ICPC Brazil Subregional Programming Contest/K-Karamell.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (auto &ai : a) cin >> ai;
int sum = accumulate(a.begin(), a.end(), 0);
if (sum % 2) {
cout << -1 << endl;
return 0;
}
vector<vector<bool>> dp(n + 1, vector<bool>(sum / 2 + 1, 0));
sort(a.beg... | ALGO | 0.999991 | 3.482821 | {
"github_metadata": {
"branch": "main",
"commit_count": 29,
"repo_created_at": "2022-02-13T15: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": "a32eb8950c0... |
10bac53a-a847-4b14-9a78-a8544c9a6f78 | okaryo/CompetitiveProgramming | AtCoder/ABC/001~100/081~090/084/D.cpp | #include <bits/stdc++.h>
typedef long long LL;
using namespace std;
int main() {
int q;
cin >> q;
vector<int> a(100001, 0);
a[2] = 1;
for (int i = 3; i <= 100000; i += 2) {
bool flag = true;
for (int j = 2; j * j <= i; j ++) {
if (i % j == 0) {
flag = false;
break;
}
}... | ALGO | 0.999651 | 3.756826 | {
"github_metadata": {
"branch": "main",
"commit_count": 573,
"repo_created_at": "2019-04-25T11:58:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5339d4b0d4... |
f07e573b-9190-4989-8534-30fc3e113ddf | Mithril0rd/ComplexCode | Hd4527.cpp | #include <cstdio>
#include <queue>
using namespace std;
struct node {
int x, y, tim, dir;
};
const int MAX_N = 7;
const int dir[5][2] = {0,0, 1,0, -1,0, 0,1, 0,-1};
queue<node> q;
int mat[MAX_N][MAX_N];
void bfs(int x, int y) {
mat[x][y] = 0;
while (!q.empty()) q.pop();
for (int i = 1; i <= 4; ++i) {
int nx ... | ALGO | 0.999882 | 4.112879 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2014-04-01T03:18: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": "54a9b79b2... |
7408f6b2-3dcd-4d58-966e-fb00628107fc | chen8913w/my-acm-solutions | leetcode/plus-one-misunderstand.cc | #include <algorithm>
#include <iostream>
#include <vector>
#include <ctime>
using std::vector;
class Solution {
public:
/**
* I mis-understand the problem...
*/
vector<int> plusOne(vector<int>& digits) {
vector<int> V;
int carry = 1, pos = digits.size() - 1;
while (carry && po... | ALGO | 0.999863 | 5.422124 | {
"github_metadata": {
"branch": "master",
"commit_count": 288,
"repo_created_at": "2014-10-28T19:21:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5afd4497... |
b85aade0-45d2-49e9-a78f-fa0699152486 | NREL/EnergyPlus | third_party/ssc/tcs/numeric_solvers.h | /**
BSD-3-Clause
Copyright 2019 Alliance for Sustainable Energy, LLC
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met :
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the... | ALGO | 0.998381 | 4.509256 | {
"github_metadata": {
"branch": "develop",
"commit_count": 40658,
"repo_created_at": "2013-11-22T14:47:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1278,
"forks": 441,
"issues": 908,
"pull_requests": 48
},
"file_meta": {
"content_id":... |
e2c64acb-6c65-4a30-b407-38f0bf553c34 | hbyacademic/Interesting-PlayList | INTS_006_AstarPathFinding/astar.cpp | #include <iostream>
#include <fstream>
#include <stdlib.h>
#include <vector>
#include <algorithm>
using namespace std;
typedef unsigned char BYTE; // 1 byte (0~255)
typedef unsigned short WORD; // 2 bytes (0~65536)
typedef unsigned long DWORD; // 4 bytes (0~2^32 -1)
#pragma pack(push)
#pragma pack(... | ALGO | 0.998798 | 3.274296 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2018-12-17T11:31:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dde1fe692... |
83b91d29-8815-4f16-8588-58c07ed8526b | AlexFirfarov/olympic-programming | Осень/20 декабря/N.cpp | #include <iostream>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<std::vector<std::pair<int, int>>> g(n);
const int intmax = 2147483647;
int tresh;
std::cin >> tresh;
tresh *= tresh;
int s = 0;
int f = n - 1;
std::vector<std::pair<int, int>> coor(n);
for (int i = 0; i < n; ++i)
std::c... | ALGO | 0.999997 | 5.098706 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2021-09-27T15:57: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": "35a1ef6d7c5... |
fb7e8faf-5f8e-4149-9ba9-7cdd348424c7 | wyrover/book-code | stl_examples/ex05-25.cpp | // Illustrating the generic merge algorithms.
#include <vector.h>
#include <algo.h>
#include <assert.h>
int main()
{
// Initialize vector of integers:
vector<int> vecInt1(5);
vector<int> vecInt2(5);
vector<int> vecInt3(10);
for (int i = 0; i < 5; i++)
vecInt1[i] = 2 * i;
for (i = 0; i < 5; i++)
... | ALGO | 0.999153 | 6.029921 | {
"github_metadata": {
"branch": "master",
"commit_count": 192,
"repo_created_at": "2016-07-24T07:29:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 388,
"forks": 248,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a7e... |
3a81a26d-b7da-40a4-a838-b0d85b92dfdd | Bidhit74/DSA-With-C- | Day 13 - 2D - ArrayAndVector/WaveFormMatrix.cpp | // Question : Write a program to print the matrix in wave form.
// Example:
// 1 2 3
// 4 5 6
// 7 8 9
// Output -- 1 2 3 6 5 4 7 8 9
#include <iostream>
#include <vector>
using namespace std;
void printWaveForm(vector<vector<int>> &matrix, int rows, int cols){
for(int i = 0; i < rows; i++){
if(i%2 == 0... | ALGO | 0.999906 | 5.463147 | {
"github_metadata": {
"branch": "main",
"commit_count": 185,
"repo_created_at": "2023-11-24T13:04: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": "f54bff10af... |
ceb603b5-4553-474a-9636-b3427efce634 | studouglas/GEANT4-GPU | geant4.10.02/examples/extended/exoticphysics/channeling/src/XCrystalPlanarMoliereElectronDensity.cc | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration... | ALGO | 0.989632 | 6.259673 | {
"github_metadata": {
"branch": "master",
"commit_count": 518,
"repo_created_at": "2015-09-13T23:36:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 40,
"forks": 18,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f8c63... |
f3992ecb-11b1-4c83-a616-8cc55bc4151e | MelLain/cluster-bigartm | src/master_main.cc | #include <cstdio>
#include <unistd.h>
#include <signal.h>
#include <iterator>
#include <memory>
#include <string>
#include <sstream>
#include <unordered_set>
#include <utility>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include "glog/logging.h"
#include "common.h"
#include "protocol.h"
#i... | DATA | 0.95813 | 7.074532 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2018-09-20T15:03:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "7b4ce192b... |
bf248d28-2e3b-4f83-b8ac-e0027da4655e | zwkno1/shadowsocks-asio | include/shadowsocks/proto.h | #pragma once
#include <cstring>
#include <variant>
#include <shadowsocks/asio.h>
namespace shadowsocks
{
// [1-byte type][variable-length host][2-byte port]
// 0x01: host is a 4-byte IPv4 address.
// 0x03: host is a variable length string, starting with a 1-byte length, followed by up to 255-byte domain name.
// 0x... | TOOL | 0.920085 | 5.282588 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2019-04-17T07:16:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 15,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "74e351fb... |
da94a710-e122-49c4-aa2e-ae1c29de0bea | delta4d/AlgoSolution | codeforces/235/C.cpp | #include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
int n0, n1;
cin >> n0 >> n1;
if (n1 < n0 - 1 || 2*(n0+1) < n1) {
cout << -1 << endl;
return 0;
}
int r = n1 - n0 + 1, m = max(r, r-4);
for (int i=0; i<m&&i+1<n0; ++i) s += "011", --r;
for (int i=m; i+1<n0... | ALGO | 0.999895 | 3.651258 | {
"github_metadata": {
"branch": "master",
"commit_count": 154,
"repo_created_at": "2013-02-15T16:09:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a02410a3... |
9a2d22dc-b16c-4eae-b200-764b70ef78b8 | dereksodo/allcode | 2019/2019down/luogu/P1005.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef __int128 ll;
#define DEBUG
#ifdef DEBU... | ALGO | 0.99999 | 3.135264 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2019-07-19T16:06:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "12b03a9f5... |
dce971ee-d7c1-4f04-a53c-f417854a6633 | an-sla/hse-algorithms-and-data-structures | Lecture 2_07.04.2022/HW 2/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int lowerbound(vector<int> &v, int x){
int l = 0;
int r = v.size();
while (l < r){
int m = l + (r - l) / 2;
if (x <= v[m]){
r = m;
} else{
l = m + 1;
}
}
if (l < ... | ALGO | 0.999872 | 4.807087 | {
"github_metadata": {
"branch": "main",
"commit_count": 116,
"repo_created_at": "2022-04-21T07:20:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "78de6abf36... |
819aaf1e-bdb2-4094-82a8-8bbaeee3f826 | sunruix/zoj | ac/1649_rescue.cpp | #include <cstdio>
#include <queue>
using namespace std;
struct node {
char c;
int i, j, step;
};
int main()
{
int n, m, i, j, k, ans, dir[4][2] = {-1, 0, 0, -1, 1, 0, 0, 1};
node g[201][201], *temp;
queue<node *> Q;
while (scanf("%d %d\n", &n, &m) != EOF) {
for (i = 0; i < n; i++) {
for (j = 0; j < m; j+... | ALGO | 0.999214 | 3.519842 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2020-08-22T02:35: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": "dd02f3125... |
5f110aee-ad62-4b65-9a86-2437683a7fa8 | petaceta79/Mapeo-de-Adyacencias-entre-Entidades | InterpretarDatosEjecutable.cc | #include "LogicaPrincipal.hh"
int main() {
map<int, string> hashMapIntToString = readHashMap_a_to_b<int, string>(hashMapIntToStringLink);
map<string, int> hashMapStringToInt = readHashMap_a_to_b<string, int>(hashMapStringToIntLink);
vector<vector<bool>> matrizAdyacencias = readMatriz<bool>(hashMapIntToStr... | ALGO | 0.985407 | 3.389961 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2025-03-23T01:05:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2df181b4ce... |
d6538977-3380-4b66-b5c8-7523aacbbde1 | morris821028/UVa | volume125/12573 - Sohel Sir's Assignment.cpp | #include <stdio.h>
#include <math.h>
int main() {
scanf("%*d");
long long x, y;
int i;
while(scanf("%lld %lld", &x, &y) == 2) {
long long n = x-(y-2), sq;
sq = (long long)sqrt(n);
if(n == 0) {
printf("%lld\n", x+1);
continue;
}
int flag = 0... | ALGO | 0.999939 | 3.433172 | {
"github_metadata": {
"branch": "master",
"commit_count": 1197,
"repo_created_at": "2013-06-14T12:34:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 571,
"forks": 269,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "159... |
6d78931d-d8e0-427d-845b-b1abe0e65762 | Debabrata-bhakat/programming-practice | ds_algo/random/Tokitsukaze_and_All_Zero_Sequence.cpp | // https://codeforces.com/contest/1678/problem/A
#include <bits/stdc++.h>
#define ull unsigned long long
using lli = long long int;
using namespace std;
int mod = 1e9+7;
void insert(int* freq,int x, int& cntDistinct){
freq[x]++;
if(freq[x]==1) cntDistinct++;
}
void remove(int* freq, int x, int& cntDistinct){
freq[x... | ALGO | 0.999938 | 4.514838 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2021-07-17T15:01: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": "f3936ecd354... |
dde90e9a-7522-4fc2-9139-5d4fdfed8b41 | iamrudhresh/GeeksforGeeks | Medium/Maximum Sum Combination/maximum-sum-combination.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> maxCombinations(int N, int K, vector<int> &A, vector<int> &B) {
// code here
sort(A.begin(),A.end());
sort(B.begin(),B.end());
priority_queue<pair<int,i... | ALGO | 0.999983 | 5.798985 | {
"github_metadata": {
"branch": "main",
"commit_count": 880,
"repo_created_at": "2023-06-20T15:38:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "47f22a83ca... |
027e183b-190a-47b1-87ff-e20e48fa10cc | JatinGarg19/Leetcode-Coding-Problems | 1519-number-of-nodes-in-the-sub-tree-with-the-same-label/1519-number-of-nodes-in-the-sub-tree-with-the-same-label.cpp | class Solution {
vector<int> array;
vector<int> visited;
public:
vector<int> dfs(int node, vector<vector<int>> &adj, string &labels) {
// Mark the node as visited.
visited[node] = 1;
// Count array to mark the count of char in the subtrees
vector<int> count(26);
... | ALGO | 0.999973 | 6.130958 | {
"github_metadata": {
"branch": "main",
"commit_count": 737,
"repo_created_at": "2022-11-26T11:11:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "df9bb126ac... |
d3770b25-cd55-4408-b2af-d451e81f920a | HongYoungGee/Algorithm | BOJ/14888/14888.cpp14.cpp | #include <iostream>
#include <queue>
#include <algorithm>
#pragma warning (disable:4996)
using namespace std;
int N, arr[13], command[4] = { 0 }; //+ - * /
int vmin = 1000000000, vmax = -1000000000;
void incommand(int num,int sum) //
{
if (num >= N)
{
vmin = min(vmin, sum);
vmax = max(vmax, sum);
return;
}... | ALGO | 0.999867 | 3.66682 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2015-11-17T09:32: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": "8a3424bc9... |
f315c850-2bbb-40c0-9ea5-50b2ee3a8103 | himkwan01/TszKwan_CSC17C_48942 | Hmwk/AVL/test.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
class AVLTreeNode{
public:
T data; //data
int height; //tree height
AVLTreeNode *left; //left tree
AVLTreeNode *right; //right tree
AVLTreeNode(T value, AVLTreeNode *l, AVLTreeNode *r):
dat... | ALGO | 0.998867 | 4.015348 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2015-09-03T17:08:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e48f3312... |
5640da10-5bd6-49b7-899f-ccd98b0cb5b4 | CAS-Atlantic/vtr-verilog-to-routing | vpr/src/place/compressed_grid.cpp | #include "compressed_grid.h"
#include "arch_util.h"
#include "globals.h"
std::vector<t_compressed_block_grid> create_compressed_block_grids() {
auto& device_ctx = g_vpr_ctx.device();
auto& grid = device_ctx.grid;
const int num_layers = grid.get_num_layers();
//Collect the set of x/y locations for each... | TOOL | 0.926643 | 6.872172 | {
"github_metadata": {
"branch": "master",
"commit_count": 19495,
"repo_created_at": "2019-06-17T14:43:37.000Z",
"is_fork": true,
"is_org_owned": true,
"forked_from": "verilog-to-routing/vtr-verilog-to-routing",
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 2
},
"fi... |
acd8ab5c-7a98-4bd8-a569-e60f99191e1b | Andrew-He/Algorithms | isStringAnagram.cpp | #include <iostream>
#include <vector>
#include <string>
#include <limits>
// string counts
// true: "abcd" and "dcab"
// introduce extra array counts table
using namespace std;
int maxCharSize = std::numeric_limits<char>::max();
bool isAnagram(string str1, string str2)
{
vector<int> list1(maxCharSize, 0); // ma... | ALGO | 0.999628 | 5.125093 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2015-11-25T03:34:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9adf1baef... |
00d527bd-cb1c-433a-a1b6-b568f489731a | risavctt/Competetive-Programming | codeforces/problems/Help valissia the wise/sol.cpp | /*
ID: dzlvocp1
TASK:
LANG: C++
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
#define print(a) cout << a << '\n';
#define val(a, b) cou... | ALGO | 0.999785 | 3.376047 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-01-12T09:31:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9ff2aa817f4... |
0fbfc19a-9dc6-4363-ad50-239c7de78b31 | kfg021/Competitive-Programming | AtCoder/ARC/107/c.cpp | /*
An important observation is that the operations on rows and columns are
independent (Swapping rows doesn't effect columns, and vice versa). So,
we can consider them seperately and multiply their results.
First, lets figure out which rows/columns can be swapped with each other.
Because of small constraints, this ca... | ALGO | 0.99999 | 5.349449 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2020-10-11T02:57: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": "abac9d08f... |
1b0aeb2b-533f-4760-80ae-5eada3ad2d79 | AmazingCaddy/acm-codelab | PKU/pku_2104.cpp | #include<iostream>
#define MAXN 100005
using namespace std;
struct node
{
int l,r;
};
node tree[MAXN*3];
int key[MAXN],sortseq[25][MAXN];
void make_tree( int v, int l, int r, int deep )
{
int mid,i,j,k;
tree[v].l=l,tree[v].r=r;
if( l==r )
{
sortseq[deep][l]=key[l];
return;
}
mid=(l+r)>>1;
make_tree( v<<1, l... | ALGO | 0.999999 | 4.205395 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2013-11-28T15:42: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": "8bcacb449... |
ddb684dd-1e54-4c68-ba17-0828f2489b1c | showmanlee/HowCanISolveThisQuestion | BOJ/1000/1761.cpp | // 정점들의 거리
// https://www.acmicpc.net/problem/1761
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<int, int> pr;
int n;
vector<pr> board[40001];
int depth[40001], length[40001], root[40001];
bool visit[40001];
void dfs(int cur, int dep, int len) {
visit[... | ALGO | 0.999989 | 5.130996 | {
"github_metadata": {
"branch": "master",
"commit_count": 1741,
"repo_created_at": "2020-09-16T11:55:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "10d680d... |
ac28839b-ab06-4909-8b64-c67e6a3c50ef | GYC1996/leetcode | refer_offer/zui-chang-bu-han-zhong-fu-zi-fu-de-zi-zi-fu-chuan.cpp | //请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度
class Solution {
public:
int lengthOfLongestSubstring(string s) {
if (s.size() == 0){
return 0;
}
int i = 0, j = 1;
int max = 1;
string temp = s.substr(i, j);
string::size_type position;
// temp = s.substr(... | ALGO | 0.999398 | 4.599709 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2020-08-29T12:07: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": "7de4b904b... |
24717dfe-d4f6-4195-bc2f-f5474bc4a965 | themayank-goyal/Leetcode-DSA-questions | Diagonal Sum In Binary Tree - GFG/diagonal-sum-in-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999495 | 6.132624 | {
"github_metadata": {
"branch": "main",
"commit_count": 106,
"repo_created_at": "2023-03-15T11:23: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": "1cdc89eafc... |
0a567a44-fc58-4fce-8ca3-3ac446b9ae32 | suyash-03/DSA | Graphs/Matrix Problems/PathInMatrix.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// Solution Using DFS
void dfs(int i,int j,int row,int col,int x,int y,vector<vector<int>> &A){
if(i<0 || j<0 || i>=row || j>=col || A[i][j] == 0) return;
if(i == x && j == y){
A[i][j] = 0;
return;
}
A[i][j] = 0;
dfs(... | ALGO | 0.999834 | 4.32073 | {
"github_metadata": {
"branch": "master",
"commit_count": 173,
"repo_created_at": "2021-08-02T13:16:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ab1232d... |
8a975bd1-f092-4455-a613-14851a74294c | thalals/Algorithm_Study | Taewoo/problem_solving/~2021.02/week5/2667.cpp | #include<bits/stdc++.h>
using namespace std;
int graph[26][26];
int visited[26][26];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int N;
vector<int> component;
void dfs(int x, int y, int idx) {
visited[x][y] = 1;
component[idx]++;
for(int i = 0; i < 4; i++) {
int X = x + dx[i];
int ... | ALGO | 0.999934 | 4.215021 | {
"github_metadata": {
"branch": "main",
"commit_count": 1277,
"repo_created_at": "2021-01-19T15:10:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94c8f7c8d... |
65cd641f-dd26-431c-847c-4d5e0ca1f49f | yasukawayuu/portfolio | FREE FIGHTER/collision.cpp | //=============================================================================
//
// 当たり判定処理 [collision.cpp]
// Author :
//
//=============================================================================
#include "main.h"
#include "collision.h"
#include "bullet.h"
#include "wall.h"
#include "shadow.h"
#include "score... | ALGO | 0.91117 | 4.219356 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-01-31T05:28: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": "bec3fb68fe67... |
3fcf3874-ce96-409a-a8bb-f7f5fe4f6fee | ai5/gpsfish | osl/std/osl/progress/effect5x3.cc | /* effect5x3.cc
*/
#include "osl/progress/effect5x3.h"
#include "osl/progress/effect5x3Table.h"
osl::progress::
Effect5x3::Effect5x3(const NumEffectState& state)
{
area_progresses[BLACK]=makeProgressArea(WHITE, state, state.kingSquare(BLACK));
area_progresses[WHITE]=makeProgressArea(BLACK, state, state.kingSquare... | ALGO | 0.943743 | 5.515485 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-07-02T20:31:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b616d976f1... |
184516ed-88d1-4baf-b817-5774818b9024 | Ishwarendra/CompetitiveProgramming | Atcoder/C++/abc269_c/34982324.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "F:\CPP\Debug\debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::vector<std::string> a(10);
for (int i = 0; i < 10; i++)
std::cin >> a[i];
int s... | ALGO | 0.999155 | 3.090042 | {
"github_metadata": {
"branch": "main",
"commit_count": 1516,
"repo_created_at": "2022-09-25T10:25: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": "a2292cb58... |
858de657-f9dc-4c7a-b41d-7f834e99ff5e | ohbumjun/Algorithm_CodingTest | Algorithm/BOJ/백준/Python/2025다시풀것들/SS_포탑부수기_241216.cpp | // https://www.codetree.ai/training-field/frequent-problems/problems/destroy-the-turret/description?page=3&pageSize=5
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <thread>
#include <cassert>
#include <vector>
#include <string>
#include <cstring>
// #include <climits>
#include <set>
#include <queue>
#i... | ALGO | 0.999936 | 4.134138 | {
"github_metadata": {
"branch": "master",
"commit_count": 633,
"repo_created_at": "2020-10-31T12:20:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "df353803... |
8552cfa4-7cd9-4a52-9e18-2ebd870a3c66 | lipsapraharaj/data-structures | Arrays And Matrices/UpperTriangular.cpp | #include<iostream>
#include<conio.h>
#include<process.h>
using namespace std;
class upper
{
int *arr;
int n;
public:
upper(int size=20)
{
int i,j;
n=size;
if(size!=0)
arr=new int[n*(n+1)/2];
else
arr=0;
}
~upper()
{
delete []arr;
... | ALGO | 0.990819 | 3.512823 | {
"github_metadata": {
"branch": "master",
"commit_count": 180,
"repo_created_at": "2020-08-12T12:41: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": "23a8677c... |
026d3a2c-83ac-4f80-acd1-046561d80c31 | Ryansmg/CodingPractice | .contests/Etc/IoiSummer/08-07/1.cpp | #include <bits/stdc++.h>
using namespace std;
template <class t> using v = vector<t>;
template <class t> using v2 = v<v<t>>;
using i32 = int;
using i64 = long long;
#define all(vec) (vec).begin(), (vec).end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define forn(i, j) for(i32... | ALGO | 0.999817 | 4.491367 | {
"github_metadata": {
"branch": "master",
"commit_count": 152,
"repo_created_at": "2023-11-14T17:03: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": "021ad29c... |
f1f5efa6-b368-4859-ade9-6e498dfbddc4 | saedrna/RenderMatch | depends/fastann/dist_l2.hpp | #ifndef __FASTANN_DIST_L2_HPP
#define __FASTANN_DIST_L2_HPP
#include <stddef.h> // size_t
namespace fastann {
typedef void (*cl2func)(const unsigned char *, const unsigned char *, unsigned, unsigned, unsigned *); // cl2func;
typedef void (*sl2func)(const float *, const float *, unsigned, unsigned, float *); // ... | TOOL | 0.905967 | 6.726968 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2019-11-14T08:02:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 26,
"forks": 9,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "075be318... |
73b37a0d-c73e-4a9e-a823-32be2929b208 | arty4325/IC2001-BienVsMal | BienVsMal/Estructuras/heapMuerte.h | #ifndef HEAPMUERTE_H
#define HEAPMUERTE_H
#include <iostream>
#include <algorithm>
#include "listaOrdenada.h"
#include "../Human/persona.h"
template <typename T>
class HeapMuerte {
private:
ListaOrdenada<Persona*> elementos;
int indicePecado; // Con esto decido si es por pecados totales o por un pecado que yo... | ALGO | 0.978841 | 4.191574 | {
"github_metadata": {
"branch": "main",
"commit_count": 85,
"repo_created_at": "2024-10-09T20:38: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": "78b2cb33b7e... |
e9679c03-38a4-43d3-a2d3-3eea0616434c | iprincekumark/Cpp-Codes | PrintTheOccuranceOfEachCharacter2.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
int i, ln, j, f, c;
cout << "Enter String ";
getline(cin, str);
ln = str.length();
for (i = 0; i < ln; i++)
{
f = 0;
for (j = i - 1; j >= 0; j--)
{
if (str.at(j) == str.at(... | ALGO | 0.999855 | 3.675539 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2020-12-13T00:05:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "470de363a309... |
09634f92-d8a0-4dee-8c69-9bb0c0033f1d | DevSusu/Competitive | boj_5397/main.cpp | // https://www.acmicpc.net/problem/5397
// by DevSusu
#include <iostream>
#define fastio \
std::ios_base::sync_with_stdio(0); \
std::cin.tie(NULL); \
std::cout.tie(NULL)
struct LL
{
struct Node
{
char val;
Node *prev, *next;
Node() {}
};
No... | ALGO | 0.999981 | 4.747539 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2021-01-01T15:48: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": "80597fb67... |
75895c66-09ef-4acb-9364-f40c7acb47c3 | Kim-dongeon/Algorithm | SW Academy/[모의]디저트카페.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int N;
int arr[22][22];
int ans = 0;
int dx[] = { 1,1,-1,-1 };
int dy[] = { 1,-1,-1,1 };
//오른쪽 아래, 왼쪽 아래, 왼쪽 위, 오른쪽 위
int isVisited[22][22];
int D[102];//디저트 체크
void dfs(int x, int y , int sx, int sy, int d) {
isVisi... | ALGO | 0.999155 | 3.535128 | {
"github_metadata": {
"branch": "master",
"commit_count": 195,
"repo_created_at": "2018-01-08T07:34:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9fe54fbb... |
80105ba3-785c-4798-9ce0-4476b752f2e9 | omteja04/Contest-Programs | CodeChef/Make_K_Most_Frequent.cpp | /**
* Author: omteja04
* Created on: 15-01-2025 20:18:46
* Description: Make_K_Most_Frequent
**/
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
/*
=========================
Headers
=========================
*/
#pragma G++ optimize("Ofast")
#pragma G++ target("sse,sse2,sse3,ssse3,sse4,popc... | ALGO | 0.999954 | 5.044328 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2024-08-28T05:18: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": "7138af58... |
89cfbe1c-b5e9-4c7d-8fa4-a6520d701184 | RainerKuemmerle/g2o | g2o/types/slam3d/isometry3d_mappings.h | // g2o - General Graph Optimization
// Copyright (C) 2011 <NAME>, <NAME>, <NAME>, <NAME>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain t... | ALGO | 0.934609 | 5.93903 | {
"github_metadata": {
"branch": "master",
"commit_count": 1617,
"repo_created_at": "2012-01-12T10:18:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3276,
"forks": 1126,
"issues": 0,
"pull_requests": 5
},
"file_meta": {
"content_id": "a... |
7d7f79f3-9def-4fcd-83a7-33d58db3f9b4 | Kamran-Mohammed/Github | TicTacToe.cpp | #include<iostream>
using namespace std;
char matA[3][3];
int index1,index2;
void check(int i,int j){
char a = matA[i][j];
if (i==0 && j==0)
{
if (((a==matA[0][1]) && (a==matA[0][2])) || ((a==matA[1][0]) && (a==matA[2][0])) || ((a==matA[1][1]) && (a==matA[2][2])))
{
cout<<endl<... | ALGO | 0.99937 | 3.796218 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2023-12-11T09:53: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": "882e0229bf1... |
bf91e025-b518-4d80-b73e-b00314133e40 | wallbreaker01/Competitive-Programming | A_Noldbach_problem.cpp | #include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
const ll N=1e7+10;
vector<bool>a(N,true);
vector<int>prime;
vector<bool> p(N, true);
void sieve()
{
for(ll i = 2 ; i <= N ; i++)
{
if(a[i])
{
for(ll j = ... | ALGO | 0.999976 | 3.911673 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-02-23T14:32: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": "0a9db2b790b5... |
37f9c72e-c583-4c2d-8adb-7460f7b7c975 | lizhe960118/Machine-Learning | C++_code/2017_interview/头条/01zhaoling.cpp | //Z国的货币系统包含面值1元、4元、16元、64元共计4种硬币,以及面值1024元的纸币,现在小Y使
//用1024元的纸币购买力一种价值为N(0<N<1024)的商品,请问最少他会收到多少硬币?
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
n = 1024 - n; //求出剩余值,现在有n元,要找零
int dp[n + 1];// 保存最后结果
if (n <= 0){
cout << 0;
} else if (n == 1) {
cout <... | ALGO | 0.999651 | 3.314963 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2018-10-10T03:08:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1096086f... |
99d2a03c-24f6-4719-9e71-719208aaeaae | IshtyMahin/xpsc | SuperZone/week13/F_Blocks.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define nl '\n'
#define yes cout << "YES" << nl
#define no cout << "NO" << nl
#define error cout << -1 << nl
#define srt(v) sort((v).begin(), (v).end())
#define coutv(v) for(auto it:v)co... | ALGO | 0.999759 | 3.352587 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2023-12-02T12:43: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": "1ab3480a2d0... |
dfcd7022-effa-470f-ac50-cfa3e2b0896e | 192211838/CSA0610-DAA | EXP-12.cpp | #include <stdio.h>
int binarySearch(int arr[], int size, int target) {
int left = 0, right = size - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (arr[mid] == target) {
return mid;
}
if (arr[mid] < target) {
left = mid + 1;
... | ALGO | 0.999974 | 5.888633 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-11-20T06:53: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": "f95262850b1f... |
5c1d8513-b1c9-4a50-99f9-b12bcedadd64 | uphowshelet/c-- | array.cpp | // Напишите программу на языке C++, которая выполняет следующие действия:
// Создает массив целых чисел размером N (где N вводится пользователем).
// Заполняет массив случайными числами в диапазоне от -100 до 100.
// Выводит массив на экран
// Находит и выводит на экран минимальный и максимальный элементы массива.
// С... | ALGO | 0.997801 | 4.766329 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2024-09-24T10:42: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": "07d30e0302b... |
7dcfd11d-ba61-4774-9a9a-7c86833d5642 | alexandraback/datacollection | solutions_1480487_1/C++/zd987/r1b_1.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999437 | 3.671861 | {
"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": "2c1c1dfb6... |
b3cbae5d-2fac-4a74-adde-1c2d3086a6f8 | Kristiyan025/C-plus-plus | 01. Състезания/Leet Code/Dynamic programing/1277. Count Square Submatrices with All Ones/count_square_submatrices_with_all_ones.cpp | class Solution {
public:
int countSquares(vector<vector<int>>& matrix)
{
int m = matrix.size();
int n = matrix[0].size();
vector<vector<int> > dp(m, vector<int>(n, 0));
int counter = 0;
for(int i = 0; i < m; i++)
{
counter += (dp[i][0] = matrix[i][0]);... | ALGO | 0.999933 | 6.016681 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2019-07-31T17:16: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": "9f8f3f901... |
d7c1bc10-97b6-47a8-b2ef-a7f2c853f977 | kisnaXD/leetcode_and_cpp_progress | solutions/Arrays/twoSumProblem.cpp | #include <bits/stdc++.h>
using namespace std;
// Two Sum Problem (with and without usage of Map)
pair<int ,int> twoSumProblemWithMap(vector<int> &arr, int N, int K) {
map<int, int> mpp;
for(int i=0; i<N; i++) {
int a = arr[i];
int r = K - a;
if(mpp.find(r) != mpp.end()) {
r... | ALGO | 0.999983 | 5.409175 | {
"github_metadata": {
"branch": "main",
"commit_count": 130,
"repo_created_at": "2025-03-10T11:00: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": "688d829bb4... |
791ef242-f5b7-4615-83a5-a3183fd01b5b | gauthamdasu/leetcode_solutions | search_in_rotated_sorted_array.cpp | /*
Searching in rotated sorted array.
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exis... | ALGO | 0.999993 | 6.405333 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-04-14T10:16:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8be664768... |
92269a01-855a-4eab-8d60-c98786087306 | doubleLLL3/hzcla | 6.C++程序设计/x.hws/1.complex_num.cpp | /*************************************************************************
> File Name: 1.complex_num.cpp
> Author: Double
> Mail: <EMAIL>
> Created Time: Tue 02 Mar 2021 08:21:02 PM CST
************************************************************************/
#include <iostream>
using namespace std;
#define gree... | ALGO | 0.975598 | 4.992866 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2020-12-20T13:36:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8328f701077... |
469b42e4-0fa1-4a72-8881-62396e3caee6 | bandlarakesh7/tut-3-interval-trees | intervaltree.cpp | #include <iostream>
using namespace std;
struct Interval
{
int low, high;
};
struct ITNode
{
Interval *i;
int max;
ITNode *left, *right;
};
ITNode * newNode(Interval i)
{
ITNode *temp = new ITNode;
temp->i = new Interval(i);
temp->max = i.high;
temp->left = temp->right = NULL;
re... | ALGO | 0.999799 | 4.669175 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-02-16T17:14: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": "a85bb1a0b6... |
ad8e615a-3f34-49a0-ba67-90f0fbdb1472 | wlrnfyd0329/algorithm | BaekJoon/13 시뮬레이션/17837 새로운 게임 2.cpp | #include <iostream>
#include <stack>
using namespace std;
struct chess {
int x;
int y;
int dir;
};
int n, k;
int info[15][15];
stack<int> board[15][15];
chess horse[15];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
bool isFinish(int nx, int ny) {
if (board[nx][ny].size() >= 4) return true;
... | ALGO | 0.999889 | 3.945474 | {
"github_metadata": {
"branch": "main",
"commit_count": 157,
"repo_created_at": "2024-03-19T15:15:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "91475a558d... |
9354a8b9-fe09-4a74-aa0d-091fa39dea78 | parajiholkar/CPP-DSA | searching_sorting.cpp | #include<iostream>
using namespace std ;
void display_arr(int n, int arr[]){
cout<<"sorted array : ";
for(int i=0; i<n; i++){
cout<< arr[i]<<" " ;
}
}
// bubble sort
void bubble_sort(int n, int arr[]){
int counter=1 ;
// loop will run n-1 times ( Passes == n-1)
for(int i=1; i<n; i++){
for(int j=0; j<n-count... | ALGO | 0.999943 | 4.335951 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-04-21T20:16:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29a88f71e67e... |
31140ab4-bbe1-4516-a6da-27871faf2f2a | thevkp/DSA | LinkedList/LinkedList/temp.cpp | #include <iostream>
using namespace std;
template <typename T>
class LinkedListNode {
public:
T data;
LinkedListNode<T> *next;
LinkedListNode(T value) {
this->data = value;
this->next = nullptr;
}
};
template <typename T>
class LinkedList {
public:
LinkedListNode<T> *head;
Lin... | ALGO | 0.999985 | 5.866554 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-06-07T06:47:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0780662e68dc... |
dfe63198-6c5c-457e-b2eb-6de63ce38b26 | JeppeNielsen/PocketEngine | Pocket/Data/Octree.hpp | #pragma once
#include "BoundingBox.hpp"
#include "BoundingFrustum.hpp"
#include "Ray.hpp"
#include <vector>
namespace Pocket {
class Octree
{
public:
struct Node {
BoundingBox box;
Octree* node;
size_t childIndex;
int order;
void* data;
};
typedef std::vector<Node*> Nodes;
Oct... | ALGO | 0.99073 | 4.877851 | {
"github_metadata": {
"branch": "master",
"commit_count": 957,
"repo_created_at": "2015-05-17T20:06:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed2a2eaf... |
fdfc300c-37ac-45f3-9af0-a1f305e9dfe9 | trilinos/Trilinos | packages/ml/examples/BasicExamples/ml_read_MatrixMarket.cpp |
/* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* person and disclaimer. */
/* ******************************************************************** */
#include "ml_confi... | TOOL | 0.988351 | 5.034546 | {
"github_metadata": {
"branch": "master",
"commit_count": 104031,
"repo_created_at": "2015-11-16T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 593,
"issues": 263,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
f98f1fde-e44d-4b88-801c-3379bbaaa58f | dipta007/Competitive-Programming | Codeforces/Practice/82A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll b, ll e)
{
if(e==1) return 1;
if(e&1)
{
ll now = power(b, e-1) * b;
return now;
}
else
{
ll now = power(b, e/2);
return now * now;
}
}
int main()
{
int n;
cin >> n;
i... | ALGO | 0.999962 | 3.388457 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2016-03-27T22:30:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4acbbedc9... |
a901a3c3-7a77-44fb-84d7-887c23f0a4d1 | haoel/leetcode | algorithms/cpp/flattenNestedListIterator/FlattenNestedListIterator.cpp | // Source : https://leetcode.com/problems/flatten-nested-list-iterator/
// Author : <NAME>
// Date : 2016-05-30
/***************************************************************************************
*
* Given a nested list of integers, implement an iterator to flatten it.
*
* Each element is either an intege... | ALGO | 0.997648 | 6.454449 | {
"github_metadata": {
"branch": "master",
"commit_count": 788,
"repo_created_at": "2014-10-20T03:22:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17857,
"forks": 4931,
"issues": 26,
"pull_requests": 28
},
"file_meta": {
"content_id": ... |
962e5b35-f81a-4bb4-9661-eab25460d390 | apw/cache | algo/carebear_dual_trie.cpp | #include "../includes/trie_cb.h"
#include "../includes/carebear_dual_trie.h"
#include "../includes/uset_uint.h"
#include "../includes/common.h"
#include <assert.h>
#include <algorithm>
carebear_dual_trie::carebear_dual_trie(const char *cur_time)
: rep(cur_time, "carebear_dual_trie"), trie_cb(cur_time) {
}
void ... | ALGO | 0.985894 | 4.429941 | {
"github_metadata": {
"branch": "master",
"commit_count": 277,
"repo_created_at": "2013-10-14T00:18:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed0554e7... |
7c4ace27-aa44-4199-9fca-d5ff70a0cdaa | BrunoAntonioA/greedy-cpmp | src/main_cpmp.cpp |
#include <map>
#include <vector>
#include <list>
#include <iterator>
#include <cmath>
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <stdexcept>
#include<ctime>
#include "dirent.h"
#include "Layout.h"
#include "Greedy.h"
#include "Bsg.h"
using namespace std;
using namespace c... | ALGO | 0.998762 | 3.616418 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-07-11T15:59: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": "c2f980a15c... |
2b24875d-2b16-49f6-a568-3115470e48e2 | lakshyajain1508/CPP | Assignments/Principal_amount.cpp | #include <iostream>
#include <cmath>
using namespace std;
void calculateMaturityAmount(double principal, double rate, int time, bool isCompound) {double maturityAmount;
if (isCompound)
{
maturityAmount = principal * pow((1 + rate / 100), time);
}
else
{
maturityAmount = principal + (principal * rate * time)... | ALGO | 0.922251 | 4.766785 | {
"github_metadata": {
"branch": "main",
"commit_count": 69,
"repo_created_at": "2024-11-11T19:00:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "07d9e89b6e8... |
e7df2373-b64d-4f44-861f-44deb97a4826 | cnyali-czy/code | others/loj/3157.cpp | /*
* File Name: 3157.cpp
* Author : CraZYali
* Year : 2019.09.30 09:43
* Email : <EMAIL>
*/
#define DREP(i, s, e) for (register int i(s), end_##i(e); i >= end_##i; i--)
#define REP(i, s, e) for (register int i(s), end_##i(e); i <= end_##i; i++)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTI... | ALGO | 0.999854 | 3.679649 | {
"github_metadata": {
"branch": "master",
"commit_count": 1593,
"repo_created_at": "2018-02-24T06:16: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": "176707f... |
3e7976c2-8770-4dc7-8aaf-ea817477742c | Sefayet-Alam/New-CP-submissions_vol_5 | Towers_of_Wadia.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// VVI
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define SZ(a)... | ALGO | 0.999883 | 4.149754 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-12-26T13:12: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": "f64925fffe8... |
dc536849-572f-4497-984f-fc4af1c085cd | FANZ3R/leetcode | 0124-binary-tree-maximum-path-sum/0124-binary-tree-maximum-path-sum.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.999986 | 5.933594 | {
"github_metadata": {
"branch": "main",
"commit_count": 575,
"repo_created_at": "2024-09-09T22:39: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": "567509a07b... |
25e67c1f-0a7f-483c-9349-f4c7435ac1d1 | t3nsor/SPOJ | game.cpp | // 2024-02-17
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
void do_match(int round,
unordered_map<string, int>& teams,
vector<pair<string, string>>& games) {
cout <... | ALGO | 0.999736 | 4.412319 | {
"github_metadata": {
"branch": "master",
"commit_count": 392,
"repo_created_at": "2014-10-08T22:07:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 248,
"forks": 102,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "7901... |
3e44d77d-0963-4423-9bc0-d5a4328e471c | moophis/careercup | 4.3.cpp | /**
* careercup 4.3
* Given a sorted (increasing order) array, write an algorithm
* to create a binary search tree with minimal height.
*/
#include <iostream>
#include <queue>
#include <cassert>
using namespace std;
typedef struct _treenode {
int val;
_treenode *left, *right;
}treenode;
/*
* Method: Rec... | ALGO | 0.999985 | 5.707795 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2013-02-17T07:18:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d3b9d52cd... |
f27a6057-a1e1-49c2-91a7-9e9cf6839cc5 | tawsifsazid/Uva-Solutions | number theory 11287.cpp | #include<bits/stdc++.h>
#define N 200005
#define ll long long
#define llu unsigned long long int
#define pare pair<int,int>
using namespace std;
ll ct=0,cases;
ll flag[320005],p,a;
vector<int>P;
///dir array for Queen int dxq[10] = {-1,-1,-1,1,1,1,0,0};
///dir array for Queen int dyq[10] = {-1,0,1,-1,0,1,-1,1};
///dir... | ALGO | 0.999699 | 3.940082 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-05-23T14:59: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": "aaa1f6c8d4... |
df1253f9-ad13-46f3-9a5c-a1791a7b0be7 | coderajdeep/Code | striverSDE/stackQueue/20--sumOfSubarrayMinimum--907.cpp | // Sum of subarray minimum -- leetcode 907
// Time complexity O(n)
// Space complexity O(n)
int sumSubarrayMins(vector<int>& arr) {
int n = arr.size();
vector<int> leftNSE(n, -1), rightNSE(n, -1);
stack<int> leftStk, rightStk;
int left = 0, right = n-1;
while(left < n) {
while(!leftStk.empty... | ALGO | 0.999997 | 6.221617 | {
"github_metadata": {
"branch": "rajdeep",
"commit_count": 667,
"repo_created_at": "2022-05-15T17:35: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": "518c5fc... |
9e8de6da-f32f-4b23-abd0-1ed13e868558 | smiling689/BPlusTree | src/storage/index/b_plus_tree.cpp | #include "storage/index/b_plus_tree.h"
#include <sstream>
#include <string>
#include <vector>
#include "buffer/lru_k_replacer.h"
#include "common/config.h"
#include "common/exception.h"
#include "common/logger.h"
#include "common/macros.h"
#include "common/rid.h"
#include "storage/index/index_iterator.h"
#include "st... | ALGO | 0.971101 | 4.198694 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-04-27T06:21: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": "d06fb9067f03... |
964a82ab-6bb0-457f-a483-855c62c72bf7 | ModelDBRepository/136308 | simul_lrn/CNlib/CN_HHneuron.cc | /*--------------------------------------------------------------------------
Author: <NAME>
Institute: Institute for Nonlinear Dynamics
University of California San Diego
La Jolla, CA 92093-0402
email to: <EMAIL>
initial version: 2005-08-17
--------------------------... | ALGO | 0.92393 | 4.661168 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-05-29T21:05:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "e7e8dd91908... |
f154d739-6a27-4c28-9b10-639d9ef45c5c | josuesSU-DEV/BinaryTree | BinaryTree.h | #include <iostream>
using namespace std;
#include "Node.h"
template<typename T>
class BinaryTree{
private:
Node<T>*m_pRoot;
public:
BinaryTree(){
this->m_pRoot=0;
}
void insert(T value){
if(!this->m_pRoot){
this->m_pRoot=new Node<T>(value);... | ALGO | 0.999829 | 3.31926 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-10-07T02: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": "b1686438ab97... |
69dd685c-6155-4267-8c60-7cc189553b0e | emthrm/cp-library | test/math/formal_power_series/formal_power_series.5.test.cpp | /*
* @title 数学/形式的冪級数/形式的冪級数 (mod_pow)
*
* verification-helper: IGNORE
* verification-helper: PROBLEM https://atcoder.jp/contests/abc135/tasks/abc135_d
*/
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include "emthrm/math/convolution/mod_convolution.hpp"
#includ... | ALGO | 0.999977 | 4.582038 | {
"github_metadata": {
"branch": "main",
"commit_count": 429,
"repo_created_at": "2021-02-08T19:37:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 2,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc464a133... |
a7e11bd9-6a5c-4b93-8296-3d82f4c6dc35 | MAKSEMENS/OC-lab1.1 | main.cpp | #include <windows.h>
#include <iostream>
#include <map>
#include <clocale>
#include <vector>
#include <format>
#include <array>
#include <sstream>
using namespace std;
constexpr std::array<int, 21> attributeEnums = {
FILE_ATTRIBUTE_HIDDEN,
FILE_ATTRIBUTE_SYSTEM,
FILE_ATTRIBUTE_DIRECTORY,
... | TOOL | 0.917257 | 4.034236 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2024-02-25T19:54:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "23e0b0c21... |
a844af6d-e164-4ae5-a3b6-b612dfbb49fb | InfinitiesAgent/OF_2021_1_2_T4 | OF_71_1_2_4.cpp | #include <iostream>
#include <map>
#include <string>
#include <random>
#include <fstream>
using namespace std;
// podane w treści zadania czasy połowicznego rozpadu w minutach
// 214Po rozpada się natychmiastowo
// 210Pb i 207Pb to izotopy trwałe
map<string, double> T12 = {
{ "218Po", 3.05 },
{ "214Pb", 26.8 },
{ ... | DATA | 0.9375 | 4.114351 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2021-11-07T19:11: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": "42459d546cde... |
20474f1f-56bb-4217-a657-5a03c79dd820 | haiku/haiku | src/add-ons/kernel/file_systems/ext2/crc_table.cpp | //----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//
// Copyright (c) 2003 <NAME>, <EMAIL>
//---------------------------------------------------------------------
/*! \file crc_table.cpp
Standalone prog... | ALGO | 0.963618 | 5.367771 | {
"github_metadata": {
"branch": "master",
"commit_count": 67939,
"repo_created_at": "2011-06-16T05:35:19.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2042,
"forks": 378,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "34... |
2b8c7ce7-63cd-4b49-9748-9bf952b45907 | anu-unnikrishnan/pandemonic | Pandemonic.cpp | #include<iostream>
#include<unistd.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
using namespace std;
//size of grid
const int n = 8;
//prints character grid
void print(char grid[n][n])
{
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(grid[i][j] == 'p')
... | ALGO | 0.999283 | 3.031868 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-04-08T14:29: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": "ec9241550d... |
f763a2a4-4e3a-4da7-b520-0e73444049dd | Noppagorn/PracticeACMICCP | p11244.cpp | //p11244.c
#include <iostream>
#include <stdbool.h>
int count_star(int star[][2],int topStar){
int count = 0;
bool check = true;
for (int i = 0 ; i <= topStar;i++){
for (int j = 0 ; j <= topStar;j++){
if ((star[i][0] == star[j][0] -1 && star[i][1] == star[j][1] - 1)
|| (sta... | ALGO | 0.999615 | 3.957499 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2018-11-07T14:33: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": "1bd9b0b46... |
20e537e8-1007-4dc5-87a6-9e6c634d942d | Elbouchouki/Algorithms | problem solving/hackerrank/Best index/best_index.cpp | #include <bits/stdc++.h>
using namespace std;
long long int findBestSum(long long int arr[], long long int n, long long int start)
{
long long int sum = 0;
int step = 1;
for (int i = start; i < n && (n - i) >= step; i++, step++)
{
sum += arr[i];
}
return sum;
}
long long int solve(long ... | ALGO | 0.99998 | 4.515287 | {
"github_metadata": {
"branch": "main",
"commit_count": 104,
"repo_created_at": "2021-11-03T22:55:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a44da83c6... |
8f743c42-776b-445c-97e1-bfa17f924272 | amarrr11/DSA-questions | Interview Problems/minSubArrayOfGivenSize.cpp | // Minimum Sum Subarray Of Given Size
// Problem statement
// You have been given an array 'ARR' of integers consisting of ‘N’ integers and a positive integer ‘K’. Your task is to find a subarray(contiguous) of size ‘K’ such that the sum of its elements is minimum.
// Note :
// You can assume that the value of ‘K’ wil... | ALGO | 0.999874 | 6.380157 | {
"github_metadata": {
"branch": "main",
"commit_count": 268,
"repo_created_at": "2024-03-31T07:02: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": "5d39c531cd... |
f5c3ecf9-aac1-4ebc-b770-dcaf5c3562b6 | christophe001/UniversalMeshfreeMethods | MeshfreeMethods/m_eulerian_compute.h | /*! \file m_eulerian_compute.h */
//@HEADER
// ************************************************************************
//
// M4_Technologies
// Copyright (2017) by <NAME>
//
// M4 stands for Multiscale Mesh-based Meshfree Method
// Any questions, please contact:
// <NAME> <EM... | ALGO | 0.999405 | 5.922422 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-05-08T19:46:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d6b6f9d6... |
73ac23c7-7475-4f63-8a0c-ce464223bfd4 | JohnathanLP/cmcppgroups | cppadventuregame/main.cpp | #include <SFML/Graphics.hpp>
#include <iostream>
#include <vector>
#define WIDE 800
#define HIGH 640
#define TILESIZE 32
bool testColl(sf::Sprite a, sf::Sprite b)
{
return a.getGlobalBounds().intersects(b.getGlobalBounds());
}
bool testWallColl(sf::Sprite a, std::vector<sf::Sprite> walls)
{
for(int i=0; i<walls... | TOOL | 0.91301 | 3.74023 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2017-04-01T18:28: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": "a6d7df2b6... |
dc5e08fb-e5d1-43a5-943f-38c006133f2b | dbpowell42/DSLab10 | Hybrid.h | #if !defined (HYBRID_H)
#define HYBRID_H
#include "QueueLinked.h"
using CSC2110::QueueLinked;
#include "SortedListDoublyLinked.h"
template < class T >
class Hybrid
{
private:
//QueueLinked<DoubleNode<T> >* q;
QueueLinked<T>* q;
SortedListDoublyLinked<T>* sldl;
public:
Hybrid(int (*comp_it... | TOOL | 0.942237 | 5.442169 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2014-11-04T17:09: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": "dc93a3c6b2... |
041e597a-cca5-4c56-ad58-a74b7e1d573a | mckianisla/AMAOEd-CompProg1 | Laboratory Exercise 007/sort_int.cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
//////////////////////////////////////////////////////////////////
// NOTE
// This is your program entry point. Your main logic is placed
// inside this function. You may add your functions before this
// "main(... | ALGO | 0.993698 | 3.305027 | {
"github_metadata": {
"branch": "AMAOEd",
"commit_count": 65,
"repo_created_at": "2021-01-31T13:55: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": "91051df99... |
95c6e9d1-f0b9-4b94-93d8-d6778014d2aa | sudipto21-java/C-codes | Inserting elements according to Formula in Array.cpp | /* Create two arrays of lenght l, given by the user. Read 'n' and the n elements. Store the elements in two
arrays in the location calculated using the following formulae:
l1(x)=(x+1)%l
l2(x)=(x/3)%l
If l1(x) is empty, place x there, Otherwise, place x there, evict the old element y and try placing y into l2
recurs... | ALGO | 0.999863 | 3.316437 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-06-25T13:03:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8dd12ca5eaa3... |
6e3cef34-3df6-45e7-8ae5-f5b94435a812 | raincross7/code-similarity | codes/train_code/problem405/problem405_74.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long int ll;
#defi... | ALGO | 0.999985 | 3.765045 | {
"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": "d1d9b1710611... |
5e61215b-0cf0-401d-afd6-73c53c1be669 | ishandutta2007/codeforces-f | fizzydavid/normal/930/E.cpp | //by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
... | ALGO | 0.999848 | 4.030145 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:43: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": "26b720a01ad2... |
b88e34de-f2e5-49b8-b5fa-1ec0327d41e0 | KiwiGrenade/Informatyka-Algorytmiczna | electives/AOD/L1/Z1/main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include "Graph.h"
int main(int argc, char** argv)
{
std::ifstream graphDefinition;
graphDefinition.open(argv[1], std::ios::out);
if (graphDefinition.is_open())
{
Graph* graph = new Graph(graphDefinition);
//serach the graph
... | ALGO | 0.995715 | 3.040571 | {
"github_metadata": {
"branch": "main",
"commit_count": 432,
"repo_created_at": "2023-07-15T11:32:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a2d9a71074... |
664e3ec9-3778-4e86-9ba7-7e52db695555 | MukuFlash03/data-structures-algos-CPP | LC_Self/Trees/E_100_Same_Tree.cpp | /*
Construct BT: https://www.linkedin.com/pulse/create-binary-tree-from-array-suhasis-saha/
Problem: https://leetcode.com/problems/same-tree/
Solution(s):
YouTube
NC - https://www.youtube.com/watch?v=vRbbcKXCxOw
*/
/*
A. Recursive Depth-first search
1. Identity base conditions:
- If both null
- Re... | ALGO | 0.99951 | 6.040072 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2021-10-21T08:19:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "805329b40... |
01d88df6-f691-4b7d-a457-c6714a5373c2 | gulya-a-a-a/otus_algo_2022 | hw09/merge.hpp | template <typename T>
void merge(int p, int q, int r, std::fstream &data, std::fstream &tmp) {
int a = p, b = q + 1, m = p;
T aVal{}, bVal{}, tmpVal{};
tmp.seekg(0);
while (a <= q && b <= r) {
data.seekp(a * sizeof(T));
data >> aVal;
data.seekp(b * sizeof(T));
data >> bVal;
if (aVal <= bVa... | ALGO | 0.994614 | 4.844354 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2022-01-27T20:33:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "054a50dcfaa... |
f3efcd6d-70ca-43ff-981a-edfdb9494663 | nenuon/CompetitiveProgramming | Atcoder/ARC086/e2.cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR... | ALGO | 0.999992 | 3.995583 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2017-11-28T08:06: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": "3d4e80a1e... |
b764e9d9-9c85-4934-bfdd-437f4ac7dbd7 | yuxineverforever/leetcode | 239-Sliding-Window-Maximum.cpp | /**
* You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
Return the max sliding window.
来源:力扣(LeetCode)
链接:https://leetc... | ALGO | 0.999948 | 6.568 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2021-04-02T00:45:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1fbd858af82... |
4fd96892-dc85-4c89-b186-39faae1edd5b | zzzzDenzzzz/OOP_5 | OOP_5_T_4/OOP_5_T_4/Main.cpp | #include<iostream>
#include<string>
#include<vector>
using namespace std;
string modString(const string &s)
{
int factor = 10;
int res = 0;
string new_s;
vector<int>v_int;
vector<char>v_char;
bool flag = false;
for (int i = 0; i < s.size(); i++)
{
if (s[i] >= '0' and s[i] <= '... | ALGO | 0.998508 | 4.193429 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-06-24T06:36: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": "4960461db8... |
37b1af7d-2dba-40a0-a501-a286c8eaa6e8 | m1sterzer0/DaveProgrammingCompetitions | codejam/cpp/2009/1C/1C_CenterOfMass.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define FOR(i,a) for (ll i = 0; i < (a); i++)
#define len(x) (ll) x.size()
const ll INF = 1LL << 62;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = 4*atan(double(1.0));
vector<vec... | ALGO | 0.999458 | 4.235317 | {
"github_metadata": {
"branch": "main",
"commit_count": 451,
"repo_created_at": "2021-07-11T18:26: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": "c56b93111e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.