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 |
|---|---|---|---|---|---|---|---|
d228e97b-e9fe-42bb-aa06-353ac9de1e74 | ROBOTICSENGINEER/NAO_H25_V4 | Markov_Decision_Process/rewards.h | #ifndef REWARDS_H
#define REWARDS_H
#include <iostream>
void set_target_reward(float R[7][5],float ephi)
{
unsigned int i,j;
if (-1.5708<=ephi && ephi<0.64350)
{
i=4;
j=4;
}
else if (0.64350<=ephi && ephi<0.89606)
{
i=4;
j=3;
}
else if (0.89606<=ephi &&... | ALGO | 0.967474 | 3.746454 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2017-12-09T17:39:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5b8e5e291... |
0f0f24f0-5b97-4bb9-b72d-f086001690c6 | fwdzh/cp_code | Codeforces/2090/D.cpp | // Date: 2025-03-24
// Time: 10:14:47
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5;
vector<int> minp(N + 1);
void ChatGptDeepSeek()
{
int n;
cin >> n;
vector<int> ans;
int mid = n / 2;
for (int i = 0; i < mid; i++)
{
if (minp[mid - i] == mid - i)
{
... | ALGO | 0.999344 | 5.104053 | {
"github_metadata": {
"branch": "master",
"commit_count": 295,
"repo_created_at": "2025-04-10T12:07: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": "1ff86b41... |
e63405f6-7126-45c2-a6cf-c5d8a67d1fd1 | danishred/Programming | OOPS/Matrix_Multiplication.cpp | // Multiplication of Two Matrices
#include <iostream>
using namespace std;
int main()
{
int a[5][5], b[5][5], c[5][5], i, j, k, sum = 0, m, n, o, p;
cout << "\nEnter number of rows and columns of first matrix\n";
cin >> m >> n;
cout << "\nEnter number of rows and columns of second matrix\n";
cin >>... | ALGO | 0.999464 | 4.210033 | {
"github_metadata": {
"branch": "main",
"commit_count": 384,
"repo_created_at": "2022-10-05T09:49: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": "0733affc39... |
10a76ff5-0fe2-4145-b670-126d6d1e2c75 | Justes/leetcode_answers | medium/1-500/36_Valid_Sudoku.cpp | #include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <deque>
#include <stack>
#include <cmath>
#include <bitset>
#include <map>
using namespace std;
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& bo... | ALGO | 0.999025 | 6.190532 | {
"github_metadata": {
"branch": "main",
"commit_count": 126,
"repo_created_at": "2022-04-02T10:27: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": "ce8d261ae8... |
f67b3fcd-20b0-4bf6-956a-9fcf73eebf64 | dgcnz/competitive-programming | codeforces/976B-lara-croft-and-the-new-game.cpp | #ifdef DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) ((void)0)
#endif
#include <bits/stdc++.h>
#include <cplib/utils/io>
#define all(c) begin(c), end(c)
#define isz(c) (int)(c).size()
using namespace std;
using namespace cplib;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
ii... | ALGO | 0.999974 | 4.440642 | {
"github_metadata": {
"branch": "master",
"commit_count": 380,
"repo_created_at": "2020-01-08T16:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2590aedc... |
bbc144c9-6e20-4e9f-a710-bb8c4b5659a2 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/11/1126/personal_submission/cf174c_yawn_sean.cpp | #include <bits/stdc++.h>
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #include "atcoder/convolution"
// #include "atcoder/dsu"
// #include "atcoder/fenwicktree"
// #include "atcoder/lazysegtree"
// #include "atcoder/math"
// #include "atcoder/maxflow"
// #include "atcoder/mincostflow"
// #include "atcoder/modint... | ALGO | 0.99984 | 3.895618 | {
"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": "6c39... |
c761929b-397f-4d48-9008-145eb70e2f48 | ishandutta2007/codeforces-s | saketh/normal/1089/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()
... | ALGO | 0.999368 | 3.994257 | {
"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": "a3e8d87fdcb4... |
35553fd7-b1ea-437e-9f8a-39d1f99c39d4 | ichyo/atcoder-submissions | cpp/ARC059/D.cpp | // Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;
#ifdef LOCAL
#include "contest.h"
#else
#define dump(x)
#endif
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w;... | ALGO | 0.999996 | 3.927216 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2017-07-01T01:14: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": "c99243b13... |
b14f7d08-2013-467b-abf0-13aff75dea0c | minseonkkim/Algorithm_BOJ | Dynamic programming/10826.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int n;
string dp[10001];
string big_num_sum(string a, string b){
int sum;
string s;
vector<int> v, num1, num2;
if(a.size() < b.size()){
string tmp = a;
a = b;
b = tmp;
}
num1.push_back(0);
num2.push_back(0);
for (int i = ... | ALGO | 0.999979 | 3.568302 | {
"github_metadata": {
"branch": "main",
"commit_count": 571,
"repo_created_at": "2021-09-11T12:43:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "834dfeb3b3... |
3ca3e45b-8bfa-4880-908b-8265704be4c9 | cusplibrary/cusplibrary | cusp/system/detail/generic/transpose.inl | /*
* Copyright 2008-2013 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable... | TOOL | 0.909466 | 7.374781 | {
"github_metadata": {
"branch": "main",
"commit_count": 1316,
"repo_created_at": "2012-08-24T01:13:26.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 415,
"forks": 134,
"issues": 33,
"pull_requests": 6
},
"file_meta": {
"content_id": "28be7... |
adc37447-7fd1-45bb-a2da-d17e7fb442b3 | ishandutta2007/codeforces-b | barichek/normal/1240/D.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(... | ALGO | 0.999739 | 3.685145 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd62cce6ff13... |
6d80236f-c8ee-4529-8fba-5034cdf03572 | RitikJainRJ/GFG-Practice | hashtable open addressing.cpp | #include<bits/stdc++.h>
using namespace std;
class HashTable{
private:
int cap;
int *arr;
int size;
public:
HashTable(int cap){
this->cap = cap;
arr = new int[cap];
size = 0;
for(int i = 0; i < cap; i++)
arr[i] = 0;
}
void insert(int data){
... | ALGO | 0.998977 | 4.202507 | {
"github_metadata": {
"branch": "master",
"commit_count": 77,
"repo_created_at": "2019-12-13T09:08:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "14ebcdb89... |
7d59bbc5-9980-4baa-a53f-c90b14b795e0 | qiayuanl/legged_control | legged_wbc/include/legged_wbc/HoQp.h | //
// Created by qiayuan on 2022/6/28.
//
//
// Ref: https://github.com/bernhardpg/quadruped_locomotion
//
#pragma once
#include "legged_wbc/Task.h"
#include <memory>
namespace legged {
// Hierarchical Optimization Quadratic Program
class HoQp {
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
using HoQpPtr = std::sha... | ALGO | 0.999753 | 5.668243 | {
"github_metadata": {
"branch": "master",
"commit_count": 274,
"repo_created_at": "2022-06-24T02:24:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1345,
"forks": 300,
"issues": 34,
"pull_requests": 2
},
"file_meta": {
"content_id": "a9... |
964e20dd-7c6c-4fe5-8662-fc37cc4f7981 | ishandutta2007/codeforces-a | amshz/normal/1316/A.cpp | # include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, int> pii;
# define F first
# define S second
# define endl '\n'
# define sep ' '
# define pb push_back
# define fast_io ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
const ll md = 1e9+7;
const int x... | ALGO | 0.999926 | 3.68601 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-04-11T00:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efb0f8e7609d... |
76e5001a-95fd-48a6-8fa3-e37fe115ac42 | suhyun444/ProblemSolving | 백준/Silver/14940. 쉬운 최단거리/쉬운 최단거리.cc | #include <iostream>
#include <queue>
using namespace std;
int n, m;
int visited[1001][1001];
int board[1001][1001];
int startY, startX;
int dirY[4] = { 0,1,0,-1 };
int dirX[4] = { 1,0,-1,0 };
void bfs()
{
for (int i = 0; i < n; i++)for (int j = 0; j < m; j++)visited[i][j] = 2e9;
queue<pair<int, int>> q;
q.push({ s... | ALGO | 0.99984 | 3.479865 | {
"github_metadata": {
"branch": "main",
"commit_count": 229,
"repo_created_at": "2023-01-09T06:43: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": "3270f3ebed... |
d3466324-b102-4580-8e00-f86662ba3416 | oustani-anas/codef_problems | football.cpp |
#include <iostream>
#include <string>
int main()
{
int zcount, ocount;
std::string num;
std::cin >> num;
for (size_t i = 0; i < num.size(); i++)
{
if(num[i] != '0' && num[i] != '1')
return(0);
}
for (size_t i = 0; i < num.size(); i++)
{
if(num[i] == '0... | ALGO | 0.999584 | 3.713113 | {
"github_metadata": {
"branch": "main",
"commit_count": 112,
"repo_created_at": "2023-07-30T16:36:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a873ef4fd... |
9111863c-21b3-45da-b12f-34474de0b7fa | AdityaLondhe/DAA-Lab | B-01: Activity selection problem with K persons.cpp | // C++ program for the above approach
#include <bits/stdc++.h>
using namespace std;
// Comparator
bool compareBy(const pair<int, int>& a,
const pair<int, int>& b)
{
if (a.second != b.second)
return a.second < b.second;
return a.first < b.first;
}
// Function to find maximum shops
// that can be visited by K pe... | ALGO | 0.999967 | 5.493807 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-08-14T09:52:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "825ec1059ab... |
75e4df69-6dd5-48f5-8121-601d4ad93979 | MikeChuv/prog_c_and_cpp | Lab01/source.cpp | /*
<NAME>
Определить в каком массиве больше минимум элементов, больших заданного числа. Если в двух или трёх массивах минимумы совпадают, вывести соответствующее сообщение.
*/
#include <cstdio>
// #include <stdio.h>
// #include <stdlib.h>
const int nmax = 10;
// ввод массива
int array_input(int *arr_size, doubl... | ALGO | 0.999584 | 3.400311 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2020-09-03T18:21: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": "8dfee3e38... |
40bdc78e-14db-4278-95a1-cc75663e548b | talegriat/projects | cprograms/listas.cpp | //Listas enlazadas
#include <iostream>
#include <iomanip>
#include<cstdlib>
#include<math.h>
using namespace std;
//structs
struct TNodo{
int info;
TNodo *liga;
};
//prototipos
TNodo *crea();
void *quita(TNodo);
TNodo *insertaInicio(TNodo *, int dato);
TNodo *insertaFinal(TNodo *, int dato);
void recorre(TN... | ALGO | 0.994665 | 4.653196 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-10-02T23:14: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": "e25f41cfed76... |
3075a7d1-7485-4231-8039-a3ef30b253a2 | SuperKam91/bnn | forward_models/cpp_models/src/loglikelihoods.cpp | /* external codebase */
#include <Eigen/Dense>
/* in-house code */
#include "loglikelihoods.hpp"
double calc_gauss_ll(Eigen::Ref < Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> > y, Eigen::MatrixXd & pred, double & LL_var, double & LL_norm, const uint & LL_dim, const uint & batch_size) {
... | ALGO | 0.999207 | 6.372587 | {
"github_metadata": {
"branch": "master",
"commit_count": 240,
"repo_created_at": "2018-09-04T09:08:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c0f2677c... |
ace56900-e839-4eb9-a642-0e7341064aa3 | Burnsidious/FSGDEngine | EDGameCore/Physics.cpp | #include "Physics.h"
#include "Game.h"
#include "GameObject.h"
#include "../EDSpatial/DynAabbTree.h"
#include "GameObject.h"
#include "Collider.h"
#include "RigidBody.h"
#include "Transform.h"
#include "../EDCollision/Ray.h"
#include "../EDCollision/sphere.h"
#include "../EDCollision/obb.h"
#include "../EDCollision/cap... | ALGO | 0.974853 | 3.201666 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2016-08-02T18:39:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0395e59613... |
53f50232-9cc8-497a-8611-eb36cbafca7a | bjohnsonfl/Tic-Tac-Toe-Engine | search.cpp | //
// search.cpp
// TicTacToeAI
//
// Created by <NAME> on 12/3/18.
// Copyright © 2018 <NAME>. All rights reserved.
//
#include <iostream>
#include "search.hpp"
//std::vector<move> pvTable;
move pvTable[9];
void search::search(position& pos, int depth)
{
pos.clear_nodes();
// miniMax(pos, depth, tru... | ALGO | 0.998677 | 3.805359 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-12-11T19:29:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d93f18a51a... |
0bdd39ac-94ad-43b7-bf44-58c37b6ce872 | adityajamwal02/LeetcodeProblemSet2 | EasyString.cpp | /*
You are given the string S . Compress the string when lower and upper cases are the same. In compressed string characters should be in lowercase.
Example 1:
Input: S = "aaABBb"
Output: "3a3b"
Explanation: As 'a' appears 3 times
consecutively and 'b' also 3 times,
and 'b' and 'B' considered as same.
Example 2:
In... | ALGO | 0.999997 | 5.81246 | {
"github_metadata": {
"branch": "main",
"commit_count": 335,
"repo_created_at": "2023-05-07T06:18: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": "ea61116462... |
fd570c78-f5e8-48b8-b6e0-2997075487a9 | aryan04-t/LeetCode | 02_Strings/025_5. Longest Palindromic Substring/00_My_Naive_Approach.cpp | // LeetCode (5. Longest Palindromic Substring):
// https://leetcode.com/problems/longest-palindromic-substring/
#include<string>
using namespace std;
class Solution {
public:
bool checkPalindrome(const string &s){
int start = 0;
int end = s.length()-1;
while(start < end){
... | ALGO | 0.996044 | 6.320402 | {
"github_metadata": {
"branch": "master",
"commit_count": 571,
"repo_created_at": "2023-11-12T04:49:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "db335eaa... |
ad2a1cb3-476c-41f7-bf96-ab48764980f3 | Gin101/CS101 | luogu/P1541.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int maxN = 351;
const int maxM = 121;
const int maxNum = 41;
int a[maxN] = {0};
int dp[maxNum][maxNum][maxNum][maxNum] = {{{{0}}}};
int main()
{
int n = 0;
int m = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i]... | ALGO | 0.999986 | 3.762409 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2021-08-19T15:41:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "79c9da84d... |
e4a4055d-9fc8-4692-8487-9649e5a47785 | JordanaBM/TC1031-Estructuras-Formativas | Act 4.1 - Grafos, sus representaciones y sus recorridos/graph.h | /*
* autor: <NAME> y <NAME> A01707434
* fecha: 9 de noviembre de 2021
* programa: act 4.1 Implementacion Grafos
* desc: estos programas son soluciones parciales a algunos de
* las actividades planteadas en el curso TC1031
*
*
* Extiende este archivo para completar tu solución.
*/
#ifndef Graph_H_
#define Graph_H... | ALGO | 0.996485 | 4.016259 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2021-08-09T17:10:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "02af3e56e24... |
c4cdb88a-026d-4a46-a4af-0c24a884d6da | shtuk41/Leetcode | Leetcode/GroupAnagram.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution1 {
map<string, int> groups;
bool isAnagram(string s, string t) {
int map[256] = { 0 };
if (s.length() != t.length())
... | ALGO | 0.999987 | 6.072534 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-03-15T22:24: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": "97bcb88b9e1f... |
e2c6f013-a91f-49a9-968c-6a4403c035c2 | SayaUrobuchi/uvachan | NTUJ/0699.cpp | #include <stdio.h>
int ln[100005], lm[100005], llen[100005];
long long tim[100005], has[100005], lhas[100005];
char pat[100005], tex[100005];
int chk(int n, int m, int k)
{
return (k-m)%2==0 && k>=m && (k==0 || n+m>0);
}
int main()
{
int cas1, cas2, i, lnum, len, pp, las;
long long bas;
bas = 13;
tim[0] = 1;
f... | ALGO | 0.99376 | 3.078303 | {
"github_metadata": {
"branch": "master",
"commit_count": 105,
"repo_created_at": "2017-06-12T06:49:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1fd95b5... |
da22fea1-d0b8-488c-97df-07af0a0cdd60 | robert1003/problem-solving | cses/introductory_problem/1755.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> cnt(26);
string s; cin >> s;
for (auto i : s) cnt[i - 'A']++;
string ans;
int oddcnt = 0;
for (int i = 0; i < 26; i++) {
if (cnt[i] & 1) {
oddcnt++;
continue;
}
for (int j = 0; j < cnt[i] / 2; j++) {
ans.pu... | ALGO | 0.999995 | 4.164562 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2021-07-17T08:18: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": "0c5acad781e... |
0b0629eb-8aad-436f-aa23-e9176d63be61 | KarahanS/Bachelor-University-Projects | CmpE250 - Data Structures and Algorithms/project2/main.cpp | #include "DeluxePQ.h"
#include "Hacker.h"
#include "Event.h"
#include "HoodiesPQ.h"
#include "StickersPQ.h"
#include <iomanip>
#include <string>
#include <fstream>
int main(int argc, char* argv[]) {
int maxSticker = 0, maxHoodie = 0, invalidQueue = 0, invalidGift = 0;
float averageGift = 0, waitSQ = 0, wait... | ALGO | 0.99094 | 3.386744 | {
"github_metadata": {
"branch": "master",
"commit_count": 88,
"repo_created_at": "2021-02-14T13:31:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8ec91f627... |
97ed56d7-52ab-445e-a3f5-76f92dec6632 | merinovvvv/cpp_labs | lab01/ex2/main.cpp | #include <iostream>
using std::cin;
using std::cout;
int main()
{
int x, y;
cout << "Input the value of x: ";
cin >> x;
cout << "Input the value of y: ";
cin >> y;
int plus_x = +x;
int plus_y = +y;
int minus_x = -x;
int minus_y = -y;
int sum = x + y;
int sub = x - y;
int mult = x * y;
int div = x / y;
in... | ALGO | 0.994354 | 3.885552 | {
"github_metadata": {
"branch": "main",
"commit_count": 59,
"repo_created_at": "2023-10-05T08:23: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": "bef526e5709... |
f95f317d-f4a9-4c4b-9178-8aad23a695b7 | zddhub/opensse | sse/quantize/quantizer.h | /*************************************************************************
* Copyright (c) 2014 <NAME>
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* htt... | ALGO | 0.991109 | 6.948846 | {
"github_metadata": {
"branch": "master",
"commit_count": 138,
"repo_created_at": "2014-03-01T11:23:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 970,
"forks": 157,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0644... |
9502436c-9df3-4de1-bfa5-0a79a7ae506a | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc004/B/3240711.cpp | #if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <... | ALGO | 0.999974 | 4.480568 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-09-30T05:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 22,
"forks": 8,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "37c9645d... |
e4e6c3e1-d9fb-457e-b016-f3e9d607ffcc | Alaxe/noi2-ranking | 2020/solutions/B/VDH-Plovdiv/brackets.cpp | #include <iostream>
#include <string>
#include <stack>
#include <algorithm>
using namespace std;
stack <pair<int, int> > st; ///+1 -2 *3 /4 (5
struct skobi
{
int idx1;
int idx2;
int op;
int dali;
}sk[100000];
int bez[200000];
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(false);
... | ALGO | 0.999991 | 3.916044 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2017-03-20T21:56:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ef44c53a... |
60e4e9e5-26fd-4618-ad1f-34e2b65dc6f3 | aliu-here/aoc | aoc2024/16/p1.cpp | #include <iostream>
#include <array>
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
//dijkstra's
enum dirs {
UP,
DOWN,
LEFT,
RIGHT
};
struct pos_dist_dir {
std::array<int, 2> pos;
int dist;
char dirs;
};
std::array<int, 2> add_vecs(std::array<int, 2> v1, std::... | ALGO | 0.999958 | 4.966555 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2024-12-15T00:29: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": "0e2aaa67078... |
bcf9b8bf-a9cd-4ecf-9c6b-974205399685 | Ayush7614/Daily-Coding-DS-ALGO-Practice | Gfg/C++/Detect cycle in an undirected graph.cpp | // Link to problem:
//https://practice.geeksforgeeks.org/problems/detect-cycle-in-an-undirected-graph/1
/*Algorithm:
We will use DFS traversal. During traversal if a node is already visited and its not equal to its parent value means
there exist a cycle so we will return true.
*/
#include<bits/stdc++.h>
using names... | ALGO | 0.999963 | 5.559083 | {
"github_metadata": {
"branch": "main",
"commit_count": 2968,
"repo_created_at": "2020-12-28T05:34:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 322,
"forks": 474,
"issues": 335,
"pull_requests": 20
},
"file_meta": {
"content_id": "27... |
1d1e5173-5c85-4b09-852d-96c842985a76 | raujika418/GoodOldDays | llvm/lib/Transforms/Scalar/ADCE.cpp | //===- ADCE.cpp - Code to perform aggressive dead code elimination --------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | ALGO | 0.990376 | 6.232789 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-07-11T12:11:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "431aceb5fa... |
59eda437-855b-4c44-8d07-e02ba4f46fbd | olroque/LeetCode | 88_merge_sorted_array/merge_sorted_array.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n)
{
if (n < 1) {return;}
if (m < 1 && n > 0)
{
int y = 0;
while (y < nums2.size())
{
nu... | ALGO | 0.99997 | 5.41514 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-10-08T15:40: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": "4ee507e63bc... |
a0bce920-33a5-4316-b2a6-987715c791a4 | brpapa/algorithms | solutions/uva/10779.cpp | /*
graphs > maximum flow
difficulty: medium
date: 10/Aug/2020
hint: each friend receives 1 flow unit of a sticker and offers a flow of other sticker; Bob also offers, but he receives 1 flow unit of each sticker; maximized it
by: @brpapa
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long l... | ALGO | 0.999967 | 3.708925 | {
"github_metadata": {
"branch": "master",
"commit_count": 197,
"repo_created_at": "2019-01-25T20:40:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 35,
"forks": 15,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d759a1... |
54c42b48-51a8-4088-9015-5b716c34547b | emilyju0314/gpt_code_plagiarism | dataset/code_content_classifier/allpro_train/0_0_10543.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <limits>
using namespace std;
const int INF = numeric_limits<int>::max();
struct Edge {
int to;
int cost;
};
int main() {
int N, M, L;
cin >> N >> M >> L;
vector<vector<Edge>> graph(N);
for (int i = 0; i < M; i++) {
int... | ALGO | 0.999987 | 5.252337 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2024-04-28T03:59: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": "83a5873dc31... |
0efa8344-b406-4c87-8c2d-0e359170aaed | 7oSkaaa/LeetCode_DailyChallenge_2023 | 02- February/21- Single Element in a Sorted Array/21- Single Element in a Sorted Array (Mahmoud Aboelsoud).cpp | // Author: <NAME>
class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
// we have a sorted array with all elements appearing twice except one
// let's assume that every element appears twice that means that each element appears at two positions adjecent to each other
// one ... | ALGO | 0.999748 | 5.889534 | {
"github_metadata": {
"branch": "main",
"commit_count": 6874,
"repo_created_at": "2023-01-02T11:28:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 104,
"forks": 86,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "79176a... |
ce05bf7f-881e-4904-8eb8-58a64ebfeece | CMU-Perceptual-Computing-Lab/caffe_rtpose | include/caffe/cpm/layers/nms_layer.hpp | #ifndef CAFFE_NMS_LAYER_HPP_
#define CAFFE_NMS_LAYER_HPP_
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/proto/caffe.pb.h"
namespace caffe {
template <typename Dtype>
class NmsLayer : public Layer<Dtype> {
public:
explicit NmsLayer(const LayerParameter& param)
: Layer<Dtype>(param), nu... | TOOL | 0.920259 | 7.055109 | {
"github_metadata": {
"branch": "master",
"commit_count": 3529,
"repo_created_at": "2016-09-28T14:48:17.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 358,
"forks": 205,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "7fc3... |
61c82020-8ebd-4e65-bd84-f0fc6530db23 | Ruslan515/Competitions | coding/Leetcode/Biweekly_Leetcode/Biweekly_Contest_145/q2.cpp | // https://leetcode.com/contest/biweekly-contest-145/problems/minimum-time-to-break-locks-i/description/
// Created by omega515 on 07.12.24.
//
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int findMinimumTime(vector<int>& strength, int K) {
sort(strength.begin(), strength.end());... | ALGO | 0.99961 | 6.296307 | {
"github_metadata": {
"branch": "main",
"commit_count": 271,
"repo_created_at": "2022-05-31T16:17:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c4b86d2563... |
1edbc8a6-f977-47b8-84e7-b5ab20a1f564 | faraaz-bot/HIPTraining | 007_hiprtc/transpose_kernel.h | #include <hip/hip_runtime.h>
template <typename Tfloat>
__global__ __launch_bounds__(1024) void transpose_kernel(const Tfloat* __restrict__ input,
Tfloat* __restrict__ output,
unsigned int length0,
... | ALGO | 0.987076 | 5.385567 | {
"github_metadata": {
"branch": "main",
"commit_count": 89,
"repo_created_at": "2025-05-09T22:09: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": "14883f2c1c7... |
c15b7028-c566-4e96-9e51-e437e9204d4e | millag/alife | src/Flock.cpp | #include "Flock.h"
#include <algorithm>
#include <boost/thread.hpp>
#include <boost/thread/detail/thread_group.hpp>
#include "Grid.h"
#include "Integrator.h"
#include "Servant.h"
#include "Config.h"
class Callable : public INeighboursServant, public IObstacleServant
{
public:
typedef std::vector<Boid*>::const_it... | ALGO | 0.990652 | 3.637372 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2014-02-05T19:02: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": "a9a456586... |
2a39a1dd-f4d0-4e47-8296-0b91c61b0f19 | ishandutta2007/codeforces-k | kirill22/normal/438/C.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const st... | ALGO | 0.999936 | 4.204369 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06: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": "bdb340fdf275... |
7509bb0a-934f-4340-913d-d79bac219ff0 | esaminu/leetcodeSubmissions | problems/top_k_frequent_words/solution.cpp | class wordFreq {
public:
string word;
int freq;
wordFreq(string word, int freq) {
this->word = word;
this->freq = freq;
}
};
class Solution {
public:
vector<string> topKFrequent(vector<string>& words, int k) {
unordered_map<string, int> s;
for(strin... | ALGO | 0.999994 | 6.581076 | {
"github_metadata": {
"branch": "main",
"commit_count": 99,
"repo_created_at": "2021-05-24T14:09: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": "5f0fa774825... |
60790a52-ef1b-45c9-b536-5cdc61af93eb | dslab-epfl/pix | dpdk-nfs/nf/pin/counts.cpp | #include "pin.H"
#include <fstream>
#include <iostream>
#include <string>
std::ofstream trace;
static bool is_counting = false;
static UINT64 instr_count = 0;
static UINT64 mem_count = 0;
typedef struct {
unsigned long ip;
std::string function;
std::string assembly;
} instruction_data_t;
std::string start_fn =... | TOOL | 0.909662 | 6.650238 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2022-03-06T20:45:55.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 16,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b66278cdc6c... |
1762213e-3ba9-4e09-8ed3-c00a1fb0a9b9 | lazzzis/uva-oj-code | Uva3670/main.cpp | /*
UvaOJ 3670
Emerald
Sat 20 Jun 2015
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;
struct Node {
int x, y;
int step, conStep;
};
const int MAXN = 20 + 5;
int maze[MAXN][MAXN];
int vis[MAXN][MAXN][MAXN*MAXN];
int dir[4][2] = { 0,1, 0,-1, 1,0, -1,0 };
int M, N,... | ALGO | 0.999964 | 4.129086 | {
"github_metadata": {
"branch": "master",
"commit_count": 62,
"repo_created_at": "2015-09-02T14:14:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "611ab1be5... |
1165b5be-b1c8-4a6d-9906-96a6b2e4e399 | christopheblomsen/Project-3 | code/src/PenningTrap.cpp | #include "PenningTrap.hpp"
#include "Particle.hpp"
// Constructor
PenningTrap::PenningTrap(std::vector<Particle> particles_in, double B0_in, double V0_in, double d_in){
particles = particles_in;
B0 = B0_in;
V0 = V0_in;
d = d_in;
V02 = V0 / (d * d);
// The mass is the same for all ions
mass_ion = part... | ALGO | 0.999675 | 5.577183 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2022-10-26T05:52: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": "a0b2fbcd22a... |
8885aff1-067c-489e-acfd-8885c0c813ec | SophyaTs/V_semester | OS/Lab1/Manager/manager.cpp | #include <boost/process.hpp>
#include <iostream>
#include <string>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <windows.h>
#include <stdio.h>
namespace bp = boost::process;
std::mutex mz, mr;
std::condition_variable cvz;
const int TOTALTHREADS = 2;
int finished = 0;
bool gotZero = false;... | ALGO | 0.946294 | 5.335389 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2020-09-15T19:21: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": "5bd511966... |
9ab795a4-4b2b-4078-8e14-662f990f9e2c | YashPandey1405/DataStructures-CollegeLab-Codes | DS05_QueuesUsingArrays.cpp | #include <iostream>
using namespace std;
class Queues_Arrays{
private :
int * arr;
int Capacity;
int Front,Rear;
public:
Queues_Arrays(int c){
this->Capacity=c;
this->arr=new int[Capacity];
this->Front=0;
this->Rear=-1;
}
void enqueue(int x){
... | ALGO | 0.99975 | 4.332129 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2023-10-03T13:15:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "43e55887c96... |
903fc609-2cc8-4cf6-a83e-b6c7a315548f | ishandutta2007/codeforces-f | ffao/normal/138/A.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <list>
#include <string>
#include <iostream>
using namespace std;
#define AABB 0
#define ABBA 1
#define ABAB 2
string quatrain[4];
int main() {
int N, K;
scanf("%d %d", &N, &K);
getchar();
int scheme = -1;
f... | ALGO | 0.999866 | 3.303377 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:43: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": "f9b8cf49dd93... |
f4d58605-6683-40de-9515-44cd572a968b | Dan920-Dev/ProgrammingCPP | Scripts/main16.cpp | /*
Ingresar 10 valores por teclado y obtener la sumatoria de los mismos.
Imprimir el total.
*/
#include <iostream>
using namespace std;
int main() {
cout << "*** Usando for ***" << endl;
int suma = 0, cont = 0, valor;
// Usando for
for (int i = 0; i < 10; i++)
{
cout << "ingrese el va... | ALGO | 0.998626 | 4.281425 | {
"github_metadata": {
"branch": "main",
"commit_count": 74,
"repo_created_at": "2022-05-06T17:03:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac7497b6339... |
77c8ea55-7a20-4511-9b6d-de143b0e3c1d | thegamer1907/Codechef | PRINCESS.cpp | def func(text):
N = len(text)
if N == 0:
return
N = 2*N+1
L = [0] * N
L[0] = 0
L[1] = 1
C = 1
R = 2
i = 0
iMirror = 0
maxLPSLength = 0
maxLPSCenterPosition = 0
start = -1
end = -1
diff = -1
for i in xrange(2,N):
iMirror = 2*C-i
... | ALGO | 0.999546 | 3.470356 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-04-12T06:31: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": "e4e2b4245c... |
e52f3c0d-7eab-4335-927f-2cb55a7cc83d | UCliwenbin/AlgorithmCPP | CToC++/CToC++/Search/SearchSolution.hpp | //
// SearchSolution.hpp
// CToC++
//
// Created by mac on 2020/4/10.
// Copyright © 2020 lwb. All rights reserved.
//
#ifndef SearchSolution_hpp
#define SearchSolution_hpp
#include <iostream>
#include <vector>
using namespace std;
class TreeNode {
public:
int val;
TreeNode *left;
TreeNode *righ... | ALGO | 0.999889 | 5.137725 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2021-02-25T07:54:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc6f4a552ba... |
667f6c1a-ecfa-499a-9712-2c4b67c349b7 | Adrenalinerush07/Trees | treefromstring.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void __print(int x)
{
cerr << x;
}
void __print(long x) { cerr << x; }
// void __print(long long x) {cerr << x;}
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }... | ALGO | 0.999357 | 4.420615 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-01-22T13:46: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": "a1a612c83f65... |
9c945f46-214e-41c2-b35d-7278fa9e00e7 | notiom/Mystudy | leetcode/hot100/01_哈希_两数之和.cpp | //1.我的方法,测试通过
存在的问题:vector中查找是否存在的函数,如何快速给vector每个元素赋值
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
//第一个数
int signle = 0;
//第二个数
int score = -1;
for(int i =0;i<nums.size();i++)
{
int chazhi = target - nums[i];
f... | ALGO | 0.999902 | 4.871677 | {
"github_metadata": {
"branch": "main",
"commit_count": 465,
"repo_created_at": "2024-04-01T08:50:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c128031ee7... |
3ddc294c-f619-4922-9b88-05088454dc5c | blubits/solutions | kattis/@solved/presidentialelections/presidentialelections.cpp | #include <bits/stdc++.h>
#define LSOne(S) ((S) & (-S))
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const int NINF = 0xcfcfcfcf;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS ... | ALGO | 0.999933 | 4.283393 | {
"github_metadata": {
"branch": "main",
"commit_count": 114,
"repo_created_at": "2022-12-04T03:07: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": "62014b52af... |
124430e5-6132-4e35-bd5e-4ba9faab5565 | wowCharming/MSc | AdvPT/AdvPT_02_MatrixPDE/Vector.h | #include <iostream>
#include <cassert>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <array>
#include <cmath>
using namespace std;
using std::vector;
using std::string;
using std::cout;
using std::cin;
using std::istream;
using std::ostream;
using std::en... | ALGO | 0.970836 | 3.903316 | {
"github_metadata": {
"branch": "main",
"commit_count": 137,
"repo_created_at": "2023-12-05T03:41:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8ff5af2de... |
00278df1-f7de-4b88-baea-b8de769c95db | MalcolmMielle/PathFinding | Astar.hpp | #ifndef ASTAR_PATHFINDING_H
#define ASTAR_PATHFINDING_H
#include <iostream>
#include <stdio.h>
#include <vector>
#include <deque>
#include <cstdlib>
#include <sstream>
#include <cmath>
#include "Data.hpp"
#include "Point.hpp"
class Astar{
protected :
std::deque<Data*> _OpenList;
std::deque<Data*> _ClosedList;
st... | ALGO | 0.988958 | 4.033189 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2014-03-03T12:04:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c159357063... |
a268398c-8b45-49e6-b91a-19103aef84d4 | Tocknicsu/oj | pcca/2015_1/1002/pd.cpp | #include <bits/stdc++.h>
using namespace std;
struct C{
int x, y, r;
C(){}
C(int _x, int _y, int _r):x(_x),y(_y),r(_r){}
};
inline int squ(int x){
return x * x;
}
void Solve(int n){
vector<C> c;
bool go[n][n];
memset(go, 0, sizeof(go));
for(int i = 0 ; i < n ; i++){
int x, y, r;
... | ALGO | 0.999664 | 3.967062 | {
"github_metadata": {
"branch": "master",
"commit_count": 368,
"repo_created_at": "2015-03-23T01:16:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0d6e209... |
de446b62-35e5-43ad-980b-8da4038f3c55 | SAMIUL-35/codechef_contest | starter_128/Disjoint_Non_Decreasing_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> v(n);
for (long long i = 0; i < n; i++) {
cin >> v[i];
}
for (long long i = 1; i < n - 1; i++) {
... | ALGO | 0.999979 | 4.256353 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-06-27T03:17:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1fe43606a6ed... |
33268828-b205-4d5c-a020-0607e1b85f69 | tonhao-dev/Made-In-Acre | codeforces/Round944/D/main.cpp | /**
* [Link]
* [Título da questão]
* [Assuntos]
*/
#include <bits/stdc++.h>
using namespace std;
#define SPEED cin.tie(0)->sync_with_stdio(0);
#define DEBUG true
#define db(x) \
if (DEBUG) cout << #x << ": " << x << endl
#define dbpair(x) \
if (DEBUG) cout << #x << ": " << x.f << ", " << x.s << endl
#def... | ALGO | 0.999911 | 4.089247 | {
"github_metadata": {
"branch": "main",
"commit_count": 418,
"repo_created_at": "2022-09-23T02:25:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c4d53aabc... |
060b7366-e7bc-4501-a7a6-a739773af398 | arborx/ArborX | src/spatial/detail/ArborX_MortonCode.hpp | /****************************************************************************
* Copyright (c) 2025, ArborX authors *
* All rights reserved. *
* *
* This ... | ALGO | 0.992137 | 7.270241 | {
"github_metadata": {
"branch": "master",
"commit_count": 4283,
"repo_created_at": "2019-04-09T20:44:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 207,
"forks": 43,
"issues": 27,
"pull_requests": 16
},
"file_meta": {
"content_id": "674... |
50f574f1-b8db-4e6c-b69a-8298fcbeb72e | vishesh312/cp-problems | PRIMESETMUL/gen.cpp | #include "testlib.h"
#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define s... | ALGO | 0.994608 | 3.12581 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-01-03T18:27: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": "0a238115e212... |
65d4aec6-93d1-45cb-9a54-db071010d640 | BHARAT0M/Lab | Al/Algorithms/randomQuickSort.cpp | /*
Roll no :- 194CA014
randomized Qucik sort
For this program we need two files input.txt , output.txt
input file contain data and output file is empty
*/
#include<bits/stdc++.h>
using namespace std;
int Random_Partition(int arr[], int low, int high)
{
srand(time(NULL));
int random = low + rand() % (high - low)... | ALGO | 0.999761 | 4.671988 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2020-01-27T18:32: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": "8c7058ace... |
8534672c-d328-4534-917f-ab229baafb2b | mauriciopara/cssprojects | programação/capítulo8/8_9.cpp | #include<iostream>
#include<conio.h>
using namespace std;
enum Top{
soma=1, subtracao, multiplicacao, divisao
};
struct Tvalue{
float n, d;
enum Top x;
} ;
struct Tvalue valor( struct Tvalue P1, struct Tvalue P2)
{
enum Top x;
struct Tvalue resposta;
switch(x)
{
case soma: resposta= ((P1.n / P2.n)... | ALGO | 0.988557 | 3.765022 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-01-27T12:23: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": "d5f66987cab9... |
2adff6fe-ee6b-4646-8104-be5d4e39c3d4 | wlhee/practice-on-programming | week4/CBigNum.cpp | #include "CBigNum.hpp"
using namespace std;
CBigNum::CBigNum(const string num_string) {
char c_sign = num_string[0];
int pos = 0;
if (c_sign == '+') {
length = num_string.length() - 1;
pos = 1;
sign = POSITIVE;
}
else if (c_sign == '-') {
length = num_string.length() - 1;
pos = 1;
... | ALGO | 0.999671 | 4.241951 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2014-03-26T18:05: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": "8ce4eb9d3... |
0a970ba0-1595-4dc4-9282-fb1ea86bcf88 | gornad/Concurrent-Scientific-Programming | Project4/Project4-Parallel_Listranking.cpp | //Name: <NAME>
//Project4-ListRankSerial
#include <stdlib.h>
#include <sys/time.h>
#include <stdio.h>
#include <omp.h>
#define LENGTH 10000000
#define NUM_THREADS 32
void ListRankSerial(float *pf_output, float *pf_input, unsigned int ui_len);
void get_walltime(double* wcTime) {
struct timeval tp;
gettimeofday(&... | ALGO | 0.999871 | 3.71024 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-03-17T01:42: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": "083d7b1ffd... |
b48161ba-4d07-4b74-b504-3a61149c1d3d | vineethkumart/snippet | Array/moores_voting.cpp | // This finds the majoiry element in a given array
// i.e any element occuring more than n/2 times
// idea is that me will contrinute n/2 times to the count and collective contribution of all remainign elements wil be < n/2 and hence
// e will be the majority element if at all exists
//
//
int majority(int *a, int siz... | ALGO | 0.999713 | 4.405257 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2015-12-03T02:04: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": "5a6389d5d... |
95f28774-e156-437c-bd96-81774a00efb5 | Programavimas-CPP-Vadovelis/Vadovelyje-naudojamas-programinis-kodas | 10 skyrius/6 programa/10skyriaus6programa.cpp | import <iostream>;
import <format>;
using std::cout;
using std::endl;
using std::format;
//
int main() {
// Burbulo algoritmo funkcijos prototipas
void bubbleSort(size_t, double*);
//
double array[] = { 32., 70., 0., -45., 15. };
//
size_t n = (sizeof array) / (sizeof array[0]);
//
cout << "Pradinis masyvas:\n"... | ALGO | 0.999699 | 5.399743 | {
"github_metadata": {
"branch": "main",
"commit_count": 144,
"repo_created_at": "2022-07-14T09:59: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": "e0fdd41829... |
6166bc20-7892-40b6-bffa-5b547f108e6c | Rockroyal305/Practice-Problems | Mixmilk.cpp | #include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
int main()
{
int capacities[3];
int amounts[3];
int cycle = 0;
//1st row is for
for(int i = 0; i < 3; i++)
{
cin >> capacities[i];
cin >> amounts[i];
}
for... | ALGO | 0.999977 | 3.114063 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-09-01T04: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": "6ec44b2081af... |
e8542f0f-1d1c-47e8-8a76-e55ad86b494e | kovaxis/apuntes-bella-y-sensual | math/discrete-log.cpp | // discrete logarithm log_a(b).
// solve b ^ x = a (mod M) for the smallest x.
// returns -1 if no solution is found.
//
// time: O(sqrt(M))
ll dlog(ll a, ll b, ll M) {
ll k = 1, s = 0;
while (true) {
ll g = __gcd(b, M);
if (g <= 1) break;
if (a == k) return s;
if (a % g != 0) re... | ALGO | 0.999934 | 4.37754 | {
"github_metadata": {
"branch": "main",
"commit_count": 164,
"repo_created_at": "2023-04-22T16:23:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9dd7edb63b... |
b9d8c8fa-d1ba-4bc2-8806-7f078cf89de5 | Badrinath-Chandi/mygit | avltree.cpp | /* AVL Tree Implementation in C++*/
#include<iostream>
#include<stdio.h>
using namespace std;
class treeNode
{
public:
int data;
int height;
treeNode* left;
treeNode* right;
treeNode(int data) :data(data), left(NULL), right(NULL),height(1) {}
int getBalance(treeNode* left, treeNode* right)
{
if (left ==... | ALGO | 0.99964 | 5.488656 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2015-04-04T10:50: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": "a5389fbeb4... |
d58cc8d6-e67e-43c2-acaa-2d7044a24ee9 | Nattchi/Atcoder | Medium100_2020-8-24/AC_ABC064_C.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n);
map<string, int> m;
m.insert(make_pair("red", 0));
m.insert(make_pair("orange", 0));
m.insert(make_pair("yellow"... | ALGO | 0.957321 | 3.676155 | {
"github_metadata": {
"branch": "master",
"commit_count": 140,
"repo_created_at": "2020-03-15T05:27:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73c7febb... |
f996f340-7648-47be-9d72-ac58f2962cae | ishandutta2007/codeforces-r | rns_cus/normal/794/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define N 400040
#define left(I) (I<<1)
#define right(I) (I<<1|1)
long long sum[N][11], tmp[11];
int u, v, L, R, a[N][11], type;
int n, q, arr[N];
void push_down(int id){
for(int i = 0; i <= 9; i ++) tmp[i] = sum[left(id)][i], sum[left(id)][i] = 0;
for(int i = 0; i <= ... | ALGO | 0.999534 | 4.709431 | {
"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": "bfb2286ea336... |
8a838b87-1bc2-41c1-9fce-3691233ebba7 | piotrsznapka/pss | marcin_17_04/Laboratorium/obiekt.cpp | #include "obiekt.h"
#include <iostream>
#include "generator.h"
#include <math.h>
#define PI 3.14159265
using namespace std;
// konstruktor obiektu ARX
ObiektARX::ObiektARX(int k ,vector<double> WielomianA, vector<double> WielomianB)
{
dA = WielomianA.size();
dB = WielomianB.size()-1;
W_A = Wielomia... | ALGO | 0.99777 | 4.620659 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2012-04-02T20:06:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ddb4b318f... |
d5f97dd2-eaf2-486b-9a7a-95dc8f701fad | RockLloque/Exercism | cpp/crypto-square/crypto_square.cpp | /*
* =====================================================================================
*
* Filename: crypto_square.cpp
*
* Description:
*
* Version: 1.0
* Created: 01.11.2015 21:12:06
* Revision: none
* Compiler: gcc
*
*
* ======================================... | ALGO | 0.999554 | 4.930959 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-06-03T17:46: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": "55e2f8d94cba... |
69f15f16-9ec6-4d51-9ee0-37873cbefe8e | liardanc3/algorithm | cpp/15971.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
int n, a, b, dist[100001], s, len, e, mx;
vector<pii> vect[100001];
void dijkstra() {
priority_queue<piii, vector<piii>, greater<piii>> pq;
pq.push({ { 0,a }, 0 });
while (!pq.empty()) {
int now = pq.top().first.... | ALGO | 0.999414 | 3.629621 | {
"github_metadata": {
"branch": "master",
"commit_count": 673,
"repo_created_at": "2021-06-30T06:52:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eaecbec8... |
c7689d4f-8a45-4e70-92e5-18032e63e8b9 | CaptNikh/LeetCode-Practice | 139-word-break/139-word-break.cpp | class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
// we are going to do the bottom up approach starting from the end
// [a b c d e f g h] if a word starting from an index i is found in the dictionary we check if the word starting
// i + words size is al... | ALGO | 0.997976 | 5.524129 | {
"github_metadata": {
"branch": "main",
"commit_count": 528,
"repo_created_at": "2021-11-28T06:02: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": "cbbcd4278c... |
05441d9d-1925-4d44-a7c9-be678357babc | manumerous/OrbiSim | src/celestial_body.cpp | #include <SFML/Graphics.hpp>
#include <eigen3/Eigen/Dense>
#include <iostream>
#include "celestial_body.hpp"
// Gravitational Constant in N*m^2/kg^2
float G = 6.67430f * pow(10.0f, -11.0f);
void CelestialBody::setPosition(Eigen::Vector3d new_pos)
{
pos_ = new_pos;
shape_.setPosition(sf::Vector2f(pos_(0), pos_... | ALGO | 0.995043 | 5.621083 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2020-04-03T20:46:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1eac51864... |
1567f8b1-8047-48e0-8ba3-0c0f331ef83b | graph-alg/graph-algorithms | include/multiple_core/branch_multiple_core_decomposition.h | /******************************************************************************************************************
* @copyright : Boost Software License
* @file : basic_multiple_core_decomposition.h
* @brief : a index method for temporal core decomposition
* @version : 1.0
* @date : 2021/08/09
***... | ALGO | 0.999105 | 4.846806 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2022-05-31T08:59: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": "ec8dbc75d71... |
8c281a34-fc2a-4858-9541-4ea98c8a1881 | bytebeaver/leetcode-solutions | 0019-remove-nth-node-from-end-of-list/0019-remove-nth-node-from-end-of-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) {}
* };
*/
//STRIVER
//BRUTE FORCE ----> MY OWN SOLUTION ... | ALGO | 0.999982 | 6.136563 | {
"github_metadata": {
"branch": "main",
"commit_count": 343,
"repo_created_at": "2024-09-26T17:48:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7acdb1cdab... |
98e706af-2362-4f65-b969-28bcaabd7088 | shreya-chinnari/placement-cpp | prep/Strivers/2ptr-SlidingWindow/08-better-substrings-all-3-chars.cpp | // TOTAL Number of Substrings containing all 3 characters
// TC : O(n^2) {worst}
// TC : O(n^2) {best}
// SC : O(1)
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int countSubstrings_little_opt_hash(string s)
{
int count = 0;
int n = s.size();
for (int i = 0; i < n; i++... | ALGO | 0.999332 | 5.524954 | {
"github_metadata": {
"branch": "main",
"commit_count": 341,
"repo_created_at": "2025-05-10T06:55: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": "26a6e4fd99... |
5f09104c-e56a-4ccc-8796-90e433b6714a | ellynhan/challenge100-codingtest-study | hall_of_fame/wi-seong-cheol/BOJ/0x0D Simulation/17281.cpp | //
// 17281.cpp
// wi-seong-cheol
//
// Created by wi_seong on 2022/11/23.
//
/*
[Input]
2
4 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0
[Output]
1
*/
// 시간복잡도: O((2 ^ n) * n)
// 최악시간: 51,200
// 난이도: Gold 4
// Timer: 1h
// Url: https://www.acmicpc.net/problem/17281
#include <iostream>
#include <algorithm>
using name... | ALGO | 0.999943 | 4.393699 | {
"github_metadata": {
"branch": "master",
"commit_count": 6737,
"repo_created_at": "2021-08-31T03:30:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 212,
"forks": 107,
"issues": 0,
"pull_requests": 3
},
"file_meta": {
"content_id": "19d... |
7440a962-d750-4767-bd17-ae4a0417a29b | siara-cc/sqlite_blaster | src/sqib/btree_handler.h | #ifndef SIARA_BP_TREE_H
#define SIARA_BP_TREE_H
#include <cstdio>
#include <cstring>
#include <iostream>
#include <stdint.h>
#include "lru_cache.h"
#define BPT_LEAF0_LVL 14
#define BPT_STAGING_LVL 15
#define BPT_PARENT0_LVL 16
#define BPT_BLK_TYPE_INTERIOR 0
#define BPT_BLK_TYPE_LEAF 128
#define BPT_BLK_TYPE_OVFL 255... | ALGO | 0.94871 | 3.652553 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2022-08-06T06:02:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 183,
"forks": 7,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "4b1099db7... |
dbe550ea-0cb2-4766-adb0-de9e53ecb3c7 | rianbowgift/Algorithm_Cpp | Algorithm_Cpp/Baekjoon/BFS/BJ_13565.cpp | //#include<iostream>
//#include<algorithm>
//#include<queue>
//#include<string>
//using namespace std;
//#define X first
//#define Y second
//int board[1002][1002];
//bool vis[1002][1002];
//int n, m;
//int dx[4] = { 1,0,-1,0 };
//int dy[4] = { 0,1,0,-1 };
//
//int main() {
//
// cin >> n >> m;
//
//
// for (int i = 0;... | ALGO | 0.999945 | 3.854156 | {
"github_metadata": {
"branch": "master",
"commit_count": 671,
"repo_created_at": "2022-03-15T10: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": "8478c29c... |
7bfce685-b390-4c6b-a208-e2b6bff10649 | Viswanath1680/LeetCode-problems | 0662-maximum-width-of-binary-tree/0662-maximum-width-of-binary-tree.cpp | class Solution {
public:
// Biggest Hint: assign col number to each node
int widthOfBinaryTree(TreeNode* root) {
if( !root ) return 0;
unsigned long long ans = 0;
queue<pair<TreeNode*, unsigned long long>> q;
q.push({root, 0});
while( q.size() ){
int n = q.siz... | ALGO | 0.999765 | 5.462224 | {
"github_metadata": {
"branch": "phase2",
"commit_count": 1773,
"repo_created_at": "2024-12-11T12:00:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3aad278... |
1d8496d2-b322-413f-b9d8-5948e80c9803 | LvJC/myLittle | 笔试/CTRIP/trainSchedule.cpp | 作者:Blue5437
链接:https://www.nowcoder.com/discuss/245173?type=all&order=time&pos=&page=1
来源:牛客网
//示例输入:"aabbcddc"
//示例输出:2, 2, 4
// 两次遍历,第一次统计字母个数,第二次维护cur 和 tar,cur表示当前字母个数,tar表示目标个数(例如已包含a,则全部a都要包含),
// cur==tar时划分并清0
int main() {
string s;
cin >> s;
unordered_map<char, int> m;
unordered_map<char, bo... | ALGO | 0.999646 | 3.135212 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2019-02-22T02:18:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7478287f6... |
e811b07c-73c0-4b21-a3b6-647aa32e6a34 | Shloub/metalang | out/euler17.cc | #include <iostream>
#include <vector>
int main() {
std::cout << 3 + 16 << "\n";
int one_to_nine = 3 + 33;
std::cout << one_to_nine << "\n";
int one_to_ten = one_to_nine + 3;
int one_to_twenty = one_to_ten + 73;
int one_to_thirty = one_to_twenty + 6 * 9 + one_to_nine + 6;
int one_to_forty = ... | ALGO | 0.997606 | 3.254696 | {
"github_metadata": {
"branch": "master",
"commit_count": 1424,
"repo_created_at": "2017-10-14T13:33:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "50b29dd... |
40a673e4-e6f4-4612-a925-c879273cf63c | kkisic/Procon | CPP/yukicoder/ac/533.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
const int INF = 1e15;
const int MOD... | ALGO | 0.999984 | 3.752141 | {
"github_metadata": {
"branch": "master",
"commit_count": 1105,
"repo_created_at": "2017-11-28T11:11:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e2a81b... |
042a0688-3c41-4cd9-acec-3c802b431e02 | srrishtea/LeetCode-Grind | 128-longest-consecutive-sequence/longest-consecutive-sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
int n = nums.size();
if (n == 0) return 0;
unordered_set<int> st;
for (int x : nums) {
st.insert(x);
}
int ans = 0;
// Iterate through the set
for (auto it : st... | ALGO | 0.999985 | 6.493006 | {
"github_metadata": {
"branch": "main",
"commit_count": 262,
"repo_created_at": "2024-12-28T09:23:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4598c06c99... |
d682c2af-e6c1-4303-9d99-6850cccc5de7 | amazy2596/Algorithm-Competition | program_2025/program_05/program_31/P_3435.cpp | #include <bits/stdc++.h>
#define uint uint64_t
// #define int long long
using namespace std;
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
const int inf = 1e18;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoc... | ALGO | 0.999927 | 4.173951 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2025-06-20T15:02:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1d2c3623d55... |
ccb8ef3c-a1e3-43db-a489-b7bee061a5ec | Archit-arch/RM_TaskPhase | hill.cpp | #include <iostream>
bool isHillNumber(int number) {
bool ascending = true;
bool descending = false;
int lastDigit = number % 10;
number /= 10;
while (number > 0) {
int currentDigit = number % 10;
number /= 10;
if (ascending) {
if (currentDigit >= lastDigit) {
... | ALGO | 0.9998 | 4.443936 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-06-06T12:00: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": "eee5a4d25d48... |
7f0ff551-e4e2-45d7-9c2f-ba8ec25b6edc | statco19/codeforces-problems | 1795B.cpp | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define vt vector
#define ll long long
#define pb push_back
#define ioa insert_or_assign
#define umap unordered_map
#define prq priority_queue
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define rev(c) (c).rbegin(), (c)... | ALGO | 0.99997 | 4.499623 | {
"github_metadata": {
"branch": "main",
"commit_count": 154,
"repo_created_at": "2022-10-22T03:21:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b59d577e15... |
8962dd3e-54c3-4794-bce2-d8e56579601a | LambertPRC/SecureCommunication | Alice/EncryptDecrypt.cpp | #include <iostream>
#include <ctime>
#include "EncryptDecrypt.h"
/**
* 函数功能:加密运算
*/
char* EncryptDecrypt::encrypt(char* input) {
std::string str(input);
std::cout << ">";
//std::cin >> str;// 输入明文
if (!std::cin || !islegal(str))
return false;
BigInteger m(str);
clock_t start = clock();
BigInteger c = rsa.en... | TOOL | 0.988555 | 3.8496 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-07-26T16:22: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": "0166e5b0ac... |
33dea5e4-27e2-4100-a3ac-e40cf3ec324e | BekzhanKassenov/olymp | informatics.mccme.ru/Graphy/MaxFlow/E/E.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
const int MAXN = 5 * 100010;
const int MAXM = 4 * MAXN;
struct MaxFlow {
int to[MAXM];
int cap[MAXM], flow[MAXM];
int lastEdge;
int S, T, lim;
vector <int> g[MAXN];
... | ALGO | 0.999984 | 4.536864 | {
"github_metadata": {
"branch": "master",
"commit_count": 426,
"repo_created_at": "2015-07-29T15:25:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "04f5ca8d... |
e3094380-99e4-4602-a359-9da9695bd777 | pravin-pandey/brainwaves | ft.ino | #include "arduinoFFT.h"
#define SAMPLES 8 //Must be a power of 2
#define SAMPLING_FREQUENCY 768 //Hz, must be less than 10000 due to ADC
arduinoFFT FFT = arduinoFFT();
unsigned int sampling_period_us;
unsigned long microseconds;
double vReal[SAMPLES];
double vImag[SAMPLES];
void setup() {
Seri... | ALGO | 0.996979 | 5.077294 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2018-12-30T14:24:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1811b3467... |
2e977d71-ddfa-4eb9-b092-18719fc771a1 | raincross7/code-similarity | codes/train_code/problem181/problem181_307.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ret = 1; // number of biscuit
if (
B-A > 2 // 錬金したほうが得
|| K < A - 1 + 2// 錬金できるか A枚のビスケット, -1 最初の一枚, +2 錬金に必要な回数
) {
// A になるまでたたく
K -= (A - 1);
ret... | ALGO | 0.999683 | 3.484259 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aaf80b7a5e72... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.