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 |
|---|---|---|---|---|---|---|---|
799523cc-fdd4-4776-8bb8-842a1ff95d6c | lovish1234/practice | dynamic_prog/gridPaths.cpp | /*
int getSets (int x, int y, vector< vector< int> > &A)
{
int m = A.size();
int n = A[0].size();
if(x==(m-1) && y==(n-1))
{
return 1;
}
if(x<(m-1) && A[x+1][y]==0 && y<(n-1) && A[x][y+1]==0)
{
return (getSets(x+1,y,A) + getSets(x,y+1,A));
}
else if(x<(m-1) ... | ALGO | 0.999901 | 5.223859 | {
"github_metadata": {
"branch": "master",
"commit_count": 332,
"repo_created_at": "2015-10-23T06:02:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4ce32db... |
95185388-694a-4349-9153-d16557f75f10 | dengyufan2008/code | Contests/20240712-20240830 HDUACM/HDUACM20240805/i/i.cpp | // O((n+q) \sqrt t)
#include <algorithm>
#include <fstream>
using namespace std;
ifstream cin("i.in");
ofstream cout("i.out");
const int kMaxN = 5e5 + 1;
struct V {
int l, r, o;
} v[kMaxN << 1];
int t, n, m, ht, _ht, ans;
pair<int, int> h[kMaxN], _h[kMaxN];
int main() {
cin.tie(0), cout.tie(0);
ios::sync_with... | ALGO | 0.999854 | 3.818515 | {
"github_metadata": {
"branch": "master",
"commit_count": 1775,
"repo_created_at": "2021-09-21T09:26:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e2ca79... |
c4187cdf-4779-47ed-971a-ce26238e30bb | Sarang8/Leetcode_Problems | 138-copy-list-with-random-pointer/138-copy-list-with-random-pointer.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head) {
//STEP 1
Node* temp = ... | ALGO | 0.999165 | 5.390138 | {
"github_metadata": {
"branch": "main",
"commit_count": 2238,
"repo_created_at": "2022-06-20T05: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": "6ad2f1ca5... |
a734ef03-e94e-4689-a9f9-8724cf987cf8 | alandefreitas/futures | dev-tools/linter/application.cpp | //
// Copyright (c) 2022 alandefreitas (<EMAIL>)
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
//
#include "application.hpp"
#include <functional>
#include <string_view>
std::regex const application::include_regex{
"(^|\n) *# *include *[<\"] *([a-zA-Z0-9... | TOOL | 0.979921 | 6.896795 | {
"github_metadata": {
"branch": "develop",
"commit_count": 331,
"repo_created_at": "2021-10-16T02:02:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 45,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e9bf6d... |
e7ab2a2b-cecd-4d77-a7f3-5f337926d14f | i-m-samarth-cs/DSAL | Assignmentno 4.CPP | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Node {
int value;
Node* left;
Node* right;
bool threaded;
Node(int val) : value(val), left(NULL), right(NULL), threaded(false) {}
};
Node* preorder_successor(Node* node) {
if (node->left != NULL)
retur... | ALGO | 0.999951 | 6.512093 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2024-05-08T16:04: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": "7778a808ce5... |
90029229-57e4-4d68-abd4-b06847f037be | blurock/AnalysisStable | src/Matrix/Matrix.cc | /* FILE Eigenvectors.cc
** PACKAGE REACTION
** AUTHOR <NAME>
**
** CONTENT
**
**
** REFERENCES
**
** COPYRIGHT (C) 1995 REACTION Project / <NAME>
*/
#define TEMPLATE_INSTANTIATION
#include "Basis/defines.hh"
#include "Basis/System.hh"
#include "iomanip.h"
#include "Basis/CommBuffer.hh"
#inclu... | ALGO | 0.986971 | 3.792384 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-03-18T19:50: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": "4e49e74746... |
275f8c25-e271-49d8-a3ae-cbcfeaaa5180 | Eclipsemos/GrindLeetcode | LeetCodeLegacy/Leetcode_legacy/278.cpp | #include <bits/stdc++.h>
using namespace std;
// The API isBadVersion is defined for you.
// bool isBadVersion(int version);
bool isBadVersion(long long n)
{
if (n == 5 || n == 4)
return 1;
else
return 0;
}
class Solution
{
public:
int firstBadVersion(int n)
{
long long l, r;
... | ALGO | 0.999831 | 5.245106 | {
"github_metadata": {
"branch": "master",
"commit_count": 70,
"repo_created_at": "2021-02-16T17: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": "1ee1f2da3... |
361a7146-99fb-4876-89c5-53a7d395a47a | Hackeries/CP | Codechef/151 starters/c.cpp | #include <bits/stdc++.h>
#define lli long long
#define pii pair<int,int>
#define fi first
#define sc second
#define pb push_back
#define EB emplace_back
#define MP make_pair
#define vi vector<lli>
#define vov vector<vector<lli>>v(n,vector<lli> (m))
#define vpii vector<pair<lli,lli>>
#define all(o) (o).begin(), (o).end(... | ALGO | 0.999931 | 4.933898 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-02-10T16:17: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": "6ecba80c68ca... |
30ec639e-e0ac-4007-9923-935fb376457e | SubinHan/problem-solving | p1920/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
constexpr int MAX_NUM = 100000;
int numOfNumbers;
int numOfQueries;
int numbers[MAX_NUM];
int queries[MAX_NUM];
void input()
{
scanf("%d", &numOfNumbers);
for (int i = 0; i < numOfNumbers; i++)
{
scanf("%d", &numbers[i]);
}
s... | ALGO | 0.999956 | 5.022522 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-01-04T05:44:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfee947b40ab... |
939b88d5-7c45-4023-b4d5-a8f6854c5eac | Aecotyle/GIKI-TASKS-2021664 | ANN_TicTacToe_2nd_Semester_Project/matrix.cpp | #include <iostream>
#include <cmath>
#include <iostream>
#include <vector>
#include <cstdlib>
class Matrix
{
private:
int _rows;
int _cols;
std::vector<std::vector<double> > matrix;
public:
//constructor to maek matrix of desired size filled intially with 0
Matrix(int _rows = 0, int cols = 0)
... | ALGO | 0.998206 | 4.269593 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-06-10T19:51:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9dc862d45f29... |
0a521944-8e4d-4c19-a9d9-448329bff529 | JSeokjun/Daily_Algorithm | 백준/Gold/2573. 빙산/빙산.cc | #include <iostream>
#include <queue>
#include <tuple>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int N, M; cin >> N >> M;
int arr[N][M], visit[N][M];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int sx, sy, size = 0, min_year = 0;
queue<tuple<int,int,int... | ALGO | 0.999989 | 3.83492 | {
"github_metadata": {
"branch": "main",
"commit_count": 450,
"repo_created_at": "2023-01-10T14:53: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": "46d3476eb2... |
7a4ab190-0fd5-41e8-8e15-a9f0f71ed6d3 | akhikolla/testpackages | fuzzedpackages/slopeOP/src/slopeOP.cpp | // MIT License
// Copyright (c) 2019 <NAME>
#include<Rcpp.h>
// Enable C++11 via this plugin (Rcpp 0.10.3 or later)
// [[Rcpp::plugins(cpp11)]]
#include<math.h>
#include"OmegaOP.h"
#include"OmegaSN.h"
#include"op2d.h" //Marco Pascucci code
using namespace Rcpp;
using namespace std;
// [[Rcpp::export]]
List slopeOPt... | ALGO | 0.999521 | 6.097205 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-01-15T17:42:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "355c2a0604... |
624331a2-a38e-4008-ba58-8e361ced3996 | Monjur3175/Programming | Data Structure and Algorithm/11.Math_Algorithm.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
using namespace std;
//-------------------------
// 1. Sieve of Eratosthenes
vector<bool> sieve(int n) {
vector<bool> prime(n+1, true);
prime[0] = prime[1] = false;
for (int p = 2; p*p <= n; p++) {
if (prime[p]) {
... | ALGO | 0.999455 | 5.17308 | {
"github_metadata": {
"branch": "main",
"commit_count": 77,
"repo_created_at": "2024-02-27T10:56: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": "97d0fd3da64... |
2b87e584-c1e7-4225-a66f-054e47141537 | Ren-Gen22/DSA_pract- | 9.11Sums/9th.cpp | #include<bits/stdc++.h>
using namespace std;
void boolMat(vector<vector<int>> mat){
int m=mat.size(),n=mat[0].size();
vector<bool> row(m, false);
vector<bool> col(n, false);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (mat[i][j] == 1) {
row[i] = tr... | ALGO | 0.999968 | 4.381667 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-11-25T16:18:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fa56dda6526c... |
9362dd8f-67b6-4f08-bede-aa6d329b16e0 | cces-cepid/massccs-ompc | src/Force.cpp | /*
* This program is licensed granted by STATE UNIVERSITY OF CAMPINAS - UNICAMP ("University")
* for use of MassCCS software ("the Software") through this website
* https://github.com/cces-cepid/MassCCS (the "Website").
*
* By downloading the Software through the Website, you (the "License") are confirming that yo... | ALGO | 0.999127 | 4.564441 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2023-10-27T13:17:29.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8fade29e2a19b... |
da6f69ce-1e90-4ec9-b75f-8b817bcba534 | Daiga0/darbas | darbas/Perseverance.cpp | #include <iostream>
using namespace std;
int main() {
double x = 0.0, sum = 0, total = 0;
double grit = 0.0;
total++;
cout << "New ideas and projects sometimes distract me from previous ones." << endl;
cout << "Please enter a number: not at all - 5; not much - 4; somewhat - 3; mostly - 2; very mu... | ALGO | 0.961084 | 3.043464 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2021-03-22T20:01: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": "927f735814f9... |
eb1ee699-5d89-40e6-a278-aa7b026341a5 | EmptyCityJK/daily_problem | 数学/D_Pigeon_Swap.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
// 求pos[id[a]]
inline void solve() {
int n, q; cin >> n >> q;
vector<int> id(n + 1); //第i只鸟所在的鸟巢编号
vector<int> pos(n + 1); //第i个鸟巢所处的地上位置编号
vector<int> npos(n + 1); //pos的反向映射,npos[i]记录位置i上的鸟巢位置
for(int i... | ALGO | 0.999951 | 4.193492 | {
"github_metadata": {
"branch": "main",
"commit_count": 67,
"repo_created_at": "2025-03-04T03:10:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "14f2356497b... |
c5c8fc31-33a8-4052-8fbb-64159685432f | hdvsyu/PAT-Solutions | C++/Advanced/1127. ZigZagging on a Tree (30).cpp | #include <cstdio>
#include <vector>
#include <queue>
using namespace std;
vector<int> in, post;
struct tree {
int val, level;
struct tree *left, *right;
};
int findRootInInorder(int inl, int inr, int val) {
for (int i = inl; i <= inr; i++) {
if (in[i] == val) return i;
}
return -1;
}
st... | ALGO | 0.999991 | 4.245872 | {
"github_metadata": {
"branch": "master",
"commit_count": 312,
"repo_created_at": "2016-02-23T12:41:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 40,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e07d44... |
40639ae6-e10a-45c6-a4ba-f3c9a8594bbc | Mohaimen-Hridoy/XPSC-problem-Solving | week 10/Day 1/A_Binary_Search.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> arr(n);
for (int i = 0; i < n; ++i)
cin >> arr[i];
vector<int> queries(k);
for (int i = 0; i < k; ++i)
cin >> queries[i];
... | ALGO | 0.999992 | 5.081081 | {
"github_metadata": {
"branch": "main",
"commit_count": 81,
"repo_created_at": "2024-10-27T16:34: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": "e276f0067e4... |
2681bd84-f96e-4547-be8f-dde1aae46b76 | fyhtea/Algo | graph/listGraph.h | /*************************************************************************
> File Name: listGraph.h
> Author: fyhtea
> Mail: <EMAIL>
> Created Time: 2018年01月22日 星期一 20时41分30秒
************************************************************************/
#ifndef _LISTGRAPH_H
#define _LISTGRAPH_H
#include <ios... | TOOL | 0.961191 | 4.27547 | {
"github_metadata": {
"branch": "master",
"commit_count": 64,
"repo_created_at": "2017-11-01T13:08: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": "94f870c05... |
55b1dd58-693e-4697-949f-577d8e279f7b | Samsung/Vyond | chipyard-1.11.0/sims/firesim/platforms/f1/aws-fpga/Vitis/examples/xilinx_2021.2/host/debug_profile/src/vadd.cpp | /**
* Copyright (C) 2019-2021 Xilinx, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in ... | ALGO | 0.991232 | 5.837367 | {
"github_metadata": {
"branch": "main",
"commit_count": 52,
"repo_created_at": "2024-11-05T05:20:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 11,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "72d13e7cd14... |
558b6c2d-e5ec-484e-b799-fd98139ec337 | midnightcoder/gracula | opencog/spatial/SuperEntity.cc | /*
* opencog/spatial/SuperEntity.cc
*
* Copyright (C) 2002-2009 Novamente LLC
* All Rights Reserved
* Author(s): <NAME>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License v3 as
* published by the Free Software Foundation and in... | ALGO | 0.939573 | 5.650536 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2010-09-06T08:37: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": "5b9abaeb55... |
eefd1612-56e1-4b9d-afce-fa17017eb9de | htcoles/Vector-Math-Library | source/Matrix4x4.cpp |
#include "Matrix4x4.h"
namespace MathLib
{
/*Addition */
Matrix4x4 Matrix4x4::add(Matrix4x4 left, const Matrix4x4 &right)
{
/* First Row */
left._11 += right._11;
left._12 += right._12;
left._13 += right._13;
left._14 += right._14;
/* Second Row */
left._21 += right._21;
left._22 += rig... | ALGO | 0.996663 | 4.403199 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2011-08-18T22:34:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "934099c2fd... |
c9f32d90-ff65-4c45-959e-f40e390802dd | mamgaingaurav14/CP | template_complex.cpp | //<NAME>
//<NAME>
//<NAME>
//<NAME>
#include <bits/stdc++.h>
using namespace std;
#define lil long long int
const int MOD=1e9+7;
#define pb push_back
#define ppb pop_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define yes cout<<"YES"<<'\n';
#define no cout<<"NO"<<'\n';
cons... | ALGO | 0.999536 | 4.42603 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-10-02T07:23:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95b69805877... |
7cde5955-cc43-45db-9bf8-5b37055d69f1 | MikierXXV/EDA | P4/P40685.cc | #include <iostream>
#include <vector>
using namespace std;
void escribe(const vector<int>& v, vector<bool>& sol, int n){
cout << "{";
bool primer = true;
for (int i = 0; i < n; ++i) {
if (sol[i]){
if (not primer) cout << ",";
else primer = false;
cout << v[i];
}
}
cout << "}" << endl;
}
void back_... | ALGO | 0.99955 | 3.95386 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-08-29T16:55:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b9b3daebd6... |
03e0bb34-f50f-429e-9262-4661d8c6908e | lballabio/QuantLib | ql/pricingengines/vanilla/qdfpamericanengine.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2022 <NAME>
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modif... | ALGO | 0.999916 | 7.076234 | {
"github_metadata": {
"branch": "master",
"commit_count": 17543,
"repo_created_at": "2015-12-17T16:29:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6151,
"forks": 1964,
"issues": 51,
"pull_requests": 11
},
"file_meta": {
"content_id":... |
b0683bb0-22f9-447c-a580-7894e2a478cf | kushkumarkashyap7280/DSA | day_064/Insertion_sorting_using_recursion.cpp | // insertion sorting using recursion
#include <iostream>
#include <algorithm>
using namespace std;
// inner function to find the correct position for the key
// and shift elements accordingly
int inner_function(int arr[],int j, int key){
if(j >= 0 && arr[j] > key){
arr[j+1] = arr[j];
return inner_function... | ALGO | 0.999998 | 5.934803 | {
"github_metadata": {
"branch": "main",
"commit_count": 127,
"repo_created_at": "2025-05-01T16:22:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "851c282588... |
788fe9e5-6e6a-495e-86a4-0f6b8ad3f518 | romill-09/TY | SEM VI/AC/CODES/primeFactors.cpp | #include<bits/stdc++.h>
using namespace std;
bool checkPrime(int n)
{
int count = 0;
for(int i = 1; i <= sqrt(n); ++i)
{
if(n % i == 0)
{
count++;
if(n / i != i)
{
count++;
}
}
}
if(count == 2)return true;
... | ALGO | 0.999639 | 4.956059 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-11-26T13:10:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b073825ed3f1... |
002cc21d-b297-48bd-ab5a-eab6e7dcce57 | Saseke/3-5000-algorithm | Binary search.cpp | #include <stdio.h>
int binSearch(int srcArray[], int key)
int binSearch(int srcArray[], int start, int end, int key);
int main() {
int array[] = {3, 5, 11, 14, 33, 50, 333};
printf("%d", binSearch(array, 0, 5, 3));
return 0;
}
/**
* 递归算法
* @param srcArray 要进行查找的数组
* @param start 数组元素开始的指针
* @param ... | ALGO | 0.99999 | 4.687776 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2017-12-29T13:36: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": "a5954ebc5f... |
0c5286ee-60ed-488a-877d-2403e28ae111 | Ayon-SSP/The-SDE-Prep | 8]_CPU Scheduling Algorithms C++/First Fit.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int bn, pn;
cout << "Enter number of block: ";
cin >> bn;
cout << "Enter number of processor: ";
cin >> pn;
int bsize[bn], psize[pn], tmpbsize[bn], fit[pn], f = 0;
for (int i = 0; i < pn; i++)
{
fit[i] = -1;
}
for... | ALGO | 0.999134 | 3.442153 | {
"github_metadata": {
"branch": "main",
"commit_count": 1190,
"repo_created_at": "2022-07-02T16:33:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 174,
"forks": 71,
"issues": 9,
"pull_requests": 2
},
"file_meta": {
"content_id": "5741b5... |
619d9599-ab3c-4377-bfda-0a648f6e7f94 | Alamin-Momin/cheaters | hash.cpp | //hash.cpp
// Created by <NAME> on 4/30/20.
//cpp file for hash.h
#include <vector>
#include <string>
#include <iostream>
#include <cmath>
#include "hash.h"
HashTable::HashTable() { //initialize all the pointers in the hash table to NULL
for (int i = 0; i < TABLE_SIZE; i++) {
htabl... | ALGO | 0.957447 | 4.27608 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-05-04T06:58: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": "27094ef774... |
e196fcb8-78ed-4989-a578-3ffeade9e180 | SNURFER/algorithm | baekjun/bj_7568.cc | #include <iostream>
#include <algorithm>
#include <map>
#include <string> ... | ALGO | 0.99993 | 3.817929 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2020-11-03T11:56:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "26547a5fc534... |
f42c625c-737f-4a55-9e4f-1a898437f9ee | Scrubpai/Competitive-Programming | DMOJ/USACO/USACO 2021 February Bronze P3 - Clockwise Fence.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl '\n'
void solve(int tc) {
int n; cin >> n;
while (n--) {
string s; cin >> s;
int x = 0;
for (int i=0; i<(int)s.size()-1; i++) {
if (s[i] == s[i+1]) continue;
if ((s[i] == 'N' && s[i+1] == 'E') || (s[i] == 'E... | ALGO | 0.999995 | 5.074165 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2021-12-29T02:05:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1f4f21c4e54... |
39f0c7cb-5520-465e-843b-f4b96d4f1168 | sotirisnik/uva | 616.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
void solve( int n ) {
int people = 0;
printf( "%d coconuts, ", n );
int sqrt_n = sqrt(n)+1;
for ( int i = sqrt_n; i >= 2; --i ) {
int tmp = n;... | ALGO | 0.99997 | 3.765599 | {
"github_metadata": {
"branch": "master",
"commit_count": 87,
"repo_created_at": "2014-08-25T23:37: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": "814b507ad... |
255b9f0e-07e5-4bd8-b310-942b5f995841 | junewaves/contests | NCKU_CP/Class_contest_3/p38_sol.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n;
vector<int> mo(n + 1), pl(n + 1);
for (int i = 0; i < n; i++)
cin >> mo[i]; // i-th monster's power
cin >> m;
for (int i = 0; i < m; i++) {
... | ALGO | 0.999989 | 3.984689 | {
"github_metadata": {
"branch": "master",
"commit_count": 244,
"repo_created_at": "2020-04-10T12:39: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": "95bbe2bc... |
c1f67413-0a7f-4e2e-8a85-9637796b6d60 | cdh981009/Algorithm | codeforces/635/C_Linova_and_Kingdom.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FOR_(i, a, b) for (int i = (a); i <= (b); ++i)
const int N = 2e5;
int depth[N+1];
int sub[N+1];
vector<vector<int>> edges(N+1, vector<int>());
void dfs(int node, int parent) {
int& d = depth[node];
int... | ALGO | 0.999894 | 3.868938 | {
"github_metadata": {
"branch": "master",
"commit_count": 850,
"repo_created_at": "2020-02-16T08:17:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cfc71f17... |
31a4f257-e6f6-4115-9df0-63cb8e94cc77 | kgoel9899/CF_Solutions | codeforces/1743/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define mod 998244353
#define int long long
#define setpres cout << fixed << setprecision(10)
#define all(x) (x).begin(), (x).end()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int INF = 1e18;
#ifdef DEBUG
#de... | ALGO | 0.999976 | 4.58296 | {
"github_metadata": {
"branch": "master",
"commit_count": 1962,
"repo_created_at": "2020-12-21T08:58: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": "24fee80... |
d2fb2ef1-3613-4981-a42c-bd3971b75917 | ishandutta2007/codeforces-m | mangooste/normal/1277/C.cpp | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
// #define int long long
#define all(a) a.begin(), a.end()
signed main() {
ios::sync_with_stdio(false);
... | ALGO | 0.999126 | 4.101716 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-06-06T01:03: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": "e7275a146704... |
b08dc0d8-8a90-4bb4-9f71-9eab0d8f1d0c | hamx05/DSA-and-LeetCode | data-structures/ds_lab_final_practice/GPT_treasureHunt.cpp | #include <iostream>
using namespace std;
#define N 5
void printBoard(char sol[N][N]) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cout << sol[i][j] << " ";
}
cout << endl;
}
}
bool noSolution = false;
void findAllPaths(int x, int y, char map[N][N], char s... | ALGO | 0.99998 | 5.797393 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2025-04-25T09:58:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f13a68700bc... |
14b1ff6c-de12-4a94-9018-78f806b0bbba | adityabhat95/DailyCoding | prog27.cpp | /*
Problem : Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).
For example, given the string "([])[]({})", you should return true.
Given the string "([)]" or "((()", you should return false.
Solution : This problem can be so... | ALGO | 0.996796 | 5.760277 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2018-07-12T00:18: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": "d12c42477a... |
1b4eb080-e378-40e5-9efd-068e30230495 | Mohitbagul/Leetcode-POTD | 2054-the-number-of-the-smallest-unoccupied-chair/the-number-of-the-smallest-unoccupied-chair.cpp | class Solution {
public:
int smallestChair(vector<vector<int>>& times, int targetFriend) {
int targetArrival = times[targetFriend][0]; // target friend's arrival time
int targetDeparture = times[targetFriend][1]; // target friend's leaving time
// Sort based on arrival times
sort(ti... | ALGO | 0.999983 | 6.043459 | {
"github_metadata": {
"branch": "main",
"commit_count": 449,
"repo_created_at": "2023-12-19T06:24: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": "099c8079d2... |
0062e4f3-e813-469e-914c-6726b55dc5fe | traking/lectures | base_compression_algoritms/source/CompressorLZ77.cpp | #include "CompressorLZ77.h"
#include <cstring>
#include <stdio.h>
namespace {
using PairType = uint8_t;
const size_t WindowSize = 255;
enum HeaderFlags : unsigned char {
None = 0,
Pair = 0b00000001,
Dt = 0b00000010,
PairFourBit = 0b00000100,
DtFourBit = 0b00001000
};
struct Node {
uint8_t header;
PairType of... | ALGO | 0.998899 | 5.602202 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-07-14T05:31: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": "6115c10845... |
8f920b9a-c3c6-45e1-b08e-d32b6eb0358b | voreen-project/voreen | voreen/modules/flowsimulation/ext/openlb/src/reaction/explicitFiniteDifference/fdPostProcessor3D.hh | /* This file is part of the OpenLB library
*
* Copyright (C) 2020 <NAME>
* E-mail contact: <EMAIL>
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Li... | ALGO | 0.994729 | 5.651536 | {
"github_metadata": {
"branch": "main",
"commit_count": 2506,
"repo_created_at": "2024-10-29T14:44:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 18,
"forks": 7,
"issues": 17,
"pull_requests": 0
},
"file_meta": {
"content_id": "57e4cbaa... |
7f4a2789-59e9-436c-af23-324d13c4043b | Sagar-Puniyani/DataStructures | Queue/KReversal.c++ | #include <iostream>
#include <queue>
#include <stack>
using namespace std;
template <typename T>
void print(const queue<T>& q) {
cout << "[ ";
queue<T> tempQueue = q; // Create a copy to avoid modifying the original queue
while (!tempQueue.empty()) {
cout << tempQueue.front() << " ";
tempQ... | ALGO | 0.999704 | 4.489197 | {
"github_metadata": {
"branch": "main",
"commit_count": 170,
"repo_created_at": "2023-12-19T12:12:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8339fbdd05... |
b7dbd384-4e4f-496f-86ff-2ca1e0a26886 | XDoodler/Algorithms | Lazy Segment Tree.cpp | void build(int node,int s,int e){
if(s==e){
T[node] = arr[s];
return;
}
int m=(s+e)>>1;
build(node<<1,s,m);
build(node<<1|1,m+1,e);
T[node]=(T[node<<1]+T[node<<1|1]);
}
int query_tree(int node, int a, int b, int i, int j) {
if(a > b || a > j || b < i) return 0; // Out of ran... | ALGO | 0.999908 | 4.250865 | {
"github_metadata": {
"branch": "master",
"commit_count": 404,
"repo_created_at": "2019-03-27T14:54:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "342bd44... |
9098b1f2-a9b6-4bab-9091-a2f673ddc2e3 | ishandutta2007/codeforces-s | se1ka2/normal/1265/C.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
for(int c = 0; c < t; c++){
int n;
cin >> n;
int p[400005];
for(int i = 0; i < n; i++) cin >> p[i];
int g = 0;
for(; g < n; g++){
if(p[g] != p[g + 1]) break;
}
... | ALGO | 0.999763 | 3.107974 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "800113f719c2... |
dc53acfa-9c5f-47ca-b0fa-4a517d420a6f | Athanaze/z_notes | algo_lab/sith.cpp | #include <limits>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <tuple>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include ... | ALGO | 0.999873 | 5.162668 | {
"github_metadata": {
"branch": "main",
"commit_count": 88,
"repo_created_at": "2024-10-16T16:36: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": "b909e699c10... |
fce86559-043d-4479-8318-04d108603293 | triglav/advent_of_code | 2015/day09.cc | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include "string_utils.h"
using Destinations = std::unordered_map<std::string, int>;
using Graph = std::unordered_map<std::string, Destinations>;
void InsertPath(Graph *graph, std::string const &t0, std::string const &t1,
... | ALGO | 0.999278 | 4.913308 | {
"github_metadata": {
"branch": "master",
"commit_count": 307,
"repo_created_at": "2019-12-04T14:48: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": "1344f9e2... |
78d33a33-9637-4926-98d5-0e29f6caaf1a | hsmahesha/Algorithms | Expt/Toy_Facebook/FaceBook.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <sstream>
#include <vector>
using namespace std;
class Node {
public:
int uId;
string name;
set<Node*> friends;
public:
Node(int uId, string name) {
... | ALGO | 0.994979 | 5.146709 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2018-03-07T16:40: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": "46e48fd9d... |
9805f8b1-c967-43d6-97c8-1c8c15b31bb6 | wavescholar/numerical_libraries | itpp/itpp-4.3.1/itpp/signal/resampling.h | /*!
* \file
* \brief Resampling functions - header file
* \author <NAME> and <NAME>
*
* -------------------------------------------------------------------------
*
* Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors)
*
* This file is part of IT++ - a C++ library of mathematical, signal
* p... | ALGO | 0.960807 | 6.622826 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2012-11-30T14:19:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 4,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6ddde59... |
a6eb5459-39dd-4846-a579-6ca1a928d476 | Dev-XYS/Code | codeforces/797b.cpp | // Problem Name: Odd sum
// Source: Educational Codeforces Round 19
#include <iostream>
#define INF 1000000000
typedef long long ll;
using namespace std;
int n;
int main()
{
cin >> n;
int poddc = 0, minpodd = INF, maxnodd = -INF, x;
ll podds = 0, ans = 0;
for (int i = 0; i < n; i++)
{
cin >> x;
if ((x & ... | ALGO | 0.999998 | 4.279158 | {
"github_metadata": {
"branch": "master",
"commit_count": 496,
"repo_created_at": "2016-11-27T05:35:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e1349730... |
2b81637d-1301-444c-93e4-e04117c7b364 | reborn1456/C-Lesson | c/11060465/1106046kadaic13.cpp | #include "1106046kadaic13.h"
#include <cstdlib>
#include <Windows.h>
#include <conio.h>
#include <chrono>
#include <iostream>
using namespace std;
#pragma comment(lib,"winmm.lib")
int getDigit()
{
static int digit1 = 0, digit2 = 0, i = 0;
if (i == 0)
{
digit1 = rand() % 900 + 100;
digit2 = rand() % 900 + 10... | TOOL | 0.970236 | 3.496981 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-03-13T23:24: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": "f4b24418a2d8... |
2dc94600-2f70-4799-bfde-8395d0340ffa | lnxhigh/Baekjoon | 백준/Silver/1393. 음하철도 구구팔/음하철도 구구팔.cc | #include <bits/stdc++.h>
using namespace std;
using Point = pair<int,int>;
int dist(const Point &A, const Point &B) {
auto [x1, y1] = A;
auto [x2, y2] = B;
int dx = x1 - x2;
int dy = y1 - y2;
return dx * dx + dy * dy;
}
int main() {
int xs, ys; cin >> xs >> ys;
int xe, ye; cin >> xe >... | ALGO | 0.999976 | 5.061911 | {
"github_metadata": {
"branch": "main",
"commit_count": 1355,
"repo_created_at": "2023-11-23T13:44:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae5e44845... |
a4334c3f-d7f9-447f-8c05-f5eaab3722cc | penhoi/patch-ctrlflow | src/wbt.cpp | /*
* C++ Program to Implement Weight Balanced Tree
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "struct.h"
/* class WBTNode */
class WBTNode
{
public:
WBTNode *left;
WBTNode *right;
int weight, key;
WBTNode(int key, int wt): left(NULL), right(NULL)
{
this->... | ALGO | 0.9999 | 5.625027 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2016-08-30T10:29: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": "d0424a1699... |
911c1929-aa53-4bb5-a079-675a7fef5784 | rsummers11/CADLab | LymphNodeRFCNNPipeline/nifty_reg-1.3.9/nifty_reg/reg-lib/_reg_blockMatching.cpp | /*
* _reg_blockMatching.cpp
*
*
* Created by <NAME> and <NAME> on 24/03/2009.
* Copyright (c) 2009, University College London. All rights reserved.
* Centre for Medical Image Computing (CMIC)
* See the LICENSE.txt file in the nifty_reg root folder
*
*/
#include "_reg_blockMatching.h"
#include "_reg_globa... | ALGO | 0.998291 | 4.496867 | {
"github_metadata": {
"branch": "master",
"commit_count": 174,
"repo_created_at": "2014-09-10T19:16:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 453,
"forks": 185,
"issues": 14,
"pull_requests": 5
},
"file_meta": {
"content_id": "a9b... |
af4a113f-897a-4dc9-86c1-909525d1732a | ishandutta2007/codeforces-nonalphabetic | .tx/normal/847/G.cpp | #include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)
#define STRESS 0
using lint = long long;
string ... | ALGO | 0.999783 | 3.769037 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:49:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71a8709cb3d5... |
81df8ad1-61df-499c-b8e5-ae6a826c069a | shinnosuke-narita/AtCoderWork | abc/abc332/d/main.cpp | #include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <atcoder/all>
#include <math.h>
using namespace std;
using vvi = vector<vector<int>> ;
// マクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF (1 << 30)
int main() {
int h, w;
cin >> h >> w;
vector<vec... | ALGO | 0.999958 | 3.329554 | {
"github_metadata": {
"branch": "main",
"commit_count": 272,
"repo_created_at": "2023-11-09T22:48: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": "c6833ad90d... |
40cf56cd-d381-4d13-afa6-5a06d6265d7a | FedchenkoIKM724v/- | task8.cpp | #include <iostream>
int commonElements(int arr1[], int size1, int arr2[], int size2, int result[]) {
int size = 0;
for (int i = 0; i < size1; ++i) {
for (int j = 0; j < size2; ++j) {
if (arr1[i] == arr2[j]) {
result[size++] = arr1[i];
}
}
}
r... | ALGO | 0.997413 | 5.911287 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-04-25T07:01: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": "60ee8796f971... |
5a1a55ac-7baf-4f95-b8c5-04da3556de77 | patilrohit1964/Dsa-With-C- | array2d_ch11/asc_desc_2d.cpp | #include <iostream>
using namespace std;
int main()
{
int r, c;
cout << "Enter number of rows: ";
cin >> r;
cout << "Enter number of columns: ";
cin >> c;
int arr[r][c], temp;
cout << "Enter elements of the array:\n";
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j... | ALGO | 0.999946 | 4.969606 | {
"github_metadata": {
"branch": "main",
"commit_count": 109,
"repo_created_at": "2025-02-04T17:31: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": "5975d0f8b8... |
7d1d1b4e-7307-498c-8975-4e28f1739df1 | qn06142/coding-python | A_Dãy_ngoặc_không_sai_chúng_ta_sai1.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
// Check if the sequence is valid parentheses
bool isValid(const string &s) {
int balance = 0;
for (char c : s) {
if (c == '(') balance++;
else balance--;
if (balance < 0) return false; // invalid
}
return b... | ALGO | 0.999971 | 5.293199 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2024-04-18T01:40:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "327f62b4f27... |
8758a5cd-dda9-4b5a-9286-08eadd6b9549 | KZyred/hackerRankTest | hackerRankTest_(note)/Arrays/MinimumSwaps2.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
vector<string> split_string(string);
// Complete the minimumSwaps function below.
int minimumSwaps(vector<int> arr)
{
// // câu hỏi:
// // 1. làm thế nào để biết swap cái nào trước, sau -> quy luật gì không
// // 2. liệu chỉ có một cách du... | ALGO | 0.999918 | 4.378811 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2024-06-20T01:04: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": "347b9d2f091... |
a06c4f1d-d254-4d43-8338-903da4a39396 | prprprpony/oj | cf/954/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1024, inf = 0x3f3f3f3f;
bitset<N> g[N];
int ds[N], dt[N];
void go(int u,int n,int d[])
{
memset(d+1,0x3f,sizeof(d[1]) * n);
d[u] = 0;
queue<int> q;
q.push(u);
while (q.size()) {
u = q.front();
q.pop();
for (int i = 1;... | ALGO | 0.999925 | 3.785566 | {
"github_metadata": {
"branch": "master",
"commit_count": 1116,
"repo_created_at": "2015-11-24T14:16:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "81aa4b2... |
47153eaa-486a-4179-8f78-b0668e3b8ea7 | SeonJun-Hwang/PS | BFS/1854.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;
const int MAX = 1000;
typedef pair<int, int> pii;
vector<vector<pii> > adj;
vector<priority_queue<int> > res;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, m,... | ALGO | 0.999981 | 4.014474 | {
"github_metadata": {
"branch": "master",
"commit_count": 49,
"repo_created_at": "2019-08-05T00:48: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": "1134ac112... |
9842ceba-f622-4c47-a5e8-0ffbef476518 | syurskyi/Algorithms_and_Data_Structure | _algorithms_challenges/projecteuler/ProjectEuler-master(2)/ProjectEuler-master/223/223.cc | #include <iostream>
#include <map>
#include <vector>
#include <stdio.h>
#define SIEVE_RANGE (25000000)
#define PRIME_COUNT (1565927)
bool sieve_visited[SIEVE_RANGE] = {};
long long primes[PRIME_COUNT] = {};
void InitPrimes()
{
long long sum = 0;
long long curr_pos = 0;
for (long long i = 2; i < SIEVE_RAN... | ALGO | 0.998984 | 4.536258 | {
"github_metadata": {
"branch": "master",
"commit_count": 304,
"repo_created_at": "2019-12-06T04:14:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 11
},
"file_meta": {
"content_id": "26f3b8f... |
6756edcc-a52e-4cd9-a586-ecbf29c52e6f | YashasJKumar/Data_Structures | Linked_List/dll.cpp | //
// Created by <NAME> on 20/08/24.
//
#include "iostream"
using namespace std;
class Node
{
public:
int data;
Node *next;
Node *prev;
explicit Node(int data)
{
this->data = data;
next = prev = nullptr;
}
};
typedef Node* node;
node insert_front(node head, int data)
{
n... | ALGO | 0.999223 | 5.492903 | {
"github_metadata": {
"branch": "main",
"commit_count": 44,
"repo_created_at": "2024-08-21T01:45: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": "ea24d1a23ea... |
60e81a4f-c68d-44fd-96b2-ab9ee772ecdf | 410588896/leetcode | algorithms/cpp/binaryTreePreorderTraversal/binaryTreePreorderTraversal.cpp | /*
* @lc app=leetcode id=144 lang=cpp
*
* [144] Binary Tree Preorder Traversal
*/
/****************************************
*
* Given the root of a binary tree, return the preorder traversal of its nodes' values.
*
*
*
* Example 1:
*
*
* Input: root = [1,null,2,3]
* Output: [1,2,3]
* Example 2:
*
* Input: ... | ALGO | 0.999992 | 7.049462 | {
"github_metadata": {
"branch": "master",
"commit_count": 377,
"repo_created_at": "2020-08-31T12:50: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": "85501cf6... |
9a71e75a-8cbc-4625-9232-628a004093b4 | NarekAt/DiplomaProject | central_place/graph_analyzer/parallel_property_counters/parallel_triangle_counter.cpp | /**
* @file parallel_property_counters/parallel_triangle_counter.cpp
* @brief definition of class parallel_triangle_counter.
*/
#include "parallel_triangle_counter.h"
#include "erdos_renyi_reader.h"
#include "graph_constants.h"
#include <iostream>
#include <ctime>
#include <assert.h>
/////////////////////////////... | ALGO | 0.979759 | 6.010376 | {
"github_metadata": {
"branch": "master",
"commit_count": 69,
"repo_created_at": "2015-12-08T17:32:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f4da1a9c... |
73ba4c07-269d-4316-9deb-2d4eebe732fb | sahilkhan03/CF-Solutions | codeforces/1213/C.cpp | /* ___ |\ /| ____ ____ ____ ____
| | /\ / \ | | | \ / | /\ | \ | \ | | \
|_____| /__\ \____ |_____| | \/ | /__\ |____/ |____/ |__ |____/
| | / \ \ | | | | / \ | | | | \
... | ALGO | 0.999106 | 3.536329 | {
"github_metadata": {
"branch": "master",
"commit_count": 2194,
"repo_created_at": "2021-01-27T11:51:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd131e6... |
46cc01f9-bf8d-423c-aa01-f1007cfa2a62 | oceantran27/cpp-projects-collection | 0704/mtheall_ftpd/include/ftpConfig.h | // ftpd is a server implementation based on the following:
// - RFC 959 (https://tools.ietf.org/html/rfc959)
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
// - Deflate transmission mode for FTP
// (https://tools.ietf.org/html/draft... | CONFIG | 0.974879 | 6.898679 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-07-04T01:27: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": "6aff77ac328b... |
5b0d7b83-5f99-4e2c-b77d-50c153fa85d8 | ShawnJeffersonWang/algorithm | 4.更小的数.cpp | //
// Created by shawn on 24-3-7.
//
//本题思路:按位比较两端,如果是大于小于的情况容易处理,但如果是等于的情况需要耗费n的时间复杂度向中间再比较
//这样会使得时间复杂度达到n^3,根据测试用例大小可知后面60%跑不了,需要优化到n^2
//因此启用动态规划,当比较两端大小相等时,如i,j位,直接根据已经计算过的dp[i+1][j-1]得出结论,时间复杂度为1
#include <string>
#include <iostream>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s... | ALGO | 0.999998 | 3.83085 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-04-12T02:35: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": "8d062c8d269d... |
8e36867c-982c-4ea8-9c13-3c9f9556f596 | ygao317/LeetCode_ForFun | WeekendContest/LeetCode_2685.cpp | class Solution {
public:
int countCompleteComponents(int n, vector<vector<int>>& edges) {
vector<vector<int>> ns(n); // {parent, edges}
for (int i=0; i<n; ++i) ns[i] = {i, 0};
function<int(int)> find = [&](int i) {
int p = ns[i][0];
return (p == i)? i : (n... | ALGO | 0.999657 | 6.017196 | {
"github_metadata": {
"branch": "main",
"commit_count": 729,
"repo_created_at": "2022-11-02T11:56: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": "73b8776688... |
3ddf3039-2f01-4bbf-a2c1-d02afb5f039b | knagakura/procon | atcoder/abc157/e.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<std::bitset<26>(_)<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(... | ALGO | 0.999501 | 4.760579 | {
"github_metadata": {
"branch": "master",
"commit_count": 328,
"repo_created_at": "2018-12-14T09:52: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": "028192d9... |
d0166fa1-3864-42be-be68-831daeb6be40 | deevena30/SOC_PROBLEMS | SoC_Week3Problems/w3_q5sol.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int MAX = 1e6 + 1;
ll MOD = 1e9 + 7;
vector<ll> ans(MAX); // ans[n] will store total ways for height = n
void precompute() {
ll a = 1, b = 1;
ans[1] = (a + b) % MOD;
for (int i = 2; i < MAX; i++) {
ll x = (2LL * a + b) % MO... | ALGO | 0.999852 | 4.727075 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2025-05-23T09:57: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": "a7ac57a2917... |
f5733913-8a08-46fb-bf0c-3e9161ddc8d5 | abhisheksingh24/random_codes_i_ever_wrote | Altitudes.cpp | #include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
vector<long long> fact;
void fillfact(long long n){
fact.resize(n + 1);
fact[0] = 1;
for(long long i = 1; i <= n; i++) fact[i] = (i * fact[i - 1]) % MOD;
}
long long power(long long base, long long exp){
base %= MOD;
i... | ALGO | 0.999966 | 4.021863 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-07-02T07:55: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": "0c2cf38bf2... |
86c56548-7dc2-470d-8d28-228ad3a04cf0 | alexchun78/MeshTool | zLibEarCut/zLibEarCut.cpp | #include "../zLibMeshIO/include/Vector.h"
#include "header/CEarCut.h"
#include <iostream>
int main(int argc, char** argv)
{
// input data 초기화 : PVT4//sample01.txt
//std::vector<Vec2> inputData
//{
// Vec2(50.0, 130.0),
// Vec2(20.0, 90.0),
// Vec2(40.0, 65.0),
// Vec2(30.0, 35.0... | ALGO | 0.925347 | 3.508204 | {
"github_metadata": {
"branch": "main",
"commit_count": 42,
"repo_created_at": "2023-03-03T10:11: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": "a5d54dd6405... |
ea7e65df-2be3-4fe5-86ab-ddaae2a0a9d4 | manideepreddy13/Yeetcode | 0031-next-permutation/0031-next-permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int i = nums.size()-1;
int j = -1;
int k = -1;
int min_sub;
if(nums.size() == 2){
min_sub = nums[0];
nums[0] = nums[1];
nums[1] = min_sub;
} else {
while(i>0){
... | ALGO | 0.999991 | 5.120651 | {
"github_metadata": {
"branch": "main",
"commit_count": 76,
"repo_created_at": "2023-03-11T12:47: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": "55603b44109... |
161956b9-abbe-43d4-98d6-2a0ecf817b2b | sreekanth025/Algorithms | binaryExponentiation.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
// (a^b) % m
/*
int power(int a, int b, int m)
{
if(b == 0)
return 1;
int res = power(a, b/2, m);
if(b%2)
return ((res%m)*(res%m)*(a%m))%m;
else return ((res%m)*(res%m))%m;
}
*/
int power(int x, unsigned int y,... | ALGO | 0.999987 | 4.567357 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2020-03-19T15:13:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1fbc6ad1f... |
92c584e2-64b8-44d1-8631-3c00b0259ec8 | IPPK93/DAFE-A-DS-Contests-Problems | Semester 1/Contest 1/Tasks/Problemset 5/5_1.cpp | #include <iostream>
#include <string>
#include <stack>
#include <stdexcept>
#include "../../first_contest.h"
namespace FirstContest::Problemset5::Task1
{
char opposite(const char& ch)
{
switch (ch)
{
case ')': return '(';
case '}': return '{';
case ']': return '[';
... | ALGO | 0.999819 | 5.918197 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-05-19T22:20: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": "1b77f14a9239... |
a2859884-983e-4e70-ba18-d1c37bac6269 | seirion/code | facebook/2018/qualification/3/main.cpp | // https://www.facebook.com/hackercup/problem/1153996538071503/
// Facebook Hacker Cup 2018 Qualification Round
// Ethan Searches for a String
#include <iostream>
#include <string>
#include <map>
using namespace std;
string s;
int len;
map<char, int> m;
bool contains(char c) {
auto it = m.find(c);
return it ... | ALGO | 0.999694 | 3.924216 | {
"github_metadata": {
"branch": "master",
"commit_count": 677,
"repo_created_at": "2014-03-11T05:33:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f209831d... |
548bd3f5-df48-4e30-824d-af6525c326f4 | BDFYB/Data_Structure_and_Algorithm | data_structure/tree/5_level_traversal/method_2/src/solution.cpp | #include "solution.h"
#include <queue>
using std::vector;
using std::queue;
vector<int> Solution::level_order(Node* root) {
vector<int> ret;
std::cout << "递归这种方式不分层无法实现" << std::endl;
return ret;
}
vector<vector<int> > Solution::level_order_ret_mat(Node* root) {
vector<vector<int> > ret_root;
vec... | ALGO | 0.999972 | 5.464971 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-06-04T09:50: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": "93c61e97f... |
88f9371f-35da-460e-b3a4-4c82a87572c9 | isabelfdez/ft_containers | algorithms/lexicographical_compare.hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexicographical_compare.hpp :+: :+: :+: ... | ALGO | 0.971699 | 5.622535 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2022-09-15T12:39: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": "77d11fec4... |
045e455f-8bac-4ebf-a9e9-98bb7b39441c | mijanur-rahman-40/C-C-plus-plus-Online-Judge-Algorithms-Practise-Programming | Bestt_algorithm Based problems code/C++ .STL Container/Map problems/General map/Member functions/insert.cpp | #include <iostream>
#include <map>
using namespace std;
int main ()
{
map<char,int> mymap;
// first insert function version (single parameter):
mymap.insert (pair<char,int>('a',100) );
mymap.insert (pair<char,int>('z',200) );
pair<map<char,int>::iterator,bool> ret;
ret = mymap.insert (pair<char,int>('z',5... | TOOL | 0.960051 | 4.355489 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-01-13T14:19:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "66291cde37... |
8211c96c-2ce8-4dc7-974e-53f89ca531b5 | LynchLab/MAPGD | src/mapgd_0.4/depricated/PopLD-old.cc | // Updated on 01/19/16
#include "PopLD.h"
/*
Program PopLD.cc to estimate linkage disequilibrium (LD) between
polymorphic sites from high-throughput sequencing data of multiple
diploid individuals from a population by a maximum-likelihood (ML) method.
Random union of gametes is assumed in the estimation. In addit... | ALGO | 0.999482 | 4.268105 | {
"github_metadata": {
"branch": "master",
"commit_count": 519,
"repo_created_at": "2014-12-05T17:35:58.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 29,
"forks": 11,
"issues": 10,
"pull_requests": 1
},
"file_meta": {
"content_id": "2880e5... |
8284c06d-84e8-498c-a95c-3cc0718f40f1 | 2044-space-elevator/OnlineJudgeCode | Luogu/Luogu_P_3379.cpp | #include <bits/stdc++.h>
#define rty printf("Yes\n");
#define RTY printf("YES\n");
#define rtn printf("No\n");
#define RTN printf("NO\n");
#define rep(v,b,e) for(int v=b;v<=e;v++)
#define repq(v,b,e) for(int v=b;v<e;v++)
#define rrep(v,e,b) for(int v=b;v>=e;v--)
#define rrepq(v,e,b) for(int v=b;v>e;v--)
#define stg str... | ALGO | 0.99998 | 4.098892 | {
"github_metadata": {
"branch": "main",
"commit_count": 93,
"repo_created_at": "2023-09-03T04:39: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": "3e3486e17df... |
aeb3bd02-c25f-42cf-9382-a58a6f02c406 | zzz0906/LeetCode | Scripts/149_std.cpp | class Solution {
public:
int maxPoints(vector<vector<int>>& points) {
int res = 0;
for (int i = 0; i < points.size(); ++i) {
int duplicate = 1;
for (int j = i + 1; j < points.size(); ++j) {
int cnt = 0;
long long x1 = points[i][0], y1 = points[... | ALGO | 0.999946 | 5.528355 | {
"github_metadata": {
"branch": "master",
"commit_count": 492,
"repo_created_at": "2017-06-08T06:26:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "197012a... |
29d6831f-7059-42b4-a58e-7d82f16f145a | jusish/MatrixCalculations | MatrixCalculations/matrixRank.cpp | #include <iostream>
using namespace std;
const int MAX_SIZE = 20;
int rankOfMatrix(int matrix[][MAX_SIZE], int rows, int cols) {
int rank = 0;
// Perform row reduction using Gaussian elimination
for (int row = 0; row < rows; row++) {
// Find the pivot element
int pivot = matrix[row][r... | ALGO | 0.999996 | 6.040031 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-05-17T10:00: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": "0b4c477c5b9a... |
cd51c9a7-be54-4bbb-a113-0da8bf44b07a | Jimmy-Sim/Competitive-Programming | Baekjoon/33060-deforestation.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int T;
cin >> T;
while (T--) {
int N, K;
cin >> N >> K;
int x[300005], l[300005], r[300005], num[300005], er[300005];
for (int i = 1; i <= N; i++) cin >> x[i];... | ALGO | 0.999893 | 4.7832 | {
"github_metadata": {
"branch": "main",
"commit_count": 698,
"repo_created_at": "2022-10-11T11:51: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": "b46e61e989... |
5ba8fc0e-ca9c-446b-a7df-884ccb95ec87 | BornToDeath/cpp | algorithms/nowcoder/BM59_N皇后问题.cpp | //
// Created by lixiaoqing on 2022/5/30.
//
#include <iostream>
#include <vector>
class Solution {
public:
/**
*
* @param n int整型 the n
* @return int整型
*/
int Nqueen(int n) {
if (n <= 0) {
return 0;
}
// i 表示行号,dp[i] 表示列号
std::vector<int> dp(n, ... | ALGO | 0.999937 | 5.717942 | {
"github_metadata": {
"branch": "main",
"commit_count": 800,
"repo_created_at": "2021-10-28T03:47: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": "71acf12307... |
e5ea9225-8fb6-4b3b-8811-a51b266bb0a5 | GhulamMustafaGM/C-Programming | 02-C++ Programing/15.cpp | #include <iostream>
using namespace std;
// This creates the class queue.
class queue
{
int q[100];
int sloc, rloc;
public:
void init();
void qput(int i);
int qget();
};
// Initialize the queue.
void queue::init()
{
rloc = sloc = 0;
}
// Put an integer into the queue.
void queue::qput(int... | ALGO | 0.983449 | 4.30104 | {
"github_metadata": {
"branch": "master",
"commit_count": 912,
"repo_created_at": "2019-06-28T09:07:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b573ca04... |
8c66b37d-7d59-4c18-81e9-bb2bef3301e6 | Tzenthin/MaxDeepstream | script/face_arcface/arcFace/arcface_v2.cpp | #include <fstream>
#include <iostream>
#include <sstream>
#include <numeric>
#include <chrono>
#include <vector>
#include <algorithm>
#include <opencv2/opencv.hpp>
#include <opencv2/core/utils/filesystem.hpp>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <unistd.h>
#include <json/json... | DATA | 0.903519 | 3.732139 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2023-07-05T03:18: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": "54fd1288a95... |
d3a1db10-5d55-4acf-8cb4-41d9d7243cea | jrl-umi3218/SpaceVecAlg | src/SpaceVecAlg/MathFunc.h | /*
* Copyright 2012-2021 CNRS-UM LIRMM, CNRS-AIST JRL
*/
#pragma once
#include <cmath>
#include <limits>
namespace sva
{
namespace details
{
template<typename T>
T constexpr sqrtNewtonRaphson(T x, T curr, T prev)
{
return curr == prev ? curr : sqrtNewtonRaphson(x, static_cast<T>(0.5) * (curr + x / curr), curr);... | ALGO | 0.999636 | 6.730459 | {
"github_metadata": {
"branch": "master",
"commit_count": 277,
"repo_created_at": "2012-01-27T14:46:09.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 77,
"forks": 24,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0eddb25... |
4783b6df-7ff5-4890-a1d7-34278b10ab79 | bingzhangdai/online_judge | leetcode/401 - 500/403. Frog Jump.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
class Solution {
public:
bool canCross(vector<int>& stones) {
int n = stones.size();
if (stones.empty())
return false;
if (n == 1)
return true;
if (stones... | ALGO | 0.999945 | 5.432583 | {
"github_metadata": {
"branch": "master",
"commit_count": 111,
"repo_created_at": "2015-06-04T14:48:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1bf524ba... |
c0935aec-4435-4db1-908d-265de626e0f0 | RootLEE2/problem-solving | baekjoon/1_bronze/level_5/cpp/10430.cpp | #include <iostream>
#include <stdlib.h>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX_N 102
#define MAX_K 1000... | ALGO | 0.99994 | 4.220968 | {
"github_metadata": {
"branch": "main",
"commit_count": 317,
"repo_created_at": "2021-08-04T09:24: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": "3c873aed3b... |
23e1879e-af00-4acf-8b84-655645e367bc | Jafrin-khan/Practice | Aggressive Cows - GFG/aggressive-cows.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
bool isPossible(int miniDis , int cows , int n , vector<int>& stalls){
int c = 1;
int lastPlaced = stalls[0];... | ALGO | 0.999965 | 6.050707 | {
"github_metadata": {
"branch": "main",
"commit_count": 4337,
"repo_created_at": "2022-06-22T15:25: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": "a37dec36b... |
8ebe3ab8-2527-4b4e-8658-a5d5510f8217 | SimFlowCFD/RapidCFD-dev | src/OpenFOAM/graph/curve/curveTools.H | #ifndef curveTools_H
#define curveTools_H
#include "scalar.H"
#include "vector.H"
#include "curve.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
#define curveSmall 1.0e-8
#define curveGreat 1.0e8
#include "char.H"
#include "List.H"
typedef List<char> charList;
... | TOOL | 0.97988 | 7.354782 | {
"github_metadata": {
"branch": "master",
"commit_count": 144,
"repo_created_at": "2015-02-12T11:35:40.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 369,
"forks": 103,
"issues": 69,
"pull_requests": 1
},
"file_meta": {
"content_id": "2580... |
cd98bea5-2ff5-4df3-82fd-2828262498dd | vvvv/vvvv-sdk | vvvv45/addonpack/src/nodes/freeframes/ARTK+Tracker/ARToolKitPlus/src/core/arGetCode.cxx | /* ========================================================================
* PROJECT: ARToolKitPlus
* ========================================================================
* This work is based on the original ARToolKit developed by
* <NAME>
* <NAME>
* HITLab, University of Washington, Seattle
* http://... | TOOL | 0.981134 | 3.747091 | {
"github_metadata": {
"branch": "develop",
"commit_count": 9429,
"repo_created_at": "2011-10-19T14:20:40.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 241,
"forks": 190,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "10b... |
14e60392-9f61-4638-b748-66ac81f532f0 | sjaljain/Programs | InterviewStreet/CodeSprint3/String_1.cpp | /* <NAME> , 09EC1017
* Interview Street
* Binomial coefficient
*
*/
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cass... | ALGO | 0.999973 | 3.780315 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2013-08-20T08:22: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": "de60d75f1b... |
ccc1591e-f3ad-44e2-9f58-ab4e2607e66e | sksaifuddin/learning-Datastructures-and-Algorithms | DataStructures/QueueExample.cpp | #include<iostream>
using namespace std;
#define SIZE 5
class Queue {
int a[SIZE];
int head;
int tail;
public:
Queue() {
head = tail = -1; // indicates that queue is initially empty.
}
void enqueue(int x);
int dequeue();
void display();
};
void Queue :: enqueue(int x) {
... | ALGO | 0.998558 | 3.955012 | {
"github_metadata": {
"branch": "master",
"commit_count": 103,
"repo_created_at": "2018-05-26T17:02:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9adffa65... |
0c4068b9-487b-4e3b-8abe-0d8e212f42f9 | be-simon/algorithm | samsung_algo_camp/ch1_algo_basic/G1920.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, m;
int key;
vector<int> v(100000);
bool binary_search(int num) {
int left, mid, right;
left = 0;
right = n - 1;
while (left <= right) {
mid = (left + right) / 2;
if (v[mid] == num)
return 1;
else if (v[... | ALGO | 0.999978 | 4.80493 | {
"github_metadata": {
"branch": "main",
"commit_count": 44,
"repo_created_at": "2021-04-28T06:17:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e10dd1cd936... |
baaa0066-db30-4875-a77c-30f21590bcae | ziadmohamed0/Software_Engineering | 01-basics/03-array/tasks/Task_7_4.cpp | /**
* @file Task_7_4.cpp
* @author <NAME>
* @brief C++ program to find the most frequent element in an array of integers.
* @version 0.1
* @date 2025-03-22
*/
#include <iostream>
#include <array>
constexpr int Size = 8;
void most_frequent_element(const std::array<int, Size> &arr);
int main (void) {
std::ar... | ALGO | 0.999814 | 6.507397 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2025-07-07T09:26: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": "e1f9a6f413f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.