uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
c764c1de-4934-483d-bf20-5b6a053a0586
kmjp/procon
atcoder/arc051-100/arc81-100/arc093/b.cpp
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZER...
ALGO
0.999796
3.029607
0a1c0751-1207-47a2-b994-29c9c9c5e932
JessicaSt0ne/Computer-Graphics-Animator
curve.cpp
#include "Curve.h" #include <algorithm> #include <functional> #ifdef _DEBUG #include <assert.h> #endif // _DEBUG #include <math.h> #ifdef WIN32 #include <windows.h> #endif // WIN32 #include <GL/gl.h> #include <float.h> #include "Curve.h" #include "CurveEvaluator.h" float Curve::s_fCtrlPtXEpsilon = 0.0001f; Curve::C...
TOOL
0.949682
6.702187
975a2018-b737-4780-8bac-3af024828f1e
truonghienminh/Full-House
code/02_11/02_11.cpp
#include <iostream> #include <math.h> using namespace std; int main(){ int n; long long sum = 0; cin >> n; for (int i = 1; i <= n; i++){ sum += (pow(-1, i)) * i; } cout << sum; return 0; }
ALGO
0.999931
4.179422
0b751cc8-753b-407b-aaf3-afa3583db793
sarvex/leetcode-carbon
lcof/面试题47. 礼物的最大价值/Solution.cpp
class Solution { public: int maxValue(vector<vector<int>>& grid) { int m = grid.size(), n = grid[0].size(); vector<vector<int>> f(2, vector<int>(n + 1, 0)); for (int i = 1; i <= m; ++i) { for (int j = 1; j <= n; ++j) { f[i & 1][j] = max(f[i & 1 ^ 1][j], f[i & 1][j...
ALGO
0.999944
5.887176
8f30d16b-1994-459b-a479-06bae3465243
Abhishekkr21/LeetCode-Solution
2102-find-the-middle-index-in-array/2102-find-the-middle-index-in-array.cpp
class Solution { public: int findMiddleIndex(vector<int>& nums) { int n= nums.size(); int left=0, totalSum=0; for (int num : nums) { totalSum += num; } for(int i=0;i<n;i++) { if(left==totalSum-left-nums[i]) { return i; ...
ALGO
0.99999
6.137461
69a5b962-910c-4cf2-9997-5abb027105d4
hichemaichour/ACM-ICPC
Contests/ACM Contests/Rocky 2010/h.cpp
#include <iostream> #include <algorithm> using namespace std; bool isL(double v[]){ return (v[0]>=0.25 && v[1]>=90 && v[2]>=125) && (v[0]<=7 && v[1]<=155 && v[2]<=290); } bool isPc(double v[]){ return (v[0]>=0.25 && v[1]>=90 && v[2]>=125) && (v[0]<=50 && v[1]<=300 && v[2]<=380); } bool isPa(double v[]){ return (v[0...
ALGO
0.997262
3.546819
6bf0ca5d-f949-4296-b946-a569fab75d63
ShikhaDhiman1/DSA_practice
Linked_List/findIntersection.cpp
#include <iostream> #include "linkList.h" using namespace std; void intersect(node* &head1, node* &head2, int pos){ node* temp2 = head2; node* temp1 = head1; pos--; while(pos--){ temp2 = temp2->next; } while(temp1->next != NULL){ temp1 = temp1->next; } temp1->next = temp...
ALGO
0.999782
4.116967
de915397-841a-4d54-a36f-65b6b97bdf42
ushakov/mapsoft
core/img_io/gobj_trk.cpp
#include <vector> #include <cmath> #include "gobj_trk.h" #include "draw_trk.h" using namespace std; int GObjTRK::draw(iImage & image, const iPoint & origin){ iRect src_rect = image.range() + origin; #ifdef DEBUG_LAYER_TRK cerr << "GObjTRK: draw " << src_rect << " my: " << myrange << "\n"; #endif // FIXME - u...
ALGO
0.98023
5.547779
48f61bf2-0b1d-424e-9bb9-1188494533b5
deniscostadsc/playground
solutions/project-euler/021/021.cpp
#include <iostream> #include <set> std::int16_t sum_divisors(std::int16_t n) { std::int16_t sum = 1, i; for (i = 2; i <= n / 2; i++) { if (n % i == 0) { sum += i; } } return sum; } bool is_amicable(std::int16_t n) { return n == sum_divisors(sum_divisors(n)); } int ma...
ALGO
0.999793
6.03837
6c16e63c-ff4a-47e3-b0e4-07892e871c37
triangleim/RCode
SM_exp/getData.cpp
#include <fstream> #include <iostream> #include <sstream> #include <stdlib.h> #include <iomanip> #include <climits> #include <cmath> #include <random> #include <vector> #include <algorithm> #include <boost/filesystem.hpp> using namespace std; typedef vector<int> vec; typedef vector<string> stringvec; template <typen...
DATA
0.951852
4.329684
7f1f0a60-3556-4662-beda-7c010996b367
codemistic/Data-Structures-and-Algorithms
Dynamic Programming/Largest Sum Contiguous Subarray.cpp
// largest contiguous array sum #include <bits/stdc++.h> using namespace std; int maxSubArraySum(int a[], int size) { int max_so_far = INT_MIN, max_ending_here = 0; for (int i = 0; i < size; i++) { max_ending_here = max_ending_here + a[i]; if (max_so_far < max_ending_here) max_so_far = max_ending_h...
ALGO
0.999965
5.28139
c104e95e-1c26-4cc1-8801-7985da406367
raincross7/code-similarity
codes/train_code/problem397/problem397_59.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define PB push_back #define MP make_pair #define endl "\n" #define sd(val) scanf("%d", &val) #define ss(val) scanf("%s", &val) #define sl(val) scanf("%lld", &val) int main() { int n; cin >> n; ...
ALGO
0.999762
4.328101
f2743c02-60f4-4c3e-9f13-df51548dcd41
vlahovivan/AoC-2020
18-1.cpp
#include <bits/stdc++.h> #define ll long long using namespace std; const int MOD = 1e9+7; ll evaluate(string expression){ ll res = 1; int last = -1; int op = 2; // 1 - addition, 2 - multiplication ll val; for(int i=0; i<expression.length()+1; i++){ if(expression[i] == '('){ ...
ALGO
0.999908
4.41115
e89d1be9-bb0e-494f-a55e-e038c22ef57f
andreyegor/nsu-tasks
CPP/nstt_11.cpp
#include <type_traits> #include <iostream> template<int a, int b = a - 1> struct is_prime : std::conditional< b == 1, std::true_type, std::conditional<static_cast<bool>(a % b), is_prime<a, b - 1>, std::false_type>>::type::type { }; template<int n, int now = 1> struct n_prime : std::conditional< ...
ALGO
0.959347
5.892736
8f4bc5f5-cf83-409f-bb16-f12bdb53314f
TheDukeVin/BaseRL
MAPG.cpp
#include "MAPG.h" MAPG::MAPG(LSTM::PVUnit* structure_, string gameFile_, string saveFile_, string controlFile_, string scoreFile_, string firstFile_, string hiddenFile_){ gameFile = gameFile_; saveFile = saveFile_; controlFile = controlFile_; scoreFile = scoreFile_; firstFile = firstFile_; hid...
ALGO
0.992651
4.183567
d63f4851-8752-4e10-931c-0ca0156a32c8
Yawn-Sean/Daily_CF_Problems
daily_problems/2024/07/0711/personal_submission/cf1131f_yawn_sean.cpp
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> ends(n), nex(n, -1), head(n, -1); iota(ends.begin(), ends.end(), 0); function<int(int)> find_head = [&] (in...
ALGO
0.999994
4.858243
82624b5b-d1dc-42cd-91e5-779f513e93ea
Liz-Nozomi/qingwen
mid/simulate/628-unionfind-template.cpp
#include <bits/stdc++.h> using namespace std; class unionfind{ private: vector<int> parent; vector<int> rank; int n; public: void init(int size){ n = size; parent.resize(size); rank.resize(size,0); for(int i=0;i<size;i++){ ...
ALGO
0.999997
3.74507
c53a1b33-695f-4b51-aaee-af108c9f84bd
SMiles02/CompetitiveProgramming
Codeforces/CF 1800 - 1899/CF1844/CF1844B.cpp
#include <bits/stdc++.h> using namespace std; int n; void print(int x) { if (n >= x) { cout << x << " "; } } void solve() { cin >> n; print(5); for (int i = n - (n & 1); i >= 6; i -= 2) { print(i); } print(2); print(1); for (int i = 7; i <= n; i += 2) { pri...
ALGO
0.999428
3.896728
48a675ae-4cf0-468d-9ccf-d19bd763a0ee
UET-2425HK2-INT2210-01/23021441-CTDL-GT
23021441_Lect7_Assignments_Recursion/B3.cpp
#include <iostream> using namespace std; // Hàm đệ quy tính số Fibonacci thứ n int fibonacci(int n) { if (n == 0) return 0; // F(0) = 0 if (n == 1) return 1; // F(1) = 1 return fibonacci(n - 1) + fibonacci(n - 2); // Đệ quy } int main() { int n ; cin >> n; cout << fibonacc...
ALGO
0.999833
5.502302
09b41739-9ed7-4052-ab75-418c44220b51
adityarawat1337x/DSA
1732-find-the-highest-altitude/1732-find-the-highest-altitude.cpp
class Solution { public: int largestAltitude(vector<int>& gain) { vector<int> pre; pre.push_back(0); int maxi=0; for(int i=0;i<gain.size();i++){ pre.push_back(pre.back()+gain[i]); maxi=max(maxi,pre.back()); } return maxi; } };
ALGO
0.99987
5.893495
76f6b77a-7410-4a7b-b51f-7ea3c01573d0
ThangCRND/IT002_-object-oriented-programming
20521893-DoQuangThang.LAB06/DaGiac_B.234/Ngugiac.cpp
#include "Ngugiac.h" NguGiac::NguGiac() : DaGiac(5){} void NguGiac::Nhap() { delete DIEM; this->DIEM = new Diem[n]; int x, y; cout << "Nhap cac diem cua ngu giac:"; for (int i = 0; i < 5; i++) { cout << "Nhap diem " << i + 1 << "(x, y): "; cin >> x >> y; Set(i, x, y...
TOOL
0.931671
3.692922
1d618cdf-b927-4bbc-93e5-8c9e99c14c7b
FernandoBerganza/Practica-en-clase---Fernando-Berganza
Suma Fernando Berganza.cpp
#include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { int x=4; // declaramos e inicializamos una variable entera int y=1; int suma= x+y; // realizamos la operacion //imorimimos en pant...
TOOL
0.980132
3.658232
faf690c7-aa9d-4fb0-81c1-8b18ebcc6310
mdonald412/Smoothed-Particle-Hydrodynamics
Engine/src/WCSPH_Solver.cpp
#include "WCSPH_Solver.h" #include "SPH_Stats.h" #define PI 3.1415926f Vec3* WCSPH_Solver::pBuffer; void WCSPH_Solver::initalize(int count) { SPH_Strategy::initialize(count); WCSPH_Solver::pBuffer = new Vec3[NUM_SPHERES]; } void WCSPH_Solver::Destroy() { delete[] pBuffer; } void WCSPH_Solver::solveParticles(std:...
ALGO
0.999601
3.404879
845cbc78-65bb-417a-b7cf-4d90ae37838f
rdstihz/Learning-and-Coding
src/cf/gym/103069/d/d.cpp
/* Created by rdstihz at 2021-11-04 21:01:12 */ #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 5010; const int INF = 0x3f3f3f3f; const double eps = 1e-13; int dis[maxn][maxn]; int a[maxn]; // a[i]表示公共部分长度为i时,最短的个人路径长度 vector<int> G[maxn]; int n, m, k; int s1, t1, s2, t2; int...
ALGO
0.999876
4.006115
ccc840fc-b8de-4431-875c-5c04a1d1ea4c
M-Awwab-Khan/Algorithmic-Amusement
Lab8/mergeList.cpp
#include <iostream> using namespace std; struct Node { int data; Node* next; Node(int data) { this->data = data; this->next = nullptr; } }; Node* mergeList(Node* l1, Node* l2) { if (!l1) return l2; if (!l2) return l1; if (l1->data < l2->data) { l1->next = mergeLis...
ALGO
0.999915
5.70495
d68e704d-5c33-4c3d-b18f-97ac79795a7a
codeclubjusl/Pass_the_baton_2022
Pass_the_baton_final_2022/Anubhab Das/Qs1.cpp
#include <iostream> using namespace std; #define ll long long int main() { // Anubhab // int h; // ll n; // cin >> h >> n; // ll sub_size = 1; // for (int i = 0; i < h + 1; ++i) sub_size *= 2; // sub_size -= 1; // bool even = true; // ll cur = 1, lo = 1, hi = sub_size / 2 + 1, ans = 0; /...
ALGO
0.999694
3.254787
5efe1bdf-3891-42cb-b486-d6310a1f5595
daviolimen/Exercises
Competitive_Programming/Graphs/bellman_ford.cpp
#include <bits/stdc++.h> using namespace std; typedef tuple<int, int, int> ti; #define MAXN 1000 #define MAXM 10000 #define INF 0x3f3f3f3f int n, m, dist[MAXN]; vector<ti> edges(MAXM); void bellmanFord(int start) { fill(dist, dist + MAXN, INF); dist[start] = 0; for (int i = 0; i < (n - 1); i++) { ...
ALGO
0.999956
4.596364
a0339760-f9d4-49fd-92ca-922c7472ac5e
Lucssiano/Ejercicios-Estructura-de-Decision
ejercicio2.cpp
// 2- Dado un número que se ingresa por teclado, informar si es par o impar #include <iostream> using namespace std; int main() { int num1; cout << "Ingrese un numero "; cin >> num1; if (num1 % 2 == 0) cout << "El numero " << num1 << " es " << "par"; else cout << "El numero " << num1 << "...
ALGO
0.992309
3.440346
d2c07a78-dce7-482b-b3ff-f5edcad522f0
Shivam7Sharma/Data-structures-and-algorithm
0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp
class Solution { public: string reverseWords(string s) { size_t start = s.find_first_not_of(' '); size_t end = s.find_last_not_of(' '); string ans; if(start==std::string::npos){ return ""; } s= s.substr(start, end-start+1); std::istringstream iss...
ALGO
0.999953
5.927524
08551ecd-baf8-47a9-b914-1ff7287533c0
minjujuu/Study_Algorithm
KU_Algorithm/Assignment/0_Prim/Prim.cpp
#include <iostream> #include <cstdio> #include <vector> using namespace std; class TREE { public: int a, b, w; }; // Priority Queue class PriorityQueue { public: int n; TREE Arr[1000]; PriorityQueue(); TREE Delete(); void Insert(TREE x); int IsEmpty(); inline bool IsNotFirstEdge(int i...
ALGO
0.999997
4.738137
cda7f736-0f2f-47bb-8bef-552e9d39b6c9
ratulMahjabin/Competitive-Programming
codeforces/208A/208A.cpp
#include <bits/stdc++.h> using namespace std; int main() { string o; int flag = 0, p=0; string n; cin>>o; for(int i=0; i< o.size(); ) { if(o[i]=='W' && o[i+1]=='U' && o[i+2]=='B') { if(flag==0 && p!=0) { n+=' '; //first e logical char...
ALGO
0.99983
3.377064
1c62a73a-6f4f-4f7c-8262-0aefcb2a59c7
MiguelABatista/icpc-training
codeforces/2125/c.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p64; typedef vector<ll> v64; #define forn(i, s, e) for(ll i = (s); i < (e); i++) #define ln "\n" #if defined(DEBUG) #define _ (void)0 #define debug(x) cout << __LINE__ << ": " << #x << " = " << x << ln #else #define...
ALGO
0.999638
4.215016
2decf29d-e7ea-4e1e-a19a-c13ffc4d8482
DevHawon/CS310-Assignments
doubleLinearSearch.cpp
// 2023-09-14 by Hawon Oh // this program finds the first two indices where their values are equal to a search value. // if not found, print -1. #include <iostream> #include <vector> using namespace std; vector<int> linear_search(vector<int>, int); int main() { vector<int> array {10, 50, 16, 1, 9, 15, 16, 20, 1...
ALGO
0.999861
5.411198
432e40ce-f136-4e0e-80d4-7e1daf5c8754
KD1-80118/cpp
CppAssign4_2.cpp
/* Q2. Stack is a Last-In-First-Out data structure. Write a Stack class. It implements stack using Dynamically allocated array. Stack size should be passed in parameterized constructor. If size is not given, allocate stack of size 5. Provide member functions like push(), pop(), peek(), isEmpty(), isFull(), and print()...
ALGO
0.985265
4.784331
8fca855c-8e2e-439a-8a64-63fbc0c01b28
raincross7/code-similarity
codes/train_code/problem380/problem380_342.cpp
#include<iostream> #include<vector> #include<algorithm> #include<functional> #include<string> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0; vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a.at(i); sum += a.at(i); } if (sum > n) { cout << "-1" << endl; return 0; } cout <<...
ALGO
0.99997
3.525311
95586142-10e9-4d04-996e-73c0fef5e70d
zhouzz7/ATCG2Exercises
Part2Geometry/libs/libigl-master/include/igl/grad_intrinsic.cpp
template <typename Derivedl, typename DerivedF, typename Gtype> IGL_INLINE void igl::grad_intrinsic( const Eigen::MatrixBase<Derivedl>&l, const Eigen::MatrixBase<DerivedF>&F, Eigen::SparseMatrix<Gtype> &G) { assert(F.cols() ==3 && "Only triangles supported"); // number of vertices const int n = F.maxCoeff()...
ALGO
0.992468
6.632505
33e94142-900a-48f8-95ac-9a0898c78cb6
SinceTodayL/CodingPractice
cf_round1002/B.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; void solve(){ int n, k; cin >> n >> k; vector<int> a(n); for(int i = 0; i < n;++i){ cin >> a[i]; } if(k == n){ for(int i = 1; i < n; i += 2){ if(a[i] != (i + 1) / 2){ cout << (i + 1) /...
ALGO
0.999945
4.036015
71d608bf-6f39-469e-9eb2-a51f2f7a3f16
raincross7/code-similarity
codes/train_code/problem212/problem212_2.cpp
// <------------- Template -----------------------> // #include<bits/stdc++.h> using namespace std; #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<fixed; cout<<setprecision(2); #define randomINT mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); #define newl cout<<...
ALGO
0.999713
4.229452
bd47a840-a502-4f8f-8f18-295e18d10fd9
rocky6122/NetworkingClass
john_imgrund-networking-codebase/Project 2/WanderSteering.cpp
//Team Member Names: John Imgrund (82-1019344) Parker Staszkiewicz (82-0967451) //EGP-410-01 //Assignment 2: Steering Behaviors //9/17/18 //We certify that this work is //entirely our own.The assessor of this project may reproduce this project //and provide copies to other academic staff, and/or communicate a copy of /...
TOOL
0.953414
5.451712
bf4e1c8c-f120-4bbf-9f3e-2cdd0371e4af
GaganMeshram123/CodeForces-CP
Codeforces/Nextround.cpp
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int advanced_count = 0; int scores[n]; for (int i = 0; i < n; ++i) { cin >> scores[i]; // Check if the participant earns a positive score and meets the advancement criteria if (scores[i]...
ALGO
0.999951
4.322072
35a7d866-2f63-49ae-98fa-06ea76f0c76c
sadialhuda/Compettetive_Programming
Problem_Solving/CodeForce/A_Word.cpp
// ---------------------------------------------------------------------// // Assalamualaikum // // American International University Bangladesh // // Binarybeast004 // // -----------------...
ALGO
0.998812
5.170113
18e40e47-80cc-4f08-b16d-a4a47946fb52
ShreyaDhir/HacktoberFest2020
Sieve_of_Eratosthenes.cpp
// using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize // all entries it as true. A value in prime[i] will // finally be false if i is Not a prime, else true. bool prime[n+1]; m...
ALGO
0.999967
5.15105
4fa26b46-e8fa-4b93-a268-6e0090f4eac8
yashsiwach/Leetcode-CPP
0047-permutations-ii/0047-permutations-ii.cpp
class Solution { public: void helper(vector<bool>& visited, vector<int>& v, vector<vector<int>>& ans, vector<int>& nums) { if(v.size() == nums.size()) { ans.push_back(v); return; } for(int ind = 0; ind < nums.size(); ind++) { ...
ALGO
0.999996
6.213694
624000b2-b1d0-4117-b84b-6929d7f1e02b
manikanta2901/ubuntu
.history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/BlackJack_20210108174542.cpp
#include<bits/stdc++.h> #include<vector> #include<iostream> #include<cmath> #include<algorithm> #include<iterator> #include<string> #include<map> #define vv vector #define F first #define S second #define MP make_pair #define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define printM...
ALGO
0.999977
3.46103
4ed9d640-e093-4a35-8e7c-73f12d5cf5f8
SachinSarin/Competative-Programming
Problem_Set_Code_Forces/Problem_30_Beautiful_Year.cpp
/* It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits. Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has...
ALGO
0.998979
5.502725
a857441c-df81-4ee9-855c-bdd62b75ffef
virpariyamalay/DSA
array/rotate_array.cpp
class Solution { public: void rotateRight(vector<int>& nums, int k) { int n = nums.size(); k = k % n; // Normalize k reverse(nums.begin(), nums.end());// Reverse the entire array reverse(nums.begin(), nums.begin() + k);// Reverse the first k elements of reversed array revers...
ALGO
0.999983
6.460339
b9bb3e6d-5597-49ff-905d-d5ce6660aa8d
Guo-lab/LeetCode
2023_With_Carl/array/34.在排序数组中查找元素的第一个和最后一个位置.cpp
/* * @lc app=leetcode.cn id=34 lang=cpp * * [34] 在排序数组中查找元素的第一个和最后一个位置 * * https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array/description/ * * algorithms * Medium (42.35%) * Likes: 2239 * Dislikes: 0 * Total Accepted: 762.1K * Total Submissions: 1.8M * Testcase Examp...
ALGO
0.999946
6.589168
f988634b-a14c-4858-bfa4-1eef96ce15ce
vidit-jain/fightFight-notebook
Linear Algebra/Gauss Determinant.cpp
const double EPS = 1E-9; int n; vector < vector<double> > a (n, vector<double> (n)); double det = 1; for (int i=0; i<n; ++i) { int k = i; for (int j=i+1; j<n; ++j) if (abs (a[j][i]) > abs (a[k][i])) k = j; if (abs (a[k][i]) < EPS) { det = 0; break; } swap (a[i], ...
ALGO
0.999979
3.248049
0ad9adfc-5466-4c38-aff1-ca74a6e7a97e
Sameer-Pattnaik/leetcode
3451-string-compression-iii/3451-string-compression-iii.cpp
class Solution { public: string compressedString(string word) { int count=1; string ans=""; for(int i=0;i<word.length();i++) { if(word[i]!=word[i+1]) { ans+=to_string(count); ans+=word[i]; count=1; } ...
ALGO
0.999998
6.187133
736f4830-d3ab-4ce0-9eda-da04c8d9e8c5
ShahriarParib/Data-structure
Single linked list/sll.cpp
#include<bits/stdc++.h> using namespace std; class Node { public: int data; Node*next; Node(int val) { data=val; next=NULL; } }; void insertathead(Node*&head,int val) { Node *n=new Node (val); if(head==NULL) { head=n; return; } n->next=head; ...
ALGO
0.999446
3.50107
4eacaa10-27de-4951-8823-82ed8e46cf33
tiagodsp/godot
thirdparty/squish/rangefit.cpp
#include "rangefit.h" #include "colourset.h" #include "colourblock.h" #include <cfloat> namespace squish { RangeFit::RangeFit( ColourSet const* colours, int flags, float* metric ) : ColourFit( colours, flags ) { // initialise the metric (old perceptual = 0.2126f, 0.7152f, 0.0722f) if( metric ) m_met...
ALGO
0.925354
7.050502
e42626ba-878d-4cdf-9126-9b7144ce0da7
FusionSP/android_frameworks_av
media/libstagefright/webm/EbmlUtil.cpp
#include <stdint.h> namespace { // Table for Seal's algorithm for Number of Trailing Zeros. Hacker's Delight // online, Figure 5-18 (http://www.hackersdelight.org/revisions.pdf) // The entries whose value is -1 are never referenced. int NTZ_TABLE[] = { 32, 0, 1, 12, 2, 6, -1, 13, 3, -1, 7, -1, -1, -1, -1, ...
ALGO
0.975598
6.936719
afdad809-121c-459f-9462-d4750fa917e3
weroshka/Basics-of-programming
lab_1/laba_20_01.cpp
#include <iostream> #include <functions.hpp> #include <chrono> int main() { int n; int mas[20000]; standart::Input(n, mas); class Timer { private: using clock_t = std::chrono::high_resolution_clock; using second_t = std::chrono::duration<double, std::ratio<1> >; std::chrono::time_point<clock_t> m_beg; ...
ALGO
0.999944
4.819993
cdaea0c1-77a2-4404-8955-a99f1d1a0cb0
AlleyNawaz/366DaysofLeetcode
0177_P1038_Binary_Search_Tree_to_Greater_Sum_Tree.cpp
/* Day: 177 Problem Number: 1038 (https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree) Date: 25-06-2024 Description: Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than t...
ALGO
0.999991
6.599918
eb8381ad-82b5-44d0-99d5-12c7566f92f8
samarthcode1/LeetCode1
25-reverse-nodes-in-k-group/reverse-nodes-in-k-group.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: void reverse(ListNode...
ALGO
0.999997
5.850083
11cd63b8-689a-4563-a49a-3831512c689a
Mohamed-Hossam/Problem-Solving
codeforces/277-A/277-A-10603533.cpp
#include<algorithm> #include<stdlib.h> #include<iterator> #include<iostream> #include<numeric> #include<sstream> #include<cstring> #include<ctype.h> #include<iomanip> #include<stdio.h> #include<fstream> #include<vector> #include<bitset> #include<string> #include<math.h> #include<queue> #include<stack> #include<cmath> #...
ALGO
0.999723
3.685468
d2309f6f-cd8e-4302-ae0f-da2924555d8c
jhreyes483/BK_C-
Guias/Guia_de_Aprendizaje 4/2)Bigger_number/2)Bigger_number.cpp
#include <iostream> using namespace std; //declare variables int num1,num2,x; main(){ //reqest data cout<<"ingrese primer numero "; cin>>num1; cout<<"ingrese segundo numero "; cin>>num2; //conditional if(num1>num2){ cout<<"El numero mayor es "<<num1; }else{ cout<<"El nuemro mayor es "<<num2; } return 0; }
ALGO
0.999511
3.121894
1af78f6f-3394-45d1-8ea2-b5fc3f04d6bb
imulan/procon
codeforces/797A.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
ALGO
0.999897
3.572865
ea918ac2-5917-4157-b277-480c61093267
chandrasainadhreddy/CSA5142-CRYPTOGRAPHY
19.cpp
#include <stdio.h> #include <stdint.h> void initialPermutation(uint64_t *data) { } void finalPermutation(uint64_t *data) { } void generateSubkeys(uint64_t *key, uint64_t subkeys[16]) { } void feistelNetwork(uint32_t *left, uint32_t *right, uint64_t subkey) { } void desEncrypt(uint64_t plaintext, uint64_t key, uint64_t...
ALGO
0.99686
4.009053
91f5a064-ecff-45e4-9ab6-b7f12f5abd72
sheeluofficial/practice
OthersCode/LeetCode-Solutions-master/LeetCode-Solutions-master/C++/koko-eating-bananas.cpp
// Time: O(nlogr) // Space: O(1) class Solution { public: int minEatingSpeed(vector<int>& piles, int H) { int left = 1, right = *max_element(piles.cbegin(), piles.cend()); while (left <= right) { const auto mid = left + (right - left) / 2; if (possible(piles, H, mid)) { ...
ALGO
0.999975
6.215873
273bc48a-d18e-49a3-b55d-3eb7b07c52d5
rahul17081998/Data-Structure
code_cpp/self pased DSA/CPL/oracle/Profit_maximization.cpp
#include <bits/stdc++.h> using namespace std; int travelVillage(vector<int> profit) { vector<int> dp = profit; int n = profit.size(); for(int i=1; i<n; i++){ for(int j=0; j<i; j++){ if(profit[i]%profit[j]==0){ dp[i] = max(dp[i], dp[j]+profit[i]); } } } int ans= INT_MIN; for(int i=0; i<n; i++){ ...
ALGO
0.999929
4.229261
c4a39339-7dca-4f2f-a280-5694d7b08763
raihanislam-71/Phitron
Data Structure/Module_12(Mid term exam)/Palindrome.cpp
#include <bits/stdc++.h> using namespace std; class Node { public: int val; Node *next; Node *prev; Node(int val) { this->val = val; this->next = NULL; this->prev = NULL; } }; void insert(Node *&head,Node *&tail,int val) { Node *newNode = new Node(val); if(tail ==...
ALGO
0.999693
4.054378
8eff937f-20f6-469d-bd26-26f92dfd37fa
yad/easy-mangos
dep/src/g3dlite/MeshAlgAdjacency.cpp
#include "G3D/Table.h" #include "G3D/MeshAlg.h" #include "G3D/Set.h" #include "G3D/Stopwatch.h" #include "G3D/SmallArray.h" namespace G3D { /** Two-level table mapping index 0 -> index 1 -> list of face indices */ class MeshEdgeTable { public: /** We expect 2 faces per edge. */ typedef SmallArray<int, 2> Fa...
ALGO
0.999034
7.755578
5978555d-503f-4411-85c4-e5e72ed96acc
lealzhan/box2d_wasm
src/dynamics/b2_circle_contact.cpp
#include "b2_circle_contact.h" #include "box2d/b2_block_allocator.h" #include "box2d/b2_body.h" #include "box2d/b2_fixture.h" #include "box2d/b2_time_of_impact.h" #include "box2d/b2_world_callbacks.h" #include <new> b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllo...
ALGO
0.948812
6.820428
6ef2c6c0-b64b-4303-96c3-b10888d23192
zedarbit/BITCS-final-exam-learning-materials-1
计算理论与算法/考试/2.cpp
#include <stdio.h> #include <stdlib.h> #include <algorithm> #include <map> using namespace std; struct Node { int deadline; int penalty; }; struct Node ary[10005] = {0}; int n; bool deal(Node x, Node y) { if (x.penalty == y.penalty) return x.deadline > y.deadline; return x.penalty > y.penalty; } int main()...
ALGO
0.999987
3.62934
21fae7e1-3a26-4fea-93b4-896f8caa33b2
dezhonger/LeetCode
Leetcode1958.cpp
int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; class Solution { public: bool check(int x, int y) { return x >= 0 && x < 8 && y >= 0 && y < 8; } bool checkMove(vector<vector<char>>& board, int rMove, int cMove, char color) { int s = 'W' + 'B'; for (in...
ALGO
0.999497
5.614345
bb591d6e-c5ce-4a51-b29d-efe7ee6ecb71
uunws/my-algorithm-design-course
a61_q2_farthest.cpp
#include <iostream> #include <vector> #include <climits> using namespace std; int n; vector<vector<int>> matrix; vector<int> dist; int main() { cin >> n; matrix.assign(n+1, vector<int> (n+1, 0)); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> matrix[i][j]; ...
ALGO
0.999936
4.194663
87d79d57-a54a-4c5a-8343-e0cf8d228325
21omkarsase/DSA
STL/Containers/VGXGPUAMKX.cpp
#include <bits/stdc++.h> using namespace std; /* * Complete the 'getTime' function below. * * The function is expected to return a LONG_INTEGER. * The function accepts STRING s as parameter. */ long getTime(string s) { long ans = 0; char curr = 'A'; long n = s.size(); for (int idx...
ALGO
0.999555
4.729468
d689a3c9-4a19-404e-bd56-4e4dfac9867a
ShellTux/DataStructures-Algorithms
src/binTree.cpp
#include <algorithm> #include <array> #include <chrono> #include <cstddef> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <ostream> #include <string> #include <utility> #include "Tree/AVLTree.hpp" #include "Tree/BinaryNode.hpp" #include "Tree/B...
TOOL
0.943523
6.865442
6c2f7d26-c87c-4413-8a91-5724b3a19de8
adarshsoni-7/Practise-DSA-Solutions
GuessGame.cpp
// ------------------------------ // Before jumping into the code, please try it yourself first // ----------------------------- #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { srand(time(0)); // Seed the random number generator using current time int yourNum, ran...
ALGO
0.953083
5.258454
c81f3232-e158-4d4c-8553-a30039330907
emelyantsev/yandex_algorithm_training
algorithm-training_2021/02_problem_D/Source.cpp
#include <iostream> #include <vector> int main() { std::vector<int> nums; int num; while (std::cin >> num) { nums.push_back(num); } int count = 0; for (int i = 1; i < static_cast<int>(nums.size()) - 1; ++i) { if (nums[i] > nums[i - 1] && nums[i] > nums[i + 1]) { ++count; } } std::cout << coun...
ALGO
0.999842
4.756474
4d6098de-0f81-4c26-a02a-14277679df2f
zggf-zggf/Kompendium
rozne/dodawanie/main.cpp
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); string a, b; cin>>a>>b; string wyn = ""; int carry = 0; for(int i = 0; i < max(a.size(), b.size()); i++){ wyn.push_back('0'+((carry+((i<a.size())?a[a.size()-i-1]-'0':0)+((i<b.size())?b[...
ALGO
0.999947
4.329962
f1041dea-69ce-41c7-944e-cef79e2d797e
OlafurAO/C-plus-plus-stuff-from-2016
T-111-PROG/Forritun Æfing fyrir Lokapróf/Lab/Lab1a.cpp
#include <iostream> using namespace std; int main() { int N; int b; cout << "Input N: " << endl; cin >> N; while(N > 0) { if (N%2 == 0) { cout << N << " is even" << endl; } else if (N%2 > 0) { cout << N << " is odd" << endl; ...
ALGO
0.99964
4.111038
969e95d4-c47c-4aeb-9add-7ab0db4783ad
Hemanta1611/C_-_DSA_USING_C--
C++ CONCEPT/15_function.cpp
#include <iostream> // Includes the input-output stream library using namespace std; // Use the standard namespace // Function prototypes int sum(int, int); // Declares the 'sum' function that takes two integers as parameters and returns an integer void g(); // Declares the 'g' function that takes no par...
TOOL
0.953344
4.390007
f315b237-11b7-4222-80c9-458063a4ebbc
PedroMarques1205/ProjetoMatricula
Front/projeto_matricula_application/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.998606
6.76775
0999e3c3-35af-40a4-b4cc-f6e0be5c95c7
113bommy/LogicalErrorFixCodeT5
logicalErrorFix_CodeT5_no_LineNumber/model/cpp/cpp_source/source_6.cpp
#include <bits/stdc++.h> using namespace std; const int Nmax = 2e5 + 5; const int Bsize = 1 << 17; double val, fail[Nmax], sum[Nmax]; int t[Nmax], x, y, i, n, q; vector<int> v[Nmax]; char buffer[Bsize + 2]; int cursor = 0; void read(int &x) { x = 0; while (!isdigit(buffer[cursor])) { ++cursor; if (cursor == Bsize) frea...
ALGO
0.999471
3.915755
c79eb447-ca31-441b-b5d5-75be4f04f7b8
jatin196/CP
CF_514_A.cpp
#include <bits/stdc++.h> using namespace std; int main() { string x, ans = ""; cin >> x; for (int i = 0; i < x.length(); i++) { if (i == 0 && x[0] == '9') { ans += x[i]; continue; } if (((int)x[i] - '0' > 4)) { ans += (9 - ...
ALGO
0.999776
4.773874
b4a51bd4-71d2-4c77-ac21-e1aa93a18a7b
ldx027/competition
luogu/p1002_过河卒.cpp
#include <iostream> #include <vector> using namespace std; void show(vector<vector<long long>> vec) { for (int i = 0; i < vec.size(); i++) { for (int j = 0; j < vec[i].size(); j++) { printf("%10ld", vec[i][j]); } cout << endl; } cout << endl; } int main() { ...
ALGO
0.999976
4.185242
df82d1d0-217a-4472-8892-ad35aeffaea2
adityanjr/code-DS-ALGO
Data Structures/Arrays/Array-G2-Majority Element.cpp
#include<iostream> #include<algorithm> #include<unordered_map> using namespace std; // Brute Force : O(n square) , O(1) // BST : Add nodes to BST , increment their frequencies // Moore's Voting algorithm int findMajorityElement(int *a,int n){ int maj_index = 0; int count = 1; for(int i=1;i<n;i++){ if(a[i]==a[...
ALGO
0.999826
4.763205
d0f9d2dc-ae2b-45de-8d9f-a9ae6b1401d9
devakar/codes
coding/bellford.cpp
#include <iostream> #include <vector> #include <queue> #include <utility> #include <functional> #include <algorithm> #include <climits> using namespace std; bool bellford(int s, vector<pair<int,int> > *adj, bool visited[], int dist[], int parent[],int n,int e) { //priority_queue<pair<int,int>, vector<pair<int,int> >...
ALGO
0.999988
3.881226
088ff17b-7c16-41b8-b101-9866157bc98a
AlexRa/Kirstens-clone
S20/indra/newview/llspatialpartition.cpp
/** * @file llspatialpartition.cpp * @brief LLSpatialGroup class implementation and supporting functions * * $LicenseInfo:firstyear=2003&license=viewergpl$ * * Copyright (c) 2003-2010, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Lind...
ALGO
0.967482
3.150512
395d04bb-137d-4b63-a7c0-f6c93dd03444
marekar/cpp
taboo search/problem.cpp
#include "problem.h" const char *file_name_problem = "problem_data.txt"; const char *file_name_penalty = "penalty_data.txt"; void Problem ::print_problem() { cout << endl << "----Problem " << problem_ID << endl; for (int i = 0; i < problem_size; i++) { cout << requirements[i] << " "; ...
ALGO
0.899624
3.858141
97a5a0e1-a1a6-4b5b-a9e6-cc7aecafc621
atikislam/Codeforces
A_First_ABC.cpp
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define INF 100000000 #define abc "abcdefghijklmnopqrstuvwxyz" #define ABC "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define PI 3.1415926535897932384626433832795 //define sort function #define asort(a) sort(a.begin(),a.end()) #define rsort(a) sort(a...
ALGO
0.999964
3.770654
d0702843-3c88-4634-b167-790e5348ee88
AIWASS23/codeSolution
aux.cpp
#include <iostream> #include <queue> #include <vector> using namespace std; vector<vector<int> > g; vector<int>vi, fa, comp, descTo; void bfs() { queue<int>q; vector<int>dist(vi.size(), 0); q.push(0); fa.push_back(0); descTo.push_back(0); dist[0] = 0; while(!q.empty()) { int v = ...
ALGO
0.999889
4.428986
5654e918-5a43-42ed-90b0-6c696c9d91cb
gireeswar18/Strivers
Striver STL/Vector2.cpp
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v1; v1.push_back(1); v1.emplace_back(2); v1.insert(v1.begin(), 0); vector<int> v2; v2.insert(v2.begin(), v1.begin(), v1.end()); for (int n : v2) cout << n << " "; }
ALGO
0.999147
3.125536
329603e2-22c5-4293-a44d-81c2b33b8641
goldmcoin/GoldMetalCoin
src/crypto/hmac_sha512.cpp
#include "crypto/hmac_sha512.h" #include <string.h> CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen) { unsigned char rkey[128]; if (keylen <= 128) { memcpy(rkey, key, keylen); memset(rkey + keylen, 0, 128 - keylen); } else { CSHA512().Write(key, keylen).Finalize(...
ALGO
0.936752
5.686802
a0e3fe5f-7e02-4fb6-a103-47e17387f0bd
ritiksp/CPP-Code
scalar multiplied matrix.cpp
//element which is maximum in array #include<iostream> #define n 3 using namespace std; int main() { cout<<"Enter elements for matrix"<<endl; int mat1[n][n]; for(int i=0;i<n;i++) { cout<<"enter "<<n<<" elements for "<<i+1<<" row"<<endl; for(int j=0;j<n;j++) { cin>>mat1[i][j]; } } int num; ...
ALGO
0.99821
3.122994
a59b999c-04d4-41dc-af9a-7f6ae58454b5
trailofbits/llvm-wedlock
libcxx/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
// <numeric> // UNSUPPORTED: c++98, c++03, c++11, c++14 // template<class InputIterator, class OutputIterator, class T> // OutputIterator exclusive_scan(InputIterator first, InputIterator last, // OutputIterator result, T init); // #include <numeric> #include <algorithm> #include...
TEST
0.979266
6.72113
53856e23-1cf6-467a-8d0c-fa402b5717da
raymondyfei/libwetcloth
include/igl/qslim.cpp
#include "collapse_edge.h" #include "connect_boundary_to_infinity.h" #include "decimate.h" #include "edge_flaps.h" #include "is_edge_manifold.h" #include "max_faces_stopping_condition.h" #include "per_vertex_point_to_plane_quadrics.h" #include "qslim_optimal_collapse_edge_callbacks.h" #include "quadric_binary_plus_oper...
ALGO
0.996683
6.280062
5184f2e9-f517-4dce-9c44-2a51b83a43b3
trungtoan2801/toan
Earning Biggest Prize Money 2/Earningprice.cpp
#include<iostream> using namespace std; int N, K, leng; int Answer; char data[7]; void lengData(char *p){ while(*p){ leng++; p = p + 1; } } int convertArrayToNumber(char *t){ int result = 0; for(int i = 0; i < leng; i++){ result = result* 10 + t[i] - 48; } return result; } void swap(char &a, char &b){ ...
ALGO
0.999972
4.077803
54d5bc00-8cb7-480b-8666-882e4edb3168
ishandutta2007/codeforces
01191020csl/normal/536/D.cpp
#include<bits/stdc++.h> using namespace std; int head[2005], ver[200001], edge[200001], nxt[200001], sz; void addedge(int u, int v, int w) { ver[++sz] = v, edge[sz] = w, nxt[sz] = head[u], head[u] = sz; ver[++sz] = u, edge[sz] = w, nxt[sz] = head[v], head[v] = sz; } void dijkstra(int n, int x, long long dis[]) { mem...
ALGO
0.999991
3.974383
bccaac62-3c3d-4a28-8363-0a6998ef6403
Scyther2/leetcode
#1025.cpp
class Solution { public: bool divisorGame(int n) { if(n%2==0) { return true; } return false; } };
ALGO
0.999947
5.575491
52f806b5-1c3f-4c78-817b-ce18c1ca4369
NLS-SJTU/CdRv_ORB_SLAM2
Thirdparty/g2o/g2o/stuff/string_tools.cpp
#include "string_tools.h" #include "os_specific.h" #include "macros.h" #include <cctype> #include <string> #include <cstdarg> #include <cstring> #include <algorithm> #include <cstdio> #include <iostream> #include <iterator> #if (defined (UNIX) || defined(CYGWIN)) && !defined(ANDROID) #include <wordexp.h> #endif name...
TOOL
0.872157
6.049948
e910b53a-f1a4-439d-aa63-5a16eb716ecb
jshummel/world-airline-route-search
project.cpp
/*CSCE 3110.501 - Project * Jeff Hummel */ #include "project.h" class Graph { public: unordered_map<string, vector<string>> flightplan; // Constructor to parse the input file and construct the graph Graph(const string& filename) { ifstream file(filename); string line; strin...
ALGO
0.983079
5.517413
072b2c6d-6527-4c91-ab22-0785d05a86c5
kasa021/atcoder-archives
abc254/abc254_c_32357123_RE.cpp
/* * Author: kAsA02 * Submission URL: https://atcoder.jp/contests/abc254/submissions/32357123 * Submitted at: 2022-06-10 13:59:53 * Problem URL: https://atcoder.jp/contests/abc254/tasks/abc254_c * Result: RE * Execution Time: 162 ms */ #include <bits/stdc++.h> #include <cmath> using namespace std; #define rep(...
ALGO
0.999999
3.811563
d59cabcb-ab77-447d-85af-5eb2b365ea1a
TensorCodeGen/tensor-codegen
compiler-rt/lib/scudo/standalone/tools/compute_size_class_config.cpp
#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <vector> struct Alloc { size_t size, count; }; size_t measureWastage(const std::vector<Alloc> &allocs, const std::vector<size_t> &classes, size_t pageSize, size_t ...
ALGO
0.947828
5.864163
a4533b02-23ee-4b4d-8913-49d9b2f87650
Nu3001/frameworks_av
media/libstagefright/codecs/amrnb/common/src/pow2_tbl.cpp
/* Filename: /audio/gsm_amr/c/src/pow2_tbl.c ------------------------------------------------------------------------------ REVISION HISTORY Description: Added #ifdef __cplusplus and removed "extern" from table definition. Description: Put "extern" back. Who: Date: Descrip...
CONFIG
0.89893
5.935047
54f802c4-17ec-449f-b951-5e1639a81440
dev-xero/leetcode
tree/find_elements_in_a_contaminated_binary_tree.cpp
// https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree #include <bits/stdc++.h> #include <queue> using namespace std; /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nu...
ALGO
0.999887
6.374563
941f1949-6ddf-4efe-a5b3-0c415bf24cb7
MuXiongGuo/study_primer
oline_judge/oj39.cpp
#include "cmath" #include "iostream" #include "vector" using namespace std; int main(){ int n; cin >> n; vector<int> ivec(n); for (int i=0;i<n;++i) cin >> ivec[i]; int min_distance = abs(ivec[0] - ivec[1]); for (int i = 0; i < n; ++i) for (int j = i+1; j < n; ++j) m...
ALGO
0.999887
3.885898
20485440-d700-46f2-ad95-f543907fe40c
tempure/algorithm-advance
category/数学/博弈论/acwing_892.cpp
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; //台阶NIM博弈问题 /*此时我们需要将奇数台阶看做一个经典的Nim游戏,如果先手时奇数台阶上的值的异或值为0,则先手必败,反之必胜 证明: 先手时,如果奇数台阶异或非0,根据经典Nim游戏,先手总有一种方式使奇数台阶异或为0,于是先手留了技术台阶异或为0的状态给后手 于是轮到后手: ①当后手移动偶数台阶上的石子时,先手只需将对手移动的石子继续移到下一个台阶,这样奇数台阶的石子相当于没变,于是留给后手的又是奇数台阶异或为0的状态 ②当后手移动奇数台阶上的石子时...
ALGO
0.999997
4.162565