Language: C++

#include<bits/stdc++.h>
using namespace std;
long n,a,b,h[100000],i,l=1,m,r=1e9,x;
main(){
  for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
  while(l<r){
    m=(l+r)/2;
    for(x=i=0;i<n;++i)h[i]>(long)m*b?x+=(h[i]-m*b+a-1)/a:0;
    x<=m?r=m:l=m+1;
  }
  cout<<l;
}


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:19: error: expected ';' before ')' token
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                   ^
      |                   ;
a.cc:5:37: warning: capture of variable 'h' with non-automatic storage duration
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                     ^
a.cc:3:12: note: 'long int h [100000]' declared here
    3 | long n,a,b,h[100000],i,l=1,m,r=1e9,x;
      |            ^
a.cc:5:38: error: expected ',' before '+' token
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                      ^
      |                                      ,
a.cc:5:38: error: expected identifier before '+' token
a.cc: In lambda function:
a.cc:5:43: error: expected '{' before ';' token
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                           ^
a.cc: In function 'int main()':
a.cc:5:34: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'main()::<lambda()>')
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                               ~~~^~~~~~~~~
      |                               |    |
      |                               |    main()::<lambda()>
      |                               std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'void (*)()'
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note:   after user-defined conversion: 'constexpr main()::<lambda()>::operator void (*)()() const'
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'short int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'short int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |                                    |
      |                                    void (*)()
a.cc:5:36: error: conversion to non-const reference type 'short int&' from rvalue of type 'void (*)()' [-fpermissive]
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short unsigned int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'short unsigned int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'short unsigned int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |                                    |
      |                                    void (*)()
a.cc:5:36: error: conversion to non-const reference type 'short unsigned int&' from rvalue of type 'void (*)()' [-fpermissive]
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |                                    |
      |                                    void (*)()
a.cc:5:36: error: conversion to non-const reference type 'int&' from rvalue of type 'void (*)()' [-fpermissive]
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'unsigned int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'unsigned int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'unsigned int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |                                    |
      |                                    void (*)()
a.cc:5:36: error: conversion to non-const reference type 'unsigned int&' from rvalue of type 'void (*)()' [-fpermissive]
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'long int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'long int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |                                    |
      |                                    void (*)()
a.cc:5:36: error: conversion to non-const reference type 'long int&' from rvalue of type 'void (*)()' [-fpermissive]
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long unsigned int&' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^
a.cc:5:36: note:   no known conversion from 'void (*)()' to 'long unsigned int'
a.cc:5:36: error: invalid conversion from 'void (*)()' to 'long unsigned int' [-fpermissive]
    5 |   for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++];
      |                                    ^~~~~~~
      |