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 |
|---|---|---|---|---|---|---|---|
af1049b4-bf0e-4bdb-8d86-da9e692dcda4 | MinSung910/LeetCode | longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums, int limit) {
int size = nums.size();
int i = 0;
int max_val = nums[0];
int min_val = nums[0];
int ans = 1;
for (int j = 1; j < size; j++) {
max_val = max(max_val, nu... | ALGO | 0.999993 | 5.645399 | {
"github_metadata": {
"branch": "master",
"commit_count": 520,
"repo_created_at": "2021-11-12T10:16: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": "a377ae6b... |
e5059dd5-1d62-4695-9e29-0aa819ecdb86 | akshanshgusain/data_structures_algorithms | BinaryTree/BT_000.cpp | //
// Created by <NAME> on 27/01/24.
//
#include<bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
struct TreeNode *left, *right;
TreeNode() {
val = 0;
left = nullptr;
right = nullptr;
}
explicit TreeNode(int key) {
val = key;
left = nullptr;
... | ALGO | 0.99995 | 5.997181 | {
"github_metadata": {
"branch": "master",
"commit_count": 153,
"repo_created_at": "2022-07-21T10:11:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "adca9c2d... |
39a930c6-07ed-4773-938f-b848aa879ad3 | eigengravy/cs-f211 | lab08/Q2_Template.cpp | // #include <bits/stdc++.h>
#include <vector>
#include <stdio.h>
#include <ios>
#include <iostream>
#include "__STUDENTPROGRAM__"
#include "Node.h"
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t, n, m, x;
cin>>t;
while(t--)
{
cin >> n;
... | ALGO | 0.999931 | 4.08435 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-01-21T17:49: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": "26c733acbb3c... |
34c08fe9-8665-4a41-a233-13fa80d56542 | Parth-Sohal/leetcode | 29-divide-two-integers/divide-two-integers.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
if (dividend == 0) {
return 0;
}
if (dividend == INT_MIN && divisor == -1) {
return INT_MAX;
}
long long low = 0;
long long high = abs((long long)dividend);
long long a... | ALGO | 0.999951 | 5.717703 | {
"github_metadata": {
"branch": "main",
"commit_count": 260,
"repo_created_at": "2025-02-05T19:15: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": "22e30422d9... |
00763e91-4698-425e-bf4a-08bc01ed8b90 | connect-abdulbasit/Data-Structure-Task | Lab 7/task3.cpp | #include <iostream>
using namespace std;
class linkedList;
void radixSort(linkedList &l1);
void countSort(linkedList &l1, int exp);
class Node
{
int score;
string name;
Node *next;
Node *prev;
public:
Node()
{
score = 0;
name = "";
next = NULL;
prev = NULL;
}... | ALGO | 0.999785 | 4.738702 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2024-11-12T12:14: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": "36c79fe4f73... |
d532fda6-21a4-4abd-9d76-e0cdac816dfe | colmcoughlan/pmem | src/update_Lagrangian.cpp | #include "update_Lagrangian.hpp"
/*
new_ABG
new_ABG gets new values for alpha, beta and gamma
This function uses LAPACK functions dgetrf (factorise into LU) and dgetrs (solve A x = b when A is LU factorised)
inputs:
grad = a structure containing all the norms calculated in get_info
delta_E = the difference b... | ALGO | 0.999728 | 4.715761 | {
"github_metadata": {
"branch": "master",
"commit_count": 29,
"repo_created_at": "2015-07-07T13:32: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": "59cb67636... |
d309cbbb-e6b8-41a4-bd97-4f75f4beb327 | vd-07/CP | atcoder/beginner-209/2.cpp | //Author : <NAME>
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxN = 3e5 + 1;
int n, x;
int a[mxN];
void solve() {
cin >> n >> x;
int sum = 0;
for(int i = 0; i < n; ++ i) {
int y;
cin >> y;
sum += y;
}
sum -= n / 2;
cout << (sum <= x ? "Yes" : "No");
}
int32_t main(... | ALGO | 0.999982 | 3.857496 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2019-09-09T18:28:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ddff99ac1... |
d21b0a54-a9a8-4214-b0fa-31a8c211601f | kundan181/Problem-On-Leetcode | 102-binary-tree-level-order-traversal/102-binary-tree-level-order-traversal.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.999938 | 5.529684 | {
"github_metadata": {
"branch": "main",
"commit_count": 1147,
"repo_created_at": "2022-04-16T08:47:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "766f0d210... |
0d3de9fc-dca5-40f8-981e-de490f9eb02c | shunlqing/DoCode | algo/Algorithms4/2-Sorting/2.1-ElementarySorts/Shell.h | #ifndef _SHELL_H_
#define _SHELL_H_
#include <iostream>
#include "BaseSort.h"
template <typename Comparable>
class Shell : public BaseSort<Comparable> {
public:
virtual void sort(Comparable a[], int size)
{
int h = 1;
while(h < size/3)
h = 3*h + 1;
while(h >= 1){
... | ALGO | 0.974627 | 3.896993 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2017-12-26T02:06: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": "4cc2221cb... |
c412eec3-7c0b-4a76-b623-f30857272cf1 | ishandutta2007/codeforces-a | alice_foo_foo/normal/1106/B.cpp | #include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
#define DEBUG(x) cerr << "DEBUG" << x << " >>> " << endl;
using namespace std;
typedef unsigned long long ull;
typedef p... | ALGO | 0.999991 | 3.446611 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-04-11T00:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9ff900d926e... |
e93c3cdb-a48f-438e-b504-aeb093e54d70 | vNaonLu/leetcode-daily | src/q_301_350/q0309.cc | // Copyright 2023 <NAME>
//
// This file describes the solution of
// Best Time to Buy and Sell Stock with Cooldown
//
// https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/
//
// Question ID: 309
// Difficult : Medium
// Solve Date : 2021/10/15 10:08
#include <iosfwd>
#include <limits>
#incl... | ALGO | 0.99939 | 6.261556 | {
"github_metadata": {
"branch": "main",
"commit_count": 2477,
"repo_created_at": "2021-09-06T15:30:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af69df85b... |
1a639fe0-223e-4a7d-ab6e-99f6c1a26d24 | maicode/DFA-Assignment | Giraldi_DFA_Assignment2.cpp | /*********(>'-')>**********
Written by <NAME>
**********<('-'<)*********/
#include <vector>
#include <iostream>
using namespace std;
vector<string> Substrings(vector<char> v) {
vector<string> str;
//The 'A' loop.
for(int i = 0; i < v.size(); i++) {
if(v[i] == 'A') {
//The 'T' loop.
for(int j = i... | ALGO | 0.996636 | 4.625106 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2020-02-03T06:11:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "66c4719ed5... |
6ca0622c-e5d1-45b6-9429-9d5d0c455d39 | ShujiaHuang/Cpp-Primer-Plus-6th | bookcodes/chapter08/funtemp.cpp | // funtemp.cpp -- using a function template
#include <iostream>
// function template prototype
template <typename T> // or class T
void Swap(T &a, T &b);
int main()
{
using namespace std;
int i = 10;
int j = 20;
cout << "i, j = " << i << ", " << j << ".\n";
cout << "Using compiler-generated int sw... | ALGO | 0.985288 | 5.805471 | {
"github_metadata": {
"branch": "main",
"commit_count": 83,
"repo_created_at": "2021-07-15T08:44:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2796,
"forks": 576,
"issues": 9,
"pull_requests": 2
},
"file_meta": {
"content_id": "10d714... |
ba3adf07-30fb-4ce4-9f88-6b2137ec6ee5 | PrachetShah/DSA_and_Codeforces_Solutions | data-structures/Tree/BinaryTree/viewTraversals.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int data){
data = data;
left = NULL;
right = NULL;
}
};
void traversalCode(Node* root){
// node, [level ,hd]
queue<pair<Node*, pair<int, int>>> q;
map<... | ALGO | 0.999931 | 4.706423 | {
"github_metadata": {
"branch": "main",
"commit_count": 323,
"repo_created_at": "2023-07-18T15:23:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d1c6128500... |
67f5c2b2-7f39-4c3a-a46a-5b93ba0fe404 | jatin1322/Leetcode_DSA_Practice | 53-maximum-subarray/53-maximum-subarray.cpp | class Solution {
public:
int maxcross(int l,int m,int h,vector<int> &arr){
int sum = 0;
int left_sum = INT_MIN;
for (int i = m; i >= l; i--) {
sum = sum + arr[i];
if (sum > left_sum)
left_sum = sum;
}
// Include elements on right of mid
sum = 0;
int rig... | ALGO | 0.999974 | 6.007854 | {
"github_metadata": {
"branch": "main",
"commit_count": 806,
"repo_created_at": "2022-05-23T04:44: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": "0ba89c2069... |
b6b4eea0-eb4f-4999-a257-ab00cc7db3f5 | emilyju0314/gpt_code_plagiarism | dataset/code_content_classifier/allpro_train/1_887_45.cpp | #include <bits/stdc++.h>
using namespace std;
void shikhar7s(long long int cas) {
long long int n, k, i;
cin >> n >> k;
long long int a[n], l = -1, c = 0;
for (i = 0; i < n; i++) {
cin >> a[i];
if (l != a[i]) {
c++;
l = a[i];
}
}
if (k == 1) {
if (k >= c)
cout << 1 << "\n";... | ALGO | 0.999803 | 3.453817 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-04-28T03:59: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": "edbe91b44a6... |
115e96e4-9ded-4f06-8ae8-700df0afe53c | 1iyiwei/comp1117 | src/sample12/exp.cc | // Recursive and iterative approach for computing
// exponentiation
#include <iostream>
using namespace std;
double Exp_loop(double x, int n)
{
double result = 1;
for (int i = 0; i < n; ++i)
result *= x;
return result;
}
// recursion is good :-)
double Exp(double x, int n)
{
if (n == 0)
return 1;
... | ALGO | 0.999957 | 5.610862 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2016-05-21T23:50:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fcb276d0... |
cff8d8bf-14cb-43b2-8dae-315980ee0fa5 | southbear-club/ars-sdk | include/ars/sdk/ds/rbtree.hpp | /**
* Copyright © 2021 <wotsen>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the “Software”), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* ... | ALGO | 0.924266 | 5.516837 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-04-03T03:43:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00b64d2ff83... |
f183cd6b-d21f-4321-a245-526217b3057a | gitrider/wxsj2 | EngineSDK/ThirdParty/VSInclude/cgal/CGAL/Boolean_set_operations_2/Gps_utils.h | // Copyright (c) 2005 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this ... | ALGO | 0.993292 | 3.328918 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-08-26T14:38:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 15,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2fbbf4789... |
87ff2191-823b-4696-ae73-55b31a112d11 | sahilkhoslaa/MazeSolverRobot | MazeSolverRobot/ArduinoCode_PreOrderTraversal.ino | float PWM;
float PWM2;
int P; // (Preportional)
float I; // (Integral)
float D; // (Derivative)
int pI; // The sum of the preportional value and the integral value
int PID;
int val;
int Aval; // All values (see the integral equation)
int Pval1; // The previous value (see the derivative term)
int Pval2;
int Dval; // Th... | ALGO | 0.998789 | 3.531848 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2017-01-17T18:01:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 9,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "b75d1343d... |
169d2f65-6bec-4afe-83aa-4f9055331e00 | fattypiggy/jianzhioffer | 67把字符串转换成整数/main.cpp | #include <iostream>
using namespace std;
class Solution {
public:
// 此题条件判断处极易出现错误
int strToInt(string str) {
if (str == "") return 0;
long long num = 0;
// flag: 用于存放符号位是否找到
// isNegative: 数字的符号
// started: 计算数字是否已经开始,若已经开始,不允许跳过空格
bool flag = false, isNegative =... | ALGO | 0.999809 | 4.089139 | {
"github_metadata": {
"branch": "main",
"commit_count": 85,
"repo_created_at": "2021-06-16T03:16: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": "195c7f83102... |
f415df71-e896-4f76-897e-89c68b452836 | wuxun-zhang/algorithms_learning | leetcode/cpp/simple/1_two_sum.cpp | #include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
/// There is only one answer corresponding to each inputs
class Solution {
public:
// Simplest solution
// traverse all elements, time complxity is almost O(N*N)
// space complexity O(1)
vector<int> twoSum(vector<int>... | ALGO | 0.999986 | 5.887331 | {
"github_metadata": {
"branch": "master",
"commit_count": 79,
"repo_created_at": "2018-06-06T13:11: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": "d2a78d955... |
c6a20684-d438-480c-8e8c-97ed6881033b | zyadhany/RoadToIcpc | Up_Solve/CSES/Dynamic Programming/Projects.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#define ll long long
#define ld long double
#define pl pair<ll, ll>
#define vi vector<ll>
#define vii vector<vi>
#define vc vector<char>
#define vcc vector<vc>
#define vp vector<pl>
#define mi map<ll,ll>
#define mc map<char, ll>
#define sortx(X) sort(X.begin(),X.end()... | ALGO | 0.999984 | 4.488806 | {
"github_metadata": {
"branch": "main",
"commit_count": 326,
"repo_created_at": "2023-10-15T14:48:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e10badcbb... |
5ba6af99-0be9-4ecd-9f0e-e6ef2abf3359 | matei0tutiu/tema-matrici | tema-patratice/786/786.cpp | #include <iostream>
#include "../../helper.cpp"
using namespace std;
void c_786()
{
size_t n;
std::cin >> n;
unsigned long long **data = Utils::allocate_matrix<unsigned long long>(n, n);
Utils::GetMatrixFromConsole(data, n, n);
for (size_t r = 0; r < n; r++)
{
for (size_t c = 0; c < n... | ALGO | 0.998656 | 5.161276 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-07T18:03: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": "9874d36ec296... |
8417b2b2-f1e7-4572-8aed-e8129187c4a0 | jlswbs/K210_Maix_Cube | Fizzy_CA/Fizzy_CA.ino | // Fizzy Cellular Automata //
#include <Sipeed_ST7789.h>
#include "lcd.h"
#define WIDTH 240
#define HEIGHT 240
#define SCR (WIDTH * HEIGHT)
SPIClass spi_(SPI0);
Sipeed_ST7789 lcd(WIDTH, HEIGHT, spi_);
static uint16_t gray2rgb565[64]={
0x0000, 0x2000, 0x4108, 0x6108, 0x8210, 0xa210, 0xc318, 0xe318,
0x0421, 0x24... | ALGO | 0.988518 | 5.172883 | {
"github_metadata": {
"branch": "main",
"commit_count": 52,
"repo_created_at": "2020-12-02T19:42: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": "a0ee4571bc5... |
4cdcfc9f-b420-4af1-8a89-fb8b6e8d1c56 | notorious94/UVa-solution | 10324 UVA.cpp | #include<bits/stdc++.h>
using namespace std;
/// M A C R O Starts Here
#define pf printf
#define sf scanf
#define MAX 500000
#define MOD 100000007
#define INF INT_MAX
#define pi acos(-1.0)
#define get_stl(s) getline(cin,s)
#define sif(a) scanf("%d",&a)
#define pif(a) printf("%d\n",a)
#define puf(a) printf("%llu\n",a)
... | ALGO | 0.999863 | 3.470809 | {
"github_metadata": {
"branch": "master",
"commit_count": 643,
"repo_created_at": "2017-06-16T19:59:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f26763cb... |
2db6f46d-a37c-4b82-8cba-628ea818b49a | nperaya/lab15 | lab15_2.cpp | #include<iostream>
using namespace std;
const int N = 5;
void inputMatrix(double [][N]);
void findLocalMax(const double [][N], bool [][N]);
void showMatrix(const bool [][N]);
int main(){
double A[N][N];
bool B[N][N];
cout << "Input the matrix.....\n";
inputMatrix(A);
findLocalMax(A,B);
cout << "Result is \... | ALGO | 0.999823 | 3.933673 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2023-01-17T08:07: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": "0155f6921... |
c68f1c5f-f113-4738-bcf7-1f561bdc0141 | SunHoJeong/algorithm | 11724.cpp | //
// 11724.cpp
// Algorithm_2017
//
// Created by 수노 on 2017. 1. 9..
// Copyright © 2017년 수노. All rights reserved.
//
#include <cstdio>
#include <queue>
using namespace std;
int n, m;
int graph[1001][1001] = {0,};
bool visited[1001] = {false,};
int cnt = 0;
queue<int> q;
void bfs(){
while(!q.empty()){
... | ALGO | 0.999976 | 3.772734 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2017-01-10T07:11: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": "a96fed5de... |
8505a8d4-3e34-4fbb-9791-02678210998f | algo-seacow/code | zerojudge/d506.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int LL;
const LL Unite = 100000000;
struct big_int {
// member ----------------
int len;
vector<LL> ele;
big_int(LL a = 0) {
len = 1;
ele.resize(1);
ele[0] = a;
}
void outp... | ALGO | 0.999976 | 3.900907 | {
"github_metadata": {
"branch": "master",
"commit_count": 289,
"repo_created_at": "2020-08-12T05:29:15.000Z",
"is_fork": true,
"is_org_owned": true,
"forked_from": "cthbst/Competitive-Programming",
"stars": 24,
"forks": 20,
"issues": 0,
"pull_requests": 0
},
"file_meta": {... |
94130a4d-dc9c-4717-8edb-2fef604d6b53 | opencv/opencv_contrib | modules/ximgproc/src/radon_transform.cpp | // This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "precomp.hpp"
namespace cv {namespace ximgproc {
void RadonTransform(InputArray src,
... | ALGO | 0.941866 | 6.523366 | {
"github_metadata": {
"branch": "4.x",
"commit_count": 4557,
"repo_created_at": "2013-09-11T13:28:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9757,
"forks": 5828,
"issues": 553,
"pull_requests": 88
},
"file_meta": {
"content_id": "d0... |
5f13a59d-1747-43c4-a46c-82c48c5cdc03 | TsuPeiChiu/DNAshapeR | src/prediction.cpp | #include "prediction.h"
#include "utilities.h"
//Can be used to predict propel as well
void predict_groove_width(std::stringstream &outs,std::vector<pointers_vector> &pointers_matrix,std::vector<int_vector> &status_matrix, \
string_vector &name_list,bool debug,DNA_to_properties &pentamers_map,std::string objectna... | ALGO | 0.982215 | 4.783884 | {
"github_metadata": {
"branch": "master",
"commit_count": 150,
"repo_created_at": "2015-10-16T05:05:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 18,
"forks": 8,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "04c4b51... |
7cc8190f-ba95-48f5-a2b7-c2acbc8ad80c | T7imal/DGP_2025 | source/Runtime/renderer/nodes/shaders/shaders/Rendering/Materials/RGLAcquisition.h | /***************************************************************************
# Copyright (c) 2015-23, NVIDIA CORPORATION. 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... | ALGO | 0.909143 | 6.785174 | {
"github_metadata": {
"branch": "main",
"commit_count": 90,
"repo_created_at": "2025-02-25T04:12:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "369623de36... |
57ab009c-95b9-4d46-bd60-7f12ed788110 | YoussefSherif10/C_PlusPlus | Concurrent_QuickSort_CPP/main.cpp | #include <iostream>
#include <future>
#include <chrono>
#include <list>
using namespace std;
template<typename T>
list<T> sequentialQuickSort(list<T> input){
if (input.empty())
return input;
list<T> result;
// copy the elements of the input list into the result list
// starting pos, the sourc... | ALGO | 0.999917 | 6.039093 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2023-10-30T11:43: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": "03f3c3bc578a... |
0feba07c-24d4-4e7a-ada4-91db3ef4162f | pomiehuan/mini-PT | src/mesh.cpp | #include "mesh.hpp"
#include "sphere.hpp"
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <sstream>
const double MAX = std::numeric_limits<double>::max();
const double epsi = 1e-8;
bool Mesh::intersect(const Ray &r, Hit &h, double tmin) {
// 构造包围盒
doubl... | ALGO | 0.941929 | 4.191585 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-08-09T13:52: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": "2a94a132c0de... |
218310c7-e50c-409f-a038-3c86f3f7ee87 | ishankinger/Data-Structures-and-Algorithms | GRAPHS/iking_128.cpp | // WORLD LADDER
// GIVEN TWO WORDS START AND END, AND WE HAVE TO GET THE MINIMUM NUMBER OF TRANSFORMATIONS NEEDED TO CONVERT START_WORD TO END_WORD
// ALL THE TRANSFORMATIONS MUST CONTAIN ONE CHARACTER TO CHANGE AND NEW WORD SHOULD BE IN THE ARRAY LIST OF WORDS WHICH IS UNIQUE
// AND RETURN 0 IF NO POSSIBLE WAY TO FIN... | ALGO | 0.99999 | 4.91738 | {
"github_metadata": {
"branch": "main",
"commit_count": 172,
"repo_created_at": "2023-09-25T12:17: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": "8dfde32044... |
9a37b4ca-aba0-4902-abb6-d6f4687f22e3 | Geant4/geant4 | source/geometry/magneticfield/src/G4FSALBogackiShampine45.cc | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration... | ALGO | 0.999019 | 4.188177 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2016-06-21T08:25:54.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 705,
"forks": 340,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "21036d... |
d4e45737-d164-416d-b3e7-d1fd9307bb1f | sraihan73/Lucene- | spatial-extras/src/java/org/apache/lucene/spatial/composite/CompositeSpatialStrategy.cpp | using namespace std;
#include "CompositeSpatialStrategy.h"
namespace org::apache::lucene::spatial::composite
{
using Field = org::apache::lucene::document::Field;
using DoubleValuesSource = org::apache::lucene::search::DoubleValuesSource;
using Query = org::apache::lucene::search::Query;
using SpatialStrategy = org::... | ALGO | 0.959372 | 7.435048 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-10-08T04:50:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e8ff3ee31... |
de36d390-bd8a-4e27-8d43-dfd866396ae9 | neilsuyukai/data-structure | 3-3.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int stack[20];
int top = -1;
void push(int num)
{
stack[++top] = num;
}
void pop(int& num)
{
num = stack[top--];
}
int Transfer(char postfix[])
{
for (int i = 0; i < 20; i++)
{
if (postfix[i] >= 48 && postfix[i] <= 57)
{
... | ALGO | 0.99871 | 3.632928 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-12-14T13:50: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": "32c6dfefb53a... |
0b75886a-f009-4f92-ae6f-72f556101d05 | pressogh/algorithm | C++/1113 수영장 만들기.cpp | // 1113
/*
* 수영장에 물을 채우는 데, 최대 얼마만큼의 물을 채울 수 있는지 구하는 문제
* 물은 어차피 최대 수영장 높이까지밖에 채우지 못하므로 최대 물 양을 구해서
* 물을 한칸씩 올려주는 식으로 해결하였다.
*/
#include <bits/stdc++.h>
#define in :
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using dv = vector<vector<int>>;
int n, m;
int arr[52][52];
bool isSafe(int x... | ALGO | 0.999959 | 4.343596 | {
"github_metadata": {
"branch": "master",
"commit_count": 348,
"repo_created_at": "2021-05-24T07:39:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00881e44... |
1a970d11-c291-408b-88b1-b5556f121956 | Jaemin0730/BOJ_2023_SS | 08_BackTracking/14888.cpp | #include <bits/stdc++.h>
using namespace std;
#define u ios::sync_with_stdio(false); cin.tie(NULL);
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
#define MAX 1000000001
int n;
int v[11]; // 수열
int k[4]; // 연산자의 개수 (+ - * /)
int mmin =... | ALGO | 0.999945 | 3.744342 | {
"github_metadata": {
"branch": "main",
"commit_count": 117,
"repo_created_at": "2023-01-05T13:57: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": "876e8fd1de... |
369072e4-a7c8-4c95-9942-74bd0fa6ab3d | kunal299/Data-Structures-and-Algorithms | Striver's DP Series/Part 4 - DP on Subsequences/Partition Set Into 2 Subsets With Min Absolute Sum Diff/Approach - 1.cpp | /*
Time Complexity- O(n*k) + O(n) + O(n)
Space Complexity - O(n*k) + O(n)
where k is the total sum of elements in the arr
*/
bool helper(int idx, int target, vector<int> &arr, vector<vector<int>> &dp) {
if(target==0) return dp[idx][target]=true;
if(idx==0) return dp[idx][target]=target==arr[idx];... | ALGO | 0.999962 | 5.552316 | {
"github_metadata": {
"branch": "main",
"commit_count": 268,
"repo_created_at": "2022-01-13T10:52:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a57a1e011e... |
55ae9330-8327-4d38-a509-700a3e08502e | cigar1920/testprogram | fdlibm1028/e_y0l.cstmt_p.cpp | #include "../ScDebug/scdebug.h"
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided th... | ALGO | 0.999395 | 3.329993 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-01-06T13:12: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": "05e5a7232268... |
cb08c1c9-7d92-41c1-9709-f2a00333d331 | eassisv/online-judge | Uri/1211.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_L 212
#define MAX_N 112345
struct lista{
char num[MAX_L];
}tel[MAX_N];
int cmp(const void *a, const void *b){
lista l1 = *(lista*)a, l2 = *(lista*)b;
int i, len = (int) strlen(l1.num);
for(i = 0; i < len; i++){
if(l1.num[i] < l2.num[i]) ret... | ALGO | 0.999728 | 3.244829 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-08-23T11:45: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": "2091d98c00... |
4ec8252d-6417-42a4-b8fb-a25bff7242ec | CISTILY/Object-Oriented-Programming-HCMUS | Homework/W01/Assignment03/22127390_Ex03.cpp | #include "LinkedListQueue.h"
using namespace std;
int main () {
LinkedListQueue a;
a.initLinkedList(0);
int choice, capacity, value;
cout << "==== Queue / LinkedList operation ====" << endl;
cout << "1. Init Queue" << endl;
cout << "2. Enqueue" << endl;
cout << "3. Push" << endl;
cout ... | TOOL | 0.988199 | 4.70352 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2023-10-03T06:34:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71aad793b36... |
4d56bfba-9d7e-44d3-aced-af1d051393a6 | zzzmfps/PAT | GPLT-Practice/L1/L1-046 整除光棍 (20).cc | #include <iostream>
using namespace std;
int main(void)
{
int num; // odd and not ends with '5'
cin >> num;
int bits = 1, remains = 1;
while (true) {
// calculates remainder, not dividend itself, avoiding overflow
int tmp = remains / num * num;
if ((remains -= tmp) == 0) break;
... | ALGO | 0.999448 | 3.877309 | {
"github_metadata": {
"branch": "master",
"commit_count": 438,
"repo_created_at": "2018-04-06T09:38:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "82048e24... |
d209ab10-1f0b-4a5d-b212-c4fd58d3b3ca | Vanaub22/gfg-submissions | Medium/Max sum in the configuration/max-sum-in-the-configuration.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*You are required to complete this method*/
class Solution {
public:
long long max_sum(int a[], int n) {
long long cval=0,ans,tsum=0;
for(int i=0;i<n;i++) tsum+=a[i];
for(int i=0;i<n;i++) cval+=(l... | ALGO | 0.999914 | 6.018258 | {
"github_metadata": {
"branch": "main",
"commit_count": 351,
"repo_created_at": "2024-06-05T07:09: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": "c9d0b435b6... |
43af1026-981c-465d-908f-a4479f6c59b1 | braegel/Arduino-Serial-Reader | ArduinoFirmware/ArduinoFirmware.ino | /*
Analog input, analog output, serial output
Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.
The circuit:
* potentiometer connected to analog pin 0.
Center pin o... | ALGO | 0.998613 | 4.68977 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2011-07-03T12:35:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "349148b61... |
6205a317-7d2a-43cf-86cb-c6d4a29acd14 | EveSunMaple/Code | luogu/D11/future.cpp | #include <algorithm>
#include <iostream>
#include <cmath>
#define N 200005
using namespace std;
int num[N];
bool tag[N];
class node
{
public:
bool lazy;
int l, r, sum;
}tree[N * 4];
class quest
{
public:
int l, r;
}way[N];
void Pushup(int crd)
{
tree[crd].sum = tree[crd * 2].sum + tree[crd * 2 + 1]... | ALGO | 0.999936 | 4.06962 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2023-07-31T10:59: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": "eac8ef35a... |
d27710a1-c9ff-443d-b6c5-0bee9cccd9cb | AneeshAhuja31/DSA_Concepts | Trees/Queue+Node.h | #include<iostream>
using namespace std;
struct Node{
Node*lchild;
int data;
Node*rchild;
};
struct Queue{
int size;
int front;
int rear;
Node**Q; // one * for Node and one * for array
};
void CreateQueue(Queue*q,int size){
q->size=size;
q->front=q->rear=-1;
q->Q = new Node*[q->s... | ALGO | 0.999601 | 3.410286 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-16T17:56:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b28870e76377... |
c34e7ede-1892-4e15-a5ac-199cb039d36e | metehkaya/Algo-Archive | Problems/CodeChef/Contests/Long/Div_2/MARCH20B/C_Full.Ada_Bishop_2.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef pair<int,int> pi;
int T;
vector<pi> moves;
void precalc() {
moves.pb(pi(8,8));
moves.pb(pi(7,7));
moves.pb(pi(6,8));
moves.pb(pi(1,3));
moves.pb(pi(2,4));
moves.pb(pi(1,5));
moves.pb(pi(4,8));
moves.p... | ALGO | 0.999328 | 3.223224 | {
"github_metadata": {
"branch": "main",
"commit_count": 78,
"repo_created_at": "2023-04-04T19:44: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": "f78a337d303... |
5b980815-04f9-4dd0-8ee8-45e3397852df | AhmedAdel21/Embedded-Software | SelfDrivingCar/Arduino Code/Arduino Code.ino |
#define left_motors_1 12
#define left_motors_2 8
#define right_motors_1 4
#define right_motors_2 2
#define r_speed 3
#define l_speed 5
#define buzzer 7
#define dir_pin1 A0
#define dir_pin2 A1
#define dir_pin3 A2
int dir1;
int dir2;
int dir3;
#define trig_pin 10
#define echo_pin 11
long duration;
int distance,dist;... | TOOL | 0.969324 | 4.153438 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-08-15T01:56: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": "9d69d3217a84... |
c3782ba3-3a7a-4ead-be76-70f4262583bc | NahidMuntasir7/Algorithms | Arrays/Subarray/2. CSES - Subarray Sums II.cpp | //Given an array of n integers, your task is to count the number of subarrays having sum x. (negative included)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x;
cin >> n >> x;
int arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
long long sum = 0, cnt = 0;
map<lo... | ALGO | 0.999985 | 4.971553 | {
"github_metadata": {
"branch": "main",
"commit_count": 901,
"repo_created_at": "2023-02-10T09:30:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "868ecb1ea5... |
c33cc3e0-71e8-4f43-a4c3-3c21c999334f | Jiboxiake/GTX-Serializable | src/gtx_transaction.cpp | //
// Created by zhou822 on 6/1/23.
//
#include "../core/gtx_transaction.hpp"
#include "../core/edge_delta_block_state_protection.hpp"
#include "core/commit_manager.hpp"
#include <immintrin.h>
using namespace GTX;
//pessimistic mode
#if USING_PESSIMISTIC_MODE
//fixme:: we should not use this function. this is unchecked... | TOOL | 0.997098 | 6.865623 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-10-09T01:01:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7a29880741... |
5353885a-1cdb-4cde-9f9f-77716d31165f | kavehshamsi/neos | src/mc/bmc_ckt.cpp | /*
* bmc.cpp
*
* Created on: Sep 2, 2018
* Author: kaveh
*/
#include "mc/bmc.h"
namespace mc {
BmcCkt::BmcCkt(const circuit& cir, const oidset& frozens,
const Bmc_config_t& config) : Bmc(config), bmcckt(cir) {
// cir.write_bench();
// assert(cir.nOutputs() == 1); // only single ended
tranckt = cir;... | ALGO | 0.99518 | 3.839739 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-12-21T06:24:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "602c83f233... |
464ef71a-4150-4be7-a7bc-10ca653f2525 | KunjShah95/APPLIED-OS | FSFS/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Task
{
int id;
int arrival_time;
int burst_time;
int start_time;
int completion_time;
};
void fcfsScheduling(vector<Task> &tasks)
{
int current_time = 0;
sort(tasks.begin(), tasks.end(), [](const Task &a... | ALGO | 0.999879 | 5.458307 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-02-05T11:49: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": "49a970c8418b... |
64ba197b-6a0a-44c3-bf1e-7c3a6295d52e | Void2403/2019SummerHoliday | 8.20/TRAVEL/travel2.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
inline int read(int &n)
{
char ch=' ';int q=0,w=1;
for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
if(ch=='-')w=-1,ch=getchar();
for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int abss(int x){return x>0?x:-x;}
int ... | ALGO | 0.999946 | 3.646963 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-08-21T10:48: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": "2ca58ece8d... |
d4ba5acc-f7ad-4865-ab16-a835fce7b6d1 | scPointer/OI | bzoj/1269_2.cpp | #include <cstdio>
#define N 2070005
#define ND 2070000
#define gp son[son[root][1]][0]
#define Swap(a,b) {_temp=a;a=b;b=_temp;}
inline int RD(){static int res;scanf("%d",&res);return res;}
char sc[N];
int son[ND][2],fa[ND];
int cnt[ND];
char val[ND];
bool rev[ND];
int stk[ND],tops;
int nds,root;
int _temp;
inline void ... | ALGO | 0.999586 | 3.487767 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2016-03-20T12: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": "9686346ebe... |
ed64bda9-9d86-4aaf-bedc-4f6d98df43b4 | Aom29/Aom_CP | Contest3/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, q;
cin >> n >> q;
string cadena, subcadena;
cin >> cadena;
//las consultas sonn q
while (q > 0) {
int i, j, k;
cin >> i >> j >> k;
// cout << endl;
... | ALGO | 0.999983 | 4.714594 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-01-24T23:20:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "54c9795481a... |
814e1a10-8aed-4947-a0a8-6f6aa3a3ab41 | machinekit/machinekit | src/libnml/inifile/inifile.hh | /********************************************************************
* Description: inifile.hh
* Declarations for INI file format functions
*
* Derived from a work by <NAME> & <NAME>
*
* Author:
* License: GPL Version 2
* System: Linux
*
* Copyright (c) 2004 All rights reserved.
*
* Last change:
*************... | TOOL | 0.904381 | 6.708793 | {
"github_metadata": {
"branch": "master",
"commit_count": 19926,
"repo_created_at": "2013-01-19T07:31:19.000Z",
"is_fork": true,
"is_org_owned": true,
"forked_from": "LinuxCNC/linuxcnc",
"stars": 413,
"forks": 178,
"issues": 9,
"pull_requests": 4
},
"file_meta": {
"con... |
f04e6f6e-fa91-49f2-a8a9-195cb2d22c13 | obscene3190/tree | include/tree.hpp | #include <iostream>
#include <sstream>
#include <string>
template <typename T> class tree_t
{
private:
struct node_t {
node_t * left;
node_t * right;
T value;
};
private:
node_t * root_;
public:
tree_t() {
root_ = nullptr;
}
tree_t(std::initializer_list<T> k... | ALGO | 0.998037 | 4.352355 | {
"github_metadata": {
"branch": "master",
"commit_count": 85,
"repo_created_at": "2018-03-27T17:49: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": "6c639f28f... |
2b365a00-05d3-4cd8-a9e6-1ccdb7823acc | surinoel/boj | 14923.cpp | #include <iostream>
#include <queue>
#include <tuple>
#include <cstring>
#include <algorithm>
using namespace std;
int mat[1000][1000];
int dist[1000][1000][2];
int dx[4] = { 1, -1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m... | ALGO | 0.99994 | 3.81865 | {
"github_metadata": {
"branch": "master",
"commit_count": 656,
"repo_created_at": "2019-03-26T19:53: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": "63698f9a... |
75068163-a6d6-4052-b0e2-e6ba5f275a5b | sheng-yu-huang/leetcode | source/cpp/TwoSum/TwoSum.cpp | /**********************************************************************************
*
* Two Sum
* Source: https://leetcode.com/problems/two-sum/
* @author <NAME>
* @version Sep 15, 2021
*
*
* Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
* You ... | ALGO | 0.999904 | 6.12771 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2022-02-04T04:54:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "08ac449b21e... |
fc759afe-6e3f-4976-8c2f-27c79863a2ee | lechugita13/AD-JAVA | INTERFACES/CPP/puntos25Sep.cpp | #include <stdio.h>
#include <iostream>
//& davant de la variable passa la direccio de ixa mateixa
//* davant de una direccio marca el contingut de ixa mateixa
int max(int * a, int *b) {
if (*a > *b) {
return *a;
}
return *b;
}
int & max2(int & a, int & b) {
if (a > b) {
return a;
... | ALGO | 0.989165 | 3.216139 | {
"github_metadata": {
"branch": "master",
"commit_count": 129,
"repo_created_at": "2019-09-23T16:45:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 104
},
"file_meta": {
"content_id": "5b0333... |
77536a26-a629-4812-a296-ab9ec3343974 | studouglas/GEANT4-GPU | geant4.10.02/source/processes/hadronic/models/de_excitation/util/src/G4CoulombBarrier.cc | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration... | ALGO | 0.975808 | 4.968577 | {
"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": "c64646... |
46f39ad9-7229-4396-a37c-840a05ecd1a2 | h4570/tyra | engine/src/renderer/core/3d/clipper/planes_clip_algorithm.cpp | /*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# <NAME> <<EMAIL>>
*/
#include "renderer/core/3d/clipper/planes_clip_alg... | ALGO | 0.999005 | 6.876629 | {
"github_metadata": {
"branch": "master",
"commit_count": 665,
"repo_created_at": "2020-10-28T08:14:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 608,
"forks": 44,
"issues": 19,
"pull_requests": 6
},
"file_meta": {
"content_id": "fdc7... |
29b1e72a-7cc7-410b-b995-09d1e8b7dd85 | khaledatia25/cp-problems-solutions | vjudge-extracted-solutions/CodeForces/1362B/38432778_AC_124ms_104kB.cpp | //// To infinity and beyond
#include <bits/stdc++.h>
#define fast cin.tie(0),cin.sync_with_stdio(0),cout.tie(0)
#define space " "
#define ll long long
using namespace std;
void init(){fast;}
/*
"وَتَوَكَّلْ عَلَى ٱلْحَىِّ ٱلَّذِى لَا يَمُوتُ"
*/
int git_bit(int n, int i){
int mask = (1<<(i-1));
r... | ALGO | 0.999775 | 3.564891 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2023-09-10T08:46:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1195bf11814... |
e77c1292-02e1-4f90-9fe3-0fa3506c7d93 | Corentin-Julienne/Ft_container | bin/redBlackTree.hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* redBlackTree.hpp :+: :+: :+: ... | ALGO | 0.936974 | 5.444736 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2022-10-25T14:32: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": "d2d04fcfa... |
bef213af-0707-4c22-adc7-6a7970747220 | MichelleZ/leetcode | algorithms/cpp/binaryTreeColoringGame/binaryTreeColoringGame.cpp | // Source: https://leetcode.com/problems/binary-tree-coloring-game/
// Author: <NAME>
// Date: 2021-04-13
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) :... | ALGO | 0.999992 | 6.176061 | {
"github_metadata": {
"branch": "main",
"commit_count": 290,
"repo_created_at": "2021-01-05T06:12:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45a60a370a... |
01f5e869-f25b-41c8-ba86-fcad383ce3f3 | Shen-Jing/CompetitiveProgramming | LeetCode/LeetCode2201-2300/LeetCode2257_Count Unguarded Cells in the Grid.cpp | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <tuple>
#include <type_traits>
#include <uti... | ALGO | 0.999531 | 5.184842 | {
"github_metadata": {
"branch": "master",
"commit_count": 534,
"repo_created_at": "2020-08-16T11:59: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": "3c7f2ded... |
77159903-f0f0-41d4-ba95-7bdac567e8bc | SazinSamin/Samin_Reading_Room | C/C problems/array_address_doesn't_change.cpp | /*Here the problem is we want to assign
a new array from the insert function,
So as we know array decays to pointer
when we pass it to a function.
So I want to assign my newly allocated array
"new_arr" to the old "array".
The assignment of address of "new_arr"
is successfully assign to the "array",
But the change we ca... | ALGO | 0.92292 | 4.419224 | {
"github_metadata": {
"branch": "main",
"commit_count": 1781,
"repo_created_at": "2021-06-28T12:25:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "f97899cc3... |
0bcc2ef5-a117-48f7-ab6c-096208a074ad | EALongva/FYS4150 | project1/tridiag_gen.cpp | // project 1 general tridiagonal algo
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <armadillo>
#include <cmath>
#include "time.h"
// object for output files
std::ofstream ofile;
inline double f(double x){return 100.0*std::exp(-10*x);}
inline double exact(double x) {return 1.0... | ALGO | 0.999094 | 5.092028 | {
"github_metadata": {
"branch": "master",
"commit_count": 214,
"repo_created_at": "2020-08-21T10:35:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "07fee009... |
617fa279-444d-4604-a1bc-e9523f0b0695 | ilksh/Baekjoon-Online-Judge | C++/6236 - Allowance management.cpp | #include<iostream>
#include<algorithm>
using namespace std;
typedef long long int lli;
const int MAX_N = 1e5 + 1;
lli money[MAX_N];
int n, m;
bool check(lli num)
{
lli imsi = 0;
int cnt = 0;
for (int i = 0; i < n; i++)
{
imsi += guitar[i];
if (imsi > num)
{
cnt++;... | ALGO | 0.999988 | 3.503857 | {
"github_metadata": {
"branch": "main",
"commit_count": 181,
"repo_created_at": "2022-05-14T12:45:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5c57b5c9b9... |
98509947-d70d-48ed-a347-ba90136c50b3 | karishmakhanna/AtomProjects | CSCI10/Homework7/digcharstr.cpp | /*
digcharstr.cpp
csci10- section01-hw7
Created by <NAME> on 11/01/18.
PART A, first function: The function in this program will test if a character is a digit or not.
PART B, second function: The function in this program will return the number version of a character if it is a digit and -1 if it isn't.
PART C, third... | ALGO | 0.981797 | 4.607842 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2021-04-20T20:04:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "42aea7a4970... |
f56b73b9-6982-46cf-a08b-3e5e0751c9b0 | huiyuxie/libparanumal | libs/timeStepper/timeStepperMRAB3.cpp | /*
The MIT License (MIT)
Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to us... | ALGO | 0.996764 | 6.317574 | {
"github_metadata": {
"branch": "main",
"commit_count": 2998,
"repo_created_at": "2025-05-24T01:03: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": "60b06bd99... |
75ba39a7-f135-46fb-bfa9-884a14a25893 | peaisge/shortestPath | code/Dijkstra_p.cpp | #include <iostream>
#include <vector>
#include "Dijkstra_p.hpp"
#include "mpi.h"
using namespace std;
int main(int argc, char *argv[]) {
int id, p;
Graph* g = Graph::makeGraph1();
const int root = 0;
if (argc == 1)
g = Graph::makeGraph2();
else if (argc == 2)
g = Graph::ReadGraphFromFile(argv[1]);
... | ALGO | 0.999964 | 4.714543 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2017-10-28T23:23: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": "78723f2f36... |
4d92dafa-2940-40b9-b6e8-6be0906bf3be | abclzr/qaoa_tetris | main.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <cstdio>
#include "Graph.hpp"
#include "GraphMatch.hpp"
#include "BiMap.hpp"
using namespace std;
using namespace std::chrono;
using namespace subiso;
using namespace qaoagrap... | ALGO | 0.998017 | 4.505802 | {
"github_metadata": {
"branch": "main",
"commit_count": 79,
"repo_created_at": "2024-11-28T18:04: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": "0aa107ccbbf... |
1f2b61c6-365d-4d95-8d57-1e5ba8cc92a8 | WiIIiamper/Sindacco-Chess-Engine | src/board.cpp |
#include <iostream>
#include "defs.h"
#include "bitboards.h"
using namespace std;
void UpdateMaterialList ( BOARD_STRUCT *pos ) {
for (int i = 0; i < 13; i++)
pos->pieceNum[i] = 0;
for ( int j = 1; j < 7; j++ )
for (int i = 0; i < 3; i++)
pos->Bitboards[j][i] = 0;
pos->occu... | TOOL | 0.94949 | 4.185435 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2020-08-16T14:59: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": "26d10c969... |
159c4e66-3964-4518-b6e8-5880f67b7b3f | lazy-chess-player/codeforce_round | other/2024 ICPC Asia Taichung Regional Contest/D_Drunken_Maze.cpp | #include <bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define yes cout << "yes\n"
#define no cout << "no\n"
#define Yes cout << "Yes\n"
#define No cout << "No\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),... | ALGO | 0.999971 | 3.669792 | {
"github_metadata": {
"branch": "main",
"commit_count": 74,
"repo_created_at": "2023-12-31T01:58:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "edd51bb955b... |
a67c3fe3-3437-460d-bf6b-f1646517646b | MingkaiMa/Algorithm-Programming | WordLadder.cc | class Solution {
public:
int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
unordered_set<string> dict(wordList.begin(), wordList.end());
if (!dict.count(endWord)) return 0;
queue<string> q;
q.push(beginWord);
... | ALGO | 0.999953 | 5.716192 | {
"github_metadata": {
"branch": "master",
"commit_count": 486,
"repo_created_at": "2018-02-26T10:43: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": "76749dfa... |
92f0aeb5-b200-40ee-9150-050a6c7fcb19 | takaxyz/atcoder | ABC165/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define VI vector<int>
#define MOD 1000000007
typedef long long int ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } ... | ALGO | 0.9997 | 3.57214 | {
"github_metadata": {
"branch": "master",
"commit_count": 80,
"repo_created_at": "2018-10-28T03:22: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": "4cc198c58... |
9c1bbcc0-ebe6-43f6-9506-cc82a3ff238f | Janhavi2304/PPSL | String.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string str = "Sanjivani";
// Concatenation
string greeting = str + " University";
cout << "Concatenation: " << greeting << endl;
// Substring
string part = greeting.substr(10, 11);
cout << "Substring: " << part << endl;
// Find
size_t pos = gre... | TOOL | 0.978888 | 3.959605 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-08-29T02:57: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": "0e56c176b4f... |
b451300a-2868-42c2-9cc7-3b98d60a1870 | researchmm/tasn | tasn-mxnet/3rdparty/tvm/topi/include/topi/nn/l2_normalize.h | /*!
* Copyright (c) 2018 by Contributors
* \brief l2 normalization op constructions
* \file nn/l2_normalize.h
*/
#ifndef TOPI_NN_L2_NORMALIZE_H_
#define TOPI_NN_L2_NORMALIZE_H_
#include <string>
#include <algorithm>
#include "topi/tags.h"
#include "tvm/tvm.h"
namespace topi {
namespace nn {
using namespace tvm;
... | TOOL | 0.97119 | 7.357876 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2019-03-29T02:02:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 218,
"forks": 39,
"issues": 16,
"pull_requests": 6
},
"file_meta": {
"content_id": "e44705... |
886a203f-c3f4-445c-8f33-0d2640305ffc | hcasellato/Trabalho_CG_1 | projeto_eduardo_henrique.cpp | //*****************************************************
//
// Código para visualização de um pêndulo!
//
// <NAME> (13838537)
// <NAME> (13781858)
//
// g++ -o projeto_eduardo_henrique projeto_eduardo_henrique.cpp -lGL -lGLU -lglut -lm && ./projeto_eduardo_henrique
//
//********************************************... | ALGO | 0.962788 | 4.176349 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-09-14T13:38:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a8a5c182a9b... |
ff96ccfc-64ee-47ff-9b57-72f3ecec1ed1 | msyahruakbar/praktikumAP1 | praktikumAPminggu11/SortSelection.cpp | #include<iostream>
using namespace std;
void selectionSort(int arr[], int n) {
for (int i = 0; i < n-1; i++) {
int max_index = i;
for (int j = i+1; j < n; j++) {
if (arr[j] > arr[max_index]) {
max_index = j;
}
}
// Swap the found maximum elem... | ALGO | 0.999969 | 5.115324 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2023-10-04T05:53:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5ef37119b77... |
87e4f850-12ee-47c5-92ae-a7efa7ebc6b7 | Mudit7/Coding-Assignments | Assign3/KWaySort.cpp | #include</Users/mudit/stdc++.h>
#include <sys/stat.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef struct node
{
int value;
int fi;
}node;
class MinHeap{
private:
int size;
vector<node> arr;
public:
MinHeap(int k)
{
size=0;
//arr.resi... | ALGO | 0.985194 | 3.580943 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2019-09-01T18:40: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": "c5b7d3d86... |
a151b0fb-5a8b-4850-a34c-a063f7bd157a | ayushkatiyar01/DSA | Striver/Recursion/16_m_coloring_problem(Backtracking).cpp | #include <bits/stdc++.h>
using namespace std;
#define V 4 // time complexity is O(n^m) | space complexity: O(n)
// check it is safe to give color
bool isSafe(int node, int color[], bool graph[][V], int k)
{
for (int i = 0; i < V; i++)
{
if (i != node and graph[i][node] and color[i] == k)// checking f... | ALGO | 0.999915 | 4.763009 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2022-10-04T07:30: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": "b984b88d7a... |
52cbfe7c-d7e7-46e0-859d-62a9975ffed4 | VishalSingh-07/Data-Structures-and-Algorithms | Section 7 - Array ADT/Student Challenge/Finding Multiple Missing Element in Unsorted Array/Finding_Multiple_Missing_value_in_unsorted_Array.cpp | // Finding Multiple Missing Element in unsorted Array
#include <iostream>
using namespace std;
struct Array{
int A[100];
int size;
int length;
};
void Display(struct Array arr) // For Display the element of array
{
int i;
cout << "Elements of Array are: " << endl;
for (i = 0; i < arr... | ALGO | 0.99977 | 4.357301 | {
"github_metadata": {
"branch": "master",
"commit_count": 50,
"repo_created_at": "2022-08-29T10:11:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "079d1f7f... |
46146779-e4e4-43a6-907e-25b7b51dc03e | minasd1/KNN-Clustering_vectors | vector_ops.h | #ifndef VECTOR_OPS_NEW_H
#define VECTOR_OPS_NEW_H
#include <iostream>
#include <vector>
#include <time.h>
#include <random>
#include <cmath>
#include <chrono>
#include <limits>
#include <algorithm>
#include "hash_functions.h"
#include "lsh.h"
#include "cube.h"
using namespace std;
//A VECTOR OF THE POINTS READ FROM... | ALGO | 0.950421 | 4.411551 | {
"github_metadata": {
"branch": "main",
"commit_count": 94,
"repo_created_at": "2021-10-22T21:38:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "99a99801c5e... |
b131ca25-b7e1-49c2-b67a-9c2a37d9b420 | tarunsilam07/GREEKS-FOR-GREEKS | Difficulty: Easy/Sort a linked list of 0s, 1s and 2s/sort-a-linked-list-of-0s-1s-and-2s.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* Link list Node */
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
struct Node *start = NULL;
// } Driver Code Ends
/*
Node is defined as
struct Node {
int data;
... | ALGO | 0.999944 | 5.654916 | {
"github_metadata": {
"branch": "main",
"commit_count": 610,
"repo_created_at": "2024-05-31T12:08: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": "50944aab80... |
7ba44083-dce5-4d6e-88c0-e571b186b187 | A8N0RMAL/data-structures-with-cpp | BalancedParentheses/main.cpp | #include<iostream>
#include<stack>
#include<string>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
bool ArePair(char open, char close)
{
if (open == '(' && close == ')')
return true;
else if (open == '{' && close == '}')
return true;
else if (open == '[' && clo... | ALGO | 0.999519 | 5.110253 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2023-04-13T02:35: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": "933df4744... |
cb9be2a6-b64b-4273-b301-e1c99886c601 | RoxasKing/uva-cpp | 1597/main.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
const string asterisk = "**********";
void print_... | ALGO | 0.998869 | 4.516115 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2021-07-21T04:13: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": "b126f70debf... |
b13acd3e-8812-4ba0-9a31-69d3acb18906 | ompl/ompl | src/ompl/geometric/planners/informedtrees/aitstar/src/Edge.cpp | /*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2019, University of Oxford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the followin... | ALGO | 0.98949 | 6.33174 | {
"github_metadata": {
"branch": "main",
"commit_count": 4948,
"repo_created_at": "2014-05-20T14:22:59.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1776,
"forks": 636,
"issues": 80,
"pull_requests": 28
},
"file_meta": {
"content_id": "e7b... |
e6860e3d-61f0-4e9f-b522-2c71ae856687 | vplagnol/CNVtools2 | src/fitmodel.h | #ifndef _FITMODEL_H_
#define _FITMODEL_H_
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <Rinternals.h>
enum MODEL{ DISEASE=0, HETERO=1, QT=2 };
enum HYPOTHESIS{ H0, H1 };
using namespace std;
extern "C"{
class CNV_signal
{
public:
int nind, ncomp, length, ncohorts;
dou... | ALGO | 0.99533 | 4.496056 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2011-12-02T16:01:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "383c1a6f02... |
7bf5e076-b69c-496d-b935-49126a906d82 | premdev1234/LEETCODE | 3218-find-number-of-coins-to-place-in-tree-nodes/find-number-of-coins-to-place-in-tree-nodes.cpp | class Solution {
public:
vector<long long> placedCoins(vector<vector<int>>& edges, vector<int>& cost) {
int n = cost.size();
vector<vector<int>> tree(n);
for (const auto& edge : edges) {
tree[edge[0]].push_back(edge[1]);
tree[edge[1]].push_back(edge[0]);
}
... | ALGO | 0.999959 | 5.789071 | {
"github_metadata": {
"branch": "main",
"commit_count": 730,
"repo_created_at": "2024-02-24T14:33: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": "82eed2f543... |
e6044d01-9b68-477f-9a13-7f6bbba714d2 | Priyanshu150/DSA-problems | Dynamic Programming/DP on grid/Gold Mine Problem/memoization_approach.cpp | #include<bits/stdc++.h>
using namespace std;
//Time complextiy :- O(n^3)
// Space complexity :- O(n^2)
// Approach :-
// memoize the recursive solution
// row and col are changing parameters then 2-d dp will suffice
// links :- https://www.geeksforgeeks.org/problems/gold-mine-problem2608/1
class Solution {
p... | ALGO | 0.999959 | 5.508816 | {
"github_metadata": {
"branch": "main",
"commit_count": 485,
"repo_created_at": "2024-12-11T16: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": "aa1fc9705e... |
88fefb60-0ca4-42df-bacd-77f7f127b4f4 | Anthony-W-Pearce/Ch-7-End-of-Chapter-Exercises | 7.10 Exercise 1.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::abs;
using std::floor;
using std::ios;
using std::to_string;
int main() {
bool Negative = false;
int Numerator = 0,
Denominator = 0,
Whole_Number = 0;
char Negative_sign = '-';
... | TOOL | 0.905017 | 4.688351 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2022-03-11T00:21: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": "6f179b43da01... |
10d081cc-99bc-439b-bf7a-1bdd6b36d01b | Chomtana/cptraining | Hashcode/2020P/dpcopy.cpp |
// A Dynamic Programming based solution for 0-1 Knapsack problem
#include <bits/stdc++.h>
#define for1(a, b, c) for (int a = b; a < c; a++)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
template <typename T, typename U>
class DPTracker {
public:
map<T, pair<T, U>> next;
ll max(T ... | ALGO | 0.999991 | 3.608825 | {
"github_metadata": {
"branch": "master",
"commit_count": 47,
"repo_created_at": "2016-04-15T03:46:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fdfdc0679... |
e1bf83a5-90d4-4683-b9aa-4561fb22d28f | PXR-0731/Data_structures | Project2/queue.cpp | #include <iostream>
using namespace std;
/*
class Queue
{
public:
int q[5];
int front = -1, rear = -1;
bool isEmpty();
bool isFull();
void push(int a);
void pop();
};
bool Queue::isEmpty()
{
if (front == rear)
return true;
else
return false;
};
bool Queue::isFull()
{
if ((rear + 1) % 5 == front || front... | ALGO | 0.980083 | 3.266275 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-06-12T02:08: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": "1d88fd59ce... |
3d64e198-756d-4730-a45e-7901ea8d5529 | zhivkopetrov/chaos_raytracing_course_2022 | tasks/02.images_and_colors/shape/src/helpers/BatmanTaskDispatcher.cpp | // Corresponding header
#include "shape/helpers/BatmanTaskDispatcher.h"
// System headers
#include <thread>
// Other libraries headers
// Own components headers
#include "shape/geometry/BatmanGeometry.h"
namespace {
int32_t getMaxSupportedThreadsCount() {
const auto maxThreads = std::thread::hardware_concurrency(... | TOOL | 0.992392 | 6.035781 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2022-03-02T13:04: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": "1d8f0e00a... |
89456113-d97e-44fc-84cb-935d9ddb8112 | ApolloAuto/apollo | modules/routing/graph/range_utils.h | /******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* 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
... | ALGO | 0.999695 | 6.753741 | {
"github_metadata": {
"branch": "master",
"commit_count": 19341,
"repo_created_at": "2017-07-04T19:03:31.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 25847,
"forks": 9793,
"issues": 895,
"pull_requests": 104
},
"file_meta": {
"content_id... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.