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 |
|---|---|---|---|---|---|---|---|
563f45f3-585d-4a1d-b61d-fd97626a071b | vincent97198/competitve-programming-record | codeforce/702F.cpp | #include <bits/stdc++.h>
#define ll long long
#define N 200005
using namespace std;
std::mt19937_64 RAND(228922);
int ans[N];
struct node{
node *l,*r;
int val,pri,lazy,sz,id,ans_lazy,ans;
node(int VAL,int ID){
l=nullptr; r=nullptr;
val=VAL;
sz=1;
lazy=ans_lazy=ans=0;
id=ID;
... | ALGO | 0.999893 | 3.720004 | {
"github_metadata": {
"branch": "master",
"commit_count": 247,
"repo_created_at": "2020-01-22T06:39: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": "6f3b8ae7... |
1280fb5d-bc98-467e-8b95-018038a010b8 | yusufsarikaya/Auto_Exposure | gradientBasedAutoExp.cpp | //
// gradientBasedAutoExp.cpp
//
// Created by <NAME> on 4.11.2020.
//
//
#include "gradientBasedAutoExp.hpp"
//kp -> control the speed to convergence
//d -> parameters used in the nonliear function in Shim's 2018 paper
double gradientBasedAutoExp::calcNewExposureTime(cv::Mat *img, double currExposureTime, doubl... | ALGO | 0.99023 | 4.892477 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2020-11-04T20:44:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95a5f7af25bf... |
edd48b4e-71ea-4ce8-a6b3-3d0adbce62a8 | ndrplz/self-driving-car | project_6_extended_kalman_filter/src/Eigen/src/SparseCore/SparseCwiseBinaryOp.h | // This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla... | ALGO | 0.967154 | 7.679738 | {
"github_metadata": {
"branch": "master",
"commit_count": 238,
"repo_created_at": "2016-12-25T18:09:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2861,
"forks": 1396,
"issues": 10,
"pull_requests": 2
},
"file_meta": {
"content_id": "e... |
25939485-4bd3-49f2-8a13-085efa58a9c5 | sky121016/Baekjoon | 백준/Gold/1915. 가장 큰 정사각형/가장 큰 정사각형.cc | // 1915
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
int n, m;
char map[1001][1001];
int dp[1001][1001];
int maxSize;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for(int i = 1; i<=n; i++){
for(int... | ALGO | 0.99983 | 3.277149 | {
"github_metadata": {
"branch": "main",
"commit_count": 513,
"repo_created_at": "2023-07-19T13: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": "853117f624... |
a20b4482-1e75-425f-a2e8-942b466930bf | Sachin10-05/Introduction_to_cpp_coding_ninja | Searching and Sorting/5. Merge two sorted array.cpp | /*
Problem:
You have been given two sorted arrays/lists(ARR1 and ARR2) of size N and M respectively, merge them into a third array/list such that the third array is also sorted.
Constraints :
1 <= t <= 10^2
0 <= N <= 10^5
0 <= M <= 10^5
Time Limit: 1 sec
Sample Input 1 :
1
5
1 3 4 7 11
4
2 4 6 13
Sample Output 1 :
1... | ALGO | 0.999967 | 3.985702 | {
"github_metadata": {
"branch": "main",
"commit_count": 204,
"repo_created_at": "2022-07-03T02:38:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae934c77a4... |
417b85ce-c034-4f13-b765-1c814959727b | hungp2812/POI | 5th_POI/lam.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
vector<pair<int, int>> a(n + 1);
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
// double nx = (x - y) / sqrt(2); //nx = cos(45) x - sin(45) y
... | ALGO | 0.999705 | 4.03679 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2021-01-03T16:28:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d30d87c8a... |
83564374-41db-4e30-8734-feb43f80ed2f | WantToBePro31/toki-tlx-basic-programming | chap11/b.cpp | #include <stdio.h>
#include <string.h>
int cek(char str[], char kata[])
{
int j = 0;
for (int i = 0; str[i] != '\0'; i++)
{
int k = i;
while (str[i] == kata[j])
{
i++;
j++;
if (j == strlen(kata))
{
return 1;
... | ALGO | 0.999928 | 3.428939 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-08-22T12:21: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": "64a50db6d253... |
df09f674-b885-4e85-9b4b-9aeda059c209 | PatanSanaulla/MissionRnD-C-Basics | src/isOlder.cpp | /*
OVERVIEW: Given date of births of two persons as inputs, return 1 if person one is elder,
2 if person two is elder, 0 if both are of same age.
Example: isOlder("24-07-2000", "25-07-2000") should return 1 as person one
is elder than person two.
INPUTS: DOBs of two persons as parameters in the format "DD-MM-YYYY".
... | ALGO | 0.998852 | 3.980635 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2015-11-18T18:23: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": "387ae51b9... |
ed9d728e-5d3f-4769-89d2-3c0a8252b5e3 | Jazz-45/LeetCode | 1570-final-prices-with-a-special-discount-in-a-shop/1570-final-prices-with-a-special-discount-in-a-shop.cpp | class Solution {
public:
vector<int> finalPrices(vector<int>& prices) {
vector<int> answer(prices.size());
stack<int> stk;
for (int i = 0; i < prices.size(); ++i) {
// Apply discounts to all items in the stack that are greater than or equal to the current price
while (!stk.empty() ... | ALGO | 0.999924 | 6.327978 | {
"github_metadata": {
"branch": "main",
"commit_count": 1295,
"repo_created_at": "2024-12-05T03:09: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": "5b8b42a93... |
3cff919a-0d17-4cd8-a9ac-4da9e2af57c7 | VivienGAGLIANO/projet-ips-dev | src/Hermit.cpp | #include "../headers/Hermit.h"
#include <iomanip> // hermit << operator formatting
/**
* @file Hermit.cpp
*/
/**
* Computes and evaluates hermit polynomial
*
* This function uses the recursion relation definition of the hermit polynomials to fill the values matrix up to rank n polynomials with the object's me... | ALGO | 0.910728 | 6.377964 | {
"github_metadata": {
"branch": "master",
"commit_count": 168,
"repo_created_at": "2020-12-28T15:26: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": "f3402f9e... |
aa5e16c6-8160-4504-aff6-aff87407e060 | austinh763/CPSC121-Object-Oriented-Programming | lab-1/HoangAlab1.cpp | //Author: <NAME>
//CPSC 121 Lab 1
//8/27/2018
#include <iostream>
using namespace std;
int main() {
//setting variables up for input, output, and values of each type of cent
int cents = 0;
int cents_Total = 0;
int cents_Dime = 0;
int cents_Nickel = 0;
int cents_Penny = 0;
int cents_Quarter = 0;
int quarter =... | TOOL | 0.951996 | 3.786162 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2021-07-03T08:17:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9be4fafc372... |
5c777371-3ab5-4232-bdf0-a9d15efabac0 | dawit2119/competitive-programming | 0124-binary-tree-maximum-path-sum/0124-binary-tree-maximum-path-sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999981 | 5.651245 | {
"github_metadata": {
"branch": "main",
"commit_count": 1608,
"repo_created_at": "2022-10-03T09:47: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": "effbcf12a... |
9aeb6523-b384-4fe6-b742-c50df62e0650 | 3bdalrhmanS3d/LeetCode | 19-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) {}
* };
*/
class Solution {
public:
ListNode* removeNthFr... | ALGO | 0.999984 | 5.515036 | {
"github_metadata": {
"branch": "main",
"commit_count": 224,
"repo_created_at": "2024-08-15T04:02: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": "0074433401... |
2e2ebc1f-5640-4b80-92d9-ed936395750b | CyanogenMod/android_system_extras | perfprofd/configreader.cc | /*
**
** Copyright 2015, The Android Open Source Project
**
** 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 appl... | CONFIG | 0.97321 | 7.323301 | {
"github_metadata": {
"branch": "cm-14.1",
"commit_count": 3415,
"repo_created_at": "2010-07-05T03:20:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 53,
"forks": 119,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2076... |
52242454-4b0d-47a0-97fd-ea312d694d64 | epicurean21/Algorithm | 2294.cpp | /**
* 2294 동전2
* 다이나믹 프로그래밍
*
* dp 배열: dp[i] = i원을 만들 수 있는 최소 동전의 개수
* dp 식: dp[i] = min (dp[i - k] + 1, dp[i])
* 즉, i번째를 k원으로 만드려면, dp[i - k], k원까지 만든 최소값에 한개의 코인을 더 했을때 또는 dp[i]
*/
#include "iostream"
#include "algorithm"
using namespace std;
#define MAX 100001
int n, k, dp[MAX], coins[101];
void init() {
... | ALGO | 0.999971 | 3.922082 | {
"github_metadata": {
"branch": "master",
"commit_count": 362,
"repo_created_at": "2019-07-30T09:06:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cc05f70f... |
261645bc-c652-4651-94f5-728732908c8d | YeonWon123/My_Problem_Solving | 백준/2798 블랙잭/2798 블랙잭/2798 블랙잭.cpp | #include <iostream>
using namespace std;
int arr[100];
int main(void)
{
ios_base::sync_with_stdio(false);
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
// 경우의 수 : 100C3 = 약 10만
// 따라서 3중 for문으로 완전 탐색을 하면 구할 수 있다.
int max_value = -1;
int sum;
for (int i = 0; i < N - 2; i++) {
... | ALGO | 0.999967 | 4.243038 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2020-03-15T12:52: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": "f8d428666... |
4e61f369-5c71-49de-8bab-299e2db4782b | Roger-JieW/ADDS-Prac6 | Main.cpp | #include<iostream>
#include<string>
#include <sstream>
#include<vector>
#include "Individual.h"
#include "Mutator.h"
#include "BitFlip.h"
#include "BitFlipProb.h"
#include "Rearrange.h"
using namespace std;
Individual * execute(Individual* indPtr, Mutator * mPtr, int k){
return mPtr->mutate(indPtr, k);
}
int mai... | ALGO | 0.999158 | 4.240584 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-05-02T05:49:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "15d32f64f39f... |
e9f3e377-15c3-4bbe-9c15-78ff332658c7 | gusl0801/ShootingGame | Vector2D.h | #pragma once
#include "stdafx.h"
#define POW2(value) value * value
#define ADD(value, addNum, limit) min(value + addNum, limit)
#define SUB(value, subNum,limit) max(value - subNum, limit)
template <class Ty>
class Vector2D
{
public:
Vector2D() : x(), y() {}
Vector2D(Ty x_, Ty y_) : x(x_), y(y_) {}
union {
struc... | TOOL | 0.913296 | 5.737754 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2018-03-19T14:01:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c2af4933... |
4600e262-74c5-4d3b-af23-7bca6c03077b | zv-proger/ol_programms | acmp/0207.cpp | /*
Автор кода: <NAME> (<EMAIL>)
Решение задачи 0207 с сайта acmp.ru
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define f first
#define s second
const int inf = 1e9;
using pii = pair<int, int>;
using pff = pair<double, double>;
template <class A, class B> pair<A, B> op... | ALGO | 0.999729 | 3.521984 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2020-07-14T11:39: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": "1a0c0e8ad... |
e229c9f1-ff06-4083-9c65-3edee37b377a | vinitava07/segmentacao-de-imagens | Parte1/include/unionFind.hpp | #ifndef UNIVERSE
#define UNIVERSE
#include <vector>
#include <iostream>
#include <stdexcept>
class Universe
{
private:
struct Element
{
int rank;
int size;
int parent;
};
int num;
std::vector<Element> elts;
public:
Universe(int n_elements, int e) : num(e), elts(n_elem... | ALGO | 0.960746 | 6.760104 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2024-06-06T21:34: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": "256085e7cdb... |
fbee040b-cd51-4d0f-8841-fee1fb7e9e6d | SarifIqbal/OOPs | 03_OperatorOverloadingAndTypeConversion/005_MathematicalOperationsOnStrings.cpp | #include <iostream>
#include <cstring>
using namespace std;
class sstring
{
char *p;
int len;
public:
sstring() // create null string
{
len = 0;
p = 0;
}
sstring(const char *s); // create string from arrays
sstring(const sstring &s); // copy constructor
~sstring() { ... | TOOL | 0.999057 | 3.47087 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2022-09-17T09:53: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": "8dcc8c86649... |
1bb1abda-a0ac-476d-94f7-787db4ea1cdf | msyashik/CPPS | Codeforces/1144F.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Fastest ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define SIZE 1000005
vector<int>v[200005];
int visited[200005];
int rong[200005];
int f = 0;
map<pair<int,int>,int>mp;
void dfs(int node, int clr, int si... | ALGO | 0.999998 | 3.632529 | {
"github_metadata": {
"branch": "master",
"commit_count": 442,
"repo_created_at": "2018-12-13T12:07: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": "4ae2baeb... |
97fb830d-545c-449b-bbc9-10ec8003b08a | morris821028/UVa | volume016/1627 - Team them up!.cpp | #include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <assert.h>
using namespace std;
#define MAXN 128
int g[MAXN][MAXN], visited[MAXN];
int color[MAXN], n;
int dfs(int u, int c, vector<int> &s0, vector<int> &s1) {
visited[u] = 1, color[u] = c;
if (c == 0) s0.push_back(u);
else s1... | ALGO | 0.99989 | 3.716739 | {
"github_metadata": {
"branch": "master",
"commit_count": 1197,
"repo_created_at": "2013-06-14T12:34:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 571,
"forks": 269,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "626... |
6ba46d64-274d-47f0-8af8-9c49c9d6c805 | Bence675/alpha_chess | src/MCTS/node.h |
#include "chess/chess.hpp"
#include <torch/torch.h>
#include <memory>
#include <vector>
#include "model.h"
#include "board_utils.h"
#ifndef MCTS_NODE_H
#define MCTS_NODE_H
#define C_PUCT 1.0
class node_t : public std::enable_shared_from_this<node_t>
{
public:
node_t(chess::Board& board, std::shared_ptr<torch:... | ALGO | 0.986416 | 5.990414 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2025-03-30T21: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": "b7bc7024291... |
ca8095fa-8ecd-43a4-9c50-aefbb3c1f4e6 | work-mohit/Placement-Practice | Aditya Verma DP/Longest-Common-Substring.cpp | #include<iostream>
using namespace std;
class Solution {
public:
int dp[1001][1001];
int longestCommonSubsequence(string text1, string text2) {
int m = text1.size();
int n = text2.size();
for(int i = 0; i<= m; i++){
for(int j = 0; j <= n; j++){
if(i == 0 || ... | ALGO | 0.999925 | 3.883416 | {
"github_metadata": {
"branch": "main",
"commit_count": 210,
"repo_created_at": "2022-01-13T10:07: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": "89927833ad... |
283fdb81-6ecb-4c0e-8021-81f20a3f5c8f | emsr/maths_cephes | linalg/LinAlg/fminbr.cc | // This may look like C code, but it is really -*- C++ -*-
/*
************************************************************************
*
* Numerical Math Package
*
* Brent's one-dimensional minimizer
*
* finds a local minimum of a single argument function
* over a given range
*
* Input
* d... | ALGO | 0.999999 | 6.436884 | {
"github_metadata": {
"branch": "master",
"commit_count": 35,
"repo_created_at": "2017-11-03T21:25:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "648c75714... |
b681d51f-5a9b-4ad7-92aa-f06ec078d14b | Uday-Berad22/Leetcode-Question | 992. Subarrays with K Different Integers.cpp | /*
Given an integer array nums and an integer k, return the number of good subarrays of nums.
A good array is an array where the number of different integers in that array is exactly k.
For example, [1,2,3,1,2] has 3 different integers: 1, 2, and 3.
A subarray is a contiguous part of an array.
Example 1:
Input: ... | ALGO | 0.999919 | 5.549507 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2023-09-01T13:44:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "649875e13a... |
d250dd13-0ed7-4f1e-bf6a-08a86dc08a78 | neal2018/oj_env | codeforces/763/b.cpp | #include <bits/stdc++.h>
using namespace std;
// https://space.bilibili.com/672328094
#define ll long long
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int T, n;
cin >> T;
auto f = [&]() {
cin >> n;
vector<int> cnt(n + 1);
for (int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;... | ALGO | 0.999888 | 4.303078 | {
"github_metadata": {
"branch": "master",
"commit_count": 175,
"repo_created_at": "2021-08-18T06:24:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2783b6ac... |
f01b8c62-e292-4321-b066-6aea2d7edf5a | sabyasachirakshit/My-Codes | C++/Bubble_Sort.cpp | //? The objective of this C++ program is to implement bubble sort on an unsorted array!
#include <iostream>
using namespace std;
int main()
{
int A[50], i, j, k, temp = 0, l;
cout << "Enter how many elements:" << endl;
cin >> l;
for (i = 0; i < l; i++)
{
cout << "Enter element:" << endl;
... | ALGO | 0.999768 | 5.101384 | {
"github_metadata": {
"branch": "master",
"commit_count": 127,
"repo_created_at": "2022-07-07T17:29:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f00e0b61... |
5d350ccf-71d4-4b88-bcfb-24c464525957 | jingnee/algorithm | baekjoon/20008.cpp | //몬스터를 처치하자!
#include <iostream>
#include <time.h>
using namespace std;
struct skill {
int cool = 0;
int damage = 0;
};
int N, HP, ans = 1e9;
skill skills[5];
int leftTime[5];
int check[100];
void DFS(int tot, int time, int *left) {
if (ans < time)return;
if (tot >= HP) {
ans = (ans > time) ? time : ans;
//c... | ALGO | 0.999824 | 3.742715 | {
"github_metadata": {
"branch": "master",
"commit_count": 483,
"repo_created_at": "2020-01-01T12:42:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a367326... |
3e15e4d0-a2c3-40db-9283-73444ea50e33 | meshula/fizzim | Core/NearestNeighbours.h |
/** @file NearestNeighbours.h
@brief Nearest neighbour utilities
*/
#ifndef _NEARESTNEIGHBOURS_H_
#define _NEARESTNEIGHBOURS_H_
#include "PMath.h"
#include "lq.h"
/// @class NNProxy
/// @brief virtual base class to help the proxy database
class NNProxy {
public:
NNProxy() : m_InDatabase(false) { }
virtual ~NNP... | ALGO | 0.99391 | 6.089991 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2014-01-28T06:08:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ea00aa393... |
46d8d962-a88a-43a2-b8f5-d325da7bd361 | olgavrou/vowpal_wabbit | vowpalwabbit/core/src/reductions/svrg.cc |
// Copyright (c) by respective owners including Yahoo!, Microsoft, and
// individual contributors. All rights reserved. Released under a BSD (revised)
// license as described in the file LICENSE.
#include "vw/core/reductions/svrg.h"
#include "vw/core/crossplat_compat.h"
#include "vw/core/learner.h"
#include "vw/core... | ALGO | 0.975107 | 6.466105 | {
"github_metadata": {
"branch": "master",
"commit_count": 10087,
"repo_created_at": "2020-06-29T11:09:53.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "VowpalWabbit/vowpal_wabbit",
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
... |
43444eef-a251-49fb-baa7-0fe7ba8eaa53 | shantanu2002git/LEET-QS | 201-bitwise-and-of-numbers-range/bitwise-and-of-numbers-range.cpp | class Solution {
public:
int rangeBitwiseAnd(int left, int right) {
int shift = 0;
// Find the common prefix of left and right by shifting right until they are equal
while (left < right) {
left >>= 1;
right >>= 1;
shift++;
}
// Shift back t... | ALGO | 0.999949 | 6.13472 | {
"github_metadata": {
"branch": "main",
"commit_count": 1583,
"repo_created_at": "2023-09-01T13:10: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": "a939f7def... |
5e867c46-cf76-4867-b198-c23f4df938ea | gclark14/Linked-List-Arithmetic | mulVal.cpp | #include "hw09.h"
LargeInt LargeInt::operator*(LargeInt &input){
int i;
int j;
LargeInt fac(input); // Copy construct to factor
/*
* Going to continously add partial to prod.
* In all actuality, prod is a sum of partial prods.
*/
LargeInt prod;
int count = 0;
/** format is
j
*i
---
partia... | ALGO | 0.9995 | 3.443745 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-06-01T02:23: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": "5171ec977d... |
3c7d6be5-6931-45b4-bc05-f480f333c0f7 | llvm/llvm-project | llvm/include/llvm/CodeGen/ModuloSchedule.h | //===- ModuloSchedule.h - Software pipeline schedule expansion ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | ALGO | 0.97342 | 7.118226 | {
"github_metadata": {
"branch": "main",
"commit_count": 545188,
"repo_created_at": "2016-12-07T09:39:33.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 33545,
"forks": 14484,
"issues": 5000,
"pull_requests": 5000
},
"file_meta": {
"content_... |
26855b31-bd24-4491-9e61-fbf586a2ecc6 | zjma/codegames | hackercup2017q/c.cpp | // template.cpp : Defines the entry point for the console application.
//
#include <climits>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_ma... | ALGO | 0.998566 | 3.836778 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2017-04-18T02:42: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": "df840e89a... |
69b6422d-06d3-4f13-b841-5c74bf16d901 | RafaelChavesPB/GeneticAlgorithm | genetico.cpp | #include "genetico.h"
double inicio, tempo_maximo, dif, tms;
int atual;
pair<vector<bool>, int> ms;
double dif_t()
{
return ((double)clock() - inicio) / CLOCKS_PER_SEC;
}
pair<int, double> algoritmo_genetico(string entrada)
{
inicio = clock(), tms = 0;
auto mda = (entrada != "cin" ? ler_arquivo(entrada)... | ALGO | 0.999894 | 4.331288 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-12-30T17:45: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": "28cd2d51fc... |
44b288d8-94a8-402c-a1ff-bab46eb4e2da | abhishek9125/DSAlgoSet | Backtracking/02. Word Search.cpp | class Solution {
public:
bool dfs(vector<vector<char> >& board, int i, int j, string s, int k) {
if(k == s.length()) return true;
if(i < 0 || j >= board[0].size() || j < 0 || i >= board.size() || s[k] != board[i][j]) return false;
char x = board[i][j];
board[i][j] = ' ';
... | ALGO | 0.999905 | 6.010964 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-08-21T20: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": "fc280f6a834... |
d962673e-0926-4c7b-93f8-6243c61aa52c | Nehagaddam2909/CP | codeforces/Lucky.cpp | /*
Author : Neha
Modified : 13/5/2022*/
#include<bits/stdc++.h>
using namespace std;
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (in... | ALGO | 0.99986 | 3.881431 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-03-07T00: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": "555752ea4c... |
b769dd60-b9de-4935-a4d2-0ecc986841f9 | EmiCastro01/AYED_TP_FINAL | src/main.cpp | #include <bitset>
#include <iostream>
#include <limits>
#include <random>
#include "machines.cpp"
#include "network.cpp"
#include "simulator.cpp"
#include "structures.cpp"
#include "system_adm.cpp"
#include "utils.cpp"
using namespace std;
#define INFI std::numeric_limits<int>::max()
#define MAX_ROUTERS 256
void cre... | ALGO | 0.997552 | 3.905801 | {
"github_metadata": {
"branch": "main",
"commit_count": 73,
"repo_created_at": "2024-12-05T17:41:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce3c3c4e1e7... |
420e19e9-f11a-4b21-9526-ef9e4c4bda68 | DpkRn/LeetCode | 3008-find-beautiful-indices-in-the-given-array-ii/3008-find-beautiful-indices-in-the-given-array-ii.cpp | class Solution {
public:
vector<int> findLps(string pat){
//string pat="aabaaac";
int n=pat.size();
int len=0;
vector<int> lps(n,0);
lps[0]=0;
int i=1;
while(i<n){
if(pat[len]==pat[i]){
len++;
lps[i]=len; i++;
}else{
//if not equal ... | ALGO | 0.999949 | 5.869217 | {
"github_metadata": {
"branch": "main",
"commit_count": 2092,
"repo_created_at": "2023-12-18T17:46:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59611198b... |
89d25e6c-73f4-4063-b0f1-3e2c4b73a0cb | git-akshat/CNS-Lab | 14. DSS/server.cpp | /* Author : <NAME>
14. Implement DSS algorithm for signing and verification of messages between two parties (obtain H(M) using simple XOR method of hash computation on M). */
/* Server Program */
# include <bits/stdc++.h>
# include <arpa/inet.h>
using namespace std;
int createServer(int port) // TCP connection
{... | ALGO | 0.998931 | 4.073514 | {
"github_metadata": {
"branch": "master",
"commit_count": 104,
"repo_created_at": "2019-08-09T16:46:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 31,
"forks": 16,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e5b818... |
8391f737-0c0f-48a2-9def-cc6189840d77 | RushhMax/Competitive-Programming-S6 | AtCoder/Beg_C393/E_GCDOfSubsetsAT.cpp |
using namespace std;
using i64 = long long;
const int N = 1'000'000;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, k;
cin >> n >> k;
vector<int> a(n + 1), mp(N + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
mp[a[i]]++;
}
vector<int> ans(N + 1, 1);
for (int i = 1; i <= N; ... | ALGO | 0.99999 | 4.032725 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2024-09-18T14:41: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": "b1dc006a7... |
376d34cf-ed41-48a7-8979-942457b26502 | logsol/Pd-Pulp | modules/juce_graphics/geometry/juce_PathIterator.cpp | /*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these ... | TOOL | 0.906345 | 6.32989 | {
"github_metadata": {
"branch": "master",
"commit_count": 47,
"repo_created_at": "2015-06-25T18:01:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 156,
"forks": 12,
"issues": 10,
"pull_requests": 0
},
"file_meta": {
"content_id": "8700c... |
4f728e72-db2f-48ea-93da-69dde89f9547 | heatblast016/CompetitiveProgramming | USACO/Dec_2016/Silver/haybales/haybales.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <cstdlib>
using namespace std;
bool bsearch(int key, int arr[], int size);
int main()
{
ifstream in("haybales.in");
ofstream out("haybales.out");
int n, q;
in >> n >> q;
int a[q];
int b[q];
int intervals[n];
in.get();
... | ALGO | 0.999791 | 3.949738 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2017-02-11T03:02: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": "5fde5aa9f... |
6bb7023b-c9d1-416c-901f-5f58c7c472a7 | lavishmlk/My-leetcode-and-gfg-solutions-in-Cpp | sudoku-solver/sudoku-solver.cpp | class Solution {
public:
char nboard[9][9];
bool isValidrow(vector<vector<char>>& board,char x,int i,int j){
for(int k=0;k<board[0].size();k++){
if(board[i][k]==x){
return false;
}
}
for(int k=0;k<board.size();k++){
... | ALGO | 0.999796 | 6.079181 | {
"github_metadata": {
"branch": "main",
"commit_count": 1393,
"repo_created_at": "2021-12-24T12:03:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "84870ff2f... |
7a0ae2e4-5c36-4d23-bb64-f0335da8c8a5 | Denisqu/masters-parprog | labs/lab12/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <mpi.h>
namespace Gauss {
using namespace std;
void print(vector< vector<double> > A) {
int n = A.size();
for (int i=0; i<n; i++) {
for (int j=0; j<n+1; j++) {
cout << A[i][j] << "\t";
if (j == n-1) {
... | ALGO | 0.999956 | 4.17223 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-11-18T19:58: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": "396df8102d44... |
a553b5e8-65c2-425e-bd0c-c451d3002d28 | cyro17/DSA-notes | 06-Sliding Window/04-MaxScoreCards.cpp | /*
using sliding window: TC = O(2*K)
*/
class Solution
{
public:
int maxScore_bf(vector<int> &arr, int k)
{
int n = arr.size();
int max_sum = 0;
int left_sum = 0, right_sum;
// store sun of first k elements from the left
for (int i = 0; i < k; i++)
{
left_sum += arr[i];
max_su... | ALGO | 0.999959 | 5.604623 | {
"github_metadata": {
"branch": "main",
"commit_count": 196,
"repo_created_at": "2024-02-15T09:52:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "560240417b... |
9c8b5329-00db-4fbe-8f8c-7f08ce6a0c3d | SIOSlab/ExoUKF | exoukf.hpp | #ifndef MEDO_HPP
#define MEDO_HPP
#include "eigen_short.hpp"
#include <vector>
namespace exoukf {
struct est_t {
vec<7> xm;
mat<7,7> Pxx;
};
struct meas_t {
vec<2> z;
mat<2,2> Pww;
double t;
ALNEW
};
struct coe_t {
double sma;
dou... | ALGO | 0.999421 | 6.191208 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-06-22T06:27:35.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6eec4fa12a005... |
c8b6aba9-6e66-4c43-82e5-3072e49b259b | shvedoff98/General_purpose | basics/memset.cpp | /*90% of the time you should use std::fill instead of memset.
This is because std::fill will work correctly with classes,
and it will also work when setting arrays of non-byte types to a non-zero value.
For example, you can memset an array of ints to 0 but
you can't memset an array of ints to 0x12345678. With std::fill... | TOOL | 0.997241 | 3.811358 | {
"github_metadata": {
"branch": "main",
"commit_count": 119,
"repo_created_at": "2021-01-18T22: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": "7b95667503... |
c9553f45-9959-4259-9796-da004f1899c9 | Kimhayoung0311/ICPC | Percolation.cpp | /*
#include <iostream>
using namespace std;
int mSIZE;
int nSIZE;
bool result=false;
int** vis;
void check(int *arr[],int row, int col,int n,int m){
if(row==mSIZE-1&& arr[row][col]==0){result=true; return;}
else if(col==0&&arr[row][col]==0 &&vis[row][col]==0){
vis[row][col]=1;
if(row !=0) c... | ALGO | 0.999931 | 4.051039 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-12-26T07:38: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": "ca6f1fa4db... |
eafb8624-8f92-40af-8612-7fa2e168a884 | inazz/leetcode | 543. Diameter of Binary Tree/ans.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999965 | 6.333403 | {
"github_metadata": {
"branch": "main",
"commit_count": 56,
"repo_created_at": "2024-05-26T04:45: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": "423a0682a64... |
8a8b4167-8cef-4105-8dec-f74a022515e1 | marionette-of-u/ext_ginac | ext_ginac/rewrite_system.hpp | #ifndef EXT_GINAC_REWRITE_SYSTEM_HPP
#define EXT_GINAC_REWRITE_SYSTEM_HPP
#include <ginac/ginac.h>
#include "logarithm2.hpp"
namespace ExtGiNaC{
using namespace GiNaC;
namespace detail{
inline ex reduce_proc(const ex &expression){
static const exmap equations = {
// exp & l... | ALGO | 0.970254 | 6.303086 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2013-02-20T14:01: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": "47c94ab3df... |
01f60717-6352-4d7b-8c0c-00dc0b627864 | mgrabovac22/SPA-practice | Bubble-sort/Bubble-sort-linked-list/bubble-sort.cpp | #include <iostream>
using namespace std;
class lista{
private:
lista *sljedeci;
public:
lista(){
sljedeci = NULL;
}
int N;
void dodavanje(int s){
lista *novi, *zadnji=this;
while(zadnji->sljedeci)
zadnji=zadnji->sljedeci;
novi = new lista;... | TOOL | 0.985749 | 3.776808 | {
"github_metadata": {
"branch": "main",
"commit_count": 196,
"repo_created_at": "2023-08-25T17:31: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": "bd828a7954... |
d7bbe32e-336e-4a5c-ba71-08a792e4fa68 | a2k34lttct/vnoi_solution | BANNER.cpp | /*Code by <NAME>*/
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(i) (1LL << (i))
#define bit_count(x) __builtin_popcount(x)
#define bit_countll(x) __builtin_popcountll(x)
#define fto(i, a, b) for (int i = (int) a; i <= (int) b; ++i)
... | ALGO | 0.99978 | 3.778939 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-22T14:55: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": "6098b23cc752... |
38e5cd43-db9c-47df-9d67-d0b92a9f70f7 | HHS-Proclub/hhs-pro-club-website | solutions/PRI4/akhare029@student.fuhsd.org.cpp | #include <bits/stdc++.h>
using namespace std;
int const NMAX = 100;
int t;
int n;
int x[1 + NMAX], d[1 + NMAX];
int main() {
cin >> t;
for(int tc = 1; tc <= t; tc++) {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> x[i] >> d[i];
}
bool ans = false;
... | ALGO | 0.999866 | 3.963596 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2021-09-09T02:23:55.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f08c702272e3... |
60c887c0-45b3-49c9-8634-f23e174e6a67 | hitengarg45/Striver_SDE_Sheet | NQueens.cpp | //* https://takeuforward.org/data-structure/n-queen-problem-return-all-distinct-solutions-to-the-n-queens-puzzle/
//* Examples:
//* Input: n = 4
//* Output: [[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
#include<bits/stdc++.h>
using namespace std;
//? Approach#1: Using Backtracking
//? We try to fi... | ALGO | 0.999974 | 6.588501 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2022-06-30T06:00: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": "9b0cad452... |
29ecb864-c484-443d-b2fc-4e7aeb34533d | julesep3/Prog2-CPP-Work | HW2/quickSort2.cpp | /*
<NAME>
Programming II
Due: 1 / 29 / 2020
Sorting Program
Bubble Sort, Shell Sort, Quick Sort, and a Main Program
*/
#include <iostream>
using namespace std;
int partition(int ar[], int l, int r)
{
while (l < r)
{
while ((l < r) && (ar[l] <= ar[r]))
r--;
swap(ar[l], ar[r]);
//cout << "L : " << ar[l] << e... | ALGO | 0.999903 | 4.871119 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2020-01-28T19:19:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "75c945986... |
41feb563-a22e-42ec-b4a3-1819f69f000c | BangYunseo/BOJ-note | 백준/Silver/1431. 시리얼 번호/시리얼 번호.cc | #include <iostream>
#include <algorithm>
#include <cctype>
using namespace std;
int N;
string arr[51];
int sumDigit(const string &a){
int sum = 0;
for(char word : a){
if(isdigit(word))
sum += word - '0';
}
return sum;
}
bool compare(const string &a, const string &b){
int le... | ALGO | 0.999893 | 5.471571 | {
"github_metadata": {
"branch": "main",
"commit_count": 1029,
"repo_created_at": "2023-10-15T07:11:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "851510aa1... |
a6ff7bd0-d4e0-44d7-95ed-6a3bc1c31ca2 | MaxVilaRuiz/Learning-Log | Course-CC---UPC/Q2/Theories/s6/bintree/bt9_BSTrand.cc | #include <algorithm> // std::random_shuffle
#include "bintree.hh"
#include "bintree-io.hh"
using namespace pro2;
using namespace std;
typedef BinTree<int> BT;
BT insertBST(BT t, int x) {
if (t.empty()) return BT(x);
if (x <= t.value()) {
return BT(t.value(), insertBST(t.left(), x), t.right());
} else {
re... | ALGO | 0.994715 | 5.119086 | {
"github_metadata": {
"branch": "main",
"commit_count": 319,
"repo_created_at": "2024-10-11T12:20: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": "269384be50... |
1b20eb43-dd89-4489-a547-b6bdb833b27f | Sudhir878786/MyLeetCode_Solutions | 92-reverse-linked-list-ii/92-reverse-linked-list-ii.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) {}
* };
*/
// This method does nothing but swaps the values ... | ALGO | 1 | 5.999092 | {
"github_metadata": {
"branch": "Sudhir",
"commit_count": 2704,
"repo_created_at": "2022-05-30T12:33:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5182e1... |
bb27f603-8eca-4f2f-984f-0b3b5ccb4be4 | Grdsznt/DMOJ-Solutions | CCC2022J5.cpp | //#include <bits/stdc++.h>
//#include <iostream>
//using namespace std;
//
///* TYPES */
//#define ll long long
// #define pii pair<int, int>
// #define pll pair<long long, long long>
// #define vi vector<int>
// #define vll vector<long long>
// #define mii map<int, int>
// #define si set<int>
// #define sc set<char>
... | ALGO | 0.999957 | 3.949165 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2023-09-24T14:12: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": "83cc0f4b0d7... |
e8ad6f0a-2ee1-42aa-86f0-b4eb18c93690 | sjnov11/Baekjoon-Online-Judge | p1021.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
class Node {
public:
int value;
Node* prev;
Node* next;
Node() {
prev = NULL;
next = NULL;
}
Node(int num) {
value = num;
prev = NULL;
next = NULL;
}
};
class Deque {
public:
Node* fr... | ALGO | 0.999985 | 3.600413 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-10-23T06:04: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": "262d98fc49... |
d98e7939-e64c-48fa-acec-afe10d09f21e | turn-sole/Data-structure-and-algorithm | 面试经典150题/14t.cpp | //1. 两数之和
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
for (int i = 0;; i++)
for (int j = i + 1; j < nums.size(); j++)
if (nums[i] + nums[j] == target)
return { i, j };
}
};
//219. 存在重复元素 II
class Solution {
public:
... | ALGO | 0.998025 | 4.605263 | {
"github_metadata": {
"branch": "main",
"commit_count": 145,
"repo_created_at": "2023-03-13T14:43: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": "006023bf66... |
c0d99abd-1e33-4862-986a-88566cd673ee | Yanstart/Rubyx | CodeRubixVFOpti.ino | //access the built-in servo library
#include <Servo.h>
#include "khaibao.h"
Servo Serv1a; //create a servo turn object named Serv1a
Servo Serv1b; //create a servo in out named Serv1b
Servo Serv2a; //create a servo object named Serv2a
Servo Serv2b; //create a servo object named Serv2b
Servo Serv3a; //create a servo... | ALGO | 0.998953 | 3.471352 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-03-07T06:32: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": "4caf045342a4... |
da739428-8d46-4425-8162-8ec7379ad7d1 | has2/Problem-Solving | boj/Backtracking/BOJ1987.cpp | //BOJ
//ID : 1987 // backtracking
//2017/09/17
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
int dy[4] = { 0,0,-1,1 };
int dx[4] = { 1,-1,0,0 };
int map[20][20];
bool selected[26], visited[20][20];
int R, C,ret;
void sol(int y, int x, int cnt) {
ret = max(cnt, re... | ALGO | 0.999382 | 3.514423 | {
"github_metadata": {
"branch": "master",
"commit_count": 585,
"repo_created_at": "2017-03-22T06:24:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f27b3bbe... |
ebf9a87c-81ba-4043-8ddb-a53edb4ced59 | northmachine/pat_test | a1018.cpp | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
using namespace std;
const int maxc = 110;
const int maxn = 510;
const int INF = 0x3fffffff;
struct node{
int s,t;
node(int _s,int _t):s(_s),t(_t){}
};
int bikes[maxn];
vector<node> adj[maxn];
bool vis[maxn];
int dis[maxn];
set<int> pre[maxn];
int ... | ALGO | 0.999992 | 3.514957 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-09-25T15:09:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6f478bfb7a... |
66d6c930-901d-4d84-9110-cebcf1108081 | RahuL25052002/Feb25 | CPP-MODULE/ExamPractise/Students.cpp | #include <iostream>
#include <vector>
#include <algorithm> //we have use for sort
using namespace std;
class Student {
protected:
string name;
int rollNumber;
float marks;
char grade;
public:
Student(string n, int roll, float m) {
name = n;
rollNumber = roll;
marks = m;
... | ALGO | 0.99825 | 6.453151 | {
"github_metadata": {
"branch": "main",
"commit_count": 133,
"repo_created_at": "2025-02-17T09:36:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1145d869a... |
93dc42db-53ad-4a44-9e62-a114464752e0 | Pavitar56/LeetCode | 2444-count-subarrays-with-fixed-bounds/2444-count-subarrays-with-fixed-bounds.cpp | class Solution {
public:
long long countSubarrays(vector<int>& num, int minK, int maxK) {
long ans = 0;
bool minFound = false, maxFound = false;
int start = 0, minStart = 0, maxStart = 0;
for (int i = 0; i < num.size(); i++)
{
if (num[i]... | ALGO | 0.999597 | 5.693314 | {
"github_metadata": {
"branch": "main",
"commit_count": 1634,
"repo_created_at": "2022-10-11T17:54:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4e9e151ae... |
4d90157b-5c0c-4297-8382-f7f5dc3c76d2 | MeetPatel2209/Leetcode-Questions | 2331-evaluate-boolean-binary-tree/2331-evaluate-boolean-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999963 | 6.020787 | {
"github_metadata": {
"branch": "main",
"commit_count": 1152,
"repo_created_at": "2023-12-06T04:05: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": "08e630f40... |
5964674b-2600-4779-a63c-e026d0919c14 | RobotEniac/leetcode | cpp/smallest_rectangle_enclosing_black_pixels.cpp | // Copyright (c) 2019, eniac
// All rights reserved.
//
// Author: eniac <<EMAIL>>
// Created: 2021/04/22 17:52:07
// Description: https://leetcode-cn.com/problems/smallest-rectangle-enclosing-black-pixels/
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include "util.h"
using namespace std... | ALGO | 0.999224 | 6.021724 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2018-11-22T14:10:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1306b475... |
2c0643ce-a536-4bd6-9851-11cc6df571f5 | haowron/algorithms | uvaoj/uva439.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repr(e, i) for (auto e: i)
#define all(x) x.begin(), x.end()
#defin... | ALGO | 0.999922 | 3.676304 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2020-08-19T13:20: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": "af616ed86... |
b889e181-9e21-44b4-a3d4-6297857741bf | princeofcrows/--cp | practice/cf/1900/A_2_Dual_Hard_Version.cpp | #include <bits/stdc++.h>
using namespace std;
// Data type
// #define int long long
#define ll long long
#define pii pair<int, int>
#define piii pair<int, pii>
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pii>
#define mii map<int, int>
#define msi map<string, int>
#define si set<int>
#defin... | ALGO | 0.999954 | 4.065013 | {
"github_metadata": {
"branch": "main",
"commit_count": 126,
"repo_created_at": "2023-09-21T17:15:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "82c41deac8... |
bbfe3b24-6773-4c2f-b8bf-ade9ceedc88b | studouglas/GEANT4-GPU | geant4.10.02/examples/extended/exoticphysics/channeling/src/XCrystalPlanarMoliereTempPotential.cc | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration... | ALGO | 0.995508 | 6.830665 | {
"github_metadata": {
"branch": "master",
"commit_count": 518,
"repo_created_at": "2015-09-13T23:36:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 40,
"forks": 18,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bebae2... |
6a394230-5ec5-4c9e-8970-aa859cc77b59 | lkoiescg2031/APSS | Baekjoon Online Judge/3955.cpp | #include <cstdio>
#include <tuple>
#include <algorithm>
using namespace std;
using ll = long long;
template <typename T>
tuple<T, T, T> extended_euclidean(T a, T b) {
if (b == 0) return make_tuple(a, 1, 0);
T gcd, x, y;
tie(gcd, x, y) = extended_euclidean(b, a % b);
return make_tuple(gcd, y, x - (a / b) * y);
}
t... | ALGO | 0.999679 | 3.842041 | {
"github_metadata": {
"branch": "master",
"commit_count": 250,
"repo_created_at": "2018-09-13T11:06:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9dd86aae... |
07e43606-c148-4a09-b675-82c63eaf450d | Nanahoshi74/ABC | 194/C.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = a; i <= (int)(b); i++)
typedef long long ll;
using namespace std;
ll nCk(ll a,ll b){
ll p = 1;
for(int i = 1; i <= b; i++){
p *= a-i+1;
p /= i;
}
return p;
}
int main(){
l... | ALGO | 0.999953 | 3.669142 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2023-11-07T06:53: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": "30c8687a1cbe... |
4b9f649d-71c9-4080-aad9-6cf393a9727c | weslleyromao/curso-de-cpp | desafio10.cpp | #include <iostream>
using namespace std;
int main(){
int l, c;
cout << "Qual e a quantidade de linhas: " << endl;
cin >> l;
cout << "Qual e a quantidade de colunas: " << endl;
cin >> c;
float matriz1[l][c], matriz2[l][c];
cout << "Digite abaixo os elementos da matriz 1: " << endl;
fo... | ALGO | 0.997148 | 4.251803 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2024-02-25T09:17: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": "34dd9f679cb... |
4c735034-8c05-4c20-a687-6d752e54397f | Jackal1586/LightOJ | LOJ-1403.cpp | #include<bits/stdc++.h>
using namespace std;
inline int RI() {
int ret = 0, flag = 1,ip = getchar_unlocked();
for(; ip < 48 || ip > 57; ip = getchar_unlocked()) {
if(ip == 45) {
flag = -1;
ip = getchar_unlocked();
break;
}
}
for(; ip > 47 && ip < 58; ... | ALGO | 0.999731 | 4.499582 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-01-28T16:27:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f0bc55916... |
8ba0137e-aa27-4044-9dc7-90f15da7ad48 | ivancea/Old-pet-projects | matrices.cpp | #include <iostream>
using namespace std;
template<class T>
class matrix{
T** _mat;
const size_t _x, _y;
void fill(){
_mat = new T*[_x];
for(size_t i=0; i<_x; i++)
_mat[i] = new T[_y];
}
public:
matrix(size_t x, size_t y, bool identity=0):_mat(0),_x(x),_y(y){
i... | ALGO | 0.986749 | 3.319955 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-12-14T15:56:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d532e85ba0... |
89dee8d8-e7c8-4f2e-8c97-1d71f20c3bb3 | Arifulhaque-02128/DSA | Module12(MidTerm)/queries.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public :
int val;
Node * prev;
Node * next;
Node (int val){
this->val = val;
this->prev = NULL;
this->next = NULL;
}
};
void insertAtTail(Node *&head, Node *&tail, int val){
Node *newNode = new N... | ALGO | 0.999863 | 4.133554 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2023-07-04T07:54: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": "4e984934781... |
14e4d7b5-3a0c-484d-bc5e-1ec039ccf5ab | TravisGurlik/aoc-solutions | 2021/Day 02/part1.cpp | /*
* Day 02: Drive! (https://adventofcode.com/2021/day/02)
* Hm, this feels familiar somehow...
* I almost used a stringstream for this. Almost.
*/
#include <iostream>
#include <fstream>
#include <string>
// Additional libraries for this Part:
using namespace std;
int main() {
string inputVal;
ifstream i... | ALGO | 0.998136 | 6.492653 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2020-12-14T17:13: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": "b991c5476f2... |
b962951b-799c-4aaf-88bd-6ebf328ec5e9 | Mattsmith1st/face-finder | src/NeuralNetworks.h | //----------------------------------------------------------------------------//
// NEURAL NETWORKS CLASSES AND DEFINITIONS //
//----------------------------------------------------------------------------//
// Author: <NAME>, e-mail: <EMAIL> //
// Licence: G... | ALGO | 0.991862 | 4.649833 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-03-14T16:53:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4f1d97daa... |
cd57919a-2c72-4647-b02a-f9a40fbcf182 | ravisaikumar88/apna_college_DSA_playlist | 97.1.diameter.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left;
Node* right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
/*int height(Node* root)
{
if(root == NULL)
{
return 0;
}
int Lheight = height(root->left);
... | ALGO | 0.99972 | 4.260497 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-10-21T09:32: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": "6421db14e182... |
3e0fdf7d-7042-4ecd-a06b-f49f88dafc32 | dlalsrn/Baekjoon | 백준/Silver/15658. 연산자 끼워넣기 (2)/연산자 끼워넣기 (2).cc | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <int> value;
vector <int> op(4);
int N, mx = -1000000000, mn = 1000000000;
void back(int ans, int cnt)
{
if (cnt == N)
{
mx = max(mx, ans);
mn = min(mn, ans);
return;
}
for (int i = 0; i < 4; i++)
{
if (!op[i])
cont... | ALGO | 0.999942 | 3.847982 | {
"github_metadata": {
"branch": "main",
"commit_count": 845,
"repo_created_at": "2022-10-18T11:21: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": "fd7957938b... |
423ed9c7-61e8-409d-a96c-aa1189aada71 | KhushalJangid/DSA | trees/bst.cpp | #include <iostream>
#include<queue>
#include <map>
#include <vector>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(){
this->data = 0;
}
Node(int data){
this->data = data;
}
};
Node* create_tree(int* arr,int l,int r){
if(l>r){
... | ALGO | 0.999986 | 4.181273 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-09-12T05:56:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "52df34199817... |
0abd062e-0e66-453b-a5a0-0381d0ba851b | ermolaevv/ppc-2024-autumn | tasks/mpi/yasakova_t_min_of_vector_elements/func_tests/main_yasakova.cpp | // Copyright 2023 <NAME>
#include <gtest/gtest.h>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/environment.hpp>
#include <random>
#include <vector>
#include "mpi/yasakova_t_min_of_vector_elements/include/ops_mpi_yasakova.hpp"
std::vector<int> RandomVector(int size, int minimum = 0, int maximum = 100) {
... | TEST | 0.916945 | 6.476631 | {
"github_metadata": {
"branch": "master",
"commit_count": 440,
"repo_created_at": "2024-10-04T18:18:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 157,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d67ce... |
8f7e76f4-3cd4-47f0-b339-2252a44cdaf6 | awaisnazir08/Cpp-programs | inDegreeoutDegree.cpp | #include<iostream>
#include<vector>
using namespace std;
class Graph
{
int num_of_vertices;
vector<vector<bool>> adjacencyMatrix;
vector<int>inDegrees, outDegrees;
public:
Graph(int v): num_of_vertices(v), adjacencyMatrix(v, vector<bool>(v, false)), inDegrees(v, 0), outDegrees(v, 0)
{
}
... | ALGO | 0.999931 | 6.137645 | {
"github_metadata": {
"branch": "main",
"commit_count": 49,
"repo_created_at": "2023-08-29T08:52:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf26a664ed2... |
da8702bf-a843-4629-a7a5-aafbc6f02821 | oneapi-src/oneAPI-samples | DirectProgramming/C++SYCL/Jupyter/gpu-optimization-sycl-training/03_Memory_Optimization/lab/buffer_mem_move_1.cpp | //==============================================================
// Copyright © Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
#include <sycl/sycl.hpp>
int main() {
constexpr int num_items = 1024*1000*1000;
std::vector<int> a(num_items);
for... | TOOL | 0.93474 | 4.450752 | {
"github_metadata": {
"branch": "main",
"commit_count": 2599,
"repo_created_at": "2020-05-27T04:52:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1054,
"forks": 727,
"issues": 59,
"pull_requests": 7
},
"file_meta": {
"content_id": "20a7... |
9042c66d-8c2a-4280-bcb5-06e3cfe955fe | gawletathagat/Leetcode-My-Solutions | graph-connectivity-with-threshold/graph-connectivity-with-threshold.cpp | class Solution {
public:
vector<int>size;
int findP( int u, vector<int>&p )
{
if( u == p[u] ) return p[u] ;
return p[u] = findP(p[u] , p) ;
}
void Union( int u, int v, vector<int>&p )
{
u = findP(u, p ) ;
v = findP(v , p) ;
if( u =... | ALGO | 0.999747 | 5.550581 | {
"github_metadata": {
"branch": "main",
"commit_count": 388,
"repo_created_at": "2021-07-20T18:27:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9c45b1df52... |
d00c8bd0-f7eb-4c4a-a120-f06c36fb2cb4 | Severus25/Data-Structures_Algorithms_Programs | Graphs/13. Erdos Renyl Model (for generating Random Graphs).cpp | #include <iostream>
#include <vector>
#include <random>
using namespace std;
// Function to generate a random graph using the Erdős-Rényi model
vector<vector<bool>> generateRandomGraph(int numNodes, double p) {
// Initialize a random number generator
random_device rd;
mt19937 gen(rd());
uniform_real_d... | ALGO | 0.999134 | 5.954769 | {
"github_metadata": {
"branch": "main",
"commit_count": 201,
"repo_created_at": "2022-10-05T12:46: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": "57f6eaaf64... |
bec930da-9703-4e49-b041-8623f7b5c94f | rukumar333/ProjectEuler | 16-powersums/main.cpp | #include <iostream>
#include <string>
void PowTwoBigInt(int index);
int powerSums[10001];
int numHolder[3011];
int numBeginIndex = 3010;
int main(){
int testCases = 0;
std::string temp;
std::getline(std::cin, temp);
testCases = std::stoi(temp);
int cases[testCases];
numHolder[numBeginIndex] =... | ALGO | 0.999662 | 4.921846 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2014-09-26T05:32: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": "c2d375806... |
39f18252-1d3f-421e-8736-7f5a7ebe3a16 | Irumyuui/ACM-Template | 图论/连通性/强连通分量/P3387.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include <debug.h>
#else
#define debug(...)
#endif
using namespace std;
#define cauto const auto
#define all(x) std::begin(x), std::end(x)
#define YES std::cout << "YES\n"
#define NO std::cout << "NO\n"
#if __cplusplus >= 202002L
namespace rgs = ranges;
#endif
template <... | ALGO | 0.999978 | 4.415482 | {
"github_metadata": {
"branch": "main",
"commit_count": 180,
"repo_created_at": "2023-01-23T03:03: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": "5548dee250... |
d89b8caa-99e3-4e0e-8030-c61beba4d854 | aphrim/codeforces-workspace | completed/1500/binary-string-reconstruction.cpp | //Category: 1500
//Link: https://codeforces.com/problemset/problem/1400/C
//Complexity: O(n)
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostr... | ALGO | 0.999855 | 4.46273 | {
"github_metadata": {
"branch": "master",
"commit_count": 64,
"repo_created_at": "2022-04-18T00: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": "b907f541b... |
790a7af2-1e10-4ac9-8168-ca8ac3442992 | TigranI/poker | poker1.cpp | #include <cmath>
#include <iostream>
#include <limits>
#include <random>
#include <vector>
#include "poker.hpp"
std::vector<double> Game::computePB(double x1, double x2, double y1, double y2, double y3) {
double ptotal = 0;
double estep = 0.01;
std::vector<double> pb;
for(double x = 0; x <= 1 + 0.001; x += ... | ALGO | 0.999844 | 4.295788 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-07-07T03:10: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": "429ff75c67... |
4159b722-7f21-4619-8d6c-067c888dccb4 | aliciamarzola/BasicCpp | 2.7.1 Exceptions/main.cpp | #include <iostream>
#include "vetor.h"
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
try {
int inicio, fim;
cin >> inicio >> fim;
if (inicio > fim) {
throw IntervaloVazio{ inicio, fim };
}
Vetor v(inicio, fim);
char op... | TOOL | 0.982647 | 5.317687 | {
"github_metadata": {
"branch": "main",
"commit_count": 107,
"repo_created_at": "2023-04-15T23:49: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": "acb3def37f... |
a901ccb7-654f-4fb2-a4ff-7d6201ea62d7 | tontide1/DSA | Lab/onTapDaiTra/c2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
struct NGAY
{
int ngay;
int thang;
int nam;
};
struct SANPHAM
{
char maSP[10];
char tenSP[255];
NGAY ngaySX;
int soNamBH;
};
void swap(SANPHAM &a, SANPHAM &b) {
SANPHAM temp = a;
a = b;
b = temp;
}
... | ALGO | 0.998486 | 3.915336 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2023-09-10T15:11: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": "923ca4dbab57... |
fc9e064c-7e91-4ac5-aec8-03e7730d2a18 | AsierFox/Skygine-sdl | Skygine-core/src/ai/AStarFinding.cpp | #include "AStarFinding.h"
AStarFinding::AStarFinding(TiledMap* map)
{
this->m_map = map;
this->reset();
}
void AStarFinding::findPath(Vector2D currentNode, Vector2D goalNode)
{
if (this->isGoalFounded())
{
return;
}
if (!this->m_isStartGoalInitialized)
{
this->clearOpenList();
this->clearVisitedList();... | ALGO | 0.998425 | 3.980889 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2016-04-10T17:54:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7183c7e2a... |
da697bf0-aabe-4bd6-ba2d-10c5423d476f | Dazegambler/squiroll | tools/condense_nut.cpp | #if __INTELLISENSE__
#undef _HAS_CXX20
#define _HAS_CXX20 0
#endif
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <string>
#include <string_view>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <array>
using namespace std::litera... | TOOL | 0.993197 | 6.097195 | {
"github_metadata": {
"branch": "main",
"commit_count": 490,
"repo_created_at": "2024-05-13T04:53:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 7,
"issues": 0,
"pull_requests": 3
},
"file_meta": {
"content_id": "332867e65... |
9cc62725-9077-425b-90f5-9698159ea44b | kamyu104/LeetCode-Solutions | C++/top-k-frequent-words.cpp | // Time: O(n + klogk) on average
// Space: O(n)
// Quick Select Solution
class Solution {
public:
vector<string> topKFrequent(vector<string>& words, int k) {
unordered_map<string, int> counts;
for (const auto& word : words) {
++counts[word];
}
vector<pair<int, string>> ... | ALGO | 0.999992 | 7.522384 | {
"github_metadata": {
"branch": "master",
"commit_count": 19395,
"repo_created_at": "2018-10-11T17:38:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4939,
"forks": 1616,
"issues": 1,
"pull_requests": 55
},
"file_meta": {
"content_id": ... |
ac7fd1fb-ded8-4e49-a683-1cfbaf1b9cad | shine-jung/2022-PPS | solutions/1260.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> p[1001];
bool vis_dfs[1001];
bool vis_bfs[1001];
int n, m, v, a, b;
void dfs(int x) {
cout << x << ' ';
vis_dfs[x] = 1;
for (int i = 0; i < p[x].size(); i++) {
int y = p[x][i];
if (!vis_dfs[y])
dfs(y);
}
}
void bfs(i... | ALGO | 0.999989 | 4.523577 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2022-01-04T03:56: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": "253bafa8d27... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.