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 |
|---|---|---|---|---|---|---|---|
0878ae37-478c-40ff-80fb-579fa34593c4 | Azipro/Algorithm | KMP/Seek the Name, Seek the Fame.cpp | //POJ 2752
Description
The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their
newly-born babies. They seek the name, and at the same time seek the fame. In order to escape from such boring job, the innovative little
cat works out an easy b... | ALGO | 0.999958 | 3.970731 | {
"github_metadata": {
"branch": "master",
"commit_count": 157,
"repo_created_at": "2019-11-06T05: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": "94e38a6a... |
a785514f-dfa4-4b00-ba90-7f42d7f60d0a | ADJA/algos | Graphs/LCABinary.cpp | /************************************************************************************
Finding LCA (Least common ancestor) of two vertices in the tree.
Uses dp calculated on powers of 2.
O(NlogN) for preprocessing, O(logN) on query.
Based on problem 111796 from informatics.mccme.ru
http://informa... | ALGO | 0.999933 | 3.835219 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2014-05-20T08:57:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 725,
"forks": 249,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "636bf... |
b96bd322-b29e-45a0-bed0-1917267c9ebf | Sunwinds/3D-Geometric-Features | ddtt/ddtt-plugin/next_combination.h | // Adapted from code by <NAME>
#pragma once
#include <algorithm>
namespace std
{
template<typename BidirectionalIterator>
bool next_combination(BidirectionalIterator first, BidirectionalIterator k, BidirectionalIterator last){
if( first == last || k == first || k == last){
return false;
}
BidirectionalItera... | ALGO | 0.999427 | 6.174702 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2015-04-09T23:12:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "33ff6cfafb... |
f61c2d05-7138-4b3a-a116-e2bf5502d49e | zdunlap226/undergrad_classes | cs302 (Data Structures & Algorithms 2)/labs/lab4/Friendnet1.cpp | #include <time.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <string.h>
#include <fstream>
#include <iostream>
#include <set>
#include <iomanip>
using namespace std;
void set_oldfriends(vector <string> &name, vector<vector<bool> > &friends, int M0, int M1) {
int N = (int) name.size();
int j;... | ALGO | 0.980315 | 3.776456 | {
"github_metadata": {
"branch": "master",
"commit_count": 267,
"repo_created_at": "2021-03-17T17:46: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": "ad06ede9... |
3c13a895-9e0f-42ff-aac0-ed0ed2e81827 | FangGet/BundleFusion_Ubuntu_Pangolin | include/FreeImage/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h | // Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// 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 Licens... | ALGO | 0.998261 | 7.127242 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2020-06-29T03:53:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 132,
"forks": 34,
"issues": 6,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9dab7f... |
fea6fbf0-73bc-44c4-aca8-6f4140f93328 | SudarshanDamodare/DSA | gfg/graph/mstPrimAlgo.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define us unordered_set
#define um unordered_map
// brute approach
void prims1(int n, vector<pair<int,int>> adj[]){
int parent[n];
int key[n];
bool mstSet[n];
for(int i=0;i<n;i++)
key[i]=INT_... | ALGO | 0.999994 | 4.387369 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2021-07-22T16:32: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": "95009ebc9... |
704789e0-d36e-4b02-9c79-512f7d7d0e3b | 2004shashwat17/codec- | Queue/reversekelements.cpp | #include<iostream>
#include<queue>
#include<stack>
using namespace std;
void reversekElements(queue<int>& q, int K) {
if(q.empty() || K <= 0 || K > q.size()) {
return; // Edge cases: empty queue, invalid K
}
stack<int> s;
// Step 1: Dequeue the first K elements and push them onto a stack
fo... | ALGO | 0.999837 | 5.60112 | {
"github_metadata": {
"branch": "main",
"commit_count": 53,
"repo_created_at": "2024-07-19T14:21: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": "037bdc5cbc9... |
72401c3d-e96b-415c-8a4d-fe4d670714aa | Randowlh/Project_ACM | code/competition/2020牛客国庆集训派对day2/6.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
typedef long long ll;
typedef double db;
typedef long double ld;
template<class T>inline void MAX(T &x,T y){if(y>x)x=y;}
template<class T>inline void MIN(T &x,T y){if(y<x)x=y;}
template<class T>inline void rd(T &x){
x=0;char o,f=1;
while(o=... | ALGO | 0.999933 | 4.15013 | {
"github_metadata": {
"branch": "master",
"commit_count": 516,
"repo_created_at": "2017-07-20T06:34: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": "03afd828... |
a5ccfa18-cfc2-4649-af17-f519581963fa | samyak-uttam/DS-and-Algo | Arrays/Sorting algos.cpp | #include<bits/stdc++.h>
using namespace std;
/* Time complexitiy of Comparison based algorithms:
Best, Average, Worst
Selection Sort - O(n^2), O(n^2), O(n^2)
Bubble Sort - O(n), O(n^2), O(n^2)
Insertion Sort - O(n), O(n^2), O(n^2)
Merge Sort - O(nlog n), O(nlog n), O(nlog n)
Heap S... | ALGO | 0.999981 | 5.3316 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2020-03-19T10:32:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "74e3990e4... |
075b8791-1cb1-46c1-b906-6f3c7e988e14 | Xiaoming-Zhao/advtex_init_align | advtex_init_align/tex_init/Utils.cpp | #include <iomanip>
#include <iostream>
#include <string.h>
#include <cstdlib>
#include "Utils.h"
namespace NS_Utils {
bool CheckLineSegIntersect2D(const float& x1, const float& y1,
const float& x2, const float& y2,
const float& x3, const float& y3,
... | ALGO | 0.994666 | 4.990513 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-07-20T17:02:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 61,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a293cf5cce... |
8a27460b-904a-413f-8370-f719f4f39fbd | PriyanKishoreMS/Data-Structures | 16_Sorting Algorithms/07_countSort.cpp | #include <iostream>
using namespace std;
// Time Complexity:
// Best: O(n+k)
// Average: O(n+k)
// Worst: O(n+k)
// Space Complexity: O(k)
int findMax(int a[], int n)
{
int i, max = INT32_MIN;
for (i = 0; i < n; i++)
{
if (a[i] > max)
max = a[i];
}
return max;
}
void cou... | ALGO | 0.99996 | 5.616762 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2021-09-18T05:29: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": "f39cdb58d... |
8332d47b-3df3-4a99-8dfb-56d577adeffd | adityarawat1337x/DSA | N meetings in one room - GFG/n-meetings-in-one-room.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int maxMeetings(int start[], int end[], int n){
pair<int,int> p[n];
for(int i=0;i<n;i++){
p[i]={end[i],start[i]};
}
sort(p,p+n);
in... | ALGO | 0.999961 | 5.372031 | {
"github_metadata": {
"branch": "main",
"commit_count": 2270,
"repo_created_at": "2020-12-15T09:04: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": "5ff349f29... |
8f82c11d-2ae8-44ac-b547-f13eada9d3ae | pkeyela/tutor-programming | translator in C++/En_Rus_translator.cpp | #include <iostream> // DEV C++
#include <fstream>
#include <string>
using namespace std;
int maxWordsNumber = 100;
void leave_space(){
cout<<" ";
}
int search_word_index(string from_lan, string word)
{
int index=-1;
bool found=false;
ifstream from_file((from_lan + ".txt").c_str());
if (... | TOOL | 0.994207 | 3.341435 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-03-22T18:12:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "917e2d481d67... |
ecff226e-663a-427b-bf60-360a8a390024 | sourav-0-sahu/DSA-Codes | Queues/Queue II/Reverse-K-Elements.cpp | /*
i/p - 10 20 30 40 50 , k = 3 (this means reverse first 3 elements of queue)
o/p - 30 20 10 40 50
*/
#include<iostream>
#include<queue>
#include<stack>
using namespace std;
void reverseKelements(queue<int> &q,int k) {
int n = q.size();
//step 1: push k elements from the queue to the stack
stack<int> st;... | ALGO | 0.999789 | 4.283959 | {
"github_metadata": {
"branch": "main",
"commit_count": 112,
"repo_created_at": "2024-04-08T21:05: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": "bdabdcbad0... |
3308a284-b9fa-43cd-8630-b6e37c484d15 | Ajaya1000/codeforces | practice/A_Control_Tower.cpp | // @itsAj
#include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define test \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define endl '\n'
#define rep(i, x, y) for (auto i = x; ... | ALGO | 0.999846 | 4.041787 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-03-20T15:17:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb2b6a42f4db... |
c8ed3a55-cd5d-461b-bd95-016a2b2a3c1c | AdarshGaur/Competitive-Programming | Codeforces/Codeforces Round #798 (Div. 2)/B. Mystic Permutation.cpp | // Author : @AdarshGaur
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define endl "\n"
typedef pair<int,int> pii;
typedef vector<int> vi;
// Source : https://codeforces.com/blog/entry/76087
vector<string> vec_splitter(string s) {
s += ',';
vector<string> res;
while(!s.empty()) {
res.push_b... | ALGO | 0.999925 | 4.703638 | {
"github_metadata": {
"branch": "main",
"commit_count": 415,
"repo_created_at": "2021-11-26T15:42:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "498b6e4005... |
6dbae3aa-a6d7-4366-8a97-8ed27b53af8f | kushah/FIU_Swarmathon_Checkin_4 | behaviours/src/SearchController.cpp | #include "SearchController.h"
#include <angles/angles.h>
#include<iostream> //Danny included
#include<string>
#include<stdlib>
#include<Danny.h>
#include <RangeController.h>
SearchController::SearchController() {
rng = new random_numbers::RandomNumberGenerator();
currentLocation.x = 0;
currentLocation.y = 0;
... | ALGO | 0.99258 | 3.806961 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-03-02T03:42: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": "7ed770e911... |
fc6f359f-906e-45d1-9133-49674c66bfa2 | PrikshitKumar/Data-Structure-Questions-For-Placement | 1) Arrays/20) Rearrange the array in alternating positive and negative items with O(1) extra space.cpp | #include<bits/stdc++.h>
using namespace std;
void rightShift(int arr[], int start, int end) {
int temp = arr[end];
for(int i=end; i>start; i--) {
arr[i] = arr[i-1];
}
arr[start] = temp;
}
void rearrangeTheArray(int arr[], int length) {
int wrongIndex = -1;
for(int i=0; i<length; i++) {... | ALGO | 0.999993 | 4.932105 | {
"github_metadata": {
"branch": "main",
"commit_count": 286,
"repo_created_at": "2022-03-10T19:28:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c5155d97be... |
7ad3b684-6ce2-4c27-b1b2-0fee73722b52 | ishandutta2007/codeforces-j | jacob/normal/126/A.cpp | #define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll t1, t2, x1, x2, t0;
ll bestCandP, bestCandQ;
ll my1, my2;
void CheckCand(ll py1, ll py2) {
if (py1 == 0 && py2 == 0) return;
if (py2 < 0 || py2 > x2) return;
ll cP = t0... | ALGO | 0.99988 | 4.151295 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T05:42:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ec8067dca1da... |
ceeadace-8eff-4e25-a329-c50e878d4b9a | bbimt13/Coding_test_workout | 직사각형 넓이/code.cpp | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
long long solution(vector<vector<int>> rectangles) {
set<int> x_set, y_set;
// x, y 좌표를 집합에 추가
for (auto& rect : rectangles) {
x_set.insert(rect[0]);
x_set.insert(rect[2]);
y_set.insert(r... | ALGO | 0.999924 | 6.558786 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-03-26T07:53: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": "7c93a391871... |
0d550523-fc2a-464e-80ec-d94921242b3e | SemihCaglar/Pc-Olympic | Codes/Usaco/Chapter 3/Section 3/3-Camelot.cpp | #include<semih/competitive.h>
const int N=32;
const int INF=0x7fffffff;
int n,m;
ii king;
vii knights;
int dist[N][N][N][N][2];
int pickup(ii coor){
return min( abs(king.fi-coor.fi) , abs(king.se-coor.se) );
}
bool intable(int x,int y){
if(x<=m and x>=1 and y<=n and y>=1)
return true;
return fals... | ALGO | 0.999871 | 3.371216 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2021-06-17T16:19: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": "739c933fa... |
fa07a977-c780-4e1b-99aa-ca672fb80df1 | RRP-IT/LTE-SIM-ITU-R-M.2135-1 | TOOLS/make_fairness_index.cc | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 TELEMATICS LAB, Politecnico di Bari
*
* This file is part of LTE-Sim
*
* LTE-Sim is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the... | ALGO | 0.92159 | 3.494484 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-09-20T16:06: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": "c2502589ca... |
87bd8837-83e9-42fb-87df-9ed51f4e098e | ishassan/ProblemSolving | SPOJ/TRIKA.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999793 | 3.035594 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-03-11T10:04:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c54453f28d... |
387a359c-ba41-4201-84d9-29360c3c9570 | lilllee/Algorithm | 인프런 알고리즘/각행의평균과가장가까운값.cpp | #include <iostream>
#include <cmath>
using namespace std;
int arr[9][9];
int answer[2][9];
int middleNum, arithmeticNum, num, mi, mi1;
double sum, ari;
int main(void)
{
for (int i = 0; i < 9; ++i)
{
for (int j = 0; j < 9; ++j)
{
cin >> arr[i][j];
}
}
for (int... | ALGO | 0.999923 | 3.440671 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2021-02-09T10:55: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": "fcd6c2186... |
298f2f6e-33f1-4c5e-81d7-89a400234b1a | paxakor/compression | lib/huffman/huffman.cpp | // Copyright 2016, <NAME>.
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include "lib/common/utils.h"
#include "lib/huffman/huffman.h"
namespace Codecs {
const size_t log_char_size = ceil(log2(CHAR_SIZE));
HuffmanCodec::HuffmanCodec()
: tree()
, table(DICT_SIZE)
... | ALGO | 0.982421 | 5.899819 | {
"github_metadata": {
"branch": "master",
"commit_count": 145,
"repo_created_at": "2016-02-06T20:07: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": "64143364... |
e478cbbf-5b71-48cc-a465-937a4d1eec1f | UCF-Lou-Lab-PET/zkformer | libsnark/gadgetlib3/pool_gadget.hpp | #include <iostream>
#include <libsnark/gadgetlib1/gadget.hpp>
#include <libsnark/gadgetlib1/gadgets/basic_gadgets.hpp>
#include <libff/algebra/curves/public_params.hpp>
#include "libff/algebra/fields/field_utils.hpp"
namespace libsnark {
template <typename FieldT>
class pool_gadget : public gadget<FieldT>
{
privat... | DATA | 0.90534 | 3.744619 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-10-27T16:31:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f36cb16a028... |
f4f3a891-c129-4f15-80fe-a78addb0fff6 | 1cekrim/boj | 9251/9251.cc | #include <algorithm>
#include <iostream>
#include <string>
#include <string_view>
#include <vector>
int solve(const std::string_view& a, const std::string_view& b, int i, int j)
{
static std::vector<std::vector<int>> memo(
a.size() + 1, std::vector<int>(b.size() + 1, -1));
if (i == a.size() || j == b.... | ALGO | 0.999995 | 5.302138 | {
"github_metadata": {
"branch": "master",
"commit_count": 172,
"repo_created_at": "2019-11-06T06:05: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": "b20cf54c... |
9dc5eb61-e01b-475b-85a5-40ed84978c38 | Mefisto04/Code-v0 | Count_Nodes_Equal_to_Average_of_Subtree.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.999521 | 6.434098 | {
"github_metadata": {
"branch": "main",
"commit_count": 782,
"repo_created_at": "2025-03-21T19:01: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": "6f72cecf58... |
bcafd871-56b9-4ab8-82cd-2e09e06d315a | davenza/PyBNesian | pybnesian/util/vech_ops.cpp | #include <algorithm>
#include <util/vech_ops.hpp>
namespace util {
VectorXd vech(const MatrixXd& m) {
auto d = m.rows();
auto ns = d * (d + 1) / 2;
VectorXd v(ns);
auto offset = 0;
for (auto i = 0; i < d - 1; ++i) {
std::copy(m.data() + i * d + i, m.data() + (i + 1) * d, v.data() + offs... | ALGO | 0.996641 | 6.412884 | {
"github_metadata": {
"branch": "master",
"commit_count": 422,
"repo_created_at": "2020-04-29T19:16:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 46,
"forks": 13,
"issues": 7,
"pull_requests": 2
},
"file_meta": {
"content_id": "013343... |
c6c9a89e-0045-4df8-baa1-841578b5e92e | 100qianli/WordCount | WordCount.cpp | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char *argv[]) {
FILE *file; // 文件指针
char filename[100]; // 存储文件名的数组
char ch; // 用于存储读取的字符
int charCount = 0, wordCount = 0; // 字符数和单词数的计数器
int inword = 0; // 标记是否在单词中
// 检查命令行参数数量
if (argc... | TOOL | 0.974418 | 4.895512 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-05-19T03:50:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71121c2f08... |
416b7f5a-445d-4c32-8fff-68c5997007a6 | EmptyBlueBox/Data_Structures_And_Algorithms_A-zl-2022Fall-PKU | 08-内排序/0810 距离排序.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
struct point
{
int x, y, z;
} pt[10];
struct node_pair
{
int n1, n2;
double dis;
bool operator<(const node_pair &other) const //另一个结构体也要用const修饰
{
return dis > other.dis;
}
} pr[100];
double f(int a, int b)
{... | ALGO | 0.999319 | 4.937063 | {
"github_metadata": {
"branch": "main",
"commit_count": 70,
"repo_created_at": "2022-08-01T17:06:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 16,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "535e869a7d... |
af186ca9-484d-4bd4-84b6-44bda9b5dbfc | raghav196/daily-coding-problem | print-nodes-with-no-siblings.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int val;
struct Node *left;
struct Node *right;
};
Node *newNode(int val) {
Node *temp = new Node;
temp->val = val;
temp->left = NULL;
temp->right = NULL;
return temp;
}
void solve(Node *root, vector<int> &arr) {
if (root == NULL) return;
... | ALGO | 0.999984 | 4.652852 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2019-11-18T17:48: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": "e70dd4467... |
fbe25aa4-85d3-4434-adf2-38cd15bd1baa | mpeychev/competitions | usaco/2012-2013/jan/seating.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
struct node {
int begin, end, mx;
node() {}
node(int _begin, int _end, int _mx): begin(_begin), end(_end), mx(_mx) {}
};
int n, m, lvs;
node tree[1 << 21];
short int st[1 << 21];
void read() {
scanf("%d %d\n", &n, &m);
}
inline void print... | ALGO | 0.999766 | 3.499082 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2015-03-23T16:37: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": "ed9bb263c... |
c97e0a9f-83c9-446f-8778-9e6881ffe1c6 | keqhe/leetcode | round1/leetcode85.cpp |
class Solution {
public:
//ref; https://leetcode.com/discuss/52670/solution-based-maximum-rectangle-histogram-with-explanation
int checkRow (vector<int> & height) {//the solution in Maximum Rectangle in Histogram
stack<int> st;//index are in this stack
int max_area = 0;
int curr_area;
... | ALGO | 0.999979 | 5.836357 | {
"github_metadata": {
"branch": "master",
"commit_count": 267,
"repo_created_at": "2015-12-22T02:14: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": "3c142ea5... |
013db609-341a-405e-b8df-e23dbac3ba50 | ylipacbio/yli-tutorial | parasail/my-parasail.cpp | #include <cstring>
#include <iostream>
#include "parasail.h"
#include "parasail/matrices/blosum62.h"
#include "parasail/matrix_lookup.h"
int main(int argc, char **argv) {
// align two sequences s1, and s2
const char *s1 = "asdfasdfffffffasdf";
const char *s2 = "asdfasdfkffbffasdf";
// sequence lengths ... | ALGO | 0.974059 | 4.986794 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-08-08T22:13:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ea7cef9b3d... |
4bdf751a-b466-4f15-a79e-2091ccd4ce01 | ishandutta2007/codeforces-q | qpedop_muxaujlobu4/normal/1554/D.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
#include<vector>
#include<iostream>
#include<stack>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<tuple>
#include<bitset>
#include<queue>
#include<... | ALGO | 0.999205 | 3.649323 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:56: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": "bdf3eb5babe5... |
367636ad-e8e7-4cc6-98c8-5e8d79d0a099 | ahornung/humanoid_navigation | footstep_planner/src/helper.cpp | /*
* A footstep planner for humanoid robots
*
* Copyright 2010-2011 <NAME>, <NAME>, University of Freiburg
* http://www.ros.org/wiki/footstep_planner
*
*
* 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 Soft... | ALGO | 0.998952 | 6.349399 | {
"github_metadata": {
"branch": "indigo-devel",
"commit_count": 297,
"repo_created_at": "2013-09-03T10:10:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 41,
"forks": 83,
"issues": 3,
"pull_requests": 2
},
"file_meta": {
"content_id": "... |
7a331d11-c083-4e24-8bbe-c05e5517fab1 | GoblinDynamiteer/cpp-direkt-book | ch05/exercise05_05/e05_05.cpp | /*
* Exercise from book
* C++ Direkt by <NAME>
* http://skansholm.com
*
* Page 197 - Exercice 5:05
* In math: A vectors (v) length is calculated with:
* l = sqrt(v1^2 + v2^2 + v3^2 + vn^2)
* Write a function that calculates the lenght of a vector
* @param v vector values (array)
* @param n number... | ALGO | 0.997965 | 5.515703 | {
"github_metadata": {
"branch": "master",
"commit_count": 76,
"repo_created_at": "2017-01-17T16:24: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": "6ebcf730b... |
9ea57e7e-8338-46a5-9017-a49ea5a14c46 | botbw/algo | Solutions/cf_810B.cpp | #include <bits/stdc++.h>
#ifdef DEBUG
#include "debug.h"
#else
#define debug(...) 42
#define debugif(x,y...) 42
#endif
using namespace std;
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define _FOR(i, a, b) for(int i = (a); i >= (b); --i)
#define INT_INF 0x3f3f3f3f
#define LLONG_INF 0x3f3f3f3f3f3f3f3f
typedef l... | ALGO | 0.999987 | 3.692701 | {
"github_metadata": {
"branch": "main",
"commit_count": 362,
"repo_created_at": "2021-11-16T06:33: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": "2cc4d3e8ec... |
c421237b-3b7a-45f5-957f-c197d7281afa | umutoztunc/usaco-training | lamps/lamps.cpp | /*
ID: umutozt1
TASK: lamps
LANG: C++14
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
bool is_buttons_possible(int buttons, int C) {
int on_count = __builtin_popcount(buttons);
if (on_count > C)
return false;
return (on_count & 1) == (C & 1);
}
void b... | ALGO | 0.999987 | 4.411354 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2021-06-22T09:01:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ef9df906cd... |
c59e8992-8b98-4adf-a733-e076ae388ebe | sandra-chavdarova/Object-oriented-Programming | Second Partial Exam/07.cpp | /*
Дадена е дел од дефиницијата на класата Karticka.
За секоја картичка се чуваат информации за трансакциска сметка (низа од 15 знаци) , пин код (цел број)
и дали има повеќе пин кодови (булова променлива).
За секој картичка може да се пресмета тежината за пробивање на картичката. Тежината на пробивање е бројот на ц... | ALGO | 0.953494 | 4.630772 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2025-02-03T19:28: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": "57151109c... |
0828f44d-2467-404a-82f1-abdb807d1359 | Gautam-Jangir8/LeetCode-Questions | 0784-insert-into-a-binary-search-tree/0784-insert-into-a-binary-search-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.999958 | 5.899255 | {
"github_metadata": {
"branch": "main",
"commit_count": 1045,
"repo_created_at": "2024-06-23T04:57: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": "d97681431... |
a26ebb29-6921-4cc7-beda-cfc3bb2494d6 | YaominJun/path_planning | Search_based_Planning/ROS/a_star_dijktra_bfs_ws/src/a_star/src/a_star/a_star.cpp | //
// Created by lym on 21-2-16
//
#include "a_star/a_star.hpp"
namespace a_star {
AStar::AStar(const State& start_state,
const State& end_state,
const grid_map::GridMap& map,
const std::string& heuristic_type)
: start_state_(start_state),
end_state_(end_state),
... | ALGO | 0.999892 | 5.003537 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2020-08-19T11:43:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 27,
"forks": 12,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0e00e8d... |
f3a5e4d6-78e0-4b70-999a-17771a4ac337 | ishandutta2007/codeforces-f | ftiasch/normal/1207/C.cpp | #line 1 "sol.cpp"
#include <bits/stdc++.h>
const int N = 200'000;
template <typename T> void update(T &x, T a) { x = ~x ? std::min(x, a) : a; }
char s[N + 1];
long long dp[N + 1][2];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n, a, b;
scanf("%d%d%d%s", &n, &a, &b, s);
memset(dp, -1, si... | ALGO | 0.998458 | 3.521223 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:43:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "334a7f8c6f98... |
a05e2872-7fc5-4d8f-9430-1a6c67f4d57a | fusion1110/Leetcode | medianOfarray.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
double findMedianSortedArrays(vector<int> &nums1, vector<int> &nums2)
{
int m = nums1.size();
int n = nums2.size();
vector<int> merged(m + n);
merge(nums1.begin(), nums1.end(), nums2.begin(), nums2.end(), merged.begin());
... | ALGO | 0.999995 | 6.184638 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2024-08-28T18:29: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": "83fa9813b... |
fabb147a-c063-4672-9508-1bdb70a13369 | SeungJL/BaekJoon-Study | 2022/07_Jul/Week_1/9019/혜온.cpp | #include<iostream>
#include<string>
#include<queue>
#include <cstring>
using namespace std;
int a, b;
bool visited[10000];
int T;
void bfs() //너비 우선 탐색
{
queue<pair<int, string>>q;
q.push(make_pair(a, ""));
visited[a] = true;
while (!q.empty())
{
int a_temp = q.front().first;
string a_s = q.front().... | ALGO | 0.999865 | 4.296158 | {
"github_metadata": {
"branch": "main",
"commit_count": 681,
"repo_created_at": "2022-01-28T04:31:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 3,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "3a7292d397... |
dd279d0e-45f9-4b0a-b44c-9ac82cff0f6a | assimp/assimp | tools/assimp_cmd/Info.cpp | /*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2025, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
w... | TOOL | 0.92422 | 4.779422 | {
"github_metadata": {
"branch": "master",
"commit_count": 12715,
"repo_created_at": "2010-05-05T12:53:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 12114,
"forks": 3052,
"issues": 26,
"pull_requests": 19
},
"file_meta": {
"content_id":... |
f4ce0f70-7456-47b8-948d-f0b0edf155af | whoisgautxm/Attestation-Proof | backend/risc0-backend/risc0/circuit/recursion-sys/cxx/step_compute_accum.cpp | // Copyright 2024 RISC Zero, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... | ALGO | 0.999645 | 5.648188 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2024-08-03T20:29:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "534d6468b5b... |
805f983a-88f7-4494-abad-d15b74dcec50 | amazzoli/PopGenCompetition | lib/gillespie.cpp | #include "gillespie.h"
GillespieBD::GillespieBD(std::mt19937& generator) :
StocProc{generator} { };
void GillespieBD::run(param& params){
state = vecd(state_dim());
weights = vecd(state_dim() * 2);
vecd init_state;
endc_f end_condition;
double time_scale;
int traj_step;
try{
... | ALGO | 0.999658 | 5.595248 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2020-09-26T09:11:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "744961532... |
15b80f62-2d3a-498d-b04e-c57327ce0118 | wangtongxue-369/xcpc_Code_file | file/vjudge/2025newpritce/2025newpractice6/P.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PII pair<ll, ll>
const ll mod = 1e9 + 7;
const ll MAXN = 500005;
const ll base1 = 131;
const ll base2 = 127;
ll _ = 1, n, m, ans = 0, l[MAXN], r[MAXN];
void solve()
{
cin >> n >> m;
l... | ALGO | 0.999987 | 3.303849 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2025-02-24T09:13:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "448d676e955... |
85ff1d14-8259-40f2-a112-914657e676dc | yanggogi1423/OpenCV_MP_Assignment | MP_Assignment_5/MP_Assignment_5.cpp | #include <opencv2/opencv.hpp>
#include "MatrixInverse.h"
#include "vec.h"
#include "mat.h"
// Source Image
IplImage* src = nullptr;
IplImage* dst = nullptr;
int W = 500; // 결과 이미지 가로 크기
int H = 500; // 결과 이미지 세로 크기
// MATRIX 함수들
// 내적 함수
void multiplyMatrix(float M[][8], float A[][8], float B[][8])... | ALGO | 0.985347 | 3.29675 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-07-05T16:01: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": "24f7193e26d6... |
72b11a5b-6e6b-48e0-9103-4f59b33faf5d | Kaur-sukhmani/DSA_C- | Graph/gfg-leetcode/graph014.cpp | /*
Bipartite Graph using DFS
https://www.geeksforgeeks.org/problems/bipartite-graph/1
https://leetcode.com/problems/is-graph-bipartite/
Given an adjacency list of a graph adj of V no. of vertices having 0 based index. Check whether the graph is bipartite or not.
Know more about Bipartite Graph: - https://www.geeksfor... | ALGO | 0.999953 | 5.917237 | {
"github_metadata": {
"branch": "main",
"commit_count": 249,
"repo_created_at": "2023-12-30T18:06: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": "9c06a5f887... |
50fc8a79-aa55-43ad-9f5d-8cbd332474cf | gui-ccr/study-cpp | code/Concepts/função/search_element_array.cpp | #include <iostream>
using namespace std;
int procurarElemento(string lista[], int tamanho, string elemento);
main()
{
// declaração dos dados
string Listacomida[] = {"pizza" , "hamburguer", "strogonoff", "pudim"}; // lista de elementos
int size = sizeof(Listacomida)/sizeof(Listacomida[0]); // aqui é calc... | TOOL | 0.977427 | 4.301536 | {
"github_metadata": {
"branch": "main",
"commit_count": 33,
"repo_created_at": "2025-04-22T03:27:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "2e8cbb9c977... |
64b8197c-4233-43cc-a462-233568d83b67 | kazusa3e/leetcode | 581.shortest-unsorted-continuous-subarray.cpp | /*
* @lc app=leetcode id=581 lang=cpp
*
* [581] Shortest Unsorted Continuous Subarray
*/
// @lc code=start
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
class Solution {
public:
int findUnsortedSubarray(vector<int>& nums) {
if (nums.size() == 1) return 0;
int ... | ALGO | 0.999881 | 6.350112 | {
"github_metadata": {
"branch": "master",
"commit_count": 428,
"repo_created_at": "2023-07-08T05:54: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": "d1efa547... |
2a488c69-fa98-4aa3-8a40-9ca0570969d4 | AartRai/CPP | Day5/question3.cpp | //Ques-03 Write a C++ function that takes a string as a parameter and checks how many vowels and consonants are in that string.
//Assuming that string contains only lowercase.
#include <iostream>
#include <string>
using namespace std;
void count(const string &str, int &vowel, int &consonant) {
vowel = 0;
cons... | ALGO | 0.999741 | 6.233613 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-08-26T16: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": "9ad2501aea07... |
3d9ecd4f-8216-46b5-9e99-99e391bbe468 | vuquelam28/competitive-programming-topics | tests/test01/p02_phan_tu_trung_vi/solution.cpp | #include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
using namespace std;
const int inf = 2e9;
bool check(long long x, vector < int > &a, int n, int k)
{
int cnt = 0;
for (int i = n / 2; i < n; ++i)
{
if (x - a[i] > 0)
cnt += x - a[i];
... | ALGO | 0.999988 | 4.831817 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2021-08-02T16:27: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": "5e43b492ef4e... |
22c965fe-390b-4d6c-b083-c000f4d29df3 | MrPaulHui/Digital-Image-Processing-Questions100-Cpp | t27.cpp | //双三次插值
//因为用到了周围16个像素,所以要判断像素位置是否超出
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include "common.h"
#include <iostream>
#include <math.h>
using namespace std;
double h(double t, double a=-1){
if(t<=1){
return (a+2)*pow(t,3) - (a+3)*t*t + 1;
}
else if(t<=2){
return a*pow(t,3)... | ALGO | 0.988104 | 4.050195 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2020-04-28T03:05:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a32f9fe56... |
1fc22d83-96c7-4642-834b-429ac57b6a1a | Galdoren/Posix-Threads-Examples | example_05/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <pthread.h>
#include <semaphore.h>
/* compile with g++ main.cpp -lpthread -o example.out */
#define NTHREADS 8
#define M NTHREADS
#define N 100000000
#define MBEXTRA (1 << 20)
sem_t semaphore;
double A[M][N];
void* do_work(void* arg) {
long tid;... | ALGO | 0.999373 | 4.450185 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2018-07-05T17:47:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "189fcc44c... |
cf6307e4-3878-4af0-b6c5-7d671ebb51f2 | seanfrischmann/cpp-practice | A2/A2.cpp | #include <iostream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <vector>
using std::string;
using std::cout;
using std::endl;
using std::ifstream;
using std::cin;
using std::cerr;
using std::vector;
/*
* The purpose of this method is to take in a reference to a sorted vector ... | TOOL | 0.997386 | 5.564934 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2013-08-30T17:48:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "b1dca2526... |
e34b66f1-b982-47b6-950b-b386d9498316 | kunidesuyo/competitive-programming | ABC/151~200/199/C.cpp | #include <bits/stdc++.h>
#include <cmath>
using ll = long long;
const ll INF = __LONG_LONG_MAX__;
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int q;
cin >> q;
int t[q], a[q], b[q];
for(int i = 0; i < q; i++) {
cin >> t[i] >> a[i] >> b[i];
}
... | ALGO | 0.999984 | 3.902039 | {
"github_metadata": {
"branch": "master",
"commit_count": 332,
"repo_created_at": "2021-05-23T09:30: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": "84228089... |
76acefbd-527f-4c52-83cc-728eb15496c0 | alyabogd/DataStructures | flows/Dinic_matrix.cpp |
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
std::vector<std::vector<int> > graph;
std::vector<std::vector<int> > flow;
std::vector<int> layers;
std::vector<int> pointers;
unsigned numOfVerts;
int istock, stock;
int money;
void assignGlobal() {
graph.assign(numOfVerts, std::vector<int... | ALGO | 0.999877 | 3.583873 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-07-14T10:45:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f531ba17a... |
23c9bdde-39b1-4c56-858e-81f31a9489d4 | Tanmoytkd/programming-projects | UVA/uva 10199/main.cpp | #include<bits/stdc++.h>
#define pii pair<int,int>
#define mkp make_pair
#define fs first
#define sc second
#define pb push_back
#define ppb pop_back()
#define pf printf
#define pf1(a) printf("%d\n",a)
#define hi printf("hi!\n");
#define sf scanf
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#defin... | ALGO | 0.999937 | 3.716832 | {
"github_metadata": {
"branch": "master",
"commit_count": 195,
"repo_created_at": "2015-09-15T12:04:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "759a8e77... |
08e9cdb3-b645-45b0-910d-f8ff1ca87501 | ronick-grammer/Algorithm | Programmers/괄호 변환.cpp | #include <string>
using namespace std;
//problem link: https://programmers.co.kr/learn/courses/30/lessons/60058
int getSplitedIndex(string s){ // 균형잡힌 괄호 문자열의 인덱스 반환
int count_left = 0;
int count_right = 0;
if(s[0] == ')'){
count_right++;
}
else{
count_left++;
}
for(i... | ALGO | 0.999972 | 5.378561 | {
"github_metadata": {
"branch": "main",
"commit_count": 435,
"repo_created_at": "2020-12-02T23:30:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae8285b125... |
c24c0a83-37da-411e-8de0-ff0c9bc0a29e | amcerbu/huygens | tests/resynthesis.cpp | #include "../src/audio.h"
#include "../src/synth.h"
#include "../src/filter.h"
#include "../src/filterbank.h"
#include "../src/noise.h"
#include "../src/delay.h"
#include <signal.h>
#include <map>
using namespace std;
using namespace std::complex_literals;
using namespace soundmath;
#define BSIZE 1024
bool running =... | ALGO | 0.926097 | 4.639831 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2021-12-15T02:13: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": "7889b953da4... |
95907936-7da5-4751-a1f2-2ca93b6cdc97 | dslov89/codetree-TILs | 240403/K번 최댓값으로 이동하기/move-to-max-k-times.cpp | #include <iostream>
#include <queue>
using namespace std;
int n,k;
int arr[100][100];
int r,c;
queue<pair<int,int>> q;
int mr,mc;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int visit[100][100]={};
void BFS(){
while(!q.empty()){
int x = q.front().first;
int y = q.front().second;
q.pop();... | ALGO | 0.999899 | 3.592812 | {
"github_metadata": {
"branch": "main",
"commit_count": 156,
"repo_created_at": "2023-11-22T09:03:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b67fa77f61... |
86b73cbc-0a50-4ad6-960d-063be4ae0d17 | dahyunko/2023-algorithm | 백준/Silver/9017. 크로스 컨트리/크로스 컨트리.cc | /*9017*/
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <queue>
#include <cmath>
#include<limits.h>
#include<set>
#include<map>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
for (int t = 0; t < T; t++) {
int N;
cin >> N;
... | ALGO | 0.999966 | 3.779843 | {
"github_metadata": {
"branch": "main",
"commit_count": 477,
"repo_created_at": "2023-01-04T03:37: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": "61c5dbf9f6... |
dcb00df2-1be9-4afb-85be-532245c5f3c5 | NisbCode/learning-to-practice-with-UFF | 3 PERÍODO/ED/lista_1/questao_4-a.cpp | /*
4. Escreva um algoritmo que dada uma pilha P, inverta a ordem dos
elementos de P. Seu algoritmo deve usar espaço auxiliar constante
(somente variáveis locais e nenhum vetor extra) e:
a) uma fila
Seu algoritmo deve manipular as pilhas e filas por suas interfaces padrão
(somente métodos do TAD).
*/
#include <stdio.... | ALGO | 0.999818 | 4.558169 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2021-10-29T18:05: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": "312c962bc2fe... |
70130c63-f324-45c2-a26e-4b9cef8ee744 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/13/52/10.cpp | //#pragma comment(linker, "/STACK:134217728")
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#includ... | ALGO | 0.99998 | 3.618472 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-09-30T05:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 22,
"forks": 8,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a6acd07c... |
e83d1913-c2fc-442c-9e12-6cddb89bfb04 | Carson-Tang/Algorithms-DataStructures | SqrtDecomp.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define INFINITE 0x3f3f3f3f
#define MAXN 100001
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int>ii;
int n,q,bs,arr[100001],cmd,l,r,u,x; ll block[317],ans;
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
// ... | ALGO | 0.999752 | 4.995982 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2018-11-05T04:57: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": "ddc6ca7ad... |
8b44b834-027f-42e4-b7df-3063612822e2 | wangjianhuaAMSS/Twinkle_analysis | differential_attack/differential_attack_SAT_probability/SAT/resizestate.h | #ifndef _RESIZESTATE_H_
#define _RESIZESTATE_H_
//#include "../main.h"
template<typename T>
vector<vector<vector<T>>> vector_2_cube(vector<T> state, size_t x, size_t y, size_t z) {
assert (state.size() == x * y * z);
vector<vector<vector<T>>> cube_state;
for (size_t i = 0; i < x; i++) {
vector<v... | ALGO | 0.978782 | 3.931635 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-06-24T04:07:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "39b0b122ca14... |
e22995f0-1c11-4f2f-8e6e-55eb3c8ce0d3 | chan9an/Daily_cplusplus | Min Turn Route.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#incl... | ALGO | 0.999753 | 4.262108 | {
"github_metadata": {
"branch": "main",
"commit_count": 221,
"repo_created_at": "2023-09-16T18:04:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5347f70f12... |
cc556ee2-f7af-4b85-87fa-87b9836e2040 | kilian-hu/hackerrank-solutions | certificates/problem-solving-basic/usernames-changes/stub.cc | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'possibleChanges' function below.
*
* The function is expected to return a STRING_ARRAY.
* The function accepts STRING_ARRAY usernames as parameter.
*/
vector<string> possibleChanges(ve... | ALGO | 0.999599 | 5.132035 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-09-15T12:09:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 420,
"forks": 178,
"issues": 5,
"pull_requests": 4
},
"file_meta": {
"content_id": "bce5fc... |
6d38684f-44b4-4e94-bac5-bf9278928770 | shuizgongyue/ZhongYue | Cyuyanxuexi/2023.12.31.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
// === 编写一个程序统计一个数在二进制序列中的1的个数 ===
//int tj(int a)
//{
// int tot = 0; 如果判断的是负数就会有错误
// while (a)
// {
// if (a % 2 == 1)
// {
// tot++;
// }
// a = a / 2;
// }
// return tot;
//}
//int tj(unsigned int a)
//{
// int tot = 0;
// while (a)
// {
// if (a % 2... | ALGO | 0.998873 | 3.509448 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-01-03T13:41: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": "659a9b2a0b22... |
90aabe2c-2aab-427c-9dff-efd4ed64db73 | bvquoc/CP-Trainning-2021 | 0 - Contest 2020/PreVOI2019/PreVOI2019-Day2/Contestants/Ti098/FIXSTR.cpp | #include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ins insert
#define era erase
using namespace std;
string tt[100009], s;
int x, k, y, m;
char type, doi[300];
int tinh(int l, int r)
{
int ans = 0, d = 0;
for(int i=l; i<=r; ++i)
{
if(s[i] == '(')
d+... | ALGO | 0.994303 | 3.929429 | {
"github_metadata": {
"branch": "master",
"commit_count": 611,
"repo_created_at": "2020-06-03T07:47: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": "455f4403... |
e75151cd-497c-4076-88d7-e5b4269822f6 | harsh-govind/codes-leetcode | Implementing Dijkstra Algorithm - GFG/implementing-dijkstra-algorithm.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the shortest distance of all the vertices
//from the source vertex S.
vector <int> dijkstra(int v, vector<vector<int>> adj[], int src)
{
// Code here
vecto... | ALGO | 0.999955 | 5.939328 | {
"github_metadata": {
"branch": "main",
"commit_count": 3946,
"repo_created_at": "2022-06-29T16:48:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "52bff85e7... |
91a96da5-d048-4986-83a1-6aab52b820ce | motaher13/Solved-OJ-problems | UVA/Dijkstra.cpp | #include<bits/stdc++.h>
using namespace std;
vector<long long>vc[100100];
vector<long long>cost[100100];
long long lfs[100100],par[100100];
long long m,n;
long long ara[100100];
struct node
{
long long vtx,wght;
bool operator < (const node&p)const
{
return wght>=p.wght;
}
};
long long djkstra(lo... | ALGO | 0.999999 | 3.911847 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2018-04-06T05:56:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a10ed684... |
62fac14c-1ca4-4e58-a4bb-64f01c213377 | sachuverma/DataStructures-Algorithms | Leetcode Daily Challenge/March-2021/22. Vowel Spellchecker.cpp | /*
Vowel Spellchecker
==================
Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word.
For a given query word, the spell checker handles two categories of spelling mistakes:
Capitalization: If the query matches a word in the wordlist (case-insensitive), then th... | ALGO | 0.998992 | 6.67466 | {
"github_metadata": {
"branch": "master",
"commit_count": 1430,
"repo_created_at": "2020-10-07T10:08:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2049,
"forks": 541,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "44... |
c511398a-c7fb-4da2-b205-a48002c5d84c | sptzxbbb/Practice | LeetCode/Algorithms/c++/Perfect Squares/Perfect Squares.cpp | class Solution {
public:
// dp solution
int numSquares(int n) {
vector<int> dp(n + 1);
fill(dp.begin(), dp.end(), INT_MAX);
for (int i = 0; i * i <= n; i++) {
dp[i * i] = 1;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; i + j * j <= n; j++) {
... | ALGO | 0.999939 | 5.265695 | {
"github_metadata": {
"branch": "master",
"commit_count": 358,
"repo_created_at": "2015-05-02T03:51:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8178fd5a... |
b046b94b-a8f9-45c5-acb5-b3e8d41e6c58 | zh-bupt/DataStructures | SearchAndSort/AVLtree1.cpp | /*
*问题描述:
*输入一组关键字序列,并以此顺序建立一棵平衡二叉树,
*并在建树过程中用逆中序法输出每次插入新结点后的平衡二叉树形状。
*分工:
*编码 2015211203 张珩
*文档 2015211109 孙嘉文
*测试 2015522118 董笑言
*/
#include<iostream>
using namespace std;
/*
*枚举类型,用来表示一个节点左右子树的关系
*LH:表示左子树高
*RH:表示右子树高
*EH:表示左右子树等高
*/
typedef enum {
LH = -1, EH, RH
}BalanceFactor;
/*
*数据元素结构
*/
typedef s... | ALGO | 0.999933 | 4.215598 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2016-11-12T15:22: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": "d81ad8f60... |
ae7bcbb5-5707-4f0b-bc7d-297f14151fba | samech-git/foam-extend3.1_src | foam/interpolations/MixingPlaneInterpolation/MixingPlaneInterpolation.H | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
---------------------... | ALGO | 0.941658 | 6.339879 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-12-14T08:26: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": "1a50ef15be... |
7af01c7c-7ee3-4456-911c-74d8176bdd24 | tanvirsweb/Competitive_Programming_Code | DivineIT_Contest/B_Block.cpp |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> blocks;
vector<int> block_pos;
void return_blocks_above(int a)
{
int pos = block_pos[a];
while (blocks[pos].back() != a)
{
int top = blocks[pos].back();
blocks[top].push_back(top);
block_pos[top] = top;
bloc... | ALGO | 0.999662 | 4.79794 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2024-05-18T17:50:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d0df455301... |
2b9c7f4c-52cd-46e8-9c48-48439f01a014 | sanket-patil96/Daily-Leetcode | 0083-remove-duplicates-from-sorted-list/0083-remove-duplicates-from-sorted-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* deleteDupli... | ALGO | 0.999964 | 5.720942 | {
"github_metadata": {
"branch": "main",
"commit_count": 938,
"repo_created_at": "2024-07-29T10:42:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "853101ba6e... |
2c88f8fe-4056-4046-ad32-e19af82f885e | luciferwzp/The-sword-refers-to-offer | 二维数组中的查找.cpp | //此二维数组是一个从左到右,从上到下逐级递增的二维数组
//从右上角查找
bool Find(int* matrix, int rows, int columns, int number)
{
bool found = false;
if(matrix != NULL && rows > 0 && columns > 0)
{
int row = 0;
int column = columns - 1;
while(row < rows && column >=0)
{
if(matrix[row * columns... | ALGO | 0.999885 | 4.353123 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2019-08-16T07:26: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": "bfd975855... |
f05c4436-8314-4ea3-8667-a0f30bbeaf43 | LLNL/RAJAPerf | src/basic/REDUCE_STRUCT-OMP.cpp | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2017-25, Lawrence Livermore National Security, LLC
// and RAJA Performance Suite project contributors.
// See the RAJAPerf/LICENSE file for details.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~... | TOOL | 0.958227 | 5.805535 | {
"github_metadata": {
"branch": "develop",
"commit_count": 3087,
"repo_created_at": "2017-09-25T20:18:46.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 118,
"forks": 42,
"issues": 45,
"pull_requests": 15
},
"file_meta": {
"content_id": "5a... |
ec5902a2-bdcd-4aaa-b0ce-bca06a4c985a | Ghoul2077/CPP-DS-Programs | Reccursion/KeypadNumberToString/Untitled.cpp | #include <bits/stdc++.h>
using namespace std;
const char KEYPAD[9][3] = {
{ 'a', 'b', 'c' },
{ 'd', 'e', 'f' },
{ 'g', 'h', 'i' },
{ 'j', 'k', 'l' },
{ 'm', 'n', 'o' },
{ 'p', 'q', 'r' },
{ 's', 't', 'u' },
{ 'v', 'w', 'x' },
{ 'y', 'z', ' ' }
};
void printArr(string arr[], int size) {
f... | ALGO | 0.999344 | 4.231955 | {
"github_metadata": {
"branch": "main",
"commit_count": 171,
"repo_created_at": "2021-07-02T04:35:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "708aacb8a1... |
0c00278c-ddd7-4403-89fc-500b25a5785b | ankitkr602/leetcode_solving | Get minimum element from stack - GFG/get-minimum-element-from-stack.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*
The structure of the class is as follows
class _stack{
stack<int> s;
int minEle;
public :
int getMin();
int pop();
void push(int);
};
*/
class Solution{
int minEle;
stack<int> s;
stack<int> min_sta... | ALGO | 0.999684 | 5.118951 | {
"github_metadata": {
"branch": "main",
"commit_count": 181,
"repo_created_at": "2022-01-22T20: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": "3fdf0edd4c... |
4d3aa432-b99b-49d8-a9c5-595a8d9f4765 | sgh9898/Coding | LeetCode C++/Problems/200-399/341. Flatten Nested List Iterator.cpp | /**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* class NestedInteger {
* public:
* // Return true if this NestedInteger holds a single integer, rather than a nested list.
* bool isInteger() const;
*
* //... | ALGO | 0.986217 | 6.472529 | {
"github_metadata": {
"branch": "master",
"commit_count": 66,
"repo_created_at": "2020-12-17T02:54: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": "7bc498ba8... |
63b50b71-fb45-408e-a273-b586fdbe398d | yuichiro-kurose/kyopro | atcoder/abc324/c/main.cpp | // author: <NAME>
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string t;
cin >> n >> t;
vector<int> ans;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
if (s.size() == t.size()) {
int cnt = 0;
for (int j = 0;... | ALGO | 0.999987 | 3.86302 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2025-06-15T05:31: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": "ba32c255b... |
4cc65deb-925e-46ba-a55d-dc2b43a86945 | smoe1/ThesisCode | dogpack-mapped/scalar/apps/hybrid/VlasovPoisson/beam/QinitFunc.cpp | #include <cmath>
#include "dogdefs.h"
#include "VlasovParams.h"
// This is a user-supplied routine that sets the
// initial conditions at all the points "xpts"
//
void QinitFunc(
const dTensor2* vel_vec,
const dTensor2& xpts, dTensor2& qvals)
{
const int numpts = qvals.getsize(1);
const int meqn =... | ALGO | 0.999133 | 3.853521 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-06-04T20:02:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f97e396f70... |
2d3f87d6-2875-4d05-bbc0-b044b97dd9cb | Seo-sang/Algorithm | baekjoon/1043.cpp | #include <bits/stdc++.h>
using namespace std;
const int MN = 51;
bool truth[MN];
bool vst[MN];
vector<int> g[MN];
vector<vector<int> > party;
int main() {
int N, M, T; cin >> N >> M >> T;
while(T--) {
int a; cin >> a;
truth[a] = true;
}
while(M--) {
int num; cin >> num;
... | ALGO | 0.999887 | 3.917521 | {
"github_metadata": {
"branch": "master",
"commit_count": 256,
"repo_created_at": "2021-11-19T07:10: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": "5a9df4dc... |
ab9d4956-2dd7-4af0-b7dd-fd9984103c0b | dimasteva/Petlja-Zbirka2 | Chapter 2/Page 83.cpp | /*
Task: Most Valuable Items
For each item on sale, a code and price are given. The buyer has a certain amount of dinars at their disposal and wants to buy the most expensive items. They take items in order starting from the most expensive until they run out of money. If there is not enough money for the most expensive... | ALGO | 0.999923 | 4.584809 | {
"github_metadata": {
"branch": "main",
"commit_count": 474,
"repo_created_at": "2023-12-09T16:05: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": "24b9d13153... |
ac7ccc5e-547f-4d09-a3f5-7879bdd554c1 | k8440009/Algorithm | BOJ/11724_1.cpp | // 연결 요소의 갯수
// https://www.acmicpc.net/problem/11724
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 1000 + 1;
int N, M;
vector<int> graph[MAX];
bool visited[MAX];
void dfs(int current)
{
visited[current] = true;
for (int i = 0; i < graph[current].size(); i++)
{
int next ... | ALGO | 0.99996 | 4.413612 | {
"github_metadata": {
"branch": "master",
"commit_count": 762,
"repo_created_at": "2019-08-04T15:03:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 12,
"pull_requests": 0
},
"file_meta": {
"content_id": "b288d1a... |
b005849e-a422-4172-aa62-241f2ea37a62 | hasantarek2002/C-Code | huffman.cpp | // THIS WILL TAKE INPUT FROM A TEXT FILE NAMED input.txt
#include <iostream>
#include <fstream>
#include<vector>
using namespace std;
struct node
{
node *left,*right;
string letter,bits;
int frequency;
};
vector <node*> arrayOfNode;
node* findMinimum()
{
int temp=INT_MAX;
vector <node*> :: itera... | ALGO | 0.999846 | 3.759996 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-08-03T15:17:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a0daf4528... |
068f5273-56a6-4c39-9f3a-67dfdae4ceee | kjbartel/magma | src/zpotrs_batched.cpp | /*
-- MAGMA (version 1.6.1) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date January 2015
@author <NAME>
@precisions normal z -> s d c
*/
#include "common_magma.h"
#include "batched_kernel_param.h"
/**
Purpose
-... | ALGO | 0.99675 | 5.399357 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2015-06-04T17:28:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 23,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f3d5bf6b... |
917e3bf5-3323-4b74-8eaf-e4f6fdf2b441 | CGAL/cgal | Shape_detection/test/Shape_detection/include/test_efficient_RANSAC_generators.h | // Copyright (c) 2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : <NAME>, <NAME>, <NAME>, <NAME>
//
#ifndef CGAL_SHAPE_DETECTION_EFFICIENT_RANS... | ALGO | 0.919714 | 6.304707 | {
"github_metadata": {
"branch": "master",
"commit_count": 113659,
"repo_created_at": "2014-10-01T12:22:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5443,
"forks": 1475,
"issues": 511,
"pull_requests": 136
},
"file_meta": {
"content_id... |
0f8576a9-ef92-4ad8-af17-ec6182a9a203 | Ziezi/Programming-Principles-and-Practice-Using-C-by-Bjarne-Stroustrup- | Visual Studio 2010/Projects/bjarneStroustrupC++PartIV/bjarneStroustrupC++PartIV/Chapter26Exercise12.cpp | /*
TITLE Random floating point numbers sorting Chapter26Exercise12.cpp
COMMENT
Objective: Write a program that generates random floating-point numbers
and sorts them using std::sort.
Measure the time used to sort 500,000 doubles and 5,000,000 doubles.
Input: -
Output: Size: 500.000 T... | ALGO | 0.996 | 5.691194 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2017-06-23T11:59:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 15,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f543ea8... |
78454d05-216a-4130-9eb8-9b7cdf590545 | koosyong/tum-lsr-dhri | pointcloud/dhri_multipleObjectTracking/src/pctracking.cpp | #include "pctracking.h"
#include "pctracking_weight.h"
//#include <Eigen/Dense>
PCTracking::PCTracking(ros::Publisher* _pub_scene, ros::Publisher* _pub_model, FuncPub _funcPub, int dimension, double cont_sampling, double cont_simplify, double segTol)
{
pub_scene = _pub_scene;
pub_model = _pub_model;
funcPu... | ALGO | 0.981531 | 5.961665 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2015-12-18T13:29:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "9b102f3b2... |
2fa0611e-252c-44d9-8f92-899c50fd5f76 | Serflous/BearBones | src/Collision/OBB.cpp | #include "OBB.h"
Collision::OBB::OBB()
{
m_centerPoint = glm::vec3(0, 0, 0);
m_rotationMatrix = glm::mat3x3(1.0);
m_halfWidths = glm::vec3(0, 0, 0);
}
Collision::OBB::OBB(const OBB & other)
{
m_centerPoint = other.m_centerPoint;
m_rotationMatrix = other.m_rotationMatrix;
m_halfWidths = other.m_halfWidths;
}
Co... | ALGO | 0.978462 | 5.013164 | {
"github_metadata": {
"branch": "master",
"commit_count": 110,
"repo_created_at": "2018-09-12T14:46: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": "aaacf0a7... |
77350f24-11ff-435f-86cb-0833724b9ad0 | SharifiZarchi/Algorithms_Design | Covid Challenge/Round-1/judge/submissions/96109588/code.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#define MAX_NODES 5
using namespace std;
int n, sum_weights;
vector<int*> all_neighbors;
bool busy;
struct State {
int *position;
bool visited[MAX_NODES][MAX_NODES];
State() {
int pos_index = 0;
for (int i = n - 1; i >= 0; i--)
pos_i... | ALGO | 0.999962 | 3.630902 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2020-02-07T12:07:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 102,
"forks": 24,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f7c04... |
c2f60004-0ed4-405a-94bb-0e4808b2e4e1 | kilarionov/cppTopics | SSTREAM-STRING/StringMATCH-AlgoAcademy-Oct2015-DEQUE.cpp | // http://bgcoder.com/Contests/Practice/Index/268#2
// https://github.com/TelerikAcademy/AlgoAcademy/tree/master/2015-10-Algorithms-on-String/Problems/Problem%20-%20Match
// https://en.wikipedia.org/wiki/Longest_common_substring_problem
// http://www.geeksforgeeks.org/longest-common-substring/
#include<iostream>
#incl... | ALGO | 0.999946 | 4.337311 | {
"github_metadata": {
"branch": "master",
"commit_count": 447,
"repo_created_at": "2015-07-29T13:12:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5683c14... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.