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 |
|---|---|---|---|---|---|---|---|
96b62438-d8f3-401c-86f3-906a67535ce9 | niiquaye/DSA | practice/sub-arrays/maximum_length_longest_subarray.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
int optimal_solution(const std::vector<int>& array)
{
int pos_len {0};
int neg_len {0};
int max_len {0};
for (const auto num : array)
{
if (num == 0)
{
pos_len = 0;
neg_len ... | ALGO | 0.999902 | 5.283751 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2025-06-20T21:17: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": "ffa1e9cf1da... |
830bae44-2f71-4573-9674-02fa99e57e83 | ParzivalEugene/misis2024s-23-04-michkov-e-v | prj.codeforces/0492b.cpp | // https://codeforces.com/problemset/problem/492/B
#include <algorithm>
#include <iostream>
int main() {
int n, l;
std::cin >> n >> l;
int a[n];
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
std::sort(a, a + n);
double max = 0;
for (int i = 0; i < n - 1; i++) {
double d = (a[i + 1] - a[i]... | ALGO | 0.999894 | 4.054372 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2024-02-07T21:04: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": "db5a6d83d... |
b2577f10-6ee6-428a-8bd7-b189421b934e | yuhanhyj/Case-studies-4-The-MG-method | main.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <chrono>
#include <iomanip> // For table formatting
#include "multigrid.h"
#include "utils.h"
int main()
{
// List of grid sizes to test
std::vector<int> testNs = {16, 32, 64, 128, 256};
// Parameters for the multigrid solver
const double... | ALGO | 0.998033 | 5.285862 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2025-05-01T23:58:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bb0aeb11d0e... |
33c3b2d6-ceb5-4f40-b85c-25b827c9edf3 | pranavjawale01/cp.exe | LeetCode/2563-count-the-number-of-fair-pairs/2563-count-the-number-of-fair-pairs.cpp | class Solution {
public:
long long countInRange(int i, int lower, int upper, vector<int> &nums) {
int n = nums.size();
int left = i + 1, right = n;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[i] + nums[mid] < lower) {
... | ALGO | 0.999994 | 6.260658 | {
"github_metadata": {
"branch": "main",
"commit_count": 7302,
"repo_created_at": "2023-09-11T17:37:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e1a38327... |
045b3b66-0c7d-4627-a9ea-e5d27fd79833 | pichenettes/eurorack | braids/envelope.h | // Copyright 2012 <NAME>.
//
// Author: <NAME> (<EMAIL>)
//
// 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, mo... | ALGO | 0.969078 | 6.655406 | {
"github_metadata": {
"branch": "master",
"commit_count": 191,
"repo_created_at": "2013-08-26T15:53:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2769,
"forks": 775,
"issues": 4,
"pull_requests": 3
},
"file_meta": {
"content_id": "471... |
93e485ab-8d1a-42a6-88b1-0d5942d14162 | google-deepmind/open_spiel | open_spiel/games/rbc/rbc.h | // Copyright 2019 DeepMind Technologies Limited
//
// 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 l... | ALGO | 0.925203 | 6.289547 | {
"github_metadata": {
"branch": "master",
"commit_count": 4660,
"repo_created_at": "2019-07-22T13:50:21.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4631,
"forks": 1006,
"issues": 17,
"pull_requests": 6
},
"file_meta": {
"content_id": "1... |
c7de3791-5225-4071-8a88-67a45583cffc | CheeXueyi/cses_notes | dp/minimalGridPath.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const int INF = 1e9 + 7;
const int N = 3100;
// we could do bfs, but at each level, we only keep track of the branches that give the smallest character
int n;
string S[3100];
// smallest char at each level
char smallestChar... | ALGO | 0.999976 | 3.696622 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-07-06T05:20: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": "2a736a27b003... |
577fe2b8-5fc4-4ba3-998c-00313c9845e4 | qliphy/2020HEPMC | RootandRandom/Random3/MC-inte3/mcint2.cpp | // int_0^1 exp(-x/2) dx =2(1-exp(-0.5))
// importance sampling: g(x)=1-x/2.0
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
double func(double x);
int main()
{
srand(unsigned(time(0))); // seed the randomizer
int i, n;
double crude_mc, tx, x, sum_sigma, fx, v... | ALGO | 0.999888 | 3.952193 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-02-27T07:42:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dabd8041e... |
41d2946c-52e8-499e-8fb8-261a86b887e9 | Hazrat-Ali9/Data-Structure-Algorithms | relative-sort-array/relative-sort-array.cpp | class Solution {
public:
vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
vector<int> result;
// Traverse through the relative order array
for (int i = 0; i < arr2.size(); i++) {
// Traverse through the target array
for (int j = 0; j < arr1.size()... | ALGO | 0.999997 | 6.443933 | {
"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": "f755e494cf... |
3be6164e-3199-4a3e-817f-f4c5893bb385 | Sumanyu301/practise_Codes | 100_starter_programs/69.cpp | // • You are given two numbers, stored in variables with the names num1 and num2
// • Print the output of the following operation
// num1> num2, this prints true if num1 is greater than num2, else it prints false
// • After this operation is performed, another number, stored in a variable with name num3 is added to num... | ALGO | 0.999905 | 3.961512 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2023-08-21T08:31:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8538c26bf... |
0cedef57-05a5-43a2-8b36-94f0d64f59fc | Biswajeet121/Interview_DS_Algo | LinkedList/Clone List with Next and Random.cpp |
Problem Link : https://www.geeksforgeeks.org/batch/gfg-160-problems/track/linked-list-gfg-160/problem/clone-a-linked-list-with-next-and-random-pointer
class Solution {
public:
Node *cloneLinkedList(Node *head) {
// Write your code here
Node* curr = head;
while(curr != NULL){
... | ALGO | 0.99878 | 4.667926 | {
"github_metadata": {
"branch": "main",
"commit_count": 134,
"repo_created_at": "2025-01-01T16:46: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": "6a496f047c... |
87f7bd62-f68b-46b0-8067-9f942082be0d | KazukiHiraizumi/DCuino | dcuino2/unittest/toef.h | #ifndef TOEFH
#define TOEFH
#ifdef APPROX
#undef APPROX
#endif
#define APPROX 3
#include "approx.h"
namespace toef{ //the Third Order Equation Filter
int variation(int *dat,int samp){
float sig=0;
for(int i=0;i<samp;i++){
int d=dat[i];
sig+=d*d;
}
return sqrt(sig/samp);
}
int N(in... | ALGO | 0.999799 | 3.962121 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-07-13T23:49: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": "1e50b73787e... |
65111c73-f547-48d9-9bc0-9a0fb7a10a27 | RockyDesigne/cpp-algos | math/sequences.cpp | #include <iostream>
#include <vector>
using namespace std;
//function to that describes a sequence
// X(n) n>=1
//X(n) => if n is odd => n = n^2 else n = n
vector<int> sequence1(int n) {
vector<int>result;
for (int i = 1; i <= n; ++i) {
if (i % 2 == 0) {
result.push_back(i);
} else ... | ALGO | 0.999808 | 4.861289 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-10-06T16:31: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": "221ee920d170... |
9173c625-18fd-4fa0-b870-a3a409b024a8 | wiwitrifai/competitive-programming | indonesian-local/vocomfest/2017_qual/d.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 111;
int dp[N+5][N+5], n, m;
int a[N], b[N], c[N];
vector< int > beg[N];
int main() {
int tt;
scanf("%d", &tt);
for (int tc = 1; tc <= tt; tc++) {
memset(dp, 0, sizeof dp);
scanf("%d %d", &n, &m);
for (int i = 0; i < N; i++)
beg[i].... | ALGO | 0.999706 | 3.505053 | {
"github_metadata": {
"branch": "master",
"commit_count": 628,
"repo_created_at": "2016-05-21T12:11:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 37,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e2c1423... |
82d2fc6d-6d74-4fdd-9bd1-caa611dfa5d6 | MarbinSpectrum/Algorithm- | StudyData/백준/5529(저택).cpp | #include <bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
#define endl "\n"
#define int long long
#define float long double
const int INF = 999999999999999;
const int Dic[4][2] = { {0,1},{0,-1},{1,0},{-1,0} };
////////////////////////////////////////////////////////////////////////
int N, M, K;... | ALGO | 0.999987 | 3.474239 | {
"github_metadata": {
"branch": "master",
"commit_count": 463,
"repo_created_at": "2019-05-27T15:30: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": "b81c9db1... |
4be18d8c-5a48-4cc0-8094-05f98bfb3135 | GDSCltce/DSA | Hashing/HashSet.cpp | #include <bits/stdc++.h>
#include "array.h"
using namespace std;
#define endl '\n'
#define ll long long int
#define space ' '
#define dbg(x) printf("%s = %d\n", #x, x);
// const int mod = 1000000007;
/*************************************/
class myHash
{
// vector<int> arr;
int *arr;
int cap, size;
public:
myHas... | ALGO | 0.998956 | 3.750653 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2023-08-26T10:03:40.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00531f972ea... |
b47d7971-aa2f-4e92-bdfe-5e3bb4da8e08 | SeSACAlgorithm/AlgorithmStudy | 백준/문자열/9342) 염색체/석희.cpp | #include <iostream>
using namespace std;
int T;
bool check_str(string str)
{
int index = 0;
int aCount = 0;
int fCount = 0;
int cCount = 0;
if (!(str[0] >= 'A' && str[0] <= 'F') || !(str.back() >= 'A' && str.back() <= 'F')) return false;
if(str[0] != 'A') index++;
for(index; index < str... | ALGO | 0.99946 | 3.876865 | {
"github_metadata": {
"branch": "main",
"commit_count": 3364,
"repo_created_at": "2024-02-23T07:02:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "68381900ca... |
56907043-94cd-4a79-94e1-bdcbabb38159 | billgan1024/competitive-programming | jan09/sales.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define INF 0x3f
#define nl '\n'
#define pb push_back
#define ms(x, y) memset(x, y, sizeof(x))
#define sp ' '
#define clz __builtin_clz
#define clzll __builtin_clzll
#define popcnt __builtin_popcount
#define flush cout << flush
#define sz(x) (... | ALGO | 0.999746 | 3.651835 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-04-22T22:40: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": "0681254c75b... |
8e705713-74f9-42e0-94e7-43ae06072747 | 523793658/Air2.0 | PI/picore/mesh/src/pi_mesh_prog.cpp | #include <list>
#include <map>
#include "algorithm"
#include "pi_mesh.h"
#include "pi_vector3.h"
#include "pi_mesh_prog.h"
using namespace std;
class Triangle;
class Vertex;
using namespace std;
class Triangle {
public:
Vertex * vertex[3];
PiVector3 normal;
PiVector3 origin_normal;
Triangle(Ver... | ALGO | 0.997315 | 3.137284 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2019-03-29T02:23:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5473f940... |
8b6a2e91-5dde-46e2-a04a-10240f71583c | deijo/adventofcode2016 | AdventureNbr_6/main.cpp | #include <QDebug>
#include <QStringList>
#include <QFile>
QStringList readFile(QString filename)
{
// Read file
QFile file(filename);
if(!file.open(QIODevice::ReadOnly)) {
qDebug() << "Error: " << file.errorString() << endl;
}
QTextStream in(&file);
QStringList indata;
while(!in.... | ALGO | 0.996977 | 4.153468 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2016-12-03T12:42: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": "5bf98f999... |
a88d0311-e33d-400f-a92d-ec2b177fea43 | zholofmeister/20ICPC-template | 图论/2-SAT/UVA 11930.cpp | UVA 11930
题意:
给你n个矩形,每个矩形给你四个顶点(无序,所以要先排序),现在要求每个矩形都要选一个对角线,使得这些对角线都不相交。如果存在解的话就YES,不然NO。
1000ms n<=1000, -1e9<=xi,yi<=1e9
思路:
预处理出2*n条对角线,然后遍历。
1. 同一个矩形的对角线continue,
2. i与j不相交,i与j^1相交 -> 选i一定选j ->i向j连边。
3. i与j相交,i与j^1不相交 -> 不可能选i,只能选i^1 -> i向i^1连边
sgn和叉积那边要开ll(490ms) or 直接#define int long long(430ms 还快一点??)
... | ALGO | 0.999905 | 4.082608 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-12-14T11:31:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a12d39de22... |
109fa364-c630-4fef-856b-5d6e56fb72c5 | abhijitWebDev/chai-aur-c- | recursion.cpp | #include<iostream>
using namespace std;
void func1(int n) {
for(int i=n; i >=0; i--)
cout << i << endl;
}
void func2(int n) {
if(n==0) return;
cout << n << endl;
func2(n-1);
cout << n << endl;
}
int funcFib(int n) {
if(n==0) return 0;
if(n==1) return 1;
cout << "The value of n ... | ALGO | 0.997912 | 4.461828 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2024-08-30T19:14:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ddc3f34a7c3... |
c10f8293-2970-4ae0-b25b-25206f16a188 | ermine27/competitive-programming | src/algorithms/Graph/Prim.hpp | /**
* @brief プリム法(最小全域木(MST))
*
* @fn prim
* @brief プリム法を使って最小全域木を求める
* @param g グラフのデータ
* @param prev 1つ前に通った点の情報
* @return 最小全域木の辺の重みの総和
* @remark 計算量:O(|E|log|V|)
*
*
* 参考ページ
* https://algo-logic.info/prim-mst/
* 参考コード
* https://github.com/ei1333/library/blob/master/graph/mst/prim.hpp
* 問題例 ALDS_1_12_... | ALGO | 0.999557 | 5.353579 | {
"github_metadata": {
"branch": "main",
"commit_count": 418,
"repo_created_at": "2022-10-15T09:25: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": "d570ea9958... |
544e3dbe-25ae-428d-99c6-2ae1142a8b67 | ForgotDream/Problemset | Luogu/T314209 回文数.cpp | /**
* @file T314209 回文数.cpp
* @author ForgotDream
* @brief 数位 DP
* @date 2023-02-28
*/
#include <bits/stdc++.h>
using i64 = long long;
int f[25][25][2];
int tmp[25];
std::vector<int> nums;
i64 dfs(int pos, int cur, bool isPalin, bool isLimited) {
if (!cur) {
return isPalin;
}
if (!isLimited ... | ALGO | 0.999878 | 5.442338 | {
"github_metadata": {
"branch": "main",
"commit_count": 286,
"repo_created_at": "2023-04-20T07:00:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "660b5af683... |
077fbae8-84ec-41a1-beaa-5a9d467dadcb | mrFahrenhiet/DSA | Backtraking/Sudoko Solver/solver.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
bool is_possible(vector<vector<int> > board,int i,int j,int n,int num) {
for(int x=0;x<n;x++) {
if(board[x][j]==num || board[i][x]==num) {
return false;
}
}
int rootn = sqrt(n);
int sub_row_s = (i/rootn)*rootn;
int sub_row_e = (i/rootn)... | ALGO | 0.999972 | 4.630051 | {
"github_metadata": {
"branch": "master",
"commit_count": 637,
"repo_created_at": "2020-02-27T09:40: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": "579ee672... |
caf66c90-0b61-4175-952d-cc9444adbd08 | nniikon/Real-Gas-Simulation | source/engine/source/eng_atoms_list.cpp | // Check atoms_docpdf.pdf for a better understanding
#include "engine/eng_atoms_list.hpp"
#include <assert.h>
#include <stdlib.h>
#include <immintrin.h>
#include "logs/logs.hpp"
static FILE* gLogFile = nullptr;
static float GetRandomCoordinate();
static float GetRandomVelocity();
static glm::vec3 GetRandom... | TOOL | 0.943017 | 4.100537 | {
"github_metadata": {
"branch": "main",
"commit_count": 92,
"repo_created_at": "2024-03-18T18:53: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": "cbb3f2159f8... |
abbc4fea-460a-4ea3-b344-39eeabc22b8d | koth/elements-of-programming-interviews | 2-for-all.cpp | // Copyright (c) 2013 Elements of Programming Interviews. All rights reserved.
#include <algorithm>
#include <cassert>
#include <deque>
#include <iostream>
#include <limits>
#include <random>
#include <string>
#include <vector>
using std::boolalpha;
using std::cout;
using std::default_random_engine;
using std::deque;... | ALGO | 0.989892 | 5.667442 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2016-03-30T01:43:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17,
"forks": 14,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "243c78a... |
547982ba-bead-47bc-95a0-ca65a7f3e55b | GeorgeLyon/SwiftHDL | mlir/circt/lib/LogicalEquivalence/Circuit.cpp | //===-- Circuit.cpp - intermediate representation for circuits --*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | TOOL | 0.966905 | 3.83012 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-10-24T15:25:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "685d2cde0d2e... |
6f795016-c631-46b5-836f-0e720ec65821 | arenas7307979/face_sfm | src/ceres/line_projection_factor.cpp | #include "line_projection_factor.h"
LineProjectionFactor::LineProjectionFactor(const Eigen::Vector3d& spt_, const Eigen::Vector3d& ept_, double focal_length)
: spt(spt_), ept(ept_)
{
sqrt_info = Eigen::Matrix2d::Identity() * focal_length / 1.5f;
}
bool LineProjectionFactor::Evaluate(double const* const* param... | ALGO | 0.996941 | 6.327321 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-04-30T02:22: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": "ca0c026b95... |
2bbab109-1615-442a-b98a-9d9f2e30cea3 | ishandutta2007/codeforces-k | kizen/normal/1105/D.cpp | #include <bits/stdc++.h>
using namespace std;
int N, M, P;
int s[14];
int q[14][1000*1000+4][2], f[14], r[14];
char arr[1004][1004];
int cnt = 0, pos, last;
int far[1004][1004];
int wx[4] = {-1, 0, 1, 0}, wy[4] = {0, 1, 0, -1};
int main(){
scanf("%d %d %d", &N, &M, &P);
for(int i=1;i<=P;++i) scanf("%d", s+i)... | ALGO | 0.999847 | 3.652215 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06: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": "8081bb249cd8... |
ae79560e-6558-467f-b3d0-d9cfa8c65763 | badr-06/bardgit | Cpp/Algoritms_CPP_Sirius/Linear_algoritms/linear_algoritm_4.cpp | #include <iostream>
#include <vector>
int main() {
int n, k, m;
std::cin >> n >> k >> m;
int a[n];
for(int i = 0; i < n; ++i){
std::cin >> a[i];
}
int sum = 0;
int index = 0;
for(int i = 0; i < k + 1; ++i){
sum += a[i];
}
if(sum == m && k > 0 && n > k){
... | ALGO | 0.999992 | 4.502462 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2024-02-16T11:21: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": "e738556cb65... |
75614ebe-9507-4b27-b6b9-cff7f7c40d2d | akhmelenko/otus2 | main.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
// ("", '.') -> [""]
// ("11", '.') -> ["11"]
// ("..", '.') -> ["", "", ""]
// ("11.", '.') -> ["11", ""]
// (".11", '.') -> ["", "11"]
// ("11.22", '.') -> ["11", "... | ALGO | 0.991403 | 4.459571 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-01-16T17:57:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "266bb534fbd... |
9641b769-654a-4ca3-b7fd-ccff0233ce70 | rmboyle/Computer-Vision | HW4/p4.cpp | /*
<NAME>
rmb2189
p4.cpp
Computes the surface normals and albedo of object
*/
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <cstdlib>
#include "vision_utilities.h"
using namespace std;
Image imageStore[5];
//maps x y z value to a valid r g or b value
int map_rgb(float value... | ALGO | 0.996856 | 4.466165 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2012-01-03T17:05: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": "50e3052298... |
94d18ab6-ffd4-4435-9b83-4d1c0a17bc3b | wjin33/oofem-2.4 | src/oofemlib/mmaleastsquareprojection.h | /*
*
* ##### ##### ###### ###### ### ###
* ## ## ## ## ## ## ## ### ##
* ## ## ## ## #### #### ## # ##
* ## ## ## ## ## ## ## ##
* ## ## ## ## ## ## ## ##
* ... | ALGO | 0.997347 | 6.125082 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-08-31T04:08:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d1c28756f... |
269969ae-c634-4b5f-87b4-e83fdd268f87 | cshung/MiscLab | data_structures/cartesian_tree.cpp | #include "cartesian_tree.h"
#include <stack>
using namespace std;
cartesian_tree::cartesian_tree() : m_root(nullptr)
{
}
cartesian_tree::~cartesian_tree()
{
if (this->m_root != nullptr)
{
delete this->m_root;
}
}
cartesian_tree::cartesian_tree_node::cartesian_tree_node(int value, int priority) : ... | ALGO | 0.999771 | 4.870196 | {
"github_metadata": {
"branch": "main",
"commit_count": 413,
"repo_created_at": "2015-02-05T17:21: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": "79ef86ad9e... |
1907b310-397c-4fd0-a899-d154b99df551 | realSahilYadav/DSA_Skillup | maxoccurenceinstring.cpp | #include<iostream>
#include<string>
using namespace std;
int getMax(int arr[], int size)
{
int max = INT_MIN;
for (int i = 0; i < size; i++)
{
if(arr[i] > max)
{
max = i;
}
}
return max;
}
char getMaxOccChar(string s)
{
int arr[26] = {0};
for (int i = ... | ALGO | 0.999697 | 4.494373 | {
"github_metadata": {
"branch": "main",
"commit_count": 89,
"repo_created_at": "2024-09-01T07:31: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": "932e67d8960... |
acc5337d-e350-483a-9a1b-4ba3e10b66f4 | hfukuoka/atcoder | abc/240/f.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define v... | ALGO | 0.99994 | 3.803832 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2022-10-19T03:51: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": "507e77dd7bb... |
58070a85-6cc5-46d5-b032-b1abc8fe8432 | apaarkamal/miscellaneous-codes | chocolates and college.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define F first
#define S second
#define pb push_back
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_u... | ALGO | 0.999993 | 4.238678 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2019-06-29T13:05:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a9a96773... |
622b47d9-d360-4ceb-ba0e-40489dcbbced | Amitpatil215/DSA | 4_strive_videos/2_DP _playlist/4_problem_on_0-1_knapsack/21_target_sum_assign_sign.cpp | /*
Target Sum
venice 20
Problem Statement
You are given an array ‘ARR’ of ‘N’ integers and a target number, ‘TARGET’. Your
task is to build an expression out of an array by adding one of the symbols '+'
and '-' before each integer in an array, and then by concatenating all the
integers, you want to achieve a target. ... | ALGO | 0.999988 | 5.019635 | {
"github_metadata": {
"branch": "master",
"commit_count": 295,
"repo_created_at": "2021-04-17T08:02:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95f98d8e... |
17fc45ab-2059-47f1-b71d-d9998f786fc4 | xihuai18/data-structure | Select/LinearSelect.h | #ifndef __LINEARSELECT__
#define __LINEARSELECT__
#include "../Vector/Vector.h"
int const Q = 5;
template <typename T>
T trivialSelect(Vector<T> & A, Rank k)
{
A.sort(0, A.size());
return A[k];
}
template <typename T>
T linearSelect(Vector<T> & A, Rank k)
{
size_t n = A.size();
if(n < Q) return trivialSelect(A,... | ALGO | 0.999659 | 4.753098 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2017-07-13T13:47:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "54cacbfa1... |
c3ed1052-8a1e-45cd-9cb8-a8c732f81ef0 | miya930/competitive_programming | algorithm/00.AtCoder/00.ABC/07_351-400/ABC396B.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, fi, n) for (int i = fi; i < n; i++)
using ll = long long;
using pii = pair<int,int>;
constexpr int inf = 1001001001;
constexpr ll infl = 1LL << 62;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
template<class T> bool chmax(T &a, T b)... | ALGO | 0.999832 | 4.186967 | {
"github_metadata": {
"branch": "main",
"commit_count": 114,
"repo_created_at": "2021-04-18T01:17: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": "6b27b73e47... |
fcb3e6ba-0034-4962-8f9d-8e464bd413bb | Camithilwen/Code-Cloning-Analysis | src/llm-scripts/testing/Project_CodeNet_experimentation_dataset/data/p03032/s993538637.cpp | #include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;
signed main() {
int N, K;
cin >> N >> K;
vector<int> V(N);
for( int i = 0; i < N; i++ ) cin >> V.at(i);
int ans = 0;
for( in... | ALGO | 0.999945 | 4.200078 | {
"github_metadata": {
"branch": "main",
"commit_count": 243,
"repo_created_at": "2025-06-06T16:57:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b9d954122... |
cbf8c4c6-be00-4f95-a4d7-37afa66a06af | kewook55/PS-BOJ | Minimum_Spanning_Tree/9373-복도뚫기(MST).cpp | /*
처음에는 왜 MST 문제인지 몰랐었다.
하지만 모든 원과 벽에 부딪히지않고 통과하면 가능하다고 생각하면 이해가 된다.
따라서 벽과 각 센서를 노드로 생각하고 노드간 cost를 반지름을 제외한 센서간 거리로 칭한다.
그리고 노드를 통과하는 MST를 구성하면 부딪히지 않고 통과할수 있다.
MST를 구성할때 끝내는 조건을 왼쪽벽과 오른쪽 벽이 같은 집합일때 종료를 해주었는데
이는 굳이 모든 센서를 포함해야할 필요가 없기 때문이다.
=> 로직떠오릴때 센서와 벽사이의 간선을 구해준다고 생각했지 모든 센서를 포함해야 한다고 생각했다.
*/
#include<iostr... | ALGO | 0.999306 | 4.024569 | {
"github_metadata": {
"branch": "master",
"commit_count": 125,
"repo_created_at": "2020-05-28T06:31:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fa76465... |
cdbc735d-1245-4601-af78-8f67652b14c3 | KeranChen/Alphabetizer | Alphabetizer.cpp | #include <iostream>
#include <string>
#include <fstream>
#include "Alphabetizer.h"
#include "StringBST.cpp"
using namespace std;
/************************************Constructor******************************/
/*
Define one constructor for the Alphabetizer class. The default
constructor takes no parameter... | ALGO | 0.988492 | 4.644555 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-03-17T21:38: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": "7e104950ce... |
4f2507f2-7eb3-4cc6-befb-46f216d67f6c | ishandutta2007/codeforces-o | oleh1421/normal/1579/C.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less_equal<T>,rb_tree_tag... | ALGO | 0.99991 | 4.115087 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:45: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": "df7d3667070c... |
28474977-b023-4f3f-a221-67a33fe71f1e | manishmotwani2002/30dayschallenge | day 2(BST questions)/lowest common ancestor of BST.cpp | /************leetcode 235 ******************/
/*************** lowest common ancestor of BST(it is the node which is lowest and both the given nodes P and Q are it's descendants)**********/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
*... | ALGO | 0.999993 | 6.532895 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2021-01-06T18:20: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": "f07dc9b187c... |
3f2cf46d-51fa-4ce3-9e4f-3dc4e19c03fa | isopropylcyanide/Competitive-Programming | code-cpp/addOpFraction.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long unsigned ll;
//You are given two fractions: 0/1 and 1/2. In each step, you will get two adjacent fractions
// and you need to add them, if and only if, the denominator is equal to or smaller than the
//number obtained in that step and write it between t... | ALGO | 0.999916 | 3.90814 | {
"github_metadata": {
"branch": "master",
"commit_count": 179,
"repo_created_at": "2015-12-31T07:54:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a41156... |
d0375435-7d77-47dc-ac17-c129a306733d | rokMkiaz/Data_structure_and_Algorithm | SolvingProblems/숫자 카드 나누기.cpp | /*
* 숫자 카드 나누기
철수와 영희는 선생님으로부터 숫자가 하나씩 적힌 카드들을 절반씩 나눠서 가진 후,
다음 두 조건 중 하나를 만족하는 가장 큰 양의 정수 a의 값을 구하려고 합니다.
철수가 가진 카드들에 적힌 모든 숫자를 나눌 수 있고 영희가 가진 카드들에 적힌 모든 숫자들 중 하나도 나눌 수 없는 양의 정수 a
영희가 가진 카드들에 적힌 모든 숫자를 나눌 수 있고, 철수가 가진 카드들에 적힌 모든 숫자들 중 하나도 나눌 수 없는 양의 정수 a
예를 들어, 카드들에 10, 5, 20, 17이 적혀 있는 경우에 대해 생각해 봅시다.
만약, 철수가 [10, ... | ALGO | 0.999961 | 5.073061 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2022-10-24T05:44: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": "5aa882ebd... |
bc017f49-bc91-467e-b001-6fb3179f80d7 | openmm/openmm | plugins/amoeba/platforms/common/src/kernels/amoebaTorsionTorsionForce.cc | int2 torsionParams = TORSION_PARAMS[index];
real3 ba = make_real3(pos2.x-pos1.x, pos2.y-pos1.y, pos2.z-pos1.z);
real3 cb = make_real3(pos3.x-pos2.x, pos3.y-pos2.y, pos3.z-pos2.z);
real3 dc = make_real3(pos4.x-pos3.x, pos4.y-pos3.y, pos4.z-pos3.z);
real3 ed = make_real3(pos5.x-pos4.x, pos5.y-pos4.y, pos5.z-pos4.z);
#i... | ALGO | 0.999972 | 4.90658 | {
"github_metadata": {
"branch": "master",
"commit_count": 7207,
"repo_created_at": "2013-05-20T17:42:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1644,
"forks": 558,
"issues": 408,
"pull_requests": 22
},
"file_meta": {
"content_id": "... |
03d1f754-4009-4637-a5eb-ff83a2ec023d | Hunterdii/GeeksforGeeks-POTD | December 2024 GFG SOLUTION/December-11.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int nextGap(int gap) {
return (gap <= 1) ? 0 : (gap / 2) + (gap % 2);
}
void mergeArrays(vector<int>& a, vector<int>& b) {
int n = a.size(), m = b.size(), gap = n + m;
... | ALGO | 0.999965 | 6.097883 | {
"github_metadata": {
"branch": "main",
"commit_count": 3732,
"repo_created_at": "2024-03-09T09:48:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 202,
"forks": 54,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b7cc43... |
8d8997ca-9bea-4c9b-84ae-89b4e2657453 | xin201501/datastructurelab-2020-11-6 | include/calculatestudentscore.h | #pragma once
#include<initializer_list>
#include<string>
#include<exception>
#include<functional>
#include"linklist.h"
class StudentScore {
private:
LinkList<double> scores;
public:
StudentScore() = default;
StudentScore(std::initializer_list<double>scoreSet) {
for (const auto& x : scoreSet) {
... | ALGO | 0.972401 | 5.523588 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-11-17T16:06: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": "41f32219dc... |
242d475d-652c-4368-87b8-a522efcd26cf | SofyaSks/recursion | recursion/recursion.cpp | #include <iostream>
using namespace std;
int fact(int num) {
if (num <= 1)
return 1;
return num * fact(num - 1);
}
int fib(int num);
template <typename T> void bubble(T arr[], int length, bool type = false ) {
if (type) {
for (int i = length - 1; i > 0; i--)
for (int j = 0; j < i; j++)
if (arr[j] < arr... | ALGO | 0.996691 | 3.280552 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-02-17T16:25:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "62ad59fe3a... |
50722a7d-7ae7-47ff-9e8d-616f5462d782 | jose-dom/bitcoin_forecasting | env/lib/python3.9/site-packages/pystan/stan/lib/stan_math/stan/math/rev/mat/fun/determinant.hpp | #ifndef STAN_MATH_REV_MAT_FUN_DETERMINANT_HPP
#define STAN_MATH_REV_MAT_FUN_DETERMINANT_HPP
#include <stan/math/prim/mat/err/check_square.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/fun/typedefs.hpp>
#include <stan/math/rev/core.hpp>
#include <stan/math/rev/mat/fun/typedefs.hpp>
#incl... | ALGO | 0.999801 | 6.964939 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2021-01-04T01:45:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 12,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "c7a7272f... |
e02e4a8f-1703-4689-84ff-e60c1caf47b7 | JiayeJerryWang/Dynamic-DRAM-Controller | src/dram_controller/impl/scheduler/rl_scheduler.cpp | #include <vector>
#include <map>
#include <random>
#include <algorithm>
#include <iostream>
#include "base/base.h"
#include "dram_controller/controller.h"
#include "dram_controller/scheduler.h"
namespace Ramulator {
struct State {
std::vector<int> readRequests;
std::vector<int> writeRequests;
std::vector... | ALGO | 0.988999 | 6.252845 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-10-13T18:53:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "48f96b341b7e... |
81f96ea4-e00c-45df-97cc-cf0c63914ba6 | PrajwalHD58/competative_coding | Code Forces/Round#740/A_Simply_Strange_Sort.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,a,b) for(long long i=a;i<b;i++)
#define RREP(i,a,b) for(long long i=a;i>b;i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define popb pop_back
#define mp make_... | ALGO | 0.999888 | 3.800764 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-08-17T18:25: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": "901c676b0e... |
fa2c87b0-3144-4812-8ad5-75b494e3b265 | tiagomariinhoo/interview-studies | Problems/GoogleInterviewSite/BinarySearch/FirstAndLastPosition(LowerUpper).cpp | #include <bits/stdc++.h>
using namespace std;
//https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/submissions/
class Solution {
public:
int lowerBound(vector<int> nums, int target) {
int l = 0, r = nums.size() - 1;
while(l < r) {
int mid = (l +... | ALGO | 0.999966 | 6.164755 | {
"github_metadata": {
"branch": "master",
"commit_count": 68,
"repo_created_at": "2021-08-11T13:48: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": "8e9fca7df... |
8821d908-90f7-4b26-9d48-c65c19af5ae3 | ishandutta2007/codeforces-d | demoralizer/normal/1114/E.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.99983 | 3.18215 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:31: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": "f95269c92b94... |
cff91700-30d4-48f1-b6e5-17e4d0c4018f | SedadKamencic/Algorithms_in_Cpp | Algoritmi i strukture podataka/Stack/Implementacija_steka_iz_knjige.cpp |
#include <iostream>
#include <stdexcept>
template <typename InfoTip>
class iStek {
private:
void operator =(const iStek&); // Zaštita za dodjelu
iStek(const iStek&); // Zaštita za konstruktor kopije
public:
iStek() {} // Podrazumijevani konstruktor
virtual ~iStek() {} // Bazni destruktor
virtual void brisi() = 0... | TOOL | 0.906209 | 4.873838 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-03-18T21:15: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": "7d679139e4ba... |
c9fef3fb-fa24-4101-abe7-fdc391c57a6b | manoflearning/cp-codes | Baekjoon OJ/05000-05999/5014.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
int f, s, g, d[2];
int dist[(int)1e6... | ALGO | 0.999714 | 3.222311 | {
"github_metadata": {
"branch": "main",
"commit_count": 1899,
"repo_created_at": "2020-08-06T14:38: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": "bac2b45ec... |
21fec89d-7c5c-4d9a-95d2-09c4720a9f1b | LvKNnT/TemporalPathComputation | benchmark_code/AnnChann/foremost.h | #include "graphUtil.h"
#include <algorithm>
#include <vector>
using std::vector;
/*
Algorithm 1
Receives the number of nodes, the edges in stream presentation, the source x, and the time interval [ta, tw].
This will compute the foremost time+path from x to all other nodes in O(|V| + |E|)
Also repo... | ALGO | 0.999882 | 5.588456 | {
"github_metadata": {
"branch": "main",
"commit_count": 67,
"repo_created_at": "2025-03-24T05:11:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6c33717540... |
11b817f6-c2a9-4fc8-87ec-05c332bdf0ce | Anubhav12345678/competitive-programming | STOCKSPANPROBLEM.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#include<vector>
#include<stack>
vector<ll> solve(vector<ll> &v)
{
ll n = v.size();
vector<ll> a(n);
stack<ll> st;
st.push(0);
a[0]=1;
for(ll i=1;i<n;i++)
{
while(!st.empty()&&v[st.top()]<=v[i])
st.pop();
a[i] = (st.empty())?(i+1):(i-st.top... | ALGO | 0.999982 | 5.617003 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-11-18T08:04:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "19797b45c8... |
a62e568d-e096-46f8-8db6-6ce8060225da | mbachm/CarND-Extended-Kalman-Filter-Project | src/kalman_filter.cpp | #include "kalman_filter.h"
#include "tools.h"
using Eigen::MatrixXd;
using Eigen::VectorXd;
KalmanFilter::KalmanFilter() {}
KalmanFilter::~KalmanFilter() {}
void KalmanFilter::Init(VectorXd &x_in, MatrixXd &P_in, MatrixXd &F_in,
MatrixXd &H_in, MatrixXd &R_in, MatrixXd &Q_in) {
x_ = x_in;
... | ALGO | 0.990522 | 6.025486 | {
"github_metadata": {
"branch": "master",
"commit_count": 89,
"repo_created_at": "2017-07-08T17:54:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fefab7c49... |
d2ebc11f-f437-41e1-b647-db6f5be21d56 | thavananh/Giai_Bai_Tap_UpCoder_Colab | LuuCodeRacHaha/Template2.cpp | #include <iostream>
using namespace std;
struct PhanSo
{
int tu, mau;
public:
friend int ucln(PhanSo ps);
};
template <typename T>
struct Mang
{
int n;
T a[100];
T &operator[](int i)
{
return a[i];
}
public:
template <typename U>
friend U tinhtong(Mang<U... | ALGO | 0.950183 | 3.142205 | {
"github_metadata": {
"branch": "master",
"commit_count": 333,
"repo_created_at": "2022-11-07T14:58:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a68687f9... |
b5f2046b-8789-4ecd-bcec-b56f5edc1d22 | nis44/DSA | 678-valid-parenthesis-string/valid-parenthesis-string.cpp | class Solution {
public:
unordered_map<string, bool> dp;
bool solve(string &s, int cnt, int idx) {
if (cnt < 0) return false; // More ')' than '(' → invalid case
if (idx == s.size()) return cnt == 0; // Valid if balanced
string key = to_string(cnt) + "," + to_string(idx);
... | ALGO | 0.999532 | 5.539614 | {
"github_metadata": {
"branch": "main",
"commit_count": 480,
"repo_created_at": "2025-01-11T07:53:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1ef33df1a... |
181b513c-9750-4c56-bb53-f689673c99fa | harsh151023/data_structures | tree13/main.cpp | //diameter
#include <stdio.h>
#include<limits.h>
struct node {
int data;
struct node* left;
struct node* right;
};
int max(int a, int b)
{
return a>b?a: b;
}
/* Function to find height of a tree */
int height(struct node* root, int *ans)
{
if (!root)
return 0;
int left_height = height(ro... | ALGO | 0.999991 | 4.964378 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2020-04-06T13:18: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": "b749a639d... |
117106bf-290a-4a7a-88cc-ddc396b1a578 | Angel-Joven/EDD_2022 | 07OCT2021/Repaso/Repaso.cpp | //Clase 07 OCTUBRE 2021
//<NAME> <NAME>
#include <stdio.h>
int main()
{
int numeros[10];
int i = 0;
while (i < 10) {
numeros[i] = i + 1;
i = i + 1;
}
i = 0;
while (i < 10) {
printf("El elemento almacenado en la pocision %d es %d\n", i, numeros[i]);
i = i + 1;
... | ALGO | 0.996052 | 3.40678 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2021-09-20T14:27: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": "f5f2d9ecb27... |
f5cb7a22-b570-4ca6-80da-cc893f1f76e5 | kitheok/uni-tasks | Практика 3/Практика 3/Source.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
//2 вариант
void first() {
//Есть массив, в котором содержится случайные числа. Используя указатель вывести все числа по возрастанию.
//Помимо объявления и инициализации массива более он использоваться в программе не до... | ALGO | 0.999124 | 3.454009 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-05-16T13:00: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": "b0fcfd7c575... |
d2191fce-93e0-4c18-ba32-7e0d080f2743 | tusharbiswas10/competitive-programming | Palindrome Game (hard version).cpp | #include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define max2(a,b) ((a<b)?b:a)
#define max3(a,b,c) max2(max2(a,b),c)
#define min2(a,b) ((a>b)?b:a)
#define min3(a,b,c) min2(min2(a,b),c)
using namespace std;
bool p... | ALGO | 0.999954 | 3.686639 | {
"github_metadata": {
"branch": "main",
"commit_count": 110,
"repo_created_at": "2021-04-15T16:16:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "31eb9e4395... |
88bc6964-4180-479d-8242-db4170228a28 | wqrxssq/my_problems | real-fast-sort/ok.cpp | #include <iostream>
#include <vector>
#include <cstdint>
#include <math.h>
#include <chrono>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ... | ALGO | 0.999159 | 4.295954 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-12-18T18:46: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": "96e649aaf8a... |
5b6bc6a0-4954-4fc9-a961-509baa1c2554 | HEOJUNFO/codingtest | 프로그래머스/3/72413. 합승 택시 요금/합승 택시 요금.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
int solution(int n, int s, int a, int b, vector<vector<int>> fares) {
// 무한대값 정의
const int INF = numeric_limits<int>::max()/2;
// 거리 배열 초기화
vector<vector<int>> dist(n+1, vector<int>(n+1, INF));
for... | ALGO | 0.999833 | 5.297483 | {
"github_metadata": {
"branch": "main",
"commit_count": 243,
"repo_created_at": "2024-12-13T05:17: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": "21d501c301... |
145d1fe8-19fb-437e-aff8-bbb4547dc806 | subham-prasad-das/C-Plus-Plus | LinkedList/18_Reversing_a_SLL.cpp | // doing it iteratively
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this-> data = data;
this-> next = NULL;
}
};
void insertAtHead(Node* &head, int d){
Node* temp = new Node(d);
temp-> ne... | ALGO | 0.999987 | 5.33523 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-05-21T14:44: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": "9a173e30dc... |
beb9c36d-7a62-4495-96f7-9bd07c35d98d | ArthurJP/DataStructure_Algorithm | max2.cpp | //
// Created by Administrator on 2019/5/14.
//
#include "iostream"
using namespace std;
void max2with2loop(int A[], int lo, int hi, int &x1, int &x2) { //O(2n-3)
x1 = lo;
for (int i = lo + 1; i < hi; ++i) {
if (A[i] > A[x1]) x1 = i;
}
x2 = lo;
for (int i = lo + 1; i < x1; ++i) {
... | ALGO | 0.999991 | 4.471395 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2019-06-26T07:39: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": "14e1f5aa4d... |
e278541f-7549-4420-9689-f13a82d8bb92 | goodpaperman/effectstl | item46/03.cc | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <iterator>
#include <algorithm>
#include <functional>
#include <numeric>
#include <memory>
#include <sys/time.h>
#include "../hrtime.h"
usin... | ALGO | 0.996458 | 4.78751 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-06-01T04:41:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7efea1b349... |
0c7c983b-6b1f-4b0a-aec3-33134c431cb0 | Mahak008/Data-Structures-and-Algorithms | Binary Tree/Serialize and Deserialize Binary Tree.cpp | // Leetcode - 297
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
if (!root)
return "";
string ans = "";
queue<TreeNode*> q;
q.push(root);
while (!q.empty()) {
TreeNode* cur = q.front();
q.pop();
if (!cur) {
ans += "null,";
... | ALGO | 0.999762 | 6.318568 | {
"github_metadata": {
"branch": "main",
"commit_count": 1194,
"repo_created_at": "2023-07-14T04:18: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": "a601ea32c... |
074a7eaa-70dd-46c5-acc7-74ec5e5b3e84 | Shamoyja/Autonomous_Beacon_Following_Robot | SonicSensors/sonic/sonic.ino | #include <TimerOne.h>
const int pw_pin_right = 30;
const int pw_pin_left = 32;
const int pw_pin_front = 31;
const int interrupt_pin = 19;
const int direction_pin = 18;
bool LeftRed = false;
bool LeftBlue = false;
bool LeftGreen = false;
bool RightRed = false;
bool RightBlue = false;
bool RightGreen = false;
bo... | TOOL | 0.931951 | 5.177148 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-06-03T19:19: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": "913689900ba7... |
281612e8-ede0-4f40-9245-477e222faba9 | ishandutta2007/codeforces-w | wild_hamster/normal/510/A.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <time.h>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#define mp make_pair
#define pb push_back
#define PI 3.14159265358979323846
#define MOD 1000000007
typedef... | ALGO | 0.999772 | 3.245653 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:34:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d84e02851b4a... |
d87bfc8b-ac66-4229-91c6-7d2c8ba8db52 | usunyu/my-awesome-projects | MagicLeap/HelloCube/Assets/MagicLeap/BackgroundMusicExample/Utility.cpp | // %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
//
// Copyright (c) 2019 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Creator Agreement, located
// here: https://id.magicleap.com/creator-terms
//
// %COPYRIGHT_END%
// ------... | TOOL | 0.94146 | 6.903358 | {
"github_metadata": {
"branch": "main",
"commit_count": 817,
"repo_created_at": "2014-01-19T23:44:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 69,
"forks": 38,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "42391a19... |
0c4b1a11-dd4e-4d5c-ae97-d5b6a0946539 | TreceyJueves/similarity-clustering | models/similarity-clustering10.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn=100000;
const int LIMIT_W=2000;
#define long long long
/* input files */
char *graphFile;
char *weightFile;
vector<int> e[maxn]; // 正向边,从父亲指向儿子
vector<int> re[maxn]; // 反向边
vector<int> neighbor[maxn]; // 距离不超过K的邻居
vector<int> successor[maxn];
vector<int>... | ALGO | 0.999857 | 3.393521 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2020-05-26T14:07: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": "c57081474... |
e6716183-7922-43bd-8ad6-9915e00889aa | bin-umar/Algorithms | module1/task2.cpp | //
// Created by jahongir on 17/10/18.
//
#include <iostream>
#include <cmath>
/**
*Дан отсортированный массив различных целых чисел A[0..n-1] и массив целых чисел B[0..m-1].
*Для каждого элемента массива B[i] найдите минимальный индекс элемента массива A[k],
* ближайшего по значению к B[i]. n ≤ 110000, m ≤ 1000.
... | ALGO | 0.999975 | 4.863713 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-02-26T23:20:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9e8b63a61... |
78935d6d-5db6-4c75-8088-03e677bd95f4 | ejhusom/FYS3150 | project5/src/main.cpp | #include "PDEsolver.h"
#include "PDEsolver2D.h"
#include "HeatEquation.h"
using namespace std;
int main(int argc, char *argv[]){
double method = 1;
int N = 100;
double dt = 0.001;
double Time = 0.03;
int dimension = 3;
int slab = 1;
int radioactive = 1;
switch (argc) {
case 6: dimension = atoi(a... | ALGO | 0.999619 | 3.967813 | {
"github_metadata": {
"branch": "master",
"commit_count": 226,
"repo_created_at": "2018-08-23T08:23:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "edefa463... |
fb6c7b99-17a3-495a-a83c-d2e7cb712032 | ataeesaeed/fum-computer | ساختمان داده/ضرب کننده چندجمله ای/Source.cpp | #include <iostream>
using namespace std;
class sentence{
public:
int coef;
int expo;
sentence *next;
};
class poly{
public:
poly();
void add( int ,int );
sentence *head;
void print();
};
poly::poly(){
head = new sentence;
head->coef = 0;
head->expo = 0;
head->next = NULL;
};
void poly::add(int c, int e)... | ALGO | 0.998629 | 3.870897 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2018-02-19T07:00: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": "3ff8fd479... |
4965eb11-4a31-4efe-b6f9-d84267670b58 | ShisuiMadara/450DSA | templeRunXor.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD= 1000000007;
void solve()
{
int n,L,q;
cin>>n>>L>>q;
vector<int>arr(n);
for(auto&c:arr)
{
cin>>c;
}
//s,r,c
while(q--)
{
string s;
cin>>s;
if(s == "start")
... | ALGO | 0.999897 | 4.208119 | {
"github_metadata": {
"branch": "main",
"commit_count": 163,
"repo_created_at": "2022-06-08T17:30: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": "ad60fdf954... |
90c06493-fe4d-4335-88de-5f4ddee82346 | ishandutta2007/codeforces-s | sohsoh/normal/949/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl ... | ALGO | 0.999478 | 3.680709 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2fe9fa589ec... |
bc70dab3-2620-4509-8de5-6acc110d1a8b | Sumu154/Codeforces_solution | 1986B-Matrix Stabilization/solution.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define Faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll INF = 1e18;
const ll MOD = 1e9+7;
const int N = 2e5+5;
//*-------------------------*//
int countSqrt(int l, int r){
ll m = ceil(sqrt(l));
... | ALGO | 0.999924 | 3.604932 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-06-24T19:11:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96c3db228ac... |
d71e8850-64f1-484c-b3bb-cb69ae422389 | Rakesh-Visave/DSA-Practice_Problem | Tree/Binary_Search_Tree/Floor-in-BST.cpp | // GFG -- Floor in BST
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *right;
Node *left;
Node(int x) {
data = x;
right = NULL;
left = NULL;
}
};
int floor(Node* root, int x) {
int floorValue = -1;
while (root != NULL)... | ALGO | 0.999998 | 4.807374 | {
"github_metadata": {
"branch": "master",
"commit_count": 224,
"repo_created_at": "2023-06-29T19:51: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": "0b627a22... |
e72f4f9e-44c8-4192-9064-cbb55883136b | backupaccount0/leetcode_practice_personal | 206.reverse-linked-list.cpp | // @before-stub-for-debug-begin
#include <string>
#include <vector>
#include "commoncppproblem206.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode id=206 lang=cpp
*
* [206] Reverse Linked List
*
* https://leetcode.com/problems/reverse-linked-list/description/
*
* algorithms
* Easy (... | ALGO | 0.999682 | 6.560948 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2023-01-27T03:34: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": "760332b4e1... |
5d78deaf-e83d-4157-b001-fa6f40d8904f | leggedrobotics/ocs2 | ocs2_robotic_examples/ocs2_legged_robot/src/gait/LegLogic.cpp | /******************************************************************************
Copyright (c) 2021, <NAME>. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain ... | ALGO | 0.991645 | 6.695127 | {
"github_metadata": {
"branch": "main",
"commit_count": 7465,
"repo_created_at": "2021-07-08T07:09:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1106,
"forks": 258,
"issues": 50,
"pull_requests": 3
},
"file_meta": {
"content_id": "e245... |
842c38c9-e231-4a3e-b4a1-cc117c72cbde | sujansarkar69/Algorithm | Online judges problem solving/codeforces/Edu problem/Segment with Small Sum.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n, k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
long long int sum = 0, ans = 0, l = 0, r = 0;
while (r < n)
{
sum += v[r];
if (sum <= k)
{
... | ALGO | 0.99999 | 4.414672 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2023-03-09T14:30:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2efa6731... |
f408c98b-f29c-488b-aa23-9c382dec5e5e | flapy/Codemonk-Series-2016-2017 | Trees/Monk and Tree Counting.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> successors;
int arr[504];
void findSuccessors(vector<int> children[505],int u)
{
// cout << u << " " ;
successors.push_back(u);
vector<int> :: iterator itr;
for (itr = children[u].begin(); itr != children[u].end(); itr++)
{
findSuccessors(children,*itr);... | ALGO | 0.999874 | 3.936233 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2016-12-22T08:52: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": "703df56a0... |
54615b8c-16e0-4399-b84a-c19cab7fe641 | KanZhang23/Tmass | src/npstat-4.9.0/npstat/nm/FejerQuadrature.hh | #ifndef NPSTAT_FEJERQUADRATURE_HH_
#define NPSTAT_FEJERQUADRATURE_HH_
/*!
// \file FejerQuadrature.hh
//
// \brief Fejer quadratures in long double precision
//
// Author: <NAME>
//
// July 2018
*/
#include <vector>
#include <utility>
#include "npstat/nm/SimpleFunctors.hh"
namespace npstat {
/**
// Fejer q... | ALGO | 0.997044 | 6.287017 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2019-06-04T20:52: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": "d4d9ae667b... |
31f7c0e4-5c56-436e-a65a-0e692afb0c4b | linkumokunn/code_la | TIOJ/1424.cpp | /*
=============================================================================
/\ \ / /\ |\ /| |===========
/ \ \ / / \ | \ / | |
/ \ \ / / \ | \ / | |
/ \ | / \ | \... | ALGO | 0.999966 | 3.834471 | {
"github_metadata": {
"branch": "main",
"commit_count": 104,
"repo_created_at": "2021-11-23T02:23:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dcb6c5de02... |
35187c3a-3e4c-4102-a897-0837795336e6 | pradeeptosarkar/LeetCode | LeetCode/problems/valid_sudoku/solution.cpp | class Solution {
public:
bool findrow(vector<char> board){
bool checknum[10]={0,};
for(int i = 0 ; i < 9;++i){
if(board[i] =='.')continue;
if(checknum[board[i]-'0']) return false;
checknum[board[i]-'0']= true;
}
return true;
}
bool findcol(... | ALGO | 0.999454 | 6.237103 | {
"github_metadata": {
"branch": "main",
"commit_count": 1504,
"repo_created_at": "2022-06-24T05:02:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4d8cb913e... |
df9b19cf-a185-4dfa-94e0-eed7d821f523 | yunjn/algorithms | linear_list/link/link_list.hpp | #ifndef SINGLE_LIST
#define SINGLE_LIST
#include <iostream>
/*数据域类型*/
typedef int Data;
typedef struct Node {
Data data{0};
struct Node *next{nullptr};
} LNode, *LinkList;
//产生空节点
LinkList InitList() {
LinkList new_node = new LNode;
new_node->data = 0;
new_node->next = nullptr;
return new_node;
}
//产生非空... | ALGO | 0.996156 | 4.921059 | {
"github_metadata": {
"branch": "data-structures",
"commit_count": 2,
"repo_created_at": "2020-10-14T16:38:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7... |
6739a58f-150a-4c7f-9837-795b1d49add0 | Tasneem205/ICPC-Assuit-Sheets-Solution | newcomers/Sheet #10 (General Hard)/O. Help Koko.cpp | #include <iostream>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <map>
#include <iomanip>
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
bool isPrime(int n) {
if (n == 1)
return false;
for ... | ALGO | 0.999887 | 3.883632 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2025-05-16T15:27: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": "f973dbf69a3... |
b09ab059-0de9-4062-bd28-b425dd8647aa | masterace007/codeforces_harwest | codeforces/1330/A.cpp | //
// Created by smoking_ace on 06-01-2021.
//
#include "bits/stdc++.h"
#define endl '\n'
#define pi 3.141592653590
#define pb push_back
#define mod 1000000007
#define int long long int
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<" : "<<x<<"\n";
#ifndef ONLINE_J... | ALGO | 0.999984 | 4.905741 | {
"github_metadata": {
"branch": "master",
"commit_count": 827,
"repo_created_at": "2021-01-16T12:40:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1ba9fbe... |
257446d6-b881-4215-a7d4-889d9310ae91 | SergioWltterRom/ArduinoAprendizaje | Arduino/Motor_12V_Driver/Motor_12V_Driver.ino | #define ENA 6
#define ENB 5
#define IN1 7
#define IN2 8
#define IN3 2
#define IN4 4
unsigned long tiempo1;
unsigned long tiempo2;
bool direccion1=LOW;
bool direccion2=LOW;
bool acelera1=LOW;
bool acelera2=LOW;
void setup() {
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT... | ALGO | 0.993666 | 4.40444 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2021-06-27T15:31: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": "6e6d576cd... |
1919c3e8-1db6-4450-8a5e-8ed42c260797 | arangodb/arangodb | 3rdParty/boost/1.78.0/boost/gil/image_processing/numeric.hpp | //
// Copyright 2019 <NAME> <<EMAIL>>
//
// 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)
//
#ifndef BOOST_GIL_IMAGE_PROCESSING_NUMERIC_HPP
#define BOOST_GIL_IMAGE_PROCESSING_NUMERI... | ALGO | 0.984998 | 7.214848 | {
"github_metadata": {
"branch": "devel",
"commit_count": 51986,
"repo_created_at": "2011-10-26T06:42:00.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 13878,
"forks": 857,
"issues": 743,
"pull_requests": 38
},
"file_meta": {
"content_id": ... |
6514de81-cd2f-41cc-ac44-0309b90de061 | erswatantra2001/ExponentialSarch-DSA | main.cpp | #include <bits/stdc++.h>
using namespace std;
int binarySearch(int arr[],int lb,int ub,int key){
int low = lb;
int high = ub-1;
while(low <= high){
int mid = (low+high)/2;
if(arr[mid] == key){
return mid;
}
else if(arr[mid] < key){
high++;
}
else{
low--;
}
}
}
i... | ALGO | 0.999971 | 5.395422 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-11-07T03:44:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bdb5d1fb8d7... |
c6257e38-7de7-46af-aa81-aebf5043c696 | tirupatihemanth/codewars | src/contests/codeforces/cf306div2/preparingOlympiad.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <map>
#include <set>
#include <iomanip>
#include <climits>
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).b... | ALGO | 0.999735 | 4.333722 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2015-05-13T06:25:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab8aec9265... |
ed07354a-5a0c-4a70-bc0b-42676956b4ba | Jeffrin2005/Dynamic_Programming | (RECURSION)Longest Palindromic Substring.cpp | class Solution {
private:
vector<vector<int>>dp;
//check if s[i...j] is a palindrome
bool isPalindrome(string& s, int i, int j){
if (i > j) return false;
if (i == j) return true;
if (s[i] != s[j]) return false;
// aa , i = 0, j = 1
if (j - i == 1) return true;
... | ALGO | 0.999966 | 5.947311 | {
"github_metadata": {
"branch": "main",
"commit_count": 204,
"repo_created_at": "2023-11-24T06:26:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8baa08bdfe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.