Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll h;
ll count=1;
ll A=1;
ll attack(){
  while(1){
  if(h=1){
    A++;
    count += A;
    break;
  }
  if(h%2=1){
    h=(h-1)/2;
  }
  else{
    h=h/2
  }
  A++;
  count += A;
  }
  

int main(){
  cin >> h;
  attack(h);
  cout << count <<endl;
}
  
  

Compiler output:
a.cc: In function 'long long int attack()':
a.cc:12:5: error: reference to 'count' is ambiguous
   12 |     count += A;
      |     ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:4: note:                 'long long int count'
    6 | ll count=1;
      |    ^~~~~
a.cc:15:7: error: lvalue required as left operand of assignment
   15 |   if(h%2=1){
      |      ~^~
a.cc:19:10: error: expected ';' before '}' token
   19 |     h=h/2
      |          ^
      |          ;
   20 |   }
      |   ~       
a.cc:22:3: error: reference to 'count' is ambiguous
   22 |   count += A;
      |   ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:4: note:                 'long long int count'
    6 | ll count=1;
      |    ^~~~~
a.cc:26:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   26 | int main(){
      |         ^~
a.cc:26:9: note: remove parentheses to default-initialize a variable
   26 | int main(){
      |         ^~
      |         --
a.cc:26:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:26:11: error: a function-definition is not allowed here before '{' token
   26 | int main(){
      |           ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:8:12: note: to match this '{'
    8 | ll attack(){
      |            ^
a.cc:30:2: warning: no return statement in function returning non-void [-Wreturn-type]
   30 | }
      |  ^