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 |
|---|---|---|---|---|---|---|---|
919f3006-3e36-48ea-b6d9-833a1e1ee2e9 | alexandraback/datacollection | solutions_2463486_1/C++/AnnKats93/A.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int sum[10000007];
int snum[20];
bool isGood(long long num)
{
int idx = 0;
while(num > 0)
{
snum[idx++] = (num % 10);
num /= 10;
}
for(int i = 0; i < idx; ... | ALGO | 0.999587 | 4.287858 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2983d049... |
caab37dd-53d4-49b8-9984-fd5c3c07967e | daveidhg/adventofcode | 2022/15/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <chrono>
#include <regex>
#include <unordered_set>
using namespace std;
struct Sensor {
int x, y, beaconX, beaconY;
Sensor(int x, int y, int beaconX, int beaconY) : x(x), y(y), beaconX(beaconX), beaconY(beaconY) {}
};
class S... | ALGO | 0.991098 | 5.915699 | {
"github_metadata": {
"branch": "main",
"commit_count": 88,
"repo_created_at": "2023-12-01T19:58: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": "5898de97c55... |
273956d5-1b30-47e9-b087-b0a600c8c1b3 | TechSir3n/LeetCode | Algorithms/С++/Easy/ReverseVowelsOfString.cpp | /*
Given a string s, reverse only all the vowels in the string and return it.
The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.
Example 1:
Input: s = "hello"
Output: "holle"
Example 2:
Input: s = "leetcode"
Output: "leotced... | ALGO | 0.999372 | 6.366662 | {
"github_metadata": {
"branch": "main",
"commit_count": 99,
"repo_created_at": "2022-12-30T10:09:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e2e3346f6c2... |
dd20c4b2-5d86-48c8-88b2-5288af3ff5f9 | MaryPinkBorsch/leetcode | 203_rekursiadelte.cpp | // /**
// * Definition for singly-linked list.
// * struct ListNode {
// * int val;
// * ListNode *next;
// * ListNode() : val(0), next(nullptr) {}
// * ListNode(int x) : val(x), next(nullptr) {}
// * ListNode(int x, ListNode *next) : val(x), next(next) {}
// * };
// */
// class Solution {
... | ALGO | 0.999937 | 3.519686 | {
"github_metadata": {
"branch": "main",
"commit_count": 128,
"repo_created_at": "2023-11-26T16:50:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf65039937... |
04cc8b46-b821-46ec-930d-6bd80521725d | cgmoreda/CompetitiveProgramming | CodeChef/LEXILARGEST/46729363_AC_10ms_0kB.cpp | #include<bits/stdc++.h> //cgmoreda || Mohamed_Reda
using namespace std;
#define vin(v) for(auto &i:(v))cin>>i
#define allr(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
#define vvi vector<vector<int>>
#define ii pair<int,int>
#define vi vector<int>
#define ll long long
#define int long long
ll gcd(ll a, ll b... | ALGO | 0.999966 | 3.583018 | {
"github_metadata": {
"branch": "main",
"commit_count": 442,
"repo_created_at": "2024-01-20T21:05:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c3b9179236... |
bdbc9cca-5f08-42f8-9255-259cbb6a4df3 | Tora416/MultiCodeEmbed | dataset/dataset_raw/gcj_cpp/L3Sota/3264486_5736519012712448_L3Sota.cpp | // UNNECESSARY
// #include
// <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
// #include
// <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets
// #include <fstream>//ifstream/ofstream
// DATA STRUCTURES
#include <array>
#include <bitset>
#include <list>
#i... | ALGO | 0.998664 | 4.335489 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2025-07-10T08:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1c5835b84... |
b378d5e8-8550-4a7a-9824-cbcba57a3ac0 | bgin/Radar-ElectroOptical-Simulation | gpu/cuda-integration/quad.h | #ifndef CUDACUHRE_QUAD_QUAD_h
#define CUDACUHRE_QUAD_QUAD_h
#define TIMING_DEBUG 1
#define BLOCK_SIZE 64
#define SM_REGION_POOL_SIZE 128
#define GLOBAL_ERROR 1
#define MAX_GLOBALPOOL_SIZE 2048
#include <fstream>
#include <string>
#include <vector>
#include "integration_result.hh"
using TYPE = double;
static int FI... | ALGO | 0.938759 | 4.773789 | {
"github_metadata": {
"branch": "master",
"commit_count": 5635,
"repo_created_at": "2019-09-27T18:45:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 62,
"forks": 21,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b768b... |
e1fea60d-845d-407d-8048-9b7ea7d63e4f | deepiano/Poketmon | SolveC.h | /*
Problem C : We have to catch at least one 'Every kind' of Poketmon as fast as possible.
*/
#pragma once
#include "GraphType.h"
#include "ShortestPath.h"
#include <iostream>
#include <vector>
using namespace std;
#define MAX_NODE 100
#define MAX_CANDIDATES 12
#define NUM_ID 12
#define START_VERTEX 0
#define START... | ALGO | 0.999284 | 4.130768 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2017-03-27T23:54:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "01b537ea7... |
b9270f21-ade4-4c14-aa80-b0020e24d824 | QiShi219/traindir3 | LinkedList.h | /* LinkedList.h - Created by <NAME>
This file is part of Train Director 3
Train Director 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; using exclusively version 2.
It is expressly forbidden the use of higher v... | TOOL | 0.941891 | 6.422171 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-10-19T06:18:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a44b7ba7c666... |
10534fdc-1de6-4cb1-98cc-0c4588b635a8 | Rainbow-prince/Fundamentals-of-Compiling | Write_My_Compiler/experiment2/experiment2.cpp | //
// Created by A123 on 12/5/2024.
//
#include <iostream>
#include <fstream>
#include <filesystem>
#include <functional> // 函数传参
#include <string>
#include <cctype> // 字符处理
#include <stack>
// #include <unordered_map>
#include <map>
#include <variant>
#include <string.h>
#include "tabulate/table.hpp"
#include "exper... | ALGO | 0.994131 | 3.73781 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-11-20T11:55:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "972c3446a1d... |
47b807cb-623f-4771-bf69-eb8a15c609da | alfredphysarani/CIHE_Projects | CIS129_AdvancedComputerProgramming/CIS129_Lab5_Q2/CIS129_Lab5_Q2/CIS129_Lab5_Q2.cpp | // CIS129_Lab5_Q2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
// Global Variable Declaration
const int NO_OF_IDOLS = 6;
const int NO_OF_REGIONS = 4;
// Function Declaration
void getIdolsName(i... | ALGO | 0.995741 | 4.180289 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2022-10-04T07:23: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": "bf6f6423d0c... |
cf982b7a-e3af-4516-9a7d-1d98ee51ce8c | HYEONSIKOH/C_PP-BaekJoon | Source/B20040.cpp | // 백준 20040 [분리집합] 사이클 게임!
#include <iostream>
#include <vector>
using namespace std;
int n, m;
vector<int> parent;
// 루트 노드 찾기
int find(int x) {
if (x == parent[x]) return x; // 같으면 루트노드
return parent[x] = find(parent[x]); // 재귀로 부모노드 접근
}
// 합치기
void Union(int x, int y) {
// 각 부모노드를 비교
x = find(x);
y = find(... | ALGO | 0.99998 | 4.054856 | {
"github_metadata": {
"branch": "master",
"commit_count": 186,
"repo_created_at": "2022-07-07T12:31: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": "eb6dc5b6... |
57422526-8ffe-40a8-a8df-a036de2da19b | tdm1223/Algorithm | acmicpc.net/source/1956.cpp | // 1956. 운동
// 2019.05.19
// 플로이드 와샬 알고리즘
#include<iostream>
#include<algorithm>
using namespace std;
int d[401][401];
int main()
{
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++)
{
int from, to, cost;
cin >> from >> to >> cost;
d[from][to] = cost;
}
// i를 거쳐가는게 더 빠를 경우 update
for (int i = 1; i <= ... | ALGO | 0.99993 | 4.046689 | {
"github_metadata": {
"branch": "master",
"commit_count": 864,
"repo_created_at": "2018-08-02T14:16:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "18dbef38... |
d62adb1f-db58-4cc1-a244-a8432fee9866 | ThePowerfulProgrammer/leetCodeProblems | createQueue/main.cpp | #include <iostream>
using namespace std;
/*
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty).
Implement the MyQueue class:
void push(int x) Pushes element x to the back of the queue.
int pop() Rem... | ALGO | 0.999104 | 5.873643 | {
"github_metadata": {
"branch": "main",
"commit_count": 84,
"repo_created_at": "2024-01-15T10:47: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": "b6d346146d0... |
651ac7a7-00e3-4c8c-a99d-7faec88ca092 | RussTedrake/drake | multibody/benchmarks/chaotic_babyboot/MG/MG_chaotic_babyboot_auto_generated.cc | // GENERATED FILE DO NOT EDIT
// -----------------------------------------------------------------------------
// File: MGChaoticBabyboot.cc created Aug 30 2017 by MotionGenesis 5.9.
// Portions copyright (c) 2009-2017 Motion Genesis LLC. are licensed under
// the 3-clause BSD license. https://opensource.org/licenses/... | ALGO | 0.999896 | 3.923954 | {
"github_metadata": {
"branch": "master",
"commit_count": 27854,
"repo_created_at": "2014-02-23T19:55:24.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "RobotLocomotion/drake",
"stars": 48,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"c... |
e6ee326e-2925-4804-903c-5ce476d1ae5e | x4132/competitive_programming | Leetcode/LC107BinaryTreeLevelOrderTraversalII.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<vector<int>> levelOrderBottom(TreeNode *root)
{
deque<vector<int>> traversal;
if (root == NULL) {
return {traversal.begin(), traversal.end()};
}
vector<TreeNode *> current;
int n... | ALGO | 0.999982 | 5.714597 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2022-10-11T00:29: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": "c56d672d241... |
d749cf48-e279-4ced-8ccb-473d6682068d | harshitha-reddy/MissionRnD-C-MrndCTest1 | src/BetweenDays.cpp | /*
Q4: Two dates are given in a 8 node single linked list form,where each node
has one digit only, dates 01-31, months 01-12, year 0000-9999.
Find the number of days in between those two dates .[Exclusive]
Ex : Date1: 0->1->0->1->2->0->0->4 .
Date2 : 0->5->0->1->2->0->0->4 should return 3 .
As there are 3 days ... | ALGO | 0.996765 | 4.366715 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2016-04-02T13:26: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": "884107f2c3... |
36c1fea1-92e4-4c83-9725-9de2d5434d7d | jamesysh/lp_gpu | state_jet.cpp | #include "state_jet.h"
#include <iostream>
#include <cmath>
static const double PI = atan(1.0)*4.0;
////////////////////////////////////////////////////////////////////////////////////////
// Start of Jet3DState
////////////////////////////////////////////////////////////////////////////////////////
Jet3DState::Jet... | ALGO | 0.9955 | 3.97512 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2018-10-02T20:34: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": "3fae505513... |
f74b145a-a7d6-46c0-8a8c-a29e043a5d57 | alanjzamora/c-basics | romanInteger.cpp | // <NAME>, 03/18/2025, Roman Integer Problem
/*Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral... | ALGO | 0.999916 | 6.199307 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2025-03-17T15:42: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": "6a0fefd948... |
36878c7e-d04f-48db-9807-705a772c7c93 | ishandutta2007/codeforces-p | pikel_rik/normal/508/C.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9 + 7;
const int inf = 2e9 + 5;
int main() {
ios::sync_with_stdio(false);
cin.... | ALGO | 0.999923 | 4.011501 | {
"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": "f2a8fbd739c5... |
e9535efe-5e53-438a-9477-073fef2a700e | mgs25/cpp-mastery | 7Strings/main.cpp | #include <iostream>
#include <cstring>
#include <cctype>
#include <string>
#include <iomanip>
#include <typeinfo>
using namespace std;
int main () {
/*********************************
* Characters and string
*********************************/
/********************************
* Character func... | TOOL | 0.981008 | 3.519476 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-11-20T09:35: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": "78b9891e0fca... |
dd303868-d90d-473c-a317-61c75914803a | vishwajeetk5/GeeksForGeeks | Difficulty: Easy/Parenthesis Checker/parenthesis-checker.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool ispar(string x) {
// code here
if(x.length()<1)return false;
stack<char> stk;
for(int i=0;i<x.length();i++){
if(x[i]=='(' || x[i] =='[' |... | ALGO | 0.989891 | 5.886097 | {
"github_metadata": {
"branch": "main",
"commit_count": 163,
"repo_created_at": "2024-08-25T18:50: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": "b7bc13d9cf... |
8bc9a291-016a-40c9-b97a-5fb1797437e6 | PP144gh/physics_code | Lab_plot&fit_program/prog_fit/MR/sessao1/PosBMR(H)/EqSolver.h |
class EqSolver{
public:
EqSolver();//construtor
void SwapRows(int,int,double**,int);
void GaussElimination(double**,double*,int);
double* GaussEliminationSolver();
double* FindRowMax(double**,int,int);
void LUdecomposition3(float*,float*,float*,int);
static void LUdecomposition3(double*,double*,doubl... | ALGO | 0.99918 | 3.548227 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2022-09-18T10:51: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": "6701d8f1b... |
dbb48657-2518-4335-b202-3298e3cfed55 | idoze2-university/search-server | src/algorithm/searcher/BFS.cpp | ////
//// Created by allen on 22.1.2020.
////
//
#include "BFS.h"
namespace searcher {
Solution BFS::search(Problem problem) {
queue<SearcherState>open;
list<MatrixNode>marked;
stack<SearcherState> searcherState_stack;
Solution solution{};
MatrixNode start = problem.getStar... | ALGO | 0.999991 | 4.736211 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2020-01-20T11:44:08.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bd01688dbb... |
6cf42039-894a-4f6a-a875-42e74e6b42a1 | lenis2000/homepage | _simulations/domino_tilings/2025-04-21-aztec-glauber-two-by-two.cpp | /*
emcc 2025-04-21-aztec-glauber-two-by-two.cpp -o 2025-04-21-aztec-glauber-two-by-two.js \
-s WASM=1 \
-s ASYNCIFY=1 \
-s "EXPORTED_FUNCTIONS=['_simulateAztec', '_performGlauberStep', '_performGlauberSteps', '_simulateAztecGlauber', '_freeString', '_getProgress']" \
-s EXPORTED_RUNTIME_METHODS='["ccall","cwrap","U... | ALGO | 0.999688 | 7.376502 | {
"github_metadata": {
"branch": "master",
"commit_count": 2465,
"repo_created_at": "2017-05-17T09:46:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 10,
"pull_requests": 0
},
"file_meta": {
"content_id": "9a7f31... |
3f66b959-4781-4792-bc26-17668ebdb805 | Yul963/baekjoon | baekjoon/1181_word_sort.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
/*
알파벳 소문자로 이루어진 N개의 단어가 들어오면 아래와 같은 조건에 따라 정렬하는 프로그램을 작성하시오.
길이가 짧은 것부터
길이가 같으면 사전 순으로
단, 중복된 단어는 하나만 남기고 제거해야 한다.
입력
첫째 줄에 단어의 개수 N이 주어진다. (1 ≤ N ≤ 20,000) 둘째 줄부터 N개의 줄에 걸쳐 알파벳 소문자로 이루어진 단어가 한 줄에 하나씩 주어진다.
주어지는 문자열의 길이는 50을 넘지 않는다.
출력
조건... | ALGO | 0.999942 | 5.451028 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2024-01-28T07:06: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": "364c6c20d... |
b8db2ff9-5197-4bf3-984d-940f137e8f21 | PointCloudLibrary/pcl | features/include/pcl/features/moment_of_inertia_estimation.h | /*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of sou... | ALGO | 0.990336 | 6.983515 | {
"github_metadata": {
"branch": "master",
"commit_count": 14566,
"repo_created_at": "2013-02-12T16:40:25.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10495,
"forks": 4656,
"issues": 432,
"pull_requests": 147
},
"file_meta": {
"content_id... |
5d180b2e-ecca-4fcd-90bf-d5f7c30d4cf4 | jonaslan/numerikumCpp | sheet08/padea.cpp | #include <iostream>
#include "helfer.h"
#include<cmath>
#include <fstream>
#include "pade.h"
using namespace std;
class Taylor {
private:
VecDoub coeffs;
public:
Taylor(const VecDoub& t) : coeffs(t) {}
double operator () (const double& x)
{
// iterate from the back of the coefficients and multiply by x ... | ALGO | 0.917708 | 4.853796 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2016-09-02T10:36: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": "d15e41e84f... |
79d765bd-e50d-49aa-89f7-322155bc68ac | Pritam723/DSA_CPP | Lecture 20 - 21/Rorate Array Leetcode 189.cpp | // https://leetcode.com/problems/rotate-array/
#include<iostream>
#include<vector>
using namespace std;
void rotateArray(vector<int> &arr , int k){
// Write your code here.
vector<int> ans;
int n = arr.size();
int i = (n - (k % n))%n;
do{
ans.push_back(arr[i]);
i = (i+1)%n;
}wh... | ALGO | 0.999777 | 5.661342 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2022-09-27T17:04: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": "3357cba6bd... |
51af3bdd-63d9-4514-9e29-657ea9cb8d49 | Yeonji-Lim/ps-log | Programmers/PGS_150369_택배배달과수거하기.cpp | #include <string>
#include <vector>
using namespace std;
long long solution(int cap, int n, vector<int> deliveries, vector<int> pickups) {
long long answer = 0;
int maxi, maxdi, maxpi, tmp, i;
i = deliveries.size()-1;
while(deliveries[i] == 0) i--;
maxdi = i+1;
i = pickups.size()-1;
... | ALGO | 0.999149 | 4.34046 | {
"github_metadata": {
"branch": "master",
"commit_count": 1037,
"repo_created_at": "2020-09-17T04:37: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": "c4f6e81... |
bfd817c5-f071-47db-97b8-c72aaf5580da | wavefunction91/HAXX | src/hblas/cxx/hblas3/gemm.cxx | /*
* This file is a part of HAXX
*
* Copyright (c) 2017 <NAME>
* All rights reserved.
*
* See LICENSE.txt
*/
#include "haxx.hpp"
#include "hblas/hblas1.hpp"
#include "hblas/hblas3.hpp"
#include "util/simd.hpp"
#include "util/macro.hpp"
#include "hblas/config/types.hpp"
#include "hblas/config/hblas3/g... | ALGO | 0.964226 | 6.138091 | {
"github_metadata": {
"branch": "perf",
"commit_count": 156,
"repo_created_at": "2017-04-19T18:15:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "de8ade26e... |
6fd4d577-4468-43a7-b8a9-55290148287c | Farama-Foundation/ViZDoom | src/vizdoom/src/weightedlist.h | /*
** weightedlist.h
** A weighted list template class
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 <NAME>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the followin... | TOOL | 0.927234 | 4.610305 | {
"github_metadata": {
"branch": "master",
"commit_count": 1911,
"repo_created_at": "2015-06-26T18:38:23.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1862,
"forks": 418,
"issues": 31,
"pull_requests": 2
},
"file_meta": {
"content_id": "1a... |
1aad5916-d9c7-4b5d-bcc8-a46d62f96905 | OFShare/Algorithm-challenger | 洛谷/提高-/P1022.cc | /*
* Author : OFShare
* E-mail : <EMAIL>
* Created Time : 2020-04-25 21:55:55 PM
* File Name : P1022.cc
*/
#include <bits/stdc++.h>
#define ll long long
void debug() {
#ifdef Acui
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
}
const int N = 1e5 + 5;
cha... | ALGO | 0.999587 | 3.318747 | {
"github_metadata": {
"branch": "master",
"commit_count": 148,
"repo_created_at": "2019-07-14T05:37:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 61,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abd536... |
4d1c6fb1-5acb-41b7-a6d6-ba9e2d1bdf32 | aryannnn17/LeetCode_Problems | 33.cpp | // Binary search in rotated sorted array
#include <bits/stdc++.h>
using namespace std;
int binarySearch(vector<int> &num, int target)
{
int st = 0, end = num.size() - 1;
int midPoint;
while (st <= end)
{
midPoint = st + (end - st) / 2;
if (target == num.at(midPoint))
{
... | ALGO | 0.999982 | 5.302739 | {
"github_metadata": {
"branch": "main",
"commit_count": 46,
"repo_created_at": "2024-10-17T17:00: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": "056f6575ec9... |
a074d5d6-884a-4894-abd6-d16c5194bbc1 | Bis-kunal09/DSnAlgo | 6. Coin Change - Number of ways - GFG/6.-coin-change-number-of-ways.cpp | // { Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
//Function to find out the number of ways to use the coins to
//sum up to a certain required value.
long long number... | ALGO | 0.999964 | 5.55265 | {
"github_metadata": {
"branch": "main",
"commit_count": 152,
"repo_created_at": "2022-02-23T14:31: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": "e780f81155... |
46858dd4-a29c-4438-b102-6b7a0bfe74a5 | elenazab/Homework | C#/Vyvodilka/hw3t2/xodilka.h | #pragma once
#include "vyvodilka.h"
template <typename T>
class Xodilka
{
public:
Xodilka(Vyvodilka<T> *v);
~Xodilka();
void obojty(T massiv[][size]);
private:
Vyvodilka<T> *vyvod;
};
template <typename T>
Xodilka<T>::Xodilka(Vyvodilka<T> *v)
:vyvod(v)
{
}
template <typename T>
Xodilka<T>::~Xodil... | TOOL | 0.908827 | 4.209391 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2012-02-28T15:55:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d6c58ce69... |
271b07a4-d2a1-41b3-a268-82c596029412 | Komal-J04/DSA | POTD/Leetcode/ReverseSubstringsBetweenEachPairOfParentheses1190.cpp | // https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/description/?envType=daily-question&envId=2024-07-11
// APPROACH 1 - RECURSION
class Solution
{
public:
int i = 0;
string rev(string s)
{
string result;
while (i < s.length())
{
if (s[i]... | ALGO | 0.999837 | 5.890087 | {
"github_metadata": {
"branch": "master",
"commit_count": 399,
"repo_created_at": "2023-03-22T13:46: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": "ae138e48... |
81758714-71e9-4179-bc0a-d41e536a9b05 | kaushik27mishra/Daily_Practice_CP-DSA | MIT6.006/peakfinding_multiarray.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 100;
int findMax(int arr[][MAX], int rows, int mid, int& max)
{
int max_index = 0;
for (int i = 0; i < rows; i++) {
if (max < arr[i][mid]) {
max = arr[i][mid];
max_index = i;
}
}
return max_index;
}
int findPeakRec(int arr[][MA... | ALGO | 0.999934 | 4.632469 | {
"github_metadata": {
"branch": "master",
"commit_count": 291,
"repo_created_at": "2020-04-02T07:28:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 111,
"forks": 43,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce8b5... |
e768b78f-71fa-4ed4-a5d5-28a7cde16457 | ershehzan/Cpp_Codes | PatternQ22.cpp | #include <iostream>
using namespace std;
int main()
{
// i represents the row, j represents the column
int n, i, j;
// Prompt the user to enter a number
cout << "Enter the number : ";
cin >> n; // Take user input and store it in 'n'
// Outer loop to control the number of rows
for (i ... | ALGO | 0.999862 | 5.855115 | {
"github_metadata": {
"branch": "main",
"commit_count": 640,
"repo_created_at": "2024-10-05T10:47:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2db12d40ee... |
2cbe657a-b371-4cd8-9232-305d7b1fff8e | Bhanu-Verma/segment-tree | k-th one.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
// When discussing segment trees, we assume that the size of the array is
// a power of two, and zero-based indexing is used, because it is convenient to build a
// segment tree for such an array. If the size of the array is not a power of two, we can... | ALGO | 0.999983 | 4.681846 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-07-05T05:19: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": "bf6441f122d7... |
4d65393d-afee-4992-8177-10e90e3a9eb6 | Ahmdfdhiilah121140173/praktikumAsd | algoritma struktur data/mg4/121140173.cpp | //1. Di dalam rekaman kelas ASD RD pert 4, pak eko menjelaskan tentang parameter pointer hapus di timestamp : 1:41:58. yang terdapat pada sub program DeleteFirst, pointer hapus, digunakan untuk mengambil nilai pada node yang akan dihapus.
//2. Di dalam rekaman kelas ASD RD pertemuan 4, pak eko menjelaskan tentang varia... | ALGO | 0.99873 | 3.104361 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-11-06T06:00:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5326b23941d7... |
7bf8c15d-d16e-4b86-8d78-4d058fa230ce | 149mansi/DSA-CPP | Recursion/32.Recursion.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isSafe(int value, int board[][9], int cur_row, int cur_col)
{
// row check
for (int col = 0; col < 9; col++)
{
if (board[cur_row][col] == value)
return false;
}
// column check
for (int row= 0; row <9; row++)
... | ALGO | 0.999691 | 5.400595 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-12-31T20:00: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": "d003a39976... |
a1520704-d960-4ae2-a62a-a3640c30038e | gunnarsundberg/aes-128 | src/aes_128_common.cpp | #include "../include/aes_128_common.h"
using namespace std;
// Create Byte Array From String
byte *string_to_byte_array(string str) {
size_t m = str.length();
byte *return_array = new byte[m];
for (size_t i = 0; i < m; i++) {
return_array[i] = (byte) str.at(i);
}
return return_array;
}
//... | ALGO | 0.999252 | 3.905972 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2022-02-18T21:41: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": "bbfafeda00... |
74db8384-420a-4e6a-a17c-bd13097eda47 | AhmettCelik1/kinematics | forword.cpp | #include <iostream>
#include <cmath>
#define L1 1.0 // length of first link (base to arm)
#define L2 0.5 // length of second link (arm to gripper)
#define L3 0.3 // length of third link (gripper fingers)
using namespace std;
int main()
{
double theta1, theta2, theta3;
double x, y, z;
// set joint angles... | TOOL | 0.935766 | 4.401403 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-02-19T02:07:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4de8e8371fbc... |
63314889-9d92-4329-80c1-789773a26a79 | stevenhalim/cpbook-code | ch8/UVa11065.cpp | // Gentlemen Agreement
#include <bits/stdc++.h>
using namespace std;
const int MAX_V = 62;
#define LSOne(S) ((S) & -(S)) // important speedup
typedef long long ll;
ll AM[MAX_V];
int V, numIS, MIS;
void backtrack(int u, ll mask, int depth) {
if (mask == 0) { // al... | ALGO | 0.99971 | 4.34152 | {
"github_metadata": {
"branch": "master",
"commit_count": 392,
"repo_created_at": "2018-11-27T05:30:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2175,
"forks": 515,
"issues": 22,
"pull_requests": 14
},
"file_meta": {
"content_id": "c... |
ec6c6f3d-c413-4728-abbd-2b270507a25f | szefany/acm-icpc | training/my-training/old/winter-2013/6-strings/G.cpp | // Codeforces Round #106 (Div. 2)
// Problem E, Martian Strings
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::max;
const int N = 100000;
char string[N], buffer[N];
int next[N], left[N], right[N];
int n, length;
void jump (int key, char* string, int& p) {
while (p != -1 && string[p + 1] !=... | ALGO | 0.999899 | 3.968892 | {
"github_metadata": {
"branch": "master",
"commit_count": 489,
"repo_created_at": "2013-01-17T12:49: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": "515a7536... |
e4f9a424-b17c-4b26-8c71-e452d1239e3b | finn-rudolph/cp | math/convolution.hpp | #include <bits/stdc++.h>
using namespace std;
/*
Convolution in O(n log n) via FFT.
*/
template <typename T>
constexpr T ceiled_lg(T n) // to keep things portable
{
T x = 1;
while ((T)1 << x < n)
++x;
return x;
}
template <size_t N, typename T>
void bit_reverse(T *const y)
{
constexpr size_t ... | ALGO | 0.99991 | 5.036913 | {
"github_metadata": {
"branch": "main",
"commit_count": 63,
"repo_created_at": "2023-02-10T11:01:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7dd1404d435... |
b365a059-60ca-4f0a-a97c-930cb34420dd | taawraat/UVa-solutions | 10168 - Summation of Four Primes.cpp | #include <bits/stdc++.h>
#define nline cout << '\n';
#define lastof(s) s.size() - 1
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define EPS 1e-12
#define pdd pair<d... | ALGO | 0.998711 | 3.514995 | {
"github_metadata": {
"branch": "master",
"commit_count": 116,
"repo_created_at": "2020-10-04T13:29:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96c59d81... |
06055e3d-3ee3-494e-acd5-70bd930bd425 | checkoutb/LeetCodeCCpp | daily_challenge/2022/LT_2022-06-11_1658._Minimum_Operations_to_Reduce_X_to_Zero.cpp |
#include "../../header/myheader.h"
class LT
{
public:
// D D
// for (int right = 0; right < n; right++) {
// sum += nums[right];
//
// while(sum > target && left <= right) {
// sum -= nums[left++];
// }
//
// if (sum == target) {
// re... | ALGO | 0.999998 | 4.573253 | {
"github_metadata": {
"branch": "master",
"commit_count": 285,
"repo_created_at": "2019-04-22T09:20:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb9d1bf3... |
b4716418-078c-46a9-9a23-1a5d57887a9c | deadTrail/gameAcademy | struct/Goods/Goods/Goods.cpp | // Goods.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
//
#pragma warning (disable:4996)
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 10
typedef struct tagGOODS
{
char name[21];
int price;
float rate;
}GOODS;
enum TYPE
{
NAME = 1,
HIGH_PRICE,
LOW_PRICE,
RATE
};
enum ACTION
{
E... | TOOL | 0.916531 | 4.666571 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2017-07-13T11:01: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": "b2e1eeb88... |
2c36c5d0-c9cb-4452-b964-ad0f82be41a1 | avcopan/MPACK | examples/mlapack/condition_num_qd.cpp | // Get condition number of Hibert matrix via Rgecon
// written by <NAME>, 2010/8/19.
#include <mblas_qd.h>
#include <mlapack_qd.h>
#include <stdio.h>
//Matlab/Octave format
void printmat(int N, int M, qd_real * A, int LDA)
{
qd_real mtmp;
printf("[ ");
for (int i = 0; i < N; i++) {
printf("[ ");
for (i... | ALGO | 0.999703 | 3.728221 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2019-12-18T18:49:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ef976f1e... |
0326a920-8639-4e8e-84a2-5a97818abd61 | inspiralpatterns/master | SMC 9/DTU guest /02393/modul 10/exercises/lists/lists/doubly-linked.cpp | /* doubly-linked.cpp
implements a class List of doubly-linked lists.
See doubly-linked.h for class specifications
*/
#include <iostream>
#include "doubly-linked.h"
using namespace std;
/* define class constructor and destructor */
List::List(void){
/* setting the pointer to first (not existing, therefore empt... | ALGO | 0.987943 | 5.459244 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2017-01-12T00:10: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": "3b0c275c1... |
f8861828-ec05-433e-a54a-4d5ee13024b2 | xuehaonan27/cailab41 | cpp/plain.cc | #include <cmath>
#include <cstdio>
#include <cstdint>
#include "misc.hh"
void solve_plain(
const unsigned char *y_data,
const unsigned char *u_data,
const unsigned char *v_data,
unsigned char **y_result,
unsigned char **u_result,
unsigned char **v_result)
{
for (int image_idx = 0; image_id... | ALGO | 0.964839 | 4.885645 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2024-11-26T10:32: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": "66028ee89... |
22fd5dd7-6afb-47b0-9203-d7d0b22c636e | ExcaliburEX/My-oj | poj1083_3.12_2.cpp | /*
Moving Tables
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 33293 Accepted: 11141
Description
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.
The floor has 200 rooms each on the north side and south side along the corridor. R... | ALGO | 0.9995 | 3.592155 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2017-12-09T02:21:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b96e39201... |
778909b1-56fc-4ff3-aeac-e0676d253bb5 | namespacesis/Algorithm | 백준/Gold/15573. 채굴/채굴.cc | #include <iostream>
#include <queue>
#define FastIO ios::sync_with_stdio(false), cin.tie(nullptr);
using namespace std;
int N, M, K;
int arr[1000][1000];
bool visited[1000][1000];
int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };
int maxV = 0;
int minV = 1000001;
int bfs(int mid) {
queue<pair<int, int>> q;... | ALGO | 0.999991 | 4.519778 | {
"github_metadata": {
"branch": "main",
"commit_count": 683,
"repo_created_at": "2023-12-31T23:01: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": "19619ade10... |
e1a828f2-0084-427e-9f92-e5f4833c2910 | heyshb/Competitive-Programming | CodeForces/PastContest/1423/K.cpp | #include <bits/stdc++.h>
using namespace std;
const int M = 1000000;
bool ok[M + 10];
int cnt;
int mp[M + 10], prime[M + 10];
int sum[M + 10];
int min_partner[M + 10];
int main() {
memset(ok, true, sizeof(ok));
cnt = 0;
for (int i=2;i<=M;i++) {
if (ok[i]) {
prime[++cnt] = i;
... | ALGO | 0.999792 | 4.364905 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2018-02-21T09:20: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": "7410ced95... |
95d5557f-2b2e-49ee-8cd5-5f815ba374ab | mannyzzle/QCSimulator | QCSim/QuantumCryptograpy.h | #pragma once
#include "QuantumAlgorithm.h"
#include "QuantumGate.h"
#include "Utils.h"
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>
namespace QuantumCryptograpy {
// about half of the tranmitted bits will have a matched measurement basis, out of those 50% will be used to check for eavesdropping a... | ALGO | 0.936203 | 6.058865 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-04-02T20:20:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "19b1ef146989... |
f4408ab7-0b53-49a0-b0a0-5d15bffd0e5e | superj6/CPcode | c++ sol/IOI/IOI 14-wall.cpp | /*
Hold left and right bound for each interval and push operations down segtree lazily. This will make sure once you push min and max
all the way down a tree all important operations will be applied in the correct order since higher values will have happened after
lower values in the tree.
*/
#include <iostream>
#in... | ALGO | 0.999975 | 3.43775 | {
"github_metadata": {
"branch": "master",
"commit_count": 441,
"repo_created_at": "2019-09-09T05:55:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 129,
"forks": 37,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29998... |
e5574ffe-22e8-4ad0-85e0-592ad158a206 | RMI-NITT/HuRoS | CODES/Arduino/servo_control/biped_servo_PID/biped_servo_PID.ino | /*
* Encoder example sketch
* by <NAME>
* 1/1/2016
*
* Records encoder ticks for each wheel
* and prints the number of ticks for
* each encoder every 500ms
*
*Motor - RMCS-3013
*Black - GND
*Brown - Vcc
*Red - EncA
*Orange - EncB
*Yellow - Motor+
*Green - Motor-
*/
// pins for the encoder inputs
#defi... | ALGO | 0.922042 | 6.066765 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2019-11-02T14:27:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "14ee2166d5... |
9d59e063-1a29-4e5e-b916-edddfcbb0ada | rapel02/competitive-programming | UVa/10181.cpp | //Template Jollybee 2017-0720 ver.1
#include<stdio.h>
#include<iostream>
#include<sstream>
#include<string.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<stdlib.h>
#include<assert.h>
#include<time.h>
using namespace std;... | ALGO | 0.999848 | 4.155294 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-06-15T16:18: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": "a97c0d6214... |
2b235df3-038e-4291-a486-03263ea0353e | akonneker/mtf_mapper | include/focus_surface.h | /*
Copyright 2011 <NAME>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following dis... | ALGO | 0.998296 | 5.588177 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-06-15T04:32:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3c88857a109b... |
ee7e5461-ac16-4fdf-a58a-0a386dc5c3f3 | purvasingh96/My-Leetcode-Solutions | 847-shortest-path-visiting-all-nodes/847-shortest-path-visiting-all-nodes.cpp | class Solution {
public:
int shortestPathLength(vector<vector<int>>& graph) {
if(graph.size()==1) return 0;
int n = graph.size();
queue<vector<int>> q;
int endingmask = (1<<n) - 1;
vector<vector<int>> seen(n, vector<int>(endingmask, false));
... | ALGO | 0.999813 | 5.156633 | {
"github_metadata": {
"branch": "main",
"commit_count": 5768,
"repo_created_at": "2021-12-24T13:59:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6528de6e4... |
3a93689b-3eed-4384-83d8-37768759ac28 | ishandutta2007/codeforces-q | qwertypi/normal/1556/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int A[100000];
void _ans(int k){
cout << "finish " << k << endl;
return;
}
int _or(int i, int j){
cout << "or " << i + 1 << ' ' << j + 1 << endl;
int ver;
cin >> ver;
return ver;
}
int _and(int i, int j){
cout << "and " << i + 1 << ' ' <... | ALGO | 0.999512 | 3.155159 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:56: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": "8aa61eb91cf1... |
8326cbe8-929a-4ec9-a91b-8678962b6378 | heeat/a2oj-ladders | Codeforces-Div-2A/ArrivaloftheGeneral.cpp | // Codeforces Link : https://codeforces.com/problemset/problem/144/A
#include <bits/stdc++.h>
using namespace std;
int main()
{
int num = 0, maxValIndex = 0, minValIndex = 0, inputVal = 0;
vector<int> vc;
cin >> num;
for (int i = 0; i < num; i++)
{
cin >> inputVal;
vc.push_back(i... | ALGO | 0.999883 | 4.580884 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2020-09-26T16:10: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": "c4d895c13... |
d0abeb11-8cc1-40b9-a6a8-9e3edc08009b | brittonsmith/c10.00-b | source/cool_argo.cpp | /* This file is part of Cloudy and is copyright (C)1978-2010 by <NAME> and
* others. For conditions of distribution and use see copyright notice in license.txt */
/*CoolArgo compute argon cooling */
#include "cddefines.h"
#include "coolheavy.h"
#include "phycon.h"
#include "ligbar.h"
#include "taulines.h"
#include "d... | ALGO | 0.99397 | 3.376629 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-11-26T12:10:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0f50804041... |
4f9e6c9e-0c46-4535-98a7-bfdbd4c62a86 | nmp9981/coding_daily_2023 | 20230429_1753.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int v,e,k;
const int maxi = 20001;
const int inf = 555555555;
vector<pair<int, int>> graph[maxi];
int dist[maxi];//거리
//max
inline int max(int x, int y) {
return x > y ? x : y;
}
//입력
void input() {
cin >> v>>e>>k;
for (int i = 0... | ALGO | 0.99996 | 4.318065 | {
"github_metadata": {
"branch": "main",
"commit_count": 420,
"repo_created_at": "2023-01-01T11:59: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": "ecaabad222... |
618b83b0-2b79-4c9a-9177-260ddcaaf9a9 | yusukeuemura/cs_academy_practice | Implementation/String_Concat/string_concat.cpp | #include <iostream>
#include <string>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<std::string> str(n);
std::vector<int> check(n, 0);
for (int i = 0; i < n; i++) {
std::cin >> str[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
... | ALGO | 0.999976 | 4.222426 | {
"github_metadata": {
"branch": "master",
"commit_count": 127,
"repo_created_at": "2018-04-04T09:29:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3e0910f... |
c4c56a26-62ff-4d14-86fe-93e1ff3b2785 | ishandutta2007/codeforces-e | emptysoulist/normal/1305/E.cpp | #include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
char cc = getchar() ; int cn = 0, flus = 1 ;
while( cc < '0' || cc > '9' ) { if( cc == '-' ) flus = - flus ; cc = getchar() ; }
while( cc >= '0' && cc <= ... | ALGO | 0.999955 | 3.162739 | {
"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": "3c191ef133c1... |
20335c90-fee9-4926-90e7-254037761e8b | ishita-gambhir/Cplusplus | Searching and Sorting/BookAllocationProblem.cpp | /*
You are given number of pages in n different books and m students. The books are arranged in ascending order of number of pages. Every student is assigned to read some consecutive books. The task is to assign books in such a way that the maximum number of pages assigned to a student is minimum.
Input Format:
First ... | ALGO | 0.999969 | 4.687661 | {
"github_metadata": {
"branch": "master",
"commit_count": 180,
"repo_created_at": "2018-12-24T11:09:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 1,
"issues": 5,
"pull_requests": 0
},
"file_meta": {
"content_id": "996c74e2... |
9b705b4b-b16f-4fb8-89ac-33309e12754f | avnishsingh516/CB-ds-and-algo | sorting/inversion_count_using_mergeSort.cpp | #include<iostream>
using namespace std;
// a[i] > a[j]
int merge(int *a , int s, int e) {
int mid = (s + e) / 2;
int i = s;
int j = mid + 1;
int k = s;
int temp[100];
int cnt = 0; //cross inversion
while (i <= mid and j <= e) {
if (a[i] <= a[j]) {
temp[k] = a[i];
k++;
i++;
}
else {
temp[... | ALGO | 0.99994 | 4.500622 | {
"github_metadata": {
"branch": "master",
"commit_count": 185,
"repo_created_at": "2020-06-18T03:45:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "25819ae4... |
c4e48e08-6beb-4db9-bebd-845c2432c74f | LZD-PratyushBhatt/CodePractice | DP/7.NinjaTraining.cpp | #include<bits/stdc++.h>
using namespace std;
int findAnswer(vector<vector<int>> &points, vector<vector<int>> &dp, int row, int last_col){
if(row == 0){ // it means we have come till the last row. And gotta pick the best in that
// Just chose the max of three(exclude the picked column from idx 1).
int m... | ALGO | 0.999719 | 4.460179 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-11-03T07:44: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": "2c151e97d7... |
23bc25c6-7d6a-431c-a445-4f0d7c28ac11 | XoJIoDuJIHuK/2-term | ОАиП (Белодед)/Лаба 12/Лаба 12/main.cpp | //#include "stdafx.h"
#include "Tree.h"
#include <fstream>
using namespace std;
struct NodeTree
{
int key;
};
//-------------------------------
btree::CMP cmpfnc(void* x, void* y) // Сравнение
{
btree::CMP rc = btree::EQUAL;
if (((NodeTree*)x)->key < ((NodeTree*)y)->key)
rc = btree::LESS;
else
if (((NodeTre... | ALGO | 0.998859 | 3.805025 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2022-04-28T15:34: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": "9bf2a87c892... |
29b2f248-1dce-410c-ad1a-bc74b7f73edd | bimalka98/Data-Structures-and-Algorithms | Dynamic Programming/canSum.cpp | #include <bits/stdc++.h>
using namespace std;
/*
// all inputs are non negative
// any element can be use any times
bool canSum(int targetsum, vector<int> & array){
// time complexity = O(m^n) m -target sum, n -lenght of array.
// space complexity = O(m)
// canSum(7, [5,3,4,7]) --> true
if(targetsum ==0) return true;
... | ALGO | 0.999971 | 5.126955 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2020-11-22T11:57:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6a940fee4b2... |
d5dd9336-1b0a-4d71-a19c-2ea0501d5c12 | giongto35/CompetitveProgramming | E333.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <iomanip>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <c... | ALGO | 0.999883 | 4.076907 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-01-30T17:12:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3cbcb0d5b7... |
bb34562e-5eed-4820-8fec-972cfe904627 | ojcole/re-pairing-brackets | src/search/segment_width_search.h | // MIT License
// Copyright (c) 2020-2021 <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 use, copy, modify, mer... | ALGO | 0.999572 | 7.043355 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2021-04-30T18:22: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": "6cf8f37b83... |
f469cafa-6be8-4f81-ba7e-dc1ba4489780 | dhruvbird/genome-diff-compression | src/main.cpp | #include <iostream>
#include <include/suffix_array.hpp>
#include <include/algorithm.hpp>
#include <include/fasta.hpp>
using namespace std;
char *ref_buff = NULL;
char *tgt_buff = NULL;
int ref_len = 0;
int tgt_len = 0;
// 16MB
#define REF_BUFF_SIZE 16*1024*1024
// 6MB
#define TGT_BUFF_SIZE 6*1024*1024
// Computes... | ALGO | 0.968195 | 4.397365 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2012-12-04T02:51: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": "de4922336... |
2b4df493-587f-4f71-a19e-27c1e79d5c9f | masfrank/ollama-for-amd | llama/llama-sampling.h | /**
* llama.cpp - commit <PASSWORD> - do not edit this file
*
* MIT License
*
* Copyright (c) 2023-2024 The ggml authors
*
* 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 res... | TOOL | 0.934895 | 6.995475 | {
"github_metadata": {
"branch": "main",
"commit_count": 3624,
"repo_created_at": "2024-06-29T03:47:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e90235c28... |
26b65175-fe85-481b-ab06-c93b66137bcc | burakbayramli/books | Game_Physics_Eberly/WildMagic2/Source/Intersection/WmlIntrElp2Elp2.cpp | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2003. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclos... | ALGO | 0.998951 | 3.934285 | {
"github_metadata": {
"branch": "master",
"commit_count": 652,
"repo_created_at": "2016-10-31T17:24:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 325,
"forks": 201,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7180... |
8acb6260-a4b4-4684-8f08-bf59a51c7df1 | franktea/acm | leetcode.com/0010. Regular Expression Matching/10.cpp | /*
* 10.cpp
*
* Created on: Sep 10, 2018
* Author: frank
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
// 用递归的方法。递归的深度就是模式的个数。
// 将模式分组,每次递归一个模式,按照每个模式可以匹配的全部字符向后移动字符的位置,
// 如果匹配到最后,模式和字符都用完,则说明匹配成功。
class Solution {
public:
bool isMatch(string s,... | ALGO | 0.999755 | 4.106521 | {
"github_metadata": {
"branch": "master",
"commit_count": 401,
"repo_created_at": "2015-04-16T16:40: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": "9ea5e597... |
64fe781b-fbe4-4377-953f-7d51e6d2dc15 | gopikrishna000/templates-latest | xor_trie_using_array.cpp | <snippet>
<content><![CDATA[
const int K = 30;
const int N = 200200;
const int M = N * (K + 1) + 7;
int id = 0;
int to[M][2];
int getNewNode() {
to[id][0] = to[id][1] = -1;
return id++;
}
int createTrie(int x=0) {
int v = getNewNode();
int r = v;
for (int k = K - 1; k >= 0; k--) {
int u = getNewNode();
to[... | ALGO | 0.999535 | 4.323737 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2024-08-29T11:28: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": "12d9df4d271... |
ed4670f6-363e-4240-bfd4-f3bd453703a1 | makerdark98/ProgrammingContest | cf/568/d.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define sci(n) scanf("%d", &(n))
int main() {
int N, result;
sci(N);
vector<int> data(N), sorted;
for(int i=0;i<N;i++){
sci(data[i]);
}
sorted = data;
sort(sorted.begin(), sorted.end());
vector<int> ... | ALGO | 0.999959 | 3.486777 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2017-07-23T06:45: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": "457bedc6c... |
384eaa74-3d54-4d4b-b32c-31b898bfbcd4 | imtiazdeepto/XPSC-solved-Problem | Week-7/Day-3/A_Phone_Desktop.cpp | //https://codeforces.com/problemset/problem/1974/A
// Solved at:Dec/03/2024 01:59UTC+6
#include <bits/stdc++.h>
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define ImtiazDeepto cout.tie(NULL);
using namespace std;
#define all(x) (x).begin(), (x).end()
#define int long long
#define tc \
... | ALGO | 0.999795 | 4.188532 | {
"github_metadata": {
"branch": "main",
"commit_count": 279,
"repo_created_at": "2024-10-27T12:19: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": "26f385276e... |
0bbd860c-3133-4cb8-a781-cd098069ea92 | DiegoIturra/Competititve-Programming | UVa/Page_Hopping.cpp | /*
Uva 821 Page Hopping (ACEPTADO)
Nombre: <NAME>
uva username: diturra2016
Codigo Propio
*/
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1 << 20 //2^20
using namespace std;
vector<vector<int>> dist; //grafo con las distancias correspondientes
vector<pair<int,int>> adyacency; //vector tempora... | ALGO | 0.998943 | 4.231688 | {
"github_metadata": {
"branch": "master",
"commit_count": 124,
"repo_created_at": "2019-04-18T15:08:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee5d5e64... |
69a541f6-7c79-4791-b15f-2ad8877daf5d | MihaiCatalin-Stan/Algotihms-design | DEI, Greedy, DP/colorare.cpp | #include <math.h>
#include <iostream>
#include <fstream>
#include <vector>
#define MOD 1000000007
using namespace std;
long my_power(long base, long exp) {
if (exp == 0)
return 1;
if (exp == 1)
return base;
long abs = my_power(base, exp / 2);
if (exp % 2)
return (abs * abs) * base % MOD;
else
return (... | ALGO | 0.999902 | 3.774966 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-03-09T13:51: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": "ee5783e4f054... |
bec1222b-cb23-4da1-87b8-dd4af510b097 | Akhireddy/test1 | src/plugins/contrib/ThreadSearch/ThreadSearchConfPanel.cpp | /***************************************************************
* Name: ThreadSearchConfPanel
* Purpose: This class implements the configuration panel used
* in modal dialog called on "Options" button click
* and by C::B on "Environment" settings window.
* Author: <NAME>
* Created... | TOOL | 0.926799 | 3.108658 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-11-07T14:01: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": "3563882d07... |
0854954a-187e-4e5c-b7ef-95fa5f8ae140 | fahimcp495/DU_Devour | notebook_generator/code/2SAT.cpp | //CNF: (a | b) ^ (c | d) means (!a -> b) ^ (!b -> a)
// (!a or b) = (-a, b), 1-based indexing
string two_sat(int n, vector<array<int, 2>> clauses) {
vector<int> adj[2 * n];
for (auto [a, b]: clauses) {
if (a > 0) a = 2 * a - 2;
else a = 2 * -a - 1;
if (b > 0) b = 2 * b - 2;
else b = 2 * -b - 1;
... | ALGO | 0.999856 | 4.485667 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-01-26T13:18: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": "f068a1a5216a... |
cb285625-1765-47fe-9453-aa183c406cd2 | suraj-iitb/algorithm-identification | BERT/Data_Dump/Merge/C++/Code/merge4689899.cpp | #include<bits/stdc++.h>
#include<limits.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)
int compare_cnt = 0;
void merge(vector<int> &s, int left, int mid, int right){
vector<int> n1(mid - left);
vector<int> n2(right - mid);
rep(i, mid - left){
n1.at(i) =... | ALGO | 0.999958 | 4.500734 | {
"github_metadata": {
"branch": "main",
"commit_count": 229,
"repo_created_at": "2020-05-24T06:21:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 2,
"pull_requests": 10
},
"file_meta": {
"content_id": "80878df9c... |
cc672408-69c3-45ca-88fb-1dd2e7b75279 | solareenlo/atcoder | 05_AtCoder-Beginner-Contest/abc057/B/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
template<class T> inline bool chmin(T &a, T b) {
if (a > b) a = b; return true;
return false;
}
void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b, s... | ALGO | 0.999994 | 4.122286 | {
"github_metadata": {
"branch": "main",
"commit_count": 256,
"repo_created_at": "2020-11-30T21:16:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7e28c0113... |
c2a557d2-dfee-442c-93d4-74631d0733aa | KaHIP/KaHIP | parallel/modified_kahip/lib/partition/initial_partitioning/initial_partition_bipartition.cpp | /******************************************************************************
* initial_partition_bipartition.cpp
* *
* Source of KaHIP -- Karlsruhe High Quality Partitioning.
* <NAME> <<EMAIL>>
*****************************************************************************/
#include <fstream>
#include "initial_p... | ALGO | 0.99583 | 5.75106 | {
"github_metadata": {
"branch": "master",
"commit_count": 648,
"repo_created_at": "2013-10-16T15:25:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 442,
"forks": 101,
"issues": 13,
"pull_requests": 8
},
"file_meta": {
"content_id": "5e62... |
d26da926-99e5-4a48-8acb-5cad29931611 | redeff/cmp | july-circuits/2018/bonus-money/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll bound = 2e3 + 10;
vector<vector<ll>> dp(bound, vector<ll>(bound, 0));
ll rec(ll k, ll n, ll p) {
if(k < bound && n < bound) return dp[k][n];
if(k == 0 && n == 0) return 1;
if(k > n) return 0;
else if(k <= 0 || n <= 0) ret... | ALGO | 0.999972 | 4.605682 | {
"github_metadata": {
"branch": "master",
"commit_count": 126,
"repo_created_at": "2017-10-21T13:35:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9f34c261... |
ec4740f1-bcc3-4602-8cb2-7e4689fc9247 | fengvyi/LeetCode | C++/802. Find Eventual Safe States.cpp | class Solution {
public:
vector<int> eventualSafeNodes(vector<vector<int>>& graph) {
vector<int>res;
int n = graph.size();
vector<int>loop(n), safe(n), visited(n);
for(int i = 0; i < n; i++)
if(isSafe(graph, visited, loop, safe, i)) res.push_back(i);
return res;
... | ALGO | 0.99997 | 6.194765 | {
"github_metadata": {
"branch": "master",
"commit_count": 1188,
"repo_created_at": "2017-08-06T09:52:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 144,
"forks": 39,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "5c18... |
59a9410d-fb13-4247-84d9-0a0a9ba5c268 | cogitates/Code | Cplus/Leetcode/Backtracking/Subsets.cc | // Subsets
// https://leetcode.com/problems/subsets/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> ans;
vector<int> cur;
// n is size of cur
// s is start of the tree
for(int i = 0... | ALGO | 0.999739 | 6.158876 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2020-03-30T02:17:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6aa9b1986... |
d1e9b8fe-6d1a-418b-9cdd-b873ddb2d128 | ChrisKimZHT/Algorithm-Problems | WHUT/2021/TeamExercise_06/A_Prim.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct NODE
{
int dist, point;
NODE(int first, int second)
{
point = first;
dist = second;
}
bool operator<(const NODE &x) const
{
return dist > x.dist;
}
};
int main(void)
{
int P, R;
... | ALGO | 0.999838 | 3.700418 | {
"github_metadata": {
"branch": "master",
"commit_count": 366,
"repo_created_at": "2022-03-26T17:03:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "270840f3... |
f6b52b8f-5bb9-44ee-a4eb-464e74f6332c | PancrasL/hust-Experiment | C++实验/U201614532_4/U201614532_4.h | #include<iostream>
#define WRONG -1;
using namespace std;
class STACK {
int *const elems; //申请内存用于存放栈的元素
const int max; //栈能存放的最大元素个数
int pos; //栈实际已有元素个数,栈空时pos=0;
public:
STACK(int m); //初始化栈:最多存m个元素
STACK(const STACK&s); //用栈s拷贝初始化栈
virtual int size() const; //返回栈的最大元素个数max
virtual operator in... | ALGO | 0.938028 | 3.738902 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-10-19T15:04: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": "bcc98e3c2f... |
420d5b5c-dbda-4a76-a130-f3a1be9101fc | deepdarshan21/leetcode-solutions | 187. Repeated DNA Sequences/HashSet.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Approach: HashSet
Use sliding window to travese all possible string and then store that strings in visited set
if a string is all ready present in set, it mean it is repeating
Edge Cases:
Time Complexity: O(n) Space: O(n)
Status: Accepted
... | ALGO | 0.999341 | 5.351239 | {
"github_metadata": {
"branch": "main",
"commit_count": 889,
"repo_created_at": "2022-01-07T14:50: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": "69746aef3f... |
925ca7a5-3d34-438d-b13c-f59e3c4ec185 | CommonRoad/commonroad-reachable-set | cpp/src/data_structure/reach/reach_polygon_boost.cpp | #include "reachset/data_structure/reach/reach_polygon_boost.hpp"
#include "reachset/data_structure/reach/reach_vertex.hpp"
#include "reachset/utility/shared_using.hpp"
using namespace reach;
ReachPolygon::ReachPolygon(vector<tuple<double, double>> const& vec_vertices) {
if (vec_vertices.size() < 3)
throw ... | ALGO | 0.998781 | 7.042449 | {
"github_metadata": {
"branch": "main",
"commit_count": 624,
"repo_created_at": "2024-02-19T07:30:27.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "d0a80e9c878... |
796d35d9-d2b2-4fb8-8d38-4b4fc2bf750e | XuansShi/XuanShi1 | Project52/模板-函数模板案例-数组排序.cpp | #include <iostream>
using namespace std;
//实现通用 对数组进行排序的函数
//规则 从大到小
//算法 选择
//测试 char数组 int数组
//交换函数模板
template<class T>
void mySwap(T&a,T&b)
{
T temp = a;
a = b;
b = temp;
}
//排序算法模板
template<class T>
void mySort(T arr[],int len)//习:对数组进行操作时一般会传一个数组长度进去
{
for (int i = 0; i < len; i++)
{
int max = i;/... | ALGO | 0.999019 | 4.61137 | {
"github_metadata": {
"branch": "main",
"commit_count": 153,
"repo_created_at": "2024-09-06T00:50: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": "60e15ffb4a... |
63bd084c-0322-4688-bbb9-f3b12d4bf79f | kaivenhu/coding-problem | leetcode/problems/20-valid-parentheses/valid_pair.cc | #include <string>
#include "valid_pair.h"
using std::string;
Node::Node(const char t): type_(t), next_(nullptr)
{
}
char Node::GetType(void) const
{
return type_;
}
void Node::SetNext(Node *n)
{
next_ = n;
}
Node* Node::GetNext(void) const
{
return next_;
}
PairStack::~PairStack()
{
while (nullp... | ALGO | 0.99444 | 5.663786 | {
"github_metadata": {
"branch": "master",
"commit_count": 93,
"repo_created_at": "2019-11-30T16:42:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d276850d4... |
71371658-5765-4ba2-8336-59d7dc9471c3 | zsxm1998/PAT-Advanced-Level | 1098.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ori, par;
bool insertion(vector<int> o, vector<int> p, vector<int> &output){
bool flag = false;
for(int i=1; i<n; i++){
int temp = o[i], j;
for(j=i-1; j>=0&&o[j]>temp; j--) o[j+1] = o[j];
o[j+1] = temp;
if(flag){
output = o;
return flag;
... | ALGO | 0.999994 | 4.062459 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-04-10T14:58:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d0c641bd6... |
3999620a-f1c4-4ba5-abe7-164807414e45 | DownToParadise/CplusProjects | heap/heapsort_BIG.cpp | #include"bitree.h"
#include<iostream>
using namespace std;
template<class T>
void PercolateUp(T*, int);
/*用向上调整的方法建立大根堆*/
template<class T>
void BuildHeap(T *pa, int size)
{
for(int i=size-1;i>0;i--)
{
PercolateUp(pa,i);
}
}
/*向上调整为大根堆*/
template<class T>
void PercolateUp(T*pa, int pos)
{
T t... | ALGO | 0.999857 | 3.90789 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-09-13T15:02: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": "6bb51c46c176... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.