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 |
|---|---|---|---|---|---|---|---|
d0ecc6a2-c90a-4806-bebf-e1c094017077 | MasterMind90/cppractice | atcoder/arc077/C.cpp | #ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > r... | ALGO | 0.999972 | 3.807153 | {
"github_metadata": {
"branch": "master",
"commit_count": 1713,
"repo_created_at": "2021-01-12T19:00:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dbb9f70... |
deff61da-3d24-475b-bb89-b17441325840 | wkdehdlr/Doo-it | programmers/문제풀이/문제풀이/문제풀이/k3.cpp | #pragma warning(disable : 4996)
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long ll;
int N;
stack<char> st;
sta... | ALGO | 0.999993 | 3.896355 | {
"github_metadata": {
"branch": "master",
"commit_count": 117,
"repo_created_at": "2017-11-09T11:23:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c86eb90... |
f414cba5-e354-4918-bd70-27df843acd6d | ohseongtaek/Programmers_Algorithm | 086_오픈채팅방/소스.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <sstream>
using namespace std;
vector<string> solution(vector<string> record) {
vector<string> answer;
map<string, string> uid_name;
vector<string> id;
stringstream ss;
string token;
string uid;
string name;
... | ALGO | 0.988034 | 4.481205 | {
"github_metadata": {
"branch": "master",
"commit_count": 169,
"repo_created_at": "2020-06-13T08:12: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": "0c6f6247... |
4e661684-be22-45c2-a436-a7b00b728810 | TransouL/leetcode | 1080-insufficient-nodes-in-root-to-leaf-paths.cpp | #include <iostream>
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 x, TreeNode *left, TreeNode *right) : val(x), lef... | ALGO | 0.999978 | 5.787382 | {
"github_metadata": {
"branch": "main",
"commit_count": 861,
"repo_created_at": "2021-02-08T15:01: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": "de23b54296... |
0fdc4138-d349-46bd-8e05-9967224fc318 | Tezaswa06/DSA_Problems-Leetcode-GFG-Coding-Ninjas- | Difficulty: Medium/Minimum Spanning Tree/minimum-spanning-tree.cpp | // prims
//struct Pair{
// int node;
// int weight;
// Pair(int node,int weight){
// this -> node = node;
// this -> weight = weight;
// }
// };
// class Compare{
// public:
// bool operator()(auto a,auto b){
// return a.weight > b.weight;
// }
// };
// class So... | ALGO | 0.999896 | 5.53734 | {
"github_metadata": {
"branch": "main",
"commit_count": 1051,
"repo_created_at": "2024-02-03T10:33: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": "0d65be878... |
9aefa2ec-93af-415d-a878-af6e96308553 | ans2568/codetree-TILs | 240411/루돌프의 반란/rudolph-rebellion.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
int P, N, M, C, D, rx, ry;
int santa_dx[] = {0, 1, 0, -1};
int santa_dy[] = {-1, 0, 1, 0};
int dolph_dx[] = {1, 1, 1, 0, 0, -1, -1, -1};
int dolph_dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
vector<int> dolph_dist; // dolph... | ALGO | 0.999925 | 4.367048 | {
"github_metadata": {
"branch": "main",
"commit_count": 31,
"repo_created_at": "2024-04-09T06:44: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": "9f45cd61861... |
c0a5a647-1f01-41cb-b883-76a428175930 | henotrix/nycu-2023-fall-algo | hw4/B/submissions/accepted/correct.cpp | #include <iostream>
#include <vector>
using namespace std;
constexpr int INF = 2'000'000'000;
int main() {
int n, m;
cin >> n >> m;
vector a(n, vector(m, -INF));
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> a[i][j];
vector dp(n, vector(m, -INF));
dp[0][0] = 0;
for (int i = 0;... | ALGO | 0.999974 | 3.975024 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-10-01T14:47:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9556219e5fc... |
1822553a-8930-4b1a-bbf2-1a7e13ca8352 | chenhan1218/UVa-Online-Judge | 516.cpp | #include <iostream>
#include <iomanip>
using namespace std ;
#include <algorithm>
#include <string>
#include <sstream>
using std::istringstream ;
#define Max_n 33000
int previous[ Max_n + 1 ] = { 0 } ;
int next[ Max_n + 1 ] = { 0 } ;
void initial( long long int n )
{
long long int i = 0 ; // loop counter
pre... | ALGO | 0.99978 | 3.729354 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2013-03-27T12:07:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfdcab7ebd... |
2ed021f7-e535-4409-bae0-fd0a0a63f523 | BoredKeyboard/cpp09 | ex01/RPN.cpp | /* ************************************************************************** */
/* */
/* :::::::: */
/* RPN.cpp :+: :+: ... | ALGO | 0.992323 | 4.890944 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2023-09-12T10: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": "cf29066fc... |
d93023a7-4baf-44c2-a076-492bad9d007b | light-planck/atcoder | abc/232/e.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
#define rng(a) (a).begi... | ALGO | 0.999898 | 4.521151 | {
"github_metadata": {
"branch": "main",
"commit_count": 1001,
"repo_created_at": "2022-01-26T04:03:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c3d9dd2fd... |
c4729a05-f3fb-403d-bb74-dc22aeb8b1f5 | ethan-was-taken/LeetCodeProblems | LeetCodeUnitTests/MaxLengthPairChainTest.cpp | #include "pch.h"
#include "..\ConsoleApplication1\MaxLengthPairChain.h"
#include <Random>
TEST(MaxLengthPairChainTest, emptyVector) {
vector<vector<int>> vec;
MaxLengthPairChain sut;
auto res = sut.findLongestChain(vec);
EXPECT_EQ(res, 0);
}
TEST(MaxLengthPairChainTest, singleVector) {
srand(NULL);
vec... | TEST | 0.944809 | 5.034716 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-08-31T14:09:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "31b4165a65... |
afe222b2-1506-4a64-a7b0-df1d7a6361f5 | mohankarthik/leetcode | problems/2XXX/21XX/211X/2115_find_recipes_from_supplies.cc | #include "../../../../common/Includes.h"
class Solution {
private:
public:
vector<string> findAllRecipes(vector<string>& recipes, vector<vector<string>>& ingredients, vector<string>& supplies) {
const int n = recipes.size();
unordered_map<string, vector<string>> graph;
unorder... | ALGO | 0.999793 | 5.772592 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2020-12-22T15:34:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e92dd815... |
17b93b00-46fe-4fd7-81a0-07e0e7f2addd | oldmonk6/stacks | infixtoprefix.cpp | #include<iostream>
#include<stack>
using namespace std;
int priority( char ch)
{
if(ch=='+' || ch=='-')return 1;
else return 2;
}
string solve(string val1,string val2,char ch)
{
string s=" ";
s.push_back(ch);
s+=val1;
s+=val2;
return s;
}
int main()
{
string s="(7+9)*4/8-3";//infix expression... | ALGO | 0.999977 | 4.353791 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-05-02T14:17:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b93782c8ba81... |
ecc31a12-dcc6-4172-80ed-c46e6a4f03ef | shri299/dsa-questions | src/dsa/oldquestions/Ques10.cpp | //First Negative Number in every Window of Size K
#include<iostream>
using namespace std;
//my approach
//void firstNegative(int a[], int n, int k)
//{
// int i = 0, j = 0;
// while (j<n)
// {
// if (n-i<k)
// {
// break;
// }
// if (j - i + 1 < k)
// {
// if (a[j]<0)
// {
// cout << a[j] << " ";
// ... | ALGO | 0.999892 | 4.226664 | {
"github_metadata": {
"branch": "main",
"commit_count": 113,
"repo_created_at": "2024-07-13T13:35: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": "6d6ff160f3... |
b1438425-57ee-4f58-b660-9d7aae9d3226 | hyrule123/CodingTest | Answer/Reference/BST/MyRedBlackTree.h | #pragma once
#include <iostream> //cout
/*
모든 노드는 레드 아니면 블랙이다.
루트 노드는 블랙이다.
모든 NIL 노드는 블랙이다.
레드 노드는 레드 노드를 자식으로 가질 수 없다.따라서... 모든 레드 노드의 부모는 블랙이다.
레드 노드는 연속으로 존재(Double red)할 수 없다.
임의의 한 노드에서 NIL 노드까지 도달하는 모든 경로에는 항상 같은 수의 블랙 노드가 있다.
*/
class RedBlackTree {
public:
enum class Color { Red, Black };
class Node {
fr... | ALGO | 0.995876 | 5.476944 | {
"github_metadata": {
"branch": "main",
"commit_count": 576,
"repo_created_at": "2024-04-22T00:51: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": "ef82df16a3... |
9e25a840-51c4-4196-be05-ae1a520f4946 | alfaaz-uddin/data-structure-problems | InfixToPostfixTask/infixtopostfixTask.cpp | #include <iostream>
#include <string>
#include "stack.h"
#include "queue.h"
using namespace std;
int precedence(char op) {
if (op == '+' || op == '-') return 1;
if (op == '*' || op == '/') return 2;
return 0;
}
string infixToPostfix(string expression) {
MyStack st;
MyQueue outputQueue;
st.p... | ALGO | 0.999839 | 6.001935 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-15T16:24: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": "c50064e96d47... |
fdf3e5fb-92ab-4fa2-a89e-1413d22d4fcc | jiaobendaye/acmcode | huaweiod/TaskArrange.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> tasks;
vector<int> workers;
bool ok(int idx, int target)
{
if(idx >= tasks.size()) return true;
for(int i=0; i<workers.size(); i++)
{
if(workers[i] + tasks[idx] <= target) {
workers[i] += tasks[... | ALGO | 0.99998 | 3.779273 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-09-04T00:18: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": "2cad5cc11a0e... |
e2fbe69b-d55a-4fe0-9357-067abf245450 | liuxueyang/liuxueyang.github.io | assets/src/leetcode/problemset/68.cpp | #include <string>
#include <vector>
using namespace std;
class Solution {
public:
string align_line(int i, int j, vector<string> a, int width) {
string res;
if (j == a.size() - 1) {
int sum = 0;
for (int k = i; k <= j; ++k) {
res += a[k];
sum... | ALGO | 0.999879 | 5.667472 | {
"github_metadata": {
"branch": "master",
"commit_count": 1302,
"repo_created_at": "2014-03-18T02:46: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": "02a12ca... |
6eba82f8-b9e6-43f9-a45b-b28439e802a2 | mkp0/CP | LeetCode/79. Word Search.cpp | class Solution
{
public:
bool dfs(vector<vector<char>> &board, int i, int j, string word, int idx)
{
if (idx == word.size())
return true;
if (i >= board.size() || j >= board[0].size() || board[i][j] == '?' || word[idx] != board[i][j])
return false;
char temp = bo... | ALGO | 0.999992 | 6.032054 | {
"github_metadata": {
"branch": "master",
"commit_count": 198,
"repo_created_at": "2020-06-19T19:32:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5592b74a... |
1b1fdda0-e4ed-4a0b-804b-9193cffa204c | Aden-Tao/LeetCode | 0133 Clone Graph/solution.cpp | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {
val = 0;
neighbors = vector<Node*>();
}
Node(int _val) {
val = _val;
neighbors = vector<Node*>();
}
Node(int _val, vector<Node*> _neig... | ALGO | 0.999993 | 5.585538 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2019-12-19T03:16:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "afdb367e2... |
df54dee2-b17f-4320-a0d8-e5c82eff0104 | Puneethnaik/100div2B | 318B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
vector<int> heavy, metal;
for(int i = 0 ; i <= (int)s.length() - 4; i++){
// cout << i << endl;
if(!s.substr(i, 5).compare("heavy")){
heavy.push_back(i);
// cout << "heavy found at positi... | ALGO | 0.999712 | 3.578937 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-08-12T17: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": "9d6cdc6b19... |
6943fb91-f51f-411e-8b61-6308840912f9 | jk-jung/problem-solving | codeforces/Codeforces Round 58x/R585_div2_B.cpp | #include <cstring>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999955 | 3.662884 | {
"github_metadata": {
"branch": "main",
"commit_count": 1582,
"repo_created_at": "2021-06-24T13:40:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a3d6aa5c... |
c336660b-19f2-4f84-a65e-7c4b451cb342 | nebulaed/My_LeetCode_Road | Code/41.缺失的第一个正数.cpp | #include<iostream>
#include<vector>
#include<unordered_set>
using namespace std;
// 我的普通解法, 时间O(n) 252 ms,空间O(n) 129.5 MB
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
unordered_set<int> hashset;
for (int i = 0; i < nums.size(); ++i) {
hashset.insert(nums[i]);
... | ALGO | 0.999968 | 4.664862 | {
"github_metadata": {
"branch": "master",
"commit_count": 121,
"repo_created_at": "2021-12-15T03:42:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8fe8fd26... |
e1afcb03-6c12-47f6-a7da-d465bb52e06e | karan221/cp | CSES/SortingandSearching/Room_Allocation.cpp | #include <bits/stdc++.h>
#define int int64_t
using namespace std;
const int N = 2e5+69;
array<int, 3> a[N];
int ans[N];
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i][1] >> a[i][0];
a[i][2] = i;
}
... | ALGO | 0.999984 | 4.370001 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2021-03-27T14:54: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": "c91434cce5c... |
3925aa69-c99b-4bd9-bc47-45dd18890ae9 | HaiZeizhouyuan/LeetCode | 3.位运算/405.数字转换为十六进制数.cpp | /*************************************************************************
> File Name: 405.数字转换为十六进制数.cpp
> Author: zhouyuan
> Mail: <EMAIL>
> Created Time: 2020年09月16日 星期三 15时56分53秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h... | ALGO | 0.999644 | 4.216105 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-09-04T02:03: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": "dfff00f7bd... |
163f8b32-1ada-4471-b471-a0ea6d2f4091 | wzmw-zr/Code-Archive | 2021/8/30/2.LeetCode528.cpp | /*************************************************************************
> File Name: 2.LeetCode528.cpp
> Author:
> Mail:
> Created Time: 2021年08月30日 星期一 08时59分50秒
************************************************************************/
#include <iostream>
#include <string>
#include <vector>
#include <queue>... | ALGO | 0.999838 | 5.148324 | {
"github_metadata": {
"branch": "master",
"commit_count": 1859,
"repo_created_at": "2019-11-28T12:33: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": "f831740... |
e23022d1-9e13-4a40-ae94-3da228ad851a | sakshgupta/DSA_Self_Paced | 07. Sorting/merge_overlapping_intervals.cpp | #include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
struct Interval
{
int start, end;
};
bool mycomp(Interval i1, Interval i2)
{
return (i1.start < i2.start);
}
void mine(Interval arr[], int n)
{
sort(arr, arr + n, mycomp);
int res = 0;
for (int i = 1; i < n; i++)
... | ALGO | 0.99999 | 4.990514 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2023-04-15T17:11:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f9de39d646... |
7406a757-b8ff-43dd-910b-a405c9f7ffd7 | ambikapanse/DSA | BS/aggressive_cows.cpp | //https://www.geeksforgeeks.org/problems/aggressive-cows/0
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int canPlace(vector<int> &stalls, int k, int mid){
//we start with the first cow at... | ALGO | 0.99998 | 6.161086 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-06-22T07:05: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": "1f3f99ba9fa... |
c633bd4d-fd64-4f49-a0aa-a714d17f86b8 | shanzi/cf | contest/1492/b/b.cpp | /* Generated by powerful Codeforces Tool
* Author: czhang
* Time: 2021-03-01 23:22:35
**/
#include <bits/stdc++.h>
#include <stack>
using namespace std;
typedef long long ll;
void solve() {
int n;
int arr[100004];
stack<int> s;
cin>>n;
for (int i = 0; i < n; ++i) {
cin>>arr[i];
... | ALGO | 0.999911 | 5.541411 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2021-03-02T15:08:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b057fd92cb1... |
21ef274e-8e79-4f19-b76a-f27e09665dac | elvircrn/ccppcodes | burek.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
using namespace std;
struct point
{
int x, y;
point () { }
point (int _x, int _y) { x = _x; y = _y; }
void get()
{
scanf ... | ALGO | 0.999483 | 4.179047 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-10-14T17:41:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d209035ea0... |
54636010-ec17-4936-b1d8-fcc0284381ea | theanujsinha01/DSA-in-CPP | SLIDING WINDOW/FirstNegativeInWindow.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> FirstNegativeInteger(vector<int>& arr, int k) {
int start = 0;
int end = start + k - 1;
vector<int> ans;
while (end < arr.size()) {
bool found = false;
for (int i = start; i <= end; i++) {
if (arr[i] < 0) {
... | ALGO | 0.999995 | 5.842103 | {
"github_metadata": {
"branch": "main",
"commit_count": 301,
"repo_created_at": "2024-10-03T13:13: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": "a28e7c776f... |
9d445c79-1f9a-47e7-9484-0ea89ee980a8 | Qiuzhongyuan/pointpillars_pytorch_trt | trt/TensorRT7.2/samples/opensource/sampleNMT/model/beamSearchPolicy.h | /*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requir... | ALGO | 0.969953 | 6.940544 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2021-04-30T01:41:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 78,
"forks": 25,
"issues": 15,
"pull_requests": 1
},
"file_meta": {
"content_id": "3b3a2de... |
9a730ee8-6864-4c47-a381-234fbd0f69f4 | Mohammad-Aman-Ullah-Khan/Drone-Weather-Station | Packages/AP_Math/location_double.cpp | /*
* location_double.cpp
*
* This file is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope... | ALGO | 0.999481 | 4.247974 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-10-03T20:00:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc9178736237... |
2e481b65-cd3f-49bd-95ae-50bb05e94756 | Anjinhyoung/Cpp_Algorithm_Problem-Solving | 백준/Bronze/2738. 행렬 덧셈/행렬 덧셈.cc | #include <iostream>
#include <vector>
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int array[100][100] = { {0,}, };
int array2[100][100] = { {0,}, };
int num, num2, sum = 0;
std::cin >> num >> num2;
for (int i = 0; i < num; i++)
{
for (int j = 0; j ... | ALGO | 0.999487 | 4.176111 | {
"github_metadata": {
"branch": "main",
"commit_count": 197,
"repo_created_at": "2024-06-05T01:04:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "899c26edd7... |
c6254577-676f-4417-b011-8edb261fe6ed | markusbuchholz/trajectory_generation_in_cpp | trajectory_generation.cpp | // g++ trajectory_generation.cpp -o t -I/usr/include/python3.8 -lpython3.8
#include <iostream>
#include <vector>
#include <math.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <tuple>
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
// AX = B
// A = inv(X)*B
// (row, column)
/*
MatrixXf A(3, 3... | ALGO | 0.999872 | 4.978114 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-02-27T20:51:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e34a827d0080... |
5e04dcca-8c55-4125-8566-4e38b8ad2353 | raynacode/leetcode | 72.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int len1 = word1.size();
int len2 = word2.size();
vector<vector<int> > dist(len1 + 1, vector<int>(len2 + 1, 0));
for (int i = 1; i <= len2; i++)
dist[0][i] = i;
for (int i = 1; i <= len1; i++) {
dist[i][... | ALGO | 0.999997 | 5.483558 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2015-06-03T06:14: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": "1bf74c88... |
a93b959a-2fe0-4041-ab16-c95898e2ebbf | Keyu-He/Enhancing-Debugging-Skills-of-LLMs-with-Prompt-Engineering | solutions_correct/algorithms/S/Smallest Range Covering Elements from K Lists/Smallest Range Covering Elements from K Lists.cpp | class Node{
public:
int data;
int x;
int y;
Node(int data,int x,int y){
this->data=data;
this->x=x;
this->y=y;
}
};
class Comparator{
public:
bool operator()(Node *a,Node *b){
return a->data > b->data;
}
};
class Solution {
public:
vector<int> smal... | ALGO | 0.999997 | 6.216816 | {
"github_metadata": {
"branch": "main",
"commit_count": 116,
"repo_created_at": "2023-10-08T23:10:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "28fbd50c14... |
3f86959e-42ef-47a1-80a6-200e763f3565 | Ph4BK/acm | 2025-01-22/luogu-P1135/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int mark[n + 1];
for (int i = 1; i <= n; i++) {
mark[i] = -1;
}
int move[n + 1];
for (int i = 1; i <= n; i++) {
cin >> move[i];
}
queue<int> q;
q.push(a);
mark[a] = 0;... | ALGO | 0.999995 | 3.727707 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2025-02-15T05:51: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": "753eb2d0d8... |
0ae1b1c6-76d1-4d19-b9ca-7e081302a83a | guille31794/EDNL | EDNL Selu/Parte 2/Practica 4/abb_ES.h | /*******************************/
/* abb_ES.h */
/* */
/* E/S de Árboles Binarios */
/* de Búsqueda */
/* */
/* <NAME> */
/* */
/*******************************/
#ifndef ABB_ES_H_
#define A... | ALGO | 0.997652 | 5.008492 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2018-07-18T17:43:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fc0c832a... |
c5b45b44-cdbe-48a3-a0a1-f6ab654585e9 | arjunvijayvargiya/DeathCoders | Hospital.cpp | #include<stdio.h>
#include<stdlib.h>
#include<process.h>
/*
AUTHOR :<NAME>
DESCRIPTION:Problem solved by the Author
*/
struct hos
{
int tok;
int pri;
hos *next;
}*front,*rear;
void insert(int,int);
void display();
void create();
void doctor();
void del(hos *,hos *);
int main()
{front=(hos *)malloc(siz... | ALGO | 0.999799 | 3.093674 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2015-01-08T08:11: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": "ccd0d5725a... |
cdc575a1-e28d-4ac0-80b3-33c4993bbd38 | aayushabhatia/Striver-DSA-A2Z-Sheet | Striver dsa a2z sheet/Step3_Arrays/SecondLargestElementArray.cpp | // https://bit.ly/3pFvBcN
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
// Function returns the second
// largest elements
int print2largest(vector<int> &arr) {
// Code Here
int n = ... | ALGO | 0.999954 | 5.486141 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-07-29T08:26: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": "0f85e9816e3e... |
a18d7776-1a23-4a2d-bafb-cbb3be158b16 | Tudy73/Advent | day_8/day_8.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <fstream>
#include <sstream>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <numeric>
#include <map>
#define ll long long
#define ull unsigned long long
#define pb push_back
using namespace std;
ifstream... | ALGO | 0.999235 | 3.585967 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-01-10T17:35: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": "395cb846a2c3... |
70c41683-22b6-4c84-a3dd-964e626bce1c | arangodb/arangodb | 3rdParty/boost/1.78.0/libs/intrusive/example/doc_splaytree_algorithms.cpp | /////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright <NAME> 2007-2013
//
// Distributed under 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)
//
// See http://www.boost.org/lib... | ALGO | 0.999435 | 6.756317 | {
"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": ... |
14d9e254-251d-4f52-a01f-26008c02ee70 | mrsac7/atcoder-educational-dp | src/F - LCS.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main(){
cin.tie(0)->sync_with_stdio(0);
string s, t; cin>>s>>t;
int n = s.size(), m = t.size();
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
for (int i = 1; i <= n; i++) {
for (int j = 1; j <=... | ALGO | 0.999986 | 4.763334 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2021-10-26T08:09:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae65554b90... |
b8380829-ffe4-498b-bcdd-7bd7a89e9546 | kyeshmz/ofxDevelopableFlow | libs/developableflow/include/developableflow/energy_selector.cpp | /*
2018, <NAME>, <NAME> and <NAME>
This file is part of the code for "Developability of Triangle Meshes".
The code for "Developability of Triangle Meshes" is free software: you can
redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation,... | ALGO | 0.99573 | 5.585727 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2019-09-08T13:01:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "f8c8ac5dee... |
e65667ff-ee03-4600-8043-28cf62bad694 | amdadul3036/C- | Basic Problem Solving in C++/Pattern/pattern5.cpp | /*
Generate the following output using nested for loops.
* * * * *
* *
* *
* *
* * * * *
*/
#include<iostream>
using namespace std;
int main(){
int number;
cout << "Enter the number of star in one arm : ";
cin >> number;
for (int i = 1;... | ALGO | 0.999861 | 3.785301 | {
"github_metadata": {
"branch": "main",
"commit_count": 329,
"repo_created_at": "2020-11-14T01:29: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": "30cbe2a990... |
008c5ced-a723-4f2e-8738-e5fd8db6f0fa | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/smallest-integer-divisible-by-k-Solution.smallestRepunitDivByK/177793_DoS_Exec_Code_Overflow.cpp | GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac,
SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) {
SplashFTFontFile *ff;
FT_Vector offset;
FT_GlyphSlot slot;
FT_UInt gid;
int rowSize;
Guchar *p, *q;
int i;
ff = (SplashFTFontFile *)fontFile;
... | TOOL | 0.959872 | 4.748618 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-22T14:39:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3dcb0fbe10e9... |
3903abbe-e3c7-4c00-95b5-b855b7843d67 | nilikunkk/CS217-Project | bellman.cpp | #include "main.h"
void updateEdgeIndex(std::vector<int> &V, std::vector<int> &E, int l, int r){
for (int index = 0; index < E.size(); index++) {
l=0; r=V.size()-1;
while (l <= r) {
int m = l + (r - l) / 2;
if (V[m] < E[index]) {
l = m + 1;
}
... | ALGO | 0.99991 | 4.706597 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-02-18T06:57: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": "98493f729047... |
1ee1ec7f-cfbb-4656-ad1b-03c9890a718c | memset0/OI-Code | 洛谷/P3195 [HNOI2008]玩具装箱TOY.cpp | // ==============================
// author: memset0
// website: https://memset0.cn
// ==============================
#include <bits/stdc++.h>
#define ll long long
#define sqr(x) ((x)*(x))
using namespace std;
int read() {
int x = 0; bool m = 0; char c = getchar();
while (!isdigit(c) && c != '-') c = getchar... | ALGO | 0.999895 | 3.140623 | {
"github_metadata": {
"branch": "master",
"commit_count": 294,
"repo_created_at": "2018-07-31T14:56:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d828959... |
e236dc25-c019-4e73-a58d-cde93b2b2bf4 | sanjusss/leetcode-cpp | 1000/1700/1780/1781.cpp | /*
* @Author: sanjusss
* @Date: 2022-12-12 09:08:26
* @LastEditors: sanjusss
* @LastEditTime: 2022-12-12 09:13:17
* @FilePath: \1000\1700\1780\1781.cpp
*/
#include "leetcode.h"
class Solution {
public:
int beautySum(string s) {
int n = s.size();
int ans = 0;
for (int i = 0; i < n; ++i... | ALGO | 0.999887 | 5.160126 | {
"github_metadata": {
"branch": "master",
"commit_count": 2055,
"repo_created_at": "2019-04-04T03:17:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad94aa1... |
e5f6a1ff-ddda-45be-8f76-675afaa49222 | shockwaveHe/MCVIO | MCVIO/src/Frontend/feature_tracker/vpi_feature_tracker.cpp | #include "vpi_feature_tracker.h"
using namespace MCVIO;
// int FeatureTracker::n_id = 0;
int filecount = 0;
bool VPIFeatureTracker::inBorder(const cv::Point2f &pt)
{
int img_x = cvRound(pt.x);
int img_y = cvRound(pt.y);
return BORDER_SIZE <= img_x && img_x < cam->COL - BORDER_SIZE && BORDER_SIZE <= img_y &... | ALGO | 0.94582 | 4.290194 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-10-31T09:36:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 78,
"forks": 15,
"issues": 5,
"pull_requests": 0
},
"file_meta": {
"content_id": "12fd73280... |
73008153-0794-429d-8f07-b33e3c19d9a7 | hieu-ln/IT81-01 | CodeC2/BaoDung_C2_Bai11.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
struct Node
{
int info;
Node *link;
};
Node *front, *rear;
void init()
{
front = NULL;
rear = NULL;
}
int isEmpty()
{
if (front == NULL)
return 1;
return 0;
}
void Push(int x)
{
Node*p = new Node;
p->info = x;
p->link = NULL;
if (rear == NULL)
... | ALGO | 0.994086 | 3.630645 | {
"github_metadata": {
"branch": "master",
"commit_count": 93,
"repo_created_at": "2019-06-26T00:55:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3c3a3360f... |
9e7698bc-30c2-4c63-9915-085191d3920e | mechanismsynthesis/mechanismsynthesis | newtonraphson.cpp | #include "newtonraphson.h"
namespace NewtonRaphson {
bool Solution::CompareForTest(const Solution &other, int precision)
{
if (this->iterations != other.iterations)
return false;
// Compare for optional vector. If oen if optional, both should be optional
if (this->vector == std::nullopt || othe... | ALGO | 0.999718 | 6.132501 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2020-04-03T17:52:59.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8935548b0... |
0b3648d2-f60b-4f10-a546-bee5dfb0e226 | eaglesky/leetcode | C++/Combinations.cc | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int timeCount = 0;
//Recursive solution
void combineRec(int n, int k, int start, vector<int>& curCombine, vector<vector<int> >& result)
{
int curSz = curCombine.size();
if (n - start + 1 < k - curSz)
return;
if (curSz == k... | ALGO | 0.999874 | 5.544578 | {
"github_metadata": {
"branch": "master",
"commit_count": 387,
"repo_created_at": "2014-08-03T05:36:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "063df765... |
a572b955-6ea0-4499-a1d0-a523dd4a5cab | MurrayEfford/secr | src/poly.h | // include guard
#ifndef __poly_h_INCLUDED__ // if poly.h hasn't been included yet...
#define __poly_h_INCLUDED__ // #define this so the compiler knows it has been included
// see https://www.boost.org/doc/libs/1_77_0/libs/math/doc/html/math_toolkit/stat_tut/weg/error_eg.html
// and https://www.boost.org/doc/libs/... | ALGO | 0.996721 | 4.297529 | {
"github_metadata": {
"branch": "master",
"commit_count": 756,
"repo_created_at": "2022-04-22T04:28:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "0b53b1c5... |
40308f22-c106-49d8-9c63-83deebb9d4d0 | Hiteshmaan4444/cppProg | Basics/revList.cpp | //{ Driver Code Starts
// driver
#include <bits/stdc++.h>
using namespace std;
/* Linked list Node */
struct Node {
int data;
struct Node* next;
Node(int x) {
data = x;
next = NULL;
}
};
struct Node* buildList(int size)
{
int val;
cin>> val;
Node* head = new Node(val);
... | ALGO | 0.999877 | 5.679797 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-04-29T05:42:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8839bf79411... |
3c5d0ed9-e827-40cf-ba38-3f9433c13920 | dheerajgattupalli/Sync-LeetCode | Leetcode_Solutions/problems/swapping_nodes_in_a_linked_list/solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* swapNodes(L... | ALGO | 0.999997 | 5.77411 | {
"github_metadata": {
"branch": "main",
"commit_count": 165,
"repo_created_at": "2022-12-18T09:44: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": "9a8a593a62... |
6011ad48-9a15-425b-9e82-3dfcd53d8eea | Nitish252000/LeetCode_Solution | CPP/Array/Number of Subarrays With GCD Equal to K.cpp | int subarrayGCD(vector<int>& nums, int k) {
int cnt = 0;
for (int i = 0; i < nums.size(); i++) {
int currGCD = nums[i];
if(currGCD == k){
cnt++;
}
for (int j = i + 1; j < nums.size(); j++) {
currGCD = __gcd(currGCD, nums[j])... | ALGO | 0.999929 | 6.220927 | {
"github_metadata": {
"branch": "main",
"commit_count": 420,
"repo_created_at": "2024-05-10T09:06: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": "12ee47ce0e... |
dbdf5621-23e8-4e9e-aedf-535e08f85fdb | UmeshKumari-202128/DSA-Questions | DSA2.cpp | // Write a program to find minimum and maximum element of an array. Your program should
// accept n elements all integer values then the program should display the minimum
// and maximum element in the array with their corresponding index number.
#include <iostream>
using namespace std;
int main()
{
int arr[7] = ... | ALGO | 0.999706 | 5.087951 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-04-30T04:47: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": "be72b8b3dd57... |
e54ac469-0c29-4e17-bd13-ecb0da97467a | monolife506/problem_solving | 구현/카드 섞기.cpp | #include <cmath>
#include <deque>
#include <iostream>
using namespace std;
int N;
void shuffle(deque<int> &cards, int k)
{
deque<int> poped;
bool flag = false;
while (k >= 0)
{
int r = (flag) ? (int)pow(2, (k + 1)) - 1 : N - 1;
int l = r - (int)pow(2, k) + 1;
// 카드 빼기
... | ALGO | 0.999976 | 3.757076 | {
"github_metadata": {
"branch": "master",
"commit_count": 433,
"repo_created_at": "2019-09-18T12:56:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb0a5eef... |
27e0d11d-2528-4e07-a73f-11e06b628618 | DeriDreri/SDIZO-Project | zad1/tree.cpp | #include "tree.h"
Tree::Tree(){
root = nullptr;
}
void Tree::addNode(int value){
TreeNode* nodeToInsert = new TreeNode(value);
TreeNode* parent = nullptr;
TreeNode* node = root;
//Szukanie rodzica, do którego należy podpiąć nowy węzeł
//Po wykonaniu pętli:
// node - pusty liść, któ... | ALGO | 0.999308 | 3.405322 | {
"github_metadata": {
"branch": "main",
"commit_count": 39,
"repo_created_at": "2023-03-09T13:53:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "118569d0b25... |
bb5dd485-d717-4143-b5cc-244ccd23b86d | mdihemu/Online-Judge | April'21/A. Array and Peaks.cpp | #include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
#define PI acos(-1.0)
#define IN freopen("input.txt",'r',stdin)
const int INF = 1e9+5;
const int N = 205;
voi... | ALGO | 0.999964 | 3.402913 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2019-11-14T18:37:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "44f63e68b... |
9c6fcbd0-1333-43ca-9233-bad18f444bf7 | slehman133/CPE301PROJ | swamp_cooler/swamp_cooler.ino | /**************************************************************************************************************************************
FILENAME: swamp_cooler.ino
AUTHOR: <NAME>, <NAME>
DATE: 12/5/2021
DESCRIPTION: code for a swamp cooler CPE 301
*************************************************************************... | TOOL | 0.974255 | 5.357292 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2021-10-29T01:00: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": "da4e34f0c0a... |
b6cb2392-f816-4a0a-92ef-06fd2a5849d7 | JU4N98/competitive_programming | Training Camp/2022/07-22/H.cpp | #include <bits/stdc++.h>
#define dbg(x) cerr<<#x<<"="<<(x)<<endl;
#define forr(i,a,b) for(int i=(a);i<(b);i++)
#define forn(i,n) forr(i,0,n)
#define dforn(i,n) for(int i=n-1;i>=0;i--)
#define forall(it,v) for(auto it=v.begin();it!=v.end();it++)
#define sz(c) ((int)c.size())
#define rsz resize
#define pb push_back
#defi... | ALGO | 0.99984 | 3.622903 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2021-04-03T19:29: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": "c393e3fac... |
e58f358f-cdb4-4044-92c7-986b7ad0a6aa | fkanvaly/densest_subgraph | degree_tracker.cpp | // C++ program to illustrate inserting a node_t in
// a Cicular Doubly Linked list in begging, end
// and middle
#include <iostream>
#include <stdexcept>
using namespace std;
// Structure of a node_t
struct node_t
{
int data;
node_t *next;
node_t *prev;
node_t():next(NULL), prev(NULL){}
};
// Function to insert a... | ALGO | 0.994224 | 5.589736 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2021-01-23T14:54: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": "4f2e844f881... |
ff602c3c-0111-450e-a560-4552bf421857 | truta193/sda | lab6/main.cpp | #include <iostream>
#include "hashtable.h"
int main() {
HashTableT hash;
hashTableInit(&hash);
hashTableInsert(&hash, 10);
hashTableInsert(&hash, 111);
hashTableInsert(&hash, 80);
hashTableInsert(&hash, 35);
hashTableInsert(&hash, 350);
hashTableInsert(&hash, 95);
hashTableInsert(&... | ALGO | 0.967108 | 4.184106 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2023-03-16T21:14: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": "8271a144ec5... |
67dc8635-d32a-4abf-a135-82594d6fd287 | 10days96/PS | 2019/samsung/2/marbleEscape2.cpp | //#13460
#include <bits/stdc++.h>
using namespace std;
int n, m;
char maps[11][11];
const int dy[] = {1, -1, 0, 0};
const int dx[] = {0, 0, 1, -1};
struct MARBLE
{
int rY;
int rX;
int bY;
int bX;
int count;
};
MARBLE start;
int bfs()
{
int ret = -1;
queue<MARBLE> q;
bool visited[11][11... | ALGO | 0.999321 | 4.017147 | {
"github_metadata": {
"branch": "master",
"commit_count": 299,
"repo_created_at": "2018-07-27T14:19:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dc65190a... |
964f248c-4f03-4f68-83e9-cf57c108301d | nd2204/code | clang/heapsort.cc | #include <iostream>
#include <cstring>
// bài số 16 với Quick Sort, bài số 17 với Merge Sort
// =========================== Bai 15 ===========================
// Sinh viên hãy lập trình giải bài toán quản lý khách hàng,
// trong chương trình thực hiện các công việc sau:
// Câu 1. (2 -) Định nghĩa một cấu trúc Khách hà... | ALGO | 0.99895 | 3.855772 | {
"github_metadata": {
"branch": "main",
"commit_count": 86,
"repo_created_at": "2022-12-20T08:55: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": "b7dfe731657... |
debfbce6-8e6c-41f8-b569-76d389cdefe6 | yjbong/problem-solving | boj/2426/2426.cpp | #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n,m;
int sqrn;
int a[111111];
int p[333];
int lower_bound(int key){ // return smallest idx i that (a[i]+p[i/sqrn]>=key)
int left,mid,right;
int ret=-1;
left=0; right=n-1;
while(left<=right){
... | ALGO | 0.999853 | 3.882881 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2016-10-06T00:56: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": "9b76fa83a... |
5b889f5d-df2e-4c88-9b36-1839e69f47aa | gengar-maker/EHC-LABS | LABS/SR2/sle_solve.cpp | #include <vector>
#include <iostream>
#include <random>
#include <string>
#include <chrono>
typedef double type;
class Gauss
{
type** coefs;
type* free_term;
std::vector<type> variables;
int n, m;
public:
Gauss(int _n, int _m, type **_coefs, type *_free_terms)
: n(_n),
m(_m),
... | ALGO | 0.999746 | 5.783501 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2023-09-28T15:12:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00a251e6622... |
03a4385a-f8c2-4c76-a451-71635c5fb4ce | Premkumar981/DSA_Daily_Problems | Developing_a_program_for_data_processing_company.cpp | #include <iostream>
#include <string>
using namespace std;
void removeDuplicates(string arr[], int& size) {
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
if (arr[i] == arr[j]) {
// Shift elements to fill the gap
for (int k = j; k < size - ... | ALGO | 0.999938 | 6.080594 | {
"github_metadata": {
"branch": "main",
"commit_count": 92,
"repo_created_at": "2023-08-24T18:08:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a22a9c634e0... |
948a1d9a-3d42-4a94-9a6b-62c3a929dbe8 | wigoutwithyoursidout/test2 | main.cpp | #include <iostream>
#include <bitset>
#include <cstdint>
#using <System.dll>
using namespace System;
int main()
//{
// uint8_t a = 5;
// std::bitset<8>b{ a };
// std::cout << b << std::endl;
// Console::ReadKey();
//
// return 0;
//}
//101
//{
// uint8_t a = 5;
// std::bitset<8>b{ a };
// std::cout << b << 1 << s... | TOOL | 0.949306 | 3.687344 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-24T06:22: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": "93849c1306f2... |
245f503c-1e28-4250-a709-172094c53d67 | ComodoSecurity/openedr | edrav2/eprj/boost/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 <NAME>, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates.
// Contributed and/or modified by <NAME>, on behalf of Oracl... | ALGO | 0.985732 | 7.411407 | {
"github_metadata": {
"branch": "main",
"commit_count": 74,
"repo_created_at": "2020-10-28T20:51:07.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2476,
"forks": 474,
"issues": 30,
"pull_requests": 0
},
"file_meta": {
"content_id": "8fff1e... |
700c4546-0f36-4d04-91af-ddeb8edc5fb9 | Asionsolver/DSA | Home/bitwiseOperator.cc | #include <iostream>
using namespace std;
int main()
{
// bitwise operators -> &, |, ^, ~, <<, >>
// int a = 5; // 101
// int b = 2; // 010
// int n = 1;
// bool c = 1;
// cout << (a & b) << endl; // 000
// cout << (a | b) << endl; // 111
// cout << (a ^ b) << endl; // 111
// cout <... | ALGO | 0.992548 | 4.185075 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2024-06-10T14:27: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": "4af661fc2... |
41d3849e-6416-4e1d-a11f-1c682d49f490 | samiulsami/Competitive-programming | Hashing and String Algorithms/Codechef - JARVIS and LCP (Suffix Array, Binary Search).cpp | #include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll>vll;
#define sf scanf
#define pf printf
#define nl printf("\n")
#define si(x) scanf("%d",&x)
#define sii(x,y) scan... | ALGO | 0.999913 | 4.278979 | {
"github_metadata": {
"branch": "master",
"commit_count": 81,
"repo_created_at": "2019-08-27T02:42: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": "3e5f50bd1... |
2770997e-ae99-4f3b-a05c-71613f6ee029 | Aniypon/DripC-Algo | алгосы/контест_2/6.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pb push_back
#define pii pair<int,int>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vi vector<int>
#define vvi vector<vi>
#define fori(a , b , c) for(int i = a; i < b; i+= c)
const... | ALGO | 0.999607 | 5.057007 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2024-10-19T09:25: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": "e22e6680b98... |
de31836a-8306-446f-b398-4b8819b30def | ktoan911/Data-structures-and-algorithms-C- | Mảng/MảngHiệuMảngCộngDồn/MangHieu_MangCongDon.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
//MẢNG CỘNG DỒN
//Mảng prefix -> mục đích để giảm độ phức tạp cảu 1 hay 2 vòng lặp for
// * 1 chiều
// ví dụ : mảng a[5] = [1,2,3,4,5]
// mảng cộng dồn của A : [1,3,6,10,15] -> pre[i] = a[0] + ... + a[i]
// * 2... | ALGO | 0.999869 | 4.974112 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-11-03T13:04:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "df6ca81049fa... |
7947aa32-64c6-4659-9c73-68279480af0f | huanghongxun/ACM | codeforces/706C.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
typedef long long ll;
const ll inf = 0x7f7f7f7f7f7f7f7fll;
const int N = 200005;
#define rep(i,j,k) for(i=j;i<k;++i)
using namespace std;
vector<string> str, str_rev;
ll c[N], dp[N][2];
int main() {
int n, i;
strin... | ALGO | 0.999902 | 3.429647 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2017-08-26T05:28:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "38aab55cc6... |
876fe105-7ace-4bf5-b971-6c1e17a1de2d | ddpigeon/2x2-solver | cube.hpp | #ifndef CUBE_HPP
#define CUBE_HPP
#include <array>
#include <functional>
#include <random>
using namespace std;
class cube {
/*
* Positions for the cubies: (U = top, D = bottom, R = right, L = left, F = front, B = back)
* eg. UFR refers to upper front right corner = the white red green corn... | ALGO | 0.989104 | 5.17248 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-04-07T13:53: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": "8eff52e960a0... |
b6c7c52d-2cd7-4097-82ee-d9b4fbe0d407 | foiegreis/dsa-cpp | data_structures/bitsets/bitsets.cpp | #include <iostream>
#include <bitset>
void printBitset(std::bitset<8> &myBitset){
for (size_t i = 0; i < myBitset.size(); ++i) {
std::cout << myBitset[i];
}
std::cout << std::endl;
}
int main() {
std::bitset<8> bits1; // Default initialization (all bits are 0)
std::bitset<8> bits2(42); ... | TOOL | 0.963421 | 5.674401 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-06-27T02:36: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": "2c6abee528b... |
f63eef0c-1ee4-40fd-831e-2263972b462b | cnyali-czy/code | vjudge/进阶指南0X05-0X05/A.cpp | #define REP(i, s, e) for (int i = s; i <= e; i++)
#define DREP(i, s, e) for (int i = s; i >= e; i--)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)
#include <bits/stdc++.h>
using namespace std;
const int maxn =... | ALGO | 0.999967 | 3.791173 | {
"github_metadata": {
"branch": "master",
"commit_count": 1593,
"repo_created_at": "2018-02-24T06:16: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": "a3cb977... |
e9bb2d38-c048-4cb0-92f8-e9257ecbf6b5 | lcbasu/Practise-Code | interview-preparation/MinHeapify.cpp | #include <iostream>
using namespace std;
void swap(int *a, int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}
int parentIndex(int i)
{
return i/2;
}
int leftChileIndex(int i)
{
return 2*i+1;
}
int rightChildIndex(int i)
{
return 2*i+2;
}
void minHeapify(int arr[], int i, int heapSize)
{
int l = leftChileIndex(i)... | ALGO | 0.99984 | 4.730503 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2014-03-28T10:49:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bb15837b36... |
02b5a553-7a66-4f11-9050-cb00587f805a | mrcoliva/ur10-controller | src/utilities/ow_core/include/ow_core/algorithms/scalar_finite_difference.h | /*! \file
*
* \author <NAME>
* \author <NAME>
* \author <NAME>
* \author <NAME>
* \author <NAME>
*
* \version 0.1
* \date 14.02.2020
*
* \copyright Copyright 2020 Institute for Cognitive Systems (ICS),
* Technical University of Munich (TUM)
*
* #### Licence
* Licensed under the Apache License, Versio... | ALGO | 0.97643 | 7.575004 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2021-06-03T14:09:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d80e3589ad... |
e5de4df5-075d-4b61-85db-5c21c598dc4a | tempure/algorithm-advance | category/动态规划/基环树DP/acwing_359.cpp | #include <bits/stdc++.h>
using namespace std;
/*
f[i][0]表示不选i 能选的最多点数
f[i][1]表示选i 能选的最多点数
对于i的子节点j:
1.不选i 那么j可选可不选 f[i][0] = ∑max{f[j][0], f[j][1]}
2.选i 那么要从i的子节点中选一个来限制i, f[i][1]可以用f[i][0]的部分来计算
枚举子节点j来限制i,也就是除了j其他的子节点都可选可不选 但是j必不选 要用来限制
f[i][1] = max{f[i][0] - max(f[j][1],f[j][0]) + f[j][0] + 1}
注意特判断开环的特殊位置 拆开边u-... | ALGO | 0.999779 | 3.895746 | {
"github_metadata": {
"branch": "master",
"commit_count": 1297,
"repo_created_at": "2020-11-16T08:58:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "64edbf3... |
a51a1eff-c48e-445a-a032-0dbb8ffe92a3 | robertcal/cpp_competitive_programming | AtCoder/ABC/129/D_after1.cpp | #include <bits/stdc++.h>
#define INF 1e9
using namespace std;
int main() {
int H, W; cin >> H >> W;
vector<string> S(H);
for (int i = 0; i < H; ++i) {
cin >> S[i];
}
//2次元配列
vector<vector<int>> cnt(H, vector<int>(W));
//横方向のカウント
for (int i = 0; i < H; ++i) {
vector<... | ALGO | 0.999747 | 4.178448 | {
"github_metadata": {
"branch": "master",
"commit_count": 694,
"repo_created_at": "2019-03-04T13:17: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": "0363b8e7... |
2dcfd258-fce7-40f3-a165-f544502b98a3 | lizi11q/algorithm | 静态查找/静态查找/demo.cpp | #include<stdio.h>
#define MAXSIZE 100
int Search1(int* arr, int n, int key);
int Search2(int* arr, int n, int key);
int Search3(int* arr, int n, int key);
int F[MAXSIZE];
int Search4(int* arr, int n, int key);
int main() {
//无效数据为arr[0]
int arr[MAXSIZE] = { 0,11,19,25,32,39,47,60,72,81,93 };
int result;
result = S... | ALGO | 0.999897 | 3.843983 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-02-05T15:10: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": "9f95a436ebeb... |
e7d80486-03a0-458d-942e-5e282a7f4c58 | iskang5532/PS | BOJ/16236 아기 상어.cpp | /*
* 16236 아기 상어
* BFS
* 시간 복잡도: ?
* 문제: https://www.acmicpc.net/problem/16236
* 참고: https://www.acmicpc.net/board/view/73362 (반례)
*/
// sol.1) 164ms
// 1. 상어가 먹을 수 있는 물고기까지의 거리를 모든 공간에 대해 조사
// 2. 확인 할 때마다 거리를 비교하며, 더 짧은 거리가 나올 경우 위치 및 거리 저장
// 3. 상어를 옮기며 물고기를 먹음.
// 4. 이후 물고기를 먹을 수 없는 경우가 나올 때까지 반복하며, 그 경우 상어... | ALGO | 0.999906 | 4.801165 | {
"github_metadata": {
"branch": "master",
"commit_count": 330,
"repo_created_at": "2021-07-29T10:17:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "97f260e5... |
89fae202-fc18-4388-b74b-acddd927fda4 | placher/Notre_Dame_Coursework | Fundamentals_of_Computing_2/lab10/Part1/findsimilar.cpp | //findsimilar.cpp
//<NAME>
//Finds a list of all unique words in a file, then returns the frequency of their occurances in a second file.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
//variable declaration
string filename;
str... | TOOL | 0.95676 | 4.814773 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2016-08-12T18:41:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "de7ac69e1... |
757f84c3-9ab2-43fa-b876-dba8e1075fc7 | 1llsun/Hash-Function | Implementation.cpp | #include <iostream>
#include "HashTable.h"
using namespace std;
Node::Node()
{
this->data = 0;
this->next = NULL;
this->prev = NULL;
}
Node::Node(int data)
{
this->data = data;
this->next = NULL;
this->prev = NULL;
}
int Node::getData()
{
return data;
}
Node* Node::getNext()
{
return... | ALGO | 0.997661 | 4.858777 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-12-08T04:19: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": "0a2be5132010... |
da803eaf-d158-40d7-a30b-40a145b893d1 | BioDynaMo/biodynamo | demo/soma_clustering/src/validation_criterion.h | // -----------------------------------------------------------------------------
//
// Copyright (C) 2021 CERN & University of Surrey for the benefit of the
// BioDynaMo collaboration. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compl... | ALGO | 0.988913 | 6.100442 | {
"github_metadata": {
"branch": "master",
"commit_count": 1781,
"repo_created_at": "2016-02-11T14:58:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 116,
"forks": 53,
"issues": 8,
"pull_requests": 16
},
"file_meta": {
"content_id": "1c1f... |
9fa6ea6e-f3b6-426b-b41a-bb4486ceffe0 | kait-ag/PLAC_A3 | 2nbody.cpp | // System Headers
#include <iostream>
#include <cmath>
#include <chrono>
#include <thread>
#include <vector>
#include <mutex>
#include <condition_variable>
#include <queue>
#include <functional>
// Project Headers
#include "nbody.h"
// #define GRAPHICS
#ifdef GRAPHICS
#include <SFML/Window.hpp>
#include <SFML/Graph... | ALGO | 0.998928 | 5.390834 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-05-30T02:39: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": "67836232d103... |
83324c68-4460-41ad-9ebd-31a00319ac3e | andresragot/UDITVolley | UDITVolley/Ball.cpp | #include "Ball.h"
/*
FUNCTIONS
*/
Ball::Circle& Ball::get_collider()
{
return ballCollider;
}
void Ball::set_position(Ball::Circle _position)
{
ballCollider.x = _position.x;
ballCollider.y = _position.y;
}
Ball::Ball()
{
//Initialize the offsets
ballCollider.x = 300;
ballCollider.y = 50... | ALGO | 0.932126 | 5.704664 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2023-11-29T19:07:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "780b73d1402... |
8ff2b6ea-e1ca-402b-8a92-deb520e300f8 | bartandrews/DiagHam_Stability | branches/testing_zp/FQHE/src/Tools/FQHEMonteCarlo/SphereGeneralEnergy.h | ////////////////////////////////////////////////////////////////////////////////
// //
// //
// DiagHam version 0.01 ... | ALGO | 0.929508 | 6.060754 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2022-07-12T10:41:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a9701f5c52... |
63f37671-1667-4f04-b9cd-f5a88cdf3088 | bortigno/tmva | deep/tmva_impl/inc/TMVA/NeuralNet_i.h | #ifndef TMVA_NEURAL_NET_I
#define TMVA_NEURAL_NET_I
#pragma once
namespace TMVA
{
namespace NN
{
static std::function<double(double)> ZeroFnc = [](double /*value*/){ return 0; };
static std::function<double(double)> Sigmoid = [](double value){ value = std::max (-100.0, std::min (100.0,value)); return 1.0/(1.0 + ... | ALGO | 0.998944 | 6.651926 | {
"github_metadata": {
"branch": "master",
"commit_count": 94,
"repo_created_at": "2015-11-08T00:49: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": "ad90dfc5f... |
31a75fb0-7b4c-4306-974d-27fa491bf50f | PSoldOut/CFriends | CFriends/Field.cpp | #include "Include.h"
#include "Field.h"
void Field::init()
{
traverse(0);
}
void Field::update(double dt)
{
}
void Field::display()
{
setColor(255);
for (int i = 0; i < 10; i++)
{
if (i % 3 == 0)
{
setLineWidth(4);
}
else
{
setLineWidth(1);
}
line(0, i * getHeight() / 9, getWidth(), i * ... | ALGO | 0.936219 | 4.459206 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2024-04-03T12:46: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": "fa1d7409c... |
7c5091c6-f25d-475e-9083-3addc7d05105 | theharshmittal/GeeksForGeeksPractice | equilibrium_point.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n, i, j, sumLeft = 0, sumRight = 0, flag = 0;
cin >> n;
int* arr = new int[n];
for(i = 0; i<n; i++)
cin >> arr[i];
if(n == 1)
{
cout << ... | ALGO | 0.999215 | 3.706498 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-09-01T07:38:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed48613702... |
b72c68e4-3779-4435-87fd-006c506c1c1a | xiaojiang2001/code_carl | 2.链表/demo3设计链表-C++封装.cpp | #include <iostream>
#include <vector>
#include <math.h>
using namespace std;
/*
int get(int index)
void addAtHead(int val)
void addAtTail(int val)
void addAtIndex(int index, int val)
void deleteAtIndex(int index)
*/
class MyLinkedList {
public:
//定义链表结构体
struct ListNode{
int val;
ListNode* next;
ListNode... | ALGO | 0.999551 | 4.318986 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2025-06-26T11:46:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "8107348e5... |
afdb7bdd-1af4-44f5-a56e-e302cfca67fc | itohdak/Competitive_Programming | AtCoder/ABC/archive/246/C.cpp | #include <bits/stdc++.h>
#include <print.hpp>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(... | ALGO | 0.999892 | 4.672142 | {
"github_metadata": {
"branch": "master",
"commit_count": 98,
"repo_created_at": "2020-10-16T18:27: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": "7e7655e8c... |
a8fe56d4-11c8-408e-890c-62e50915ed2d | av1shek/DSA-450 | Heap/18 Minimum sum of two numbers formed from digits of array.cpp | string add(string a, string b)
{
int carry = 0;
int i = a.size()-1, j = b.size()-1;
string s = "";
while( (i>=0) && (j>=0))
{
int val = a[i] - '0' + b[j] - '0' + carry;
s = char( '0' + val%10) + s;
carry = val/10;
i--; j--;
}
while(i>=0)
{
int... | ALGO | 0.999979 | 5.044353 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2021-05-10T10:37:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73655e65c... |
3d686de5-4b68-4d58-a6d9-01ecfcfdcff2 | midorimide/KNU | 3-rd course/1-st semester/CR/Lab4/Lab4/main.cpp | #include <vector>
#include <iostream>
#include <time.h>
using namespace std;
bool isPrime(const int& x) {
if (x == 1) {
return false;
}
for (int i = 2; i < (int)sqrt(x) + 1; ++i) {
if (x % i == 0) {
return false;
}
}
return true;
}
int nextPrime(const int& x) {
int a = x;
while (!isPrime(a++));
retu... | ALGO | 0.9999 | 4.628481 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2017-10-10T16:22:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "64dd117af... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.