uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9c216c7b-6cf0-47ea-becc-f498cc42587a | eh2ll/algorithm | 70-79/bj11971.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int N, M;
vector<pii> lim, spd;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> M;
int tmp = 0;
for(int i = 0; i < N; i += 1){
int a, b; cin >> a >> b;
lim.push_back({tmp + a, b});
tmp ... | ALGO | 0.999919 | 4.517988 |
485ad71e-0fb7-4834-ab9f-1c3ced433850 | qbit-t/qbit | boost/libs/compute/perf/perf_stl_rotate_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.979397 | 5.559673 |
e5fdee39-5f1e-410d-bbdb-cd8ffa4045cb | Dajtbaeva/LEETCODE | 1109.cpp | // 1109. Corporate Flight Bookings
// https://leetcode.com/problems/corporate-flight-bookings/
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Input: bookings = [[1,2,10],[2,3,20],[2,5,25]], n = 5
Output: [10,55,45,25,25]
Explanation:
Flight labels: 1 2 3 4 5
B... | ALGO | 0.999917 | 6.681913 |
8264773c-6901-4cd9-bf2f-ea5dc9ae8795 | Priyakumari00/DSA | Patterns/diamondStartPattren.cpp | #include <bits/stdc++.h>
using namespace std;
void erect_pyramid(int N)
{
for (int i = 0; i < N; i++)
{
for (int j =0; j<N-i-1; j++)
{
cout <<" ";
}
for(int j=0;j< 2*i+1;j++){
cout<<"*";
}
for (in... | ALGO | 0.999965 | 4.145936 |
13cd5a89-c77b-4f00-a901-7b4127071726 | Prakhar-002/LEETCODE | ๐ Study ๐ง Plan ๐จ๐ปโ๐ป/๐ฉต NeetCode 150 - ๐ Blind 75 + 75 problems/๐ฌ Examine Thoroughly ๐งฌ/07 Trees/Day โบ 60 ๐ฅก 297. Serialize and Deserialize Binary Tree โ๏ธ ๐ ๐ฐ ๐ฒ/๐ฒCPP - 297. Serialize and Deserialize.cpp | //! https://github.com/Prakhar-002/LEETCODE
// Todo ๐ QUESTION NUMBER 297
//? โ Time complexity โบ O(n) ๐๐ป n = Nodes
//? ๐งบ Space complexity โบ O(n)
class Codec {
public:
// Serializes a tree to a string
string serialize(TreeNode* root) {
string res;
serializeHelper(root, res);... | ALGO | 0.999812 | 7.121161 |
8eb8c944-76de-4692-ae9e-6be3340fca47 | IoannisKapotis/AMS595 | CplusplusProj1/CHWQ2.cpp | #include <iostream>
#include <vector>
using namespace std;
void print_vector(vector<int> v){
for (int i : v){ //Cycles through each position in vector, and displays it iteratively
cout << i << "";
}
}
int main(){
vector<int> vector = {1,2,3,4,5};
print_vector(vector);
return 0;
} | ALGO | 0.943604 | 4.511936 |
fd18f738-e569-4e25-8746-3bceea28ee15 | gmtiddia/structural_plasticity | simulations/noise_2Hz_simulations/20000/structural_plasticity.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <random>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#ifdef _OPENMP
#include <omp.h>
#define THREAD_MAXNUM omp_get_max_threads()
#define THREAD_ID... | ALGO | 0.968902 | 4.627857 |
00bfbfec-d48b-4474-bb02-99faf2a1b9a4 | LostOracle/AOC | 2020/users/ian/05/Part2.cpp | #include <iostream>
#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
#include <cctype>
#include <cmath>
#include <string>
int binary_partition(std::string encoding, int min, int max, char mindicator, char maxicator)
{
... | ALGO | 0.996281 | 5.016792 |
41fa1e16-239f-460c-a5c9-c68fa5eb5bd5 | VSolidus/solidus | src/core_read.cpp | #include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "serialize.h"
#include "streams.h"
#include <univalue.h>
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/... | TOOL | 0.88588 | 7.211846 |
d9cfe85c-3cba-4679-9b31-6a9fb67c343e | Vasant19/LeetCode-problem-practice | FirstUniqueChars.cpp | // Problem no 387 link: https://leetcode.com/problems/first-unique-character-in-a-string/
// The problem is to find the first unique (non repeating) character in a string and return its index.
// If there is no unique character, return -1.
#include <iostream>
#include <string>
#include <algorithm>
using namespace st... | ALGO | 0.999689 | 5.950097 |
8aba0243-066e-49f6-bf9f-9d377a1f7d81 | erpranavknigam/CPP_Repository | Array/ArrayChallenges/max_circular_subarray_sum.cpp | #include<iostream>
using namespace std;
int kadaneAlgorithm(int arr[], int n){
int currSum = 0;
int maxSum = INT_MIN;
for(int i = 0; i < n; i++){
currSum += arr[i];
if(currSum < 0){
currSum = 0;
}
maxSum = max(maxSum, currSum);
}
return maxSum;
}
int ... | ALGO | 0.999997 | 4.371368 |
32683460-3b81-45fb-b6d5-6bb6fc6bdf38 | sarvex/leetcode-emoji-code | solution/0300-0399/0346.Moving Average from Data Stream/Solution.cpp | class MovingAverage {
public:
MovingAverage(int size) {
arr.resize(size);
}
double next(int val) {
int idx = cnt % arr.size();
s += val - arr[idx];
arr[idx] = val;
++cnt;
return (double) s / min(cnt, (int) arr.size());
}
private:
vector<int> arr;
... | ALGO | 0.999661 | 6.63414 |
7c367d34-e61f-49c2-b4a3-eab86304bf06 | kamesh-3417/23JulCDPKamesh | c,c++ task/return value.cpp | #include<stdio.h>
int main ()
{
int n,r;
printf("enter any number");
scanf("%d",&n);
while(n>0)
{
r=n%10;
printf("%d ",r);
n=n/10;
}
return 0;
}
| ALGO | 0.999533 | 3.195886 |
515eb1d5-356e-4044-ac77-410356ef0a99 | ishandutta2007/codeforces | torisasami/normal/1508/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define lscan(x) scanf("%I64d", &x)
#define lprint(x) printf("%I64d", x)
#define rep(i, n) for (ll i = 0; i < (n); i++)
#... | ALGO | 0.999985 | 4.095973 |
6f4a8548-eafc-4dbe-baa3-284ea421685c | Vaibhav10sept/DSA | QUEUE/design-circular-dequeue.cpp | #include <bits/stdc++.h>
using namespace std;
class MyCircularDeque {
private:
int head, tail, size, capacity;
vector<int> q;
public:
/** Initialize your data structure here. Set the size of the deque to be k. */
MyCircularDeque(int k) : head(0), tail(0), capacity(k), size(0), q(vector<int>(k, 0)) {}
bool insert... | ALGO | 0.99903 | 5.434464 |
a8a429c4-3161-4e37-87d8-f0ffd4a7a404 | AlbanGauthier/IGR205projet | extern/eigen3/bench/sparse_randomsetter.cpp |
#define NOGMM
#define NOMTL
#include <map>
#include <ext/hash_map>
#include <google/dense_hash_map>
#include <google/sparse_hash_map>
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifndef REPEAT
#define REPEAT 1
#endif
#include "BenchSparseUtil.h"
#ifndef MINDENSITY
#define M... | TOOL | 0.920294 | 4.487392 |
65bbbed4-10a5-4e7d-8409-b84c39830324 | water2silver/Learn | algorithm/diguifenzhi/P3958.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
/*
ๅฅถ้
ช๏ผ
*/
using namespace std;
int T;
int n,h,r;
class Point{
public:
int x;
int y;
int z;
};
//vector<Point> data;
Point data[1010];
bool compare(Point a,Point b);
double dist(long long a,long long b,long long c)... | ALGO | 0.999896 | 3.478727 |
c1d7c5f5-c5e3-41b9-a7aa-c000303f116c | x75/lpzrobots | ode_robots/simulations/template_hexabot/tripodgait18dof.cpp | #include <selforg/controller_misc.h>
#include <ode_robots/hexabotsensormotordefinition.h>
#include "tripodgait18dof.h"
using namespace matrix;
using namespace std;
using namespace HEXABOT;
TripodGait18DOF::TripodGait18DOF(const TripodGait18DOFConf& _conf)
: AbstractController("TripodGait18DOF", "$Id: tripodgait18dof.c... | TOOL | 0.902597 | 4.828816 |
ae61e35a-1751-49dc-ad60-a336850c4582 | ZephyrusIoannina/ZephyrusII | code/LIBRARIES/Crypto/AES192.cpp | #include "AES.h"
#include "Crypto.h"
#include <string.h>
/**
* \class AES192 AES.h <AES.h>
* \brief AES block cipher with 192-bit keys.
*
* \sa AES128, AES256
*/
/**
* \brief Constructs an AES 192-bit block cipher with no initial key.
*
* This constructor must be followed by a call to setKey() before the
* b... | ALGO | 0.915645 | 7.175633 |
68b5e69f-747a-403c-bec4-c464b0e77dd3 | mohit-singh-13/DSA-Cpp | 34. Recursion Part-4/bubbleSort.cpp | #include<iostream>
using namespace std;
void bubbleSort(int arr[], int size) {
// base case
if (size <= 1) {
return;
}
for (int i=0 ; i<size-1 ; i++) {
if (arr[i] > arr[i+1]) {
swap(arr[i], arr[i+1]);
}
}
bubbleSort(arr, size-1);
}
int main() {
int arr... | ALGO | 0.999794 | 6.046945 |
6bc9f302-da4a-4bec-86b9-096da7502386 | prabhxjottsingh/leetcode-practise-problems | Contests/Weekly Contest 291/2259. Remove Digit From Number to Maximize Result.cpp | // Problem Link: https://leetcode.com/problems/remove-digit-from-number-to-maximize-result/submissions/
// Time Complexity: O(N ^ 2)
// Space Complexity: O(N)
class Solution
{
private:
static bool comp(const string &a, const string &b)
{
if (a.size() == b.size())
return (a > b);
re... | ALGO | 0.999935 | 6.381246 |
35c728b9-7e15-427c-9253-2b50755492c1 | lorinma/EaSTBIM | Geometry.cpp | //
// Created by ling on 30/10/15.
//
#include "Geometry.h"
Geometry::Geometry() {
}
bool Geometry::GetShells(const TopoDS_Shape &brep, Geometry::ShellSet &shells) {
TopExp_Explorer Ex;
int count=0;
for (Ex.Init(brep,TopAbs_SHELL); Ex.More(); Ex.Next()) {
shells.push_back(new TopoDS_Shell);
... | TOOL | 0.932613 | 4.113401 |
996ddcc7-23e4-48e4-a7a9-6469379d050d | Aditya5510/CSES | graphs/Investigation.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n + 1);
for (int i = 0; i < m; i++)
{
int a, b;
cin >> a >> b;
adj[a].push_back(b);
adj[b].push_back(a);
}
} | ALGO | 0.99994 | 3.972239 |
60c2bf3e-47d6-439c-84fc-d3c895407633 | mmhriyad/uva | 495_Fibonacci_Freeze.cpp | #include <stdio.h>
#include <string.h>
#define MAXN 5001
#define MAXL 10000
char fibnumbers[MAXN][MAXL];
void calculate(int a)
{
int b, c, i1, carry, sum, i2, k;
char tmp[MAXL];
b = a - 1;
c = a - 2;
i1 = strlen(fibnumbers[b]) - 1;
i2 = strlen(fibnumbers[c]) - 1;
k = i1;
tmp[k + 1] = 0x00;
carry = 0;
whi... | ALGO | 0.999872 | 3.986974 |
31ca19d8-afc4-4ec7-abf1-3e2b3baa9426 | dudgh9661/algorithmPractice | testGa/main.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
/*
* ๋ง์ง๋ง ๋ฌธ์์ด์ ๊ธฐ์ ์ผ๋ก ํ๋์ฉ ์ถ๊ฐํด๋ณด๊ณ ๊ฒ์ฌํ๋ค.
*/
bool isPal(string str, string str2) {
if( str == str2 ) {
// cout << str << "," << str2 << endl;
return true;
}
return false;
}
string rev(string plain) ... | ALGO | 0.99991 | 4.846221 |
8608e773-6523-4617-a90f-192ad602e336 | hasanmehedi9034/03_data_structure_and_algorithm | 42_lav_class(11)/3_hash.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
map<int,int> M;
M[3] = 9;
M[2] = 3;
for (auto i:M) {
cout << i.first << " | " << i.second << endl;
}
} | ALGO | 0.95623 | 4.197911 |
e3ca334a-a775-4a89-beaa-e4ed0f4566d6 | shenzheyu/EdgeLoRA | edgelora_wo_aas/examples/lookup/lookup-stats.cpp | #include "ggml.h"
#include "common.h"
#include "llama.h"
#include "log.h"
#include "ngram-cache.h"
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
int main(int argc, char ** argv){
gpt_params params;
auto options = gpt_para... | TEST | 0.947792 | 7.047921 |
ef5c3db8-90da-4f73-b0b3-506157a83c03 | phoenix29122003/Leetcode_questions | 0210-course-schedule-ii/0210-course-schedule-ii.cpp | class Solution {
public:
vector<int> findOrder(int n, vector<vector<int>>& pre) {
vector<int>ans;
unordered_map<int,vector<int>>graph;
vector<int>indegree(n,0);
queue<int>q;
for(auto it:pre){
graph[it[1]].push_back(it[0]);
indegree[it[0]]++;
}
... | ALGO | 0.99999 | 6.108115 |
94d9eda1-a122-49a3-ae79-fe29a124d291 | jcarpio/FAAL8_2122 | practica1_v1/TestAlgoritmo.cpp | /*
* La clase TestAlgoritmo contiene los metodos para:
* 1. Comprobar que el/los algoritmos funcionan adecuadamente.
* 2. Calcular la eficiencia para los casos de un mtodo de bsqueda,
* permitiendo guardar los datos e imprimir la grfica correspondiente
* 3. Comparar el coste temporal de los casos de bsqueda
* ... | TEST | 0.883045 | 4.26816 |
cc36921f-45df-4cbb-b4a6-1a899602a651 | kouki0412/Cpp_code | contest/AtCoder/ABC/ABC2xx/ABC25x/ABC250/D.cpp | //#define _GLIBCXX_DEBUG
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
#endif
using ll = long long;
using ld = long d... | ALGO | 0.999883 | 4.702871 |
5061f660-9770-4812-9afe-304918377fff | VBsaini/LeetCode | array/search-in-rotated-sorted-array.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int l = 0;
int r = nums.size()-1;
int mid;
while(l<=r){
mid = (l+r)/2;
if (nums[mid] == target) return mid;
if(nums[l]<=nums[mid]){
if(nums[l] <= target && target ... | ALGO | 0.999973 | 6.213306 |
7c1a7cb8-ab1a-41f0-b904-4116e883507b | developer-danish/CPP-and-DSA | reverse-stack.cpp | #include<iostream>
using namespace std;
#define n 10
class Stack{
char* arr;
int top;
public:
Stack(){
arr = new char[n];
top = -1;
}
void push(char x){
if(top == n-1){
cout<<"stack is full..."<<endl;
return;
}
top++;
arr[top]... | ALGO | 0.990604 | 4.525808 |
2a0b8b15-d5d8-479a-9b6d-eea4be095736 | gabitaniguchi/Competitive-programming | string/kmp/automato.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX (int)(1e6+10)
string s, p;
vector<int> pi;
int automato[26][MAX];
vector<int> prefix_function(string p){
vector<int> pi(p.size());
for(int i=1, j=0; i<(int)p.size(); i++){
while(j>0 && p[j]!=p[i]) j = pi[j-1];
if(p[i] == p[j]) j++;
... | ALGO | 0.999865 | 4.536318 |
2588b072-648e-463f-ad93-9077afd117f8 | gmaheswaranmca/20220420 | trainer/handsOn/Day 25/Qn20220527-07.cpp | /*
Write the range function
to print numbers between r1(start number) and r2(end number)
NOTE: Use Pointers in the range function for the two argumetns
Input:
10 19
Output:
10 11 12 13 14 15 16 17 18 19
Input:
5 -5
Output:
5 4 3 2 1 0 -1 -2 -3 -4 -5
Test Case 1:
Input:
5 5
Output:
5
Test Case 2:
Input:
-4 4... | ALGO | 0.999464 | 3.980379 |
722b7f39-5ab9-4c78-aede-8feff47b0405 | XIAOYAOYITAN/C_leraning | LeetCode/Leetcodeๅท้ข/896. ๅ่ฐๆฐๅ/91 ่งฃ็ ๆนๆณ.cpp | //#include <iostream>
//#include <vector>
//#include <set>
//#include <algorithm>
//#include <stack>
//#include <map>
//using namespace std;
//
////class Solution {
////public:
//// int numDecodings(string s) {
//// int n = s.size();
//// if (s.size() == 0) return 0;
//// if (s[0] == '0') return 0;
//// if (s.size(... | ALGO | 0.999874 | 4.951164 |
ef2fb258-b806-4470-9387-126f67b09317 | bira37/problem-solving | Codeforces/Official Rounds/452/Div2F.cpp | #include <bits/stdc++.h>
#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.ti... | ALGO | 0.999965 | 3.852752 |
b1df0336-0ba3-4bd9-b48f-3753c7fac86e | johnmungcal2/SOFTDEV-PRELIM-ACT-2 | 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.998733 | 6.76775 |
ea77080c-f17a-4051-bb22-9ac89ff227e9 | dimkashelk/spbspu-labs-2023-tp-904-a | gulyaev.ilya/T2/datastruct.cpp | #include "datastruct.hpp"
#include "iofmtguard.hpp"
#include "typesio.hpp"
bool gulyaev::isLess(const DataStruct &lhs, const DataStruct &rhs)
{
if (lhs.key1 != rhs.key1) {
return (lhs.key1 < rhs.key1);
}
if (std::abs(lhs.key2) != std::abs(rhs.key2)) {
return (std::abs(lhs.key2) < std::abs(rhs.key2));
}... | ALGO | 0.948088 | 4.496014 |
9f6dccd0-158a-4d43-bdd8-0fa4f27630f3 | matumoto1234/cp-crawler | AtCoder/typical90/typical90_j/23320960.cpp | // detail: https://atcoder.jp/contests/typical90/submissions/23320960
#include <bits/stdc++.h>
using namespace std;
// {{{
// clang-format off
#define rep(i, n) for (int i = 0; i < (int)(n); i += 1)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i -= 1)
#define range(i, l, r) for ( int i = (int)(l); i < (int)(r);... | ALGO | 0.999917 | 4.914755 |
9a852899-46df-4129-83f8-3a843cf31326 | ishankhanna28/Data-Structures-and-Algorithms | Stack/StockSpan.cpp | #include <iostream>
#include <stack>
#include <climits>
using namespace std;
int main()
{
stack<pair<int,int>> s;
s.push(make_pair(-1, INT_MAX));
int n, x;
cin>>n;
for(int idx=0; idx<n; idx++)
{
cin>>x;
while(x > s.top().second)
s.pop();
cout<<(idx - s.top().first)<<" ";
s.push(make_pair(idx, x));
... | ALGO | 0.999945 | 3.738656 |
ae6bd80c-4f66-4c60-a913-ea606a315dfe | prathamudeshi/Codechef-Problems | 1000+ Difficulty/Average_of_Three.cpp | // https://www.codechef.com/practice/course/1-star-difficulty-problems/DIFF1200/problems/AVGOF3
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
cout<<n-1<<" "<<n<<" "<<n+1<<endl;
}
}
| ALGO | 0.999188 | 4.375257 |
aff9cf8b-33e0-4ed6-aa45-4b066cce2ef2 | igormdfernandes/DSI-atividades | 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.998859 | 6.785645 |
ef9ebe55-7f1a-4271-85a4-d6da1ae6cd21 | ishandutta2007/codeforces | andr1y/normal/1328/D.cpp | //password1488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5+228;
ll a[N];
signed main(){
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
ll q;
cin >> q;
while(q--){
ll n;
cin >> n;
ll dc = 0;
for(ll i =0;i<n;i++){
cin >> a[i];
if(i) dc+=a[i]!=a[i-1];
}
... | ALGO | 0.999786 | 3.543643 |
7a8fea61-a060-4654-bb2a-985f0fd99c46 | STRUKTUR-DATA-SE-07-02/Modul-4 | 2311104064_Muhammad Ikhsan Al Hakim/guided/main.cpp | #include <iostream>
#include <cstring>
using namespace std;
// Deklarasi Struct untuk mahasiswa
struct mahasiswa {
char nama[30];
char nim[10];
};
// Deklarasi Struct Node
struct Node {
mahasiswa data;
Node *next;
};
Node *head;
Node *tail;
// Inisialisasi List
void init() {
head = nullptr;
... | ALGO | 0.965315 | 5.793256 |
e1adff43-0cb6-460e-a625-ac11ed602542 | ms303956362/myexercise | DS/2_Vector/alarm.cpp | #include <cstdio>
class Point {
public:
int x;
int y;
};
bool operator<(Point& p, Point& l) { // ็ด็บฟ(a, b)ๅฟ
้กปๅจๅทฆไพง๏ผ็น(x, y)ๅฟ
้กปๅจๅณไพง
return static_cast<long long>(l.x) * static_cast<long long>(p.y) +
static_cast<long long>(l.y) * static_cast<long long>(p.x) -
static_cast<long long>(l.... | ALGO | 0.999982 | 5.019807 |
4d4d4d53-5a6a-4580-a48c-753c1f43d1fe | luciocf/CP-Problems | Codeforces/1406E.cpp | // Codeforces 1406E - Deleting Numbers
// Lรบcio Cardoso
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int n;
bool mark[maxn], mark2[maxn];
void sieve(void)
{
for (int i = 2; i < maxn; i++)
if (!mark[i])
for (int j = 2*i; j < maxn; j += i)
mark[j] = 1;
}
void solve_primo(void)
{... | ALGO | 0.999757 | 3.532446 |
cb5a0a63-21de-4786-ad83-f2435cd7f5a1 | HEltim7/cpcode | Archive/ICPC/2022ICPC้ข้่ต2/L.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define endl '\n'
using LL=long long;
constexpr int N=2e6+10,mod=998244353;
int u[N],v[N];
char s[N];
int n;
struct Node {
LL i,c,p;
LL ic,cp,pc;
LL icp,cpc;
LL icpc;
void merge(const Node &l,const Node &r) {
... | ALGO | 0.999719 | 4.53494 |
7dc0cc8e-a696-4b32-b5f2-75e01c2be1b2 | AntimaTiwari07/LeetCode | 2802-find-the-punishment-number-of-an-integer/2802-find-the-punishment-number-of-an-integer.cpp | class Solution {
public:
int punishmentNumber(int n) {
vector<string>v;
int ans = 1;
for(int i = 2;i<=n;i++){
int temp = i*i;
string num = to_string(temp);
v.push_back(num);
}
for(int i = 0;i<v.size();i++){
int sum = 0;
... | ALGO | 0.999868 | 4.155029 |
74c04ef7-0b83-4cf2-aca0-eda42eaeebb6 | RyanZurrin/InterviewLevelUpProblems | leetCode.cpp | //
// Created by Ryan.Zurrin001 on 1/6/2022.
//
#pragma ide diagnostic ignored "bugprone-branch-clone"
#pragma ide diagnostic ignored "OCDFAInspection"
#pragma ide diagnostic ignored "cert-err58-cpp"
#pragma ide diagnostic ignored "cppcoreguidelines-narrowing-conversions"
#pragma ide diagnostic ignored "misc-no-recursi... | ALGO | 0.999917 | 5.112246 |
42fc7ed9-6dad-43fa-9c5e-7ea8be786a37 | pkduy2006/CVA | pttt/cvahn_dt01_tonghe16.cpp | #pragma GCC optimize(3)
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC target("avx","sse2")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffas... | ALGO | 0.999918 | 5.065937 |
8cf8d7a3-1b9b-49d0-aded-1db49ef46da5 | dnx4015/pbrt-importance-sampling | pbrt-v2-master/src/shapes/paraboloid.cpp | // shapes/paraboloid.cpp*
#include "stdafx.h"
#include "shapes/paraboloid.h"
#include "paramset.h"
// Paraboloid Method Definitions
Paraboloid::Paraboloid(const Transform *o2w, const Transform *w2o, bool ro,
float rad, float z0, float z1,
float tm)
: Shape(o2w, w2o, ro... | ALGO | 0.987437 | 6.690866 |
7a352c05-4173-4c2b-8c7f-768ddb7304ba | rahul-singh-takuli56/Competitve-Coding | Codeforces Round #835 (Div. 4)/B_problem.cpp | // 1st method
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
string s;
cin >> s;
cout << (int) (*max_element(s.begin(), s.end()) - 'a' + 1) << '\n';
}
return 0;
}
//2nd method by... | ALGO | 0.999765 | 5.804689 |
7fcf4412-bdea-485d-bd7a-db06ec0b6172 | ishandutta2007/codeforces | zhylj/normal/1684/E.cpp | #include <bits/stdc++.h>
#define gc() getchar()
template <typename T> inline void rd(T& x) {
int si = 1; char c = gc(); x = 0;
while(!isdigit(c)) si = c == '-' ? -1 : si, c = gc();
while(isdigit(c)) x = x * 10 + c - 48, c = gc();
x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args... | ALGO | 0.999903 | 3.629676 |
3f87bd99-9f75-40dc-9bc5-360460421287 | VenkataAnilKumar/LeetCode | Solutions/wordLadder.II.cpp | // Source : https://oj.leetcode.com/problems/word-ladder-ii/
// Author : Venkata Anil Kumar
/**********************************************************************************
*
* Given two words (start and end), and a dictionary, find all shortest transformation
* sequence(s) from start to end, such that:
*
* Onl... | ALGO | 0.999947 | 6.059464 |
d8db2e0d-f2c2-4bf8-a005-dfb3779f8c0d | TwilightLuigi/C-_Projects | mainClass/HashTable.cpp | // Sierra Sprungl
// Dr. Raymer
// CS 3100-01
// This is the hashtable class, this class will be used to implement the functions of the hashtable. The hashtable will be implemnted using
// an array of MAXHASH. The hashtable will be able to insert, search for, delete, return the loading fctor, overload the << operator s... | ALGO | 0.991306 | 5.166894 |
2521ec60-d7aa-465e-b5cd-1af068fa0458 | dxyzx0/eigen | unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.999564 | 4.659281 |
d12eb0ed-8599-405a-b986-69e094a593d6 | SubrataSft/flutterapp | 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.998733 | 6.76775 |
ce4cd376-bae3-4030-b305-1be1a49ec371 | danila-sosnov/P23024Lesson50Solution | Task02/logic.cpp | // ะกัะผะผะฐ ัะปะตะผะตะฝัะพะฒ [The sum of elements]
//
// ะะฐะฝะฐ ะผะฐัะตะผะฐัะธัะตัะบะฐั ะบะฒะฐะดัะฐัะฝะฐั ะผะฐััะธัะฐ ัะฐะทะผะตัะพะผ N.
// ะะตะพะฑั
ะพะดะธะผะพ ัะฐะทัะฐะฑะพัะฐัั ััะฝะบัะธั (ะธะปะธ ะฟัะพะณัะฐะผะผั),
// ะบะพัะพัะฐั ะฒััะธัะปัะตั ััะผะผั ัะปะตะผะตะฝัะพะฒ ะผะฐััะธัั,
// ัะฐัะฟะพะปะพะถะตะฝะฝัั
ะฝะฐ ะณะปะฐะฒะฝะพะน ะธ ะฟะพะฑะพัะฝะพะน ะดะธะฐะณะพะฝะฐะปัั
.
#include "logic.h"
int sum_main_and_second_diagonales_elements(int** m... | ALGO | 0.997428 | 4.216343 |
cdf12891-5e5e-42a1-a171-1080c54d58e9 | Sagorika28/C-plus-plus-codes | Simple input sum.cpp | #include <iostream>
#include<vector>
using namespace std;
int main() {
vector<int> arr;
int sum = 0;
int num;
while(true) {
cin>>num;
sum += num;
if(sum < 0) {
for(int i = 0; i<arr.size(); i++) {
cout<<arr[i]<<endl;
}
b... | ALGO | 0.999806 | 3.711528 |
ca153e68-da54-4cbd-aee8-532f0a81f45f | fazilnazkolambil/meat_admin | 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 |
12b5ba67-0507-4d31-a8cb-53775ab45182 | rohitkumarvatsh01/Cpp_Programming | Sorting And Searching/First and last occurance.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int>firstLastOccurance(int *arr, int n, int x){
vector<int>v;
//First Occurance
for(int i=0; i<n; i++){
if(arr[i]==x){
v.push_back(i);
break;
}
}
//Last Occurance
for(int i=n-1; i>=0; ... | ALGO | 0.999759 | 5.328065 |
e5ed55ee-f709-4c48-a826-d06c20a2c859 | alifalhasan/CP-code-vault | Codeforces/Codeforces Round/Codeforces Round 527 (Div. 3)/E - Minimal Diameter Forest/120419410.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
template<typename temp>using ordered_set = tree<temp, null_type, less_equal<temp>, rb_tree_tag,tree_order_statistics_node_update>;
//order_of_key(k) ... | ALGO | 0.999926 | 4.515557 |
401f4ded-ded2-44f2-80a5-3aa2bf37b9aa | hjiang13/LLMs-in-IR | POJ-104/69/815.cpp | #include <iostream>
using namespace std;
const int maxlen=255;
int main()
{
char str1[maxlen],str2[maxlen];
int a1[maxlen],a2[maxlen];
memset(a1,0,sizeof(a1));
memset(a2,0,sizeof(a2));
cin>>str1>>str2;
for(int i=0; i<strlen(str1); i++)
a1[i]=str1[strlen(str1)-1-i]-'0';
for(int i=0; i<strlen(str2); i++)
a2[i]=str2[strle... | ALGO | 0.999975 | 3.680379 |
81614374-82e6-4d75-a55c-108f07d545d0 | Rishil96/data-structures-and-algorithms | 04-Recursion/problems-16-to-17.cpp | #include <iostream>
#include <vector>
using namespace std;
// 16. Minimum Cost for Tickets
int minCostHelper(vector<int>& days, vector<int>& costs, int i) {
// Base Case
if (i >= days.size()) return 0;
// Ek Case
// 1. Use 1 day pass
int oneDayPass = costs[0] + minCostHelper(days, costs, i+1);
... | ALGO | 0.99933 | 5.020338 |
3c247ec1-f394-4404-ad31-ff6a59faf173 | m4oughi/100DaysofCode | pureCPP/0005. Day 5/Vector/005. Element Access/003. Accessing the First and Last Elements/main.cpp | #include <iostream>
#include <vector>
int main() {
std::vector<int> numbers = {100, 200, 300, 400, 500};
std::cout << "First element: " << numbers.front() << std::endl;
std::cout << "Last element: " << numbers.back() << std::endl;
return 0;
}
| ALGO | 0.977786 | 4.970424 |
ceeaca52-c0bd-46d1-b5a7-a2837db65830 | this-mkhy/Algorithm-and-Data-structures | 1-Algorithmic Toolbox/Week1-Welcome-Simple and challenge code/Assignments/Product/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
long long n,x;
cin>>n;
vector<int> a;
for(int i=0;i<n;i++)
{
cin>>x;
a.push_back(x);
}
sort(a.begin(),a.end());
if((a[0]*a[1])>(a[n-2]*a[n-1]))
cout<<(a[0]*a[1]);
... | ALGO | 0.999908 | 3.779427 |
4549ac0d-636f-4921-bc95-fdccd71edd4d | xkaper001/shoe_shopping_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.998776 | 6.763923 |
b16b89e2-c775-4649-b744-53f52158d997 | Jobayed1408/XPSC-PS | week 7/day 6/Reach Home.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t; cin>>t;
while(t--)
{
int n , m; cin>>n >> m ;
if((n*5) >= m) cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
| ALGO | 0.999768 | 4.501847 |
e4ff571a-0393-42c9-8948-d1b7fd3dc585 | pr7prashant/Leetcode | 198-house-robber/198-house-robber.cpp | class Solution {
public:
int solve(vector<int>& nums, int start, int prev, vector<vector<int>>& dp) {
if (start <= 0) return 0;
if (dp[start][prev] != -1) return dp[start][prev];
if (start < prev - 1) {
return dp[start][prev] = max(nums[start-1] + solve(nums, st... | ALGO | 0.999967 | 6.019834 |
6c32d48a-2466-42fc-bbe7-8ab84e41d4b0 | goldcirrus/cPlusCourseWork | homework2/module5/m5q1.cpp | #include <iostream>
#include <algorithm>
//#include <array> //c++ 11 not work for my version of CodeBlock
#include <iterator>
using namespace std;
int getLength(char *);
void toUpper(char *);
void toLower(char *);
void toProper(char *);
void toPattern(char *);
int main()
{
char name[80];
cout << "Enter... | ALGO | 0.893351 | 4.868359 |
59182d8a-943e-40a1-bcfe-10f4e347d2af | Dhruv1573/Data-Structure-Algorithm | codecef/Contests/code of waronline round/The Right One .cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int a;
for(int i=0;i<t;i++)
{
cin>>a;
int n=180-a;
if(360%n==0)
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}
}
| ALGO | 0.99987 | 3.835714 |
4d1dd7ed-afca-4467-bac7-8f9d1effa1dd | shahbazcse/DataStructures | Graph/eventualSafeStatesUsingDFS.cpp | // Link: https://practice.geeksforgeeks.org/problems/eventual-safe-states/1
// Approach: DFS + Hashing [TC: O(V+E) / SC: O(V)]
class Solution {
public:
bool dfs(int node, int vis[], int pathVis[], int safeNodes[], vector<int> adj[]){
vis[node] = 1; // mark nodes as visited
pathVis[node] = 1; // ... | ALGO | 0.999989 | 6.337777 |
d2ab5939-bb60-4dad-b508-8818942ed7c7 | 2505shivang/CodingNinjaDS-AlgoSolutions | Level-1/Recursion-2/PrintSubsetSumToK.cpp |
void printSubsetSumToK(int input[], int size, int k, int output[], int osize){
if(size==0){
if(k==0){
for(int i=0;i<osize;++i){
cout<<output[i]<<" ";
}
cout<<endl;
}
return;
}
printSubsetSumToK(input+1,size-1,k,output,osize);... | ALGO | 0.99927 | 4.70364 |
1e1d8677-8480-4e73-8724-26f441c65504 | fateneid/codeforces-solutions | training-sheets/assiut-sheet/contest-2/f_break_number.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int max = 0;
while(n--) {
long long x;
cin >> x;
int count = 0;
while(x % 2 == 0) {
x /= 2;
count++;
}
if(count > max) {
max = count;
}
}
cout << max;
return 0;
}
| ALGO | 0.999851 | 4.544864 |
31f320ec-6e9a-4d62-89ff-5f9a99d2bdb0 | Winterleaf/DNT-Torque3D-V1.1-MIT-3.0 | Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp | #include "btMultiSapBroadphase.h"
#include "btSimpleBroadphase.h"
#include "LinearMath/btAabbUtil2.h"
#include "btQuantizedBvh.h"
/// btSapBroadphaseArray m_sapBroadphases;
/// btOverlappingPairCache* m_overlappingPairs;
extern int gOverlappingPairs;
/*
class btMultiSapSortedOverlappingPairCache : public btSortedOv... | ALGO | 0.978281 | 4.5585 |
751a044b-0b05-4e28-9e71-c7f0e3071837 | md1894/c-ds | timeAndSpaceComplexity/pairSumInArray.cpp | /*
Pair sum in array
Send Feedback
Given a random integer array A and a number x. Find and print the pair of elements in the array which sum to x.
Array A can contain duplicate elements.
While printing a pair, print the smaller element first.
That is, if a valid pair is (6, 5) print "5 6". There is no constraint that o... | ALGO | 0.999975 | 4.824166 |
6fcb2572-270b-4c75-9f06-e72807cadb68 | ishandutta2007/codeforces | s2speed/normal/959/F.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
#define all(x) x.begin() , x.end()
#define sze(x) (ll)(x.size())
#define mp(x , y) make_pair(x , y)
#define wall cerr<<"--------------------------------------"<<endl
typedef long long int ll;
typedef pair<ll , ll> pll;
typedef pair<int , int... | ALGO | 0.9999 | 3.902611 |
ba0237c5-9a40-48cf-a75f-4d5dfb189547 | hcccrypto/hcc | src/chainparams.cpp | #include <chainparams.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
#include <arith_uint256.h>
#include <assert.h>
#include <chainparamsseeds.h>
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, ... | CONFIG | 0.956113 | 3.821624 |
bcae348a-eeac-4d35-91e0-bf75cd2f696f | hoangb0410/Advanced_Programming | Home/TH3/Bai10.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;
bool kt=true;
for (int i=0;i<s.size();i++)
{
if (!isalpha(s[i])&&!isdigit(s[i]))
{
cout<<"Invalid username.";
exit(0);
}
}
if (s.size()... | TOOL | 0.927433 | 3.388592 |
9eae2dc9-0a17-4dd6-921f-744655fb277e | dgalaktionov/compact-trip-representation | libcds/libcds2/src/static/sequence/wt_coder_Suboptimal.cpp | #include <sequence/wt_coder_Suboptimal.h>
#include <climits>
namespace cds_static
{
uint wt_coder_Suboptimal::countingSort(uint *_freqs, uint max_v, uint *&new_order){
uint *freqs = new uint[max_v+1];
for (uint i=0;i<=max_v;i++)
freqs[i]=_freqs[i];
uint *origFreqs = new uint[max_v+1];
for ... | ALGO | 0.999907 | 4.687687 |
cfa3030f-b46a-421d-aa5f-bec65aa85c70 | AmanouToona/ABC | ABC229/E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
class UnionFind {
vector<int> p, rank, member_size;
int comp;
public: UnionFind(int n): p(n), rank(n, 0), member_size(n, 1){
for (int i = 0; i < n; i++) {
p[i] = i;
}
comp = n;
}
int c() {
... | ALGO | 0.999975 | 4.669306 |
e4ff40c9-c22f-42cc-9711-17a746f71404 | adityajain1677/Movie-Booking | Cplusplus-master/Cplusplus-master/Char_to_ASCII/Char_to_ASCII.cpp | #include<iostream>
using namespace std;
int main(){
char character;
cout<<"Enter the character ";
cin>>character;
cout<<"ASCII value of character "<<character<<" = "<<(int)character;
return 0;
} | TOOL | 0.959721 | 3.856252 |
2157a957-d3dc-4e14-a01a-ed420004f07a | asSqr/AtCoder | ARC121 A.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=... | ALGO | 0.999971 | 4.503561 |
19914f6e-88e8-44a8-aa9e-ab6ccd75e333 | rkadam61001/6Companies30days- | GoldmanSachs/fifth.cpp | //https://practice.geeksforgeeks.org/problems/ugly-numbers2254/1/
/* Function to get the nth ugly number*/
ull getNthUglyNo(int n) {
// code here
long arr[n];
long num2=2;
long num3=3;
long num5=5;
long i2,i3,i5;
i2=0;
i3=0;
i5=0;
long nextugly=1;
arr[0]= nextu... | ALGO | 0.999763 | 4.668915 |
06d841b7-d1eb-4b4f-9d89-944d69970ec6 | linjiafengyang/c-and-cpp | DataStructure/็ฎๆณ/้้ๅฝๆฒกๆๅคฑๅฟ็.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
enum Error_code{not_present, success};
Error_code binarySearch(int p[10], const int& x, int bottom, int top, int& position)
{
while(bottom <= top)
{
int mid = (bottom + top) / 2;
if(x < p[mid])
top = mid - 1;
else if(x > p[mid])
bottom = mid ... | ALGO | 0.999458 | 3.920231 |
7573da49-3254-4581-96ec-4ff1f6a91572 | PauloGN/DataStructure | 06 Binary tree/BST/Source.cpp | #include <iostream>
#include "BinaryTree.h"
int main()
{
BinaryTree bst;
bst.Insert(Student(4, "PPP"));
bst.Insert(Student(6, "PPP"));
bst.Insert(Student(1, "PPP"));
bst.Insert(Student(3, "PPP"));
bst.Insert(Student(5, "JJJ"));
bst.Insert(Student(7, "PPP"));
bst.Insert(Student(2, "PPP"));
Student st(3, "")... | ALGO | 0.997842 | 3.986398 |
add42078-47ec-41d7-9ee6-b57550421e14 | amitbansal7/Data-Structures-and-Algorithms | 13.Dynamic-programming/LongestIncreasingSubsequence.cpp | /* Amit Bansal - @amitbansal7 */
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
//Longest increasing subsequence
int main()
{
int seq[] = {3, 4, -1, 0, 6, 2, 3};
int n = sizeof(seq) / sizeof(seq[0]);
int DP[n];
for (int i = 0; i < n; i++)
DP[i] = 1;
for (int i = 1; i < n; i++)
for (int... | ALGO | 0.999914 | 4.124589 |
f6033d28-652b-446a-b7f3-c83625eb244a | sarthaknarain2x/DSA-Practice | Beginner's SDE Sheet/maximum sum of non-adjacent nodes.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999733 | 6.947742 |
8bd8b8d6-e887-45a3-80cb-f44fe4a6839a | anas092121/Leetcode-Solutions | 2493-reverse-odd-levels-of-binary-tree/2493-reverse-odd-levels-of-binary-tree.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
class Solution {
public:
TreeNode* reverseOddLevels(TreeNode* root) {
queue<TreeNode*> Q;
Q.push(root);
bool toReverse = false; // Start with even level (0)
while (!Q.empty()) {
int levelSize = ... | ALGO | 0.999979 | 6.061387 |
9e33e8fa-ad27-41e8-af8d-fb72d618cf36 | Abdul-Samad-1020/DSA | DSA/LeetCode/LeetCode-master/LeetCode-master/C++/354. Russian Doll Envelopes.cpp | class Solution {
public:
int maxEnvelopes(vector<pair<int, int>>& envelopes) {
sort(envelopes.begin(), envelopes.end(), [](pair<int, int>& p1, pair<int, int>& p2){
return p1.first == p2.first ? p1.second > p2.second : p1.first < p2.first;
});
vector<int>dp;
for(auto x: en... | ALGO | 0.999997 | 6.038363 |
df06ad92-a8d5-4cf6-94e4-45fd2b4a54c8 | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | TJU/1078 - Alien Security.cpp | #include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
vector< vector<int> > G;
int V,ET;
bool *p;
bool canReachWithout(int x){
if(x==0) return false;
memset(p,false,sizeof(bool)*V);
queue<int> Q;
Q.push(0);
int aux;
*p = true;
while(!Q... | ALGO | 0.999884 | 4.322737 |
054cc231-8580-45df-93e8-fff489be5f3c | Minggyul/NAVY_algorithm_study | WEEK7/gihyeon/14890.cpp | #include <iostream>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
using namespace std;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int N,K;
int board[102][102];
void input(){
cin>>N>>K;
for(int i = 1 ; i <= N ; i++){
for(int j = 1 ; j <= N ; j++){
... | ALGO | 0.999813 | 3.209734 |
6c7383df-4ffb-4103-a236-7bab9768eb38 | codepilgrimz/hyperNEAT | fuego-0.4/gouct/GoUctDefaultPriorKnowledge.cpp | //----------------------------------------------------------------------------
/** @file GoUctDefaultPriorKnowledge.cpp
See GoUctDefaultPriorKnowledge.h
*/
//----------------------------------------------------------------------------
#include "SgSystem.h"
#include "GoUctDefaultPriorKnowledge.h"
using namespace s... | ALGO | 0.994197 | 6.206688 |
05caf238-6422-4ab6-aa76-0e47d4e70738 | chengshunzhang/my_leetcode | 201-300/253_Meeting_Rooms_II/253_Meeting_Rooms_II.cpp | #include <vector>
#include <iostream>
using namespace std;
// Definition for an interval.
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
bool myComp(Interval interval1, Interval interval2) {
return interval1.start < interval2.... | ALGO | 0.999988 | 6.239717 |
e13efbc2-63b3-416a-b882-0fc2addfc244 | shreyatpandey/Coding-Challenges | C++/Binary-Tree/Binary Tree Level Order Traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
vector<vector<int>>level_order_value;
... | ALGO | 0.999959 | 5.892467 |
19c20a05-84c6-4a49-ab11-7a714453d8c0 | CJSBinder-User/CJSBinder | experiment/correctness_efficiency/groundtruth/cpp/WRITE_A_C_PROGRAM_TO_FIND_THE_PARITY_OF_AN_UNSIGNED_INTEGER.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
bool f_gold ( unsigned int n ) {
bool parity = 0;
while ( n ) {
parity = ! parity;
n = n & ( n - 1 );
}
return parity;
}
//TOFILL
int main() {
... | ALGO | 0.999175 | 5.378531 |
4c51df9c-746f-4b08-b9ed-1ac519231329 | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_correct/cpp_correct_test_62_7.cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 1005;
long long n, m, q, ans;
bool vizitat[N][N];
long long dp[N][N][2];
bool verifica(long long i, long long j) {
if (i < 1 || j < 1 || i > n || j > m) return false;
return true;
}
long long cnt(long long i, long long j) {
long long answer = 0;
... | ALGO | 0.999839 | 4.567322 |
9d05b2e9-1fe4-4ed9-8824-6c2ab33b51e9 | wcysai/Calabash | Discover Vladivostok 2019. Division A Day 1/H.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define Rep(i, n) for (int i = 1; i <=int(n); i++)
#define range(x) begin(x), end(x)
#ifdef __LOCAL_DEBUG__
#define _debug(fmt, ...) fprintf(stderr, "[%s] " fmt "\n", __func__, ##__VA_ARGS__)
#else
#define _debug(...) ((vo... | ALGO | 0.999914 | 3.942342 |
92de3760-d130-42ee-86b0-ff8832ff1b94 | kimheonningg/baekjoon-cpp | q2252.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> edges(N+1, vector<int>(0,0));
vector<int> in_degree(N+1, 0);
for(int i = 0; i < M; i++) {
int A, B;
cin >> A >> B;
// A must be infront of B
... | ALGO | 0.999999 | 4.581989 |
3bc1f827-e06a-4c77-aaef-381c817d2c97 | Khushikamra/Leetcode | 1364-tuple-with-same-product/1364-tuple-with-same-product.cpp | class Solution {
public:
int tupleSameProduct(vector<int>& nums) {
int n = nums.size();
int tuple = 0;
sort(begin(nums), end(nums));
for(int i = 0; i < n; i++){
for(int j = n-1; j > i; j--){
unordered_set<int>st;
int product = nums[i] * num... | ALGO | 0.9999 | 5.596479 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.