Language: C++

#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
main(){
 while(1){
  int n,a,b,c;
  cin>>n;
  if(n==0) break;
  map<long,int> m;
  for(;n>0;n--){
   cin>>a>>b>>c;
   m.insert(map<long,int>((long)b*c,a));
  }
  m.sort();
  cout<<(m.begin()).first<<endl;
 }
 cout<<"NA"<<endl;
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:38: error: no matching function for call to 'std::map<long int, int>::map(long int, int&)'
   13 |    m.insert(map<long,int>((long)b*c,a));
      |                                      ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:302:9: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  302 |         map(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_map.h:302:9: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_map.h:285:9: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  285 |         map(_InputIterator __first, _InputIterator __last)
      |         ^~~
/usr/include/c++/14/bits/stl_map.h:285:9: note:   template argument deduction/substitution failed:
a.cc:13:38: note:   deduced conflicting types for parameter '_InputIterator' ('long int' and 'int')
   13 |    m.insert(map<long,int>((long)b*c,a));
      |                                      ^
/usr/include/c++/14/bits/stl_map.h:268:9: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  268 |         map(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_map.h:268:9: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_map.h:262:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; allocator_type = std::allocator<std::pair<const long int, int> >]'
  262 |       map(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:262:40: note:   no known conversion for argument 1 from 'long int' to 'std::initializer_list<std::pair<const long int, int> >'
  262 |       map(initializer_list<value_type> __l, const allocator_type& __a)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:256:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; std::__type_identity_t<_Alloc> = std::allocator<std::pair<const long int, int> >]'
  256 |       map(map&& __m, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:256:17: note:   no known conversion for argument 1 from 'long int' to 'std::map<long int, int>&&'
  256 |       map(map&& __m, const __type_identity_t<allocator_type>& __a)
      |           ~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:252:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; std::__type_identity_t<_Alloc> = std::allocator<std::pair<const long int, int> >]'
  252 |       map(const map& __m, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:252:22: note:   no known conversion for argument 1 from 'long int' to 'const std::map<long int, int>&'
  252 |       map(const map& __m, const __type_identity_t<allocator_type>& __a)
      |           ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:248:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; allocator_type = std::allocator<std::pair<const long int, int> >]'
  248 |       map(const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:248:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:240:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; allocator_type = std::allocator<std::pair<const long int, int> >]'
  240 |       map(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:240:40: note:   no known conversion for argument 1 from 'long int' to 'std::initializer_list<std::pair<const long int, int> >'
  240 |       map(initializer_list<value_type> __l,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:227:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  227 |       map(map&&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:227:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:219:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  219 |       map(const map&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:219:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_map.h:206:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const allocator_type&) [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >; allocator_type = std::allocator<std::pair<const long int, int> >]'
  206 |       map(const _Compare& __comp,
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:206:27: note:   no known conversion for argument 1 from 'long int' to 'const std::less<long int>&'
  206 |       map(const _Compare& __comp,
      |           ~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_map.h:197:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = long int; _Tp = int; _Compare = std::less<long int>; _Alloc = std::allocator<std::pair<const long int, int> >]'
  197 |       map() = default;
      |       ^~~
/usr/include/c++/14/bits/stl_map.h:197:7: note:   candidate expects 0 arguments, 2 provided
a.cc:15:5: error: 'class std::map<long int, int>' has no member named 'sort'
   15 |   m.sort();
      |     ^~~~
a.cc:16:21: error: 'std::map<long int, int>::iterator' {aka 'std::_Rb_tree<long int, std::pair<const long int, int>, std::_Select1st<std::pair<const long int, int> >, std::less<long int>, std::allocator<std::pair<const long int, int> > >::iterator'} has no member named 'first'
   16 |   cout<<(m.begin()).first<<endl;
      |                     ^~~~~