uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
64fa934f-e0b3-497c-990b-28da45f4f181
githubtanush/DSASUPREME2.0
Dynamicprogramming/Lecture4dp/02_longestpalindromicsubsequence.cpp
#include<iostream> using namespace std; int solveusingrec(string& a,string& b,int i,int j){ //Basecase if(i >= a.length()) return 0; if(j >= b.length()) return 0; int ans = 0; //Case 1 - if character matches then move i and j if(a[i] == b[j]) ans = 1 + solveusingrec(a,b,i+1,j+1); //Case 2 -...
ALGO
0.999996
5.641979
9b17a36e-c69d-4b5d-89eb-9a101d6e24d7
wells-wei-wei/smplify-x_in_docker
boost_1_72_0/libs/compute/perf/perf_stl_sort.cpp
#include <algorithm> #include <iostream> #include "perf.hpp" int main(int argc, char *argv[]) { perf_parse_args(argc, argv); std::cout << "size: " << PERF_N << std::endl; std::vector<int> v; perf_timer t; for(size_t trial = 0; trial < PERF_TRIALS; trial++){ v = generate_random_vector<int...
ALGO
0.918032
5.498227
b25ee30b-cd0e-43a9-abba-6e194a0f2c06
Dhanush-dk/CPP
SDE-Sheet/Day7-TwoPointers/trappingRainwater.cpp
class Solution { public: int trap(vector<int>& height) { int left = 0; int right = height.size()-1; int leftMax = 0; int rightMax = 0; int res = 0; while(left <= right){ if(height[left] <= height[right]){ if(height[left] >= leftMax) leftMax...
ALGO
0.999973
6.780767
5f48664e-d7bb-4d0d-a99d-709f5aad6569
ishandutta2007/codeforces
leaf1415/normal/1331/D.cpp
#include <iostream> #include <cstdio> #include <cmath> #include <ctime> #include <cstdlib> #include <cassert> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <string> #include <algorithm> #include <utility> #define llint long ...
ALGO
0.999344
3.090032
0940a2e1-f5a7-49cc-a7dd-5d577c6ebbf7
r1407p/CodeBook
Math/Big Number.cpp
template<typename T> inline string to_string(const T& x){ stringstream ss; return ss<<x,ss.str(); } struct bigN:vector<ll>{ const static int base=1000000000,width=log10(base); bool negative; bigN(const_iterator a,const_iterator b):vector<ll>(a,b){} bigN(string s){ if(s.empty())return; if(s[0]=='-')n...
ALGO
0.982444
4.102719
7152fd9b-14f6-4b8b-9ab0-0952b49df341
zaynkas/Essentia
src/algorithms/standard/monomixer.cpp
#include "monomixer.h" #include "essentiamath.h" using namespace std; namespace essentia { namespace standard { const char* MonoMixer::name = "MonoMixer"; const char* MonoMixer::category = "Standard"; const char* MonoMixer::description = DOC("This algorithm downmixes the signal into a single channel given a stereo s...
TOOL
0.859334
6.087399
193a3f3e-b6fb-4f4f-985c-701641fc68c1
VishalSingh-07/Striver-SDE-Sheet-Code
Day 05 - Linked List/Add_Two_number_II.cpp
/* 445. Add Two Numbers II You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, e...
ALGO
0.999964
6.972901
86152f8e-4f90-42f5-9eac-bc24f97c1963
Safeheron/safeheron-crypto-suites-cpp
src/crypto-suites/crypto-sss/vsss.cpp
#include "crypto-suites/crypto-sss/vsss.h" #include "crypto-suites/common/custom_assert.h" using std::vector; using safeheron::bignum::BN; using safeheron::curve::CurvePoint; namespace safeheron{ namespace sss { namespace vsss { void MakeShares(vector<Point> &shares, const BN &secret, int threshold, const vector<BN>...
ALGO
0.992519
5.070363
33fd4760-cb93-4f6f-a0be-93093488dd95
vinnyalvs/CapacitadedClusterProblemMatheuristic
Source/Solution.cpp
// // Created by edson on 11/10/18. // #include <fstream> #include "../headers/Solution.h" Solution::Solution() { } Solution::~Solution() { } void Solution::printSolution() { cout << "{"; for (auto i : groupList) { i.printGroup(); cout << " weight: " << i.weight; if (i.nodeList...
ALGO
0.999074
4.439371
2ff09cc8-ffd0-4b80-9c52-155247fad758
ChoonHean/Kattis
src/subway2.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef unsigned int uint; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<double> vd; typedef...
ALGO
0.999651
4.19452
30a42968-bd4e-4bfb-bc95-9953af844fa5
axtonio/Cpp
Contests/Vk/Stack&Dec/task1.cpp
#include <deque> #include <iostream> int main() { std::deque<char> st; std::string str; std::cin >> str; st.push_back(str[0]); int n = str.size(); for (int i = 1; i < n;) { if (!st.empty()) { int head = st.back(); if (head == str[i]) { st.pop_back(); while (str[++i] == head...
ALGO
0.999948
5.560699
41e3d6f1-c48e-449f-afbf-82dfe1ff5db9
ishandutta2007/codeforces
krijgertje/normal/1470/D.cpp
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <list> #include <cassert> #include <climits> #inclu...
ALGO
0.999979
4.51824
94b55b7d-383b-4f9e-a5d9-257f4758eb6e
QuantumBird/ACM_Team
gjz/contests/C.cpp
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<map> #include<cstdio> #include<cstring> #include<unordered_map> #include<cstring> using namespace std; string book; string res; int flag; int ans; int number; int tmpc; int Answer__; void kmp(int *next) { int n=res.size(); int i=...
ALGO
0.999772
3.298282
7aa28223-6741-4c93-8719-009eef79385d
mehr74/leetcode
src/problems/55-jump-game.cpp
class Solution { public: bool canJump(vector<int>& nums) { stack<int> st; vector<int> seen(nums.size(), 0); st.push(0); while(!st.empty()) { int pos = st.top(); st.pop(); seen[pos] = 1; int nextPos = pos+1; while (nextPos <= pos + nums[pos] && nextPos < nums.size()) {...
ALGO
0.999959
6.325153
153319d1-acfd-43e0-b54d-74b12b892a61
ahmadgitmtl/C-_InterviewerBit
LinkedLists/PalindromeList.cpp
/* Given a singly linked list, determine if its a palindrome. Return 1 or 0 denoting if its a palindrome or not, respectively. Notes: - Expected solution is linear in time and constant in space. For example, List 1-->2-->1 is a palindrome. List 1-->2-->3 is not a palindrome. https://www.interviewbit.com/problems/p...
ALGO
0.999967
5.832332
89504b7e-d277-4d85-9d8e-a7f386d56cd8
ishandutta2007/codeforces
qazswedx2/normal/1466/B.cpp
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int t,n,a[100005],vis[1000005]; int main() { scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=2*n+2;i++) vis[i]=0; for(int i=1;i<=n;i++) scanf("%d",&a[i]); reverse(a+1,a+n+1); int ans=0; for(int l=1,r;l<=n;l=r+1)...
ALGO
0.999483
3.639499
82e0c59d-7a3b-492e-9699-1938426d0d38
maniSHarma7575/Algorithms
Recursion/CreateSequence.cpp
/*Problem Statement: Given an integer n, you need to print all numbers less than n which are having digits only 2 or 5 or both. Print every number in new line. Order of numbers doesn't matter. */ bool check(int n) { if(n==0) { return true; } if(n%10==5 || n%10==2) { return check((int)n/10);...
ALGO
0.996484
4.591284
0e034dff-364b-47de-8912-7c47c899dd7e
ruchuruo/C_study
CPP_study/210-44-STL案例1-评委打分.cpp
/* 1׶C++ ֮ 01 2׶ʵս-ͨѶ¼ 3׶-C++ı 4׶ʵս-ڶ̬ҵְϵͳ 5׶-C++߱ 1 ģ 2 STLʶ 3 STL- 3.1 string 3.2 vector 3.3 deque 3.4 -ί 3.4.1 5ѡ֣ѡABCDE10ίֱÿһѡִ֣ȥ߷֣ȥίͷ֣ȡƽ֡ 3.4.2 ʵֲ 1. ѡ֣ŵvector 2. vectorȡÿһѡִ֣forѭ԰10ִִ浽deque 3. sort㷨dequeзȥߺͷ 4. dequeһ飬ۼܷ 5. ȡƽ ܽ᣺...
TOOL
0.997519
3.783127
12f42fa5-bfbe-4bed-ab66-9848fe59fdc2
wazenmai/Leetcode
Medium/2044_count_number_of_maximum_bitwise-or_subsets/solution1.cpp
/** * Title: Count Number of Maximum Bitwise-OR Subsets (Leetcode Medium 2044) * Author: Bronwin Chen <<EMAIL>> * Date: 18, October, 2024 * Result: Time complexity O(2 ** n). */ class Solution { private: int ans; public: void check(vector<int>& nums, int i, int cur, int maximum) { if (i == nums...
ALGO
0.999977
6.265634
c501befc-497d-4fcf-b51d-f0294c143447
solareenlo/atcoder
05_AtCoder-Beginner-Contest/abc177/C/C_001.cpp
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; const ll MOD = 1e9 + 7; int main() { cin.tie(0)->sync_with_stdio(false); int n; cin >> n; vector<ll> a(n); REP(i, n) cin >> a[i]; vector<ll> s(n + 1, 0); REP(i, n) { s[i + 1] += s[i] + a[i]; ...
ALGO
0.999979
4.348353
41e70f7f-4df6-4f47-8f02-670ff81568ad
byrantwithyou/PhysBAM
Public_Library/Geometry/Basic_Geometry/BOWL.cpp
namespace PhysBAM{ //##################################################################### // Function Bounding_Box //##################################################################### template<class T> RANGE<VECTOR<T,3> > BOWL<T>:: Bounding_Box() const { return CYLINDER<T>(TV(0,0,0),TV(0,depth+thickness,0),oute...
ALGO
0.987212
6.041833
2b4193a0-a347-4241-b57b-8f8a62ddbf49
FelixGroh/programming-for-physicists
exercise 08/exercise 08-2.cpp
#include <iostream> #include <vector> #include <iomanip> #include <random> using namespace std class Ding { public: unsigned int n; double x, y, z; double v_x, v_y, v_z; Ding(unsigned int set_n = 0, double set_x = 0.0, double set_y = 0.0, double set_z = 0.0, double set_v_x = 0.0, double set_v...
ALGO
0.999838
4.614023
71728201-f227-4778-b8b3-7dec5ff43630
PrinceSandal20/Leetcode
0060-permutation-sequence/0060-permutation-sequence.cpp
class Solution { public: void findans(string ds,string s,vector<string>&ans,int freq[],int k,int &count){ if (ds.size() == s.size()) { ans.push_back(ds); count++; if(count==k){ return; } } for (int i = 0; i < s.size(); i++) { if (!freq[i]) { ...
ALGO
0.999986
6.294153
7f96fd21-c8c4-42a3-81f2-1c97dd5dc957
AdityaNarayan05/Leetcode-Solved-Questions
1319-number-of-operations-to-make-network-connected/1319-number-of-operations-to-make-network-connected.cpp
class Solution { public: void dfs(vector<vector<int>>& graph,vector<bool>& vis,int start){ vis[start]=true; for(auto it : graph[start]) if(!vis[it]) dfs(graph,vis,it); } int makeConnected(int n, vector<vector<int>>& connections) { if(n>c...
ALGO
0.999937
5.748281
3d23b7ff-538f-4de7-a0dd-7ba3fd91cfba
Suraj313/DSA-TOPICS
ARRAY/IntersectionOfTwoSortedArrays.cpp
#include<bits/stdc++.h> using namespace std; vector<int> FindArrayIntersection(vector<int> &A,vector<int> &B){ int i=0; int j=0; int n=A.size(); int m=B.size(); vector<int>ans; while(i<n && j<m){ if(A[i]<B[j]){ i++; } else if(A[i]>B[j]){ j++; } else { ans.push_bac...
ALGO
0.999828
5.201756
35fb8ae5-d3dc-4f6d-afc3-00c723248355
LingHunHuaShi/CppLearningHomework
tictactoe/tictactoe/源.cpp
#include<iostream> #include<string> #include<time.h> using namespace std; string chess[3][3] = { " "," "," "," "," "," "," "," "}; void game(); bool judge(); void compute(); int winner; void output(string chess[3][3]) { system("cls"); cout << chess[0][0] << "|" << chess[0][1] << "|" << chess[0][2] << endl; cout << ...
ALGO
0.999519
4.167881
c7faa4b9-c33c-4d28-a6aa-92b373bf25b0
1395724712/Leetcode
subject144.cpp
#include<vector> using namespace std; 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), left(left), right(right)...
ALGO
0.999984
5.808267
9f7468ae-2480-4d14-961d-c1db040c6bd6
ria28/Data-Structures-And-Algorithms
DP/Advanced_Dp/LongestcommonSubstring.cpp
#include <iostream> #include <string> #include <unordered_set> #include <unordered_map> #include <vector> #include <algorithm> #include <queue> #include <climits> #define ll long long using namespace std; #define f_loop(i, s, e) for (int i = s; i < e; i++) #define f_long(i, s, e) for (long long i = s; i < e; i++) #defi...
ALGO
0.99997
4.23083
4c5b5eac-e817-496a-9f27-721288ab1862
ishandutta2007/codeforces
yukihana0416/normal/149/D.cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cmath> #include <climits> #include <iostream> #include <algorithm> #include <map> #include <set> #include <stack> #include <queue> #include <string> #include <list> #include <vector> using namespace std; typedef long long LL; inline LL...
ALGO
0.999966
3.836974
d9208757-721d-4378-9237-ad205dd565fb
Ayusohm432/Coding
ProblemOfTheDay/Leetcode/2025/23.01.2025_1267. Count Servers that Communicate.cpp
/* Problem Link: https://leetcode.com/problems/count-servers-that-communicate?envType=daily-question&envId=2025-01-23 */ /*1267. Count Servers that Communicate You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is n...
ALGO
0.999974
7.025047
c77f9a3f-4716-4460-8cff-a51036f0d6fb
ch0588/leetcode
50.Pow(x, n).cpp
// Time Complexity: O(logn) // Space Complexity: O(logn) /* quickpow n<0 and x==0 */ class Solution { public: double myPow(double x, int n) { if (x == 0) return 0; if (n == 0) return 1; double res = 1.0, t = x; bool flag = false; if ( n< 0) { flag = t...
ALGO
0.999945
5.989221
63fcc894-7c62-428f-bc03-b28cb5d1d919
Yangchengshuai/Motion_plan
源代码/hw_3/path_finder/src/test_planner.cpp
#include "self_msgs_and_srvs/GlbObsRcv.h" #include "occ_grid/occ_map.h" #include "path_finder/rrt_star.h" #include "visualization/visualization.hpp" #include <ros/ros.h> #include <geometry_msgs/PoseStamped.h> class TesterPathFinder { private: ros::NodeHandle nh_; ros::Subscriber goal_sub_; ros::Timer exec...
TEST
0.862678
3.959804
f70f6e4e-a601-41f6-a978-1e23b17b58ca
swingld/ceph-14.2.8
src/boost/libs/math/tools/carlson_ellint_data.cpp
#include <boost/math/tools/test_data.hpp> #include <boost/test/included/prg_exec_monitor.hpp> #include <boost/math/special_functions/ellint_rj.hpp> #include <boost/math/special_functions/ellint_rd.hpp> #include <fstream> #include <boost/math/tools/test_data.hpp> #include <boost/random.hpp> #include "mp_t.hpp" float ex...
ALGO
0.997008
5.443704
499f7c31-3267-4b3a-ac20-3d0cbd1b3d31
Sankhya0/logicDetector
backend/CDataset/sortArray/sortArray_4.cpp
class Solution { public: vector<int> sortArray(vector<int>& nums) { vector<int> countArr(100001, 0); // Count Each Element for (int num : nums) { countArr[50000 + num]++; } // Add previous counts for (int i = 1; i < 100001; i++) { countArr[i] ...
ALGO
0.999977
5.730188
2c59e871-3913-4bd4-b3ab-26e99f489b06
graphbig/graphBIG
common/HMC.cpp
#include "HMC.h" #define LOCK_SIZE (1<<20) #define LOCK_MASK (LOCK_SIZE-1) uint16_t global_lock[LOCK_SIZE]={0}; uint16_t __attribute__ ((noinline)) HMC_CAS_greater_16B(uint16_t * ptr1, uint16_t newdata) { uint16_t olddata = *ptr1; uint64_t idx = (uint64_t) ptr1; idx = (idx >> 1) & LOCK_MASK; while(...
TOOL
0.865538
4.485017
85e89b86-4347-468b-a8d7-c98013c8a8c5
MinerHai/CTDLGT_CUOIMON
b21.cpp
#include <iostream> using namespace std; struct MonHoc { int mamh; string tenmh; int sotc; int sotietdaday; }; void Nhap_MH(MonHoc &mh) { cout << "Nhap ma mon hoc:"; cin >> mh.mamh; cout << "Nhap ten mon hoc:"; cin.ignore(); getline(cin, mh.tenmh); cout << "Nhap so tin chi:"; ...
TOOL
0.99062
3.25262
33615b8a-46e7-4dad-b65a-ceb6609c9e1c
nikitgokhale/practice_codes
DS/HashTable/HackerRank/Ice Cream Parlour/whatFlavors.cpp
#include <bits/stdc++.h> using namespace std; string ltrim(const string &); string rtrim(const string &); vector<string> split(const string &); /* * Complete the 'whatFlavors' function below. * * The function accepts following parameters: * 1. INTEGER_ARRAY cost * 2. INTEGER money */ /* Approach: As...
ALGO
0.99975
5.271722
9a73ba25-53b0-4b06-a826-c92e0d628213
hmahajan99/InterviewBit-Solutions
Greedy/Easy greedy/Highest Product.cpp
// Given an array A, of N integers A. // Return the highest product possible by multiplying 3 numbers from the array. // Approach 1: Sorting, Time O(nlogn) bool cmp(int a,int b){ return a>b; } // Handles all cases => + + +, + - -, - - -, - + + (For - + + size of A should be 3) int Solution::maxp3(vector<int> &A)...
ALGO
0.999968
5.337991
a7112715-d415-466e-9ce6-f885f0d781ec
DPrinceKumar/HacktoberFest2020-1
CPP/addressof-idiom.cpp
class Fine {}; class Demo { int a = 0; public: int* operator&() { return &a; } }; template <class T> T* addressof(T& v) { return reinterpret_cast<T*>( &const_cast<char&>(reinterpret_cast<const volatile char&>(v))); } int main() { Fine* f1; Fine f2; f1 = &f2; Demo* ...
TOOL
0.856685
4.257736
4805b78e-c963-4c21-808f-3db3cd9e2d23
MaggieLee01/Coding
Utilities/BinaryTree.cpp
// ӡ οbook˼· //7ַϴ˼·дӡʼӡδϸ #include<iostream> #include <cstdio> #include"BinaryTree.h" #include<queue> #include<stack> //ڵ BinaryTreeNode* CreateBinaryTreeNode(int value) { BinaryTreeNode* pRoot = new BinaryTreeNode(); if (pRoot != nullptr) { pRoot->m_nValue = value; pRoot->m_pLeft = nullptr; pRoot->m_pRigh...
ALGO
0.999887
3.711644
f3d1b9ae-ddbe-42b0-9b0b-a2f6feaa0aa9
kkorona/BOJ_Rche
6410/main.cpp
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int p[100001]; void init(int v) { for(int i=0; i<v; i++) p[i]=i; } int Find(int v) { return (p[v] == v) ? v : p[v]=Find(p[v]); } void Union(int u,int v) { int pu=Find(u); int pv=Find(v); p[pu]=pv; } class Edg...
ALGO
0.999337
3.895405
e69ee2b2-ce45-4943-93bc-80f3611cacc2
ioscarhunter/Source-Fingerprint--Stub-
TestOpenCV/Main.cpp
#include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include "FpSegmentator.hpp" #include "FpMatcher.hpp" #include "OfDetector.hpp" #include "Binarizer.hpp" #include "FpEnhancer.hpp" #include "FpSegmentator.hpp" #include "GaborFilter.hpp" #i...
TOOL
0.949771
3.607285
52824347-6e4d-47af-b39f-41c02e6a04d5
Shahariar-Anu/CodeForces
A-Set/1554A_Cherry.cpp
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int t; cin>>t; while(t--) { int n; cin>>n; long long int arr[n+1],ans=0; for(int i=0; i<n; i++) cin>>arr[i]; for(int i=0; i<n-1; i++...
ALGO
0.999942
3.657159
8f5b961c-148c-4186-b7e7-4cf918d09882
Lakshyadevelops/CSES-Problem-Set
Intro/Apple_Division.cpp
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long ll; typedef pair<int,int> pii; typedef set<int> si; typedef vector<pair<int,int>> vpii; #define pb push_back #define pob pop_back #define mp make_pair #define in insert #define y() cout<<"YES"<<endl; #define n() cout<<"NO"<<endl; #de...
ALGO
0.999953
4.29399
26d8eab4-3638-410c-bb1a-4d98bc34824c
vsumanbabu/SelfDrivingCar-PathPlanning
src/Eigen-3.3/doc/examples/tut_matrix_coefficient_accessors.cpp
#include <iostream> #include <Eigen/Dense> using namespace Eigen; int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << "Here is the matrix m:\n" << m << std::endl; VectorXd v(2); v(0) = 4; v(1) = v(0) - 1; std::cout << "Here is the vector v:\n...
ALGO
0.993243
3.671318
18c79826-59bc-4148-b5b2-c9283d8df8a4
KomiMoe/Arkari
libcxx/src/barrier.cpp
#include <barrier> #include <thread> _LIBCPP_BEGIN_NAMESPACE_STD class __barrier_algorithm_base { public: struct alignas(64) /* naturally-align the heap state */ __state_t { struct { atomic<__barrier_phase_t> __phase{0}; } __tickets[64]; }; ptrdiff_t& __expected_; unique_ptr<__state_t[]> __stat...
ALGO
0.988667
5.920795
b942cd22-6efb-47fe-be17-1ec021d111b3
cran/dodgr
src/heaps/heap23.cpp
/* File heap23.c - 2-3 Heap * ---------------------------------------------------------------------------- * Mark Padgham, adapted from code by Shane Saunders */ /* This version is implemented using the same pointer structure as a Fibonacci * heap; that is, nodes have a parent pointer, and a child pointer which po...
ALGO
0.999933
6.130623
5bb889bf-2269-4cfd-aa2c-1a5b59c90046
Nathaniel-Carl-Peter/cp2406pracs
prac_10/prac10_task4_int_triangles/solutions/p039.cpp
#include <iostream> #include <cmath> #include <vector> #include <map> #include <tuple> const int MAX_P = 1000; const int MAX_N = 1000 / 2; template <typename SOME_VECTOR> void myPrint(const SOME_VECTOR& vec) { for (const auto& myTuple : vec) { std::cout << "(" << std::get<0>(myTuple) << ", " ...
ALGO
0.999539
4.739177
68fbf6ce-1c1a-4659-8ed2-1307e5186a4c
Pranit5895/LeetCode
Algorithm/Algorithm-1/Day1/704. Binary-Search.cpp
class Solution { public: int bSearch(vector<int>& nums, int target, int start, int end){ if(end < start) return -1; int mid = (start+end)/2; // cout << mid << endl; if(nums[mid] == target){ return mid; }else if(target < nums[mid]){ return bSearch(nums,...
ALGO
0.999983
6.15477
7dd452c8-039c-4234-a3ae-8528adfa44ab
amomorning/online-challenges
codeforces/985/e.cpp
#include <bits/stdc++.h> const int N = 5e5+10; int a[N], c[N]; int sum(int i) { if(i == 0) return 1; int ret = 0; for(; i > 0; i -= i&-i) ret += c[i]; return ret; } void add(int i, int x) { for(; i <= N; i += i&-i) c[i] += x; } int main() { int n, k, d; scanf("%d%d%d", &n, &k, &d); for(int i = 1; i <= n; ++ ...
ALGO
0.99999
3.995424
1c051112-d04b-4ed9-8127-1fcb66812405
DeepG25/Leetcode
Linked List/Reverse_Linked_List.cpp
/* Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL */ //Solution //time complexity - O(n) //space complexity - O(1) /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * ...
ALGO
0.999981
5.927169
cd57a9a8-1802-4746-be11-15117db34847
SourabhKrSuman/Projects
C++/Practice/wrfinalcg.cpp
#include <iostream> #include <graphics.h> #include <conio.h> #include <cmath> #include <dos.h> using namespace std; main() { int gd=DETECT, gm; float i,xmax,ymax,xmin,ymin,x1,y1,x2,y2,m; float start[4],end[4],code[4]; initgraph(&gd,&gm,NULL); cout<<"Enter xmin and ymin: "; cin>>xmin>>ymin; cout<<"Enter xmax and ...
ALGO
0.999101
3.206798
3fbcf261-b619-4193-9c36-68975083804c
SeungBeomLim/24-1_PPS-Camp
A106_임승범_20240708.cpp
// A106. 등장하지 않는 문자의 합 - Baekjoon #include <iostream> #include <unordered_set> using namespace std; int main() { int T; cin >> T; cin.ignore(); for (int i = 0; i < T; i++) { unordered_set<char> ust; string line; getline(cin, line); for (char c: line) { ...
ALGO
0.998817
5.418337
2304c63e-a59f-4ab2-a96b-e07b86cbe4c1
piash76/CF-ATCODER-UVA-LIGHTOJ-SPOJ
Chess Cheater.cpp
///Bismillahir Rahmanir Rahim ///ALLAHU AKBAR #include<bits/stdc++.h> #define flash() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type, less<int>, rb_...
ALGO
0.999954
3.611362
95e50232-7ac7-4d5b-a5dd-78aebcb059af
green-fox-academy/sanyi0411
week-02/day-2/6. List introduction 1/main.cpp
#include <iostream> #include <string> #include <vector> int main() { //Create an empty list which will contain names (strings) std::vector<std::string> list; //Print out the number of elements in the list std::cout << "The size of the list is " << list.size() << std::endl; //Add William to the li...
TOOL
0.967191
4.956294
0a426064-ced8-44e7-bf13-f8debf0a3d31
VincentCroft/CppPrimerPlusSix
Chapter 6/condit.cpp
// condit.cpp -- using the conditional operator #include <iostream> int main() { using namespace std; int a, b; cout << "Enter two integers: "; cin >> a >> b; cout << "The larger of " << a << " and " << b; int c = a > b ? a : b; // c = a if a > b, else c = b cout << " is " << c << endl; ...
ALGO
0.993709
3.394733
e576609d-a272-4c01-aa41-50d3e2132e5e
ealjkl/leetcode-solutions
377-combination-sum-iv/main2.cpp
#include <bits/stdc++.h> #include "/home/ealjkl/competitive-programming/utils/cpp/print.cpp" using namespace std; map<int, int> cache; int cachedFunc(vector<int> &nums, int target, map<int, int> &cache) { int ans = 0; if (target < 0) { return 0; } if (target == 0) { return 1; } ...
ALGO
0.999956
5.934481
6da95045-d02b-49d4-b930-783f4519580d
Aleavara/C-
pariDispari.cpp
#include<iostream> using namespace std; // Definire un numero pari o dispari senza l'uso del modulo int main() { // DICHIARAZIONE int n; // RICHIESTA IN INPUT DEL NUMERO DA ESAMINARE cout<<"Inserisci numero: \n "; cin>>n; // ESECUZIONE while(n>1) { n = n-2; } // STAMPA A VIDEO DEL RISULTATO ESAMINATO if(...
ALGO
0.999978
4.006708
fa55dd03-cef1-4679-8e80-f7b61aa1ff4f
mregrock/BigInteger
BigInteger/src/creation.cpp
// // Created by Егор Кулин on 15.02.2024. // #include "BigInteger.h" namespace big_num { BigInteger::BigInteger(std::string str_num) { int index = static_cast<int>(str_num.find('.')); std::string next_str; int count_bit = 0; int chunk_num = 0; this->AddChunk(0); if ...
TOOL
0.903976
4.913516
e957d1d7-49c9-4abf-a61f-ea9748cbc3d4
PmCoder26/te-sem-5-practicals
CNS_Lab/P_4/Ast_4.cpp
#include<iostream> #include<bits/stdc++.h> #include<ctime> using namespace std; #define ll long long int void transmissionMeth(ll &i, ll &N, ll &tf, ll &tt){ while(i <= tf){ int z = 0; for(int k = i; k < i+N && k<= tf; k++){ cout<<"Sending Frame "<<k<<"..."<<endl; tt++; } for(int k = i; k...
ALGO
0.996275
3.581265
fa953829-cfa0-42c7-b3b6-dc981dbf2cd0
m9m9ra/llms
ref/llama.rn/llama.cpp/tests/test-sampling.cpp
#include "ggml.h" #include "llama.h" #ifdef NDEBUG #undef NDEBUG #endif #include <algorithm> #include <cmath> #include <string> #include <vector> extern struct llama_sampler * llama_sampler_init_dry_testing(int32_t context_size, float dry_multiplier, float dry_base, int32_t dry_allowed_length, int32_t dry_penalty_la...
TEST
0.921275
6.822136
61aaea23-8ada-4397-84d6-aca300bf65d7
heavenMOJANG/ICPC
.history/programmes_C_Cpp/Codeforces/CF2124/E_20250707003543.cpp
#pragma GCC optimize(3, "Ofast", "inline") #include <bits/stdc++.h> #define int long long using namespace std; constexpr int INF = 0x7fffffff; void solve() { int n; cin >> n; vector<int> a(n), pre(n + 1, 0); for (int i{}; i < n; ++ i) cin >> a[i], pre[i + 1] = pre[i] + a[i]; if (pre[n] & 1) { cout << "-...
ALGO
0.999901
4.265945
183d5235-96f0-4135-9c48-f61535b33064
seongtaekkim/cpp-study
ttabaecpp/6/6-14-5.cpp
#include <iostream> using namespace std; struct Something { int v1; }; struct Other { Something st; }; int main(void) { Other ot; int &v1 = ot.st.v1; v1 = 1; int value = 5; int *const ptr = &value; int &ref = value; *ptr = 10; ref = 10; return (0); }
TOOL
0.852942
3.482866
3ae0fdc1-8477-4bd7-9e96-ea15e7ac9e04
Hemersom/Estrutura-de-dados
2. Estudos/AO/valores/SimpleInsertion.cpp
#include<stdio.h> #include<stdlib.h> #include <time.h> void randomizar(int *vet, int tam){ srand(time(NULL)); for (int i = 0; i < tam; i++) { vet[i] = rand() % 100; } } void sort(int *l, int tam){ for (int i = 1; i < tam; i++) { int key = l[i]; int j = i-1; while ...
ALGO
0.997353
4.189837
38499890-d24a-4c98-a112-d76adf331e03
alghanykennedy/ToDo_App_GetX
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
30ee1ab9-9a08-473d-af7d-f6b0418a89f6
rainingapple/algorithm-competition-code
数据结构与算法/数据结构/数据结构11—线索二叉树/中序线索二叉树的遍历.cpp
#include<iostream> using namespace std; typedef struct ThreadTNode{ int data; ThreadTNode *lchild,*rchild; int ltag,rtag; }ThreadTree; ThreadTree *FirstNode(ThreadTree *p) { while(p->ltag==0) p=p->lchild; return p; } ThreadTree *NextNode(ThreadTree *p) { if(p->rtag==0) return FirstNode(p->rchild); else ret...
ALGO
0.999925
3.114288
d593ec7b-53da-4067-868a-e05c3b258982
31Sanskrati/Data_Structure_and_algorithms
sorting/DNFsort.cpp
#include <iostream> using namespace std; // 0000 1111 2222 void swap(int arr[], int i, int j) { //swaping between two numbers int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } void dnfsort(int arr[], int n) { int low = 0; int mid = 0; int high = n - 1; while (mid <= high) { ...
ALGO
0.999957
4.607557
554fbcc5-15cc-4c80-a3fa-fbd02f37fa2e
Nikhil562/DSAinCPP
0706-design-hashmap/0706-design-hashmap.cpp
class MyHashMap { public: vector<int> v; MyHashMap() { v.resize(1e6+1,-1); } void put(int key, int value) { v[key]=value; } int get(int key) { return v[key]; } void remove(int key) { v[key]=-1; } };
ALGO
0.998524
5.912621
1bc452cb-e1ce-4482-ad74-7b279972ac73
eric2054/0
test/6019.cpp
#include<iostream> #include<string> #include<vector> #include<cmath> using namespace std; const int rows = 8; const int columns = 4; void move(int* record, const int x, const int y){ int dx = abs(record[0] - x); int dy = abs(record[1] - y); if (dx >= dy) { record[0] += (x > record[0]) ? 1 : -1; ...
ALGO
0.999771
4.657067
978c7436-a03a-42a2-aad4-c96737aab331
thebesttv/vul-llvm
libc/src/math/generic/remainderl.cpp
#include "src/math/remainderl.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(long double, remainderl, (long double x, long double y)) { int quotient; return fputil::remquo(x, y, quotient); } } // namespace __llvm_li...
TOOL
0.979359
5.661
c08b8976-7b5a-4da1-9be5-bab5c11aae30
huxingyi/autoremesher
thirdparty/libigl/include/igl/copyleft/cgal/wire_mesh.cpp
#include "wire_mesh.h" #include "../../list_to_matrix.h" #include "../../slice.h" #include "../../PI.h" #include "convex_hull.h" #include "mesh_boolean.h" #include <Eigen/Geometry> #include <vector> template < typename DerivedWV, typename DerivedWE, typename DerivedV, typename DerivedF, typename DerivedJ> I...
ALGO
0.941463
6.203446
8bf55ee0-2f82-44fd-8cce-65e8a697b894
g3ida/leetcode
32-longest_valid_parentheses.cpp
////////////////////////////////////////////////////////////// // 32. Longest Valid Parentheses ////////////////////////////////////////////////////////////// // Given a string containing just the characters '(' and ')', find the length of the longest valid // (well-formed) parentheses substring. // Example 1: // Inpu...
ALGO
0.999389
6.060466
cbc5edab-0ac1-4eb7-8aac-356abe8361b8
wangqinghe95/Knowledge-Of-CPlusPlus
DataStructure/Code/postorderTraversal.cpp
/* 树的后序序遍历--迭代和递归 */ #include<vector> #include<stack> using namespace std; 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) : ...
ALGO
0.99995
5.545759
3c9004d6-769b-47e0-933b-133bd756c82b
FuuuOverclocking/leetcode
src/cpp/offer-II-32.cpp
#include "default.h" class Solution { public: bool isAnagram(string s, string t) { if (s.size() != t.size() || s == t) { return false; } int count[26]{0}; for (auto ch : s) { count[ch - 'a']++; } for (auto ch : t) { count[ch - 'a']...
ALGO
0.999439
6.157633
b953a164-6f1e-4d22-9378-19f85eae1f29
swang142/Past-CCC-Solutions
CCC 2019/CCC2019Q3.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int inf= 1e9; int N; int dr[4]= {-1, 1, 0, 0}; int dc[4]= {0, 0, -1, 1}; vector<vector<bool>> visited; vector<vector<int>>grid(3, vector<int>(3, 0)); void fillR(int r, int c){ if(c==0 && grid[r][1]!= inf && grid[r][2] != inf){ ...
ALGO
0.999618
4.089339
b577dc1d-6d10-4b81-9969-c7562861aec2
chuc28/LNS-on-MAPD
src/main.cpp
#include <iostream> #include <string.h> #include "LNS.h" #include "map_loader.h" #include "tasks_loader.h" #include "agents_loader.h" using std::string; string agents[5] = {"60", "90", "120", "150", "180"}; int main(int argc, char** argv) { for(int i=0; i< 5; i++){ string taskfile = "./Instances/large/kiva-2000.t...
ALGO
0.980587
3.430155
c64c3161-a59d-49cf-93d2-ab4594ccfda6
ahmeducf/problem-solving
UVA/1260 - Sales.cpp
/* * Directed by: Ahmed Salah * */ #include <bits/stdc++.h> #define kill return 0 #define space " " #define endl '\n' #define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define STREAM_IO using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string str; typedef bitset<1000000...
ALGO
0.99971
4.058624
e21c09ab-6fcb-4d14-a1d3-32a81112917f
Aak172003/DSA_Prep
My-Prep-main/Level-UP/MyCode/8 - Array/Arrays - Class 1/HOMEWORK/1 - sizeof(arr).cpp
#include <iostream> using namespace std; int main() { int arr[] = {}; cout << sizeof(arr); // 0 * 4 = 0 // OR int arr[5] = {}; cout << sizeof(arr); // 5 * 4 = 20 // OR int arr[] = {1, 2, 3, 4, 5}; cout << sizeof(arr); // 5 * 4 = 20 return 0; }
ALGO
0.977805
3.456509
747a874f-7dc7-4ca6-ba39-2b0c05c8c74d
Rajibkd1/Algo
0/1_Knapsack.cpp
#include <stdio.h> #include <stdlib.h> int max(int a, int b) { return (a > b) ? a : b; } int knapsack(int S, int N, int sizes[], int values[]) { // Create a 2D table to store the maximum values int dp[N + 1][S + 1]; // Initialize the first row with zeros for (int j = 0; j <= S; j++) { dp[...
ALGO
0.999957
4.240808
de963be3-67d2-4b43-8852-8a9700ddbeb9
hwajin-me/gptp-burningground
GPTP/AI/spells/disruption_web.cpp
#include "spells.h" #include <AI/ai_common.h> namespace AI { CUnit* findBestDisruptionWebTarget(const CUnit *caster, bool isUnderAttack) { int bounds; if (isUnderAttack) bounds = 32 * 9; else if (isUmsMode(caster->playerId)) bounds = 32 * 128; else bounds = 32 * 64; auto disruptionWebTargetFind...
ALGO
0.974514
5.561645
f6cb45c8-f0bd-41dc-9373-25ce75153130
Jack1eNgBaro/JustCp
CodeForces/C++14 (GCC 6-32)/791A | Bear and Big Brother/195118347.cpp
/* "There is no light without dark There is no joy without pain You can't have a rainbow without a little rain" ~ Andrew Tate */ #include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define bit(x, i) ((x >> i) & 1) const int mod = 1e9 + 7; const int maxn = 1...
ALGO
0.999806
3.942691
2d7a18e9-b352-4f1f-91ec-6b638baf192b
taaraa99/Master-of-AI-Unibo
CDMO/venv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp
// Note - The x86 and x64 versions do _not_ produce the same results, as the // algorithms are optimized for their respective platforms. You can still // compile and run any of them on any platform, but your performance with the // non-native version will be less than optimal. #include "MurmurHash3.h" //-------------...
ALGO
0.997654
7.198757
b766e22b-8920-4f39-ad38-32d9e24bbbaa
DcmTruman/my_acm_training
HDU/1043/16367264_AC_624ms_6532kB.cpp
/*----------------------------------------- 作者:邓楚盟 日期:2018年10月10日 耗时:700ms -----------------------------------------*/ #include <iostream> #include <functional> #include <algorithm> #include <string.h> #include <string> #include <map> #include <stack> #include <vector> #include <math.h> #include <queue> using namespace...
ALGO
0.999925
4.877747
95f1ed1f-2c06-4f7b-974c-160cc3738bf3
jpdotcom/comp_prog-archive
Auto_Upload_CodeChef/START48B/Fill The Grid.cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define FOR(b) for(int i=0;i<b;i++) #define mp(a,b) make_pair(a,b) typedef std::vector<int> vi; typedef std::pair<long long, long long> pi; typedef long long ll; #define F first #define S second ...
ALGO
0.999979
5.120408
e86368e1-38f0-423e-a2b8-18ef6c6554b8
marioyc/Online-Judge-Solutions
COCI/2010-2011/Contest #1/LJUTNJA.cpp
#include <cstdio> #include <algorithm> using namespace std; int main(){ long long M; int N; scanf("%lld %d",&M,&N); long long a[N]; for(int i = 0;i<N;++i) scanf("%lld",&a[i]); sort(a,a+N); long long lo = 0,hi = a[N-1]-1,mi; while(lo!=hi){ mi = (lo+hi+1)/2; ...
ALGO
0.999964
3.312831
1b426be7-ade6-421c-b2b4-405088cc071f
Vd421/DSA
kj bvdkj.cpp
#include <iostream> using namespace std ; bool isPerfect(long long int n) { long long int sum = 1; for (long long int i=2; i*i<=n; i++) { if (n%i==0) { if(i*i!=n) sum = sum + i + n/i; else sum=sum+i; } } if...
ALGO
0.9993
4.517384
67aaf869-d53d-4bb3-a7ba-073a3afbfe1f
TheAlgorithms/C-Plus-Plus
others/longest_substring_without_repeating_characters.cpp
/** * @file * @brief Solution for Longest Substring Without Repeating Characters problem. * @details * Problem link: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ * * Intuition: * 1) The intuition is straightforward and simple. We track the frequency of characters. *...
ALGO
0.999852
7.237857
24caaf7c-96a6-455a-b850-0cf693ce4f80
vfolunin/archives-solutions
MCCME/112170.cpp
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <string> using namespace std; int main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); double x, y; cin >> x >> y; if (x * x + y * y <= 1 && (y >= -x || y <= x)) cou...
ALGO
0.999454
3.951765
ae8c4d7d-f563-4fd4-9f34-78d493f3c7e0
ravi-kislaya/CFD-Lab
Project/StudentLB/Code/DataStructure.cpp
#include "DataStructure.h" #include "helper.h" #include "computeCellValues.h" #include "LBDefinitions.h" #include <stdio.h> #include <iostream> #include <list> //------------------------------------------------------------------------------ // Wall cell //------------------------------------...
ALGO
0.995831
5.821247
753941d5-6cf6-4b7b-b8a7-cdaceaef8ad5
eliot-exdev/boost-morphos
libs/numeric/odeint/examples/quadmath/black_hole.cpp
#include <cstdlib> #include <cmath> #include <iostream> #include <iterator> #include <utility> #include <algorithm> #include <cassert> #include <vector> #include <complex> extern "C" { #include <quadmath.h> } const __float128 zero =strtoflt128 ("0.0", NULL); namespace std { inline __float128 abs( __float128 x )...
ALGO
0.99995
4.593484
a25a99de-581a-4ec4-b8eb-7725cb26312a
samek567/ZadaniaAlgorytmiczne
OKI_2021_zawansowane/paliwo100pkt_kolejka_monotonniczna.cpp
#include <iostream> #include <vector> #include <deque> using namespace std; struct Stacja { int cena; int odleglosc; }; struct Element { int wartosc; int ile; }; int p = 0, n = 0, c = 0, d = 0, ile_mamy = 0, wyn = 0; vector<Stacja> stacje; deque<Element> Q; int main() { ios_base::sync_with_stdi...
ALGO
0.999532
3.930109
694c389f-9c1d-4492-bee0-7c8c789bbc46
changsongzhu/leetcode
C++/per_day/07-18-2017/587_h.cpp
/** 587[H]. Erect the Fence There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the minimum length of rope as it is expensive. The garden is well fenced only if all the trees are enclosed. Your task is to help find the coord...
ALGO
0.999999
5.441934
a5547e86-9426-4227-9c71-063e183684dd
Ajeet1606/LeetCode-practice-problems
0373-find-k-pairs-with-smallest-sums/0373-find-k-pairs-with-smallest-sums.cpp
class Solution { public: vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) { int m = nums1.size(); int n = nums2.size(); vector<vector<int>> ans; set<pair<int, int>> visited; priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int...
ALGO
0.999991
6.144065
48dd91ed-9910-4018-b14f-ac271808605e
Haribala-09/hyprdots
User/History/5fcf7295/MqXw.cpp
#include <bits/stdc++.h> using namespace std; #define rev(ans) reverse(ans.begin(), ans.end()) #define all(a) begin(a), end(a) #define mems(a, n) memset(a, n, sizeof(a)) #define pb push_back #define fst first #define scd second // #define int long long using pii = pair<int, int>; using pci = pair<char, int>; void db...
ALGO
0.999935
5.758942
bb37fd3e-4e6a-428d-a9ad-d170afae8c59
Vishwam36/InterviewBit
Greedy Algorithm/Assign Mice to Holes.cpp
// By Vishwam Shriram Mundada // https://www.interviewbit.com/problems/assign-mice-to-holes/ // Easy int Solution::mice(vector<int> &A, vector<int> &B) { int ans = 0, n = A.size(); sort(A.begin(), A.end()); sort(B.begin(), B.end()); for(int i = 0; i < n; ++i) ans = max(ans, abs(A[i]-...
ALGO
0.999829
5.599156
d0ceaaa5-67c6-46df-b3c8-2b61686c2c0e
baolam/c_plus_plus_exercise
#vnoi/fcb030_strin/main.cpp
#include <bits/stdc++.h> #define maxn 100006 using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int n; ll dp[maxn][3]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int k = 0; k <= 2; k++) dp[1][k] = 1; for (int i = 2; i <= n; i++) ...
ALGO
0.999967
4.288262
a4815f93-d17c-46b9-aeb5-b6b18f178a18
Alok-Khansali/Lets-LeetCode
Medium/Maximum_Length_of_Pair_Chain.cpp
// Dynamic Programming Approach class Solution { public: vector<vector<int>> dp; int mx = 1; int doit(int i, int prev, int n, vector<vector<int>> &p) { if (i >= n) return 0; if (dp[i][prev] != -1) return dp[i]; if (p[i][0] <= p[prev][1]) return...
ALGO
0.999985
5.825552
86c549cf-641d-4a10-b398-59654623ad25
antonypremkumar/Cpp
IOAndLoop/sqrt.cpp
#include <iostream> #include <cmath> int main() { double x; double squareRoot; std::cout << "Input numbers: \n"; std::cin >> x; squareRoot = std::sqrt(x); std::cout << "Square root of " << x << " is: " << squareRoot << std::endl; }
TOOL
0.973335
3.880563
65f1a12f-b3b8-4183-9a76-80a570d16ef8
zim2510/Online-Judge-Solves
UVA/Prime1.cpp
#include <bits/stdc++.h> #define MAX 46341 using namespace std; int mark[100005]; int prime[MAX+1]; int nprime[4792]; void siv() { int lmt = sqrt(MAX); prime[0] = prime[1] = 1; int x = 0; nprime[x++] = 2; for(int i = 4; i<=MAX; i+=2) prime[i] = 1; for(int i = 3; i<=MAX; i+=2){ if(!p...
ALGO
0.999425
3.5778
e957a178-7179-47b3-9938-276723828ba7
Aditya-Trivedi-06/Google-Kickstart-Solutions
2020/F/A.cpp
#include <bits/stdc++.h> #define ll long long #define ld double #define uint unsigned int #define ull unsigned long long #define ff first #define ss second // For Loops ---------------------------- #define lp(i, n) for (int i = 0; i < n; i++) #define lp1(i, n) for (int i = 1; i < n; i++) // Vectors / pairs / maps ...
ALGO
0.999645
3.316063