uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
d277bbf2-1754-4ecd-8f89-7ae3f43e2b8f
ghibli613/cp-coding
coding/codeforces/ct1665/B_ArrayCloningTechnique.cpp
// time-limit: 1000 // problem-url: https://codeforces.com/contest/1665/problem/B #include<bits/stdc++.h> using namespace std; #define nl '\n' #define M(_1, _2, _3, _4, NAME, ...) NAME #define rep(...) \ M(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rep4(_, x, n, s) \ for (int _ = x; (s < 0) ? _ > n ...
ALGO
0.999922
4.419109
66f7cc92-f1a5-4fbe-8609-7d7968f89784
ishandutta2007/codeforces
burnedchicken/normal/959/F.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define ull unsigned long long #define ld long double #define rep(a) rep1(i,a) #define rep1(i,a) rep2(i,0,a) #define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++) #define rep3(i,b,a) for(int i=(...
ALGO
0.999797
3.744826
02eea2d0-aadb-43aa-b627-1bc71947eed7
agral/CompetitiveProgramming
LeetCode/0341/cpp/lc0341.cpp
#include <cassert> #include <stack> #include <vector> #include "nested_integer.hpp" // Runtime complexity: O(n) // Aux space complexity: O(n) class NestedIterator { public: NestedIterator(std::vector<NestedInteger>& nestedList) { addVectorNi(nestedList); }; int next() { int ans = m_stack....
ALGO
0.984493
6.249602
faf07630-0421-444a-badb-0c25583a6bae
navneet96/DSA
Assignment20/Program7.cpp
/* 7. Write a program to count the number of vowels and consonants in a string using a pointer.*/ #include <stdio.h> int main() { char str[] = "HelloWorld"; char *p = str; int vowels = 0, consonants = 0; printf("String = %s\n",p); while (*p) { if((*p >= 'a' && *p <= 'z' ) || (*p >=...
ALGO
0.989843
3.635732
dfa3035a-7eee-46df-bfee-7cdd0b81327b
Mazzeich/Heapsort
priorityqueue.cpp
#include "PriorityQueue.h" #include <iostream> void PriorityQueue::heapify(int i) { int leftChild; int rightChild; int largestChild; for ( ; ; ) { leftChild = 2 * i + 1; rightChild = 2 * i + 2; largestChild = i; if (leftChild < que.size() && que[leftChild] > que[la...
ALGO
0.978839
4.611648
94f190b5-d00f-4f82-bb18-7af50385a9ca
Shell-Wataru/AtCoder
ARC/ARC126/E.cpp
#include <iostream> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <set> #include <map> #include <limits> #include <cmath> #include <iomanip> #include <functional> #include <random> #include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; using namespace std;...
ALGO
0.999886
3.564037
0a82de5a-3891-4397-964c-ab27285bc428
Abhrajyoti00/Competitive_Programming
CODEFORCES/C_Clock_Conversion.cpp
#include <iostream> #include <string> using namespace std; void solve() { string time_in_string; cin >> time_in_string; int minute = stoi(time_in_string.substr(3, 2)); int hour = stoi(time_in_string.substr(0, 2)); string period = (hour >= 12) ? "PM" : "AM"; if (hour > 12) hour -= 12;...
ALGO
0.994626
5.010221
88b222c4-310d-45b9-8888-bfcbb92abf8e
IsaacAsante/LeetCode-Solutions
268. Missing Number/missing number.cpp
/* Author: Isaac Asante * LeetCode URL for this problem: https://leetcode.com/problems/missing-number/ * Original video explanation: Pending * Last verified on: March 4, 2023 */ /* IMPORTANT: * C++ headers are missing from the code below. * Only the Solution class is included. */ class Solution { public: ...
ALGO
0.999623
6.653824
aa5722d6-4b77-444e-b04c-fae703c47a83
MaximilianYan/MCS
sources/231205_b23/A.cpp
#include <iostream> #include <random> #include <functional> #include <utility> #include <string> #include <sstream> #include <stdint.h> #include <set> using namespace std; class Edge { public: Edge(); Edge(int v1, int v2); friend istream& operator>>(istream& input, Edge& ro); friend bool operator<(co...
ALGO
0.999783
4.332977
915c8a48-0c0e-4cf9-ba42-b684871baa3a
Amarjeetkumar123/HackerBlocksQuestions-CodingBlocks-
UniqueNumber_I.cpp
#include<iostream> using namespace std; int main() { int n,res=0,i=1,num; cin>>n; while(i<=n){ cin>>num; res = res^num; i++; } cout<<res; return 0; }
ALGO
0.999992
3.487181
22103629-59f4-4cf6-bbb6-78ef32e6d639
programmingduo/ACMsteps
动态规划/树形dp/poj 1947.cpp
#include<cstdio> const int maxn = 10000000; int fa[158], son[159], bro[158]; int dp[155][155]; int n, p; int min(int x, int y) { return x<y? x: y; } void dfs(int id) { for(int i = 0; i <= p; i ++) { dp[id][i] = maxn; } dp[id][1] = 0; int k = son[id]; while(k) { dfs(k); ...
ALGO
0.999935
3.903884
501f5248-6c97-401e-9a2b-df81c8d43447
LakshayPiplani77/Coding-Problems
5. Recursively Sum N Numbers - GFG/5.-recursively-sum-n-numbers.cpp
// { Driver Code Starts #include <iostream> using namespace std; // } Driver Code Ends //User function Template for C++ class Solution{ public: int recursiveSum(int N) { //Your code here //Recursively sum from 1 to N and return if(N == 0) return 0; if(N == 1)...
ALGO
0.999879
6.589978
92bf7c24-505b-44a2-8c39-9a715db7c692
hhy5277/algorithm-4
code178.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: TreeNode *pre; bool isValidBST(TreeNode* root) { int res = 1; ...
ALGO
0.999998
6.860548
7429aa32-d0ce-44b1-acf9-b3ac54ce6cc7
sartajsehgal/DSA-Solutions
669-trim-a-binary-search-tree/669-trim-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.620207
4e4ebcf7-7d1a-480e-be49-bec7701d1436
aravindsomaraj/LeetCodes
Codes/0133-clone-graph/solution.cpp
/* // Definition for a Node. class Node { public: int val; vector<Node*> neighbors; Node() { val = 0; neighbors = vector<Node*>(); } Node(int _val) { val = _val; neighbors = vector<Node*>(); } Node(int _val, vector<Node*> _neighbors) { val = _val; ...
ALGO
0.999965
6.372389
fa09cc2c-1a5f-4e2c-b6b4-7d1af8aae6c6
phoenix29122003/Leetcode_questions
1110-delete-nodes-and-return-forest/1110-delete-nodes-and-return-forest.cpp
class Solution { public: void solve(TreeNode*&root,unordered_set<int>&set,vector<TreeNode*>&ans) { if(root==NULL) return; solve(root->left,set,ans); solve(root->right,set,ans); if(set.find(root->val)!=set.end()) { if(root->left) ans.push_back(root->left); ...
ALGO
0.999804
5.990853
d203d9d2-6e46-4483-b9f4-a96775c8fe33
JonathonMacleod/Distributed-Game-Architecture
libs/BOOST1.82.0/libs/graph/example/interior_pmap_bundled.cpp
#include <boost/config.hpp> #include <iostream> #include <algorithm> #include <boost/graph/adjacency_list.hpp> #include <boost/property_map/property_map.hpp> #include <string> using namespace std; using namespace boost; /* Interior Property Map Basics An interior property map is a way of associating properties ...
ALGO
0.999699
5.044138
efcbdf2f-7237-4406-b1f7-91a6440851ca
boruoyihao/algorithms
code/sort.cpp
#include<iostream> using namespace std; void swap(int &data1,int &data2){ int temp=data1; data1=data2; data2=temp; } void printArray(int * array,int start,int end){ for(int i=start;i<=end;i++){ cout<<array[i]<<" "; } cout<<endl; } /*快速排序*/ void quickSort(int *array,int start,int end){ ...
ALGO
0.999961
4.154224
c5da7fa6-4663-4332-b9b0-fb124aa40e49
DionysiosB/CodeForces
2021B-MaximizeMex.cpp
#include <cstdio> #include <vector> int main(){ long t; scanf("%ld", &t); while(t--){ long n, x; scanf("%ld %ld", &n, &x); std::vector<long> v(n, 0); for(long p = 0; p < n; p++){long b; scanf("%ld", &b); if(b < n){++v[b];}} long mex(n); for(long p = 0; p < n; p++){ ...
ALGO
0.999892
3.343468
5d53af1e-4b40-430d-8077-18a07262b125
dalzone/KefPowerService
KefPowerService/tools.cpp
#include "tools.h" #include <algorithm> using namespace std; // Removes leading and trailing whitespaces from a string string tools::trim(string line) { const char* whitespace = " \t"; size_t start = line.find_first_not_of(whitespace); size_t end = line.find_last_not_of(whitespace); if (start == string::npos || e...
TOOL
0.95746
5.08513
77e82d1a-5dc7-4541-ba45-1d3b4d580034
rashi174/Data-Structures
Graphs/representationOfGaph.cpp
#include<stdio.h> #include<bits/stdc++.h> #include<iostream> using namespace std; vector<pair<int , int>>adjList[100100]; int adjMat[1001][1001]; //adjMat[i][j] cost of edge i->j int main(){ int n, m; //number of vertices and edges cin >> n >> m; for (int i=0; i<m; i++){ int u, v, w; ...
ALGO
0.99997
4.224725
82be865b-f751-4f2e-bd01-6b3431ed953f
crdroidx/android_bionic
libc/bionic/semaphore.cpp
// Memory order requirements for POSIX semaphores appear unclear and are // currently interpreted inconsistently. // We conservatively prefer sequentially consistent operations for now. // CAUTION: This is more conservative than some other major implementations, // and may change if and when the issue is resolved. #in...
TOOL
0.925884
7.809152
9cfdb6a8-7c6e-42a2-a29c-786553d74e49
Karan-Kumar-Mishra/sorting-
merage sort.cpp
#include<iostream> #include<stdio.h> using namespace std; //merage sort void merge(int arr[],int l,int mid,int r) { int n1=mid-l+1; int n2=r-mid; int a[n1]; int b[n2]; for(int i=0; i<n1; i++) { a[i]=arr[l+i]; } for(int i=0; i<n2; i++) { b[i]=arr[mid+1+i]; } in...
ALGO
0.999986
4.391413
46de48ac-f2f4-4f40-8c31-f5b56f0535d1
PiscesDante/leetcode_solutions
150. Evaluate Reverse Polish Notation.cpp
/* * 解题思路: * 这个逆波兰表达式的求值的核心就是借助一个栈即可 */ class Solution { public: int evalRPN(vector<string>& tokens) { for (string ch : tokens) { if (ch == "+") { int second = value_stack.top(); value_stack.pop(); int first = value_stack.top(); ...
ALGO
0.999943
6.106489
78ea4d9a-ccac-43e6-b8d5-697ca1b13bb9
YunongPan/ma_ws
src/fast_gicp/thirdparty/Eigen/doc/examples/Tutorial_ArrayClass_interop.cpp
#include <Eigen/Dense> #include <iostream> using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = (m.array() + 4).matrix() * m; cout << "-- Combination 1: --" << endl << result << endl << e...
ALGO
0.999436
4.531452
b9543162-f8f8-4ea3-a54b-92370c165713
sourav-9091/DSA-SYNTEX
Coding Ninjas/lec_9_sorting_searching/Sort012.cpp
#include <iostream> using namespace std; void swap(int& a, int& b){ int t=a; a=b; b=t; } void sort(int *arr, int n){ int low=0; int mid=0; int high=n-1; while(mid<=high){ if(arr[mid]==0){ swap(arr[mid],arr[low]); mid++; low++; }else if(arr[...
ALGO
0.999654
5.19256
0329d3be-a9b6-4733-908e-66853070d265
AnsonHooL/Coding_Note
leetcode/【区间动态规划】5.最长回文子串.cpp
// // Created by lenovo on 2020/12/24. // ///最长回文 ///cabbxxxbbaf,返回长度9:abbxxxbba ///暴力法往往能给我们带来提示进行优化 ///暴力法也有用的哟,慢慢优化才是正常思维 ///暴力法,从pos i ~ j,暴力遍历看是否为回文,j>i O(n*n*n) ///中心扩散O(n*n) ///每个字符都作为中心去看是否有回文串 class Solution { public: int findlong(const string s,int start, int& len) { int low = start; ...
ALGO
0.999797
5.075498
fc7424dd-05b5-4f0f-9bef-99af8e28f2c5
GabrielNathanael/Algoritma-dan-Pemrograman
file csv.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LENGTH 100 struct Student { char student_id[MAX_LENGTH]; char name[MAX_LENGTH]; float grade; }; void addStudent(struct Student students[], int *count) { struct Student newStudent; printf("Input Enter Student ID: "); fgets...
TOOL
0.966089
5.285219
dc702457-2e91-4ff8-a30a-b5d648bea1b5
tylerwolverton/RayTracer
Sphere.cpp
#include "Sphere.h" #include <math.h> Sphere::~Sphere() { delete(Mat); } bool Sphere::Hit(const Rayf& ray, float tMin, float tMax, HitRecord_t& rec) const { // Sphere: R^2 = (x - cx)^2 + (y - cy)^2 + (z - cz)^2 // dot(p - c) // Do algebra a bit to find a, b, and c then use quadratic formula to find discriminant ...
ALGO
0.895187
5.819219
d56fc864-e2b9-4e03-8c1a-1a7adc39a102
reedacartwright/mcberepair
blockposhash.cpp
#include <iostream> #include <string> #include <sstream> unsigned long hash(unsigned long a, unsigned long b) { a ^= b + (a << 6) + (a >> 2) + 0x9e3779b9; return a; } unsigned long hash_blockpos(int x, int y, int z) { unsigned long seed = hash(0, x); seed = hash(seed, y); seed = hash(seed, z); ...
ALGO
0.996096
4.930534
1d8bd041-b470-48cb-957b-7f9a4bba654a
UnlivedLeech01/Algoritmia
amazed.cpp
#include <bits/stdc++.h> using namespace std; using p2i=pair<int, int>; #define INF INT_MAX void Solve() { int n; cin>>n; vector<int>dias(n); for(auto &i:dias) cin>>i; dias.push_back(0); int resp=0; for(int i=0; i<n; i++) { int cont=1; int j=i+1; while(di...
ALGO
0.999967
4.241961
40884013-65bc-4e40-a478-24d2e32a36eb
masterchief007/UnrealEngine
Engine/Plugins/Experimental/GeometryProcessing/Source/GeometricObjects/Private/CompGeom/PolygonTriangulation.cpp
#include "CompGeom/PolygonTriangulation.h" #include "TriangleTypes.h" // explicit instantiations namespace PolygonTriangulation { template GEOMETRICOBJECTS_API void TriangulateSimplePolygon<float>(const TArray<FVector2<float>>& VertexPositions, TArray<FIndex3i>& OutTriangles); template GEOMETRICOBJECTS_API void Tria...
ALGO
0.99847
7.786338
704e7db5-099d-48ec-afd7-930e5606d6ed
JiFeiYe/C_Cplusplus
Introduce_of_Algorithm/23.3.6/H.cpp
#include <iostream> #include <stack> using namespace std; char str[110]; stack<char> st; int main() { int i = 0; while (cin >> str[i++]); int flag = 1; for(int j = 0; j < i; j++) { if(str[j] == '(' || str[j] == '[' || str[j] == '{') { st.push(str[j]); } e...
ALGO
0.999885
4.445524
26413bf2-c6e6-43c9-be3f-ef104d444cd7
paolaguarasci/fondEs
20171102_01v1.cpp
/* * Esercizio 1. Implementare in C++ un programma che simuli (in maniera molto semplice) un seggio elettorale. In pratica si sa che ci sono 3 candidati (per semplicità siano 1, 2, 3). Si deve leggere da input una sequenza, i cui possibili valori sono quattro: 1, 2, 3, 0, dove 0 è il tappo (sta per “fine”), e si suppo...
ALGO
0.998908
4.883554
e9a29c7a-5c5e-4f56-a1fb-4b3eee350d04
myshlee417/ProjectEuler
problem_51_to_100/problem_82.cpp
#include <iostream> #include <fstream> #include <stdio.h> #include <vector> #include <math.h> #include <string> #include <algorithm> #include <stdlib.h> #include <time.h> #pragma warning(disable:4996) using namespace std; int main(int argc, const char * argv[]) { ifstream in("matrix.txt"); string input_s...
ALGO
0.999843
3.210977
47f1cf8d-435e-4b2b-ab67-af2f4be51721
Soulflayer1337/Homework
Second_Semester/Tests/FirstTest/findpair.cpp
#include "findpair.h" #include "cstdio" #include "cstdlib" #include "ctime" FindPair::FindPair(unsigned int size) : matrix(new Matrix(size)) , numberOfPairs(0) { srand(time(NULL)); if (size < 2) { delete matrix; throw NotAllowedSizeException(); } int numberOfOne = 0; for (uns...
TOOL
0.918793
5.208734
9bae5dd6-38d2-47df-9862-48d60765dcd8
ishandutta2007/codeforces
egor.lifar/normal/706/C.cpp
#include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <string> #include <string.h> #include <cstdio> #include <vector> #include <map> #include <set> #include <cstring> #include <queue> #include <bitset> #include <queue> #include <unordered_map> using namespace std; int n; int c[100001]...
ALGO
0.999879
3.492465
91e89a75-68e4-4e80-9064-b6c211edfd82
Arkzeil/leetcode
leetcode/242.cpp
class Solution { public: bool isAnagram(string s, string t) { if(s.size() != t.size()) return false; sort(s.begin(), s.end()); sort(t.begin(), t.end()); for(int count = 0; count < t.size(); count++){ if(s[count] != t[count]) return false; ...
ALGO
0.999984
6.274974
fdcf9560-ee6f-47c5-8716-900d57fe2d38
ghugesachin0806/Data_Structure_n_Algorithm
12_Graph/69_Number_of_provinces_Disjoint_set_union.cpp
// https://practice.geeksforgeeks.org/problems/number-of-provinces/1 #include <bits/stdc++.h> using namespace std; class Disjoint { public: vector<int> size; vector<int> parent; // constructor // n is no. of nodes in the graph Disjoint(int n) { // below defined vector size can be used ...
ALGO
0.99996
6.021313
458ea088-295e-42c1-8c83-a3a0d5fe2821
wael-suleiman-UdeS/RobotFoot
Darwin/Eigen/bench/product_threshold.cpp
#include <iostream> #include <Eigen/Core> #include <bench/BenchTimer.h> using namespace Eigen; using namespace std; #define END 9 template<int S> struct map_size { enum { ret = S }; }; template<> struct map_size<10> { enum { ret = 20 }; }; template<> struct map_size<11> { enum { ret = 50 }; }; template<> struct ...
TOOL
0.952465
5.102006
d411143f-a4d1-4305-82e0-74042ff991fe
thegamer1907/Code_Analysis
scrape/data/Organized/goku98/goku98_A.cpp
#include <bits/stdc++.h> using namespace std; # define int long long signed main () { int n,m,k; cin>>n>>m>>k; int a[m]; for(int i=0;i<m;i++) cin>>a[i]; //sort(a,a+m); int i=0,c=0,j = (a[0]/k); if(a[0]%k!=0) j++; int pr=i; while(i<m) { // cout<<j<<" "; while(a[i]<=j*k + pr) { ...
ALGO
0.999929
3.447559
138cdffb-30c2-4163-a7dc-b14c862688bb
rumdien113/Algorithm
CODEFORCES/CF_TAGS/STRINGS/Anton_and_Polyhedrons.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pf push_front #define db long double #define st first #define nd second #define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL); #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #define all(x...
ALGO
0.999637
5.24567
caf40085-e676-4fce-ad69-cc912ceddef9
kamyu104/LeetCode-Solutions
C++/occurrences-after-bigram.cpp
// Time: O(n) // Space: O(1) class Solution { public: vector<string> findOcurrences(string text, string first, string second) { vector<string> result; first.push_back(' '); second.push_back(' '); string third; int i = 0, j = 0, k = 0; while (k < text.length()) { ...
ALGO
0.99996
5.901312
b483c7e6-9cf1-49a8-9cb2-54db90a43c93
lucasxia01/Competitive-Programming-Problems
Facebook Hacker Cup/2023/Round 1/E.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll,ll> pl; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; #define F0R(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = ...
ALGO
0.999918
4.734623
b95e4d41-5a52-4bf7-9dc8-ca7ed8fd273c
paaban25/CP
Codeforces/Round 156 (Div. 2)/Fear_of_the_Dark.cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ double Px,Py,Ax,Ay,Bx,By; cin>>Px>>Py>>Ax>>Ay>>Bx>>By; } return 0; }
ALGO
0.887025
3.58285
0cf3c4af-79c3-4259-aa5d-9458bf4a379c
boostorg/odeint
examples/ublas/lorenz_ublas.cpp
#include <iostream> #include <boost/numeric/odeint.hpp> #include <boost/numeric/ublas/vector.hpp> typedef boost::numeric::ublas::vector< double > state_type; void lorenz( const state_type &x , state_type &dxdt , const double t ) { const double sigma( 10.0 ); const double R( 28.0 ); const double b( 8.0 / ...
ALGO
0.999914
6.94108
53507f50-ab9c-490e-8a3b-1f9cb9bfbede
hefani/Algorithm
Fundamental Algorithms/Search & Sorting/Sorting/merge sort.cpp
#include<bits/stdc++.h> using namespace std; int a[1000]; void input (int n) { for(int i=0;i<n;i++) { cin>>a[i]; } } void merge_sort(int s, int e) { if (e - s <= 1) return; int mid = (s + e) / 2; merge_sort(s, mid); merge_sort(mid, e); vector<int> temp; int i = s, j = mid; while (i < mid && j < e) { ...
ALGO
0.999968
4.05386
b74a1397-08a2-4ac8-b520-bba1baac5e30
jesusalatorre/C-Fundamentals
First Loop/main.cpp
#include <iostream> using namespace std; int main() { int n, i, result; bool prime; cout << "Please input the desired value of n: " << endl; cin >> n; for (i=2; i<n; i++) { result=n%i; if (result==0){ prime=false; break; } else ...
ALGO
0.99978
3.381324
94a2d4fd-7a93-44f6-a4a1-ad884b23535c
HnpawsPham/CP-PROBLEMS
IT_Squad_Journey/THCS/btapTuan3/b3.cpp
#include <bits/stdc++.h> using namespace std; int ngto(int value){ int sum=0; for(int i=2;i<value;i++){ if(value%i==0){ sum++; } } if(sum==0){ return true; } return false; } int main(){ fstream fi,out; fi.open("./txtFiles/in3.txt"); out.open("./tx...
ALGO
0.997897
3.964957
27799682-65d6-4f1a-bf69-0797f76d604a
nmpasdekis/DeepNeuralNets
eigen-eigen-323c052e1731/doc/examples/TutorialLinAlgRankRevealing.cpp
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Matrix3f A; A << 1, 2, 5, 2, 1, 4, 3, 0, 3; cout << "Here is the matrix A:\n" << A << endl; FullPivLU<Matrix3f> lu_decomp(A); cout << "The rank of A is " << lu_decomp.rank() << endl; c...
ALGO
0.999846
3.720849
74e36df4-37c5-40e6-86a0-d4e2d448724c
iamrakesh28/Competitve-Programming
contest/april/p1.cpp
#include <iostream> using namespace std; const int N = 105; int h[N]; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; ++i) { int n; scanf("%d", &n); for (int j = 0; j < n; ++j) scanf("%d", h + j); int ans = 0; for (int j = 1; j < n - 1; ++j) { if (h[j] > h[j - 1] && ...
ALGO
0.99886
3.77074
2fdd50b7-f8c2-4b59-bb70-f55f84e73f5a
TingruiZh/LeetCode
memoization/climbing-stairs.cpp
class Solution { public: int climbStairs(int n) { vector<int>stair(n+1); stair[0]=1; stair[1]=1; for(int i=2;i<n+1;i++){ stair[i]=stair[i-1]+stair[i-2]; } return stair[n]; } };
ALGO
0.999991
5.902496
885e1e71-5bc1-4006-8a42-d31ff76b23c4
rstancioiu/Uva-online-judge
Volume103/10340 - All in All/10340.cpp
// Author: Stancioiu Nicu Razvan // Problem: http://uva.onlinejudge.org/external/103/10340.html #include <iostream> #include <string> using namespace std; int main() { string s1,s2; while(cin>>s1>>s2) { if(s2.length()<s1.length()) { cout<<"No"<<endl; } else { int i=0; int j=0; for(;i<s2.lengt...
ALGO
0.999961
3.491076
5ff41fe6-3790-4baa-ab3c-5b3f58abf7fb
G1rmmr/code-test
BOJ/C++/26518_limit_of_sequence.cpp
#include <iostream> #include <array> typedef long double LD; double GetRecurRelation(std::array<LD, 3>& Elements) { LD B = Elements[0], C = Elements[1]; int i = 1000000; while (i--) { Elements[2] = B + C / (Elements[2]); } return Elements[2]; } int main() { std::array<LD, 4> Elem...
ALGO
0.999783
3.623718
76d92217-cd9b-49d6-8de6-7cb9110f78af
Shresth-kaushik/dataStructure_And_Algorithm
DP/longest_common_substring.cpp
// Extended version of the Longest common subsequence question :> /* Problem Statement => Given two strings ‘X’ and ‘Y’, find the length of the longest common substring. Examples: Input : X = “GeeksforGeeks”, y = “GeeksQuiz” Output : 5 The longest common substring is “Geeks” and is of length 5. */ /* Approach 1 : ...
ALGO
0.999951
5.908391
03f0d3de-7e8e-4145-9279-1dd1f7963943
TaeYongHwang/HyHIT
Taeyong/백준/1450.cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int N, C; vector<int> weight; void findSum(int start, int end, int sum, vector<int>&v) { if (sum > C) return; if (start > end) return v.push_back(sum); findSum(start + 1, end, sum + weight[start], v); findSum(start + 1, end, sum,...
ALGO
0.999954
3.981483
64e377e2-f32c-4fc2-b90a-9deb1d7eed57
759713112/my_ceph
src/boost/libs/graph/example/prim-example.cpp
int main() { using namespace boost; typedef adjacency_list< vecS, vecS, undirectedS, property< vertex_distance_t, int >, property< edge_weight_t, int > > Graph; typedef std::pair< int, int > E; const int num_nodes = 5; E edges[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3)...
ALGO
0.999903
4.209002
12e81a0d-7006-4d0e-a9ba-c0203e710431
shobhitexp/Program-in-cpp
practice9.cpp
#include <bits/stdc++.h> using namespace std; // This function returns value // of a Roman symbol int value(char r) { if (r == 'I') return 1; if (r == 'V') return 5; if (r == 'X') return 10; if (r == 'L') return 50; if (r == 'C') return 100; if (r == 'D') return 500; if (r == 'M') return 1000; r...
ALGO
0.999488
5.988712
db1d6199-b388-4fc3-8497-a21a6df47adc
0xmohitsen/Superme-DSA-Code
function related problems/even_odd.cpp
#include<iostream> using namespace std; void checkEvenOdd(int num){ if( num % 2 == 0){ cout<<"Number is Even."<<"\n"; } else{ cout<<"Number is Odd."<<"\n"; } } int main(){ int num; cin>>num; checkEvenOdd(num); return 0; }
ALGO
0.998954
5.176168
90abf814-68e9-42d3-8fea-dbad4668b36f
lzyrapx/Codeforces
#368 (Div. 2)A.cpp
#pragma comment(linker, "/STACK:102400000,102400000") //#include<bits/stdc++.h> #include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<cstring> #include<vector> #include<map> #include<cmath> #include<queue> #include<set> #include<stack> #include <utility> using namespace std; typedef long ...
ALGO
0.999761
3.909659
9d3e0821-3506-46b4-abd1-0d4cf61cc2b9
MengxuanHUANG/MayaPlugin_LSystem
main.cpp
#include <stdio.h> #include <math.h> #include <iostream> #include "LSystem.h" int main(int argc, char **argv) { LSystem system; system.loadProgramFromString("F\nF->F[+F]F[-F]F"); system.setDefaultAngle(25.7f); system.setDefaultStep(1.0f); for (int i = 0; i < 2; i++) { std::string insn =...
TOOL
0.976259
4.35561
ea6dbb24-2507-47c8-a65d-a3d50c0150cb
gokixus/C-Learning
4_fonksiyonlar_functions/sicaklik_degeri_santigrat_fahrenhayt_cevirme.cpp
#include <stdio.h> int cdenfye(int n) { return 9*n/5 + 32; } void fdencye(int ) { } int main() { int sicaklik; printf("Sicaklik degerini fahrenhayt'a cevirmek icin santigraf cinsinden sicaklik derecesi yaziniz : "); scanf("%d", &sicaklik); printf("\nF = %d", cdenfye(sicaklik)); return 0; }
ALGO
0.992823
3.911083
1fef2033-c10e-4c5d-84b3-ef5ba28dc8ce
manakupadhyay/LeetCode
Linked List/P-21 Merge two sorted list.cpp
/* Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4 */ ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { ListNode *head = new ListNode(-1); ListNo...
ALGO
0.999923
5.674928
1cd763f4-8d29-4cb9-9b11-fc642ec7947d
gmarshburn/raytracer
src/shapes/sphere.cpp
#include "sphere.h" // A struct to model a sphere and its implicit equation in the 3D world Sphere::Sphere(glm::mat4 new_ctm, PrimitiveType new_type, SceneMaterial &new_material){ ctm = new_ctm; type = new_type; material = new_material; } IntersectInfo Sphere::traceRay(glm::vec4 p, glm::vec4 d){ glm...
ALGO
0.987258
4.902933
32d62871-7d41-46ee-97a4-10e0a0624054
n0IQ/Competitive-Programming
atcoder/abc294/C.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve() { int n, m; cin >> n >> m; vector<ll> a(n), b(m); for (auto &x : a) cin >> x; for (auto &x : b) cin >> x; a.push_back(LLONG_MAX); b.push_back(LLONG_MAX); vector<ll> posA(n), posB(m); int i = 0, j = 0, pos = 1; while (i < n ||...
ALGO
0.999993
3.343554
6f1fe70b-87f1-42c4-a2b1-5972303959fa
Johniel/contests
codeforces/905div3/C/main.cpp
// github.com/Johniel/contests // codeforces/905div3/C/main.cpp #include <bits/stdc++.h> #define each(i, c) for (auto& i : c) #define each_with_index(i, e, c) for (const auto i: views::iota(0, (int)c.size())) if (auto& e = c.at(i); true) #define each_pair(p, c) for (const auto _i: views::iota(0, (int)c.size())) if (s...
ALGO
0.999963
4.244581
a07fb222-44fd-4f39-a2c7-3709ea33421d
gokul170923/DSAandCP
DP/D_Knapsack_1.cpp
#include <bits/stdc++.h> using namespace std; #define yes cout<<"YES\n" #define no cout<<"NO\n" #define nl '\n' #define ll long long #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() ll recc(vector<pair<ll,ll>>&arr,ll n,ll k){ if(n==0) return 0; ll take = 0; if(arr[...
ALGO
0.99994
4.051278
51bd953e-8cc7-4e53-97fb-9cb436a8cda6
abaron10/CompetitiveProgramming
LeetCode/HashMap/phone_letter_combinations.cpp
#include<iostream> #include<string> #include<vector> #include<unordered_map> using namespace std; vector<string> letterCombinations(string digits) { if (digits == "") { return {}; } unordered_map<char, string> m = {{'2', "abc"}, {'3', "def"}, {'4', "ghi"}, {'5', "jkl"}, {'6', "mno"}, {'7', "...
ALGO
0.999873
7.331854
0434c390-2f04-42db-86f5-f4f9be5afb84
prakharr5/ACMBMU_Hacktoberfest
sahil_sortingbubble.cpp
#include<iostream> using namespace std; int main() { int n; cin>>n; //bubble sorting //repeatedly sorting two adjacent elements if they are in wrong order. // we have to do n-1 alteration for our sorted array int arr[n]; for (int i = 0; i < n; i++) { cin>>arr[i]; } int counter=1; while (counter<n){ for (in...
ALGO
0.999916
3.525371
23b9fea2-49cf-4aa9-be34-799955c9da69
alexanderwalford-official/6502-Emulator
6502 Emu/main.cpp
#include <stdio.h> #include <stdlib.h> #include <vector> // keyword & byte value references using byte = unsigned char; using wrd = unsigned short; using u32 = unsigned int; struct memory { static constexpr u32 max_memory = 1024 * 64; // max memory, change to suit your needs byte data[max_memory]; // data val...
TOOL
0.983753
4.57714
88450e82-c257-46dd-8e89-ab93250e370b
jamoju/C-
Longest Common Prefix/exercicio4.cpp
#include <string> #include <vector> #include <iostream> class Solution { public: std::string longestCommonPrefix(std::vector<std::string>& strs) { int j, k; std::string resultado = ""; bool commonprefixfound = false; if (strs.size () < 1 || strs.size () > 200) { return...
ALGO
0.964816
5.320019
15b4e5d7-f836-4ef3-bafc-07a0f9938041
za233/Polaris-Obfuscator
src/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/ranges_is_heap.pass.cpp
// UNSUPPORTED: c++03, c++11, c++14, c++17 // <algorithm> // template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, // indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // S...
TEST
0.914447
7.298699
1c01b55e-bf2b-4064-82e2-ab096d3b5ca4
cran/rayrender
src/quaternion.cpp
#include "quaternion.h" #include "transform.h" // Quaternion Method Definitions Transform Quaternion::ToTransform() const { Float xx = v.x() * v.x(), yy = v.y() * v.y(), zz = v.z() * v.z(); Float xy = v.x() * v.y(), xz = v.x() * v.z(), yz = v.y() * v.z(); Float wx = v.x() * w, wy = v.y() * w, wz = v.z() * w; ...
ALGO
0.92259
6.959987
23ccded6-7d27-4c74-bd2c-97c79cbd61f1
ishandutta2007/codeforces
rui_er/normal/1761/D.cpp
// LUOGU_RID: 95056121 // Problem: Carry Bit // Contest: Codeforces // URL: https://m2.codeforces.com/contest/1761/problem/D // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) //By: OIer rui_er #include <bits/stdc++.h> #define rep(x,y,z) for(ll x=(y);x<=(z);x++) #define p...
ALGO
0.99998
3.892311
d39010df-b7a9-44ef-af27-7e0a6190c660
chernienkovlad/CT-3-Semester
8/5.cpp
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int letter_counter(string str, char ch); int main() { vector<string> vec(3); for (int i = 0; i < vec.size(); i++) cin >> vec[i]; sort(vec.begin(), vec.end()); for (auto string : vec) co...
ALGO
0.997559
4.895736
23c0c036-d4a1-43d8-b180-7a28b9c2bae4
VenusHui/VenusHui
ACM-ICPC/LeetCode/P226.cpp
// 226. 翻转二叉树 /** * 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 *righ...
ALGO
0.999951
6.445261
39544fed-3bf8-4e7d-92a6-d9fcaf3ad54d
polianachagas/target_devTest
questao2.cpp
#include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; int main() { int number; cin >> number; int fib, fibAnt1 = 1, fibAnt2 = 0; bool hasNumber = false; if (number <= 1) { return number; } else { for (int i = 3; i <= number; i++)...
ALGO
0.999967
4.535224
693046ce-1b3c-4faf-b984-b9d64f6619c2
tomotakaeru/atcoder
200802_ABC174/C - Repsept.cpp
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define REP(i,s,n) for(int i=s; i<(n); ++i) #define ALL(n) begin(n),end(n) using ll = long long; const ll INF = 1e18; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chm...
ALGO
0.998837
4.009549
14bf05be-8961-4121-9d33-e7512acf7546
kalectro/pcl_groovy
examples/keypoints/example_sift_normal_keypoint_estimation.cpp
// STL #include <iostream> // PCL #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> #include <pcl/common/io.h> #include <pcl/keypoints/sift_keypoint.h> #include <pcl/features/normal_3d.h> // #include <pcl/visualization/pcl_visualizer.h> /* This example shows how to estimate the SIFT points based on the * Norma...
ALGO
0.97306
5.791445
814bbd3e-90ad-4d9c-95c2-b0cc0698b22f
cherry900606/OJ_Solutions
CPE/100.cpp
#include <iostream> using namespace std; int main() { int a,b; while(cin>>a>>b) { int max_times=1; cout<<a<<" "<<b<<" "; if(a>b) swap(a,b); for(int i=a;i<=b;i++) { int times=1,n=i; while(n!=1) { times++; ...
ALGO
0.999968
4.117179
f60edcfc-32bb-4508-88fc-ffd9f318f910
AbhishekChauhan9036/Newton-School-June-2022-Batch
Dec Assignment/General_Math/CheckIfPrime.cpp
#include <bits/stdc++.h> // header file includes every Standard library using namespace std; void fun(int n){ int i, m=0, flag=0; m=n; for(i = 2; i <= sqrt(m); i++) { if(n % i == 0) { cout<<"No"<<endl; flag=1; break; } } if (flag==0) ...
ALGO
0.999857
3.85123
4372e6fb-509a-4514-9cd2-51dcef191278
vikks143/atclib
branch/atul-dac-prog/cpp-Program/complex/complex.cpp
#include <stdio.h> #include<iostream.h> class Complex { private: int real; int imag; public: static int cnt; Complex(); Complex(int r, int i); Complex operator=(Complex& c); Complex operator++(); Complex operator++(int); Complex operator--(); Complex operator--(int); Complex operator-(Complex c1); Complex ...
ALGO
0.89963
3.983707
c7b87a94-ccd2-431f-90b3-665aae281160
bad-coco/LeetCode
breadth-first-search/reorder-routes-to-make-all-paths-lead-to-the-city-zero.cpp
class Solution { private: void dfs(unordered_map<int,vector<int>>& graph, vector<int>& visited, int source, int& result) { visited[source] =1; for(auto neighbour : graph[source]) { if(!visited[abs(neighbour)]) { if(neighbour>0) // forward p...
ALGO
0.999979
5.549175
b718b2b8-ba90-486d-90e5-a68d429cea98
Chandan2080/1BM18CS025_ADA
GCD.cpp
#include <iostream> using namespace std; int gcd(int m, int n){ int rem = 0; do{ rem = m % n; if(rem == 0) break; m = n; n = rem; } while(rem != 0); return n; } int main(){ int m, n; cout << "Enter the larger number: "; cin >> m; cout << "Enter small...
ALGO
0.98777
4.542101
1a1d9953-eac8-434d-ab49-19311246feb5
cbajs12/BOJ
stack/10828.cpp
#include <iostream> #include <string> #include <memory.h> using namespace std; struct Node{ int data; Node* next; int isEmpty; int count; }; void initStack(Node* header){ header->data = 0; header->next = nullptr; header->isEmpty = 1; header->count = 0; } void push(Node* header, int da...
ALGO
0.999509
4.022482
fefbb93c-10d3-4b2c-a51e-f0281163dd0e
izayoi5776/snd
cpp_example/CHANT.cpp
#include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #define _USE_MATH_DEFINES #include <math.h> #include "wavlib.h" #include <conio.h> extern int FOF(double *s, double Cf, double BW, double A, double Atk, double Iphase, int fs, int Np); int CHANT(int argc, char*argv[]) { int fmt_id, Nformant...
TOOL
0.916739
3.527821
ee15a4e3-620c-4f86-bfd2-4a2a0610d141
rayenbbs/CP4_Competitive_Programming_Book_Problems
UVA/Divide And Conquer/Ternary Search and Other/UVA_12893.cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<long long, long long> #define vi vector<int> #define vii vector<vi> #define vll vector<long long> #define mii map<int, int> #define si set<int> #define sc set<char> #define umap unordered_map #define uset uno...
ALGO
0.999937
5.368549
fed9d55e-5009-4da5-bd1a-14acc8a7ded7
Someijam/Final-Exam-Simulation
Final1Prog4.CPP
/*ĿλѧѧŴ16ġѧſεijɼֱһάchinesemathС Ҫ 1.дsortеô˺ɼߵ 2.дƽֵĺaverageеô˺γ̵ƽ֣ 3.дlessAverage,еô˺ƽֵ עͬһĿѧɼͬ .JPG -------------------------------------------------------*/ #include <iostream> using namespace std; /**********Program**********/ void sort(double *score,int *id,int n) { int i,j,max,tempId; double temp; for(i=...
ALGO
0.999288
3.664478
f621b0da-1156-41d1-ad11-9c5df41a1f5a
ishandutta2007/codeforces
fedoseev.timofey/normal/1009/D.cpp
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #include <ctime> #include <random> #include <cmath> #include <bitset> #include <iomanip> #include <list> #include <unordered_set> #include <unordered_map> #include <cassert> using...
ALGO
0.999789
3.754474
5f6ec15b-4bb4-4e44-a93d-909bfa285202
sarvex/leetcode-assembly
solution/1800-1899/1815.Maximum Number of Groups Getting Fresh Donuts/Solution.cpp
class Solution { public: int maxHappyGroups(int batchSize, vector<int>& groups) { using ll = long long; unordered_map<ll, int> f; ll state = 0; int ans = 0; for (auto& v : groups) { int i = v % batchSize; ans += i == 0; if (i) { ...
ALGO
0.999915
5.888699
903845e9-cef0-47de-b76e-9082fd532ce2
Anagha18/SoLoMoBro_Server
app/src/main/cpp/ClusterCreate.cpp
// // Created by karan on 18-05-2020. // #include "ClusterCreate.h" #include "util.h" /* This is the final code written for ClusterCreate, a framework for task distribution in Android devices This file contains all the functions that is used in setting up server and client and also handline server and client fault to...
WEB
0.97893
3.236481
77d58693-d448-4afa-a3ba-61f1bbdb75b8
Aman-Manwani/MY-LEETCODE-DAILY-SUBMISSIONS
0491-non-decreasing-subsequences/0491-non-decreasing-subsequences.cpp
class Solution { public: void solve(int index,vector<int>& nums,vector<int>& temp,set<vector<int>>&s) { //base case if(index==nums.size()) { if(temp.size()>=2) { s.insert(temp); } return; } //rec case ...
ALGO
0.999992
6.064831
45bc1c4e-60f8-4bc9-9990-178f32120f4a
Inderway/MyProjects
linkList/List.cpp
#include "stdafx.h" #include"List.h" #include<iostream> using namespace std; void SiCircList::input(int a[],int size) { linkNode*newNode; for (int i = 0; i < size; i++) { newNode = new linkNode(a[i]); if (newNode == nullptr) { cerr << "洢" << endl; exit(1); } newNode->link = first; rear->link = newN...
ALGO
0.997068
3.516072
035e02ee-7179-4ce8-9749-7c476dc88225
smitty-burger/Project_Delta
Project_Delta.cpp
//=========================================================================== //Delta.cpp // // //Input: // N/A // //Output: // Captains_Log.txt // //=========================================================================== #include "stdafx.h" #include <conio.h> #include <iostream> #include <stdio.h> #include <s...
ALGO
0.967092
3.887166
67c48d61-849f-4fe7-a14c-08d28fbee2e6
DyhaCreator/programming_tasks
CodeForcesRound/nar/2000E.cpp
#include <algorithm> #include <iostream> #include <vector> #include <set> #include <map> using namespace std; using ll = long long; const int INF = 1e9 + 7; void solve() { int n, m, k; cin >> n >> m >> k; int w; cin >> w; vector<int> a(w); for (auto &x : a) cin >> x; vector<vector<...
ALGO
0.999982
3.728467
682aade1-d4fc-4bf5-8738-033018dea873
GarageGames/Qt
qt-5/qtwebkit/Source/JavaScriptCore/dfg/DFGDominators.cpp
#include "config.h" #include "DFGDominators.h" #if ENABLE(DFG_JIT) #include "DFGGraph.h" namespace JSC { namespace DFG { Dominators::Dominators() : m_valid(false) { } Dominators::~Dominators() { } void Dominators::compute(Graph& graph) { // This implements a naive dominator solver. ASSERT(graph.m...
ALGO
0.992975
7.480919
a3d1e01c-3621-42c4-95ab-33d6eb908537
actium/codeforces
0600/30/637c.cpp
#include <iostream> #include <vector> template <typename T> std::istream& operator >>(std::istream& input, std::vector<T>& v) { for (T& a : v) input >> a; return input; } void answer(unsigned x) { std::cout << x << '\n'; } void solve(const std::vector<std::string>& c) { const size_t n = c.si...
ALGO
0.999329
5.114911
789032c4-fad4-4b7c-9258-ebcbb47669a5
19sProgrammersStudy/Soyeon
0724_예상대진표.cpp
//예상 대진표 //https://programmers.co.kr/learn/courses/30/lessons/12985?language=cpp #include <iostream> using namespace std; int solution(int n, int a, int b) { int answer = 0; while(a!=b){ answer++; a=(a+1)/2; b=(b+1)/2; } return answer; }
ALGO
0.999537
3.936749
37b50bd0-688e-4717-821d-d655189cceac
cskrren/LUOGU
P5657.cpp
#include<iostream> using namespace std; typedef long long ll; int n; ll k; void f(int n, ll k) { if (!n)return; if (k >= (ll)1 << (n - 1)) { cout << 1; k = ((ll)1 << n) - 1 - k; } else { cout << 0; } f(n - 1, k); } int main() { int m=1; cin >> n >> k; f(n, k); return 0; }
ALGO
0.999954
3.413584
6acbf42e-b309-4c57-afbf-6b3ce94b9075
VishwajitPatil3028/LeetCode
617-merge-two-binary-trees/617-merge-two-binary-trees.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.999989
6.02053