uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
80e22670-519f-4516-b9e5-6b2022c661a7 | Valgulious/Valgory | ClassWorks/FistWork/ex_7/main.cpp | /*Написать программу, которая бы выводила на экран
расписание ваших дисциплин для того дня недели,
номер которой вводит пользователь.*/
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "rus");
int s;
cout << "Введите номер дня недели (понедельник - 1, вторник - 2, среда - 3, четве... | TOOL | 0.991062 | 3.052442 |
a0971a89-3b47-401f-b3d7-beb3958fc735 | Rudolf-Gama/Striver-A2Z_DSASheet | LinkedList/SLL/hardSLL/flatten.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *next;
Node *child;
// Constructors to initialize the
// data, next, and child pointers
Node() : data(0), next(nullptr), child(nullptr) {};
Node(int x) : data(x), next(nullptr), child(nullptr) {}
Node(int ... | ALGO | 0.99999 | 5.614479 |
8b8c967a-48f0-46cb-864b-a6d8ea203a9d | alexcortes18/Programacion2 | 2 Parcial/prueba-ultima/alejandrocortes-21341151.cpp | #include <iostream>
using namespace std;
/*
Se tiene que pedir un numero entero y guardar en la lista de punteros solo los pares
y luego preguntar si desea ingresar otro numero. Luego presentar la lista.
*/
struct nodo {
int numero;
struct nodo *siguiente;
};
struct nodo *primero, *ultimo;
struct nodo *nue... | ALGO | 0.994176 | 3.112789 |
d12c035b-474b-41e2-aadb-dca7300614ac | vantuan2905/li-thuyet-do-thi | bellman-ford.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct gt{
int d,c;
};
vector<gt> v[1005];
int n,m,d[1005],u;
void bellman(){
for(int i=1;i<=n;i++) d[i]=1e9;
for(int i=0;i<v[u].size();i++){
d[v[u][i].d]=v[u][i].c;
}
d[u]=0;
for(int i=1;i<=n-2;i++){
for(int j=1;j<=n;j++){
for(int k=0;k<v[j].... | ALGO | 0.999768 | 4.27401 |
e99d633c-8e44-4a6c-86c9-8cc23968e1cb | Ayush-Kmr/Leet-Code | 0100-same-tree/0100-same-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999988 | 6.370878 |
280868d9-2e39-46be-b7f9-fee2543a6e2c | iwannabeasenior/BasicProgramming | ttud/midterm3/4.cpp | #include<bits/stdc++.h>
using namespace std;
int n, K, Q;
int d[1000];
int c[1000][1000];
int M;
int main() {
cin >> n >> K >> Q;
for (int i = 1; i <= n; i++) {
cin >> d[i];
}
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= n; j++) {
cin >> c[i][j];
}
}
... | ALGO | 0.999282 | 3.493953 |
896d0aa9-856d-47c8-8b3d-0e99708dba72 | shangrex/leetcode | 1646-kth-missing-positive-number/1646-kth-missing-positive-number.cpp | class Solution {
public:
/*
The number of positive integers which are missing
before the arr[idx] is equal to arr[idx] - idx - 1.
1 2 3
0 1 2
[2,3,4,7,11]
l r
m
l r
m
l
m
r l
*/
int findKthPositive(vector<in... | ALGO | 0.999965 | 5.070141 |
285377a4-3392-405d-9e6e-2030c2a8c982 | haiming-bu/ROS2-EMplanner | src/osqpSolver.cpp | //
// Created by 12971 on 2022/4/14.
//
#include "emplanner/osqpSolver.h"
/*
//二次规划最小式
f(X)=0.5*X'*H*x + f'*X;
lb<X<ub
34min
轨迹平滑二次规划形式(公式)
H1 = w_cost_smooth*(A1'*A1)+w_cost_length(A2'*A2)+w_cost_ref(A3'*A3);
f=-2*w_cost_ref*reflene_init;
标准二次规划形式
x'H1x+f'x=0.5*x'(2H1)*x + f'x;
*/
refLineSmoother::refLineSmoother... | ALGO | 0.999892 | 4.16008 |
ae4f7b70-d25a-403b-8a6b-04fd0a5ee150 | bbaah123/CPlusPlus | files/0134398408_ sc/Chapter16/pr16-13.cpp | // This program demonstrates how iterators and related concepts can
// be used to write code that works with arrays and STL containers.
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//*****************************************
// This function will print a range of ... | TOOL | 0.904349 | 5.481252 |
cc3df749-1919-4c14-9410-d15871271dbe | SeSACAlgorithm/AlgorithmStudy | 백준/자료구조 2/1620) 나는야 포켓몬 마스터 이다솜/재원.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
//해시맵사용
int main(){
map<string, int> pokemon;
vector<string> name;
int n, m;
string temp; //포켓몬 이름과 번호가 섞여있으므로 string
cin >> n >> m;
vector<string> result;
for (int i = 1; i <= n;i++){
cin >>... | ALGO | 0.999819 | 4.814631 |
df9e33e5-9742-43d4-befd-5f9e893eda8d | m4oughi/100DaysofCode | pureCPP/0013. Day 13/Function Templates/006. Overloading Function Templates/007. Overloading Function Templates with Default Parameters/main.cpp | #include <iostream>
using namespace std;
template <typename T>
void print(T value, int precision = 2) {
cout.precision(precision);
cout << fixed << "Template: " << value << endl;
}
// Overloading with specific types and default parameters
void print(double value, int precision = 5) {
cout.precision(precis... | TOOL | 0.869778 | 6.828975 |
61532695-ee04-4332-a385-4a07f11bfb82 | JANN4TUL-FERDOUS/Codeforces-Solutions | jannatul.cse7.bu/contest/313B.cpp | #include<iostream>
using namespace std;
int main(){
int n,i,s=0;
string a;
cin>>a>>n;
int b[a.length()];
b[0]=0;
for(i=1;i<a.length();i++){
if(a[i]==a[i-1]) s++;
b[i]=s;
}
while(n--){
int l,r;
cin>>l>>r;
cout<<b[r-1]-b[l-1]<<endl;
}
return ... | ALGO | 0.999721 | 3.830146 |
77e6b036-5f6e-4e01-bca4-ba02067e442a | IvanRenison/ProgrammingProblems | ICPC contests/NEERC Moscow Subregional 2008-2009/A.cpp | // https://codeforces.com/gym/100861
#include <bits/stdc++.h>
#define fst first
#define snd second
#define pb push_back
#define fore(i,a,b) for(int i=a,gmat=b;i<gmat;++i)
#define SZ(x) ((ll)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0),cin.tie... | ALGO | 0.993074 | 3.70689 |
c887ed38-ebee-4604-afa9-c4e0258e8768 | shivivats/NeetCode150 | 2-valid-anagram.cpp | class Solution
{
public:
bool isAnagram(string s, string t)
{
std::unordered_map<char, int> character_frequencies_s;
for (char c : s)
{
if (character_frequencies_s.count(c))
{
int c_freq = character_frequencies_s[c];
c_freq++;
... | ALGO | 0.999883 | 6.452419 |
04a21067-92d3-4de0-8c3c-689792a7efa2 | AntonSkachko/Fundamentals_of_Algorithmization_and_Programming | firstSemester/variant11/laba_4/first_level.cpp | #include <iostream>
using namespace std;
int main(){
int length;
cout << "Enter length of array: ";
cin >> length;
int* array = new int[length];
for (int i = 0; i < length; i++){
cout << "Enter array[" << i << "]: ";
cin >> array[i];
}
int min = array[0], minIndex = 0;
... | ALGO | 0.999073 | 3.816736 |
00ca89fe-1cd8-4d17-adaf-a741ef8f7fce | Krish7-hub/-CrackYourPlacement | 0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int n = nums.size();
if(n == 1) return nums[0];
if(nums[0] != nums[1]) return nums[0];
if(nums[n-2] != nums[n-1]) return nums[n-1];
int low = 1;
int high = n - 2;
while(low <= high){
int mid = low... | ALGO | 0.999956 | 5.63285 |
eb8a68b8-7945-44e1-a9a5-fda43df1a57c | Kashish2130/Learning_DSA | 3_Array Problems/Medium/10_Longest_Consecutive_Sequence.cpp | //brute force solution
//tc : O(n^2)
//sc : O(1)
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if (nums.empty()) return 0; // Handle empty input case
int maxlen = 1; // Start with 1 since a single number is a sequence
for (int i = 0; i < nums.size(); i++) {
... | ALGO | 0.999948 | 6.140958 |
c1a243a9-2e29-4e4e-9404-b97c52680412 | longnu/codetree-TILs | 240515/진수 to 진수/transformation-of-number-system.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
string n;
cin >> a >> b >> n;
int sib = 0;
for(int i = 0; i <n.size(); i++)
{
sib = sib * a + (n[i] - '0');
}
int arr[20];
int cnt = 0;
while(true)
{
if(sib < b)
{
arr[... | ALGO | 0.999977 | 3.426161 |
06dd7b46-94f1-4ca9-ba41-0e57153ac30a | yagyeshgoyal/codeforces-question-solution | sakurako_exam.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
if(a%2 == 0 && b%2 == 0){
cout<<"YES"<<endl;
}
else if(a%2 == 0 && b%2 == 1 && a>=2){
cout<<"YES"<<endl;
}
else{
... | ALGO | 0.999592 | 4.280892 |
24283dec-480f-44a4-a0f4-48a6966a6a57 | Slava/topcoder | LotteryCheating.cpp | #include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <sstream>
using namespace std;
#define abs(x) (x<0?-(x):x)
#define bit(x,y) ((x>>y)&1)
int go(long long x, string b) {
char s[20] = "";
sprintf(s, "%0*lld", b.size(), x);
string a = s;
int cnt ... | TEST | 0.999463 | 4.317797 |
2c8c9109-bee7-48a7-97bd-579cdddd59af | JakubKedzierski/aoc2024 | day14/solution2.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <array>
#include <regex>
#include <ranges>
struct POSITION
{
int64_t x = 0;
int64_t y = 0;
};
struct SPEED
{
int64_... | ALGO | 0.999663 | 3.628291 |
e7f20ddd-a94a-4d0f-ab3e-1bb1570e90df | TarunSinghania/Prewritten-code | DISJOINTSET/example pathcompression+ weighted+clean.cpp | #define MAX 400005
int Arr[MAX];
int size[MAX];
void initialize(int N)
{
for(int i = 0;i<N;i++)
{
Arr[ i ] = i ;
size[ i ] = 1;
}
}
int root(int i)
{
while(Arr[ i ] != i)
{
Arr[ i ] = Arr[ Arr[ i ] ] ;
i = Arr[ i ];
}
return i;
}
void weighted_union(in... | ALGO | 0.999926 | 3.774833 |
5bbbc0cb-6a3b-4ecc-8041-388ae62099e9 | AkhmetovOlzhass/algorithms | lab1/h.cpp | #include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;
int isPrime(int num){
if (num <= 1) {
return false;
}
for (int i = 2; i <= sqrt(num); i++) {
if (num % i == 0) {
return false;
}
}
return true;
}
int main()
{
int a;
cin >> a;
... | ALGO | 0.999877 | 4.797122 |
6e02f468-2f43-4ed1-b0b8-667d492c3174 | AugustHdez/oneAPI | DirectProgramming/C++/Jupyter/OpenMP-offload-training/parallelism/saxpy_func_parallel_solution.cpp | #pragma omp target map(from: is_cpu) map(from:num_teams) map(to:x[0:ARRAY_SIZE]) map(tofrom:y[0:ARRAY_SIZE])
{
// 1. Add pragma to create multiple master threads use clause num_teams(NUM_BLOCKS)
// and distribute loop iterations to the various master threads.
#pragma omp teams distribute num_teams(NUM_BLOCKS)
... | ALGO | 0.972444 | 3.891738 |
3fe0be06-0385-4110-a2ed-c0e372d7c4f0 | samotolg/ssmoderncpp | DAY4/0_람다표현식3.cpp | #include <iostream>
#include <algorithm>
#include <vector>
int main()
{
std::vector<int> v = { 4,5,6,1,2,3,7,8,9,0 };
int k;
std::cin >> k;
// C++11 ʹ ǥ ϸ մϴ
// => "Լ̸(ּ) Ǵ ڸ Լ ڵ带 ۼϴ "
// => [] : ٰ ۵ ˸ "lambda introducer"
auto ret1 = std::find_if(v.begin(), v.end(), [k](int n) { return n % k == 0; } );... | ALGO | 0.999549 | 3.984205 |
1c34abcd-13dd-4c15-ad27-b72b4b5ade7c | NewSouthWave/ALCUK_2024_Summer | ALCUK_2024_Summer/week4/B_10872.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
//문제: https://www.acmicpc.net/problem/10872
/**
*/
int factorial(int n) {
if (n == 0) {
return 1;
}
else if (n == 1) {
return 1;
}
else if (n == 2 ) {
retu... | ALGO | 0.999984 | 5.639239 |
68d83722-d4ce-454c-9a91-4e3cca6661ea | ReisenCW/DiscreteMathematicsHomework | homework_5/source.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
using std::cout;
using std::cin;
using std::endl;
#define _DEBUG_ 0
struct Code {
std::string code;
int frequency;
Code(std::string code, int frequency) :code(code), frequency(frequency) {};
};
void InputVertexNumber(int&... | ALGO | 0.999924 | 4.526968 |
058686e4-7bc6-48ac-bec7-e362af79e063 | naruse/challenges | CrackingTheCodingInterview/Version4/LinkedLists/3.RemoveNode.cpp | #include <iostream>
using namespace::std;
class Node {
public:
int data;
Node* next;
Node(int d) {
data = d;
next = NULL;
}
Node* AddToEnd(int d) {
Node* end = new Node(d);
Node* current = this;
while(current->next != NULL)
current = current->ne... | ALGO | 0.998317 | 5.209676 |
c0f8733d-00ec-4ad1-8ae6-7d5abb849ac3 | zgcharaf/Quant-cpp | ranged_loops_vector_iterators.cpp |
#include <iostream>
#include <thread>
#include <vector>
#include <cmath>
#include <cstdlib>
using namespace std;
//Author : Charaf ZGUIOUAR
int main() {
vector <int> nums = { 10, 20, 30, 40, 50};
vector <int>::iterator first = nums.begin();
vector <int>::iterator end = nums.end() -1;
vector <int> ... | TOOL | 0.920456 | 3.083966 |
86d2c61c-8233-446a-ae20-71965d6ea4c4 | steviefrisbie/FlashPhoto | project/iteration3/libphoto/src/Sharpen.cpp | //
// Sharpen.cpp
// Created by Jacob Grafenstein
//
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include "ConvolutionFilter.h"
#include "Sharpen.h"
#include "EdgeDetection.h"
Sharpen::Sharpen() {
kernelSize = 3;
kernel = (float **) malloc(kernelSize * sizeof(float *));
for (int... | TOOL | 0.919166 | 4.471724 |
b08a2571-6426-4471-98c2-7ea076fb1410 | GuacheSuede/MSSubmission1234567890 | submission/sma/boost_1_69_0/libs/geometry/example/05_a_overlay_polygon_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geome... | ALGO | 0.966336 | 6.777542 |
313afe6c-57e8-4a4b-8b8e-25c11ed1ba38 | jasonpyau/Codeforces-Solutions | SettlementOfGuineaPigs.cpp | // https://codeforces.com/problemset/problem/1802/B
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <string>
#include <bits/stdc++.h>
#include <cstdint>
#define ll long long
#define u64 uint64_t
#define i64 int64_t
using namespace std;
int main() {
int nC = 0;
cin >> nC;
... | ALGO | 0.999933 | 5.075532 |
e4ae239e-8fb4-4fea-a4df-06e8a2312895 | gabrielleodell/SENSOR-FUSION | turtlebot/turtlebot3_sensorFusion/src/common_utils/include/eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A;
A << 1, 2, 2, 3;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
if (eigensolver.info() != Success) abort();
cout << "The eigenvalues of A ... | ALGO | 0.999473 | 3.846247 |
a5644f6d-93d5-45d7-97b3-e63380ab30c0 | ToprakArslann/ascii-video | libs/opencv/sources/modules/stitching/perf/perf_matchers.cpp | #include "perf_precomp.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/opencv_modules.hpp"
#include "opencv2/flann.hpp"
namespace opencv_test
{
using namespace perf;
typedef TestBaseWithParam<size_t> FeaturesFinderVec;
typedef TestBaseWithParam<string> match;
typedef tuple<string, int> matchVector_t;
typedef ... | TEST | 0.872653 | 6.842914 |
90bc25cf-1072-4b5c-8d93-7176587f10c4 | MF-Jiang/LeetCode-75 | 443压缩字符串/Solution.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int n = chars.size();
int write = 0, left = 0;
for (int read = 0; read < n; read++) {
if (read == n - 1 || chars[read] != chars[read + 1]) {
chars[write++] = chars[read];
int num = read -... | ALGO | 0.999996 | 6.582514 |
07d16d17-18c8-4cc2-bec0-408ef4180a41 | crusior96/ALGORITHM_CODINGS | 트리의부모찾기_백준(11725).cpp | #include<iostream>
#include<vector>
using namespace std;
int parent[100002] = {}; // 忡 parent Ǵ
bool visited[100002] = {}; //Ž
vector<int> tree[100002]; // Ǵ
//1 尡 Ʈ Ʈ
//N 尡 ϰ N-1 Ʈ Էµɶ θ ϶
// parentfinder 尪 parent , parentfinder Լ ϴ ̷
//, ̹ parent 尪 쿡
void parentfinder(int currNode) {
visited[curr... | ALGO | 0.999994 | 4.782963 |
289b1913-48cb-40bf-bc93-64e6ce7c9df0 | RoelVdP/Griffin | exp/DBMS-versions-for-evaluation/DuckDB/third_party/hyperloglog/sds.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <limits.h>
#include "sds.hpp"
namespace duckdb_hll {
static inline int sdsHdrSize(char type) {
switch(type&SDS_TYPE_MASK) {
case SDS_TYPE_5:
return sizeof(struct sdshdr5);
case SD... | TOOL | 0.867892 | 6.228079 |
deaaf8d5-f83a-4a3a-8015-1a3fa9a18eef | ashita-agarwal/DSA-Practice-Cpp | Basics/HourGlass.cpp | #include <iostream>
using namespace std;
int main(){
int n ;
cin >> n;
//UPPER TRIANGLE
for (int i = 0 ; i <= n ; i++) {
//SPACES
for (int j = 0 ; j <= i-1 ; j++) {
cout <<" ";
}
//LEFT_HALF
for (int j = n-i ; j >= 0 ; j--) {
cout << j << " ";
}
//RIGHT_HALF
for (int j = 1; j <= n - i ; j++)... | ALGO | 0.999905 | 3.107493 |
5678b6af-db88-41c8-9962-03031480e899 | mertturkmenoglu/cpp | src/stl/algorithm/Modifying/E003_CopyIf/main.cpp | /**
* copy_if() example
* g++ main.cpp -std=c++17 -Wall -Wextra -Wnon-virtual-dtor -pedantic -g -o main
* valgrind --leak-check=yes -v ./main
*/
#include <iostream>
#include <algorithm>
#include <vector>
int main() {
std::vector<int> numbers = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
std::vector<int> evenNumbers... | ALGO | 0.992537 | 5.520172 |
f2b78e30-b775-4be0-b1f7-d3709fad0cc2 | shahidul-brur/OnlineJudge-Solution | Codeforces/1020_A - New Building for SIS.cpp | /*==============================================*\
ID: shahidul_brur
Name: Md. Shahidul Islam
Study: CSE, BRUR
Address: Rangpur, Bangladesh
mail: <EMAIL>
FB : fb.com/shahidul.brur
Blog: shahidul-brur.blogspot.com(in Bengali),
shahidul... | ALGO | 0.99932 | 3.274268 |
4fdd1b12-d26f-4714-8709-5b075cf2d64c | Mayank50001/Leetcode-Solved-Questions | Array/Binary Search/searchInsertPosition.cpp | /*
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with O(log n) runtime complexity.
Example 1:
Input: nums = [1,3,5,6], target = 5
Output: 2
Example 2:
Input: nu... | ALGO | 0.99998 | 6.56176 |
f0087b30-eea7-41e4-ae30-4cd6955ba8ff | chusloj/Data-Structures-and-Algorithms | data_structures/stack_linked_list.cpp | #include<iostream>
struct Stack {
int data;
Stack* next;
};
Stack* Push(int x, Stack* head) {
Stack* temp = new Stack;
temp->data = x;
temp->next = head;
head = temp;
return head;
}
Stack* Pop(Stack* head) {
Stack* old;
old = head;
head = old->next;
delete[] old;
return head;
}
void Top(Stack* head) {... | ALGO | 0.990616 | 4.574567 |
a99d1f0f-e57f-4a8c-9baa-835cd47db9eb | buptqitian/algorithms_notes | insertion_sort/sort_bst.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Node
{
int key;
Node *left, *right;
int attach;
Node (int k = 0, Node *l = NULL, Node *r = NULL)
{
key = k;
left = l;
right = r;
}
};
void insert(Node **root, int value)
{
Node *new_node = new Node(v... | ALGO | 0.999992 | 4.84216 |
ff83a5d0-2dc5-4900-9c01-915f3280e8d5 | itsactuallyashish/cppfiles | C_Strong_Password.cpp | #include<bits/stdc++.h>
using namespace std;
template<typename... T>
void see(T&... args) { ((cin >> args), ...);}
template<typename... T>
void put(T&&... args) { ((cout << args << " "), ...);}
template<typename... T>
void putl(T&&... args) { ((cout << args << " "), ...); cout<<'\n';}
#define ll long long
#define deb(x... | ALGO | 0.999942 | 4.19476 |
d8188acb-74f4-4929-aea8-bd0dcacd38fc | lokeshchandr/dsa | Practice/LeapYear.cpp | #include <iostream>
using namespace std;
bool Leap(int year)
{
if (year % 400 == 0)
{
return true;
}
else if (year % 4 == 0 && year % 100 != 0)
{
return true;
}
return false;
}
int main()
{
int year = 2002;
int ans = Leap(year);
if (ans)
{
cout << "l... | ALGO | 0.99977 | 3.656352 |
f49f4f47-9bb5-47b3-89e2-0d020f7f8951 | SR-Akash/Problem-Solving | Codeforces/cf_In Search of an Easy Problem 2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int str;
cin>>str;
for(int i=0;i<str;i++)
{
if(i='1')
cout<<"HARD"<<endl;
return 0;
}
}
cout<<"EASY"<<endl;
return 0;
}
| ALGO | 0.998213 | 3.188308 |
b6aad3d2-e0fe-4508-b9ab-27df08d5051e | urextra/myCodes | cpp/cf/cf96_1/a.cpp | #include <stdio.h>
int Reverse(char ch) {
int ans = 0;
int i;
int c = 128;
for(i = 0; i < 8; i++) {
if(ch % 2)
ans += c;
c >>= 1;
ch >>= 1;
}
return ans;
}
int main(void) {
char ch;
int rev0, rev1;
rev0 = 0;
while((ch = getchar()) != '\n') {
rev1 = Reverse(ch);
//printf("%d\t", rev1);
print... | ALGO | 0.999527 | 3.400996 |
e74ae1ab-49e0-4829-a0c8-9e5b3de76b3c | DangQui/BackUp | DevC++/Learn_C++_From_Basic_To_Advanced/Contest/Session 7/Lesson_9.cpp | #include <bits/stdc++.h>
/*
SO THUAN NGUYEN TO
1. Khai niem:
- Mot so duoc coi la so thuan nguyen to neu no la so nguyen to, tat ca cac chu so va tong
cua no cung la mot so nguyen to. Bai toan dat ra la dem xem trong mot doan giua hai so
nguyen cho truoc co bao nhieu so thuan nguyen to
*/
using namespace... | ALGO | 0.99977 | 5.040668 |
1e30f603-cb51-4cba-9f50-391735cd1e06 | zgh551/LateralControl_Cpp_Webots | controllers/rear_wheel_controller/Math/linear_quadratic_regulator.cpp | #include "linear_quadratic_regulator.h"
using Matrix = Eigen::MatrixXd;
namespace math{
/**
* @brief Solver for discrete-time linear quadratic problem.
* @param A The system dynamic matrix
* @param B The control matrix
* @param Q The cost matrix for system state
* @param R The cost matrix for control output
* ... | ALGO | 0.999661 | 6.054703 |
37a261a4-d57d-46b0-a7b5-0fb875345732 | kiwibrowser/src | third_party/openh264/src/codec/processing/src/imagerotate/imagerotatefuncs.cpp | #include "imagerotate.h"
WELSVP_NAMESPACE_BEGIN
void ImageRotate90D_c (uint8_t* pSrc, uint32_t uiBytesPerPixel, uint32_t iWidth, uint32_t iHeight, uint8_t* pDst) {
for (uint32_t j = 0; j < iHeight; j++) {
for (uint32_t i = 0; i < iWidth; i++) {
for (uint32_t n = 0; n < uiBytesPerPixel; n++)
pDst[ ... | ALGO | 0.998683 | 6.255272 |
e6e358e1-8adf-47bf-ad2c-737f201f0a61 | nikhil637/CSA5174crypto | exp 9 - Copy.cpp | #include <stdio.h>
#include <string.h>
#define MAX_LENGTH 100
void decodePlayfair(char *code) {
char key[5][5] = {
{'K', 'X', 'J', 'E', 'Y'},
{'U', 'R', 'E', 'B', 'E'},
{'Z', 'W', 'E', 'H', 'E'},
{'W', 'R', 'Y', 'T', 'U'},
{'H', 'E', 'Y', 'F', 'S'}
};
int i, j;
... | ALGO | 0.999939 | 4.245916 |
044b052f-a6d9-4a31-b254-cbabbc65a1bd | Ujjwal2017099/leet-code | 1220-count-vowels-permutation/1220-count-vowels-permutation.cpp | class Solution {
map<pair<int,char>,int> dp;
map<pair<int,char>,bool> m;
map<char,vector<char>> g;
public:
int mod = 1e9+7;
int countVowelPermutation(int n) {
g[' '] = {'a','e','i','o','u'};
g['a'] = {'e'};
g['e'] = {'a','i'};
g['i'] = {'a','e','o','u'};
g['o'... | ALGO | 0.999966 | 5.848849 |
d55634eb-0d41-4d4f-8ccd-3320efa95f56 | ishikabansal04/WireUsChallenge-CompetitiveProgramming | Day_18.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int size;
cout << "Enter the size of the array: " << endl;
cin >> size;
vector<int> input(size), v;
cout << "Enter " << size << " elements in the array: " << endl;
for(int i = 0; i < size; i++){
cin >> input[i];
... | ALGO | 0.999986 | 4.213144 |
360a1a80-4cd9-40dd-a31d-a034f00e4355 | rrmcastro/primeiro_projeto | 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 |
bb57930d-4068-4c0c-bb13-4a02f6b1b9c8 | NickLennonLiu/cpp | bpd/Homework/HW7/stones.cpp | #include <iostream>
using namespace std;
#define INTMAX 2147483647
int n;
int a[1001], s[1001];
int dp[1010][1010];
int dfs(int i, int j)
{
if (dp[i][j] != INTMAX)
return dp[i][j];
if(i == j)
return dp[i][j] = 0;
for(int k = i; k < j; ++k )
{
dp[i][j] = min(dp[i][j], dfs(i,k) ... | ALGO | 0.999838 | 3.655871 |
63171351-dc85-4940-870e-b62e5d3a2f4c | fhajji/ntl | src/CheckAVX512F.cpp |
#include <NTL/ctools.h>
#include <cstdlib>
#include <immintrin.h>
#include <iostream>
// Ths actually checks for AVX512F+DQ+VL
#if (!defined(__GNUC__) || !defined(__x86_64__) || !defined(__AVX512F__))
#error "AVX512F not supported"
#endif
#if (!defined(__AVX512VL__) || !defined(__AVX512DQ__))
#error "AVX512F not s... | ALGO | 0.987955 | 4.312663 |
a15737bd-306a-47a9-a981-318db413cfba | fabriciocarraro/flutter_tasklist | 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 |
a80636ee-acd7-46a7-8253-4db5a067c560 | mammadzadaa/FSDM_12011_ru | OOP/Lesson_18_02_21/Source.cpp | #include<iostream>
using namespace std;
enum Priority
{
High = 1, Mid, Low
};
template<class T>
class DLinkedList
{
private:
struct Node
{
Node* next = nullptr;
Node* previous = nullptr;
Priority priority = Priority::High;
T value;
};
Node* begin = nullptr;
public:
void push(T val, Priority priority)
{... | ALGO | 0.999421 | 5.115833 |
91b4e07e-8943-4fb6-a6b5-3d5c7064809e | EmanueleMusumeci/RoboCup-Coach | Src/Tools/ImageProcessing/Sobel.cpp | /**
* @file Sobel.cpp
*
* @author Alexis Tsogias
*/
#include <cstring>
#include <cstddef>
#include "Tools/ImageProcessing/SIMD.h"
#include "Platform/BHAssert.h"
#include "Platform/Memory.h"
#include "Sobel.h"
void Sobel::sobelSSE(const Image1D& srcImage, SobelImage& destImage)
{
ASSERT(srcImage.width % 16 == ... | ALGO | 0.983778 | 5.665096 |
9e7b0f31-a6a2-4dcd-ae71-d715f6f67287 | k-kmw/algorithm | C++/기타/유니온 파인드/14868 문명.cpp | #include <bits/stdc++.h>
using namespace std;
int n, k;
int board[2005][2005];
int num = 1;
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, -1, 0, 1};
bool vis[2005][2005];
int cnt;
int p[100005];
void make_set() {
for (int i = 1; i <= k; i++) {
p[i] = i;
}
}
int find(int a) {
if (a == p[a]) return a;
... | ALGO | 0.999941 | 4.468831 |
78350ab2-902f-479f-be81-2c0a5df97c69 | LazarevicLazar/Mathematical-Notation-Converter | NotationConverter.cpp | /*
* Notation Converter Project using Doubly Linked Lists implemented as a Deque.
*
* This program implements a Notation Converter using deque data structure.
* It can convert from postfixToInfix, postfixToPrefix, infixToPostfix, infixToPrefix, prefixToInfix, prefixToPostfix depending on the user's input.
*
*/
#... | ALGO | 0.952349 | 5.662192 |
d3bc00aa-83b4-40ca-a451-38cd853f4b87 | srijanshetty/code | editDistance.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int minDistance(string word1, string word2) {
if (word1 == "" && word2 == "") {
return 0;
}
if (word1 == "") {
return word2.size();
}
if (wor... | ALGO | 0.999992 | 5.189778 |
7395ec8e-4896-4b00-8ade-577a14238d4a | Gaurav-singh101/Strivers-A2Z-DSA-Course | Lab Exam/QuickSort.cpp | #include<bits/stdc++.h>
using namespace std ;
int fun(vector<int>& arr , int low , int high){
int pivot = arr[low];
int i = low + 1 ;
int j = high ;
while(i < j){
while(arr[i] <= pivot && i <= high){
i++;
}
while(arr[j] > pivot && j >= low){
j--;
... | ALGO | 0.999956 | 4.875949 |
ce96144f-bbca-4955-9547-1e13bfce6113 | yuntianyi-chen/Artifacts-of-ADS-Bug-Fix-Pattern-Study | data/bug-fix file-change dataset/autowarefoundation_autoware.universe/1969/after/shift_pull_over.cpp | #include "behavior_path_planner/scene_module/pull_over/shift_pull_over.hpp"
#include "behavior_path_planner/path_utilities.hpp"
#include "behavior_path_planner/scene_module/pull_over/util.hpp"
#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <memory>
#inclu... | ALGO | 0.978285 | 6.979368 |
5363cff6-d0ec-4258-bddc-eafcc448ea13 | anmolsinghturka/data-structure-algorithm | First negative integer in every window of size k .cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,i,k,flag;
cin>>n;
queue<int> q;
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>k;
for(i=0;i<n-k+1;i++)
{
flag=0;
for... | ALGO | 0.999752 | 3.612224 |
cc57b797-56b2-4e77-b2c5-8251f82f417d | NimishSinghChouhan/LeetCode | 1252-cells-with-odd-values-in-a-matrix/1252-cells-with-odd-values-in-a-matrix.cpp | //Runtime: 0 ms, faster than 100.00% of C++ online submissions for Cells with Odd Values in a Matrix.
//Memory Usage: 9.6 MB, less than 100.00% of C++ online submissions for Cells with Odd Values in a Matrix.
class Solution {
public:
int oddCells(int n, int m, vector<vector<int>>& indices) {
vector<vector<... | ALGO | 0.999989 | 6.336005 |
9f4eedd2-e3b5-4c97-af55-a37831654bcb | CoolZiyang/LLVM-Optimization | Tests/VariableDeclaration/VariableDeclaration.cpp | #include <stdint.h>
unsigned num;
uint32_t * keys; | TOOL | 0.868296 | 3.14525 |
63261b52-db68-4f64-9ded-036628b851b0 | Benyaminteymuri/CPP | [01] Basics/[08] LessonEight/14 MorePointerToStruct.cpp | // pointer for structure
#include <iostream>
#include <conio.h>
using namespace std;
struct a
{
int n;
float f;
};
int main()
{
a x;
a *p;
x.n = 5;
p = &x;
p->n = 8;
cout << x.n ; //8
getch();
}
| TOOL | 0.882519 | 3.08266 |
90a32f80-0b92-4a6d-86d9-f5f0c730fe8d | ashokabairwaideology/Leet-code-problem | solution/1700-1799/1749.Maximum Absolute Sum of Any Subarray/Solution.cpp | class Solution {
public:
int maxAbsoluteSum(vector<int>& nums) {
int f = 0, g = 0;
int ans = 0;
for (int& x : nums) {
f = max(f, 0) + x;
g = min(g, 0) + x;
ans = max({ans, f, abs(g)});
}
return ans;
}
}; | ALGO | 0.999983 | 6.126761 |
fe8164a2-5d3f-432d-8020-7b50fd1ca531 | tiankonguse/ACM | contest/ssssssss/1144.cpp | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<queue>
#include<map>
#include<cmath>
#include<stack>
#include<algorithm>
#include<functional>
using namespace std;
char ans[222];
void restr(char *str,int len){
int l=0,r=len-1;
char c;
while(l<r){
c=str[l];
str[l]=str[r];
str[... | ALGO | 0.999981 | 3.112725 |
9582d345-c0ea-4ab1-81c6-3823b4980efe | Prabhat-2101/Data_Structures_Basic_To_Advance | GreedyAlgorithm/assign_cookies.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxChildren(vector<int> &greed, vector<int> &cookie) {
sort(greed.begin(),greed.end());
sort(cookie.begin(),cookie.end());
int n1 = greed.size(), n2 = cookie.size();
int i=0,j=0;
while(i<n1 && j<n2)... | ALGO | 0.999373 | 4.872065 |
5ebc09ca-6415-405e-8f59-d49370f34a30 | Ravikumarjj/DSA-using-cpp | max sum subarray of size k.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
long maximumSumSubarray(int K, vector<int> &Arr , int N){
// code here
int s=0;
long maxi=INT_MIN;
long ans=0;
for(int i =0;i<K;i++){
ans+=Arr[... | ALGO | 0.999912 | 5.95843 |
d2576847-aadf-4a02-8608-adcc141f5966 | Nezz7/Competitive-programming | Training Marathons/1900/D. Office Keys.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define LL long long
#define LD long double
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const MAXN = 2000 + 9;
LL dp[MAXN][MAX... | ALGO | 0.999974 | 3.609207 |
fd113b23-9615-4a74-8b52-1443910a5857 | TacticalMeow/IKSolverLibigl | igl/lscm.cpp | #include "vector_area_matrix.h"
#include "cotmatrix.h"
#include "repdiag.h"
#include "min_quad_with_fixed.h"
#include <iostream>
IGL_INLINE bool igl::lscm(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& F,
const Eigen::VectorXi& b,
const Eigen::MatrixXd& bc,
Eigen::MatrixXd & V_uv)
{
using namespace Eige... | ALGO | 0.98608 | 5.781414 |
45f79452-8789-4d03-9b88-60376ac5807e | CaioS410/Comp_Paralela | lab01b - intro ao c/lab01b ex05.cpp | /* 5 Crie um programa capaz de multiplicar uma linha de uma matriz de inteiros
por um dado número. Faca o mesmo para uma coluna. A matriz deve ser lida de
teclado.*/
#include <iostream>
using namespace std;
int main(){
int linhas,colunas;
cout<<"Número de linhas: ";
cin>>linhas;
cout<<"Número de colunas: ";
... | ALGO | 0.988962 | 3.364714 |
211d8aa6-3579-4352-b1b8-7930ab69f509 | sagardeepesh2/DS-Recursion | Rec_string_subset.cpp | //Given a string print all the subset of it
#include<iostream>
using namespace std;
void printSub(string str,string curr=" ",int index=0)
{
if(index == str.length())
{
cout<<curr<<" ";
return;
}
printSub(str,curr,index+1);
printSub(str,curr+str[index],index+1);
}
int main()
{
str... | ALGO | 0.99914 | 4.706283 |
1df376b0-4d7a-4e12-87e0-fb298bf4d8f4 | ishandutta2007/codeforces | i_love_tanya_romanova/normal/87/C.cpp | #include <iostream>
#include <string>
#include <math.h>
#include <set>
#include <vector>
using namespace std;
long long ii,sq[200000];
long long q;long ts[500000],ans[500000],answ,was[2000];
vector <pair <long, long> >v[300000];
int main()
{long n;
cin>>n;
answ=1000000;
for (int i=1;i<=51000;i++)
{ii=i... | ALGO | 0.999907 | 3.546685 |
d716dcae-b4e1-407e-bae1-2edecd61d810 | CodeKwang/Blue-Bridge-Cup-2020-C- | 算法提高/算法提高 合并石子.cpp | #include<iostream>
#define INF 0x3f3f3f3f
using namespace std;
int m[1001][1001];//m[i][j]=min{m[i][k]+m[k+1][j]}+sum[j]-sum[i-1];iΪ,jΪյ
int s[1001][1001];//s[i][j]浱m[i][j]ʱķֽkֵ
int a[1001],sum[1001];
int main()
{
int n,i,k;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
if(i==0)
sum[i]=a[i];
else
sum[i]=sum[i-1... | ALGO | 0.999905 | 3.199246 |
a9544876-a8d5-4bc7-9167-ba03470bc222 | bony2023/Competitive-Programming | Others/SPOJ Randoms/032 SPOJ - HPYNOS.cpp | // Author : Bony Roopchandani
// HPYNOS
// Ad-Hoc
// INCLUDES
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using na... | ALGO | 0.999594 | 3.603896 |
8ce2f35a-1a3c-4a31-a503-8c841c726bce | chenan02/Interview-Practice | dynamic_programming/longest_common_subsequence/longest_common_subsequence.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<vector<int> > makeMatrix(string string1, string string2) {
vector<vector<int> > counts;
// initialize counts matrix of 0s
for(int i = 0; i < string1.size(); ++i) {
vector<int> column;
for(int j = 0;... | ALGO | 0.999918 | 4.637986 |
3e9e3426-68c1-4782-a99b-94921373e484 | ishandutta2007/codeforces | karuna/normal/1250/J.cpp | #include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int T;
int n, x, a, b;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> T;
while (T--) {
cin >> n >> x >> a >> b;
int ans = abs(b-a);
cout << min(n-1, ans+x) << '\n... | ALGO | 0.999766 | 4.176509 |
f2a2420d-0fd1-49c5-bd73-6b1b9452e03d | ASchneidman/HackCMU2018 | HackCMU2018/crawler/cpp_files/GeeksforGeeksLargest Number formed from an Array.cpp | <<<<<<< HEAD
#include <bits/stdc++.h>
using namespace std;
int a[1003];
bool cmp(const int &a,const int &b)
{
string ab=to_string(a)+to_string(b);
string ba=to_string(b)+to_string(a);
int f=stoi(ab);
int s=stoi(ba);
if(ab>=ba)
return true;
return false;
}
int main() {
//code
int t,n;
... | ALGO | 0.999918 | 4.896839 |
0adf4490-de17-4e39-b9a2-47d415a1e23e | ishandutta2007/codeforces | liouzhou_101/normal/1257/B.cpp | #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;... | ALGO | 0.999901 | 4.574934 |
e0df4f8c-c4b3-4870-b9b3-9ef8b3d8c23b | Linumm/LeetCode | 0078-subsets/0078-subsets.cpp | class Solution {
public:
vector<vector<int>> result;
vector<vector<int>> subsets(vector<int>& nums)
{
vector<int> empty_set;
result.push_back(empty_set);
if (nums.size() == 0)
return result;
for (int i=1; i<=nums.size(); i++) {
vector<int> tmp;
... | ALGO | 0.999901 | 6.06433 |
ee52eb3f-5254-4fef-a175-a77e50fa2fa9 | MarcioSousa/FatecAulas2016a2021 | 1 Semestre/Algoritmo e Logica de Programacao/30 de Setembro2/exercicio04.cpp | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
main(){
setlocale(LC_ALL,"Portuguese");
int numero;
printf("Digite um nmero: ");
scanf("%d", &numero);
switch(numero){
case 1:
printf("\nO ms digitado Janeiro.");
break;
case 2:
printf("\nO ms digitado Fevereiro.");
break;
case... | TOOL | 0.920756 | 3.324142 |
258ee647-67c6-4fbd-b374-816e13011889 | Sean95164/CP | Competitive_Programming_Udemy/Ch34_ShortestPathsAlgothms/Ex121_CheapestFlightWithinKStops.cpp | #include<bits/stdc++.h>
using namespace std;
int findCheapestPrice(int n, vector<vector<int>> flights, int src, int dst, int k) {
// using Bellman-ford algorithm
vector<int> dist(n, INT_MAX);
dist[src] = 0;
for (int i = 0; i < k+1; i++) {
// alway update the next node from known dist node step... | ALGO | 0.999792 | 5.226035 |
5c1bb788-dee4-4547-9f1b-1b762b1f0cd8 | pankajbanshiwal/DSA-CRACKER-4-TOPICS | Stacks&Queues/10_TheCelebrityProblem.cpp | //Approach : Stack
//Time Complexity : O(n)
//Space Complexity : O(n)
class Solution {
public:
int celebrity(vector<vector<int> >& M, int n) {
stack<int>st;
for(int i = 0; i < n; i++)
st.push(i);
while(st.size() >= 2){
int i = st.top();
st.pop();
... | ALGO | 0.999923 | 5.98659 |
c3af1036-560e-4c77-a925-da2a9be7db69 | Sruthikj/geeksforgeeks | Difficulty: Basic/Count Leaves in Binary Tree/count-leaves-in-binary-tree.cpp | /* A binary tree node has data, pointer to left child
and a pointer to right child
struct Node
{
int data;
Node* left;
Node* right;
}; */
// Class Solution
class Solution {
public:
// Function to count the number of leaf nodes in a binary tree.
void traversal(Node* root , int &count){
... | ALGO | 0.999543 | 6.522498 |
03d89595-9139-4998-b1c1-d95f897dac0d | kSagiri998/BSOJ-answers | 1083.cpp | #include<cstdio>
int f[5005],n,m,p;
int find(int t) {
if(f[t]==t) {
return t;
}
f[t]=find(f[t]);
return f[t];
}
void merge(int x,int y) {
int tx,ty;
tx=find(x);
ty=find(y);
if(tx==ty) {
return ;
}
f[ty]=tx;
return ;
}
int main() {
int i,x,y,s=0;
scanf("%d%d%d",&n,&m,&p);
for(i=1; i<=n; i++) {
f[i]=i... | ALGO | 0.999991 | 3.729396 |
4e46adfc-0a31-41f8-b782-0783c3eb0978 | PankajGit2711/DataStructures | Recursion/Recursion17 - CombinationSum2.cpp | /*************************************************************************************
Recursion - 17:- Combination Sum II - Leetcode (Recursion on Subsequences)
Time Complexity:- O(2^target) * O(length of combinations)
Space Complexity:- O(length * combinations)
****************************************************... | ALGO | 0.999995 | 5.983635 |
56a3d36d-e149-4262-bed8-4a92d6e02cfd | guricerin/algo-method-submissions | src/14_various-data-structure/07_stack-and-queue/01.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i64 = int64_t;
int main() {
vector<char> v;
v.push_back('A');
v.push_back('B');
v.push_back('C... | ALGO | 0.985821 | 3.469268 |
950e4b0a-c812-47ce-aece-75d14d60575a | ujjwalprakash17/Striver-A2Z-DSA-Series-Solutions | 12 Greedy Algorithms/01 Easy/02_FractionalKnapsack.cpp | #include <bits/stdc++.h>
using namespace std;
struct Item
{
int value;
int weight;
};
// bool basedOn()
// static bool basedOn(Item a, Item b) {
// double ratio_a = static_cast<double>(a.value) / a.weight;
// double ratio_b = static_cast<double>(b.value) / b.weight;
// return ratio_a > ratio_b; //... | ALGO | 0.999908 | 4.756442 |
2b1dc6db-6812-49c7-8cb5-e55e6cfa21d0 | s-nakaoka/choreonoid | src/Body/JointPath.cpp | /**
\file
\author Shin'ichiro Nakaoka
*/
#include "JointPath.h"
#include "Jacobian.h"
#include "Body.h"
#include "CustomJointPathHandler.h"
#include "BodyCustomizerInterface.h"
#include <cnoid/EigenUtil>
#include <cnoid/TruncatedSVD>
using namespace std;
using namespace cnoid;
double JointPath::numericalIKde... | ALGO | 0.996255 | 6.186447 |
64fb7443-1e14-4575-8f8c-4c39a1f08e2c | Samiatrix/Leetcode-Problems | 701-insert-into-a-binary-search-tree/701-insert-into-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999993 | 6.174613 |
3385e67e-1101-41a1-aaec-afec5ec3d654 | acbin/DS-and-Algorithms | docs/DS图遍历--深度优先搜索.cpp |
//DS图遍历--深度优先搜索
/*
题目描述
给出一个图的邻接矩阵,对图进行深度优先搜索,图的结点编号从0到n-1
输入
第一行输入t,表示有t个测试实例
第二行输入n,表示第1个图有n个结点
第三行起,每行输入邻接矩阵的一行,以此类推输入n行
第i个结点与其他结点如果相连则为1,无连接则为0,数据之间用空格隔开
以此类推输入下一个示例
输出
每行输出一个图的深度优先搜索结果,结点编号之间用空格隔开
样例输入
2
4
0 0 1 1
0 0 1 1
1 1 0 1
1 1 1 0
5
0 0 0 1 1
0 0 1 0 0
0 1 0 1 1
1 0 1 0 0
1 0 1 0 0
样例输出
0 2 1 ... | ALGO | 0.999961 | 5.279862 |
883b206a-6fe5-43fc-939c-8490565bdaa4 | prameetu/CP_codes | CODECHEF/magdoors.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long int
#define rep(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
void ans()
{
string s;
cin >> s;
auto curr = '1';
ll ans(0);
for(auto x:s){
if(curr != x){
ans++;
curr = x;
}
}
cout... | ALGO | 0.999976 | 4.543231 |
83844a08-c3af-426b-b00f-d79de2ff09d4 | riya1689/competitive_programming | Codeforces/decode_string/decode_string.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
vector <int> v;
string s;
cin >> s;
for(int i=s.size()-1;i>=0;i--)
{
if(... | ALGO | 0.99996 | 5.136 |
7829c4f3-e974-4c88-8334-fec9915ed55f | giyasht/Algorithms | Algorithms/Radix_sort.cpp | #include <iostream>
using namespace std;
int getMax(int arr[], int n)
{
int mx = arr[0];
for (int i = 1; i < n; i++)
if (arr[i] > mx)
mx = arr[i];
return mx;
}
void countSort(int arr[], int n, int exp)
{
int output[n];
int i, count[10] = { 0 };
for (i = 0; i < n; i++)
... | ALGO | 0.999865 | 5.293228 |
0418dd7a-f29f-4278-aa23-d931abc8f91f | Maulidin-Ilham/Pemorograman-Mobile | Pertemuan1/hello_world/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.997695 | 6.76073 |
4a9b50f4-63ec-4f51-97c7-2c1c62b88594 | Esheta10/GeeksForGeeks-Solutions | Difficulty: Medium/Aggressive Cows/aggressive-cows.cpp | //{ Driver Code Starts
// Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
// Function to check if it is feasible to place cows with at least `distance` apart
bool isFeasible(vector<int>& stalls,... | ALGO | 0.999755 | 5.767203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.