criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int n, m;
    cin>>n>>m;
    int a[n], b[n], c[m], d[m];
    int i;
    REP(i, n){
        cin>>a[i]>>b[i];
    }
    for(i=0; i<m; i++){
        cin>>c[i]>>d[i];
    }
    int min = INF;
    bango = 0;
    for(i=0; i<n; i++){
        for(int j=m-1; j>=0; j--){
            if(min>abs(a[i]-c[j])+abs(b[i]-d[j])){
                min = abs(a[i]-c[j])+abs(b[i]-d[j]);
                bango = i+1;
            }
        }
        cout<<min<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'bango' was not declared in this scope
   23 |     bango = 0;
      |     ^~~~~
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int n, m;
    cin>>n>>m;
    int a[n], b[n], c[m], d[m];
    int i;
    REP(i, n){
        cin>>a[i]>>b[i];
    }
    for(i=0; i<m; i++){
        cin>>c[i]>>d[i];
    }
    int min = INF;
    for(i=0; i<n; i++){
        for(i=0; i<m; i++){
            if(min>abs(a[i]-c[i])+abs(b[i]-d[i])){
                min = abs(a[i]-c[i])+abs(b[i]-d[i])
            }
        }
        cout<<min<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:52: error: expected ';' before '}' token
   26 |                 min = abs(a[i]-c[i])+abs(b[i]-d[i])
      |                                                    ^
      |                                                    ;
   27 |             }
      |             ~
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int n, m;
    cin>>n>>m;
    int a[n], b[n], c[m], d[m];
    REP(i, n){
        cin>>a[i]>>b[i];
    }
    for(i=0; i<m; i++){
        cin>>c[i]>>d[i];
    }
    int min = INF;
    for(i=0; i<n; i++){
        for(i=0; i<m; i++){
            if(min>abs(a[i]-c[i])+abs(b[i]-d[i])){
                min = abs(a[i]-c[i])+abs(b[i]-d[i])
            }
        }
        cout<<min<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'i' was not declared in this scope
   18 |     for(i=0; i<m; i++){
      |         ^
a.cc:22:9: error: 'i' was not declared in this scope
   22 |     for(i=0; i<n; i++){
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> ans(n);
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(m);
  vector<int> d(m);
  vector<>
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  for(int i=0;i<m;i++){
    cin>>c[i]>>d[i];
  }
  for(int i=0;i<n;i++){
    int manhattan=400000002;
    for(int j=0;j<m;j++){
      if(abs(a[i]-c[j])+abs(b[i]-d[j])<manhattan){manhattan=abs(a[i]-c[j])+abs(b[i]-d[j]);ans[i]=j+1;}
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: wrong number of template arguments (0, should be at least 1)
   11 |   vector<>
      |          ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:12:3: error: expected unqualified-id before 'for'
   12 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:12:15: error: 'i' was not declared in this scope
   12 |   for(int i=0;i<n;i++){
      |               ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define MAXP 0x0FFFFFFF

typedef struct{
	TLong x;
	TLong y;
} point;

int main(int argc, char const *argv[])
{
	int n,m;
	int pNum;
	TLong min;
	point std[53],cp[53];
	scanf("%d%d",&n,&m);
	for (int i = 0; i < n; ++i)	scanf("%lld%lld", &std[i].x, &std[i].y);
	for (int i = 0; i < m; ++i)	scanf("%lld%lld", &cp[i].x, &cp[i].y);
	for (int i = 0; i < n; ++i)
	{
		min = MAXP;
		pNum = 0;
		for (int j = 0; j < m; ++j)
		{
			if(MHD(std[i],cp[j]) < min){
				min = MHD(std[i],cp[j]);
				pNum = j;
			}
		}
		printf("%d\n",pNum + 1);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:31:28: error: implicit declaration of function 'MHD' [-Wimplicit-function-declaration]
   31 |                         if(MHD(std[i],cp[j]) < min){
      |                            ^~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <limit.h>


int main()
{
	int point[50][2];
	int check[50][2];
	int N,M;
	int i, j;
	int minditance;
	int distance;
	int minnum = 0;

	scanf("%d%d",&N,&M);
	for (i = 0; i < N; i++) {
		scanf("%d%d", &point[i][0], &point[i][1]);
	}
	for (i = 0; i < M; i++) {
		scanf("%d%d", &check[i][0], &check[i][1]);
	}

	for (i = 0; i < N; i++) {
		minditance = INT_MAX;
		for (j = 0; j < M; j++) {
			distance = abs(point[i][0] - check[j][0]) + abs(point[i][1] - check[j][1]);
			if (minditance > distance) {
				minditance = distance;
				minnum = j;
			}
		}
		printf("%d\n", minnum + 1);
	}


    return 0;
}


Compiler output:
a.cc:3:10: fatal error: limit.h: No such file or directory
    3 | #include <limit.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <stdlib.h>


int main()
{
	int point[50][2];
	int check[50][2];
	int N,M;
	int i, j;
	int minditance;
	int distance;
	int minnum = 0;

	scanf("%d%d",&N,&M);
	for (i = 0; i < N; i++) {
		scanf("%d%d", &point[i][0], &point[i][1]);
	}
	for (i = 0; i < M; i++) {
		scanf("%d%d", &check[i][0], &check[i][1]);
	}

	for (i = 0; i < N; i++) {
		minditance = INT_MAX;
		for (j = 0; j < M; j++) {
			distance = abs(point[i][0] - check[j][0]) + abs(point[i][1] - check[j][1]);
			if (minditance > distance) {
				minditance = distance;
				minnum = j;
			}
		}
		printf("%d\n", minnum + 1);
	}


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'scanf' was not declared in this scope
   14 |         scanf("%d%d",&N,&M);
      |         ^~~~~
a.cc:23:30: error: 'INT_MAX' was not declared in this scope
   23 |                 minditance = INT_MAX;
      |                              ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <stdlib.h>
  +++ |+#include <climits>
    2 | 
a.cc:31:17: error: 'printf' was not declared in this scope
   31 |                 printf("%d\n", minnum + 1);
      |                 ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <stdlib.h>
  +++ |+#include <cstdio>
    2 |
Language: C++


#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;


int getdis(int a, int b, int c, int d) {
	return abs(a - c) + abs(b - d);
}

int main() {

	int a[50];
	int b[50];
	int c[50];
	int d[50];

	int n, m;
	int dis;

	cin >> n >> m;

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < m; i++) {
		cin >> c[i] >> d[i];
	}

	for (int i = 0; i < n; i++) {
		int wk_dis = INT_MAX;
		int ansindex;
		for (int j = 0; j < m; j++) {
			dis = getdis(a[i], b[i], c[j], d[j]);

			if (dis < wk_dis) {
				ansindex = j;
				wk_dis = dis;
			}
		}
		
		cout << ansindex+1 << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:30: error: 'INT_MAX' was not declared in this scope
   34 |                 int wk_dis = INT_MAX;
      |                              ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <stdlib.h>
  +++ |+#include <climits>
    5 |
Language: C++

#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;


int getdis(int a, int b, int c, int d) {
	return abs(a - c) + abs(b - d);
}

int main() {

	int a[50];
	int b[50];
	int c[50];
	int d[50];

	int n, m;
	int dis;

	cin >> n >> m;

	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < m; i++) {
		cin >> c[i] >> d[i];
	}

	for (int i = 0; i < n; i++) {
		int wk_dis = INT_MAX;
		int ansindex;
		for (int j = 0; j < m; j++) {
			dis = getdis(a[i], b[i], c[j], d[j]);

			if (dis < wk_dis) {
				ansindex = j;
				wk_dis = dis;
			}
		}
		
		cout << ansindex+1 << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:30: error: 'INT_MAX' was not declared in this scope
   33 |                 int wk_dis = INT_MAX;
      |                              ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <stdlib.h>
  +++ |+#include <climits>
    4 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){

int N, M, num, mi;
  cin >> N >> M;
int a[N];
int b[N];
int c[M];
int d[M];
  
  for(int i = 0;i < N;i++){
  cin >> a[i];
  cin >> b[i];  
  }
  for(int i = 0;i < M;i++){
  cin >> c[i];
  cin >> d[i]; 
  }
  
  for(int j = 0;j < N;j++){
    mi = 200000001;
  for(int i = 0;i < M;i++){
  if(mi > abs(a[j] - c[i]) + abs(b[j] - d[i])){
  num = i + 1;
  mi = abs(a[j] - c[i]) + abs(b[j] - d[i]);  
  }
  }
        cout << num << endl;
  }
  
 

Compiler output:
a.cc: In function 'int main()':
a.cc:31:4: error: expected '}' at end of input
   31 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: Java

import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] ax = new int[n];
        int[] ay = new int[n];
        int[] bx = new int[m];
        int[] by = new int[m];

        for(int i = 0; i<n; i++) {
            ax[i] = Integer.parseInt(sc.next());
            ay[i] = Integer.parseInt(sc.next());
        }

        for(int i = 0; i<m; i++) {
            bx[i] = Integer.parseInt(sc.next());
            by[i] = Integer.parseInt(sc.next());
        }

        int min = Integer.MAX_VALUE;
        int minI = 0;

        for(int i = 0; i<n; i++) {
            min= Integer.MAX_VALUE;
            for(int j = 0; j<m; j++) {
                long manhattan = (long)Math.abs(ax[i]-bx[j]) + (long)Math.abs(ay[i]-by[j]);
                if(manhattan < min ) {
                    min = manhattan;
                    minI = j+1;
                }
            }
            System.out.println(minI);
        }

    }
}

Compiler output:
Main.java:30: error: incompatible types: possible lossy conversion from long to int
                    min = manhattan;
                          ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>



int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
	int N, M; std::cin >> N >> M;
	std::vector<int> a(N), b(N), c(M), d(M);
	for (int i = 0; i < N; i++) {
		std::cin >> a.at(i) >> b.at(i);
	}
	for (int i = 0; i < M; i++) {
		std::cin >> c.at(i) >> d.at(i);
	}

	int nearest = 400000001, check_point = 0;

	for (int i = 0; i < N; i++) {
		nearest = 400000001;
		for (int j = 0; j < M; j++)
		{
			const int cur = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
			if (cur < nearest) {
				nearest = cur;
				check_point = j + 1;
			}
		}
	}

	std::cout << check_point;


	return 0;
}

	std::cout << check_point;


	return 0;
}

Compiler output:
a.cc:40:14: error: 'cout' in namespace 'std' does not name a type
   40 |         std::cout << check_point;
      |              ^~~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:43:9: error: expected unqualified-id before 'return'
   43 |         return 0;
      |         ^~~~~~
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  int n,m;
  cin>>n>>m;
  long long a[n],b[n],c[m],d[m];
  REP(i,n){
    cin>>a[i]>>b[i];
  }
  REP(i,m){
    cin>>c[i]>>d[i];
  }
  int ans[n];
  int check=-1;
  long long dist=inf;
  REP(i,n){
    for(int j=m-1;j>=0;j--){
      if(abs(a[i]-c[j])+abs(b[i]-d[j])<=dist){
        dist = abs(a[i]-c[j])+abs(b[i]-d[j]);
        check=j;
      }
    }
    ans[i]=j;
    check=-1;
    dist=inf;
  }
  REP(i,n){
    ans[i]++;
    cout<<ans[i]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:91:12: error: 'j' was not declared in this scope
   91 |     ans[i]=j;
      |            ^
Language: Java

import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] stu = new int[n][2];
        for(int i = 0; i < n; i++){
            stu[i][0] = sc.nextInt();
            stu[i][1] = sc.nextInt();
        }
        int[][] cp = new[m][2];
        for(int i = 0; i < n; i++){
            cp[i][0] = sc.nextInt();
            cp[i][1] = sc.nextInt();
        }
        
        for(int i = 0; i < stu.length; i++){
            int min = -1;
            int d = 1_000_000;
            for (int j = 0; j < cp.length; j++) {
                int temp = Math.abs(stu[i][0] - cp[j][0]) + Math.abs(stu[i][1] - cp[j][1]);
                if(d > temp){
                    min = j;
                    d = temp;
                }
            }
            System.out.println(min + 1);
        }
        
    }
}

Compiler output:
Main.java:13: error: <identifier> expected
        int[][] cp = new[m][2];
                        ^
1 error
Language: C++

#include <cstdio>
#include <cmath>
usin namespace std;
int main() {
	int s_x[51], s_y[51], m_x[51], m_y[51], cur_dis;
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%d%d", &s_x[i], &s_y[i]);
	for (int i = 0; i < m; i++) scanf("%d%d", &m_x[i], &m_y[i]);
	for (int i = 0; i < n; i++) {
		int update_dis = abs(s_x[i] - m_x[0]) + abs(s_y[i] - m_y[0]), checkpoint;
		if (update_dis > cur_dis) {
			for (int j = 1; j < m; j++) {
				cur_dis = abs(s_x[i] - m_x[j]) + abs(s_y[i] - m_y[j]);
				if (update_dis > cur_dis) {
					update_dis = cur_dis;
					checkpoint = j + 1;
				}
			}
			printf("%d\n", checkpoint);
		}
		return 0;
	}
}

Compiler output:
a.cc:3:1: error: 'usin' does not name a type
    3 | usin namespace std;
      | ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int n,m;
  cin >> n >> m;
  int a[n],b[n],c[m],d[m];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i=0;i<m;i++){
    cin >> c[i] >> d[i];
  }
  for(int i=0;i<n;i++){
    int ans=1;
    int k=abs(c[0]-a[i])+abs(d[0]-b[i]);
    for(int j=1;j<m;j++){
      if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
        ans=j+1;
        k=abs(c[j]-k[i])+abs(d[j]-k[i]);
      }
    }
    cout << ans << endl;
  }
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: invalid types 'int[int]' for array subscript
   20 |       if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
      |                      ^
a.cc:20:37: error: invalid types 'int[int]' for array subscript
   20 |       if(k>abs(c[j]-k[i])+abs(d[j]-k[i])){
      |                                     ^
a.cc:22:21: error: invalid types 'int[int]' for array subscript
   22 |         k=abs(c[j]-k[i])+abs(d[j]-k[i]);
      |                     ^
a.cc:22:36: error: invalid types 'int[int]' for array subscript
   22 |         k=abs(c[j]-k[i])+abs(d[j]-k[i]);
      |                                    ^
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int N, M;
  cin >> N >> M;
  vector< pair<int, int> > students(N);
  for (int i = 0; i < N; ++i) {
    int a, b;
    cin >> a >> b;
    students[i] = make_pair(a, b);
  }

  vector< pair<int, int> > ans(N, pair<int, int>(0, INT_MAX));
  for (int i = 0; i < M; ++i) {
    int c, d;
    cin >> c >> d;
    for (int j = 0; j < N; ++j) {
      int distance = abs(students[j].first - c) + abs(students[j].second - d);
      if (ans[j].second > distance) {
	ans[j].first = i;
	ans[j].second = distance;
      }
    }
  }
  for (int i = 0; i < N; ++i) {
    cout << ans[i].first + 1 << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:53: error: 'INT_MAX' was not declared in this scope
   40 |   vector< pair<int, int> > ans(N, pair<int, int>(0, INT_MAX));
      |                                                     ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   17 | #include <fstream>
  +++ |+#include <climits>
   18 |
Language: C++

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

int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
  int ret = 0, ds = INF;
  for (int i = 0; i < m; i++) {
    int nds = abs(x - c[i]) + abs(y - d[i]);
    if (nds < ds) {
      ds = nds;
      ret = i + 1;
    }
  }
  return ret;
}

int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int c[m], d[m];
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:19: error: 'x' was not declared in this scope
    8 |     int nds = abs(x - c[i]) + abs(y - d[i]);
      |                   ^
Language: C++

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

int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
  int ret = 0, ds = INF;
  for (int i = 0; i < m; i++) {
    nds = abs(x - c[i]) + abs(y - d[i]);
    if (nds < ds) {
      ds = nds;
      ret = i + 1;
    }
  }
  return ret;
}

int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int c[m], d[m];
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:5: error: 'nds' was not declared in this scope; did you mean 'ds'?
    8 |     nds = abs(x - c[i]) + abs(y - d[i]);
      |     ^~~
      |     ds
a.cc:8:15: error: 'x' was not declared in this scope
    8 |     nds = abs(x - c[i]) + abs(y - d[i]);
      |               ^
Language: C++

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

int nearest_checkpoint(int , int y, int m, int c[], int d[]) {
  int ret = 0, ds = INF;
  for (int i = 0; i < m; i++) {
    nds = abs(x - c[i]) + abs(y - d[i]);
    if (nds < ds) {
      ds = nds;
      ret = i;
    }
  }
  return ret;
}

int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int c[m], d[m];
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < n; i++) {
    cout << nearest_checkpoint(a[i], b[i], m, c, d) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int nearest_checkpoint(int, int, int, int*, int*)':
a.cc:8:5: error: 'nds' was not declared in this scope; did you mean 'ds'?
    8 |     nds = abs(x - c[i]) + abs(y - d[i]);
      |     ^~~
      |     ds
a.cc:8:15: error: 'x' was not declared in this scope
    8 |     nds = abs(x - c[i]) + abs(y - d[i]);
      |               ^
Language: C++

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

int main(){
    int n, m, i, j, r, t;
    cin >> n >> m;
    int a[n][2], b[m][2];
    for(i=0; i<n; i++){
        cin >> a[i][0] >> a[i][1];
    }
    for(i=0; i<m; i++){
        cin >> b[i][0] >> b[i][1];
    }
    for(i=0; i<n; i++){
        r = 1000000000;
        t = 0
        for(j=0; j<m; j++){
            if(r > abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])){
                r = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1]);
                t = j+1;
            }
        }
        cout << t << '\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: expected ';' before 'for'
   16 |         t = 0
      |              ^
      |              ;
   17 |         for(j=0; j<m; j++){
      |         ~~~   
a.cc:17:26: error: expected ';' before ')' token
   17 |         for(j=0; j<m; j++){
      |                          ^
      |                          ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<pair<int,int>> human(N), check(M);
  for(int i = 0; i < N; i++) {
    cin >> human.at(i).first >> human.at(i).second;
  }
  for(int i = 0; i < M; i++) {
    cin >> check.at(i).first >> check.at(i).second;
  }
  long ans, num, sub;
  for(int i = 0; i < N; i++) {
    ans = 10000000000, num = -1;
    for(int j = 0; j < M; j++) {
      sub = abs(human.at(i).first - check.at(j).first) + abs(human.at(i).second - check.at(j).second);
      if(ans > sub) {
        ans = sub;
        num = j + 1;
      }
    }
    cout << nm << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'nm' was not declared in this scope; did you mean 'num'?
   23 |     cout << nm << endl;
      |             ^~
      |             num
Language: C++

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

int main () {
  int N , M ;
  cin >> N >> M ;
  int A[100][2] , B[100][2] ;
  for(int i = 0 ; i < N ; i ++ ){
    int a , b ;
    cin >> a >> b ; 
    A[i][0] = a ;
    A[i][1] = b ;
  }
  for(int i = 0 ; i < M ; i ++ ){
    int a , b ;
    cin >> a >> b ; 
    B[i][0] = a ;
    B[i][1] = b ;
  }
  for(int i = 0 ; i < N ; i++ ) {
    long long d[M] ;
    long longt pre = 100000000 ;
    long long ans = 0 ;
    for(int j = M - 1 ; j >= 0 ; j-- ){
      d[i] = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) ;
      if(pre>d[i]) ans = j ;
    }
    cout << ans + 1 << endl ;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected initializer before 'pre'
   22 |     long longt pre = 100000000 ;
      |                ^~~
a.cc:26:10: error: 'pre' was not declared in this scope; did you mean 'pread'?
   26 |       if(pre>d[i]) ans = j ;
      |          ^~~
      |          pread
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
const double pi = 3.14159265359;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n, m;
int a[55], b[55], c[55], d[55];

int main()
{
	cin >> n >> m;

	for (int i = 0;i < n;i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0;i < m;i++) {
		cin >> c[i] >> d[i];
	}

	for (int i = 0;i < n;i++) {
		int d = INF;
		int CP = 0;
		for (int j = 0;j < m;j++) {
			if (d > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
				CP = j;
			}
		}
		cout << CP << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:64: error: invalid types 'int[int]' for array subscript
   45 |                         if (d > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
      |                                                                ^
Language: C++

#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	int N, M;
	
	cin >> N >> M;

	ll a[N], b[N], c[M], d[M];
	
	rep(i, N)
	{
		cin >> a[i] >> b[i];
	}

	ll e[N][M];

	rep(i, M)
	{
		cin >> c[i] >> d[i];
		for(int j = 0; j < N; j++)
		{
			e[j][i] = abs(a[j] - c[i]) + abs(b[j] - d[i]);
		}
	}

	rep(i, N)
	{
		ll min = MOD;
		int idx = -1;
		rep(j, M)
		{
			if (e[i][j] < min)
			{
				min = e[i][j];
				idx = j;
			}
		}
		cout << j + 1 << endl;
	}

	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:25: error: 'j' was not declared in this scope
   67 |                 cout << j + 1 << endl;
      |                         ^
Language: C

#include<stdio.h>
int dif(int a, int b);
int N, M, A, B, C, D, min, i, j;
int MAX = 1073741824;
int main(){
  scanf("%d%d", &N, &M);
  for(i=0; i<N; i++){
    scanf("%d%d", A+i, B+i);
  }
  for(j=0; j<M; j++){
    scanf("%d%d", C+j, D+j);
  }
  for(i=0; i<N; i++){
    min = max;
    for(j=0; j<M; j++){
      if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
        min=j;
      }
    }
    printf("%d\n", min);
  }
}
int dif(int a, int b){
  return a<b?b-a:a-b;
}


Compiler output:
main.c: In function 'main':
main.c:14:11: error: 'max' undeclared (first use in this function)
   14 |     min = max;
      |           ^~~
main.c:14:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:15: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |               ^
main.c:16:21: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                     ^
main.c:16:31: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                               ^
main.c:16:37: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                                     ^
main.c:16:49: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                                                 ^
main.c:16:55: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                                                       ^
main.c:16:67: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                                                                   ^
main.c:16:73: error: subscripted value is neither array nor pointer nor vector
   16 |       if(dif(A[i], C[j])+dif(B[i], D[j]) < dif(A[i], C[min])+dif(B[i], D[min])){
      |                                                                         ^
Language: C++

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;

int main(){
	int N,M;
	cin >> N >> M;
	int a[50],b[50],c[50],d[50];
	for(int i=0; i<N; i++) cin >> a[i] >> b[i];
	for(int i=0; i<M; i++) cin >> c[i] >> d[i];

	for(int i=0; i<N; i++){
		int ans = 0;
		int m = INT_MAX;
		for(int j=0; j<M; j++){
			if(abs(a[i]-c[j])+abs(b[i]-d[j]) < m){
				ans = j;
				m = abs(a[i]-c[j])+abs(b[i]-d[j]);
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: 'INT_MAX' was not declared in this scope
   28 |                 int m = INT_MAX;
      |                         ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <cassert>
  +++ |+#include <climits>
   17 | using namespace std;
Language: C++

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

int main() {
  int N, M;
  vector<int> a(N), b(N), c(M), d(M);
  for (int i=0; i<N; i++)
    cin >> a.at(i) >> b.at(i);
  for (int i=0; i<M; i++)
    cin >> c.at(i) >> d.at(i);
  int minmht = -1, minp=0;
  for (int i=0; i<N; i++) {
    for (int j=0; j<M; j++) {
      if (minmht==-1 || minmht>abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j))) {
        minp = j+1;
        minmht = abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j));
      }
    }
    cout << minp << endl;
    minmht = -1;
    minp = 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:53: error: 'abc' was not declared in this scope; did you mean 'abs'?
   14 |       if (minmht==-1 || minmht>abs(a.at(i)-c.at(j))+abc(b.at(i)-d.at(j))) {
      |                                                     ^~~
      |                                                     abs
Language: C++

#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(m);
    vector<int> d(m);
    vector<int> ans(n);
    int INF = 1 << 29;
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
    for (int i = 0; i < m; ++i) cin >> c[i] >> d[i];
    for (int i = 0; i < n; ++i) {
        int min = INF;
        for (int j = 0; j < m; ++j) {
            int t = (abs(a[i]-c[j]) + abs(b[i]-d[j]));
            if (t < min) {
                min = dis;
                ans[i] = j+1;
            }
        }
    }
    for (int i = 0; i < n; ++i) cout << ans[i] << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:30:23: error: 'dis' was not declared in this scope; did you mean 'div'?
   30 |                 min = dis;
      |                       ^~~
      |                       div
Language: C++

#include<cmath>
#include<iostream>
using namespace std;
const int MAXN = 51;
int a[MAXN], b[MAXN], c[MAXN], d[MAXN];
inline int dist(int x1, int y1, int x2, int y2) {
	return abs(x1-x2) + abs(y1-y2);
}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		cin >> a[i] >> b[i];
	}
	for (int j = 1; j <= M; j++) {
		cin >> c[j] >> d[j];
	}
	for (int i = 1; i <= N; i++) {
		int min_dist = dist(a[i], b[i], c[1], d[1]);
		int id = 1;
		for (int j = 2; j <= M; j++) {
			int cur_dist = dist(a[i], b[i], c[j], d[j]);
			if (cur_dist < min_dist) {
				min_dist = cur_dist;
				id=j; 
			}
		}
		cout<<j<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: 'j' was not declared in this scope
   28 |                 cout<<j<<endl;
      |                       ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n) 
#define all(a) (a).begin(), (a).end()
#define inf 10000000
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin>>n>>m;
    vector<long long> a(n),b(n),c(m),d(m),dist(m);
    vector<int> ans(n),tem(j);
    REP(i,n) cin>>a[i]>>b[i];
    REP(j,m) cin>>c[j]>>d[j];
    REP(i,n){
        int temp = inf;
        REP(j,m){
            dist[j] = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(dist[j]<temp){
                temp = dist[j];
                ans[i] = j;
            } else if (dist[j]==temp){
                ans[i] = min(tem[j], j);
            }
        }
    }
    
    REP(i,n) cout<<ans[i]+1<<endl; 
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: 'j' was not declared in this scope
   17 |     vector<int> ans(n),tem(j);
      |                            ^
Language: C++

#include<iostream>
using namespace std;
int n, m;
int main(){
  cin >> n >> m;
  const int nm = 50;
  int a[nm], b[nm], c[nm], d[nm];
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for(int j = 0; j < m; j++) cin >> c[i] >> d[i];
  
  for(int i = 0; i < n; i++){
    int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
    int checkpoint = 1;
    for(int j = 1; j < m; j++){
      const int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(mintwo < minone) {
        minone = mintwo;
        checkpoint = j + 1;
      }
    }
    cout << checkpoint << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:39: error: 'i' was not declared in this scope
    9 |   for(int j = 0; j < m; j++) cin >> c[i] >> d[i];
      |                                       ^
Language: C++

#include<iostream>
using namespace std;
int n, m;
int main(){
  cin >> n >> m;
  const int nm = 50;
  int a[nm], b[nm], c[nm], d[nm];
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for(int i = 0; i < m; i++) cin >> c[i] >> d[i];
  
  for(int i = 0; i < n; i++){
    int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
    int checkpoint = 1;
    for(int j = i; j < n; j++){
      int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(mintwo < minone) {
        minone = mintwo;
        checkpoint = j +1
      }
    }
    cout << checkpoint << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: expected ';' before '}' token
   18 |         checkpoint = j +1
      |                          ^
      |                          ;
   19 |       }
      |       ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n, m;
int main(){
  cin >> n >> m;
  const int nm = 50;
  int a[], b, c, d;
  for(int i = 0; i < n; i++) cin >> a >> b;
  for(int i = 0; i < m; i++) cin >> c >> d;
  
  for(int i = 0; i < n; i++){
    int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
    for(int j = i; j < n; j++){
      int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(mintwo < minone) minone = mintwo;
    }
    cout << minone << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: storage size of 'a' isn't known
    7 |   int a[], b, c, d;
      |       ^
a.cc:12:30: error: invalid types 'int[int]' for array subscript
   12 |     int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
      |                              ^
a.cc:12:42: error: invalid types 'int[int]' for array subscript
   12 |     int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
      |                                          ^
a.cc:12:49: error: invalid types 'int[int]' for array subscript
   12 |     int minone = abs(a[i] - c[0]) + abs(b[i] - d[i]);
      |                                                 ^
a.cc:14:32: error: invalid types 'int[int]' for array subscript
   14 |       int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      |                                ^
a.cc:14:44: error: invalid types 'int[int]' for array subscript
   14 |       int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      |                                            ^
a.cc:14:51: error: invalid types 'int[int]' for array subscript
   14 |       int mintwo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      |                                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int a[n],b[n],c[m],d[m];
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  for(int i=0;i<m;i++){
    cin>>c[i]>>d[i];
  }
  for(int i=0;i<n;i++){
    int mi=1000000000,e;
    for(int j=0;j<m;j++){
      if(mi>abs(a[i]-c[j])+abs(b[i]-d[i]){
        mi=abs(a[i]-c[j])+abs(b[i]-d[i]);
        e=j+1;
      }
         }
         cout<<e<<endl;
         }
         }
         

Compiler output:
a.cc: In function 'int main()':
a.cc:16:42: error: expected ')' before '{' token
   16 |       if(mi>abs(a[i]-c[j])+abs(b[i]-d[i]){
      |         ~                                ^
      |                                          )
a.cc:20:10: error: expected primary-expression before '}' token
   20 |          }
      |          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
const int INF = 1000000; // 十分大きな値
int n,m,a[60],b[60],c[60],d[60];
int func(int id){
	int best = INT_MAX;
	int ans = -1;
	REP(j,m){
		int dist = abs(a[id] -c[j]) + abs(b[id] -d[j]);
		if(dist < best){
			best = dist;
			ans = j;
		}
	}
	return ans + 1;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	REP(i,n)cin >> a[i] >> b[i];
	REP(j,m)cin >> c[j] >> d[j];
	REP(i,n)cout << func(i) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int func(int)':
a.cc:10:20: error: 'INT_MAX' was not declared in this scope
   10 |         int best = INT_MAX;
      |                    ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #include <string>
Language: C++

#include <iostream>
#include <vector>

int main() {
  int N, M;
  std::cin >> N >> M;
  std::vector<int> a(N), b(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> a[i] >> b[i];
  }
  std::vector<int> c(M), d(M);
  for (int i = 0; i < M; ++i) {
    std::cin >> c[i] >> d[i];
  }

  for (int i = 0; i < N; ++i) {
    int min = 0x1ffffff;
    int check = 0;
    for (int j = 0; j < M; ++j) {
      int d = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if ( d < min ) {
        min = d;
        check = j + 1;
      }
    }
    std::cout << check << std::endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:46: error: invalid types 'int[int]' for array subscript
   20 |       int d = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      |                                              ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<pii> AB(N), CD(M);
  for(int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    AB[i] = {a, b};
  }
  for(int j = 0; j < M; j++) {
  	int c, d;
    cin >> c >> d;
    CD[j] = {c, d};
  }
  for(int i = 0; i < N; i++) {
  	int ans = -1, dist = 1 << 30;
    for(int j = 0; j < M; j++) {
      int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
      if (dist > d) {
      	dist = d;
        ans = j;
      }  
    }
    cout << ans + 1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'pii' was not declared in this scope
    8 |   vector<pii> AB(N), CD(M);
      |          ^~~
a.cc:8:13: error: template argument 1 is invalid
    8 |   vector<pii> AB(N), CD(M);
      |             ^
a.cc:8:13: error: template argument 2 is invalid
a.cc:12:7: error: invalid types 'int[int]' for array subscript
   12 |     AB[i] = {a, b};
      |       ^
a.cc:17:7: error: invalid types 'int[int]' for array subscript
   17 |     CD[j] = {c, d};
      |       ^
a.cc:22:21: error: invalid types 'int[int]' for array subscript
   22 |       int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
      |                     ^
a.cc:22:35: error: invalid types 'int[int]' for array subscript
   22 |       int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
      |                                   ^
a.cc:22:54: error: invalid types 'int[int]' for array subscript
   22 |       int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
      |                                                      ^
a.cc:22:69: error: invalid types 'int[int]' for array subscript
   22 |       int d = abs(CD[j].first - AB[j].first) + abs(CD[j].second - AB[j].second);
      |                                                                     ^
Language: C++

#include <iostream>

using namespace std;

int main()
{
	long long i, j, k, N, M, a[50], b[50], c[50], d[50], dis, ans[50];

	cin >> N; cin >> M;
	for (i = 0; i < N; i++) {
		cin >> a[i];
		cin >> b[i];
	}
	for (i = 0; i < M; i++) {
		cin >> c[i];
		cin >> d[i];
	}

	for (i = 0; i < N; i++) {
		long long min = LLONG_MAX;
		for (j = 0; j < M; j++) {
			dis = llabs(a[i] - c[j]) + llabs(b[i] - d[j]);
			if (min > dis) {
				min = dis;
				ans[i] = j+1;
			}
		}
	}

	for (i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:33: error: 'LLONG_MAX' was not declared in this scope
   20 |                 long long min = LLONG_MAX;
      |                                 ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int Digits(int num){
  int cnt = 0;
  while(num > 0){
    num / 10;
    cnt++;
  }
  return cnt;
}

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A,B;
    int max_num;
    for(A = 1;A < sqrt(N);A++){
      for(B = 1;B<sqrt(N);B++){
        if(A * B == N){
          max_num = max(Digits(A),Digits(B));
        }
      }
    }
    cout << min_num << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:13: error: 'min_num' was not declared in this scope; did you mean 'max_num'?
   43 |     cout << min_num << endl;
      |             ^~~~~~~
      |             max_num
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n, m;
    cin >> n >> m;
    ll sx[n], sy[n], cx[m], cy[m];
    for (int i = 0; i < n; i++) {
        cin >> sx[i] >> sy[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> cx[i] >> cy[i];
    }
    ll d, min, min_num;
    for (int i = 0; i < n; i++) {
        min = LLONG_MAX;
        for (int j = 0; j < m; j++) {
            d = abs(sx[i] - cx[j]) + abs(sy[i] - cy[j]);
            if (min > d) {
                min = d;
                min_num = j;
            }
        }
        cout << min_num + 1 << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:28:15: error: 'LLONG_MAX' was not declared in this scope
   28 |         min = LLONG_MAX;
      |               ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 |
Language: C++

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

int main(){
  int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
  cin>>N>>M;
  for(i=0;i<N;i++){
    cin>>a[i]>>b[i];
  }
  for(i=0;i<M;i++){
    cin>>c[i]>>d[i];
  }
  for(int j=0;j<N;j++){
    d=100000001;
      ans=0;
  for(i=0;i<N;i++){
   if(d<abs(a[i]-c[i])+abs(b[i]-d[i])){
     ans=i+1;
     d=abs(a[i]-c[i])+abs(b[i]-d[i]);
   }
  }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:39: error: conflicting declaration 'int d [51]'
    5 |   int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
      |                                       ^
a.cc:5:19: note: previous declaration as 'int d'
    5 |   int N,M,i,ans=0,d,a[51],b[51],c[51],d[51];
      |                   ^
a.cc:11:17: error: invalid types 'int[int]' for array subscript
   11 |     cin>>c[i]>>d[i];
      |                 ^
a.cc:17:34: error: invalid types 'int[int]' for array subscript
   17 |    if(d<abs(a[i]-c[i])+abs(b[i]-d[i])){
      |                                  ^
a.cc:19:33: error: invalid types 'int[int]' for array subscript
   19 |      d=abs(a[i]-c[i])+abs(b[i]-d[i]);
      |                                 ^
Language: C++

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

int main(){
  int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
  cin>>N>>M;
  for(i=0;i<N;i++){
    cin>>a[i]>>b[i];
  }
  for(i=0;i<M;i++){
    cin>>c[i]>>d[i];
  }
  for(int j=0;j<N;j++){
    c=100000001;
      ans=0;
  for(i=0;i<N;i++){
   if(c<abs(a[i]-c[i])+abs(b[i]-d[i])){
     ans=i+1;
     c=abs(a[i]-c[i])+abs(b[i]-d[i]);
   }
  }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:33: error: conflicting declaration 'int c [51]'
    5 |   int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
      |                                 ^
a.cc:5:19: note: previous declaration as 'int c'
    5 |   int N,M,i,ans=0,c,a[51],b[51],c[51],d[51];
      |                   ^
a.cc:11:11: error: invalid types 'int[int]' for array subscript
   11 |     cin>>c[i]>>d[i];
      |           ^
a.cc:17:19: error: invalid types 'int[int]' for array subscript
   17 |    if(c<abs(a[i]-c[i])+abs(b[i]-d[i])){
      |                   ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |      c=abs(a[i]-c[i])+abs(b[i]-d[i]);
      |                  ^