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 |
|---|---|---|---|---|---|---|---|
ff7c2c95-31b8-4e8d-afd4-4200779b0ed3 | yiouejv/algorithm_travel | double_pointer/206.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* reverseList... | ALGO | 0.999266 | 5.815105 | {
"github_metadata": {
"branch": "main",
"commit_count": 115,
"repo_created_at": "2021-09-04T23:50: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": "81701c1e4c... |
f63d996e-36b5-4ba8-911f-dd4b50d50ed9 | Tashdidtrdb/Competitive-Programming | Code Library/Dp/group same color.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
#define PI 2*acos(0.0)
#define eps 1e-11
#define DEBUG(x... | ALGO | 0.999954 | 3.108 | {
"github_metadata": {
"branch": "master",
"commit_count": 50,
"repo_created_at": "2020-05-28T21:21:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "53ea39a7d... |
0c72be4a-5a39-48fc-8efe-c7b29b120e3b | leostd/Competitive-Programming | Codeforces/Rounds/Round426/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
//freopen("in", "r", stdin);
char dir[4]={'^', 'v', '<', '>'}, s, e;
bool fcw, fccw;
fcw = fccw = false;
map<char, int> ccw, cs;
ccw['^'] = 0;
ccw['<'] = 1;
ccw['v'] = 2;
ccw['>'] = 3;
cs['^'] = 0;
cs['>'] = 1;
c... | ALGO | 0.999997 | 3.8424 | {
"github_metadata": {
"branch": "master",
"commit_count": 122,
"repo_created_at": "2017-04-09T05:24:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c76963e4... |
7ea44b58-3380-4efa-b9e1-e5894fac8600 | dabralhd/algo_design | cpp/hackerrun_30daysofcode_challenge/day_6_logic.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
//#include <string>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int T = 0;
vector<string> str;
cin >> T;
str.resize(T);
// after ... | ALGO | 0.99993 | 3.906519 | {
"github_metadata": {
"branch": "master",
"commit_count": 48,
"repo_created_at": "2021-12-06T08:38: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": "19095379d... |
7c04682c-9e5c-4c8a-a26d-32380a8b1f4b | lunlun1992/LeetCode | 93. Restore IP Addresses.cpp | //DFS,对0要做特殊处理。
class Solution {
public:
void dfs(string s, string cur, int isegs, int curpos)
{
if(isegs == 0) {
if(s.size() == curpos)
ret.push_back(cur);
return;
}
if(curpos >= s.size())
return;
string bak = cur;
... | ALGO | 0.999852 | 4.913846 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2017-01-16T12:43:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "908e38f0b... |
6455ee51-3aeb-4d7d-a195-9bde481e31a5 | fenil3357/Leetcode | 1091-shortest-path-in-binary-matrix/1091-shortest-path-in-binary-matrix.cpp | class Solution {
public:
vector<int> x_points = {-1,-1,-1,0,0,1,1,1};
vector<int> y_points = {-1,0,1,-1,1,-1,0,1};
bool isValid(int x, int y, int n, int m) {
return x>=0 && x<=n && y>=0 && y<=m;
}
int shortestPathBinaryMatrix(vector<vector<int>>& grid) {
int n = grid.size()-1;
... | ALGO | 0.999997 | 5.718511 | {
"github_metadata": {
"branch": "main",
"commit_count": 912,
"repo_created_at": "2021-12-24T11:05:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d97cb1d400... |
ef22ea9a-b45a-46ba-851a-e937ac5495e0 | hoangtien2k3/Data-Structure-And-Algorithm | Search/Binary_Search/test.cpp |
/*
Cho một dãy gồm n số nguyên và một số nguyên x.
Hãy đếm xem trong dãy có bao nhiêu phần tử có giá trị x.
*/
#include<bits/stdc++.h>
using namespace std;
int count(int *arr, int l, int r, int x) {
if (l == r) {
if (arr[l] == x || arr[r] == x) {
return 1;
} else return ... | ALGO | 0.999941 | 5.084857 | {
"github_metadata": {
"branch": "main",
"commit_count": 144,
"repo_created_at": "2023-01-16T09:44:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 3
},
"file_meta": {
"content_id": "7a9bfa13fe... |
dc7c7daf-293c-4174-976f-bd67428ce796 | project-chip/connectedhomeip | scripts/py_matter_idl/matter/idl/tests/outputs/large_all_clusters_app/cpp-app/static-cluster-config/WiFiNetworkDiagnostics.h | // DO NOT EDIT - Generated file
//
// Application configuration for WiFiNetworkDiagnostics based on EMBER configuration
// from inputs/large_all_clusters_app.matter
#pragma once
#include <app/util/cluster-config.h>
#include <clusters/WiFiNetworkDiagnostics/AttributeIds.h>
#include <clusters/WiFiNetworkDiagnostics/Comm... | CONFIG | 0.929158 | 7.117115 | {
"github_metadata": {
"branch": "master",
"commit_count": 19981,
"repo_created_at": "2020-03-03T17:05:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 8072,
"forks": 2209,
"issues": 1971,
"pull_requests": 358
},
"file_meta": {
"content_id... |
cc93d6ae-3d33-4a71-bb6f-ebc03ec8921a | ichiro-its/keisan | include/keisan/number.impl.hpp | // Copyright (c) 2021 ICHIRO ITS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, di... | TOOL | 0.932143 | 7.366264 | {
"github_metadata": {
"branch": "master",
"commit_count": 235,
"repo_created_at": "2021-04-15T05:28:38.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 8,
"pull_requests": 7
},
"file_meta": {
"content_id": "1095fd7f0... |
406bcc84-92bf-4999-ac0d-500ca1ef13ec | filippkowalski/mygimp-imageprocessing-project | src/core/transformations/edge_gradient.cpp | #include "edge_gradient.h"
EdgeGradient::EdgeGradient(PNM* img, ImageViewer* iv) :
Convolution(img, iv)
{
}
EdgeGradient::EdgeGradient(PNM* img) :
Convolution(img)
{
}
PNM* EdgeGradient::verticalDetection()
{
return convolute(g_y, RepeatEdge);
}
PNM* EdgeGradient::horizontalDetection()
{
return conv... | ALGO | 0.940002 | 4.94311 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2015-10-30T12:12:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6ff7ae49cc... |
101a2c48-4112-4d5e-bb51-caf2148f2f11 | Hunterdii/GeeksforGeeks-POTD | August 2024 GFG SOLUTION/August-25.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
long long countPairs(vector<int>& arr, vector<int>& brr) {
int N = brr.size();
vector<int> NoOfY(5, 0);
for (int i = 0; i < N; i++) {
if (brr[i] < 5) NoOfY[brr[i... | ALGO | 0.999888 | 6.187445 | {
"github_metadata": {
"branch": "main",
"commit_count": 3732,
"repo_created_at": "2024-03-09T09:48:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 202,
"forks": 54,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7483f8... |
bb34a684-5a33-4209-a4e9-bdd0a317f6e6 | yenthanh132/Codes | Codeforces/CF 273/E.cpp |
#include <bits/stdc++.h>
#define pb push_back
#define sqr(x) (x)*(x)
#define sz(a) int(a.size())
#define reset(a,b) memset(a,b,sizeof(a))
#define oo 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const ll maxv=100000000000000ll;
int d[20],cnt;
bool check(ll v){
if(v<100) retur... | ALGO | 0.999739 | 3.72575 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2015-11-24T09:41:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a1dcf2603... |
8a8cf7e6-d4af-4c14-af91-f6ee4d0251ca | deselaers/fire-cbir | Retriever/imagecomparator.cpp | /*
This file is part of the FIRE -- Flexible Image Retrieval System
FIRE is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FIRE is distribu... | ALGO | 0.946722 | 5.228878 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2015-04-05T09:25:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 31,
"forks": 12,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "1d0d2b85... |
5695f98a-90a2-4ac5-a5b2-24d8b812f0b1 | Vincent550102/Competitive-Programming-Warehouse | codeforce/Codeforces Round #693 (Div. 3)/pD.cpp | #pragma GCC optimize("O3,unroll-loops")
#pragma loop_opt(on)
#include<bits/stdc++.h>
#define io_op ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
using pii = pair<int,int>;
using piii = pair<int,pii>;
using ll = long long;
//#define int ll
#define F first
#define S second
#define All(x) x.begin(),x.end()... | ALGO | 0.999975 | 4.499404 | {
"github_metadata": {
"branch": "master",
"commit_count": 38,
"repo_created_at": "2020-11-14T16:25:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "993a6f227... |
6a02bf94-8efe-4b82-942c-36b5da6ab54a | Shikhar-S/Analysis-of-Competitive-Codebase | Data/Contest1244/all/28934731_62469979.cpp | /// <NAME> 2019
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB emplace_back
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int,int>;
using pll = pair<ll,ll>... | ALGO | 0.999919 | 3.815037 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2019-11-22T14:40: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": "6fbff97b4... |
d45e3132-7e9c-4b1a-9e88-4a0b2459b01c | Lotuses-robot/Codes | Exercise/Hydro/P1003/P1003.cpp | // Copyright 2023 Lotuses
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#define gc getchar()
template<typename T>
void read(T &r) {
r = 0; static char ch, last;
ch = gc, last = 'z';
while (ch < '0' || ch > '9') last = ch, ch = gc;
while (ch >= '0' && ch <= '9') r = (r << 1)... | ALGO | 0.995144 | 4.427197 | {
"github_metadata": {
"branch": "main",
"commit_count": 108,
"repo_created_at": "2022-11-08T05:50:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9738504598... |
1b193909-e05b-4885-aa24-fcea92412253 | jsh15932/BOJ_Solve | 5972.cpp | #include<bits/stdc++.h>
using namespace std;
#define INF 1e9
int n, m;
int arr[50001];
vector< pair<int, int> > vc[50001];
priority_queue< pair<int, int>, vector< pair<int, int> >, greater< pair<int, int> > > pq;
int main() {
cin >> n >> m;
for(int i = 1; i <= n; i++) {
arr[i] = INF;
}
for(int i = 0; i ... | ALGO | 0.999965 | 3.656001 | {
"github_metadata": {
"branch": "master",
"commit_count": 274,
"repo_created_at": "2020-04-06T17:06: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": "6487b2c3... |
fee8f746-25b2-40ea-8ca5-87482fb731d4 | AMReX-Microelectronics/artemis | Source/Particles/ElementaryProcess/QEDInternals/SchwingerProcessWrapper.H | /* Copyright 2020 <NAME>, <NAME>
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#ifndef WARPX_schwinger_process_wrapper_h_
#define WARPX_schwinger_process_wrapper_h_
#include "QedWrapperCommons.H"
#include <AMReX_Random.H>
#include <picsar_qed/physics/schwinger/schwinger_pair_engine_core.hpp... | ALGO | 0.997004 | 7.279735 | {
"github_metadata": {
"branch": "development",
"commit_count": 8653,
"repo_created_at": "2021-03-22T20:57:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 20,
"forks": 16,
"issues": 9,
"pull_requests": 4
},
"file_meta": {
"content_id": "5... |
64e88b69-63de-45b5-a461-e9cea5d173ca | liuq901/code | LOJ/l_1114.cpp | #include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;
struct trie
{
int cnt,son[52];
};
trie a[100010];
char buf[1000000];
int m;
void clear(int x)
{
a[x].cnt=0;
memset(a[x].son,0,sizeof(a[x].son));
}
int get(char ch)
{
if (isupper(ch))
return(ch-'A');... | ALGO | 0.999606 | 3.461882 | {
"github_metadata": {
"branch": "master",
"commit_count": 108,
"repo_created_at": "2013-09-18T08:58:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4044e6c6... |
4b8e7179-069d-4c7a-8856-de3c123bb262 | KavyaSriChennoju/graphs | eulers path 2.cpp | #include<iostream>
using namespace std;
struct graph
{
char data;
int in;
};
struct node
{
char ch;
node *next;
};
node *t=NULL,*s=NULL;int e1=0;node *ptr;
void addend(node *&l,char k)
{
while(l->next!=NULL)
{
l=l->next;
}
l->next=new(node);
l->next->ch=k;
l->next->next=NULL;}
int h=0,n5;
void... | ALGO | 0.999901 | 3.466508 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-03-26T17:36: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": "e19cca1d33... |
0fe8d080-fab9-4bce-9531-6b461c06f452 | MaxBayne/Embedded-AVR | Projects/AVRTutorials/include/DataStructures/LinkedList.h | #ifndef LINKEDLIST_H_
#define LINKEDLIST_H_
/*
* ################### Information #################
* Define Nodes
* Dynamic List
* Dynamic Types
* its more power full than array but array is the fastest way
* easy insert , remove nodes from list
* Traversing
* Searching
* Sorting
* Merging
*/
#include <stdlib.h>
na... | ALGO | 0.993088 | 4.577781 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2022-11-04T15:53: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": "2efc39549e3... |
4ce58924-bc0f-4487-9a7d-6a571a3b34be | samuelloza/notas_uni | Programacion Competitiva/campamento_roy/Camp UMSA/Dia 2/Contest/P1-871.cpp | #include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
vector <string> grid;
bool visited[25][25];
int calc(int a, int b)
{
visited[a][b]=true;
int n=1;
for(int i=-1; i<=1; ... | ALGO | 0.998976 | 3.896595 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2020-04-19T17:04:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bb6a2a2914... |
1598fc8d-cbec-4bfd-bf6a-6369d8972e2a | vrajarampandian/Leetcode_Interview_150q | Array_String/Merge_sorted_array.cpp |
#include<iostream>
#include<vector>
using namespace std;
class solution
{
public:
void merge(vector<int> &nums1, int m, vector<int> &nums2, int n)
{
int i = m - 1;
int j = n - 1;
int k = m + n - 1;
while( i >= 0 && j >= 0)
{
if (nums1[i] > nums2[j])
... | ALGO | 0.999989 | 5.438891 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2025-04-20T05:13: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": "a293775169... |
feef0748-bf9d-49ef-a862-bdd987213b81 | arvin-ferrer/codeforces | GreedyGrid.cpp | /*
Created by: acferrer
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <ll> vll;
typedef vector<int> vi;
typedef unordered_map<int, int> u_map;
typedef unordered_map<ll, ll> ll_map;
void solve(){
int n, m;
cin >> n >> m;
if (n == 1 || m == 1)
cout << "NO\n";
else ... | ALGO | 0.999945 | 4.345935 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2025-06-22T10:01:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ce517c1fdd3... |
500c2974-cf7a-412f-b0e8-899269a87471 | pdeitel/CPlusPlus20ForProgrammers | examples/ch20/fig20_08.cpp | // fig20_08.cpp
// Demonstrate shared_ptrs.
#include <algorithm>
#include <fmt/format.h>
#include <iostream>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
// class Book
class Book {
public:
explicit Book(std::string_view bookTitle) : title{bookTitle} {}
~Book() { std::cout << fmt::... | ALGO | 0.998591 | 6.821627 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2020-04-17T17:53:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 220,
"forks": 104,
"issues": 4,
"pull_requests": 1
},
"file_meta": {
"content_id": "852f5... |
66e6dbd4-8720-412f-aea5-25b58b260996 | AlaminPu1007/leet-code | Leet-Code/205. Surrounded Regions/130_Surrounded_Regions.cpp |
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
void solve(vector<vector<char>> &board)
{
int n = board.size(), m = board[0].size();
// initially an visited array
vector<vector<int>> vis(n, vector<int>(m, 0));
// initialize an queue
queue<pair<int... | ALGO | 0.999954 | 5.489001 | {
"github_metadata": {
"branch": "master",
"commit_count": 1102,
"repo_created_at": "2022-06-13T15:42:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d47b3d6... |
9dfbffb2-4b89-48e8-9ecb-e7a83f695f42 | ArmyAntSEC/rhex_code | PID.h | #ifndef PID_v1_h
#define PID_v1_h
#define LIBRARY_VERSION 1.2.1
class PID
{
public:
//Constants used in some of the functions below
#define AUTOMATIC 1
#define MANUAL 0
#define DIRECT 0
#define REVERSE 1
#define P_ON_M 0
#define P_ON_E 1
//commonly used functions *******************************... | ALGO | 0.972453 | 5.560545 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2019-11-28T21:08:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd44fbd66... |
5cd1d98d-dcd0-4412-ac04-0de0c25d9981 | Nagisa12321/leetcod_cpp | algorithm/solve306.cpp | #include "leetcode.h"
using namespace std;
class Solution {
public:
bool isAdditiveNumber(string num) {
return helper(num, "", "", 0);
}
bool helper(const string &num, const string &first, const string &second, int numbers) {
if (num.empty()) {
if (numbers < 3)
... | ALGO | 0.999792 | 6.069384 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-01-22T03:13: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": "8ccff8c3d4... |
dbbf3641-a0a3-433d-a47b-8b49837bba61 | Girl-Code-It/Beginner-CPP-Submissions | Shubham/milestone_12/multiplication.cpp | #include<cstdlib>
#include<iostream>
#define SIZE 2
using namespace std;
int main()
{
//proram to multiply two matrices
int A[SIZE][SIZE];
int B[SIZE][SIZE];
int C[SIZE][SIZE];
int row, col, i, sum;
cout << "Enter elements in matrix A of size " << SIZE << "x" << SIZE << endl;
for(row... | ALGO | 0.997577 | 4.186975 | {
"github_metadata": {
"branch": "master",
"commit_count": 557,
"repo_created_at": "2020-05-14T05:39:40.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 32,
"forks": 83,
"issues": 2,
"pull_requests": 7
},
"file_meta": {
"content_id": "de51ff1... |
174fc946-9d7b-4a15-830b-f0c517d72f49 | sarahjh4528/cpp_exercise | leetcode2024/p201_p250/p207_courseSchedule/main.cpp | #include<bits/stdc++.h>
#include<iostream>
#include<queue>
using namespace std;
class Solution {
public:
void printVec(vector<int>& v) {
for (auto i : v)
cout << i << " ";
cout << endl;
}
/*
Runtime 10 ms Beats 30.18%
Memory 20.46 MB Beats 17.46
Same design as fastest solution
*/... | ALGO | 0.999814 | 5.962352 | {
"github_metadata": {
"branch": "master",
"commit_count": 261,
"repo_created_at": "2018-11-17T04:36:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b5aba116... |
e1f6aa4c-25a9-4e4b-900c-5b4a0380c8be | zizhong/algorithm-training | lc/LineMergerWithDotUpdator.cpp | // https://leetcode.com/problems/subarray-with-elements-greater-than-varying-threshold/
struct LineMerger {
public:
vector<int> e;
int max_len = 0;
LineMerger(int n) : e(n, -1) {
}
void remove(int x) {
if (e[x] == -1) return;
int te = e[x];
e[x] = e[te] = -1;
}
void ... | ALGO | 0.999964 | 5.726363 | {
"github_metadata": {
"branch": "master",
"commit_count": 265,
"repo_created_at": "2015-11-23T13:36: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": "be5be9e8... |
27df4c47-396c-40e8-a3dd-db14e9106237 | Mahendra67/Data-Structures-and-Algorithms | Linked List/LL_cycle_2.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
/*------------------------------------------------------------------------------------------------------------------... | ALGO | 0.999935 | 5.285915 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2022-12-18T13:08:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "703d24083... |
2426c412-b3d2-434d-b315-059bfd58cf5e | rohandagale28/DSA-CPP | SortingAlgorithms/SelectionSort/selectionRecursive.cpp | #include <iostream>
using namespace std;
int minIndex(int *arr, int size, int start)
{
int minIndex = start;
for (int i = start + 1; i < size; i++)
{
if (arr[i] < arr[minIndex])
{
minIndex = i;
}
}
return minIndex;
}
void selectionSort(int *arr, int size, int st... | ALGO | 0.999991 | 5.696908 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-08-30T12:42:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f710100adc9... |
170a2d2f-63fd-4422-91ae-6822e3a69c32 | how340/optimized-LSM-Tree | buffer_level.h | // This class implements the basic componenet in each level of the LSM Tree.
// Each tier of the lsm tree will have 1 or more level.
#pragma once
#ifndef BUFFER_H
#define BUFFER_H
#include <math.h>
// #include <bits/stdc++.h>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <unordered_map>
#includ... | TOOL | 0.917059 | 3.434259 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2024-02-16T17: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": "fb9e91e89ed... |
d54eb95a-c8ad-47ae-8bbc-fd9c5daaaab0 | hellojaewon/study | algorithms/leetcode/125_valid_palindrome/valid_palindrome.cpp | #include <iostream>
#include <vector>
#include <cassert>
using namespace std;
bool alphanumeric (char c) {
return (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
}
bool isPalindrome(string s) {
int left = 0;
int right = s.size() - 1;
int result = true;
for (int i = 0 ; i < s.size(); i++)
... | ALGO | 0.996686 | 4.24514 | {
"github_metadata": {
"branch": "master",
"commit_count": 174,
"repo_created_at": "2013-10-08T05:13:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b191e44c... |
d78f931c-f294-4a63-8ed4-010b615b85ba | Jitisha-khede/leetcode | Linked List/Easy/160_intersection_of_two_linked_list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
//BRUTE FORCE
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode *ptrA = headA;
ListNode *p... | ALGO | 0.999907 | 5.215195 | {
"github_metadata": {
"branch": "main",
"commit_count": 190,
"repo_created_at": "2024-06-23T05:55: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": "3f3d9b61f5... |
1c429814-7e36-4036-950f-3c0107ab4261 | davtrinh/343 | bintree.h | //----------------------------------------------------------------------------
// By: <NAME>
//
// BinTree.h
// Description: BinTree header, contains the methods for BinTree.cpp
// to include. This homework has a memory leak in the bstreeToArray method
// and was not able to be fixed in time.
//
// Assumptions: Lines ... | ALGO | 0.988754 | 4.149345 | {
"github_metadata": {
"branch": "lab2",
"commit_count": 2,
"repo_created_at": "2014-11-16T09:04:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2ead6d4f917f... |
d2cdcf09-83b7-43c0-a8af-d479d5c8732c | ishandutta2007/codeforces-y | yaobig/normal/1080/D.cpp | #include "bits/stdc++.h"
#define rep(i,a,n) for(auto i=a;i<=n;i++)
#define per(i,a,n) for(auto i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define all(A) A.begin(),A.end()
#define sz(A) (int)A.size()
template<class T> bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} ... | ALGO | 0.999762 | 4.033486 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:40: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": "2c36b43247d6... |
0b29ea52-9a9b-49a9-acd1-049f313fa0a1 | StoicGang/Problem_Solving | 0_LeetCode Problems/1800.cpp |
/*
Title: 1800. Maximum Ascending Subarray Sum
Problem:
Given an array of positive integers nums, return the maximum possible sum of a strictly increasing subarray in nums.
A subarray is defined as a contiguous sequence of numbers in an array.
Input:
- vector<int> nums: An array of positive integers.
Output:... | ALGO | 0.999997 | 6.883503 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2025-01-01T05:59: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": "cefae720e9b... |
14715a63-cad2-4590-8c96-110094094265 | anshul-singhrajput/random | Arrays/UniqueArrayValue.cpp | #include <iostream>
using namespace std;
void printUniqueValues(int arr[], int size)
{
cout << "Unique values in the array are: " << endl;
for (int i = 0; i < size; i++)
{
bool isUnique = true;
// Check if the current element is unique
for (int j = 0; j < size; j++)
{
... | ALGO | 0.998891 | 5.785168 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-01-27T03:24:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a7dcc8909669... |
f65039f6-4b51-418d-b472-da076b321686 | jk-jung/problem-solving | codeforces/Events/Global Round/Global_Round_20_E.cpp | #include <string.h>
#include <stdio.h>
#include <math.h>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vecto... | ALGO | 0.999801 | 3.160193 | {
"github_metadata": {
"branch": "main",
"commit_count": 1582,
"repo_created_at": "2021-06-24T13:40:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "608efbecc... |
6ea2aaf6-bb36-4aeb-b578-f25b69e91ef3 | ishandutta2007/codeforces-v | vercingetorix/normal/333/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999295 | 3.761417 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:31:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b6a2964c9840... |
1bceb46b-1a2e-4ee6-a737-049991eb11b4 | arnavjaiswal2803/DSA | 0450-delete-node-in-a-bst/0450-delete-node-in-a-bst.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.999992 | 6.15231 | {
"github_metadata": {
"branch": "main",
"commit_count": 1732,
"repo_created_at": "2024-09-11T06:38: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": "078c16b0a... |
0b3a54a9-cf47-4df1-9fe6-6c2f3d817fd7 | debog/hypar | src/PETScFunctions/PetscJacobianMatNonzeroEntriesImpl.cpp | /*! @file PetscJacobianMatNonzeroEntriesImpl.cpp
@brief Contains the function to set nonzero entries of the Jacobian matrix
@author <NAME>
*/
#ifdef with_petsc
#include <stdio.h>
#include <vector>
#include <arrayfunctions.h>
#include <simulation_object.h>
#include <mpivars_cpp.h>
#include <petscinterface.h>
... | ALGO | 0.998051 | 5.424757 | {
"github_metadata": {
"branch": "master",
"commit_count": 1451,
"repo_created_at": "2024-04-02T19:47:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d03828f... |
7674aa2c-895d-4a3f-b9a9-4a5265a19fde | Rishi-11-2/CSES | Sliding_Window_Cost.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define debug(x...) { cout << "(" << #x << ")" << " = ( "; PRINT(x); }
tem... | ALGO | 0.999972 | 3.942016 | {
"github_metadata": {
"branch": "master",
"commit_count": 29,
"repo_created_at": "2023-05-09T06:41:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "285cde467... |
5fd19007-5c4f-4f0e-bfef-9f7e51b83653 | cloudwalker01/OS-MiniProject2022 | LIFO.cpp | #include <iostream>
using namespace std;
#include <bits/stdc++.h>
void showstack(stack<int> st)
{
if (st.empty())
return;
int x = st.top();
st.pop();
showstack(st);
cout << x << "\t";
st.push(x);
}
void display(int pages,stack<int>&st ,int &... | ALGO | 0.999754 | 4.604487 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-10-26T09:00: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": "f52c3ede706a... |
1c2f7e58-0a44-486d-bacc-d5c0f231097e | avisharma7/DSA | sorting/QuickSort.cpp | /*
Quick Sort is a sorting algorithm that follows divide and conquer paradigm. It is a two way process
1) partition : It means we take an element and put it at its right place
2) Recursion : solving one condition of putting pivot to its correct position and give rest of work to recursion to do
*/
#include <bits/stdc++... | ALGO | 0.999994 | 6.234634 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2024-01-12T14:08:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4e6b46c869ed... |
cfc5fadb-deb9-437e-a54c-7d3b67fc8495 | AbhiArya20/data-structure-and-algorithms-practice | 02 DP/025LongestRepeatingSubsequence.cpp | #include<bits/stdc++.h>
using namespace std;
// GFG - Longest Repeating Subsequence
class Solution { // Memoization - Not Accepted
int f(int i, int j, int x, int y, string s1, string s2, vector<vector<int>> &dp){
if(i==x || j==y)
return 0;
if(dp[i][j]!=-1)
return dp[i][j];
... | ALGO | 0.999924 | 5.221318 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-03-01T19:09:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b8eae352652f... |
792bd058-8307-4f6d-b49d-a00ba0554638 | kadupitiya/ROS-TurtleBot-PID | src/geometry.h | //
// Created by kadupitiya on 9/7/18.
//
#ifndef GEOMETRY_H
#define GEOMETRY_H
#include <geometry_msgs/Point.h>
#include <geometry_msgs/Quaternion.h>
#include "vector2D.h"
using namespace std;
using namespace geometry_msgs;
class Geometry {
public:
struct LineSegment {
VECTOR2D startP;
VECTOR... | ALGO | 0.995975 | 4.700785 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-10-19T04:50:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 93,
"forks": 22,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "aa5a4cc... |
16b7230c-d15c-46fa-a1a3-1aacec548b56 | Isomorphic-Knots/data-structures | p3/in2post.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <cctype>
#include "stack.h"
//change
using namespace std;
using namespace cop4530;
bool isleftparenthesis(string s);
bool isrightparenthesis(string s);
bool isoperator(string s);
bool isoperand(string s);
bool lowerprecedence(string s... | ALGO | 0.997603 | 3.628644 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-01-13T20:29:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "05991d2ede... |
53a64122-028a-48bd-8911-6689358a5304 | gokarna14/PI-approximation-using-Simulations-CPP-SFML | Spinner.cpp | #include <SFML/Graphics.hpp>
#include <math.h>
#include <iostream>
#include <string>
using namespace sf;
using namespace std;
int ni = 1, no = 1;
int main()
{
RenderWindow window(VideoMode(600, 600), "Pi Approximator");
CircleShape bullet(1);
RectangleShape R(Vector2f(1000, 35));
R.setFillColor(Colo... | ALGO | 0.964444 | 3.879061 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2021-02-09T06:22:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f0f965891128... |
2060205d-3886-4991-8c78-faa407badf9e | PrashamModi/gfg | Hard/Subtraction in Linked List/subtraction-in-linked-list.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Node Class
class Node {
public:
int data;
Node* next;
Node(int val) : data(val), next(NULL) {}
};
// Linked List Class
class LinkedList {
public:
Node* head;
Node* tail;
LinkedList() : head(NU... | ALGO | 0.99988 | 6.058423 | {
"github_metadata": {
"branch": "main",
"commit_count": 1040,
"repo_created_at": "2023-09-13T06:47: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": "89b725172... |
5f62ef3a-d11d-4e00-a6c3-efb989c882d2 | ccsdu2004/vulkan-cpp-demo | include/VK_Util.h | #ifndef VK_UTIL_H
#define VK_UTIL_H
#include <string>
#include <cstring>
#include <vector>
#include <optional>
#include <vulkan/vulkan.h>
inline bool hasStencilComponent(VkFormat format)
{
return format == VK_FORMAT_D32_SFLOAT_S8_UINT || format == VK_FORMAT_D24_UNORM_S8_UINT;
}
template<class T>
inline bool isSam... | TOOL | 0.947318 | 6.97015 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2021-11-07T03:35:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 52,
"forks": 15,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "19e1e85... |
111e6088-c0b7-461a-a8ef-5d53afd22b9b | misaka18931/misaka-cp | pboj/PER-2/b_Participant.cpp | #include <bits/stdc++.h>
namespace {
using namespace std;
template <typename T> inline void O(const T &x) { cout << x << '\n'; }
template <typename T, typename... W> inline void O(const T &x, const W &...b) {
cout << x << ' ';
O(b...);
}
template <typename T> inline void rd(const T &x) { cin >> x; }
template <typen... | ALGO | 0.999347 | 4.659017 | {
"github_metadata": {
"branch": "main",
"commit_count": 332,
"repo_created_at": "2020-12-30T07:06: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": "023b9cf8d8... |
131492df-fa20-40cb-bd66-fe37881ed5a6 | PRADEEPERIYASAMY/cpp-codes | top_500/string/find number of times a string occurs as a subsequence in given string.cpp | #include <bits/stdc++.h>
using namespace std;
// recursion
// int count(string a,string b,int m,int n){
// if((m == 0 && n == 0) || n == 0) return 1;
// if(m == 0) return 0;
// if(a[m-1] == b[n-1]) return count(a,b,m-1,n-1)+count(a,b,m-1,n);
// else return count(a,b,m-1,n);
// }
//dp
int count(string... | ALGO | 0.999912 | 5.107028 | {
"github_metadata": {
"branch": "main",
"commit_count": 1122,
"repo_created_at": "2020-12-24T11:15: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": "74b5074b0... |
7fdcaf97-e6b4-460b-b199-d1f9a410b79a | seaify/poj-codes | 1811/6200405_TLE.cpp | #include<iostream>
#include<time.h>
const __int64 S=20; ////测试次数...
__int64 T,N,ans;
__int64 gcd(__int64 a,__int64 b)
{
if(b==0)
return a;
return gcd(b,a%b);
}
__int64 check(__int64 a,__int64 n,__int64 p) ////a*n%p;
{
__int64 result=0;
a%=p;
n%=p;
while(n)
{
if(n&1)
... | ALGO | 0.999818 | 3.651845 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2015-11-12T00:48:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0fe4106144... |
7c39453f-74ae-4667-b506-4a6e9b87238e | asdadeeeee/OJ | leetcode/912/a.cpp | #include <cstring>
#include <memory>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> sortArray(vector<int> &nums) {
temp.resize(nums.size());
sort(nums, 0, nums.size() - 1);
return nums;
}
void sort(vector<int> &nums, int begin, int en... | ALGO | 0.999993 | 5.792202 | {
"github_metadata": {
"branch": "main",
"commit_count": 42,
"repo_created_at": "2024-10-29T14:23: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": "1b79589dc4f... |
2cbdc127-eeb4-4b32-b999-215f80f2476a | satyam-jaat/TicTacToe-game-in-c- | tictoe.cpp | #include <iostream>
using namespace std;
char player = 'O';
int turn = 0;
int n = 5;
char board[5][5];
int getPosition(){
cout << "Enter the position: "<<endl;
int position;
cin >> position;
return position;
}
int wins() {
if(board[0][0]==player && board[2][2]==player && board[4][4]==player) {
... | ALGO | 0.999685 | 3.781369 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-11-09T04:57:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "016d7c3b1fcd... |
85cfe2d3-28ba-4d30-ad0d-9e3f69cfcbbc | kurumishka/problems | global20.virt/C.cpp | #pragma GCC optimize("O2")
#include <bits/stdc++.h>
template<class T>
using V = std::vector<T>;
using namespace std;
#define endl "\n"
#define pb push_back
#define all(x) x.begin(),x.end()
#define ANS ((int)1e9+7)
void solve() {
int n;
cin >> n;
V<int> a(n);
for (auto& x : a)
cin >> x;
in... | ALGO | 0.999868 | 4.410012 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2022-12-31T09:28:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "24ddc640a84... |
da8da53f-597a-4a7a-b74d-b77107cc91a9 | Shitaibin/leetcode-2016 | 75.SortColors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int counts[3] = {0};
for (int i = 0; i < nums.size(); i++) {
counts[nums[i]]++;
}
int i = 0, end = 0;
for (int c = 0; c < 3; c++) {
end += counts[c];
for (; i <... | ALGO | 0.999979 | 6.232618 | {
"github_metadata": {
"branch": "master",
"commit_count": 293,
"repo_created_at": "2016-01-25T04:13:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a9c7b7d3... |
b5509148-c812-4b30-af64-3cc267b6a20d | knockcat/Daa-Lab | 0033_Equal_Sum_Partition.cpp | // 0-1 KnapSack Equal Sum Partition Problem
#include <iostream>
using namespace std;
bool subsetsum(int arr[], int sum, int n)
{
bool t[n + 1][sum + 1];
for (int i = 0; i < n + 1; ++i)
{
for (int j = 0; j < sum + 1; ++j) // Initialisation (base case)
{
if (i == 0)
... | ALGO | 0.999942 | 5.491875 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2022-06-18T08:09:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3dfd98b7143... |
c7728b8f-1311-4296-b273-29a8309a9479 | nevikw39/oj | ZeroJudge/b056.cpp | #include <iomanip>
#include <iostream>
#define endl '\n'
#pragma GCC optimize("O3")
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
int n;
while (cin >> n)
{
double a = 0;
for (int i = 0; i < n; i++)
for (int j = 0; ... | ALGO | 0.988543 | 4.343697 | {
"github_metadata": {
"branch": "master",
"commit_count": 2018,
"repo_created_at": "2020-02-22T14:59:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0a4ecc... |
6b31e436-b4e8-410a-9f1a-60e1b0980e2a | Song621/learngit | day02/Code02_SmallSum.cpp | #include <iostream>
#include <vector>
using namespace std;
int merge(vector<int>& unsorted, int L, int M, int R){
int p1 = L;
int p2 = M + 1;
int i = 0;
int sum = 0;
vector<int> temp(R-L+1);
while(p1<=M && p2<=R){
sum += unsorted[p1] < unsorted[p2] ? (R-p2+1)*unsorted[p1] : 0;
... | ALGO | 0.99998 | 5.341955 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2019-10-21T13:25: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": "0d9fbc4c9... |
5e471111-0b31-4ed9-8c10-0cc7f5c295d4 | YuZhong-Chen/Hydra | hydra_ws/src/kimera_pgmo/src/compression/VoxbloxCompression.cpp | /**
* @file VoxbloxCompression.cpp
* @brief Combine and simplify meshes based on Voxblox createConnectedMesh
* @author <NAME>
*/
#include <iterator>
#include "kimera_pgmo/compression/VoxbloxCompression.h"
#include "kimera_pgmo/utils/CommonFunctions.h"
#include "kimera_pgmo/utils/VoxbloxUtils.h"
namespace vxb =... | TOOL | 0.949761 | 5.76026 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2024-06-25T17:11:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d20786464c... |
8e057d05-3855-4ca7-b32c-6495b5e2f088 | jlswbs/Arduino_Gameduino_Chaotic_Map | Duffing/Duffing.ino | // Duffing chaotic map //
#include "SPI.h"
#include "GD.h"
byte i;
float a = 2.75f;
float b = 0.1f;
float x = 1.0f;
float y = 0.0f;
void setpixel(byte x, byte y, byte color){
unsigned int addr = RAM_SPRIMG|(x & 0xf)|(y << 4)|((x & 0x30)<<8);
byte mask = 0xc0 >> ((x >> 5) & 6);
GD.wr(addr, (... | ALGO | 0.998008 | 4.4655 | {
"github_metadata": {
"branch": "main",
"commit_count": 99,
"repo_created_at": "2021-08-19T20:54:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63dbf807bb9... |
9769507b-ecc6-4271-9901-025ae5662ebd | SteveKameron/Sem2Lab5 | Source1.cpp | #include <iostream>
#include <algorithm>
#include <fstream>
#include <set>
#include <unordered_set>
#include <string>
#include <functional>
class Book {
public:
std::string FIO;
std::string Book_Name;
std::string Book_Publishing_Office;
int Year_Of_Publishing, Amount_of_pages;
Book(std::string fio... | ALGO | 0.994172 | 4.435517 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-02-20T17:08: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": "8ebf0c608c80... |
24bd762d-b6fb-4a10-b16d-96f33916c88f | expeditow/Maratona | CSES/Programação Dinâmica/Minimizing Coins/p.cpp | #include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using f64 = double;
using ii = pair<int, int>;
using ull = unsigned long long;
using vi = vector<int>;
using vii = vector<ii>;
const string ENDL = "\n";
const int INF = 1e9 + 7;
const int s = 1e6+2;
... | ALGO | 0.999815 | 4.035095 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-10-08T01:31: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": "f14a60b117ad... |
6614c995-ecab-4935-b6f5-bd757c6d4d9b | itz-siddharth/Advanced-DataStructures-in-C | 10-22-2020 20_Binary Search Tree Operations.cpp | #include<stdio.h>
#include<stdlib.h>
void data();
void add();
int search(struct node);
struct node del_node(struct node);
void dis_inorder(struct node);
void dis_postorder(struct node);
struct node{
int data;
struct node *left;
struct node *right;
};
struct node *root=NULL;
int n,key;
void data()
{
printf("Enter t... | ALGO | 0.999951 | 3.330729 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-02-04T11: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": "6dc58a6ff630... |
b54d7467-cf79-4cfb-a3fa-bbc8f00f6a95 | aaronmorgenegg/cs5500 | assn8/main.cpp | #include <iostream>
#include <fstream>
#include <time.h>
#include <stdlib.h>
#include <mpi.h>
#include <unistd.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
const int RESOLUTION = 256; // size of array, 2d so it's squared
const int PROPORTION = 20; // % of squares initially alive
const ... | ALGO | 0.999722 | 4.872928 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2018-08-28T20:36: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": "396c30bcb... |
0b7e0f7b-7acd-4479-b032-11215c05a558 | smi1le/taifa | taifa/taifa/TranslateMealeToMoora.cpp | #include "stdafx.h"
#include "TranslateMealeToMoore.h"
bool Find(std::vector<SSymbols> const &newStates, SSymbols const &el)
{
for (auto const &ss : newStates)
{
if (ss == el)
{
return true;
}
}
return false;
}
CViewAutomates STranslateMealeToMoore::Translate(CViewAutomates const &meale)
{
std::vector<S... | ALGO | 0.998803 | 4.133772 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2016-06-15T19:17:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "13639539d2... |
28b2d3ac-1286-4104-9a1f-364d99d10868 | rwth-i6/rasr | src/Flf/FlfCore/LatticeInternal.cc | /** Copyright 2020 RWTH Aachen University. All rights reserved.
*
* Licensed under the RWTH ASR License (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.hltpr.rwth-aachen.de/rwth-asr/rwth-asr-license.html
*
* Un... | TOOL | 0.993866 | 6.141118 | {
"github_metadata": {
"branch": "master",
"commit_count": 264,
"repo_created_at": "2020-08-10T08:34:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 57,
"forks": 16,
"issues": 7,
"pull_requests": 12
},
"file_meta": {
"content_id": "12f103... |
8e8cad56-6e20-4087-8afe-558e60680eba | hamx05/FAST-NUCES-Resources | Semester-03/DS-Lab/ds_lab_05/K232005_DS_Lab-05/task15.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node *next;
Node () : data(0), next(NULL) {}
Node (int d) : data (d), next(NULL) {}
};
class SLL {
public:
Node *head;
SLL () : head(NULL) {}
SLL (int d) {
head = n... | ALGO | 0.964591 | 5.274142 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2025-04-26T05:49: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": "33533aca3d8... |
77b2c10a-f86a-42d6-9ef8-258cf90c2ff3 | ishandutta2007/codeforces-k | kokokostya/normal/759/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
struct vert {
int p, t, x;
};
vector<int> t;
vector<int> p;
void push(int v) {
t[2 * v] += p[v];
t[2 * v + 1] += p[v];
p[2 * v] += p[v];
p[2 * v + 1] += p[v];
p[v] = 0;
}
void update(int v, int tl, int tr, int l... | ALGO | 0.999933 | 4.037901 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "10fd9f433f0f... |
06b3669a-aa47-4930-a792-137e466ea652 | uni-kakurenbo/cp-solutions | realtime/AtCoder/tupc2022/g.cpp | /*
* @uni_kakurenbo
* https://github.com/uni-kakurenbo/competitive-programming-workspace
*
* CC0 1.0 http://creativecommons.org/publicdomain/zero/1.0/deed.ja
*/
/* #language C++ GCC */
/* #region template */
#include <bits/stdc++.h>
// using namespace std;
#include "template.hpp"
/* #endregion */
signed main() ... | ALGO | 0.999969 | 3.776629 | {
"github_metadata": {
"branch": "main",
"commit_count": 262,
"repo_created_at": "2022-07-23T02:32:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd041455d6... |
d1eb8f4b-a789-486d-8f37-fbd7e14656f9 | vinorom/contests | src/hackerrank/contests/hackathon/godaddy-hackathon/LCSRevisited.cpp | /**
* https://www.hackerrank.com/contests/godaddy-hackathon/challenges/lcs3
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 3001;
int a[3][MAXN];
vector<int> indices[3][MAXN];
struct triplet
{
int x, y, z;
int max_lcs;
triplet(int x_ = 0, int y_ = 0... | ALGO | 0.999894 | 4.46008 | {
"github_metadata": {
"branch": "master",
"commit_count": 91,
"repo_created_at": "2015-03-30T19:47:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "49da79100... |
a9a3286f-52d4-4e6f-98f9-e00236a74e9e | cliche-niche/CS648 | Programming Assignments/A2/A2Q2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ITERATIONS 2'000
vector< vector<int> > gen_output(int n, uniform_int_distribution<> (&d), mt19937 (&g)){
int max_load = 0;
vector<int> load(n, 0);
vector< vector<int> > output(ITERATIONS, vector<int> (2, 0));
for(int reps = 0; reps < ITERATIONS;... | ALGO | 0.983555 | 4.344903 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2023-01-09T16:25:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5eb729366a1... |
7684e4af-0a4e-4e11-bfd0-942e368692c9 | final-venture/cp | leetcode/115.cpp | // Memoisation
class Solution
{
private:
string s;
string t;
vector<vector<int>> dp;
public:
int numDistinct(string s, string t)
{
this->s = s;
this->t = t;
this->dp = vector<vector<int>>(s.size() + 1, vector<int>(t.size() + 1, -1));
return dfs(0, 0);
}
int ... | ALGO | 0.999996 | 5.882107 | {
"github_metadata": {
"branch": "main",
"commit_count": 313,
"repo_created_at": "2024-01-01T04:15: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": "78bd1838e8... |
8c696ab2-5c0b-42c2-a18b-6792dd1032db | gventino/GraphSolutions | UVa 429/main.cpp | #include "Graph.hpp"
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
int main() {
int nroCasos = 0;
std::queue<std::pair<std::string, std::string>> casos;
std::pair<std::string, std::string> *novoCaso = NULL;
std::string str, startWord, endWord;
std::queue<int> que... | ALGO | 0.998948 | 3.821681 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2023-08-04T22:00: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": "16db8d3fe98... |
78eea05a-1d07-472f-868c-466e5a0c3f8b | shanukun/algo_dst | 1203b.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
#define debug(x) cerr << #x << " " << x << endl
int main() {
int q, n, num;
cin >> q;
while (q--) {
cin >> n;
int pr[N] = {0};
vector<int> v;
for (int i = 0; i < 4 * n; i++) {
cin >> num;
... | ALGO | 0.999847 | 4.143966 | {
"github_metadata": {
"branch": "master",
"commit_count": 78,
"repo_created_at": "2020-05-27T15:19:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "13f6df1c0... |
1d384bbe-4c1b-4aa5-b809-b795198ab2bb | Doveqise/Cloud | Codes/C++/3258.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 6e5 + 5;
int a[maxn], val[maxn], cf[maxn], fa[maxn], dep[maxn], siz[maxn], son[maxn], id[maxn], rl[maxn], hd[maxn], nxt[maxn << 1], to[maxn << 1], top[maxn];
int n, tot = 1, cnt = 0;
void add(int u, int v)
{
to[++tot] = v;
nxt[tot] = hd[u];
hd[u... | ALGO | 0.999861 | 3.989527 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2019-10-02T10:57: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": "3ee8ab0276... |
c8f549bb-b8c5-4c5b-8203-23bb61c63b19 | Riyanshukumar/DSA | DSA/Binary Search/countOccurence.cpp | #include<iostream>
using namespace std;
int firstOccur(int arr[], int n, int k){
int st = 0, end = n-1;
while(st <= end){
int mid = (st+end)/2;
if(arr[mid] > k)
end = mid-1;
else if(arr[mid] < k)
st = mid+1;
else
if(arr[mid-1] != k || mid == ... | ALGO | 0.999858 | 4.945242 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-07-08T07:32:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c35fee87c767... |
e98663ef-6f49-4b1f-a816-c4d8e1c267a0 | paulzcy/USACO | 3.1_contact/contact.cpp | /*
ID: paulzcy3
TASK: contact
LANG: C++
*/
#include <algorithm>
#include <cassert>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int a, b, n;
int cnt[12 << 12];
struct Count {
int cnt;
int encoded;
} counts[12 << 12];
int num_count = 0;
int main() {
ofstream fout("contact.out")... | ALGO | 0.999747 | 3.608992 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2024-12-21T01:08: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": "b4cae5491b... |
5066be33-552c-4502-8634-dadcc145bdf3 | O-LEX/pba-task03-cuda | main.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm> // For std::sort, std::fill
#include <random> // For random number generation
#include <chrono> // For timing
#include <limits> // For std::numeric_limits
#include <iomanip> // For std::fixed, std::setprecision
#include <string> /... | ALGO | 0.999818 | 6.398942 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-12T16:44: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": "5f08c64bd4a2... |
d6855770-7920-4fa2-84e9-9961cae8ff80 | yaoyaowd/competitivecoding | codefoce/cf1238f.cc | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 300010;
const ll inf = 1e18;
const ll mod = 1000000007;
int n;
vector<int> g[maxn];
int d[maxn];
int dp[maxn][2];
void dfs(int v, int p) {
vector<int> dd;
dp[v][1] = d[v] - 1;
for (auto to : g[v]) {
if (to == p)
co... | ALGO | 0.999732 | 4.421738 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2019-05-04T16:17: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": "65cb1c4885... |
091efded-40d4-458b-acdb-6cda9fea4904 | sumit8692/Leetcode-solutions | Smallest distinct window - GFG/smallest-distinct-window.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int findSubString(string str)
{
// Your code goes here
int n = str.length();
int ans = n, j = 0;
map<char, int> mp, T;
for(char ... | ALGO | 0.999895 | 5.955351 | {
"github_metadata": {
"branch": "main",
"commit_count": 2037,
"repo_created_at": "2022-04-12T18:28:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e89deb000... |
c96a3f68-8419-490c-b9a7-2349c61f8fc8 | Moneemabdullah/problem_solving_journey | rendom/A_1_Balanced_Shuffle_Easy.cpp | /*
#### ### # # ##### ##### #### ##### #####
# # # # # # # # # # #
### ##### # # #### AND #### #### #### ####
# # # # # # # # # # #
#### # # # ##### # # # ##### #####
... | ALGO | 0.999833 | 4.651333 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-09-21T10:07: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": "48a591fa5649... |
42879898-1ab4-4dcf-9658-1294ec4ab5af | dineshmakkar079/My-DS-Algo-code | geeksforgeeks/Is_Sudoku_Valid.cpp | /*
Time : Mon Oct 16 2017 15:54:43 GMT+0530 (IST)
URL : http://practice.geeksforgeeks.org/problems/is-sudoku-valid/0/?ref=self
Given an incomplete Sudoku configuration in terms of a 9x9 2-D square matrix (mat[][]) the task
to check if the configuration has a solution or not.
Input:
The first line of input contains ... | ALGO | 0.999598 | 5.396146 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2017-06-10T18:15: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": "83d18e8be... |
5d8c1a61-37f1-4f65-9e2b-b9d97595988b | johnkk1999/FIRFilter | main.cpp | #include <Arduino.h>
#define FIR_FILTER_LENGTH 16
typedef struct {
float buf[FIR_FILTER_LENGTH];
uint8_t bufIndex;
float out;
}FIRFilter;
void FIRFilter_init(FIRFilter *fir);
float FIRFilter_update(FIRFilter *fir, float inp);
static float FIR_IMPULSE_RESPONSE[FIR_FILTER_LENGTH] = {0.0010846f,0.0019684f,0.00... | ALGO | 0.998 | 5.426244 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-05-18T11:31:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b731a0c43db0... |
90f7388d-4ea5-47b8-9e26-03e08c7c5269 | rwitten/vision-spl | ess.cc | /********************************************************
* *
* Efficient Subwindow Search (ESS) implemention in C++ *
* entry point and commmand line interface *
* *
* Performs a branch-and-boun... | ALGO | 0.999204 | 3.419857 | {
"github_metadata": {
"branch": "master",
"commit_count": 97,
"repo_created_at": "2011-08-28T23:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f78900016... |
dde043be-6d93-46c9-bfb8-1c5f5a932db5 | fmejbah/Solve | LightOJ/1319.cpp | #include <bits/stdc++.h>
using namespace std;
int mod(int a, int b) {
int ret = a % b;
if (ret < 0) {
ret += b;
}
return ret;
}
int extended_cuclid(int a, int b, int &x, int &y) {
int xx = y = 0;
int yy = x = 1;
while (b) {
int q = a / b;
int t = b; b = a % b; a = t;
t = xx; xx = x - q ... | ALGO | 0.999695 | 4.635128 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2018-03-08T17:38:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4898e6aead... |
3f3da04f-e80e-4c2f-831d-cf9842cd9009 | Ashnabasotia/6Companies30days | M2/Q14.cpp | class Solution {
public:
struct Info{
int lDepth;
int rDepth;
bool contains;
int time;
Info(){
lDepth = rDepth = 0;
contains = false;
time = -1;
}
};
Info calcTime(Node* node, Info& info, int target, int& res)
{
... | ALGO | 0.999985 | 5.452025 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2022-01-04T10:54: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": "fcf8160f01... |
0da154ed-516e-47be-9c20-0d2cbe251323 | davidmartinezhi/road-to-internships | Alexa (0-0)/Easy/Array/5.PlusOne.cpp | /*
<NAME>
Primer intento: 28/01/2022
Segundo intento ya bien: 30/01/2022
50 min sin nada JAJAJ, David me ayudó a sacar el primer intento aunque se pase de tiempo
Despues de ver la resp de david pos la puse parecida jajaj el 30 de enero
1. Cada dígito de un numero se guardó en orden en un array
Se debe sumarle uno al... | ALGO | 0.99954 | 5.829943 | {
"github_metadata": {
"branch": "main",
"commit_count": 126,
"repo_created_at": "2022-01-23T01:52:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abf1ec67ef... |
97642c73-33f2-4f81-aa87-3ebb7ca75b36 | fathink/DataStruct | tmp/ShortestPath_Floyd.cpp | //ShortestPath_Floyd algorithm by adjacency matrix of directed graphs
//2015/12/13
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define numVertex 6 //Graph's vertex numbers
#define INFINITY 65536
string VertexName[numVertex]={"V0","V1","V2","V3","V4","V5"};
void createGraph(int Graph... | ALGO | 0.999971 | 4.516675 | {
"github_metadata": {
"branch": "master",
"commit_count": 110,
"repo_created_at": "2015-12-01T12:48:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e53e2898... |
b3b5e975-04d9-4c9b-ab16-5636013a0501 | liujiamingustc/phd | awesome/c_cpp/cpp-cheat/opengl/bouncing_balls_many.cpp | /*
Many spheres bouncing inside a cube with gravity,
energy dissipation on impact, and impact between the spheres.
TODO: DRY
- up with bouncing_balls_one.cpp
- balls flicker a lot. Why?
*/
#include <cstdio>
#include <cstdlib>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include <GL/glext.h>
... | ALGO | 0.99841 | 4.603579 | {
"github_metadata": {
"branch": "master",
"commit_count": 491,
"repo_created_at": "2019-04-26T06:04:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "672f197b... |
a66dd018-39f1-4c41-97af-8a4add97f287 | mehedi37/OOP | Lab_final/lab.cpp | // Roll - 2003037
// Lab Final on DSA
#include<bits/stdc++.h>
using namespace std;
// Set the size of the array
// For understanding BST it kept low
#define SIZE 5
class Queue {
private:
int items[SIZE]{0}, front, rear;
public:
Queue() {
front = -1;
rear = -1;
}
bool isFull() {
if (front == 0 ... | ALGO | 0.999803 | 4.674342 | {
"github_metadata": {
"branch": "main",
"commit_count": 116,
"repo_created_at": "2022-09-19T20:47: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": "b7c0f2acc9... |
1cd04c97-345b-488b-84d8-63a6a866431a | Sapr0nov/C-practice | C++ practice/sapper.cpp | //Сапёр
//Вам необходимо построить поле для игры «Сапёр» по его конфигурации — высоте, ширине и координатам расставленных на нем мин.
//
//Вкратце напомним правила построения поля для игры «Сапёр»:
//
//поле состоит из клеток с минами и пустых клеток;
//клетки с миной обозначаются символом *;
//пустые клетки содержат ч... | ALGO | 0.999871 | 4.686831 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-02-29T10:23: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": "2aa7e6ded24... |
29814adc-dbbf-4ebd-aaa5-a98c658b90c9 | peygar/DynoGuy | dinosaur.cc | #include "dinosaur.h"
#include <iostream>
using namespace std;
const int MAX_JUMP_HEIGHT = 4;
const int MAX_JUMP_PROGRESS = MAX_JUMP_HEIGHT * 2;
Dinosaur::Dinosaur():lastJumpDistance(-1),jumpProgress(0){}
void Dinosaur::initialize()
{
for(int i = 0; i < 55; i++)
{
qArray[i] = 0;
}
}
void Dinosaur::jump() {
... | ALGO | 0.997135 | 3.862708 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2016-05-10T15:36:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c98432e4b... |
a8efe4f8-3360-4556-a0c6-3d2da4fc083f | KhoiBui16/UIT_Wecode | Source code/DSA/Cô Thương source code/Search and Sort (Intermediate)/Bai3.cpp | /*###Begin banned keyword - each of the following line if appear in code will raise error. regex supported
define
include
using
###End banned keyword*/
#include <iostream>
using namespace std;
//###INSERT CODE HERE -
void inputArray(int *a, int n)
{
for (int i=0; i<n; i++) cin >> a[i];
}
/*void MergeSort(int *... | ALGO | 0.999973 | 4.892549 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2024-01-13T15:22:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a18a0af44c4... |
b09dbd4b-6d14-46fe-9044-b069b0c21df2 | temmie-950807/code | contest/中文賽區/NPSC 2022/pB.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ... | ALGO | 0.999888 | 4.92703 | {
"github_metadata": {
"branch": "main",
"commit_count": 61,
"repo_created_at": "2022-03-14T14:01:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "04633e0ff0f... |
e0b6b9d5-c56d-47af-a285-73d7e9478c5a | Riseikou1/LeetCode | Arrays_Hashing/valid_anagram.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
class Solution1{
public :
bool isAnagram(string s, string t){ // it is the slowest shit.
if(s.length() != t.length()) return false;
unordered_map<int,int> sCount, tCount;
for(int i=0;i<s.length();i++){
... | ALGO | 0.999787 | 5.73428 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2025-06-14T07:45:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "037ad665a90... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.