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

#include <iostream>
#include <vector>


int main() {
	int n;
	std::cin >> n;
	int* x = new int[n];
	int* l = new int[n];
	for (int i = 0; i < n; ++i) {
		std::cin >> x[i] >> l[i];
	}

	int allPattern_num = pow(2, n);
	std::vector<std::string> flag(allPattern_num);

	for (int i = 0; i < allPattern_num; ++i) {
		flag[i].resize(n + 1);
	}

	int temp = allPattern_num / 2;
	char t = '0';
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < allPattern_num; ++j) {
			flag[j][i] = t;
			if (j % temp == temp - 1) {
				t++;
				if (t == '2') {
					t = '0';
				}
				if (j == allPattern_num - 1) {
					temp /= 2;
				}
			}
		}
	}

	int max = 0;

	for (int k = 0; k < allPattern_num; ++k) {
		bool huragu = true;
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				if (flag[k][i] == '1'&& flag[k][j] == '1' && !((x[i] + l[i] <= x[j] - l[j]) || (x[i] - l[i] >= x[j] + l[j]))) {
					huragu = false;
				}
			}
		}
		if (huragu) {
			int tempN = 0;
			for (int i = 0; i < n; ++i) {
				if (flag[k][i] == '1') tempN++;
			}
			if (max < tempN) max = tempN;
		}
	}


	std::cout <<  max;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'pow' was not declared in this scope
   14 |         int allPattern_num = pow(2, n);
      |                              ^~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    
    int N;
    
    cin  >> N;
    int X[N];
    int L[N];
    int Y[N], Z[N];

    for (int i = 0; i < N; ++i)
    {
        cin >> X[i] >> L[i];
        Y[i] = X[i] + L[i];
        Z[i] = X[i] - L[i];
    }
    
    int s = N;
    int A = 0;
    
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < N; ++j)
        {
            if (i != j){
                //if(( Z[i] < Z[j] && Z[j] < Y[i]) || (Z[i] < Y[j] && Y[j] < Y[i] ) )
                if(( Z[i] < Z[j] && Z[j] < Y[i]) )
                {
                    ++A;
                    //cout << A << endl;
                } else if((Z[i] < Y[j] && Y[j] < Y[i] ))
                {
                    ++A;
                }
            }
        }
        if (s > A && A != 0) s = A;
        //cout << s << endl;
        A = 0;
    }
    if (s == N) 
    {
        cout << N << endl;
    } else
    {
        cout << N - s << endl;       
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:50:6: error: expected '}' at end of input
   50 |     }
      |      ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	int* x = new int[n];
	int* l = new int[n];
	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> l[i];
	}

	int allPattern_num = pow(2, n);
	vector<string> flag(allPattern_num);

	for (int i = 0; i < allPattern_num; ++i) {
		flag[i].resize(n + 1);
	}

	int temp = allPattern_num / 2;
	char t = '0';
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < allPattern_num; ++j) {
			flag[j][i] = t;
			if (j % temp == temp - 1) {
				t++;
				if (t == '2') {
					t = '0';
				}
				if (j == allPattern_num - 1) {
					temp /= 2;
				}
			}
		}
	}

	int max = 0;

	for (int k = 0; k < allPattern_num; ++k) {
		bool huragu = true;
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				if (flag[k][i] == '1'&& flag[k][j] == '1' && !((x[i] + l[i] <= x[j] - l[j]) || (x[i] - l[i] >= x[j] + l[j]))) {
					huragu = false;
				}
			}
		}
		if (huragu) {
			int tempN = 0;
			for (int i = 0; i < n; ++i) {
				if (flag[k][i] == '1') tempN++;
			}
			if (max < tempN) max = tempN;
		}
	}


	cout <<  max;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:30: error: 'pow' was not declared in this scope
   15 |         int allPattern_num = pow(2, n);
      |                              ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define MAX(a, b)  a>b?a:b

struct area {
	area(int x, int l):min(x-l), max(x+l){}
	int min, max;
	operator<(const area &x) { return min<x.min; }
};

int main()
{
	int n;
	int x, l;

	vector<area> robot;

	cin>>n;

	for(int i=0 ; i<n ; i++){
		cin>>x>>l;
		robot.push_back(area(x,l));
	}

	sort(robot.begin(), robot.end());

	auto itr = robot.begin();
	itr++;

	while(itr != robot.end()) {
		if(itr->min < (itr-1)->max) {
			itr = robot.erase(itr);
		} else {
			itr++;
		}

	}

	cout<<robot.size()<<endl;

#if 0
	itr = robot.begin();
	while(itr != robot.end()) {
		cout<<itr->min<<endl;
		itr++;
	}
#endif

	return 0;
}


Compiler output:
a.cc:14:9: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   14 |         operator<(const area &x) { return min<x.min; }
      |         ^~~~~~~~
Language: Java

import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int robo = sc.nextInt();
		int[] plus = new int[robo];
		int[] minus = new int[robo];
		int x = 0;
		int l = 0;
		int count = 0;
		for (int i = 0; i < robo - 1; i++){
			x = sc.nextInt();
			l = sc.nextInt();
			plus[i] = x + l;
			minus[i] = x - l;
			if (plus[i] > minus[p - 1]){
				count++;
			}
		}
		System.out.plint(count);
	}
}

Compiler output:
Main.java:17: error: cannot find symbol
			if (plus[i] > minus[p - 1]){
			                    ^
  symbol:   variable p
  location: class Main
Main.java:21: error: cannot find symbol
		System.out.plint(count);
		          ^
  symbol:   method plint(int)
  location: variable out of type PrintStream
2 errors
Language: C++

// C++ program for activity selection problem 
// when input activities may not be sorted. 
#include <bits/stdc++.h> 
using namespace std; 

// A job has a start time, finish time and profit. 
struct Activitiy 
{ 
	int start, finish; 
}; 

// A utility function that is used for sorting 
// activities according to finish time 
bool activityCompare(Activitiy s1, Activitiy s2) 
{ 
	return (s1.finish < s2.finish); 
} 

// Returns count of the maximum set of activities that can 
// be done by a single person, one at a time. 
void printMaxActivities(Activitiy arr[], int n) 
{ 
	// Sort jobs according to finish time 
	sort(arr, arr+n, activityCompare); 

	//cout << "Following activities are selected n"; 

	// The first activity always gets selected 
	int i = 0; 
  	int count = 0;
	//cout << "(" << arr[i].start << ", " << arr[i].finish << "), "; 
	count++;
	// Consider rest of the activities 
	for (int j = 1; j < n; j++) 
	{ 
	// If this activity has start time greater than or 
	// equal to the finish time of previously selected 
	// activity, then select it 
	if (arr[j].start >= arr[i].finish) 
	{ 
		//cout << "(" << arr[j].start << ", "
		//	<< arr[j].finish << "), "; 
      	count++;
		i = j; 
	} 
	} 
  	cout<<count<<endl;
} 

// Driver program 
int main() 
{ 
  	int n,i;
  	cin>>n;
  	Activity arr[n];
  	for(i=0;i<n;i++){
      int a,b;
      cin>>a;
      cin>>b;
      arr[i].start = a-b+1;
      arr[i].finish = a+b-1;
    } 
	printMaxActivities(arr, n); 
	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'Activity' was not declared in this scope; did you mean 'Activitiy'?
   55 |         Activity arr[n];
      |         ^~~~~~~~
      |         Activitiy
a.cc:60:7: error: 'arr' was not declared in this scope
   60 |       arr[i].start = a-b+1;
      |       ^~~
a.cc:63:28: error: 'arr' was not declared in this scope
   63 |         printMaxActivities(arr, n);
      |                            ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#define n 10000000000

int main(){
	int N, i, j,k; //ロボットの個数N
  	scanf("%d", &N);
  	int X[N], L[N]; 
  	int *y
  	int count=0, loop=1, loop2=1; //取り除いた回数 count, loop=1
  
  	y = (int *)malloc(n * sizeof(int)); //メモリの確保
  	
  
  	for(i=0; i++; i<N){
    	scanf("%d, %d", &X[i], L[i]);
    }
  	for(i=0; i++; i<n){
      y[i] = 0; //初期化
    }
  	
  	while(loop){
      	loop2++;
    	for(j=0;j++;j<N){
          while(loop2){
	          for(k=X[j]-L[j];k++;k<=X[j]+L[j]){
    	      	if(y[k]==0){
        	    	y[k]++;
            	}
            	else{
            		loop2--;
                  	j=N;
                  	X[k] =-1,L[k] = 0, count++; //ロボットの除去
            	}
          	}	
          }
        }
      	if(loop2==1){
        	loop==0;
        }
    }
  	
  	
  	printf("%d",N - count);

}


Compiler output:
main.c: In function 'main':
main.c:9:15: error: expected ';' before 'int'
    9 |         int *y
      |               ^
      |               ;
   10 |         int count=0, loop=1, loop2=1; //取り除いた回数 count, loop=1
      |         ~~~    
main.c:12:9: error: 'y' undeclared (first use in this function)
   12 |         y = (int *)malloc(n * sizeof(int)); //メモリの確保
      |         ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

// C++ program for activity selection problem 
// when input activities may not be sorted. 
#include <bits/stdc++.h> 
using namespace std; 

// A job has a start time, finish time and profit. 
struct Activitiy 
{ 
	int start, finish; 
}; 

// A utility function that is used for sorting 
// activities according to finish time 
bool activityCompare(Activitiy s1, Activitiy s2) 
{ 
	return (s1.finish < s2.finish); 
} 

// Returns count of the maximum set of activities that can 
// be done by a single person, one at a time. 
void printMaxActivities(Activitiy arr[], int n) 
{ 
	// Sort jobs according to finish time 
	sort(arr, arr+n, activityCompare); 

	//cout << "Following activities are selected n"; 

	// The first activity always gets selected 
	int i = 0; 
  	int count = 0;
	//cout << "(" << arr[i].start << ", " << arr[i].finish << "), "; 
	count++;
	// Consider rest of the activities 
	for (int j = 1; j < n; j++) 
	{ 
	// If this activity has start time greater than or 
	// equal to the finish time of previously selected 
	// activity, then select it 
	if (arr[j].start >= arr[i].finish) 
	{ 
		//cout << "(" << arr[j].start << ", "
		//	<< arr[j].finish << "), "; 
      	count++;
		i = j; 
	} 
	} 
  	cout<<count<<endl;
} 

// Driver program 
int main() 
{ 
  	int n;
  	cin>>n;
  	Activity arr[n];
  	for(i=0;i<n;i++){
      int a,b;
      cin>>a;
      cin>>b;
      arr[i].start = a-b+1;
      arr[i].finish = a+b-1;
    } 
	printMaxActivities(arr, n); 
	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'Activity' was not declared in this scope; did you mean 'Activitiy'?
   55 |         Activity arr[n];
      |         ^~~~~~~~
      |         Activitiy
a.cc:56:13: error: 'i' was not declared in this scope
   56 |         for(i=0;i<n;i++){
      |             ^
a.cc:60:7: error: 'arr' was not declared in this scope
   60 |       arr[i].start = a-b+1;
      |       ^~~
a.cc:63:28: error: 'arr' was not declared in this scope
   63 |         printMaxActivities(arr, n);
      |                            ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#define n 10000000000

int main(){
	int N, i, j,k; //ロボットの個数N
  	scanf("%d", &N);
  	int X[N], L[N]; 
  	int y = (int *)malloc(n * sizeof(int)); //直線の配列
  	int count=0, loop=1, loop2=1; //取り除いた回数 count, loop=1
  
  	for(i=0; i++; i<N){
    	scanf("%d, %d", &X[i], L[i]);
    }
  	for(i=0; i++; i<n){
      y[i] = 0; //初期化
    }
  	
  	while(loop){
      	loop2++;
    	for(j=0;j++;j<N){
          while(loop2){
	          for(k=X[j]-L[j];k++;k<=X[j]+L[j]){
    	      	if(y[k]==0){
        	    	y[k]++;
            	}
            	else{
            		loop2--;
                  	j=N;
                  	X[k] =-1,L[k] = 0, count++; //ロボットの除去
            	}
          	}	
          }
        }
      	if(loop2==1){
        	loop==0;
        }
    }
  	
  	
  	printf("%d",N - count);

}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: initialization of 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
    9 |         int y = (int *)malloc(n * sizeof(int)); //直線の配列
      |                 ^
main.c:16:8: error: subscripted value is neither array nor pointer nor vector
   16 |       y[i] = 0; //初期化
      |        ^
main.c:24:21: error: subscripted value is neither array nor pointer nor vector
   24 |                 if(y[k]==0){
      |                     ^
main.c:25:26: error: subscripted value is neither array nor pointer nor vector
   25 |                         y[k]++;
      |                          ^
Language: C++

int main() {

int N;
 cin >> N;
 int X[N],L[N];
 for(int i=0;i<N;i++){
 cin >>X[i]>>L[i];
 }
 int a=0,b=0,c=0;
for(int j=0;j<N;j++){
 for(int i=0;i<N;i++){
 if(X[i]<X[i+1]){
 a=X[i];
 b=L[i];
 X[i]=X[i+1];
 L[i]=L[i+1];
 X[i+1]=a;
 L[i+1]=b;}}}

 for(int i=0;i<N-1;i++){
 a=i;
 c=i;
 if((X[i]+L[i])>(X[i+1]-L[i+1]))
 {
 while((X[a]+L[a])>X[c+1])
    {
    if((X[a]+L[a])>(X[c+1]+L[c+1]))
        {
            a=c+1;
            c++;
         }
     else c++;
  if(c==N) break;
   }
     if(c==N) break;
   }
i=a;
b++; }
cout<<b<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:2: error: 'cin' was not declared in this scope
    4 |  cin >> N;
      |  ^~~
a.cc:39:1: error: 'cout' was not declared in this scope
   39 | cout<<b<<endl;}
      | ^~~~
a.cc:39:10: error: 'endl' was not declared in this scope
   39 | cout<<b<<endl;}
      |          ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
struct robot{
	int x;
	int l;
};
typedef struct robot robot;
vector<robot> a(100000);
bool cmp(robot o,robot p){
	return o.x<p.x;
}
int main(){
	int n;
	cin>>n;
	int cnt=n;
	for(int i=0;i<n;i++)cin>>a[i].x>>a[i].l;
	sort(a.begin(),a.begin()+n,cmp);
	for(int i=1;i<n;i++){
		if(a[i-1].l+a[i].l>a[i].x-a[i-1].x){
			a.erase(a.begin()+i);
			cnt--;
		}
	}
	cout<<cnt<<'\n';
}

Compiler output:
a.cc:9:1: error: 'vector' does not name a type
    9 | vector<robot> a(100000);
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:17:34: error: 'a' was not declared in this scope
   17 |         for(int i=0;i<n;i++)cin>>a[i].x>>a[i].l;
      |                                  ^
a.cc:18:14: error: 'a' was not declared in this scope
   18 |         sort(a.begin(),a.begin()+n,cmp);
      |              ^
Language: Java

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // KEYENCE-B - Robot Arms

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] x = new int[n];
        int[] l = new int[n];

        HashMap<Integer,Integer> map = new HashMap<>();

        int p = 0;
        int cnt = 0;
        int max = 0;

        int p2 = 0;
        int cnt2 = 0;

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            l[i] = sc.nextInt();
            map.put(x[i],l[i]);
            if (max < x[i]) max = x[i];

        }

        Arrays.sort(x);

        for (int i = 0; i < n; i++) {
            if (cnt == 0 ||
                x[i] - map.get(x[i]) > p) {
                p = x[i];
                cnt++;
            } else if (x[i - 1] + map.get(x[i - 1]) > x[i] - map.get(x[i])) {
                p = x[i];
            }
        }

        System.out.println(cnt > cnt2 ? cnt : cnt2);
    }

Compiler output:
Main.java:47: error: reached end of file while parsing
    }
     ^
1 error
Language: C


#include<iostream>
using namespace std;
int main(){
    struct SEGMENT{
        int x;
        int y;
    };
    int n,si,ei,pos,k,tmp,i,cur;
    struct SEGMENT seg[101];
        cin>>n;
        pos = 0;
        
        while(n--){
            cin>>si>>ei;
            seg[pos].x=si;
            seg[pos].y=ei;
            pos++;
        }
        //BubbleSort
        for(k=1;k<pos;k++){
            for(i=0;i<pos-k;i++){
                if(seg[i].y>seg[i+1].y){
                    //swap
                    tmp=seg[i+1].y;
                    seg[i+1].y=seg[i].y;
                    seg[i].y=tmp;
                    tmp=seg[i+1].x;
                    seg[i+1].x=seg[i].x;
                    seg[i].x=tmp;
                }
            }
        }
        //main process
        cur=seg[0].y;
        int cnt=1;
        for(k=1;k<pos;k++){
            if(seg[k].x>=cur){
                cur=seg[k].y;
                cnt++;
            }
        }
        cout<<cnt<<endl;
    
    return 0;
}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

n = int(input())
arr = []
for i in range(n):
    x,y= map(int,input().split())
    res = [x-y+1+100000000000,x+y-1+100000000000]
    arr.append(res)
arr.sort()
if n==1:
    print(n)
else:
    end = arr[0][1]
    mini = 0
    for i in range(1,n):
        if arr[i][0] < end:
            end = min(end,arr[i][1])
            mini+=1
        else:
            end =arr[i][1]
    print(n-mini)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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

int main() {

int N;
 cin >> N;
 int X[N],L[N];
 for(int i=0;i<N;i++){
 cin >>X[i]>>L[i];
 }
 int a=0,b=0;
 for(i=0;i<N-1;i++){
 a=i;
 c=i;
 if((X[i]+L[i])>(X[i+1]-L[i+1]))
 {
 while((X[a]+L[a])>X[c+1])
    {
    if((X[a]+L[a])>(X[c+1]+L[c+1])
        {
            a=c+1;
            c++;
         }
     else c++;
     if(c==N) break;
     }
     if(c==N) break;
i=a;
b++; }
cout<<b<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:6: error: 'i' was not declared in this scope
   13 |  for(i=0;i<N-1;i++){
      |      ^
a.cc:15:2: error: 'c' was not declared in this scope
   15 |  c=i;
      |  ^
a.cc:25:6: error: expected primary-expression before 'else'
   25 |      else c++;
      |      ^~~~
a.cc:24:11: error: expected ')' before 'else'
   24 |          }
      |           ^
      |           )
   25 |      else c++;
      |      ~~~~  
a.cc:20:7: note: to match this '('
   20 |     if((X[a]+L[a])>(X[c+1]+L[c+1])
      |       ^
a.cc:31:16: error: expected '}' at end of input
   31 | cout<<b<<endl;}
      |                ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include <stdio.h>
#include <string.h>
long X[100100];
long L[100100];

int main(){

	long int i,j,cnt=0,N;
	int ans;
	int war;
	
	scanf("%ld",&N);
	
	for(i=0;i<N;i++){
		scanf("%ld %ld",&X[i],&L[i]);
	}
	
	for(i=0;i<N-1;i++){
		if(XL[i]==0){
		long st = X[i]-L[i]>0? X[i]-L[i]: 0;
		long end = X[i]+L[i];
		for(j=i+1;j<N;j++){
			long st2 = X[j]-L[j]>0? X[j]-L[j]: 0;
			long end2 = X[j]+L[j];
			if(end <= st2 || st >= end2);
			else {
				//printf("%ld,%ld:%ld < %ld, %ld > %ld\n",i,j,end,st2,st,end2);
				cnt++;
				XL[j]=1;
				break;
			}
		}
		}
	}
	
	
	printf("%ld\n",N-cnt);	//printf("%ld %ld*(%ld - %ld)\n", cnt,edge,K,sa);
 return 0;
 }

Compiler output:
main.c: In function 'main':
main.c:19:20: error: 'XL' undeclared (first use in this function); did you mean 'L'?
   19 |                 if(XL[i]==0){
      |                    ^~
      |                    L
main.c:19:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
#include <queue>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define mp make_pair
#define forn(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    vector<pair<int,double>> a(2*n);
    forn(i,n)
    {
        int x,l;
        scanf("%d%d",&x,&l);
        a[2*i].f=x-l;
        a[2*i].s=i+1+((double)l)/(double)(1e9+1.0);
        a[2*i+1].f=x+l;
        a[2*i+1].s=-i-1-(double)l/(1e9+1.0);
//        printf("%f %f\n",a[2*i].s,a[2*i+1].s);
    }
    sort(a.begin(),a.end());
//    for(auto i:a)
//    {
//        printf("%d %f\n",i.f,i.s);
//    }
    vi vis(n+5);
    int res=0;
    double going=0;
    forn(i,2*n)
    {
        if(vis[(int)(a[i].s>0.0?a[i].s:-a[i].s)]==0)
        {
            if(a[i].s>0.0&&going!=0)
            {
                vis[((int)(a[i].s>0.0?a[i].s:-a[i].s)]=1;
                res++;
            }
            else if(a[i].s>0.0)
            {
                going = a[i].s;
            }
            else if(a[i].s<0.0&&going == abs(a[i].s))
            {
                going = 0;
            }
        }
    }
    printf("%d\n",n-res);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:54: error: expected ')' before ']' token
   50 |                 vis[((int)(a[i].s>0.0?a[i].s:-a[i].s)]=1;
      |                     ~                                ^
      |                                                      )
a.cc:50:57: error: expected ']' before ';' token
   50 |                 vis[((int)(a[i].s>0.0?a[i].s:-a[i].s)]=1;
      |                                                         ^
      |                                                         ]
a.cc:50:57: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int n;
int s[100000], f[100000];
pair<int, int> itv[100000];
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, l;
        cin >> x >> l;
        s[i] = x - l;
        f[i] = x + l;
    }
    for (int i = 0; i < n; i++) {
        itv[i].first = f[i];
        itv[i].second = s[i];
    }
    sort(itv, itv + n);
    int ans = 0, t = itv[0].second - 10;
    for (int i = 0; i < n; i++) {
        if (t <= itv[i].second) {
            ans++;
            t = itv[i].first;
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(itv, itv + n);
      |     ^~~~
      |     short
Language: C++

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

using lli = long long;
#define X first
#define Y second

int main() {
  int n;
  cin >> n;
  
  vector<pair<lli, lli>> v(n);
  for (auto &x : v) {
    cin >> v.X >> v.Y;
    v.X -= v.Y;
    v.Y += v.Y;
    v.Y += v.X;
  }
  
  sort(v.begin(), v.end(), [](auto a, auto b) {
    if (a.Y == b.Y) return a.X < b.X;
    return a.Y < b.Y;
  });
  
  lli ri = -1E18, bk = 0;
  for (auto x : v) {
    if (x.X < ri) ++bk;
    ri = x.Y;
  }
  
  cout << n - bk << "\n";
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
    5 | #define X first
      |           ^~~~~
a.cc:14:14: note: in expansion of macro 'X'
   14 |     cin >> v.X >> v.Y;
      |              ^
a.cc:6:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
    6 | #define Y second
      |           ^~~~~~
a.cc:14:21: note: in expansion of macro 'Y'
   14 |     cin >> v.X >> v.Y;
      |                     ^
a.cc:5:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
    5 | #define X first
      |           ^~~~~
a.cc:15:7: note: in expansion of macro 'X'
   15 |     v.X -= v.Y;
      |       ^
a.cc:6:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
    6 | #define Y second
      |           ^~~~~~
a.cc:15:14: note: in expansion of macro 'Y'
   15 |     v.X -= v.Y;
      |              ^
a.cc:6:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
    6 | #define Y second
      |           ^~~~~~
a.cc:16:7: note: in expansion of macro 'Y'
   16 |     v.Y += v.Y;
      |       ^
a.cc:6:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
    6 | #define Y second
      |           ^~~~~~
a.cc:16:14: note: in expansion of macro 'Y'
   16 |     v.Y += v.Y;
      |              ^
a.cc:6:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
    6 | #define Y second
      |           ^~~~~~
a.cc:17:7: note: in expansion of macro 'Y'
   17 |     v.Y += v.X;
      |       ^
a.cc:5:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
    5 | #define X first
      |           ^~~~~
a.cc:17:14: note: in expansion of macro 'X'
   17 |     v.Y += v.X;
      |              ^
Language: C++

#include<bits/stdc++.h>
#define N 1000000010
//#define int long long
#define INF 1e9
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus;
}
int o[N], sum[N];
signed main()
{
	int t = read();
	int n = t;
	int maxr(0);
	while(t -- )
	{
		int x = read(), len = read();
		int l = max(x - len, 0), r = x + len;
		maxr = max(maxr, r);
		//printf("l = %d r + 1 = %d\n",l,r + 1);
		o[l] += 1;
		o[r + 1] -= 1;
	}
	int maxn(0);
	rep(i, 0, maxr)
	{
		sum[i] = sum[i - 1] + o[i];
		//printf("%d ",sum[i]);
		if(sum[i] > maxn && sum[i - 1] > maxn) 
		{
			maxn = sum[i];
		}
		//maxn = max(maxn, sum[i]);
	}
	//printf("n = %d \n maxn = %d \n",n,maxn);
	printf("%d\n",n - maxn + 1);
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:9:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |         register char cc = getchar();register int cn(0), flus(1);
      |                       ^~
a.cc:9:51: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |         register char cc = getchar();register int cn(0), flus(1);
      |                                                   ^~
a.cc:9:58: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |         register char cc = getchar();register int cn(0), flus(1);
      |                                                          ^~~~
a.cc: In function 'int main()':
a.cc:30:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         rep(i, 0, maxr)
      |             ^
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i, l, r) for(register int i = l; i <= r; ++ i)
      |                                       ^
/tmp/ccyiVl7f.o: in function `main':
a.cc:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccyiVl7f.o
a.cc:(.text+0x14b): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccyiVl7f.o
a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccyiVl7f.o
a.cc:(.text+0x17c): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccyiVl7f.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccyiVl7f.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    cin >> n;
    int all_e = 0;
    vector<int> x(n), l(n), e(n, 0);
    for (int i = 0; i < n; ++i) {
        cin >> x.at(i) >> l.at(i);
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (x.at(i) < x.at(j) and (x.at(i) + l.at(i) - 1) >= x.at(j) - l.at(j) + 1) {
                ++all_e;
                ++e.at(i);
                ++e.at(j);
            } else if ( x.at(i) > x.at(j) and (x.at(i) - l.at(i) + 1) <= x.at(j) + l.at(j) - 1) {
                ++all_e;
                ++e.at(i);
                ++e.at(j);
            }
        }
    }
    sort(e.begin(), e.end(), std::greater<int>());
    for (int x : e) {
        if (all_e <= 0) {
            cout << n << endl;
            return 0;
        }
        all_e -= x;
        --n;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |     sort(e.begin(), e.end(), std::greater<int>());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::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;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  long long x[n], l[n];
  typedef pair<long long, long long> P;
  vector<P> xl;
  REP(i,n){
    cin>>x[i]>>l[i];
    xl.push_back(P(x[i], l[i]));
  }
  auto cmp = [](P a, P b){
    long long ar = a.first + a.second;
    long long br = b.first + b.second;
    return ar < br;
  }
  sort(ALL(xl), cmp);
  REP(i,n){
    x[i] = xl[i].first;
    l[i] = xl[i].second;
  }
  long long dp[n][2] = {};
  vector<long long> xpl;
  REP(i,n){
    if(i == 0){
      dp[i][0] = 0;
      dp[i][1] = 1;
      xpl.push_back(x[i] + l[i]);
      continue;
    }
    dp[i][0] = max(dp[i-1][0], dp[i-1][1]);
    long long cnt = upper_bound(ALL(xpl), x[i]-l[i]) - xpl.begin();
    dp[i][1] = cnt;
  }
  long long ans = max(dp[n-1][0], dp[n-1][1]);
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:3: error: expected ',' or ';' before 'sort'
   85 |   sort(ALL(xl), cmp);
      |   ^~~~
Language: C++

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

int main(){
  int64_t N; cin >> N;
  if(N==1){
    cout << 1 << endl;
    return 0;
  }
  vector<pair<int64_t, int64_t>> MY(N);
  for(int i=0;i<N;i++){
    cin >> MY[i].first >> MY[i].second;
  }
  sort(MY.begin(), MY.end());
  int64_t ans=1;
  int64_t nowf=MY[0].first;
  int64_t nows=MY[0].second;
  for(int i=1;i<N;i++){
    if(MY[i].first-nowf>=MY[i].second+nows){
      ans++;
      nowf=MY[i].first;
      nows=MY[i].second;
    }
    else if{
      if(nowf+nows>=MY[i].first+MY[i].second){
        nowf=MY[i].first;
        nows=MY[i].second;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: expected '(' before '{' token
   24 |     else if{
      |            ^
      |            (
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;

const int MAX_N = 100005;


int main(int argc, char *args[]) {
	int n; cin >> n;
	vector<int> x(n);
	vector<int> l(n);
	vector<pair<int, int> > range(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> l[i];
		range[i].first = x[i] + l[i];
		range[i].second = x[i] - l[i];
	}
	sort(range.begin(), range.end());
	int ans = 0, t = -INT_MAX;
	for (int i = 0; i < n; i++) {
		if (t <= range[i].second) {
			ans++;
			t = range[i].first;
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:46:27: error: 'INT_MAX' was not declared in this scope
   46 |         int ans = 0, t = -INT_MAX;
      |                           ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   23 | #include <numeric>
  +++ |+#include <climits>
   24 | #define rep(i,n) for (int i = 0; i < (n); ++i)
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}

//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}

//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}

//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}



int main(){
  cin >> n;
  vector<pair<int ,int>> p(n);

  rep(i, n) {
    int a, b;
    cin >> a >> b;
    p[i] = make_pair(a, b);
  }

  sort(p.begin() ,p.end());

  int ans = n;
  rep(i, n-1){
    if((p[i].first + p[i].second) > (p[i+1].first - p[i+1].second)) {
      ans--;
      i++;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   36 |   cin >> n;
      |          ^
      |          yn
Language: C++

import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        int n, x, l;
        n = sc.nextInt();
        int lx, ll;
        lx = 0;
        ll = 0;
        boolean isGone = false;
        int[][] pair = new int[n][2];
        for (int i = 0; i < n; i++) {
            x = sc.nextInt();
            l = sc.nextInt();
            pair[i][0] = x;
            pair[i][1] = l;
        }
        Arrays.sort(pair, (a, b) -> Integer.compare(a[0], b[0]));
        for (int i = 0; i < n; i++) {
            x = pair[i][0];
            l = pair[i][1];
            if (i != 0) {
                if (lx + ll > x - l && !isGone) {
                    ans++;
                    isGone = true;
                } else {
                    isGone = false;
                }
            }
            lx = x;
            ll = l;
        }
        System.out.println(n - ans);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.math.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MAXN = 100010;

int n;
pair < int, int > a[MAXN];

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

  cin >> n;
  for(int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;

  sort(a, a + n);

  vector<int> f(n + 1);

  fill(f.begin(), f.end(), (int) 1e9 + 7);
  f[0] *= -1;

  int ans = 0;
  for(int i = 0; i < n; ++i) {
    auto p = upper_bound(f.begin(), f.end(), a[i].first - a[i].second) - f.begin();
    ans = max(ans, p);
    f[p] = min(f[p], a[i].first + a[i].second);

  }

  cout << ans;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: no matching function for call to 'max(int&, long int&)'
   26 |     ans = max(ans, p);
      |           ~~~^~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   26 |     ans = max(ans, p);
      |           ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |     ans = max(ans, p);
      |           ~~~^~~~~~~~
Language: C++

#include <iostream>
using namespace std;
#define MAX_N 110000
typedef long long ll;
ll N, X[MAX_N], L[MAX_N];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> X[i] >> L[i];
  pair<ll, ll> itv[MAX_N];
  for (int i = 0; i < N; i++) {
    itv[i].first = X[i] + L[i];
    itv[i].second = X[i] - L[i];
  }

  sort(itv, itv + N);

  ll ans = 0, t = -10000000000;
  for (int i = 0; i < N; i++) {
    if (t <= itv[i].second) {
      ans++;
      t = itv[i].first;
    }
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(itv, itv + N);
      |   ^~~~
      |   short
Language: C++


#include <iostream>
#include <string>
//#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
//#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 21474836

int N;
vector<pair<long long, long long>> GS;


int main() {	

	cin >> N;

	rep(i,N)
	{
		long long x, l;
		cin >> x >> l;
		GS.push_back(make_pair(x + l, x - l));
	}

	sort(GS.begin(), GS.end());

	int now = GS[0].first;
	int ans = 1;

	rep(i, N-1) {
		if (GS[i + 1].second >= now) {
			now = GS[i + 1].first;
			ans++;
		}
	}


	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   34 |         sort(GS.begin(), GS.end());
      |         ^~~~
      |         sqrt
Language: C++

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

struct interval {
  int s, f;
  interval(int s, int f) : s(s), f(f) { }
};
bool compare_f(const interval &x, const interval &y) {
  return x.f < y.f;
}
vector<interval> interval_scheduling(vector<interval> J) {
  vector<interval> A;
  sort(J.begin(), J.end(), compare_f);
  int f = -1e9;
  for (int i = 0; i < J.size(); ++i) {
    if (J[i].s >= f) {
      A.push_back(J[i]);
      f = J[i].f;
    }
  }
  return A;
}

void solve(long long N, std::vector<long long> X, std::vector<long long> L){
    vector<interval> vec;
    for(int i = 0;i < N;i++){
        vec.push_back(interval(X[i]-L[i], X[i]+L[i]-1));
    }
    cout<<interval_scheduling(vec).size()<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(X), std::move(L));
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>

//using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

using ll =  long long;

//constexpr int inf = 1e9 + 7;
constexpr int inf = INT_MAX;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}
}


int main() {

	int n;
	std::cin >> n;
	std::vector<std::pair<ll, ll>> xl(n);
	rep(i, n) std::cin >> xl[i].first >> xl[i].second;

	std::sort(allof(xl));

	// 各ロボットのスタートと終わり
	std::vector<std::pair<ll, ll>> se;
	rep(i, n) {
		se.push_back(std::make_pair(xl[i].first + xl[i].second - 1, xl[i].first - xl[i].second + 1));
	}

	std::sort(allof(se));

	// 貪欲

	int ans = 0;

	ll t = -1e9 - 7;
	// 終了時刻を早いものにする
	rep(i, n) {
		if (t < se[i].second) {
			++ans;
			t = se[i].first;	
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Compiler output:
a.cc:32:21: error: 'INT_MAX' was not declared in this scope
   32 | constexpr int inf = INT_MAX;
      |                     ^~~~~~~
a.cc:22:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   21 | #include <functional>
  +++ |+#include <climits>
   22 |
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
		System.err.println();
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		ArrayList<Pair<Integer,Integer>>robots=new ArrayList<>(n);

		for(int i=0;i<n;++i)
			robots.add(new Pair<>(s.nextInt(),s.nextInt()));

		robots.sort(null);

		robots.forEach(System.err::println);
      	hoge
	}
}

class Pair<A extends Comparable<A>,B extends Comparable<B>> implements Comparable<Pair<A,B>>{
	A	a;
	B	b;

	public Pair(A A,B B){
		a=A;
		b=B;
	}
	public Pair(Pair<A,B> p){
		this(p.a,p.b);
	}

	public Pair<B,A> swapped(){
		return new Pair<>(b,a);
	}

	@Override
	public String toString(){
		return "P["+a+", "+b+"]";
	}

	@Override
	public int compareTo(Pair<A,B> o){
		int v=a.compareTo(o.a);
		if(v!=0)
			return v;
		return b.compareTo(o.b);
	}

	@Override
	public int hashCode(){
		return Objects.hashCode(a)*31+Objects.hashCode(b);
	}

	@Override
	public boolean equals(Object obj){
		if(this==obj) return true;
		if(!(obj instanceof Pair))
			return false;
		Pair<?,?> other=(Pair<?,?>)obj;
		return Objects.equals(a,other.a)&&Objects.equals(b,other.b);
	}
}

Compiler output:
Main.java:16: error: not a statement
      	hoge
      	^
Main.java:16: error: ';' expected
      	hoge
      	    ^
2 errors
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
    int n;
    cin >> n;
    P p[100002];
    for(int i = 0; i < n; i++){
        ll x, l;
        cin >> x >> l;
        p[i] = P(x, l);
    }
    sort(p, p + n);
    ll r = -100000000000;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(p[i].first - p[i].second >= r){
            ans++;
            r = p[i].first + p[i].second;
        }
        else{
            r = min(r, p[i].first + p[i].second);
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |     sort(p, p + n);
      |     ^~~~
      |     short
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>

#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())

using namespace std;
using ll = int64_t;

struct Range {
  ll begin, end;
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;
  vector<Range> ranges(N);
  for (auto& range : ranges) {
    ll X, L;
    cin >> X >> L;
    range.begin = X - L;
    range.end = X + L;
  }
  sort(all(ranges), [](auto lhs, auto rhs) {
    return lhs.end < rhs.end;
  });
  ll current_end = numeric_limits<ll>::min(), answer = 0;
  for (auto range : ranges) {
    if (range.begin >= current_end) {
      current_end = range.end;
      ++answer;
    }
  }
  cout << answer << endl;


  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<Range, std::allocator<Range> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = Range]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
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:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

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

int main(){

  long long N, K, S;
  cin>>N>>K>>S;
  
  for(i=0; i<N; i++){
    
    if(i<K){
      cout<<S<<" ";
    }else{
      if(S==1000000000){
        cout<<999999999<<" ";
      }else{
        cout<<1000000000<<" ";
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0; i<N; i++){
      |       ^