uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
973e2fe6-83bb-429d-9ccf-02fd78086886
ishandutta2007/codeforces
gom/normal/1320/C.cpp
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #define x first #define y second #define mp make_pair using namespace std; typedef long long ll; typedef long double db; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<db,db> pdb...
ALGO
0.999964
4.815531
fef5a589-7def-44d1-85ba-f0caf2a13aa0
eizadhamdan/Learning_CPP
cpp_dsa/dsa42.cpp
#include <iostream> using namespace std; class Node { public: int value; Node *next; Node(int value) { this->value = value; next = nullptr; } }; class LinkedList { private: Node *head; Node *tail; int length; public: LinkedList(int value) { Node *newN...
ALGO
0.999052
4.883677
c6505f70-31ec-421b-87aa-53bc48f99bc9
ushmita4/SdeSheetChallenge
verticalordertraversal.cpp
#include <queue> void getBreadth(TreeNode<int> *root, int hrDistance, int &minLeft, int &maxRight) { if (root == NULL) { return; } getBreadth(root->left, hrDistance - 1, minLeft, maxRight); getBreadth(root->right, hrDistance + 1, minLeft, maxRight); minLeft = min(minLeft, hrDistance)...
ALGO
0.999988
5.076162
33e6e62e-4584-4bbf-8fa5-cfb8d7cfaccd
Tencent/libpag
src/base/utils/BezierEasing.cpp
#include "BezierEasing.h" namespace pag { BezierEasing::BezierEasing(const Point& control1, const Point& control2) { bezierPath = BezierPath::Build(Point::Zero(), control1, control2, Point::Make(1, 1), 0.005f); } float BezierEasing::getInterpolation(float input) { if (input <= 0) { return 0; } if (input >...
ALGO
0.890456
5.021957
416339da-56ca-4faa-b511-ac40c35feadd
ankitdeb11/myDSAjourney100PlusDaysOfCode
CPP practice/LBtwo.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cout << "Enter a number: "; cin >> n; int sum = 0; for (int i = 0; i <= n; i++) // here N is inclusive { sum += i; } cout << sum; return 0; }
ALGO
0.994001
3.941141
42df120a-637e-4547-8355-b878217ab12f
hummingg/LeetCode
2104.子数组范围和.cpp
/* * @lc app=leetcode.cn id=2104 lang=cpp * * [2104] 子数组范围和 */ #include <iostream> #include <vector> using namespace std; // @lc code=start class Solution { public: // 方法二:n n // long long subArrayRanges(vector<int>& nums) { // int size = nums.size(); // long long sum = 0; // vector<...
ALGO
0.999916
5.530755
f8c287d3-dbf7-4b69-9136-b0a7c386528f
yash2723/Codechef
Starters 69 Division 4 (Rated)/Convert_to_permutation.cpp
#include <bits/stdc++.h> using namespace std; #define PI 3.141592653589793 #define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define ll long long int #define vi vector <int> #define vll vector < ll > #define pb push_back #define endl '\n' #define max3(a,b,c) max(max(a,b),c) #define min3(a,b,c) min(m...
ALGO
0.999355
4.272379
482e9ffe-cc1f-45dc-9064-3e6a1182dc76
Matheshravichandran/OpenCV
samples/cpp/tutorial_code/gapi/porting_anisotropic_image_segmentation/porting_anisotropic_image_segmentation_gapi.cpp
/** * @brief You will learn how port an existing algorithm to G-API * @author Dmitry Matveev, <EMAIL>, based * on sample by Karpushin Vladislav, <EMAIL> */ #include "opencv2/opencv_modules.hpp" #ifdef HAVE_OPENCV_GAPI //! [full_sample] #include <iostream> #include <utility> #include "opencv2/imgproc.hpp" #include ...
ALGO
0.974132
6.593243
e31e4f69-e1a9-4325-8b5f-c354545127d9
leejinwook69/github_vscode
1__/BaekJoon/11403.cpp
#include <iostream> using namespace std; int arr[100][100], arr2[100][100]; void checkRoute(int arr[][100], int searchRow, int size, int currentRow) { for (int i = 0; i < size; i++) { if (arr[searchRow][i] == 1) { if (arr2[currentRow][i] != 1) { arr2[cu...
ALGO
0.99997
4.643017
341c9095-46b6-4550-8ac6-f4a67adf0c20
habanero-rice/hclib
test/performance-regression/full-apps/qmcpack/src/QMCDrivers/QMCCostFunctionOMP.cpp
namespace qmcplusplus { QMCCostFunctionOMP::QMCCostFunctionOMP(MCWalkerConfiguration& w, TrialWaveFunction& psi, QMCHamiltonian& h, HamiltonianPool& hpool): QMCCostFunctionBase(w,psi,h), CloneManager(hpool) { CSWeight=1.0; app_log()<<" Using QMCCostFunctionOMP::QMCCostFunct...
ALGO
0.977558
5.764205
b83fea01-e686-4710-a827-c76130c9af27
ishandutta2007/codeforces
tiwairoao/normal/1528/D.cpp
#include <bits/stdc++.h> const int N = 600; const int INF = (1 << 30); int read() { int x = 0, ch = getchar(); while (ch < '0' || ch > '9') ch = getchar(); while ('0' <= ch && ch <= '9') x = 10 * x + ch - '0', ch = getchar(); return x; } void write(int x) { if (x > 9) write(x / 10); putchar(x % 10 + '0'); } in...
ALGO
0.999991
3.753477
6002650b-e449-4410-96a8-0e8a2054c6bc
ishandutta2007/codeforces
jo_ulej/normal/1174/A.cpp
#include <iostream> #include <iomanip> #include <random> #include <algorithm> #include <vector> #include <set> #include <map> #include <cmath> #include <numeric> #include <cstdlib> #include <cstring> #include <deque> #include <sstream> #include <bitset> #ifdef __LOCAL #define DBG(X) cout << #X << "=" << (X) << endl; #...
ALGO
0.999982
3.296329
03ff87ee-77ee-4cc5-8fc5-bbb4b67c2e5f
mariaelisaaraya/ats
basicos/13-2.cpp
//Escriba un programa que lea dos numeros y determine cual de ellos es mayor, que pasa si los dos numeros son iguales #include <iostream> using namespace std; int main(){ int n1, n2; cout << "Por favor ingresa dos numero= "; cin >> n1 >> n2; if(n1 == n2){ cout << "Los dos numeros son iguales...
ALGO
0.996944
3.578767
87507c8f-225c-4ee4-a752-7417de00fca5
Hiddenworld26/DSA_Questions
Basics/declare.cpp
#include<iostream> using namespace std; int main() { int x=3; cout<<x<<endl; cout<<(x=7)<<endl; //output and re-intilalized in 1 line return 0; }
TOOL
0.931618
3.035648
25755398-3cf4-46d5-9838-b67b01337f82
kritikarag/DSA-Prep
Graph/max_area_island.cpp
// https://leetcode.com/problems/max-area-of-island/ // USING BFS int DR[4] = {1, 0, -1, 0}; int DC[4] = {0, -1, 0, 1}; bool valid_index(int i, int j, vector<vector<int>> &grid) { if (i < 0 || j < 0 || i >= grid.size() || j >= grid[0].size()) return false; return true; } void bfs(int i, int j, vecto...
ALGO
0.999865
6.660734
29ba9825-06e6-4218-bfac-94628867a90f
Afinis/algorithm
luogu_P1120.cpp
#include<bits/stdc++.h> using namespace std; int a[70], n, vis[70], vc=1, r, ma, nei[70]; bool dfs(int in, int sum){ if(sum == r){ sum = 0; in = 0; } if(vc == n && sum == 0) return true; bool en = false; for(int i = in+1; i < n; i++){ if(vis[i] == 0){ if(sum + a[i] <= r){ vis[i] = 1; vc++; if...
ALGO
0.999994
3.856302
8a6be88f-c551-4c8d-b071-a753a5e081e8
joshnagulipilli/gfgsolutions
Medium/Prime Pair with Target Sum/prime-pair-with-target-sum.cpp
//{ Driver Code Starts #include <bits/stdc++.h> using namespace std; class Array { public: template <class T> static void input(vector<T> &A, int n) { for (int i = 0; i < n; i++) { scanf("%d ", &A[i]); } } template <class T> static void print(vector<T> &A) { f...
ALGO
0.998805
5.525198
f5779b50-5146-4b81-9527-095a0f5fc3ed
radekp/qt
util/lexgen/re2nfa.cpp
#include "re2nfa.h" #include "tokenizer.cpp" RE2NFA::RE2NFA(const QMap<QString, NFA> &macros, const QSet<InputType> &maxInputSet, Qt::CaseSensitivity cs) : macros(macros), index(0), errorColumn(-1), maxInputSet(maxInputSet), caseSensitivity(cs) { } NFA RE2NFA::parse(const QString &expression, int *errCol) { t...
ALGO
0.955643
6.799496
eede8c63-5b56-4832-b774-3670c6eace05
mammothb/boost_1_54_0
libs/math/example/numerical_derivative_example.cpp
#ifdef _MSC_VER # pragma warning (disable : 4996) // assignment operator could not be generated. #endif # include <iostream> # include <iomanip> # include <limits> # include <cmath> #include <boost/static_assert.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/math/special_functions/next.hpp>...
ALGO
0.998558
7.26427
56662b67-8537-4d81-a177-721e43800258
csuyangpeng/ros_src
src/opencv3/opencv_contrib/sfm/samples/trajectory_reconstruccion.cpp
#include <opencv2/core.hpp> #include <opencv2/sfm.hpp> #include <opencv2/viz.hpp> #include <iostream> #include <fstream> using namespace std; using namespace cv; using namespace cv::sfm; static void help() { cout << "\n------------------------------------------------------------------\n" << " This prog...
TOOL
0.977688
5.63132
9162c77d-bd8c-4f2b-8190-284dd3885bc1
kcsarrdah/Hackerrank-Practice-Problems
hackerrank practice programs/beautiful day at the movies.cpp
//beautiful day #import<iostream> using namespace std; int reverse(int a) { int reversedno=0,remainder; while(a != 0) { remainder = a%10; reversedno = reversedno*10 + remainder; a /= 10; } return reversedno; } int main() { int i,j,k,n,rev,flag; cin>>i>>j>>k; for(n=i;n<=j;n++)...
ALGO
0.999888
3.693356
20f1e777-d43c-45ff-ad61-5b6375e975ea
ishandutta2007/codeforces
keko37/normal/442/D.cpp
#include<iostream> #include<cstdio> using namespace std; const int MAXN = 1000005; int n; int p[MAXN], dp[MAXN], a[MAXN], b[MAXN]; void update (int x) { if (x == 0) return; dp[x]++; if (dp[x] > a[p[x]]) { a[p[x]] = dp[x]; if (a[p[x]] > b[p[x]] +1) update(p[x]); } else if (dp[x] > b[p...
ALGO
0.999917
3.327118
8487d4d1-d332-42c5-b09d-3b2dad726188
volkead/HotlineMiamiCPP
Library/SFML-2.6.0/examples/island/Island.cpp
//////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #define STB_PERLIN_IMPLEMENTATION #include <stb_perlin.h> #include <SFML/Graphics.hpp> #include <vector> #include <deque> #include <sstream> #include <algorithm> #include <cstring> #incl...
TOOL
0.87506
6.654213
75fb4ff5-5afc-4e6b-90bf-a6a16e06e918
sergey00010/shortUrl
libs/boost/libs/graph/example/make_connected.cpp
#include <boost/graph/connected_components.hpp> #include <boost/graph/make_connected.hpp> using namespace boost; int main(int argc, char** argv) { typedef adjacency_list< vecS, vecS, undirectedS, property< vertex_index_t, int > > graph; graph g(11); add_edge(0, 1, g); add_edge(2, 3, ...
ALGO
0.983699
6.920966
751fa11d-2a89-476d-bc81-7ebbb57a4049
ABDULLAH44-AA/Lab-tasks
Q4swap.cpp
#include <iostream> using namespace std; int main() { int num1, num2; cout << "Enter the first number: "; cin >> num1; cout << "Enter the second number: "; cin >> num2; cout << "Original values: num1 = " << num1 << ", num2 = " << num2 << endl; num1 = num1 + num2; num2 = num1 - num2; ...
ALGO
0.999299
5.397301
5324b665-7509-43f7-8b29-dc69f4596d4d
DuaMohyyudin/Data_Structures
Assignment#01/Question02.cpp
//# include <iostream> //using namespace std; // //class Node //{ // int data; // Node* next; // Node* head = NULL; // Node* tail = NULL; // //public: // Node() // { // data = 0; // next = nullptr; // } // Node(int d, Node* ptr = nullptr) // { // data = d; // next = ptr; // } // void insert(int d) // { // Node* ne...
ALGO
0.999585
3.755118
741ba669-e7d6-4655-8b9f-2933a26ed756
KunalBansal12/KUNALBANSAL12
1240-stone-game-ii/stone-game-ii.cpp
class Solution { public: int rec(int i,int m,vector<int>&piles,int n,vector<vector<int>>&dp){ if(i==n) return 0; if(dp[i][m]!=-1) return dp[i][m]; int ans=INT_MIN; int x = min(n,i+(2*m)); int sum=0; for(int j=i;j<x;j++){ sum+=piles[j]; ans = ma...
ALGO
0.999891
5.481797
f0cf23e2-2b12-41b4-a99e-b277b2ce87f8
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/CodeLlama/top0-100/number-of-atoms-Solution.countOfAtoms/177811_DoS.cpp
aspath_put (struct stream *s, struct aspath *as, int use32bit ) { struct assegment *seg = as->segments; size_t bytes = 0; if (!seg || seg->length == 0) return 0; if (seg) { /* * Hey, what do we do when we have > STREAM_WRITABLE(s) here? * At the moment, we would write out a par...
TOOL
0.994418
4.450494
15319458-68f0-404d-bdad-ee490f2ce6d5
MoodyMusicMan/MPC-Project
src/Eigen-3.3/unsupported/doc/examples/MatrixPower.cpp
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); Matrix3d A; A << cos(1), -sin(1), 0, sin(1), cos(1), 0, 0 , 0 , 1; std::cout << "The matrix A is:\n" << A << "\n\n" "The matrix power A^(pi/4) is:\n"...
ALGO
0.999615
3.793199
d1445f27-015e-4a25-a0df-4018adb7da08
solareenlo/cpp_tutorial
advanced04/prob/prob4_3/classify.cpp
#include "classify.h" #include <iostream> CCla::CCla() {} CCla::~CCla() {} void CCla::classify(vector<int>& v, int num, int amari) { m_count = 0; cout << "1の位が" << amari << "の整数:"; for(unsigned int i = 0; i < num; i++) { if(v[i] % 10 == amari) { cout << v[i] << " "; m_count...
ALGO
0.917334
4.133673
8489bff8-6a70-4963-bc38-c02693fd4e89
piyush1146115/Competitive-Programming
Other Contests/cse week contest 2016/B.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pf printf #define sf scanf #define mxx 1000005 template<typename T> inline T sq(T a) { return a*a; } template<typename T> inline T gcd(T a, T b) { if(b == 0) return a; else return gcd(b, a % b...
ALGO
0.999821
3.690141
37ad0c88-42f7-4b08-8ac6-a909f6236978
NiranjanLangade/DSA
Linked List/Insertion Deletion in DLL/insertAtEnd.cpp
#include<bits/stdc++.h> using namespace std; class Node{ public : int data; Node *front; Node *back; Node(int data1,Node *front1,Node *back1){ data = data1; front = front1; back = back1; } Node(int data1){ data = data1; front = nullptr; bac...
ALGO
0.999838
5.177571
244b0270-53ef-4e33-84af-bcddd22f9800
phamvangjang/BAI_TAP_LON
phamvangiang/baiso2.cpp
//Ho Va Ten: Pham Van Giang //MSSV: 6251071025 //CNTT K62 #include<stdio.h> int main(){ int n,i; long S; i = 1; S = 0; printf("Vui long nhap so n = "); scanf("%d",&n); while(i <= n){ S = S + i * i; i++; } printf("Tong cua day 1^2 + 2^2 +...+ %d^2 = %d", n,S); printf("\nCAM ON BAN DA HOC CODE CUNG CHUNG TO...
ALGO
0.99319
3.304307
f0f241a3-d5e4-4290-92f4-42979f9be93d
sakshampurohitt/DSA-ed
LinkedList Aarush/middleOfLL.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* middleNode(...
ALGO
0.999924
5.840087
3fc4399b-203f-47ac-a6dc-56b7b683872c
finyle/algo_ds
algo_acm_tedukuri/tedukuri/2_search/9_exp/13_骑士精神.cpp
/* 棋盘走法: */ #include <cstdio> #include <iostream> #include <algorithm> using namespace std; char ed[5][5] = { {'1','1','1','1','1'}, {'0','1','1','1','1'}, {'0','0','*','1','1'}, {'0','0','0','0','1'}, {'0','0','0','0','0'} }, a[5][5]; int dx[8] = {-2,-2,-1,-1,1,1,2,2}; int dy[8] = {-1,1,-2,2,-2,2,-1,1}; int dep, ...
ALGO
0.999678
3.716738
7e5f2b86-f561-42ec-b36f-b27f33ba8cf0
water2silver/Learn
algorithm/diguifenzhi/P1028.cpp
#include <iostream> /* 把计算的结果储存在数组里面,用的时候直接调用,果然能提高效率 */ using namespace std; //本身也算 int data[1010]; //dfs没有充分利用计算得到的答案 int dfs(int n); //这个利用相对充分一些 int dfs2(int n); int main(){ // data[1]=1;data[2]=2;data[3]=2; // data[4]=4; int n;cin>>n; // for(int i=1;i<=n;i++){ // cout<<"n= "<<i<<" ans = "...
ALGO
0.999979
3.709004
f5d74c27-0c2a-4750-b7e5-cdc031148e22
sendoru/ps-cpp-new
source/atcoder/abc392_b.cpp
// #include "atcoder/all" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll MOD9 = 998244353; const ll MOD1 = (ll)1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(null...
ALGO
0.999995
4.116388
08cdf3d7-1d11-4514-b5f6-1b17f7ab36c2
ZARIFREZAUL/Beginner-Level-Problems
school.outsbook/Volume-5/552 - Easy Recurtion.cpp
#include <bits/stdc++.h> using namespace std; int main() { int T; long long N; cin>>T; for(int i=1; i<=T; i++) { cin>>N; cout<<(N*(N+1))/2<<endl; } } /* 10 1 10 12 */
ALGO
0.999851
5.126105
8023aa24-4254-4097-96f2-4abfb4667462
Lucerna00/BOJ
two dimensional array/2566.cpp
#include<iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int input = 0, max = 0, x = 0, y = 0; for (int i = 1;i <= 9;i++) { for (int j = 1;j <= 9;j++) { cin >> input; if (input >= max) { max = input; x = j; y = i; } } } cout <<...
ALGO
0.999624
3.564404
e5a62c43-0ef4-48b7-ab8e-c890e288f803
AshwathVS/Programming
leetcode/network_delay_time.cpp
class Solution { public: int networkDelayTime(vector<vector<int>>& times, int N, int K) { // from, {to, time} vector<set<pair<int, int>> > graph(N+1); for(auto time : times) { graph[time[0]].insert({time[1], time[2]}); } int count=0; // time, node ...
ALGO
0.999979
6.026272
9b954d6e-4586-4448-9ae8-377a502f9c0a
anishvabardhan/Doomenstein
Engine/Code/Engine/Math/MathUtils.cpp
#include "MathUtils.hpp" #include "Engine/Math/Vec3.hpp" #include "Engine/Math/Vec4.hpp" #include "Engine/Math//Mat44.hpp" #include "Engine/Math/IntVec2.hpp" #include "Engine/Math/AABB2.hpp" #include "Engine/Math/OBB2.hpp" #include "Engine/Math/EulerAngles.hpp" #include "Engine/Core/EngineCommon.hpp" #include <stdio....
TOOL
0.978444
5.713001
8b5bea0a-e06d-4bb1-afcb-09e8afa7cf04
Toshiyana/leetcode-cpp
BinarySearch/medium/1011.cpp
#include <bits/stdc++.h> // #include "./../../Utils/Utils.h" using namespace std; // https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/discuss/256729/JavaC%2B%2BPython-Binary-Search class Solution { public: int shipWithinDays(vector<int> &weights, int D) { int left = 0, right = 0;...
ALGO
0.999946
5.224761
701156cf-3303-4b82-acd0-f5ec979b4fa7
SURYAPRAKASHKALYANAM/LEETCODE-GFG-SOLVED-SOLUTIONS
2958-length-of-longest-subarray-with-at-most-k-frequency/2958-length-of-longest-subarray-with-at-most-k-frequency.cpp
class Solution { public: int maxSubarrayLength(vector<int> &nums, int k) { unordered_map<int, int> count; int max_len = 0; int left = 0, right = 0; while (right < nums.size()) { count[nums[right]]++; if (coun...
ALGO
0.99985
5.832602
06baa24b-555a-49ef-aec5-d2b9044ef4be
skygupta07/cpp
13_strings2/19_minCharToAddForPalindrome.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: // Function to compute the LPS array vector<int> computeLPS(const string& str) { int n = str.size(); vector<int> lps(n, 0); int length = 0; // Length of the previous longest prefix suffix int i = 1; ...
ALGO
0.998906
6.704382
07497af6-e333-493a-b13a-9023453b74ca
pirgus/LCSanalysis
lcspd.cpp
#include <iostream> #include <vector> #include <fstream> #include <chrono> const int BLANK = -1; int lcs (std::vector<char>& string_1,std::vector<char>& string_2, int size_1, int size_2, std::vector<std::vector<int>>& table) { if(size_1 == 0 || size_2 == 0) ...
ALGO
0.99444
5.156198
e5300273-66f9-4f8f-ab08-c15ea8d4de73
txxxxc/competitive-programming
ABC_189/c/first/index.cpp
#include <bits/stdc++.h> using namespace std; #define debug(arg) std::cerr << #arg << ": " << (arg) << '\n' #define INF ((1LL<<62)-(1LL<<31)) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() using ll = long long; using P = pair<int, int>; using Graph = vector<vector<int>>; int...
ALGO
0.999981
4.367574
6efd31f0-4ae8-44a7-b6b0-a2be9be063ae
Stark09Dh/DSA-Practice
October leetcode/21_oct.cpp
#include<bits/stdc++.h> using namespace std ; void solve(string s , int i , unordered_set<string>&st , int currcount , int &maxcount){ if(currcount + (s.length() -i) <= maxcount){ return ; } if(i >= s.length()){ maxcount = max(maxcount ,currcount); return ; } for(int j =...
ALGO
0.999852
4.928418
ec6a11e0-db3f-4d95-ad22-320f11d47d1a
emamhasan1804/XPSC
week 23(last)/day -01/F_Zhan's_Blender.cpp
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; // template <typename T> using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // for set template <typename T> using pbds = tree<T, n...
ALGO
0.999837
4.487127
2ad79543-d91e-4b47-b15e-a0578ab4c326
ishandutta2007/codeforces
nachia/normal/1401/D.cpp
#include<bits/stdc++.h> using namespace std; using UL = unsigned int; using ULL = unsigned long long; using LL = long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M=1000000007; int N; vector<int> E[100000]; int nP; ULL P[60000]; int gP[100000]; int gZ[100000]; ULL Sc[99999]; ULL Ml[99999]; void dfs(int...
ALGO
0.999889
3.940684
28f6289d-e27d-4074-bf3f-972831743929
archit-dev/LeetCode-Solutions
2-add-two-numbers/2-add-two-numbers.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* addTwoNumbe...
ALGO
0.999915
6.275137
d60fd624-cf2f-451e-be81-3ce408ab6848
Silverdrain/CoreProjekt
src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
/* ScriptData SDName: Arcatraz SD%Complete: 60 SDComment: Warden Mellichar, event controller for Skyriss event. Millhouse Manastorm. TODO: make better combatAI for Millhouse. SDCategory: Tempest Keep, The Arcatraz EndScriptData */ /* ContentData npc_millhouse_manastorm npc_warden_mellichar mob_zerekethvoidzone EndCont...
TOOL
0.872226
6.196937
37125087-5565-4335-8057-48219cdad71f
Williams392/Proyecto_SistemaSolar
SistemaSolar/luna.cpp
#include "luna.h" #include <cmath> #include <Windows.h> #include <GL/glut.h> #include "globals.h" Luna::Luna(float distanciaDesdePlaneta, float tiempoOrbita, float tiempoRotacion, float radio, GLuint identificadorTextura) { this->distanciaDesdePlaneta = distanciaDesdePlaneta; this->tiempoOrbita = tiempoOrbita; t...
TOOL
0.860312
4.141605
fa95334d-98a2-4767-80cb-b83d5b064f32
SiyangShao/codes
luogu/P1903.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int n , k; cin >> n >> k; int a[n]; for(int i = 0 ; i < n ; i++){ cin>>a[i]; } sort(a,a+n); cout<<a[k]<<endl; return 0; }
ALGO
0.999927
3.316782
471b3b0d-d095-4582-bf47-169bc7a31b17
cb1271290526/exp10
Graph.cpp
#include "Graph.h" bool visited[MAX] = { 0 }; int conVerID[MAX] = { 0 }; //֧ͨ EdgeType edges[MAX * MAX]; EdgeType treeEdges[MAX]; bool edgeused[MAX * MAX]; //DZǷʹù int path[MAX]; int dist[MAX]; int Dist[MAX][MAX]; int Path[MAX][MAX]; int main(void) { int choice; Graph G; char fileName[20]; //ļ while (true) { ...
ALGO
0.99374
3.387076
18c32feb-6cdb-4342-9741-583ea4f332ed
SH7072/DSA-cpp
10_Stack/1_arrImpOfStack.cpp
#include <bits/stdc++.h> using namespace std; #define n 100 class Stack { int top; int* arr; public: Stack() { arr = new int[n]; top = -1; } void push(int x) { if (top == n - 1) { cout << "Stack Overflow" << endl; return; ...
ALGO
0.996922
4.189975
1df1864d-9263-44c2-9e06-78438b5c487d
MrDonaldoWorking/School-Codes
lksh_2016_12/1 день 29 декабря Вычислительная геометрия {}/C.cpp
#include <iostream> #include <fstream> #include <vector> #include <cmath> using namespace std; #define forn(i, a, b) for (int i = a; i < b; i++) #define form(i, a, b) for (int i = a - 1; i >= b; i--) #define sz(a) (int)a.size() #define all(x) x.begin(), x.end() typedef long long ll; typedef unsigned long long ull; t...
ALGO
0.98769
3.365793
21f64b59-3ab1-4d73-b8e2-a35a863fd6d7
buihuunam/bai-10
vd10_9.cpp
// This program uses the return value of strcmp to // alphabetically sort two strings entered by the user. #include <iostream> #include <cstring> using namespace std; int main() { // Two arrays to hold two strings. const int NAME_LENGTH = 30; char name1[NAME_LENGTH], name2[NAME_LENGTH]; // Read two st...
ALGO
0.988194
5.683703
76d40fc4-a123-4be8-9595-8e80425b0ac1
113bommy/deepmind_codecontests_refine
cpp_gold_filter_file/cpp_train_774_6.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; cin >> m; int arr1[m]; for (int j = 0; j < m; j++) cin >> arr1[j]; sort(arr, arr + n); sort(arr1, arr1 + m); bool visited[n]; bool visited1[m]; for (int i = 0; i ...
ALGO
0.999977
3.68279
1946ae2b-b252-4e5f-aa54-bfc066706a3e
nickappleton/portmedia
scorealign/trunk/scorealign.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #ifndef __MACH__ #include <malloc.h> #endif #include <fstream> #include "allegro.h" #include "audioreader.h" #include "scorealign.h" #include "gen_chroma.h" #include "comp_chroma.h" #include "curvefit.h" #include "mfmidi.h" ...
ALGO
0.935618
4.034095
5347ceb1-6616-4261-83f4-5f16a543a412
dasbd72/leetcode
problems/0007-reverse-integer/main.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: int reverse(int x) { int ans = 0; while(x) { if(ans > 214748364 || ans < -214748364) return 0; ans *= 10; ans += x % 10; x /= 10; } return ans; ...
ALGO
0.999865
5.587806
e76f8fbd-8f34-4a67-bca8-9fb6b8b335ab
viocuong/datastruct
B50.Muacafe.cpp
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int a[n+1]; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a,a+n); int q; cin>>q; int x; int y[q+1]; for(int i=0;i<q;i++){ cin>>y[i]; } for(int i=0;i<q;i++){ if(y[i]<a[0])...
ALGO
0.999961
4.017119
0e68f3f5-7f14-4685-a12c-4272a2cf7498
roarkhabegger/Athena_Radiation-master
src/pgen/testcr.cpp
//====================================================================================== // C++ headers #include <iostream> // endl #include <fstream> #include <sstream> // stringstream #include <stdexcept> // runtime_error #include <string> // c_str() #include <cmath> // sqrt #include <algorithm> // m...
ALGO
0.995176
4.511939
13819448-41bf-4ead-91f8-1f4d1675279b
rishu110067/Competitive-Programming-Templates
matrixExpo.cpp
//------------------------ Un, Deux, Trois, Quatre, Cinq -----------------------// #pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include<bits/stdc++.h> using namespace std; //Shorthands #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl ...
ALGO
0.999755
4.36068
439a21c3-b5d3-48dc-81d2-4cf7559a5308
kbcgang/kbc
KBB TIME/C++/OnlineJudges/Codeforces/CONTEST/DIV3/E.cpp
/// Hãy làm Sư tử, đừng làm Nai.😅😅😅 /// Hãy làm thợ săn, đừng làm con mồi. /// --- <EMAIL> --- /// ☆*: .。. o(≧▽≦)o .。.:*☆ #include <bits/stdc++.h> using namespace std; #define kien long long #define JAV main #define Million 1000000 #define NT 10000000 #define MOD 1000000007 int T, n; struct KBB { int u, cha, ...
ALGO
0.999844
4.000216
3f43f670-2f73-4daa-a4df-b84433c3cfdf
charitra1022/AC2025
Aaj ka Sawal/Day 28/Task 2.cpp
// Day 28 // Task 2: https://leetcode.com/problems/sum-of-unique-elements/description/ // Date: 28-01-2023 // APPROACH: Store count of all elements and add only those that appear once // Time Complexity: O(N) // Space Complexity: O(1) (used array of 101 size) // where N is the size of the vectors given class Solutio...
ALGO
0.999225
6.173937
d411f8cd-5b16-4ac1-a4b7-a8ca22b8b56a
lock3/meta
libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.pass.cpp
// <algorithm> // template<BidirectionalIterator Iter> // requires ShuffleIterator<Iter> // && LessThanComparable<Iter::value_type> // bool // prev_permutation(Iter first, Iter last); #include <algorithm> #include <cassert> #include "test_macros.h" #include "test_iterators.h" #include <cstdio> int fa...
TEST
0.901943
7.103584
c9a8ca34-9d02-471a-bb50-8498bf63be6a
lombichh/computer-science-bachelor
unibo/first-year/programmazione/exercises-new/TreeSwap/Main.cpp
#include <iostream> #include <math.h> using namespace std; struct tree { int val; tree* ltree; tree* rtree; }; typedef tree* ptree; ptree create_tree(int n, int num) { if (n == 0) return NULL; else { ptree t = new tree; t -> val = num; t -> ltree = create_tree(n - 1, num - ...
ALGO
0.99992
4.366661
9b0d374b-8391-434d-9dea-53058144f954
Tanvin2442002/Code-Forces
Jan_or_Jami.cpp
#pragma GCC optimize("O3") #include<bits/stdc++.h> // #ifndef ONLINE_JUDGE // #include "F:\Codeforces\debug.h" // #else // #define dbg(x...) // #define dbgc(x...) // #endif using namespace std; #define ll long long #define ld long double #define vf(v) (v).begin(), (v).end() #define vr(v) (v).rbegin(), (v).rend() #de...
ALGO
0.999705
5.042474
08ef010d-239c-402e-82b3-9fbe38cd4f65
kailashsah/cplus_workspace
DATA_STRUCTURES/MiscDS/src/algo_stl/iota.cpp
#include <iostream> #include <numeric> // iota using namespace std; /* 1. iota() - Store increasing sequence Assigns to every element in the range [first, last] successive values of val, as if incremented with ++val after each element is written. 2. */ void run_iota() { int arr1[100]; iota(begin(arr1), end(arr1...
ALGO
0.970615
4.82792
84f822da-23ce-43ee-9a15-eb282f9c3966
kinstugi/algorithms_journey_folder
usaco/02_bronze/complete_search_with_recurssion/01_photoshoot.cpp
#include <bits/stdc++.h> using namespace std; int n; vector<int> bessie, seen, res; bool recur(int i, int cur){ if (i+1 == n) return true; int nxt = bessie[i] - cur; if (seen[nxt] || nxt == 0) return false; seen[nxt] = true; res.push_back(nxt); if (recur(i+1, nxt)) return true; seen[nx...
ALGO
0.999979
3.584328
ac2521c1-4608-441c-989c-539e74a1b989
evialbert/LeetCode
1388-pizza-with-3n-slices/1388-pizza-with-3n-slices.cpp
class Solution { private: int f(int i, int e, vector<int> &slices, int n, vector<vector<int>> &dp) { if (n == 0 || i > e) return 0; if(dp[i][n] != -1) return dp[i][n]; int take = slices[i] + f(i + 2, e, slices, n - 1, dp); int not_take = f(i + 1, e, slices, n, dp); return dp[i][n] = max(take, not_take)...
ALGO
0.999924
5.939588
2d67e585-6485-458f-9301-046cd3d212b3
K-Yoshizawa/Procon
verify/AOJ-GRL-5-B.test.cpp
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/5/GRL_5_B" #include "../Library/Tree/TreeDiameter.hpp" int main(){ cin.tie(0)->sync_with_stdio(false); int n; cin >> n; Graph<int> T = InputTree(n, 0, true); TreeDiameter td(T); for(int i = 0; i < n; ++i){ cout << td....
ALGO
0.999537
4.514635
6ba24b81-7738-4724-a04c-f29bb9c17ff1
oxygen-hunter/Flashboom
data/big-vul-100/add_attention_code/MixtralExpert/top0-100/cheapest-flights-within-k-stops-Solution.findCheapestPrice/177900_+Info.cpp
xmlDocPtr soap_xmlParseMemory(const void *buf, size_t buf_size) { xmlParserCtxtPtr ctxt = NULL; xmlDocPtr ret; /* xmlInitParser(); */ */ ctxt = xmlCreateMemoryParserCtxt(buf, buf_size); if (ctxt) { ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace; ctxt->sax-...
ALGO
0.991469
4.496132
9305d2ce-b558-47cb-8779-f9f71a621034
wykim111/algorithm
Trie알고리즘/14725_개미굴.cpp
/* Trie알고리즘을 활용하여 tree 형태로 만들고, dfs 탐색 - 같은 문자열인 경우 map을 활용하여 해당되는 키의 depth+1로 업데이트 */ #include <iostream> #include <map> #include <string> #include <algorithm> #include <vector> using namespace std; int n, k; struct Tree { map<string, Tree*> child; map<string, Tree*>::iterator iter; void insert(int dep, vecto...
ALGO
0.999803
4.36789
51521a53-c437-4ac4-86c2-3f6766850e51
kumaryash7/My-Practice-On-C-
b41.cpp
#include<iostream> #include<string> using namespace std; int main(){ string str; cin>>str; for(int i=0;i<str.length();i++){ if(str[i]>='a' && str[i]<='z' ){ str[i]-=32; } } cout<<str; return 0; }
ALGO
0.985898
4.219171
2147cb3c-84b3-4336-98b0-68f8f681b76b
cosmo8724/Algorithm
BackJoon/Solved/1644 O.cpp
/* 23. 09. 01 */ #include <bits/stdc++.h> using namespace std; int N, sum, ret; vector<int> primes; vector<int> getPrimes(int num) { deque<bool> nums(num + 1); vector<int> _ret; for (int i{ 2 }; i <= num; ++i) { if (nums[i]) { continue; } _ret.push_back(i); for (int j{ i * 2 }; j <= num; j += i) { nums[j]...
ALGO
0.999896
4.341233
c796d9cf-877e-4bd5-a714-7b4af4611528
AlexLiou/pthreads-prefixSums
labhash1--prefix-sum-and-barriers (1)/src/main.cpp
#include <iostream> #include <argparse.h> #include <threads.h> #include <io.h> #include <chrono> #include <cstring> #include "operators.h" #include "helpers.h" #include "prefix_sum.h" #include "spin_barrier.h" #include <mutex> using namespace std; int main(int argc, char **argv) { // Parse args struct options...
ALGO
0.961441
5.172814
2722a9a2-b07f-40f6-863a-24e1ecadb468
ht1602/DPBEMO
src/metric/igd.cpp
#define _CRT_SECURE_NO_WARNINGS #include "metric/igd.h" #include <fstream> #include <iostream> #include "core/macro.h" #include "core/global.h" #include "core/utility.h" namespace emoc { double CalculateIGD(Individual **pop, int pop_num, int obj_num, double** pf_data, int pf_size) { // calculate igd value` d...
ALGO
0.998803
4.730216
3c72e043-ef48-4032-9231-e4f728fed5fb
Afaz31028/XPSC
Week 5/Day 5/A_Payment_Without_Change.cpp
#include <bits/stdc++.h> #define ll long long #define yes cout << "YES" << endl #define no cout << "NO" << endl #define endl '\n' #define loop for (int i = 0; i < n; i++) #define Faster \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); using namespace std; in...
ALGO
0.997558
3.869128
cce1c111-fdf9-4cec-9480-a23efe95e819
Jenatko/VariYO
VarioSW_as/VarioSW/src/lib/CircleFit/circle.cpp
// #include "circle.h" // /************************************************************************ DECLARATION OF THE CLASS CIRCLE ************************************************************************/ // Class for Circle // A circle has 7 fields: // a, b, r (of type reals), the circle parameters // s (...
ALGO
0.95428
4.784996
d06c7302-482a-473c-a794-29eab68b9046
sky8c9/Prac
AtCoder/ABC/300/F.cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; using ll = long long; void task() { ll n, m, k; cin >> n >> m >> k; string s; cin >> s; vector<ll> prefS(n + 1); for(int i = 1; i <= n; i++) { prefS[i] = prefS[i - 1] + (s[i - 1] == 'x' ...
ALGO
0.99983
4.569977
98aa0429-ffae-4eaf-a0a9-f4b70c9f7867
ww1820/CppTest
exam/0827/area.cpp
#include<bits/stdc++.h> using namespace std; bool isRectangleOverlap(vector<int>& rec1, vector<int>& rec2) { if (rec1[0] == rec1[2] || rec1[1] == rec1[3] || rec2[0] == rec2[2] || rec2[1] == rec2[3]) { return false; } return !(rec1[2] <= rec2[0] || // left rec1[3] <= rec2[1] || ...
ALGO
0.999827
4.763478
4f9761e4-97ba-4226-a19d-0f9d80322b3f
clay-arras/cp-practice
codeforces/contests/2008B/main.cpp
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debugFunc.h" #else #define debug(...) 42 #endif void solve() { int N; cin >> N; string s; cin >> s; double sq = sqrt(N); if (ceil(sq) != floor(sq) || N < 4) { cout << "No" << endl; return; } int z = 0; ...
ALGO
0.999968
4.888882
b38496a3-ee08-4671-974a-c5a2c6598cfa
vaishalipandey-11/DSA
notes/Live Class codes/13.array class 2 codes.cpp
#include <iostream> using namespace std; void solve(int& a) { a++; cout<< "Printing inside solve function: " << a << endl; } void solve(int arr[], int n) { arr[0] = 100; } int getUnique(int arr[], int n) { int ans = 0; for(int i=0; i<n; i++) { ans = ans^arr[i]; } return ans; } void sortZeroOne(in...
ALGO
0.998557
4.251776
33610d6d-935b-40b0-8e4b-ade0f6b73928
itzuditsharma/Leetcode
0792-binary-search/0792-binary-search.cpp
class Solution { public: int search(vector<int>& nums, int target) { int low = 0; int high = nums.size() - 1; while(low <= high){ int mid = (low + high)/2; if(nums[mid] == target){ return mid; }else if(target <= nums[mid]){ ...
ALGO
0.999902
6.319465
fb3dccd3-fb12-47a8-bc7f-9967032d7726
sagpant/CoolProp
src/CPnumerics.cpp
#include "CPnumerics.h" #include "MatrixMath.h" #include <unsupported/Eigen/Polynomials> double root_sum_square(const std::vector<double> &x) { double sum = 0; for (unsigned int i=0; i<x.size(); i++) { sum += pow(x[i],2); } return sqrt(sum); } double interp1d(const std::vector<double> *x, c...
ALGO
0.999765
4.922093
7bda3aca-0473-47ac-bb83-039044eb9982
sushantkumar143/Competitive-Programming
CodeForces/A_Next_Round.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; vector<int> arr(n); for(int i=0; i<n; i++) cin >> arr[i]; int cnt = 0; int th = arr[k-1]; for(int i=0; i<n; i++){ if(arr[i] >= th && arr[i]>0) cnt++; } cout << cnt; }
ALGO
0.999934
3.791562
86cb97e2-df99-4e63-9a9e-1c28e453af09
ZRZRING/algorithm
Practice/Codeforces/Codeforces Round (Div. 1 + Div. 2)/900-1000/Codeforces Round 945/B.cpp
#include <bits/stdc++.h> using int64 = long long; #define endl '\n' #define PII std::pair<int64, int64> #define NO return (void)(std::cout << "NO" << endl) #define YES return (void)(std::cout << "YES" << endl) #define Fast_IOS std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0) const int64 mod = 9982...
ALGO
0.999895
5.315756
e45ea177-11be-414b-ae45-080a27407606
saccadic/UoF
win/openFrameworks/libs/openFrameworks/math/ofMatrix3x3.cpp
#include "ofMatrix3x3.h" ofMatrix3x3::ofMatrix3x3( float _a, float _b, float _c, float _d, float _e, float _f, float _g, float _h, float _i ) { a = _a; b = _b; c = _c; d = _d; e = _e; f = _f; g = _g; h = _h; i = _i; } void ofMatrix3x3::set( float _a, float _b, float _c, float _d, float _e, floa...
TOOL
0.864728
5.970393
6844e3b5-3b45-480d-a90b-b34f265c9b58
Boklazhenko/itstephomework
ps/week7.2/task7/zorina/hw7.cpp
// Напишите рекурсивную функцию, которая принимает одномерный массив из 100 целых чисел, заполненных случайным образом, //и находит позицию, с которой начинается последовательность из 10 чисел, сумма которых минимальна. // #include <iostream> #include<stdlib.h> #include<ctime> using namespace std; int recursion(int...
ALGO
0.999861
4.652868
f2342a01-6144-4137-8d43-3b3e14a08e90
khanasifhere/Codeforces
19jan/2.cpp
#include<bits/stdc++.h> #define ll long long using namespace std; ll solve(){ int n,m; cin>>n>>m; vector<vector<int>>a(n,vector<int>(m)); for(int i=0;i<n;i++){ for(int j=0;j<m;j++)cin>>a[i][j]; } for(int i=0;i<n;i++){ sort(a[i].begin(),a[i].end()); } bool flag=true; f...
ALGO
0.999974
4.046745
4ab99f47-a8be-4bec-b913-762d048bd56e
RiyaadHossain/XPSC-Practice
Be a CM/Target - 1400/June - 12/E_2_Game_with_Marbles_Hard_Version.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define endl '\n' #define ye cout << "YES" #define no...
ALGO
0.99999
5.03426
2f28d8ec-9778-4437-bf80-acd7a55b53ec
VSUpadhye/BasicCPrograms
LeetCode/lengthOfLastWord.cpp
#include <iostream> #include<vector> #include <string.h> using namespace std; int lengthOfLastWord(string s){ int answer = 0, len = s.length(); for (int i = len - 1; i >= 0; i--) { if (s[i] != ' ') { answer++; } else if (s[i] == ' ' && answer != 0) { ...
ALGO
0.990662
4.556977
21a9f9f9-4ea0-4fa1-bcf5-9f483b435be9
yashtekade21/LeetCode_Solved
3439_Reschedule_Meetings_for_Maximum_Free_Time.cpp
class Solution { public: int maxFreeTime(int eventTime, int k, vector<int>& startTime, vector<int>& endTime) { vector<int> freeTimeArr = {startTime[0] - 0}; for (int i = 1; i < startTime.size(); i++) freeTimeArr.push_back(startTime[i] - endTime[i - 1]); free...
ALGO
0.999755
5.361936
2d257333-bac3-4884-8b18-042529511c56
Aryan150304/DSA-codes-
Sort 0 1.cpp
// problem statement - The array consist of only 2 values 0 and 1 sort the array in non decreasing order in o(n) complexity. // Solution - */ #include<iostream> using namespace std ; void printArray(int *arr, int n){ for(int i=0;i<n;i++){ cout<<arr[i]<<" "; } cout<<endl; } void sort01(int *arr, ...
ALGO
0.999982
5.697293
362e664d-f0b6-4975-af90-5274eed02e84
sasikiranE/Leetcode-studyplan
DataStructure/preorderTraversal.cpp
/* Given the root of a binary tree, return the preorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1,2,3] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Constraints: The number of nodes in the tree is in the range [0, 100]. -100 <= Nod...
ALGO
0.999994
6.733398
e92fa822-b73d-41fa-8014-4258bdcf5e82
rbtre/rbtre.github.io
assets/code/B2047.cpp
#include <iostream> #include <iomanip> #include <cstdlib> using namespace std; int main() { double x; cin >> x; if (x >= 0 && x < 5) { cout << fixed << setprecision(3) << -x + 2.5; exit(0); } if (x >= 5 && x < 10) { cout << fixed << setprecision(3) << 2 - 1.5 * (x - 3) * (x...
ALGO
0.99885
3.840687
4def0dfb-aae4-4c05-ab53-3066feec968b
sujalraj00/snews
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
a5b0451a-42a9-4f63-98f6-65a2ed9117c7
kavinmayil/C-with-Classes
average_in_array.cpp
#include <iostream> using namespace std; int main() { int n, sum = 0; float average; cout << "Enter number of elements: "; cin >> n; int arr[n]; cout << "Enter " << n << " elements:\n"; for(int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } average = (float...
ALGO
0.990613
5.547966
73572a07-d446-40c6-a494-0ce35700e17a
jatinverma2705/DSA
HashMap/hash_map_basic.cpp
#include <iostream> #include<map>//should be included for using map #include <vector> using namespace std; int main() { //creation vala part map<int,char>MeraMap; //insertion vala part MeraMap[0] = 'a'; MeraMap[1] = 'b'; MeraMap[2] = 'c'; // MeraMap[3].push_back('d'); //acces vala part // cout << ...
ALGO
0.858645
4.00675