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 |
|---|---|---|---|---|---|---|---|
7c74d049-9d32-45d3-b29f-e1a17524b667 | kebugcheckex/Vivid | Vivid/GzMatrix.h | /*
File name: GzMatrix.h
Description: Definition of a 4x4 matrix. This class implements a 4x4 matrix data structure
and its operations with vectors and other matrices.
Created by: <NAME> (<EMAIL>)
Created on: 2015-03-05
*/
#pragma once
#include "GzVector.h"
typedef enum tagMatrixType
{
MATRIX_ZEROS,
MATR... | TOOL | 0.902304 | 4.949291 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2015-01-16T06:01: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": "b669115bd... |
2193a5bf-e62e-4a3f-8c36-73473f1b68a5 | nature1216/PS | BOJ/b7432.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node {
map<string, Node*> child;
void addNode(vector<string> v, int idx) { // 문자열 벡터의 idx번째 단어 add
if(idx == v.size()) return;
auto iter = child.find(v[idx]);
if(iter != child.end()) { // 현재 노드의 child map에 add하려는 단어가 있으면
iter->second->addNode(v, idx+1)... | ALGO | 0.999376 | 4.697008 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2020-08-01T14:50: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": "b9ffd4bdc... |
9213ec55-e8d0-4c82-b102-27246bf5d2b5 | B-Timok/Fall21 | minesweeper/pa08b.cpp | /// @file pa08b.cpp
/// @author <NAME>
/// @date 11/30/2021
/// @brief labels a minesweeper grid with corresponding numbers that touch each bomb.
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <cmath>
using namespace std;
const int max_size = 102;
void print_bombs(char table[ma... | ALGO | 0.995652 | 4.616951 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-04-06T06:41: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": "b528a74ee28f... |
f98f904a-bbd6-4409-9af8-60c41e9223fd | Kobakat/Algorithms | src/Sorting/Heap.cpp | #include "Common.h"
template<typename T, class Predicate>
void Heapify(std::vector<T>& collection, const Predicate& predicate, int i)
{
int max = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < collection.size() && predicate(collection[max], collection[l]))
{
max = l;
}
if (r < c... | ALGO | 0.999647 | 5.827631 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2021-09-15T20:56: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": "472629473... |
e9546fd9-0602-4b2a-a163-8f57629edd8c | Zara-sk/OPP | rgr/shurigina/main.cpp | #include "main.h"
void init_graph(Graph *graph, int nodes_count, double fullness) {
graph->matrix = (Matrix)malloc(sizeof(int*) * nodes_count);
for (int i = 0; i < nodes_count; i++) {
graph->matrix[i] = (int*)malloc(sizeof(int) * nodes_count);
for (int j = 0; j < nodes_count; j++) {
graph->matrix[i]... | ALGO | 0.999309 | 4.054168 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-03-02T13:35:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3d60a84d89b... |
9ab59208-018d-42a8-950b-664efed0f771 | MohamedIrfanAM/cp | codechef/Starters74/Facebook.cpp | // time-limit: 1000
// problem-url: https://www.codechef.com/START74D/problems/FACEBOOK
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tst;
cin >> tst;
while(tst--)
{
int n;
cin >> n;
vector<pair<int,int>>a;
vector<int> b;
for(int i = 0... | ALGO | 0.999991 | 4.077713 | {
"github_metadata": {
"branch": "master",
"commit_count": 235,
"repo_created_at": "2021-04-07T16:17: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": "76260043... |
0f9e94e0-0894-486a-ba35-15a8eecc54d2 | ShubhamKapil04/Placement | Dynamic Programing/KnapSackProbMemo.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int SolveMemo(vector<int> &weight, vector<int> &val, int index, int maxWeight, vector<vector<int> >&dp){
// if(index == 0){
// if(weight[0] <= maxWeight)
// return val[0];
// else return 0;
// }
// if(dp[index][... | ALGO | 0.999987 | 4.655484 | {
"github_metadata": {
"branch": "master",
"commit_count": 423,
"repo_created_at": "2022-02-10T20:58:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e03758c9... |
496eb274-6eb8-4150-8cf1-6c6225056b66 | freedomDR/coding | nowcoder/108038E.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >> t;
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
while(t--) {
int n, m; cin >> n >> m;
vector<string> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
vector<int> row_one(n), c... | ALGO | 0.999483 | 4.708722 | {
"github_metadata": {
"branch": "master",
"commit_count": 327,
"repo_created_at": "2019-04-25T10:44:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efbb1aaa... |
c13a2f28-274b-4a8f-a9e5-e2e39c069c17 | sammiiT/leetcode | LinkedList/82 Remove Duplicates from Sorted List II.cpp | //===類似題===
83. Remove Duplicates from Sorted List
More challenges
1836. Remove Duplicates From an Unsorted Linked List
//===思路===
(*)如果有發生重複的節點
f r t r->val==t->val f r t->next
hdr O O O O O x =============> hdr O % O O O x
\---/
... | ALGO | 0.999945 | 4.930055 | {
"github_metadata": {
"branch": "master",
"commit_count": 1345,
"repo_created_at": "2019-11-02T04:35: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": "2766f65... |
b04fa423-6811-44a2-923f-a8ae91f11bfe | zhngjn/cpp_code | algo/include/union/weighted_union.h | #ifndef UNION_WEIGHTED_UNION_H_
#define UNION_WEIGHTED_UNION_H_
#include <vector>
#include <climits>
#include <unordered_map>
#include <algorithm>
#include "boost/optional.hpp"
namespace algo
{
namespace disjoint_set
{
template <typename T, typename Weight>
class WeightedDisjointSet
{
public:
using SetID = std:... | ALGO | 0.999472 | 6.575497 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2021-12-05T02:46: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": "5f92a1e2b... |
f2e43517-8dd7-4e92-acc8-b57f22b20ec8 | csehydrogen/algorithm | hopcroft_karp.cpp | #include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct HK {
int n, m, dd;
vector<vector<int> > g;
vector<int> xy, yx, d;
HK(int n, int m) : n(n), m(m), g(n), xy(n), yx(m), d(n) {}
bool bfs() {
queue<int> q;
for(int x = 0; x < n; ++x)... | ALGO | 0.999969 | 3.953658 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2015-09-23T16:06:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "33ca1d3b... |
f8ae6ca6-d171-4d97-bdfc-d5bf7aa3eb5d | BlinkingStar7/Problem_Solving | Study/CP3/ch2/11926.cc | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
using namespace std;
#define PI 2*acos(0.0)
#defin... | ALGO | 0.999841 | 3.624602 | {
"github_metadata": {
"branch": "master",
"commit_count": 50,
"repo_created_at": "2016-02-09T11:46: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": "d04646660... |
543ea186-919d-46bf-b2f9-3f1b0aad92f0 | Gartosz/Alghoritms_and_data_structures | Lista_5/z8.cpp | #include <iostream>
#include <vector>
#include <cassert>
struct lnode
{
int key;
lnode *next;
lnode(int k,lnode* n=nullptr):key(k),next(n){}
lnode(std::vector<int> list, lnode* n=nullptr)
{
if (list.empty())
std::logic_error("Vector cannot be empty.");
key = list[0];
... | ALGO | 0.999825 | 5.265734 | {
"github_metadata": {
"branch": "main",
"commit_count": 89,
"repo_created_at": "2023-03-02T22:31: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": "f5b775de243... |
e5f233c6-1797-474a-9f39-7a8b88c583bb | aajjbb/contest-files | UVA/GCDLCM.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <memory>
#include <iomanip>
#include <numeric>
#include <functional>
#include <new>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdl... | ALGO | 0.999535 | 3.789048 | {
"github_metadata": {
"branch": "master",
"commit_count": 892,
"repo_created_at": "2016-03-02T13:05:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "75b4d46f... |
8e5a59de-7416-4c74-82ca-26468c52f7ba | AliOsm/CompetitiveProgramming | CodeForces/133E. Logo Turtle.cpp | #include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
using namespace std;
char s[101];
int n, m, dp[101][101][101][51];
int rec(int idx, int a, int b, int cnt, int add, char lst) {
if(idx == m)
return cnt == n ? max(a, b) : -1e9;
if(cnt > n)
return -1e9;
int &ret = dp[idx][a][b][c... | ALGO | 0.999983 | 3.523 | {
"github_metadata": {
"branch": "master",
"commit_count": 595,
"repo_created_at": "2016-10-14T11:29:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 138,
"forks": 49,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee344... |
873b1458-3211-40a9-913d-2c4139271457 | GENHEN/ComputerScienceClasses | Class1/HW7/hw7.cpp | /*
File Name: hw7.cpp
Author: genhen
Description: Create a BinaryInteger class that mimics the way integers are stored in a computer,
but which represents negative numbers in the `sign and magnitude' form (i.e., the
binary representation for -19 would be the same as 19 but with the signed bit ... | ALGO | 0.995916 | 5.94691 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2017-04-02T04:18: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": "8f7632879... |
8f174cca-5e9d-4d3d-8ad2-5ab2a66e3988 | smilingpoplar/coding-practice | leetcode/game-of-life.cpp | //
// game-of-life
// https://leetcode.com/problems/game-of-life/
//
// Copyright (c) 2015 YangLe. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
// inplace:board[r][c]用第0位表示当前状态,第1位表示下一状态
... | ALGO | 0.997647 | 6.593448 | {
"github_metadata": {
"branch": "main",
"commit_count": 2130,
"repo_created_at": "2015-04-29T04:29: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": "1caab5c88... |
0d663bcd-e12e-4fd5-9ab1-46b33172b67a | Roberto09/Competitive-Programming-Training | Problemas Codeforces/Nastya Is Playing Computer Games.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef vector<ii> vii;
typedef vector<pair<ii, ll>> viii;
#define FOR(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define ROF(i, a, b) for(ll i=ll(a); i>=ll(b); i--)
#define pb pus... | ALGO | 0.999736 | 3.279634 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-08-17T13:40: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": "cd1e5142a5... |
9dd01a96-48cf-45eb-a349-ae5b9e3dbc4e | Ereh11/CompetitiveProgramming | STL/1302. Deepest Leaves Sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999994 | 5.78433 | {
"github_metadata": {
"branch": "main",
"commit_count": 444,
"repo_created_at": "2022-01-02T09:20:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1726d4a91e... |
e0e80929-5f66-494d-9428-7768b81268e1 | ebertolazzi/G1fitting | src/Triangle2D.cc | /*
* Triangle-Triangle Overlap Test Routines
* July, 2002
* Updated December 2003
*
* This file contains C implementation of algorithms for
* performing two and three-dimensional triangle-triangle intersection test
* The algorithms and underlying theory are described in
*
* "Fast and Robust Triangle-Tria... | ALGO | 0.998921 | 7.194971 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2014-05-13T10:11:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 65,
"forks": 20,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee358a7... |
a2ae2e3c-46fc-488c-9ab9-c94735ba60ef | schambon77/CarND-Unscented-Kalman-Filter | src/ukf.cpp | #include "ukf.h"
#include "Eigen/Dense"
#include <iostream>
using namespace std;
using Eigen::MatrixXd;
using Eigen::VectorXd;
using std::vector;
/**
* Initializes Unscented Kalman filter
* This is scaffolding, do not modify
*/
UKF::UKF() {
// if this is false, laser measurements will be ignored (except during i... | ALGO | 0.941079 | 5.889931 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2017-11-27T02:22: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": "cb9cff067... |
98cb9083-ea7e-4e3f-a5be-2cb04bf8eb34 | micmacIGN/micmac | src/uti_phgrm/TiePHistorical/cInterEp_VisuTiePtIn3D.cpp | #include "TiePHistorical.h"
void Write3DCoor(std::string aNameSaveL, std::vector<Pt3dr> Pt3dL)
{
FILE * fpOutput = fopen((aNameSaveL).c_str(), "w");
for(unsigned int i=0; i<Pt3dL.size(); i++)
{
fprintf(fpOutput, "%lf %lf %lf\n", Pt3dL[i].x, Pt3dL[i].y, Pt3dL[i].z);
}
fclose(fpOutput);
}
i... | TOOL | 0.930829 | 3.701557 | {
"github_metadata": {
"branch": "master",
"commit_count": 10879,
"repo_created_at": "2016-11-24T22:09:54.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 785,
"forks": 163,
"issues": 83,
"pull_requests": 30
},
"file_meta": {
"content_id": "d... |
af518e8a-84ca-4716-babd-c0b6f82ee0f7 | Mr-Seoul/Kattis_Problems | Lyklagangriti.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
char c;
Node* previous;
Node* next;
};
typedef Node *LinkedList;
LinkedList answer = NULL;
LinkedList strToLinkedList(string s) {
LinkedList result = nullptr;
result = new Node{'!', nullptr, nullptr};
Node *prev = result;
Node ... | ALGO | 0.999985 | 4.468619 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2024-10-15T02:15: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": "ea46b5095df... |
03e1cd6c-fbd5-4a86-ad72-5f52dcb42148 | vladshablinsky/algo | 1592/d_euler.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
const int MAXN = 1005;
vector<int> g[MAXN];
vector<int> euler_traversal;
void dfs(int v, int p) {
euler_traversal.push_back(v);
for (auto to: g[v]) {
if (to != p) {
dfs(to, v);
euler_t... | ALGO | 0.999915 | 3.287632 | {
"github_metadata": {
"branch": "master",
"commit_count": 425,
"repo_created_at": "2021-10-22T06:45: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": "03efb840... |
a16e55b0-49f5-496f-be8c-00228fa0f1ad | mfem/mfem | examples/petsc/ex11p.cpp | // MFEM Example 11 - Parallel Version
// PETSc Modification
//
// Compile with: make ex11p
//
// Sample runs: mpirun -np 4 ex11p -m ../../data/star.mesh
// mpirun -np 4 ex11p -m ../../data/star.mesh --slepcopts rc_ex11p_lobpcg
// mpirun -np... | ALGO | 0.974879 | 5.749069 | {
"github_metadata": {
"branch": "master",
"commit_count": 24273,
"repo_created_at": "2015-06-11T21:42:21.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1934,
"forks": 544,
"issues": 96,
"pull_requests": 189
},
"file_meta": {
"content_id": ... |
ff30a7b5-cd5b-4a93-8ffc-9c9e28768853 | SuaceFace/Snake-Project | SnakeLinkedList.cpp | #include <string>
#include "SnakeLinkedList.h"
#include <iostream>
#include <sstream>
using namespace std;
using namespace std;
string SnakeListNode::toString() const {
stringstream ss;
ss << "(row = " << _row << ", col = " << _col << ')';
return ss.str();
}
SnakeLinkedList::~SnakeLinkedList() {
Sna... | TOOL | 0.931611 | 4.519824 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-03-04T18:59: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": "8cfbb4354c06... |
4c7f1cd5-de8f-4994-8f2b-b7b7cc9670e5 | wqrqwerqrw/acm_code | contest/wannafly2020/day6/13.cpp | // Wqr_
// acme : 20/01/17
#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
#define int long long
using namespace std;
int n, m, w;
const int N = 100 + 10;
const int inf = 998244353;
set<int> ac[12], wa[12];
int ans[N];
int watijiao[N][12];
int k[N][12];
signed main() {
#ifdef Wqr_
freopen("in.txt", "... | ALGO | 0.999885 | 4.192659 | {
"github_metadata": {
"branch": "master",
"commit_count": 109,
"repo_created_at": "2019-03-28T10:09:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1c0d675a... |
4333e60a-f05f-4d7d-8663-e5cfc880bee5 | memset0/vjudge-code | CodeForces/1425D/27487072_AC_93ms_15844kB.cpp | // Author -- xyr2005
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long l... | ALGO | 0.999741 | 3.504989 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2020-11-05T04:40:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "81e910032... |
4eec5c14-467e-4af1-90aa-539f9262cb97 | dimyvi/algorithms | c++/binary_search.cpp | #include <iostream>
using namespace std;
int binary_search(int arr[], int size, int num){
int low = 0;
int high = size - 1;
while (low <= high){
int mid = (low + high)/2;
int gess = arr[mid];
if (gess == num){
return mid;
}
if (gess > num){
... | ALGO | 0.999777 | 4.349832 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2025-06-27T12:47: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": "558165a5f4ae... |
51ee88ff-5177-4330-bbef-b86f0399d39a | shihaoz/leetcode_problems | rod_cutting.cpp | //
// rod_cutting.cpp
// leetcode2016
//
// Created by <NAME> on 9/16/16.
// Copyright © 2016 <NAME>. All rights reserved.
//
#include "rod_cutting.hpp"
class Solution{
public:
int rodCut(int length, vector<pair<int, int>> prices);
};
int Solution::rodCut(int length, vector<pair<int, int>> prices){
i... | ALGO | 0.999042 | 5.046937 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2016-09-10T20:36: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": "f55c22f55... |
348db952-994e-412f-899f-218c63eae883 | Mohammed-eid35/Problem-Solving | kattis/Increasing Subsequence.cpp | //:::: Alien :::://
// <NAME> //
#include <bits/stdc++.h>
using namespace std;
void Mo35() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
typedef vector<int> vi;
int n;
int ar[205], mem[205][205];
map<int, vi> mp;
vector<vi> vc;
int dp(int idx, int pre) {
if(idx == n) retu... | ALGO | 0.999979 | 3.764269 | {
"github_metadata": {
"branch": "main",
"commit_count": 473,
"repo_created_at": "2021-01-25T23:14:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "517380c4f3... |
8bcf3b01-7732-40ec-a77e-ab1c0d477e3e | jordifierro/uva | solutions/119.cc | #include <iostream>
#include <sstream>
#include <vector>
#include <map>
using namespace std;
int main() {
bool firstcase = true;
string line;
while (getline(cin, line)) {
istringstream ss(line);
int n;
ss >> n;
vector<string> v(n);
getline(cin, line);
ss... | ALGO | 0.996858 | 3.79927 | {
"github_metadata": {
"branch": "master",
"commit_count": 115,
"repo_created_at": "2015-12-17T17:18:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e66cd87... |
190c855c-8c6e-4169-9d7b-1c8b95fadd4c | cueltschey/5G_dynamic_compression | lib/srsvec/convolution.cpp |
/*
*
* Copyright 2021-2024 Software Radio Systems Limited
*
* This file is part of srsRAN.
*
* srsRAN is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at ... | ALGO | 0.999086 | 6.486507 | {
"github_metadata": {
"branch": "main",
"commit_count": 64,
"repo_created_at": "2024-10-05T22:54: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": "4ac3bb99ab8... |
358e827d-f994-4e1e-8ecb-def3ee9e164c | snat-s/competitiva | Entrenamiento/A/Graph Theory/10452.cpp | #include <iostream>
#include <string>
#include <utility>
#include <vector>
int main(void) {
std::cin.tie(0);
std::ios_base::sync_with_stdio(0);
int t, n, m;
std::cin >> t;
while (t--) {
std::vector<std::string> res;
std::cin >> n >> m;
char mat[n][m];
std::pair<int, int> indie_position;
f... | ALGO | 0.999817 | 3.466384 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-12-27T22:55: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": "873f2be9d620... |
7785efcb-74b4-4796-bf4e-c7c21826dfaf | SuperChenSSS/Algorithm-Training | Trainning/多校联合1st/多校联合1标准程序/1012.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
typedef long long LL;
namespace fastIO {
#define BUF_SIZE 100000
//fread -> read
bool IOerror = 0;
inline char nc() {
static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
if(p1 == pend) {
p1 = buf;
pend = buf + fread(buf, 1, BUF... | ALGO | 0.999963 | 3.908638 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2017-07-26T14:06:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 73,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab0a5ba2... |
734d4bda-6145-4b95-9fdc-b0ba4cf9cfc3 | rsln-s/aggregative-coarsening-for-multilevel-hypergraph-partitioning | packages/fei/test_utils/beam_main.cpp | /*--------------------------------------------------------------------*/
/* Copyright 2005 Sandia Corporation. */
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
/* non-exclusive license for use of this work by or on behalf */
/* of the U.S. Government... | ALGO | 0.974015 | 4.767388 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-04-04T20:05:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0370437609... |
7556bd61-42fd-44a5-bd6b-42ad340e8074 | aminjonshermatov/leetcode | algorithms/MaximumWidthOfBinaryTree/MaximumWidthOfBinaryTree.cpp | #include "bits/stdc++.h"
using namespace std;
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int... | ALGO | 0.99949 | 5.47649 | {
"github_metadata": {
"branch": "master",
"commit_count": 911,
"repo_created_at": "2021-10-28T19:12:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fedd56f... |
49244959-bfc5-4093-8248-8b07b2c8cef5 | yamanozdmr/Exam2 | VectorNorm/VectorNorm.cpp | #include <iostream>
#include <cmath>
struct Vector3 {
float x, y, z;
Vector3 operator+(const Vector3& other) {
return {x + other.x, y + other.y, z + other.z};
}
Vector3 operator-(const Vector3& other) {
return {x - other.x, y - other.y, z - other.z};
}
float magnitude() const... | TOOL | 0.969764 | 4.136776 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-09-17T20:16: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": "a9d3fb39a499... |
ee3e8917-bfbd-46ea-8369-05f7f0a75249 | OgradL/cp-algos | algos/dinic.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;
struct FlowEdge {
int v, u;
long long cap, flow = 0;
FlowEdge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
const long long flow_inf = 1e18;
vector<FlowEdge> edges;
vector<vector<int>> ... | ALGO | 0.999636 | 3.85936 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2023-11-12T17:38:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c429dc2fca3... |
1aeba15e-fdd2-4c73-82b3-6bd169b81997 | Ninjaclasher/Competitive-Programming | DWITE/dwite11c4p4.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 16;
int dp[1<<16];
int arr[MAXN];
bool losing(int msk)
{
bool dec = true, inc = true;
int prev = -1;
for (int x = 0; x < MAXN; x++)
{
if (msk>>x&1)
{
if (~prev)
{
if (arr[x] < prev... | ALGO | 0.999818 | 3.463593 | {
"github_metadata": {
"branch": "master",
"commit_count": 218,
"repo_created_at": "2018-07-09T14:51:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf8f02d3... |
6be32a63-721f-479c-b970-bcf2f6f21825 | NirukshaSandeepa/DSA-InClassLabs | Lab 7 - Binary Search Tree/BinarySearchTree.cpp | #include <iostream>
using namespace std;
struct node {
int key;
struct node *left, *right;
};
// Inorder traversal
void traverseInOrder(struct node *root) {
if (root == NULL) return;
traverseInOrder(root->left);
cout << root->key << " ";
traverseInOrder(root->right);
}
// Insert a node
struct nod... | ALGO | 0.999931 | 5.328479 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2023-04-06T09:56: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": "3270fede50c... |
84dc9746-73b4-41c0-a5f8-936ba1871b67 | sahilintech/dsa | Trees/20_count_nodes_in_complete_binary_tree.cpp | /*
Count no. of nodes in a complete binary tree
*/
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
struct Node
{
int key;
Node *right, *left;
Node(int x)
{
key = x;
left = right = NULL;
}
};
/* Time : O(n)
int res = 0;
int countNodesInBT(Node *root... | ALGO | 0.99988 | 5.522213 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2022-04-25T11:24:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a922ae111bb... |
aca8901e-e988-4cdf-b78a-087dfca59901 | diodel-agr/Cluster-Monitoring-System-v1 | UI/sha256.cpp | #include "sha256.h"
constexpr uint32_t SHA256::K[];
void printBytes(unsigned char* mesg, int len)
{
for (int i = 0; i < len; ++i)
{
std::cout << (int)mesg[i] << " ";
}
std::cout << std::endl;
}
uint32_t* SHA256::computeDigest(unsigned char* msg, uint64_t& length)
{
/* step 1. Append padd... | ALGO | 0.98607 | 5.908647 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-03-09T16:09:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8eab79fe6f... |
56eefb76-26a6-473a-833d-58ed7d8ac189 | inglada/OTB | Utilities/ITK/Code/Review/itkOptNoiseImageFilter.txx | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkOptNoiseImageFilter.txx,v $
Language: C++
Date: $Date: 2009-04-06 00:19:18 $
Version: $Revision: 1.2 $
Copyright (c) Insight Software Consortiu... | ALGO | 0.988682 | 7.089342 | {
"github_metadata": {
"branch": "master",
"commit_count": 10982,
"repo_created_at": "2011-07-01T06:29:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5da334... |
8c4b74e4-c066-485a-af4d-cf59e0da366a | laurenam/meas_algorithms | src/Blendedness.cc | // -*- LSST-C++ -*-
/*
* LSST Data Management System
* Copyright 2015 LSST/AURA
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published ... | ALGO | 0.999437 | 3.743285 | {
"github_metadata": {
"branch": "master",
"commit_count": 1664,
"repo_created_at": "2016-01-13T20:46: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": "a5fc6ba... |
aa4ec43b-3185-424f-8166-99078b57ad65 | mahadodla4/GFG_solutions | Medium/Number of Good Components/number-of-good-components.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
class Matrix {
public:
template <class T>
static void input(vector<vector<T>> &A, int n, int m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
scanf("%d ", &A[i][j]);
}
... | ALGO | 0.999827 | 5.744835 | {
"github_metadata": {
"branch": "main",
"commit_count": 978,
"repo_created_at": "2023-05-24T04:18: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": "cfa5a2fc8c... |
1be1dcc2-87bc-41f4-87ea-5fcac3ea567c | Slemmie/cses-fi | 1703.cpp | #include <bits/stdc++.h>
int n, m;
std::vector <std::vector <int>> g;
std::vector <int> get_path(int s, int t) {
std::queue <std::pair <int, int>> q;
std::vector <int> par(n, -1);
q.emplace(s, s);
while (q.size()) {
auto [u, p] = q.front(); q.pop();
if (par[u] != -1) continue;
par[u] = p;
if (u == t) {
... | ALGO | 0.999989 | 4.221208 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2021-05-05T02:48:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7005df9770e... |
1823c6d2-24a7-44cf-b7d4-84c848e240b8 | RocYan98/PAT | A1143.cpp | #include <iostream>
#include <set>
#include <vector>
using namespace std;
set<int> nodes;
vector<int> pre;
int main() {
int m, n;
scanf("%d%d", &m, &n);
for (int i = 0; i < n; ++i) {
int data;
scanf("%d", &data);
nodes.insert(data);
pre.push_back(data);
}
while (m--... | ALGO | 0.99993 | 4.159214 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2020-03-21T15:30:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "379d11b90... |
21d7a76c-6f75-4ec3-8dbb-86cad49e9d7e | Taha-Adeel/CP | CSES Problems/Divisor_Analysis.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort() {std::sort(this->begin(), this->end());}
void sort_dsc() {std::sort(this->begin(), this->end(), greater<T>());}
auto sum() {T sum = 0; for(... | ALGO | 0.999825 | 3.966286 | {
"github_metadata": {
"branch": "main",
"commit_count": 353,
"repo_created_at": "2022-08-04T08:25: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": "0b6e16c599... |
2fc19228-8ac8-4067-81c2-8f26ba308663 | Walissonpj/Issues-Resolved---URI | Graphs/1552.cpp | #include <bits/stdc++.h>
using namespace std ;
vector<int> posto, pai ;
int m ;
int find( int x )
{
if ( pai[x] != x )
pai[x] = find( pai[x] );
return pai[x];
}
bool unio( int a, int b )
{
a = find(a) ;
b = find(b) ;
if ( a == b )
return false ;
if ( posto[a] >= posto[b] )
{
pai[b] = a ;
if (post... | ALGO | 0.99985 | 4.83327 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-09-13T15:01: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": "cce46173f8... |
84d69af5-334c-4117-bf37-0cda89cdb91f | alisw/AliRoot | STEER/STEER/AliKink.cxx | /**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors ... | ALGO | 0.991183 | 4.207454 | {
"github_metadata": {
"branch": "master",
"commit_count": 74535,
"repo_created_at": "2016-03-07T09:20:12.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 57,
"forks": 256,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "2772... |
252a77a5-9b5d-47fb-8883-8ff280731a4d | ishandutta2007/codeforces-d | darkkcyan/normal/191/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define long long long
#define ve vector
#define vi ve<int>
#define sz(v) ((int)v.size())
#define ii pair<int, int>
#define xx first
#define yy second
#define inf(t) numeric_limits<t>::max()
namespace Solution {
#define maxn 201010
int n;
vi gr[maxn];
int cnt[maxn], l... | ALGO | 0.999945 | 4.722657 | {
"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": "2c104d1b33cc... |
0eac3055-1a24-4c11-9651-c7545379f9df | YouRyuu/CPNPbiubiubiu | LeetCode/leetcode250.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99997 | 6.163702 | {
"github_metadata": {
"branch": "master",
"commit_count": 476,
"repo_created_at": "2019-02-28T00:12:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "922ae804... |
88603363-8ef8-4c19-97ce-105e0394efb0 | dakotamum/CPP_Projects | ParallelGlobalSum/parallelGlobalSum.cpp | // <NAME>
// Parallel Global Sum Project
#include <iostream>
#include <mpi.h>
#include <ctime>
#include <unistd.h>
#include <fstream>
#include <complex>
#include <vector>
#include <chrono>
#define MCW MPI_COMM_WORLD
#define MASTAH 0
using namespace std ;
int main(int argc, char **argv){
int pid, np;
int dat... | ALGO | 0.999812 | 4.137479 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2020-06-07T03:06: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": "083e9064d... |
12330031-1702-4652-883a-c578f1093301 | ZhenyingZhu/ClassicAlgorithms | src/CPP/src/leetcode/ReverseLinkedList.cpp | /*
* [Source] https://leetcode.com/problems/reverse-linked-list/
* [Difficulty]: Easy
* [Tag]: Linked List
*/
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
// [Solution]: Keep a pointer to the previous node, and keep a ... | ALGO | 0.999947 | 6.218109 | {
"github_metadata": {
"branch": "master",
"commit_count": 484,
"repo_created_at": "2014-09-14T08:09:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6625005d... |
1ae9d6f6-be1d-4809-8d8b-2cb34d3f12d0 | morris821028/UVa | volume011/1182 - Sequence Alignment.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <assert.h>
using namespace std;
void inv(char s[], int n) {
for (int i = 0, j = n-1; i < j; i++, j--)
swap(s[i], s[j]);
}
int dp[64][64][2][2];
int main() {
int testcase;
char s1[64], s2[64];
scanf("%d", &testcase);
while (getchar() != '\n');
... | ALGO | 0.999903 | 3.738885 | {
"github_metadata": {
"branch": "master",
"commit_count": 1197,
"repo_created_at": "2013-06-14T12:34:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 571,
"forks": 269,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "8d1... |
5da42550-a950-42b6-9593-9916866ce879 | KSH-code/Problem-Solving | 14428.cpp | #include <iostream>
#include <algorithm>
#include <memory.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5+10;
pair<int,int> tree[MAX*4];
const pair<int,int> NULL_PAIR = {1e9,1e9};
pair<int,int> query(int start, int end, int node, int left, int right) {
if (end < left || right < start) return NU... | ALGO | 0.999994 | 4.876046 | {
"github_metadata": {
"branch": "master",
"commit_count": 117,
"repo_created_at": "2020-07-13T16:12: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": "426d4b5e... |
a5be7d6d-b83a-4a1f-831a-78a9d682f4fe | iamdimitarkolev7/Sofia-University | OOP/higher-order functions II/map and reduce/structArray.cpp | #include <iostream>
template <typename T, typename G>
using opFn = G (*)(T);
template <typename T>
struct S
{
T a, b, c;
T sum = 0;
};
template <typename T>
T *generateArray(int size)
{
T *arr = new (std::nothrow) T[size];
if (!arr)
{
std::cout << "Not enough memory!" << std::endl;
... | ALGO | 0.987028 | 4.767315 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2019-10-19T09:52:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6a8cb70a... |
9d301c53-decd-4649-a5d1-89c84d76384a | konstoikonomou/design-value-of-moment-of-a-doubly-reinforced-beam | moment_calculation_MRd.cpp |
/*
Program that calculates the design value of moment of a doubly reinforced rectangular beam, according to Eurocode 2.
It takes as input the geometry of the rectangular beam and the quantity and size of steel bars
(in tension and compression).
At first, it checks if the failure is occuring with the desired form ... | ALGO | 0.99911 | 4.29233 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-07-09T13:54: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": "584d3c68129d... |
37fa770a-95d8-405b-8ef6-10ca44fe1aa2 | jcarlson23/crab | tests/crab.cpp | #include "./crab_lang.hpp"
#include "./crab_dom.hpp"
#include <crab/analysis/liveness.hpp>
#include <crab/analysis/fwd_analyzer.hpp>
// Helper
template<typename CFG, typename Dom, typename IntraFwdAnalyzer>
void intra_run_impl (CFG* cfg,
bool run_liveness,
unsigned widening,
unsigned narrowing,... | ALGO | 0.98958 | 6.831763 | {
"github_metadata": {
"branch": "master",
"commit_count": 601,
"repo_created_at": "2017-05-17T15:49: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": "4e46d1ea... |
49fe014f-18aa-4a89-8145-d16c81d42be6 | DongfeiJi/LeetCode | 6.二分查找、二叉排序树/LeetCode 449.Serialize and Deserialize BST.cpp | /*
二叉查找树/二叉排序树/二叉搜索树,对于一个node,左子树均小于等于node,右子树均大于等于node,等于只在一侧
中序遍历是排序好的的数据,对于二叉排序树有插入一个元素BST_insert和查找一个元素BST_search的操作
想法:将二叉排序树前序遍历存储到vector,再重新插入元素构造就可以得到和原来一模一样的树,
这里一定是前序遍历,因为中左右,还有插入元素算法的原理,才是先从root开始
本题思想:
编码:先画一个二叉搜索树,然后前序遍历形式,将整型数据转化为字符串并且用特殊符号连接。比如8#3#1#6#
解码:根据分隔符,将数字拆分出来,然后第一个数字作为root,在依次插入即可
补充整形转字符串:
对于1... | ALGO | 0.999705 | 4.547511 | {
"github_metadata": {
"branch": "master",
"commit_count": 50,
"repo_created_at": "2019-05-12T12:37:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "78748fee... |
804fbdf9-8b65-42fc-8ada-e83b6f32df42 | careercup/ctci | c++/Chapter 11/Chapter11.h | #include <iostream>
using namespace std;
template <class T>
void Swap(T &a, T &b){
T tmp = a;
a = b;
b = tmp;
}
// Runtime average and worst case O(n2). Memory O(1)
template <class U>
void bubbleSort(U &arr, int low, int high){
if (high <= low) {
return;
}
int noOfElements = high - low + 1;
for (int i = 0; i... | ALGO | 0.999899 | 5.362133 | {
"github_metadata": {
"branch": "master",
"commit_count": 342,
"repo_created_at": "2013-03-21T23:01:01.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5149,
"forks": 2304,
"issues": 32,
"pull_requests": 34
},
"file_meta": {
"content_id": "f... |
4210340d-9818-47ef-b38f-e6d839c4036a | Pritam723/ProblemSolving | 0984-most-stones-removed-with-same-row-or-column/0984-most-stones-removed-with-same-row-or-column.cpp | class Solution {
public:
void dfs(vector<vector<int>> &adjList, int n, int i, int &count, vector<bool> &visited){
visited[i] = true;
count = count + 1;
vector<int> neighbours = adjList[i];
for(int neighbour: neighbours){
if(visited[neighbour] == true) continue;
... | ALGO | 0.999644 | 5.338305 | {
"github_metadata": {
"branch": "main",
"commit_count": 1655,
"repo_created_at": "2024-08-23T08:21: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": "7bcedd6ec... |
06c1234b-f48d-46db-9e31-88bd90817f9a | blkph0x/rc4fun | main.cpp | #include <CL/cl.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <iterator>
#include <algorithm>
#include <stdexcept>
#include <chrono>
// OpenCL kernel for RC4 decryption
const char* kernel_code = R"(
__kernel void rc4_decrypt(__global const uchar *encrypted_data,
... | ALGO | 0.987976 | 6.383849 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-07-16T11:49: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": "2b28f5d1fa4d... |
bd6f5d16-3539-48af-897a-a9581304cb34 | blastervla/Algoritmos1 | TPI/juegoDeLaVida/solucion.cpp | #include "solucion.h"
#include "utils/toroidUtils.h"
#include "utils/vectorUtils.h"
/********************************** EJERCICIO esValido **********************************/
bool esValido(toroide t) {
bool esValido = filas(t) > 0 && columnas(t) > 0;
for (int f = 0; f < filas(t); f++) {
esValido = esV... | ALGO | 0.99986 | 4.941597 | {
"github_metadata": {
"branch": "develop",
"commit_count": 60,
"repo_created_at": "2018-09-10T20:17: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": "92f515e7... |
1516e160-e8a9-40d9-98b2-40d7ad0efb55 | Andycode3759/solutions | leetcode/cpp/p792.cpp | // TLE
#include <bits/stdc++.h> // local
using namespace std; // local
class Solution
{
public:
bool isSubseq(string str, string target) // is str a subseq of target?
{
if (str.size() > target.size())
return false;
if (str.size() == target.size())
return str.compare(... | ALGO | 0.999859 | 3.795546 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2022-11-12T06:08: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": "803c3cc5b27... |
21df6c91-ed10-4ed8-a227-17316a4e75a8 | hanifenura/c-ile-kargo-takip | c-ile-kargo-takip/c-ile-kargo-takip.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TABLO_BOYUTU 10
typedef struct {
int takipNo;
char gonderici[100];
char alici[100];
char kargoDurum[100];
} Kargo;
Kargo* hash_tablo[TABLO_BOYUTU];
int HashIndex1(int takipNo);
int HashIndex2(int takipNo);
int HashD... | TOOL | 0.919799 | 3.078725 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-04-10T10:04: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": "5557ddac5caf... |
2e348e38-a17b-45af-8328-67d7bcc151a9 | camil0palacios/Competitive-programming | solutions/Training Camp Argentina - 2021/contest-9/o.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fori(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define mp make... | ALGO | 0.999994 | 4.430592 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2018-10-30T16:26:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c02dcbdc... |
29b009b9-8213-4d64-acaa-d7498eb4188b | jeroenrook/MOSMAC-ECJ | experiments/aclib/aclib2/target_algorithms/sat/cryptominisat-cssc14/code/cryptominisat4/subsumeimplicit.cpp | /*
* CryptoMiniSat
*
* Copyright (c) 2009-2013, <NAME>. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.0 of the License.
*
* This libr... | ALGO | 0.99917 | 6.47811 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-03T13:45:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2eba778968df... |
b5438969-8d6d-450f-a68f-d448e4760f39 | wiwitrifai/competitive-programming | codechef/cook110/anggra.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, N = 2e5 + 5;
long long powmod(long long b, long long p) {
long long r= 1;
for (; p; p >>= 1, b = b * b % mod)
if (p & 1)
r = r * b % mod;
return r;
}
long long fac[N], inv[N];
long long C(int n, int k) {
if (n < k || k < 0 || ... | ALGO | 0.999989 | 4.715478 | {
"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": "1b2c313... |
f845ea54-3596-4b61-be07-7894082dd57c | werticell/algorithms_course | 1_term/4_module/2_2.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using std::cin;
using std::cout;
using std::vector;
struct Time
{
int timeIn;
int timeOut;
Time(int timeIn, int timeOut) : timeIn(timeIn), timeOut(timeOut) {};
Time() = default;
};
template <typename T, class TLess = std::less<T>>
void mergeS... | ALGO | 0.999894 | 4.063828 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2020-08-20T15:39: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": "4af62bcf5... |
d8a29097-6cd1-45ed-9562-97d838a4a4c3 | SunLight419/nazopuyo-solver-min | nazopuyo_single.cpp | #include "nazopuyo_single.h"
#include <chrono>
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
void nazopuyo_single::copy_field(std::array<char, FIELD_WIDTH* FIELD_HEIGHT>& from, std::array<char, FIELD_WIDTH* FIELD_HEIGHT>& to) {
for (int i = 0; i < FIELD_HEIGHT * FIELD_WIDTH; ++i) {
... | ALGO | 0.998991 | 3.365305 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-09-02T00:35:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95b20d520bf... |
7c815721-e043-47bf-85fc-ed2e42d2cb59 | sofa-framework/issofa-merge | modules/SofaConstraint/UncoupledConstraintCorrection.inl | /******************************************************************************
* SOFA, Simulation Open-Framework Architecture, development version *
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH *
* *
... | TOOL | 0.971763 | 6.291932 | {
"github_metadata": {
"branch": "issofa_master_integration_all",
"commit_count": 17545,
"repo_created_at": "2021-09-09T13:16:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
... |
d8be4479-fe78-46f6-bf6e-edecc99070f0 | ishandutta2007/codeforces-e | eecs/normal/1503/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n;
pair<int, int> p[maxn];
long long ans, f[maxn], g[maxn], mn[maxn << 2], mn2[maxn << 2], cost;
#define mid (l + r >> 1)
#define ls (k << 1)
#define rs (k << 1 | 1)
void upd(int k, int l, int r, int p, long long v, long long v2) {
if (l =... | ALGO | 0.999965 | 3.663717 | {
"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": "67ed16c5e9d1... |
8fc7a6ca-e5a0-4cfb-b2c8-c434431c2027 | enjoy-365/Algorithm | sorting/Merge.cpp | #include <iostream>
#include <stdlib.h>
#include <limits.h>
using namespace std;
int arr[100005];
void Merge(int p, int q, int r);
void Merge_Sort(int p, int r);
void printArr(int n);
int main(void){
int n;
cin >> n;
arr[0] = -1;
for(int i = 1; i <= n; i++){
cin >> arr[i];
}
Merge_... | ALGO | 0.999971 | 4.05651 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2020-09-09T15:36:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "40052d170... |
cf12a543-e078-4e05-b51b-1088ed18b4ab | transfix/SDF | SignDistanceFunction/propagate.cpp | /*****************************************************************************/
/* ______________________ */
/* / _ _ _ _ _ _ _ _ _ _ _) */
/* ____ ____ _ / /__ __ _____ __ */
... | ALGO | 0.999972 | 4.163974 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2014-01-02T06:47:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "817583e286... |
88e58d04-1301-4980-9a89-3245068efa37 | GTLTFITHOU/Trainning | Training Round 2/HOU - K18/C.cpp | #include <iostream>
#include <vector>
#include <array>
using namespace std;
int b, d, c, l;
signed main()
{
ios::sync_with_stdio(0); cin.tie(0);
cin >> b >> d >> c >> l;
vector<array<int, 3>> res;
for (int i = 0; i <= l / b; i++)
for (int j = 0; j <= l / d; j++)
for (int k = ... | ALGO | 0.999887 | 3.431577 | {
"github_metadata": {
"branch": "main",
"commit_count": 78,
"repo_created_at": "2021-09-20T13:39:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf884fd6fd2... |
96b78fe5-ec47-4743-b992-c8123ec8b14e | alexandraback/datacollection | solutions_5639104758808576_0/C++/vpj/tc.cpp | #include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <fstream>
#include <iomanip>
#include <cstring>
using namespace std;
#define PRINT(x) cout << "DEBUG " << #x << " = " << x << endl;... | ALGO | 0.999442 | 3.697773 | {
"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": "2c5d99c38... |
6353e5a3-675c-41de-ba69-e2f95784c1aa | AkiTomoya10023/Energy_Detect | Include/RunEnergy_Predictor.hpp | #ifndef ANGULARVELOCITY_CALCULATOR_HPP_
#define ANGULARVELOCITY_CALCULATOR_HPP_
#include <iostream>
// STD
#include <vector>
// OpenCV
#include <opencv2/core/types.hpp>
#include <opencv2/opencv.hpp>
// Ceres
#include <ceres/ceres.h>
// Filter
#include "../Filter/particle_filter.h"
namespace rm_power_rune
{
cl... | ALGO | 0.990899 | 6.026286 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2023-06-06T19:22: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": "79a974c451... |
e4fd58bd-efc1-456b-adae-63ceb6d8380b | saurabhvitee/leetcode-solutions | Medium/Shortest_Path_to_Get_Food/Shortest_Path_to_Get_Food_v3.cpp | class Solution {
class Node {
private:
int row;
int col;
int minDistance;
public:
int getRow() { return row; }
int getCol() { return col; }
int getMinDistance() { return minDistance; }
Node(int r, int c, int dist) {
row = r;
co... | ALGO | 0.999982 | 5.008902 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2025-06-21T20:50: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": "efe9fe3c7e4... |
65983774-167b-4b76-a4ef-6992f6a5ca75 | dreyus95/AVSP_SourceQualityPrediction | CodeJamCrawler/dataset/09_20236_99.cpp | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < int(b); i++)
#define FOREQ(i, a, b) for(int i = (a); i <= int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOREQ(i, 1, n)
#define CLR(a, x) memset(a, x, sizeof(a))
... | ALGO | 0.999634 | 4.23475 | {
"github_metadata": {
"branch": "master",
"commit_count": 70,
"repo_created_at": "2017-06-08T21:00: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": "ea2b67999... |
4d2b6867-c48e-48d9-8b0e-f6034c204c5c | imoverflow/mycode | summmertrainning7/A/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int>V;
typedef pair<int , int > P;
const int inf = 0x3f3f3f3f;
const ll INF = 2e18;
const double PI = acos(-1.0);
const double eps = 1e-9;
const int N = 5+1e4;
const ll mod = 1e9+7;
ll dp[N], num[N], b[N], a[100];
int main()
{
// freo... | ALGO | 0.999972 | 3.522947 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-10-19T07: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": "ffe80e6e69... |
d319668a-9e9e-45f7-b05b-c7da48026b18 | QuiverDance/Algorithm | class/14938.cpp | /*
#14938 서강그라운드
*/
#include<iostream>
using namespace std;
int n, m, r, a[104], ret;
int dist[104][104];
int main(){
fill(&dist[0][0], &dist[0][0] + 104 * 104, 1e9);
cin >> n >> m >> r;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
int from, to, t;
for(int i = 0; i < r; i++){
... | ALGO | 0.999969 | 4.076831 | {
"github_metadata": {
"branch": "master",
"commit_count": 608,
"repo_created_at": "2023-05-14T08:19: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": "26d8d2c8... |
e263071b-1960-405a-90cc-30caf9370e98 | mlc-ai/mlc-llm | cpp/serve/engine_actions/batch_draft.cc | /*!
* Copyright (c) 2023-2025 by Contributors
* \file serve/engine_actions/batch_draft.cc
*/
#include <numeric>
#include "../config.h"
#include "../model.h"
#include "../sampler/sampler.h"
#include "action.h"
#include "action_commons.h"
namespace mlc {
namespace llm {
namespace serve {
/*!
* \brief The action ... | ALGO | 0.924763 | 3.984148 | {
"github_metadata": {
"branch": "main",
"commit_count": 1681,
"repo_created_at": "2023-04-29T01:59:25.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 20996,
"forks": 1770,
"issues": 286,
"pull_requests": 19
},
"file_meta": {
"content_id": "... |
ee40eb58-d2cd-4ade-b3be-49b157cdd3e6 | rajesh-1920/Competitive_Programming_Problem_Solving | Codeforces/E_Binary_Inversions.cpp | // Author: <NAME>
// CF : rajesh-1920
// Date : 28.02.2025
#include <bits/stdc++.h>
using namespace std;
//----------------------------(definition section)-----------------------------------------
#define dbg(x) cout << #x << " = " << x << '\n'
#define int long long int
#define fi first
#define sc second
#defi... | ALGO | 0.999973 | 4.597864 | {
"github_metadata": {
"branch": "main",
"commit_count": 263,
"repo_created_at": "2024-10-21T13:58:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63dda9e793... |
273edc6b-4a6b-4a84-b052-2101037e0975 | stagiaire230A/Trust | Turbulence/src/VDF/Turbulence/Source_Transport_K_Eps_Bas_Reynolds_VDF_Elem.h | /****************************************************************************
* Copyright (c) 2019, CEA
* 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 retai... | ALGO | 0.958341 | 4.240749 | {
"github_metadata": {
"branch": "master",
"commit_count": 853,
"repo_created_at": "2022-06-24T09:28: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": "6c186920... |
4495e2c7-b56f-4f5f-b4fc-84f74da89b21 | wuppu/Algorithms | data_structure/queue.cpp | /* FIFO(First in first out) Queue */
#include <iostream>
#include <vector>
using namespace std;
class m_queue {
private:
int *queue;
int size;
int top;
public:
m_queue(int input_size) {
size = input_size;
queue = (int *)malloc(size * sizeof(int));
... | ALGO | 0.999288 | 4.99431 | {
"github_metadata": {
"branch": "master",
"commit_count": 157,
"repo_created_at": "2019-09-15T09:37: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": "fbebeb55... |
9161afc8-47e1-4a5d-90e3-dd5e6454d039 | KoheiIchikawa/cuEDM | src/nearest_neighbors_cpu.cc | #include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include "nearest_neighbors_cpu.h"
NearestNeighborsCPU::NearestNeighborsCPU(uint32_t tau, uint32_t Tp,
bool verbose)
: NearestNeighbors(tau, Tp, verbose)
{
}
// clang-format off
void NearestNeighbor... | ALGO | 0.999932 | 6.89098 | {
"github_metadata": {
"branch": "master",
"commit_count": 218,
"repo_created_at": "2020-01-21T08:00:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4035e684... |
bd47970b-513b-44e2-96fd-fab1924e2301 | heyuhhh/ACM | oj/bzoj/BZOJ1001.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#define INF 0x3f3f3f
using namespace std;
const int N = 1000005,M = 6000005;
struct Edge{
int v,c,next;
}e[M];
int head[N],d[N],cur[N];
int n,m,tot=0;
void adde(int u,int v,int w){
e[tot].v=v;e[tot]... | ALGO | 0.999947 | 3.607965 | {
"github_metadata": {
"branch": "master",
"commit_count": 693,
"repo_created_at": "2019-11-25T06:31:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "54400a50... |
0589810b-5f93-4715-9db1-c6a71217042b | tschmidt23/dart | src/optimization/optimizer.h | #ifndef OPTIMIZER_H
#define OPTIMIZER_H
#include "optimization.h"
#include "prediction_renderer.h"
#include "priors.h"
#include "depth_sources/depth_source.h"
#include "model/mirrored_model.h"
#include "pose/pose.h"
namespace dart {
struct Observation {
const float4 * dVertMap, * dNormMap;
const int width, h... | ALGO | 0.982246 | 7.198694 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2016-04-04T00:30:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 110,
"forks": 37,
"issues": 4,
"pull_requests": 2
},
"file_meta": {
"content_id": "5ed168... |
0f8d1af8-5aab-4142-adbb-bc19407171b8 | adedner/dune-fem-dg | dune/optim/solver/gauss.hh | #ifndef DUNE_OPTIM_SOLVER_GAUSS_HH
#define DUNE_OPTIM_SOLVER_GAUSS_HH
#include <cstddef>
#include <algorithm>
#include <iostream>
#include <memory>
#include <utility>
#include <dune/common/exceptions.hh>
#include <dune/common/dynvector.hh>
#include <dune/optim/solver/fullydynmatrix.hh>
namespace Dune
{
namespac... | ALGO | 0.999246 | 6.989483 | {
"github_metadata": {
"branch": "master",
"commit_count": 2771,
"repo_created_at": "2024-03-05T15:52: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": "5ba1e3c... |
733a7b51-7f7b-406a-9bdd-6aee8817af48 | godoin/C-and-Cpp | cpp programming/oop cplusplus/activity_seven.cpp | #include <iostream>
#include <stdbool.h>
using namespace std;
// bool functions: isGreater, isSmaller, isGreaterEqual, isLesserEqual, isEqual, isNotEqual
class Distance
{
private:
double feet;
double inch;
public:
Distance();
Distance(double, double);
void addDistance(double, double);
void show(); // not... | ALGO | 0.99191 | 4.131411 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2022-11-05T06:53: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": "cf73588f6... |
b249f436-172b-4e05-8b9d-3b8789cd9658 | hanbin9775/BaekJoon_Algorithm | 다익스트라알고리즘/1916.cc | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <set>
#include <unordered_map>
#define INF 10000000000
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<vector<pair<int, int>>> graph;
graph.resize(N+1);
... | ALGO | 0.999923 | 3.776139 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2019-08-25T06:56: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": "3ababcbc3... |
1d88f832-b691-43a0-9281-31fed59b7666 | kuhaku-space/atcoder-submissions | code/arc/arc116/arc116_c.cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vi = vector<int>;
using Vl = vector<ll>;
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define FORR(i, m, n) for(int i = (m)-1; i >= (n); --i)
#de... | ALGO | 0.999994 | 5.31825 | {
"github_metadata": {
"branch": "main",
"commit_count": 446,
"repo_created_at": "2022-05-21T07:48: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": "fe572cd5cc... |
bc6329b4-5fd6-471f-841d-a267dfeb666a | rahulwilful/dataStructuresInCpp | 22.Binery-Search-Tree/BST-implimentation.cpp | #include<bits/stdc++.h>
using namespace std;
template<typename T>
class BTnode{
public:
T data;
BTnode<T>* left;
BTnode<T>* right;
BTnode(T data)
{
this->data = data;
left = NULL;
right = NULL;
}
};
BTnode<int>* takeinlevel()
{
int data;
cout<<"enter root data: ... | ALGO | 0.999797 | 3.667529 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-08-23T12:15: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": "2a1276307f57... |
2b270e92-bf45-4cff-894e-ebffd66fdea7 | dhiru909/dsa_in_cpp | graph/tcs/arrangeMaps.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;
// Function to split the grid into sheets
vector<vector<vector<string>>> splitIntoSheets(int N, int M, const vector<string>& grid) {
vector<vector<vector<string>>> sheets(N / M, vector<vector<string>>(N / M));
for (i... | ALGO | 0.999997 | 7.226423 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2022-09-14T18:41:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b776ac80f8d... |
110624fd-2134-4cfd-99d6-a5a3cffbd4e1 | ngoquanghuy99/Data-structures-Algorithms-problems-and-solutions | notes/sort_vector_of_pair.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define mp make_pair
using namespace std;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
typedef vector <pii> vii;
typedef vector <ppi> vpi;
typedef vector <pip> vip;
bool sort_by_second(const pii &u, const pii &v){
retu... | ALGO | 0.999905 | 4.607352 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2020-06-15T19:10:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4cb657a92... |
64d70e40-10a1-4792-a364-73a03ef7526b | Raogurucharan/Practice-Problems | AsknBid.cpp |
/*
The question is to increment the array by 1
eg:
I/P: {9,9}
O?P: {1,0,0}
I/P: {6,6,9}
O/P: {6,7,0}
*/
#include <bits/stdc++.h>
using namespace std;
void ConcatAddOne(int arr[], int N)
{
int ans = arr[0];
for (int i = 1; i < N; i++) {
int l = floor(log10(arr[i]) + 1); // used to kno... | ALGO | 0.999953 | 5.010192 | {
"github_metadata": {
"branch": "master",
"commit_count": 137,
"repo_created_at": "2020-05-26T18:43:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fa25346f... |
3dd75b63-4218-410b-9bb7-0eb80a66b1d1 | Keiran810975/bur | 24Autumn/E5/dd.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int MAXN = 100010;
int a[MAXN];
int mid[MAXN];
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
priority_queue<in... | ALGO | 0.99996 | 4.442846 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-11-30T01:55:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "886d77905e76... |
7ff93857-7020-41c9-a0b5-37d2a83a0087 | yxtj/GSDM | Search/StrategyOFGPara-mis.cpp | #include "stdafx.h"
#include "StrategyOFGPara.h"
#include "MType.h"
/*
Miscellaneous:
1, result
2, statistics
3, log
*/
using namespace std;
// -------------- Result -----------------
void StrategyOFGPara::gatherResult()
{
if(net->id() == MASTER_ID) {
resultReceive();
} else {
resultSend();
}
}
void Stra... | ALGO | 0.978327 | 5.029681 | {
"github_metadata": {
"branch": "master",
"commit_count": 393,
"repo_created_at": "2016-06-10T20:26:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "28cfd379... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.