online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> #include <bits/stdc++.h> using namespace std; int minEatingSpeed(vector<int>& piles, int h) { std::ranges::iota_view r{1, *max_element(piles.begin(), piles.end())}; return *upper_bound(r.begin(), r.end(), h, [&piles] (auto h, auto e) { return accumulate(piles.begin(), piles.end(), 0, [e] (int acc, auto x) {return acc + ceil((double) x/e);}) <= h; }); } int main() { vector<int> piles1 = {3,6,7,11}; cout << "Test 1 " << minEatingSpeed(piles1, 8) << endl; vector<int> piles2 = {30,11,23,4,20}; cout << "Test 2 " << minEatingSpeed(piles2, 5) << endl; vector<int> piles3 = {30,11,23,4,20}; cout << "Test 3 " << minEatingSpeed(piles3, 6) << endl; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue