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

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
	string s;
	vector<int> x;
	cin >>h>>w>> n;
	a = max(h, w);
	ans = n / a;
	if (n % a != 0)ans++;
	
	cout << ans <<endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: conflicting declaration 'std::vector<int> x'
    8 |         vector<int> x;
      |                     ^
a.cc:6:39: note: previous declaration as 'long long int x'
    6 |         long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
      |                                       ^
Language: C++

#include <bits/stdc++.h>
	
using namespace std;
	
#define endl "\n"
#define ll long long
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second


int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	int mx, mn, n;
	cin >> mx >> mn >> n;

	if(mn > mx) swap(mn, mx);

	int ans = 0;
	forn(i, mn + 1){
		if(mx*i >= n){
			cout << i << endl;
			return 0;
		}
	}


	return 0;
}
#include <bits/stdc++.h>
	
using namespace std;
	
#define endl "\n"
#define ll long long
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second


int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	int mx, mn, n;
	cin >> mx >> mn >> n;

	if(mn > mx) swap(mn, mx);

	int ans = 0;
	forn(i, mn + 1){
		if(mx*i >= n){
			cout << i << endl;
			return 0;
		}
	}


	return 0;
}


Compiler output:
a.cc:66:5: error: redefinition of 'int main()'
   66 | int main(){
      |     ^~~~
a.cc:24:5: note: 'int main()' previously defined here
   24 | int main(){
      |     ^~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
	string s;
	bool b, h[100000] = {false};
	vector<int> x;
	cin >>h>>w>> n;
	a = max(h, w);
	ans = n / a;
	if (n % a != 0)ans++;
	
	cout << ans <<endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: conflicting declaration 'bool b'
    8 |         bool b, h[100000] = {false};
      |              ^
a.cc:6:27: note: previous declaration as 'long long int b'
    6 |         long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
      |                           ^
a.cc:8:17: error: conflicting declaration 'bool h [100000]'
    8 |         bool b, h[100000] = {false};
      |                 ^
a.cc:6:57: note: previous declaration as 'long long int h'
    6 |         long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
      |                                                         ^
a.cc:9:21: error: conflicting declaration 'std::vector<int> x'
    9 |         vector<int> x;
      |                     ^
a.cc:6:39: note: previous declaration as 'long long int x'
    6 |         long long int a=0,b=0,c=0,n=0,x=0,ans=0,count=0,h,w ;
      |                                       ^
Language: C++

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

  int  H, W ,N ;
  cin  >> H >> W >> N ;
  int A = max(H,W) ;
  int B = min(H,W) ;
  rep(i,B+1){
    if(A*i>=N){
      cout << i << endl;
      retrun 0 ;
    }
  }
}

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

lines = readlines.map{|line| line.split(' ').map(&:to_f)}
puts (lines[2][0]/[lines[0][0],lines[1][0]].max).ceil

Compiler output:
a.cc:1:1: error: 'lines' does not name a type
    1 | lines = readlines.map{|line| line.split(' ').map(&:to_f)}
      | ^~~~~
a.cc:2:6: error: expected constructor, destructor, or type conversion before '(' token
    2 | puts (lines[2][0]/[lines[0][0],lines[1][0]].max).ceil
      |      ^
Language: C++

import math

H = int(input())
W = int(input())
N = int(input())

print(math.ceil(N / max(H, W)))


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int H, W, N;
	int result = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		this.H = Integer.parseInt(in.readLine());
		this.W = Integer.parseInt(in.readLine());
		this.N = Integer.parseInt(in.readLine());
	}

	void calc() {
		int row = Math.max(H, W);
		result = N / row;
		if (N % row != 0) {
			result++;
		}
	}

	void showResult() {
		System.out.println(result);
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
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.stream.Collectors;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.nio.charset.StandardCharsets;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main {
      | ^~~~~~
Language: C

#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,x,y,z,p,q;
    ll n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>i>>j>>k;
    if(i>j) j=i;
    i=k/j;
    if(k%j) i++;
    cout<<i<<endl;

    return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

int h,w,n;

void solve(){
    int i,j;
    string str;
    cin >> h >> w >> n;
    long long ans = 0;
    if(h > w){
        ans = (n+h-1)/h;
    }
    else{
        ans = (n+w-1)/w;
    }
    cout << ans << endl;
}

int main(){
    solve();
}
#include <bits/stdc++.h>

using namespace std;

int h,w,n;

void solve(){
    int i,j;
    string str;
    cin >> h >> w >> n;
    long long ans = 0;
    if(h > w){
        ans = (n+h-1)/h;
    }
    else{
        ans = (n+w-1)/w;
    }
    cout << ans << endl;
}

int main(){
    solve();
}


Compiler output:
a.cc:28:5: error: redefinition of 'int h'
   28 | int h,w,n;
      |     ^
a.cc:5:5: note: 'int h' previously declared here
    5 | int h,w,n;
      |     ^
a.cc:28:7: error: redefinition of 'int w'
   28 | int h,w,n;
      |       ^
a.cc:5:7: note: 'int w' previously declared here
    5 | int h,w,n;
      |       ^
a.cc:28:9: error: redefinition of 'int n'
   28 | int h,w,n;
      |         ^
a.cc:5:9: note: 'int n' previously declared here
    5 | int h,w,n;
      |         ^
a.cc:30:6: error: redefinition of 'void solve()'
   30 | void solve(){
      |      ^~~~~
a.cc:7:6: note: 'void solve()' previously defined here
    7 | void solve(){
      |      ^~~~~
a.cc:44:5: error: redefinition of 'int main()'
   44 | int main(){
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main(){
      |     ^~~~
Language: C++

#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
void chmax(T& m, T x) {
	m = std::max(m, x);
}

template <typename T>
void chmin(T& m, T x) {
	m = std::min(m, x);
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int h, w, n;
	scanf("%d\n%d\n%d", &h, &w & n);
	int bigger = max(h, w);
	printf("%d\n", (n / bigger) + n % bigger ? 1 : 0);
	return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/optional.hpp: No such file or directory
    2 | #include <boost/optional.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            long MOD = 1000000007;

            int H = sc.nextInt();
            int W = sc.nextInt();
            int N = sc.nextInt();

            int M = Math.max(H, W);

            int ans = (N + M - 1) / M;
            System.out.println(ans);
        }
    }

}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int H,W,N;cin >> H >> W >> N;
  int H = max(H,W);
  cout << (N+H-1)/H << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:7: error: redeclaration of 'int H'
   36 |   int H = max(H,W);
      |       ^
a.cc:35:7: note: 'int H' previously declared here
   35 |   int H,W,N;cin >> H >> W >> N;
      |       ^
Language: C

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int H,W,N;
    cin >> H >> W >> N;
    int div=max(H,W);
    cout << (N+div-1)/div << endl;
}

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

#include<iostream>
#include <numeric>
#include <algorithm>
#include<queue>
#include<vector>
using namespace std;
typedef pair<int, int> P;
int n, m, ans=0;

int main(){
  cin >> n;
  vector<int> x(n);
  vector<int> l(n);
  vector<P> ps(n);
  for(int i=0; i<n; i++){
    int a, b;
    cin >> a >> b;
    x[i] = a, l[i] = b;
    ps[i] = P(a+b, a-b);
  }
  sort(ps.begin(), ps.end());
  int cur = -1000000000;
  for(int i=0; i<n; i++){
    if(cur <= ps[i].seocnd){
      ans++;
      cur = ps[i].fist;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'seocnd'; did you mean 'second'?
   24 |     if(cur <= ps[i].seocnd){
      |                     ^~~~~~
      |                     second
a.cc:26:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'fist'; did you mean 'first'?
   26 |       cur = ps[i].fist;
      |                   ^~~~
      |                   first
Language: C++

#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
 
using namespace std;
     
    int main(){
      int N;
      cin >> N;
      vector<int> X(N), L(N);
      int c=0;
      for (int i=0; i<n; i++){
        cin >> X[i] >> L[i];
      }
      
    }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<pair<ll, ll>> v;
    rep(i, n) {
        ll x, l; cin >> x >> l;
        v.push_back(make_pair(x, l));
    }
    sort(all(v));
    ll ans = 1;
    ll now = v[0].first + v[0].second;
    rep(i, n-1) {
        if(now <= v[i+1].first - v[i+1].second) {
            ans++;
            now = v[i+1].first + v[i+1].second;
        }
    }
    ll can = 1;
    ll now = v[1].first + v[1].second;
    rep(i, n-2) {
        if(now <= v[i+2].first - v[i+2].second) {
            ans++;
            now = v[i+2].first + v[i+2].second;
        }
    }
    chmax(ans, can);
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:8: error: redeclaration of 'll now'
   32 |     ll now = v[1].first + v[1].second;
      |        ^~~
a.cc:24:8: note: 'll now' previously declared here
   24 |     ll now = v[0].first + v[0].second;
      |        ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 100002
int compare_int(const void *a,const void *b){
    return *(int *)a - *(int*) b;
}

struct robo{
    int X;
    int L;
    int end;
}

int main(){
    struct robo robot[MAX];
    int N;
    scanf("%d",&N);
    int X[MAX],L[MAX];
    int end[MAX];
    for(int i=1;i<=N;i++){
        scanf("%d %d",&robot[i].X,&robot[i].L);
        robot[i].end = robot[i].X + robot[i].L;
    }
    qsort(robot->end,N,sizeof(robot),compare_int);
    int ans=1,tmp=robot[1].X + robot[1].L;
    for(int i=2;i<=N;i++){
        if(tmp <= robot[i].X - robot[i].L){
            tmp = robot[i].X + robot[i].L;
            ans++;
        }
    }
    printf("%d",ans);
}


Compiler output:
main.c:18:1: error: expected ';', identifier or '(' before 'int'
   18 | int main(){
      | ^~~
main.c: In function 'main':
main.c:28:16: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   28 |     qsort(robot->end,N,sizeof(robot),compare_int);
      |           ~~~~~^~~~~
      |                |
      |                int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int (i)=int (a);i<=int (b);i++)
#define ff(i,a,b) for(int (i)=int(a);i<int (b);i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
const double eps=1e-5;
const double pi=acos(-1.0);
const int N=1e6+6,inf=1<<30;
pii p[N];
int x[N],l[N];
int n;
int main(){
	scanf("%d",&n);
	ff(i,0,n){
		scanf("%d%d",x+i,l+i);
	}
	ff(i,0,n){
		p[i]={x[i]+l[i],x[i]-l[i]};
	}
	sort(p,p+n);
	int ans=0;
	ff(i,0,n){
		if(cur<=p[i].se){
			ans++;
			cur=p[i].fi;
		}
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: 'cur' was not declared in this scope
   31 |                 if(cur<=p[i].se){
      |                    ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <time.h>
using namespace std;
typedef long long ll;

struct Edge {
	int from;
	int to;
};

bool cmprFrom(Edge e1, Edge e2)
{
	if (e1.from < e2.from) {
		return true;
	}
	return false;
}

void main()
{
	int N; cin >> N;
	vector<int> X(N), L(N);
	vector<Edge> E(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> L[i];
		E[i].from = X[i] - L[i];
		E[i].to = X[i] + L[i];
	}
	sort(E.begin(), E.end(), cmprFrom);
	auto it = E.begin();
	auto nt = it; ++nt;
	while(nt != E.end()){
		if (it->to > nt->from) {
			if (it->to > nt->to) {
				it = E.erase(it);
				nt = it; ++nt;
			}
			else {
				nt = E.erase(nt);
			}
		}
		else {
			it = nt;
			++nt;
		}
	}
	cout << E.size() << endl;;
}


Compiler output:
a.cc:23:1: error: '::main' must return 'int'
   23 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |         sort(E.begin(), E.end(), cmprFrom);
      |         ^~~~
      |         short
Language: C++

#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

int main(void){
   int N;
   cin>>N;
   vector<long long> X(N),L(N);
   for(int i=0;i<N;i++){
      cin>>X[i]>>L[i];
   }
   vector<pair<long long,long long>> range(N);
   for(int i=0;i<N;i++){
      range[i]=make_pair(X[i]+L[i],X[i]-L[i]);
   }
   sort(range.begin(),range.end());
   int ans=0;
   long long now=-1000000007;
   for(int i=0;i<N;i++){
      if(range[i].second>=now){
         ans++;
         now=range[i].first;
      }
   }
   cout<<ans<<endl;
   return 0;
}#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

int main(void){
   int N;
   cin>>N;
   vector<long long> X(N),L(N);
   for(int i=0;i<N;i++){
      cin>>X[i]>>L[i];
   }
   vector<pair<long long,long long>> range(N);
   for(int i=0;i<N;i++){
      range[i]=make_pair(X[i]+L[i],X[i]-L[i]);
   }
   sort(range.begin(),range.end());
   int ans=0;
   long long now=-1000000007;
   for(int i=0;i<N;i++){
      if(range[i].second>=now){
         ans++;
         now=range[i].first;
      }
   }
   cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc:30:2: error: stray '#' in program
   30 | }#include<bits/stdc++.h>
      |  ^
a.cc:30:3: error: 'include' does not name a type
   30 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:33:5: error: redefinition of 'int dy [4]'
   33 | int dy[4]={1,0,-1,0};
      |     ^~
a.cc:4:5: note: 'int dy [4]' previously defined here
    4 | int dy[4]={1,0,-1,0};
      |     ^~
a.cc:34:5: error: redefinition of 'int dx [4]'
   34 | int dx[4]={0,1,0,-1};
      |     ^~
a.cc:5:5: note: 'int dx [4]' previously defined here
    5 | int dx[4]={0,1,0,-1};
      |     ^~
a.cc:35:21: error: redefinition of 'std::vector<std::vector<int> > graph'
   35 | vector<vector<int>> graph;
      |                     ^~~~~
a.cc:6:21: note: 'std::vector<std::vector<int> > graph' previously declared here
    6 | vector<vector<int>> graph;
      |                     ^~~~~
a.cc:37:5: error: redefinition of 'int main()'
   37 | int main(void){
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main(void){
      |     ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

int main() {
    auto n = 0;
    std::cin >> n;

    auto robots = std::vector<std::pair<std::int64_t, std::int64_t>>();
    for (auto i_ = 0; i_ < n; ++i_) {
        auto x = std::int64_t(0);
        auto l = std::int64_t(0);
        std::cin >> x >> l;
        robots.emplace_back(x, l);
    }

    std::sort(robots.begin(), robots.end(), [](const auto& a, const auto& b) { return a.first < b.first; });

    auto range = robots.front().first + robots.front().second;
    auto counter = -1;
    for (const auto& [x, l] : robots) {
        if (range <= (x - l)) {
            range = x + l;
        } else {
            counter++;

            if (range > (x + l)) {
                range = x + l;
            }
        }
    }

    std::cout << n - counter << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:46: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   10 |     auto robots = std::vector<std::pair<std::int64_t, std::int64_t>>();
      |                                              ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/bits/stl_algo.h:71,
                 from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc:10:60: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   10 |     auto robots = std::vector<std::pair<std::int64_t, std::int64_t>>();
      |                                                            ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc:10:60: error: template argument 1 is invalid
   10 |     auto robots = std::vector<std::pair<std::int64_t, std::int64_t>>();
      |                                                            ^~~~~~~
a.cc:10:60: error: template argument 2 is invalid
a.cc:10:67: error: template argument 1 is invalid
   10 |     auto robots = std::vector<std::pair<std::int64_t, std::int64_t>>();
      |                                                                   ^~
a.cc:10:67: error: template argument 2 is invalid
a.cc:12:23: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   12 |         auto x = std::int64_t(0);
      |                       ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc:13:23: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   13 |         auto l = std::int64_t(0);
      |                       ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;

int x[N], l[N];
pair<int, int> ps[N];

int main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> l[i];
    }
    for (int i = 0; i < n; i++) {
        ps[i] = make_pair(x[i] + l[i], x[i] - l[i]);
    }
    sort(ps, ps + n);
    int cur = INT_MIN, cnt = 0;
    for (int i = 0; i < n; i++) {
        if (cur <= ps[i].second) {
            ++cnt;
            cur = ps[i].first;
        }
    }
    cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |     cout << ans << '\n';
      |             ^~~
      |             abs
Language: C++

#include<iostream>
using namespace std;
int main()
{
  long long n,x,l,t,m,c=0;
  cin>>n;
  m=n;
  cin>>x>>l;
  t=x+l;
  while(n>1)
  {
    cin>>x>>l;
    if(t<x)
    {
      c++;
      t=(x+l);
    }
    n--;
  }
  cout<<m-c<<endl;
  return 0
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: expected ';' before '}' token
   21 |   return 0
      |           ^
      |           ;
   22 | }
      | ~
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		
		LinkedList<Pair2> list = new LinkedList<>();
		
		for(int i = 0; i < n; i++) {
			int x = scan.nextInt();
			int l = scan.nextInt();
			list.add(new Pair2(x-l,x+l));
		}
		scan.close();
		
		list.sort(comparing(Pair2::getSecond));
		int num = 0;
		while(!list.isEmpty()) {
			int x = list.removeFirst().second;
			list = list.stream().filter(pair -> pair.first >= x).collect(Collectors.toCollection(LinkedList::new));
			num++;
		}
		System.out.println(num);
	}
}

class Pair2 {
	int first; 
	int second;
	
	public Pair2(int first, int second) {
		this.first = first;
		this.second = second;
	}
	
	public int getSecond() {
		return second;
	}
	
	public String toString() {
		return first + ":" + second;
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
		LinkedList<Pair2> list = new LinkedList<>();
		^
  symbol:   class LinkedList
  location: class Main
Main.java:7: error: cannot find symbol
		LinkedList<Pair2> list = new LinkedList<>();
		                             ^
  symbol:   class LinkedList
  location: class Main
Main.java:16: error: cannot find symbol
		list.sort(comparing(Pair2::getSecond));
		          ^
  symbol:   method comparing(Pair2::getSecond)
  location: class Main
Main.java:20: error: cannot find symbol
			list = list.stream().filter(pair -> pair.first >= x).collect(Collectors.toCollection(LinkedList::new));
			                                                             ^
  symbol:   variable Collectors
  location: class Main
Main.java:20: error: cannot find symbol
			list = list.stream().filter(pair -> pair.first >= x).collect(Collectors.toCollection(LinkedList::new));
			                                                                                     ^
  symbol:   class LinkedList
  location: class Main
7 errors
Language: C++

#include <iostream>
#include <iomanip>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll n;
    cin >> n;
    pair<ll, ll> range[n];
    repi(i, n, 0)
    {
        ll x, l;
        cin >> x >> l;
        range[i].second = max(x - l + 1, 0); //開始
        range[i].first = x + l - 1;          //終了
    }
    sort(range, range + n);

    ll ans = 0, t = -1;
    repi(i, n, 0)
    {
        if (t < range[i].second)
        {
            ans++;
            t = range[i].first;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: no matching function for call to 'max(ll, int)'
   20 |         range[i].second = max(x - l + 1, 0); //開始
      |                           ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:20:30: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   20 |         range[i].second = max(x - l + 1, 0); //開始
      |                           ~~~^~~~~~~~~~~~~~
/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,
                 from a.cc:4:
/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:20:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   20 |         range[i].second = max(x - l + 1, 0); //開始
      |                           ~~~^~~~~~~~~~~~~~
Language: C++

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

typedef pair<int, int> P;

const int MAX_N = 100000;
const int MAX_V = 1000000000;

int N;
int X[MAX_N];
int L[MAX_N];

void input(){
  cin>>N;
  for(int i = 0; i < N; i++){
    cin>>X[i]>>L[i];
  }
}

P ps[MAX_N];

int solve(){
  for(int i = 0; i < N; i++){
    ps[i] = P(X[i] + L[i], X[i] - L[i]);
  }
  
  sort(ps.begin(), ps.end());
  int cur = -MAX_V;
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(cur <= ps[i].second){
      ans++;
      cur = ps[i].first;
    }
  }
  return ans;
}



Compiler output:
a.cc: In function 'int solve()':
a.cc:27:11: error: request for member 'begin' in 'ps', which is of non-class type 'P [100000]' {aka 'std::pair<int, int> [100000]'}
   27 |   sort(ps.begin(), ps.end());
      |           ^~~~~
a.cc:27:23: error: request for member 'end' in 'ps', which is of non-class type 'P [100000]' {aka 'std::pair<int, int> [100000]'}
   27 |   sort(ps.begin(), ps.end());
      |                       ^~~
Language: C++

bool pairCompare(const P& firstElof, const P& secondElof){
  return firstElof.second < secondElof.second;
}

int main(){
  int n;
  int cnt=0;
  cin >> n;
  vector <int> x(n),l(n);
  vector <P> p(n);
  rep(i,n)cin >> x[i] >> l[i];
  rep(i,n){
    p[i]=P(x[i]-l[i],x[i]+l[i]);
  }
  sort(p.begin(),p.end(),pairCompare);
  //rep(i,n)cout << p[i].first << " " << p[i].second << endl;;
  int right=p[0].second;
  cnt+=1;
  for(int i=1;i<n;i++){
    if(p[i].first<right)continue;
    right=p[i].second;
    cnt+=1;
  }
  cout << cnt << endl;
}


Compiler output:
a.cc:1:24: error: 'P' does not name a type
    1 | bool pairCompare(const P& firstElof, const P& secondElof){
      |                        ^
a.cc:1:44: error: 'P' does not name a type
    1 | bool pairCompare(const P& firstElof, const P& secondElof){
      |                                            ^
a.cc: In function 'bool pairCompare(const int&, const int&)':
a.cc:2:20: error: request for member 'second' in 'firstElof', which is of non-class type 'const int'
    2 |   return firstElof.second < secondElof.second;
      |                    ^~~~~~
a.cc:2:40: error: request for member 'second' in 'secondElof', which is of non-class type 'const int'
    2 |   return firstElof.second < secondElof.second;
      |                                        ^~~~~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> n;
      |   ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector <int> x(n),l(n);
      |   ^~~~~~
a.cc:9:11: error: expected primary-expression before 'int'
    9 |   vector <int> x(n),l(n);
      |           ^~~
a.cc:10:11: error: 'P' was not declared in this scope
   10 |   vector <P> p(n);
      |           ^
a.cc:10:14: error: 'p' was not declared in this scope
   10 |   vector <P> p(n);
      |              ^
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   rep(i,n)cin >> x[i] >> l[i];
      |       ^
a.cc:11:3: error: 'rep' was not declared in this scope
   11 |   rep(i,n)cin >> x[i] >> l[i];
      |   ^~~
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(p.begin(),p.end(),pairCompare);
      |   ^~~~
      |   short
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << cnt << endl;
      |   ^~~~
a.cc:24:18: error: 'endl' was not declared in this scope
   24 |   cout << cnt << endl;
      |                  ^~~~
Language: C++

public sealed class Program : BaseProgram
    {
        public static void Main(string[] _)
        {
          Solve();
        }
        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var machines = new List<Tuple<long, long>>();
            for (int i = 0; i < n; i++)
            {
                var xl = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
                var x = xl[0];
                var l = xl[1];
                machines.Add(Tuple.Create(x - l, x + l));
            }

            var count = n;
            var rightLimit = long.MinValue;
            foreach (var t in machines.OrderBy(m => m.Item2))
            {
                if (t.Item1 < rightLimit)
                {
                    count--;
                }
                else
                {
                    rightLimit = Math.Max(t.Item2, rightLimit);
                }
            }
            Console.WriteLine(count);
        }
    }

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'public'
    1 | public sealed class Program : BaseProgram
      | ^~~~~~
Language: C++

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

int n,ans = 0;
int now = -pow(10,7);
vector<pair<int,int>> v;

void input(){
    cin >> n;
    rep(i,n){
        ll x,l = 0; cin >> x >> l;
        v.push_back(make_pair(x-l,x+l));
    }
    sort(v.begin(),v.end());
    rep(i,n){
        if(v[i].second < now) continue;
        else{
            now = v[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int n,ans = 0;
int now = -pow(10,7);
vector<pair<int,int>> v;

void input(){
    cin >> n;
    rep(i,n){
        ll x,l = 0; cin >> x >> l;
        v.push_back(make_pair(x-l,x+l))
    }
    sort(v.begin(),v.end());
    rep(i,n){
        if(v[i].second < now) continue;
        else{
            now = v[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'void input()':
a.cc:14:40: error: expected ';' before '}' token
   14 |         v.push_back(make_pair(x-l,x+l))
      |                                        ^
      |                                        ;
   15 |     }
      |     ~
Language: C++

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

int n,ans = 0;
int now = -pow(10,7);
vector<p> v;

void input(){
    cin >> n;
    rep(i,n){
        ll x,l = 0; cin >> x >> l;
        v.push_back(make_pair(x-l,x+l))
    }
    sort(v.begin(),v.end());
    rep(i,n){
        if(v[i].second < now) continue;
        else{
            now = v[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:5:7: error: expected nested-name-specifier
    5 | using pair<int,int> p;
      |       ^~~~~~~~~~~~~
a.cc:9:8: error: 'p' was not declared in this scope
    9 | vector<p> v;
      |        ^
a.cc:9:9: error: template argument 1 is invalid
    9 | vector<p> v;
      |         ^
a.cc:9:9: error: template argument 2 is invalid
a.cc: In function 'void input()':
a.cc:15:11: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   15 |         v.push_back(make_pair(x-l,x+l))
      |           ^~~~~~~~~
a.cc:17:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   17 |     sort(v.begin(),v.end());
      |            ^~~~~
a.cc:17:22: error: request for member 'end' in 'v', which is of non-class type 'int'
   17 |     sort(v.begin(),v.end());
      |                      ^~~
a.cc:19:13: error: invalid types 'int[int]' for array subscript
   19 |         if(v[i].second < now) continue;
      |             ^
a.cc:21:20: error: invalid types 'int[int]' for array subscript
   21 |             now = v[i].first;
      |                    ^
Language: C++

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

int n,ans = 0;
int now = -pow(10,7);
vector<p> v;

void input(){
    cin >> n;
    rep(i,n){
        ll x,l = 0; cin >> x >> l;
        v.push_back(make_pair(x-l,x+l))
    }
    sort(v.begin(),v.end());
    rep(i,n){
        if(v[i].second < now) continue;
        else{
            now = v[i].first;
            ans++
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:5:7: error: expected nested-name-specifier
    5 | using pair<int,int> p;
      |       ^~~~~~~~~~~~~
a.cc:9:8: error: 'p' was not declared in this scope
    9 | vector<p> v;
      |        ^
a.cc:9:9: error: template argument 1 is invalid
    9 | vector<p> v;
      |         ^
a.cc:9:9: error: template argument 2 is invalid
a.cc: In function 'void input()':
a.cc:15:11: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   15 |         v.push_back(make_pair(x-l,x+l))
      |           ^~~~~~~~~
a.cc:17:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   17 |     sort(v.begin(),v.end());
      |            ^~~~~
a.cc:17:22: error: request for member 'end' in 'v', which is of non-class type 'int'
   17 |     sort(v.begin(),v.end());
      |                      ^~~
a.cc:19:13: error: invalid types 'int[int]' for array subscript
   19 |         if(v[i].second < now) continue;
      |             ^
a.cc:21:20: error: invalid types 'int[int]' for array subscript
   21 |             now = v[i].first;
      |                    ^
a.cc:22:18: error: expected ';' before '}' token
   22 |             ans++
      |                  ^
      |                  ;
   23 |         }
      |         ~
Language: C++

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

int main(){
	ll n; cin >> n;
	vl x(n); vl l(n); rep(i,n)cin >> x[i] >> l[i];
	vector<P> d(n); 
	rep(i,n){
		d[i].first = x[i] + l[i];
		d[i].second = x[i] - l[i];
	}
	sort(d.begin(), d.end());
	reverse()
	ll ans = 1; ll t = d[0].first;
	rep(i,n){
		if(d[i].second >= t){
			ans++;
			t = d[i].first;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: no matching function for call to 'reverse()'
   17 |         reverse()
      |         ~~~~~~~^~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   candidate expects 2 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 0 provided
a.cc:21:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |                         ans++;
      |                         ^~~
      |                         abs
a.cc:25:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include <iostream>
#include <vector>
#include <climits>

using namespace std;

bool comp(pair<int, int> p1, pair<int, int> p2) {
    return p1.second < p2.second;
}

void print_pair_vec(const vector<pair<int, int>> &v) {
    for(auto itr = v.begin(); itr != v.end(); ++itr) {
        cout << "(" << itr->first << ", " << itr->second << ")" << endl;
    }
}

int main() {
    vector<pair<int, int>> v;

    int N; cin >> N;
    for(int i = 0; i < N; ++i) {
        int x, l; cin >> x >> l;
        v.push_back(make_pair(x-l, x+l));
    }

    sort(v.begin(), v.end(), comp);

    // print_pair_vec(v);

    int current = INT_MIN;
    int c = 0;
    for(auto itr = v.begin(); itr != v.end(); ++itr) {
        // cout << "current = " << current << endl;
        int f = itr->first;
        int s = itr->second;
        // cout << "f, s = " << f << ", " << s << endl;

        // 選択する場合
        if(f >= current) {
            current = s;
            ++c;

        // 選択しない場合
        }
    }

    cout << c << endl;
}


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

#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
const int MAX_N = 100000;
const int MAX_V = 1000000000;
int N;
int X[MAX_N];
int L[MAX_N];
void input(){
scanf("%d", &N);
for(int i = 0; i < N; ++i){
scanf("%d%d", X + i, L + i);
}
}
P ps[MAX_N];
int solve(){
for(int i = 0; i < N; ++i){
2
ps[i] = P(X[i] + L[i], X[i] - L[i]);
}
sort(ps, ps + N);
int cur = -MAX_V;
int ans = 0;
for(int i = 0; i < N; ++i){
if(cur <= ps[i].second){
ans++;
cur = ps[i].first;
}
}
return ans;
}
int main(){
input();
int ans = solve();
printf("%d\n", ans);
return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:20:2: error: expected ';' before 'ps'
   20 | 2
      |  ^
      |  ;
   21 | ps[i] = P(X[i] + L[i], X[i] - L[i]);
      | ~~
Language: C++

#include<cstdio>
#include<utility>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;

const int MAX_N=100000;
const int MAX_V= 1000000000;

int N;
int X[MAX_N];
int L[MAX_V];

void input(){
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d%d",X+i,L+i);
    }
}

P ps[MAX_N];

int solve(){
    for (int i=0;i<N;i++){
        ps[i] = P(X[i]+L[i],X[i]-L[i]);
    }
    sort(ps,ps+N);
    
    int cur=-MAX_V;
    int ans = 0;
    for(int i=0;i<N;i++){
        if(cur<=ps[i].second){
            ans++;
            cur =ps[i].first;
        }
    }
    return ans;
}

int main(){
    input();
    int ans = solve();
    printf("%d\n",ans);
    return 0;
}



Compiler output:
/tmp/cclYje5t.o: in function `solve()':
a.cc:(.text+0x128): relocation truncated to fit: R_X86_64_PC32 against symbol `ps' defined in .bss section in /tmp/cclYje5t.o
a.cc:(.text+0x164): relocation truncated to fit: R_X86_64_PC32 against symbol `ps' defined in .bss section in /tmp/cclYje5t.o
a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `ps' defined in .bss section in /tmp/cclYje5t.o
a.cc:(.text+0x1a4): relocation truncated to fit: R_X86_64_PC32 against symbol `ps' defined in .bss section in /tmp/cclYje5t.o
a.cc:(.text+0x1c4): relocation truncated to fit: R_X86_64_PC32 against symbol `ps' defined in .bss section in /tmp/cclYje5t.o
collect2: error: ld returned 1 exit status