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 |
|---|---|---|---|---|---|---|---|
953057b4-3636-4f89-8cf5-fec6fbdc8c74 | albertollamas-GII/ED | TEORIA/examen2021/ejercicio2.cpp | #include <map>
#include <iostream>
#include <set>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
class MatrizSesgada
{
private:
vector<list<int>> datos;
int filas;
int cols;
public:
//a. Si lo encuentra devuelve el numero y sino -1 (suponem... | ALGO | 0.985744 | 4.24938 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-06-23T18:49:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6204585c9c542... |
273a8ca8-dc4a-406f-a817-7276d7e5826a | SiddhantKumar228/Data-Structures-Algorithms | 05. 2D ARRAYS/2. PROGRAMS/Program01.cpp | // Print Matrix
#include <iostream>
using namespace std;
int main()
{
int row, col;
cout << "Enter the number of rows, columns: ";
cin >> row >> col;
int **arr = new int *[row];
for (int i = 0; i < row; i++)
{
arr[i] = new int[col];
}
cout << "Enter the elements in array: " <... | TOOL | 0.97809 | 4.694107 | {
"github_metadata": {
"branch": "main",
"commit_count": 54,
"repo_created_at": "2023-08-30T12:36: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": "3746207014b... |
5c92a672-482e-41bd-8da1-56c4741c4062 | Shikhar-S/Analysis-of-Competitive-Codebase | Data/Contest1243/all/29773838_64373632.cpp | #define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#inc... | ALGO | 0.999693 | 4.278996 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2019-11-22T14:40:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc3b72062... |
0f4add41-05a4-4206-b37c-e62de050a375 | SSandorov/The-Cpp-Programming-Language | cpp-tour/basics/user-defined-types/classes.cpp | #include <iostream>
// using namespace std;
//* Class definition
class Vector
{
public:
// A function with the same name as the class is called a constructor
// A constructor is guaranteed to be used to initialize objects of its class
Vector( int s ):
// the constructor initializes ... | ALGO | 0.993389 | 4.47562 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2023-09-10T13:03: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": "e6ec25d2c39... |
a443c72c-de49-47a7-ba62-f379c1144486 | gk9516/18CSC304J-CD | EXP5/topdownparser.cpp | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char lookahead;
void match(char expected) {
if (lookahead == expected)
lookahead = getchar();
else {
fprintf(stderr, "Syntax error: Expected '%c' but found '%c'\n", expected, lookahead);
exit(EXIT_FAILURE);
}
}
void express... | ALGO | 0.999497 | 3.747948 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-04-28T05:13:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3afb2988723... |
7f7aaa0b-76b9-4970-8e78-71d979508d2b | naveen-21tyagi/PSCP-Lab | assignment3/Q6.cpp | //862041_<NAME>
#include<iostream>
using namespace std;
int main(){
int num,bin[100],i,num_bin;//declaration of variables,here bin[100] will store array of values
cout<<"Enter a number: ";
cin>>num; //store entered number in num
num_bin=num; // store num in num_bin so tha... | ALGO | 0.982459 | 3.375372 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-12-17T07:03: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": "77b00a23f8d9... |
30c86c45-012d-498d-9736-bbce71c1c0e1 | ayoubedd/webserv | libparse/utilities.cpp | #include "Config.hpp"
#include "libparse/match.hpp"
#include <cstddef>
#include <cstring>
#include <ctime>
#include <dirent.h>
#include <fcntl.h>
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <unistd.h>
#include <utility>
void advance(std::vector<libparse::tokens> &tokens, size_... | TOOL | 0.971986 | 4.189618 | {
"github_metadata": {
"branch": "master",
"commit_count": 596,
"repo_created_at": "2023-06-10T10:34:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "7e67f806... |
7e2c0bbd-e5b5-4d22-92ed-1cb98df4bdfb | OfficerGreg/fastPrime | main.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <chrono>
#define AVG_10(func) \
[]() { \
double total_time = 0; \
for (int i = 0; i < 10; ++i) { \
auto start = std::chrono::high_resolution_clock::now(); \
uint32_t primes = func(10'000'000u); \
a... | ALGO | 0.99941 | 6.121532 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-03-28T10:51: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": "f01d5f8822bc... |
b1e67075-fc6a-48dd-a813-3788ffd1da17 | javiiariass/FAA_Prac5 | AlgoritmosSERIES.h | #pragma once
#include "Serie.h"
#include <tuple>
#include <vector>
#include "Capitulo.h"
using namespace std;
class AlgoritmosSERIES
{
// Estrategia 1: Mayor valoración (descendente)
static bool compararPorValoracionS(const Serie &a, const Serie &b);
// Estrategia 2: Menor Duracion (ascendente)
static... | ALGO | 0.997055 | 5.163752 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-05-13T06:48: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": "98cc61cd2cf3... |
79764e65-0851-4204-a73f-152cff9024e2 | shbhmexe/LeetCode-Question-Sol | Easy/Contain_duplicate_217.cpp | // class Solution {
// public:
// bool containsDuplicate(vector<int>& nums) {
// //T.C ---> O(n^2)
// // int n = nums.size();
// // for (int i = 0; i < n - 1; i++) {
// // for (int j = i + 1; j < n; j++) {
// // if (nums[i] == nums[j]) {
// // ... | ALGO | 0.999832 | 5.944922 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2025-07-01T14:45: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": "966e4a6ad72... |
cadf8566-25e6-4e86-a649-0a53f88e8c3b | pongsaphol/submission | IOI/04/artemis.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 2e4+5;
int n, m;
int X[N], Y[N];
int pos[N], t[N];
void update(int x) {
if(x <= n) t[x]++, update(x + (x & -x));
}
int query(int x) {
return t[x] + (x... | ALGO | 0.999998 | 3.772754 | {
"github_metadata": {
"branch": "master",
"commit_count": 287,
"repo_created_at": "2018-10-02T16:54:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6667fc61... |
3032b06f-6d3a-473e-ba64-da0e48d561b5 | enzo2605/Leetcode | 0700. Search in a Binary Search Tree/main.cpp | /** Creato da <NAME> in data 17/02/2021
* Ti viene data la radice di un albero di ricerca binario (BST) e un intero val.
* Trova il nodo nel BST che il valore del nodo è uguale a val e restituisci la sottostruttura
* radicata con quel nodo. Se tale nodo non esiste, restituire null.
* **/
#include <iostream>
#inc... | ALGO | 0.999998 | 5.471816 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2021-03-02T13:59: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": "a6673fbff7e... |
07f61917-f1d6-4a57-a1a9-03efce33d096 | johan2001/Practica-1 | Practica 2/Problemas/problema 9.cpp | /*Problema 9:
Escribir un programa que reciba un número n y lea una cadena de caracteres numéricos, el programa
debe separar la cadena de caracteres en números de n cifras, sumarlos e imprimir el resultado. En caso de no poderse
dividir exactamente en números de n cifras se colocan ceros a la izquierda del primer núme... | ALGO | 0.999346 | 3.919768 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-10-08T16:50:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac8bf506d5... |
25487b8a-49cc-4d9e-824c-f6381338328b | ShabeelNavaz/DSA | lec_4_Pattern.cpp | /*
#include<iostream>
using namespace std;
int main(){
int n=4;
for(int row=1; row<=n; row++){
for(int col=1; col<=n; col++){
cout<<"*";
}
cout<<endl;
}
return 0;
}
*/
// Half
/*
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for... | ALGO | 0.999872 | 4.46565 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-03-25T11:25: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": "f299fcef0d13... |
a390903d-733a-49cf-a520-b3f9bf1741e0 | reddy-lab-code-research/MuST-CoST | data/transcoder_evaluation_gfg/cpp/FIND_EQUAL_POINT_STRING_BRACKETS.cpp | // Copyright (c) 2019-present, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.
//
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include... | ALGO | 0.996415 | 5.337006 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2022-02-08T19:28:59.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 11,
"forks": 5,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "97d39e0439c... |
fca44109-ca8b-45ce-a8e5-1f11f91ba1e7 | shun-lin/Shun_Hackerrank_Solutions | C++/DiagonalDifference.cc | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stdio.h> /* printf */
#include <stdlib.h> /* abs */
using namespace std;
int main(){
int n;
cin >> n;
vector< vector<int> > a(n,vector<int>(n));
for(int a_i = 0;a_i < n;a_i++){
for(i... | ALGO | 0.99997 | 3.690405 | {
"github_metadata": {
"branch": "master",
"commit_count": 77,
"repo_created_at": "2017-03-14T09:54:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "08cdb1534... |
e03c77bb-5dbe-43d1-b177-53dd6d87a8e8 | vietan32/Algorithms | divide-and-conquer/uva_183_bitmaps.cpp | /* Uva 183 - Bit maps. [https://onlinejudge.org/external/1/183.pdf]
* Keys: + pre-calculate sum of all cells -> O(n^2) -> O(1)
* + indices of top-left/right, bottom-left/right quarters of a matrix
*
* j1 jm j2
* _________^_____
* i1 |_x|__|__|_x|__| [x] -> [*] quarters
... | ALGO | 0.999363 | 4.656322 | {
"github_metadata": {
"branch": "master",
"commit_count": 105,
"repo_created_at": "2019-07-18T11:40:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cca12a3e... |
ef4869b3-c3db-4d35-92bf-32a47d326366 | jerrycychen/leetcode | 002.add_two_numbers/add_two_numbers.cpp | #include <iostream>
using namespace std;
//Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2)
{
int sum = 0;
ListNode *head = new ListNode(0)... | ALGO | 0.999972 | 5.690543 | {
"github_metadata": {
"branch": "master",
"commit_count": 114,
"repo_created_at": "2016-12-18T05:57:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "85fe39dc... |
7728d40c-6c68-49a7-9901-b824892cb47e | red23495/UVa-solutions | etc/sieve.cpp | #define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a,int b){ return (a%b == 0)?b:gcd(b,a%b);}
bool naive_prime(ll n){
for(ll i = 2; i*i <= n; i++){
if(n%i == 0) return false;
}
return true;
}
void naive_sieve(ll n, vector<ll>& v){
vector<... | ALGO | 0.999778 | 3.869659 | {
"github_metadata": {
"branch": "master",
"commit_count": 378,
"repo_created_at": "2016-10-21T14:23:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f58e74d... |
4a67b606-ecf7-4420-95d1-429f86d60b2c | Priyanshsoniii/DSA | 450-delete-node-in-a-bst/delete-node-in-a-bst.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.999999 | 5.579646 | {
"github_metadata": {
"branch": "main",
"commit_count": 287,
"repo_created_at": "2024-06-10T10:19:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f43937648... |
d87d2fa9-8a31-4c63-9231-84e0c914d0fe | prashant-smart/Leetcode-Daily-Questions | 823-binary-trees-with-factors/823-binary-trees-with-factors.cpp | class Solution {
public:
const int MOD=1e9+7;
int dp[1001];
int helper(unordered_map<int,int>&umap,vector<int>& arr,int p){
int f = 0;
int parent = arr[p];
for(auto i : umap){
if(parent%i.first == 0 && umap.find(parent/i.first) != umap.end()){
f =... | ALGO | 0.999926 | 5.772629 | {
"github_metadata": {
"branch": "main",
"commit_count": 1124,
"repo_created_at": "2022-06-09T11:42:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94f7b263f... |
053a23de-9fc3-4b55-8cc7-e7a949a4893c | ths-rwth/carl | src/carl-arith/ran/thom/TarskiQuery/TarskiQueryManager.h | /*
* File: TarskiQueryManager.h
* Author: tobias
*
* Created on 27. August 2016, 15:58
*/
#pragma once
#include <iterator>
#include "MultiplicationTable.h"
#include "MultivariateTarskiQuery.h"
#include "UnivariateTarskiQuery.h"
#include <carl-arith/poly/umvpoly/functions/to_univariate_polynomial.h>
namespa... | TOOL | 0.910164 | 6.142235 | {
"github_metadata": {
"branch": "master",
"commit_count": 7730,
"repo_created_at": "2015-05-08T13:25:27.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 30,
"forks": 15,
"issues": 5,
"pull_requests": 2
},
"file_meta": {
"content_id": "59f10b... |
ab3a74c8-6091-448c-b233-53a1227e8bbd | walyogesh/FindPowerNode-Graph | Main.cpp | #include "PathNode.h"
#include "PowerUp.h"
#include "Weapon.h"
#include "Health.h"
#include "Armor.h"
#include "GraphDataStructure.h"
#include <stdio.h>
#include <algorithm>
#include <map>
#include <cmath>
#include <mutex>
static PathNodes sPathNodes;
static PowerUps sPowerUps;
std::mutex gMutex;
///////////////////... | ALGO | 0.998929 | 3.841372 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-03-02T19:17:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b284690770b9... |
7c26b2a7-7f1f-4840-b6d1-2eb8f1b1cdb6 | ReNginx/acm | HDU/3282/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10, inf = 0x3f3f3f3f, mod = 1e9 + 7;
multiset<int> More;
multiset<int, greater<int> > Less;
int T, k, n, b[maxn], dsz;;
inline void modify(int &x) {
Less.insert(x);
while (Less.size() - More.size() >= 2)
More.insert(*Less.... | ALGO | 0.999696 | 3.70856 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2017-04-24T14:09:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95b1be69a... |
7355f5db-24b2-41fb-b747-0b86bb938574 | mwilden/stosh | Engine/evaluate.h | /*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 <NAME> (Glaurung author)
Copyright (C) 2008-2010 <NAME>, <NAME>, <NAME>
Stockfish 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 ... | ALGO | 0.995493 | 5.88811 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2012-08-05T21:16:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 4
},
"file_meta": {
"content_id": "4b79ecf08... |
ca57d2fc-620f-4063-830f-fc8b7846ca12 | open-afc-project/openafc | src/afc-engine/RlanRegion.cpp | /******************************************************************************************/
/**** FILE: RlanRegion.cpp ****/
/******************************************************************************************/
#include "RlanRegion.h"
#include "terrai... | ALGO | 0.977223 | 3.37782 | {
"github_metadata": {
"branch": "main",
"commit_count": 154,
"repo_created_at": "2024-03-22T15:44:19.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 19,
"forks": 5,
"issues": 25,
"pull_requests": 12
},
"file_meta": {
"content_id": "8fcd302a... |
6f827ad6-58f0-4f09-bafe-4758dfd28bd0 | stonne-simulator/stonne | pytorch-frontend/third_party/ideep/mkl-dnn/src/cpu/x64/gemm/s8x8s32/jit_avx512_core_u8_copy_bt_kern_autogen.cpp | /*******************************************************************************
* Copyright 2018-2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apa... | ALGO | 0.952691 | 3.408096 | {
"github_metadata": {
"branch": "master",
"commit_count": 90,
"repo_created_at": "2020-12-01T17:24:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 134,
"forks": 30,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c16f87... |
8d510d24-a09c-4f41-86f5-3913d8b0d945 | mz2/peer | External/alglib/src/specialfunctions.cpp | /*************************************************************************
Copyright (c) <NAME> (ALGLIB project).
>>> SOURCE LICENSE >>>
This program 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 (www.fsf.org); ... | ALGO | 0.995548 | 5.529133 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2010-10-07T21:49:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 43,
"issues": 21,
"pull_requests": 1
},
"file_meta": {
"content_id": "73bc994... |
c212ecff-dbc7-4a2e-bce8-c2f9beb589a3 | nqdat2002/Data-Structures-and-Algorithms | Sap Xep & Tim Kiem/DSA06032 - BỘ BA SỐ CÓ TỔNG NHỎ HƠN K.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> p;
typedef vector<vector<int> > vt;
typedef vector<pair<int, int> > vp;
const ll mod = 1e9 + 7;
const int oo = 1e6 + 7;
#define f first
#define s second
#define pb push_ba... | ALGO | 0.999961 | 4.755574 | {
"github_metadata": {
"branch": "main",
"commit_count": 459,
"repo_created_at": "2022-02-20T06:21:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8b6a21e079... |
1c07ce0b-a1f5-4de1-be11-a6623929a8a8 | ishandutta2007/codeforces-p | pinkrabbit/normal/1310/C.cpp | #include <cstdio>
#include <algorithm>
typedef long long LL;
const LL Infll = 0x3f3f3f3f3f3f3f3f;
const int MN = 1005;
inline void Add(LL &x, LL y) { x = (x += y) >= Infll ? Infll : x; }
LL K;
int N, M, C, lcp[MN][MN];
char str[MN];
struct dat { int s, l; } seq[500505];
LL f[MN], g[MN];
LL Solve(dat now) {
int st ... | ALGO | 0.999991 | 3.756175 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:49: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": "7d1118637cb1... |
f42153d3-b68b-4263-b7aa-5dbd0d5613f3 | grpc/grpc | src/core/lib/event_engine/posix_engine/timer_heap.cc | //
//
// Copyright 2015 gRPC 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 agree... | ALGO | 0.965526 | 6.267972 | {
"github_metadata": {
"branch": "master",
"commit_count": 57126,
"repo_created_at": "2014-12-08T18:58:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 43321,
"forks": 10849,
"issues": 667,
"pull_requests": 417
},
"file_meta": {
"content_i... |
71978124-af05-4f13-bc70-a082291fc046 | ivan-ivano/LAB_8.1_rek | LAB_8.1_rek.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
bool hasPair(char* str, int i)
{
if (strlen(str) < 2)
return false;
else
if (str[i] != 0)
if (str[i - 1] == 'S' && str[i] == 'Q' || str[i - 1] == 'Q' && str[i] == 'S')
return true;
else
return hasPair(str, i + 1);
}
char* Chan... | ALGO | 0.999189 | 3.447664 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-11-14T21:13: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": "8de6b11533... |
bf29731d-0cb3-47d7-a86c-c02b3ed23f09 | Anubhaw19/CP | DP/DP on Tree/DP_Tree(general).cpp | #include <bits/stdc++.h>
using namespace std;
int static t[11][51]; // 0<e<1=0 , 0<=f<=50
/*
Dynamic Programming on TREE: (General)
EX: diameter of a Binary Tree
Steps:
1>Base Case
2>Hypothesis
3>Induction (temporary-answer, answer, result )
**/
class Node
{
public:
int data;
Node *left;
Node *right;
... | ALGO | 0.999564 | 4.332617 | {
"github_metadata": {
"branch": "master",
"commit_count": 103,
"repo_created_at": "2021-01-11T15:04:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e35dd447... |
96c613cb-c7ed-4d09-8982-de20e6866ab5 | coolsnowy/CLRS | 21/DisjointSet/test/src/main.cpp | // chapter 21, 不相交集合
#include <memory>
#include <iostream>
using std::cout;
using std::endl;
using std::shared_ptr;
using std::weak_ptr;
using std::make_shared;
class DisjointSetNode {
public:
DisjointSetNode() = default;
DisjointSetNode(int v) : value (v) {
}
public:
int value;/*!< 结点保存的数据的弱指针*/
int rank;/*!<... | ALGO | 0.996412 | 5.037674 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-07-30T07:55:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "811106bc6a... |
ee1ed88a-b1c2-44fc-84d2-a11b9d07c2f2 | Hazrat-Ali9/Data-Structure-Algorithms | create-binary-tree-from-descriptions/create-binary-tree-from-descriptions.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.999868 | 7.120883 | {
"github_metadata": {
"branch": "main",
"commit_count": 828,
"repo_created_at": "2024-11-13T04:56:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b26c692948... |
064863d2-f3ab-411d-892e-feee74cf0fe2 | sparkfiresprairie/cpc | divide_and_conquer/expression_add_operators.cpp | //
// Created by <NAME> on 3/9/17.
//
/*
Given a string that contains only digits 0-9 and a target value, return all possibilities
to add binary operators (not unary) +, -, or * between the digits so they evaluate to the
target value.
Examples:
"123", 6 -> ["1+2+3", "1*2*3"]
"232", 8 -> ["2*3+... | ALGO | 0.999766 | 6.735892 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2017-02-26T23:02:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8414df340... |
d5969e1d-097a-499d-a9c6-f9fa5599b6a9 | khbence/pansim | matlab/Toolboxes/CasADi-Matlab/include/casadi/core/runtime/casadi_max_viol.hpp | //
// MIT No Attribution
//
// Copyright (C) 2010-2023 <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 with... | ALGO | 0.99719 | 6.309667 | {
"github_metadata": {
"branch": "main",
"commit_count": 153,
"repo_created_at": "2021-04-10T14:54:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7873a8be39... |
0dc70612-a428-4804-b4b2-82cc3c0eb3f8 | hixo356/vrptw-solver | vrptw/src/evaluate.cpp | #include "../include/evaluate.h"
#include "../include/instance.h"
#include "../include/genetic_algorithm.h"
#include <iostream>
float evaluateSolution(individual_t const& solution, std::vector<std::vector<float>> const& distanceMatrix, const int& truckCapacity, int& counter){
counter++;
float penalty = 0;
... | ALGO | 0.999937 | 4.766686 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2025-05-15T20:27: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": "865c77c418dd... |
ffab2a3d-bdad-4988-8617-5ab159efb419 | neetusuthar90/DSA | Stacks and queues/Stack_array.h | #include <iostream>
using namespace std;
#include <climits>
template <typename T>
class Stack_array
{
private:
T *data;
int nextIndex;
int capacity;
public:
Stack_array()
{
capacity = 4;
data = new T[capacity];
nextIndex = 0;
}
// Size of the stack
int size()
... | ALGO | 0.993164 | 4.549224 | {
"github_metadata": {
"branch": "main",
"commit_count": 43,
"repo_created_at": "2022-06-03T14:03: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": "5f1e76286b5... |
99a03541-60a4-43dc-9861-4ea386f59a2e | JorgeArevaloEchevarria/Estructura-de-Datos | examenesArboles/D/main.cpp |
// NOMBRE Y APELLIDOS (USUARIO DEL JUEZ)
//jorge <NAME>
// COMENTARIO SOBRE LA SOLUCIÓN Y SU COSTE JUSTIFICADO
// realizo una busqueda hacia abajo hasta llegar a las hojas, y despues voy comprobando hacia arriba si el arbol es inclinado
// y comprobando las condiciones de inclinado con la altura, y en el caso de que ... | ALGO | 0.999968 | 4.753628 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-03-08T10:34: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": "5f6ac24fe21f... |
eb4100ae-92b9-4d60-a0cf-edd6397c30c2 | zainryan/INSIDER-System | STAccel/inc/hls_csim/hls/hls_cordic.h | /*****************************************************************************
*
* Author: Xilinx, Inc.
*
* This text contains proprietary, confidential information of
* Xilinx, Inc. , is distributed by under license from Xilinx,
* Inc., and may be used, copied and/or disclosed only pursuant to
*... | ALGO | 0.998444 | 6.993125 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2019-06-02T21:26:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 38,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "795f126... |
8a1d9cba-f95b-4bc0-aa96-7ace7aa739e3 | vicnaum/ParanoidWallet | libraries/bitelliptic/bitelliptic.cpp | //This code is derived form https://github.com/ThePiachu/Golang-Koblitz-elliptic-curve-DSA-library/tree/master/bitelliptic
// Copyright 2010 The Go Authors. All rights reserved.
// Copyright 2011 ThePiachu. All rights reserved.
// Copyright 2013 <NAME>. All rights reserved.
// Use of this source code is governed by a B... | ALGO | 0.936176 | 5.854471 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-09-11T07:39:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1fae778f8... |
615e2d46-dbd1-498a-89a3-e1c25ec18bac | sailor-ux/mycodes | leetcode_vscode/leetcode_402/leetcode_402_1.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
string removeKdigits(string num, int k) {
string res;
int i = 0;
for (; i < num.length() && k > 0; i++) {
while (1) {
if (res.empty() || (num[i] - '0') >= (res.back() - '0') || !... | ALGO | 0.999937 | 5.993146 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2019-10-11T08:27:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a71e0b3da85... |
3a98cb6f-5396-4189-8c34-9659858e23d7 | yyx112358/For-Interview | 笔试用/剑指offer刷题/树的子结构.cpp | #include "..\笔试用\GlobalInc.h"
#include "..\笔试用\ListArray.hpp"
#include "..\笔试用\BinTree.h"
#include "..\笔试用\Plot.h"
#include <memory>
/*树的子结构(572. 另一个树的子树 https://leetcode-cn.com/problems/subtree-of-another-tree/)
输入两棵二叉树A,B,判断B是不是A的子结构。(ps:我们约定空树不是任意一个树的子结构)
思路:二者类似,以LEETCODE为准。由两个递归函数组成。
首先s、t任意为空均不是子树。随后先序遍历s,找到s... | ALGO | 0.999106 | 5.260803 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2019-06-04T03:39: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": "2e4f04a39... |
1c7ab91a-b352-4e22-b1e5-d622d009829a | ijpq/15418 | assignments/assignment3/part2/include/graph_dist_ref.h | #ifndef __DISTGRAPHREF_DEFINED
#define __DISTGRAPHREF_DEFINED
#include <mpi.h>
#include <stdio.h>
#include <random>
#include <set>
#include <cassert>
#include <cmath>
#include <iostream>
// 75% of the edges for any vertex will be internal edges
#define CLUSTERING_RATIO 0.75f
using Vertex = int;
enum GraphType { uni... | ALGO | 0.972749 | 6.107174 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2021-02-05T11:07:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8fc1bb8da... |
fce7e554-9839-4246-9535-debf2c2eaf8f | ducanhkl/algorithm | SPOJ/SAFENET2/main.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 30010;
int root[maxn], active[maxn], visited[maxn], cnt[maxn];
vector <int> e[maxn];
int n, m;
stack <int> st;
int get_root(int u)
{
if (root[u] == 0)
return u;
return (root[u] = get_root(root[u]));
}
void dfs(int u)
{
visited[u] = ... | ALGO | 0.999911 | 4.018175 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2019-05-27T16:26: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": "83168cc91... |
a77ab0ca-edb9-40f8-88e5-06bb0a8a1abf | collinalexbell/all-the-compilers | zig/src/stage1/util.hpp | /*
* Copyright (c) 2015 <NAME>
*
* This file is part of zig, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
#ifndef ZIG_UTIL_HPP
#define ZIG_UTIL_HPP
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#if defined(_MSC_VER)
#include <intrin.h>
#endif
#define ZIG... | TOOL | 0.927646 | 6.756384 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-07-05T05:14:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "782b46885867... |
994e5d84-ee86-4da9-b6a7-aa886fb8eabf | zkmake520/Fault-tolerant_Key-Value_Storage_System | MP2Node.cpp | /**********************************
* FILE NAME: MP2Node.cpp
*
* DESCRIPTION: MP2Node class definition
**********************************/
#include "MP2Node.h"
/**
* constructor
*/
#define QUORUM 2
#define TIME_OUT 20
MP2Node::MP2Node(Member *memberNode, Params *par, EmulNet * emulNet, Log * log, Address * addre... | ALGO | 0.949996 | 3.502005 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2016-01-27T00:52:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "948694864... |
71cb4fa3-fbc2-48f8-a177-38b535fe8f6f | LubovKos/love | matrix_operations.h | #ifndef MATRIX_OPERATIONS
#define MATRIX_OPERATIONS
#include <iostream>
#include <iomanip>
#include "matrix_operations.h"
using namespace std;
//создание нулевой квадратной матрицы
double** create_zero_matrix(int n);
// проверка корректности ввода
template <class T>
T read_and_check(T a);
//ввод исходной квадратной... | ALGO | 0.998948 | 4.42235 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2021-11-27T08:55:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e735f2bb3... |
fbcfbe9b-0557-4dff-a5f0-c27c8322f263 | JartC0ding/AoC2022 | Day3/Problem2/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int solve() {
int sol = 0;
ifstream my_file("input.txt");
if(my_file.is_open()) {
string rucksack;
vector<bool> dp(52, false);
int cnt = 0;
while(getline(my_file, rucksack)) {
// ... | ALGO | 0.999707 | 3.783838 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2022-12-10T11:40: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": "38c08516e1db... |
2ec48b9f-1a20-438a-b0c1-a555fdc919c9 | iamdeepti/100DaysOfCode | 643(div-2)/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
// int f[200001];
#define pii pair<int,int>
#define f first
#define s second
#define mp make_pair
// /}
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vi a(n);
// memset(f,0,sizeof(f));
v... | ALGO | 0.999895 | 3.557452 | {
"github_metadata": {
"branch": "master",
"commit_count": 87,
"repo_created_at": "2020-04-30T14:30: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": "a80f0bab9... |
6bd6a858-7d56-42c5-9a2e-1a5b8dd284e2 | Mitesh766/Data-Structure-and-Algorithms | HomeWork/OneWay.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string str1, str2;
cin >> str1;
cin >> str2;
int l1 = str1.length();
int l2 = str2.length();
int letters1[26] = {0};
int letters2[26] = {0};
for (int i = 0; i < l1; i++)
{
letters1[str1[i] - 'a']++;
}
for (in... | ALGO | 0.999993 | 4.687978 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-05-04T13:07: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": "8db28bdede4... |
b4ab535b-592c-4156-b8a7-e10ff03c4958 | TerixSK/Algorithms-2020-2021 | Лаба 2/race/race.cpp | #include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
// Строки через структуру
struct person
{
string country, man;
int where{};
};
// Функция быстрой сортировки для строк
void quicksort(person* a, int left, int right)
{
int i, j, k;
string m;
k = a[(left + right) / 2].where;
i = left;
j ... | ALGO | 0.999987 | 3.899044 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-04-25T16:34: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": "87bcf243fe... |
e5357914-32e9-4664-a25f-f6013d031327 | WenjieSun1996/PAT_Advanced | 1001~1030/1010.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
string a, b;
int tag, radix;
ll sum = 0, MinRadix = 2, MaxRadix, ans;
cin>>a>>b>>tag>>radix;
if(tag == 2) swap(a,b);
for(int i = 0; i < a.length(); i++) sum = sum*radix+( isdigit(a[i]) ? (a[i]-'0'):(a[i]-'a'+10) );
... | ALGO | 0.999716 | 3.664403 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2018-09-06T12:04: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": "5f83ef854... |
00e33753-f0b1-496b-87cc-3752aeac5aad | ishandutta2007/codeforces-h | heart_blue/normal/622/D.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999815 | 3.236506 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T02:01: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": "5f1423a09cb8... |
008ac1da-7a32-4576-b221-9ada109537c5 | zcy05331/code-backup | Libre OJ/#109.cpp | #include <bits/stdc++.h>
#define R register
#define ll long long
#define cmax(a, b) ((a < b) ? b : a)
#define cmin(a, b) ((a < b) ? a : b)
#define sum(a, b, mod) ((a + b) % mod)
const int MaxN = 4000010;
const int mod = 998244353;
int n, m;
ll ans;
int f[MaxN];
inline int read()
{
int x = 0;
char ch = getch... | ALGO | 0.999952 | 4.776152 | {
"github_metadata": {
"branch": "master",
"commit_count": 59,
"repo_created_at": "2020-02-19T14:44:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a820c6b1e... |
ede91ae2-1c73-4f4d-b920-f9df0e271364 | albertoueda/algorithms | problem-solving/016-r2-sumfour.cpp | /*
* <NAME> - DCC/UFMG
* 2017-09-15
http://www.spoj.com/problems/SUMFOUR/
The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) belongs to A x B x C x D are such that a + b + c + d = 0
*/
#include <iostream>
#include <vector>
#incl... | ALGO | 0.999952 | 4.413177 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2012-12-27T18:57:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d9017c854... |
8d30b977-8f13-4263-b2b7-7662e676e6ce | DrSwad/CP | Submissions/CodeChef/SnackDown/2021/Round 1B/Largest_Laddu.cpp | #include <bits/stdc++.h>
using namespace std;
namespace IO {
#define output_op(...) ostream &operator<<(ostream &os, const __VA_ARGS__&u)
#define input_op(...) istream &operator>>(istream & is, __VA_ARGS__ & u)
// Pairs
template<class U, class V> output_op(pair<U, V>) {
return os << u.first << " " << u.se... | ALGO | 0.999614 | 4.541759 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2019-10-12T13:53:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 5,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "1643721a... |
a032703a-fd7e-4a23-bdff-febc7c71d5f8 | jaredhuling/oem | src/lanczos.cpp |
#include "lanczos.h"
void GKLBidiag(const Ref<const MatrixXd>& AA, double& eigenv, Ref<VectorXd> vv,
Ref<VectorXd> alpha, Ref<VectorXd> beta, const int nrow, bool ls) {
VectorXd u(nrow);
VectorXd Uprev(vv.size());
VectorXd Vnew(vv.size());
const int kmax(alpha.size());
MatrixXd B(MatrixX... | ALGO | 0.999378 | 5.535122 | {
"github_metadata": {
"branch": "master",
"commit_count": 334,
"repo_created_at": "2016-03-28T14:09:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 27,
"forks": 5,
"issues": 11,
"pull_requests": 1
},
"file_meta": {
"content_id": "52d60c... |
1c8ba52f-45ed-41d5-8191-983e1e4f14a0 | Vandan121/VS-code | Coding/GeeksforGeeks/Smallest Absolute Difference.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
int kthDiff(int a[], int n, int k);
// Driver code
int main() {
int t, i;
int k;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
... | ALGO | 0.999852 | 6.094423 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-05-19T10:28: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": "ebe7b099ab47... |
71dd886c-a5ab-483a-afba-91ee50ebbc1c | zmoratto/PatchMatch | PatchMatch2Heise.cc | #include <PatchMatch2Heise.h>
#include <TVMin3.h>
using namespace vw;
void stereo::PMHeiseBase::evaluate_8_connect_smooth( ImageView<float> const& a,
ImageView<float> const& b,
BBox2i const& a_roi, BBox2i const& ... | ALGO | 0.999788 | 6.144226 | {
"github_metadata": {
"branch": "master",
"commit_count": 110,
"repo_created_at": "2013-10-13T22:12:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 59,
"forks": 31,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "f523a2... |
130b426e-fcc6-403d-8297-460ac185a45e | guzhoudiaoke/practice | poj/poj/ID1000-2000/1036/1036.cpp | /*
* problem: poj 1036
* author: guzhoudiaoke
* time: 2011-10-09
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct gangster {
int t;
int p;
int s;
} ganster;
ganster g[101];
/* dp[i] 表示第i 个人能够成功进入时的最大p 和值 */
int n, k, t, dp[101];
int cmp_ganster(const void *a, const void *b)
{
return ((ganster *)a)-... | ALGO | 0.999961 | 3.919136 | {
"github_metadata": {
"branch": "master",
"commit_count": 77,
"repo_created_at": "2016-07-20T11:10:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1a541289... |
b64711a7-db97-4cb5-858f-9716af7f09e1 | duck10/LatticeRepLib | LatticeMatchingTest/MAIN_LatticeMatchingTest.cpp | // LatticeMatchingTest.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <utility>
#include "CellInputData.h"
#include "LRL_CreateFileName.h"
#include "CS6Dist.h"
#include "DeloneTypeList.h"
#include "LatticeC... | TEST | 0.969344 | 5.147952 | {
"github_metadata": {
"branch": "master",
"commit_count": 801,
"repo_created_at": "2017-12-31T17:10:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a22cd8a5... |
70d57b75-7555-4803-98c3-58a67aea7201 | siddharthkadu/LeetCode | 2059-unique-length-3-palindromic-subsequences/2059-unique-length-3-palindromic-subsequences.cpp |
class Solution {
public:
int countPalindromicSubsequence(string s) {
int n = s.size();
vector<int> leftSeen(26, 0); // Tracks if a character has appeared to the left
vector<int> rightCount(26, 0); // Tracks count of characters to the right
// Initialize rightCount with frequenci... | ALGO | 0.999951 | 7.194234 | {
"github_metadata": {
"branch": "main",
"commit_count": 475,
"repo_created_at": "2024-10-08T14:34: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": "a3c638d3f1... |
563b4614-7d1f-4559-b591-17286a6b858e | priyanka-12varshney/labwork | queueWK6.1.cpp | #include <stdio.h>
#define MAX 5
int queue[MAX];
int front = -1;
int rear = -1;
// Function to check if the queue is full
int isFull() {
return (rear == MAX - 1);
}
// Function to check if the queue is empty
int isEmpty() {
return (front == -1 || front > rear);
}
// Function to add an element to the queue
v... | ALGO | 0.996252 | 5.957431 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-09-04T06:07: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": "893ce760b840... |
f3cfe6e7-a004-4827-977d-279ff790f8cc | quanghuy0497/Competitive-Programing | Where is the Marble_10474_UVA.cpp | //https://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1415
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//======================================================
int bsFirst(vector <int> &a, int left, int right, int x)
{
if (left <= right)
{
int mid ... | ALGO | 0.999882 | 4.042158 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-10-03T09:41:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed76440512... |
456bf658-a09d-4053-954c-45e1f2799737 | qluana7/Baekjoon-Cpp | Platinum/Platinum 5/6549.cpp | #include <iostream>
#include <vector>
#define ll long long
using namespace std;
vector<ll> v;
ll exp(int st, int ed) {
int m = (st + ed) / 2, a = m, b = m;
ll w = 1, h = v[m];
ll res = w * h;
while (ed - st > b - a) {
ll
h1 = a > st ? min(h, v[a - 1]) : -1,
h2 = ... | ALGO | 0.99988 | 4.736117 | {
"github_metadata": {
"branch": "master",
"commit_count": 350,
"repo_created_at": "2022-01-09T18:43:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce494308... |
198b3288-179a-4364-9f60-db418383f64b | rbgusdlza/algorithm_study | library/graph/topology_sort.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastIo cin.tie(0)->sync_with_stdio(0)
#define pii pair<int, int>
typedef long long ll;
const int INF = 1e9 + 7;
const ll LNF = 1e18 + 7;
const int MAX = 50000;
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};
int n, m, deg[MAX];
vector<int> adj[MAX];
vector<int>... | ALGO | 0.999997 | 3.51459 | {
"github_metadata": {
"branch": "main",
"commit_count": 94,
"repo_created_at": "2024-02-06T18:52: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": "e07c4c0f514... |
7aa8a0de-a258-496a-b1ae-dc65948d199b | frankyang603/Linear-Algebra-HW | HW2/qr-decomposition.cpp | #include <iostream>
#include <fstream>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
ifstream infile;
infile.open("input.txt");
ofstream outfile;
outfile.open("output.txt");
double a[100][100];
int x,y,p;
infile>>p;
for(int i=0;i<p;i++){
outfile<<p<<"\n";
infile>>x>... | ALGO | 0.999671 | 3.368844 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-09-28T15:13: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": "6302b32d121b... |
fff1602f-ecf9-4190-b595-6b0fe941493c | Qglddd111/SEU_shuzhifenxi_shangjiti | 第五章上机题/Taylor/sin_taylor.cpp | #include <iostream>
#include <cmath>
#include <fstream>
const double PI = 3.14159265358979323846;
// 计算阶乘
double factorial(int n) {
if (n == 0 || n == 1)
return 1;
else
return n * factorial(n - 1);
}
// 计算泰勒展开的值
double taylorExpansion(double x, int n) {
double result = 0;
int n_tem;
... | ALGO | 0.996196 | 4.488542 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2023-10-26T14:22:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "31bbd31a55ed... |
15d033d7-a57d-472c-a61f-10d10edd7c8e | Divyanshu-012/Arrays | Pattern Printing/3Darray.cpp | #include <iostream>
using namespace std;
#include <vector>
int main() {
// Declare a 3D array
const int x = 2;
const int y = 3;
const int z = 4;
int threeDArray[x][y][z];
// Initialize the 3D array
for (int i = 0; i < x; ++i) {
for (int j = 0; j < y; ++j) {
for (int k ... | ALGO | 0.989754 | 5.591669 | {
"github_metadata": {
"branch": "master",
"commit_count": 69,
"repo_created_at": "2024-05-14T12:31: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": "9290f56af... |
e680cc38-1859-4500-96bc-9a784fd2ac3a | fadhil195/ALGO_PEMROGRAMAN_STRUKTUR_DATA | Pertemuan 8/tugas 8.cpp | #include <iostream>
using namespace std;
int main() {
int baris, kolom, b2, k2;
cout << "Masukkan Panjang Baris = ";
cin >> baris;
b2 = baris;
cout << "Masukkan Panjang Kolom = ";
cin >> kolom;
k2 = kolom;
int matriks1[baris][kolom];
int matriks2[baris][kolom];
cout << endl;
//Input Data Matriks 1
c... | ALGO | 0.99469 | 4.102981 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-12-12T05:08: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": "419af458e37f... |
60b097bc-9988-410b-b486-a270dcae41fc | Arnizack/opticalFlow | src/OptFlowCpp/cpu_backend/image/ROFPreProcessing/ROFPreProcessing.cpp | #pragma once
#include "ROFPreProcessing.h"
#include "ROFHelper.h"
#include "../../Base.h"
#include <omp.h>
#include <vector>
#include <cmath>
#include <iostream>
namespace cpu_backend
{
using PtrImage = std::shared_ptr<core::IArray<float, 3>>;
ROFPreProcessing::ROFPreProcessing(std::shared_ptr<ROFPreProcessingSe... | ALGO | 0.998707 | 5.335143 | {
"github_metadata": {
"branch": "master",
"commit_count": 268,
"repo_created_at": "2020-04-08T12:02:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a4b94518... |
59a75388-3f95-4f3a-a4fb-194a2a4e9ac5 | wmaterna/Algorithms-and-Data-Structures | GrafNieskierowanyTablica.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <ctype.h>
#define SIZE_OF_GRAPH 10
using namespace std;
class GrafNieskierowanyTablica{
public:
int actualsize=0;
int edges=0;
int elements[SIZE_OF_GRAPH]={0};
bool
neighbors[SIZE_OF_GRA... | ALGO | 0.995865 | 3.804852 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2020-12-09T22:47:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2af3345983bf... |
3f180698-7e37-4cb2-8309-701fa8b32a34 | RobotEniac/leetcode | cpp/dungeon_game.cpp | // Copyright (c) 2019, eniac
// All rights reserved.
//
// Author: eniac <<EMAIL>>
// Created: 2019/02/28
// Description: https://leetcode.com/problems/dungeon-game/
#include <iostream>
#include <vector>
#include <sstream>
#include <list>
#include "util.h"
using namespace std;
#define INTMAX 0x3f3f3f3f
template<cl... | ALGO | 0.999745 | 4.893858 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2018-11-22T14:10:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8cdc626c... |
fb5c7997-5781-4b77-ac59-ed2d0ae33326 | Jayant-001/DSA-using-CPP | DSA/stack/reverseStackRec.cpp | #include <bits/stdc++.h>
using namespace std;
void insertAtBottom(stack<int> &s, int key) {
if(s.empty()) {
s.push(key);
return;
}
int temp = s.top();
s.pop();
insertAtBottom(s, key);
s.push(temp);
}
void reverse(stack<int> &s) {
if(s.empty())
return;
int t... | ALGO | 0.999964 | 5.076648 | {
"github_metadata": {
"branch": "master",
"commit_count": 84,
"repo_created_at": "2021-05-10T18:37: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": "0f8585d94... |
459d331d-e749-4cb1-887d-215659270ce5 | hieupham1103/TINHOC | SCHOOL/ANHTAN/DP DNC/S.cpp | #include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
// #define int long long
#define double long double
#define endl '\n'
#define all(x) x.begin(), x.end()
using namespace std;
const int maxN = 1e3 * 5 + 10;
int n, m;
int a[maxN];
int cost[maxN][maxN];
int upp[maxN][maxN];
int dp_cur... | ALGO | 0.999974 | 3.35344 | {
"github_metadata": {
"branch": "main",
"commit_count": 406,
"repo_created_at": "2021-08-20T03:38:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "69b4059a27... |
07d41858-e148-48c2-92cb-2a9fd3721050 | syniox/Online_Judge_solutions | BZOJ/3991.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<set>
using namespace std;
typedef long long lint;
const int N=1e5+5;
int n,m,cnt,fir[N],dfn[N],nfd[N],dep[N],fa[N][18];
lint ans,dis[N][18];
bool vis[N];
set<int> st;
struct edge{
int to,wi,nx;
}eg[N<<1];
inline void add(int a,int b,int v){
eg[++c... | ALGO | 0.999903 | 3.734069 | {
"github_metadata": {
"branch": "master",
"commit_count": 1071,
"repo_created_at": "2018-06-07T03:31:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 59,
"pull_requests": 0
},
"file_meta": {
"content_id": "aa8a85... |
9a6c4071-7e88-4638-b700-48d444f6c3e0 | Shuailong/PAT | pat-basic/A1016.cpp | /***************************************************\
|Author: harmony |
|email: <EMAIL> |
|csdn homepage: http://blog.csdn.net/shuaiilong |
|pat: http://pat.zju.edu.cn |
|copyright : harmony 2014. |
\********... | ALGO | 0.999847 | 3.549282 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2014-01-04T05:08:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "03e1f7a0a... |
1fe463b2-5224-4360-9184-542388001aa8 | gauravai2025/DSA_Cpp25 | Precomputation and hashing and range update/find parent in each query in binary or bst.cpp | #include <bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node* left;
node* right;
node(int d) {
this -> data = d;
this -> left = NULL;
this -> right = NULL;
}
};
node* buildTree(node* root) {
cout << "Enter the data: " << endl;
... | ALGO | 0.999878 | 4.404428 | {
"github_metadata": {
"branch": "main",
"commit_count": 171,
"repo_created_at": "2022-12-16T18:09:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "756dc2a75c... |
d577a8c5-f47f-41c3-81ea-bcf7c6976012 | ishandutta2007/codeforces-e | ehnryx/normal/339/D.cpp | #include <bits/stdc++.h>
using namespace std;
struct SegTree {
int length, layers;
vector<int> nodes;
SegTree(int n) {
length = 1<<n;
layers = n+1;
nodes.resize(2*length+1);
}
int& operator [] (int i) {
return nodes[length+i];
}
void build() {
int curr = length/2;
int op = 1;
for (int i = length-... | ALGO | 0.999969 | 5.153872 | {
"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": "e5c25c69f0f3... |
8a7d2d5b-975f-4543-8d5d-47050602bf6e | AlexFanw/HUSTER-CS | 系统综合能力—虚拟机/ics2019/nexus-am/apps/microbench/src/15pz/heap.h | // Author: <NAME>
// Copyright (c) 2009 by <NAME>. All rights reserved.
template <typename T>
T max(T a, T b) {
return a > b ? a : b;
}
template <typename T>
class Updatable_heap {
private:
int M;
class Step;
Step **hash_table;
Step **heap;
int heap_size;
int maximum_heap_size;
void... | ALGO | 0.99934 | 5.540188 | {
"github_metadata": {
"branch": "master",
"commit_count": 148,
"repo_created_at": "2019-12-21T15:39:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1237,
"forks": 202,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "373... |
cddd77ce-54e1-4c84-958e-97a8ce25348d | codeforcause123/c- | tree_orders.cpp | #include <bits/stdc++.h>
using namespace std;
class orderPrint
{
int n;
vector<int> key;
vector<int> left;
vector<int> right;
vector<int> result;
public:
void read()
{
cin >> n;
key.resize(n);
left.resize(n);
right.resize(n);
for (int i = 0; i < n; i... | ALGO | 0.999988 | 4.485226 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-06-29T02:29: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": "2fe1958401... |
d02d3da1-83cd-4c65-9c9e-264c68f19baf | GalinaMaykova/CodGame | Shadows of the Knight - Episode 1.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
int W; // width of the building.
int H; // height of the b... | ALGO | 0.9999 | 3.653062 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2019-09-22T11:20: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": "e639cfb449... |
7b8ebb29-5b6e-454e-bbc9-d9f46efc52fd | sachinkumarS-K/leetCode | 199-binary-tree-right-side-view/binary-tree-right-side-view.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.999744 | 5.930105 | {
"github_metadata": {
"branch": "main",
"commit_count": 698,
"repo_created_at": "2025-01-31T05:23:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "37b7aba2d8... |
82e19970-7b2c-45b3-b681-d8a293c9c9bd | gitchaofang/leetcode | 240_dc.cpp | class Solution {
public:
bool dc(const std::vector<std::vector<int>>& matrix, const std::pair<int,int>& row, const std::pair<int,int>& col, const int& targ){
if(row.first > row.second || col.first > col.second) return false;
int mid = col.first + (col.second - col.first) / 2;
for(int i = row... | ALGO | 0.999985 | 6.172649 | {
"github_metadata": {
"branch": "master",
"commit_count": 1095,
"repo_created_at": "2020-01-06T05:51:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e409fb4... |
aef82a23-854c-4e53-b079-29df6b064493 | lrussell676/SUPAASP | src/calc_routines_kokkos.h | /* ------------------------------------------------------------------------------------------------
-------------------------- Author: <NAME> : SUPAASP Class Student -----------------------
--------------------------------------------------------------------------------------------- */
#include "calc_routines.h"... | ALGO | 0.903057 | 4.65403 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2024-02-14T14:28: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": "756115d41f1... |
e7584c82-bf0f-4555-8194-a313eca2556e | ttyang/sandbox | sandbox/interval_math_toolkit/boost/math/special_functions/detail/ibeta_inv_ab.hpp | // (C) Copyright <NAME> 2006.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This is not a complete header file, it is included by beta.hpp
// after it has defined it's... | ALGO | 0.999658 | 6.000984 | {
"github_metadata": {
"branch": "trunk",
"commit_count": 20907,
"repo_created_at": "2013-10-11T03:08:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6632876... |
e477ac49-6e3c-4e9f-886b-24b51c64c1dd | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/05/0523/personal_submission/cf501d_Lu_xZ.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int N = 2e5 + 5;
int n, o[N], o1[N], p[N];
struct Segment_Tree {
int t[N << 2];
void init(int x = 1, int l = 1, int r = n) {
t[x] = r - l + 1;
if(l == r) return;
int mid = l + r >> 1;
init(x << 1, l, mid), init(x << 1 | 1, mid + ... | ALGO | 0.999983 | 4.103682 | {
"github_metadata": {
"branch": "main",
"commit_count": 20410,
"repo_created_at": "2024-02-26T01:04:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 478,
"forks": 302,
"issues": 0,
"pull_requests": 7
},
"file_meta": {
"content_id": "3f03... |
c9c7ec30-12de-40a6-9e9f-ebe157f142c8 | allgorithmik/CPP | Clang/Programs/FunctionMultiDimensionalArrayFunctionParameter.cpp | #include<iostream>
double sum2D(double array[][5], size_t count); //function prototype
double sum3D(double array[][5][5], size_t count); //function prototype
int main(int argc, char **argv){
double values1[][5] {
{(15.55, 55.55, 100.55, 75.20, 45.99)},
{(15.55, 55... | ALGO | 0.994468 | 5.439204 | {
"github_metadata": {
"branch": "master",
"commit_count": 230,
"repo_created_at": "2022-01-25T07:22: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": "7367b326... |
b7e729aa-39f7-4144-95dc-d933ffaadf8d | ItsLucas/acm | 21012.cpp | #include <bits/stdc++.h>
using namespace std;
int n,c,k;
vector<int> arr,arr2,arr3;
int remove() {
unordered_map<int, int> mp;
for (int i = 1; i <= n; i++) {
mp[arr[i]]++;
}
int j = 1;
for (int i = 1; i <= n; i++) {
if (mp[arr[i]] >= k) {
arr2[j] = arr[i];
j++;
}
}
return... | ALGO | 0.999985 | 3.199191 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2019-07-25T10:23: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": "079fec1d7... |
3781c733-8dd7-40df-bd80-c443de6190d2 | arleyribeiro/solving-problems-and-studies | hackerrank/interview_preparation_kit/jumping_on_the_clouds.cpp | #include <bits/stdc++.h>
#define CLOUD_MAX 100
using namespace std;
int jumpingOnClouds(vector<int> clouds) {
int number_clouds = clouds.size(),
jumps = 0,
jump_min = CLOUD_MAX;
for(int i = 0; i < number_clouds - 1; i++) {
if (!clouds[i] && i) {
jumps++;
} else... | ALGO | 0.99998 | 3.979677 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2020-02-17T19:24:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "648d64ae0... |
f054a07e-48fc-417c-937a-7a1cece4ab90 | ytrsk/ICPC_training_respository | ACM模板/DP/动态dp.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define sqr(x) (x)*(x)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=100007;
const int inf=0x3f3f3f3f;
int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch... | ALGO | 0.999963 | 4.322354 | {
"github_metadata": {
"branch": "master",
"commit_count": 201,
"repo_created_at": "2019-09-25T14:01:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4554ec37... |
09b634d6-a08a-4fe9-8adb-4eccf770ae9e | syzygy608/CP_Practice | 2024/0707/cf/gym/533225/k/k.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <utility>
#include <cassert>
#define F firs... | ALGO | 0.999997 | 3.665233 | {
"github_metadata": {
"branch": "main",
"commit_count": 43,
"repo_created_at": "2023-06-16T12:49: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": "3abc01d3f43... |
1a0da45a-2812-45a2-b36c-d9c5c8c8c4df | michal0janczyk/voice_recognizer | Matrix.h | #ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
#include <vector>
#include "IllegalArgumentException.h"
/** C++ port of:
* Jama = Java Matrix class.
* <P>
* The Java Matrix Class provides the fundamental operations of numerical
* linear algebra. Various constructors create Matrices from two d... | ALGO | 0.994838 | 6.266523 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-02-08T21:16: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": "994f7991e0... |
cb75fa17-5f3c-4d0f-86e4-8be4e3187d19 | twoload/myAlgo | BruteForce/BF_16938_camp.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <tuple>
#include <cstring>
using namespace std;
long long n, l, r, x;
bool check[16];
long long a[16];
long long ans = 0;
void print(vector<long long... | ALGO | 0.999948 | 5.10745 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2022-08-15T00:08: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": "d53c3286e... |
a2ac0547-353f-42f8-b3a1-6e4a7cde6590 | Ciphrox/Hacktoberfest2021 | C++ & C/Sort the Matrix Diagonally.cpp | /*
Sort the Matrix Diagonally
A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix's end. For example, the matrix diagonal starting from mat[2][0], where mat is a 6 x 3 matrix, includes cell... | ALGO | 0.999998 | 6.498864 | {
"github_metadata": {
"branch": "main",
"commit_count": 708,
"repo_created_at": "2021-10-03T19:18:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 42,
"forks": 213,
"issues": 2,
"pull_requests": 16
},
"file_meta": {
"content_id": "f258c1... |
06939475-4f2a-4b22-ae8b-f959756febc3 | raincross7/code-similarity | codes/train_code/problem066/problem066_448.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bits... | ALGO | 0.999691 | 3.49227 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a8d04b71c89... |
fbf4c700-0321-4398-be70-74856e42ea21 | shanmuga-pandi/LeetCode-Shanmuga | Solutions/Medium/729_My_Calendar_I.cpp | /*
Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.
Your class will have the method, book(int start, int end). Formally, this represents a booking on the half open interval [start, end), the range of real numbers x such that start <= x < ... | ALGO | 0.999638 | 6.116045 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2020-03-31T13:36: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": "0a4ee9118... |
f9750157-d58d-4764-bf0b-317d9d07f7f6 | vinodpatidar0808/Data-structures-and-Algorithms | hashing/10-pair-with-given-sum.cpp | // find a pair with given sum in unsorted array
#include <iostream>
#include <unordered_set>
#include <unordered_map>
using namespace std;
// O(n^2)
bool isPair(int arr[], int n, int sum)
{
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
if(arr[i] + arr[j] == sum)
return tr... | ALGO | 0.999635 | 5.711557 | {
"github_metadata": {
"branch": "main",
"commit_count": 40,
"repo_created_at": "2022-08-07T08:39:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfdba29fe71... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.