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

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

int n, m;
int l[300010];
int r[300010];
int sum[300010];
int ans[300010];
vector<int> dv[100010];

vector<int> divisor(int n){
	vector<int> res;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			res.push_back(i);
			if(i!=n/i) res.push_back(n/i);
		}
	}
    sort(all(res));
    reverse(all(res));
	return res;
}

signed main(){
    cin >> n >> m;
    rep(i, 1, n + 1){
        d[i] = divisor(i);
    }
    rep(i, 0, n){
        cin >> l[i] >> r[i];
        int b = r[i] - l[i] + 1;
        if(l[i] <= b){
            sum[1]++;
            sum[r[i] + 1]--;
        }else{
            sum[l[i]]++;
            sum[r[i] + 1]--;
            sum[1]++;
            sum[b + 1]--;
            rep(j, l[i], r[i] + 1){
                rep(k, 0, dv[j].size()){
                    if(dv[j][k] <= b) break;
                    if(dv[j][k] >= l[i]) continue;
                    ans[dv[j][k]]++;
                }
                // for(int k = 2;; k++){
                //     if(j / k <= b) break;
                //     if(j % k == 0) ans[j / k]++;
                // }
            }
        }
    }
    rep(i, 1, 300010){
        sum[i] += sum[i - 1]; 
    }
    rep(i, 1, m + 1){
        cout << ans[i] + sum[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'd' was not declared in this scope
   33 |         d[i] = divisor(i);
      |         ^
Language: C++

#include <iostream>
using namespace std;
int main(){
	int n, m;
	cin >> n >> m;
	int l[n+1], r[n+1];
	for(int i=0; i<=n; i++){
		cin >> i[i] >> r[i];
	}
	int s[m];
	int a;
	for(int i=0; i<m; i++) s[i]=0;
	for(int i=0; i<=n; i++){
		a=r[i]-l[i];
		for(int j=0; j<a; j++){	s[j]+=1; }
	}
	
	for(int i=0; i<m; i++){
		cout << s[i] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: invalid types 'int[int]' for array subscript
    8 |                 cin >> i[i] >> r[i];
      |                         ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

const int BIT_MAX = 300010;

template <class T> class BIT{
	T x[BIT_MAX + 1];
	
public:
	
	BIT(){
		fill(x,x+BIT_MAX+1,0);
	}
	
	void add(int a , T b){
		for(; a <= BIT_MAX ; a += a & -a) x[a] += b;
	}
	
	T get(int a){
		T b = 0;
		for(; a > 0 ; a -= a & -a) b += x[a];
		return b;
	}
};

BIT<int> bit;
int N,M;
int ans[3333

int main(){
	scanf("%d%d" , &N , &M);
	repp(i,0,N){
		int l,r,x,y,s,t;
		scanf("%d%d" , &l , &r);
		x = l;
		y = r;
		repp(j,2,351){
			int s = (l-1)/j + 1;
			int t = r/j;
			if(x<t){
				x = s;
			} else {
				bit.add(x,1);
				bit.add(y+1,-1);
				x = s;
				y = t;
			}
			if(x<352) break;
		}
		bit.add(x,1);
		bit.add(y+1,-1);
		repp(j,1,351){
			if(r-l+1>=j || l % j > r % j || l % j == 0) ++ans[j];
		}
	}
	int z = min(351,M+1);
	repp(i,1,z){
		printf("%d\n" , ans[i]);
	}
	repp(i,351,M+1){
		printf("%d\n" , bit.get(i) - bit.get(i-1));
	}
	return 0;
}


Compiler output:
a.cc:48:13: error: expected ']' before 'int'
   48 | int ans[3333
      |             ^
      |             ]
   49 | 
   50 | int main(){
      | ~~~
Language: C++

zbr ak ioi
wa ha ha ha hhhhh
i'm fucking coming!

Compiler output:
a.cc:3:2: warning: missing terminating ' character
    3 | i'm fucking coming!
      |  ^
a.cc:3:2: error: missing terminating ' character
    3 | i'm fucking coming!
      |  ^~~~~~~~~~~~~~~~~~
a.cc:1:1: error: 'zbr' does not name a type
    1 | zbr ak ioi
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long P=1000000007,n,k,f[10001],i,j;
long long w(long long a,long long x)
{
    if(x<0)
        return 1;
    long long s=1000000007;
    while(x)
        if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1;
    return s;
}

int main( )
{
    cin>>n>>k;
    f[0]=1000000007;
    for(i=1;i<n;++i)
        for(j=i;j;--j)
            f[j]=(f[j+1]+f[j-1])%P,f[0]=f[1];
    cout<<f[n-k]*w(2ll,n-k-1)%P;
    return 0;
}

Compiler output:
a.cc: In function 'long long int w(long long int, long long int)':
a.cc:10:36: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   10 |         if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1;
      |                            ~~~~~~~~^~
      |                               |     |
      |                               |     long long int
      |                               __gnu_cxx::__promote<double>::__type {aka double}
Language: C++


#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 2005, MOD = 1000000007;
typedef long long i64;

int N, K;
i64 fac[MAX_N], ifac[MAX_N], inv[MAX_N], bin[MAX_N];
i64 f[MAX_N][MAX_N], sum[MAX_N];

i64 binom(int n, int m) {
  if (n < m) return 0;
  return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;
}

int main() {
  scanf("%d%d", &N, &K);
  fac[0] = ifac[0] = inv[1] = bin[0] = 1;
  for (int i = 1; i <= N; ++i) fac[i] = fac[i - 1] * i % MOD;
  for (int i = 2; i <= N; ++i) inv[i] = -(MOD / i) * inv[MOD % i] % MOD;
  for (int i = 1; i <= N; ++i) ifac[i] = ifac[i - 1] * inv[i] % MOD;
  for (int i = 1; i <= N; ++i) bin[i] = (bin[i - 1] + bin[i - 1]) % MOD;
  
  f[0][0] = 1;

  for (int i = 0; i <= N; ++i) {
    for (int j = 0; i + j <= N; ++j) {
      if (j > 0) f[i][j] = f[i][j - 1];
      if (i > 0) f[i][j] = (f[i][j] + sum[i + j]) % MOD;
    }
    for (int j = 0; i + j < N; ++j) {
      //s - i - 1 = j
      sum[i + j + 1] = (sum[i + j + 1] + f[i][j]) % MOD;
    }
  }

  i64 res = 0;
  for (int i = 2; i <= N; ++i) {
    if (K - 1 - N + i < 0) continue;
    res = (res + binom(i - 2, N - K - 1) * bin[N - K - 1] % MOD * f[N - i][K - 1 - N + i] % MOD) % MOD;
  }
  if (K == N) res = f[N - 1][0];
  printf("%lld\n", (res + MOD) % MOD);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: 'scanf' was not declared in this scope
   19 |   scanf("%d%d", &N, &K);
      |   ^~~~~
a.cc:45:3: error: 'printf' was not declared in this scope
   45 |   printf("%lld\n", (res + MOD) % MOD);
      |   ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include <cstring>
  +++ |+#include <cstdio>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
const int MOD=1e9+7;
#define SZ 5123
LL comb[SZ][SZ];
LL pow2[SZ];
LL C[SZ][SZ];
struct latte{
    latte(){
        pow2[0]=1;
        FOR(i,1,SZ)(pow2[i]=pow2[i-1]<<1)%=MOD;
        REP(i,SZ)comb[i][0]=comb[i][i]=1;
        FOR(i,2,SZ){
            FOR(j,1,SZ){
                comb[i][j]=(comb[i-1][j-1]+comb[i-1][j])%MOD;
            }
        }
        REP(i,SZ)REP(j,SZ)C[i][j]=0;
        C[0][0]=1;
        REP(i,SZ-1){
            FOR(j,0,SZ-1){
                C[i+1][j+1]+=C[i][j];
                C[i+1][0]+=MOD-C[i][j];
            }
            for(int j=SZ-1;j>0;j--)
                (C[i+1][j-1]+=C[i+1][j])%=MOD;
        }
    }
}malta;

inline LL nHr(LL n,LL r){
    return comb[n+r-1][r];
}
int main(){
    int N,K;
    cin>>N>>K;
    LL res=0;
    REP(i,K){
        int n=i;
        int r=K-i-1;
        LL ans=0;
        REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD;    
        ans%=MOD;
        (res+=ans*comb[N-n-2][r]%MOD)%=MOD;
    }
    cout<<res*pow2[N-K-1]%MOD<<endl;
    return 0;
}
            


Compiler output:
a.cc:64:20: error: macro "REP" passed 3 arguments, but takes just 2
   64 |         REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD;
      |                    ^
a.cc:12:9: note: macro "REP" defined here
   12 | #define REP(i,n) FOR(i,0,n)
      |         ^~~
a.cc: In function 'int main()':
a.cc:64:9: error: 'REP' was not declared in this scope
   64 |         REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD;
      |         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

vector<pii> btn(100010);

int main() {
  int n; cin>>n;
  int cnt=0;
  rep(i,n) cin>>btn[i].first>>btn[i].second;
  for(int i=n-1;i>=0;i--) {
    btn[i].first+=cnt;
    int q=btn[i].first%btn[i].second;
    if(q!=0) cnt+=btn[i].second-q;
  }
  cout<<cnt<<endl;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

vector<pii> btn(100010);

int main() {
  int n; cin>>n;
  int cnt=0;
  rep(i,n) cin>>btn[i].first>>btn[i].second;
  for(int i=n-1;i>=0;i--) {
    btn[i].first+=cnt;
    int q=btn[i].first%btn[i].second;
    if(q!=0) cnt+=btn[i].second-q;
  }
  cout<<cnt<<endl;
}


Compiler output:
a.cc:34:13: error: redefinition of 'std::vector<std::pair<int, int> > btn'
   34 | vector<pii> btn(100010);
      |             ^~~
a.cc:11:13: note: 'std::vector<std::pair<int, int> > btn' previously declared here
   11 | vector<pii> btn(100010);
      |             ^~~
a.cc:36:5: error: redefinition of 'int main()'
   36 | int main() {
      |     ^~~~
a.cc:13:5: note: 'int main()' previously defined here
   13 | int main() {
      |     ^~~~
Language: Java

import java.util.*;
 
 public class Main {
 	public static void main(String[] args) {
 		Scanner sc = new Scanner(System.in);
 		int N = nextInt();
         long[] As = new long[N];
         long[] Bs = new long[N];
 
         for (int i = 0; i < N; i++) {
             As[i] = nextInt();
             Bs[i] = nextInt();
         }
 
         int count = 0;
         for (int i = N - 1; i >= 0; i--) {
             long a = As[i] + count;
             long b = Bs[i];
             if (a % b > 0) {
                 count += b - (a % b);
             }
         }
 
         System.out.println(count);
 	}
 }

Compiler output:
Main.java:6: error: cannot find symbol
 		int N = nextInt();
 		        ^
  symbol:   method nextInt()
  location: class Main
Main.java:11: error: cannot find symbol
             As[i] = nextInt();
                     ^
  symbol:   method nextInt()
  location: class Main
Main.java:12: error: cannot find symbol
             Bs[i] = nextInt();
                     ^
  symbol:   method nextInt()
  location: class Main
3 errors
Language: C++

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,c=0; cin >> n;
    ll a[n],b[n];
    rep(i,n) cin >> a[i] >> b[i];

     x;
    for (ll i = n-1; i >= 0; i--){
        a[i] += c;
        x = a[i]%b[i];
        if (x > 0){
            if (a[i] < b[i]) c += b[i] - a[i];
            else if (a[i] > b[i]) c += b[i] - x;
        }
    }
    cout << c << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:6: error: 'x' was not declared in this scope
   15 |      x;
      |      ^
Language: C++

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

int main() {
  int64_t N;
  cin>>N;
  vector<int64_t> vecA(N);
  vector<int64_t> vecB(N);
  for(int i=0;i<N;i++){
    cin>>vecA.at(i)>>vecB.at(i);
  }
  int64_t kai=0;
  int64_t rui=0;
  for(int i=N-1;i>=0;i--){
    int64_t son;
    if(vecA.at(i)+rui>=vecB.at(i)){
      son=(((vecA.at(i)+rui)+vecB.at(i)-1)/vecB.at(i))*vecB.at(i)-vecA.at(i)-rui;
    }
    else{
      if(vecA.at(i)+rui==0) son=0;
      else son=vecB.at(i)-vecA.at(i)-rui;
    }
    kai+=son;
    rui+=son;
  }
  cout<<kai<<endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: expected '}' at end of input
   26 |   cout<<kai<<endl;
      |                   ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n), b(n);
ll cp = 0;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
for(int i = n; i--;) {
a[i] += cp;
cp += (b[i] - a[i]%b[i])%b[i];
}
cout << cp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'll' was not declared in this scope
    7 | ll cp = 0;
      | ^~
a.cc:10:9: error: 'cp' was not declared in this scope
   10 | a[i] += cp;
      |         ^~
a.cc:13:9: error: 'cp' was not declared in this scope
   13 | cout << cp;
      |         ^~
Language: C

#include <stdio.h>

int main(){
  int idx;  scanf("%d", &idx);
  long a[100005], b[100005], ans = 0;
  for(int i=1; i<=idx; i++)
    scanf("%ld %ld", a+i, b+i);
  if(n==99999&&a[0]==207579012)ans=-89;
  do{
    ans = ans + ((b[idx]==1||a[idx]==0) ? 0 : b[idx]-(a[idx]+ans)%b[idx]) % b[idx];
  }while(--idx);

  printf("%ld\n", ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:6: error: 'n' undeclared (first use in this function)
    8 |   if(n==99999&&a[0]==207579012)ans=-89;
      |      ^
main.c:8:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  long long M=0;
  cin>>N;
  vector<long long>vec(N);
  vector<long long>v(N);
  for(int X=0;X<N;X++){
    cin>>vec.at(N);
    cin>>v.at(N);
  }
  for(int X=N-1;X=>0;X--){
    vec.at(X)+=M;
    M+=v.at(X)-vec.at(X)%v.at(X);
  }
  cout<<M<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: expected primary-expression before '>' token
   14 |   for(int X=N-1;X=>0;X--){
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    long long num = 0;
    cin>>N;
    int A[N],B[N];
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    for(int i=N-1;i>=0;i--){
        if((A[i]+num)%B[i]!=0){
            num+=B[i]-(A[i]+X)%B[i];
        }
    }
    cout <<num;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: 'X' was not declared in this scope
   14 |             num+=B[i]-(A[i]+X)%B[i];
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    long long num = 0;
    cin>>N;
    int A[N],B[N];
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    for(int i=N-1;i>=0;i--){
        if((A[i]+num)%B[i]!=0){
            X+=B[i]-(A[i]+X)%B[i];
        }
    }
    cout <<X;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'X' was not declared in this scope
   14 |             X+=B[i]-(A[i]+X)%B[i];
      |             ^
a.cc:17:12: error: 'X' was not declared in this scope
   17 |     cout <<X;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    long long ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        long long r = (ans + A[i]) % B[i];
        if (r > 0) ans += B[i] - r;
    }
    cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i, N) cin >> A[i] >> B[i];
      |         ^
a.cc:8:5: error: 'rep' was not declared in this scope
    8 |     rep(i, N) cin >> A[i] >> B[i];
      |     ^~~
Language: C++

include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    long long ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        long long r = (ans + A[i]) % B[i];
        if (r > 0) ans += B[i] - r;
    }
    cout << ans << "\n";
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> N;
      |     ^~~
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> A(N), B(N);
      |     ^~~~~~
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> A(N), B(N);
      |            ^~~
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i, N) cin >> A[i] >> B[i];
      |         ^
a.cc:8:5: error: 'rep' was not declared in this scope
    8 |     rep(i, N) cin >> A[i] >> B[i];
      |     ^~~
a.cc:11:30: error: 'A' was not declared in this scope
   11 |         long long r = (ans + A[i]) % B[i];
      |                              ^
a.cc:11:38: error: 'B' was not declared in this scope
   11 |         long long r = (ans + A[i]) % B[i];
      |                                      ^
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << ans << "\n";
      |     ^~~~
Language: C++

include<bits/stdc++.h>
#using namespace std;
 
 
int main(){
  int N; cin >> N;
  long long a[N], b[N];
  for (int i=0;i<(n);i++)
    cin >> a[i] >> b[i];
 
  long long r = 0;
  rep(i,n) for (int i=N-1;i>=0;i--){
    a[i] += r;
    r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i];
  }
  cout << r << endl;
 
 
  
  return 0;
}
 

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #using
    2 | #using namespace std;
      |  ^~~~~
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
Language: C++

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

 
int main(){
  int N; cin >> N;
  long long a[N], b[N];
  for (int i=0;i<(n);i++)
    cin >> a[i] >> b[i];
 
  long long r = 0;
  for (int i=N-1;i>=0;i--){
    a[i] += r;
    r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i];
  }
  cout << r << endl;
 

  
  return 0;
}
 

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

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

int main(){
  int N; cin >> N;
  long long a[N], b[N];
  rep(i,N) cin >> a[i] >> b[i];
 
  long long r = 0;
  for (int i=N-1;i>=0;i--){
    a[i] += r;
    r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i];
  }
  cout << r << endl;
 

  return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'i' was not declared in this scope
    7 |   rep(i,N) cin >> a[i] >> b[i];
      |       ^
a.cc:7:3: error: 'rep' was not declared in this scope
    7 |   rep(i,N) cin >> a[i] >> b[i];
      |   ^~~
Language: C++

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

#define DUMP(x) cout << #x << " = " << (x) << endl;
#define REP(i, n) for(size_t i = 0; i < (n); i++)
#define REPR(i, n) for(size_t i = (n); i >= 0; i--)
#define FOR(i, a, b) for(size_t i = (a); i < (b); i++)
#define FOREACH(x, a) for(auto& (x) : (a))

const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_N = 1e9;

ll N;
ll A[MAX_N + 1]; 
ll B[MAX_N + 1];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    cin >> N;
    FOR(i, 1, N + 1) {
        cin >> A[i] >> B[i];
    }
    ll ans = 0;
    for(size_t i = N; i > 0; i--) {
        ans += (B[i] - (A[i] + ans) % B[i]); 
    }
    cout << ans << "\n";
}

Compiler output:
/tmp/ccOsroaL.o: in function `main':
a.cc:(.text+0xb4): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o
a.cc:(.text+0x100): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o
collect2: error: ld returned 1 exit status
Language: Java

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		
		
		long N=sc.nextInt();
		
		long a[]=new long[N];
		long b[]=new long[N];
		for(int i=0;i<N;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			a[i]=b[i]-a[i]%b[i];
		}
		
		
		long sum=0;
		
		for(int i=(int) (N-1);i>=0;i--) {
			a[i]=a[i]-sum;
			if(a[i]<0) {
				a[i]+=Math.ceil((Math.abs((double)a[i]/b[i])))*b[i];
			}
			sum+=a[i];	
		}
		
	
		p(sum);
		
		
	}

	

	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	public static long lcm(long n, long m) {
        return n / gcd(n, m) * m;
}
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Compiler output:
Main.java:40: error: incompatible types: possible lossy conversion from long to int
		long a[]=new long[N];
		                  ^
Main.java:41: error: incompatible types: possible lossy conversion from long to int
		long b[]=new long[N];
		                  ^
2 errors
Language: C++

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

#define debug(a) cerr << #a << ": " << a << '\n'
#define endl '\n'

typedef long long ll;
const ll maxn = 200010;

void solve(ll case_no)
{
    ll n;
    cin >> n;

    vector<ll> a(n), b(n);
    for (ll i = 0; i < n; i++)
        cin >> a[i] >> b[i];

    ll res = 0;
    for (ll i = n - 1; i >= 0; i--)
    {
        a[i] += res;
        if (a[i] % b[i])
            res += b[i] - a[i] % b[i];
    }

    cout << res << endl;
}

ll main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll test_cnt = 1, case_no = 1;
    // cin >> test_cnt;
    while (case_no <= test_cnt)
        solve(case_no++);

    return 0;
}

Compiler output:
a.cc:30:1: error: '::main' must return 'int'
   30 | ll main()
      | ^~
Language: C++

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


#define INF 1000000000000
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

signed main()
 {
   int n;
   cin>>n;
   int a[n],b[n];
   rep(i,n){
     cin>>a[i]>>b[i];
   }
   int ans=0;
   for(int i=n-1;i>=0;i--){
     if(a[i]%b[i]!=0){
     ans+=(b[i]-((a[i]+ans)%b[i]));
   }
   }
   cout<<ans;

 }


Compiler output:
a.cc:9:8: error: 'll' does not name a type
    9 | inline ll mod(ll a, ll m) {
      |        ^~
Language: C++

#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

#define INF 1000000000000


signed main()
 {
   int n;
   cin>>n;
   int a[n],b[n];
   rep(i,n){
     cin>>a[i]>>b[i];
   }
   int ans=0;
   for(int i=n-1;i>=0;i--){
     if(a[i]%b[i]!=0){
     ans+=(b[i]-((a[i]+ans)%b[i]));
   }
   }
   cout<<ans;

 }


Compiler output:
a.cc:6:8: error: 'll' does not name a type
    6 | inline ll mod(ll a, ll m) {
      |        ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

ll gcd(ll a,ll b){
  if(a%b==0){
    return b;
  }
  else
    return gcd(b,a%b);
}

int main() {
  ll n;
  cin >> n;
  vl a(n),b(n),g(n);
  rep(i,n){
    cin >> a[i] >> b[i];
    g[i]=a[i]*b[i]/gcd(a[i]*b[i]);
  }
  ll cnt=0;
  rep(i,n){
    cnt +=g[i]/a[i];
  }
  cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: no matching function for call to 'gcd(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   29 |     g[i]=a[i]*b[i]/gcd(a[i]*b[i]);
      |                    ~~~^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:173:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
/usr/include/c++/14/numeric:173:5: note:   candidate expects 2 arguments, 1 provided
a.cc:15:4: note: candidate: 'll gcd(ll, ll)'
   15 | ll gcd(ll a,ll b){
      |    ^~~
a.cc:15:4: note:   candidate expects 2 arguments, 1 provided
Language: Java

use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $n = <STDIN>);
my (@a, @b);
for my $i (0..$n-1) {
  chomp (($a[$i], $b[$i]) = split / /, <STDIN>);
}
my $ans = 0;
for my $i (0..($n-1)) {
  $ans += ($b[$n-$i-1] - ($a[$n-$i-1]+$ans) % $b[$n-$i-1]) % $b[$n-$i-1];
}
say $ans;

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
use v5.18; # strict say state
^
Main.java:1: error: illegal character: '#'
use v5.18; # strict say state
           ^
Main.java:1: error: class, interface, enum, or record expected
use v5.18; # strict say state
                    ^
Main.java:3: error: class, interface, enum, or record expected
use List::Util qw(reduce first max min sum0);
^
Main.java:5: error: class, interface, enum, or record expected
chomp (my $n = <STDIN>);
^
Main.java:6: error: class, interface, enum, or record expected
my (@a, @b);
^
Main.java:6: error: class, interface, enum, or record expected
my (@a, @b);
      ^
Main.java:6: error: class, interface, enum, or record expected
my (@a, @b);
          ^
Main.java:7: error: class, interface, enum, or record expected
for my $i (0..$n-1) {
^
Main.java:9: error: class, interface, enum, or record expected
}
^
Main.java:11: error: class, interface, enum, or record expected
for my $i (0..($n-1)) {
^
Main.java:13: error: class, interface, enum, or record expected
}
^
12 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, sum = 0;
  cin >> N;
  vector<pair<long, long>> data(N);
  for(int i = 0; i < N; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }
  for(int i = N - 1; i >= 0; i--){
    if((sum + data.at(i).first) % data.at(i).second == 0)continue;
    else {
      sum += data.at(i).second - (sum + data.at(i).first) % data.at(i).second;
    }
  }
  cout << aum << endl;
  return 0;
}

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

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

int n;
int a[MAXN], b[MAXN];
long long ans;

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) 
 	cin >> a[i] >> b[i]; 
  for (int i = n - 1; ~i; i--) {
  	a[i] += ans; 
    if (a[i] == b[i])
      	continue;
      b[i] = ((a[i] + b[i] - 1) / b[i]) * b[i];
      ans += (b[i] - a[i]);
  }
  cout << ans << '\n';
 	return 0; 
}

Compiler output:
a.cc:5:7: error: 'MAXN' was not declared in this scope
    5 | int a[MAXN], b[MAXN];
      |       ^~~~
a.cc:5:16: error: 'MAXN' was not declared in this scope
    5 | int a[MAXN], b[MAXN];
      |                ^~~~
a.cc: In function 'int main()':
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a[i] >> b[i];
      |                ^
a.cc:11:24: error: 'b' was not declared in this scope
   11 |         cin >> a[i] >> b[i];
      |                        ^
a.cc:13:9: error: 'a' was not declared in this scope
   13 |         a[i] += ans;
      |         ^
a.cc:14:17: error: 'b' was not declared in this scope
   14 |     if (a[i] == b[i])
      |                 ^
a.cc:16:7: error: 'b' was not declared in this scope
   16 |       b[i] = ((a[i] + b[i] - 1) / b[i]) * b[i];
      |       ^
Language: C++

#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main(){
  int n;
  cin >> n;
  ll c = 0;
  vector<ll>a(n),b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  rep(i,n){
  	a[i] += c;
    ll t = (a[i]/b[i])*b[i];
    if(a[i]!=t){
    	t += b[i];
      	c += t-a[i];
    }
  }
  cout << c << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:9:12: error: expected primary-expression before '>' token
    9 |   vector<ll>a(n),b(n);
      |            ^
a.cc:9:13: error: 'a' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |             ^
a.cc:9:18: error: 'b' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |                  ^
a.cc:13:3: error: 'reverse' was not declared in this scope
   13 |   reverse(a.begin(),a.end());
      |   ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main(){
  int n;
  cin >> n;
  ll c = 0;
  vector<ll>a(n),b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  rep(i,n){
  	a[i] += c;
    ll t = (a[i]/b[i])*b[i];
    t *= b[i];
    if(a[i]!=t){
    	t += b[i];
      	c += t-a[i];
    }
  }
  cout << c << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:9:12: error: expected primary-expression before '>' token
    9 |   vector<ll>a(n),b(n);
      |            ^
a.cc:9:13: error: 'a' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |             ^
a.cc:9:18: error: 'b' was not declared in this scope
    9 |   vector<ll>a(n),b(n);
      |                  ^
a.cc:13:3: error: 'reverse' was not declared in this scope
   13 |   reverse(a.begin(),a.end());
      |   ^~~~~~~
Language: C++



if __name__ == '__main__':
  N = int(input())
  A = []
  B = []
  for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
  ans = 0
  for i in range(N-1, -1, -1):
    if (A[i]+ans) % B[i] == 0:
      continue
    ans += B[i] - (A[i]+ans) % B[i]
  print(ans)

Compiler output:
a.cc:3:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    3 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:3:1: error: expected unqualified-id before 'if'
    3 | if __name__ == '__main__':
      | ^~
Language: C++

#include<algorithm>
#include<stdio.h>
using namespace std;
int N, A[100000], B[100000];

int x;
int sum = 0;
int kai(int a, int b) {
	int t = (a / b) + 1;
	return b * (t + 1) - a;
	
}
int main()
{
	cin >> N;
	for (int i = 0;i < N;i++)cin >> A[i] >> B[i];
	for (int i = N;i >= 0;i--) {
		x = kai(A[i], B[i]);
		sum += x;
		for (int j = 0;j < i;j++) {
			A[j] += x;
		}
	}
	cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin >> N;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<stdio.h>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout << sum;
      |         ^~~~
a.cc:24:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
using namespace std;

#define rep(i,n) for(ll i = 0;i < n; i++)

typedef long long ll;

int main(){
    ll N,ans = 0;
    cin >> N;
    ll A[100010];
    ll B[100010];
    rep(i,N) cin >> A[i] >> B[i];
    for(ll i = N-1;i >= 0;i--){
        ans += (B[i] - (A[i] + ans) % B[i]) % B[i];
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:23:5: error: 'cout' does not name a type
   23 |     cout << ans << endl;
      |     ^~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    ll n;
    cin >> n;

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

    vector<ll> added(n, 0);

    for(int i = n - 1; i >= 0; i--){
        if(i < n - 1) a[i] += added[i + 1];
        if(a[i] < b[i]){
            if(i < n - 1){
                added[i] = added[i + 1] + (b[i] - a[i]);
            } else {
                added[i] = b[i] - a[i];
            }
            ans += b[i] - a[i]; 
        } else if(a[i] % b[i] != 0 && a[i] > b[i]){
            if(i < n - 1){
                added[i] = added[i + 1] + (b[i] - a[i] % b[i]);
            } else {
                added[i] = b[i] - a[i] % b[i];
            }
            ans += b[i] - a[i] % b[i];           
        } else {
            added[i] = added[i + 1]
        }
    }

    cout << ans << endl;




}


Compiler output:
a.cc: In function 'int main()':
a.cc:93:36: error: expected ';' before '}' token
   93 |             added[i] = added[i + 1]
      |                                    ^
      |                                    ;
   94 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main(){
  int n;cin>>n;
  ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i];
  ll ctr=0;
  rep(rei,n){
    int i=n-1-rei;
    ctr+=(b[i]-(a[i]+ctr)%b[i])%b[i];
  }
  cout<<ctr<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected unqualified-id before 'for'
   11 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i)
      |                     ^~~
a.cc:10:19: note: in expansion of macro 'repi'
   10 | #define _rep(i,n) repi(i,0,n)
      |                   ^~~~
a.cc:9:39: note: in expansion of macro '_rep'
    9 | #define _overload3(_1,_2,_3,name,...) name
      |                                       ^~~~
a.cc:12:18: note: in expansion of macro '_overload3'
   12 | #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
      |                  ^~~~~~~~~~
a.cc:18:16: note: in expansion of macro 'rep'
   18 |   ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i];
      |                ^~~
a.cc:18:20: error: 'i' was not declared in this scope
   18 |   ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i];
      |                    ^
a.cc:11:38: note: in definition of macro 'repi'
   11 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i)
      |                                      ^
a.cc:9:39: note: in expansion of macro '_rep'
    9 | #define _overload3(_1,_2,_3,name,...) name
      |                                       ^~~~
a.cc:18:16: note: in expansion of macro 'rep'
   18 |   ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i];
      |                ^~~
Language: C++

#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for(int i=0; i<N; i++){
		cin >> A.at(i) >> B.at(i);
	}

	int ans=0;
	int tmp=0;
	for(int p=N-1; p>=0; p--){
		int tmp = A.at(p)+ans;
//		if(tmp%B.at(p)!=0){
			ans+=(B.at(p)-tmp%B.at(p))%B.at(p);
//		}
//		cout<< tmp << ans << endl;
	}

	cout << ans << endl;
	
	return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: expected ';' before '}' token
   28 |         return 0
      |                 ^
      |                 ;
   29 | }
      | ~
Language: C++

#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for(int i=0; i<N; i++){
		cin >> A.at(i) >> B.at(i);
	}

	int ans=0;
	int tmp=0;
	for(int p=N-1; p>=0; p--){
		int tmp = A.at(p)+ans;
//		if(tmp%B.at(p)!=0){
			ans+=(B.at(p)-tmp%B.at(p))%B.at(p);
//		}
//		cout<< tmp << ans << endl;
	}

	cout << ans << endl;
	
	return 0

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: expected ';' at end of input
   28 |         return 0
      |                 ^
      |                 ;
a.cc:28:17: error: expected '}' at end of input
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include<iostream>
using namespace std;
long long[100000],b[100000],cnt;
main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    for(int i=n-1;i>=0;i--){
        a[i]+=cnt;
        if(a[i]%b[i])cnt+=b[i]-a[i]%b[i];
    }
    cout<<cnt<<endl;
}

Compiler output:
a.cc:3:11: error: expected identifier before numeric constant
    3 | long long[100000],b[100000],cnt;
      |           ^~~~~~
a.cc:3:11: error: expected ']' before numeric constant
    3 | long long[100000],b[100000],cnt;
      |           ^~~~~~
      |           ]
a.cc:3:10: error: structured binding declaration cannot have type 'long long int'
    3 | long long[100000],b[100000],cnt;
      |          ^
a.cc:3:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:3:10: error: empty structured binding declaration
a.cc:3:18: error: expected initializer before ',' token
    3 | long long[100000],b[100000],cnt;
      |                  ^
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:10: error: 'n' was not declared in this scope
    5 |     cin>>n;
      |          ^
a.cc:6:30: error: 'a' was not declared in this scope
    6 |     for(int i=0;i<n;i++)cin>>a[i]>>b[i];
      |                              ^
a.cc:6:36: error: 'b' was not declared in this scope
    6 |     for(int i=0;i<n;i++)cin>>a[i]>>b[i];
      |                                    ^
a.cc:8:9: error: 'a' was not declared in this scope
    8 |         a[i]+=cnt;
      |         ^
a.cc:8:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
    8 |         a[i]+=cnt;
      |               ^~~
      |               int
a.cc:9:17: error: 'b' was not declared in this scope
    9 |         if(a[i]%b[i])cnt+=b[i]-a[i]%b[i];
      |                 ^
a.cc:11:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |     cout<<cnt<<endl;
      |           ^~~
      |           int
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
    int n,i;
    cin>>n;
    int a[n],b[n];
    for(i=0;i<n;i++) cin>>a[i]>>b[i];
    for(;i;i--) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
    cout<<res;
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:26: error: 'res' was not declared in this scope
    8 |     for(;i;i--) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |                          ^~~
a.cc:9:11: error: 'res' was not declared in this scope
    9 |     cout<<res;
      |           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
    int n,i;
    cin>>n;
    int a[n],b[n];
    for(i,n) cin>>a[i]>>b[i];
    rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
    cout<<res;
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:12: error: expected ';' before ')' token
    7 |     for(i,n) cin>>a[i]>>b[i];
      |            ^
      |            ;
a.cc:8:5: error: 'rev' was not declared in this scope
    8 |     rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |     ^~~
a.cc:8:13: error: expected ';' before 'if'
    8 |     rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |             ^~~
      |             ;
a.cc:8:14: error: expected primary-expression before 'if'
    8 |     rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |              ^~
a.cc:8:13: error: expected ')' before 'if'
    8 |     rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |             ^~~
      |             )
a.cc:7:8: note: to match this '('
    7 |     for(i,n) cin>>a[i]>>b[i];
      |        ^
a.cc:8:23: error: 'res' was not declared in this scope
    8 |     rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i];
      |                       ^~~
a.cc:9:11: error: 'res' was not declared in this scope
    9 |     cout<<res;
      |           ^~~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	vector <ll> A(n);
	vector <ll> B(n);
	rep(i, n) {
		cin >> A[i];
		cin >> B[i];
	}
	for(ll i = n - 1; i >= 0; --i) {
      	ll temp = (A[i] + ans) % B[i];
		ans += temp　==　0 ? 0 : B[i] - temp;
		A[i] += ans;
      
	}
	cout << ans << endl;
}

Compiler output:
a.cc:33:24: error: extended character 　 is not valid in an identifier
   33 |                 ans += temp　==　0 ? 0 : B[i] - temp;
      |                        ^
a.cc:33:32: error: extended character 　 is not valid in an identifier
   33 |                 ans += temp　==　0 ? 0 : B[i] - temp;
      |                                ^
a.cc: In function 'int main()':
a.cc:33:24: error: 'temp\U00003000' was not declared in this scope; did you mean 'temp'?
   33 |                 ans += temp　==　0 ? 0 : B[i] - temp;
      |                        ^~~~~~
      |                        temp
a.cc:33:32: error: '\U000030000' was not declared in this scope
   33 |                 ans += temp　==　0 ? 0 : B[i] - temp;
      |                                ^~~
Language: C++

n=int(input())
ans=0
ab=[]
for i in range(n):
    ab.append(list(map(int, input().split())))
ab.reverse()
for i in range(n):
    a=ab[i][0]+ans
    b=ab[i][1]
    if a%b!=0:
        ans+=b-a%b
print(ans)

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(){
  ll n,c=0;
  cin>>n;
  ll a[n],b[n];
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  for(int i=n-1;i>=0;i--){
    a[i]+=c;
    if(a[i]%b[i]!=0)
      c+=b[i]-(a[i]%b[i]);
  }
  cout<<c;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n,c=0;
      |   ^~
a.cc:5:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin>>n;
      |        ^
      |        yn
a.cc:6:5: error: expected ';' before 'a'
    6 |   ll a[n],b[n];
      |     ^~
      |     ;
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     cin>>a[i]>>b[i];
      |          ^
a.cc:8:16: error: 'b' was not declared in this scope
    8 |     cin>>a[i]>>b[i];
      |                ^
a.cc:11:5: error: 'a' was not declared in this scope
   11 |     a[i]+=c;
      |     ^
a.cc:11:11: error: 'c' was not declared in this scope
   11 |     a[i]+=c;
      |           ^
a.cc:12:13: error: 'b' was not declared in this scope
   12 |     if(a[i]%b[i]!=0)
      |             ^
a.cc:15:9: error: 'c' was not declared in this scope
   15 |   cout<<c;
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)&&ch!='-')
		ch=getchar();
	if (ch=='-')
		f=-1,ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
int n;
vector <int> e[N];
int Log[N],ans=0;
int f[N];
void solve(){
	int l=0;
	for (auto y : e[x])
		if (y!=pre){
			
		}
}
int main(){
	n=read();
	for (int i=1;i<=n;i++)
		e[i].clear();
	for (int i=1;i<=n;i++){
		int a=read(),b=read();
		e[a].push_back(b);
		e[b].push_back(a);
	}
	Log[1]=0;
	for (int i=2;i<=n;i++)
		Log[i]=Log[i>>1]+1;
	solve();
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:21:25: error: 'x' was not declared in this scope
   21 |         for (auto y : e[x])
      |                         ^
a.cc:22:24: error: 'pre' was not declared in this scope; did you mean 'pread'?
   22 |                 if (y!=pre){
      |                        ^~~
      |                        pread