uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b2a75369-c132-4b00-af3f-762d9c5f205a | jciglesias/piscine-cpp | module07/ex01/main.cpp | // ************************************************************************** //
// //
// ::: :::::::: //
// main.cpp :+: :+: :+: ... | TOOL | 0.877295 | 4.915085 |
eda38408-ffc1-40fd-846f-bb0e8cc381a3 | AmarjeetJyotis/GeeksForGeeks- | Difficulty: Medium/Detect Loop in linked list/detect-loop-in-linked-list.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* next;
Node(int val) {
data = val;
next = nullptr;
}
};
void loopHere(Node* head, Node* tail, int position) {
if (position == 0)
return;
Node* walk = head;
for (int i... | ALGO | 0.999579 | 5.49927 |
dbe2b9fe-647d-4f41-a4b1-5aa6d0afd3a3 | hemu789/Cpp-Adv-Practice | ARRAY/Leader.cpp | #include <bits/stdc++.h>
using namespace std;
void leader(int arr[], int n)
{
int curr_ldr = arr[n - 1]; // Last val is always leader
cout << curr_ldr << " ";
for (int i = n - 2; i >= 0; i--)
{
if (curr_ldr < arr[i])
{
curr_ldr = arr[i];
cout << curr_ldr << " "... | ALGO | 0.999958 | 4.358845 |
c669b861-fecc-4983-826d-bef28f2a84e4 | mertturkmenoglu/cpp | src/stl/algorithm/Partition/E001_IsPartitioned/main.cpp | /**
* is_partitioned() example
* "g++ main.cpp -std=c++17 -Wall -Wextra -Wnon-virtual-dtor -pedantic -g -o main"
* valgrind --leak-check=yes -v ./main
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
int main() {
std::vector<int> vector = { 5, 1, 6, 2, 7, 3, 8, 4 };
std::... | TOOL | 0.994646 | 6.029948 |
2e9e0c75-bb27-4f0d-990a-1fe256b1dbb8 | mapleyustat/Network_Dynamics | SocialNetworkAlgorithm.cpp | #include "SocialNetworkAlgorithm.h"
std::vector<std::pair<long,double>> SocialNetworkAlgorithm::getIdDistancePairs(long startId,int DFSlimit){
std::vector<std::pair<long, double>> retVector;
std::map<long,bool> isVisited;
isVisited[startId]=true;
Graph::adjacency_iterator vertexIt, vertexEnd;
boost... | ALGO | 0.99779 | 4.837168 |
8f9ed2e3-d1c6-462f-8796-ef609ee65332 | suman105/GeeksforGeeks-DSA-Solutions | Basic/Binary Array Sorting/binary-array-sorting.cpp | //{ Driver Code Starts
// A Sample C++ program for beginners with Competitive Programming
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// A[]: input array
// N: input array
//Function to sort the binary array.
void binSort(int A[], int N)
{
... | ALGO | 0.999897 | 6.023112 |
e598df50-f3fe-40f6-a638-fb2ce788faa0 | inf0craw1/algorithm | baekjoon/27323.cpp | #include <iostream>
#define debug if constexpr (local) std::cout
#define endl '\n'
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#ifdef LOCAL
constexpr bool local = true;
#else
constexpr bool local = false;
#endif
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
/* -... | ALGO | 0.97692 | 4.054904 |
5883c252-10ac-4afc-8c6b-faeda13953c8 | ZCube/boost-cmake | libs/multiprecision/example/safe_prime.cpp | //[safe_prime
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/miller_rabin.hpp>
#include <iostream>
#include <iomanip>
int main()
{
using namespace boost::random;
using namespace boost::multiprecision;
typedef cpp_int int_type;
mt11213b base_gen(clock());
independent_bits_en... | ALGO | 0.997245 | 5.997166 |
fc239e57-d5b3-436e-9846-9c9befd84373 | kunal2630/CODING | Graphs/BFS/Minimum Genetic Mutation.cpp |
/*
We have to change starting word to ending word , so at a time we are allowed to change 1 characters from starting word and if after changing letter of the word if the new word which formed is present in bank then it will be 1 mutation ,so we have return such min number of mutation
Whenever there is qu... | ALGO | 0.999972 | 5.762069 |
fd84d3e1-6e69-4b8d-9d18-a245a419c25a | ca2/operating_system-posix | innate_ui_gtk4/time/aaa_callstack.cpp | #include "framework.h"
#include "acme/operating_system.h"
#undef Context
#undef Node
#include "callstack.h"
#include <malloc.h>
#define WORK_AROUND_SRCLINE_BUG
#pragma warning(disable: 4091)
#include <ImageHlp.h>
// The following is defined for x86 (XP and higher), x64 and IA64:
#define GET_CURRENT_CONTEXT(pc, cont... | TOOL | 0.926561 | 3.025628 |
8bec8815-7644-437f-b68a-ba54588a45a2 | btc-free-mining/https-github.com-settings-organizations | src/index/blockfilterindex.cpp | #include <map>
#include <dbwrapper.h>
#include <index/blockfilterindex.h>
#include <node/blockstorage.h>
#include <util/system.h>
/* The index database stores three items for each block: the disk location of the encoded filter,
* its dSHA256 hash, and the header. Those belonging to blocks on the active chain are ind... | TOOL | 0.963091 | 6.433329 |
6f601527-7fe8-4e24-a10d-32618a9f33e4 | ShubhamVaidya26/Data_Structure_Codes | Stack/Generic_Stack.cpp | /*
Generic Stack in C++ Programming
Containts : Push Function
Pop Function
Display Function
*/
#include<iostream>
using namespace std;
template<class T>
struct SNode
{
T Data;
struct SNode * Next;
};
template<class T>
class Stack
{
public :
struct... | ALGO | 0.873393 | 5.131698 |
4b1a6959-7d64-4c7d-a7f9-aa83f5324c4c | KansaiUser/ExtendedKalmanFilter | src/kalman_filter.cpp | #include "kalman_filter.h"
#include <math.h>
#include <iostream>
using Eigen::MatrixXd;
using Eigen::VectorXd;
/*
* Please note that the Eigen library does not initialize
* VectorXd or MatrixXd objects with zeros upon creation.
*/
KalmanFilter::KalmanFilter() {}
KalmanFilter::~KalmanFilter() {}
void KalmanFi... | ALGO | 0.977503 | 5.155698 |
53a5c261-ab63-40e5-9904-3bc02c0e6df7 | tofuwen/icpc-Rujia-Liu | Beginning_Algorithm_Contests_Second_Edition/aoapc-bac2nd-master/ch4/comb-mingw.cpp | #include<stdio.h>
// 计算组合数的一种方法
long long C(int n, int m)
{
return factorial(n)/(factorial(m)*factorial(n-m));
}
// 计算组合数的另一种方法,可以解决更大规模的问题
long long C2(int n, int m) {
if(m < n-m) m = n-m;
long long ans = 1;
for(int i = m+1; i <= n; i++) ans *= i;
for(int i = 1; i <= n-m; i++) ans /= i;
return ans;
}
lo... | ALGO | 0.999786 | 3.704098 |
859cf474-731f-40d7-a8cc-d7f68c560822 | manish-kumar1/LeetCode-Problems | Two Pointers/Roteta_Array.cpp | /*
Q. Roteta Array
Given an integer array nums, rotate the array to the right by k steps,
where k is non-negative.
Example 1:
Input: nums = [1,2,3,4,5,6,7], k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the right: [6,7,1,2,3,4,5]
rotate 3 steps to the right... | ALGO | 0.99999 | 5.171811 |
f431bf7c-d13c-4ce6-8e7b-63e4e07b93a5 | flyingSnow-hu/games202 | 2/prt/ext/eigen/doc/examples/class_FixedVectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived, 2>
firstTwo(MatrixBase<Derived>& v)
{
return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);
}
template<typename Derived>
const Eigen::VectorBlock<const Derived, 2>
firstTwo(c... | TOOL | 0.970966 | 5.200637 |
d313fbf8-202b-4ab7-9501-baf1301a898f | XXXLight/C_plus_plus | 链表/链表中的两数相加.cpp | #include<bits/stdc++.h>
using namespace std;
//ڵĶ
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* pre = NULL;
ListNode* curr = head;
while (curr) {
ListNode* nextp = curr->next;
curr->next ... | ALGO | 0.999878 | 5.530315 |
8c8f94c2-bb95-40eb-a8be-cf323cd9f4ef | imatyukin/cpp | BeginningCPP17/Chapter07/ex7_05.cpp | // Searching within substrings
#include <iostream>
#include <string>
int main()
{
std::string text{}; // The string to be searched
std::string word{}; // Substring to be found
std::cout << "Enter the string to be searched and press Enter:\n";
... | ALGO | 0.997395 | 5.806022 |
dc24f4d7-222d-4a3d-a3e4-f8ef3723b2d2 | divcs/DSA-Practice-Learning | Platforms/Strivers/Arrays/Easy/Remove duplicates in-place from sorted array/optimal_approach.cpp | #include <iostream>
#include <vector>
using namespace std;
int removeDuplicates(vector<int> &nums)
{
int s = nums.size();
if (s == 0)
return 0; // Handle empty vector edge case
int left = 0;
for (int right = 1; right < s; right++)
{
if (nums[right] != nums[left])
{
nums[left + 1] = nums[right];
left... | ALGO | 0.999891 | 5.735561 |
00a9ac6b-66c1-4992-aa6a-c21c5f216cfc | Vivek-Rathod14/DSAWithCPP | PR9/Stack.cpp | #include<iostream>
using namespace std;
class Stack{
private:
int *arr;
int top;
int capacity;
public:
Stack(int size) {
capacity = size;
arr = new int[capacity];
top = -1;
}
bool Full(){
return top == capacity - 1;
}
bool empty() {
return top == -1;
}
bool EMPTY() {
if (empty... | ALGO | 0.983699 | 3.761627 |
76ce58a5-f638-4456-9af0-fc9d19c5add5 | Idris110/Sem-4-MU | College labs/OS/5/lru.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
cout << "Enter page size:\n";
int p;
cin >> p;
vector<int> pages;
cout << "Enter string length:\n";
int n;
cin >> n;
vector<int> a(n);
cout << "Enter page string:\n";
for(int i=0; i<n; i++) {
cin >... | ALGO | 0.999806 | 3.290161 |
f7203e5e-0b3e-42da-96bb-bd07115438c4 | ishandutta2007/codeforces | lucina/normal/1626/F.cpp | #include<bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
void plusle(int &a, int b){a+=b;if(a>=MOD)a-=MOD;}
void minun(int &a, int b){a-=b;if(a<0)a+=MOD;}
int add(int a, int b){a+=b;if(a>=MOD)a-=MOD;return a;}
int sub(int a, int b){a-=b;if(a<0)a+=MOD;return a;}
int mul(int a, int b){return 1ll*a*b%MOD;}
... | ALGO | 0.999944 | 4.179673 |
b5b40781-8b82-4990-bd68-2ac10d287892 | ProjectStreak/platform_packages_modules_adb | daemon/jdwp_service.cpp | #if !ADB_HOST
#if !defined(__ANDROID_RECOVERY__)
#define TRACE_TAG JDWP
#include "sysdeps.h"
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <list>
#include <memory>
#include <thread>
#includ... | TOOL | 0.864538 | 7.265304 |
aaa6a739-5391-42e8-80ca-e0c011f57d60 | shulingWarm/OrthographicDenseMatching | src/openMVG/linearProgramming/lInfinityCV/resection_kernel.cpp | // This file is part of OpenMVG, an Open Multiple View Geometry C++ library.
#include "openMVG/linearProgramming/bisectionLP.hpp"
#include "openMVG/linearProgramming/linearProgrammingInterface.hpp"
#include "openMVG/linearProgramming/linearProgrammingOSI_X.hpp"
#include "openMVG/linearProgramming/lInfinityCV/resection... | ALGO | 0.999958 | 6.552591 |
07fa1727-6de6-4b03-9561-284a64afff15 | pabloescoder/dsa | Dsa Questions/Cpp/Arrays/TrappingRainwater.cpp | // https://practice.geeksforgeeks.org/problems/trapping-rain-water/0
// References:-
// https://www.youtube.com/watch?v=ZI2z5pq0TqA
// https://www.geeksforgeeks.org/trapping-rain-water/
#include <iostream>
#include <algorithm>
// Given an array arr[] of N non-negative integers representing the height of blocks.
// If ... | ALGO | 0.999977 | 7.201027 |
1d4b663a-4ee3-4a6b-a4d9-dbf4e268b36a | f-a-h-a-d/MY-OJ-SOLUTIONS | Timus/Staircases.cpp | #include<bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)
#define lcm(a,b) (a * (b / __gcd(a,b)))
#define en '\n'
#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi 0x3f3f3f3f
#define LInfi 0x3f3f3f3f3f3f3f3f
... | ALGO | 0.999788 | 3.448301 |
d01f5f8b-3bd6-4c88-96f4-f87fc642a3f3 | pptale/2025-01-CP | quiz-11-20001.cpp | #include <iostream> //importing an inbuilt library
#include <vector>
using namespace std;
// Function to compute the number of steps in the Collatz Conjecture sequence
int collatzSteps(int n) {
int steps = 0;
while (n != 1) {
if (n % 2 == 0) {
n /= 2;
} else {
n = 3 *... | ALGO | 0.999797 | 5.524691 |
920bd764-93c1-46c8-9740-24a45a5805fa | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/BlackJack_20210108181050.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999985 | 3.474334 |
41b86fb9-4c96-4c43-a82f-b93b28624e71 | devanshcs22/c-programes | lab3.cpp | #include<stdio.h>
int main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++);
{
for(j=1;j<i;j++);
{
printf(" ");
}
for(k=i;k>=1;k--);
{
printf("*");
}
printf("\n");
}
} | ALGO | 0.999921 | 3.418443 |
e1df9770-a78f-4b86-a171-a7f2473d1e10 | shawamar/InterviewBit | Trees/Boundary Traversal Of Binary Tree.cpp | /**
Boundary Traversal Of Binary Tree
Given a binary tree. Given a binary tree, return the values of its boundary in anti-clockwise direction starting from the root.
Boundary includes left boundary, leaves, and right boundary in order without duplicate nodes. Left boundary is defined as the
path from the root to the ... | ALGO | 0.999998 | 5.691587 |
4e89e308-86df-4636-a27f-cd0cf2c0454e | Kunalgarg108/Cpp_Codes | Example2.cpp | #include<bits/stdc++.h>
using namespace std;
void Prim(vector<pair<int,int>> adj[],int V,int S){
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,S});
int sum=0;
vector<int> vis(V,0);
while(!pq.empty()){
auto it=pq.top();
pq.pop();
int... | ALGO | 0.999783 | 3.899542 |
4a34357b-fac2-45eb-9eda-2b05eb41d19d | xufei1006/cpp_primer | src/ch07/exercise7_1.cpp | #include <iostream>
#include <string>
using std::cin; using std::cout; using std::endl; using std::string;
struct Sales_data
{
string bookNo;
unsigned units_sold = 0;
double revenue = 0.0;
};
int main()
{
Sales_data total;
if (cin >> total.bookNo >> total.units_sold >> total.revenue)
{
Sales_data trans;
whi... | TOOL | 0.91811 | 4.216749 |
2fc9e749-1ec5-4d63-a3d7-76d7499cbd42 | soban09/DSA-Problems | Heaps/6_FrequencySort.cpp | #include<iostream>
#include<queue>
#include<unordered_map>
#include<vector>
using namespace std;
typedef vector<int> vi;
typedef unordered_map<int, int> m;
typedef pair<int, int> p;
// Max Heap
typedef priority_queue<p> pr;
vi TopKFreq(int *arr, int n, int k){
pr Heap;
vi v;
m mp;
for(int i=0; i<n; i... | ALGO | 0.999967 | 4.930299 |
8f42ed4c-77b6-4f97-974f-8ea24c0641a1 | shubhangi-dwivedi/Data-Structures-and-Algorithms-SOLUTIONS | LEETCODE/LEETCODE-CPP/344.cpp | //344. Reverse String
//https://leetcode.com/problems/reverse-string/
class Solution {
public:
void reverseString(vector<char>& s)
{
int start=0, end=s.size()-1;
for(int i=0;i<s.size()/2;i++)
swap(s[start++],s[end--]);
}
}; | ALGO | 0.998624 | 5.998569 |
cab71053-caa3-463f-8b9b-dcf870f6922e | Fang0105/APCSpractice | tcircjudge/d012.cpp | #include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define ull unsigned long long
#define IL(X) ((X)*2+1)
#define IR(X) ((X)*2+2)
using namespace std;
int MAX = LONG_MAX;
int MIN = LONG_MIN;
int pow2(int a,int b,int c){
int ans=1;
a=a%c;
while(b!=0){
if(b&1){
ans=(ans*a)%c; ... | ALGO | 0.999966 | 4.529397 |
d7a59b25-a47d-43ec-909f-6adcc797bbc7 | algorithm-haneun-42/algorithm | 53th/somilee/rescue_princess.cpp | #include <iostream>
#include <queue>
using namespace std;
int n, m, t;
int ans = 0xfffffff;
int map[105][105];
int vis[105][105];
pair<int, int> s;
int dx[4] = {0,-1,0,1};
int dy[4] = {1,0,-1,0};
int main(void) {
cin >> n >> m >> t;
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
cin >> map[i][j];
... | ALGO | 0.999873 | 5.12093 |
a1edcea3-9e02-444c-a08b-951d51da15df | PaulOberg1/cnn-from-scratch | eigen/eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.998836 | 3.497552 |
0e6d3924-84f2-460c-a283-9abd28815c0f | jacke121/push_image_to_rtsp | hik_client_dll/opencv/sources/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp | /**
* @file HoughLines_Demo.cpp
* @brief Demo code for Hough Transform
* @author OpenCV team
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
/// Global variables
/** General variables */
Mat src, edges... | ALGO | 0.951592 | 6.765508 |
3f00b77a-6b04-496c-bbc2-c96397c337f8 | Dhairya024/week1-CPP5-CipherSchools | lecture2/funcOverload.cpp | #include <bits/stdc++.h>
using namespace std;
// ================Function Overloading=========================
int maxi(int num1, int num2)
{
if (num1 > num2)
return num1;
else
return num2;
}
int maxi(int num1, int num2, int num3)
{
if (num1 > num2)
{
if (num1 > num3)
... | ALGO | 0.999767 | 4.673754 |
59f96b5b-13ea-4ad9-94b7-46c878537335 | GaurishIIITNR/CP-Problems-Solutions-2 | Pseudo_Sorted_Array.cpp | // Created by Mahadev_devote
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
// ios_base::sync_with_stdio(0);
// cin.tie(0);
ll tc;
cin >> tc;
while (tc--)
{
ll n;
cin >> n;
vector<ll> v(n);
ll cnt = 0;
for (ll i = 0; i... | ALGO | 0.99996 | 4.430207 |
f0bd63bf-28cf-45ae-8347-28c9c90fd9bc | swayamprogramator/Cpp | OOPs in Cpp College work/time_sum.cpp | #include<iostream>
using namespace std;
class time{
int hr;
int min;
int sec;
public:
time(int h,int m,int s){
hr=h;
min=m;
sec=s;
}
void hour_sum(time t1,time t2){
sec=(t1.sec+t2.sec)%60;
min=((t1.sec+t2.sec)/60 + (t1.min + t2.min)%60)%60;
hr=... | ALGO | 0.996252 | 4.127316 |
7c006aee-fa5d-420d-ad8e-3cc5f62cd1fd | HongSon28/Training | Online Judges/Vnoj/fc128_sequenceweight.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e4;
int t,n,a[N+5],c[N+5];
long long dp[N+5];
vector<int>cprs;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>t;
while (t--) {
cprs.clear();
cin>>n;
for (int i=1;i<=n;i++) {
cin>>a[i... | ALGO | 0.999863 | 4.260851 |
92f4b812-900f-48ba-9961-e06dc574aa7d | hohaidang/CPP_Basic2Advance | LeetCode/215. Kth Largest Element in an Array/source.cpp | class Solution {
public:
int partition(vector<int> &nums, int left, int right) {
int pivot_idx = left + (rand() % (right - left + 1));
std::swap(nums[pivot_idx], nums[right]);
int pivot = nums[right];
int i = left - 1;
for(int j = left; j <= right; ++j) {
if(nu... | ALGO | 0.999986 | 5.243063 |
f83b4e9f-3a23-46f5-9fe0-f10d665f30cc | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/cgal/CGAL-4.14.3/examples/Convex_hull_3/extreme_indices_3.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Extreme_points_traits_adapter_3.h>
#include <CGAL/IO/read_off_points.h>
#include <boost/iterator/counting_iterator.hpp>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructi... | ALGO | 0.993533 | 5.300375 |
093a15cc-7492-4f37-be26-e8064c52f8c9 | jz769491062/Leetcode_Self | Code/Graphs/1584. 连接所有点的最小费用-Kruskal.cpp | class Solution {//https://mp.weixin.qq.com/s/dJ9gqR3RVoeGnATlpMG39w
public:// https://leetcode.cn/problems/min-cost-to-connect-all-points/description/
// 本题m == n^2 所以O(n^2logn)
int minCostConnectPoints(vector<vector<int>>& points) {
// 算一下曼哈顿距离,剩下的就是Kruskal算法,和1135一致
int n = points.size();
... | ALGO | 0.999984 | 5.870318 |
9a089fd5-bbfc-474e-b439-9d1bd7113a05 | kennent/for_scsc_code_save | solved_arena/#016_SciOI2023/c2.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int t;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> t;
while (t--) {
int n, cnt[4] = {1}, cur = 0, x;
cin >> n;
if (n == -1) return 0;
for (int i = 2; i <= n; i++) {
cout << "diff " << i-1 << " ... | ALGO | 0.999185 | 3.274916 |
1c33cf6e-4746-4b1c-86fe-bc856f636ff7 | ktorseth/syncmaster | omnetprojects/boost_1_78_0/libs/spirit/example/qi/key_value_sequence_empty_value.cpp | // The purpose of this example is to show how to parse arbitrary key/value
// pairs delimited by some separator into a std::vector. The difference to
// the example 'key_value_sequence.cpp' is that we preserve the order of the
// elements in the parsed sequence as well as possibly existing duplicates.
// In addition ... | TOOL | 0.939085 | 6.341355 |
adb19bbd-cfd2-4d1c-b8ed-fd9d45c59b4e | ISOLDE-Project/riscv-llvm | libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// sort(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <vector>
#include <cassert>
... | TEST | 0.983853 | 5.644898 |
6868d263-0362-4604-9a7f-922311d8742f | pratyush2905/cfprog | D_Black_and_White_Stripe.cpp | #include <bits/stdc++.h>
#define int long long
#define fr(a, b) for (int i = a; i < b; i++)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
string s;
cin >> s;
int w=0;int b=0;i... | ALGO | 0.999845 | 4.407459 |
ceb6035e-d094-437f-859c-fb4d1fcc6c18 | Arpit-AD/LeetCode | Column name from a given column number - GFG/column-name-from-a-given-column-number.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
string colName (long long int n)
{
// your code here
string s = "";
while(n){
char c = 'A' + (n-1)%26;
s = c + s;
n = (n-1)/26;
... | ALGO | 0.999929 | 5.53763 |
e6077fb5-7980-4040-a90f-b323ef2d5ff3 | chinmayg/ece2524 | homework7/consumer.cpp | #include <unistd.h>
#include <iostream>
int main() {
double num;
double total=0;
size_t lines=0;
while(std::cin >> num) {
std::cout << "Consumer[" << getpid() << "] received line: " << num << std::endl;
total += num;
++lines;
}
std::cout << total << "/" << lines << "=" << total/lines << std:... | TOOL | 0.943254 | 3.912458 |
4e06a728-5230-4dd7-9f78-b4c0fa39e37a | CedricKuang/LeetCode | easy/806.number-of-lines-to-write-string.cpp | /*
* @lc app=leetcode id=806 lang=cpp
*
* [806] Number of Lines To Write String
*/
// @lc code=start
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> numberOfLines(vector<int>& widths, string s) {
vector<int> result = {0, 0};
for (int i = 0; i < s.l... | ALGO | 0.999754 | 6.40731 |
03b13a7d-b359-4c5a-b385-adb4e577ac9e | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4225_10.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
int n, m;
set<pair<int, int> > odd;
set<pair<int, int> > even;
map<int, int> saveN;
vector<int> noa;
vector<int> nea;
int a[MAX_N];
int on, en;
vector<int> surplusE, surplusO, surplus;
bool changed[MAX_N] = {0};
void process() {
int pointerO = 0;... | ALGO | 0.999987 | 3.796832 |
ca539795-1de1-4930-a5ee-0f6014d3265f | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/16/03/19.cpp | #include<bits/stdc++.h>
using namespace std;
const int inf = 1000000001;
const int MOD = 1000000007;
typedef long long Int;
#define FOR(i,a,b) for(int i=(a); i<=(b);++i)
#define mp make_pair
#define pb push_back
#define sz(s) (int)((s).size())
int d[11];
bool ok(string &s) {
FOR(b,2,10) {
bool fb=false;
... | ALGO | 0.998256 | 3.688788 |
bc2fc26c-172e-49d2-8a1a-f8a363a76225 | NiloyKumarKundu/Leetcode-Preparation | Advanced CP/Topics/Number Theory/Euler Phi Function/Euler_Totient_Function.cpp | #include <bits/stdc++.h>
#define Niloy
#define int int64_t
#define MAX (int) 1e6 + 123
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define llu unsigned long long... | ALGO | 0.999838 | 5.083287 |
6fa789d3-995d-4b8b-9b0c-9c9679744764 | RitishShah/6Companies30days | Goldman Sachs/question2.cpp | class Solution {
public:
int doOverlap(int L1[], int R1[], int L2[], int R2[]) {
if(L1[0] > R2[0] || L1[1] < R2[1]) return 0;
if(R1[0] < L2[0] || L2[1] < R1[1]) return 0;
return 1;
}
}; | ALGO | 0.999391 | 5.03164 |
6d8d2a65-01e3-4739-98e1-1dc857b42546 | sd2618/c-all-progs | number-of-digits.cpp | #include <iostream>
using namespace std;
int main(){
int n,s=0,r;
cout<<"Enter a number";
cin>>n;
while(n!=0){
r=n%10;
s++;
n=n/10;
}
cout<<"Number of digits is="<<s;
} | ALGO | 0.999814 | 3.796337 |
7e3f42d9-a3c4-4ae6-8477-541031bddf84 | jianxinzhu/Bit-Characters-String-and-Struct | TokenReverseOrder.cpp | /* name: jianxin zhu
date: june/21/2020
*/
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
int main()
{
char sentence[100];
char* strPtr = nullptr;
char* Pointer[50];
char sep[] = " ";
int count = 0, i;
cout << "Enter a line of text, then tokenized in reverse order:";
cin... | TOOL | 0.989864 | 4.193413 |
cd895167-beea-4ccb-9eea-fe8ef8a9b3e4 | RohanManojPatil/GFG-POTD | September-2024/17-09-2024.cpp | // User function template for C++
class Solution {
public:
int getMinDiff(vector<int> &arr, int k) {
int n = arr.size();
sort(arr.begin(),arr.end());
int min_diff = arr[n-1] - arr[0];
for(int i = 1; i < n; i++){
if(arr[i] < k) continue;
int mini = min(arr[0... | ALGO | 0.999907 | 5.14729 |
fb43c4e5-e204-4353-b843-0a0abe6be06c | shaafsalman/Data-Structures | Trees/Ds-Solved/.history/Part 2/dns_20241014194336.cpp | #include "dns.h"
#include <fstream>
#include <algorithm>
#include <unordered_map>
#include <memory>
#include <vector>
using namespace std;
// You aren't allowed to edit these method declarations or declare global variables
// .....................................................................................
DNS::... | ALGO | 0.9622 | 5.776052 |
c3452e45-a1ef-4231-a93a-a8a4ae4aff8e | crisnita/University | Object-Oriented Programming/Lab 6 OOP/Lab 6-7/service.cpp | #include "service.h"
#include <functional>
#include <algorithm>
#include <assert.h>
#include <iostream>
using namespace std;
// adds a movie
Movie Service::addMovie(const string& title, const string& genre, const int& year, const string& actor) {
Movie m{ title, genre, year, actor };
val.validate(m);
m = repo.add(... | TOOL | 0.934581 | 5.531938 |
cb2d4929-b874-400f-b159-e2b16096c2e3 | nhomlaptrinhgame6/CauTrucDuLieu | 8/20127132_1/bai1/Source.cpp | #include "Header.h"
Node* createNode(string s)
{
Node* p = new Node;
p->key = s;
p->left = p->right = NULL;
return p;
}
void FindNode(link root, Node*& find, string data) {
if (root == NULL)
return;
if (root->key == data) {
find = root;
return;
}
else
{
FindNode(root->left, find, data);
FindNode(roo... | ALGO | 0.999892 | 3.370447 |
aef92120-4502-4166-8c1b-3b05d8e678ee | Himel-HSTU/Code-2025 | Stick_Lengths.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main ()
{
ios::sync_with_stdio(false);
cin.tie(0);
ll n;
cin>>n;
int ar[n];
for (int i = 0; i < n; i++)
cin>>ar[i];
sort(ar,ar+n);
ll mid= (n/2);
ll rslt=0;
for (int i = 0; i < n; i++)
rslt+=abs(ar[... | ALGO | 0.999924 | 4.471198 |
50a65043-8865-4b6d-8c60-6c75f3f700ad | raincross7/code-similarity | codes/train_code/problem162/problem162_195.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int a, b;
cin >> a >> b;
if(a==b)
cout << "a == b" << endl;
else
cout << (a > b ? "a > b" : "a < b") << endl;
return 0;
} | ALGO | 0.999566 | 4.199728 |
f4c606a8-a0c5-4700-ab82-f5bb7bbe24b3 | leonardogrupioni/Competitive_Programming | BrazilianICPCSummerSchool2023_FinalContest/Baekjoon-13580_Problem_K.cpp | #include <bits/stdc++.h>
using namespace std;
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define rep(i,a,b) for(int i =a;i<b;i++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
typedef vector<int> vi;
typedef vecto... | ALGO | 0.999958 | 3.970414 |
138f86a5-36c2-4d0b-8b6b-c3bef4e3a6d2 | sonsm0318/baekjoon-log | diamond/17476_수열과_쿼리_28/main.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
struct Node
{
ll sum;
ll max;
ll min;
ll lazySum;
ll lazySqrt;
};
ll arr[100001];
Node tree[400004];
void lazyUpdate(int idx, int start, int end)
{
if (tree[idx].lazySqrt == 0 && tree[idx].lazySum == 0) return;
... | ALGO | 0.999188 | 4.525889 |
40acf634-7904-4694-937e-4beb7f038fdb | ishandutta2007/codeforces | 1092515503/normal/1203/A.cpp | #include<bits/stdc++.h>
using namespace std;
int t,n,num[201];
int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&num[i]),num[i]--;
bool flag=true;
for(int i=0;i<n;i++)if(num[i]!=(num[(i+1)%n]+1)%n){flag=false;break;}
if(flag){puts("YES");continue;}
flag=true;
for(in... | ALGO | 0.999932 | 3.68102 |
a696a1a8-bc87-42ee-b0ca-33d9f6bad73d | Hashtag2425/CPP | dequeue_linkedlist.cpp | #include<iostream>
using namespace std;
struct node
{
int info; node *next; node *prev;
}
*front, *rear;
class dqueue
{
public:
int top1,top2;
void insert();
void del();
void display();
dqueue()
{
top1=0; top2=0;
front=NULL;
rear=NULL;
}};
void dqueue::insert()
{
struct node *temp;
int ch,value;
if(top1+top2... | ALGO | 0.998711 | 4.065367 |
d52a1394-8001-49b1-ad76-b8fce8532647 | neohackt/android_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_mpeg2_stereo_proc.cpp
Functions:
pvmp3_st_intensity_ver2
pvmp3_mpeg2_stereo_proc
Date: 09/21/2007
-----------------------------------------------------... | ALGO | 0.996027 | 5.952 |
4fffa59a-9889-4ba6-85a3-a5e8cc78ce07 | godnoTA/acm.bsu.by | 1. Деревья поиска/0.1. Построить дерево #3534/[OK]212208.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
using namespace std;
class TTree {
struct TNode {
long Key;
TNode* Left = nullptr;
TNode* Right = nullptr;
TNode* Father = nullptr;
};
TNode* Root;
public:
TTree() : Root(0) {}
~TTree() {
DestroyNode(Root);
}
void Insert(long k... | ALGO | 0.999869 | 4.270501 |
59b74268-6179-450c-8cb8-ef95457b7e71 | Viv786ek/Striver-SDE-Sheet | Reverse Linked List.cpp | #include <bits/stdc++.h>
/****************************************************************
Following is the class structure of the LinkedListNode class:
template <typename T>
class LinkedListNode
{
public:
T data;
LinkedListNode<T> *next;
LinkedListNode(T data)
{
... | ALGO | 0.999954 | 4.348711 |
4e21fa69-84a4-4198-b5db-55dc42c0c378 | Pedro-augusto-almeida-de-castro/Repositorio | code blocks 15.04.cpp | #include<iostream>
using namespace std;
int main ()
{
float idade;
cout << "entre com uma idade: ";
cin >> idade;
if (idade == 0){
cout << "idade invalida: igual a zero";
}
else if (idade < 0){
cout << "idade invalida: negativa!";
}
else{
cout << "idade valida: po... | TOOL | 0.935424 | 3.051611 |
0fae8850-4c20-4ec7-bc1b-2b4ee1ddf791 | azarankin/cpp_reference | 002 Strategy Pattern dependency_injection.cpp | /***
* Strategy Pattern
* base https://www.youtube.com/watch?v=motLOioLJfg
* By means of the Strategy design pattern we have:
... extracted implementation details (Singel Responsible Pronciple);
... created the opportunity for easy change;
... created the opportunity for easy extension (Open-Close Principle);
***/... | TOOL | 0.973982 | 7.775114 |
dfc8b8cf-3081-47cc-8516-206687d0b936 | edison16029/competitive-programming | CSES DP/Grid_Paths.cpp | #include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (int i = 0; i < n; i++)
#define foeq(i, n) for (int i = 1; i <= n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scan... | ALGO | 0.999699 | 4.083113 |
4c83ef52-d710-47cc-95e5-13467f50c758 | Saif-000001/xpsc_latest | Week11/Day3/Stone_Pile.cpp | #include <bits/stdc++.h>
using namespace std;
#define Faster \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define ll long long int
const int MOD = 1e9 + 7;
int main()
{
Faster;
int n;
cin >> n;
vector<int> a(n);
int sum = ... | ALGO | 0.999967 | 4.37987 |
219912ff-da35-4954-8af3-bb930c45ab17 | Capzera/Cpp | Algorithm/Lowest Common Ancestors(LCA)/Multiply.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, r, x, y;
cin >> n >> m >> r;
vector<int> edge[n + 1], depth(n + 1), lg(n + 1);
vector<vector<int>> pa(n + 1, vector<int>(22));
for(int i = 1; i <= n; i++)
lg[i] = lg[i - 1] + (1 << lg[i - 1] == i);
function<void(int, int, int)> ... | ALGO | 0.999999 | 4.343916 |
9125bce1-6bce-4bfb-ba3b-f5bf299e5665 | kimotu4632uz/Compete | abc319/d/abc319_d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr auto seq(int begin, int end) { return ranges::iota_view(begin, end); }
constexpr auto seq(int end) { return ranges::iota_view(0, end); }
#define all(v) std::ranges::begin((v)), std::ranges::end((v))
int main() {
ios_base::sync_with_stdio... | ALGO | 0.99998 | 4.339534 |
9b9e51fd-095a-41f3-96f3-03fa19e9dd1e | saubhik/hackerrank | alternating-characters.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
string s;
cin >> s;
int count = 0;
for (int i = 1; i < s.length(); i++)
if (s[i] == s[i-1]) count ++;
cout << count << "\n";
}
}
| ALGO | 0.999782 | 4.163644 |
69443dcb-3c6e-4e79-92d1-888b3b973c37 | jeremiasibarani/Applied_CPP | Data Structures/Sorting/bubble_sort.cpp | #include <iostream>
#include <vector>
#define pb push_back
void bubble(std::vector<int>& arr){
int size = arr.size();
for(int i = 0; i < size; i++){
for(int j = 0; j < size - 1 - i; j++){
if(arr[j] > arr[j + 1]){
std::swap(arr[j], arr[j + 1]);
}
}
}
}
int main(){
//sort(arr)
}
| ALGO | 0.99944 | 4.659524 |
11a32416-5c83-4b28-93f1-eaf14fdc90d8 | srivastavaritik/DSA | 983-minimum-cost-for-tickets/983-minimum-cost-for-tickets.cpp | class Solution {
public:
int mincostTickets(vector<int>& days, vector<int>& costs, int cost = 0) {
queue<pair<int, int>> last7, last30;
for (auto d : days) {
while (!last7.empty() && last7.front().first + 7 <= d) last7.pop();
while (!last30.empty() && last30.front().first + 30 <= d) last30.pop();
last7.... | ALGO | 0.999513 | 6.021055 |
5a8e2f5a-0fe6-40ea-a0e1-ea341997d5ef | mwien/PACE2025 | native/EvalMaxSAT/lib/cadical/src/mobical.cpp | /*------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
// Model Based Tester for the CaDiCaL SAT Solver Library.
namespace CaDiCaL {
static const char * USAGE =
"usage: mobical [ <option> ... ] [ <mode> ]\n"
"\n"
"whe... | TOOL | 0.964181 | 6.914199 |
299f29b8-f990-46bf-91d7-d735ab283e3f | sammmms/flutter-learn | M03/m03_teori/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.998419 | 6.76073 |
d6d9b580-33cd-4a0f-aa12-54f04d551aba | plasmatic1/dmoj-solutions | cpp/noi05p2.cpp | #pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native"
#include <bits/stdc++.h>
using namespace std;
// Common DS shorteners
using ll = long long; using ull = unsigned long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
tem... | ALGO | 0.999641 | 3.571419 |
564335ab-0051-4f95-8a47-25be2652d436 | CNugteren/myGEMM | src/libclblas.cpp | // Common include
#include "common.h"
// Include OpenCL and clBlas
#include <clBLAS.h>
// =================================================================================================
// Matrix-multiplication using the clBlas library. This function copies the input matrices to the
// GPU, runs SGEMM, and copies ... | ALGO | 0.996642 | 6.417882 |
dc8fe59f-a55a-4bbc-83d9-2d8d3fe13495 | HomuraCat/cf | contest/1485/f/f.cpp | //HomuraCat codes it!
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<bitset>
#include<queue>
#include<vector>
#include<set>
#include<cstdlib>
#include<iostream>
#include<utility>
#include<map>
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (int i = (a); i >= (b); --i)
#def... | ALGO | 0.999954 | 4.168784 |
29375aa0-9f23-4c9f-8a4a-46a7b23a1d4c | ROCm/flang | flang-classic/llvm-classic/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "l... | ALGO | 0.99665 | 7.863401 |
6f95062c-66e9-40a5-9772-c90fe2120cc7 | ishabhray/Competitive-Programming | codeforces/1879C.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
#define al... | ALGO | 0.999959 | 5.027637 |
7633e4cd-f425-4ece-a667-57a6aa25175a | lsgwr/algorithms | Part13算法竞赛宝典/第二部资源包/第九章 搜索算法/八数码/src/A星算法/Puzzle8.cpp | //룭*
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
const int MAXN = 370000;
struct node
{
int math;//ֵ
int ca;//cantorֵ
int zero;//0λ
}dui[MAXN];//
struct node d;
int s[9],f[9]={1,2,3,8,0,4,7,6,5};//s¼״̬f¼ĩ״̬
int h[MAXN];//hǵǰĿĹֵ
int g[MAXN];//g㵽ǰĴ
int dui... | ALGO | 0.999983 | 3.63352 |
06b4ea4a-f18b-4e33-92a0-e967923b51f3 | kunalsd-16/striver_sheet_challange | 4 sum.cpp | class Solution {
public:
//two pointer approach
vector<vector<int>> fourSum(vector<int>& nums, int target) {
int n=nums.size();
sort(nums.begin(),nums.end());
vector<vector<int>> outside;
for(int i=0;i<n-3;i++){
for(int j=i+1;j<n-2;j++){
long long newt... | ALGO | 0.999972 | 5.847694 |
717d62d1-2955-4c2f-a89b-16e51a6d9f64 | Abhibhab/DSA-CP-Practice | CN_dsa/Lecture 11 : Trees/Structurally identical.cpp | Structurally identical
Send Feedback
Given two generic trees, return true if they are structurally identical. Otherwise return false.
Structural Identical
If the two given trees are made of nodes with the same values and the nodes are arranged in the same way, then the trees are called identical.
Input format :
The f... | ALGO | 0.999621 | 5.578359 |
b8b5e502-3486-44d5-8367-8eec7f44e973 | fengchiyiya/C- | 路径总和3.cpp | // 给定一个二叉树的根节点 root ,和一个整数 targetSum ,求该二叉树里节点值之和等于 targetSum 的 路径 的数目。
// 路径 不需要从根节点开始,也不需要在叶子节点结束,但是路径方向必须是向下的(只能从父节点到子节点)。
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
... | ALGO | 0.999968 | 5.465907 |
5f06cdd5-9b03-47dd-8e47-2ac97230e1f1 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11639_45.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, T, M;
cin >> S >> T;
cout << S + T << endl;
}
| ALGO | 0.999695 | 4.524572 |
e2702ca9-7a27-442c-a148-dfe259ca6b0d | Licheam/Codes | CF1313C.cpp | #include <bits/stdc++.h>
#define LL long long
#define MAXN 500005
using namespace std;
LL m[MAXN],ls[MAXN],rs[MAXN];
stack<int> st;
void solve(){
int n;
scanf("%d", &n);
for(int i=1;i<=n;i++)
scanf("%lld", &m[i]);
for(int i=1;i<=n;i++){
while(!st.empty() && m[st.top()]>m[i])
st.pop();
if(!st.empty()) ls[... | ALGO | 0.999977 | 3.396903 |
f2ed7044-e1cb-4b56-b66b-4fd8b9800b8c | ravigod22/CompetitiveProgrammingUNI | Codeforces/2019/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define dbg(x) cerr << #x << " = " << x << endl
#define pv(x) cerr << #x << "[]: "; for (auto e : x) cerr << e << " "; cerr << endl
#define raya cerr << string(20, '=') << endl
void solve() {
ll n, k; cin >> n >> k;
vector<ll> a(n);
for (... | ALGO | 0.999948 | 4.619084 |
964ded43-35cd-4c8d-8b25-4255b8b047b8 | obaydullahmhs/Programming-Contest | Lightoj/1216 - Juice in the Glass.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 2000005
#define ESP 1e-9
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pp pop_back
#define ff ... | ALGO | 0.999427 | 3.504857 |
6ff1b835-de2c-4579-8abd-7496c6b2ab91 | MrCryptoBeast/BSTP | src/support/lockedpool.cpp | #include <support/lockedpool.h>
#include <support/cleanse.h>
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#ifdef WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#else
#include <sys/mman.h> // for mmap
#include <sys/resource.h> // for getrlimit
#include <limits.h> // for PAG... | TOOL | 0.868407 | 7.580101 |
78c674d5-6350-4459-a86e-14f9582a1354 | SMiles02/CompetitiveProgramming | Templates/Graph Theory/Block Cut Tree/block_cut_tree.cpp | struct block_cut_tree {
int n, edge_id, bct_node_cnt;
vector<vector<array<int, 2>>> edges;
vector<vector<int>> edges_bct;
vector<bool> is_split;
block_cut_tree(int n) : n(n), edges(n + 1), edges_bct(n * 3 + 1), edge_id(0) {}
void add_edge(int x, int y) {
edges[x].push_back({y, edge_id});... | ALGO | 0.999853 | 4.523858 |
3576ab6c-e76c-4062-8973-3eb714ce46fd | siddheshk/CS534L-Social-Networks-Project | CPP Code/ic_edge.cpp | #define HEAD_INFO
#define HEAD_INFO
//#define HEAD_TRACE
#include "TIM/src/tim.cpp"
#include <random>
#include <iterator>
#include <algorithm>
#include <fstream>
TimGraph generateGraph(string dataset, string graph_file, int budget, double epsilon=0.1){
cout<<"Generating Graph"<<endl;
TimGraph graph(dataset, graph_f... | ALGO | 0.999488 | 3.248778 |
1319b395-1c09-4381-8571-9b00e4de4beb | xionggithub/leetcode | algorithms/cpp/107_levelOrderBottom.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
struct TreeNode
{
int val;
TreeNode* left;
TreeNode* right;
}
vector<vector<int>> levelOrderBottom(TreeNode* root)
{
queue<TreeNode *> nodes;
vector<vector<int>> results;
stack<vector<int>> out;
if (root)
{
nodes.p... | ALGO | 0.999992 | 5.924531 |
4777feb1-e8b2-4b65-93ae-2f3faac315a6 | haeyun-choi/DeepDeblurRF | gaussian-splatting/submodules/diff-gaussian-rasterization/third_party/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.998852 | 4.846448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.