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 |
|---|---|---|---|---|---|---|---|
ba808feb-a9b1-4e50-9bd8-4bf1b5e293db | doluong-opt/CodeContest | LightOJ/1049 - One Way Roads.cpp | /***********************************************
* Author - <NAME> *
* 1049 - One Way Roads ->AC
* Algorithm dfs
* Time Limit 0.004s
* *********************************************/
#include <iostream>
#include <stdio.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include ... | ALGO | 0.999982 | 4.359582 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-07-02T12:10: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": "cc5b5e640a... |
117d77fe-9343-470b-a4c8-48d597e33292 | w3raza/CPP | BjarneStroustrup/wyd. I/r08/chapter.8.5.1.cpp |
//
// To jest przykładowy kod z podrozdziału 8.5.1 „Deklarowanie argumentów i typu zwrotnego” książki
// "Programowanie. Teoria i praktyka z wykorzystaniem C++" Bjarne'a Stroustrupa.
//
#include "std_lib_facilities.h"
//------------------------------------------------------------------------------
double fct(int a... | ALGO | 0.981153 | 3.66988 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2022-07-03T22:02:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e652460f... |
9324a3f1-22b4-45be-8ed6-c65f715b0173 | scslab/bad | models/cpp-models/method4.cc | #include "method4.hh"
#include <algorithm>
#include <stdexcept>
using namespace std;
// Do we sort buckets lazily as needed? This optimization should improve the
// time for operations that don't touch all buckets, without hurting
// performance for those that do.
constexpr bool kLazy = true;
constexpr... | ALGO | 0.995099 | 5.877058 | {
"github_metadata": {
"branch": "master",
"commit_count": 801,
"repo_created_at": "2015-09-15T00:57:50.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2425254cd... |
c267460a-7ce7-4e7e-b6bc-b64ed4921e5b | Deepanshugupta65/DataStructure | topics/celebrityProblm.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution
{
private:
bool knows(vector<vector<int> >& M, int a, int b, int n) {
if(M[a][b] == 1)
return true;
else
return false;
}
public:
int celebrity(vector<vector<int> >& M, int n) {
stack<int> s;
... | ALGO | 0.999882 | 4.924872 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2023-11-26T06:09: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": "38174d53f44... |
bf038998-68d7-46e7-889f-e80293b704b0 | xoruddl/boj | 백준/Gold/27978. 보물 찾기 2/보물 찾기 2.cc | #include <iostream>
#include <queue>
#include <algorithm>
#define INF 987654321
using namespace std;
int H, W;
char MAP[503][503];
int dist[503][503];
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
int targetX = 0;
int targetY = 0;
void bfs(int b, int a) {
priority_queue<pair<... | ALGO | 0.999838 | 3.792751 | {
"github_metadata": {
"branch": "main",
"commit_count": 303,
"repo_created_at": "2024-05-14T08:41: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": "9423df1971... |
03391a88-28bb-4086-80dc-fe2ab4e5f4ef | dreyus95/AVSP_SourceQualityPrediction | CodeJamCrawler/dataset/13_7280_80.cpp | /* ############################################################################
* START OF HEADER
* ############################################################################
*/
#include<cstdio>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<casse... | ALGO | 0.999501 | 3.481223 | {
"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": "c70579e5d... |
66f3e023-1e12-4935-b88e-1705a29ed68c | vrangr1/competitive-programming | contests/atcoder/beginner_contests/abc_340/d.cpp | /***************************************************
* Author : <NAME>
* Nick : vrangr
* Created : Sat Feb 10 17:54:36 IST 2024
****************************************************/
#include <iostream>
#include <vector>
#include <string.h>
#include <ctype.h>
#include <set>
#include <stdlib.h>
#include <map>
#includ... | ALGO | 0.999702 | 4.423419 | {
"github_metadata": {
"branch": "main",
"commit_count": 585,
"repo_created_at": "2021-06-02T19:31: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": "64df9b702d... |
a465b64f-af4d-415a-9338-a03a98108209 | littlecloud1/leetCode | lc66.cpp | //leetcode: 66. Plus One
//go through the vector from the end to the begin
//add one to the end and if sum > 9 , store carry
//if carry > 0 then go to next position and add it
//repeat until reach the begin of vector
//if carry > 0, insert one at the begining
class Solution {
public:
vector<int> plusOne(vector<int... | ALGO | 0.999435 | 5.460068 | {
"github_metadata": {
"branch": "master",
"commit_count": 59,
"repo_created_at": "2018-07-10T08:15:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bd57e806... |
9bd0f9f6-a950-4eae-a9d9-4542cfabda33 | Colinerith/Algoriithm | p_heap_2.cpp | #include <string>
#include <vector>
#include <queue>
#include<iostream>
using namespace std;
struct comp1 { // 도착시각 순
bool operator()(pair<int, int> a, pair<int, int> b) {
if (a.first == b.first)
return a.second > b.second;
return a.first > b.first;
}
};
struct comp2 { // 소요시간 순
bool operator()(pair<int, i... | ALGO | 0.999943 | 5.098341 | {
"github_metadata": {
"branch": "main",
"commit_count": 179,
"repo_created_at": "2021-03-24T04:52: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": "0419c6000a... |
249bdc4c-77ff-47ce-9908-ba720a5466ef | OI-wiki/OI-wiki | docs/math/code/continued-fraction/recover-fraction.cpp | #include <algorithm>
#include <iostream>
#include <tuple>
#include <vector>
// Find the continued fraction representation of P/Q.
auto fraction(int p, int q) {
std::vector<int> a;
while (q) {
a.push_back(p / q);
std::tie(p, q) = std::make_pair(q, p % q);
}
return a;
}
// Find the convergents of a cont... | ALGO | 0.999955 | 5.205679 | {
"github_metadata": {
"branch": "master",
"commit_count": 12101,
"repo_created_at": "2018-07-11T03:28:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 23612,
"forks": 4310,
"issues": 112,
"pull_requests": 9
},
"file_meta": {
"content_id":... |
d43a7c1e-183f-4daf-8573-df05c5b2c188 | abhay-byte/DSA-QUESTIONS | 50-search-in-rotated-sorted-array-ii/81.search-in-rotated-sorted-array-ii.cpp | #include <iostream>
#include <vector>
#include <algorithm>
/*
* @lc app=leetcode id=81 lang=cpp
*
* [81] Search in Rotated Sorted Array II
*/
// @lc code=start
class Solution
{
public:
bool binarySearch(std::vector<int> &nums, int left, int right, int target)
{
while (left <= right)
{
... | ALGO | 0.999995 | 6.390559 | {
"github_metadata": {
"branch": "main",
"commit_count": 105,
"repo_created_at": "2025-06-28T12:38:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "5c84836d48... |
2465a6a3-8fad-4135-bbc4-20a84ff8e2fd | ranavikramsinha/cpp-practice | Week 1/p5.cpp | /*Given a comparison symbol S between two numbers A and B. Determine whether it is Right or Wrong.
The comparison is as follows: A < B, A > B, A = B.
Where A, B are two integer numbers and S refers to the sign between them.
Input
Only one line containing A, S and B respectively (-100 ≤ A, B ≤ 100), S can be ('<'... | ALGO | 0.999942 | 3.016502 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-05-07T12:51: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": "97b7140ba52e... |
f0012139-dc0f-4998-8ac2-9127bccb89b5 | ishandutta2007/codeforces-u | umqra/normal/512/A.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
typedef long lo... | ALGO | 0.999827 | 3.517411 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:31: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": "5296d6ba30e9... |
7b219056-8339-4007-a69c-4c855ff9abaa | Iamnvincible/myleetcode | String/Solution_5.hpp | #ifndef SOLUTION_5
#define SOLUTION_5
/*
Given a string s,
find the longest palindromic substring in s.
You may assume that the maximum length of s is 1000.
找字符串中最长的回文序列
如果不止一个返回其中一个即可
我朴素的想法是
遍历一遍,找和当前字符一致的下一个字符
判断这两个字符之间是不是回文
同时记录最长的回文长度,减少遍历的次数
记录最长的回文起始位置
就是判断的次数太多了
更快的办法
从中间向两边扩展,判断两边元素是否一样
*/
#include <strin... | ALGO | 0.999968 | 5.284136 | {
"github_metadata": {
"branch": "master",
"commit_count": 174,
"repo_created_at": "2018-09-25T07:29:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "72d83978... |
4744ad8f-7526-4b81-82dc-2582c5b51191 | kason-huang/algorithm_learning | SELF/Sort/test.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void print_arr(int* arr, int size)
{
for(int i = 0; i < size; i++)
{
cout << arr[i] << " ";
}
cout << endl;
}
void HeapAdjust(int *a,int i,int size) //调整堆
{
int lchild=2*i; //i的左孩子节点序号
int rchild=2*i+1; //i的右孩子... | ALGO | 0.999941 | 4.237754 | {
"github_metadata": {
"branch": "master",
"commit_count": 66,
"repo_created_at": "2017-01-19T03:27: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": "4e39e0e7a... |
ba6f3911-eb3f-4fbc-9bb3-8bc46dd63a81 | AdamHarris-GamesProgrammer/FGAGS | DX11 Framework 2018/IntersectionTests.cpp | #include "IntersectionTests.h"
static inline float TransfromToAxis(
const Box& box, const Vector3& axis) {
return
box._halfSize.x * fabsf(axis * box.GetAxis(0)) +
box._halfSize.y * fabsf(axis * box.GetAxis(1)) +
box._halfSize.z * fabsf(axis * box.GetAxis(2));
}
bool IntersectionTests::SphereAndPlane(const Sph... | TEST | 0.92149 | 5.574753 | {
"github_metadata": {
"branch": "main",
"commit_count": 239,
"repo_created_at": "2020-10-05T07:57: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": "bce74eb816... |
09b7c254-7694-43a1-8149-ed890765579b | slonichobot/codebook | strings/kmp.cpp | #include "../template.cpp"
// Pattern matching in O(n) query, O(m) preprocess, O(m) space
// n=|txt|, m=|patt|
// ===================
#define MAX 10007 // max length of patt
ll B[MAX];
// B[i]: length of longest common (own) prefix (strictly shorter)
// -1 = sentinel
// 0 1 2 3 4 5 6 7 8 9 10 11
//str: ... | ALGO | 0.999692 | 5.080637 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-05-24T05:45: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": "3bfcf55423... |
fff2d7a3-bb7f-4083-bf68-88ff816dbfb7 | hyb8892208/wire | my_tools/app/license/genlicense/encryptlicense.cpp | #include "openssl/err.h"
#include "openssl/des.h"
#include "openssl/rc4.h"
#include "openssl/md5.h"
#include "openssl/rsa.h"
#include "openssl/pem.h"
#include <cryptopp/base64.h>
#include <cryptopp/files.h>
#include <cryptopp/modes.h>
using namespace CryptoPP;
#include <iostream>
#include <cstring>
#include <fstream... | ALGO | 0.973171 | 4.137716 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-09-23T09:49:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "308972a8cb... |
99bbb519-d5f0-4f07-b3c0-28252ae66f80 | softwareQinc/qpp | examples/circuits/teleport_qudit_circuit.cpp | // Qudit teleportation quantum circuit simulator
// Source: ./examples/circuits/teleport_qudit_circuit.cpp
#include <iostream>
#include "qpp/qpp.hpp"
int main() {
using namespace qpp;
idx d = 5; // qudit dimension
std::cout << ">> Qudit teleportation (d = " << d << ") ";
std::cout << "quantum circui... | ALGO | 0.90285 | 4.197845 | {
"github_metadata": {
"branch": "main",
"commit_count": 3213,
"repo_created_at": "2014-03-21T20:00:40.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 611,
"forks": 131,
"issues": 3,
"pull_requests": 1
},
"file_meta": {
"content_id": "fe6fb1... |
63db3b87-4181-4d18-bc10-f8f8a38e275e | BaranovMykola/Educational-Practice | Library/Library - Source.cpp | #include <iostream>
#include "LibraryBaseData.h"
#include <algorithm>
#include <iterator>
#include <forward_list>
#include <iomanip>
#include <vector>
using namespace std;
enum Aaction{ADD, DEL, VIEW, EXIT};
enum SortBy{YEAR, AUTHOR};
void main()
{
ifstream file("BaseData.txt");
/* while (!file.eof())
{
LibraryB... | TOOL | 0.977482 | 4.440492 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-02-22T21:36: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": "5cb7a656d5... |
f382885b-9fbc-47a4-b694-fb97605178b2 | algorithm005-class01/algorithm005-class01 | Week_01/G20190343020242/LeetCode_26_0242.cpp | /*
* @lc app=leetcode.cn id=26 lang=cpp
*
* [26] 删除排序数组中的重复项
*
* https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/description/
*
* algorithms
* Easy (47.44%)
* Likes: 1207
* Dislikes: 0
* Total Accepted: 208.8K
* Total Submissions: 440.2K
* Testcase Example: '[1,1,2]'
*
* 给定一个排... | ALGO | 0.999865 | 5.916669 | {
"github_metadata": {
"branch": "master",
"commit_count": 2003,
"repo_created_at": "2019-12-01T14:31:06.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 18,
"forks": 128,
"issues": 641,
"pull_requests": 5
},
"file_meta": {
"content_id": "42a... |
26ea5c64-366a-4a86-9775-6ae701a8d106 | El-Medonho/Contests | Geral/CodeForces/Contests/rnd 856 (only e left)/a.cpp | #include "bits/stdc++.h"
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define MOD 1000000009
#define mod(x,mvvm) (((x%mvvm)+mvvm)%mvvm)
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define pll pair<lon... | ALGO | 0.999843 | 4.270053 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2022-09-03T14:12:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c7743203ce1... |
7d72fe02-9ab3-4fa5-964b-2a4c660bb553 | Hi-Simon/NTU-ACM-Document | code/2DBIT.cc | int N;
int c[maxn][maxn];
inline int lowbit(int t) {
return t&(-t);
}
void update(int x, int y, int v) {
for (int i=x; i<=N; i+=lowbit(i)) {
for (int j=y; j<=N; j+=lowbit(j)) {
c[i][j]+=v;
}
}
}
int query(int x, int y) {
int s = 0;
for (int i=x; i>0; i-=lowbit(i)) {
for (int j=y; j>0; j-=lowbit(j)) {
... | ALGO | 0.999808 | 3.159793 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2019-05-20T12:36: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": "47e6bd816a... |
86a49078-e119-4ff2-b096-a9e94d1d8e6c | st117210/2023-cpp-autumn | 2023.11.21-homework-6/Task 7/Source.cpp | #include<iostream>
int n[4]{ 0 };
int** d = new int* [4] { nullptr, new int[10], new int[10], new int[10] };
void shift(int from, int to);
void hanoi(int count, int from, int to);
void sort(int a = 1);
int top(int a);
int main(int argc, char* argv[])
{
std::cin >> n[1];
for (int i = n[1] - 1; i >= 0; --i)
{
std... | ALGO | 0.999982 | 4.236774 | {
"github_metadata": {
"branch": "main",
"commit_count": 48,
"repo_created_at": "2023-09-05T15:15: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": "a3ff7e94d6a... |
4415fca7-5a1a-4f02-8177-56928f056ac8 | jasonlarue/csci104-coursework | hw3/stringparser.cpp | #include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include "stackstr.h"
using namespace std;
/* Here's an overview of how this program runs:
We getline each line of the file, remove all spaces, and then put the entire
line into MasterStack. Then, scanner is run which finds a... | ALGO | 0.982867 | 4.073356 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-09-19T06:38: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": "e167cdfcb3... |
4e5909db-44a4-49e0-98b6-a32d64f3d3a4 | raincross7/code-similarity | codes/train_code/problem321/problem321_176.cpp | #pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define... | ALGO | 0.999979 | 4.09002 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "467e8916f7c6... |
d91e0efe-1cff-42cc-804f-a2059eec399f | yliu-cs/ACM | LuoGu/洛谷-P3806.cpp | #include <bits/stdc++.h>
const int maxn = 1e4 + 5;
const int maxk = 1e7 + 5;
int n, m;
struct Edge { int v, c; };
std::vector<Edge> g[maxn];
int sum, rt;
int max[maxn], sz[maxn];
bool vis[maxn];
void FindRoot(int u, int p) {
sz[u] = 1; max[u] = 0;
for (auto &e : g[u]) {
int v = e.v;
if (v == p |... | ALGO | 0.999982 | 4.484606 | {
"github_metadata": {
"branch": "master",
"commit_count": 442,
"repo_created_at": "2018-10-03T10:47:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "724e34a8... |
83b66cec-6975-4166-9fba-86b8bac87f00 | jimlinntu/gym | leetcode/286/main-bfs-Omn.cc | class Solution {
public:
int m, n;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void wallsAndGates(vector<vector<int>>& rooms) {
m = rooms.size();
n = rooms[0].size();
queue<pair<int, int>> q;
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
... | ALGO | 0.999941 | 5.87695 | {
"github_metadata": {
"branch": "master",
"commit_count": 591,
"repo_created_at": "2019-10-09T14:58:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "60ff1360... |
206ab330-c08f-44c2-8a61-9aa6287b6896 | mrpkdeveloper/450-DSA-Questions | c++/Heap/convertMinHeapToMaxHeap.cpp | #include <bits/stdc++.h>
using namespace std;
void printArray(vector<int> &arr)
{
for (auto i : arr)
cout << i << " ";
cout << endl;
}
void downHeapify(vector<int> &arr, int parentIndex)
{
int maxIndex = parentIndex;
int leftChildIndex = 2 * parentIndex + 1;
int rightChildIndex = 2 * paren... | ALGO | 0.999743 | 4.90502 | {
"github_metadata": {
"branch": "main",
"commit_count": 324,
"repo_created_at": "2021-04-11T04:14:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 792,
"forks": 272,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "1d8396... |
4b9c990e-cd8a-409d-8acc-839ee877f370 | queuedq/ps | BOJ/30807/main.cc | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct DisjointSet {
vector<int> par;
void reset(int N) {
par.resize(N + 1);
for (int i = 1; i <= N; i++)
par[i] = i;
}
int find(int x) {
if (par[x] == x)
return x;
... | ALGO | 0.999986 | 3.702421 | {
"github_metadata": {
"branch": "master",
"commit_count": 824,
"repo_created_at": "2018-05-26T14:07:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1af803c... |
fefd6ea9-de30-46df-8183-91ae39e339fc | DevBaweja/Competitive-Coding | GeeksForGeeks/Graph Algorithms/Tarjan Strongly Connected.cpp | #include <bits/stdc++.h>
using namespace std;
// low - earliest visited vertex
int dfs(int cur, vector<int> adj[], vector<int> &dis, vector<int> &low, int &t, vector<bool> &inStack)
{
dis[cur] = t;
low[cur] = t;
inStack[cur] = true;
t++;
for (int el : adj[cur])
{
if (dis[el] == -1)
... | ALGO | 0.997678 | 5.412196 | {
"github_metadata": {
"branch": "master",
"commit_count": 76,
"repo_created_at": "2020-10-25T07:57:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "410eedf8f... |
89c8a29d-e54a-4b9e-9aca-e0ca8fb7aad8 | SohnQuixote/Algorithm | C++/삼성 기출/색종이 옮기기/main.cpp | #include <iostream>
using namespace std;
/*
색종이 붙이기
1*1, 2*2, 3*3,4*4,5*5
각 종류 색종이 5개씩
모든 1을 덮는데 필요한 색종이의 최소 개수
dfs로하면 될 것으로 보임
가장 왼쪽 위에 있는 1
색종이 겹쳐도 안됨
*/
int arr[10][10] = {0,};
int papers[6] = {0,5,5,5,5,5};
int result = 987654321;
int jongied[10][10] = {0,};
void find_next_one(int &x, int &y)
{
for(... | ALGO | 0.999542 | 3.577595 | {
"github_metadata": {
"branch": "main",
"commit_count": 282,
"repo_created_at": "2021-07-18T00:57: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": "726974fa40... |
a50dcfb9-2fe8-4499-8764-4f6824c59c38 | SelfishOlex/GridMateLab | dev/Code/Tools/SceneAPI/SceneCore/Import/Utilities/FileFinder.h | #pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the lice... | TOOL | 0.920893 | 6.657432 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2017-10-05T03:30:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c635cc9607... |
c1b5fe01-e741-4811-b1dd-4eeb688ddd51 | buaa-hipo/MSToolkit | test/lib/memory_wrapper/mpi_example.cpp | #include <iostream>
#include <mpi.h>
#include <unistd.h>
int main(int argc, char** argv) {
// 初始化 MPI 环境
MPI_Init(&argc, &argv);
// 获取进程总数和当前进程的编号
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size); // 获取进程数
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); // 获取当前进程的编号
... | ALGO | 0.914414 | 4.921032 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-01-15T06:29:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "512fb1397ff9b... |
189b9f6f-d7e9-44fe-bd42-e865a52816a9 | ishandutta2007/codeforces-z | zhukov_dmitry/normal/264/B.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define bublic public
#define clr(x) memset((... | ALGO | 0.999951 | 3.958517 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:43: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": "516bce177d17... |
ceed428c-5201-4f6a-9dc9-60aa6beb9b1a | rn10950/RetroZilla | security/nss/gtests/nss_bogo_shim/config.cc | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
... | TOOL | 0.956275 | 6.285402 | {
"github_metadata": {
"branch": "master",
"commit_count": 196,
"repo_created_at": "2015-10-21T02:38:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 285,
"forks": 20,
"issues": 14,
"pull_requests": 2
},
"file_meta": {
"content_id": "91e4... |
db9af28c-ae77-4d90-b5a8-053f673f3b93 | 4x11/build69 | jni/vendor/raknet/SAMP/samp_auth.cpp | // https://github.com/P3ti/RakSAMP/blob/master/raknet/SAMP/samp_auth.cpp
#include <main.h>
#define endian_swap8(x) (x)
#define endian_swap16(x) ((x>>8) | (x<<8))
#define endian_swap32(x) ((x>>24) | ((x<<8) & 0x00FF0000) | ((x>>8) & 0x0000FF00) | (x<<24))
#define endian_swap64(x) ((x>>56) | ((x<<40) & 0x00FF00000000000... | ALGO | 0.991482 | 4.326947 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-04-20T12:55:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 66,
"forks": 66,
"issues": 18,
"pull_requests": 3
},
"file_meta": {
"content_id": "fed38a6... |
49097a93-2189-47da-b364-535306f57e6a | dygks232/ACMICPC_problem | BFS/Heap/9376_PrisonBreak.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
using namespace std;
#define W... | ALGO | 0.99981 | 3.666895 | {
"github_metadata": {
"branch": "master",
"commit_count": 169,
"repo_created_at": "2020-03-07T07:41: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": "856759f1... |
e8051ea7-a37e-4a27-8b58-7d5f57dfe2c8 | sekiya9311/Programming-Contest | codeforces/ECR#50/C.cpp | #include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <uno... | ALGO | 0.999651 | 4.028043 | {
"github_metadata": {
"branch": "master",
"commit_count": 469,
"repo_created_at": "2016-06-19T09:44: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": "e8204954... |
b7111e1a-247b-4bea-b2b4-481c3137b37e | superweaver/leetcode | p1329.cc | #include "common.h"
class Solution {
public:
vector<vector<int>> diagonalSort(vector<vector<int>>& mat) {
int m = mat.size();
int n = mat[0].size();
for (int i = m -1; i >= 0; --i) { // j = 0;
vector<int> temp;
int r = i;
int c = 0;
while(r < m && c < n) {
temp.push_back(mat[r][c]);
r++;
... | ALGO | 0.999986 | 5.604722 | {
"github_metadata": {
"branch": "master",
"commit_count": 285,
"repo_created_at": "2017-10-31T23:49: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": "a386c879... |
f61a724f-3a13-460b-b1cf-f79f510bc083 | jakev/CobraDroidBeta | src/external/chromium/base/string_split.cc | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/string_split.h"
#include "base/string_util.h"
namespace base {
bool SplitStringIntoKeyValues(
const std::string& line,
char ... | TOOL | 0.983015 | 6.542244 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2013-06-24T07:16:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 7,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "6649c9b26... |
5fbc95ab-f669-4aaf-80c8-b7b0ac9805b4 | ZEUSRPA/CompetitiveProgramming | Training/Codeforces/OlympicRanking.cpp | #include <bits/stdc++.h>
#define ENDL '\n'
#define deb(u) cout << #u " : " << (u) << ENDL;
#define deba(alias, u) cout << alias << ": " << (u) << ENDL;
#define debp(u, v) cout << u << " : " << v << ENDL;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lli long long
#define ld long dou... | ALGO | 0.999777 | 3.76659 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-02-17T17:25: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": "a4df29e77c68... |
b64eaa14-14ad-475c-8ba3-8d79605718e2 | AnjaneyaGoyal/Competitve-Programming | CSES/Sum_of_Three_Values.cpp | /*#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,i,j;
ll m,sum;
cin>>n>>m;
vector<ll>a(n+1);
unordered_map<ll,int> mpp;
for(i=1;i<=n;i++){
cin>>a[i];
}
for(i=1;i<=n;i++){
sum=m-a[i];
... | ALGO | 0.999995 | 3.542722 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2025-07-04T17:05: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": "946130d41b49... |
d7ae82f8-86a3-4e0b-ae04-628bda29f66d | omkar1403/DSA-questions-on-daily-basis | DP_Series/TAKE_NOTAKE/Leetcode1863.cpp | /*isme dekho hamne ind less than hone pe sum return ki hai soo
u have to return the total sum Firstly i made a mistake that I was returning nums[ind]^sum
on ind==0 which is wrong because it is already calculating in take part soo u have to just return the sum when u
are going out of index that's it*/
class Solution... | ALGO | 0.999996 | 5.843386 | {
"github_metadata": {
"branch": "main",
"commit_count": 123,
"repo_created_at": "2024-05-01T07:41: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": "ec360a8c62... |
c9267dde-7c7f-4392-a44f-4ebbfbb11e5c | carolinajimenez26/Competitive-programming | Algorithms/maxSubArray.cpp | #include <iostream>
#include <vector>
#include <limits>
using namespace std;
// O (nums.size())
int maxSubArrayIterative(vector<int>& nums) {
if (nums.size() == 0) return -2147483648;
int best = nums[0];
int curr = nums[0];
for (int i = 1; i < nums.size(); i++) {
int sum = curr + nums[i];
curr = max(s... | ALGO | 0.999953 | 5.638919 | {
"github_metadata": {
"branch": "master",
"commit_count": 299,
"repo_created_at": "2019-07-28T18:33:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4312ddd7... |
3dfdb0e8-988b-48f3-8729-7cfe8adb6a57 | jaxvanyang/acm | cyj/训练/4-13/a.cpp | /*
* @Descripttion:
* @Topic link:
* @Question meaning:
* @Status:
* @Author: cyj
* @Date: 2021-04-13 20:07:06
* @LastEditTime: 2021-04-13 22:01:54
*/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
using nam... | ALGO | 0.999997 | 4.194775 | {
"github_metadata": {
"branch": "master",
"commit_count": 384,
"repo_created_at": "2021-11-02T02:32: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": "b3546e6d... |
6296786f-18ad-4284-bfeb-6ea97ac0ca29 | Kestrel-omega/Baekjoon | src/1012.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
ios_base ::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T, M, N, K, x, y;
cin >> T;
while(T--)
{
cin >> M >> N >> K;
vector<vector<int>> board(N, v... | ALGO | 0.999838 | 4.218546 | {
"github_metadata": {
"branch": "main",
"commit_count": 141,
"repo_created_at": "2021-06-27T07:40:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b908608297... |
210dbad9-e03b-4fb4-b981-7705195917eb | Zero-Vec/cppACM | ACM/codeforce/1760E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 9;
ll a[N];
ll f(ll a[], int n)
{
ll res = 0, c1 = 0;
for (int i = 1; i <= n; ++i)
{
if (a[i])
c1++;
else
res += c1;
}
return res;
}
void solve()
{
int n;
cin >> ... | ALGO | 0.999955 | 4.095631 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-03-04T17:21: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": "ea5f8a34a6a8... |
2376b2c4-2c91-4a77-a63b-b9b78bc20258 | Kuro-orzz/CP | Codeforces/education/dsu/C1.cpp | // #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD (ll)(1e9+7)
#define ... | ALGO | 0.999922 | 5.095923 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2025-03-10T14:13: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": "71098f24667... |
a07c12e0-65e7-44a3-bbf7-53882b1d73de | steemit/steem | libraries/fc/src/crypto/restartable_sha256.cpp |
#include <fc/bitutil.hpp>
#include <fc/crypto/restartable_sha256.hpp>
namespace fc {
static uint32_t kvalues[] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0... | ALGO | 0.997211 | 7.384079 | {
"github_metadata": {
"branch": "main",
"commit_count": 5156,
"repo_created_at": "2016-03-23T00:17:55.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1954,
"forks": 792,
"issues": 349,
"pull_requests": 8
},
"file_meta": {
"content_id": "783... |
9b842b3c-289a-424a-92f5-d907413e732b | luoyin500/aliceVision-1 | multiview/rotationAveraging/l1.hpp | // This file is part of the AliceVision project.
// Copyright (c) 2016 AliceVision contributors.
// Copyright (c) 2012 openMVG contributors.
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https:... | ALGO | 0.999555 | 7.080722 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2020-08-18T07:33: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": "199ec2791... |
7bfd7ef8-7c2d-4189-b7bb-2e4d2dabac8f | ricardodalarme/Competitive-Programming | Uri/1244.cpp | // https://www.urionlinejudge.com.br/judge/pt/problems/view/1244
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
string c;
cin >> a;
vector<vector<string>> v;
v.resize(51);
for (int i = 0; i < a; i++)
{
do
{
cin >> c;
v[c.size()].... | ALGO | 0.999661 | 3.464054 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2019-07-10T03:36:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0abff8e050b... |
eec8a114-f7e7-42df-9089-38721ded98d6 | woosmile/algorithm | barkingdog/0x09/boj1926.cpp | #include <iostream>
#include <utility>
#include <queue>
#define X second
#define Y first
using namespace std;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
bool board[502][502];
bool visit[502][502];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
int x = 0, y = 0;
in... | ALGO | 0.9999 | 3.513453 | {
"github_metadata": {
"branch": "master",
"commit_count": 85,
"repo_created_at": "2024-01-11T09:41: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": "6b176a481... |
67b33096-9953-41f5-b4f6-47a0285dc9bc | Kamisorara/Algorithm_Codeforces | Solutions/800/1759A - Yes-Yes/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define INF 0x3f3f3f3f
#define MOD le9 + 7
#define sd(n) scanf("%d", &n)
#define sdd(n, m) scanf("%d %d", &n, &m)
#define mem(a, b) memset((a), (b), sizeof(a))
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define fast_io \
... | ALGO | 0.999682 | 3.627493 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2022-11-10T15:05:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d1a4ba58f... |
0fab54e5-1281-4474-a571-7b4d8e0df5b8 | fang-tech/Algorithm | Solution/Leetcode/last/1020.Num of Enclaves[dfs].cpp | /*
* @lc app=leetcode.cn id=1020 lang=cpp
*
* [1020] 飞地的数量
*/
#include <vector>
#include <iostream>
using namespace std;
// @lc code=start
class Solution {
private:
int visited[505][505] = {0};
int counter = 0;
int flag = 1;
int d[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
void dfs(vector<vector... | ALGO | 0.999914 | 5.972336 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-02-17T06:01: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": "db70f024c8a5... |
de8bae85-e5a7-4948-af94-f6b9964b7919 | ericleoo/fyp | Gsketch.cpp | #include "Gsketch.h"
struct Gsketch::outCmp{
Gsketch* m;
outCmp(Gsketch* p) : m(p) {};
bool operator() ( int i, int j )
{
if(!m->outNeighbour.count(i) && !m->outNeighbour.count(j)) return i < j;
if(!m->outNeighbour.count(i)) return true;
if(!m->outNeighbour.count(j)) return false;
return m->outTotalFreq[i... | ALGO | 0.999201 | 3.704544 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2017-11-08T09:37: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": "fe9f7a092... |
8ff23160-07af-4a78-bff3-77892cca4e5b | LiorZadah1/Disk-File-System-Simulation | main.cpp | ///<NAME> - Final Project
#include <iostream>
#include <vector>
#include <map>
#include <assert.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace std;
#define DISK_SIZE 256
// ==================================================... | TOOL | 0.990755 | 3.913487 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-03-22T14:20:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c18a507842... |
bfcc8e72-2690-4bde-bdfa-a3d6c9048d7f | cjr61/LZW-File-Compression | Project 2/lzw435M.cpp | #include <string>
#include <map>
#include <iostream>
#include <fstream>
#include <iterator>
#include <vector>
#include <cmath>
#include <fstream>
#include <sys/stat.h>
/*
This code is derived for UA CS435 from LZW@RosettaCode
*/
// Compress a string to a list of output symbols.
// The result will be written to the ... | ALGO | 0.99061 | 4.443686 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-01-31T17:40: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": "61c98c6794... |
3929e776-6502-4f70-bf73-640810bf1da5 | ishandutta2007/codeforces-b | bench0310/normal/1728/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
struct mi
{
int v;
mi(){v=0;}
mi(ll _v){v=int(-mod<=_v&&_v<mod?_v:_v%mod); if(v<0)v+=mod;}
explicit operator int()const{return v;}
friend bool operator==(const mi &a,const mi &b){return (a.v==b.v);}
f... | ALGO | 0.999811 | 4.182208 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05: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": "1b26513106ee... |
266a3a83-b80b-4b2e-8f9e-7f2f13828b27 | Abunyawa/contests | 688/с.cpp | // chrono::system_clock::now().time_since_epoch().count()
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define debug(... | ALGO | 0.999832 | 4.279793 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2020-03-29T11:27:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8a4fbab4... |
d358f00b-6374-4b4c-b290-5a87caac6fed | Gmo3/Poker-Statistical-simulator | poker.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
using namespace std;
const int NUM_SIMULATIONS = 1000000;
// Function declarations:
void initializeDeck(int deck[]);
void shuffleDeck(int deck[]);
bool isStraight(int R[]);
bool isPair(int R[]);
bool isFlush(int S[]);
bool isThreeOfAKind(int R[... | ALGO | 0.996799 | 5.709541 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-10-27T23:42: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": "33f7a99bb7... |
ae2400ab-9851-46e9-968c-a0bcbf250cd8 | becklo/3D_mono_camera | avec_buffer/old/depth.cpp | #include <iostream>
#include <stdio.h>
#include <math.h>
#include "var.h"
#include "conv.cpp"
void creation_error(int image_floue[IMG_WIDTH][IMG_HEIGHT], int image_net[IMG_WIDTH][IMG_HEIGHT],
int num_filtre, int rec_error_tab[IMG_WIDTH+16][IMG_HEIGHT+16]){//[IMG_WIDTH+16][IMG_HEIGHT+16]){
ac_fi... | DATA | 0.95384 | 3.720501 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2017-12-21T07:58: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": "409223173... |
822a8bc8-079e-4645-a1a1-92910150a57e | mayank171/Data-Structure-Programs | recursive_binary_search.cpp | // C++ program to implement recursive Binary Search
#include <bits/stdc++.h>
using namespace std;
// A recursive binary search function. It returns
// location of x in given array arr[l..r] is present,
// otherwise -1
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r - l) / 2;
// ... | ALGO | 0.999925 | 5.424139 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2020-06-28T05:05:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "940344c45... |
96d23ff2-45f8-470d-b380-6adb9a7aa84a | LaZoark/NIU_programming | 簡易電話簿/main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <windows.h>
#include <conio.h>
#include <iomanip>
#include <vector>
#define FILE_NAME "聯絡人.txt" //檔案名稱
using namespace std;
///!*問題:即便我不再使用push_back ,capacity 依然會翻倍增加...
fstream contacts;
int s=0,*Sort=&s,k;
vector <strin... | TOOL | 0.966137 | 3.308846 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-04-22T11:34: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": "ca11316cd7... |
af6e23bb-5e96-465f-b0be-75514d1008ae | USC-PRL/ReMod3D | Source/ReBots/BBPSO/BranchBoundParticleSwarm.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "BranchBoundParticleSwarm.h"
#include <chrono>
/**
* @brief constructor
*/
BranchBoundParticleSwarm::BranchBoundParticleSwarm(){}
/**
* @brief destructor
*/
BranchBoundParticleSwarm::~BranchBoundParticleSwarm(){}
/**
* @br... | ALGO | 0.999941 | 5.656572 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2018-05-20T14:42:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "701e89b66... |
5442a2c1-0a3c-4f3b-be31-97959b466480 | marcovirgolin/GP-GOMEA | src/Utils/KDTree.cpp | /*
*/
#include "GPGOMEA/Utils/KDTree.h"
using namespace kdt;
using namespace std;
using namespace arma;
void KDTree::build(const std::vector<arma::vec> & points) {
clear();
points_ = points;
_dim = points[0].size();
std::vector<int> indices(points.size());
std::iota(std::begin(indices), st... | ALGO | 0.999475 | 6.026886 | {
"github_metadata": {
"branch": "master",
"commit_count": 121,
"repo_created_at": "2019-01-04T10:15:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 54,
"forks": 24,
"issues": 3,
"pull_requests": 1
},
"file_meta": {
"content_id": "17ad41... |
5be511eb-f611-43f8-a764-b5b3f3380f10 | skandavc18/logic_detector | backend/CDataset/numIslands/numIslands_56.cpp | class Solution {
public:
int nr_row, nr_col;
const int TYPE_WATER = 0x7fffffff;
int numIslands(vector<vector<char> > &grid) {
if (grid.empty() || grid[0].empty()) {
return 0;
}
nr_row = grid.size();
nr_col = grid[0].size();
int type_num = 0;
vecto... | ALGO | 0.999749 | 5.96005 | {
"github_metadata": {
"branch": "master",
"commit_count": 147,
"repo_created_at": "2020-10-01T10:26:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "05dda9c5... |
f3816f50-3be7-4a03-ab1d-a0e306d93e3c | bgaff/ats_pagespeed | src/ats_pagespeed_configuration.h | /*
* Copyright (c) 2013 LinkedIn Corp. 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 required by applicable la... | CONFIG | 0.966566 | 6.395294 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2013-08-15T21:56:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45d4f8e99c... |
86264996-93be-4a39-9b8d-bd87aa108f07 | nobuyuki83/Applied_Computer_Graphics_2024S | task06/main.cpp | #include <iostream>
#include <filesystem>
#include <fstream>
#include <optional>
#include <chrono>
//
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include "Eigen/Core"
#include "Eigen/Geometry"
//
#include "util.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include <random>
std::... | ALGO | 0.998246 | 5.203526 | {
"github_metadata": {
"branch": "main",
"commit_count": 73,
"repo_created_at": "2024-02-24T10:22:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 50,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "07ee2fb82b... |
b1c39cbf-8e23-4577-a78e-633c5e01bb1f | PaddlePaddle/Paddle-Lite | lite/kernels/x86/gru_unit_compute.cc | // Copyright (c) 2019 PaddlePaddle Authors. 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 required... | ALGO | 0.985651 | 7.579175 | {
"github_metadata": {
"branch": "develop",
"commit_count": 7526,
"repo_created_at": "2017-09-20T11:41:42.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7124,
"forks": 1620,
"issues": 68,
"pull_requests": 17
},
"file_meta": {
"content_id": ... |
0ac8d316-f370-4f79-a160-e4f3c9c9ee57 | AndanteKim/LeetCode_Practice | 1140-stone-game-ii/1140-stone-game-ii.cpp | class Solution {
int n;
private:
int f(int p, int i, int m, vector<int>& piles, vector<vector<vector<int>>>& dp){
if (i == n) return 0;
if (dp[p][i][m] != -1) return dp[p][i][m];
int res = p == 1? 1000000 : -1, s = 0;
for (int x = 1; x <= min(2 * m, n - i); ++x){
... | ALGO | 0.999977 | 4.706816 | {
"github_metadata": {
"branch": "main",
"commit_count": 13165,
"repo_created_at": "2022-12-31T06:32:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b87ff089... |
2fd719c3-ca50-498b-9108-8e691730567f | 2003msd/OS_Scheduling_Algorithms | non_fcfs.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Process {
int id; // Process ID
int arrival_time; // Arrival time
int burst_time; // Burst time
int completion_time; // Completion time
};
void FCFS_non_preemptive(vector<Process>& processes) {
int ... | ALGO | 0.999922 | 5.62606 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-09-01T21:14:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e65e7905ab63... |
cf79abb6-06b9-4d40-9114-435c6aebb15c | rofi93/Codechef | Pishty and tree.cpp | /* -------------------------------- */
/* Name: MD. <NAME> */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: <EMAIL> */
/* -------------------------------- */
#include <bits/stdc++.h>
/* all header files */
#define fs first
#define sc second
#def... | ALGO | 0.999972 | 4.091753 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2016-07-27T19:54: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": "ee3f1bd2f5... |
15d3ea9a-230d-446a-9200-03b1ea384a25 | RohanMehsare/CPP_Programs_1 | program192.cpp | /*
Same copy of program191
*/
#include<iostream>
using namespace std;
class Array
{
public:
int *Arr;
int iSize;
Array(int A)
{
iSize = A;
Arr = new int[iSize];
}
void Accept()
{
int iCnt = 0;
cout<<"Enter t... | TOOL | 0.961924 | 3.919121 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-02-27T09:39: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": "1f3b2b8cdcb3... |
48e77392-477d-4a32-a040-b3265867e12c | tyeasmino/XPSC_Batch_4 | Week 16/Day 05/J_Test_of_Love.cpp | /* title: Week 16 - J_Test_of_Love.cpp */
/* created: 2024-08-04 00:37:44 */
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--)
{
ll n, m, k;
cin >> n >> m >> k;
str... | ALGO | 0.998594 | 4.37899 | {
"github_metadata": {
"branch": "main",
"commit_count": 87,
"repo_created_at": "2024-03-15T16:28: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": "8002b975b8a... |
bcfd29f5-29b4-46da-9a54-e1b7cea35f3d | KD3-80142/cpp | Assignment4/assignment43.cpp | #include<iostream>
using namespace std;
class Matrix{
private:
int m;
int n;
int **p;
public:
Matrix(int m,int n):m(m),n(n){
p = new int *[m];
for(int i = 0 ; i < m ; i++){
p[i] = new int[n];
}
}
Matri... | ALGO | 0.994911 | 4.28787 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2023-09-26T12:20: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": "3428898469e... |
3f2fe88e-bbb0-41c4-bf25-37428ea467c4 | hoanghai1803/CP_Training | Codeforces/Contests/Round_736/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_N 200005
int t, n;
long long a[MAX_N];
long long prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
int cnt[100];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i... | ALGO | 0.999658 | 3.311873 | {
"github_metadata": {
"branch": "main",
"commit_count": 97,
"repo_created_at": "2021-08-09T03:00:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "882dd90d4d9... |
364907fb-a173-4969-9d03-998b322cd3f1 | hffaust/CSCE240 | Assignment_4_csce240/src/PQ.cpp | /*
* PQ.cpp
*
* Created on: Mar 17, 2017
* Author: hfaust
*/
#include "PQ.h"
#include <iostream>
#include <exception>
#include <cstdlib>
using namespace std;
PQ::PQ() {
// TODO Auto-generated constructor stub
root = NULL;
}
PQ::~PQ() {
// TODO Auto-generated destructor stub
DeletePQ();
}
void PQ::Dele... | ALGO | 0.955231 | 4.239114 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-11-27T20:14:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af38911833... |
8a0d54a1-4fe0-4450-9444-f86458030eb4 | Devendra48D/Single-Server-Queueing-System | simlib/examples/lorenz.cc | ////////////////////////////////////////////////////////////////////////////
// Model lorenz SIMLIB/C++
//
// Lorenz equation:
//
// dx1/dt = sigma * (x2 - x1)
// dx2/dt = (1 + lambda - x3) * x1 - x2
// dx3/dt = x1 * x2 - b * x3
//
// Parameters: sigma = 10
// lambda = 24
/... | ALGO | 0.999719 | 5.830327 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-10-02T17:03:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "126a7cbc77... |
cf8137a0-99ba-4e12-be8f-112ee8fa9901 | acoidaan/Problemas-IB-AYED | AyED/2024/Junio/solucion3.cc | #include <iostream>
#include <vector>
#include <cassert>
#include "../vector_t.h"
#include "../sll_node_t.h"
#include "../sll_t.h"
#include "../dll_node_t.h"
#include "../dll_t.h"
#include "../matrix_t.h"
#include "../queue_l_t.h"
#include "../stack_l_t.h"
#include "../stack_v_t.h"
// 1. Desarrollar el destructor de ... | ALGO | 0.999291 | 4.814952 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2024-06-05T22:21:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a864b6ab29... |
2488a069-95d4-44e4-841f-d5658b64f77d | vbonnici/grafe-sim | analysis/data/p01267/s355875330.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include ... | ALGO | 0.999711 | 3.206291 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-07-10T13:21: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": "2b057277060... |
1d09e3cb-a64a-4229-8b69-c8e1b395eaec | enfuego27826/competitive-programming | Binary Search/revegetating.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i,j) for(ll i = 0; i < j; i++)
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define p push
#define f first
#define s second
#define all(x) x.begin, x.end()
#define eb emplace_back
#d... | ALGO | 0.999935 | 3.571758 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-09-30T14:59: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": "96e73fb994f2... |
02a19849-fbbd-47e4-a14f-10e1fab45609 | AllanVasc/Competitive-Programming | Contests/Brazilian ICPC Summer School 2023 - BF - Jan 31/B - Special Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ii = pair<int,int>;
using iii = tuple<int,int,int>;
using ll = long long;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
int32_t main() {
ios::sync_with_s... | ALGO | 0.999712 | 3.847928 | {
"github_metadata": {
"branch": "main",
"commit_count": 115,
"repo_created_at": "2021-05-12T20:29: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": "19a6889cc6... |
f4a8704c-af2d-4149-aa1e-5b320bfd30c3 | Adarshsingh2k/30-Days-Of-Code | Trees/Bt-SumTreeApproach2.cpp | /*
Sum Tree
Medium Accuracy: 33.33% Submissions: 86540 Points: 4
Given a Binary Tree. Return 1 if, for every node X in the tree other than the leaves, its value is equal to the sum of its left subtree's value and its right subtree's value. Else return 0.
An empty tree is also a Sum Tree as the sum of an empty tree ca... | ALGO | 0.999919 | 5.694053 | {
"github_metadata": {
"branch": "main",
"commit_count": 205,
"repo_created_at": "2021-04-26T06:16:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e52fa751b... |
fe41874b-f47a-4b68-9974-f6f93849d18e | imcauley/Recursive-Mandelbrot | main.cpp | /*
Name: <NAME>
E-Mail: <EMAIL>
Course: COMP 1633 - 001
Instructor: <NAME>
Assignment: 3
File: main.cpp
*/
#include <Magick++.h>
#include <cmath>
#include <iostream>
using namespace std;
using namespace Magick;
struct complex
{
double real;
double imaginary;
};
int checkNum(complex c, complex x, int itter... | ALGO | 0.980492 | 5.568788 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-01-06T17:49: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": "f48c8043e9... |
72060ffd-bf99-451a-9852-76de18acd0cb | JamesBremner/PathFinder | src/maze.cpp | #include <iostream>
#include "GraphTheory.h"
#include "cMaze.h"
#include "cCommandParser.h"
int main(int argc, char *argv[])
{
raven::set::cCommandParser P;
P.add("help", "\tproduce help message");
P.add("solve", "fname\tsolve a maze");
P.add("gen", "bin|rec\tgenerate maze with binary or recursive algo... | ALGO | 0.975017 | 5.077283 | {
"github_metadata": {
"branch": "main",
"commit_count": 198,
"repo_created_at": "2023-02-04T15:45:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bee7771869... |
ba08e0a3-cbff-44bb-b127-43d6787d5842 | vandanphadke/cpp_practice_codes | Leetcode/medium/381InsertDeleteGetRandomDuplicates.cc | /*
Design a data structure that supports all following operations in average O(1) time.
Note: Duplicate elements are allowed.
insert(val): Inserts an item val to the collection.
remove(val): Removes an item val from the collection if present.
getRandom: Returns a random element from current collection of elements. The... | ALGO | 0.997342 | 6.647195 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-12-15T06:38: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": "4db0f859a8... |
61f5fcdc-ea33-42ad-b1c1-31e59d1c32df | Hafiz-sustswe/Competitive-Programming-and-DSA-codes | Algorithms/Graph/gr-Bicoloring-and-colored-node-counting.cpp | /*
Program short detail : L.OJ-1009
Written by : <NAME>, SWE, SUST
*/
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf 1e18
#define PI 3.1415926535897932384626
#define mx INT_MAX
const int N = 3e5, M = N;
#define fi first
#define sc second
#define ll long long
#defin... | ALGO | 0.999928 | 4.66491 | {
"github_metadata": {
"branch": "master",
"commit_count": 48,
"repo_created_at": "2021-02-16T07:01:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e06ed3811... |
a98dd11f-19bb-4f72-b52d-543580460134 | Erdon-NSUL/cryptography | 4/SHA1.cpp | #include<bits/stdc++.h>
using namespace std;
class SHA1 {
public:
static string hash(const string& input) {
// 初始化哈希值(5个32位常量)
uint32_t h0 = 0x67452301;
uint32_t h1 = 0xEFCDAB89;
uint32_t h2 = 0x98BADCFE;
uint32_t h3 = 0x10325476;
uint32_t h4 = 0xC3D2E1F0;
/... | ALGO | 0.999604 | 5.177684 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2025-05-08T10:41:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1be8d1ef2... |
d6cc97d5-0eff-41a3-83b6-74fd5caea78b | Poscowekh/SEM3_LAB2 | src/sem2_lab3/Structures/PriorityQueue.hpp | #ifndef PRIORITYQUEUE_HPP
#define PRIORITYQUEUE_HPP
#include "Tree.hpp"
#include "../../sem3_lab1/structures/List/_list.hpp"
using namespace std;
template<typename Key, typename Type>
class PriorityQueue {
private: /*
class Priority {
private:
Key key_;
Type* data_;
public:
Priori... | ALGO | 0.996685 | 6.318585 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2020-12-21T05:37: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": "2b189f10ad47... |
73d02b8f-76eb-457c-adfc-be7f2a1a3fda | jingkongmtsu/xTron.mKP16 | src/gints_engine/hgp_os/energy/mom_p/hgp_os_mom_g_p_p.cpp | //
//
// This code is generated from CPPINTS, a C++ program to generate the
// analytical integrals based on Gaussian form primitive functions.
// Copyright (C) 2015 The State University of New York at Buffalo
// This software uses the MIT license as below:
//
// Permission is hereby granted, free of charge, to a... | ALGO | 0.990778 | 3.585865 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2022-09-21T14:39:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f486a899e7... |
cceefcda-1f7a-4456-9ac0-d91dea61c08d | neoashraf/UVA-efforts | 696 - How Many Knights.cpp |
//This is </the_brainFuck>
#include <cstring>
#include<string>
#include<sstream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#i... | ALGO | 0.999703 | 3.308515 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2015-09-08T03:18: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": "def3d6205... |
e021fb01-b9fa-4927-94f5-941eba5ac49d | SanjeevURao/PC_Project | mColoringParallel.cpp | #include<stdio.h>
#include<stdlib.h>
#include<omp.h>
#include<stdbool.h>
#include<sys/time.h>
// Number of vertices in the graph
int V;
#define LEVEL 22
bool found=false;
void printSolution(int color[] , int graph[][100]);
/* Function to check if the color can be safely assigned */
bool isSafe (int v, int graph[][10... | ALGO | 0.999874 | 3.757747 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2017-10-10T11:23:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5fe9bd322... |
c87cdad7-7145-454d-95c2-548dd013226c | ldcm3/Tech-Interview-Studies | crackingCodeInterview/Chapter4/routeBetweenNodes.cc | #include<iostream>
#include<vector>
#include <cstring>
#include <list>
#include <queue>
using namespace std;
/*
Find out whether there is a route between two nodes
BFS:
- useful to find shortest paht
DFS:
- simpler to implement
- may traverse adjancent node very deeply before... | ALGO | 0.999762 | 5.019536 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2016-12-22T09:28: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": "25b3c6f26... |
2de2d1f7-10c8-453a-bb16-4d164cbca33b | erik-nelson/project-euler | include/P9.h | #ifndef __P9_h__
#define __P9_h__
#include "utils.h"
/*
A Pythagorean triplet is a set of three natural numbers,
a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which
a + b + c = 1000. Find the product abc.
*/
class P9
{
public:
... | ALGO | 0.998843 | 4.139662 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2013-12-20T19:35: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": "873f761e4f... |
edd459f0-68fc-4290-b221-8ed64e1f71db | hrushikesh430/DSA-codes | tree/prac_tree.cpp | #include <bits/stdc++.h>
using namespace std;
class node;
class Queue{
int size;
node **q;
int front , rear;
public :
void create(int size)
{
this->size = size;
q = new node*[size];
front = rear = -1;
}
void enqueue(node *p)
{
front++;
q[f... | ALGO | 0.999949 | 4.09532 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-07-27T08:48: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": "48898013076b... |
95db2fb1-51a1-4e2a-9950-4032ee72854a | sxs-collaboration/spectre | src/PointwiseFunctions/Hydro/InitialData/IrrotationalBns.cpp | // Distributed under the MIT License.
// See LICENSE.txt for details.
#include "PointwiseFunctions/Hydro/InitialData/IrrotationalBns.hpp"
#include <cmath>
#include <cstddef>
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/Expressions/TensorExpression.hpp"
#include "DataStructures/Tensor/Tens... | ALGO | 0.981772 | 7.249555 | {
"github_metadata": {
"branch": "develop",
"commit_count": 17103,
"repo_created_at": "2017-04-07T17:28:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 168,
"forks": 202,
"issues": 530,
"pull_requests": 57
},
"file_meta": {
"content_id": ... |
cfb50750-6e16-4385-8ba8-4eab794c0041 | AhmedH777/SFND-Lidar-Object-Detection2 | src/kdtree.h | /* \author <NAME> */
// Quiz on implementing kd tree
#include "render/render.h"
// Structure to represent node of kd tree
template<typename PointT>
struct Node
{
PointT point;
int id;
Node* left;
Node* right;
Node(PointT arr, int setId)
: point(arr), id(setId), left(NULL), right(NULL)
{}
~Node()
{
delet... | ALGO | 0.995198 | 4.183688 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-11-14T21:40: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": "c5c9010cba... |
569ab8bc-d502-4b72-ae13-4528300471a3 | axrdiv/USACO | Chapter_3/Section_3.2/Factorials/Factorials.cpp | /*
ID: axrdiv1
PROG: fact4
LANG: C++
*/
#include<iostream>
#include<fstream>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
const int maxn = 4220 + 10;
ofstream fout("fact4.out");
ifstream fin("fact4.in");
int n;
int prim[maxn], cnt[maxn];
bool is_prim(int p) {
if(p == 1... | ALGO | 0.999977 | 4.335638 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-08-23T13:52: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": "10a9086a64... |
371e4195-a36e-4df8-a592-fb087c1e21cb | antoni-heredia/FP | Sesion03/I_Gaussiana.cpp | /***************************************************************************/
// FUNDAMENTOS DE PROGRAMACIÓN
//
// CURSO 2016-2017
// (C) <NAME>
// GRUPO B GRUPO DE PRACTICAS B2
//
//
/*
El programa calculara la funcion gausiana a partir de los
Entradas: esperanza,desviacion, x
Salidas: funcion gausiana
*/
/... | ALGO | 0.997204 | 4.140177 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2016-09-29T21:15: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": "9e2763615... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.