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 |
|---|---|---|---|---|---|---|---|
988f0d2d-7c77-40f8-8ab4-97e028810c2a | LarrySchultheis/CMPSC441-Labs | lab6/lab6/labn6P3.cpp | //<NAME>
//CMPSC 441
//Lab 6
#include <time.h>
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
void showBoard(const vector<vector<int>>& board);
int calculateH(const vector<vector<int>>& board);
void move(vector<vector<int>>& board, int queenColumn, int queenDestRow);
int evaluateSucces... | ALGO | 0.99987 | 4.041589 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2020-02-29T00:49:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6212d3514... |
0f389450-06da-4f3a-9451-87699817de63 | hemanvithapullela0456/CP-templates | Bit Maipulation/Bit_Tricks.cpp | 1) Check Whether Number is Even or Odd : x & 1
2) Clear the Lowest Set bit of x : x & (x-1)
3) Extract the Lowest Set bit of x : x & ~(x-1)
4) Clear all bits from LSB to ith bit : mask = ~((1 << i+1 ) - 1); x &= mask;
5) Clearing all bits from MSB to i-th bit : mask = (1 << i) - 1; x &= mask;
6) Divide by 2 : x >>= 1;... | ALGO | 0.99865 | 6.82191 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2024-08-06T13:25: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": "63c1fec5655c... |
ae2f895d-6d86-4026-baab-74c63f14dbbc | SitiSahrani/Fractal-Generator-Cpp | Fractals_Generator_C++.cpp | #include <iostream>
#include <graphics.h>
#include <math.h>
#include <conio.h>
#include <stdlib.h>
#include <ctime>
double xm,xM,ym,yM,dx, dy, sx, sy;
double x, y, r, s, t, z;
unsigned i, max_iter=512, jari=100, u, V, H;
void gam(double, double, unsigned);
void julia(double, double);
void mandelbrot(); //number of i... | ALGO | 0.999175 | 4.071631 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2025-03-12T15:51:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ca0372c93dda... |
9ea5ee55-ab60-4653-a44b-6cfd87626b8b | Hatary05/Problem-Solving | Basics/Math/Sieve-based Prime Factorization Preprocessing.cpp | //O(nloglogn) MAXN = 1e6정도여도 무리없음
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define compress(x) (x).erase(unique(all(x)), x.end(... | ALGO | 0.999893 | 4.300433 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2025-02-16T12:36: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": "9ef327b6b88... |
d956247f-1b3d-44d5-8e89-0edda85a76eb | ytsaurus/ytsaurus | contrib/python/scipy/py3/scipy/special/Faddeeva.cc | /* Copyright (c) 2012 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy... | ALGO | 0.999615 | 6.543252 | {
"github_metadata": {
"branch": "main",
"commit_count": 83261,
"repo_created_at": "2022-12-05T16:32:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2063,
"forks": 164,
"issues": 335,
"pull_requests": 38
},
"file_meta": {
"content_id": "b... |
a1a2fee7-b900-454e-9312-9f0e09ac2115 | joseaguirre/AguirreJose_CSC5_46091_SUM2015_Homework | Savitch Chapter3/Savitch_9thEd_Ch3_#2/main.cpp | /* File: main.cpp
* Author: <NAME>
* Created on June 29, 2015, 9:16 AM
*Purpose: Homework, credit card problem, revolving credit
*Savitch Chapter 3 #2
*URL:
*/
//System Libraries
#include <iostream> //I/O Library
using namespace std;//Namespace for iostream
//User Libraries
//Global Constants
const int cv... | ALGO | 0.997996 | 4.071944 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2015-06-30T03:07: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": "239cb2c43... |
21413ac5-3c15-47e4-a483-53b2014d9501 | liming-vie/LeetCode | largest-bst-subtree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int res=0;
int helper(TreeNode* root, int* max, int* min) {
*max = *min = root... | ALGO | 0.999953 | 6.082213 | {
"github_metadata": {
"branch": "master",
"commit_count": 662,
"repo_created_at": "2016-04-18T16:58:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a9cb66ae... |
7071b233-8aaf-44db-ba11-ba26418a5ebe | ascyrax/cp_dsa | codeforces/rated/div2/700s/777/d/d1.cpp | // @author: ascyrax
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define endl "\n"
#define ioss \
ios::sync_with_stdio(false); \
cin.tie(0);
#define pb push_back
double startTime;
double gct() // get_current_time
{
r... | ALGO | 0.999853 | 3.917214 | {
"github_metadata": {
"branch": "main",
"commit_count": 53,
"repo_created_at": "2022-06-07T16:49: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": "9da76ed6759... |
c6f2a1bc-3c4d-4c59-96a1-e7cc79d8be27 | AkVaya/CP_Solutions | Codeforces/1282B2.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
#include<iomanip>
#include<algorithm>
#include<map>
#include<math.h>
#include<string.h>
#include<ctime>
#include<cmath>
#define ll long long
#define eb emplace_back
#define pb push_back
#define ins insert
#define mp make_pair
#define m... | ALGO | 0.999913 | 3.71826 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2020-01-09T10:12: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": "397359dd8... |
870188a8-d801-466d-9ece-417a96fff2af | 2hanhan/algorithm | 算法学习/7.StackQueue/valid-parentheses.cpp | /**
* @file valid-parentheses.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-12-28
* 20. 有效的括号
* https://leetcode.cn/problems/valid-parentheses/
*
* @copyright Copyright (c) 2022
*
*/
#include <string>
#include <stack>
using namespace std;
class Solution
{
public:
bool isValid(s... | ALGO | 0.990952 | 6.185482 | {
"github_metadata": {
"branch": "master",
"commit_count": 94,
"repo_created_at": "2022-12-05T00:58:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8044ca1d... |
3fe38274-ad3e-4193-8376-998d0829ac0e | dotrann1412/CSES | Introductory Problems/TowerOfHanoi.cpp | #include <bits/stdc++.h>
using namespace std;
#define init(file_name) freopen(filename.in, "r", stdin); freopen(filename.out, "w", stdout)
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()
#define ll long long
#define vt vector
#define pb push_back
#define fi fi... | ALGO | 0.999861 | 4.171107 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2021-10-04T17:31:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "056a1dca27... |
8b224108-a4c5-4989-ab95-b5a0f7908ad8 | Ailuras/prob-smt | src/math/lp/nla_grobner.cpp | /*++
Copyright (c) 2017 Microsoft Corporation
Module Name:
nla_grobner.cpp
Author:
<NAME> (levnach)
<NAME> (nbjorner)
--*/
#include "util/uint_set.h"
#include "math/lp/nla_core.h"
#include "math/lp/factorization_factory_imp.h"
#include "math/lp/nex.h"
#include "math/grobner/pdd_solver.h"
#include "math... | ALGO | 0.997936 | 4.275104 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2022-09-20T13:53:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "270bda4034a... |
c5c1c9ba-2fab-4ddd-b24b-1a9e36e938c4 | lian/ofx-dev | addons/ofxCvHaarFinder/ofxCvHaarFinder.cpp | #include "ofxCvHaarFinder.h"
static int qsort_carea_compare( const void* _a, const void* _b) {
int out = 0;
// pointers, ugh.... sorry about this
CvSeq* a = *((CvSeq **)_a);
CvSeq* b = *((CvSeq **)_b);
// use opencv to calc size, then sort based on size
float areaa = fabs(cvContourArea(a, CV_WHOLE_SEQ));
float... | ALGO | 0.979794 | 5.494831 | {
"github_metadata": {
"branch": "master",
"commit_count": 156,
"repo_created_at": "2009-02-28T20:48:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 50,
"forks": 49,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c3b4b3... |
90c64bde-1b0d-4f65-bebd-b8701339b23a | JieunHan17/algorithm | LG_SW_Course/C3.cpp | #include <iostream>
using namespace std;
int N;//색종이 수
int X[100+10];
int Y[100+10];
int paper[100+10][100+10];
void InputData() {
cin >> N;
for (int i=0; i<N; i++){
cin >> X[i] >> Y[i];
}
}
bool Check(int leftTopY, int leftTopX, int rightBottomY, int rightBottomX)
{
for (int i = leftTopY; i... | ALGO | 0.999127 | 4.337601 | {
"github_metadata": {
"branch": "main",
"commit_count": 260,
"repo_created_at": "2021-04-10T01:59:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45ff09890e... |
b31e775b-9f20-4387-b975-63648edd7878 | Abysman/MyLeetCode | 139.Word Break/139.Word Break/main.cpp | //
// main.cpp
// 139.Word Break
//
// Created by Abysman on 2018/10/5.
// Copyright © 2018年 Abysman. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
if (wordDict.empty()) return false;
... | ALGO | 0.995114 | 5.084217 | {
"github_metadata": {
"branch": "master",
"commit_count": 548,
"repo_created_at": "2018-03-16T02:31:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f87fae95... |
5e408528-4e0c-4bf6-9ed7-0a5aa97e2533 | Basasuya/ACM | CodeForces/CF503/C.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iomanip>
using namesp... | ALGO | 0.99995 | 3.528288 | {
"github_metadata": {
"branch": "master",
"commit_count": 204,
"repo_created_at": "2018-01-10T03:13:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e83703bc... |
8d966e30-b9a4-4c06-b501-77d13c8dd78c | gianluisdiana/InputParser | include/input_parser/parser.hpp | /**
* @file parser.hpp
* @author <NAME> (<EMAIL>)
* @version 0.1
* @date November 27, 2023
* @copyright Copyright (c) 2023
*
* @brief File containing the description of a c++ command line parser.
*
*/
#ifndef _INPUT_PARSER_PARSER_HPP_
#define _INPUT_PARSER_PARSER_HPP_
#include <unordered_map>
#include <varia... | TOOL | 0.948083 | 7.509158 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2023-11-22T09:26:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 29,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8551d55... |
42042830-1871-40f6-8288-ee7c02608aa2 | cms-externals/blackhat | src/tree1.cc | /* Tree1.cc */
/* <NAME>, September 14, 2007 */
/* Implementation of light-cone gauge Berends-Giele recursion relations
using BlackHat momentum library.
3/22/08: Updated for new version of BlackHat
5/22/08: Reference momentum is no longer an argument to J; it is cached,
and created if no "re... | ALGO | 0.993357 | 3.253661 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2014-07-24T12:51:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8e0ca0d29e9... |
b554f547-e042-42c0-98b2-ff68b2a80b27 | eth-cscs/SummerSchool2021 | topics/openacc/practicals/diffusion/diffusion2d.hpp | #include <cstdio>
#include <iostream>
#include <fstream>
void diffusion_gpu(const double *x0, double *x1, int nx, int ny, double dt)
{
int i, j;
auto width = nx+2;
#ifdef OPENACC_DATA
// TODO: Offload the following loops to the GPU
#else
// TODO: Offload the following loops to the GPU; data is manage... | ALGO | 0.966085 | 5.320469 | {
"github_metadata": {
"branch": "main",
"commit_count": 102,
"repo_created_at": "2021-05-27T09:10:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 31,
"forks": 14,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "2f441084f... |
457bb15b-bf40-4d0a-b3a2-fe3c2499f255 | ishandutta2007/codeforces-c | chemthan/normal/629/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999838 | 4.142389 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:17: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": "b83cd4b9e422... |
ac36254b-0b9b-4fa9-95da-84cfb6115340 | swastik2703/C-plus-plus | Leetcode Challenge/merge2LL.cpp | #include<list>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
//*********** APPROACH-1 ********
ListNode* me... | ALGO | 0.999954 | 5.687706 | {
"github_metadata": {
"branch": "main",
"commit_count": 319,
"repo_created_at": "2021-06-03T16:16: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": "7f24e88a75... |
7c1a78a1-8b93-47c2-ad6b-1eb1c7221b24 | itohdak/Codeforces | Div3/prev/582/D.cpp | #include <bits/stdc++.h>
#include <print.hpp>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()... | ALGO | 0.999982 | 4.274273 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2018-05-21T14:37: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": "6c2fabb58... |
d89fc593-2885-4069-9134-afd79133011d | Samuel77743/linguagem-c-cpp | exercicios/12 Vetores.cpp | #include <stdio.h>
#include <stdlib.h>
//Usando Constante para dar um enunciado ao Programa:
#define title "Vetores"
int main(void)
{
printf("\n%s\n\n", title);
printf("Os vetores armazenam diferentes valores mas de forma sequencial na memoria!\nDessa forma a aplicacao fica mais eficiente, e mais conveniente aces... | ALGO | 0.996794 | 3.39308 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-03-26T21:45:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cc8d8bfc8ad6... |
a624cdae-c8b2-478e-b3a3-b3c3efc87c4c | RapidsAtHKUST/ContinuousSubgraphMatching | matching/graphflow.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include "utils/types.h"
#include "utils/globals.h"
#include "utils/utils.h"
#include "graph/graph.h"
#include "matching/graphflow.h"
Graphflow::Graphflow(Graph& query_graph, Graph& data_graph,
uint max_num_results,
bool print_prep,
... | ALGO | 0.998322 | 5.643524 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-03-14T06:53:56.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 50,
"forks": 7,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae24135741ce... |
f2551243-88ae-43cf-9024-773f3af82768 | NeblioTeam/NeblioX | src/bech32.cpp | // Copyright (c) 2017, 2021 <NAME>
// Copyright (c) 2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bech32.h>
#include <util/vector.h>
#include <assert.h>
namespace bech32
{
namespac... | ALGO | 0.93482 | 4.240252 | {
"github_metadata": {
"branch": "master",
"commit_count": 31685,
"repo_created_at": "2021-12-06T17:47:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "b55a14... |
63a0d689-9a1c-4b9c-82b1-a9d263f57359 | pedropiin/competitive-programming | mc521/03-08/jolly_jumpers.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, num;
while(cin >> n) {
vector<int> v(n);
vector<int> f(n - 1);
for (int i = 0; i < (n - 1); i++) {
f[i] = 0;
}
for (i... | ALGO | 0.999899 | 3.639055 | {
"github_metadata": {
"branch": "main",
"commit_count": 40,
"repo_created_at": "2024-09-15T22:38: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": "f3114b392be... |
056c1280-2b26-49e3-85a4-95192cf04b0a | meozigoon/Problem-Solving | C++17/백준/Silver/18352. 특정 거리의 도시 찾기/특정 거리의 도시 찾기.cc | #include <vector>
#include <iostream>
#include <list>
using namespace std;
//도시의 개수 N, 도로의 개수 M, 거리 정보 K, 출발 도시의 번호 X
int N, M, K, X;
vector<vector<int> > graph; //도시정보
vector<int> dist; //거리정보
vector<int> result; //거리가 K인 도시
void bfs() {
int start = X; // X번 도시로부터 시작
dist[X] = 0;
list<int> queue;
queue.push_... | ALGO | 0.999973 | 4.550032 | {
"github_metadata": {
"branch": "main",
"commit_count": 1094,
"repo_created_at": "2024-10-09T16:22:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3fc03366a... |
986f720b-4f6a-412c-b3f4-fcb95b03f7bb | andnlv/algorithms | mipt-2/task 2/Phone number/main.cpp | //
// main.cpp
// Phone number
//
// Created by <NAME> on 08.04.16.
// Copyright © 2016 <NAME>. All rights reserved.
//
#include <iostream>
#include <assert.h>
#include <algorithm>
#include <math.h>
#include <stack>
#include <stack>
#include <vector>
using namespace std;
class BigInt{
private:
vector<int> numb... | ALGO | 0.999877 | 3.897223 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2018-09-14T05:16: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": "7ffc91d74... |
074cd7b1-d634-4e0b-b8f6-de25c1a95b2e | baetuc/E-vote-protocol | HomeClient/Client.h | #include <NTL/ZZ.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include "FFunction.h"
#include "GFunction.h"
#define INFORMATION "../OfficeClient/votingInformation"
#define OK 0
#define INVALID 1
using namespace std;
using namespace NTL;
ZZ ID;
ZZ pseudonym;
int sec... | ALGO | 0.998437 | 3.667036 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2016-01-06T01:27: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": "18e66808ac... |
1de7a270-6cdd-4cdb-8088-018bc26eae45 | kylewuu/Othello-AI | Reversi.cpp | #include "Reversi.h"
#include "Mct.h"
#include "MctHeuristic.h"
#include <cstdlib>
#include <ctime>
using namespace std;
Reversi::Reversi(void)
{
main_loop();
};
void Reversi::print_intro()
{
cout << "xxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
<< "x x\n"
<< "x Reversi ... | ALGO | 0.987458 | 3.861776 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2020-07-27T16: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": "a25c5f59c... |
3299b029-21ed-4b34-8d84-e71c272baae1 | piDack/magma | magmablas_hip/daxpycp.hip.cpp | #include "hip/hip_runtime.h"
/*
-- MAGMA (version 2.7.1) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date February 2023
@generated from magmablas_hip/zaxpycp.hip.cpp, normal z -> d, Wed Feb 22 15:19:49 2023
*/
#include "magma_interna... | ALGO | 0.951406 | 5.568334 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-06-09T06:35:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "50ac99c766c9... |
44423eeb-7802-4e32-bc96-b1ea4b04b777 | djeada/Algorithms-And-Data-Structures | src/graphs/cpp/prim/src/graph.h |
#include <string>
#include <unordered_map>
#include <vector>
template <class T> struct Vertex {
Vertex(T value);
Vertex(const Vertex<T> &vertex);
T value;
bool operator==(const Vertex<T> &other) const;
bool operator!=(const Vertex<T> &other) const;
bool operator<(const Vertex<T> &other) const;
};
templ... | ALGO | 0.991043 | 5.7156 | {
"github_metadata": {
"branch": "master",
"commit_count": 511,
"repo_created_at": "2020-05-16T14:25:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 375,
"forks": 59,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "089b1... |
dff2011f-4b6a-49f0-b15a-42622c81694e | rlan/CodilityLessons | Lesson02/CyclicRotation/CyclicRotation/main.cpp | //
// Codility
// Lesson 2
// CyclicRotation
// https://codility.com/programmers/lessons/2-arrays/cyclic_rotation/
//
// 100% score
// https://codility.com/demo/results/trainingW3ATGD-489/
//
// Created by <NAME> on 3/28/17.
// See LICENSE.
//
#include <iostream>
#include <vector>
using namespace std;
vector<... | ALGO | 0.999759 | 5.518393 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-03-28T13: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": "25451923de... |
def7671f-95dc-4e7a-b83c-8cb48f1eab35 | bezzantsam/arrayFunCPP | Source.cpp | /*
@file ArrayFun.cpp
@author <NAME>
@version 1.0
Overview
This is a program (named arrayfun) that gets 10 integers from the user, stores them in an array, and then prints out:
the entire array
the lowest value in the array
the highest value in the array
the number of odd numbers in the array
the sum of all the val... | TOOL | 0.99101 | 4.969731 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-11-21T07:34:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "704d7224bc... |
6d3180ab-753a-4d01-8b1f-2a1c755ef15f | aig-upf/fs | src/constraints/direct/direct_rpg_builder.cxx |
#include <constraints/direct/direct_rpg_builder.hxx>
#include <utils/utils.hxx>
#include <utils/projections.hxx>
#include <problem_info.hxx>
#include <constraints/direct/constraint.hxx>
#include <constraints/direct/compiled.hxx>
#include <constraints/direct/translators/translator.hxx>
#include <aptk2/tools/logging.hx... | ALGO | 0.997814 | 5.491964 | {
"github_metadata": {
"branch": "master",
"commit_count": 607,
"repo_created_at": "2016-04-25T06:54:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4,
"forks": 4,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "1834328b3... |
d0163065-10c7-45b2-b964-80a7844baf37 | wangzitian0/leecode | 109. Convert Sorted List to Binary Search Tree.cpp | /**
11:42 - 11:57
Very similar with 108, split the ListNodes, then
recursively resolve it.
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, Lis... | ALGO | 0.999997 | 6.110695 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2015-07-07T13:26: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": "b900626d3... |
49959cbf-f24a-4d2b-a416-19fbe26289ed | DionysiosB/CodeForces | 0700-0799/785B-AntonAndClasses.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
bool scmp(std::pair<long, long> a, std::pair<long, long> b){return a.second < b.second;}
int main(){
long n; scanf("%ld", &n);
std::vector<std::pair<long, long> > chess(n);
for(long p = 0; p < n; p++){scanf("%ld %ld", &chess[p]... | ALGO | 0.99996 | 3.942776 | {
"github_metadata": {
"branch": "master",
"commit_count": 4487,
"repo_created_at": "2013-06-27T18:15:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 690,
"forks": 163,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ccc... |
52c08e7b-605c-4620-9c52-50618383a206 | ReinSwanSD/Programming-in-C-plus-plus | Recursion/HWPrograms/forHW2/HW2P2_sort/combine.cpp | using namespace std;
#include <iostream>
#include <vector>
// CS311 YOSHII FALL21
// Must use the algorithm that is in the notes!
// NEVER delete my comments!!
//--------------------------------------------
//CS311 HW2P2 Combine
//Name: <NAME>
//Compiler: g++
//--------------------------------------------
// combi... | ALGO | 0.999538 | 5.431036 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-03-08T21:49: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": "5e25fe45c93f... |
a28107b8-0e53-4f79-8047-8f34c3e8ec4f | jmaralo/codeforces | 2001/c/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed char byte;
typedef unsigned char ubyte;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
#define TESTCASES true
int query(int i, int j) {
static int resp{};... | ALGO | 0.999392 | 3.904383 | {
"github_metadata": {
"branch": "main",
"commit_count": 36,
"repo_created_at": "2023-11-01T18:55: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": "431bbadce7a... |
928a56cd-98fa-49b4-807a-e2b13baaf135 | mirinta/leet_code | array/0870_advantage_shuffle.cpp | #include <algorithm>
#include <queue>
#include <vector>
/**
* You are given two integer arrays "nums1" and "nums2" both of the same length. The advantage of
* "nums1" with respect to "nums2" is the number of indicies "i" for which "nums1[i] > nums2[i]".
*
* Return any permutation of "nums1" that maximizes its adva... | ALGO | 0.999976 | 6.280891 | {
"github_metadata": {
"branch": "master",
"commit_count": 1725,
"repo_created_at": "2023-04-09T12:48:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "012bce6... |
ce61b026-db53-45d7-b57f-53c0234da237 | ThomasBJones2/Robustness_Dissertation_Data | Scalable_Robustness/RBS2012_Blind_WC/ErrGain.cpp | #include <iostream>
#include <stdlib.h>
#include <inttypes.h>
#include <math.h>
#include <time.h>
using namespace std;
#define MAX_LENGTH 52 //This is the length of lists which need to be compared
#define MAX_ERR_PATTERN_LENGTH 2567 //This is an estimate of the number of comparisons required by the longest... | ALGO | 0.997001 | 3.721581 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-12-17T07:19: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": "031344b86c... |
97e6523e-3077-43de-8f4c-e30a68a2cd07 | chemthan/algorithm | Archive/Training/ACM/Asia - Jakarta 2012/Solutions/E.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i... | ALGO | 0.999976 | 3.493008 | {
"github_metadata": {
"branch": "master",
"commit_count": 554,
"repo_created_at": "2015-09-21T15:58:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 111,
"forks": 43,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "bf85e... |
d502add1-fc42-4659-9095-f4558f5113a9 | kgoel9899/CF_Solutions | codeforces/461/B.cpp | // https://codeforces.com/contest/461/submission/29958717
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i... | ALGO | 0.999975 | 4.019255 | {
"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": "01f3545... |
1edc2085-c50e-4289-ae3b-92ffad6f1f47 | jelllove/leetcode | leetcode/leetcode_0146_LRU_Cache/leetcode_0146_LRU_Cache.cpp |
class LRUCache {
struct DLL
{
DLL *prev = nullptr;
DLL *next = nullptr;
int key = 0;
int value = 0;
DLL()
{
}
DLL(int k, int v)
{
key = k;
value = v;
}
};
private:
//把一个结点从整个链路中移除
void _remove(DLL *item)
{
item->next->prev = item->pre... | ALGO | 0.999739 | 5.629647 | {
"github_metadata": {
"branch": "main",
"commit_count": 443,
"repo_created_at": "2021-03-19T16:22: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": "dc78e8378e... |
cdbedc30-75c7-47e5-a2af-d2c4f67b8bfb | ishandutta2007/codeforces-s | shatovoleg/normal/1203/F1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int ll
#define pb push_back
#define kek pop_back
#define mp make_pair
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
mt19937 rnd(chrono::high_resolution_clock::now()... | ALGO | 0.999973 | 4.094547 | {
"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": "f1644cf35b3a... |
7a4e47f6-f5a7-4ae5-b4fc-7130817bc656 | MohsenBg/algorithms-data-structures | src/Binary_Tree/Tree.cpp | #ifndef GRAP_CPP
#define GRAP_CPP
#include "Node.cpp"
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <vector>
using namespace std;
// Depth Breath Map(has table)
enum ALGORITHM { DFS, BFS, MAP, RECURSIVE };
template <typename T> struct TreeNode {
TreeNode(string Id, T Value) {
... | ALGO | 0.99967 | 4.258616 | {
"github_metadata": {
"branch": "main",
"commit_count": 67,
"repo_created_at": "2022-07-01T12:07: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": "a93beb81199... |
550814a7-d1c4-4f22-ba42-360ef9bdd80a | NEDJIMAbelgacem/graphs_algorithms | graphs_algorithms/graphs.cpp | #include "stdafx.h"
#include "graphs.h"
//using namespace graphs;
t_adjList graphs::from_adjMatrix_to_adjList(t_adjMatrix& adjMatrix, int n) {
map<int, set<vector<int>>> m;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (adjMatrix[i][j] != -1) {
m[i].insert(vector<int>{ j, adjMatrix[i][j] }... | ALGO | 0.999841 | 3.557527 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2018-11-03T18:13:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "57b96d61a... |
ea344406-24f9-414e-9e90-652b5a3f8d66 | Adityasharma15/Data-Structures | Arrays/circular-subarray-sum.cpp | // Max Circular Subarray Sum
// https://www.geeksforgeeks.org/maximum-contiguous-circular-sum/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll max_kedans(vector<ll> arr)
{
ll max_sum = INT_MIN;
ll curr_sum = 0;
for(ll i = 0; i<arr.size(); i++)
{
curr_sum+=arr[i];
max_sum = max(cur... | ALGO | 0.999946 | 5.413915 | {
"github_metadata": {
"branch": "master",
"commit_count": 201,
"repo_created_at": "2019-10-19T14:00:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "61678984... |
ef9592bb-5f65-4da0-b7ca-8a02ae4e01d4 | Ammar9290/water_ripple_simullation | water_ripple.cpp | #include <GL/glut.h>
#include <cmath>
#include <vector>
#include <iostream>
// Screen dimensions
const int WIDTH = 800;
const int HEIGHT = 600;
// Ripple parameters
float timeStep = 0.5f; // Increased time step for faster ripple propagation
float damping = 0.98f; // Reduced damping to let ripples last longer
std::... | ALGO | 0.983242 | 6.735389 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-01-15T10:14: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": "f3d3d6a32a1e... |
e292540d-3c34-4c04-8cab-da647034c116 | Leezed525/learning-algorithm | test/leetcode/editor/cn/[700]二叉搜索树中的搜索.cpp | //给定二叉搜索树(BST)的根节点
// root 和一个整数值
// val。
//
// 你需要在 BST 中找到节点值等于 val 的节点。 返回以该节点为根的子树。 如果节点不存在,则返回
// null 。
//
//
//
// 示例 1:
//
//
//
//
//
//输入:root = [4,2,7,1,3], val = 2
//输出:[2,1,3]
//
//
// 示例 2:
//
//
//输入:root = [4,2,7,1,3], val = 5
//输出:[]
//
//
//
//
// 提示:
//
//
// 树中节点数在 [1, 5000] 范围内
// 1... | ALGO | 0.999989 | 6.478553 | {
"github_metadata": {
"branch": "master",
"commit_count": 185,
"repo_created_at": "2022-04-07T03:12: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": "a7029af4... |
aa9dec17-ae13-43bd-ba2a-bac4e224b4bb | Mazziruso/PAT--Advanced | PAT1095/pat95_b.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#define maxn 86500
#define lowbit(x) (x & -x)
using namespace std;
int C[maxn] = { 0 };
void update(int s, int e, int key) {
for (int i = e; i > 0; i -= lowbit(i)) {
C[i] += key;
}
for (int i = s - 1... | ALGO | 0.99989 | 3.990888 | {
"github_metadata": {
"branch": "master",
"commit_count": 123,
"repo_created_at": "2018-10-27T06:43:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8833efa... |
3bc8b8ae-6533-4d02-a5d9-60470e430ee1 | JoelxD12O/C-PLUSPLUS-PROGRAMACION-III | SEMANA_5/SEMANA_5A_EJER2.cpp | #include <iostream>
using namespace std;
// Clase para cifrado afín
struct CAfin {
int a, b;
// Constructor
CAfin(int _x, int _y) : a(_x), b(_y) {}
// Sobrecarga de () para cifrar una letra
char operator()(char x) {
int x_num = x - 'A'; // Convertir letra a número (A = 0)... | ALGO | 0.999323 | 4.877162 | {
"github_metadata": {
"branch": "main",
"commit_count": 44,
"repo_created_at": "2025-04-17T01:49: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": "a791a6684ed... |
ac700bde-a6cd-4081-aad1-cd161bf4746b | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/minimum-height-trees-Solution.findMinHeightTrees/177778_DoS_Exec_Code_Overflow.cpp | void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
Stream *str, int width, int height,
GfxImageColorMap *colorMap,
Stream *maskStr, int maskWidth,
int maskHeight, GBool maskInvert)
{
ImageStream *maskImgStr;
maskImgStr = new ImageStream(maskStr, maskWidth, 1, 1);
maskImgStr->reset(... | TOOL | 0.936142 | 4.763483 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-22T14:39:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0e67d750bf4e... |
ae8d9e5a-d858-4304-9b63-630880145b95 | Sumanth-NR/CompetitiveProgramming | Platforms/Misc/Codeopardy/C_Alyona_and_the_Tree.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
vector<vector<array<int, 2>>> e(n);
for (int &x: a) cin >> x;
for (int i = 1, p, c; i < n; i++) {
cin >> p >> c;
... | ALGO | 0.999756 | 3.844047 | {
"github_metadata": {
"branch": "master",
"commit_count": 104,
"repo_created_at": "2022-04-18T13:29:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d55fa08... |
6f1f409f-f3d8-4269-b339-8aa8f879dfd1 | errai-/euler | hundredandbelow/70.cpp | #include <iostream>
#include <cmath>
#include <vector>
// This function expects that the given number is not divisible by 2
bool IsPrime(int prime_candidate, int * primes)
{
int border = sqrt(prime_candidate);
int i = 0;
while (primes[i] <= border){
if (prime_candidate%primes[i]==0){
return ... | ALGO | 0.999675 | 4.330632 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2017-03-19T19:42: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": "5e55e6c5e... |
44805bac-8a1b-4f7d-bbfc-0e9dc0c47c6c | mariiakornieva/algo-problems | Leetcode/06-2020-challenge/june-20-permutation-sequence.cpp | /* Permutation Sequence
The set [1,2,3,...,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for n = 3:
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permutation sequence.
*/
class Solution {
private:
std::vect... | ALGO | 0.99999 | 6.314905 | {
"github_metadata": {
"branch": "master",
"commit_count": 102,
"repo_created_at": "2020-04-01T19: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": "ae324a63... |
0d3d9842-7045-4194-942a-b891c3518caf | Parzival1509/GFG_POTD | 2023/2023-03/GFG_POTD_2023-03-01_Update_Queries.cpp | // GFG POTD 2023/03/01
// Update Queries
// Medium
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> updateQuery(int N,int Q,vector<vector<int>> &U) {
vector<vector<int>> bit(N+5, vector<int>(35));
for(auto& q: U) {
int l = q[0] - 1, r = q[1] - 1, x = q... | ALGO | 0.999945 | 4.888094 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2023-06-01T09:54: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": "9db6c1ceac2... |
06a99e91-a65f-43d1-bdab-a30e6924b2d6 | elliereiselt/vxnoise | vx/noise/impl/CellularNormal.cpp | #include <limits>
#include <cmath>
#include "../../simd/none.hpp"
#include "CellularNormal.hpp"
static float hashCellX(int seed, int cellX, int cellY) {
float rx = vx::simd::none::dot(static_cast<float>(cellX), static_cast<float>(cellY), 127.1f, 311.7f);
int hashX = vx::simd::none::partialJenkinsHash(seed, sta... | ALGO | 0.999077 | 6.403422 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2019-09-12T04:44:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ba28975a95... |
456d16af-628a-4865-9fb1-22b83fa31ba7 | likewinter/robotlinking-learning-kit-uno | Lesson 20 Automatic Light Source Tracking/code/Raytrace/Raytrace.ino | /********************************************************************
* name : Raytrace,
* function : Automatically Tracking Light Source。if you use a flashlight to shine the photoresistor, you will see the servo motor and the photoresistor rotate, finally stop at the direction of light source.
************************... | TOOL | 0.972737 | 5.416089 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-01-04T11:33:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "294932886... |
8da4cb53-0a3e-4801-8d3b-77552b3aea38 | szymon-czapracki/HackerRank | C++/ForLoop/src/main.cpp | #include <iostream>
using namespace std;
void print_even_odd(bool type) {
if(type) {
cout << "even" << endl;
}
else {
cout << "odd" << endl;
}
}
void print_value_name(int value) {
switch(value) {
case(1):
cout << "one" << endl;
brea... | ALGO | 0.995915 | 3.948577 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2019-02-24T15:35: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": "6ae28aea1... |
19778303-0c2d-4169-b474-7cd4e5be8dd6 | srishti-100/dsaQues | 0044-wildcard-matching/0044-wildcard-matching.cpp | class Solution {
private:
bool helper(int i, int j, string s, string t, vector<vector<int>>& dp){
if(i<0 && j<0) return 1;
if(j<0 && i>=0) return 0;
if(i<0 && j>=0){
for(int k = j; k>=0; k--){
if(t[k]!='*'){
return 0;
}
... | ALGO | 0.999983 | 5.14726 | {
"github_metadata": {
"branch": "main",
"commit_count": 445,
"repo_created_at": "2023-06-11T10:11: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": "9da69a5944... |
dfe38f8d-5252-4a0d-a347-a8f94ab63277 | menon92/Competitive-Programming | Uva/cpp-solution/11396.cpp | /**
* Problem : 11396 - Claw Decomposition.
* Verdict : Accepted.
* Author : <NAME>.
* Algorithm : DFS.
* Date : 27.07.2016.
**/
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
using std :: cin;
using std :: cout;
using std :: endl;
using std :: vector;
using std :: queue;
const i... | ALGO | 0.999961 | 4.39243 | {
"github_metadata": {
"branch": "master",
"commit_count": 160,
"repo_created_at": "2015-09-08T05:28:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f1cee723... |
e9f32f34-4173-4252-a25c-b434e12c5b88 | tylermorganwall/rayshader | src/bilineargrid.cpp | #include <Rcpp.h>
using namespace Rcpp;
inline double bilinearinterp(double q11, double q12, double q21, double q22, double x, double y) {
double x2x, y2y, yy1, xx1;
x2x = 1 - x;
y2y = 1 - y;
yy1 = y;
xx1 = x;
return(q11 * x2x * y2y + q21 * xx1 * y2y + q12 * x2x * yy1 + q22 * xx1 * yy1);
}
// [[Rcpp::expo... | ALGO | 0.948015 | 5.890003 | {
"github_metadata": {
"branch": "master",
"commit_count": 521,
"repo_created_at": "2018-05-13T13:51:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2116,
"forks": 216,
"issues": 39,
"pull_requests": 4
},
"file_meta": {
"content_id": "38... |
416764c5-8db7-4be1-8b70-b8f1dd681d1c | mpeychev/competitions | coci/2013-2014/coi/nizovi.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int na, nb;
int pos[1024];
int cmp(int x, int y) {
printf("cmp %d %d\n", x, y);
fflush(stdout);
int ret;
scanf("%d", &ret);
return ret;
}
int findPos(int kIndex) {
int le = na + 1, ri = na + nb, mid;
int ret = na;
while(le <= ri) {
mid = (le + ... | ALGO | 0.99983 | 3.283819 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2015-03-23T16:37: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": "a89e9687a... |
cb23ffd2-7c1e-43c0-8767-365cd0b34864 | ahsamehx/Problem-Solving | Coding/Number Theory/Project Euler #7 10001st prime.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 1e10
const int N = 1e6 + 20;
#define Ahmed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
long long mul(long long x, long long y, const long long &mod) { return ((x % mod) * (... | ALGO | 0.999561 | 4.647945 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-05-07T10:38:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "458a61784cbd... |
0b6af706-9a2e-48cc-b241-2462b486251b | calvin456/VaR | src/rng.cpp | //rng.cpp
#include<memory>
#include<math.h>
#include<cmath>
#include <boost/math/distributions.hpp>
#include "rng.h"
using namespace std;
copulaRng::copulaRng(unsigned int _d, rng& _rng_)
:d(_d)
{
_rng = shared_ptr<GenFromDistr<rng>>(new GenFromDistr<rng>(_rng_));
}
// Gaussian
Vec copulaRng::getGaussiancopul... | ALGO | 0.993521 | 3.766335 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2016-12-27T07:56:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "78de25aa0d... |
82b3f149-d807-4a21-8c51-ea9f63da4b5b | X-Plane/xptools | src/Utils/QuiltUtils.h | /*
* Copyright (c) 2010, Laminar Research.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merg... | TOOL | 0.994207 | 4.923753 | {
"github_metadata": {
"branch": "master",
"commit_count": 5526,
"repo_created_at": "2015-12-14T17:01:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 101,
"forks": 37,
"issues": 1,
"pull_requests": 2
},
"file_meta": {
"content_id": "df174... |
e0ec7b45-08f2-4d39-bebf-c15b628681e6 | ishandutta2007/codeforces-p | pranjal.ssh/normal/792/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int>... | ALGO | 0.999927 | 3.557806 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:49: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": "43a0669edff3... |
cf0cf590-4473-4e1c-9371-c0bc56a6bc60 | computer-graphics-fall-2018-2019-haifa/project-space-cowboys | Viewer/src/Utils.cpp | #include "Utils.h"
#include <cmath>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
glm::vec3 Utils::Vec3fFromStream(std::istream& issLine)
{
float x, y, z;
issLine >> x >> std::ws >> y >> std::ws >> z;
return glm::vec3(x, y, z);
}
glm::vec2 Utils::Vec2fFromStream(std::istream& issLine)... | TOOL | 0.911248 | 5.28691 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2018-10-18T18:34:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8f1653ba4... |
69d8a308-e51d-465b-b0cb-493622ed7185 | betteryjs/LC | 680/main.cpp | #include <iostream>
using namespace std;
// @solution-sync:begin
class Solution {
public:
// 双指针
bool validPalindrome(string s) {
int left = 0, right = s.size() - 1;
while (left < right) {
char c1 = s[left], c2 = s[right];
if (c1 == c2) {
left++;
... | ALGO | 0.999958 | 5.88541 | {
"github_metadata": {
"branch": "master",
"commit_count": 85,
"repo_created_at": "2022-02-24T05:26:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee1d988ec... |
c6590488-0af2-44a4-9712-37e62b1aa63f | woohyunjng/Coding-Practice | PS/Baekjoon/13000/13817.cpp | #include <bits/stdc++.h>
#define int long long
#define MAX 1000100
#define MOD 1000000007
#define INF 0x7f7f7f7f7f7f7f7f
#define endl '\n'
using namespace std;
typedef pair<int, int> pr;
typedef array<int, 3> tp;
int min_prime_factor[MAX + 1];
vector<int> primes;
void linear_sieve(int N) {
for (int i = 2; i <= ... | ALGO | 0.999945 | 3.680563 | {
"github_metadata": {
"branch": "main",
"commit_count": 485,
"repo_created_at": "2022-06-04T14:40: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": "5b7baba59d... |
03878b3a-956f-4447-a383-3a4fe0a5c163 | SwingOlive/kASA | source/utils/ParallelQuicksort.hpp | /***************************************************************************
* Part of kASA: https://github.com/SilvioWeging/kASA
* Inspired by https://github.com/log4cplus/ThreadPool/blob/master/ThreadPool.h
*
* Copyright (C) 2020 <NAME> <<EMAIL>>
*
* Distributed under the Boost Software License, Version 1.0.
* (... | ALGO | 0.999772 | 6.900398 | {
"github_metadata": {
"branch": "master",
"commit_count": 91,
"repo_created_at": "2019-03-26T15:26:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 23,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "48b814b5... |
3d211f60-22f8-4aa9-835f-49f4f06f2405 | zdevito/ATen | aten/src/TH/generic/THTensorLapack.cpp | #ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "TH/generic/THTensorLapack.cpp"
#else
/*
Check if self is transpose of a contiguous matrix
*/
static int THTensor_(isTransposedContiguous)(THTensor *self)
{
return self->stride(0) == 1 && self->stride(1) == self->size(0);
}
/*
If a matrix is a regular contiguous matrix... | ALGO | 0.9924 | 6.41698 | {
"github_metadata": {
"branch": "master",
"commit_count": 8655,
"repo_created_at": "2017-06-20T23:50:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 703,
"forks": 128,
"issues": 68,
"pull_requests": 0
},
"file_meta": {
"content_id": "4b... |
dba5f4eb-83f2-438b-b513-6d518036a9b7 | vaibhavdangayachvd/CPP-Programming | Practise/Exercises E Bala C++/Ch 7/7.3.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
class matrix
{
int **mat;
int row;
int col;
public:
matrix(){mat=0,row=0,col=0;};//Default Constructor
matrix(const int r,const int c);//Constructor
matrix(const matrix &m);//Copy Constructor
operator=(const matrix &m);//Overloaded = ... | ALGO | 0.994565 | 3.633132 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2018-11-21T10:12: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": "2c652db21... |
b5956944-820e-4b48-b4e5-0236d6e53ff6 | TaejuPark/OPMB_RTSS_2020 | opmb_fixable_assignment.cpp | #include "sys_model.h"
#include "routing_table.h"
#include "system_generator.h"
#include "opmb.h"
#include "common.h"
#include <unordered_set>
#include <queue>
vector<struct priority_assignment> getFixableAssignment(struct sys_model *model)
{
//printf("[getFixableAssignment] start\n");
//fflush(stdout);
v... | ALGO | 0.997956 | 5.443083 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-09-21T21:50:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "744b8c4c87... |
d54256fc-9420-4fc6-b078-c558277b513c | rajveer-09/DSA-GFG | Medium/Factorials of large numbers/factorials-of-large-numbers.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:
vector<int> factorial(int N){
// code here
int carry=0,multi=0;
vector<int>arr ;
arr.push_back(1);
... | ALGO | 0.99992 | 6.08986 | {
"github_metadata": {
"branch": "main",
"commit_count": 1696,
"repo_created_at": "2023-10-28T18:44:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "596e744d1... |
5c8c5ac6-2b74-48dc-b2ea-8b2f3b330881 | mrreda1/problem-solving | usaco/moocastGold.cpp | #include <bits/stdc++.h>
#include <numeric>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define make_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())
using namespace std;
template <typename T> T nxt();
template <typename T> class is_iterable {
public:
template <typename U>
... | ALGO | 0.999874 | 4.54886 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2025-01-27T18:28: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": "dc3e2ace8b5... |
40acfe3e-2131-419b-8b0f-890cebf798f0 | mukhoplus/BOJ | 1_cpp/13548/main.cpp | // 백준 13548: 수열과 쿼리 6(플래티넘 I), https://www.acmicpc.net/submit/13548
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const int MAX = 100000;
// 구조체 연습
struct S {
int x, y, num, ans;
} Q[MAX+1];
int N, M, A[MAX+1], sn, s, e, cMax, c[MAX+1], co[MAX+1];
// 정... | ALGO | 0.999994 | 4.137402 | {
"github_metadata": {
"branch": "main",
"commit_count": 716,
"repo_created_at": "2021-03-06T10:55: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": "e1689be762... |
15682d36-ba0b-416c-a9db-00ce2ddcad2d | nileshwankhede03/DSA-Practice | rightRotateArray.cpp | #include "./stdc++.h"
using namespace std;
// using extra space
void rotateArrayByOnePlace(int * arr , int n)
{
int temp[n];
int j = 0;
for(int i = 1; i <= n - 1 ; i++, j++)
{
temp[j] = arr[i];
}
temp[n - 1] = arr[0];
for(int k = 0; k < n; k++)
{
cout << temp[k] <... | ALGO | 0.99988 | 5.777589 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2025-07-14T14:22: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": "bd6db109db7c... |
05683dab-c2e0-4a55-9e16-3ea09bdba7e7 | Mindjolt2406/Competitive-Programming | Codeforces/367/C.cpp | #include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define ll long long int
#define ld long double
#define vi vector<int>
#define vll vector<long long int>
#define fi first
#define se second
#define sc(n) scanf("%d",&n);
#define scll(n) ... | ALGO | 0.99995 | 3.168464 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2018-11-15T05:50:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dcae38d61... |
22e5a1f3-ee4d-48d8-a400-03dc05521e06 | amusecode/amuse | src/amuse_pikachu/src/sequoia/src/sequoiaInterface.cpp | #include "../include/sequoiaInterface.h"
#include "../include/octree.h"
//The memory counters
long long my_dev::base_mem::currentMemUsage;
long long my_dev::base_mem::maxMemUsage;
//The Bonsai Octree class
octree *sequoia;
bool initFlag = false;
ofstream logFile;
//extern "C" {
my_dev::context & sequoia_init... | ALGO | 0.995238 | 3.053757 | {
"github_metadata": {
"branch": "main",
"commit_count": 9742,
"repo_created_at": "2014-04-07T12:35:07.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 172,
"forks": 107,
"issues": 164,
"pull_requests": 26
},
"file_meta": {
"content_id": "71d... |
b5c671b7-6cfb-4d5b-839e-8c03f02cf149 | phUR99/TEST | 백준/Platinum/4196. 도미노/도미노.cc | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(NULL); \
cin.tie(NULL); \
cout.tie(NULL)
vector<vector<int>> adj;
int p[100005];
bool finished[100005];
int indegree[100005];
int id;
int cnt;
int group[100005];
stack<int> s;
... | ALGO | 0.99985 | 5.051291 | {
"github_metadata": {
"branch": "main",
"commit_count": 1693,
"repo_created_at": "2023-08-27T13:55: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": "860ca639b... |
7ba171f7-0889-49a8-9189-edc4e7a93614 | CH-YYK/leetcode-cpp | 200. Number of Islands/solution_bfs.cc | #include <vector>
#include <queue>
#include <utility>
using namespace std;
/* Space complexity of BFS: O(min(M, N))
*/
class Solution {
public:
int numIslands(vector<vector<char>> &grid) {
int nisland = 0;
int m = grid.size(), n = grid[0].size();
queue<pair<int, int>> q;
for (int i = 0; i < grid.siz... | ALGO | 0.999876 | 5.909152 | {
"github_metadata": {
"branch": "master",
"commit_count": 130,
"repo_created_at": "2019-02-22T23:24:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8fffef9... |
10a06583-b004-4f36-aa69-c2359576fbbd | AishaJalil/Backtracking | source to destination.cpp | #include <iostream>
#include <vector>
using namespace std;
const int N = 5; // Size of the maze
bool isValid(int x, int y, int maze[N][N], int visited[N][N]) {
return (x >= 0 && x < N && y >= 0 && y < N && maze[x][y] != -1 && !visited[x][y]);
}
bool findPath(int x, int y, int maze[N][N],int visited[N][N]) {
... | ALGO | 0.999997 | 5.550922 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-06-09T15:09: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": "74b1dda6bb54... |
ae95c745-a263-4ee4-bd04-4142f5042b79 | arnavjaiswal2803/DSA | 1197-parsing-a-boolean-expression/1197-parsing-a-boolean-expression.cpp | class Solution {
struct ds {
bool result;
int index;
};
ds parseAnd(string &expr, int start) {
int n = expr.length();
ds res;
res.result = true;
for (int i = start; i < n; i++) {
res.index = i;
char ch = expr[i];
if (ch ==... | ALGO | 0.999786 | 5.277127 | {
"github_metadata": {
"branch": "main",
"commit_count": 1732,
"repo_created_at": "2024-09-11T06:38: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": "2b366dbdf... |
da928295-d38c-42aa-95bf-053b8e95a1c0 | andrelucasrc/Aed-1 | Aed 1 Lista 21/POO.cpp | #include<iostream>
//Cabeçalho de classe:
class Triangulo{
private:
float lado1;
float lado2;
float lado3;
public:
void setLado1(int lado){
if(lado>=0){
this->lado1=lado;
}//fim if
else{
this->lado1=0;
}//fim else
}//fim setLado1
void setLado2(int lado){
if(lado>=0){
... | ALGO | 0.995879 | 4.394171 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-05-27T21:01:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c629bff25... |
f35386e8-1729-4528-8d0e-942d10953a10 | Area-Ivy/Programming_Paradigms_Assignments | Assignment_2/Assignment_2_3.cpp | #include <iostream>
using namespace std;
// 定义链表的节点结构
struct Node {
int data; // 巧克力的编号
Node* next; // 指向下一个节点
Node(int d) : data(d), next(nullptr) {}
};
// 判断一个数是否是幸运数字:7的倍数或者包含数字7
bool luckyNumber(int num)
{
if (num % 7 == 0)
return true; // 检查是否是7的倍数
while (num > 0)
{ // 检查是否包含数字7
... | ALGO | 0.999574 | 4.276386 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2025-05-24T16:24: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": "33ed0afa960e... |
fddcd87c-ba11-4194-9e2d-4dad6d9f82a2 | kimmk6845/Baekjoon | Stack/9012(괄호).cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
stack<char> stk;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
for (int i = 0; i < t; i++)
{
string s;
cin >> s;
bool isBracket = true;
for (int j = 0; j < s.length(); j++)
{
i... | ALGO | 0.999731 | 4.81689 | {
"github_metadata": {
"branch": "main",
"commit_count": 195,
"repo_created_at": "2021-12-10T11:44: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": "17704544f9... |
dbdd84a0-4dc0-4416-aed5-0a63925c986b | Nolancw98/Durak | Game.cpp | #include "Game.h"
Game::Game(Player p1)
{
//deck = Deck();
deck.shuffle();
deck.setTrump();
cout << deck.getTrump() << endl;
player1 = p1;
player2.setName("Computer");
//Deal
for(int i = 0; i < minCards; i++)
{
//cout << deck.getSize() << endl; //DEBUG
player1.addToHand(deck.draw());
... | ALGO | 0.960211 | 3.725476 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2021-04-24T23:56:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "69d377b7b... |
3db8ea4a-f563-48d9-953b-2971d08c7742 | udeshya123/striver-sdesheet-challenge | ClimbingStairs.cpp |
Complexity Analysis:
- The time complexity of the fmemo function is O(n) because we are calculating and storing the number of ways to climb n steps.
- The space complexity is also O(n) to store the dp array.
*/
// Memoization
int fmemo(int n, vector<int>& dp) {
if (n == 1 || n == 2)
return dp[n] = n;
... | ALGO | 1 | 6.477991 | {
"github_metadata": {
"branch": "main",
"commit_count": 77,
"repo_created_at": "2022-06-04T14:23: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": "c0168449b0b... |
ef950cfd-469c-486a-8f3e-247f4ccd87e4 | ishandutta2007/codeforces-n | nishant403/normal/1562/B.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
uniform_int_distribution<int> uid(l, r);
return uid(rng);... | ALGO | 0.999447 | 3.974843 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:35:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9af81218f878... |
a5ae8ce5-d2bd-4f08-adc1-9493fb910230 | slDeng1003/Multi_Thread_External_Sort | DataIO.cpp | #include "DataIO.h"
// 哈希函数,用于生成随机数
int64_t DataIO::HashFunc(int64_t X) {
return (3 * X + 5) % modnum;
}
// 生成未排序的随机数据,将数据分为fileNum个相同大小的文件存储到磁盘
// 注:此处GB计算方式为1024*,非计算机1000*,故OS中文件大小可能“不同”。实际上字节数是相同的。
// 调用:int64_t HashFunc(int64_t X)
void DataIO::RandNumFileGenerate(int64_t* mem, FILE ** fPtrUnsort) {
int64... | TOOL | 0.934988 | 4.252977 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2023-12-05T07:26:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63c08786903... |
11f7c256-fb2a-45aa-8531-1b8344f29256 | arangodb/arangodb | 3rdParty/boost/1.78.0/boost/geometry/strategies/spherical/distance_segment_box.hpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2018-2021 Oracle and/or its affiliates.
// Contributed and/or modified by <NAME>, on behalf of Oracle
// Contributed and/or modified by <NAME>, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// ... | ALGO | 0.999876 | 7.190291 | {
"github_metadata": {
"branch": "devel",
"commit_count": 51986,
"repo_created_at": "2011-10-26T06:42:00.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 13878,
"forks": 857,
"issues": 743,
"pull_requests": 38
},
"file_meta": {
"content_id": ... |
25020f19-fe0e-48d9-96e6-c8ba230fe046 | rost0413/LeetCode | Longest_Substring_Without_Repeating_Characters.cpp | /*
Author: <NAME>, <EMAIL>
Date: Jul 3, 2012
Problem: Longest Substring Without Repeating Characters
Difficulty: easy
Source: http://www.leetcode.com/onlinejudge
Notes:
Given a string, find the length of the longest substring without repeating
characters. For example, the longest substring with... | ALGO | 0.999787 | 5.08956 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2012-07-18T15:36:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 34,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a52fd2d2... |
3d55f777-36c5-4e0f-b217-5586734a3735 | Lin-Guanguo/Algorithms_4th | 2_Sorting/2_Sorting/BinaryHeap.h | #pragma once
#include <utility>
#include <vector>
#include <functional>
class BinaryHeap {
public:
template<typename Iter>
static void swim(const Iter& begin, const Iter& end, int k) {
using std::swap;
while (k > 1 && compare(begin, k / 2, k)) {
swap(*(begin + k / 2), *(begin + k));
k /= 2;
}
}
templat... | ALGO | 0.999939 | 5.038758 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2020-10-16T14:47: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": "b8415df81e... |
df3a12ee-7190-42ef-a5df-26862bd2da9d | HarshCasper/NeoAlgo | C-Plus-Plus/math/Pythagorean_Triples.cpp | //C++ Program to generate Pythagorean Triples within a user-given limit
#include <bits/stdc++.h>
using namespace std;
//Function for computing Pythagorean Triples
void GetTriples(int& l)
{
//Starting values of m=2, n=1 are mapped to a=3, b=4, c=5, which is the smallest Pythagorean triple
int a = 0, b = 0, c = 0, m =... | ALGO | 0.99859 | 4.495756 | {
"github_metadata": {
"branch": "master",
"commit_count": 7521,
"repo_created_at": "2020-06-24T16:04:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 887,
"forks": 1041,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2... |
a392d9b1-9a07-4ed4-a566-1b3586cae7fc | ishandutta2007/codeforces-y | yzc2005/normal/1389/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200005, M = N * 2, inf = 0x3f3f3f3f;
int n, p[M], cnt, dp[M][2];
struct SegmentTree {
int l[M << 2], r[M << 2], val[M << 2], lzy[M << 2];
#define mid (l[p] + r[p] >> 1)
#define ls (p << 1)
#define rs (p << 1 | 1)
inline void pushup(int p) {... | ALGO | 0.999792 | 4.161101 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:40: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": "eac48d767eec... |
fb2cc994-a99c-4297-abf7-9743890d04ec | maZymaZe/maze-Python-learning-luogu-cpp-py- | LeetCode/m17.26.cpp | class Solution {
public:
vector<string> computeSimilarities(vector<vector<int>>& docs) {
unordered_map<int, vector<int>> mp1;
for (int i = 0; i < docs.size(); i++) {
for (auto& x : docs[i]) {
mp1[x].push_back(i);
}
}
unordered_map<int, unord... | ALGO | 0.998433 | 5.806144 | {
"github_metadata": {
"branch": "master",
"commit_count": 2987,
"repo_created_at": "2020-02-16T02:06:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3aceacd... |
44b3d539-3731-4e63-af10-ae4030b1c5aa | nikki-infinte/LeetCode_30Days_Challenge | 3395-minimum-length-of-anagram-concatenation/minimum-length-of-anagram-concatenation.cpp | class Solution {
public:
bool check(const std::string &s, int n) {
std::unordered_map<char, int> baseFreq;
for (int i = 0; i < n; i++) {
baseFreq[s[i]]++;
}
for (int i = n; i < s.size(); i += n) {
std::unordered_map<char, int> currentFreq;
for (int j... | ALGO | 0.999918 | 5.843768 | {
"github_metadata": {
"branch": "main",
"commit_count": 1426,
"repo_created_at": "2024-04-14T04:40: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": "34c7c4a30... |
02dc0775-8e83-4c9e-beab-7089f4d38f6e | xenial/algorithms | CSES/DT 2021/loppu/suuremmat.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long llu;
llu power(llu x, llu y) {
llu e = x;
if (y == 0)
return 1;
while(--y) {
e = e * x;
}
return e;
}
llu solve(llu n) {
int l = log10(n), i;
llu a;
llu c = 1;
do {
a = 0;
for ... | ALGO | 0.99989 | 4.469201 | {
"github_metadata": {
"branch": "master",
"commit_count": 130,
"repo_created_at": "2021-11-04T19:14: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": "b538be8d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.