Language: C++

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

int main() {
  int N;
  cin >> N;
  
  int A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
}
  
for (int j = 1; j < N; j++){
   cout << lower_bound(A, A + N, j) - lower_bound(A, A + N, j-1) << endl;     
}
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: request for member 'at' in 'A', which is of non-class type 'int'
   10 |     cin >> A.at(i);
      |              ^~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = int; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_less_val]':
/usr/include/c++/14/bits/stl_algobase.h:1539:32:   required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int]'
 1539 |       return std::__lower_bound(__first, __last, __val,
      |              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
 1540 |                                 __gnu_cxx::__ops::__iter_less_val());
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:23:   required from here
   14 |    cout << lower_bound(A, A + N, j) - lower_bound(A, A + N, j-1) << endl;
      |            ~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1495:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
 1495 |         _DistanceType;
      |         ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1497:42: error: no matching function for call to 'distance(int&, int&)'
 1497 |       _DistanceType __len = std::distance(__first, __last);
      |                             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = int]':
/usr/include/c++/14/bits/stl_algobase.h:1497:42:   required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = int; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
 1497 |       _DistanceType __len = std::distance(__first, __last);
      |                             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32:   required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int]'
 1539 |       return std::__lower_bound(__first, __last, __val,
      |              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
 1540 |                                 __gnu_cxx::__ops::__iter_less_val());
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:23:   required from here
   14 |    cout << lower_bound(A, A + N, j) - lower_bound(A, A + N, j-1) << endl;
      |            ~~~~~~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~