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 |
|---|---|---|---|---|---|---|---|
16355d6d-f0e7-47ae-8e20-24fb2653d406 | itsjustwinds/study-path | cpp/w33f.cpp | #include<bits/stdc++.h>
#define mod 1000000007
#define maxn 100005
#define ll long long
using namespace std;
struct data
{
int val[3];
};
data hashT[maxn],base,power[maxn],hashQ;
int n,len;
char s[maxn],q[maxn];
vector<int> e[maxn];
int trc[maxn],h[maxn];
int p[maxn][55];
bool check(data a,data b)
{
for (int i=... | ALGO | 0.999948 | 3.961978 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-05-31T11:52:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "40e6312e4b... |
167ef795-6450-40d3-b8b5-dd2dc801bb3e | SunHaoer/PTA | PAT (Advanced Level) Practice/1043 Is It a Binary Search Tree.cpp | #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
vector<int> origin, pre, preM, post, postM; // 初始序列origin
struct Node{
int data;
Node *left, *right;
};
void insert(Node* &root, int data) { // 建树
if(root == NULL) {
root = new Node;
root->data = data;
... | ALGO | 0.999999 | 3.872124 | {
"github_metadata": {
"branch": "master",
"commit_count": 105,
"repo_created_at": "2018-07-08T04:14:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a1dee3c... |
7c9217ad-fbf5-49f3-a35d-b548bedcf8ae | dealii/dealii | examples/step-20/step-20.cc | /* ------------------------------------------------------------------------
*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright (C) 2005 - 2024 by the deal.II authors
*
* This file is part of the deal.II library.
*
* Part of the source code is dual licensed under Apache-2.0 WITH
* LLVM-exception OR LGPL-... | ALGO | 0.983741 | 5.075741 | {
"github_metadata": {
"branch": "master",
"commit_count": 65304,
"repo_created_at": "2014-07-17T14:00:26.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1530,
"forks": 789,
"issues": 533,
"pull_requests": 92
},
"file_meta": {
"content_id": ... |
0b7d154e-502d-42bd-b671-f6f8b7e66b42 | Yusuf-sust/Problem_Solving | CODEFORCES/355B.cpp | #include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<math.h>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namesp... | ALGO | 0.999741 | 3.427295 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2021-12-20T13:01: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": "c0869afbec4f... |
db315cfb-bc61-4c8f-be6e-376bb37408b3 | thomsmits/wordclock | classic-clock/src/font.ino | /**
Functions for rendering fonts on the LED display.
*/
#include "fontdef.h"
/**
Extracts the font definition for a given character from the font array.
@param (out) data the bytes of the character
@param (in) c the character to extract font information for
@param (in) font the font definition
@param... | TOOL | 0.902079 | 5.054842 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2012-10-12T14:55:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76acf49ba36... |
a21c5c21-f8c8-460a-b7db-c2b370a51d89 | harshkailash/LeetCode-Solution | 65-valid-number/65-valid-number.cpp | class Solution {
bool isInt(string s)
{
// first char can be + or -
// rest have to be digits
int n = s.length();
int si = 0;
if(n == 0) return false;
if(s[0] == '+' || s[0] == '-') si = 1;
if(n==1 && si==1) return... | ALGO | 0.999344 | 4.886619 | {
"github_metadata": {
"branch": "main",
"commit_count": 308,
"repo_created_at": "2022-08-21T06:52: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": "f6317154e5... |
3977626f-7609-4c0e-b907-3b7987ba53ff | hossenrabiul/Algoritham-Code | module 16 assignment/prob_2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int par[N];
int group_size[N];
void dsu_initialize(int n)
{
for (int i = 1; i <= n; i++)
{
par[i] = -1;
group_size[i] = 1;
}
}
int dsu_find(int node)
{
if (par[node] == -1)
{
return node;
}
int leade... | ALGO | 0.999896 | 4.57558 | {
"github_metadata": {
"branch": "main",
"commit_count": 29,
"repo_created_at": "2024-08-02T05:00: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": "51497b8ff04... |
a2332d82-7229-4e4a-8a02-5409d04213dc | Kartheek-Mannepalli/QALSH | QALSH/src/b_tree.cpp | #include "headers.h"
// -----------------------------------------------------------------------------
// BTree: b-tree to index hash values produced by qalsh
// -----------------------------------------------------------------------------
BTree::BTree() // constructor
{
root_ = -1;
file_ = nullptr;
root_ptr_... | TOOL | 0.933959 | 4.008344 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-12-17T22:52: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": "ea6f2c3fa6... |
13584406-cf36-43a2-a129-13c97c5ffe8a | kernsuite-debian/wsclean-idg | iuwt/iuwtdeconvolutionalgorithm.h | #ifndef IUWT_DECONVOLUTION_ALGORITHM_H
#define IUWT_DECONVOLUTION_ALGORITHM_H
#include <aocommon/staticfor.h>
#include <aocommon/uvector.h>
#include <aocommon/fits/fitswriter.h>
#include "iuwtdecomposition.h"
#include "imageanalysis.h"
#include <vector>
namespace aocommon {
template <typename NumT>
class ImageBase;... | ALGO | 0.994789 | 5.466218 | {
"github_metadata": {
"branch": "master",
"commit_count": 123,
"repo_created_at": "2022-08-15T12:57:21.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5fe92039... |
a255be1a-a394-4e03-a866-ccd854e132dd | jiayuanmark/hackerrank | world-sprint-7/gridland.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;
typedef long long LL;
LL n, m, k;
LL r, c1, c2;
map<LL, vector<pair<LL, LL> > > intervals;
inline LL Max(const LL& a, const LL& b) {
return a > b ? a : b;
}
int ma... | ALGO | 0.999653 | 3.583013 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2013-09-16T19:12:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5bc1491ea... |
28b61c39-b30f-4957-8e8a-f8ed51180a16 | gesandru/Taller-Proyecto-2025 | src/VarEqn.cpp | #include "../include/VarEqn.hpp"
Matrix& VarEqn(double x, Matrix yPhi){
tuple< double, double, double, double, double, double, double, double, double> result = IERS(eopdata,AuxParam.Mjd_UTC,'l');
double x_pole = get<0>(result);
double y_pole = get<1>(result);
double UT1_UTC = get<2>(result);
double LOD = get<3>(res... | ALGO | 0.968322 | 4.262881 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2025-03-28T08:51:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0bb9eacf854... |
18a7b530-4304-4ee4-823d-cc94ca159a34 | borglab/gtsam | gtsam/base/kruskal-inl.h | /* ----------------------------------------------------------------------------
* GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: <NAME>, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------... | ALGO | 0.999947 | 7.308599 | {
"github_metadata": {
"branch": "develop",
"commit_count": 19360,
"repo_created_at": "2017-03-27T17:12:06.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3002,
"forks": 845,
"issues": 99,
"pull_requests": 25
},
"file_meta": {
"content_id": ... |
70a11f85-de38-4fc3-b632-fbc2c7cf9f77 | andrew-canada/competitive-programming | cco/2023/p1/p1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
const int MAXN = 1000005;
int sums[MAXN];
int dp[3005][3005];
int diff;
int num1;
int num0;
const int MOD = 1e6 + 3;
int states[3005];
ll fact[MAXN];
ll inv[... | ALGO | 0.999975 | 4.05718 | {
"github_metadata": {
"branch": "main",
"commit_count": 365,
"repo_created_at": "2024-07-28T17:18: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": "eea0c8326e... |
64eb9ab6-6e57-4ce2-8e44-3b03c88a3ae1 | Michael1249/MyGame_ | Source/MyGame/Noise.cpp | //#include "pch.h"
#include "Noise.h"
#define _PI_ 3.14159265358979f
Noise::Noise(): seed(rand()) {}
Noise::Noise(hash_t hash_seed): seed(hash_seed) {}
value_t Noise::operator()(value_t x, value_t y)
{
coord_t target_x = floor(x);
coord_t target_y = floor(y);
Vector2<value_t> relativ_pos(x - target_x, y - target_... | ALGO | 0.908743 | 6.142206 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-02-25T11:46: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": "9fe6cb525f... |
e6182318-a753-4ccb-846b-c805ea2eb63c | abhishekvtangod/competitive-programming | spoj/ETF.cpp | // [abhishekvtangod]
// g++ -Wall -Wextra -Wshadow filename.cpp
#include<bits/stdc++.h>
using namespace std;
#define as(n,a,b) assert(a<=n && n<=b);
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
typedef long long int ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll t; cin>>t;... | ALGO | 0.999835 | 4.090826 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2020-02-19T16:55: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": "6e4afab5b... |
5fbe8c7e-2231-4c7a-8524-958a7edc4405 | triSYCL/triSYCL | tests/jacobi/jacobi2d-tile.cpp | /* RUN: %{execute}%s
*/
#include <cstdlib>
#include <CL/sycl.hpp>
#include "include/helpers-jacobi.hpp"
using namespace cl;
int main(int argc, char **argv) {
read_args(argc, argv);
counters timer;
start_measure(timer);
// declarations
sycl::buffer<float,2> ioABuffer = cl::sycl::buffer<float,2>(sycl::rang... | ALGO | 0.992317 | 4.690626 | {
"github_metadata": {
"branch": "master",
"commit_count": 2249,
"repo_created_at": "2014-04-19T15:19:51.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 444,
"forks": 99,
"issues": 108,
"pull_requests": 9
},
"file_meta": {
"content_id": "bbf... |
24978e75-a948-490c-a347-693d21e6b15b | camil0palacios/Competitive-programming | solutions/CSES/Dynamic Programming/Grid Paths/solution.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int mod = 1e9 + 7;
const int MXN = 1001;
char a[MXN][MXN];
void add(int & a, int b) {
a += b;
if(a >= mod) a -= mod;
if(a < 0) a += mod;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n;
cin >> n;
f... | ALGO | 0.999976 | 4.208431 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2018-10-30T16:26: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": "bf54d8a75... |
976820e9-7a4e-4e0f-bd38-5eee947f9422 | Anishka0107/Wunner | inc/query.hpp | /*
*
* Author : <NAME>
* Created on : July 8, 2017
*
*/
#ifndef QUERY_PROCESSOR
#define QUERY_PROCESSOR
#include <map>
#include <set>
#include "index_builder.hpp"
namespace wunner
{
enum QueryType { SIMPLE, COMPLETE };
class Query
{
private:
std::vector<std::string> processed_query;... | ALGO | 0.92615 | 6.043805 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2017-07-08T06:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 6,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "133c69d36... |
b341f566-523c-4d5e-aa0b-efd3264e10d5 | arpitbbhayani/spoj | practice/Microsoft34.cpp | /*
* Microsoft34.cpp
*
* Created on: Oct 9, 2014
* Author: <NAME>
*/
#include <map>
#include <cmath>
#include <set>
#include <cstring>
#include <stack>
#include <vector>
#include <queue>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <climits>
using namespace std;
#defin... | ALGO | 0.999605 | 3.799285 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2013-12-06T05:02:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 5,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "c21798ce7... |
d0278036-5ff9-4cdb-bde6-b0d856e23f73 | OneZeroAndTwoZero/own-cppfile | 程序/实验舱/question_bank/#3681、排序链表去重.cpp | // #include<bits/stdc++.h>
// using namespace std;
// struct ListNode{
// int val;
// ListNode *next;
// ListNode() : val(0),next(nullptr){}
// ListNode(int x) : val(x),next(nullptr){}
// ListNode(int x,ListNode *next) : val(x),next(next){}
// };
// int a[1005] = {1,1,1,1,1,1,1,1,1,3,3,3,3};
List... | ALGO | 0.99991 | 3.742049 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-10-20T03:01: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": "1ded73b7449f... |
3fef0b50-d01d-4545-9d71-57d2edca6deb | congtinh06/BT-CTDLGT | Con trỏ cấu trúc chuỗi tập tin/Lab01b/Lab01b - bai 2.cpp | #include<iostream>
using namespace std;
bool kiem_tra_xen_ke_chan_le(int *a, int n) {
for(int i = 1; i < n; i++) {
if (((*a + i) % 2 ) == (*(a + i - 1 ) % 2)) {
return false;
}
}
return true;
}
bool kiem_tra_toan_chan(int *a , int n) {
for(int i = 0 ; i < n ;i++) {
if(*(a + i ) % 2 != 0) {
return false... | ALGO | 0.998674 | 3.628831 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2025-04-05T16:38: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": "108045ea2b3a... |
5416be66-3a6c-4519-953f-35890d032385 | hilings/leetcode | cpp/601_700/606_Construct_String_from_Binary_Tree.cpp | //
// 606_Construct_String_from_Binary_Tree.cpp
// leetcode
//
// Created by <NAME> on 10/18/18.
// Copyright © 2018 Hilings Studio. All rights reserved.
//
#include <iostream>
#include <vector>
#include <deque>
using namespace std;
/**
* Definition for a binary tree node.
*/
struct TreeNode {
int val;
... | ALGO | 0.999945 | 6.03828 | {
"github_metadata": {
"branch": "master",
"commit_count": 266,
"repo_created_at": "2015-04-12T00:16: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": "923a567f... |
6a5a7dae-3e28-4024-b406-3b458f1aa0ce | eternityduck/labs-cpp-IK-02 | lab6.cpp |
#include <iostream>
#include <string>
using namespace std;
struct DATA
{
int code;
string lastname;
int numOfGarbage;
int weight;
};
class NODE {
public:
DATA data;
NODE* Left;
NODE* Right;
};
class Tree {
NODE* root;
int Count;
void print(NODE* leaf)
{
if (leaf != ... | ALGO | 0.996116 | 3.5379 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2021-02-14T18:28:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e2d2c8f59dd... |
fb7bd917-b3eb-4897-a7a4-1d2449bc1d67 | iamrahul25/LeetCode | Graph/04_Coloring_Border.cpp | class Solution {
public:
//Approach 1: BFS Traversal Time: O(N^2) Space: O(1)
vector<vector<int>> colorBorder(vector<vector<int>>& grid, int row, int col, int color) {
int m = grid.size();
int n = grid[0].size();
int tocolor = grid[row][col];
if(tocolor==... | ALGO | 0.999936 | 6.277705 | {
"github_metadata": {
"branch": "main",
"commit_count": 453,
"repo_created_at": "2022-02-13T18:55: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": "7d34db2407... |
8dc39cee-ebba-4abe-8546-847206428e70 | Amanhacker/Aman-Barnwal-Leetcode-Solutions | 1935-maximum-number-of-words-you-can-type/1935-maximum-number-of-words-you-can-type.cpp | class Solution {
public:
int canBeTypedWords(string text, string brokenLetters) {
int ans;
unordered_map<char, int> u; // contains broken letters
for(auto &x : brokenLetters) u[x]++;
string temp = "";
int noBrokenWord... | ALGO | 0.999541 | 4.980312 | {
"github_metadata": {
"branch": "master",
"commit_count": 2521,
"repo_created_at": "2021-12-24T16:13:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 441,
"forks": 140,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "695... |
5a943106-2d18-4d3b-8159-5f739166c4a3 | BeckyFerrelle0836/treasure-quest | src/openrct2/core/Numerics.hpp | /*****************************************************************************
* Copyright (c) 2014-2025 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU Gener... | ALGO | 0.929409 | 7.171119 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-03-15T04:07: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": "8e077152c3e6... |
1fb4b970-ebb3-4897-8010-ab4ea13cec67 | Amenable-C/Algorithm | 8weeks-1/3rd-week/boj4179.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m, fire[1004][1004], ji[1004][1004], y, x, ji_y, ji_x, ret = 987654321;
char a[1004][1004];
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, 1, 0, -1};
vector<pair<int, int>> v;
void bfs_f(int y, int x){
queue<pair<int, int>> q;
q.push({y, x});
fire[y][x] = 1... | ALGO | 0.999892 | 3.859225 | {
"github_metadata": {
"branch": "master",
"commit_count": 388,
"repo_created_at": "2022-07-05T14:35: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": "e865abfc... |
7fb9540c-c713-4062-8a8e-3c0c02e73d36 | Subhrajitnaskar/---LEET-CODE-SOLVE-QUESTION--- | 1790._Check_if_One_String_Swap_Can_Make_Strings_Equal.cpp | // 1790. Check if One String Swap Can Make Strings Equal
// Solved
// Easy
// Topics
// premium lock icon
// Companies
// Hint
// You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indic... | ALGO | 0.999943 | 5.910548 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-07-13T15:41: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": "5d764584123e... |
e16c356f-3e62-4053-8f01-d834fa562b22 | evilcat-x/leetcode-reboot | contest/KickStart-B-2019/Diverse-Subarray.cpp | #include <iostream>
#include <vector>
#include <climits>
#include <utility>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
int getMaxTrinkets(vector<int> T, int N, int S)
{
int maxTotal = 1;
for (int l = 0; l < N; l++)
{
unordered_set<int> overLimit;
un... | ALGO | 0.999939 | 4.60798 | {
"github_metadata": {
"branch": "master",
"commit_count": 70,
"repo_created_at": "2019-02-27T07:24:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e49234b90... |
0775d57d-6daa-46d9-b224-3161d48a6fc2 | ishandutta2007/codeforces-s | se1ka2/normal/1684/D.cpp | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--)
{
int n, k;
cin >> n >> k;
ll a[200005];
P p[200005];
for(... | ALGO | 0.999907 | 4.311481 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "66b69ba6280e... |
15f4ff5c-587b-4eba-a68a-ab92b1247572 | praat/praat.github.io | dwtools/CC.cpp | /* CC.cpp
*
* Copyright (C) 1993-2020 <NAME>, 2024 <NAME>
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Th... | ALGO | 0.953479 | 5.818449 | {
"github_metadata": {
"branch": "master",
"commit_count": 9387,
"repo_created_at": "2014-04-11T18:36:00.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1717,
"forks": 256,
"issues": 57,
"pull_requests": 7
},
"file_meta": {
"content_id": "f1... |
337c4927-bb3d-4796-a73c-05243361d182 | hep2018kyiv/hep2018kyiv | Yeresko/DFS.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
struct Vertex {
int id = 0;
int depth = 0;
bool visited = false;
vector<Vertex*> neighbours;
};
void dfs(Vertex* initial) {
cout<<"Running DFS algorithm\n";
stack<Vertex*> pending;
pending.push(initial);
do {
... | ALGO | 0.999806 | 4.613971 | {
"github_metadata": {
"branch": "master",
"commit_count": 72,
"repo_created_at": "2018-03-23T07:27:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8ceca76b... |
c564dfb2-5e1e-4a7d-a394-f7fed892c400 | LewisVille-flow/Algorithm_PS | BOJ/1244.cpp | /*
23:07~23:33 26m
*/
#include <iostream>
#include <vector>
using namespace std;
const int N_MAX = 101;
const int STU_MAX = 101;
bool switch_state[N_MAX] = {false, };
//vector<pair<int, int>> stu_num;
int switch_num, stu_num;
int main(){
//
cin >> switch_num;
for(int sn=1; sn<=switch_num; sn++)
... | ALGO | 0.999881 | 3.268586 | {
"github_metadata": {
"branch": "main",
"commit_count": 59,
"repo_created_at": "2022-10-28T05:36: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": "bb8543716c4... |
81700344-9c4b-4703-b346-131d211e8a41 | shashankkanade25/DSA-Love-Babbar | .vscode/STACK/StackFun.cpp | #include<iostream>
using namespace std;
#define n 100
class stack{
int* arr;
int top;
public:
stack() {
arr = new int[n]; //constructor
top = -1;
}
void push(int x){
if (top == n-1){
cout<< "stack Overflow"<< endl;
return ;
} ... | ALGO | 0.998019 | 4.257731 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2025-02-21T07:24: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": "e483d18b6bd... |
7a171576-0457-47f8-9d38-76152a2dc7ce | jaxvanyang/acm | jax/training/21-03/21-03-22-night/d.cc | #include <iostream>
using namespace std;
int times[105];
int main() {
int n, s;
cin >> n >> s;
for (int i = 0; i < n; ++i) {
int h, m;
cin >> h >> m;
times[i] = h * 60 + m;
}
if (times[0] > s) {
cout << "0 0" << endl;
return 0;
}
for (int i = 1; i < n... | ALGO | 0.999778 | 3.720155 | {
"github_metadata": {
"branch": "master",
"commit_count": 384,
"repo_created_at": "2021-11-02T02:32: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": "075074cf... |
df29ad03-592e-4a75-8726-a2ad16613f8f | AakashKT/analytic_ss_cpu | src/integrators/ltc+silhouette.cpp | #include "integrators/ltc+silhouette.h"
#include "bssrdf.h"
#include "camera.h"
#include "film.h"
#include "interaction.h"
#include "paramset.h"
#include "scene.h"
#include "stats.h"
#include "lights/diffuse.h"
#include "shapes/triangle.h"
namespace pbrt {
LTCSilhouette::LTCSilhouette(const Bounds2i &pixelBounds, st... | ALGO | 0.97575 | 5.747202 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2021-06-25T18:56:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 19,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cc5b0a39... |
976f9f3e-ae8a-4bb3-a9d2-c1ba28df0de5 | rorozoro0/Algorithmic-toolbox | week5_dynamic_programming1/5_longest_common_subsequence_of_three_sequences/lcs3 - Copy.cpp | #include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int lcs3(vector<int> &X, vector<int> &Y, vector<int> &Z,int m,int n, int o) {
int L[m+1][n+1][o+1];
for (int i=0; i<=m; i++)
{
for (int j=0; j<=n; j++)
{
for (int k=0; k<=o; k++)
{
... | ALGO | 0.999885 | 4.334943 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-08-22T19:30:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "4f581931a9... |
461afd40-2f92-4b1b-a08b-74f2e92e5dd1 | perchuts/CompetitiveProgramming | AtCoder/abc093/d.cpp | #include <bits/stdc++.h>
//#define gato
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define pb push_back
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int ll
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ii = pa... | ALGO | 0.999703 | 3.88396 | {
"github_metadata": {
"branch": "master",
"commit_count": 93,
"repo_created_at": "2021-12-19T23:57: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": "eab9ca4f9... |
e15f31dc-bbe5-49e1-a060-a250179b5cc4 | zhaoshenglong/Leetcode | 388_medimum_longest_absolute_file_path/cpp/main.cpp | #include "../../include/leetcode.hpp"
class Solution {
public:
int pos = 0;
int lengthLongestPath(string input) {
int res = 0;
vector<int> dirLen = {0};
bool isDir;
int level, len;
while(pos < input.size()) {
skipNewLine(input);
level = g... | ALGO | 0.999375 | 4.939061 | {
"github_metadata": {
"branch": "master",
"commit_count": 229,
"repo_created_at": "2019-10-23T15:40:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ef6b46e8... |
f11b1298-62f1-49bf-a135-736323e5cc4e | cxlove/ACM_ICPC | Online_judge/HDU/hdoj_4419_3.cpp | #include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define ls rt<<1
#define rs rt<<1|1
#define lson l,m,ls
#define rson m,r,rs
using namespace std;
const int mm=22222;
const int mn=mm<<2;
int ot[]={1,2,4,3,5,6,7};
struct seg
{
int x,y1,y2,val;
}g[mm];
int len[mn][8],y[mm],L,R;... | ALGO | 0.994158 | 3.088007 | {
"github_metadata": {
"branch": "master",
"commit_count": 112,
"repo_created_at": "2013-03-28T06:23:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8140c88e... |
0aabb31e-5a0d-4b69-a580-a5863413da69 | thenexthub/Codira | include/language/SIL/Dominance.h | //===--- Dominance.h - SIL dominance analysis -------------------*- C++ -*-===//
//
// Copyright (c) NeXTHub Corporation. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the... | ALGO | 0.99546 | 7.835445 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2025-02-09T09:18:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "366550f1c0cb... |
a0180323-6601-420b-bcbe-b32c2103735c | aspandiyarKK/DS_and_Algo | Recursions/fibonacciSolution/main.cpp | /* this program is based on generating Fibonacci Series using recursion and doing the same with iterative
approach
A Fibonacci series is given by of the form of
0, 1, 1, 2, 3, 5, 8,... where from 2nd index the numbers are the sum of previous two numbers.
*/
#include <iostream>
#include <cstdlib>
using namespace std;
... | ALGO | 0.999967 | 4.898163 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2021-11-21T11:16:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2dcf2e60d... |
83e6ca29-ea73-4979-b195-5ac99dac4431 | ishandutta2007/codeforces-s | shadowlight/normal/919/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define TASKNAME ""
using namespace std;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;
int dsum(int n) {
int s = 0;
while (n) {
s += n % 10;
n /= 10;
}
return s;
}
int main() {
#ifdef MY
freopen(... | ALGO | 0.999765 | 4.216308 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9796a47d06c6... |
8d30abcd-a7ee-43b7-8e19-4e207b183e68 | Reset02/Leetcode | 1442-count-triplets-that-can-form-two-arrays-of-equal-xor/1442-count-triplets-that-can-form-two-arrays-of-equal-xor.cpp | class Solution {
public:
int countTriplets(vector<int>& arr) {
int count = 0;
// Iterate over each possible starting index i
for (int start = 0; start < arr.size() - 1; start++){
// Initialize XOR value for the subarray from start to mid-1
int xor_A = 0;
... | ALGO | 0.999922 | 6.27473 | {
"github_metadata": {
"branch": "main",
"commit_count": 613,
"repo_created_at": "2024-05-30T12:30: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": "d5e851811a... |
5b27e370-062f-467f-8a11-820f904e9bdd | GillesBareilles/surface-min | src/optimiseur.cpp | #include "optimiseur.hpp"
Vecteur Optimiseur::gradientFixe(const Vecteur& x0, double eps, int itMax, bool verbose) {
cout << "------------- Optimisation : gradient à pas fixe -------------" << endl;
cout << "--------------------------------------------------------------"<<endl;
int iteration = 0;
int iterat... | ALGO | 0.998795 | 5.271563 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2018-02-12T16:26: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": "060b222326... |
088253c2-731f-4b60-baef-6a1ca46272e8 | halide/Halide | apps/hexagon_benchmarks/gaussian5x5_generator.cpp | #include "Halide.h"
using namespace Halide;
class Gaussian5x5 : public Generator<Gaussian5x5> {
public:
Input<Buffer<uint8_t, 2>> input{"input"};
Output<Buffer<uint8_t, 2>> output{"output"};
GeneratorParam<bool> use_parallel_sched{"use_parallel_sched", true};
GeneratorParam<bool> use_prefetch_sched{"... | ALGO | 0.960348 | 5.824502 | {
"github_metadata": {
"branch": "main",
"commit_count": 23344,
"repo_created_at": "2012-07-31T04:05:25.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6126,
"forks": 1080,
"issues": 993,
"pull_requests": 78
},
"file_meta": {
"content_id": "... |
cb64a397-ab61-4396-baa4-bfd2d1ad9960 | kdongha/Algorithm | swexpert/4038.cpp | //
// Created by kdongha on 2019/12/16.
//
#include <bits/stdc++.h>
int T;
char str[500005];
char pattern[100005];
int pi[100005];
int strlen(char *arr) {
int len = 0;
while (*(arr + len) != '\0') {
len++;
}
return len;
}
void setPi() {
int len = strlen(pattern);
for (int i = 0; i < ... | ALGO | 0.999879 | 4.976923 | {
"github_metadata": {
"branch": "master",
"commit_count": 192,
"repo_created_at": "2018-06-25T12:25:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3bf32acb... |
17f2ea60-bb17-4427-88b5-e7e70a9af02d | ToshihideMatsuda/atcoder | programs/ABC/ABC200-299/ABC251/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < n; i++ )
#define reps(i,m,n) for(ll i = m; i < n; i++ )
#define max(a,b) (a>b?a:b)
#define max3(a,b,c) max(a,max(b,c))
#define min(a,b) (a<b?a:b)
#define min3(a,b,c) min(a,min(b,c))
#define INF 1 << 30... | ALGO | 0.999959 | 4.545501 | {
"github_metadata": {
"branch": "master",
"commit_count": 444,
"repo_created_at": "2022-02-28T00:05: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": "7bc7a00b... |
e08df14e-345a-4057-ab0a-aabb0ebce065 | david-alvarez-rosa/CppPlayground | AdventOfCode2024/day_10_part_2.cpp | #include <fstream>
#include <iostream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
struct Pos {
int row;
int col;
friend auto __attribute__((always_inline)) inline operator+(Pos lhs,
Pos rhs) noexcept
-> Pos;
... | ALGO | 0.998267 | 6.023875 | {
"github_metadata": {
"branch": "main",
"commit_count": 283,
"repo_created_at": "2024-02-18T20:03:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7796927148... |
6251a00d-899e-486b-bc1c-917e41502beb | MAZHARMIK/Interview_DS_Algo | Arrays/Binary Search/Koko Eating Bananas.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=QQcEIxK-snE
Company Tags : Google, Miscrosoft
Leetcode Link : https://leetcode.com/problems/koko-eating-bananas/
*/
//Binary Search - Using same concept as "Leetcode-2187 : Minimum Time to Complete Trips"
class ... | ALGO | 0.999976 | 5.568204 | {
"github_metadata": {
"branch": "master",
"commit_count": 5946,
"repo_created_at": "2020-07-12T13:13:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2586,
"forks": 1357,
"issues": 7,
"pull_requests": 37
},
"file_meta": {
"content_id": "... |
52e9f115-49c1-4dca-881f-05696dc392c6 | QiuanWu/CS385 | waterjugpuzzle/waterjugpuzzle.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
using namespace std;
// Struct that represents the state of the water in the jugs.
struct State {
int a, b, c;
vector<string> directions;
State(int _a, int _b, int _c) : a(_a), b(_b), c(_c) { }
// String repres... | ALGO | 0.999775 | 4.851203 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-09-05T00:54:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d07166f3f0... |
9ea3de9c-c855-485f-964f-61a099679378 | MRDGH2821/Cpp-Code-Dump | src/p14.cpp | #include <iostream.h>
#include <process.h> // for Exit()
#include <stdlib.h>
struct Node {
int info;
Node *next;
} *start, *newptr, *save, *ptr, *rear;
Node *Create_New_Node(int);
void Insert(Node *);
void Display(Node *);
void DelNode();
int main() {
start = rear = NULL;
int inf;
char ch = 'y';
while (ch ... | ALGO | 0.992818 | 3.975064 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2024-07-03T16:55: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": "09107f2e8be... |
f834d30e-9ed3-4d8c-bb22-8c7e93a41db9 | dmitmedv/sportprog | lksh2017/Day10/Gv2.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using namespace std;
const int N = 65;
const int K = 4;
const int OX[K] = {1, 0, -1, 0}; //east, south, west, north
const int OY[K] = {0, -1, 0, 1};
const string DESC[K] = {"EAST", "SOUTH", "WEST", "NORTH"};
bool used[N][... | ALGO | 0.995813 | 3.738267 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-10-12T05:18: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": "06001afc5a... |
cb273644-3521-4c99-9fa7-8dae481bb0d6 | Gin101/CS101 | HJJ/reform.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int n = 0;
int tot = 0;
int root = 0;
int result = 0;
const int maxN = 201;
const int MOD = 10007;
int head[maxN] = {0};
int big[maxN] = {0};
int size[maxN] = {0};
int dp[maxN][maxN] = {0};
int tmp[maxN] = {0};
struct Node {
int val = 0... | ALGO | 0.999813 | 4.656126 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2021-08-19T15:41: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": "314192751... |
93ad5ba1-398a-4a5c-8edb-23d9bf6b1955 | metaphysis/Code | Books/PCC2/10/10.4.2.1.cpp | const int MAXV = 110, MAXE = 12100, INF = 0x3f3f3f3f;
struct edge { int u, v, weight; } edges[MAXE];
int dist[MAXV], parent[MAXV], n, m;
bool bellmanFord(int s)
{
for (int i = 0; i < n; i++) dist[i] = INF, parent[i] = -1;
dist[s] = 0;
int updated = 1;
for (int k = 1; k < n && updated; k++)
{
... | ALGO | 0.999663 | 3.58677 | {
"github_metadata": {
"branch": "master",
"commit_count": 1710,
"repo_created_at": "2016-03-07T13:28:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 229,
"forks": 50,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b482... |
5e74136d-393a-4a83-b799-a39cf6105d4c | gabriel88766/C-CPP-AlgorithmsAndContests | Codeforces/1334/E.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f, MOD = 998244353; //1e9+7
const int INF_INT = 0x3f3f3f3f;
const long double PI = acosl(-1.), EPS = 1e-9;
using namespace std;
struct Mint{
ll v;
//static const int MOD = MOD_val;
Min... | ALGO | 0.999947 | 5.334965 | {
"github_metadata": {
"branch": "master",
"commit_count": 436,
"repo_created_at": "2020-08-21T00:21: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": "7162366d... |
92706c3d-b5bb-48ac-881a-247d4adb7844 | hyeok230/Algorithm | BaekJoon/Class/Class2/1654/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
unsigned int K, N;
unsigned int list[10000];
unsigned int ans = 0;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> K >> N;
unsigned int maxn = 0;
for (int i = 0; i < K; i++)
... | ALGO | 0.999977 | 3.900968 | {
"github_metadata": {
"branch": "main",
"commit_count": 143,
"repo_created_at": "2022-01-26T06:05: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": "213d668ca2... |
048fc255-4b47-4d07-be6a-5302e6eb40ae | MarcoPhanVu/Programming-With-School | Duong/LOPMANG.cpp | #include<iostream>
using namespace std;
class LopMang{
int n;
int a[100];
public:
LopMang(int _n = 0, int _a[]= new int [0]){
n=_n;
for(int i = 0;i < n; i++){
a[i]=_a[i];
} //mang thi phai la _a[]= new int [0]
}
LopMang (const LopMang& m ){
n=m.n;
... | ALGO | 0.998936 | 3.491826 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2022-03-14T14:14: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": "78f07000583... |
b2d3b368-8b0b-4c4e-a7e2-5dd452fa2602 | vpekunov/Planning_C_Translator | Examples/reent_reentera_pyramide.cpp | #include "stdtopo.h"
#include <iostream>
using namespace std;
const int NP = 5;
int main() {
int SUM = 0;
int PROCESSED = 0;
auto t = topology pyramide[NP] <input_proc Src, int val> {
int id = reent_linear_num();
input_proc outcoming[128];
int n_out;
reent_neighbours(false, th... | ALGO | 0.999721 | 3.697304 | {
"github_metadata": {
"branch": "main",
"commit_count": 146,
"repo_created_at": "2022-01-07T23:08:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96eeec504f... |
1fae6d93-381f-4872-99a2-de27ffa8406c | saumyayadav25/DSA-Supreme-3.0 | 16 Binary Search Trees/Week 14 - BST Assignment/09-flatten-BST-to-sorted-LL.cpp | // flatten BST to sorted LL
#include<iostream>
using namespace std;
struct node{
int key;
struct node*left, *right;
};
// function to create a new BST node
struct node* newNode(int item){
struct node* temp = new struct node;
temp->key = item;
temp->left = temp->right = NULL;
return temp;
}
//... | ALGO | 0.999998 | 5.252569 | {
"github_metadata": {
"branch": "main",
"commit_count": 382,
"repo_created_at": "2024-04-26T16:43:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 78,
"forks": 25,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6cda9d47... |
6b6f421f-0c73-4f85-a753-a7c6297def1a | mrNoactiv/DDL_Procesor-old | Framework/dstruct/paged/rtree/cCommonRTree_Insert.h | /**
* Insert item into inner node
**/
template<class TMbr, class TKey, class TNode, class TLeafNode>
void cCommonRTree<TMbr,TKey,TNode,TLeafNode>::
InsertIntoInnerNode(TNode *currentInnerNode, const TKey &item, uint currentLevel, const tNodeIndex& insertNodeIndex, cInsertBuffers<TKey>* insertBuffers)
{
cRTreeHeader... | ALGO | 0.997956 | 4.186381 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2017-03-17T20:20:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8cb5db023... |
e30e9813-37f5-4757-8c28-f09b093d8161 | jungh150/PS | codeforces/edu round 181/a.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
vector<int> a(26, 0);
for (char c: s) a[c - 'A']++;
for... | ALGO | 0.999513 | 4.956976 | {
"github_metadata": {
"branch": "main",
"commit_count": 526,
"repo_created_at": "2023-08-28T16:01: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": "cf77120281... |
77c669d8-72bc-436a-821b-c8ddd27912d3 | CyFI-Lab-Public/RetroScope | external/openfst/src/script/reweight.cc |
// 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 or agreed to in writing, software
// distributed... | ALGO | 0.938446 | 7.377154 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2016-05-15T23:49:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 120,
"forks": 43,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "29e504... |
04ae738b-3898-4972-a528-28b67025c5c7 | tatesoto/atcoder | ABC C/241-250/241.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define out(x) cout<<x<<endl
#define all(v) v.begin(),v.end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
ll N;
vector<string> S;
ll rcount(ll i,ll j){
if(j+5>N-1) return 3;
else{
ll c=0;
rep(k,6){
if(S.at(i).at(j+k)... | ALGO | 0.999975 | 4.884406 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2023-12-06T17:49: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": "f3e1f0d7d... |
94d90ddf-4b03-44a5-b7d7-ed9ad8496256 | avs/express-community | xp_comm_proj/segedit/seggrow.cxx | /*
Copyright (c) 2004 by
Advanced Visual Systems Inc.
All Rights Reserved
This software comprises unpublished confidential information of
Advanced Visual Systems Inc. and may not be used, copied or made
available to anyone, except in accordance with the license
under which it is furnished.
This file is ... | ALGO | 0.941107 | 5.41053 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2020-05-15T16:40:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e63c6d8ac7... |
bc762648-032d-45ef-bac9-bddf05198db1 | liuyubobobo/Play-with-Algorithm-Interview | 09-Dynamic-Programming/Course Code (C++)/09-Longest-Common-Subsequence/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <cassert>
using namespace std;
/// LCS问题
/// 记忆化搜索
/// 时间复杂度: O(len(s1)*len(s2))
/// 空间复杂度: O(len(s1)*len(s2))
class LCS{
private:
vector<vector<int> > memo;
// 求s1[0...m]和s2[0...n]的最长公共子序列的长度值
int __LCS(const string &s1, const string &s2,... | ALGO | 0.999973 | 4.497095 | {
"github_metadata": {
"branch": "master",
"commit_count": 257,
"repo_created_at": "2017-01-13T02:17:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1113,
"forks": 456,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eba... |
7c7168f5-212f-4473-9f0c-14ddffbd51a8 | JeraKrs/acm | codes/UVA/10001-19999/uva11481.cpp | #include <cstdio>
#include <cstring>
typedef long long ll;
const int N = 1005;
const ll MOD = 1000000007;
int n, m, k;
ll dp[N], c[N][N];
void init () {
memset(c, 0, sizeof(c));
for (int i = 0; i < N; i++) {
c[i][0] = c[i][i] = 1;
for (int j = 1; j < i; j++)
c[i][j] = (c[i-1][j-1] + c[i-1][j]) % MOD;
}
d... | ALGO | 0.999989 | 4.305048 | {
"github_metadata": {
"branch": "master",
"commit_count": 163,
"repo_created_at": "2016-05-23T06:40:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7e9c3665... |
0663b1cc-ad8f-4c8e-b829-c2577b9b05ed | mukesh2305/c-data-structure | newCommers/recursion/prob7.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lb long double
#define ull unsigned long long
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define format(n) fixed << setprecision(n)
#define pi 3.141592653
#define nl '\n'
#define Yes cout << "Yes\n"
#define YES cout << "YES\n"
#def... | ALGO | 0.999963 | 4.019483 | {
"github_metadata": {
"branch": "start",
"commit_count": 3,
"repo_created_at": "2022-05-07T13:39: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": "19cf342a026... |
b6982722-f307-4e0c-a3e0-59d28d8d3ae8 | CHART-Team/xitao | benchmarks/randomDAGs/taosort.h | // taosort.h
#include "tao.h"
#include <chrono>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atomic>
#define SORT_BUFFER_SIZE (32*1024*1024)
#define MERGE_TASK_SIZE (2*1024)
#define SORT_TASK_SIZE (2*1024)
#define INSERTION_THR (20)
#define BARRIER spin_barrier
typedef int... | ALGO | 0.999511 | 5.593518 | {
"github_metadata": {
"branch": "master",
"commit_count": 373,
"repo_created_at": "2021-03-09T16:05:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8c913345... |
9f77cb82-4ca8-47cc-9767-bd9c6bf981de | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/high-access-employees-Solution.findHighAccessEmployees/177853_DoS_Overflow.cpp | setPath(JsonbIterator **it, Datum *path_elems,
bool *path_nulls, int path_len,
JsonbParseState **st, int level, Jsonb *newval, bool create)
{
JsonbValue v;
JsonbValue *res = NULL;
int r;
if (path_nulls[level])
elog(ERROR, "path element at the position %d is NULL", level + 1);
switch ... | ALGO | 0.989724 | 4.696179 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-22T14:39:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "32ba0acb7165... |
4549825c-b9fa-4670-937b-b685d8afbd14 | jaimemin/programmers | 에어컨.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
const int INF = 987654321;
const int MAX = 1e3 + 10;
const int TEMPERATURE_RANGE = 50;
int cache[MAX][TEMPERATURE_RANGE + 1];
int solution(int temperature, int t1, int t2, int a, int b, vector<int> onboard) {
if (... | ALGO | 0.998497 | 4.210034 | {
"github_metadata": {
"branch": "main",
"commit_count": 506,
"repo_created_at": "2021-09-03T13:45:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e4b9cc2e91... |
fdfa2bf1-fdec-4036-b5a2-d90b5a5dab19 | asusunha/CPP2409-P | Sources/parking_system.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
// 주차 공간의 종류 정의
const int EMPTY = 0; // 비어있는 공간
const int MOTORBIKE = 1; // 오토바이 공간
const int COMPACT = 2; // 경차 공간
const int REGULAR = 3; // 일반차 공간
const int LARGE = 4; // 대형차 공간
const int ELECTRIC = 5; // ... | TOOL | 0.950768 | 3.908128 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-09-11T05:59: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": "ab310ad9d5c... |
1064d730-fd1f-4c2a-bdb5-660d185c7175 | AdarshNandanwar/DSA-and-Competitive-Programming | LeetCode/1552.cpp | // https://leetcode.com/problems/magnetic-force-between-two-balls/
// Method 1 (Binary Search, O(nlogn + nlog(range/m))):
class Solution {
bool predicate(const vector<int> & position, const int m, int interval){
int placed = 0, next = 0;
for(const int pos:position){
if(pos >= next){
... | ALGO | 0.999989 | 6.127635 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2020-04-05T22:00: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": "ed50b2380... |
928286a8-2391-4eef-8f81-a3ff36e57eba | tuanxn/Complex | Complex/Complex.cpp | // Student ID: 20274909
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <stdio.h>
#include "Complex.h"
using namespace std;
//int main()
//{
// Complex c = Complex(0.71785581797, 0.4131147882);
// cout << c.to_string();
//}
bool Complex::operator==(const Complex& that) const ... | ALGO | 0.927504 | 4.783724 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-07-07T14:40: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": "7d5b7c8173... |
a6367521-e7d2-46d0-83e0-2e5ce4447183 | samudraauv/samudraV4 | embeddedSystemOfAUV/pid_atlab.ino |
PID_ATLAB::PID_ATLAB(double Kp, double Ki, double Kd, double Min, double Max)
{
reset();
PID_ATLAB::SetOutputLimits(Min, Max);
PID_ATLAB::SetTunings(Kp, Ki, Kd);
}
double PID_ATLAB::Compute(double input, double zero, double Setpoint)
{
unsigned long now = millis();
SampleTime = (now - lastTime);
/*Com... | ALGO | 0.987807 | 5.552589 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2015-08-04T16:57:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e5bf083395... |
befa1fae-f55c-4e5d-aa87-ef38ea9adc88 | tcvdijk/fast-linear-carto | src/Segment.cpp | #include "RoadNetwork.h"
#include "Segment.h"
#include "Point.h"
#include "Util.h"
#include <iostream>
#include <cassert>
#include <math.h>
using namespace std;
Point *Segment::oppositeOf( Point * p ) {
if( a==p ) return b;
assert( b==p );
return a;
}
Real Segment::targetZoom() {
return requestedLength / length;... | ALGO | 0.995301 | 5.444607 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-07-29T08:28:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "edc2a6a0a6... |
bcb0f39d-9a0f-4aef-a1ff-afbc0fbef25a | GaryAacm/ACM_Algorithm | At coder/C线段树连续查询.cpp | /*
线段树维护区间最长连续子序列
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=5e4+10;
struct node{
int l,r,sum;//从左边开始往右的最长连续子序列长度,从右边开始往左的最长连续子序列长度,整段区间之和
}t[maxn<<2];
int n,m;
void pushup(int l,int r,int rt){
int m=l+r>>1;
t[rt].l=t[rt<<1].l+(t[rt<<1].l==m-l+... | ALGO | 0.999949 | 3.930297 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2025-05-22T08:57: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": "41cbd99a370... |
205ccac6-d67e-449d-9676-e0897b7de1d7 | fsjhhh/acm_title | cpp/atcoder/abc306/B.cpp | // Problem: B - Base 2
// Contest: AtCoder - Toyota Programming Contest 2023#3(AtCoder Beginner Contest 306)
// URL: https://atcoder.jp/contests/abc306/tasks/abc306_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <iostream>
#include <cstdio>
#include <cstri... | ALGO | 0.999617 | 4.650464 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2023-10-30T10:57:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7333061d81b... |
1515bacf-9579-4ff4-8a25-725d7ab3cb78 | SaharAbdelhaq/GraduationProHw | servo/servo.ino | // last update working good
#include <Servo.h>
#include <AccelStepper.h>
#include <MultiStepper.h>
// Define the servo pins
const int servoPin2 = 8;
const int servoPin3 = 9;
const int servoTrabpin = 7;
const int servoSeedpin1 = 6;
const int servoSeedpin2 = 5;
//IR1
int IRsensor1 = 2; // the pin that th... | TOOL | 0.905782 | 6.118079 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-07-28T18:02: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": "86dd9645f68f... |
b1cf0978-3845-4909-946b-9c699c13bed5 | ishandutta2007/codeforces-e | enkognit/normal/1491/A.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pii pair<int,i... | ALGO | 0.999964 | 3.764359 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:34:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f1d9f12f3c9a... |
37787952-f25e-44f0-b9e1-07fc42bbb20e | tensorflow/tensorflow | third_party/xla/xla/service/while_loop_expensive_invariant_code_motion.cc | /* Copyright 2021 The OpenXLA Authors.
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 or agreed to in writing, sof... | ALGO | 0.998967 | 4.698519 | {
"github_metadata": {
"branch": "master",
"commit_count": 182413,
"repo_created_at": "2015-11-07T01:19:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 190773,
"forks": 74758,
"issues": 873,
"pull_requests": 553
},
"file_meta": {
"content... |
b23efe6e-0737-442b-9ec9-ab1766adcc5e | zz-mars/kaleidoscope | lexer.cpp | #include <cctype>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "llvm/ADT/STLExtras.h"
#include <cstdio>
#include <map>
#include <vector>
// the lexer return [0-255] if it is an unknown character... | TOOL | 0.960096 | 5.863711 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2015-09-21T14:49: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": "eea445472b... |
4578e969-b3f8-43ea-b90c-4c37907db754 | jiguang123/Big-Data-Learning-Note | 07_数据结构与算法/LeetCode_C++版本V1/letter-combinations-of-a-phone-number(AC).cpp | // 7CE, 2RE, 1WA, 1AC, too bad~
#include <string>
using namespace std;
class Solution {
public:
vector<string> letterCombinations(string digits) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
result.clear();
... | ALGO | 0.999862 | 6.094349 | {
"github_metadata": {
"branch": "master",
"commit_count": 90,
"repo_created_at": "2018-04-07T07:05:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 51,
"forks": 19,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9309148... |
5ee5516f-1ee9-4492-9ef2-d1aa6281145c | David-Petrov/sda2021-22 | Homework_12/Скорости/david.cpp | #include <iostream>
#include <climits>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
class WeightedQuickUnion {
int count;
const int size;
vector<int> parents;
vector<int> sizes;
public:
WeightedQuickUnion(int n) : count(n), size(n), parents(n), sizes(n, 1) {
r... | ALGO | 0.999932 | 4.470494 | {
"github_metadata": {
"branch": "main",
"commit_count": 91,
"repo_created_at": "2022-07-06T10:52:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 18,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "da4916d015... |
04fcfab7-3733-49b6-8a68-b30b0fc9d94e | Xinghui-Wu/LeetCode | problem_135.cpp | /**
* 135. Candy
*
* There are n children standing in a line.
* Each child is assigned a rating value given in the integer array ratings.
* You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more ca... | ALGO | 0.999999 | 7.106261 | {
"github_metadata": {
"branch": "main",
"commit_count": 286,
"repo_created_at": "2021-06-24T11:17:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8bea88175... |
dcec1633-d3e8-43e7-b774-6f9b856a153d | SmratRitwik/LeetCodeAndGFG | A Game of LCM - GFG/a-game-of-lcm.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
long long maxGcd(int N) {
// code here
long long int ans = N * (N-1);
int c=0;
for(int i=N-2; i>2; i--... | ALGO | 0.999951 | 6.087834 | {
"github_metadata": {
"branch": "main",
"commit_count": 296,
"repo_created_at": "2022-12-11T08:23:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e7fb1eb14... |
e1a606db-ca0d-47a5-8778-75467ea6ca28 | anik-ewu/C-O-N-T-E-S-T | 1.Codeforces/OLD/Codeforces Round #705 (Div. 2)/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
#define what_is(x) cerr<<#x<<" is "<<x<<"\n";
#define read(x) freopen("in.txt","r",stdin);
#define write(x) freopen("out.txt","w",stdout);
#define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.... | ALGO | 0.999538 | 3.978848 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2020-09-20T15:31: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": "0278657f3... |
0beaa75d-a41b-491f-acd8-4424da0195dd | alexandraback/datacollection | solutions_5644738749267968_1/C++/yyjhao/d.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int main() {
double nao[1024];
double ken[1024];
int t;
scanf("%d", &t);
for (int ca = 0; ca < t; ca++) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%lf", nao + i);
}
f... | ALGO | 0.999796 | 3.424137 | {
"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": "3ababc865... |
a1141c3a-6dcd-4ff2-a14e-de0ca2b72506 | ArkadebMisra/DS-Algorithms-Cpp | segment tree/combined/addition_and_min.cpp | //There is an array of n elements, initially filled with zeros.
//You need to write a data structure that processes two types of queries:
//add v to the segment from l to r−1,
//find the minimum on the segment from l to r−1.
//link to the problem https://codeforces.com/edu/course/2/lesson/5/2/practice/contest/27965... | ALGO | 0.999815 | 5.269935 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-01-27T09: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": "877f93c4d1d3... |
adddf115-1796-4cea-9773-074090bcd4a7 | reyren19/Leetcode | 0116-populating-next-right-pointers-in-each-node/0116-populating-next-right-pointers-in-each-node.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.99982 | 5.815249 | {
"github_metadata": {
"branch": "main",
"commit_count": 471,
"repo_created_at": "2024-11-05T07:18:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8ab244d64... |
55a941e9-4220-4c88-9cd5-8e3f1aa21c48 | dhirajpatil2346/compitative | a20j/coach.cpp | #include <bits/stdc++.h> // Include every standard library
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;
double E... | ALGO | 0.999945 | 3.804117 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2022-09-28T12:31: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": "67ae4a850ab... |
f529410f-0c76-42df-b945-bada9287da80 | akksharvan/Competitive-Programming | USACO/Silver/2020-2021/US Open/Acowdemia.cpp | #include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) x.size())
#define nl "\n"
#define spc " "
array<int, (int) 1e5> p;
long long int N, K, L;
bool f (int h) {
if (h == 0) {
return true;
}
long long int nc = 0;
for (int i = 0; i < h; i++) {
nc += max(0, h - p[i]);
}
if (nc <= K * L && (p[h ... | ALGO | 0.999995 | 5.036882 | {
"github_metadata": {
"branch": "main",
"commit_count": 279,
"repo_created_at": "2022-12-18T20:37:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e98e1c32ea... |
cf0391f7-641c-4bf0-b4e7-ea10bf41668e | G4BE-334/Cplusplus | GCU-CST-210/quadratic/quad.cpp | #include "quad.h"
#include <iostream>
#include <cmath>
using namespace std;
Quadratic::Quadratic()
{
a = 0;
b = 0;
c = 0;
}
Quadratic::Quadratic(double A, double B, double C)
{
a = A;
b = B;
c = C;
}
bool Quadratic::discriminant()
{
if ((b * b - 4 * a * c) < 0)
{
return false;
... | ALGO | 0.99955 | 4.405601 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-07-10T16:47: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": "4618a39b7078... |
ae7285f1-5385-4308-8634-687d491ca9fc | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/number-of-subarrays-that-match-a-pattern-ii-Solution.countMatchingSubarrays/177833_DoS_Overflow.cpp | static void reds_handle_ticket(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
char password[SPICE_MAX_PASSWORD_LENGTH];
time_t ltime;
time(<ime);
RSA_private_decrypt(link->tiTicketing.rsa_size,
link->tiTicketing.encrypted_ticket.encrypted_data,
... | TOOL | 0.921407 | 4.365119 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-22T14:39:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4bd1c63e4f6c... |
4781f713-319f-42f2-af17-2016e5355ff9 | zzl20000307/code-learning | C++_algorithm/divide_and_conquer/hanota.cpp | #include "../../include/common.hpp"
/*移动一个圆盘*/
void move(vector<int> &src, vector<int> &tar)
{
// 从顶部拿走一个圆盘
int back = src.back();
src.pop_back();
// 将圆盘放入tar顶部
tar.push_back(back);
}
/*求解汉诺塔问题*/
void dfs(int i, vector<int> &src, vector<int> &buf, vector<int> &tar)
{
// 若src只剩下一个圆盘,直接将其移到tar
... | ALGO | 0.999982 | 5.134814 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-01-12T02:15:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2697793df3b... |
0bcba57c-a375-4aae-ac31-8192782f07e5 | shugoy/ofApps | myLens/src/mycode.cpp | //
// mycode.cpp
// myLens
//
// Created by 山口 周悟 on 2016/04/19.
//
//
//#include "ofxiOS.h"
#include "mycode.h"
//ofImage grabImage(ofVideoGrabber& grabber)
//{
// ofImage image;
// int w = grabber.getWidth();
// int h = grabber.getHeight();
// image.allocate(w, h, OF_IMAGE_COLOR);
// unsigned cha... | TOOL | 0.981753 | 4.154902 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-04-18T19:03: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": "a8a45a5ffc... |
97253ba7-f4f7-4504-b0d5-5c9fdc13af8c | loganryan01/Code-Design-and-Data-Structures-Assignment | Binarytree/Project1/App.cpp | /*----------------------------
File Name: App.cpp
Purpose: Draws the app.
Author: <NAME>
Modified: 28 June 2020
------------------------------
Copyright 2020 <NAME>.
----------------------------*/
#include "App.h"
#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_SUPPORT_ICONS
#inc... | TOOL | 0.922887 | 5.71376 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-07-01T04:46: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": "6c1aa18eae... |
48ace7c7-bb8d-4cf5-b8c1-5b7e80db7c92 | crinn8/Facultate-Informatica-Aplicata | ANUL 1/SEMESTRUL 2/Programare orientata pe obiecte/Laboratoare/Laborator2/Problema1/Problema1/Problema1.cpp | /*Func?ie care prime?te ca primi parametrii lungimea unui vector de numere Óntregi
precum ?i pointerul c?tre acest vector.S? se construiasc? un alt vector(alocat
dinamic) format cu elementele care sunt numere prime ale vectorului ini?ial.S? se
returneze prin referin?? lungimea vectorului construit precum ?i pointerul c... | ALGO | 0.999848 | 4.060011 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-05-05T08:41: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": "400a4c049638... |
1c1bd7c2-b468-493a-9640-d062374756cf | ArindamDutta02082001/Target450Q | array/splitbinarystring0and1.cpp | // C++ implementation of the approach
#include <bits/stdc++.h>
using namespace std;
// Function to return the count
// of maximum substrings str
// can be divided into
int maxSubStr(string str, int n)
{
int z = 0, o = 0;
int c = 0;
for (int i = 0; i < n; i++)
{
if (str[i] == '0')
z... | ALGO | 0.999951 | 5.584351 | {
"github_metadata": {
"branch": "main",
"commit_count": 52,
"repo_created_at": "2021-09-18T14:02:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "cff2c8a3cfa... |
a7dec6e2-5aee-4a7d-9ffd-cb24d2222742 | BCLCommons/bcl | include/descriptor/bcl_descriptor_molecule_3da_soft_max.h | // (c) Copyright BCL @ Vanderbilt University 2014
// (c) BCL Homepage: http://www.meilerlab.org/bclcommons
// (c) BCL Code Repository: https://github.com/BCLCommons/bcl
// (c)
// (c) The BioChemical Library (BCL) was originally developed by contributing members of the Meiler Lab @ Vanderbilt University.
// (c)
// (c) T... | ALGO | 0.986691 | 6.086073 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2022-05-21T17:35:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 29,
"forks": 19,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "e884b763... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.