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 |
|---|---|---|---|---|---|---|---|
d0b779fa-ca9a-4e70-a5a7-f8f93e4d7cac | turjohasnat/Codeforces | C++/Rating - 900/67. B. Sale/Solution.cpp | //C++ Solution:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dl;
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mid(l,r) ((r+l)/2)
#define left(node) (node*2)
#define right(node) (node*2+1)
#define mx_int_prime 999999937
#define endl "\n"
#define PI (2.0 ... | ALGO | 0.999997 | 4.146234 | {
"github_metadata": {
"branch": "main",
"commit_count": 661,
"repo_created_at": "2024-06-04T14:22: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": "6fec66e89a... |
7d4ce7f9-7d02-4411-b5bb-4216b0d4b029 | VA-run23/Data-Structures-And-Algorithms | Before Linked List-Done/tohRecursion.cpp | //Done
///IMPORTANT:
//TC : O(2^n)
#include <bits/stdc++.h>
using namespace std;
////source to helper to destination
void towerOfHanoi(int n, char src, char dest, char helper){
if(n==0){
return ;
}///THE MAIN LOGIC IS : BIGGER THING CANNOT BE ON THE SMALLER ONE.
towerOfHanoi(n-1, src, helper, dest... | ALGO | 0.999921 | 6.124136 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2025-01-04T07:47: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": "3f27ee3495a... |
f0dc2636-3642-4aa2-b230-99e0c7a5f4b8 | LuisEnilton/Maratona | Beecrowd/2440 - Famílias de Troia/solution.cpp | //
// Created by Luis on 06/07/2023.
//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define optimize \
ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define INF 1000000010
#define INFLL 100000000000000... | ALGO | 0.999863 | 4.231052 | {
"github_metadata": {
"branch": "main",
"commit_count": 204,
"repo_created_at": "2023-06-20T00:39: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": "846952551a... |
1d58e9a1-04a2-443c-a62c-a8391f8b209e | superveetz/data-structures-ass-2 | include/HashTable.hpp | #ifndef HASHTABLE_H
#define HASHTABLE_H
#include <iostream>
#include <algorithm>
using namespace std;
class HashTable {
private:
int* table;
int numElems;
int nullVal;
int delVal;
public:
int tableSize;
int numNonNull;
// constructor func
HashTable(int tableSize = 13) {
... | ALGO | 0.997775 | 5.939693 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-06-30T02:13: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": "17a7037a79... |
b657e843-7a4e-4bbf-a05d-7033a51554aa | attnishit/Competitive-Programming | codeforces/Codeforces Round #614 (Div. 2) by User nishit5/A - ConneR and the A.R.C. Markland-N.cpp |
1293 A - ConneR and the A.R.C. Markland-N.cpp GNU C++17 Accepted
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll... | ALGO | 0.99999 | 4.408372 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2020-04-20T11:38:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce0b5eb5e... |
a0f16148-3e4f-4215-9a60-c28be22379cf | rajvir2003/Data-Structures-Algorithms | Linked-List/Problems/add_2_numbers_as_linked_list.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
void traversal(Node* head){
Node* ptr = head;
while(ptr != NULL){
cout << ptr->data << " ";
ptr = ptr->next;
... | ALGO | 0.999979 | 5.856317 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2024-01-01T15:30:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a7bf88c98ee... |
81ad34ad-a23c-4581-9b3d-98d1b761a3f3 | kinhoy/practice_code | 1021_Deepest_Root.cpp | #include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
bool visited[10010];
int maxdepth = 0;
vector<vector<int>> v;
vector<int> queue;
set<int> s;
void dfs(int p, int depth)
{
if (depth > maxdepth)
{
queue.clear();
queue.push_back(p);
maxdepth = d... | ALGO | 0.999726 | 4.185511 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2021-03-04T15:35: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": "149d353b9... |
93819644-3965-484e-8575-48d8c261a677 | BCLCommons/bcl | source/descriptor/bcl_descriptor_molecule_3d_distribution.cpp | // (c) Copyright BCL @ Vanderbilt University 2014
// (c) BCL Homepage: http://www.meilerlab.org/bclcommons
// (c) BCL Code Repository: https://github.com/BCLCommons/bcl
// (c)
// (c) The BioChemical Library (BCL) was originally developed by contributing members of the Meiler Lab @ Vanderbilt University.
// (c)
// (c) T... | ALGO | 0.995907 | 6.402474 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2022-05-21T17:35:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 29,
"forks": 19,
"issues": 2,
"pull_requests": 1
},
"file_meta": {
"content_id": "3891aa2b... |
efc69837-cc68-43e3-b8da-c20a9e541bbb | chlau6/cpoj | cpp/leetcode/q68-text-justification.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<string> fullJustify(vector<string>& words, int maxWidth) {
vector<string> result;
int n = words.size();
int i = 0;
int j = 0;
while (i < n) {
int len = 0;
while (j < word... | ALGO | 0.999977 | 6.033618 | {
"github_metadata": {
"branch": "main",
"commit_count": 84,
"repo_created_at": "2021-10-18T07:20: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": "61cd7cb006a... |
1c41ddae-dbdc-4879-8d69-fffd57761597 | mongodb/mongo | src/third_party/boost/libs/math/include/boost/math/interpolators/detail/septic_hermite_detail.hpp | /*
* Copyright <NAME>, 2020
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_MATH_INTERPOLATORS_DETAIL_SEPTIC_HERMITE_DETAIL_HPP
#define BOOST_MATH_INTERPOLATORS_... | ALGO | 0.991409 | 7.44995 | {
"github_metadata": {
"branch": "master",
"commit_count": 90314,
"repo_created_at": "2009-01-15T16:15:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 27329,
"forks": 5655,
"issues": 0,
"pull_requests": 82
},
"file_meta": {
"content_id": ... |
9c9ee8e9-847f-408b-bf51-842aa2ebf802 | orfeotoolbox/OTB | Modules/Core/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h | /*
* Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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 ... | ALGO | 0.998308 | 7.690006 | {
"github_metadata": {
"branch": "develop",
"commit_count": 34510,
"repo_created_at": "2015-07-17T15:56:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 370,
"forks": 120,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "8e... |
474c8e40-1237-4401-b82d-2483e39998d1 | neharikarout/DSA | 7. Linked List/LL-1.cpp | #include<bits/stdc++.h>
using namespace std;
// struct Node : no OOP concepts so use class
class Node
{
public:
int data;
Node* next;
public:
Node(int data1 , Node* next1) // constructor
{
data = data1;
next = next1;
}
Node(int data1 )
{
data = data1;
}... | ALGO | 0.999905 | 4.658623 | {
"github_metadata": {
"branch": "main",
"commit_count": 125,
"repo_created_at": "2024-01-17T08:36: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": "7b44478023... |
a9a65f17-e5a5-49b0-97a1-a4c18aed12b1 | lehau007/AppliedAlgorithms | hustack/Tn/maximumRectangle.cpp | #include <vector>
#include <stack>
#include <iostream>
class Stack {
public:
std::vector<std::vector<int>> stack;
int size;
Stack() {
size = 0;
}
void push(int val, int cur_count = 1, int pre_count = 0) {
stack.push_back({val, cur_count, pre_count});
size++;
}
voi... | ALGO | 0.999965 | 5.57392 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-03-17T07:15:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "098f33fb5b34... |
c680e742-4f90-4418-813b-f66e01af8049 | PaulinaSzreder/AproksymacjaFunkcjamiSklejanymi | Source.cpp | #include <iostream>
#include <math.h>
#define NUMBERS 47
#define SCALE 2
using namespace std;
void crtMiddlePoints(double *distance, double *points)
{
double tmp = 0;
int k = 0;
for (int i = 0; i < NUMBERS - 1; i++)
{
tmp = distance[i + 1] - distance[i];
tmp = tmp / SCALE;
for (int j = 0; j < SCALE-1; j++... | ALGO | 0.999924 | 3.768378 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-04-24T07:25:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0db0db5717... |
ca2ec56b-b5c1-4a1b-9c3c-eb1de84816ce | h6ah4i/cxxdasp | include/cxxdasp/filter/digital_filter.hpp | //
// Copyright (C) 2014 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... | TOOL | 0.939455 | 6.820687 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2014-11-16T15:01:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 31,
"forks": 12,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1a473b... |
78ac49d5-d1f0-46e2-8502-fd55c35d8d7f | fura2/competitive-programming-codes | atcoder/past/past202004-open/o1.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
template<class T> struct edge{
int to;
T wt;
edge(int to,const T& wt):to(to),wt(wt){}
};
template<class T> using weighted_graph=vector<vector<edge<T>>>;
template<class T>
void add_edge(weighted_graph<T>& G... | ALGO | 0.999973 | 3.790754 | {
"github_metadata": {
"branch": "main",
"commit_count": 225,
"repo_created_at": "2021-05-05T15:14: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": "f965539be7... |
c601ff2b-ae79-42fe-9815-e2b2947abab7 | mrmosch/AdvancedMathematics | Praktikum_3/main.cpp | #include <iostream>
#include "DGL_Solver.h"
#include "CMyVektor.h"
using namespace std;
CMyVektor dglF(CMyVektor y, double x)
{
CMyVektor erg(2);
erg.setKomponente(0, (2 * y.getKomponente(1) - x * y.getKomponente(0)));
erg.setKomponente(1, (y.getKomponente(0)*y.getKomponente(1) - 2 * (x*x*x)));
return erg;
}
... | ALGO | 0.996715 | 3.790737 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2019-04-04T11:15: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": "13fbec978... |
09267b4b-2437-41b2-9c4b-cac1a4ce77b7 | fern17/geometriacomputacionalFICH | chgrahamscan/grafico/chGrahamScanGrafico.cpp | #include <list>
#include <stack>
#include "Point2D.h"
#include <iostream>
#include <GL/glut.h>
#include <algorithm>
std::stack<Point2D> S;
std::list<Point2D> Q;
std::list<Point2D> QQ;
std::pair<Point2D, Point2D> fPair;
float maxDist;
void reshape_cb (int w, int h) {
if (w==0||h==0) return;
glViewport(0,0,w,h)... | ALGO | 0.997645 | 4.14474 | {
"github_metadata": {
"branch": "master",
"commit_count": 66,
"repo_created_at": "2012-03-26T13:46:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc3875f2c... |
61fb0598-1fca-4f26-8b6e-10fc360493ba | ffengc/BitCode | C++/0808模板/0808模板/test.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cassert>
using namespace std;
//模板 -- 泛型编程
#if false
void Swap(int& left, int& right)
{
int temp = left;
left = right;
right = temp;
}
void Swap(double& left, double& right)
{
double temp = left;
l... | ALGO | 0.962085 | 4.159161 | {
"github_metadata": {
"branch": "main",
"commit_count": 184,
"repo_created_at": "2023-02-02T15:20:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "22ba971da... |
d442c656-9226-4765-be92-b5c90caa8fa2 | tayyabarfaq/Candy-Crush | mycandycrushing/Source.cpp | #include<iostream>
#include<conio.h>
#include<cstdlib>
#include"help.h"
#include<dos.h>
#include<stdlib.h>
#include<time.h>
#include <chrono>
#include <ctime>
using namespace std;
int elapsed = 0; int score = 0;
void Cross(int x, int y) //shape=cross
{
myLine(x, y, x + 40,... | ALGO | 0.990724 | 3.22622 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-07-11T15:07:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "12de2c545d64... |
b525fd26-359b-4caa-8dd3-f12d4785204c | sxs-collaboration/spectre | src/Evolution/Systems/GrMhd/ValenciaDivClean/Flattener.cpp | // Distributed under the MIT License.
// See LICENSE.txt for details.
#include "Evolution/Systems/GrMhd/ValenciaDivClean/Flattener.hpp"
#include <array>
#include <cstddef>
#include <limits>
#include <pup.h>
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/EagerMath/DotProduct.hpp"
#include "D... | TOOL | 0.969656 | 6.268314 | {
"github_metadata": {
"branch": "develop",
"commit_count": 17103,
"repo_created_at": "2017-04-07T17:28:20.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 168,
"forks": 202,
"issues": 530,
"pull_requests": 57
},
"file_meta": {
"content_id": ... |
01ed2d0f-51a6-45dd-b857-3e8620dcca94 | MdShah-alam/D-S-Tree | question-10.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int data)
{
this->data=data;
left=NULL;
right=NULL;
}
};
void print(Node *root)
{
if(root==NULL)
return ;
cout<<root->data<<" ";
print(root->le... | ALGO | 0.999988 | 3.653505 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-09-04T07:17: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": "a1954ef9424a... |
1ada6317-4a04-4045-b45d-d90aa885b2cf | marioyc/Online-Judge-Solutions | TJU/2714 - Collecting Bugs.cpp | #include <cstdio>
using namespace std;
double dp[1001][1001];
int main(){
int n,s;
scanf("%d %d",&n,&s);
for(int i = n;i >= 0;--i){
for(int j = s;j >= 0;--j){
if(i == n && j == s) dp[i][j] = 0;
else{
dp[i][j] = n * s;
... | ALGO | 0.998646 | 3.020308 | {
"github_metadata": {
"branch": "master",
"commit_count": 364,
"repo_created_at": "2010-09-24T16:07:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 603,
"forks": 359,
"issues": 1,
"pull_requests": 9
},
"file_meta": {
"content_id": "8d46... |
e28bd6e2-7ca2-43ed-b7f8-c3edef8a6708 | ongyiumark/programming-problems | Atcoder/ABCs/001 - 099/ABC092/ABC092D.cpp | /*
Let's use a 100 by 100 grid.
Fill the left half with black and the right half with white.
We now have 1 connected component for each.
To create another white connected component, we turn individual cells in the black side to white.
By skipping intervals of 2, we create one additional connected component.
... | ALGO | 0.999634 | 3.570434 | {
"github_metadata": {
"branch": "main",
"commit_count": 227,
"repo_created_at": "2020-10-09T05:36: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": "370e5f4ef1... |
d2bad017-534b-42c6-b698-3431a5a050ad | mayank2903/CodeChef-Solutions | mb1994UVHST.cpp | #include<bits/stdc++.h>
#define lol long long
#define mp make_pair
#define pb push_back
using namespace std;
bool marked[1000001];
vector<pair<int, int> > adj[1000001];
priority_queue<pair<lol, int>, vector<pair<lol,int> >, less<pair<lol, int> > >qq;
pair<lol, int> top;
int main()
{
int n,m,a,b,nb2,tot,u,v;
... | ALGO | 0.999997 | 3.266333 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2015-02-10T20:36:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "09d2564c40... |
6241b426-1acf-4fc4-8fbd-70513a518ad3 | ericbrandwein/competencias | Codeforces/1392/b/b.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define elif else if
#define ll long long i... | ALGO | 0.999931 | 4.108485 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-05-28T02:53: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": "6c1b67730e... |
acdc0a8f-d38f-4448-a1ab-d5259ffa3d98 | miaortizma/competitive-programming | online_judges/cf/102448/d/d.cpp | #include<bits/stdc++.h>
using namespace std;
// By <NAME> https://github.com/miaortizma
constexpr int MAXN = 5 + 100000;
int n;
struct P {
int x,y,r;
long double d;
} points[MAXN];
long double dist(const P& p, const P& q) {
long double dx = p.x - q.x, dy = p.y - q.y;
return sqrt(dx*dx + dy*dy);
}
bool ok(l... | ALGO | 0.999601 | 4.342849 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2018-02-19T03:21:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "274d80680... |
bff8a92b-a4db-47d9-80ff-ab10735ed4bc | jay754/riddles | data-structures/linkedlist/linkedlist.cc | #include <iostream>
#include <stdlib.h>
struct Node{
int value;
struct Node *next;
};
struct Linkedlist{
struct Node *head;
};
struct Linkedlist* createLinkedlist(){
struct Linkedlist* list = (struct Linkedlist*)(malloc(sizeof(struct Linkedlist)));
list->head = NULL;
return list;
}
void addNode(struct L... | ALGO | 0.999508 | 5.17723 | {
"github_metadata": {
"branch": "master",
"commit_count": 128,
"repo_created_at": "2013-12-03T07:55:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "796dd4de... |
0bb27442-efca-48c9-ac9f-e578b2f6e8b1 | ishandutta2007/codeforces-w | weakesttopology/normal/466/E.cpp | #include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) begin(X), end(X)
#define size(X) (int)std::size(X)
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3... | ALGO | 0.999559 | 4.182217 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:34: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": "1a93a02e36c1... |
e1983f46-b947-4bb9-9f1b-e1189074af5f | charlieusc/Leetcode_2017 | C++/18_4Sum.cpp | class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
sort(nums.begin(), nums.end());
int len = nums.size();
vector<vector<int>> ret;
for (int i=0; i<len; i++) {
int a = nums[i];
for (int j=i+1; j<len; j++) {
int... | ALGO | 0.999946 | 5.954742 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2017-01-17T20:04: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": "fde2c1dfd... |
64d331ad-def3-47e1-9dea-6fc853bb65ec | patrickwang96/lc-lib | 000-100/064 Minimum Path Sum.cpp | #include "header.h"
// https://leetcode.com/problems/minimum-path-sum/
class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
vector<vector<long long>> map;
int m = grid.size();
int n = grid[0].size();
for (int i = 0; i < m ;++i) {
vector<long long> tmp(n, ... | ALGO | 0.999863 | 5.62278 | {
"github_metadata": {
"branch": "master",
"commit_count": 49,
"repo_created_at": "2020-02-21T10:28:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "514c19e4c... |
8da9948b-5db6-4073-a5f8-6c2839d6a121 | prisms-center/CASMcode | include/casm/symmetry/SymCompare.hh | #ifndef CASM_SymCompare
#define CASM_SymCompare
#include <memory>
#include <utility>
#include "casm/global/definitions.hh"
#include "casm/misc/cloneable_ptr.hh"
namespace CASM {
class SymOp;
class SymOpRepresentation;
/// \brief CRTP base class for implementing element and orbit comparison
///
/// Derived needs to... | ALGO | 0.957651 | 7.379795 | {
"github_metadata": {
"branch": "1.X",
"commit_count": 3175,
"repo_created_at": "2015-09-14T04:21:07.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 113,
"forks": 73,
"issues": 110,
"pull_requests": 6
},
"file_meta": {
"content_id": "35439b... |
a933fdab-d18a-438c-8a4c-45a5486d0b19 | ishandutta2007/codeforces-s | smax/normal/1262/D2.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
if (a.first == b.first)
retur... | ALGO | 0.999972 | 4.450276 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "55b44e845f34... |
ac42ca98-7000-4f08-9010-21539f0423c3 | GaoLon/pp | src/gen/src/pp.cpp | #include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl_conversions/pcl_conversions.h>
#include <iostream>
#include <pcl/filters/extract_indices.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/Vector3.h>
#include <math.h>
#include <nav_msgs/Odometry... | DATA | 0.987433 | 4.596225 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2024-09-13T06:21: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": "dfb5fd6e6c... |
31c31d22-8913-4340-9389-a7accac0e541 | norizara/BIBLE | C Programming/CAWU_2/DATA_STRUCT/Practice_Session/crytoHashQuiz.cpp | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 50
struct Data{
char coin[5];
double price;
Data *next;
} *arr[SIZE];
int midSquare(char coin[]){
int len = strlen(coin);
int mid = len/2;
int sum = 0;
for(int i = 0; i < len; i++){
sum += coin[i];
}
printf("Sum: %d\n"... | ALGO | 0.992435 | 4.062283 | {
"github_metadata": {
"branch": "main",
"commit_count": 92,
"repo_created_at": "2025-01-17T09: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": "42dc92c58c4... |
a9bb49d1-38c5-440d-87aa-d5681fe458cc | henryoier/leetcode | 358_RearrangeStringKDistanceApart/358_RearrangeStringKDistanceApart.cpp | /*************************************************************************
> File Name: 358_RearrangeStringKDistanceApart.cpp
> Author: <NAME>
> Mail: <EMAIL>
> Created Time: Thu Oct 20 00:27:59 2016
************************************************************************/
#include<iostream>
using namespace std;... | ALGO | 0.999998 | 5.227283 | {
"github_metadata": {
"branch": "master",
"commit_count": 378,
"repo_created_at": "2016-07-16T05:08:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "39f6712d... |
991dccea-17ab-4390-9179-e72b29bdcf9b | ttoino/feup-da-proj1 | includes/scenarios.hpp | #ifndef DA_PROJ1_SCENARIOS_HPP
#define DA_PROJ1_SCENARIOS_HPP
#include <chrono>
#include <functional>
#include <utility>
#include <vector>
#include "dataset.hpp"
#include "order.hpp"
#include "utils.hpp"
#include "van.hpp"
/**
* @brief Represents the results of a scenario.
*/
struct ScenarioResult {
/** @brief... | ALGO | 0.997122 | 7.472847 | {
"github_metadata": {
"branch": "main",
"commit_count": 59,
"repo_created_at": "2022-04-07T13:16:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb5cc109107... |
a1ee229c-a52d-49ed-a9a2-672c6578e775 | LionZhY/LeetCode-ACM | hot100/lc199.cpp | #include <vector>
#include <queue>
#include <iostream>
using namespace std;
// 199 二叉树的右视图
struct TreeNode
{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
vector<int> rightSideView(TreeNode* root)
{
vector<int> result;
queue<TreeN... | ALGO | 0.999917 | 5.499135 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2025-06-26T02:49: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": "e515580efba... |
3da90d59-c64e-4723-bc03-a9d687f2452f | ck89119/Algorithm | AoC/2024/d6_p2.cpp | #include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << __LINE__ << " : "<< #x << " = " << (x) << endl
#define clr(a, x) memset(a, x, sizeof(a)) //0:0, -1:-1, INF:0x3f, -INF:0xc0
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define lowbit(x) x & (-x)
typedef long long ll;
typedef pair<i... | ALGO | 0.999938 | 4.00678 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2015-01-30T05:58:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9af7a6b07... |
536d4c83-0edc-4204-9ba5-2bd588787980 | mit-biomimetics/Cheetah-Software | common/src/SparseCMPC/OsqpTriples.cpp | #include "SparseCMPC/SparseCMPC.h"
#include "osqp.h"
#include <Utilities/Timer.h>
struct OsqpCSC {
u32 nnz, m, n;
c_float* values = nullptr;
c_int* colPtrs = nullptr;
c_int* rowIdx = nullptr;
void alloc(u32 _n, u32 _nnz) {
nnz = _nnz;
n = _n;
m = _n;
values = new c_float[nnz];
colPtrs = ... | ALGO | 0.998881 | 5.035021 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2019-06-17T20:27:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2931,
"forks": 985,
"issues": 55,
"pull_requests": 5
},
"file_meta": {
"content_id": "7b8bc... |
34abbaed-79bc-4cf6-81f6-188e0c401ba7 | sansurrogate/PrimeFlower | src/Factrize.cpp | #include "Factrize.hpp"
/*与えられた集合内の素数を降順で返す*/
std::list<int> sieve(std::list<int> primes) {
if(!primes.empty()) {
int first = primes.front();
auto itr = primes.begin();
while(itr != primes.end()) {
if(*itr % first == 0) {
itr = primes.erase(itr);
} ... | ALGO | 0.998544 | 3.1177 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2015-07-06T14:31: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": "d9a582d32... |
4dcef4c8-4212-4d36-8a47-5512fe314c3b | Glanshammar/VistaFramework | Vista/Core/DataTypes/VArraySpecializations.cpp | #include <VArray>
#include <VString>
#include <string>
// Specialized implementation for VArray<VString>::join
template<>
VString VArray<VString>::join(const VString& separator) const {
if (isEmpty()) {
return VString();
}
// Create a new VString for the result - copying the first element
... | TOOL | 0.927614 | 7.336743 | {
"github_metadata": {
"branch": "master",
"commit_count": 136,
"repo_created_at": "2024-06-25T12:23: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": "26be8050... |
9c68666a-90fd-4105-8339-658a0b3d58f4 | changicho/algorithm-training | LeetCode/easy/1652. Defuse the Bomb/code.cpp | #include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
// use brute force
// time : ... | ALGO | 0.99999 | 6.060008 | {
"github_metadata": {
"branch": "master",
"commit_count": 2455,
"repo_created_at": "2019-09-02T14:53:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 44,
"forks": 4,
"issues": 25,
"pull_requests": 0
},
"file_meta": {
"content_id": "b8a83... |
a695712a-74ae-4f7f-9b73-34796c4eb4b4 | tovfer17/CollegeXcode | algoexercise20/main.cpp | //
// main.cpp
// algoexercise20
//
// Created by <NAME>
//
#include <iostream>
using namespace std;
template<typename T>
void selectionSort(T*a, int size){
T insert;
for(int j=0; j<size; j++){
insert=a[j];
int item =j;
while (item >0 && a[j-1]>insert){
a[item]=a[it... | ALGO | 0.999734 | 4.62408 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-12-01T02:24: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": "e03c43ae1557... |
30d65d5d-3f95-4791-b4f3-6e10649e275a | jbiccler/AdventOfCode2022 | day03/cpp/day03.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <set>
#include <string>
#include <vector>
using namespace std;
set<char> find_common(vector<string> &v)
{
if (v.size() < 2)
{
return set<char>{};
}
vector<set<char>> sep;
for (int i = 0; i < v.size(); i++)
{
se... | ALGO | 0.999582 | 4.952331 | {
"github_metadata": {
"branch": "main",
"commit_count": 47,
"repo_created_at": "2022-12-27T14:35: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": "c34ef4dad52... |
36e50b26-e4b6-4558-858d-8a63ea7982a7 | leimingyu/FiberScattering | CPU/fiber_cpu.cpp | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // getopt
#include <time.h>
#include <sys/time.h>
#include <math.h> // pi
#include <string.h> // strcmp
#include <iostream>
#include <vector>
#include "util_vector.h"
#define FOUR_PI (4 * M_PI)
#define INV_PI (M_1_PI)
const float
d_atomC[9]={ 2.31000, ... | ALGO | 0.998461 | 3.870906 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2015-02-28T15:53:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "24e34f87f... |
d3bb4391-9969-4b8d-a1e5-a386ede7ff11 | aishwaryaverma05/Leet-code | 966-binary-subarrays-with-sum/binary-subarrays-with-sum.cpp | class Solution {
public:
int numSubarraysWithSum(vector<int>& nums, int goal) {
// brute force
// int total=0;
// int n=nums.size();
// for(int i=0;i<n;i++){
// for(int j=i;j<n;j++){
// int sum=0;
// for(int k=i;k<=j;k++){
// ... | ALGO | 0.999949 | 5.77452 | {
"github_metadata": {
"branch": "main",
"commit_count": 27,
"repo_created_at": "2025-01-22T04:52: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": "bd024122401... |
6e63ae6d-74a8-4b40-b2a2-713c38213bf8 | Yu0727Harada/pro_con | ABC/ABC122/c.cpp | //
// Created on 2020/07/29.
//
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint>... | ALGO | 0.999847 | 4.786165 | {
"github_metadata": {
"branch": "master",
"commit_count": 142,
"repo_created_at": "2020-08-09T08:23:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "696a3fab... |
0fa06fbe-d4c4-405d-b6d2-16d9f49704e0 | xhzhuhit/Practice_concepts_autopilot_localization | test_state_machine/main.cpp | #include <iostream>
enum STATUS {
INIT = 0,
DO_A = 1,
DO_B = 2,
DO_C = 3,
DO_D = 4,
EXIT = 5
};
STATUS do_preprocess() {
std::cout << "ganle chushihua !" << std::endl;
return DO_A;
}
STATUS do_athing() {
std::cout << "aaaaa !" << std::endl;
return DO_C;
}
STATUS do_bthing() {... | ALGO | 0.967819 | 4.37148 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-01-08T06:50:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7028b67da7... |
336cbdab-823f-47e0-a204-8e22575d8216 | kaartikn/options-pricing-simulation | montecarlo_multi_thread.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <random>
#include <thread>
#include <mutex>
#include <chrono>
std::mutex mtx;
double generateNormalRandom() {
static thread_local std::random_device rd;
static thread_local std::mt19937 generator(rd());
static thread_local std::normal_distri... | ALGO | 0.998249 | 6.188334 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-10-08T11:21: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": "d9a7a1dd4032... |
8a7323f0-7ee0-4977-a684-ef18e41959cf | Yonghui56/ComponentialMultiphase | UserModules/FemGroundwaterFlow/HeadBasedGWTimeODELocalAssembler.h | /**
* Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.com/LICENSE.txt
*
*
* \file GWTimeODELocalAssembler.h
*
* Created on 2012-07-13 by <NAME>
*... | ALGO | 0.971607 | 5.326701 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2015-09-21T09:42:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3eac2b39... |
df026fb5-ce70-4b48-99de-1c7ff43a123f | unluckyjung/Algorithm | BaekJoon/1913.cc | #include <bits/stdc++.h>
using namespace std;
int board[1001][1001];
int find_num, find_nx, find_ny;
int n, cnt;
void num_check(int nx, int ny) {
if (cnt == find_num) {
find_nx = nx;
find_ny = ny;
}
}
void output() {
for (int i = 1; i <= n; ++i) {
for (int ii = 1; ii <= n; ++ii) {
cout << board[i][ii] <... | ALGO | 0.999931 | 3.122774 | {
"github_metadata": {
"branch": "master",
"commit_count": 773,
"repo_created_at": "2019-03-11T09:43:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cb31205a... |
916114a4-d905-4bae-9817-ccf4affb2d73 | NghiaNgo0409/LuyenCode | Unit8/Bai486.cpp | #include <iostream>
#include <math.h>
using namespace std;
struct DonThuc
{
int a;
int n;
};
void Input(DonThuc& dt)
{
cout << "Nhap he so: ";
cin >> dt.a;
cout << "Nhap bac don thuc: ";
cin >> dt.n;
}
void Output(DonThuc dt)
{
cout << dt.a << "*x^" << dt.n << endl;
}
DonThuc Nhan2DonThuc(Do... | ALGO | 0.998741 | 3.768564 | {
"github_metadata": {
"branch": "master",
"commit_count": 202,
"repo_created_at": "2021-08-09T04:25:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9edd55c... |
4dd814eb-7c67-484e-a866-9d9db240a25c | cs2100-utec-aed-2019ii/cs2100-pointerfuncs-Johoyos | bubblefunc.cpp | /*------DECLARATIONS------*/
#include <iostream>
using namespace std;
/*_bubblesort_ con punteros a funcion*/
void * _bubblesort_(void * _array_,int _tam_ , void (*_puntero_) (void *, int _i, int _k)){
for (int i = 0; i < _tam_ ; i ++)
for(int k = 0; k < _tam_-1; k++)
_puntero_(_array_,k,k+1);
return _array_;
... | ALGO | 0.999534 | 4.56405 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-08-22T22:51: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": "52a67d960a6... |
895dd6ca-53e1-4986-afa4-cc90755a21cc | RobotLocomotion/drake | geometry/optimization/cspace_free_structs.h | #pragma once
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "drake/common/drake_copyable.h"
#include "drake/common/parallelism.h"
#include "drake/common/symbolic/rational_function.h"
#include "drake/geometry/optimization/c_iris_collision_geometry.h"
#include "drake/solvers/mathemat... | ALGO | 0.995271 | 6.734809 | {
"github_metadata": {
"branch": "master",
"commit_count": 33726,
"repo_created_at": "2014-01-26T16:11:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3630,
"forks": 1305,
"issues": 690,
"pull_requests": 46
},
"file_meta": {
"content_id":... |
0dc27bfa-5528-4296-b520-759cdd134050 | alexandraback/datacollection | solutions_1483488_0/C++/Yeomin/c.cpp | #include <cstdio>
#include <set>
using namespace std;
int t, cases;
int lng(int n)
{
if (n < 10) return 1;
if (n < 100) return 10;
if (n < 1000) return 100;
if (n < 10000) return 1000;
}
int solve(int n, int m)
{
set<pair<int, int> > s;
for (int i = n; i <= m; ++i)
{
int p, lngi;
if (n < 10) continue;
... | ALGO | 0.999518 | 4.540009 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d15513d0... |
f56ecbec-1173-4d55-8b3d-3342883e6633 | hurryabit/codeeval.com | LightsOut.cpp | //
// LightsOut.cpp
// PrepareGoogle
//
// Created by <NAME> on 18.02.16.
// Copyright © 2016 <NAME>. All rights reserved.
//
#include <bitset>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
struct Bits128 {
uint64_t high, low;
Bits128(uin... | ALGO | 0.999529 | 4.384786 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-02-16T15:04: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": "4a885d3081... |
d52d02c7-794d-4e85-bce4-b5bf3bcae588 | trilinos/Trilinos | packages/rol/src/sol/function/randvarfunctional/risk/fdivergence/ROL_Chi2Divergence.hpp | // @HEADER
// *****************************************************************************
// Rapid Optimization Library (ROL) Package
//
// Copyright 2014 NTESS and the ROL contributors.
// SPDX-License-Identifier: BSD-3-Clause
// *************************************************************************... | ALGO | 0.982529 | 6.201482 | {
"github_metadata": {
"branch": "master",
"commit_count": 104031,
"repo_created_at": "2015-11-16T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 593,
"issues": 263,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
cf4f09a8-b0b9-4835-b55f-81c39b84ea43 | zuzhiang/ACM | Trie(字典)树.cpp | /*
1、插入
假设存在字符串str,Trie树的根结点为root。i=0,p=root。
1)取str[i],判断p->next[str[i]-97]是否为空,若为空,则建立结点temp,并将p->next[str[i]-97]指向temp,然后p指向temp;
若不为空,则p=p->next[str[i]-97];
2)i++,继续取str[i],循环1)中的操作,直到遇到结束符'\0',此时将当前结点p中的 exist置为true。
2、查找
假设要查找的字符串为str,Trie树的根结点为root,i=0,p=root
1)取str[i],判断判断p->next[str[i]-97]是否为空,若为... | ALGO | 0.999969 | 4.098598 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-12-15T00:52:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e94bd2cc4a... |
0b516841-6aaf-44c4-b083-633528eccedc | Ni-Sun/SWJTU-computer-graphics | Experiment-2/GeometryRelations.cpp | #include "GeometryRelations.h"
double dis_point_to_line(POINT P, Line A)
{
return fabs((P-A.s)^(A.e-A.s))/len(A.s,A.e);
}
//直线和圆的关系
int relation_line_and_circle(Circle A, Line B)
{
double dst=dis_point_to_line(A.O,B);
if(dst<A.r) return 2;
else if(fabs(dst-A.r)<=1e-6) return 1;
return 0;
}
//两... | ALGO | 0.998897 | 3.924469 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-10-15T07:27:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8280de49322... |
974a45d6-169e-47c1-93f5-788938ed021d | krishna25092005/LeetCode_Solutions | 0003-longest-substring-without-repeating-characters/0003-longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
// Hash map to store the last index of each character
unordered_map<char, int> lastSeen;
int maxLength = 0; // To store the maximum length of substring
int start = 0; // Start index of the current window
... | ALGO | 0.999613 | 6.716979 | {
"github_metadata": {
"branch": "main",
"commit_count": 1092,
"repo_created_at": "2024-07-27T08:00:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94622a8fe... |
fb12498f-0d9a-41fd-9665-f0ab1a260e0a | dmnfarrell/peat | UFFBAPS/methods/nn_fitter.cpp | /*
#
# UFFBAPS - Unified Force Field for Binding And Protein Stability
# Copyright (C) 2010 <NAME> & <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | ALGO | 0.979443 | 4.707966 | {
"github_metadata": {
"branch": "master",
"commit_count": 620,
"repo_created_at": "2015-07-27T09:05:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "25147c6b... |
8b940035-4c99-47ee-834c-9283be45af89 | daniel-cin/estudos-emulador | testes_multi_plataforma/profiler/src/main.cpp | #include <Arduino.h>
#include "Benchmark.h"
#define BAUD 115200
#define N 10
/*Variaveis para o teste*/
/*que feio, variaveis globais*/
int alea[N] = {74, 39, 102, 57, 86, 91, 32, 65, 78, 23};
int worst[N] = {102, 91, 86, 78, 74, 65, 57, 39, 32, 23};
int best[N] = {23, 32, 39, 57, 65, 74, 78, 86, 91, 102};
int target... | TEST | 0.93144 | 4.625368 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2023-07-14T00:31: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": "13de5985d1e... |
fce5d97d-7214-4ef6-97e5-12e39f4cf7c2 | Minipoloalex/comp_prog | codeforces/problems/2050/F/F.cpp | #include <bits/stdc++.h>
using namespace std;
// supports point update, range query
template <typename T>
struct seg_tree {
int n;
vector<T> t;
// neutral element: inf in min seg_tree, 0 in sum seg_tree, ...
const T iden = 0;
seg_tree(int sz) : n(sz), t(2 * sz, iden) {}
seg_tree(const vector... | ALGO | 0.999932 | 4.598567 | {
"github_metadata": {
"branch": "main",
"commit_count": 529,
"repo_created_at": "2023-08-01T10:35: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": "188ff97946... |
539098ae-93af-45cf-adf7-2faabd3e4012 | kahowang/sensor-fusion-for-localization-and-mapping | 第一章 概述/lidar_localization/third_part/gtsam-4.0.2/gtsam/slam/EssentialMatrixFactor.h | /*
* @file EssentialMatrixFactor.cpp
* @brief EssentialMatrixFactor class
* @author <NAME>
* @date December 17, 2013
*/
#pragma once
#include <gtsam/nonlinear/NonlinearFactor.h>
#include <gtsam/geometry/EssentialMatrix.h>
#include <gtsam/geometry/SimpleCamera.h>
#include <iostream>
namespace gtsam {
/**
* Fac... | ALGO | 0.978323 | 3.504986 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2021-08-15T10:36:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 747,
"forks": 256,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "801365c... |
e01b739d-991a-4ece-bd0a-a8d1229a9df7 | Pratik333-droid/trivial-projects | NM-labs/lab1/bisection.cpp | #include <iostream>
#include <cmath>
using namespace std;
// find the root of the equation x^2 cosx + x sinx using the bisection method
float functionValue (float x)
{
return (x* cos(x) - x* sin(x));
// return (pow(x,3)- 3*x - 9);
}
void findRoots (float a, float b, float err, float iteration)
{
float mid_v... | ALGO | 0.999761 | 4.357019 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-12-18T08:28: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": "44fb56f1ccaf... |
1316b299-0a16-49e1-ad6f-ef394ac037fa | luizademelo/TP-MES | grpc-result-comments-cc/src/core/util/uri.cc | Here's the commented version of the code:
```c++
// Copyright 2015 gRPC authors.
// Includes necessary headers for URI parsing and manipulation
#include "src/core/util/uri.h"
#include <ctype.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include <algorithm>
#include <functional>
#include <map>
#inc... | TOOL | 0.950509 | 5.011518 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2025-04-11T22:53: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": "16a27d2cd2c... |
54087cff-efb9-42a2-ac0b-e81f6aef51b9 | Ayush-dixit-15/DSA | .history/LinkedListQuestions/CloneALLwithrandomPointer_20221011164239.cpp | // //{ Driver Code Starts
// #include <bits/stdc++.h>
// using namespace std;
// /* Link list Node */
// struct Node {
// int data;
// Node *next;
// Node *arb;
// Node(int x) {
// data = x;
// next = NULL;
// arb = NULL;
// }
// };
// // } Driver Code Ends
// class Solu... | ALGO | 0.996261 | 4.694831 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2022-10-18T12:36:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c92fbec75e... |
07fd93cd-4385-4cba-bf8b-231736be868d | Aditya-Bawangade/CppQuestions | MergeKsortedLinkedLists.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) {}
// };
struct compare{
... | ALGO | 0.999826 | 6.152122 | {
"github_metadata": {
"branch": "main",
"commit_count": 169,
"repo_created_at": "2023-01-02T17:13: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": "49d56c4f5b... |
6baf1dc8-51b6-42ca-8495-1a157b8a1c0e | ann-mj/Cpp_Algorithm | 백트래킹/15663 N과 M(9)/해시 사용/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
using namespace std;
int N, M;
int arr[9]; // M개 까지 저장
int vis[9]; // N개 까지 저장
vector<int> nums;
unordered_map<string,int> map;
void q_sort(vector<int> &arr, int start, int end) {
if(start >= end) return;
int pivot = start;
i... | ALGO | 0.999992 | 4.978548 | {
"github_metadata": {
"branch": "main",
"commit_count": 83,
"repo_created_at": "2022-03-11T13:13: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": "0b90d8d0ed6... |
2a1099e1-3b05-46fe-b0d6-b854915e8b36 | ishandutta2007/codeforces-s | sugarrr/normal/1344/B.cpp | //#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
ll c=a%i_7;
if(c>=0)re... | ALGO | 0.999961 | 3.82226 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b6192167d3a6... |
771e556b-4183-4e3b-ba2b-e4735adfd939 | Sumanth-NR/CompetitiveProgramming | Platforms/CodeForces/Infero/Infero2024_Practise02/E_Distances_to_Zero.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n); for (auto &x: a) cin >> x;
vector<int> left(n), right(n);
left.front() = a.front() == 0 ? 0: 1e9;
for (int i = 1; i < n; i++) {
if (a[i] == 0) left[... | ALGO | 0.999991 | 4.112581 | {
"github_metadata": {
"branch": "master",
"commit_count": 104,
"repo_created_at": "2022-04-18T13:29:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c26b1fb1... |
f8059736-616a-4b76-ac1f-b3886cc169fd | PauloMiranda98/Solutions-To-Competitive-Programming-Problems | 2017 Benelux Algorithm Programming Contest (BAPC 17)/B.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
#define POINT_DOUBLE
#ifdef POINT_DOUBLE
typedef double ftype;
typedef long double ftLong;
const long double EPS = 1e-9;
#define eq(a, b) (abs(a - b) < EPS)
#define lt(a, b) ((a + EPS) < b)
#define gt(a, b) (a > (b + EPS))
#define le(a, b) (a... | ALGO | 0.999936 | 4.623007 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2020-04-30T13:45:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "80f7a6595... |
7fb193e8-0f01-4774-a304-2306b3a3e432 | asdfghwunai/Sword-pointing-to-offer | Train/wangyi/2016路灯(排序).cpp | /*
链接:https://www.nowcoder.com/questionTerminal/62cdf520b9d94616b6644ac03a0306ff
来源:牛客网
一条长l的笔直的街道上有n个路灯,若这条街的起点为0,终点为l,第i个路灯坐标为ai ,每盏灯可以覆盖到的最远距离为d,为了照明需求,所有灯的灯光必须覆盖整条街,但是为了省电,要是这个d最小,请找到这个最小的d。
输入描述:
每组数据第一行两个整数n和l(n大于0小于等于1000,l小于等于1000000000大于0)。第二行有n个整数(均大于等于0小于等于l),为每盏灯的坐标,多个路灯可以在同一点。
输出描述:
输出答案,保留两位小数。
示例... | ALGO | 0.999972 | 4.309871 | {
"github_metadata": {
"branch": "master",
"commit_count": 308,
"repo_created_at": "2018-05-02T02:49:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8952507... |
5f4a8f1b-b433-4836-9f27-104f54dc1471 | mengjiaoliwang/window-file-copy | 01 STL三大组件/04 deque容器/04 deque容器.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
#include <deque>
#include <algorithm>
/*
3.3.3.1 deque构造函数
deque<T> deqT;//默认构造形式
deque(beg, end);//构造函数将[beg, end)区间中的元素拷贝给本身。
deque(n, elem);//构造函数将n个elem拷贝给本身。
deque(const deque &deq);//拷贝构造函数。
3.3.3.2 deque赋值操作
assign(beg, end);//将[beg, end)区... | TOOL | 0.989378 | 4.470248 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-11-10T15:28:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c2c9d41cdf... |
03cdc590-9b4a-4e94-8efd-00ff207b637b | Bencomester/LeetCode | 0013.cpp | class Solution {
public:
int romanToInt(string s) {
int n = 0;
int current = value(s[0]);
int last = current;
for (int i = 1; i < s.length(); i++) {
int val = value(s[i]);
if (last == val) {
current += val;
last = val;
... | ALGO | 0.99986 | 5.951756 | {
"github_metadata": {
"branch": "main",
"commit_count": 271,
"repo_created_at": "2025-02-24T16:18: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": "47ccf6d2c9... |
6f5e2c2c-f216-4b38-b1ed-1a35c7c11fa3 | seven17000/DataStructrue | BTree/BTree.h | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
/*
*Author:seven17000
*Date:2017.3.9
*Content:实现B树
*/
template <class K, class V, size_t M = 3>
struct BTreeNode
{
pair<K,V> _kv[M];//存放键值
size_t _size;//键值计数
BTreeNode<K, V>* _sub[M + 1];
BTreeNode<K, V>* _parent;
BTreeNode()
:_parent(... | ALGO | 0.999735 | 3.592271 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2016-12-20T08:05: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": "974cf7cd4... |
3bb11ffd-03f0-4600-9167-eb6282f1fc51 | Manasvi8274/Manasvi | 1language-C/0_class/2nd_YR/3rd_SEM/oops/10oct/27_classes_/30_destructor.cpp | #include<iostream>
#include<string>
#include<math.h>
using namespace std;
// class g25{
// public:
// g25(int a){
// int marks=a;
// }
// g25(const g25 *obj){//pass by reference , as int value has no ref so we use const
// return obj.marks;
// }
// };
//... | ALGO | 0.999172 | 3.985566 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2024-08-14T06:36: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": "0de28430324... |
3c8e2500-ca80-4161-92f0-d5005af8cd41 | owlpaw20/CPArchive | 洛谷题库/[洛谷 P2357] 守墓人.cpp | #include <iostream>
using namespace std;
using i64 = long long;
const int N = 2e5 + 10;
int n, m;
i64 a[N];
struct Fenwick {
i64 tr[N];
int lowbit(int x) {
return x & -x;
}
void update(int x, i64 delta) {
for (int i = x; i <= n; i += lowbit(i))
tr[i] += delta;
}
i64 query(int x) {
i64 r... | ALGO | 0.999792 | 5.173906 | {
"github_metadata": {
"branch": "main",
"commit_count": 162,
"repo_created_at": "2023-12-17T02:02: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": "9cdc6be12a... |
0e10ab52-b101-44b4-968f-9bd5350881ad | Sadman007/DevSkill-Programming-Course---Basic---Public-CodeBank | DevSkill_CP/Intermediate/Batch 13/class_26/CF-296.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 100050;
int arr[MAX + 5], L[MAX + 5], R[MAX + 5], V[MAX + 5];
long long updateCnt[MAX + 5], coeff[MAX + 5];
int main()
{
int n, m, k;
scanf("%d %d %d", &n, &m, &k);
for (int i = 1; i <= n; i++)
{
scanf("%d", &arr[i]);
}
for ... | ALGO | 0.999951 | 4.382013 | {
"github_metadata": {
"branch": "master",
"commit_count": 473,
"repo_created_at": "2019-02-28T11:59:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 84,
"forks": 58,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4a8e6... |
e1a5e898-a1c1-4c97-9fbe-a4276cbc837c | sdseepaul/robobulls | movement/move_collisions.h | #ifndef MOVE_COLLISIONS_H
#define MOVE_COLLISIONS_H
#include "utilities/measurements.h"
#include "utilities/comparisons.h"
#include "utilities/velocitycalculator.h"
#include "model/gamemodel.h"
#include "model/robot.h"
class Robot;
class Point;
//! @brief Indicates the robot is free to move.
#define MOVE_OK ... | ALGO | 0.998537 | 5.544736 | {
"github_metadata": {
"branch": "master",
"commit_count": 829,
"repo_created_at": "2017-11-19T00:08: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": "15b877da... |
202d7f85-888c-4581-aeb9-f1b2f067f93d | SajibTalukder2k16/Algorithm-or-random-problem-solution | 1076B.cpp | #include<bits/stdc++.h>
using namespace std;
#define llu long long int
#define maxx 1000000000
bool marked[maxx];
vector<llu>prime;
bool isPrime(llu n) {
if (n < 2) return false;
if (n == 2) return true;
if (n % 2 == 0) return false;
return marked[n] == false;
}
void sieve(llu n) {
for (llu i = 3; i * i <= ... | ALGO | 0.999927 | 4.180231 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-11-14T14:38: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": "e0b9497632... |
37354a3f-cc37-4ac1-a06d-35159fe5d8de | woojong92/algorithm_study | 14225_부분집합의합_v2.cpp | /*****************************************************************
부분수열의 합 - 재귀
https://www.acmicpc.net/problem/14225
수열 S가 주어졌을 때, 수열 S의 부분 수열의 합으로 나올 수 없는
가장 작은 자연수를 구하는 프로그램을 작성하시오.
예를 들어, S = [5, 1, 2]인 경우에
1, 2, 3(=1+2), 5, 6(=1+5), 7(=2+5), 8(=1+2+5)을 만들 수 있다.
하지만, 4는 만들 수 없기 때문에 정답은 4이다.
***********... | ALGO | 0.999974 | 3.935359 | {
"github_metadata": {
"branch": "master",
"commit_count": 85,
"repo_created_at": "2018-08-22T14:58: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": "b7660c734... |
88fccc91-dfb9-42b9-a0ae-18b208495f69 | arthurratz/intel_parallel_stable_sort_oneapi | src/parallel_stable_sort_oneapi.hpp | #include <tbb/tbb.h>
#include <tbb/task.h>
#include <CL/sycl.hpp>
#if FPGA || FEMU
#include <CL/sycl/intel/fpga_extensions.hpp>
#endif
#include <dpstd/execution>
#include <dpstd/algorithm>
#include <dpstd/iterators.h>
#include <iostream>
#include "misc/utility.hpp"
#ifndef PARALLEL_SORT_STL_H
#define PARALLEL_SORT... | ALGO | 0.999901 | 6.507478 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2020-07-09T18:01:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "9c2af827e4... |
64231fe8-b43f-4e7a-bfce-08643013c1f5 | npuchala/ncursesSnake | main.cpp | /*
https://github.com/npuchala
A snake-like game
*/
#include<ncurses.h>
#include"Segment.h"
#include<string>
#include<thread>
#include<vector>
#include<chrono>
#include<cstdlib>
using namespace std;
/*A function the gets the key inputs*/
void chooseChar(char *ch){//& sends a reference to the function
while(*ch != 'q... | TOOL | 0.975877 | 4.183679 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2021-12-06T08:42: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": "0afa0d944... |
8a8dcc8e-53f5-4be5-aade-f7dd5e3c5abb | ankikong/c- | src/Other/ZOJ - 3868.cpp | #include <bits/stdc++.h>
#ifndef LOCAL
#pragma GCC optimize(3)
#endif
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int maxn=1e6+100;
int cnt[maxn], dp[maxn];
int qpow(ll a, int b) {
a%=mod; ll ans=1;
... | ALGO | 0.999909 | 4.63557 | {
"github_metadata": {
"branch": "dev",
"commit_count": 65,
"repo_created_at": "2018-11-11T02:03: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": "6a8ab94dd65e... |
27554b5b-dacb-4857-841f-90d38d49da36 | google/cuckoo-index | cuckoo_index.h | // Copyright 2020 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | ALGO | 0.923596 | 7.279833 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2020-04-14T08:11:28.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 129,
"forks": 17,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5863184... |
8ba8d3f8-4090-4d9e-9a21-beda26b28d9e | ishandutta2007/codeforces-k | keshi/normal/848/C.cpp | //In the name of GOD
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll tof = 1024;
const ll tof2 = 101;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freo... | ALGO | 0.999931 | 4.302571 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8726fbc6fc67... |
1fc874e4-3cbb-4a06-b9ba-9dc3774151f9 | my-totoro/algorithm | careercup/array_string/rotate_matrix.cpp | /*
*1.7 Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method
* to rotate the image by 90 degrees. Can you do this in place?
*/
/*
*Solution: we assume rotate around the center. We can also assume rotate around the lower left. After analysis,
* the rotation correpon... | ALGO | 0.999704 | 5.872628 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2016-07-07T07:05: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": "798c1cba4... |
09ac99da-1243-4293-ab4d-8bf8302cf8e0 | sachin-611/practicals_sem3 | fds/prac_9/main.cpp | #include <bits/stdc++.h>
using namespace std;
struct poly_store{
int coeff;
int exp;
};
class polynomial
{
int degree;
struct poly_store terms[];
public:
polynomial(int n){
degree=n;
terms[n];
}
friend ostream& operator << (ostream &out,const polynomial &object1)
{
... | ALGO | 0.999618 | 4.521809 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2020-11-16T09:13: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": "fe165fe73... |
d37723c5-0b62-4f9e-820d-a4c35a960db7 | ishandutta2007/codeforces-r | radewoosh/normal/1083/C.cpp | //~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/asso... | ALGO | 0.999564 | 3.797338 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:58:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5277769e64dd... |
a5494ebf-3140-4d49-aa80-bb3d73897035 | abufarhad/Programming | C++ Practice/DataStucture/symmetric matrix is or not .cpp | #include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define scd(x) scanf("%lf",&x)
#define scc(x) scanf("%[^\n]s",x); // For charecter string input , It will read all charecter untill Enter new line .
#define pfi(x) printf... | ALGO | 0.999882 | 3.662 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2019-04-09T18:30:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "551996efa... |
1ffe2c62-10b2-4206-a480-19cf1b7e010f | juanmsl/CPP-Computacional-Geometry-Algorithms | lib/GeoAlgorithms/src/triangulation/monotone.cxx | #include <triangulation/monotone.hxx>
SegmentLinesVector Triangulation::triangulateMonotonePolygon(const Polygon &polygon) {
std::map<Point, char, CompPoints> orderedVertex;
for(Point p : polygon.container()) {
orderedVertex.emplace(p, 'r');
}
auto top = std::find(polygon.container().begin(), polygon.con... | ALGO | 0.998934 | 5.737929 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-08-12T23:52: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": "fca608bbd1... |
a18bbf31-9fdb-4f06-86e2-dc2a91dd5794 | franr22/Data_Structures | Real-Time Operating System Simulator Project/main.cpp | #include <iostream>
#include "arrayheap-student-proj5.h"
#include "process-proj5.h"
using namespace std;
int main() {
ArrayHeap<Process> myHeap;
int totalProcesses;
cin >> totalProcesses; // Read the total number of processes
int currentTime = 0;
int processCount = 0;
int skipCount = 0;
... | ALGO | 0.999966 | 5.778508 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-04-16T05:51:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e271b3dd277... |
7ec630eb-bdd3-458a-9233-7592da8a9412 | meco-group/fatrop | include/fatrop/ip_algorithm/ip_nlp_resto.hpp | //
// Copyright (C) 2024 <NAME>, <NAME>
//
#ifndef __fatrop_ip_algorithm_ip_nlp_resto_hpp__
#define __fatrop_ip_algorithm_ip_nlp_resto_hpp__
#include "fatrop/common/fwd.hpp"
#include "fatrop/context/context.hpp"
#include "fatrop/linear_algebra/fwd.hpp"
#include "fatrop/linear_algebra/vector.hpp"
#include "fatrop/nlp/d... | ALGO | 0.997468 | 6.491115 | {
"github_metadata": {
"branch": "main",
"commit_count": 172,
"repo_created_at": "2023-07-19T12:05:33.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 208,
"forks": 23,
"issues": 16,
"pull_requests": 1
},
"file_meta": {
"content_id": "e9bc0ca... |
16f48341-c2b1-402e-90bf-5b4b51bf3726 | nkriger/C---Project-Showcase-Nathan-Kriger | Priority Que, Struct and Multi Instances/pqueue.cpp |
#include <iostream>
#include "cust.h"
#include "pqueue.h"
using namespace std;
void PQueue::enqueue(Cust* cust, int priority) {
Node* new_node = new Node(cust, nullptr, priority);
if (head == nullptr || priority < head->getPriority()) {
new_node->setNext(head);
head = new_node;
} else {
Nod... | TOOL | 0.955807 | 4.120656 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-04-03T20:10: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": "a59c3d79cd67... |
7d82e62b-5563-4ca6-9e71-b633dff46bdc | DISTRHO/DISTRHO-Ports | ports-juce6.0/vitalium/source/synthesis/framework/poly_utils.h | /* Copyright 2013-2019 <NAME>
*
* vital 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.
*
* vital is distributed in the hope tha... | ALGO | 0.978484 | 6.988202 | {
"github_metadata": {
"branch": "master",
"commit_count": 677,
"repo_created_at": "2014-02-14T11:14:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 282,
"forks": 47,
"issues": 45,
"pull_requests": 3
},
"file_meta": {
"content_id": "aca20... |
04beb5c4-1acb-4cc3-a7ff-efa4fc521440 | nhathuyle2002/HIGH-SCHOOL-CODE | 2019/Thang06_2019/10_06_2019/zigzag.cpp | #include <bits/stdc++.h>
#define forn(i,a,b) for(int i=(a); i<=(b); ++i)
#define ford(i,a,b) for(int i=(a); i>=(b); --i)
using namespace std;
//////
const
int maxn=2e3+100, base=1e9;
int n, n1, n2, S, T;
long long d[maxn], sum1[maxn], sum2[maxn], res1[maxn], res2[maxn], res;
//////
void prepare()
{
d[0]=1;
... | ALGO | 0.999978 | 4.600715 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-10-24T10:32:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1401b7521f... |
06b3b6da-019d-4d89-b611-5ecc9e853f30 | Jpickard1/Main | Shared/kgmoments/matlab/skrongraph_mex.cpp | /**
* @file skronggraph_mex.cpp
* Implement stochastic Kronecker generation via coin-flipping.
* @author <NAME>
*/
// compile with
// mex -O skrongraph_mex.cpp CXXFLAGS="\$CXXFLAGS -Wall" -largeArrayDims -I../skcoin
/** History
* :2011-04-10: Added threaded computation
*/
#include "mex.h"
#include "math.h"
#... | ALGO | 0.997663 | 6.143836 | {
"github_metadata": {
"branch": "main",
"commit_count": 318,
"repo_created_at": "2022-03-21T20:29: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": "fd38c0a90d... |
6c97b056-2936-4b77-9740-f36103fae140 | Xilinx/XRT | tests/xrt/mailbox/use_mailbox.cpp | /*
* Copyright (C) 2021 Xilinx, Inc
* SPDX-License-Identifier: Apache-2.0
*/
/****************************************************************
Kernel to kernel streaming example consisting of three compute
units in a linear hardware pipeline.
1) Adder kernel that adds two input vectors from global memory
and strea... | TEST | 0.914105 | 6.253665 | {
"github_metadata": {
"branch": "master",
"commit_count": 8326,
"repo_created_at": "2018-05-30T22:04:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 608,
"forks": 493,
"issues": 123,
"pull_requests": 9
},
"file_meta": {
"content_id": "92... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.