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 |
|---|---|---|---|---|---|---|---|
0c039cab-296f-4976-bb29-18ce1c595c0f | VenusHui/VenusHui | ACM-ICPC/Codeforces/CodeforcesRound784B.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
usin... | ALGO | 0.999923 | 4.034251 | {
"github_metadata": {
"branch": "main",
"commit_count": 368,
"repo_created_at": "2021-08-18T02:42:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59ea07df28... |
8c62d557-2981-4ac8-bd00-fbd727b2b789 | seate/algorithm | baekjoon/단계 별로 풀어보기/강한_연결_요소/4013_ATM.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <deque>
using namespace std;
int maxV = 500000, maxE = 500000;
//입력부 처리
vector<int> weight;
set<int> end_point;
//dfs 전처리
vector<int> dfsn(maxV + 1, -1);
vector<int> upper(maxV + 1, 0);
vector<vector... | ALGO | 0.999938 | 4.739484 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2023-01-08T09:50:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "994c228f43d... |
5babd751-30a7-4615-b94e-224bf814503b | jigyasaG18/Data-Structures-And-Algorithms | Linked List/16)Remove Duplicates from a Sorted Linked List.cpp | Remove Duplicates from a Sorted Linked List
Given a singly linked list. The task is to remove duplicates (nodes with duplicate values) from the given list (if it exists).
Note: Try not to use extra space. The nodes are arranged in a sorted way.
Examples:
Input:
LinkedList: 2->2->4->5
Output: 2 -> 4 -> 5
Explanation: I... | ALGO | 0.999985 | 6.301363 | {
"github_metadata": {
"branch": "main",
"commit_count": 255,
"repo_created_at": "2024-12-24T05:09: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": "af00ebe29a... |
a5e649bb-971b-412c-8c4c-fdf4688b88b3 | AnurajKat/BTECHcollegeStuff | DC/lamport_Clock_Sync.cpp | /*
* use threads to represent different machines.
* An iterator to signify clock.
* make threads communicate with each other.
* A thread will send a message and a timestamp of its clock to another thread.
* Might have to use shared resource.
*
*/
#include <iostream>
#include <thread>
#include <vector>
#inclu... | ALGO | 0.985521 | 4.957239 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2017-08-17T05:02: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": "3f54aad0b... |
11b9461b-3cb9-4efa-885d-29990da03e47 | Team-RoboManipal/Kamalkant- | 2nd assignment(cpp)/2.matrix_multip.cpp | #include <iostream>
using namespace std;
int a[10][10],b[10][10],r[10][10];
//function to get matrix input
void printmat(int mat[10][10],int r, int c){
cout<<"\n******************\n\n";
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cout<<mat[i][j]<<" ";
}
cou... | ALGO | 0.997066 | 3.441898 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-09-12T00:27:57.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e9b67985b73... |
0009595e-e847-46a0-8ed1-c85ad2fb90e5 | TieWay59/tmplz | chunk1/图论/dijkstra with pairs.cpp | using cost_t = long long; //beware of integer overflow
using node_t = int;
using edge_t = pair<node_t, cost_t>;
using pqnd_t = pair<cost_t, node_t>;
vector <vector<edge_t>> adj;
void dijkstra(int s, vector <cost_t> &d) {
int n = adj.size();
d.assign(n, INF); // distance
d[s] = 0;
priority_queue <... | ALGO | 0.999959 | 4.021731 | {
"github_metadata": {
"branch": "master",
"commit_count": 35,
"repo_created_at": "2019-07-04T06:02:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 50,
"forks": 4,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "232de905... |
40a3b39e-14b5-40ad-a156-94e35c605a7b | Shahbaz898414/Code_Cheff | Pratice/Christmas Candy.cpp | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define double long double
#define endl '\n'
const int MOD = 1000000007;
const int inf = 1ll << 60;
int modInverse(int A, int M = MOD)
{
int m0 = M;
int y = 0, x = 1;
if (M == 1)
return 0;
while (A > 1)
{
int q = A / M;
int... | ALGO | 0.999736 | 5.170506 | {
"github_metadata": {
"branch": "main",
"commit_count": 654,
"repo_created_at": "2023-01-23T10:35:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71b435f44b... |
52bd3390-d3ae-4113-a19f-af9f3acf49fc | lueluelue1998/leetcode_cpp | leetcode_cpp/leetcode_cpp/416.分割等和子集.cpp | //#include <iostream>
//#include <vector>
//using namespace std;
//
//
////test
//int main() {
//
// cout << "hello world!" << endl;
//
// system("pause");
// return 0;
//}
//
//class Solution {
//public:
// bool canPartition(vector<int>& nums) {
// int sum = 0;
// int n = nums.size();
// for (int i = 0; i < n; i++)... | ALGO | 0.999946 | 4.76528 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2022-03-31T06:48:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4775f23e65... |
94af7b8c-f0c7-4419-a3b4-1e36c081d9fe | mukuldiw/Leetcode- | Root To Node Path.cpp | #include <bits/stdc++.h>
#include<queue>
#include<vector>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int data){
this->data=data;
left=NULL;
right=NULL;
}
~node(){
delete left;
delete right;
}
};
node* takeInputLevelWise() {
int rootData;
cout << "Ente... | ALGO | 0.999756 | 4.114378 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-05-15T15:55: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": "178e08524e5... |
26a584c5-4919-4570-a744-22ca1b79661f | Atul8766/Assignments | Assignment 36 STL:Array/7.Sorted.cpp | #include <iostream>
#include <array>
#include <iterator>
#include <algorithm>
using namespace std;
void show(int arr[], int size)
{
for (int i = 0; i < size; i++)
{
cout << arr[i] << " ";
}
}
int main()
{
int arr[] = {10, 19, 5, 1, 7, 6, 2, 3};
int size = sizeof(arr) / sizeof(int);
cou... | ALGO | 0.998968 | 4.850277 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-07-09T12:01:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "64a04ac2c528... |
d37aa775-18ed-4e15-b870-48cc936a7ae4 | khushalbokadey/Codes | CS 5/matrix.cpp | #include<iostream>
#include<string.h>
#include<stdio.h>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
#define in() ({ int x; scanf("%d", &x); x; })
#define fr(i,n) for(i = 0; i < n; i++)
void INPUT_FROM_FILE()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
}
... | ALGO | 0.999917 | 4.477511 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2013-08-23T18:52: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": "5d0848ef5... |
f9a79679-5115-41f4-ad78-281d9056b7a7 | uchiha-satyam/Codes | Longest Palindromic Substring - GFG/longest-palindromic-substring.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:
string longestPalindrome(string S){
// code here
int n = S.size();
bool dp[n][n];
string ans = "";
... | ALGO | 0.999959 | 5.945152 | {
"github_metadata": {
"branch": "main",
"commit_count": 1522,
"repo_created_at": "2023-03-28T17:13: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": "453f763fd... |
bcfdb6b6-0ffa-4671-85e7-dc1fdf7a32ab | viddrobnic/adventofcode | 2017/day_02/day_02.cpp | #include <iostream>
#include <string>
#include <vector>
int main() {
int s_1 = 0, s_2 = 0;
std::string line;
while (std::getline(std::cin, line)) {
std::vector<int> numbers;
std::string buffer = "";
for (int i = 0; i < line.size(); ++i) {
if (line[i] == ' ' || line[i] =... | ALGO | 0.999769 | 5.208606 | {
"github_metadata": {
"branch": "master",
"commit_count": 109,
"repo_created_at": "2020-12-01T15:23: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": "afbae89c... |
88d4a8dd-1bde-4193-8ee2-c722da445d9d | OptimoJoe/Optizelle | src/unit/core/qn_dogleg_tr_to_cauchy_safe.cpp | // Test the quasinormal step where we cut off the Newton step with a
// trust-reegion, but the dogleg and Cauchy points both violate the safeguard,
// so we retreat back on the Cauchy point.
#include "optizelle/optizelle.h"
#include "optizelle/vspaces.h"
#include "augsys.h"
#include "spaces.h"
int main(int argc,char*... | TEST | 0.910571 | 5.050989 | {
"github_metadata": {
"branch": "master",
"commit_count": 688,
"repo_created_at": "2014-05-14T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 67,
"forks": 13,
"issues": 10,
"pull_requests": 1
},
"file_meta": {
"content_id": "55dba9... |
189655ce-ea9f-484b-9589-1be66eabd1ef | priyansh19/data-structures-and-algorithms | linear-ds/DoublyLinkedList.cpp | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.cpp
* Author: Priyanka
*
* Created on May 29, 2019, 9:23 AM
*/
#include <iostream>
using namespace std;
clas... | ALGO | 0.999735 | 5.126557 | {
"github_metadata": {
"branch": "master",
"commit_count": 35,
"repo_created_at": "2019-07-06T15:36:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3dbac6f0f... |
044a96c1-dbad-480a-a8a1-6745cfef4717 | XMuli/QtExamples | unix_linux_20_conditton/conditton.cpp | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
typedef struct node //节点结构
{
int data;
struct node* next;
} Node;
Node* g_head = nullptr; //永远指向链表头部的指针
pthread_mutex_t g_mutex; //互斥锁--线程同步
pthread_cond_t g_cond; //条件变量--阻塞线程,等待条件满足
void* funProducer(void* arg); //生产者-... | ALGO | 0.989419 | 4.254512 | {
"github_metadata": {
"branch": "master",
"commit_count": 229,
"repo_created_at": "2019-08-16T15:46:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3772,
"forks": 814,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5b5... |
418b6117-d4ba-41d0-bb5e-4be560a76036 | albertobsd/keyhunt | secp256k1/IntGroup.cpp | /*
* This file is part of the BSGS distribution (https://github.com/JeanLucPons/BSGS).
* Copyright (c) 2020 <NAME>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This ... | ALGO | 0.97923 | 4.173627 | {
"github_metadata": {
"branch": "main",
"commit_count": 109,
"repo_created_at": "2020-12-16T16:37:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 868,
"forks": 577,
"issues": 51,
"pull_requests": 26
},
"file_meta": {
"content_id": "182b... |
d1a08c0d-7aad-4acf-af8d-9548203a37ee | iCodeIN/Competitive-Programming-11 | CodeChef/Fizbuzz/Kingdom_Attack.cpp | // // // // // // // // // // // // // // // // // // // // // // // //
/* author : pasricha_dhruv */
// // // // // // // // // // // // // // // // // // // // // // // //
// #include <algorithm>
// #include <bits/stdc++.h>
// #include <cmath>
#include <iostream>
// #include <map>
// #include <set>
// #incl... | ALGO | 0.999967 | 5.107693 | {
"github_metadata": {
"branch": "master",
"commit_count": 211,
"repo_created_at": "2022-03-22T12:10:57.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "060d25411... |
7c288b0f-89dd-45fd-a0c3-674ff9b22288 | joranzan/study-algorithms | BaaarkingDog_BOJ/9. BFS/2146. 다리 만들기.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
struct pos {
int row;
int col;
};
int Map[101][101] = { 0, };
int Visited[101][101] = { 0, };
int N;
const int dr[4] = { -1,1,0,0 };
const int dc[4] = { 0,0,-1,1 };
vector<queue<pos>> Candi;
int Answer = 1000;
void fi... | ALGO | 0.999822 | 4.142799 | {
"github_metadata": {
"branch": "main",
"commit_count": 521,
"repo_created_at": "2023-08-29T07:33: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": "35f4fffdf5... |
f936e503-4e82-49df-b46f-18ef197b023d | Daniel-1209/Competitive_Programing | AntiguosCPP/SumaDados.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool suman( int n, vector<int> vec, vector<int> vec2){
for(int j=0; j<vec.size(); j++){
for( int i=0; i<vec2.size(); i++){
if( vec[j]+ vec2[i] == n){
return true;
}
}
}
re... | ALGO | 0.999962 | 3.219223 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2021-05-09T04:17: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": "8b813603b9c... |
b2c8b89d-ed5a-422a-a815-6117f9601ec2 | tsuchan19991218/atcoder_achievement | atcoder.jp/abc054/abc054_c/Main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
typedef long long ll;
int main(){
int n, m; cin >> n >> m;
vector <vector <int>> G(n + 1);
rep(i, m){
int from, to; cin >> from >> to;
G.at(from).push_back(to);
G.at(to).push_back(fro... | ALGO | 0.999842 | 3.240778 | {
"github_metadata": {
"branch": "master",
"commit_count": 387,
"repo_created_at": "2020-08-24T19:03: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": "3d2682bb... |
bc7d92b0-b85d-497e-82bc-7b67ef9d935d | sivomke/Root_searching | Nonlinear_equations/Steffensen's_Method.cpp | #include "Steffensen's_Method.h"
#include "Fixed_Point_Iterator.h"
#include "Secant_Method.h"
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;
double steffensen_method() {
double x_prev = x0_, x_next = x1_, x_aux, y_aux, f_cur; int i = 0;
cout << setw(40) << right << "Steffensen's Metho... | ALGO | 0.999967 | 4.665881 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-02-29T15:10: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": "cb25a0efc7... |
dd9d3c11-ff18-464a-85e0-1559f1d9d0d7 | chisuhua/comodel | src/behavior/gpu/inc/OperandUtil.h | #pragma once
#include <cassert>
#include <iostream>
#include <memory>
#include <vector>
//
// Bitwise Functions
//
template <typename T >
inline T getBits(T x, int high, int low)
{
T one = 1;
return (x >> low) & ((one << (high - low + 1)) - 1);
}
template <typename T>
inline bool getBit(T x, int bit)
{
T ... | TOOL | 0.97639 | 7.193709 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2021-02-13T09:05: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": "cbd31ae3d5b7... |
c777e74c-ba4e-42ea-8d83-6eff9f158d50 | ishandutta2007/codeforces-e | eccentricity/normal/1456/C.cpp | #include<bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int maxn = 500000 + 1;
LL c[maxn];
LL pn[maxn];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
for(int i = 1; i <= n; i += 1) cin >> c[i];
sort(c + 1, c + n + 1, greater<LL>());
... | ALGO | 0.999985 | 4.040401 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:34:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "898c150e0c16... |
8d0f3bad-33cb-4f3f-a584-4a991ff55f03 | JosepHyv/Contest-Archive | hackerearht/minimun-querys.cpp | #include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mset(x,y) memset(x,y,sizeof(x))
using namespace std;
void DBG(){ cerr<<")\n";}
template<class H, class... T >
void DBG( H h, T... t... | ALGO | 0.999512 | 3.27524 | {
"github_metadata": {
"branch": "master",
"commit_count": 107,
"repo_created_at": "2020-04-12T00:42:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a2e2ab65... |
614987d3-1520-4876-8e95-442c343390ee | ehnryx/acm | naipc2019/virtual/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int INF = 0x3f3f3f3f;
ld prob(int n, int k, int d) {
if (k-2 > n-d) return 0;
ld ret = (ld)k*(k-1)/((ld)(n-k+1)*(n-k+2));
for (int i=3; i<=k; i++) {
ret *= (ld)(n-d-k+... | ALGO | 0.999967 | 5.043845 | {
"github_metadata": {
"branch": "master",
"commit_count": 79,
"repo_created_at": "2018-05-03T04:18: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": "1c15a7f12... |
e3cc0db9-d890-4e5d-beb8-dd25e9454bd5 | rudycito23/SearchEngine | IndexHandler.cpp | //
// Created by rrluc on 4/9/2022.
//
#include "IndexHandler.h"
IndexHandler::IndexHandler() { // empty constructor
}
void IndexHandler::insertWord(string word, string doc) {
invertedFileWordIndex.insertNode(word).emplace_back(doc); // insert the word and document into AVLTree
}
void IndexHandler::trave... | ALGO | 0.960745 | 3.987321 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2022-04-09T17:18:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "a8a5489586e... |
3f2586dc-9242-4186-99fb-32241906c53a | luchenqun/leet-code | problems/119-pascals-triangle-ii.cpp | /*
* [119] Pascal's Triangle II
*
* https://leetcode-cn.com/problems/pascals-triangle-ii/description/
* https://leetcode.com/problems/pascals-triangle-ii/discuss/
*
* algorithms
* Easy (47.65%)
* Total Accepted: 978
* Total Submissions: 2.1K
* Testcase Example: '3'
*
* 给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。... | ALGO | 0.99971 | 5.775706 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2017-09-01T16:07:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8b2899e65... |
4f189a82-cd7b-4aba-8e51-3fbcc5f98f28 | Rony-dot/Problem-Solving | BS/protagonist.cpp | #include<bits/stdc++.h>
using namespace std;
#define file_read(filename) freopen("input.txt","r",stdin)
#define ll long long
#define llu unsigned long long
/**
we will first solve the elements that are always smallest and then solve the problem
by maximizing the weapons with lees weight, and then compare to find the o... | ALGO | 0.999635 | 3.507013 | {
"github_metadata": {
"branch": "main",
"commit_count": 95,
"repo_created_at": "2021-03-22T04:30: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": "f6ad9079129... |
909365a0-445d-4fe6-bd14-9f206b93360c | mrslan/CSC-2560 | Assignment 2/Tracker.cpp | #include "Tracker.h"
void Tracker::findPath(Map* map)
{
Cell* c = map->getStart();
s.push(c);
c->setIsTraversed(true);
c->setOnPath(true);
for (;c->getCellType() != 'E';)
{
bool ar[8] {map->getNorth(c) != NULL, map->getNorthEast(c) != NULL, map->getEast(c) != NULL, map->getSouthEast(c)... | ALGO | 0.99938 | 3.421695 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2023-10-17T01:33: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": "56a654e469a... |
12a31163-9497-4efe-b236-0a0080a136fb | bever209/Competitive-Programming | Cpp programs/Codeforces/Random_practice/B1458.cpp | #include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define pq priority_queue
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using str = string;
const ll inf = 2 * 1e18;
int main() {
ios::sync_with_stdio(false);
... | ALGO | 0.999722 | 3.843298 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2021-04-22T21:46: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": "703615f6a95... |
82a257a2-6f60-4e79-8799-bb66d62a65ff | kaiubiferreira/genetic-pacman | Pacman/Scenario.h | #include "Sprites.h"
#include "Square.h"
#include "Queue.h"
struct tTarget
{
int directionFromSource;
int object;
int targetX;
int targetY;
int distance;
};
class Scenario
{
private:
int mainMatrix[31][28];
int distanceMatrix[68][68];
int listVisitedEdges[68... | ALGO | 0.997503 | 3.859694 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-12-26T09:42: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": "6c39b44352... |
88e43b7b-153d-4006-8724-c89334d802bd | Pragadeeshwar-D/GFG-PROBLEMS | Palindrome.cpp | Palindrome
Difficulty: SchoolAccuracy: 56.28%Submissions: 84K+Points: 0
Given an integer, check whether it is a palindrome or not.
Note : Strings which read the same backwards as forwards , eg - MADAM, MOM etc.
Example 1:
Input: n = 555
Output: Yes
Example 2:
Input: n = 123
Output: No
Your Task:
You don't need ... | ALGO | 0.999977 | 6.23285 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-08-07T17:35: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": "5453fb68a13... |
f7e11f35-5cf5-4ad8-b0e1-f5a932785237 | Anachor/HellBent | Ashiq's Code Library/data structure/segment tree Max with index.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 100, inf = 1e9 + 100;
int tree[4*N];
int a[N];
/// max in a range - keeps index
/// initiate a[0] with -inf
void build (int cn,int b,int e) {
if (b == e) {
tree[cn] = b;
return ;
}
int lc = 2*cn , rc ... | ALGO | 0.999996 | 4.497228 | {
"github_metadata": {
"branch": "master",
"commit_count": 209,
"repo_created_at": "2019-09-27T07:37:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 59,
"forks": 17,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "5eacff... |
06a01a26-2d63-4b98-8a80-8ec297aa5b78 | ingyu1008/Algorithm-Problem-Solving | Baekjoon Online Judge/유전자/solution.cpp | /********************************************************************
Problem Solving / Competitive Programming Template
Code by MatWhyTle(ingyu1008)
********************************************************************/
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")
#... | ALGO | 0.999597 | 3.743264 | {
"github_metadata": {
"branch": "master",
"commit_count": 2241,
"repo_created_at": "2021-03-31T05:23:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8a24d2... |
eb22dc55-7472-4abe-ad32-30e2ba3ccc64 | feel-coding/algorithm-practice | 괄호의값.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
int main() {
string paren;
cin >> paren;
stack<int> s;
for (int i = 0; i < paren.size(); i++) {
if (paren[i] == '(') {
s.push(-1);
}
else if (paren[i] == '[') {
s.push(-2);
}
else if (paren[i] == ')') {
if (!s.empty() &&... | ALGO | 0.999375 | 4.344143 | {
"github_metadata": {
"branch": "master",
"commit_count": 394,
"repo_created_at": "2020-09-05T13:38:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "97c209d5... |
94c96a10-bfaa-4dca-8625-f51bbeaa1911 | NghiaNDabc/OPP.cpp | rac/asm2_PhamTrongNghia_2021605945.cpp | #include<bits/stdc++.h>
using namespace std;
class LOPHOC;
class NGUOI{
protected:
char HoTen[50];
char NgaySinh[30];
char QueQuan[50];
public:
void nhap();
void xuat();
};
void NGUOI :: nhap()
{
cout << "Ho ten: "; fflush(stdin); gets(HoTen);
cout << "NgaySinh: "; fflush(stdin); gets(NgaySinh);
cout << "QueQu... | TOOL | 0.976984 | 3.107158 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-05-06T19:34: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": "226e878fdc1... |
5037398b-2772-4b76-bf8c-b378d31e817c | iliayar/ITMO | Term2/algo/labs/lab1/taskH.cpp |
// Generated at 2020-02-29 01:36:45.489643
// By iliayar
#include <iostream>
#include <vector>
#include <chrono>
#include <algorithm>
#include <cstdio>
using namespace std;
#define ON 1
#define OFF 0
#define int long long
#define vint vector<int>
#ifdef LOCAL
#define DBG(x) cout << "DBG: " << x << endl
#define DB... | ALGO | 0.999887 | 5.349636 | {
"github_metadata": {
"branch": "master",
"commit_count": 1008,
"repo_created_at": "2019-10-18T22:11:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ed968... |
7e3ebf6a-ec5e-43bf-8191-730d6ae331c1 | lumiis2/Geometrix---Programacao-e-Desenvolvimento-de-Software | src/geometry/Polygon.cpp | #include "Polygon.hpp"
#include "Utils.hpp"
Polygon::Polygon(std::vector<std::shared_ptr<Point>>& _vertices): vertices(_vertices) {
if (_vertices.size() <= 2) throw std::runtime_error("Tentativa de criar poligono degenerado!");
}
double Polygon::area() const {
double polArea = 0;
for (int i = 0; i <... | ALGO | 0.975403 | 5.937845 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-09-21T14:42:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "09943dc481b6... |
636bd4b7-38e7-4a90-92d9-84d26fb9c0fb | sohaib1083/University | University/3rd semester/DS Theory/ds_practise/Hashing/q1.cpp | #include <iostream>
#include <vector>
using namespace std;
// node of the singly linked list
struct Node
{
int data;
Node* next;
Node(int x)
{
data = x;
next = NULL;
}
};
// hash table with chaining using singly linked list
const int TABLE_SIZE = 1000;
class HashTable
{
private:
// array of poi... | ALGO | 0.999907 | 6.125815 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2023-07-09T17:38:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8ffb21d2c4... |
53b28c56-8d94-4890-af47-92d596fd69be | abswndfr/daily | CtCI/template/chap1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//1.1
// init bitmap after creating
// while(*str), not while(str)
#define ASCII_CODE_SIZE 128
bool isUnique(char* str)
{
return true;
}
//1.2
// is each character unique ? boolean type if yes, int type if no.
bool isPermutation(char* strA, char* strB)
{
... | ALGO | 0.998458 | 3.398812 | {
"github_metadata": {
"branch": "main",
"commit_count": 177,
"repo_created_at": "2023-06-15T02:32: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": "7c3e47f3d9... |
4480c7ce-14e8-484d-8cf4-d1dd8afcf4c1 | tiankonguse/leetcode-solutions | problemset-new/001/00189-rotate-array/rotate-array-tle.cpp | /*************************************************************************
> File Name: rotate-array.cpp
> Author: tiankonguse
> Mail: <EMAIL>
> Created Time: 2015年04月25日 星期六 17时50分29秒
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#incl... | ALGO | 0.99993 | 4.779838 | {
"github_metadata": {
"branch": "master",
"commit_count": 1037,
"repo_created_at": "2015-04-11T09:31:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 81,
"forks": 26,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "6f7cd... |
db5d7a74-99b8-4144-aab5-4f27b25dc61e | hemantsingh0557/My-Leetcode-Solutions | 1171-remove-zero-sum-consecutive-nodes-from-linked-list/1171-remove-zero-sum-consecutive-nodes-from-linked-list.cpp |
// /**
// * Definition for singly-linked list.
// * struct ListNode {
// * int val;
// * ListNode *next;
// * ListNode() : val(0), next(nullptr) {}
// * ListNode(int x) : val(x), next(nullptr) {}
// * ListNode(int x, ListNode *next) : val(x), next(next) {}
// * };
// */
// class... | ALGO | 0.99981 | 4.740576 | {
"github_metadata": {
"branch": "main",
"commit_count": 2527,
"repo_created_at": "2023-06-15T08:40: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": "cb828c950... |
cd10f536-00f1-46b1-825a-6e5933818e28 | biparnakroy/DSA-All-In-All | leetcode/1890-sum-of-beauty-of-all-substrings/sum-of-beauty-of-all-substrings.cpp | class Solution {
public:
int beautySum(string s) {
int totalBeauty = 0;
int n = s.size();
// Iterate over every possible starting point of the substring
for (int i = 0; i < n; i++) {
vector<int> freq(26, 0); // frequency array to store the frequency
... | ALGO | 0.999938 | 6.03389 | {
"github_metadata": {
"branch": "main",
"commit_count": 296,
"repo_created_at": "2021-10-01T16:09: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": "5b9933338f... |
d4c150f4-c1e8-470e-8c06-eef37f065447 | pmnyc/Source_Codes_Collected | osrm-backend/include/engine/geospatial_query.hpp | #ifndef GEOSPATIAL_QUERY_HPP
#define GEOSPATIAL_QUERY_HPP
#include "engine/phantom_node.hpp"
#include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/rectangle.hpp"
#include "util/typedefs.hpp"
#include "util/web_mercator.hpp"
#include "osrm/coordinate.hpp"
#include <algorithm>
#include ... | ALGO | 0.999229 | 6.662267 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2018-10-15T04:37:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "34354beb66... |
6281e93c-8f1c-461f-8acd-bceabed58097 | wudanchen/leecode | 1195offer.cpp | /*
* @Author: wdc <EMAIL>
* @Date: 2022-06-15 23:23:26
* @LastEditors: wdc <EMAIL>
* @LastEditTime: 2022-06-19 22:50:27
* @FilePath: /swordFingerOffer/1195offer.cpp
* @Description: 交替打印字符串
*
* Copyright (c) 2022 by wdc <EMAIL>, All Rights Reserved.
*/
#include <iostream>
#include <thread>
#include <mutex>
#i... | ALGO | 0.989904 | 5.247354 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-06-20T13:11: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": "b7e978330459... |
96cb5510-37e0-414c-96ec-23f87c59a68e | amir-hosen7/Graph | BFS/LightOJ/Beehives.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define Mid(b,e) b+(e-b)/2
#define inf 2147483647
double PI=2*acos(0.0);
//----------------------------------------------------------... | ALGO | 0.999371 | 3.792148 | {
"github_metadata": {
"branch": "master",
"commit_count": 91,
"repo_created_at": "2020-01-29T09:50: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": "942fd873c... |
15827a2c-be90-425e-9b7c-ae5e29e8ace1 | LymanY/MetricDBSCAN | code/src/Rtree.h |
#ifndef RTREE_H
#define RTREE_H
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include "Point.h"
#include "Global.h"
using namespace std;
bool comp(const Point* p1, const Point* p2);
class Rectangle {
public:
// The list of lower coordinates.
int* minValues;
// The list of hi... | ALGO | 0.998338 | 4.302593 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2022-05-12T12:48: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": "828e6c7148... |
4d07ef4a-866d-470d-a52c-55747906735b | soumik-saha/Problem_Solving | GeeksForGeeks/Job Sequencing Problem .cpp | //{ Driver Code Starts
// Program to find the maximum profit job sequence from a given array
// of jobs with deadlines and profits
#include<bits/stdc++.h>
using namespace std;
// A structure to represent a job
struct Job
{
int id; // Job Id
int dead; // Deadline of job
int profit; // Profit if job... | ALGO | 0.999956 | 5.508188 | {
"github_metadata": {
"branch": "main",
"commit_count": 1609,
"repo_created_at": "2022-11-21T05:41: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": "42832ad72... |
020abcf3-27e3-46bd-9458-49857103619f | mejibyte/competitive_programming | LeetCode/330 - Patching Array/patch2.cpp | // <NAME>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <... | ALGO | 0.999976 | 4.549784 | {
"github_metadata": {
"branch": "master",
"commit_count": 355,
"repo_created_at": "2011-10-27T01:25:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 196,
"forks": 66,
"issues": 1,
"pull_requests": 2
},
"file_meta": {
"content_id": "1e3a5... |
6ed7f2cf-cf03-448f-8499-d23c60dac4bf | codemonkeyricky/lc | 2123.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <cmath>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
... | ALGO | 0.999973 | 5.630648 | {
"github_metadata": {
"branch": "main",
"commit_count": 126,
"repo_created_at": "2024-11-11T05:29: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": "b78f3d500a... |
1dc3c537-af4b-4d25-b8a9-f6bce522f965 | ladamalina/leetcode-2022-cpp | 2602. Minimum Operations to Make All Array Elements Equal (medium)/main.cpp | #include <bits/stdc++.h>
using namespace std::literals;
using ll [[maybe_unused]] = long long;
using ii [[maybe_unused]] = std::pair<int, int>;
using vii [[maybe_unused]] = std::vector<ii>;
using vi [[maybe_unused]] = std::vector<int>;
using vl [[maybe_unused]] = std::vector<ll>;
using vvi [[maybe_unused]] = std::vec... | ALGO | 0.999903 | 6.127337 | {
"github_metadata": {
"branch": "master",
"commit_count": 837,
"repo_created_at": "2022-07-23T05:09:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c4eb1979... |
8f4adc53-3490-4875-ae74-aa0a9a247069 | utkarsh-009/CP-Problem-Solving | A_Nineteen.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
string s;
cin >> s;
unordered_map<char, int> m;
m.insert(make_pair('n', 0));
m.insert(make_pair('i', 0));
m.insert(make_pair('e', 0));
m.insert(make_pair('t', 0));
for (int i = 0; i < s.length(); i++)
{
char c =... | ALGO | 0.999733 | 3.823542 | {
"github_metadata": {
"branch": "main",
"commit_count": 242,
"repo_created_at": "2022-07-17T15:13: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": "04b463a767... |
11e1a20b-848d-4298-9dd0-d74ec527c8f7 | yongsoonko/solved-problems | 071-10845.cpp | #include <iostream>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
struct queue {
int f = 0, b = 0, _size = 0;
int _queue[20000] = {
0,
};
void push(int x) {
_queue[b++] = x;
_size = b - f;
}
void pop() {
if (_size == 0)
cout << -1 << '\n';
else {
... | ALGO | 0.998954 | 4.421341 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2019-11-13T06:15: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": "0e8edfeb5... |
39357150-fb79-4290-8baa-d47c9c6e7190 | MarcinCz/ealib | ealib/NormalMutationOperator.h | #pragma once
#include <random>
#include <boost/shared_ptr.hpp>
#include "MutationOperator.h"
namespace ealib
{
namespace eaoperator {
///An abstract class for normal mutation operator.
class NormalMutationOperator:
virtual public MutationOperator
{
public:
/**
* NormalMutationOperator constructor.
... | ALGO | 0.995053 | 6.616575 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2014-01-15T17:56:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fcac3cd01... |
2698bb2d-0f9f-4aee-9b5a-51a4f1b7dff7 | big-boy300/CTU | 4sem/PDV/sem_01/algorithms/bfs.cpp | #include "bfs.h"
#include <unordered_set>
#include "limits.h"
std::shared_ptr<const state> bfs(std::shared_ptr<const state> root) {
if (root->is_goal()) {
return root;
}
std::vector<std::shared_ptr<const state>> opened_vert;
std::vector<std::shared_ptr<const state>> copy_opened_vert;
std::... | ALGO | 0.999929 | 4.451419 | {
"github_metadata": {
"branch": "main",
"commit_count": 56,
"repo_created_at": "2022-07-02T12:33: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": "4c9b7648093... |
f69ee466-081b-4247-9db4-37e51676c2c6 | ftiasch/problem-setting-public | 2016-xiangtan/substring-count/random.cpp | #include "testlib.h"
int main(int argc, char* argv[])
{
registerGen(argc, argv, 1);
int n = std::atoi(argv[1]);
int q = std::atoi(argv[2]);
std::string alphabet = argv[3];
int w = std::atoi(argv[3]);
std::vector<int> lengths(n);
for (int i = 0; i < n; ++ i) {
lengths.at(rnd.wnext(0,... | ALGO | 0.991033 | 3.556624 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2019-08-15T12:29:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "087103f70... |
7d794a77-187f-4a04-8792-c7a6bc1fce68 | ishitarakchhit/Data-Structures-Code-Help | 13. Trees/Class 2/PathSumII.cpp | /*
Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node references.
A root-to-leaf path is a path starting from the root and ending at any leaf node. A l... | ALGO | 0.999989 | 6.205716 | {
"github_metadata": {
"branch": "main",
"commit_count": 181,
"repo_created_at": "2023-02-11T08:51: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": "8ab9031503... |
f1885727-6e7e-4796-ad68-3b059d13bcdb | AXIHIXA/PVG | solver/include/cuda_adaptive_evaluation.h | #ifndef CUDA_ADAPTIVE_EVALUATION_H
#define CUDA_ADAPTIVE_EVALUATION_H
#include <stdio.h>
#include <cuda_runtime.h>
/*This software contains source code provided by NVIDIA Corporation.
Read more at: http://docs.nvidia.com/cuda/eula/index.html#ixzz3h4aD9UbD
Follow us: @GPUComputing on Twitter | NVIDIA on Facebook
*/
... | ALGO | 0.981763 | 3.314492 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2019-12-02T00:28: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": "1ca78439e... |
d6ca87dc-12cd-4e9d-846e-d8e8198d6e6f | yichi3/UIUC | CS225/mp6/skipList.cpp | /**
* @file skipList.cpp
* MP6, skip list implementation
*/
#include "skipList.h"
#include <iostream>
using namespace std;
/**
* Default constructs the SkipList.
* Uses two sentinel nodes, each initially of height 1
*/
SkipList::SkipList() {
// zhi zhang a zhe ge cuo wu
// TMD zhe ge dai ma shi na ge sh... | ALGO | 0.998532 | 3.875194 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2018-10-17T19: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": "426364818... |
65dcba45-3f1c-4ce7-b740-8be1f59703a8 | PetarV-/Algorithms | Data Structures/Binomial Heap.cpp | /*
Petar 'PetarV' Velickovic
Data Structure: Binomial Heap
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <complex>
#def... | ALGO | 0.999998 | 4.286521 | {
"github_metadata": {
"branch": "master",
"commit_count": 176,
"repo_created_at": "2013-04-17T16:59:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 660,
"forks": 233,
"issues": 1,
"pull_requests": 15
},
"file_meta": {
"content_id": "885... |
ac53659f-f88a-47e4-ab06-86921765703f | winoros/Acm | Hdu/4749.cpp | /*
* =====================================================================================
*
* Filename: 4749.cpp
*
* Description:
*
* Version: 1.0
* Created: 2015/1/31 15:24:43
* Revision: none
* Compiler: gcc
*
* Author: winoros (Ding), <EMAIL>
* Orga... | ALGO | 0.999933 | 3.575578 | {
"github_metadata": {
"branch": "master",
"commit_count": 129,
"repo_created_at": "2015-01-20T13:13:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e5c7d10... |
154a7b46-2978-46c4-a284-2466e1787b24 | praveen189/CP-DSA | LCS/Min_No_insertion_to_make_aString_palindrome.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void lps(string a, string b, int m, int n)
{
int t[m + 1][n + 1];
for (int j = 0; j < n + 1; j++)
{
t[0][j] = 0;
}
for (int i = 0; i < m + 1; i++)
{
t[i][0] = 0;
}
// choice diag
for (int i = 1; i < ... | ALGO | 0.999917 | 4.479701 | {
"github_metadata": {
"branch": "gh-pages",
"commit_count": 22,
"repo_created_at": "2022-03-15T15:05: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": "73ae3cc... |
c86012ad-1457-4419-bbc0-df57817eda1d | Liluoquan/a-high-concurrency-webserver-in-linux | WebServer/include/pagecache/lfu_cache.h | #pragma once
#include <unordered_map>
#include <string>
#include "locker/mutex_lock.h"
#include "memory/MemoryPool.h"
#define LFU_CAPACITY 10
namespace cache
{
using std::string;
// 链表的节点
template<typename T>
class Node {
public:
void setPre(Node* p) { pre_ = p; }
void setNext(Node* p) { next_ = p; }
... | TOOL | 0.981592 | 4.800073 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2022-05-22T08:55:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 43,
"forks": 1,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "e4921f57... |
875d6a1f-286c-470e-84d6-d39d11114c3e | dicekeys/read-dicekey | lib-read-dicekey/utilities/statistics.h | // © 2019 <NAME> (Github: @uppajung)
#pragma once
#include <math.h>
#include <algorithm>
#include "../utilities/vfunctional.h"
/*
Given a vector of numbers, finds the value at a given percentile,
where the 0th percentile is the lowest number, 50th percentile is the median,
and the 100th percentile is the mix.
If t... | ALGO | 0.999764 | 6.762156 | {
"github_metadata": {
"branch": "primary",
"commit_count": 475,
"repo_created_at": "2019-05-12T23:26:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "bdbe3aeb... |
c6b1e530-e065-4ba7-883f-d191f681a242 | gitubanana/Problem-Solving | baekjoon/graph/15730/poolBoss.cpp | #include <iostream>
#include <climits>
#include <cstring>
#include <vector>
#include <queue>
struct t_pos
{
int y, x;
};
const int MAX_SIZE = 100;
const int dy[] = {-1, 1, 0, 0};
const int dx[] = {0, 0, -1, 1};
const int dirSize = sizeof(dy) / sizeof(dy[0]);
int ySize, xSize;
int map[MAX_SIZE][MAX_SIZE];
int hei... | ALGO | 0.999564 | 4.898636 | {
"github_metadata": {
"branch": "main",
"commit_count": 1345,
"repo_created_at": "2022-06-02T12:38:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b563787d... |
308ec97d-c7cc-4bad-aeeb-aec7ad00c0bd | Itamar000Git/CPP_Algorithms | CPP_files/praiority_Q.cpp | //<EMAIL>
#include <iostream>
#include <stdexcept>
#include <limits>
#include "praiority_Q.hpp"
namespace graphs
{
praiority_Q:: praiority_Q(int s, int * d):head(nullptr), size(0)
{
if(s<0){
throw std::out_of_range("Source vertex out of bound");
}
if(d == nullptr){
... | ALGO | 0.999838 | 4.830244 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2025-03-23T21:33: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": "a93283bccdd6... |
f0dbff07-a00f-4b28-aab4-3702aa91f18a | alvaroborras/AdventOfCode-2023 | src/Day_14_part2.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <chrono>
#include "time_utils.h"
int main() {
auto start = std::chrono::high_resolution_clock::now();
const uint16_t H = 100, maxIter = 150;
const uint32_t target = 1000000000;
s... | ALGO | 0.999176 | 5.369985 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2023-12-01T08:44: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": "9fb4b475f43... |
a209a243-6ef4-41d4-a8ec-40f18ef7a03e | prateeek1/CP | ShortestCycle.cpp | #include<bits/stdc++.h>
using namespace std;
int inf = INT_MAX;
const int N = 200005;
#define pb push_back
vector<int>gr[N];
void bfs(int src, int n, int &ans)
{
vector<int>dis(n + 1, INT_MAX);
queue<int>q;
dis[src] = 0;
q.push(src);
while (!q.empty())
{
int curr = q.front();
q.pop();
for (auto child : gr[... | ALGO | 0.999953 | 3.845064 | {
"github_metadata": {
"branch": "master",
"commit_count": 115,
"repo_created_at": "2021-06-14T17:06: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": "0356b061... |
aaa420d0-2ac6-4fd6-8267-dee01ccbe26f | Petroklos/Warframe-Damage-System-Reverse-Engineer-and-Dynamic-Damage-Reduction | DamageAttenuation/main.cpp | #include "Definitions.h"
#include "DamageCalculation.h"
#include "FrequencyCalculation.h"
#include "ArmorReduction.h"
#if isDebugging
void printDebug(double, double, double, double, double);
#endif
void calculateDamage(DamageCalculation&);
void calculateArmor(ArmorReduction&);
void calculateFrequency(FrequencyCalcul... | TOOL | 0.967064 | 4.705648 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2022-09-13T17:49: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": "be257cd0e... |
e0c5c91a-6fe0-4b10-a005-e19e36f213d0 | GonzaloPereira/CompetitiveProgramming | Codeforces/1499/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL);
#define N
bool checkOne(string &s,int pos){
int n = s.size();
for(int i = 1 ; i <= pos ; i++){
if(s[i] == s[i-1] && s[i]=='1') return false;
}
for(int i = po... | ALGO | 0.999837 | 4.16846 | {
"github_metadata": {
"branch": "main",
"commit_count": 86,
"repo_created_at": "2019-06-03T22:10:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b62360255c1... |
cfae69c7-60e8-4049-bf10-14b32eaef508 | Sa2003hil/DSA | Introdunction to CPP/Switch Statement/Programs/SetBits.cpp | // Brian_Kernighan_Algorithm
/*
if we subtract a number by 1 and do it bitwise & with itself (n & (n-1)), we unset the rightmost set bit. If we do n & (n-1) in a loop and count the number of times the loop executes, we get the set bit count.
The beauty of this solution is the number of times it loops is equal to the ... | ALGO | 0.999889 | 5.993394 | {
"github_metadata": {
"branch": "main",
"commit_count": 111,
"repo_created_at": "2023-03-20T13:58:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "393d3ade67... |
7bec16ff-2cd3-45ca-a3a9-2e8b0aab595e | ztizzlegaming/movie-recommendation-system | main_torus.cpp | //Netflix Prize
//<NAME> and <NAME>
//This implementation is using a torus
//For a data point, the user and movie rating vectors are attracted together
//Then, the user is repelled away from the average movie rating, and the movie rating from the average user
//The current z is printed out 100 times every iteration (e... | DATA | 0.997792 | 4.669326 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2018-03-24T00:10:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "692122d06... |
93d4f630-51df-4aec-bc8b-0c6b317ada17 | roshihie/At_Coder | ABC_C/ABC123_C_FiveTransportations.cpp | #include <bits/stdc++.h>
using namespace std;
using llong = long long;
void input(llong& rnMaxNum, vector<llong>& rvnCapcty)
{
cin >> rnMaxNum;
for (llong& rnCapcty : rvnCapcty)
cin >> rnCapcty;
}
llong calcTransptCnt(llong nMaxNum, vector<llong>& rvnCapcty)
{
for (int nx = 0; nx < rvnCapcty.size() - 1; ... | ALGO | 0.999892 | 3.963161 | {
"github_metadata": {
"branch": "master",
"commit_count": 465,
"repo_created_at": "2019-11-17T06:24: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": "0a354853... |
67a67109-d10d-44b9-9790-f9a60a7ae96c | elecbug/template | Template/bst.cpp | #pragma once
#include <iostream>
namespace EB
{
template <typename T>
class Queue;
const int INORDER = 0;
const int PREORDER = 1;
const int POSTORDER = 2;
template <typename T>
class BST
{
private:
class Node
{
public:
Node* left, * right;
T data;
Node(T data)
{
this->left = 0;
th... | ALGO | 0.998042 | 5.129996 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2022-10-24T01:08: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": "6511bca27... |
b4c32db7-caa4-4f94-a8d7-3fd2a9e9ac63 | impie66/McRave | Source/BWEB/PathFind.h | #pragma once
#include <BWAPI.h>
namespace BWEB
{
class Wall;
class Path {
std::vector<BWAPI::TilePosition> tiles;
double dist;
bool reachable;
BWAPI::TilePosition source, target;
BWAPI::UnitType type;
public:
Path(BWAPI::TilePosition _source, BWAPI::TilePosi... | ALGO | 0.99863 | 5.222627 | {
"github_metadata": {
"branch": "master",
"commit_count": 735,
"repo_created_at": "2020-08-30T01:36:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fea313a7... |
2e60fcc7-033b-48bc-91c6-fc65caf93937 | leopwma/spilady | periodic_CPU.cpp | /********************************************************************************
*
* Copyright (C) 2015 Culham Centre for Fusion Energy,
* United Kingdom Atomic Energy Authority, Oxfordshire OX14 3DB, UK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in c... | ALGO | 0.989327 | 3.024457 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2016-12-15T21:15:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "19232c7e95... |
ba05c6c0-7842-4df4-b1d7-5ae0f2d0bc89 | qdcampagna/BTODSTARLNUNP_EVTGEN_Model | src/EvtGenModels/EvtbTosllMS.cpp |
/***********************************************************************
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
* *
* This file is part of EvtGen. *
* ... | DATA | 0.961911 | 5.995605 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2022-03-12T20:42:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "82968ffdacb... |
27759116-0922-4248-90f2-3b199698e98a | rajith-r/MPI_week2_Deliverables | recursive_mergesort.cpp | #include <iostream>
#include <vector>
#include <random>
#include <chrono>
// Merge function
void merge(std::vector<int>& arr, int left, int mid, int right) {
int n1 = mid - left + 1;
int n2 = right - mid;
std::vector<int> L(n1), R(n2);
for (int i = 0; i < n1; i++)
L[i] = arr[left + i];
for... | ALGO | 0.999852 | 6.406955 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2025-06-13T03:41: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": "31280defd... |
8b54781c-6e36-48bc-876c-ce6a3820fd0d | UCL/STIR | src/include/stir/numerics/MatrixFunction.inl | //
//
/*
Copyright (C) 2004- 2007, Hammersmith Imanet Ltd
This file is part of STIR.
SPDX-License-Identifier: Apache-2.0
See STIR/LICENSE.txt for details
*/
/*!
\file
\ingroup numerics
\brief Implementation of functions for matrices
\author <NAME>
\author <NAME>
*/
#include "stir/IndexRan... | ALGO | 0.997413 | 6.6055 | {
"github_metadata": {
"branch": "master",
"commit_count": 9261,
"repo_created_at": "2015-09-28T07:44:46.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 125,
"forks": 96,
"issues": 305,
"pull_requests": 38
},
"file_meta": {
"content_id": "2a... |
6eab21e0-ef10-46c8-8cd4-699797605091 | cloud-007/Online-Judge-Solutions | CodeForces/1427A.cpp | /*One touch and i IGNITE*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define endl "\n"
#define Endl "\n"
const int N = 2e5 + 5;
int tc, n, casee = 1, a[N];
int main() {
#ifdef cloud_007
freopen("in.txt", "r", stdin);
#endif // cloud_007
ios_base::sync_w... | ALGO | 0.999799 | 3.96654 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2022-09-20T19:30:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "943becb59... |
a63192ac-fe22-41a5-8e68-3f5cf2f39269 | Chomtana/cptraining | UVa/193.cpp | #include <bits/stdc++.h>
#define for1(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define for2(i,a,b) for(int (i)=(a);((a)<=(b)?(i)<=(b):(i)>=(b));(i)+=((a)<=(b)?1:-1))
#define until(x) while(!(x))
#define all(x) x.begin(),x.end()
#define mp make_pair
#define subfunc(ret,name,args) function<ret args> name; name = [&] args
... | ALGO | 0.999943 | 4.195549 | {
"github_metadata": {
"branch": "master",
"commit_count": 47,
"repo_created_at": "2016-04-15T03:46: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": "43796c00d... |
f37a5252-4c18-42e8-bcb8-2f679c77e1e4 | Milikovv18/WavEffects | GasParticle.h | #pragma once
#include <corecrt_math_defines.h>
#include "Vec2.h"
#define POW_2(x) ((x)*(x))
#define POW_3(x) ((x)*(x)*(x))
namespace particle_const
{
// Solver parameters
constexpr float REST_DENS = 1000.0f; // Rest density
constexpr float GAS_CONST = 2000.0f; // Const for equation of state
constexpr float MAS... | CONFIG | 0.971948 | 5.793295 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-12-21T16:44: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": "eab8bef3dbb2... |
6e1d2d4c-8db7-4d90-bb40-cbe38aba537b | KOREAparksh/algorithm | baekjoon/5525.cpp | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string str;
int n, length;
int count = 0;
cin >> n >> length;
cin >> str;
for(int i = 0 ; i < length; i++){
... | ALGO | 0.99963 | 3.515665 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2022-11-21T10:05:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0dad478c5... |
8dfc9637-fb59-4f87-92f5-4ddf786f829e | sunggh/Algorithm | Algorithm/BOJ/수들의 합 7 (2268).cpp | #include <iostream>
#include <queue>
#include <set>
#include <map>
#include <math.h>
using namespace std;
long long init2268(vector<long long>& a, vector<long long>& tree, int node, int start, int end) {
int mid = (start + end) / 2;
if (start == end)
return tree[node] = a[start];
else
retu... | ALGO | 0.999976 | 4.996973 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-01-13T04:27: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": "45a0ab0604c4... |
740d0476-f9e7-416d-ac53-02ffadabfa12 | skyline9981/Algorithm_pratice | process.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long
struct node{
int task_num;
int next_pos;
int run_where=-1;
};
struct cmp{
bool operator()(node a, node b){
return a.next_pos < b.next_pos;
}
};
int main(){
... | ALGO | 0.999802 | 3.615382 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-10-04T07:55: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": "40cf1461e295... |
9d10c600-8240-4993-aa24-4749842ce774 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/12/1226/personal_submission/cf1610d_6_1.cpp | #include <bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 2e5+10,p = 1e9+7;
int fac[N],a[N];
int qmi(int a,int b,int p)
{
int res = 1;
while(b)
{
if(b&1)res=a%p*(res%p)%p;
b>>=1;
a=a%p*a%p;
... | ALGO | 0.999936 | 4.31874 | {
"github_metadata": {
"branch": "main",
"commit_count": 20410,
"repo_created_at": "2024-02-26T01:04:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 478,
"forks": 302,
"issues": 0,
"pull_requests": 7
},
"file_meta": {
"content_id": "d038... |
9b7accca-100c-49b7-a1e6-0ec2cc80cb39 | kuno4n/TopCoder | src/559-div2-250/BlockTower.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
#define SZ(x) ((int)x.size())
#define MSET(x,a) memset((x), (a), ... | ALGO | 0.999972 | 4.555137 | {
"github_metadata": {
"branch": "master",
"commit_count": 310,
"repo_created_at": "2012-10-04T08:58: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": "5d9344e1... |
1d8d51a3-745e-43cb-9ed0-f2e23e67e117 | Ashai-project/DroneOptimization | src/Main/DroneOptSample.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <limits>
#include <GL/glut.h>
// Vec3構造体で頂点座標を表現
struct Vec3 {
float x, y, z;
Vec3() : x(0), y(0), z(0) {}
Vec3(float x, float y, float z) : x(x), y(y), z(z) {}
float distance(const Vec3& other) co... | ALGO | 0.999025 | 5.221269 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-10-14T06:10: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": "07df504c222... |
d97d08dd-7f6b-4db6-a855-1837806d0b88 | poshithNandyala/cp-pratice | anonymous/TLE/1100/B_2_D_Traveling.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr);
int main()
{
fastio int t;
cin >> t;
while (t--)
{
ll n, k, a, b;
cin >> n >> k >> a >> b;
... | ALGO | 0.999953 | 4.153475 | {
"github_metadata": {
"branch": "main",
"commit_count": 160,
"repo_created_at": "2024-12-22T07:04:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e804ed86c1... |
578f44de-e06a-4b37-9c05-1a93f70e1662 | MAKIYAMA-ma/AtCoder | ABC300/B.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#if 1
using mint = modint1000000007;
#else
using mint = modint998244353;
#endif
using ll = long long;
using ull = unsigned long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using sl = set<ll>;
using vi = vect... | ALGO | 0.99995 | 3.511071 | {
"github_metadata": {
"branch": "main",
"commit_count": 473,
"repo_created_at": "2024-09-07T23:49: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": "5241bfe038... |
987b7300-db48-4656-86bf-c8e77f680175 | RootMyself/data-structure-study | My_Project/Graph/Graph/GraphMatrix.cpp | #include "pch.h"
#include "GraphMatrix.h"
GraphMatrix::GraphMatrix()
{
}
GraphMatrix::~GraphMatrix()
{
ResetVisited();
}
void GraphMatrix::Initialize()
{
m_Size = 0;
for (int i = 0; i < MAX_VTXS; ++i)
{
for (int j = 0; j < MAX_VTXS; ++j)
{
m_Adj[i][j] = 0;
}
m_Visited[i] = 0;
}
}
void GraphMatrix::I... | ALGO | 0.990935 | 3.663364 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2018-10-09T14:57: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": "384704d78... |
be2447ab-f6e5-4fd6-b170-a3c215d28413 | lclpsoz/competitive-programming | CF/1159/E_1.cpp | #include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#de... | ALGO | 0.999873 | 3.696541 | {
"github_metadata": {
"branch": "master",
"commit_count": 274,
"repo_created_at": "2020-07-09T09:09:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d638f783... |
07de7928-6953-45fa-9479-328cbaef39c7 | boyima/Leetcode | lc100-2.cpp | //非递归
class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
if(p == NULL || q == NULL){
if(p == NULL && q == NULL) return true;
return false;
}
stack<TreeNode*> st1;
stack<TreeNode*> st2;
st1.push(p);
st2.push(q);
while(!... | ALGO | 0.99999 | 5.701802 | {
"github_metadata": {
"branch": "master",
"commit_count": 458,
"repo_created_at": "2015-12-07T08:29:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ec0b0df3... |
c1a8b3cf-95b8-4c6a-9ce7-5ec75605abf9 | hosua/leetcode-solutions | c++/smallest_equiv_string.cc | #include <bits/stdc++.h>
using namespace std;
#define ALPHA 26
class Union {
private:
vector<int> rep;
public:
Union(){
rep.resize(ALPHA);
for (int i = 0; i < ALPHA; i++) // set each element to its index to indicate a root
rep[i] = i;
}
int find(int x){
if (rep[x] == x) // found the root
return x;... | ALGO | 0.999987 | 5.266048 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2022-11-08T07:17:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8fb2bfd9fdb... |
033416bd-4069-4aa2-b6ae-e9804761270e | jake3991/sonar-SLAM | bruce_slam/src/bruce_slam/cpp/cfar.cpp | #include <pybind11/eigen.h>
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
#include <Eigen/Dense>
#include <algorithm>
typedef Eigen::MatrixXf MatrixXf;
typedef Eigen::Matrix<uint8_t, Eigen::Dynamic, Eigen::Dynamic> MatrixXb;
MatrixXb ca(const MatrixXf &img, int train_hs, int guard_hs, double tau)
{
Mat... | ALGO | 0.932368 | 7.058252 | {
"github_metadata": {
"branch": "main",
"commit_count": 76,
"repo_created_at": "2022-03-30T17:55:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 240,
"forks": 31,
"issues": 9,
"pull_requests": 0
},
"file_meta": {
"content_id": "35f271e3... |
9b74b91b-8259-42c3-8689-24781b0d6459 | azkung/Chess_CS247 | level3Bot.cc | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "board.h"
#include "level3Bot.h"
#include "move.h"
using namespace std;
Level3Bot::Level3Bot(char color) : Bot(color) {}
Move Level3Bot::getMove(Board *b... | ALGO | 0.975066 | 3.961983 | {
"github_metadata": {
"branch": "main",
"commit_count": 54,
"repo_created_at": "2022-07-16T00:20:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "438b8f077a7... |
3c81304e-24fc-4ede-89a9-b37de862396a | golborneville/BOJAlgorithm | BOJAlgorithm/16236아기상어.cpp | #include<iostream>
#include<vector>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
int N;
int sea[23][23];
int chk[23][23];
int dx[4] = { -1,0,0,1 };
int dy[4] = { 0,-1,1,0 };
struct fish {
int size;
int x;
int y;
int dis;
};
struct shark {
int size;
int x;
int y;
int eaten;
};
boo... | ALGO | 0.999554 | 3.581702 | {
"github_metadata": {
"branch": "master",
"commit_count": 160,
"repo_created_at": "2020-03-19T13:43:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f2f030e7... |
698ce969-5a11-44f0-896e-2cdfe1d7945f | dhankb/practice | cpp/0063_Unique_Paths_II.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;
class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
if ... | ALGO | 0.999922 | 5.388535 | {
"github_metadata": {
"branch": "master",
"commit_count": 406,
"repo_created_at": "2019-06-10T06:43:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee1129a9... |
06ce362e-d4d7-4ec4-8d8a-7c68699f9f37 | ucinae/algorithm | ps/programmers/자물쇠와 열쇠.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
bool check(vector<vector<int>> b, int size) {
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
if (b[size + i][size + j] == 0 || b[size + i][size + j] > 1)
return false;
return true;
}
bool solution(vector<vector<in... | ALGO | 0.999911 | 4.952932 | {
"github_metadata": {
"branch": "master",
"commit_count": 138,
"repo_created_at": "2019-04-05T07:17: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": "45a798a8... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.