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 |
|---|---|---|---|---|---|---|---|
f23d64d5-24a7-4a92-b7bf-6e6587c00d17 | prashivg-04/DSA-C-Plus-Plus | Greedy Algorithms/fractionalKnapsack.cpp | //Fractional Knapsack
//Put items in the knapsack to get the maximum total value in the knapsack
#include<iostream>
#include<vector>
using namespace std;
bool compare(pair<double, int> p1, pair<double, int> p2) {
return p1.first > p2.first;
}
int fractionalKnapsack(vector<int> val, vector<int> wt, int W) {
i... | ALGO | 0.999985 | 5.046124 | {
"github_metadata": {
"branch": "main",
"commit_count": 176,
"repo_created_at": "2024-08-06T19:26: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": "05978b81ce... |
b33aa8d6-2380-437b-8e92-c2b554bc6a72 | felipethome/coding-interview-solutions | src/cpp/dp-unique-path-grid/dp.cpp | /**
* Given a grid of size m * n, lets assume you are starting at (1,1) and your
* goal is to reach (m,n). At any instance, if you are on (x,y), you can either
* go to (x, y + 1) or (x + 1, y).
*
* Now consider if some obstacles are added to the grids. How many unique paths
* would there be? An obstacle and empt... | ALGO | 0.999559 | 5.516001 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2019-06-09T17:50:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a80bb920e... |
e6a1c8f8-740c-430a-b7a7-a7ea9bb086aa | annebell881/CSCE-221-Data-Structures-and-Algorthims | Assignment Five/BinaryHeap.h | #ifndef BINARYHEAP_H
#define BINARYHEAP_H
#include <stdexcept>
#include <iostream>
#include <vector>
#include <math.h>
struct EmptyBH: public std::runtime_error{
explicit EmptyBH(char const *msg = nullptr):runtime_error(msg){}
};
/*
* Binary Heap class
*/
template <typename T>
class BinaryHeap {
public:
... | ALGO | 0.996079 | 4.866839 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-05-29T02:33: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": "3eb213adcc4... |
45803ed1-4bc0-47c0-8adf-b76df438752f | DionysiosB/CodeForces | 1200-1299/1244D-PaintTheTree.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
typedef long long ll;
int main(){
ll n; scanf("%lld", &n);
std::vector<std::vector<ll> > cost(4, std::vector<ll>(n + 1, 0));
for(ll row = 1; row <= 3; row++){for(ll p = 1; p <= n; p++){scanf("%lld", &cost[row][p]);}}
std::vector<std::vector<ll> ... | ALGO | 0.999894 | 3.468234 | {
"github_metadata": {
"branch": "master",
"commit_count": 4487,
"repo_created_at": "2013-06-27T18:15:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 690,
"forks": 163,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ae... |
104ef6db-98e0-47bc-bd12-e910de9d2ffd | RulerOfCakes/BaekjoonHub | 백준/Gold/2931. 가스관/가스관.cc | #include <bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
using ll = long long;
using pl = pair<ll, ll>;
int T, N, M;
int sx, sy, ex, ey;
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
char arr[30][30];
vector<int> ans;
bool visited[30][30];
int ax = -1, ay = -1;
bool valid(int x, int y, bool um = fa... | ALGO | 0.999958 | 3.7664 | {
"github_metadata": {
"branch": "main",
"commit_count": 57,
"repo_created_at": "2022-07-09T11:05: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": "7b4b6d4bc38... |
d8a287d0-6abc-4d14-80dd-350b9d4e1e66 | sandhu28/APNA-COLLEGE-DSA-SHEET-QUES | Dynamic Programming/Hard/Minimum Insertion Steps to Make a String Palindrome.cpp | #include <iostream>
#include <bits/stdc++.h>
#define pii pair<int, int>
#define lli long long int
#define li long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>
#define vlli vector<lli>
#define vli vector<li>
#define all(x) (x).begin(), (x).end()
#define fo(i, n) for (int... | ALGO | 0.999984 | 3.853354 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2022-05-26T17: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": "b6f239f9c... |
4186947f-1bcf-4a56-a44f-1d92ce29984f | dotnet/corert | src/Native/gc/unix/cgroup.cpp | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*++
Module Name:
cgroup.cpp
Abstract:
Read memory and cpu limits for the current process
--*/
#ifdef __FreeBSD__
#define _WITH_GETLINE
#endif
#include <cstdint>
#include... | TOOL | 0.946946 | 6.47823 | {
"github_metadata": {
"branch": "master",
"commit_count": 10408,
"repo_created_at": "2015-09-15T23:10:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2901,
"forks": 509,
"issues": 313,
"pull_requests": 0
},
"file_meta": {
"content_id": "... |
0911320e-58e9-4d54-8396-32c9bf9c0075 | Mybro007/Algorithms-and-Data-Structures | Homework 8/Homework 8.1/main.cpp | #include<iostream>
#include<fstream>
class Orgraph
{
private:
int size{};
int* vertices;
int** adjacent;
public:
Orgraph()
{
std::ifstream fin("input.txt");
if (!fin.is_open())
{
std::cout << "File with data doesn't exist!\n";
exit(-1);
}
fin >> size;
vertices = new int[size];
for (int i = 0... | ALGO | 0.9998 | 4.4261 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-08-16T09:49: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": "bb2f5c00997e... |
b7e22e13-7149-4578-90f5-36084502203a | OP-DSL/OPS | apps/c/CloverLeaf_3D_HDF5/clover_leaf.cpp | /* Crown Copyright 2012 AWE.
This file is part of CloverLeaf.
CloverLeaf 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 3 of the License, or (at your option)
any later version.
Clove... | ALGO | 0.977998 | 5.468862 | {
"github_metadata": {
"branch": "develop",
"commit_count": 2896,
"repo_created_at": "2014-02-17T12:44:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 69,
"forks": 43,
"issues": 4,
"pull_requests": 2
},
"file_meta": {
"content_id": "5672f... |
6fe6fcb8-c3a4-4b46-839d-7b5fe621493b | ishandutta2007/codeforces-i | i_love_tanya_romanova/normal/538/B.cpp | /*
Out on the wiley, windy moors
We'd roll and fall in green
You had a temper, like my jealousy
Too hot, too greedy
How could you leave me?
When I needed to possess you
I hated you, I loved you too
Bad dreams in the night
They told me I was going to lose the fight
Leave behind my wuthering, wuthering
Wuthering Heights... | ALGO | 0.999912 | 3.447632 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T05:39: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": "822583ef4d07... |
444361dc-462b-4a06-892c-d950aef5082c | k1810179/PG_contest | APG4b/GridCompression_B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int H, W;
cin >> H >> W;
vector<vector<char>> table(H, (vector<char>(W, '-')));
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
cin >> table[i][j];
}
}
set<int> setH, setW;
for(int i = 0; i < H; i... | ALGO | 0.999971 | 3.681184 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-04-03T18:48: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": "e9a243d8b24... |
6cb59865-e70c-4b2d-9491-fae22cdf437f | PoundKey/Algorithms | LeetCode/C++/11-Container With Most Water.cpp | // Thoughts: Notice that i to j are sorted, two pointer strategy can be applied under such circumstance.
// the width, j - i could not get any larger, we could only hope that the height gets larger.
// moving two pointers to the middle to find if such height exists.
class Solution {
public:
int maxArea(vector<int>&... | ALGO | 0.999996 | 6.776124 | {
"github_metadata": {
"branch": "master",
"commit_count": 346,
"repo_created_at": "2014-11-27T07:34:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0119244f... |
1fd959b2-813f-4b5b-86ab-d095f101a276 | Jestin-Joseph/leetcode | median-of-two-sorted-arrays.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Solution
{
public:
double findMedianSortedArrays(vector<int> &nums1, vector<int> &nums2)
{
vector <int> combined;
int i = 0;
int len = max(nums1.size(), nums2.size());
while(i < len){
... | ALGO | 0.999989 | 5.963393 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2024-12-10T07:02:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3665ba19de5... |
625c4c5a-3292-490c-90ea-1673a4d817d1 | Rockstatata/CP-solves | Greedyalgorithm/interviewbit/gasstation.cpp | #include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v3... | ALGO | 0.999955 | 3.894913 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2023-10-30T23:31: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": "2963f47ca7a... |
71b03158-f254-49e2-b9da-dd26a8f77eb7 | TISparta/online-judge-solutions | Codeforces/Round-132-Div2/C.cpp | // Tags: Brute Force, Math
// Difficulty: 5.0
// Priority: 1
// Date: 19-08-2021
#include <bits/stdc++.h>
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
... | ALGO | 0.999632 | 4.635672 | {
"github_metadata": {
"branch": "master",
"commit_count": 121,
"repo_created_at": "2017-09-10T04:52:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6dc94c9b... |
2c5b61db-5b56-403b-82a6-a7bcc67c4e54 | alibaba/GraphScope | analytical_engine/test/run_vy_app_local_vm.cc | /** Copyright 2020 Alibaba Group Holding Limited.
*
* 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 law... | ALGO | 0.985925 | 5.445539 | {
"github_metadata": {
"branch": "main",
"commit_count": 2271,
"repo_created_at": "2020-10-28T03:19:33.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3461,
"forks": 458,
"issues": 418,
"pull_requests": 28
},
"file_meta": {
"content_id": "43... |
28f252dc-66df-4bf5-a389-9f2c7ce1486a | dougshidong/PHiLiP | src/reduced_order/pod_adaptive_sampling.h | #ifndef __POD_ADAPTIVE_SAMPLING__
#define __POD_ADAPTIVE_SAMPLING__
#include <deal.II/numerics/vector_tools.h>
#include "parameters/all_parameters.h"
#include "pod_basis_online.h"
#include "rom_test_location.h"
#include <eigen/Eigen/Dense>
#include "nearest_neighbors.h"
#include "adaptive_sampling_base.h"
namespace P... | ALGO | 0.996902 | 6.458112 | {
"github_metadata": {
"branch": "master",
"commit_count": 1502,
"repo_created_at": "2018-12-17T20:30:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 49,
"forks": 40,
"issues": 80,
"pull_requests": 14
},
"file_meta": {
"content_id": "c7d... |
997a067f-d468-46eb-abf0-e7c83a5c54a0 | yakult-lily-yu/intro_to_computer2 | hw5/hw5_e24066470.cpp | #include"Matrix.h"
#include<iostream>
#include<vector>
Matrix::Matrix()//將data存入2*2皆為零
{
data = new double*[2];
for (int i = 0; i < 2; i++)
{
data[i] = new double[2];
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
data[i][j] = 0;
}
}
}
Matrix::matrix(int row, int col)//設定大小,並使初始為零
{
... | TOOL | 0.91828 | 3.234025 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-10-04T19:21: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": "75e244e286... |
7b63b812-0e59-4b2c-9ea7-fe9f435eab12 | tensor-compiler/taco | include/taco/lower/lowerer_impl_imperative.h | #ifndef TACO_LOWERER_IMPL_IMPERATIVE_H
#define TACO_LOWERER_IMPL_IMPERATIVE_H
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <memory>
#include <taco/index_notation/index_notation.h>
#include "taco/lower/iterator.h"
#include "taco/util/scopedset.h"
#include "taco/util/uncopyable.h"
#includ... | ALGO | 0.958297 | 5.88472 | {
"github_metadata": {
"branch": "master",
"commit_count": 2832,
"repo_created_at": "2016-09-25T23:35:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1312,
"forks": 195,
"issues": 182,
"pull_requests": 20
},
"file_meta": {
"content_id": "... |
e25108c1-1fa2-4008-85de-99386829c6f3 | liangsheng/ACM | template3/atcoder_begin204_E_堆优化的spfa.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 100005;
const LL INF = ~0ULL >> 2;
int n, m;
vector<tuple<int, int, int> > g[N];
LL spfa() {
priority_queue<pair<LL, int>> q;
vector<LL> dis(n + 1, INF);
auto push = [&](int u, LL d) {
if (d < dis[u]) {
... | ALGO | 0.999972 | 3.831726 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2013-04-10T03:54: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": "84a8e214a... |
b8c21e2a-d15f-4f50-bee0-b7fb1995df37 | CGAL/cgal | Mesh_3/doc/Mesh_3/Concepts/BisectionGeometricTraits_3.h | /*!
\ingroup PkgMesh3SecondaryConcepts
\cgalConcept
The concept `BisectionGeometricTraits_3` describes a geometric traits class
that provides the basic types and operations
to implement a model of `MeshDomain_3`
based solely on intersection detections.
Points in the non-empty intersections are herein computed
by bisec... | ALGO | 0.961142 | 7.377407 | {
"github_metadata": {
"branch": "master",
"commit_count": 113659,
"repo_created_at": "2014-10-01T12:22:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5443,
"forks": 1475,
"issues": 511,
"pull_requests": 136
},
"file_meta": {
"content_id... |
ad9a9891-519c-4be4-87d7-c8dedd08a887 | Zealoft/LeetSteps | leetcode/3_Sum.cpp | /*
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note: The solution set must not contain duplicate triplets.
For example, given array S = [-1, 0, 1, 2, -1, -4],
A solution set is:
[
[-1, 0, 1],
[-1, -1, ... | ALGO | 0.999889 | 5.823922 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2017-10-21T02:32: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": "8c4112bf7... |
96df5d9f-5cba-4f76-b580-ad384ddb68a0 | EdwardShiung/LeetCode | DataStructure_Algorithm/02_Data_Structure/05_Compared_Container/01_Vector/01_vectoc_Basic Knowledge.cpp | /*
1. std::vector 為動態陣列:
- 末位插入和末位刪除效率高
- 中間插入和中間刪除”最慢“
- "動態" 擴展容量(dynamic array),隨機訪問
*/
/*
操作整理:
添加元素 push_back(val) 在末尾添加一个元素
删除元素 pop_back() 删除末尾元素
获取大小 size() 返回当前元素个数
随机访问 v[index] 或 v.at(index) 获取指定位置的元素
插入元素 insert(pos, val) 在... | ALGO | 0.969749 | 4.90302 | {
"github_metadata": {
"branch": "main",
"commit_count": 485,
"repo_created_at": "2023-08-22T20:21:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc113a930d... |
6791ddf6-73af-4e0d-bbbd-9b7fe5c3ca1d | yzygitzh/oj_solutions | leetcode/src/63.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int m = obstacleGrid.size();
if (m == 0) return 0;
int n = obstacleGrid[0].size();
if (n == 0) return 0;
vector<vector<int> > pathNum(m, vector<int>(n, 0));
fo... | ALGO | 0.99954 | 5.622341 | {
"github_metadata": {
"branch": "master",
"commit_count": 219,
"repo_created_at": "2017-01-28T15:31:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "42d8ee9f... |
9dbd238d-380a-44b3-bafd-a3a246e755d6 | nawngs/CompetitiveProgramming | VNOI/atcoder_dp_e.cpp | #include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pll pair < ll, ll >
using namespace std;
const ll INF = 1e18;
const ll nmax = 1e7;
const ll MOD = 1;
ll n, w, dp[105][100005];
pll a[105];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> w;
for ... | ALGO | 0.999967 | 3.799259 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2021-06-19T07:51: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": "d3c4b5180fc... |
27102a4d-87f7-4f12-9de4-a859e928cca7 | mhromatka/Team-IV | ros/AU_UAV_stack/AU_UAV_ROS/src/FLtest.cpp | /*
First attempt at utilizing FuzzyLite library
*/
// standard c++ headers
#include <sstream>
#include <stdlib.h>
#include <time.h>
//blahblahblah
#include "AU_UAV_ROS/PlaneCoordinator.h"
#include "FUZZYLITE/FuzzyEngine.h"
#include "FUZZYLITE/FunctionTerm.h"
#include "FUZZYLITE/RuleBlock.h"
#include <limits>
voi... | ALGO | 0.988021 | 4.642336 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2012-06-05T18:41:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dda13a994... |
be3e4db5-63a9-4eb9-aa6d-c4f1cbee48a7 | utec-aed-2022-2/proyecto-proyecto-7 | Trie.h | #ifndef V1_TRIE_H
#define V1_TRIE_H
#include <iostream>
#include <stdexcept>
#include <vector>
#include "Record.h"
const unsigned ALPHA_SIZE = 26;
template<typename TV>
class Trie {
private:
struct TrieNode {
TrieNode** children;
bool is_end;
std::vector<TV> end_values;
TrieNod... | ALGO | 0.989793 | 6.109286 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-09-27T22:07:08.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "100029f1dac1... |
4d11670d-c0f0-4138-8b22-e77f85acbbab | harshits19/dsa | Stack/stack_vector.cpp | #include <iostream>
#include <vector>
using namespace std;
struct MyStack
{
vector<int> arr;
void push(int x)
{
arr.push_back(x);
}
int pop()
{
int res = arr.back();
arr.pop_back();
return res;
}
int peek()
{
return arr.back();
}
int s... | ALGO | 0.993508 | 3.996867 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-08-07T19:51: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": "287f0cad11ad... |
fa5f36de-9eec-492a-bda8-5c34839bbc41 | Faysoula/leeting-around | 0002-add-two-numbers/0002-add-two-numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(NULL) {}
* ListNode(int x) : val(x), next(NULL) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbers(Lis... | ALGO | 0.999947 | 6.084865 | {
"github_metadata": {
"branch": "main",
"commit_count": 432,
"repo_created_at": "2023-10-06T14:25: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": "d2bb936560... |
0b5dc0a7-6e68-406a-a477-dd4ebc89c99f | deemp/projects | cpp/0h-h1-solver/ohh1 solver.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_SZ = 14;
// ++Interface
void tutorial(bool isRobot);
bool checkIsRobot();
void read_(int t[][MAX_SZ], int n);
// read table and count colored cells
int count_(int t[][MAX_SZ], int n, int CNT);
void show_for_humans(int t[][MAX_SZ], int n);
void sho... | ALGO | 0.999971 | 4.105835 | {
"github_metadata": {
"branch": "main",
"commit_count": 1861,
"repo_created_at": "2022-12-24T16:03:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "d010ca0e0... |
b1a81bfa-b125-4fd5-8149-d7c79fe353a4 | deepak-ky/cpp-codes | cpp-codes/largest_number_in_k_swaps.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define varname(name) #name
#define mod 1000000007
#define wer(x) cout<<"\n"<<varname(x)<<" here : "<<x<<"\n"
#define asdf(a,n) ... | ALGO | 0.999946 | 4.305126 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-12-30T08:47:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "06b9d42f42ec... |
9c02e047-8cae-40d9-9bf9-779932f4fb9d | Novak666/leetcode | Binary Search/34 Find First and Last Position of Element in Sorted Array/opt.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
if(!nums.size())
return {-1, -1};
int i = 0, j = nums.size() - 1;
vector<int> ret(2, -1);
// Search for the left one
while (i < j)
{
int mid = (i + j) /2;
if (nums[mid] < tar... | ALGO | 0.999991 | 6.108926 | {
"github_metadata": {
"branch": "master",
"commit_count": 137,
"repo_created_at": "2018-08-18T03:50:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a7b251ea... |
d33c2fbd-66f7-439d-a203-cd76c7ad205d | burakturk3/ParalelKonvolusyon | ParalelKonvolusyon/paralelkonwinapithreads.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <chrono>
#include <windows.h>
using namespace std;
using namespace chrono;
// Rastgele bir dizi oluşturan fonksiyonu tanımla
vector<double> generateRandomArray(int size);
// Paralel konvolüsyon işlemini yapan fonksiyonu tanımla
DWORD ... | ALGO | 0.999747 | 4.705827 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-01-23T20:19: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": "f94811164f1a... |
dd7be06a-a256-4993-a428-6dc8ae1c9fac | ALLETttttt/KBTU_ALGOS | lab2/i.cpp | #include <bits/stdc++.h>
using namespace std;
struct node{
string word;
node* next;
node* prev;
node(string w){
word = w;
next = NULL;
prev = NULL;
}
};
node* head = NULL;
node* tail = NULL;
void add_front(string s){
node* newnode = new node(s);
if(not tail){head = newnode;tail = newnode;}
else... | ALGO | 0.987852 | 3.846396 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-04-20T08:44:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6a8a664487c5... |
8dfb3a50-6a56-4364-8180-43577c2681ac | adhiharika123/Daily-Coding-Cpp | C++ STL-Priority Queue.cpp | #include<bits/stdc++.h>
using namespace std;
void explainPriority_Queue(){
//MAX HEAP
priority_queue<int> pq;
//PUSH
pq.push(2);
pq.push(4);
pq.push(1);
pq.push(9);
pq.emplace(3);
//TOP
cout<<"The top element is: "<<pq.top()<<endl;
//POP
pq.pop();
cout<<"The top elem... | ALGO | 0.999657 | 5.106739 | {
"github_metadata": {
"branch": "main",
"commit_count": 46,
"repo_created_at": "2024-10-01T14:34: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": "e908804ff3f... |
7126f0e2-adb7-427e-b94f-e15217612485 | AMlhdSan/code | Luogu_P_1083.cpp | #include <bits/stdc++.h>
#define N 1000001
#define ll long long
#define ls (p << 1)
#define rs (p << 1 | 1)
#define mid ((l + r) >> 1)
using namespace std;
int n, m;
int a[N];
int tree[N << 2];
int lazy[N << 2];
int d, s, t;
bool flag = 0;
void upd(int p) {
tree[p] = min(tree[ls], tree[rs]);
}
void pushd(int p... | ALGO | 0.999942 | 3.992031 | {
"github_metadata": {
"branch": "master",
"commit_count": 376,
"repo_created_at": "2024-09-11T14:06:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c39af680... |
592f486a-6dd4-489c-9e62-f0accabe9fb8 | abhishekk7r/DSA-LeetCode | 724-find-pivot-index/724-find-pivot-index.cpp | class Solution {
public:
int pivotIndex(vector<int>& nums) {
int ans = -1;
long long totalSum = 0;
int leftSum = 0, rightSum = 0;
int n = nums.size();
//first we store the total sum in total sum variable
for(int i =0; i<n; i++)
{
... | ALGO | 0.999974 | 6.073331 | {
"github_metadata": {
"branch": "main",
"commit_count": 689,
"repo_created_at": "2022-07-31T17:40: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": "257a47a9a2... |
efedce7f-c9b8-4c20-b916-46c7c6aeec3b | vathanakphy/Advance-Algorithms-Bank-Management-System | pay-back-loan.hpp | #include <iostream>
#include <fstream>
#include <stdexcept>
#include <cmath>
using namespace std;
class Loan {
public:
double loanAmount;
int loanDurationDays;
double interestRate;
bool hasOverduePayments;
bool isBlacklisted;
User borrower;
// Define the loan's validation methods
b... | TOOL | 0.965554 | 5.018234 | {
"github_metadata": {
"branch": "main",
"commit_count": 232,
"repo_created_at": "2024-11-26T02:10:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "5ea6aa4ecf... |
20429990-8ae5-4aa4-810c-66c2c7b9bdff | EmreAyberk/School-Projects | C++/cmpe250-project2/main.cpp | #include <iostream>
#include <queue>
#include <iterator>
#include <fstream>
#include <algorithm>
#include <functional>
#include "Passanger.h"
#include "Luggage.h"
#include "Security.h"
#include "Event.h"
using namespace std;
bool flightPriority = false;
bool vipTicket = false;
bool onlineTicket = false;
bool comp... | ALGO | 0.972539 | 4.090031 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2018-11-03T11:04: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": "54cdffd49... |
342af3f1-561c-4e16-8e72-4ff8c72d4e8a | MaveLINN/House-Listing-BIT-Manipulations | HouseListing.cpp | # House-Listing-BIT-Manipulations
// B E A U T I F U L L I F E
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds ;
using namespace std ;
using ll = long long ;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set ;
const int N ... | ALGO | 0.968956 | 3.810165 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-06-13T18:13:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c48153c23... |
8617de0b-3f39-43b1-814a-4a822d69ca03 | tapasrnk/Design-and-Analysis-of-Algorithms-Lab | A5_20CS01064.cpp | /*
Course : Design & Analysis of Algorithms Lab
Assignment : 05
Date : February 1, 2022
Name : <NAME>
Roll No : 20CS01064
*/
#include<bits/stdc++.h>
using namespace std;
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
//Rat object
class Rat{
public:
int x, y, ... | ALGO | 0.999571 | 3.837084 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2022-01-17T06:52:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b799aec6... |
2d04dd9e-edfb-4e12-bb75-624ced18d33c | jangra8950/DSA- | linked list/Remove duplicates/dup.cpp |
#include<iostream>
#include<conio.h>
using namespace std;
class node
{
public:
int data;
node *next;
};
class linkedlist
{
private :
node *first;
public:
linkedlist()
{
first=NULL;
}
~linkedlist();
void display();
int length();
void insert(int index,int x);
void Rdu... | ALGO | 0.998906 | 3.244561 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-05-17T09:21: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": "c33d4f7c67ab... |
72d7af9d-16de-4968-8ae9-de4fd97a5877 | besnyder/tripoli | src/readers.cpp | /*
* readers.cpp
*
* Created on: Nov 6, 2014
* Author: ara
*/
#include <fst/fst.h>
#include "readers.h"
#include "tripoli.h"
using namespace std;
using namespace fst;
namespace fst {
template <typename T>
bool ReadIntVectors(const string& filename, vector<vector<T>> *vectors) {
ifstream strm(filename.c... | TOOL | 0.920097 | 5.529188 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2014-10-05T14:43: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": "c325fdd58... |
a9338183-d2cb-47fc-9ae2-fd155e15ea3a | AllisonLee0507/CPlusPlus_Language_Tutorial | 32.Heap/32-01.make_heap.cpp | #if 0
#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>
template <class T>
inline void PRINT_ELEMENTS(const T& coll, const char* optcstr = "")
{
typename T::const_iter... | ALGO | 0.999088 | 4.661195 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-08-22T04:21:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8f21e2fa414... |
a1664925-a9a2-4820-9d16-b6ad15bac88c | duckduckgo/cpp-libface | include/benderrmq.hpp | // -*- mode:c++; c-basic-offset:4 -*-
#if !defined LIBFACE_BENDERRMQ_HPP
#define LIBFACE_BENDERRMQ_HPP
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <stack>
#include <stdio.h>
#include <sstream>
#include <assert.h>
#include <include/types.hpp>
#include <include/utils.hpp>
#inc... | ALGO | 0.998758 | 3.589233 | {
"github_metadata": {
"branch": "master",
"commit_count": 159,
"repo_created_at": "2012-02-06T12:58:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 259,
"forks": 50,
"issues": 7,
"pull_requests": 4
},
"file_meta": {
"content_id": "ab3ebc... |
1c2403c8-3b2e-4add-a2df-c21c9d180bdf | rainbow-auto/rainbow-codes | Luogu/CF1646E.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bitset>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#pragma GCC Optimize(2)
using i64 = long long;
#define RainbowAutomatonDebugFlag
#d... | ALGO | 0.99993 | 4.118307 | {
"github_metadata": {
"branch": "master",
"commit_count": 749,
"repo_created_at": "2024-09-07T02:10: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": "6938cfe6... |
e8c83d3c-4476-46a2-9eca-e2267de5ab47 | ericljx2020-gmail/Leetcode_exercise | 971-shortest-bridge/shortest-bridge.cpp | class Solution {
public:
unordered_map<int, unordered_map<int, int>> st;
vector<vector<int>> g;
int n,m;
int dx[4] = {0,0,-1,1};
int dy[4] = {1,-1,0,0};
void bfs(int x, int y, int idx){
queue<pair<int,int>> q;
q.push({x,y});
st[x][y] = idx;
while (q.size()){
... | ALGO | 0.999973 | 5.116846 | {
"github_metadata": {
"branch": "master",
"commit_count": 1685,
"repo_created_at": "2023-08-21T15:17:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6ea394... |
cd6ca3db-1b8a-4b59-81f5-1d1512ad6696 | GuoYL36/algorithm | leetcode62_不同的路径.cpp | #include<vector>
#include<iostream>
using namespace std;
// 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为 “Start” )。
// 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish” )。
// 问总共有多少条不同的路径?
// 输入:m = 3, n = 7
// 输出:28
// 输入:m = 3, n = 2
// 输出:3
// 解释:
// 从左上角开始,总共有 3 条路径可以到达右下角。
// 1. 向右 -> 向下 -> 向下
// 2. 向下 -> 向下 -> 向右
// 3.... | ALGO | 0.999666 | 4.429686 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2017-05-04T12:03: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": "ea90ceee0... |
7420a49d-0c26-4cca-8b3f-652b1de646dd | y-kamiya/test | cpp/contest_challenge_book/2-3-9.cpp | /*
* トラック
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
const int N = 4;
const int L = 25;
const int P = 10;
int A[N] = {10,14,20,21};
int B[N] = {10,5,2,4};
int solve() {
int l = 0, p = P;
int count = 0;
priority_queue<int> pque;... | ALGO | 0.998217 | 3.267475 | {
"github_metadata": {
"branch": "master",
"commit_count": 357,
"repo_created_at": "2012-05-12T05:27:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 3
},
"file_meta": {
"content_id": "93b03606... |
d719231a-7999-4e85-9b2f-3c0aa96ad742 | ShortTailLab/ph-open | Classes/boost/geometry/multi/algorithms/distance.hpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 <NAME>, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 <NAME>, Paris, France.
// Copyright (c) 2009-2012 <NAME>, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c... | ALGO | 0.998316 | 7.015661 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2014-08-20T03:23:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 518,
"forks": 332,
"issues": 7,
"pull_requests": 0
},
"file_meta": {
"content_id": "7384df... |
2f917f41-e83c-4dcf-a23a-dde445c9d463 | nakatamaho/mplapack | examples/mplapack/04_NonsymmetricEigenproblems/Rgeev_readfromfile_double.cpp | //public domain
#include <mpblas_double.h>
#include <mplapack_double.h>
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#define DOUBLE_FORMAT "%+20.16e"
#define DOUBLE_SHORT_FORMAT "%+20.16e"
inline void printnum(double rtmp) { printf(DOUBLE_FORMAT, rtmp); }
// Matlab/Octave format
voi... | ALGO | 0.997398 | 3.684114 | {
"github_metadata": {
"branch": "master",
"commit_count": 2597,
"repo_created_at": "2017-03-29T02:30:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 95,
"forks": 13,
"issues": 22,
"pull_requests": 0
},
"file_meta": {
"content_id": "cef5... |
3cdb80bc-ca73-4bb0-8e52-71f0b3b5f04d | SirawitN/algorithmDesign | dc_one.c++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> Q = {0, 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111};
int one(int N)
{
if (N >= 1 && N <= 11)
{
return (N < 7) ? N : N - (2 * (N - 7) + 1);
} // trivial case
int idx = upp... | ALGO | 0.999573 | 3.523327 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-07-12T15:16: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": "c1629ea80fa... |
c774a750-5624-4b28-96b1-07cc51e30924 | lyccrius/OI-Solution | Luogu/P6617 查找 Search.cpp | #include <iostream>
#include <algorithm>
#include <set>
void promote() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
return;
}
typedef std::set<int>::iterator sit;
const int maxN = 5e5;
const int maxM = 5e5;
const int maxW = 5e5;
int n, m, w;
int a[maxN + 10];
int op;
int pos, v... | ALGO | 0.999996 | 4.52684 | {
"github_metadata": {
"branch": "main",
"commit_count": 653,
"repo_created_at": "2022-09-28T05:47: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": "7635d4f218... |
715c868c-7a25-4ffa-8c7e-f1b38721bf6e | Umangmodii/DSA-Concept | Linear_Search.cpp | // Linear Search Finding the Array
#include <iostream>
using namespace std;
// Base Case
void base(int arr[], int n, int val)
{
for (int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
}
// Linear Search
int linear_search(int arr[], int n, int val)
{
for (int i = 0; i < n; i++)
{
i... | ALGO | 0.999273 | 5.559616 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2024-01-26T14:50:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8680e6bea0d... |
eb26e2c8-02fa-4c8f-8007-4861e3d2556b | YoshikiTakashima/vert | benchmark/cpp_transcoder/PAIR_WITH_GIVEN_PRODUCT_SET_1_FIND_IF_ANY_PAIR_EXISTS/PAIR_WITH_GIVEN_PRODUCT_SET_1_FIND_IF_ANY_PAIR_EXISTS_towasm.cpp | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
int min(int x, int y) { return (x < y)? x: y; }
int max(int x, int y) { return (x > y)? x: y; }
int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}... | ALGO | 0.999312 | 5.287899 | {
"github_metadata": {
"branch": "main",
"commit_count": 101,
"repo_created_at": "2023-11-26T18: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": "2566506f31... |
97981900-7d05-4719-9a9a-980e6040c026 | jingminglake/Leetcode | mergekSortedLists/mergekSortedLists.cpp | #include <iostream>
#include <queue>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
class Compare {
public:
bool operator() (const ListNode* l1, const ListNode* l2) const {
return l1->val > l2-... | ALGO | 0.999913 | 5.487412 | {
"github_metadata": {
"branch": "master",
"commit_count": 1483,
"repo_created_at": "2017-02-24T09:35:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "23b756... |
1b081996-584d-4525-90e4-3c7bb63e6c9f | Jan-Piotraschke/2DTissue | src/simulation/2DTissue.h | #pragma once
// C++ standard library headers
#include <cmath>
#include <cstddef>
#include <fstream>
#include <iomanip>
#include <limits>
#include <map>
#include <memory>
#include <stdexcept>
#include <vector>
// Third-party library headers
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <filesystem>
// #incl... | ALGO | 0.975081 | 3.364385 | {
"github_metadata": {
"branch": "main",
"commit_count": 879,
"repo_created_at": "2023-05-26T09:00:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "a3e56e42c3... |
a1807f74-2c43-43aa-aa54-286d4a588e9c | snccekl/Algorithm | ATcoder/400/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
char s[1010][1010];
int G[1010][1010];
signed main(){
int n,m;
cin>>n>>m;
for(int i = 0;i<n;i++) cin>>s[i];
int a,b,c,d;cin>>a>>b>>c>>d;
--a,--b,--c,--d;
memset(G,0x3f,sizeof G);
G[a][b] = 0;
deque<pair<int,int>> q;
... | ALGO | 0.999829 | 4.322164 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-07-21T13:12: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": "15c1aa1b8b9a... |
1d6ee3a9-b864-4d29-9daf-10b0c1b30cd3 | ishandutta2007/codeforces-g | greenheadstrange/normal/1280/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define maxn 400010
#define ll long long
#define db double
#define vi vector<int>
#define pb push_back
#define mod 998244353
#define fi first
#define pi pair<int, int>
#define se second
#define mp make_pair
ll ksm(ll a, ll b) {
if (!b) return 1;
ll ns = ksm(a, b >> 1)... | ALGO | 0.999761 | 4.216739 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:55:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aee67965529b... |
f3235827-bf0c-422f-8a27-532e59aad5eb | tj8016/Strivers-A2Z-DSA-Course-Sheet | 16.Dynamic Programming/16.2 1D DP/5.House_Robber.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// } Driver Code Ends
class Solution
{
private:
int spaceOptimazation(int idx, int arr[]) {
// Base case
int prev1 = arr[0];
int prev2 = 0;
for(int i=1; i<=idx; i++) {
... | ALGO | 0.999958 | 5.689987 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-10-02T12:11: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": "cd4be7290fd... |
9bbda4ba-738b-42e3-b4d5-31ec55ba611b | rqsz/basis | 数据结构/kmp/kmp.cpp | /*
* @Description: 831. kmp字符串
* @Author: <NAME>
* @Date: 2020-04-05 18:52:47
* @Last Modified time: 2020-08-07 23:21:55
*/
/*
// s[]是长文本,p[]是模式串,n是s的长度,m是p的长度
//求模式串的Next数组:
for (int i = 2, j = 0; i <= m; i ++ )
{
while (j && p[i] != p[j + 1]) j = ne[j];
if (p[i] == p[j + 1]) j ++ ;
ne[i] = j;
}
// 匹配
... | ALGO | 0.999928 | 4.279998 | {
"github_metadata": {
"branch": "master",
"commit_count": 142,
"repo_created_at": "2022-09-06T11:07:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a6bd3b7... |
c0ef6eab-8ec4-4391-8ed9-8e0ca7b4e04e | austinwklein/cs201 | Homework/HW3/HW3a/boxer.cpp | // Boilerplate
/*
* boxer.cpp
* <NAME>
* CS 201
* Feb/11/2021
* HW 3
*/
// Description:
/* Description from Blackboard
*/
#include <iostream>
#include "boxer.hpp"
using std::cout;
using std::cin;
using std::endl;
int main() {
// Program behavior: closes program if user types anything other than 1
in... | TOOL | 0.936943 | 3.938729 | {
"github_metadata": {
"branch": "main",
"commit_count": 99,
"repo_created_at": "2021-01-25T18:20: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": "ffcc35e18af... |
4ca63308-3180-4b7b-9715-e576c192ef2b | singhal-amit/B.Tech-LAB-Courses | Sem 3/Computational Methods/prg_09 (Gauss_Jordan Method).cpp | #include <iostream>
#include <iomanip>
using namespace std;
void convertone(float m[3][3], float a[3][3], int x)
{
float f = m[x][x];
for (int j = 0; j < 3; j++)
{
if (m[x][x] != 0.0)
{
m[x][j] /= f;
a[x][j] /= f;
}
}
}
void RowOperations(float m[3][3], float a[3][3], int row, int n)
{
for (int i = ... | ALGO | 0.999865 | 3.827485 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-05-12T07:58: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": "3646a0a6c7e8... |
c0e84b28-43a1-41f7-8c88-786561990a7f | guilhermeleobas/maratona | URI/uri1547.cc | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <o... | ALGO | 0.99999 | 3.685198 | {
"github_metadata": {
"branch": "master",
"commit_count": 123,
"repo_created_at": "2014-07-01T17:46:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9347d9fa... |
1706b113-65bf-4558-a24c-015b6d5a480a | raincross7/code-similarity | codes/train_code/problem293/problem293_243.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int inf = 1e9;
con... | ALGO | 0.999922 | 3.535104 | {
"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": "a0dcaee1bb53... |
714f7b00-b320-4c74-b350-927b8f351a75 | CoralDevs/CrankWheel | M8_Wheel/M8_Wheel.ino | #include <util/atomic.h> // For the ATOMIC_BLOCK macro
#include <Bounce2.h>
#define MOTOR_ENCODER_A 2
#define MOTOR_ENCODER_B 3
#define ENCODER_CONSTANT 2
#define WHEEL_DIAMETER_CM 6.5
#define WHEEL_DISTANCE_CM 14.5
#define BUTTON_PIN 4
Bounce debouncer = Bounce();
int pinAState = 0;
int pinAStateOld = 0;
int pinBS... | ALGO | 0.967631 | 5.995258 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-06-28T09:23:24.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "316992ab0c5d7... |
12754576-8837-4209-ab22-b9c7811d11f3 | ROCm/OpenFOAM_HMM | src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-----------------------------------... | ALGO | 0.934802 | 4.838471 | {
"github_metadata": {
"branch": "suyash/hmm",
"commit_count": 25733,
"repo_created_at": "2022-10-27T12:31:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 25,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "7d... |
48f29b67-e890-4938-863a-f9299b94f878 | catec/leica_point_cloud_processing | src/FODDetector.cpp | /**
* @file FODDetector.cpp
* @copyright Copyright (c) 2020, FADA-CATEC
*
* 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... | DATA | 0.905312 | 6.057708 | {
"github_metadata": {
"branch": "master",
"commit_count": 168,
"repo_created_at": "2020-07-31T06:11:21.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0d3e0e0da... |
d156d126-392a-4541-8c9d-fc0717fdf365 | kyungyonglee/social_overlay_network_simulator | p2p_message.cpp | /*
This program is part of Netmodeler, a library for graph and network
modeling and simulation.
Copyright (C) 2011 University of Florida
Copyright (C) 2011 <NAME> (<EMAIL>), University of Florida
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License... | TOOL | 0.928108 | 3.980621 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2011-10-20T20:12:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b7959ade0a... |
933510e4-68e3-4559-9b4e-eb76fdbb0152 | KISHANsingh0001/Supream_2.0_DSA_by_CODE_help | 22_Heaps/06_Heap Doubt Class Codes by Lakshay Bhaiya/8. Longest Happy String.cpp | class Solution
{
public:
string longestDiverseString(int a, int b, int c)
{
// make PQ.
priority_queue<pair<int, char>> pq;
if (a)
pq.push({a, 'a'});
if (b)
pq.push({b, 'b'});
if (c)
pq.push({c, 'c'});
// build answer string
... | ALGO | 0.999982 | 4.751473 | {
"github_metadata": {
"branch": "master",
"commit_count": 120,
"repo_created_at": "2023-09-28T19:14:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eebf6620... |
16e141a3-57e6-45e2-9a98-49f52d407696 | vmmc2/Competitive-Programming | Codeforces/1234B1 - Social Network (Easy Version).cpp | #include <bits/stdc++.h>
#include <sstream>
#include <cmath>
#define pb push_back
#define INF 99999999
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n, k;
ll id;
queue <ll> fila;
unordered_map<ll,int> tanafila;
cin >> n >> ... | ALGO | 0.999998 | 3.655995 | {
"github_metadata": {
"branch": "master",
"commit_count": 1704,
"repo_created_at": "2018-10-09T00:24:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "83a9d46... |
42fc9724-4262-43b2-96d7-3e82af6f627b | sarthakag99/Coursera-Algorith-Toolbox | week5.4.cpp | #include <bits/stdc++.h>
#define MOD (ll)1000000007
#define MOD2 998244353
#define ll long long int
#define ull unsigned long long int
#define lf double
#define ld long double
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define UMAX ULLONG_MAX
#define pb push_back
#define endl "\n"
using namespace std;
using std::stri... | ALGO | 0.99999 | 4.991081 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2020-10-27T16:24: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": "5db7bd58032c... |
02ad47fb-9872-4c4b-8486-7fc66525f2c3 | PranjalA7/LP3 | LP-3 Exam/kanpsack01.cpp | #include <iostream>
#include <climits>
using namespace std;
int knapSack(int v[], int w[], int n, int W) {
if (W < 0)
return INT_MIN;
if (n < 0 || W == 0)
return 0;
int in = v[n] + knapSack(v, w, n - 1, W - w[n]);
int ex = knapSack(v, w, n - 1, W);
return max (in, ex);
}
int main() {
int ... | ALGO | 0.999994 | 4.605941 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-11-13T17:05: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": "7698260941cd... |
b2b6f2b5-652d-4bc5-96a3-a334649e4662 | Arquivotheca/Solaris-8 | osnet_volume/usr/src/lib/fn/context/x500/common/X500Context.cc | /*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "@(#)X500Context.cc 1.3 97/11/12 SMI"
#include <string.h>
#include <stdio.h>
#include <synch.h> // mutex_t
#include <sys/stat.h> // stat()
#include <ctype.h> // isspace()
#include "X500Context.hh"
#include "XDSDUA.hh"
#incl... | TOOL | 0.907578 | 5.050713 | {
"github_metadata": {
"branch": "2.8",
"commit_count": 1,
"repo_created_at": "2021-10-11T23:04:39.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d361a693f2af1... |
c8c228c1-7f5f-4f3c-9b49-92c63d7c7f7b | ishandutta2007/codeforces-v | vepifanov/normal/639/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define re return
#define y0 y2415
#define y1 y3... | ALGO | 0.999988 | 3.331503 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:31: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": "2f31a51b3855... |
ecd206b3-bead-41c8-8af1-1312584a8baa | qwli7/cpp-all | CppPrimePlus/Chapter08/8.4_swaps.cpp | #include <iostream>
void swapr(int & a, int & b); //引用
void swapp(int * p, int * q); //指针
void swap(int a, int b); //值拷贝
int main() {
using namespace std;
int wallet1 = 300;
int wallet2 = 500;
cout << "wallet1 = " << wallet1 << ", wallet2 = " << wallet2 << endl;
cout << "Using references to swap... | ALGO | 0.990829 | 4.872398 | {
"github_metadata": {
"branch": "master",
"commit_count": 257,
"repo_created_at": "2022-09-12T15:23:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b567abb3... |
d4fa7ae1-cf7d-4faa-9ceb-ac97ede2f2f3 | wxy1105952676/HelloCode | AcWing/算法基础课/1.基础算法/1.5前缀和与差分/子矩阵的和.cpp | /*
* @Author: wxy
* @Date: 2023-01-23 11:36:56
* @LastEditors: wxy
* @LastEditTime: 2023-01-23 12:10:24
* @FilePath: \AcWing\算法基础课\1.基础算法\1.5前缀和与差分\子矩阵的和.cpp
* @Description:
* @
* @Copyright (c) 2023 by Author, All Rights Reserved.
*/
#include <algorithm>
#include <cstring>
#include <iostream>
using namespa... | ALGO | 0.999862 | 4.735246 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2024-01-26T07:06: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": "9ceef9600599... |
92d8bc52-e663-4067-b419-b8ccb13bdfed | demodemocode/SOS | A2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
struct Process
{
int process_id;
int arrival_time;
int burst_time;
int completion_time;
int waiting_time;
int turnaround_time;
int priority;
};
void print_results(std::vector<Process> processes)
{
std:... | ALGO | 0.999987 | 5.400422 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-18T18:38:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e8cbaa299e7... |
fff94af5-ac5b-4432-9924-0a95ee32d33d | udayan14/Competitive_Coding | codeforces/edu94/str_recon.cpp | //#define _GLIBCXX_DEBUG
#include <iostream>
#include <cassert>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
string s;
cin >> s;
int... | ALGO | 0.999023 | 3.672167 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2020-07-24T00:31: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": "0d6839995... |
2799b68e-62ab-463c-881a-a4b30f5b1106 | lyandut/MyLeetCode | setMatrixZeroes.cpp | //
// Created by liyan on 2019-05-21.
//
#include "MyLeetCode.h"
/*
* 73. Set Matrix Zeroes
* https://leetcode.com/problems/set-matrix-zeroes/
*/
void MyLeetCode::setZeroes(vector<vector<int>> &matrix) {
bool isFirRowZero = false, isFirColZero = false;
int rowLength = matrix.size(), colLength = matrix[0].... | ALGO | 0.989044 | 5.925362 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2019-03-20T17:04: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": "f60b44fc9... |
a659a1f0-376f-410b-a44a-d1becf976a3b | invincible04/Competitive-Programming | A_A_characteristic.cpp | #include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define mp make_pair
#define pb push_back
#define rall(a) a.rbegin(),a.rend()
#define all(a) a.begin(),a.end()
#define arraysort(a) sort(a,a+n)
#define endl... | ALGO | 0.999953 | 3.935123 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2023-01-28T22:56:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6644d4be7... |
31fe7924-91b6-4a0a-9162-8d9ed34fba8d | kedebug/leetcode | SortColors/SortColors.cpp | class Solution {
public:
void sortColors(int A[], int n) {
int p0 = -1;
int p1 = 0;
int p2 = n;
while (p1 < p2) {
if (A[p1] == 1) {
p1++;
} else if (A[p1] == 0) {
swap(A[p0+1], A[p1]);
p0++;
p1++;... | ALGO | 0.999961 | 5.68741 | {
"github_metadata": {
"branch": "master",
"commit_count": 227,
"repo_created_at": "2013-06-06T11:39:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 230,
"forks": 153,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "222d... |
9400d9dc-c29f-46cf-a8c6-749f809760d6 | pratapaditya1997/leetcode | easy/720/trie_sol.cpp | const int N = 3e4 + 4;
const int ALPHA = 26;
int trie[N][ALPHA];
int nodes;
int words_end_count[N];
void init() {
nodes = 0;
memset(trie, -1, sizeof trie);
memset(words_end_count, 0, sizeof words_end_count);
}
int addEdge(int node, char c) {
int nxt = trie[node][c - 'a'];
if (nxt == -1) {
... | ALGO | 0.99998 | 5.569371 | {
"github_metadata": {
"branch": "master",
"commit_count": 394,
"repo_created_at": "2019-10-02T13:13: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": "a982edf2... |
b7cd2ad7-b642-40aa-943c-f162ab140bac | yaoyuan0801/MiniLecture | C++/patternMatch.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
#include <ctime>
#include <set>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
bool getNewPatternMap(map<char, string> &m, map<char, string> &res, char c, string &s) {
if (m.find(c) != m.end()) {
if (m[... | ALGO | 0.999951 | 4.866938 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2014-09-25T00:06: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": "bc4e19430... |
ed463768-ec63-4a99-900b-2f63828dbaa2 | LomoX-Offical/winpcs | winpcs/parse_config.h | /*
Copyright (c) 2015, <NAME> (<EMAIL>)
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 list of conditi... | CONFIG | 0.938603 | 6.259294 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2015-11-27T14:52:44.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "81f6c61562... |
6e1049b7-fc59-4d9c-8de0-663eb631d0a0 | pjyi2147/acmicpc | 2644.cc | // acmicpc number: 2644
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, b) for (int i=(a); i < (b); i++)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<int> vi;
ty... | ALGO | 0.999815 | 3.369956 | {
"github_metadata": {
"branch": "main",
"commit_count": 179,
"repo_created_at": "2020-09-07T10:02: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": "6623298ced... |
b49f790d-fc7d-4337-86cd-a46a72669c55 | wellisonraul/DesenvolvimentoUniversidade | Semestre4/Grafos/Kruskal-trabalho-professora.cpp | #include<stdio.h>
#include<stdlib.h>
void printArray(int a[][100], int n);
void MatrixAdja(int a[][100],int n){
int i,j;
for(i= 0;i < n; i++){
for(j= 0;j < i; j++){
a[i][j] = a[j][i]= rand()%50;
if( a[i][j]>40)a[i][j]=a[j][i]=999;
}
a[i][j] = 999;
}
printArray(a,n);
}
void printArray(int a[... | ALGO | 0.99992 | 3.584655 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-07-02T13:45: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": "1eaf1675f9... |
9d8aa6ab-005d-4e48-a1b5-cc0afbe95887 | liuyubobobo/Play-Leetcode | 0501-1000/0995-Minimum-Number-of-K-Consecutive-Bit-Flips/cpp-0995/main2.cpp | /// Source : https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips/
/// Author : liuyubobobo
/// Time : 2019-02-18
#include <iostream>
#include <vector>
using namespace std;
/// Greedy + Events
/// Record every closed event
/// Time Complexity: O(N)
/// Space Complexity: O(N)
class Solution {
pu... | ALGO | 0.999969 | 5.616895 | {
"github_metadata": {
"branch": "master",
"commit_count": 2592,
"repo_created_at": "2016-12-01T17:08:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2732,
"forks": 718,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe... |
932409f3-e59b-4b48-9f30-d888278a99d2 | Tushar1805/coding_roadmap | Star Pattern Programs/8.cpp | // * * * * * * * * *
// * * * * * * * *
// * * * * * *
// * * * *
// * *
#include<stdio.h>
int main(int argc, char const *argv[])
{
int rows, i, j, k, l, m, n, c = 0;
printf("Enter the number of rows: ");
scanf("%d", &rows);
l = -1;
n = rows;
for (int i = rows; i > 0; --i)
{
f... | ALGO | 0.999728 | 3.972406 | {
"github_metadata": {
"branch": "main",
"commit_count": 328,
"repo_created_at": "2023-03-07T12:55: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": "b5255496d5... |
6f6dd9d8-9bde-4ae0-a881-697cb1a064ad | samuelcamilodacosta/Cpp-codes | STUDIES FOR INTERVIEW/INTERVIEWBIT/Subtract.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
ListNode* reverse(ListNode* A,int n){
ListNode *tmp1=A,*tmp2=A,*prev=NULL,*curr,*tmp3=A;
int half=n/2+1,c... | ALGO | 0.99997 | 4.52767 | {
"github_metadata": {
"branch": "master",
"commit_count": 88,
"repo_created_at": "2021-02-11T08:35: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": "720b5b3ef... |
769b7c59-b28a-46a9-898f-ccf6b23f6ef4 | ishandutta2007/codeforces-n | nigus/normal/815/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a;i<(b);++i)
#define trav(a,v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
ll big = 1000000007ll;
ll big2 ... | ALGO | 0.999975 | 4.07681 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:35:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3c6e8da6102... |
a02eea23-3fea-463e-8cd3-fa89feb64d69 | ishandutta2007/codeforces-t | theoneyouwant/normal/1070/H.cpp | //by <NAME>
#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // c... | ALGO | 0.999597 | 3.858681 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:27: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": "1b45caa8733e... |
2a5ceea1-fc9f-4719-9747-d784a986ce8c | leonacwa/code | contest/c0414/F.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int NN = 200005;
char str[NN], ans[NN];
int main()
{
int nTest;
scanf("%d", &nTest);
while (nTest--) {
scanf("%s", str);
int ls = strlen(str);
ans[0] = 0;
int i, j, k, p = 0;
bool yes = true;
for (i = 0; i < ls; ++i) {
... | ALGO | 0.999055 | 3.372218 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2012-05-12T13:00:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e024fed9d... |
d4d128a2-3972-4144-ad4c-b9bc09ee3982 | bunnerlemon/PTA-Advanced | 1019.cpp | #include <bits/stdc++.h>
using namespace std;
#define fin freopen("in.txt", "r", stdin)
#define fout freopen("out.txt", "w", stdout)
vector<int> to_base(int n, int base) {
vector<int> ans;
while(n) {
ans.push_back(n % base);
n /= base;
}
return ans;
}
bool judge(vector<int> x) {
f... | ALGO | 0.999921 | 3.698682 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2020-02-23T14:09: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": "f4d63f2c4f... |
d8d77f72-19cf-4978-b914-f04e29f1d68a | vexlore-code/YouKn0wWho-Academy | YouKn0wWho-Academy-main/Arrays/F_Reversing.cpp | /*
"<NAME>"
╔═══════════════════════════════════════╗
✦ v e x l o r e ✦ Created : 09-07-2025 23:33:54
"Code like a poet. Debug like a pro." GitHub : https://github.com/vexlore-code
╚═══════════════════════════════════════╝
*/
#include <bits/stdc++.h>
using namespace std;
#define... | ALGO | 0.999938 | 5.168652 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2025-05-30T10:53:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11d3f0f14a7... |
d9ec88eb-8f8a-4c81-9c84-05e81399a9bd | taroyabuki/cppbook2 | samples/answers/11/11-answer3.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
using namespace std;
template<typename T>
size_t binarySearch(T key, const vector<T>& v) {
if (!is_sorted(v.cbegin(), v.cend())) {
throw runtime_error("例外:ソートされていない");
}
size_t n = v.size();
size_t low = 0;
size_t high = n - 1;... | ALGO | 0.996543 | 3.260886 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2017-02-12T02:46:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aee123f2e... |
6345c8e2-d878-4f2d-9204-427c8ea4c469 | PawelW91/Podstawy_CPP_Praktyka | Polski_SPOJ/WI_DZWON - Szkolne dzwonki/main.cpp | #include <iostream>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;
string formatTime(int godzina, int minuta) {
stringstream ss;
ss << setfill('0') << setw(2) << godzina << ":" << setw(2) << minuta;
return ss.str();
}
vector<string> generuj_dzwonki(string godzina_startu, vec... | ALGO | 0.998811 | 5.709159 | {
"github_metadata": {
"branch": "main",
"commit_count": 108,
"repo_created_at": "2023-06-12T21:02:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "469ca53f92... |
5ab43cf2-c864-4d6d-9084-1ead466837ba | SimoenStoev95/BinaryTree | BinaryOrdTree.h | #ifndef BINARYORDTREE_H_INCLUDED
#define BINARYORDTREE_H_INCLUDED
#include "BinaryTree.h"
#include<iostream>
template<class T>
class BinaryOrdTree {};
template<class T>
friend ostream& operator<<(ostream&, const BinaryOrdTree<T>&);
template<class T>
friend istream& operator>>(istream&, BinaryOrdTree<T>&);
template... | ALGO | 0.999245 | 4.374171 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-02-13T21:12: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": "d5f5a7d2c6... |
f014197b-1162-4a2a-8aaf-a2f351177383 | NYU-Processor-Design/onboarding-lab-2 | dv/exercise3.cpp | #include <cstdint>
#include <random>
#include <catch2/catch_test_macros.hpp>
#include <VExercise3.h>
uint8_t mystery1(uint8_t a, uint8_t b, uint8_t c) {
switch(a) {
case 0:
return b;
case 1:
return (b << 4) | (c >> 4);
case 2:
return c;
default:
return ((a & 0x7) << 6) | ((c ... | TEST | 0.951145 | 5.587062 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-01-23T09:24:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 26,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cc10ae0a102f... |
45d01b91-b1e3-41f5-88eb-84f68e1ec187 | MeGaCrazy/CompetitiveProgramming | UVA/UVA_12333.cpp | /**
* Idea : First Part make add Function to simulate the process of adding 2 BigInteger :)
* Second part make trie But make it in static array like that [number of possible paths][possible digits]
* and another array for save the First arrive in this path for satisfy the Queries
*
* ... | ALGO | 0.99993 | 4.446644 | {
"github_metadata": {
"branch": "master",
"commit_count": 388,
"repo_created_at": "2017-06-29T22:55:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abd689f6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.