uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
57a947e5-6981-4c31-ac70-f57e5a3351b5 | Joacaldo7965/memoria | mesher/src/Mesher.cpp | #include "Mesher.h"
#include <math.h>
#include <algorithm>
namespace Clobscode
{
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
Mesher::Mesher(){
}
//----------------------------... | ALGO | 0.981443 | 4.707064 |
92409fa9-877c-402f-ab7c-bbf130cf7a82 | gauravkumarjha442/Leetcode | leetcode/1419. Minimum Number of Frogs Croaking/s1.cpp | // OJ: https://leetcode.com/problems/minimum-number-of-frogs-croaking/
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(1)
class Solution {
public:
int minNumberOfFrogs(string s) {
string t = "croak";
vector<int> cnt(5);
int ans = 0, cur = 0;
for (char c : s) {
... | ALGO | 0.999785 | 5.493797 |
a205f843-af8a-4509-81ff-8fc8fb9faf6c | gotr3k/fax_backup | teams_backup/[143-2018] Kernel-8086/src/semaphor.cpp | /*
* semaphor.cpp
*
* Created on: Aug 17, 2020
* Author: OS1
*/
#include "../h/semaphor.h"
#include "../h/lock.h"
#include "../h/krnlsem.h"
Semaphore::Semaphore(int init){
LOCK
myImpl=new KernelSem(init,this);
UNLOCK
}
Semaphore::~Semaphore (){
LOCK
delete myImpl;
UNLOCK
}
int Semaphore::wait (Time ... | TOOL | 0.966351 | 4.641861 |
e617d30f-d741-4991-bd89-a0ceffcee902 | SantiagoNinoX/Competitive_Programming | wrong_substracion.cpp | #include <iostream>
using namespace std;
int main(){
int n, k;
cout << "Insert the number to substract and the number of substractions: " << endl;
cin >> n >> k;
if(n >= 2 && n <= 1000000000){
if(k >= 1 && k <= 50){
for (int i = 0; i < k; i++){
if (n % 10 == 0){
... | ALGO | 0.999808 | 3.766584 |
080db832-b99c-4ba6-9d7b-ae6e64e34a8f | Qzxell/GOICPC | Problems/2047B.cpp | #include <bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define ln '\n'
#define ll long long
#define pb push_back
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>
#define fi first
#define se second
#define f(i, a, b) for(ll i = (ll)a... | ALGO | 0.999908 | 4.345615 |
770907b4-3759-4611-9055-d56d1dbb75b4 | geoffgeorgein/CP | 1/edu103B.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define F first
#define S second
#define ll ... | ALGO | 0.99959 | 3.584498 |
4d628fb9-b38d-494c-aedf-31273e20bb44 | abovethe-clouds/ACM | c++/算法/搜索/DFS/P1036 [NOIP2002 普及组] 选数.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k,a[21],b[21],sum,ans;
int judge(int x)
{
if(x==2) return 1;
if(x==1) return 0;
int flag=1;
for(int i=2;i*i<=x;i++)
{
if (x%i==0)
{
flag=0;
break;
}
}
return flag;
}
void dfs(int x,int y)
{
... | ALGO | 0.999929 | 3.354811 |
a1e589ac-ae3c-4e98-94e1-f1151573df12 | Vesimeu/Object-Oriented-Programming | 5 задание/Program.cpp | #include "DynamicList.h"
#include "LinkedList.h"
#include <iostream>
#include <random>
#include <stdexcept>
void testPerformance() {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> operationDist(0, 6);
std::uniform_int_distribution<> valueDist(0, 99);
std::uniform_int... | TEST | 0.934311 | 6.498845 |
d04adca4-2fd8-438d-9b39-fe5d193b0aa3 | ishandutta2007/codeforces | ztxz16/normal/414/C.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#define Max(a, b) ((FASTBUFFER = ((a) - (b)) >> 31), ((b) & FASTBUFFER | (a) & ~FASTBUFFER))
#define Min(a, b) ((FASTBUFFER = ((a) - (b)) >> 31), ((a) & FASTBUFFER | (b) & ~FASTBUFFER))
#define Swap(a, b) (a ^= b, b ^= a,... | ALGO | 0.999919 | 3.516725 |
f727a408-3227-44be-9a0c-a911a79e9794 | blocked3time/linedetect_sim | vision.cpp | #include<math.h>
#include"vision.hpp"
using namespace cv;
void setFrame(Mat& frame){
frame = frame(Rect(Point(0,frame.rows/4*3),Point(frame.cols,frame.rows)));
cvtColor(frame,frame,COLOR_RGB2GRAY);
frame += Scalar(100) - mean(frame);
threshold(frame, frame, 0, 255, THRESH_BINARY | THRESH_OTSU);
}
void drawBoun... | ALGO | 0.99407 | 4.123446 |
07254e3f-6227-43f3-8a40-2692e2e8cfcd | ashay20/dsa-playlist | 50-powx-n/50-powx-n.cpp | class Solution {
public:
double myPow(double x, int n) {
if(n==0)
return 1;
if(n==1)
return x;
long long num=n;
if(n<0)
num=-num;
double ans {1.0};
while(num){
if(num%2==1){
ans*=x;
--num;... | ALGO | 0.99979 | 6.006294 |
f575bb68-f3fa-4695-8db3-68d9f28a4321 | ajpslcwds/cpp_study | wzq_study/avltree.cpp | #include "avltree.h"
void plr_sort(Tree tr)
{
if (NULL == tr)
{
return;
}
tr->display();
plr_sort(tr->lchild);
plr_sort(tr->rchild);
}
void lpr_sort(Tree tr)
{
if (NULL == tr)
{
return;
}
lpr_sort(tr->lchild);
tr->display();
lpr_sort(tr->rchild);
}
void lrp_sort(Tree tr)
{
if (NULL == tr)
{
return;... | ALGO | 0.999739 | 4.159474 |
8e96b112-9bfb-4862-afa2-7b03949c860d | Faizii992/Algorithm- | QuickSort.cpp |
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<stdlib.h>
#include<cstring>
using namespace std;
struct Info
{
int id;
string name;
};
int partition(struct Info a[],int lo,int hi)
{ struct Info temp;
int pivot=a[hi].id;
int i=lo-1;
for(int j=lo;j<=hi-1;j++)
{ if(a[j].id<=piv... | ALGO | 0.999744 | 4.021628 |
18271fdf-e216-4dfe-a511-d3af6fc989c9 | emotionless/Programming-Problem-Solution | codeforces/bottom_Up.cpp | /****************************************************************************
* ==>>JU_Bottom_Up *
* emotionless, BG_Peacemind, sahedsohel *
****************************************************************************/
#includ... | ALGO | 0.999807 | 3.383402 |
1642f4d3-84d7-423d-85af-ed1a3ba36220 | MMKante/regression-by-multithreading | PowerSeriesRegressionSolver.cpp | #include "PowerSeriesRegressionSolver.h"
PowerSeriesRegressionSolver::PowerSeriesRegressionSolver() {}
void PowerSeriesRegressionSolver::name() const {
std::cout << "Power Series" << std::endl;
}
std::vector<Point> PowerSeriesRegressionSolver::Solve() {
std::vector<Point> result;
int n = m_points.size();... | ALGO | 0.989405 | 4.771736 |
4061f844-7002-4224-8a5f-1388593af313 | raincross7/code-similarity | codes/train_code/problem186/problem186_36.cpp | #include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>... | ALGO | 0.999936 | 3.929088 |
3a8c8d3e-3b81-475b-ba0d-0d9ffeae580f | gautamop01/Daily-Goals-Of-Coding | Leet Code/Data Structure II/Linked List Cycle II.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *slow = head, *fast = head;
bool hasCycle = false;
... | ALGO | 0.999936 | 6.464187 |
fee5a2db-9711-4360-aeca-86eb80fc6487 | LiaoU3/LeetCode | Problems/116_Populating_Next_Right_Pointers_in_Each_Node.cpp | #include<queue>
#include<stdlib.h>
using namespace std;
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, N... | ALGO | 0.99971 | 5.380462 |
2c41a0ee-c214-49d2-87ad-19701c204ef1 | ishandutta2007/codeforces | farhod_farmon/normal/1557/D.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
const int N = 300300;
using namespace std;
int n;
int m;
int d[N];
int p[N];
int lz[N * 8];
int t[N * 8];
vector<int> v[N];
pair<int, int> a[N];
int comb(int x, int y)
{
return d[x] > d[y] ? x : y;
}
void push(int x)
{
if(lz[x]){
... | ALGO | 0.999988 | 3.550384 |
bb347892-d702-4ca6-a73c-b074eb70c56c | SonginCV/MAF_HDA | GMPHD_MAF/demo_GMPHD_MAF.cpp | #include "pch.h"
#include <iostream>
// Funtions for Demo (visualization) in train or test dataset
void RunMOTDataset(const vector<string>& seqNAMEs, const vector<string>& seqPATHs, const vector<string>& detTXTs, const vector<MOTparams>& params_in=vector<MOTparams>());
void RunMOTSequence(const int& sq, const string&... | DATA | 0.986761 | 4.662984 |
6f05b62f-3422-4b2a-91b1-1e64993a4d93 | sotakqmf01/Programmers-CodingTest | 프로그래머스/2/62048. 멀쩡한 사각형/멀쩡한 사각형.cpp | #include <cmath>
using namespace std;
// Y = (w/h)X 그래프보다 밑에 있는 격자의 개수 세는 방식
// - 다만 큰 수의 나눗셈을 할 때 float를 사용하면 부동 소수점 정밀도가 떨어져, 오차가 클 수 있음
// - double을 쓰면 조금이나마 해결할 수 있지만, 근본적인 해결은 아님
long long solution(int w,int h) {
long long answer = 0;
for(int x = 0; x < h; x++){
double y = (double)w / h * x;... | ALGO | 0.999632 | 4.45685 |
d681f0a5-1582-45e4-b69b-c16e11a5771c | AstroVPK/LLVM-5.0.0 | llvm/tools/lld/ELF/Relocations.cpp | #include "Relocations.h"
#include "Config.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/raw_ostream.h"
#include <al... | TOOL | 0.971749 | 6.054991 |
b230cc6f-0a0c-4d25-b377-56368c046090 | synnaxlabs/synnax | driver/rack/persist.cpp | /// std
#include <filesystem>
/// module
#include "x/cpp/kv/kv.h"
// internal
#include "driver/rack/rack.h"
constexpr auto PERSISTED_STATE_FILE_PERMISSIONS = std::filesystem::perms::owner_read |
std::filesystem::perms::owner_write |
... | TOOL | 0.869804 | 7.492666 |
fa79ff11-0574-43d0-ba38-fed8dd5c0d19 | holotrek/test_desktop_multi_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
a58aba61-f75f-4c23-97f0-c0f857e476a5 | raincross7/code-similarity | codes/train_code/problem492/problem492_405.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
int a = 0,... | ALGO | 0.999943 | 4.152107 |
ebba5feb-1eee-48a2-bb52-4699dd4becc1 | manikanta2901/ubuntu | .history/SRM/elab/AlgorithmAnalysisAndDesign/Random/mergeSort_20210121151819.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(vector<int>& numbers, int l, int m, int r){
int n1 = m - l + 1, n2 = r - m;
int L[n1], R[n2];
for (int i = 0; i < n1; i++){
L[i] = numbers[l + i];
}
for (int j = 0; j < n2; j++){
R[j] = numbers[m + 1 + j];
}
int i = 0,j = 0,k = l;
while (i < n... | ALGO | 0.999991 | 4.725636 |
66fa516c-30d7-4e02-a6f4-0fcd774bb6c0 | atandritC/Competitive-Programming-Solutions | TLE's CP-31 Sheet/800/A_Array_Coloring.cpp | #include <bits/stdc++.h>
using namespace std;
// Define common macros
#define int long long
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>... | ALGO | 0.999473 | 6.003956 |
50ae473b-671e-4003-8e08-cdf0f6f4bd28 | hjiang13/LLMs-in-IR | POJ-104/13/298.cpp | #include <iostream>
using namespace std;
/*
* 1000012761_26.cpp
*??n????n???????????????10-100???
???????????????????????????????????????????
* Created on: 2010-10-29
* Author:1000012761
*/
int main(){
int n,i,j,k,s=0;
cin>>n;
if(n<1||n>20000) return 0;
int a[n];
for(i=0; i<n; i++)
{
cin>>a[i];
if(a[i]<10||a[i]>=... | ALGO | 0.999766 | 3.127089 |
13f6ed9d-5211-4694-a868-b3233a2a42b0 | meldaw84/The-offecial-GROMACS-molecular-simulation-toolkit_2023.2 | src/gromacs/linearalgebra/gmx_lapack/sormtr.cpp | #include "../gmx_lapack.h"
#include "lapack_limits.h"
void
F77_FUNC(sormtr,SORMTR)(const char *side,
const char *uplo,
const char *trans,
int *m,
int *n,
float *a,
int *lda,
float *tau,
float *c__,
int *ldc,
float *work,
int *lwork,
int *info)
{
int a_dim1, a_offset, c_dim1, c_offset, i__2;
... | ALGO | 0.998208 | 5.156761 |
89e0d778-4bc1-4423-b1ef-a63de7fffd5c | kevinalh/competitive-programming | pucp/vjudge-184008/polish.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
int i, j, n, k;
int h, m;
vector<pair<int,int> > ti, tf;
cin >> n;
ti.reserve(n+1);
tf.reserve(n+1);
for(i = 0; i <... | ALGO | 0.999827 | 3.259911 |
80eb429e-4f8c-4d68-a0f1-e8941138b8c3 | Dekryptor/VlaveLeak_2k03 | utils/vbsp/brushbsp.cpp |
#include "vbsp.h"
int c_nodes;
int c_nonvis;
int c_active_brushes;
// if a brush just barely pokes onto the other side,
// let it slide by without chopping
#define PLANESIDE_EPSILON 0.001
//0.1
void FindBrushInTree (node_t *node, int brushnum)
{
bspbrush_t *b;
if (node->planenum == PLANENUM_LEAF)
{
for (b=... | ALGO | 0.975247 | 4.753371 |
110c64b2-b73b-481c-96f2-e761135d85d8 | deveris256/sf_dynamic_actor_framework | Plugin/src/MorphEvaluationRuleSet.cpp | #include "MorphEvaluationRuleSet.h"
bool daf::MorphEvaluationRuleSet::ParseScript(std::string a_filename, bool a_clearExisting, CollisionBehavior a_behavior)
{
std::ifstream file(a_filename);
if (!file.is_open()) {
logger::error("Failed to open file: {}", a_filename);
return false;
}
// Read json file
nlohma... | TOOL | 0.897794 | 6.83564 |
0c619221-b0ea-42ad-aa2c-4d8d5e074197 | adithya-tp/uva | 11690/sol.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Augment the Union Find data structure with an "amount" vector.
Basically the total amount (owe + owed) in each disjoint set must be zero.
*/
#define pb push_back
#define forn(i, l, r) for(int i = l; i <= r; i++)
#define fornr(i, r, l) for(int i = r; i >= l; i--... | ALGO | 0.99991 | 4.672112 |
1d9b89ce-6efc-4b7c-bbbf-549e3dd33677 | RafaelPanisset/leetcode-solution | easy/169. Majority Element.cpp | //https://leetcode.com/problems/majority-element/
//Time: O(n)
//Space: O(n)
class Solution {
public:
int majorityElement(vector<int>& nums) {
unordered_map<int, int> mp;
for (auto it : nums) {
mp[it]++;
}
int ans = 0, occu = 0;
for (auto it : mp) {
i... | ALGO | 0.999909 | 5.548244 |
6b97015f-2070-4485-9705-9ad6c40e8b5a | ishandutta2007/codeforces | farhod_farmon/normal/915/B.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );
const long long N = 200200;
const long long Q = 5000010;
const long long mod = 1e9 + 7;
const long long block = 500;
using namespace std;
int n, pos, l, r;
void solve()
{
... | ALGO | 0.999946 | 3.443542 |
cebe3f26-2f31-4586-85f8-d324f2c064f2 | Jiheyy/study | 21608.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const int dy[4] = {-1, 0, 0, 1};
const int dx[4] = {0, -1, 1, 0};
struct Student {
int no;
int y, x;
int friends[4];
};
int n, answer;
int arr[21][21];
vector <Student> st;
int count_friend(int std... | ALGO | 0.999648 | 3.744665 |
887eb14e-7891-4e72-994d-f3c80728dd9f | vinjn/chihuahua | 3rdparty/assimp/code/SGSpatialSort.cpp | /** @file Implementation of the helper class to quickly find
vertices close to a given position. Special implementation for
the 3ds loader handling smooth groups correctly */
#include "SGSpatialSort.h"
using namespace Assimp;
// ---------------------------------------------------------------------------------------... | ALGO | 0.999562 | 7.054142 |
0e1c41ff-ba71-4cc0-ab8c-9ccf4836cd40 | teptind/AlgoLabs | Labs/dp/4B.cpp | #include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long
#define ld long double
#define uint unsigned int
#define ull unsigned long long
void print(vector<int> &t) {
for (int i = 0; i < (int)t.size(); ++i)
cout << t[i] << " ";
cout << "\n";
}
void print2(vector<vector<int>... | ALGO | 0.999998 | 3.820965 |
6ca73028-448f-4dba-8d85-f4901c7b493d | Sherry970/cpp-basics | while-loop.cpp | #include<iostream>
using namespace std;
int main()
{
int i=1;
int a=2;
while(i<=10){
cout<<a<<"X"<<i<<" = "<<a*i<<endl;
i=i+1;
}
return 0;
} | ALGO | 0.978928 | 3.469513 |
15807ec8-c17c-4137-a4f6-bdfa30291d6e | liorupam123/LeetCode | 1291-sequential-digits/1291-sequential-digits.cpp | class Solution { // Time and Space: O(1)
public:
vector<int> sequentialDigits(int low, int high) {
vector<int> seqDigitsInRange;
// Create all numbers with sequential digits and compare if they fit the given range
for (int i = 1; i < 9; i++) { // Runs 8 times
int number = i;
... | ALGO | 0.999929 | 6.408214 |
e5dc47b1-3f78-404f-827e-62f00dfacf7b | goodcodedev/shader-things | sdf-shader.cpp | #include "sdf-shader.hpp"
Expression* box3d(Expression *width, Expression *height, Expression *depth, Expression *point) {
return braced(
fcall("length", {
fcall("max", {
*fcall("abs", {point}) - vec3({width, height, depth}),
vec3({floatc(0.0), floatc(0.0), floatc(0.0)})
})
})
);
}
Expression* sph... | TOOL | 0.935761 | 6.148167 |
cebc4bba-5d8f-4e7a-ace9-c67336451928 | akbtech17/dsa | Graphs/2 - Graph Traversals/1_GraphTraversals.cpp | // 1_GraphTraversals.cpp
// Link - https://ide.codingblocks.com/s/657936
// There are two ways of traversing a Graph
// 1 - BFS (Iterative Way)
// 2 - DFS (Recursive Way)
// When KeyNode is closer to the LeafNode,
// we use DFS, it is faster than BFS in this case
// While when the when KeyNode is closer... | ALGO | 0.999914 | 5.068459 |
751f0f44-232f-4d64-8679-0a83f31cd097 | M4573R/competitive-programming-archive | timus/volume-01/gaby_ivanushka.cpp | #include <iostream>
using namespace std;
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned int numbers;
cin >> numbers;
for (unsigned int i {0}; i < numbers; ++i)
{
cout << i << (i < numbers -... | ALGO | 0.998372 | 4.765698 |
db371d2e-85b6-438a-b956-72de81f82002 | codeAbinash/leetcode-solutions | leetcode/problems/cpp/max-consecutive-ones-iii.cpp | // by @codeAbinash
// Time : O(n)
// Space : O(1)
#include "vector"
using namespace std;
class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
int i = 0, j;
for (j = 0; j < nums.size(); ++j) {
if (nums[j] == 0) k--;
if (k < 0 && nums[i++] == 0) k++;
}
return... | ALGO | 0.999786 | 5.9387 |
4ee54b7d-8848-4e0f-aa8c-99a2b65c7d09 | npnkhoi/Competitive-programming | Contests/Winter Contest/WC2.cpp | #include <bits/stdc++.h>
using namespace std;
#define task "WC2"
const long long md = 1e9 + 7;
int tc, n;
vector<long long> primes;
int notPrime[(int) 1e7 + 5];
priority_queue<long long, vector<long long>, greater<long long> > heap;
void sieve() {
for (int i = 2; i <= 1e7; i ++) {
if (!notPrime[i]) {
... | ALGO | 0.999905 | 4.433403 |
6977fbe4-3d58-49a9-84f3-47c66b17e090 | JorgeIba/Competitive-Programming-Problems | Library Checker/Vertex Add Path Sum.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define lli long long int
#define ld long double
#define forn(i,n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define SZ(s) int(s.size())
#define debugg(x) cerr << #x << " = " << x <<... | ALGO | 0.999727 | 4.932902 |
3bc3509e-ba9e-478e-bc2a-a4e2db6d60d2 | mrvau/XPSC | Week-04/C_Grandma_Capa_Knits_a_Scarf.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string s;
cin >> s;
set<char> st;
for(int i = 0; i < n; i++) {
st.insert(s[i]);
}
int ans = INT_MAX;
bool isPali... | ALGO | 0.99958 | 4.636034 |
802fabe9-2966-4e03-8219-5fa5c71a5ba5 | ishandutta2007/codeforces | roundgod/normal/1687/A.cpp | #pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int t,n,k,a[MAXN];
ll sum[MAXN];
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%... | ALGO | 0.999873 | 3.693658 |
d140587e-b2f8-4e76-b77b-a67cc116f053 | barayne/phpdesktop | phpdesktop-chrome-cef2171/random.cpp | // The srand2_mix() function is by Jonathan Wright:
// http://stackoverflow.com/a/323302/623622
// The random() function is by Ryan Reich:
// http://stackoverflow.com/a/6852396/623622
// The code was modified a bit.
// The random() fallback is by Mark B:
// http://stackoverflow.com/a/5009006/623622
#include "random.... | TOOL | 0.9676 | 6.058976 |
27eb7001-0144-4ded-9882-638b7c5e4e1a | rifatbroh/Daily_Update | Weak 1/Day_4/L_Era.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int b = 0;
int c;
for (int i=1; i<=n; i++)
{
cin >> c;
if (c - i > b)
{
b = c - i;
}
... | ALGO | 0.999773 | 3.322048 |
e1587ea8-069e-4bd4-924e-44e626f3595a | JakeUrban/Algorithms | DirectedAcyclicGraphAlgorithms/longestPath.cpp | #include <iostream>
#include "headers/longestPath.h"
#include "headers/topologicalSort.h"
LongestPath::LongestPath(list<int> *l, int v) {
alist = l;
numOfNodes = v;
}
void LongestPath::execute() {
Sorter sorter(alist, numOfNodes);
list<int> tOrder = *(sorter.topologicalSort());
//Creating ... | ALGO | 0.999951 | 3.619673 |
94621f01-3364-4043-8759-205269d81adb | harsh9539/GFG-Cpp | Practise/WindowsSlidingTech.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution{
public:
void WST(int arr[],int n,int k){
int sum = 0;
int maxi = INT_MIN;
for (int i = 0; i < n-k+1; i++)
{
sum = 0;
int m = i;
for (int j = 0; j < k; j++)
{
... | ALGO | 0.999948 | 4.12977 |
3804dcaa-39df-4aea-a77c-eec932452973 | rodrigoAMF/competitive-programming | Contests/Codeforces/div2/573/c.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define PI 3.141592653589793238462643383279502884
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair
#define sz (x) int(x.size())
#define all (x) x.be... | ALGO | 0.99997 | 3.372311 |
147d2d6c-3f1b-4f7c-8d66-2c43a7b4c4fa | Pulakesh5/_DSA_ | January 23/17 Jan/Find the maximum GCD of the siblings of a Binary Tree gfg.cpp | int ans=0;
Node* node=NULL;;
int _maxGCD=0;
int maxGCD( Node* root)
{
//code here
if(!root) return 0;
dfs(root);
return (_maxGCD==0)?0:node->data;
}
int dfs(Node* root)
{
if(!root) return 0;
//(root->left? (root->left->dat... | ALGO | 0.999966 | 4.154776 |
f29a1ad3-dff6-46e9-9d26-f5b0c6c20d3d | Ghar777/PublicWork | Laba2_4b_kurakov/src/fraction.cpp | #include "fraction.h"
#include <iostream>
#include <ostream>
#include <cmath>
using namespace std;
void fraction::print () const
{
cout <<n<<'/'<<d;
}
ostream& operator << (ostream& out, const fraction& a)
{
out << a.n <<'/'<<a.d;
return out;
}
istream& operator >> (is... | ALGO | 0.982431 | 4.256704 |
b34a2a05-c664-45ab-8fdb-172e86a704ea | wuvei/algorithm | Algorithm/cpp/0072.EditDistance/minDistance.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int n1 = word1.size(), n2 = word2.size();
if (n1 == 0) return n2;
else if (n2 == 0) return n1;
vector<vector<int> > dp(n1 + 1, vector<int>(n2 + 1, 0));
for (int i = 0; i <= n1; i++) {
dp[i][0] ... | ALGO | 0.999996 | 5.86796 |
54d59c05-0631-4a1c-a5c0-1f7658a6740b | PlanarG/Code | Codeforces/842E.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 300010;
typedef pair<int, int> P;
struct edge {
int to, next;
} e[N * 2];
int head[N], ecnt;
void adde(int from, int to) {
e[++ecnt] = { to, head[from] }, head[from] = ecnt;
e[++ecnt] = { from, head[to] }, head[to] = ecnt;
}
int dfn[N], dfsn... | ALGO | 0.999629 | 3.806699 |
75b4fa4c-840c-4936-b9be-6d6d31e1bd25 | VinayBhupelli/Striver-Sheet | BINARY TREES/11_diameter_of_binary_tree.cpp | // Code with Vinay
#include<bits/stdc++.h>
using namespace std;
class TreeNode{
public:
int val;
TreeNode *left,*right;
TreeNode(int data){
val=data;
left=right=NULL;
}
};
class Solution {
public:
int diameterOfBinaryTree(TreeNode* root) {
int diam... | ALGO | 0.999977 | 6.812911 |
a6c31215-805d-4582-8c60-802b34d704da | AabidPatel/Modular-Autonomous-Mobile-Robot | laser_filters/src/sector_filter.cpp | #include <math.h>
#include <laser_filters/sector_filter.h>
#include <ros/node_handle.h>
namespace laser_filters
{
LaserScanSectorFilter::LaserScanSectorFilter()
{
}
bool LaserScanSectorFilter::configure()
{
ros::NodeHandle private_nh("~" + getName());
dyn_server_.reset(new dynamic_reconfigure::Server<SectorFilt... | TOOL | 0.880701 | 6.200891 |
e0c035ea-6c1b-4734-b73e-81d6e3cc17ed | Yugg007/-SdeSheetChallenge | Day6/Remove Suplicate from Sorted Array.cpp | #include <bits/stdc++.h>
using namespace std;
int removeDuplicates(vector<int> &arr, int n) {
unordered_set<int>st;
for(int i = 0; i < n; i++){
st.insert(arr[i]);
}
return st.size();
} | ALGO | 0.999343 | 5.216248 |
965794fa-73f3-417a-a9d2-e1ed837fb02b | Aman18111625/LeetCode-Solutions | Zero Sum Subarrays - GFG/zero-sum-subarrays.cpp | //{ Driver Code Starts
//Initial function template for C++
#include<bits/stdc++.h>
using namespace std;
#define ll long long
// } Driver Code Ends
//User function template for C++
class Solution{
public:
//Function to count subarrays with sum equal to 0.
ll findSubarray(vector<ll> arr, int n ) {
... | ALGO | 0.999474 | 6.299253 |
2a77f779-f862-4b6b-a582-d08500ca465f | LLNL/gidiplus | MCGIDI/Src/MCGIDI_domainHash.cpp | #include "MCGIDI.hpp"
namespace MCGIDI {
/*! \class DomainHash
* This class stores the data needed for logarithmic hash look up of a domain. This is used to find a cross section given a projectile's energy.
*/
/* ******************************************************************************************************... | TOOL | 0.940498 | 5.99633 |
2692ec56-618f-4ad5-a998-2153e2ff5d58 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p02574/p02574_num9_parsed.cpp | #include <iostream>
#include <vector>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
// Check pairwise coprime
bool isPairwise... | ALGO | 0.999807 | 5.032609 |
fea678ea-6db6-4d7e-a0ee-07543dc4cec5 | xenial/algorithms | CSES/DT 2022/alkukilpailu/karkit.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
#define sz size
#define rsz resize
void set_io(string filename = "") {
ios::sync_with_stdio(0);
cin.tie(0);
if (filename != "") {
freopen((... | ALGO | 0.999122 | 3.342009 |
905ea466-b357-434c-b407-54f5669a6fa0 | ou3slati/competitive-programming | Codeforces/Contests/Div2/Round634/B.cpp | /*
CF 634B - Construct String
https://codeforces.com/contest/1335/problem/B
Build string with fixed substring frequencies
n,a,b ≤ 1000
Key: Repeat pattern of length a with b chars
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t... | ALGO | 0.999709 | 4.755043 |
e5843f61-6a5d-4dc5-b955-aca3bcf72b05 | amirphl/learning | algorithms/geeks-for-geeks/dynamic-programming/find-minimum-number-of-coins-that-make-a-change.cpp | // https://www.geeksforgeeks.org/find-minimum-number-of-coins-that-make-a-change/
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// time: O(M*V), memory: O(M*V)
int minCoins2(int coins[], int M, int V)
{
int dp[M][V + 1];
... | ALGO | 0.999981 | 5.767694 |
faf7677d-402d-456e-88b7-419e40cdc0bc | asifulamin/CPP-Programs | (STL) Priority_queue.cpp | #include<iostream>
#include<queue>
using namespace std;
int main()
{
priority_queue<int> q;
q.push(5);
q.push(8);
q.push(3);
q.push(10);
cout<<q.top()<<endl<<endl;
while(!q.empty())
{
cout<<q.top()<<endl;
q.pop();
}
cout<<endl;
priority_queue<string> que... | ALGO | 0.997103 | 3.880733 |
9e95c6fb-8040-47da-befa-1ddf57bfa5ec | the-student-of-school-366/ITMO-Algorithms | Lab_6/Lab_7/A_7.cpp | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
vector<string> cod;
cod.push_back("0");
cod.push_back("1");
int j;
for (int i = 2; i < pow(2, n); i=i*2)
{
for (j = i - 1; j >= 0; j--)
{
cod.push_bac... | ALGO | 0.999986 | 3.728773 |
c6897813-c3b1-4a28-a6e4-9813d4c2c912 | salahedine2008/code | fei3dlineartetra.cpp | #include "fei3dlineartetra.h"
#include "flotmtrx.h"
#include "flotarry.h"
#include "geometry_base.h"
#include "stdafx.h"
FloatArray* FEI3dLinearTetrahedra::evalN(Mu::Point* p)
// ****************************************************
// computes the value of shape functions at a given point p
// Result: N=[1-xi-eta-z... | ALGO | 0.998114 | 5.71381 |
d2760816-5211-4c20-b1a4-0d2a82faaf80 | elainafan/PKU_2025_practice-of-programming-in-cpp_HomeWork | 期中 C++部分补充题2/G.cpp | #include <iostream>
using namespace std;
class Singleton
{
private:
int val;
int cnt;
Singleton() : val(0), cnt(0) {};
static Singleton* instance;
public:
void Add(int delta) {
val += delta;
cnt += 1;
}
void Print() {
cout << cnt << " " << val << endl;
}
stat... | ALGO | 0.997107 | 4.27671 |
d3fe508c-5492-4e89-9b21-d6809cb0368a | AhnafTChowdhury/problemSolving | ShafayetBlog/DS/Stacks/balancedParentheses.cpp | // ProblemOJ: HackerRank
// ProblemURL: balanced-parentheses
// ProblemCatagory: Stack
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
while(n--){
string s;
stack<char> st;
cin >> s;
bool legit = true;
for (int i = 0; i < s.size() && legit; ++i){
char ch = s[i];
i... | ALGO | 0.99975 | 5.539708 |
e8a4dd92-3a9a-4aa1-beab-91963b4e1137 | Runhong-Huang/UCLA_Computational_Methods_in_Finance | HW2/HW2/HW2/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <fstream>
using namespace std;
class Calculator {
private:
public:
Calculator(){
};
~Calculator(){};
template <class T>
double average(std::vector<T> arr, int length){
float sum =0;
for (int i ... | ALGO | 0.997974 | 3.451928 |
b36b673e-eec4-4970-b27a-c7f9c4ec6b1d | pritamchaudhary/DSA-Supreme-2.O | Week 3 Arrays, time complexity and space complexity/Arrays/reverseArray.cpp | // reverse an array
#include<iostream>
using namespace std;
void reverseArray(int arr[], int size){
// using for loop
// for(int left=0, right = size-1; left<=right; left++, right--){
// swap(arr[left], arr[right]);
// }
// using while loop
int left = 0;
int right = size-1;
whil... | ALGO | 0.999617 | 5.235262 |
a691ef52-7f3e-4365-8d70-320f2460c1b7 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/WatchingCpl_20210102144603.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999998 | 4.189428 |
e56ea12c-1270-47bc-93a8-29dc2342c90b | Shkiper2012/1.0007rc1 | 3rd party/boost/libs/graph/example/loops_dfs.cpp | using namespace boost;
template < typename OutputIterator >
class back_edge_recorder : public default_dfs_visitor
{
public:
back_edge_recorder(OutputIterator out):m_out(out) { }
template < typename Edge, typename Graph >
void back_edge(Edge e, const Graph &)
{
*m_out++ = e;
}
private:
OutputIterator ... | ALGO | 0.999462 | 6.563425 |
64480fca-60a0-4754-ad08-7d49dc2a8d76 | ccj5351/crowdsourcing | src/main_GT_VM_GP_Generator.cpp | /**
* @file: main_GT_VM_GP_Generator.cpp
* @brief: task assignment graph GTGenerator.
* @author: Changjiang Cai, <EMAIL>
* @version: 0.0.1
* @creation date: 17-12-2015
* @last modified: Thu 10 Mar 2016 09:32:02 AM EST
*/
/* Usage:
***********
* Input:***
***********
* argv[1]: vertexNum, e.g., = "200"
* argv[2]: ... | ALGO | 0.956999 | 5.246372 |
cc6c87be-9245-472a-9b40-740b36c10faf | Shubham05178/LeetcodeProblems | medium/Sort List.cpp | /**
* Leetcode Problem - https://leetcode.com/problems/sort-list/
* Author - Shubham Nagaria
* Date - 30th Jan 2022
**/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ... | ALGO | 0.999977 | 5.811229 |
823cb42f-231d-4a73-a02a-aaa94cc32757 | lighthouseQC/frameworks_av | media/codecs/mp3dec/src/pvmp3_dct_16.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_dct_16.cpp
Functions:
dct_16
pv_merge_in_place_N32
pv_split
Date: 09/21/2007
-------------------------------------------------------------------------... | ALGO | 0.998598 | 4.861203 |
e1061684-dfdc-4c3c-b5d0-907dcee426cf | alexpizarroj/competitive-programming | src/hacker-rank/kundu-and-tree.cpp | /*
** UNNECESSARILY COMPLEX SOLUTION BELOW
** Proceed with care. :D
*/
#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
// ---
vector<vii> g;
long long ans;
vi cnt;
vi reds, reds_x;
vi red_paths_cnt, red_paths_cnt_x... | ALGO | 0.999442 | 4.814396 |
6c94e29a-bdb6-4de5-b9d5-03cb56143970 | sarvex/leetcode-racket | solution/1700-1799/1750.Minimum Length of String After Deleting Similar Ends/Solution.cpp | class Solution {
public:
int minimumLength(string s) {
int i = 0, j = s.size() - 1;
while (i < j && s[i] == s[j]) {
while (i + 1 < j && s[i] == s[i + 1]) {
++i;
}
while (i < j - 1 && s[j] == s[j - 1]) {
--j;
}
... | ALGO | 0.999992 | 6.164279 |
d3462048-ed21-4516-a475-a45bacad1802 | Coder-Vippro/Code | Archived/BTVN/QUYHOACHDONG/Bai1.cpp | #include <bits/stdc++.h>
using namespace std;
int A[10001];
int n;
int L[10001];
int main()
{
cin>>n;
int dem;
for(int i=1;i<=n;i++)cin>>A[i];
vector<int> A(n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<i;j++)
{
if(A[i]>A[j])
L[i]=max(L[i],L[j]+1);
}
... | ALGO | 0.999945 | 3.69238 |
3836f84b-f4c8-4705-95d4-adc66afe0958 | yanbcxf/cpp | MyToolKit/NumericalRecipes/examples/xttest.cpp | #include <iostream>
#include <iomanip>
#include "nr.h"
using namespace std;
// Driver for routine ttest
int main(void)
{
const int NPTS=1024,MPTS=512,NSHFT=10;
const DP EPS=0.02;
int i,j,idum=(-5);
DP prob,t;
Vec_DP data1(NPTS),data2(MPTS);
// Generate gaussian distrib... | TEST | 0.964582 | 4.523441 |
7383a3d2-fb42-4e2e-b0e1-14369067f07b | anshmishra010/DSA-OOP-in-CPP | Sorting algorithm/quicksort.cpp | #include<iostream>
using namespace std;
int part(int arr[],int s ,int e)
{
int pivot=arr[e];
int pindex= s;
for(int i=s;i<e;i++)
{
if(arr[i]<pivot)
{
int temp=arr[i];
arr[i]=arr[pindex];
arr[pindex]=temp;
pindex++;
}
}
int temp =arr[e];
arr[e]=arr[pindex];
arr[pindex]=temp;
return pindex;
}
v... | ALGO | 0.99997 | 4.470692 |
f818a01d-10ce-44a1-9c2f-d356d141d14e | ishandutta2007/codeforces | ania/normal/118/A.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define err(...) fprintf(stderr, __VA_ARGS__)
typedef pair<int,int> pi;
typedef long long int64;
typedef vector<int> vi;
#define fore(i,n) for(int i = 0; i < (n); i++)
#define tr(i,c) for(typeof((c).begin()) i = (c).begin(); i != (c).end()... | ALGO | 0.999 | 3.579378 |
e7b70b0e-1be4-45ea-bcf8-683723648f3e | yutzuhsuan/problem-solving | UVa/10098 - Generating Fast.cpp | #include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;
int main(void)
{
int n;
string s;
scanf("%d\n", &n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
do {
cout << s << endl;
} while(next_permutation(s.begin(), s.end()));
puts("");
... | ALGO | 0.99991 | 4.319377 |
24ab18c9-0fd4-4b84-966a-2067889acfe5 | Tishasoumya-02/Fork-CPP | gradethestell.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int hardness,tensile,T,grade;
float carbon;
cin>>T;
while(T--)
{
cin>>hardness;
cin>>carbon;
cin>>tensile;
if(hardness>50&&carbon<0.7&&tensile>5600)
grade=10;
else if(hardness>50&&carbon<0.7&&tensile<=5600)
grade=9;
else if(hardness<=50&&... | ALGO | 0.994771 | 3.643061 |
9549534d-0f4d-45d7-bfb1-080c451d3a0b | ozzing/boj | codeplus/17425_약수의 합.cpp | #include <iostream>
using namespace std;
#define MAX 1000001
long long dp[MAX];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
long long sum=0;
int t, n;
cin >> t;
for(int i=1;i<MAX;i++){
for(int j=i;j<MAX;j+=i){
dp[j]+=i;
}
}
... | ALGO | 0.999871 | 3.547609 |
e6f9e69f-0348-493a-ad77-5dd51f96be54 | jungahshin/algorithm | c:c++/LeetCode_39.cpp | class Solution {
public:
vector<vector<int>> ans;
void dfs(int sum, vector<int>& v, vector<int>& candidates, int target, int start){
if(sum>target){
return;
}
if(sum==target){
ans.push_back(v);
return;
}
for(int i=start; i<candidat... | ALGO | 0.999997 | 6.6645 |
94f822a2-b46e-4393-a3a9-d083d9f993b2 | hfhongzy/CodeForOI | zroi-1508.cpp | #include <bits/stdc++.h>
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
int n, k, d, p[N], f[N], g[N], tot[N];
vector<int> G[N], cnt[N];
void dfs(int u, int fa = 0) {
p[u] = fa;
for(int v : G[u]... | ALGO | 0.999866 | 4.309244 |
45e0b45d-bd7e-402b-ba73-ff9190d46787 | yqw1212/fuzztruction-llvm17.0.6 | libc/src/math/generic/sincosf.cpp | #include "src/math/sincosf.h"
#include "sincosf_utils.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/common.h"
#include "src/__support/macros/optimization.h" ... | ALGO | 0.997085 | 7.557365 |
43ea1a9e-e269-451d-959f-abcef6d652ec | Bungmint/competitiveprogramming | contest/cses/2138.cpp | using namespace std;
#pragma region TEMPLATE
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename... | ALGO | 0.999958 | 5.135633 |
6e1cd852-f67d-4c3c-9780-f53adabbb329 | ishandutta2007/codeforces | shayan.p/normal/813/D.cpp | // Can U hack it?
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=5010,MAX=1e5+10;
int dp[maxn][maxn],a[maxn];
v... | ALGO | 0.999798 | 3.324379 |
f028a84b-7081-4d10-8728-4ec8bfce6147 | bishakhne0gi/6Companies30Days | Intuit/KSwaps.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
void helper(string &max, string str, int k, int idx)
{
if (k == 0)
{
return;
}
int n = str.length();
char maxc = str[idx];
for (int i = idx + 1; i < n; i++)
{
... | ALGO | 0.999975 | 6.0897 |
a51042fa-7f96-4220-9c44-cafa2ce2494f | krgoodnews/Algorithm | CppAlgorithm/CppAlgorithm/main.cpp | //
//#include <iostream>
//#include <string>
//
//using namespace std;
//
//string makeAbbreviation(string str) {
// if (str.size() <= 10) {
// return str;
// }
//
// string result;
//
// result.push_back(str.front());
// int size = str.size();
// string strSize = to_string(size - 2);
// result += strSize;
//... | ALGO | 0.995959 | 4.495297 |
ec49fe4d-4f81-453e-a02a-f65b09225082 | NigelNelson/GPU_Programming | Cuda_NN/third_party/eigen/bench/benchEigenSolver.cpp |
// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver
// options:
// -DBENCH_GMM
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/QR>
#in... | TOOL | 0.987632 | 5.772194 |
4a5868d0-dbdb-40f1-a149-b270148af8cc | buptrh/leetcode | Round1/769. Max Chunks To Make Sorted (ver. 1).cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
map<int, vector<int>> table;
for(int i = 0; i < arr.size(); i++) {
table[arr[i]].push_back(i);
}
vector<int> newarr = arr;
sort(newarr.begin(), newarr.end());
int cur = -1;
stack<int> res;
for(int i = 0;... | ALGO | 0.999998 | 5.318325 |
d6380b82-54f1-48fd-a93e-b20151d1d8a9 | cjl3230/SOUI2.backup | third-part/skia/src/pathops/SkPathOpsQuad.cpp | #include "SkIntersections.h"
#include "SkLineParameters.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsQuad.h"
#include "SkPathOpsTriangle.h"
// from http://blog.gludion.com/2009/08/distance-to-quadratic-bezier-curve.html
// (currently only used by testing)
double SkDQuad::nearestT(const SkDPoint& pt) const {
S... | ALGO | 0.998897 | 4.883949 |
acd0d376-c77a-43ea-810c-f0470787419b | AbdulMoeez060/Labwork | PF2 Lab 2/2.Join 2 strings .cpp | #include<iostream>
using namespace std;
int main()
{
const int size = 20;
char fname[size];
char lname[size];
char fullname[size];
cout << "Enter your First Name :";
cin >> fname;
cout << "Enter your Last Name :";
cin >> lname;
int i;
for (i = 0; fname[i] != '\0' ; i++)
{
fullname[i] = fname[i];
}
fulln... | TOOL | 0.936999 | 3.5955 |
c30280c5-8b2b-4d60-bc9e-2c1ad0c70c7d | mtabishk/DataStructuresAlgorithms-Cpp | dsa/linked_list/mid_point_ll.cpp | #include <iostream>
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
using namespace std;
Node *takeinput()
{
int data;
cin >> data;
Node *head = NULL, *tail = NULL;
while (data != -1)
{
Node *newnode = new Node(data);
if (head == NULL)
{
h... | ALGO | 0.999952 | 4.443488 |
dbdb14bc-9ce0-4d3e-92dc-fbee5c6abf4d | JSeungBeom/Data-structure | personal practice/personal practice/queue3.cpp | #include <iostream>
using namespace std;
class Queue {
private:
int* arr;
int capacity;
int frontidx;
int rearidx;
int n;
public:
Queue(int capacity) {
this->capacity = capacity;
arr = new int[capacity];
frontidx = rearidx = n = 0;
}
int size() {
return n;
}
bool empty() {
return (n == 0);
}
... | ALGO | 0.997094 | 5.077511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.