uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
daabad89-401d-43cd-973f-6eb3d2651cf3
mograsan/atcorder_product
AtCoder/20190324/B.cpp
#include <iostream> #include <string> #include <math.h> #include <map> #include <vector> #include <tuple> #include <algorithm> using namespace std; #define lli long long int #define vi vector<int> #define vlli vector<lli> #define pii pair<int, int> #define plli pair <lli, lli> #define F(i,n) for(lli (i)=0;(i)<(n);(i)++...
ALGO
0.999476
3.921247
b0144fae-06f9-496d-8005-0007b8d4cd6b
nishant-sachdeva/ml-llvm-tools-iith
libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
// <algorithm> // template<BidirectionalIterator Iter> // requires ShuffleIterator<Iter> // && LessThanComparable<Iter::value_type> // void // inplace_merge(Iter first, Iter middle, Iter last); #include <algorithm> #include <random> #include <cassert> #include "test_macros.h" #include "test_iterators.h...
TEST
0.995182
6.553727
c30db2e5-13e3-446a-9a34-3668a6e6e5d5
shreyanshthakur/DSA_Course
afterCourse/Leetcode/Repair Max performance of a team MyApproach.cpp
#define mod 1000000007 class Solution { public: long long solve (int n, vector<int>& speed, vector<int>& eff, int k, int miniEff, int prevSpeed, int index) { //base case if (k <= 0 || index == n) return (prevSpeed%mod * miniEff%mod)%mod; long long inc...
ALGO
0.999961
5.322184
0a12066c-3bde-4c04-b3ff-22959ce33d39
rehmanis/UBC-Courses
CS221/lab7/lab7driver.cpp
#include "hashtable.h" #include <cstdlib> #include <ctime> #include <iostream> #define TABLESIZE 1000 #define NUMOF using namespace std; void usage(char* argv[]) { cerr << "Usage: " << argv[0] << " scheme numberOfKeys sizeOfTable" << endl; exit(-1); } int main(int argc, char *argv[]) { int n, m; srand(time(0));...
ALGO
0.886736
4.293018
cfcc5187-1068-48ae-ac32-e602c74bad91
DylanCampo5/1st_degree
1st_semester/IB/Jutge/P61634-Leap years.cpp
/** * Universidad de La Laguna * Escuela Superior de Ingeniería y Tecnología * Grado en Ingeniería Informática * Informatica Básica 2023-2024 * * @file P61634 Leap years * @author Dylan Gonzalo Campo Bedoya <EMAIL> * @date Nov 2 2023 * @brief Escribe un programa que indique si un año es o no bisiesto. * ...
ALGO
0.999812
5.841208
6b4dbded-9e92-488f-b1c9-e5b8bb0c7b22
Inlucker/AnalysisOfAlgorithms
AA_Lab2/report/inc/src/algorithms.cpp
int standartMult(mtrx &rez, mtrx mtrx1, int n1, int m1, mtrx mtrx2, int n2, int m2) { if (m1 != n2) return SIZE_ERROR; for (int i = 0; i < n1; i++) for (int j = 0; j < m2; j++) { rez[i][j] = 0; for (int k = 0; k < n2; k++) rez[i][j] = rez[i][j] + mtrx1...
ALGO
0.999903
3.560897
105cddd3-31f2-4f95-bd14-672b0ffb085e
sarvex/leetcode-haxe
solution/2400-2499/2441.Largest Positive Integer That Exists With Its Negative/Solution.cpp
class Solution { public: int findMaxK(vector<int>& nums) { unordered_set<int> s(nums.begin(), nums.end()); int ans = -1; for (int& v : nums) { if (s.count(-v)) { ans = max(ans, v); } } return ans; } };
ALGO
0.999976
5.468189
11f4d64b-002f-4c9e-bff0-99bd7c42c149
SA33ED/shared_preferences_app
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
3e2866b0-402a-46e2-8c96-ba9255fe0c6c
mwang98/leetcode-practice
0995-minimum-number-of-k-consecutive-bit-flips/0995-minimum-number-of-k-consecutive-bit-flips.cpp
class Solution { public: int minKBitFlips(vector<int>& nums, int k) { /* Greedy + Line sweep Greedy: always flip 0 to 1 when traversing nums from left to right Line sweep: perform O(1) updates the interval + use prefix sum to get the actual upate TC: O(n) SC: O(n) */...
ALGO
0.999992
6.114408
89e30faa-f98e-469f-aa20-8bd1136b084a
aakrati14/-CrackYourInternship
0073-set-matrix-zeroes/0073-set-matrix-zeroes.cpp
// 2nd meathod, better than brute force // algo: we will create a row and col array and update its element as we get any 0s in our matrix class Solution { public: void setZeroes(vector<vector<int>>& matrix) { int n = matrix.size(); int m = matrix[0].size(); vector<int> row(n,1); vec...
ALGO
0.999668
6.829099
2c731d46-29e8-4289-8cc9-7dec168c7616
RatnangshuD/VisualServo
src/visp_ros/src/robot/sim-robot/franka/model/FrictionTorque.cpp
/* * FrictionTorque.cpp * * Created on: 24 feb 2019 * Authors: Oliva Alexander, Gaz Claudio, Cognetti Marco * * C. Gaz, M. Cognetti, A. Oliva, P. Robuffo Giordano, A. De Luca, 'Dynamic * Identification of the Franka Emika Panda Robot With Retrieval of Feasible * Parameters Using Penalty-Based Optimizati...
ALGO
0.995788
5.652449
81749fa6-0823-4d36-ad2e-b2fe5dd16ea4
julkar-naim/toph-solutions
DecentArrays.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int arr[n], cp[n]; for(int i = 0; i < n; i++){ cin >> arr[i]; cp[i] = arr[i]; } sort(arr, arr+sizeof(arr)/sizeof(arr[0])); int flag = 0; for(int i = 0; i < n; i++){ if(arr[i] != cp[i]){ ...
ALGO
0.999995
3.934536
05c873de-c129-4a32-b35c-7cfa5959daf4
sakshee15/LeetCode_Solutions
0890-lemonade-change/0890-lemonade-change.cpp
class Solution { public: bool lemonadeChange(vector<int>& bills) { int countFive = 0; int countTen = 0; for (const int bill : bills) { if (bill == 5) { countFive++; } else if (bill == 10) { if (countFive <= 0) { ret...
ALGO
0.998745
6.284553
3dd9f583-871a-44d1-bf0d-a2a91d9e0cda
alex-kity/optimization-Registration
3rdpart/gtsam/gtsam/3rdparty/GeographicLib/examples/example-AzimuthalEquidistant.cpp
// Example of using the GeographicLib::AzimuthalEquidistant class #include <iostream> #include <exception> #include <GeographicLib/Geodesic.hpp> #include <GeographicLib/AzimuthalEquidistant.hpp> using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants...
ALGO
0.953905
6.67749
1684b4fc-4f88-4edc-a00e-6e013c9ec865
Saurav-kumar077/DSA-Leetcode
14-longest-common-prefix/longest-common-prefix.cpp
#include<string> class Solution { public: string longestCommonPrefix(vector<string>& strs) { if(strs.empty()){ return ""; } //sorti the string sort(strs.begin(),strs.end()); string first = strs[0]; string last = strs.back(); int i =0; whi...
ALGO
0.999864
5.303156
20824010-4186-4ea4-880b-37aab40ae105
Anujdominoblack/DSA-using-c-
tree/levelordertraversalbfs.cpp
#include<iostream> #include<queue> using namespace std; // we will use deque data structure // the idea is we will enque a level into a queue pop it out print it // and we will push children of it into queue struct node{ int key; node *left,*right; node(int k) { key =k; left = right = ...
ALGO
0.999945
4.606296
9f401416-1e91-4ce2-bc6f-daa6aa9e7d2a
XRPLF/rippled
src/xrpld/app/misc/NegativeUNLVote.cpp
//------------------------------------------------------------------------------ //============================================================================== #include <xrpld/app/consensus/RCLValidations.h> #include <xrpld/app/ledger/Ledger.h> #include <xrpld/app/misc/NegativeUNLVote.h> #include <xrpld/shamap/SHAM...
ALGO
0.964957
6.64457
98719d8c-f308-4736-8621-a5a4970843c6
lzyrapx/Codeforces
44A(简单题).cpp
#include<bits/stdc++.h> using namespace std; set<pair<string,string> > leaf; int main() { int n; string s,t; cin>>n; for(int i=1;i<=n;i++){ cin>>s>>t; leaf.insert(make_pair(s,t)); } cout<<(int)leaf.size()<<endl; return 0; }
ALGO
0.995579
3.625374
df42f1ba-a0ba-465f-9910-111fe4944c2e
javagovindsharma/leetscode
solution/1000-1099/1085.Sum of Digits in the Minimum Number/Solution.cpp
class Solution { public: int sumOfDigits(vector<int>& nums) { int x = *min_element(nums.begin(), nums.end()); int s = 0; for (; x > 0; x /= 10) { s += x % 10; } return s & 1 ^ 1; } };
ALGO
0.99997
6.000615
e6d48cb6-f393-4ea7-b6e8-1ffa475997af
ishandutta2007/codeforces
izban/normal/178/F1.cpp
#include <iostream> #include <string> #include <map> #include <math.h> #include <vector> #include <algorithm> #include <cstdio> #include <set> #include <queue> #include <sstream> using namespace std; #define sqr(x) ((x)*(x)) #define PB(a) push_back(a) #define MP(a) make_pair(a) #define ll long long int gcd(int a, i...
ALGO
0.999964
3.884508
7818b9e6-67d0-4582-892a-44eab09b3635
arin2002/Hacktoberfest-2022
C++/LeetCode/1402.reducing-dishes.cpp
class Solution { public: int maxSatisfaction(vector<int>& arr) { int n = arr.size(); sort(arr.begin(), arr.end()); int ans = 0; for(int i = 0; i < n; i++) { int cur = 0; // considering the suffix from pos i // [arr[i], arr[i+1], ... arr[n-1]] ...
ALGO
0.999932
5.34799
a5446a0c-fe14-46ee-ba8c-e1a61cc996bd
zianed/leetcode
cpp/276. 栅栏涂色.cpp
class Solution { public: int numWays(int n, int k) { if (n * k == 0) { return 0; } if (n == 1) { return k; } int diff = k * (k -1); int same = k; for (int i = 2; i < n; i++) { int temp = diff; // 如果前两个栅栏的颜色相同,当前栅...
ALGO
0.999973
5.87981
69dda980-dca3-445d-a3e8-02d313270d88
tyu123/repotest
petle.cpp
/* * */ #include <iostream> using namespace std; int main(int argc, char **argv) { int i; for (i = 0; i < 101; i++) { if (i % 10 == 0) { cout << i << endl; ; } } return 0; }
ALGO
0.990221
3.34019
693fd065-a7d6-47b9-8791-7841019aca1f
mmycly/serverTwo
serverTwo/SceneServer/SSBattleMgr/SSAI_Wild.cpp
#include "SSAI_Wild.h" #include "SSNPC.h" #include "SSBattle.h" #include "SSMoveTool.h" namespace SceneServer{ CSSAI_Wild::CSSAI_Wild(CSSGameUnit* pGU):CSSAI(pGU), m_ifAIRunning(TRUE) , m_eGuardState(eGuardState_Sleep) { if (m_pcMasterGU){ m_pcWildGU = m_pcMasterGU->TryCastToNPC(); } m_bIfFliter = FALSE; } CSS...
ALGO
0.914583
3.999625
7e344fea-b13d-4305-ab76-ab36ddfabe98
bradygin/scripting_language
src/lib/parser.cpp
#include "parser.h" #include <iostream> #include <sstream> #include <cmath> std::unordered_map<std::string, double> Node::variableMap; Node::~Node() { for (Node* child : children) { delete child; } } Parser::Parser(const std::vector<Token>& tokens) : tokens(tokens), currentTokenIndex(0) {} Parser::~...
ALGO
0.923213
5.704054
ecd2d0ac-b621-4587-b5af-509602544705
PANCHO7532/alienswarm-sdk
src/game/server/physics_fx.cpp
// memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" static int BestAxisMatchingNormal( matrix3x4_t &matrix, const Vector &normal ) { float bestDot = -1; int best = 0; for ( int i = 0; i < 3; i++ ) { Vector tmp; MatrixGetColumn( matrix, i, tmp ); float dot = fabs(DotProduct...
ALGO
0.907286
6.810813
37d9e40c-f28d-46cb-a651-77c960c1e30a
melias198/XPSC
Week 10/Day 2/CQXYM Count Permutations.cpp
/* ||-----------------------------------|| || Mohammad Elias || ||-----------------------------------|| */ #include <bits/stdc++.h> #define ll long long int #define pub push_back #define pob pop_back #define PI 3.14159265359 #define fast ios::sync_with_stdio(false); cin.tie(NULL); #define yes cout<<"...
ALGO
0.999889
4.652365
d38a2503-889f-4a31-ba2d-fe120ef08a9a
BaoTrung37/PTIT_Sources
CTDL-thayson/contest11/bai20-BST-2.cpp
/* Duyệt theo inoder L N R mà trong BST L < N < R kiểm tra mảng a có tăng dần ko ? */ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define ii pair<int, int> #define X first #define Y second #define all(x) (x).begin(), (x).end() #define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>...
ALGO
0.999908
4.390121
83cff178-8b6f-4e1e-b49d-fece0e9a18f0
filippobistaffa/PK
pk.cpp
#include "pk.h" static char line[MAXLINE]; typedef struct { value *sm; // surplus matrix const value *x; // payoff vector const agent *csbuf; // solution coalition structure const agent *rev; // rev[i] = j => i is in the j-th coalition in csbuf size_t *cc; // cc[i] = number of coalitions containing i const m...
ALGO
0.999932
4.268149
cb21d169-1da1-4867-be60-147ab89f9fdc
Noodle3D/ZCookie
algorithm/HDU/HDU3400 Line belt.cpp
#include <stdio.h> #include <math.h> #include <stdlib.h> #define ESP 1E-5 struct POINT{ double x, y; }A, B, C, D; int P, Q, R; POINT Get_Mid(POINT PL, POINT PR) { POINT temp; temp.x = (PL.x + PR.x) / 2.0; temp.y = (PL.y + PR.y) / 2.0; return temp; } double len(POINT p1, POINT p2) { return ...
ALGO
0.999841
3.491388
70e05685-31ed-43f9-90fa-1600b582c136
kuanlun/LeetCode
3/3/3.cpp
#include <iostream> #include<string> #include<unordered_set> #include<algorithm> using namespace std; int lengthOfLongestSubstring(string s) { unordered_set<char> character; int maxLen = 0, left = 0; for (int i = 0;i < s.size();i++) { while (character.find(s[i]) != character.end())//存在字符 while(防止很多重复字符串) { ...
ALGO
0.999629
4.6872
59906a02-ffbb-4831-abba-282216adf6f1
dipesh-m/Data-Structures-and-Algorithms
LeetCode Submissions/Find the Highest Altitude.cpp
class Solution { public: int largestAltitude(vector<int>& gain) { int ans=0, curr=0; for(int i=0; i<gain.size(); i++) { curr+=gain.at(i); ans=max(ans, curr); } return ans; } };
ALGO
0.999802
5.934042
7fe04f10-030a-419c-b3d2-af37b8f99924
minddonyy/AlgorithmStudy
Comet/BOJ/1929/sol.cpp
using namespace std; #include <iostream> #include <algorithm> #include <vector> int main() { int a, b; cin >> a >> b; bool arr[1000001] = { 0 }; arr[0] = 0; arr[1] = 0; for (int i = 2; i <= b; ++i) { arr[i] = 1; } for (int i = 2; i <= b; ++i) { if (!arr[i]) continue; for (int j = i + i; j <= b; j += i) ...
ALGO
0.99986
3.433949
e5a0dfef-ba10-4a8c-82b1-6bc56f1486f2
ishandutta2007/codeforces
74traktor/normal/1475/A.cpp
#include<bits/stdc++.h> using namespace std; #define int long long main() { #ifdef HOME freopen("input.txt", "r", stdin); #endif // HOME ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t, n; cin >> t; while (t--) { int n; cin >> n; while (n % 2 == 0) n /...
ALGO
0.998928
5.46591
126f8609-3510-4f36-8206-ea4acfbfac66
usmansgit/Cpp_projects_codes
09/snake2/gameboard.cpp
/* #################################################################### # COMP.CS.110 Programming 2: Structures, 2022 # # # # Project4: Snake # # Program description: Implements a game ...
TOOL
0.946758
6.943246
aea97c17-3be1-4ed0-9291-96d92676d853
diegonighty/universidad
FUNDAMENTOS DE PROGRAMACION/UNIDAD 3/PRACTICA 8/main.cpp
// PRACTICA 8 UNIDAD 3 - DIEGO CÁRDENAS // 7 de oct de 2024 #include <iostream> using namespace std; int main() { int dia; cout << "Ingrese el número del día de la semana: "; cin >> dia; if (dia == 1) { cout << "Lunes"; } else if (dia == 2) { cout << "Martes"; } else if (dia ==...
ALGO
0.989063
3.879135
0baa05fe-de8c-4ed9-b134-81e50b032e6b
raincross7/code-similarity
codes/train_code/problem071/problem071_161.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; string s, t; cin >> n >> s >> t; int cnt = 0; for (int i = 0; i < n; i++) { string subs = s.substr(i, n - i); //後半を抽出 string subt = t.substr(0, n - i); //前半を抽出 if (subs == subt) //抽出した部分がもし重複したら cnt = max(cnt, n - i); //重複部分がながければ長いほど最小にな...
ALGO
0.999898
3.544575
e495c453-acd8-4ae3-971f-18e9cc06e47b
viniXLeite/data_structure_class
hash_table/test.cpp
#include <iostream> #include <string> #include <fstream> using namespace std; struct Servers_info { unsigned int number_of_servers; unsigned int max_capacity; unsigned int number_of_requests; }; struct Request { string str_to_print; string checksum_str; }; struct Server { unsigned int number...
ALGO
0.994875
4.51765
7e5b9fb5-b417-4818-8475-aa30b8083411
mahimalmuntashir/CodeForces
1500-1599/1557A-EzzatAndTwoSubsequences.cpp
#include <cstdio> int main(){ long t; scanf("%ld", &t); while(t--){ long n; scanf("%ld", &n); long double s(0), mx(-1e11); for(long p = 0; p < n; p++){ long x; scanf("%ld", &x); s += x; mx = (mx > x) ? mx : x; } double res = mx + (s ...
ALGO
0.999045
3.545181
1243983d-96dd-4750-b56f-9bd35b224b10
iwanlothbrok/Students_Exercises
Еxercises/C++/MathExercise/DimanaExr/DimanaExerciseLastWeek/04/04.cpp
#include <iostream> using namespace std; bool ednakviCifri(int num1); int main() { int m, n; cin >> m >> n; while (m != 0 && n != 0) { bool isFound = false; for (int i = m; i <= n; i++) { if (i < 0 & ednakviCifri(i)) { cout << i << " "; ...
ALGO
0.99995
4.61037
f4f79a47-41a5-4e74-a2da-432f5289b90b
Debmalya017Das/DSA
NQT/secondsmall_secondlarge.cpp
#include <bits/stdc++.h> using namespace std; int sS(vector<int> &a) { int m = INT_MAX; int n = INT_MAX; for (int i = 0; i < a.size(); i++) { m = min(a[i], m); } for (int i = 0; i < a.size(); i++) { if (a[i] < n and a[i] != m) { n = a[i]; } } ...
ALGO
0.999769
4.330479
63781b93-34fe-4560-a47d-134129eb11ca
PaukIsUha/optimizing_formating_code
predictions/submissions-aizu-coop-gpt4/Codenet/p00099/438612178/response_6.cpp
#include <cstdio> #include <iostream> #include <sstream> #include <queue> using namespace std; const int MAX = 1000001; int S[MAX]; struct data { int num, score; data() {} data(int n, int s) : num(n), score(s) {} bool operator<(const data &d) const { if (score != d.score) return score < d.score; r...
ALGO
0.999914
3.696775
8de11d88-b34b-4824-8398-9dc6f0e3e4a2
Guard-creator/C---code
Taking DSA to next level/Searching Algorithm/Binary Algorithm/LastOccurnace.cpp
#include <iostream> // it is used to find the last occurance of the target value // even if it is dublicate int lastOccurance(int arr[], int size, int target) { int low = 0; int high = size - 1; int result = -1; while(low <= high) { int mid = low + (high - low) / 2; if(arr[mid] == target) { ...
ALGO
0.999032
5.91296
497f2957-faaf-46ad-87f8-cb013f777251
itsmeShaurya/Data-Structures-and-Algorithms
Arrays/Longest_Consecutive_Sequence.cpp
class Solution { public: int longestConsecutive(vector<int>& nums) { unordered_set<int> s(nums.begin(), nums.end()); if(nums.size() == 0){ return 0; } int longest = 1; for(auto it: s){ if(s.find(it-1) == s.end()){ int count = 1; ...
ALGO
0.999935
5.741252
aaebdc44-5926-434e-8e35-0db3cfaafd64
sarvex/leetcode-d
lcof2/剑指 Offer II 081. 允许重复选择元素的组合/Solution.cpp
class Solution { public: vector<vector<int>> ans; vector<int> candidates; int target; vector<vector<int>> combinationSum(vector<int>& candidates, int target) { this->candidates = candidates; this->target = target; vector<int> t; dfs(0, 0, t); return ans; } ...
ALGO
0.999969
6.502296
377e4a62-ea64-45db-8f7d-23228bce0ad0
uditamujumdar/LeetCode
0231-power-of-two/0231-power-of-two.cpp
class Solution { public: bool isPowerOfTwo(int n) { if(n==0) return false; while(n!=0){ if(n==1) return true; if(n%2!=0) return false; n/=2; } return true; } };
ALGO
0.997825
6.008428
fa8462b9-6089-45bc-a157-bdcf456845e3
upupming/algorithm
BasicLevel_C++/1026. 程序运行时间(15).cpp
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int n = ((b - a) + 50) / 100; int hour = n / 3600; n = n % 3600; int minute = n / 60, second = n % 60; printf("%02d:%02d:%02d", hour, minute, second); return 0; }
ALGO
0.995858
4.216492
fb0a253e-08f2-423d-8fdd-c462410d81c1
RuyRuy99/ProjetoFinal_APA
src/save_solution.cpp
#include <iostream> #include <fstream> #include <vector> #include "datatype.h" using namespace std; int calcularCustoRota(const vector<vector<int>>& routes, const vector<vector<int>>& c) { int custoTotal = 0; // Itera sobre cada rota for (const auto& rota : routes) { // Itera sobre cada cliente n...
ALGO
0.995083
5.568268
deec68e3-5a10-43ef-8384-81857bcd8250
Youngcircle-kim/practice_algorithm
2xxx/2206.cpp
#include <bits/stdc++.h> using namespace std; #define X first #define Y second int dx[4] = {0,1,0,-1}; int dy[4] = {1,0,-1,0}; char board[1000][1000]; int dist[1000][1000][2]; int n, m; bool OOB(int x, int y){ return x < 0 || x >= n || y < 0 || y >= m; } int bfs() { for (int i = 0; i < n; ++i) for (int j = ...
ALGO
0.999965
4.787691
2b987314-9bff-4bc4-94c8-66fe1f4353b1
evanw12345/CS216
Lab9/rank.cpp
/* File: rank.cpp * Course: CS216-001 * Project: Lab 9 (as part of Project 2) * Purpose: the implementation of member functions for the Rank class. * Author: Evan Wells */ #include <iostream> #include "iomanip" #include "rank.h" using namespace std; // Default constructor. Rank::Rank() { kind = hRanks::NoR...
TOOL
0.918577
6.456087
ec0630b7-879a-4aa5-8d85-b9eac0dfb064
zguoch/gmsh
contrib/Netgen/libsrc/csg/surface.cpp
#include <mystdlib.h> #include <myadt.hpp> #include <csg.hpp> #include <linalg.hpp> #include <meshing.hpp> namespace netgen { Surface :: Surface () { maxh = 1e10; name = new char[7]; strcpy (name, "noname"); bcprop = -1; bcname = "default"; } Surface :: ~Surface() { delete [] name; } void Surface :: Se...
ALGO
0.961098
3.952468
9354d556-ac23-4cd7-a6d9-c6e9c1308bd5
AncutaTheodor14/Structuri-de-date
panama_sum.cpp
/* https://kilonova.ro/problems/304 */ #include<bits/stdc++.h> #define int long long using namespace std; int n,q,v[100005]; struct form{ int bestsum, pref, suf, sum; }aint1[4*100000 +5], aint2[4*100005 +5]; form join(form a, form b) { form c; c={max({a.bestsum,b.bestsum, a.suf + b.pref}), max(a.pref,...
ALGO
0.999888
4.173944
c68aa18b-49a7-493a-88b4-08d6fcacaef1
Amenable-C/dataStructure
p53_1.cpp
#include <iostream> #include "polynomialListIterator.h" using namespace std; template <class T> int Show(const Chain<T>& l) { ChainIterator<T> li(l); if (!li.NotNull()) return 0; T retvalue = *li.First(); cout << retvalue; while (!li.NextNotNull()) { retvalue = *li.Next(); cout << " <- " << retvalue; } re...
TOOL
0.876098
3.764286
4c217880-b286-40ce-974f-6dce6cc7565f
raincross7/code-similarity
codes/train_code/problem287/problem287_421.cpp
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; using ll = long long; #define rep(i,n) for(ll i=0;i<ll(n);i++) #define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} #define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"N...
ALGO
0.999984
4.074397
4a2f66d9-09ef-4407-b4b9-bf0a4561be41
altantheprodigy/ocr-nik-extractor
example/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.998845
6.776823
675088ba-3934-4736-a052-a7e426a2e8bb
inkarrime/Programming-2-UTEC
Evaluations/EC_4.cpp
#include <iostream> #include <iomanip> using namespace std; int main() { int number; while(number <= 0 || number >= 10){ cout << "Numero [1 - 10]:"; cin >> number; } cout << setw(4) << ""; for (int h = 10; h >= 1; h--) { cout << setw(4) << h; } cout << endl; for...
ALGO
0.954952
3.729044
a82e89d6-24cd-4bd9-93aa-cf54650a04e8
conorobrien/CIS581Project4
flandmark/examples/simple_example.cpp
#include <highgui.h> #include <cstring> #include <cmath> #include "flandmark_detector.h" int main( int argc, char** argv ) { char flandmark_window[] = "flandmark_simple_example"; double t; int ms; int * bbox = (int*)malloc(4*sizeof(int)); if (argc < 6) { fprintf(stderr, "Usage: fla...
TOOL
0.90275
4.955874
b63646a2-8fcd-40bb-952b-04940f0581c9
algorr/slidernews
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.998762
6.786404
8cb9a454-4316-46e0-b121-e9302a14eea4
shirali-saraf/DSA-
1_array/1_arr.cpp
#include<iostream> using namespace std; int main(){ int n; cout<<"enter size of array"; cin>>n; int arr[n]; cout<<"enter array elements : "; for(int i=0;i<n;i++){ cin>>arr[i]; } cout<<"array elements : "; for(int i=0;i<n;i++){ cout<<arr[i]<<" "; } return 0; ...
ALGO
0.931873
3.028745
0665b0bc-ecf4-40fa-aa08-d2c0db3ea855
sangbpark94/CS211_CPP_Projects
CS211 HW 1-12/HW6.cpp
#include <iostream> #include <cmath> using namespace std; int main(){ int solution=0; int b[8]={0}; int r,c=0; NC: c++; if(c==8) goto PR; b[c]=-1; NR: b[c]++; if(b[c]==8) goto BT; for(int i=0; i<c; i++) if(b[c]==b[i]||(c-i)==abs(b[c]-b[i])) goto NR; goto NC; BT: c--; if(c==-1) return 0; goto NR; PR: f...
ALGO
0.999395
3.090821
f75a3f3b-8f25-4a59-9687-1bffd376f948
gudwnsgur/Algorithm
BOJ/10804_카드역배치.cpp
#include <iostream> #include <vector> #include <algorithm> #define endl '\n' using namespace std; int main() { vector<int> card(20), tmp(20); for (int i = 0; i < 20; i++) card[i] = i + 1; int s, e; for (int i = 0; i < 10; i++) { cin >> s >> e; s -= 1; e -= 1; for (int i = 0; i < s; i++) tmp[i] = card[i]; ...
ALGO
0.999897
3.37992
8627a700-aa12-46e7-9020-28f90004aa63
okcd00/CDKeeper
Online_training/2014 Summer_Crazy/2014 Summer Crazy _20140826/H.cpp
#include <cstring> #include <iostream> #include <algorithm> using namespace std; int n,m,ex=0,a[111][111]; bool v[111]={0},zero[111]={0},lg[111][111]; void dfs(int i) { v[i]=true; for (int j=1;j<=n;j++) if (a[i][j] && !v[j]) dfs(j); } int main() { cin>>n>>m; for (int i=1;i<=n;i++) { ...
ALGO
0.999838
3.107128
772cbd11-3cf7-4412-813e-194135c018b0
taskifbin/Competitive-Pogramming
A_Elephant.cpp
#include<iostream> using namespace std; int main() { int x; cin>>x; if(x%5==0) cout<<x/5; else cout<<x/5 +1; return 0; } //https://codeforces.com/problemset/problem/617/A
ALGO
0.999717
4.185051
92e4d7dc-ce35-4f76-b458-83ff0eceb265
tajansari612/cpp-Notes
C++/06_breakAndContinue.cpp
#include<iostream> using namespace std; int main(){ //break keyword int n=10; while(n>0){ cout<<n<<" "; if(n==5){ break; } n--; } //continue keyword n=10; while (n>0){ n--; if(n==5){ continue; } cout<...
ALGO
0.998159
3.201983
31be8067-f349-42da-8e36-a8f313432e49
MojammelSojib/Codeforces-Solve
codeforces2.11.25/A_Amusing_Joke.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string a,b,last; cin>>a>>b>>last; string x=a+b; sort(x.begin(),x.end()); sort(last.begin(),last.end()); // cout<<x<<endl; // cout<<last<<endl; if(x==last){ co...
ALGO
0.999921
3.309297
17decd91-5f0b-4078-bd61-835816459824
singh-gurkawalbir/DSA-Striver
Binary Search Tree Part-2/653. Two Sum IV - Input is a BST/Sol.cpp
#include <iostream> #include <vector> #include <map> #include <stack> #include "Tree.h" using namespace std; class Solution { public: bool findTarget(TreeNode *root, int target) { if (!root) return false; stack<TreeNode *> s1, s2; TreeNode *temp1 = root; TreeNode *t...
ALGO
0.999991
5.835644
689e4e2f-753e-4d71-973f-22d440021e94
elizabethlourcey/Project3v2
main.cpp
#include <iostream> #include <algorithm> #include "Cells.h" #include "Trie.h" #include "HashTable.h" #include <SFML/Graphics.hpp> using namespace std; SearchBoard welcomeWindow() { int width = 1200; int height = 800; bool searchMode = false; bool choiceMode = false; bool trieMode = false; bool has...
ALGO
0.968078
5.442483
bea409b0-e692-445d-a2b5-543a0f87bf11
majkimge/CompetitiveProgrammingCode
nawiasy/main.cpp
#include <bits/stdc++.h> #define lld long long #define mp make_pair #define f first #define s second #define MAX 2000000 #define INF 100000000000 using namespace std; lld tree[MAX]; pair<pair<lld,lld>,bool> ost; char nawiasy[MAX]; lld n; lld q,ktory,co,od1,do1,k,ilemocy=1; void update(lld x){ int p=ilemocy+x; ...
ALGO
0.999852
3.769806
9c2f1113-87cc-4faa-ba05-3af5b4275734
arduinocc04/Algorithm
BOJ/C++/1074-Z.cpp
#include <cstdio> int n, r, c, cnt; int pow(int a, int b) { int res = 1; for(int i = 0; i < b; i++) res *= a; return res; } int find(int r, int c, int n) { if(n == 0) return 0; int tmp = pow(2, n-1); bool flag1 = r >= tmp, flag2 = c >= tmp; if(!flag1 && !flag2) { return 0 + find(r...
ALGO
0.999833
3.663838
67ef884e-7cb5-493d-a0c5-843459e04e31
Khaleeq01/Leetcode-problems-solutions
0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divgoldman-sachs-divdiv-classcompanytagscontainer-tagoccurence1-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version1...
class Solution { public: int minimumLength(string s) { int i=0,j=s.size()-1; while(i<j && s[i]==s[j]){ //expand prefix and suffix char c=s[i]; while(i<j && s[i]==c) i++; while(i<=j && s[j]==c) j--; } return j-i+1; } };
ALGO
0.999973
6.36622
36289302-dda4-435b-b6cb-b90fcbd378e7
vasavagyan/homeworks
amrapndoxner/amrapndox 29.cpp
#include <iostream> int even_nums(int arr[], int col); int main(){ const int Size=5; std::cout<<"enter numbers:"<<std::endl; int array[Size]; for (int i=0; i<Size; ++i){ std::cin>>array[i]; } std::cout<<"the quantity of even numbers is: " <<even_nums(array, Size)<<std::endl; return 0; } i...
ALGO
0.987472
5.33422
b0aa07c1-debb-4697-80dc-08d1b21d5b47
ShashiShekharSuman/DSA
maximum_number_of_pairs_in_array.cpp
#include <bits/stdc++.h> using namespace std; class Solution { public: /* You are given a 0-indexed integer array nums. In one operation, you may do the following: > Choose two integers in nums that are equal. > Remove both integers from nums, forming a pair. The operation is done on nums ...
ALGO
0.999861
5.295764
b3202676-0882-4f7e-aa1a-d7401a6945d6
saiprakash192110061/Operating-system-
programs"/Exp-32.cpp
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define MAX_FRAMES 3 // Maximum number of frames in memory // Function declarations int lruPageReplacement(int pages[], int n, int capacity); int main() { int pages[] = {7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2}; // Reference string example int n = s...
ALGO
0.999785
6.269462
afa701d2-ed04-4a78-9f2e-d4abedeff926
hansikaweerasena/gem5-multi
src/systemc/tests/systemc/misc/user_guide/chpt4.1/stage1.cpp
/***************************************************************************** stage1.cpp -- Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 *****************************************************************************/ /*****************************************************************************...
ALGO
0.981299
5.389117
e26f61cd-9958-45b2-bfcc-5d897204f634
sodalalala/Verifiable-SE
C++/source/curve/pairing/fuzzy.cpp
/* Fuzzy IBE - Sahai-Waters See http://eprint.iacr.org/2004/086.pdf Section 4.1 Compile with modules as specified below For MR_PAIRING_CP curve cl /O2 /GX fuzzy.cpp cp_pair.cpp zzn2.cpp big.cpp zzn.cpp ecn.cpp miracl.lib For MR_PAIRING_MNT curve cl /O2 /GX fuzzy.cpp mnt_pair.cpp zzn6a.cpp ecn...
ALGO
0.9972
4.533494
9febcef4-5772-4422-91b7-788c43c9a8de
Rylynnn/Arithmetic
Competition/Code Forces/#432/c.cpp
/************************************************************************* > File Name: c.cpp > Author: Rylynnn > Mail: <EMAIL> > Created Time: 一 9/ 4 23:40:07 2017 ************************************************************************/ #include <iostream> #include <fstream> #include <cmath> #inclu...
ALGO
0.999991
3.406485
76943189-c2f2-4425-80cd-7c05e5f9aad7
ta7uw/competitive-programming
AtCoder/ABC148/E.cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for(ll i=0;i<(ll)(n);i++) #define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++) #define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = ...
ALGO
0.9999
4.202886
b9b0c4af-ae7f-4d0f-ad7b-3e4fecf1ffb2
Akilax0/CP
leet/Algorithm1/704binarysearch.cpp
class Solution { public: int search(vector<int>& nums, int target) { int l = 0; int r = nums.size()-1; while(r >= l) { int mid = l + (r - l) / 2; if (nums[mid] == target) return mid; if (nums[mid] > target) r=mid-1; else l = mid+1...
ALGO
0.999961
6.299347
d41561e2-ae80-4248-82e1-238c5c010d5f
PloKoon68/algorithmic-question-solutions
leetcode questions/ds-algorithm/medium/Least Number of Unique Integers after K Removals.cpp
//https://leetcode.com/problems/least-number-of-unique-integers-after-k-removals/description/?envType=daily-question&envId=2024-02-16 //https://leetcode.com/problems/least-number-of-unique-integers-after-k-removals/solutions/4739152/beats-81-71-c-priority-queue/ class Solution { public: int findLeastNumOfUniqueInt...
ALGO
0.999825
6.069674
aafb2fb7-1d04-4d48-ba06-c40c9219ee09
wxrdnx/My-Leetcode-Solutions
lowest-common-ancestor-of-a-binary-search-tree.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) { TreeNode *c...
ALGO
0.999991
6.502645
947ea8ff-8bcd-44f9-a55b-21adde1024a4
Piyush13-ambure/DSA
Min distance between two given nodes of a Binary Tree.cpp
/*Given a binary tree with n nodes and two node values, a and b, your task is to find the minimum distance between them. The given two nodes are guaranteed to be in the binary tree and all node values are unique. */ #include <iostream> using namespace std; // A binary tree node struct Node { int data; Node* ...
ALGO
0.999995
7.270697
0a2e50fc-d61d-4abb-aac6-0d6776bfda26
PNieck/KinematicChain2D
src/simulation/utils/intersections.cpp
#include <simulation/utils/intersections.hpp> #include <algorithm> float Cross(const glm::vec2& v1, const glm::vec2& v2) { return v1.x * v2.y - v2.x * v1.y; } bool LinesSegmentsIntersects( const glm::vec2 &p1, const glm::vec2 &p2, const glm::vec2 &p3, const glm::vec2 &p4 ) { const float d1 = Cross(p4 - p...
ALGO
0.998538
6.415073
10ec84df-bfd7-4dfb-a49a-7c99c573fd9e
trunghai95/MyCPCodes
Codeforces/755D.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1000000; int n, k, bit[MAXN+2], lst; ll cur; void update(int x) { while (x <= n) { ++bit[x]; x += x&(-x); } } int get2(int x) { int res = 0; while (x) { res += bit[x]; x -= x&(-x); ...
ALGO
0.999966
3.231316
85a0307f-ce72-4364-9027-828b0d42209e
ishandutta2007/codeforces
als123/normal/907/B.cpp
#include<cstdio> #include<cstring> const int N=15; char ss[N][N]; void lalal () { for (int u=1;u<=9;u++) { for (int i=1;i<=9;i++) { if (ss[u][i]=='.')printf("%c",33); else printf("%c",ss[u][i]); if (i%3==0) printf(" "); } printf("\n"); if (u%3==0) printf("\n"); } } void print () { for (int u=1;u<...
ALGO
0.999127
3.092642
a04e3849-fd82-40da-99cf-cde48d4e8f04
ishandutta2007/codeforces
superguyjm/normal/891/D.cpp
#include <bits/stdc++.h> #define LL long long #define pii pair<int,int> using namespace std; const int inf = 2147483647; const int N = 1000001; int _max(int x, int y) {return x > y ? x : y;} int _min(int x, int y) {return x < y ? x : y;} inline int read() { int x = 0, f = 1; char ch = getchar(); while(ch < '0...
ALGO
0.999411
3.83587
8c2f1266-1139-4bd8-b491-9229481f32c1
ggchangan/leetcode
Subsets/Subsets_BFS.cpp
#include<iostream> #include<queue> #include<algorithm> using namespace std; /* bool myCompare(vector<int>t1, vector<int>t2){ if(t1.size()<t2.size())return true; else if(t1.size()==t2.size()){ for(int i=0;i<t1.size();i++){ if(t1[i]<t2[i])return true; else if(t1[i]>t2[i]) return fa...
ALGO
0.999954
3.948978
c9e0187c-7914-4007-b1db-9b7c1810d94f
godnoTA/acm.bsu.by
4. Алгоритмы на графах/29.2. Слова #3033/[OK]173813.cpp
#include <iostream> #include <fstream> #include <deque> #include <string> #include <stack> #include <vector> #include <iterator> using namespace std; ifstream in("input.txt"); ofstream out("output.txt"); int main() { int n; string temp; vector< vector<string> > masOne; deque<string> second; stack<string> first;...
ALGO
0.99999
3.405756
e7a35736-d897-4a1d-a39c-64d3d2b462cd
2002wzy/c-code
将数组S中所有小写字母改写成大写字母.cpp
//SСдĸдɴдĸ #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char arr[] = "abCdEfg"; int i = 0; int sz = sizeof(arr) / sizeof(arr[0]); for ( i = 0; i < sz-1; i++) { if (arr[i] <= 'z' && arr[i] >= 'a') { printf("%c", arr[i] - 32); } else printf("%c", arr[i]); } return 0; }
ALGO
0.995016
3.043972
46755e38-3a5a-4bce-8b96-b0e433b3ef3d
Silaeder-Math-Modelling/MaMoth2019_TaMaKoDa
solve_b.cpp
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <utility> #include <set> #include "data_getter.cpp" #define eps 1e-9 using namespace std; struct Compare1{ bool operator() (const pair<pair<double, double>, pair<pair<double, double>, pair<double, double>>> &a, const pair<pair<doub...
ALGO
0.999793
3.732216
2895c2c3-3ebe-408b-b62b-0861d265b9a2
Varshini11113/TechDose_Training
2470-removing-stars-from-a-string/removing-stars-from-a-string.cpp
class Solution { public: string removeStars(string s) { string t; for (auto letter : s) { if (letter == '*') { if (t.size() > 0) { t.pop_back(); } } else { t += letter; } } retur...
ALGO
0.999896
6.332316
79e2d5ec-0c01-46ff-9851-862577819341
xNinjaKittyx/Theory-of-Algorithms
Test 2 - Divide and Conquer/Part 4/myProgram/main.cpp
// Handout #1: Source code of a C++ Program, which // converts distance in miles to kilometers. #include <iostream> //inclusion of support for doing input & output #include <vector> //inclusion of support for doing input & output #include <ctime> #include <time.h> using namespace std; //declare access to standard...
ALGO
0.999801
3.71387
26ac3326-cc11-4652-b6fe-fe7ba40bced1
abhishek18124/PPCPPApril2023
Lecture 24/004CoinToss.cpp
// n <= 10 #include<iostream> using namespace std; void f(int n, char* out, int i, int j) { // base case if (i == n) { // you've taken decisions for all the n coins out[j] = '\0'; cout << out << endl; return; } // recursive case // take decisions for the remaining n-i coins starting from the ith coi...
ALGO
0.999916
4.928834
a1a9862f-6a31-4747-bc66-1ea38eab05a1
slitvinov/lammps-swimmer
tools/colvars/abf_integrate.cpp
/**************************************************************** * abf_integrate * * Integrate n-dimensional PMF from discrete gradient grid * * Jerome Henin <<EMAIL>> * ****************************************************************/ #...
ALGO
0.998761
5.520493
10d5e61c-1912-4158-889d-2511b8dbf318
madmaxujjwal/leetcode-solutions
1962-remove-stones-to-minimize-the-total/1962-remove-stones-to-minimize-the-total.cpp
class Solution { public: int minStoneSum(vector<int>& piles, int k) { priority_queue<int> maxh; int n=piles.size(); for(int i=0;i<n;i++){ maxh.push(piles[i]); } while(k--){ double z=maxh.top(); int k=ceil(z/2); maxh.pop(); ...
ALGO
0.999809
5.55211
3af6001e-245f-40ea-8442-302acdec6661
lucashuati/maratona
URI/1148.cpp
#include <bits/stdc++.h> using namespace std; int matriz[501][501]; int main(){ int n, e; while(scanf("%d%d",&n,&e), n + e){ //zerar matriz de adjacencia for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { matriz[i][j] = 99999; } } //criar a matriz de adjacencia ...
ALGO
0.999892
3.865666
e874adde-8932-4608-9211-88a94d0c811f
szakats/bzflag_mirror
bzflag/plugins/plugin_utils/plugin_config.cpp
// PluginUtils.h - Collection of useful utility functions for plugins #include <iostream> #include <fstream> #include "bzfsAPI.h" #include "plugin_config.h" #include "plugin_utils.h" /* * INI style configuration file parser class * * Comments start with # or ; * Ignores whitespace around sections, keys, and value...
CONFIG
0.98565
6.535217
79b594bc-1337-48c3-b826-ddc3b8d119f2
iamsteven526/master
GDMA/GDMA_OFDM_coded/GDMA_OFDM_concatenate_polar_code_512_sc/turbo.cpp
#include <iostream> #include "parameters.h" #include <cstring> #include <math.h> using namespace std; void TrellisConstruction(int ***trellis) { for (int i = 0; i < 2; i++) { trellis[i][0][0] = trellis[i][0][1] = i; trellis[i][1][0] = trellis[i][1][1] = i ^ 1; } } void BCJR(int ***trellis, double *refLlr, doub...
ALGO
0.999951
3.904791
efdf0916-e9f1-4a3f-b4f1-6e34c20849a4
Ikran21/CW1
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.998756
6.772262
7ff91599-5c64-4f52-a214-3a1e641ced2f
FaiyazMujawar/interview-prep
Stack/calculator_stack.cpp
/* * This program solves a given mathematical expression using 'STACK' * data structure. * The program takes care of paranthesis. * Allowed operators : [paranthesis, + , -, *, /,^(raised to)] * Example: 2*(1+9/3)+1 evaluates to => 9 | 2^3+2^2 evaluates to => 12 */ #include <iostream> #include <stack> #include...
ALGO
0.99995
5.63625
c5c03f46-0a6b-47e8-9dfe-87789c60ea01
PraneethJain/CSES
Introductory_Problems/Increasing_Array.cpp
#include <iostream> using ll = long long; int main() { int n{}; std::cin >> n; int cur{}; int prev{}; ll ans{0}; for (int i{0}; i < n; ++i) { if (i == 0) { std::cin >> prev; } else { std::cin >> cur; if (prev > cur) { ans += prev - cur; cur = p...
ALGO
0.999897
4.66586