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 |
|---|---|---|---|---|---|---|---|
faca3ff1-4103-4800-9f50-63b03f30743f | ishandutta2007/codeforces-s | ssrs_/normal/1422/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
long long sx, sy, fx, fy;
cin >> sx >> sy >> fx >> fy;
vector<long long> x(m), y(m);
for (int i = 0; i < m; i++){
cin >> x[i] >> y[i];
}
x.push_back(sx);
y.push_back(sy);
m++;
vector<pair<long long, int>> X(m);
... | ALGO | 0.99994 | 3.321038 | {
"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": "c625516b290f... |
88a1aa93-4139-414f-a5f6-b44dc68ccb71 | Alucat1986/AdventOfCode2024 | Day06/src/main.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
struct Guard {
size_t PosX = 0;
size_t PosY = 0;
int Direction = 0; // 0 = up, 1 = right, 2 = down, 3 = left
void changeDirection();
void move();
bool operator==(const Guard& other) const;
};
bool readFile(const std... | ALGO | 0.999797 | 5.27109 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2024-11-30T20:50: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": "37723ad8f... |
9efd8604-c0d1-4df9-9270-ca1613aa2cb1 | ishandutta2007/codeforces-r | rubikun/normal/1083/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | ALGO | 0.999871 | 3.68929 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:58: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": "064b5cddf406... |
554bfdbd-c080-4ff8-8809-9f890bc1d579 | ffbh123456/code | ural/ural/code/1934.cpp | #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <functional>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
#define Exp (1e-8)
struct Node{
int to;
double p;
Node(int a, double b){
to = a;
p = b;
}
};
int N,... | ALGO | 0.999938 | 3.577799 | {
"github_metadata": {
"branch": "master",
"commit_count": 186,
"repo_created_at": "2018-02-04T01:42: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": "90cdb029... |
a1a73aa4-9be8-4d80-ab57-7ce6944cbe9b | twbf/cs-class | alpha-sort/sort.cpp | /* <NAME> Alpha Sort
This sorts words using the strcmp function with the algoritheam being selection
sort because I think that its the easiest to program. The size variable up top
determines how many words you cin. It is actualy a vary simple if you know about
strcmp.
*/
#include <iostream>
#include <string.h>
#i... | ALGO | 0.999935 | 4.589237 | {
"github_metadata": {
"branch": "master",
"commit_count": 187,
"repo_created_at": "2016-09-06T04:06:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "173217c7... |
7d5c1531-14ea-4e16-b2ea-aa34c717f2ad | Mohamed-7018/HackerRank-Solutions | problem solving/algorithms/Implementation/Cavity Map.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define all(a) a.begin(),a.end()
ll dx[] = {+0, +0, -1, +1, +1, +1, -1, -1};
ll dy[] = {-1, +1, +0, +0, +1, -1, +1, -1};
void _Depressed() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
// #ifndef ONLINE_J... | ALGO | 0.999991 | 4.059173 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2021-11-27T00:38:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5c9dfaefff8... |
7e4cd9c0-8ba5-4a9b-a796-bfd71e1aac04 | natesmith83/WSU_GoBabyGo_Programming | FrozenCarCode_noMD_AnalogJoystick_10kPotSteeringFeedback/FrozenCarCode_noMD_AnalogJoystick_10kPotSteeringFeedback.ino | //<NAME>, April 2016, GoBabyGo code
//Using a joystick to control drivemotor (Forward/Reverse)
//Using a DC motor with a custom built steering linkage and a 10K OHM potentiometer (for feedback)
//to control the steering
//*For Public Use*
const int pwm1 = 3 ; //initializing pin 3 as pwm (ENA) steering motor
c... | ALGO | 0.954254 | 4.737142 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2018-10-07T21:34:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "47fa71411... |
32ec120d-906d-4014-bd6e-44af5aa752b6 | alexandraback/datacollection | solutions_5744014401732608_0/C++/pudae/run.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
void solve(int64_t b, int64_t m)
{
// from 0
{
cout << 0; // 0 to 0
for (int64_t i = 2; i < b; ++i)
{
auto x = b - i - 1;
if (m & (0x01 << (b -... | ALGO | 0.999808 | 4.311654 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "46483662e... |
9c153ad0-0597-440e-8694-6882de61dc8f | subnr01/subs-practice | leet_code/graphs/medium/NumConnectedComponents.cpp | /*
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to
find the number of connected components in an undirected graph.
Example 1:
0 3
| |
1 --- 2 4
Given n = 5 and edges = [[0, 1], [1, 2], [3, 4]], return 2.
Examp... | ALGO | 0.999977 | 6.281256 | {
"github_metadata": {
"branch": "master",
"commit_count": 2551,
"repo_created_at": "2015-12-13T13:29: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": "f71c220... |
8f4cbbd3-ad67-4395-8a8b-661b2d737b3a | Kanekicn/WayofOffer | 7_贪心/Leetcode_322_CoinChange.cpp | //
// Created by <NAME> on 2020/10/1.
//
#include <vector>
#include <algorithm>
#include <climits>
class Solution {
public:
int coinChange(std::vector<int>& coins, int amount) {
if (amount == 0) return 0;
std::sort(coins.rbegin(), coins.rend());
int ans = INT_MAX;
dfsHelper(coin... | ALGO | 0.999971 | 5.327249 | {
"github_metadata": {
"branch": "master",
"commit_count": 105,
"repo_created_at": "2020-07-01T13:07: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": "24d12ce4... |
1ffae793-8509-4ecb-9678-65ba4788df41 | McIllyaz/Pointer | pointer.cpp | #include <iostream>
#include <cstring>
using namespace std;
int banyak;
int counter(char *str) {
int count = 0;
bool kataBaru = true;
while (*str) {
if (*str == ' ' || *str == '\t' || *str == '\n') {
kataBaru = true;
}
else if (kataBaru) {
count++;
... | ALGO | 0.995698 | 3.626433 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-05-19T11:32: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": "75756ee6106e... |
a0e94c54-7cbf-4395-b6b8-a975df1fab98 | tempbottle/upp | uppdev/Queue/Patrik.cpp | // Solution to our pre-interview test.
#include <stdlib.h>
#include <stdio.h>
// Macros I can't do without anymore.
#define hope(x) while ( ! (x) ) { onIllegalOperation() ; }
#define require(x) typedef char require[ (x) ? 1 : -1 ] ;
// Error handlers.
#define onOutOfMemory() do{ fprintf( stderr, "Out ... | TEST | 0.925121 | 4.912834 | {
"github_metadata": {
"branch": "trunk",
"commit_count": 7787,
"repo_created_at": "2015-08-21T19:05:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1aabfc7b... |
81cd6c69-eb8e-4642-826b-18a12fb0a4a7 | sujal-0611/DSA-Solutions | LEC_24_maths/fast_exponentiation.cpp | //basically calculate a^b using fast exponentiation
//CodeStudio:MOdular Exponentiation- to calculate exponents faster (and to accomodate numbers under the range )
#include<iostream>
using namespace std;
//Brute force- solving in O(n)
void mod_expo1(int x,int n,int m)
{
//bruteforce- solving in O(n)
//long long r... | ALGO | 0.999986 | 4.833138 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-09-16T22:02: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": "971870baa51d... |
edd5432d-a398-4320-b785-6d764f496a3e | 984727216/oj1 | HDU/1754/11090915_AC_1076ms_8820kB.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 200005;
int n, m;
struct node{
int l, r;
int MAX_VALUE;
int mid(){
return (l + r) >> 1;
}
};
node tree[maxn * 4];
int value[maxn];
void init(int root, int l, int r){
tree[r... | ALGO | 0.999891 | 3.579656 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2018-04-07T13:21: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": "08564a341... |
a1bc8dec-a682-4b62-b717-215506264200 | Choe-Ji-Hwan/FlightReservation | flight_Reservation/ListDbl.cpp | /*
| this is .cpp file of doubly linked and sorted list header
| doubly linked list (by cursor) ADT
| - insert() + ((sorted)insertItem() + (sorted)deleteItem())
| = doubly linked and sorted list (by cursor) ADT
| 2017112104 최지환
*/
#include "Listdbl.h"
#include <iostream>
// Constructor
template < class DT>
ListNode<DT... | TOOL | 0.949665 | 5.444622 | {
"github_metadata": {
"branch": "main1",
"commit_count": 5,
"repo_created_at": "2021-03-02T12: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": "9eb29419447... |
0f0b3533-fe70-4771-9373-522c9f2d3274 | Hexxy-Dev/Old_Code | Console_Games/Conway's Game Of Life/src/main.cpp | #include <iostream>
#include <string>
#define clear() puts("\033[H\033[J")
#define gotoxy(x,y) printf("\033[%d;%dH", (y), (x))
#include <unistd.h>
void sleep_ms(size_t milliseconds)
{
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = (milliseconds % 1000) * 1000000;
nanosleep(&ts, NULL);
... | ALGO | 0.993488 | 4.735364 | {
"github_metadata": {
"branch": "main",
"commit_count": 95,
"repo_created_at": "2024-02-11T12:48: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": "ae1135f1693... |
f3da9122-9bd0-4b31-b400-ea3170ed5c3d | akshin-kuvshin/smth | Университет/Лабы/2024-2025/Семестр 1/Лаб4(матрицы)/stat.cpp | // Задача: дана прямоугольная матрица. Переставляя её строки и столбцы, переместить наибольший элемент матрицы в верхний левый угол.
// ВАРИАНТ СТАТИЧЕСКОЙ МАТРИЦЫ (без визуализации, более оптимизированный в плане алгоритма)
#include <cstdio>
#include <cstdlib>
#include <ctime>
#define _RAND_MIN -100
#defi... | ALGO | 0.999786 | 4.334881 | {
"github_metadata": {
"branch": "main",
"commit_count": 106,
"repo_created_at": "2024-10-10T09:36:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb768b84ed... |
1d3327a2-3816-40d9-a2dc-5e9df7a7fe79 | Pandey-SaurabhP/CP | Codeforces/1853+CC.cpp | #include <bits/stdc++.h>
using namespace std;
#define read(a, n) for(ll i = 0; i < n; ++i) cin >> a[i];
#define print(a, n) for(ll i = 0; i < n; ++i) if(i == n - 1){ cout << a[i] << endl; } else { cout << a[i] << ' '; }
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9 + 7;
const ll mxn = 1e6 + 5... | ALGO | 0.99995 | 4.059658 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2023-04-13T08:49:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9ac575c226... |
398b7690-60d8-4c5c-a624-ebdff5b3d1e6 | terminalpp/terminalpp | helpers/helpers.h | #pragma once
#ifdef HELPERS_NAMESPACE
#define HELPERS_NAMESPACE_DECL :: HELPERS_NAMESPACE
#define HELPERS_NAMESPACE_BEGIN namespace HELPERS_NAMESPACE {
#define HELPERS_NAMESPACE_END }
#else
#define HELPERS_NAMESPACE_DECL
#define HELPERS_NAMESPACE_BEGIN
#define HELPERS_NAMESPACE_END
#endif
#include <string>
#include <... | TOOL | 0.959869 | 5.583376 | {
"github_metadata": {
"branch": "master",
"commit_count": 1154,
"repo_created_at": "2019-10-29T21:05:37.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 55,
"forks": 4,
"issues": 11,
"pull_requests": 0
},
"file_meta": {
"content_id": "ceaee4... |
29377e35-6f92-4e58-8a88-61f7e1f653e3 | supakornPanya/CompetitiveProgramming | leetcode/0015ThreeSum_P.cpp | #include <bits/stdc++.h>
using namespace std;
//very slow -> O(logN + n + n^2)
//sort O(logN) -> loop map value O(n) -> loop 2 index check sum with map value O(n^2)
// class ijx {
// public:
// int i;
// int j;
// int x;
// ijx(int i, int j, int x) : i(i), j(j), x(x) {}
// bool operator<(const ijx&... | ALGO | 0.999964 | 5.430806 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-12-04T09:13: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": "0a259ffb1843... |
0906cc5e-0490-42a4-9029-3c7e61f4336f | FeTS-AI/Front-End | src/applications/Preprocessing/greedy/src/bk/greedy_main.cxx | #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include "lddmm_common.h"
#include "lddmm_data.h"
#include <itkImageFileReader.h>
#include <itkGaussianInterpolateImageFunction.h>
#include <itkResampleImageFilter.h>
#include <itkIdentityTransform.h>
#include <itkShrinkIma... | ALGO | 0.999305 | 5.783091 | {
"github_metadata": {
"branch": "master",
"commit_count": 744,
"repo_created_at": "2020-08-19T19:35:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 89,
"forks": 15,
"issues": 3,
"pull_requests": 2
},
"file_meta": {
"content_id": "d24b117... |
e83b0533-17e0-4ffb-84bf-2b30a030f94a | adilahmad17/Obfuscuro | libs/linux-sgx/sdk/tlibcrypto/sgx_ecc512.cpp | /*
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this li... | ALGO | 0.999529 | 6.738808 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-03-23T23:05:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 20,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c94e0299... |
a248132e-392c-49f9-90f0-43a3843a6822 | ROCm/omnitrace | source/bin/omnitrace-causal/impl.cpp | // MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
//
// 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 limitati... | TOOL | 0.940442 | 6.748024 | {
"github_metadata": {
"branch": "amd-staging",
"commit_count": 347,
"repo_created_at": "2022-02-24T05:44:58.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 320,
"forks": 28,
"issues": 13,
"pull_requests": 11
},
"file_meta": {
"content_id": ... |
5e56845b-4fa6-4e0d-87a4-e7809f0e597c | skyelves/LeetCode | 2261_countDistinct.h | //
// Created by 王柯 on 7/25/22.
//
#ifndef LEETCODE_2261_COUNTDISTINCT_H
#define LEETCODE_2261_COUNTDISTINCT_H
#include "solution.h"
class CountDistinct : public solution {
public:
bool divisible[200] = {0};
int countDistinct(vector<int> &nums, int k, int p) {
int res = 0;
int len = nums.siz... | ALGO | 0.998776 | 6.229908 | {
"github_metadata": {
"branch": "main",
"commit_count": 415,
"repo_created_at": "2022-07-20T02:19:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0c5053b4fd... |
5fcdf78e-dd11-434a-a058-d791730f6a23 | gradientpm/gvpm | src/integrators/photonmapper/beams_accel.h | #if !defined(__BEAMS_ACCEL_H)
#define __BEAMS_ACCEL_H
#include <mitsuba/render/photonmap.h>
#include <mitsuba/core/kdtree.h> // For subBeams kdTree
#include "beams_struct.h"
MTS_NAMESPACE_BEGIN
struct PhotonSubBeamData {
const PhotonBeam *beam;
Float t1, t2; // Start point for the beam
};
struct PhotonSubBeam :... | TOOL | 0.915243 | 6.247274 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2018-07-31T05:32:28.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 41,
"forks": 7,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "66a6a56da0... |
de5e5f53-3a73-489f-b9b3-dd0c1b3d6ec0 | syadav481/leetcode | 725.cpp | #include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr... | ALGO | 0.999846 | 5.71339 | {
"github_metadata": {
"branch": "main",
"commit_count": 83,
"repo_created_at": "2023-10-26T03:39:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c956a1ff0f... |
5752e0ae-ddbb-4343-8ddb-34e8d8f98e8e | crashRT/procon | ABC309/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<string> A;
for (int i = 0; i < N; i++)
{
string tmp;
cin >> tmp;
A.push_back(tmp);
}
vector<string> B(N);
for (int i = 0; i < N; i++)
{
B.at(i) = A.at(i);
for (i... | ALGO | 0.999999 | 4.173199 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2023-07-01T12:00: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": "2dc422d869d... |
1040ba95-2335-4ea5-9489-760e3fc85569 | LasseD/uva | P10363.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int count(string &s1, string &s2, string &s3, char color) {
int ret = 0;
for(int i = 0; i < 3; ++i) {
if(s1[i] == color) ++ret;
if(s2[i] == color) ++ret;
if(s3[i] == color) ++ret;
}
cerr << "Count " << color << ": " << ret << endl;
retur... | ALGO | 0.999987 | 4.919495 | {
"github_metadata": {
"branch": "master",
"commit_count": 886,
"repo_created_at": "2014-03-13T11:01:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3936c7fa... |
dbecd18b-2751-4338-a233-cdfdefa84ae9 | danftang/AgentBasedMCMC | src/agents/PredPreyAgent.h | //
// Created by daniel on 18/05/2021.
//
#ifndef GLPKTEST_PREDPREYAGENT_H
#define GLPKTEST_PREDPREYAGENT_H
#include <vector>
#include <map>
#include "../ModelState.h"
#include "../Constraint.h"
class PredPreyAgentBase {
public:
typedef int Act;
enum ActNames {
DIE,
MOVELEFT,
MOVERIG... | ALGO | 0.998799 | 6.835314 | {
"github_metadata": {
"branch": "master",
"commit_count": 266,
"repo_created_at": "2020-03-15T16:24:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "823e5494... |
bc0befa9-6074-44ca-862a-6b3d6f4539a9 | ShichengChen/Online-Judge-Code | Graph theory/DFS (Depth First Search)/hdu 5424 Rikka with Graph II.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
#include<iterator>
using namespace std ;
typedef pair<int,int>pii;
#define MAXN 1005
int first[MAXN],d[MAXN],e,n,point,root = 1;
struct Edge
{
int v,next;
}edge[MAXN << 1];
bool vis[MAXN];
void insert(int u,int v)
{
edge[e].... | ALGO | 0.999863 | 4.010969 | {
"github_metadata": {
"branch": "master",
"commit_count": 145,
"repo_created_at": "2017-06-16T13:34:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11eaae6d... |
4bcc5814-39ee-4e84-ae7b-099d9b6fa920 | alexandraback/datacollection | solutions_5709773144064000_0/C++/waterghost/cookie.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
double cookie(vector<double>, int);
double farmcost(double c, double f, int n);
int main()
{
ifstream fin("B-small-attempt0.in");
ofstream fout("res.txt");
if(!fin.is_open() || !fout.is_open())
{
... | ALGO | 0.998792 | 3.531331 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29f6c1f71... |
0c4ee05e-6c35-4d53-a130-da71b753afc1 | berry8192/Atc | ahc040/A.cc | #include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep3(i, n, m) for (int i = m; i < (int)(n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define SP << " "
#define ll long long
using namespace std;
// using na... | ALGO | 0.999904 | 4.790234 | {
"github_metadata": {
"branch": "master",
"commit_count": 1462,
"repo_created_at": "2019-05-14T16:53:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "4d8fb17... |
106f45d3-6fb9-4654-8c2c-fb9257cae7dd | maharshi0706/LeetCode | Longest Prefix/longestPrefix.cpp | // loop through each word -> add letter in string if match ?
// compare first and second word -> store common prefix -> check prefix in rest words -> remove if not present -> return
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
string longestCommonPrefix(vector<strin... | ALGO | 0.999674 | 5.036752 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2024-04-23T18:07: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": "7e5cc31609b... |
5f9a3f09-b541-4051-ad39-6d160e3b4217 | PrathameshJadhav30/Top-100-Codes | Top 100 Codes/03-Codes for Recursion/12-Last non-zero digit in factorial/Lastnonzerodigitinfactorial.cpp | #include <iostream>
using namespace std;
// Function to find the last non-zero digit of factorial
int lastNonZeroDigit(int n) {
int result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
// Remove trailing zeros by dividing by 10
while (result % 10 == 0) {
result /= 1... | ALGO | 0.999819 | 6.376031 | {
"github_metadata": {
"branch": "main",
"commit_count": 217,
"repo_created_at": "2024-08-12T16:16: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": "8e785c3825... |
17c85b5f-1019-4f1c-ba12-01d45986b131 | rohitramteke1/consistency | 2.BIT Manipulation/5countAllSetBitsOfNaturalNum.cpp | #include <bits/stdc++.h>
using namespace std;
int power(int x, int n) {
long long int res = 1;
while(n) {
if(n & 1)
res *= x;
x *= x;
n = n >> 1;
}
return res;
}
// there is pattern for this, just crack that pattern,
// & you'll get the answer
int countOfAllSetBi... | ALGO | 0.999923 | 4.95598 | {
"github_metadata": {
"branch": "main",
"commit_count": 82,
"repo_created_at": "2022-10-23T20:05:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a44b0ac435... |
2bdb10b2-4c6a-4eff-b21c-a34fafc3136e | 0123krishnayadav/CSES-Problem | sas/cses-22.cpp | #include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <sstream>
#include <unistd.h>
#include <ext/pb_ds... | ALGO | 0.999976 | 4.010647 | {
"github_metadata": {
"branch": "master",
"commit_count": 115,
"repo_created_at": "2020-05-31T09:36:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ff3f803... |
6d23a598-fc62-41c0-8ed8-4dfd00249d6e | ympark99/Algorithm | 20437.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int T; cin >> T;
while(T--){
string str;
int K;
cin >> str;
cin >> K;
vector<int> alpha(26);
for(int i = 0; i < str.length(); i++)
... | ALGO | 0.999786 | 4.507655 | {
"github_metadata": {
"branch": "main",
"commit_count": 538,
"repo_created_at": "2020-12-22T10:49:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ac81f17d9... |
ef47a56a-e99d-4400-8594-5c0949250a16 | 9ankitha/CSA0420_OS | SJF.cpp | #include <stdio.h>
#define MAX 20
typedef struct {
int pid;
int burst_time;
int waiting_time;
int turnaround_time;
} Process;
void sort_by_burst_time(Process p[], int n) {
int i, j;
Process temp;
for (i = 0; i < n-1; i++) {
for (j = i+1; j < n; j++) {
if (p[i].burst_ti... | ALGO | 0.999983 | 5.020908 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2024-06-10T05:06: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": "585cb95f289... |
6cd97b1f-6da2-44af-98f1-76bf76d569eb | SrCiruelo/Cpp--Data-Structures-and-Algorithms | Count_Sort/main.cpp | #include <iostream>
void print_arr(int* arr,std::size_t arr_size){
for(int i{0};i<arr_size;++i){
std::cout<<arr[i]<< " ";
}
std::cout<<std::endl;
}
void count_sort(int* arr,std::size_t arr_size){
if(arr_size == 0)return;
int* end = arr + arr_size;
//find the largest element
int smallest = sizeof(int)... | ALGO | 0.999649 | 5.158148 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2019-10-01T16: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": "ac9dc73b1... |
c3a55fbd-0e02-4650-b68a-3ec8188091cf | Alipashaimani/Competitive-programming | ACMSGURU/195.cpp |
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define L first
#define R second
#define smax(x, y) (x) = max((x), (y))
const int maxn = 5e5 + 85 - 69;
vector<int> adj[maxn];
int dp[maxn], pd[maxn], pdman[maxn];
int n;
vector<int> ans;
void dfs(int v){
for(int i = 0; i < ad... | ALGO | 0.999974 | 3.721666 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-02-19T02:03: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": "7be3605931... |
0fc3dde8-984b-40d3-b9ae-7e9d37606ccc | dinox0r/comp-prog | aoc/2021/18.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> parse_number(const string& n) {
vector<string> r;
string d = "";
for (char c : n) {
if (isdigit(c))
d += c;
else {
if (d != "") {
r.push_back(d);
d = "";
}
if (c != ',')
r.push_back(string(1, c));... | ALGO | 0.999347 | 4.874235 | {
"github_metadata": {
"branch": "master",
"commit_count": 167,
"repo_created_at": "2017-10-09T20:57:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4c2c251... |
ceff18fe-a85c-4a14-a603-69fb47141e80 | DimitrijeDobrota/leetcode | Problems/1080.cpp | class Solution {
public:
TreeNode *sufficientSubset(TreeNode *root, int limit) const {
stack<pair<TreeNode *, int>> st;
unordered_set<TreeNode *> deleted;
st.emplace(root, root->val);
while (!st.empty()) {
if (st.top().first) {
auto [root, sum] = st.top... | ALGO | 0.999861 | 6.250258 | {
"github_metadata": {
"branch": "master",
"commit_count": 851,
"repo_created_at": "2022-12-05T18:50:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ef4c80f5... |
61339534-5491-445f-8ccd-ac7f40d958d2 | caomw/3DFeatureMatcher | mosaic.h | /**
* \file mosaic.h
* \Author: <NAME>
* \brief: This class work as a descriptor extractor but compute the keypoints
* detection using the triangulator objects that I developed in the
* Triangulator folder
*
* Copyright (c) 2012, <NAME> (<EMAIL>)
* All rights reserved.
*
* Redistribution an... | ALGO | 0.928921 | 5.876731 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2016-06-30T13:43: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": "712d0e11a... |
9fdc7dcc-f25c-4f75-8686-49195bb576d2 | PallaviCodeVoyage/DSA | DP/LONGEST STRING CHAIN.cpp | //T.C : O(n*n*n)
class Solution {
public:
int n;
int t[1001][1001];
bool predecessor(string& prev, string& curr) {
int M = prev.length();
int N = curr.length();
if(M >= N || N-M != 1)
return false;
int i = 0, j = 0;
while(i < M && j ... | ALGO | 0.999994 | 6.087914 | {
"github_metadata": {
"branch": "main",
"commit_count": 164,
"repo_created_at": "2024-07-11T07:26:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b7094b1411... |
4eb72883-2aad-443c-929d-0922e2914366 | Yawn-Sean/Daily_CF_Problems | daily_problems/2025/01/0102/personal_submission/cf581d_Bonelight.cpp | /*
Bonelight (=v=)
20241211: New Light
== Under Fire ==
#pragma GCC optimize(2)
*/
#include <bits/stdc++.h>
using namespace std;
#define i64 long long
#define int long long
#define endl '\n'
#define pii pair<int,int>
#define tiii tuple<int,int,int>
#define INF 2e18
#define VC vector<int>
#define MAT... | ALGO | 0.999264 | 4.636999 | {
"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": "ae10... |
aa5e6e7d-a777-4b02-82f1-7fab8786008a | mattagar6/crypto | generate_keys.cpp | #include <random>
#include <chrono>
#include "helpers.H"
std::mt19937 rng;
std::vector<std::int64_t> read_secret_phrase() {
std::string buf;
std::vector<std::int64_t> in;
while( std::cin >> buf ) {
std::transform( buf.begin(), buf.end(), std::back_inserter( in ),
[]( char c ) -> std::int64_t {
assert( ... | ALGO | 0.999433 | 4.539855 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-06-23T14:11: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": "8af79a85ce3a... |
700c8e12-29e5-4e99-b1d8-836b378ade1a | codewhippet/AdventOfCodeWhippet-Public | AoC2016/Puzzle11.cpp | #include "stdafx.h"
using namespace std;
static string dummy =
R"()";
namespace Puzzle11_2016_Types
{
enum : size_t
{
Generator = 0,
Microchip = 1
};
struct Puzzle
{
NameDictionary Elements;
vector<char> State;
int64_t TargetFloor;
};
}
using namespace Puzzle11_2016_Types;
static Puzzle ReadPuzzl... | ALGO | 0.994645 | 5.115262 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2025-05-21T21:01: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": "0d82fe40b3c3... |
28931445-dec6-4893-a6cc-b704c97a6f44 | KelseyKwon/backjoon-programmers | 백준/Silver/2178. 미로 탐색/미로 탐색.cc | #include <bits/stdc++.h>
using namespace std;
int N, M;
vector<vector<int>> graph;
vector<vector<bool>> visited;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
bool inRange(int y, int x) {
return (y >= 1 && y <= N && x >= 1 && x <= M);
}
int bfs(int y, int x) {
// 안 방문했고, 범위 안에 있고, 1이면.
// priori... | ALGO | 0.999965 | 4.143597 | {
"github_metadata": {
"branch": "main",
"commit_count": 180,
"repo_created_at": "2025-05-13T13:38: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": "efffdd3328... |
3f206fbd-954b-4ed9-ab7a-91a473aefabc | DkshLuvsDucks/DSA-Practice | 06_BitManipulation/1_bitwiseOperators.cpp | #include<iostream>
using namespace std;
int main(){
cout << "& operations-\n";
cout << "0 & 1 = " << (0 & 1) << endl;
cout << "1 & 1 = " << (1 & 1) << endl;
/*
3 = 0011
5 = 0101
--------
0001
--------
*/
cout << "3 & 5 = " << (3 & 5) << endl;
cout << "\n| operation... | ALGO | 0.928029 | 4.53046 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-07-09T08:03: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": "c8bbfe4f9588... |
0ac5865f-079e-4e42-8fd3-8dd9ee93bb46 | Saitejagorli/dynamic-programming | obstacle-grid.cpp | /*brut force approac*/
#include<iostream>
#include<vector>
using namespace std;
int solve(int i,int j,int r,int c,vector<vector<int>>grid){
if(i==r || j==c)
return 0; //if the range out of bounds
if(grid[i][j]==1)
return 0; //if there is an obstacle
if(i==r-1 && j==c-1)
return 1; //... | ALGO | 0.999957 | 5.148081 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2022-11-12T05:38: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": "8c0f66d540a... |
7ae5f1a3-f576-4314-a37b-1880aa9b0106 | Saki-Zhang/LeetCode | addTwoNumbers2.cpp | // 445. Add Two Numbers II
// https://leetcode.com/problems/add-two-numbers-ii/
/**
* 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) : v... | ALGO | 0.999826 | 6.331858 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-02-13T14:53: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": "6448e89c6d... |
1e32b677-8c63-417e-b743-9b8f4f518fda | cdalitz/triplclust | src/cluster.cpp | //
// cluster.cpp
// Functions for triplet clustering and for propagating
// the triplet cluster labels to points
//
// Author: <NAME>, <NAME>, <NAME>
// Date: 2019-04-02
// License: see ../LICENSE
//
#include <algorithm>
#include <cmath>
#include <fstream>
#include "cluster.h"
#include "hclust/fastcluste... | ALGO | 0.998686 | 5.899639 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2022-09-19T13:52:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 4,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "5825cb88e2... |
b915c78f-8b50-4720-a5d5-3e4ab28bfc3b | iknoorjobs/atlas-test | program.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
class test{
private:
int** a;
int p;
public:
test(MatrixXf t);
test(int x);
void print();
friend void add(test &b,test &c);
friend void sub(test &b,test &c);
friend void div(test ... | ALGO | 0.991803 | 4.024581 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2018-02-26T18:07: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": "9a313be892... |
3b480240-b53c-4b77-8837-0e7efb0e385d | halcyonfreed/.leetcode | 36.有效的数独.cpp | /*
* @lc app=leetcode.cn id=36 lang=cpp
*
* [36] 有效的数独
*/
// @lc code=start
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
}
};
/*
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
// 使用哈希表记录每一行每个数字出现的次数
// 由于数字是从 1 - 9 ,因此可以采取数组的... | ALGO | 0.999493 | 6.445632 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2023-08-09T23:20: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": "9d83248f1e8... |
6701f3a8-88a7-4b0e-8f33-2e69dcf895a6 | TarunSinghania/C-lib | Graphs/Mincutmaxflow/notes.cpp | all examples tested on cf problem : https://codeforces.com/problemset/problem/546/E
quick revise : william fiset https://youtu.be/LdOnanfc5TM
for through revise : Tim Roughgarden Lectures on youtube, https://youtu.be/dorq_YA6plQ
todo: add edmund karp and dinic code
note :
methods to get max flow :
f... | ALGO | 0.949754 | 3.199047 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-12-21T16:46: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": "29045e140900... |
df35f744-1015-4a03-ac5f-0749769ae918 | rashmi0305/RISCV-Simulator---Innovators | main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<sstream>
#include "Processor.h"
int main() {
Processor sim;
Parser parser;
auto parsedProgram1 = parser.parseFromFile("code1.txt",sim.memory); // Parse th... | ALGO | 0.995689 | 3.944896 | {
"github_metadata": {
"branch": "main",
"commit_count": 109,
"repo_created_at": "2024-02-22T06:56:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "f74f59e68e... |
ced25859-b99b-4a73-8f33-fae8d6bf3a0f | wxnn08/RepLord | cf/gym/PacificNorth2017-18/y.cpp | /* O nosso maior medo não é sermos inadequados.
O nosso maior medo é sermos infinitamente poderosos.
É a nossa própria luz, não a nossa escuridão, que nos amedronta.
Sermos pequenos não engrandece o mundo.
Não há nada de transcendente em sermos pequenos,
pois assim os outros não se sentirão inseguros ao nosso lado.
Tod... | ALGO | 0.999837 | 4.213619 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2018-03-09T02:21:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e5d1c047... |
305c0878-46fc-4f2c-ac08-6b1a1e17e396 | rkalz/xbmc4xbox | xbmc/utils/StringUtils.h | /*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* 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; either version 2, or (at your option)
* any later version.
*
* ... | TOOL | 0.944223 | 6.052014 | {
"github_metadata": {
"branch": "master",
"commit_count": 1593,
"repo_created_at": "2018-04-13T04:09:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "135f44... |
4d74dae7-5a7f-4b70-b6d8-8f345433c11a | mtortora/chiralDFT | include/Legendre.hpp | #ifndef LEGENDRE_HPP_
#define LEGENDRE_HPP_
// ===================================================================
/**
* Legendre polynomials through a fast recursive iteration algorithm
* Adapted from <NAME>ell:
* https://github.com/jachappell/Legendre-polynomials/blob/master/legendre.h
*/
// ====================... | ALGO | 0.999825 | 6.07367 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2017-03-03T15:20:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "feaa18247... |
008388a6-0b4c-4871-9dff-73b826249f93 | RohitNunnaguppala/DSA_ROHIT | Leetcode/43.cpp | class Solution {
public:
string multiply(string num1, string num2) {
if (num1 == "0" || num2 == "0") {
return "0";
}
int n1 = num1.size();
int n2 = num2.size();
vector<int> result(n1 + n2, 0);
reverse(num1.begin(), num1.end());
reverse(num2.begin... | ALGO | 0.999994 | 6.128331 | {
"github_metadata": {
"branch": "main",
"commit_count": 323,
"repo_created_at": "2024-09-10T03:35: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": "40027f2200... |
6e06db7c-02f2-499e-9288-bed0b434d869 | AutumnKite/Codes | Luogu/3224 [HNOI2012]永无乡/线段树合并/std.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#define LL long long
#define For(i,a,b) for(int i=a;i... | ALGO | 0.999926 | 3.916426 | {
"github_metadata": {
"branch": "master",
"commit_count": 683,
"repo_created_at": "2019-08-18T00:53:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6c5be64d... |
871c94e0-8761-43cf-ade7-af66fb429149 | IlMioFrizzantinoAmabile/Competitive_Programming | Lesson 08/circular_RMQ.cpp | /* PROBLEM
* You are given circular array a0, a1, ..., an - 1. There are two types of operations with it:
* - inc(lf, rg, v) — this operation increases each element on the segment [lf, rg] (inclusively) by v;
* - rmq(lf, rg) — this operation returns minimal value on the segment [lf, rg] (inclusively).
* Assume segm... | ALGO | 0.999894 | 5.663479 | {
"github_metadata": {
"branch": "master",
"commit_count": 166,
"repo_created_at": "2018-11-13T17:32: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": "babdf8b8... |
572c320a-faab-4d30-a55a-29bd4f867751 | drowdemon/Universe | GenerateBoolTransCode/main.cpp | #include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
unsigned int amnt=0;
cin >> amnt;
ofstream outf("outputCode");
outf << "make_tuple(";
for(unsigned int i=0; i<amnt-1; i++)
outf << "(wantedData[" << i << "] ? get<" << i << ">(data) : NULL),";... | ALGO | 0.977353 | 3.054394 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2013-08-08T21:42:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "a6c93f566... |
2b5a51fd-dffe-43c0-83d0-2a7b4e5d2248 | anoldfriend0718/openfoam | applications/solvers/cokeCombustionFoam/considerKnudsenDiffusion/updateDeff.H | {
const scalar MO2=composition.Wi(O2Index);
const scalar MCO2=composition.Wi(CO2Index);
const scalar MN2=composition.Wi(N2Index);
const volScalarField& T=thermo.T();
forAll(p,i)
{
scalar Ti=T[i];
scalar pi=p[i]/atmpressure; //atm
scalar TstartiO2N2=Ti/epsO2N2Kb;
... | ALGO | 0.999902 | 5.186788 | {
"github_metadata": {
"branch": "master",
"commit_count": 228,
"repo_created_at": "2020-08-31T02:42: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": "8393f47c... |
ebcebe2d-6939-49e1-bf6e-4305656e6724 | SouravSaha18/codeforces | D. Grid-00100.cpp | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define ll long long int
#define db double
#define ch char
#define st string
#define lp1(i,a,n) for(i=a;i<n;i++)
#def... | ALGO | 0.999923 | 3.122324 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-11-27T18:30: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": "70dc8e5cd51... |
7aaaaecd-5bb3-4bd9-b65b-58b71d9c663b | Saicharan-2004/GFG_general_pratice | Medium/Zero Sum Subarrays/zero-sum-subarrays.cpp | //{ Driver Code Starts
//Initial function template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
//Function to count subarrays with sum equal to 0.
long long int findSubarray(vector<long long int> &arr, int n )
{
... | ALGO | 0.999789 | 5.404253 | {
"github_metadata": {
"branch": "main",
"commit_count": 137,
"repo_created_at": "2023-07-11T18:39: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": "35f503c375... |
ca2aec80-315d-4159-8909-252cd247081e | enderquestral/Reed-CS221-Cplusplus | TSPHomework4/tsp.cc | /*
* Main file for Traveling-Salesperson solver.
* Read a cities file in TSV format into a Cities object, then run
* of several solver algorithms on it and output the best result.
*/
#include "cities.hh"
#include "tournament_deme.hh"
#include <atomic>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#i... | ALGO | 0.99999 | 6.756773 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2018-10-02T02:22:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4fdb463e6... |
994c33f5-7730-4c82-aaf7-8064dad6b6c9 | Harlinn/Harlinn.Windows | 3rdParty/Harlinn.geos/src/noding/snapround/HotPixelIndex.cpp | /**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 <NAME> <<EMAIL>>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Licence as published
* by t... | ALGO | 0.955504 | 6.439168 | {
"github_metadata": {
"branch": "master",
"commit_count": 553,
"repo_created_at": "2023-04-05T20:58:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 30,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "655557c... |
dd0688b9-8e07-4066-9c87-7f85f97630b1 | Aledo-Jun/BOJ | MyAnswers/7469.cpp | //
// Created by june0 on 2024-01-09.
// Using merge-sort tree and binary search
//
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using lll [[maybe_unused]] =... | ALGO | 0.999995 | 6.125474 | {
"github_metadata": {
"branch": "main",
"commit_count": 467,
"repo_created_at": "2024-01-01T10:03: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": "8f464b1791... |
9a22d682-32a0-4556-8bf3-8b28921a98e9 | ldslds449/LeetCode | 73/main.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int M = matrix.size(), N = matrix.front().size();
bool f1 = false, f2 = false;
for(int i = 0; i < N; ++i) f1 |= matrix[0][i] == 0;
for(int i = 0; i < M; ++i) f2 |= matrix[i][0] == 0;
for(int i = 1; i < M; ++i){
for(int j ... | ALGO | 0.999498 | 6.423308 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2022-11-25T17:32:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd621e4812... |
ce22e982-88ef-44ec-ad3e-589bfa6f00ed | ClickHouse/ClickHouse | src/Storages/MergeTree/MergeTreeReadersChain.cpp | #include <Storages/MergeTree/MergeTreeReadersChain.h>
#include <Storages/MergeTree/IMergeTreeReader.h>
#include <Common/logger_useful.h>
#include <Storages/MergeTree/PatchParts/PatchPartsUtils.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
MergeTreeReadersChain::MergeTreeReadersChain(... | TOOL | 0.949838 | 7.183699 | {
"github_metadata": {
"branch": "master",
"commit_count": 183246,
"repo_created_at": "2016-06-02T08:28:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 41764,
"forks": 7471,
"issues": 4250,
"pull_requests": 622
},
"file_meta": {
"content_... |
e1af9082-0809-4abd-950d-6587564c35de | hsheric0210/Algorithm-Coding | cpp/AJIT-old/Elementary/Graph/04.cc | /* 기초 알고리즘(그래프) - 4. 로봇미로찾기 */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <set>
#include <queue>
int arr[105];
int dist[105];
int navi[105];
int start = 0, end = 0;
int encodeCoord(int x, int y)
{
return ((x & 0xffff) << 16) | (y & 0xffff);
}
int sumCoord(... | ALGO | 0.999818 | 4.429029 | {
"github_metadata": {
"branch": "main",
"commit_count": 123,
"repo_created_at": "2022-08-21T16:23: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": "ca5151b8a3... |
1705a964-aed7-49db-af30-f5b482155515 | rafkt/C.CPT | src/lib/Elias_Fano.cpp | //
// test.cpp
//
//
// Created by <NAME> on 02/09/2015.
//
//
//----------------------------------------------------------------------------------------------------------
// Compile with:
// g++ -std=c++11 -O3 -g -DNDEBUG -I ~/include -L ~/lib Elias_Fano.cpp -lsdsl -ldivsufsort -ldivsufsort64
//------------------... | ALGO | 0.978685 | 4.797863 | {
"github_metadata": {
"branch": "master",
"commit_count": 124,
"repo_created_at": "2016-10-26T09:34: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": "714c2765... |
b3a0b3af-d8e7-401e-a0ab-1ae8010bc876 | yutan0565/Algorithm_C_Cpp | Cpp/BaekJoon_SBS/32/13549.cc | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <limits.h>
#define endl '\n'
using namespace std;
#define MAX_POINT 100001*2
int n,k;
vector<int> visited(MAX_POINT, INT_MAX);
int daik(int start, int end)
{
int result = 0;
priority_queue<pair<int,int>> pq;
pq.push(ma... | ALGO | 0.999968 | 3.573998 | {
"github_metadata": {
"branch": "main",
"commit_count": 268,
"repo_created_at": "2022-08-28T04:06: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": "74d109d988... |
e88c80cb-948a-4f9a-91e1-319e24abc8a1 | maheshgudisa/MissionRnD-C-LinkedLists-Worksheet | src/012sllSort.cpp | /*
OVERVIEW: Given a single linked list of 0s 1s and 2s ,Sort the SLL such that zeroes
will be followed by ones and then twos.
INPUTS: SLL head pointer
OUTPUT: Sorted SLL ,Head should Finally point to an sll of sorted 0,1,2
ERROR CASES:
NOTES: Only 0,1,2, will be in sll nodes
*/
#include <stdio.h>
#include <m... | ALGO | 0.999975 | 3.657321 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2016-03-17T15:11:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c44d509bfd... |
ee8090c2-b759-473b-a71f-0d3461e8ed90 | Alex7Li/ProgrammingContests | other/NA_Camp/AtoZContest/DictionarySize.cpp | # include <bits/stdc++.h>
using namespace std;
//not finished
# define all(x) begin(x), end(x)
# define sz(x) (int)(x).size()
# define rep(i, a, b) for(int i = a; i < (b); ++i)
# define trav(a, x) for(auto& a : x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct Trie {
bool leaf; /... | ALGO | 0.999846 | 3.780401 | {
"github_metadata": {
"branch": "master",
"commit_count": 84,
"repo_created_at": "2017-08-14T19:06:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a06414eee... |
c03a428c-d7ce-4008-b84b-2b62b13532e3 | loveillusion/Archive_Practices-for-CS-Contests | Written using CLion/lgP1022/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string equation;
char c;
getline(cin, equation);
int constant = 0, x = 0, temp;
int sign = '+';
bool ls = true;
string stemp;
string unknown;
for (int i = 0; i < equation.length(); i++) {
c = equation[i];
i... | ALGO | 0.999926 | 3.871592 | {
"github_metadata": {
"branch": "main",
"commit_count": 57,
"repo_created_at": "2022-02-09T23:36:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "488d0ef3c4b... |
4e9606c0-dd9e-4bcf-b42f-9bb1575c73e3 | p61402/UVa-Solutions | 100-1999/637 Booklet Printing.cpp | #include <iostream>
using namespace std;
int main()
{
int n, x, y, pages;
while (cin >> n && n)
{
if (n % 4 == 0)
pages = n / 4;
else
pages = n / 4 + 1;
x = 1;
y = pages * 4;
cout << "Printing order for " << n << " pages:\n";
... | ALGO | 0.998887 | 4.218342 | {
"github_metadata": {
"branch": "master",
"commit_count": 136,
"repo_created_at": "2017-04-01T07:28: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": "31ddba3f... |
cb4141d2-b402-451a-8d30-b017b7e49075 | rohitkadam0101/CPP_Advanced | Arrays/circular_subarray.cpp | // Max circular subrray sum
// two condition => subarray with max sum is 1)non wrapping 2) wrapping
#include <iostream>
using namespace std;
int kadanes(int a[],int n){
int curr = 0;
int ans = a[0];
for(int i=0;i<n;i++){
curr+=a[i];
ans = max(ans,curr);
if(curr<0){
cur... | ALGO | 0.999998 | 4.343827 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-08-28T06:44: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": "4998026911... |
d0f91dc3-fc5a-48c6-bec8-bd9147b94de3 | brianbbsu/program | code archive/GJ/c074.cpp | //{
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<sstream>
#include<cmath>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#def... | ALGO | 0.99992 | 3.385632 | {
"github_metadata": {
"branch": "master",
"commit_count": 199,
"repo_created_at": "2017-02-06T06:47:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3608469e... |
ed2acdac-0935-45fd-a8f9-7812710c08aa | lkl0304/Simple-Snake | snake.h | #ifndef SNAKE_H_INCLUDED
#define SNAKE_H_INCLUDED
// 控制台句柄函数
#define Hc GetStdHandle(STD_OUTPUT_HANDLE)
// 重定义控制台颜色函数
#define Color SetConsoleTextAttribute
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <conio.h>
#include <windows.h>
#define Xx 32
#define Yy Xx
// 构造地图的二维数组
int smap[Yy][Xx];
// 控制移动方向... | TOOL | 0.90773 | 4.130396 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2016-12-26T13:59:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f9d88a39c... |
13cae0e3-1e77-4014-822d-f9c621cfe419 | ishandutta2007/codeforces-h | hongzy/normal/1238/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define ucin() ios :: sync_with_stdio(0)
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;... | ALGO | 0.999981 | 3.996502 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T02:01:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b95d7c09337f... |
b238383e-a887-40b8-8ae6-4fcdbd58de39 | ZxgnjasonTheFirst/Portfolio-of-Zxgnjason | CS 008/!include/Heap_Class/heap_class.h | #ifndef HEAP_CLASS_H
#define HEAP_CLASS_H
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
template <typename T>
class Heap{
public:
void insert(const T& insert_me){
//Can't use find here because it takes time to search through the whole vector
//if there are duplicates... | ALGO | 0.972075 | 3.913 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-05-02T20:42: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": "dcd35f6d8e... |
87fb3a79-de52-408f-8ba0-a729b849caa8 | junewaves/contests | Codeforces/2020/GoodBye2020/F.cpp | #include <bits/stdc++.h>
using namespace std;
struct dsu {
vector<int> g;
dsu(int n) : g(n, -1) {}
int get(int u) {
return g[u] < 0 ? u : g[u] = get(g[u]);
}
bool merge(int u, int v) {
u = get(u), v = get(v);
if (u == v) return false;
if (g[u] > g[v]) swap(u, v);
... | ALGO | 0.999962 | 3.972412 | {
"github_metadata": {
"branch": "master",
"commit_count": 244,
"repo_created_at": "2020-04-10T12:39:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59969c7b... |
3bc22ba7-dc39-4f8d-80df-19f48673132d | ExO-Okami/Lab_Work_10 | main.cpp | #include <iostream>
using namespace std;
// Тип данных, описывающий каждый отдельно взятый узел списка
struct Node
{
int info; // полезная информация, хранящаяся в этом узле
Node * next; // адрес следующего узла списка
// (nullptr, если данный элемент является последним)
};
// Расп... | ALGO | 0.999606 | 4.714909 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-12-18T18:06: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": "5cb7a02878d3... |
259f4e49-9d28-4e24-8d1f-852d0ab841f1 | Naoya14/Competitive | AtCoder/PRACTICE/EDUCARIONAL_DP/EDc_vacation.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <cstdint>
#include <set>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pis = pair<int, string>;
using Graph = ve... | ALGO | 0.99993 | 4.308062 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2021-04-17T12:12: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": "a3843897bb1... |
f337a456-1891-4523-9d25-40a089efb50d | Hoshinonono/cp-library | Test/yukicoder/yuki2764.test.cpp | #define PROBLEM "https://yukicoder.me/problems/no/2764"
#include <bits/stdc++.h>
#include "DataStructure/LiChaoTree_min.hpp"
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> w(n);
LiChaoTree LCT(0, 1 << 30);
... | ALGO | 0.999947 | 4.781192 | {
"github_metadata": {
"branch": "main",
"commit_count": 156,
"repo_created_at": "2023-12-30T13:58:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c7f99a1e6... |
e2f12e31-feb3-486c-b0e8-152a0767dc44 | lympassion/ccf-csp | 2019/9-2.cpp | /*
* description:
* 起初修改好之后提交一直只有50分,后面又读了一下题,
* 发现要记录发生苹果掉落的棵树,所以要加一个判断,以免
* 重复, 其实最好的方法实在判断mp[i] == 1 的地方改变D
* Author: lympassion
* Date: 2021/2/12
*/
#include <iostream>
#include <map>
using namespace std;
const int N = 1e3+3;
const int M = 1e3+3;
int arr[N][M];
map<int, bool> mp;
int main(... | ALGO | 0.999963 | 3.462894 | {
"github_metadata": {
"branch": "main",
"commit_count": 74,
"repo_created_at": "2021-02-01T03:56: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": "d149f1e1d1b... |
f27564fb-33a2-4bbe-99b4-1d2d505b7103 | seiko-iwasawa/my-library | my-library/Math/Chinese Remainder Theorem.cpp | #include <iostream>
using namespace std;
int gcd_ext(int a, int b, int &x, int &y) {
if (b == 0) {
x = 1;
y = 0;
return a;
} else {
int res = gcd_ext(b, a % b, y, x);
y -= a / b * x;
return res;
}
}
int chreth(int n, int a, int m, int b) {
int k1, k2;
int d = gcd_ext(n, m, k1, k2);
... | ALGO | 0.99993 | 3.97326 | {
"github_metadata": {
"branch": "master",
"commit_count": 298,
"repo_created_at": "2020-04-05T19:49:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5cebd8a... |
20b1dacf-7676-4ee4-8d6a-6d00513dadd8 | Viiprogrammer/Attiny13-Dual-Channel-PWM | Attiny13_DualPWM/main.cpp | #define F_CPU 9600000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#define FIRST_PLUS_MIN 187
#define FIRST_PLUS_MAX 196
#define FIRST_MINUS_MIN 120
#define FIRST_MINUS_MAX 137
#define SECOND_PLUS_MIN 167
#define SECOND_PLUS_MAX 174
#define SECOND_MINUS_MIN 0
#de... | TOOL | 0.987872 | 3.345942 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-08-06T21:42:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1bb5c3a74c... |
55113f53-4ed5-41e5-a96b-f0ed276c035c | plops/cl-cpp-generator2 | example/169_netview/source01/src/VideoDecoder.cpp | //
// Created by martin on 3/16/25.
//
#include "VideoDecoder.h"
#include "DurationComputer.h"
#ifdef NO_LIBS
#include <av.h>
#else
#include <avcpp/av.h>
#endif
#include <iostream>
#include <map>
#include "Histogram.h"
#include "TraceIO.h"
/*
* Main components
*
* Format (Container) - a wrapper, providing sync, m... | TOOL | 0.937726 | 6.993102 | {
"github_metadata": {
"branch": "master",
"commit_count": 5411,
"repo_created_at": "2019-08-10T18:04:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 36,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "eae976... |
e9aff13f-96c8-4d0f-896a-a2d0dd7f7744 | heleenoomen/42_CPP_Modules | cpp02/ex03/bsp.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsp.cpp :+: :+: :+: ... | ALGO | 0.997634 | 5.039922 | {
"github_metadata": {
"branch": "main",
"commit_count": 315,
"repo_created_at": "2022-11-20T12:58:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a32c79322... |
f3bb34da-0b3a-421d-84ac-f065f1c1c2cb | peterjc123/pytorch | third_party/nvfuser/csrc/lower_loops.cpp | #include <lower_loops.h>
#include <arith.h>
#include <ir_iostream.h>
#include <ir_utils.h>
#include <iter_visitor.h>
#include <kernel_expr_evaluator.h>
#include <lower2device.h>
#include <lower_utils.h>
#include <transform_replay.h>
#include <algorithm>
#include <deque>
#include <numeric>
namespace torch {
namespace... | ALGO | 0.986741 | 7.122434 | {
"github_metadata": {
"branch": "master",
"commit_count": 58973,
"repo_created_at": "2017-04-30T03:05:18.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "pytorch/pytorch",
"stars": 138,
"forks": 18,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"conte... |
fafd68e9-1195-4207-99ee-77c402f001b1 | Donutellko/Game_2048 | Model.h | /*
* Directions: 0-down, 1-left, 2-up, 3-right
*/
#include "Field.cpp"
class Game {
private:
const double chance_of_2 = 0.909090909; // Шанс выпадения двойки, иначе четвёрка
int field_size; // Размер поля NxN
int goal; // Количество очков, необходимое для победы
Field * field = nullptr; // Массив игрового поля
... | ALGO | 0.997304 | 4.489038 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2017-11-29T08:03: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": "6f7aa2b541... |
10f90f4a-052c-4063-9e62-3636071ea2b5 | EdzG/ndhu_oj_codes | SecondSemester/q27.cpp | #include <iostream>
class LinkedList
{
public :
class Node
{
public :
Node() : next(nullptr), data(0) {}
Node(int d) : next(nullptr), data(d) {}
Node(Node *n) : next(n), data(0) {}
Node(Node *n, int d) : next(n), data(d) {}... | TOOL | 0.900674 | 4.545968 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-01-13T04:44: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": "9dc6691dda58... |
f26b9201-1c95-4ccf-9c35-79d4fb576a4d | vincentRedDuck/Interview | automated_grading_system/lab8/studentCode/lab8-2/stu110511232.cpp | #include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
int A_code=65;
int Z_code=90;
int a_code=97;
int z_code=122;
string input;
cout<<"Enter message: ";
getline(cin,input);
while(input!="Stop")
{
int l=inp... | ALGO | 0.998144 | 3.06812 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-03-04T12:07: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": "b02a5cec81... |
06f74043-b370-47da-a38a-326f2d0cb140 | MetoA/OOP_Zadaci_2020 | Lab/7. Polimorfizam/Shapes.cpp | /*
Shapes Problem 7 (1 / 2)
--
Потребно е да конструирате абстракна класа Shape со само еден параметар:
страна (int)
Конструктори:
Shape()
Shape(int a)
И виртуелните методи:
double plostina()
void pecati()
int getType()
Од таа класа вие треба да конструирате 3 изведени класи:
Square
Circle
Triangle
Изведените кла... | ALGO | 0.978907 | 4.422649 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-05-12T19:58: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": "01b9826bede0... |
fe415f19-e60f-4db3-954c-630978023c0a | hengli/camodocal | src/ceres-solver/internal/ceres/runtime_numeric_diff_cost_function.h | // Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2010, 2011, 2012 Google Inc. All rights reserved.
// http://code.google.com/p/ceres-solver/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
... | ALGO | 0.995895 | 7.559428 | {
"github_metadata": {
"branch": "master",
"commit_count": 200,
"repo_created_at": "2013-03-14T10:42:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1235,
"forks": 392,
"issues": 54,
"pull_requests": 2
},
"file_meta": {
"content_id": "89... |
03e1bb31-4e33-42af-a3ae-db75ac14ef08 | kartikgtm7/Codeforces | questions/1890B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin>>t;
while(t--){
long n, m; cin >> n >> m;
string s, t; cin >> s >> t;
bool res(true);
for(long p = 0; res && p + 1 < s.size(); p++){if(s[p] == s[p + 1]){res = false;}}
if(res){cout << "YES" << endl; con... | ALGO | 0.99998 | 4.204731 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-10-20T14:12: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": "d940ede607... |
967c4dba-6599-496e-a06f-8703284b8dde | cod1r/projecteuler | problem16/problem16.cpp | #include <string>
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int main(){
long long int carry = 0;
string two = "2";
ofstream outfile("output.txt");
outfile << two << endl;
for (int x = 0; x < 999; x++){
string temp = "";
for(int y = two.length()-1;... | ALGO | 0.999711 | 3.544838 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2020-05-18T06:59: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": "7539b738f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.