Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
int main(void){
  int N,M;
  cin >> N >> M;
  
  vector<vector<int>>person(N,vector<int>(2,0));
  for(int i=0;i<N;i++){
    cin >> person[i][0];
    cin >> person[i][1];
  }
  
  vector<vector<int>>point(M,vector<int>(2,0));
  for(int i=0;i<M;i++){
    cin >> point[i][0];
    cin >> point[i][1];
  }

  for(int i=0;i<N;i++){
    int distance_to_point = 1000000000;
    int ans;
    for(int i=0;i<M;i++){
      int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
      if(distance_to_point > distance){
        distance_to_point = distance;
        ans = j + 1;
      }
    }
    cout << ans << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> N >> M;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<vector<int>>person(N,vector<int>(2,0));
      |   ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:17: error: expected primary-expression before 'int'
    9 |   vector<vector<int>>person(N,vector<int>(2,0));
      |                 ^~~
a.cc:11:12: error: 'person' was not declared in this scope; did you mean 'perror'?
   11 |     cin >> person[i][0];
      |            ^~~~~~
      |            perror
a.cc:15:17: error: expected primary-expression before 'int'
   15 |   vector<vector<int>>point(M,vector<int>(2,0));
      |                 ^~~
a.cc:17:12: error: 'point' was not declared in this scope
   17 |     cin >> point[i][0];
      |            ^~~~~
a.cc:25:26: error: 'person' was not declared in this scope; did you mean 'perror'?
   25 |       int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
      |                          ^~~~~~
      |                          perror
a.cc:25:41: error: 'point' was not declared in this scope
   25 |       int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
      |                                         ^~~~~
a.cc:25:47: error: 'j' was not declared in this scope
   25 |       int distance = abs(person[i][0] - point[j][0]) + abs(person[i][1] - point[j][1]);
      |                                               ^
a.cc:31:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   31 |     cout << ans << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:31:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   31 |     cout << ans << endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~