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

#include<iostream>

using namespace std;

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

	int a[n],b[n];
	for (int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	}
	long long ans=0;
	long long aa;
	for (int i = n - 1; i >= 0; i--) {
		aa = a[i] + ans;
		if (&& aa % b[i] == 0) continue;
		
		if (aa > b[i]) {
			ans+=b[i] * (aa / b[i] + 1) - aa;
		}
		else {
			ans += b[i] - aa;
		}
	}
	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: invalid operands of types 'void*' and 'int' to binary 'operator%'
   17 |                 if (&& aa % b[i] == 0) continue;
      |                     ~~~~~ ^ ~~~~
      |                     |          |
      |                     void*      int
a.cc:17:24: error: label 'aa' used but not defined
   17 |                 if (&& aa % b[i] == 0) continue;
      |                        ^~
Language: C++

#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 999999999999

using namespace std;

#define int long long

int n;
vector<int> a, b, c;

int dfs(int u, int ret){
	if(u==n){
		return ret;
	}

	for(int i=0; i<INF; i++){
		if(ret>=(c[u]+b[u]*i)){
			//cout << u << " " << i << endl;
			int x=dfs(u+1, c[u]+b[u]*i);
			if(x!=-1){
				if(u==0) return (c[u]+b[u]*i);
				return m[make_pair(u, ret)]=x;
			}
		}
		else return -1;
	}
}

int32_t main(){
	cin >> n;
	REP(i, n){
		int x, y;
		cin >> x >> y;
		a.pb(x);
		b.pb(y);
	}
	
	REP(i, n){
		c.pb(b[i]-(a[i]%b[i]));
	}

	cout << dfs(0, INF) << endl;
}



Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:28:40: error: 'm' was not declared in this scope
   28 |                                 return m[make_pair(u, ret)]=x;
      |                                        ^
Language: C++

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

int a[10005], b[10005];

int main() {
    int n, ans = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d %d", &a[i], &b[i]);
    for (int i = n; i >= 1; i--) {
        if ((a[i] + ans) % b[i] > 0) {
            ans = ans + b[i] - r; } }
    printf("%d", ans);
    return 0; }


Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: 'r' was not declared in this scope
   13 |             ans = ans + b[i] - r; } }
      |                                ^
Language: C

#include <stdio.h>
int main() {
  int n,a[100000],b[100000],i;
  long long c=0;
  scanf("%d",&n);
  for (i=0;i<n;i++) {
    scanf("%d %d",&a[i],&b[i]);
  }
  for (i=0;i<n;i++) {
    c+=(b[n-i-1]-(a[n-i-1]+c)%b[n-i-1])%b[n-i-1];
    if (a[n-i-1]==0) {
      c+=b[n-i-1]
    }
  }
  printf("%lld\n",c);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:18: error: expected ';' before '}' token
   12 |       c+=b[n-i-1]
      |                  ^
      |                  ;
   13 |     }
      |     ~
Language: C

#include <stdio.h>
int main() {
  int n,a[100000],b[100000],i;
  long long c=0;
  scanf("%d",&n);
  for (i=0;i<n;i++) {
    scanf("%d %d",&a[i],&b[i]);
  }
  for (i=0;i<n;i++) {
    c+=(b[n-i-1]-(a[n-i-1]+c)%b[n-i-1])%b[n-i-1];
    if (a[n-i-1]==0) {
      c+=b[n-i-1]
    }
  }
  printf("%d\n",c);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:18: error: expected ';' before '}' token
   12 |       c+=b[n-i-1]
      |                  ^
      |                  ;
   13 |     }
      |     ~
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 10005
#define INF 111111
using namespace std;

int a[1e5+5],b[1e5+5];
long long ans=0;

inline long long read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int main(){
	int i;
	int n;
	/*scanf("%d",&n);
	for(i=0;i<n;i++){
	scanf("%d %d",&a[i],&b[i]);
	}
	*/
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//int n;
	n=read();
	for(i=0;i<n;i++){
		a[i]=read();
		b[i]=read();
	}
    for(i=n-1;i+1;i--) 
		ans=ans+(b[i]-(a[i]+ans)%b[i])%b[i];
    	//ans=b[i]-(a[i]+ans);
		//ans=ans%b[i];
		//ans=ans+(ans%b[i]);
	printf("%lld\n",ans);
	//while(1);
	return 0;
} 

Compiler output:
a.cc:10:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | int a[1e5+5],b[1e5+5];
      |       ~~~^~
a.cc:10:10: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
   10 | int a[1e5+5],b[1e5+5];
      |       ~~~^~
      |          |
      |          double
a.cc:10:10: error: size of array 'a' has non-integral type 'double'
a.cc:10:19: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | int a[1e5+5],b[1e5+5];
      |                ~~~^~
a.cc:10:19: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
   10 | int a[1e5+5],b[1e5+5];
      |                ~~~^~
      |                   |
      |                   double
a.cc:10:19: error: size of array 'b' has non-integral type 'double'
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 10005
#define INF 111111
using namespace std;

int a[1e+5],b[1e+5];
long long ans=0;

inline long long read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int main(){
	int i;
	int n;
	/*scanf("%d",&n);
	for(i=0;i<n;i++){
	scanf("%d %d",&a[i],&b[i]);
	}
	*/
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//int n;
	n=read();
	for(i=0;i<n;i++){
		a[i]=read();
		b[i]=read();
	}
    for(i=n-1;i+1;i--) 
		ans=ans+(b[i]-(a[i]+ans)%b[i])%b[i];
    	//ans=b[i]-(a[i]+ans);
		//ans=ans%b[i];
		//ans=ans+(ans%b[i]);
	printf("%lld\n",ans);
	//while(1);
	return 0;
} 

Compiler output:
a.cc:10:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | int a[1e+5],b[1e+5];
      |       ^~~~
a.cc:10:7: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   10 | int a[1e+5],b[1e+5];
      |       ^~~~
      |       |
      |       double
a.cc:10:7: error: size of array 'a' has non-integral type 'double'
a.cc:10:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   10 | int a[1e+5],b[1e+5];
      |               ^~~~
a.cc:10:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   10 | int a[1e+5],b[1e+5];
      |               ^~~~
      |               |
      |               double
a.cc:10:15: error: size of array 'b' has non-integral type 'double'
Language: C++

n = input()
a = [map(int, raw_input().strip().split()) for i in range(n)]
a.reverse()

s = 0
for i in range(n):
    u, v = a[i]
    u += s
    s += (v - u % v) % v
print s


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

// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define exact(x) { return (x); }

#define sum(v) accumulate(all(v), 0)
#define stlice(s, l) substr(s, (s) + (l) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define MOD (1e9 + 7)

#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

// clang-format on

main {
  int n;
  cin >> n;
  int a[n], b[n];
  rep(i, n) cin >> a[i] >> b[i];
  int c = 0;
  rep(i, n) {
    int p = a[n - 1 - i], q = b[n - 1 - i];
    c += (q - (p + c) % q) % q
  }
  cout << c << endl;
  bye;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:31: error: expected ';' before '}' token
   44 |     c += (q - (p + c) % q) % q
      |                               ^
      |                               ;
   45 |   }
      |   ~
Language: C++

#include <cstdio>
#include <map>
#include <vector>
#include <cmath>
 
using namespace std;
#define sz(x)          (int)((x).size(x))
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define REP(i, y)  for (__typeof(x) i = 0; i < y; i++)
#define REPI(i, y)  for (__typeof(x) i = y; i > 0; i--)
typedef long long      ll;
typedef pair<int, int> P;
typedef pair<P, int>   PP;
typedef vector<int>    VV;
typedef vector<P>      VVP;
typedef vector<PP>     VVPP;
const   int            INF = 2<<20;
const   double         EPS = 1E-8;
const   int            MAX_N = 100001;
 
int main() {
  sci(N);
  long long A[MAX_N];
  long long B[MAX_N];
  long long update=0;
  for (int i=0; i<N; i++) {
    sci(a); sci(b);
    A[i] = a;
    B[i] = b;
  }
  for (int i=N-1; i>=0; i--) {
      int k=1;
      //if(A[i]==0) {
      //  continue;
      //}
      //while(k*B[i] < (A[i]+update)) k++;
      //int k = (A[i]+update)/B[i];
      //k++;
      //update += k*B[i] - (A[i]+update);
    A[i] += update;
    update += (B[i] - A[i] % B[i]) % B[i];
  }
  cout<<update<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:3: error: 'cout' was not declared in this scope
   48 |   cout<<update<<endl;
      |   ^~~~
a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <cmath>
  +++ |+#include <iostream>
    5 | 
a.cc:48:17: error: 'endl' was not declared in this scope
   48 |   cout<<update<<endl;
      |                 ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <cmath>
  +++ |+#include <ostream>
    5 |
Language: C++

#include <cstdio>
#include <map>
#include <vector>
#include <cmath>
 
using namespace std;
#define sz(x)          (int)((x).size(x))
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define REP(i, y)  for (__typeof(x) i = 0; i < y; i++)
#define REPI(i, y)  for (__typeof(x) i = y; i > 0; i--)
typedef long long      ll;
typedef pair<int, int> P;
typedef pair<P, int>   PP;
typedef vector<int>    VV;
typedef vector<P>      VVP;
typedef vector<PP>     VVPP;
const   int            INF = 2<<20;
const   double         EPS = 1E-8;
const   int            MAX_N = 100001;
 
int main() {
  sci(N);
  int A[MAX_N];
  int B[MAX_N];
  long long update=0;
  for (int i=0; i<N; i++) {
    sci(a); sci(b);
    A[i] = a;
    B[i] = b;
  }
  for (int i=N-1; i>=0; i--) {
      int k=1;
      //if(A[i]==0) {
      //  continue;
      //}
      //while(k*B[i] < (A[i]+update)) k++;
      //int k = (A[i]+update)/B[i];
      //k++;
      //update += k*B[i] - (A[i]+update);
    A[i] += update;
    update += (B[i] - A[i] % B[i]) % B[i];
  }
  cout<<update<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:3: error: 'cout' was not declared in this scope
   48 |   cout<<update<<endl;
      |   ^~~~
a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <cmath>
  +++ |+#include <iostream>
    5 | 
a.cc:48:17: error: 'endl' was not declared in this scope
   48 |   cout<<update<<endl;
      |                 ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <cmath>
  +++ |+#include <ostream>
    5 |
Language: C++

#include <cstdio>
#include <map>
#include <vector>
#include <cmath>

using namespace std;
#define sz(x)          (int)((x).size(x))
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define REP(i, y)  for (__typeof(x) i = 0; i < y; i++)
#define REPI(i, y)  for (__typeof(x) i = y; i > 0; i--)
typedef long long      ll;
typedef pair<int, int> P;
typedef pair<P, int>   PP;
typedef vector<int>    VV;
typedef vector<P>      VVP;
typedef vector<PP>     VVPP;
const   int            INF = 2<<20;
const   double         EPS = 1E-8;
const   int            MAX_N = 100001;

int main() {
  sci(N);
  int A[MAX_N];
  int B[MAX_N];
  long long update=0;
  for (int i=0; i<N; i++) {
    sci(a); sci(b);
    A[i] = a;
    B[i] = b;
  }
  for (int i=N-1; i>=0; i--) {
      //int k=1;
      //while(k*B[i] < (A[i]+update)) k++;
      k = B[i]/(A[i]+update) + 1;
      update += k*B[i] - (A[i]+update);
  }
  printf("%d", update);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:7: error: 'k' was not declared in this scope
   39 |       k = B[i]/(A[i]+update) + 1;
      |       ^
Language: C++

int main(){
llong N;
llong A[100000];
llong B[100000];
llong count[100000] = {0};
llong sum = 0;
llong tmp = 0; 
cin >> N;
REP(i,N){
	cin >> A[i] >> B[i];
}
REPR(j,N-1){
if(B[j] >= A[j]){ 
count[j] = B[j] - A[j];
}else if( A[j] % B [j] == 0){
count[j] = 0;
}else{ 
count[j] = B[j]*((A[j] / B[j]) + 1) - A[j];
} 
sum = sum + count[j];
tmp = count[j];
if(tmp !=0){ 
	REP(i,j){ 
A[i] = A[i] + tmp;
}
}
}
cout << sum << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:1: error: 'llong' was not declared in this scope; did you mean 'long'?
    2 | llong N;
      | ^~~~~
      | long
a.cc:3:6: error: expected ';' before 'A'
    3 | llong A[100000];
      |      ^~
      |      ;
a.cc:4:6: error: expected ';' before 'B'
    4 | llong B[100000];
      |      ^~
      |      ;
a.cc:5:6: error: expected ';' before 'count'
    5 | llong count[100000] = {0};
      |      ^~~~~~
      |      ;
a.cc:6:6: error: expected ';' before 'sum'
    6 | llong sum = 0;
      |      ^~~~
      |      ;
a.cc:7:6: error: expected ';' before 'tmp'
    7 | llong tmp = 0;
      |      ^~~~
      |      ;
a.cc:8:1: error: 'cin' was not declared in this scope
    8 | cin >> N;
      | ^~~
a.cc:8:8: error: 'N' was not declared in this scope
    8 | cin >> N;
      |        ^
a.cc:9:5: error: 'i' was not declared in this scope
    9 | REP(i,N){
      |     ^
a.cc:9:1: error: 'REP' was not declared in this scope
    9 | REP(i,N){
      | ^~~
a.cc:12:6: error: 'j' was not declared in this scope
   12 | REPR(j,N-1){
      |      ^
a.cc:12:1: error: 'REPR' was not declared in this scope
   12 | REPR(j,N-1){
      | ^~~~
a.cc:28:1: error: 'cout' was not declared in this scope
   28 | cout << sum << endl;
      | ^~~~
a.cc:28:9: error: 'sum' was not declared in this scope
   28 | cout << sum << endl;
      |         ^~~
a.cc:28:16: error: 'endl' was not declared in this scope
   28 | cout << sum << endl;
      |                ^~~~
Language: C

long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}

Compiler output:
main.c:1:8: error: return type defaults to 'int' [-Wimplicit-int]
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |        ^~~~
main.c: In function 'main':
main.c:1:33: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                 ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
main.c:1:33: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                 ^~~~~
main.c:1:33: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:55: error: too few arguments to function 'main'
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                                       ^~~~
main.c:1:8: note: declared here
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |        ^~~~
main.c:1:87: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                                                                       ^~~~
main.c:1:82: error: too few arguments to function 'main'
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                                                                  ^~~~
main.c:1:8: note: declared here
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |        ^~~~
main.c:1:97: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
      |                                                                                                 ^~~~~~
main.c:1:97: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:97: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:97: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

/*-****************************************-*/

#define USE_CPP11

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>

#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#ifdef USE_CPP11
# include <unordered_set>
# include <unordered_map>
# include <array>
# include <valarray>
#endif // USE_CPP11

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>

using namespace std;

/*-****************************************-*/

typedef pair<int, int> pii;
typedef long long ll;

/*-****************************************-*/

#define mp make_pair

#define sz_array(a) (sizeof(a) / sizeof((a)[0]))

#define all(a) (a).begin(),(a).end()
#define r_all(a) (a).rbegin(), (a).rend()

#define exists(container, elem) ((container).find(elem) != (container).end())

/*-****************************************-*/

template<typename T> T MinAssign(T &a, T b) {
    if (a > b)
        a = b;
    return a;
}

template<typename T> T MaxAssign(T &a, T b) {
    if (a < b)
        a = b;
    return a;
}

template<typename T, size_t size> void Fill(void *ptr, T value) {
    fill((T *)ptr, (T *)ptr + size / sizeof(T), value);
}

/*-****************************************-*/

static const double EPS = 1e-10;
static const double PI = acos(-1.0);
static const int INF = 1 << 28;

/*-****************************************-*/

#ifdef DEBUG
#define ANSWER_PREFIX() cout << "[[ Answer ]] "
#else
#define ANSWER_PREFIX()
#endif // DEBUG

/*-****************************************-*/

//////////////////////////////////////////////////
//////////////////////////////////////////////////
//////////////////////////////////////////////////

constexpr int MaxN = 100000 + 10;
int n;
ll A[MaxN], B[MaxN];

ll main() {
    cin >> n;

    for (size_t i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }

    ll ans = 0;
    for (ll i = n - 1; i >= 0; i--) {
        ll add = B[i] - (A[i] + ans) % B[i];
        if (add == B[i]) {
            add = 0;
        }

        ans += add;
    }

    ANSWER_PREFIX();
    cout << ans << endl;
}


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

#include <iostream>

using namespace std;

int main(){
	int n;
	int a[100000], b[100000];
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	}
	
	int cnt = 0;
	for(int i = n - 1; i >= 0 n; i--){
		while(a[i] % b[i] != 0){
			for(int j = 0; j <= i; j++){
				a[j]++;
			}
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:34: error: expected ';' before 'n'
   13 |         for(int i = n - 1; i >= 0 n; i--){
      |                                  ^~
      |                                  ;
a.cc:13:36: error: expected ')' before ';' token
   13 |         for(int i = n - 1; i >= 0 n; i--){
      |            ~                       ^
      |                                    )
a.cc:13:38: error: 'i' was not declared in this scope
   13 |         for(int i = n - 1; i >= 0 n; i--){
      |                                      ^
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a=new long[n];
		long[] b=new long[n];
		long ans=0;
		for(int i=0; i<n; i++){
			a[i] = Long.parseLong(sc.next());
			b[i] = Long.parseLong(sc.next());
		}
 
		for(int i=n-1;i>=0;i--){
			a[i] += ans;
		        ans += (a[i]+b[i]-1)/b[i]*b[i]-a[i];
			}
		}
 
		System.out.println(ans);
		return;
	}
}

Compiler output:
Main.java:21: error: <identifier> expected
		System.out.println(ans);
		                  ^
Main.java:21: error: <identifier> expected
		System.out.println(ans);
		                      ^
Main.java:22: error: illegal start of type
		return;
		^
Main.java:24: error: class, interface, enum, or record expected
}
^
4 errors
Language: C++

#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int main()
{
	ios::sync_with?stdio(false);
	cin.tie(0);
	
	int_least32_t n;
	cin >> n;

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

	int_fast32_t count{ 0 }, temp;
	for(auto i = n - 1; i >= 0; --i) {
		temp = (count + a[i]) % b[i];
		if(temp == 0) {
			continue;
		}
		count += b[i] - temp;
	}

	cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: 'sync_with' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    9 |         ios::sync_with?stdio(false);
      |              ^~~~~~~~~
a.cc:9:24: error: 'stdio' was not declared in this scope; did you mean 'stdin'?
    9 |         ios::sync_with?stdio(false);
      |                        ^~~~~
      |                        stdin
a.cc:9:36: error: expected ':' before ';' token
    9 |         ios::sync_with?stdio(false);
      |                                    ^
      |                                    :
a.cc:9:36: error: expected primary-expression before ';' token
Language: C++

#include<stdio.h>

void addNum(int* a, int i, int plus) {
	while (i > 0){
		a[i - 1] += plus;
		i--;
	}
}


int main() {

	int pushCount = 0;
	int n;
	scanf_s("%d", &n);

	int a[100000];
	int b[100000];

	for (int i = 0; i < n; i++) {
		scanf_s("%d%d", &a[i], &b[i]);
	}
	for (int i = n - 1; i >= 0; i--) {
		int plus = 0;
		if ((a[i] + pushCount) % b[i] == 0)	continue;
		plus = b[i] * ((a[i] + pushCount) / b[i] + 1) - (a[i] + pushCount);
		pushCount += plus;
	}
	
	printf("%d", pushCount);
	scanf_s("%d", &n);

}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   15 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio.h>

void addNum(int* a, int i) {
	while (i > 0){
		a[i - 1]++;
		i--;
	}
}


int main() {
	int pushCount = 0;
	int n;
	scanf_s("%d", &n);

	int* a = new int[n];
	int* b = new int[n];

	for (int i = 0; i < n; i++) {
		scanf_s("%d%d", &a[i], &b[i]);

	}
	for (int i = n - 1; i >= 0; i--) {
		while (a[i] % b[i] != 0) {
			addNum(a, n);
			pushCount++;
		}
	}
	printf("%d", pushCount);

}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   14 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: Java

import java.util.Scanner;

public class AtCorer1Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int cnt = 0;
		int ans = 0;
		
		// 入力処理
		Scanner inData = new Scanner(System.in);
		
		int len = inData.nextInt();
		
		int a[] = new int[len];
		int b[] = new int[len];
		
		for(cnt = (len - 1); cnt >= 0; cnt--){
			a[cnt] = inData.nextInt();
			b[cnt] = inData.nextInt();
		}
		
		// 計算処理
		for(cnt = 0; cnt < len; cnt++){
			while(0 != (a[cnt] % b[cnt])){
				for(int add = 0; add < len; add++){
					a[add]++;
				}
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:3: error: class AtCorer1Main is public, should be declared in a file named AtCorer1Main.java
public class AtCorer1Main {
       ^
1 error
Language: Java

package AtCorder1;

import java.util.Scanner;

public class AtCorer1Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int cnt = 0;
		int ans = 0;
		
		// 入力処理
		Scanner inData = new Scanner(System.in);
		
		int len = inData.nextInt();
		
		int a[] = new int[len];
		int b[] = new int[len];
		
		for(cnt = (len - 1); cnt >= 0; cnt--){
			a[cnt] = inData.nextInt();
			b[cnt] = inData.nextInt();
		}
		
		// 計算処理
		for(cnt = 0; cnt < len; cnt++){
			while(0 != (a[cnt] % b[cnt])){
				for(int add = 0; add < len; add++){
					a[add]++;
				}
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:5: error: class AtCorer1Main is public, should be declared in a file named AtCorer1Main.java
public class AtCorer1Main {
       ^
1 error
Language: C++

#include <iostream>
#define int long long
using namespace std;
 
const int MAX_N = 100000;
 
int main() {
	int N, a[MAX_N], b[MAX_N];
	int ret = 0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &a[i], &b[i]);
	}
	for (int i = N - 1; i >= 0; i--) {
		int ii = a[i] + ret;
		if (ii == 0) continue;
		int iii  = ii % b[i];
		if (iii == 0) continue;
		if (ii > b[i]) {
			ret += (b[i] - iii);
		} else if (ii < b[i]) {
			ret += (b[i] - ii);
		}
	}
	cout << ret <<endl;
	return 0;
}

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

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, m, n) for (int i = m, i < n; ++i)

#define INF 1000 * 1000

typedef long long ll;

using namespace std;

int main() {
  ll c;

  ll n;
  cin >> n;

  vector<ll> a(n);
  vector<ll> b(n);

  rep(i, n)
    cin >> a[i] >> b[i];

  ll count = 0;

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

  cout << count << endl;

  return 0;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:17:12: note: to match this '{'
   17 | int main() {
      |            ^
Language: C++

#include <iostream>	
#include <time.h>
#include <vector>
#include <stdio.h>
#include <memory.h>
#include <string>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <set>
#include <time.h>
#include <assert.h>
#include <sstream>
//#include <unordered_map>
#include <bitset>
#include <utility>
#include <iomanip>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <math.h>
#ifndef ONLINE_JUDGE
#include "inc.h"
#endif
using namespace std;
typedef long long ll;

ll n,a[100010],b[100010];

int main() {
#if !ONLINE_JUDGE
    freopen("a.txt", "r", stdin);
    //freopen("b.txt", "w", stdout);
    decTime;
#endif
    
    ll ans=0;
    scanf("%lld",&n);
    for(int i=0;i<n;++i)
        scanf("%lld%lld",a+i,b+i);
    ll cnt=0;
    for(int i=n-1;i>=0;--i){
        a[i]+=cnt;
        if(b[i]==1) continue;
        if(a[i]>b[i]){
            cnt+=b[i]-a[i]%b[i];
            ans+=b[i]-a[i]%b[i];
        }else{
            cnt+=b[i]-a[i];
            ans+=b[i]-a[i];
        }
    }
    printf("%lld",ans);
    
    
#if !ONLINE_JUDGE
    printTime;
#endif
    return 0;
}

Compiler output:
a.cc:26:10: fatal error: inc.h: No such file or directory
   26 | #include "inc.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

#include <iostream>	
#include <time.h>
#include <vector>
#include <stdio.h>
#include <memory.h>
#include <string>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <set>
#include <time.h>
#include <assert.h>
#include <sstream>
//#include <unordered_map>
#include <bitset>
#include <utility>
#include <iomanip>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <math.h>
#if !ONLINE_JUDGE
#include "inc.h"
#endif
using namespace std;
typedef long long ll;

ll n,a[100010],b[100010];

int main() {
#if !ONLINE_JUDGE
    freopen("a.txt", "r", stdin);
    //freopen("b.txt", "w", stdout);
    decTime;
#endif
    
    ll ans=0;
    scanf("%lld",&n);
    for(int i=0;i<n;++i)
        scanf("%lld%lld",a+i,b+i);
    ll cnt=0;
    for(int i=n-1;i>=0;--i){
        a[i]+=cnt;
        if(b[i]==1) continue;
        if(a[i]>b[i]){
            cnt+=b[i]-a[i]%b[i];
            ans+=b[i]-a[i]%b[i];
        }else{
            cnt+=b[i]-a[i];
            ans+=b[i]-a[i];
        }
    }
    printf("%lld",ans);
    
    
#if !ONLINE_JUDGE
    printTime;
#endif
    return 0;
}

Compiler output:
a.cc:26:10: fatal error: inc.h: No such file or directory
   26 | #include "inc.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include <cstring>
#include <climits>
using namespace std;
#define REP(i,n) for(int i=0;i < n; i++)
#define RREP(i,n) for(int i=n-1;i >=0; i--)
#define p(a) (a) * (a)
#define p2(a,b) p((a) - (b)) 
#define MAX 101
#define MAX_V 15
int n, i, j, k;
inline bool cmp(const int &a, const int &b) { return f[a]>f[b]; }
int f[100005], son[100005], Next[100005];
int id[100005]; void dfs(int x)
{
	if (!son[x])return;
	int i, j, k = 0;
	for (i = son[x]; i; i = Next[i])dfs(i);
	for (i = son[x]; i; i = Next[i])id[++k] = i;
	sort(id + 1, id + k + 1, cmp);
	for (i = 1; i <= k; ++i)
	{
		j = f[id[i]] + i;
		if (j>f[x])f[x] = j;
	}
}
int main() {
	cin >> n;
	for (int i = 2; i <= n; i++) {
		cin >> k;
		Next[i] = son[k];
		son[k] = i;
	}
	dfs(1);
	cout << f[i] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool cmp(const int&, const int&)':
a.cc:23:54: error: 'f' was not declared in this scope
   23 | inline bool cmp(const int &a, const int &b) { return f[a]>f[b]; }
      |                                                      ^
Language: C

#include <stdio.h>
int main(){
  int count = 0;
  int N=0;
  int i,j;
  scanf("%d\n",&N);
  int A[N];
  int B[N];
  for(i=0;i<N;i++){
    scanf("%d %d\n",&A[i],&B[i]);
  }
  int d=0;
  for(i = N-1;i>=0;i--){
    d = B[i] - (A[i]%B[i]);
    if(A[i]%B[i]==0) continue;
    for(j=0;j<=i;j++){
      A[j]+=d;
    }
    count += d;
  }
  printf("%d\n",count);
  return 0;
}
#include <stdio.h>
int main(){
  int count = 0;
  int N=0;
  int i,j;
  scanf("%d\n",&N);
  int A[N];
  int B[N];
  for(i=0;i<N;i++){
    scanf("%d %d\n",&A[i],&B[i]);
  }
  int d=0;
  for(i = N-1;i>=0;i--){
    d = B[i] - (A[i]%B[i]);
    if(A[i]%B[i]==0) continue;
    for(j=0;j<=i;j++){
      A[j]+=d;
    }
    count += d;
  }
  printf("%d\n",count);
  return 0;
}


Compiler output:
main.c:25:5: error: redefinition of 'main'
   25 | int main(){
      |     ^~~~
main.c:2:5: note: previous definition of 'main' with type 'int()'
    2 | int main(){
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>

#define int unsigned long long

using namespace std;

int n;
int a[100000], b[100000];

unsigned main(void)
{
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    a[i] += ans;
    if (a[i] % b[i] == 0) {
      continue;
    }
    int n = a[i] / b[i];
    int d = b[i] * (n + 1) - a[i];
    ans += d;
  }
  cout << ans << endl;
  return 0;
}


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

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, m, n) for (int i = m, i < n; ++i)

#define INF 1000 * 1000

using namespace std;

int main() {
  long long a[100000], b[100000];
  long long c;

  long long n;
  cin >> n;

  rep(i, n)
    cin >> a[i] >> b[i];

  long long count = 0;

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

  cout << count << endl;

  return 0;

}



Compiler output:
a.cc:44:3: error: 'cout' does not name a type
   44 |   cout << count << endl;
      |   ^~~~
a.cc:46:3: error: expected unqualified-id before 'return'
   46 |   return 0;
      |   ^~~~~~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: Java

//package com.grand9;

import java.util.Scanner;

public class Main1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int 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();
        }

        long ans = 0;
        for(int i =N-1;i>=0;i-- ){
            if((A[i]+ans)%B[i]!=0L){
                long plus = ((A[i]+ans)/B[i]+1L)*B[i]-A[i]-ans;
                ans += plus;
            }

            //System.out.println(ans);
        }


        System.out.println(ans);


        sc.close();

    }

 }


Compiler output:
Main.java:5: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
        int s=0;
	for(int i=n;i>=1;i--){a[i]+=s;
	    if(a[i]<b[i]){ans+=b[i]-a[i];s+=b[i]-a[i];
                else{
                
                s+=b[i]-(a[i]-1)%b[i]-1;
		ans+=b[i]-(a[i]-1)%b[i]-1;}
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: expected '}' before 'else'
   20 |                 else{
      |                 ^~~~
a.cc:19:26: note: to match this '{'
   19 |             if(a[i]<b[i]){ans+=b[i]-a[i];s+=b[i]-a[i];
      |                          ^
Language: C

#include <stdio.h>

int main(){

     int i, j, n;
     int counter = 0;

     scanf("%d", &n);

     int buttonA[n];
     int buttonB[n];

     for(i = 0; i < n; i++){
          int a, b;
          scanf("%d %d", &a, &b);
          buttonA[i] = a;
          buttonB[i] = b;
     }


     for(i = n - 1; i >= 0; i--){

          int diff = 0;
          if(buttonB[i] - buttonA[i] % buttonB[i] > 0){
               diff = buttonB[i] - buttonA[i] % buttonB[i];
          else if(buttonA[i] == 0)
               diff = buttonB[i];

          counter += diff;
          for(j = i - 1; j >= 0; j--)
               buttonA[j] += diff;
     }




     printf("%d\n", counter);

     return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:11: error: expected '}' before 'else'
   26 |           else if(buttonA[i] == 0)
      |           ^~~~
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a=new long[n];
		long[] b=new long[n];
		long ans=0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextLong();
			b[i] = sc.nextLong();
		}

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

		System.out.println(ans);
		return;
	}
}

Compiler output:
Main.java:18: error: bad operand types for binary operator '&'
			}else if( (a[i]%b[i] + ans%b[i]) &b[i] != 0 ){
			                                 ^
  first type:  long
  second type: boolean
1 error
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:49: error: expected ';' before '}' token
   24 |                                 c[i]=x*b[i]-a[i]
      |                                                 ^
      |                                                 ;
   25 |                         }
      |                         ~
Language: C++

/*************************************************************************
	> File Name: A.cpp
	> Author: yxg 
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

typedef long long ll;
const ll INF = 1e18;
const int maxn = 1e9+10;

int a[maxn],b[maxn],n;

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

    cin >> n;
    for(int i=0; i<n; i++) cin>>a[i]>>b[i];
    
    int ans = 0;
    for(int i=n-1; i>=0; i--){
        if(a[i]%b[i] == 0) {
            if(i>=1) a[i-1]+=ans;
            continue;
        }
        if(a[i]<b[i])
            ans += b[i]-a[i];
        else
            ans += b[i]-(a[i]%b[i]);
        if(i>=1) a[i-1]+=ans;
//        cout << "aa " << ans << endl;
    }

    cout << ans << endl;    
}


Compiler output:
/tmp/ccIKiBFd.o: in function `main':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x84): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x9c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0xae): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0xe5): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x183): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
a.cc:(.text+0x1e7): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccIKiBFd.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:49: error: expected ';' before '}' token
   24 |                                 c[i]=x*b[i]-a[i]
      |                                                 ^
      |                                                 ;
   25 |                         }
      |                         ~
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",nd);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'nd' was not declared in this scope; did you mean 'n'?
   13 |         scanf("%d",nd);
      |                    ^~
      |                    n
a.cc:24:49: error: expected ';' before '}' token
   24 |                                 c[i]=x*b[i]-a[i]
      |                                                 ^
      |                                                 ;
   25 |                         }
      |                         ~
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",&d);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'd' was not declared in this scope
   13 |         scanf("%d",&d);
      |                     ^
a.cc:24:49: error: expected ';' before '}' token
   24 |                                 c[i]=x*b[i]-a[i]
      |                                                 ^
      |                                                 ;
   25 |                         }
      |                         ~
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",&d);
	for(int i=1;i<=n;i++){
		scnaf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'd' was not declared in this scope
   13 |         scanf("%d",&d);
      |                     ^
a.cc:15:17: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   15 |                 scnaf("%d%d",&a[i],&b[i]);
      |                 ^~~~~
      |                 scanf
a.cc:24:49: error: expected ';' before '}' token
   24 |                                 c[i]=x*b[i]-a[i]
      |                                                 ^
      |                                                 ;
   25 |                         }
      |                         ~
Language: C++

#include<iostream>
#include<cstring>
#include<ccstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",&d);
	for(int i=1;i<=n;i++){
		scnaf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]/b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

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

#include<iostream>
#include<cstring>
#include<ccstdio>
#include<algorithm>
#include<map>
using namespace std;
int n;
int a[100005];
int b[100005];
int c[100005];
long long ans=0; 
int main(){
	scanf("%d",&d);
	for(int i=1;i<=n;i++){
		scnaf("%d%d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++){
		if(a[i]<b[i]){
			c[i]=b[i]-a[i];
		}
		else{
			int x=a[i]\b[i];
			if(x*b[i]>a[i]){
				c[i]=x*b[i]-a[i]
			}
			else{
				c[i]=(x+1)*b[i]-a[i];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=c[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc:3:9: fatal error: ccstdio: No such file or directory
    3 | #include<ccstdio>
      |         ^~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a=new long[n];
		long[] b=new long[n];
		long ans=0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextLong();
			b[i] = sc.nextLong();
		}

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

		System.out.println(ans);
		return;
	}
}

Compiler output:
Main.java:20: error: ';' expected
				ans -= a[i]%b[i]
				                ^
1 error
Language: C++

#include<stdio.h>
int a[100005],b[100005];
int main()
{
	int t,i,j,c;
	while(scanf("%d",&n)!=EOF)
	{
		c=0;
		for(i=0;i<n;i++)
			scanf("%d%d",&a[i],&b[i]);
		for(i=n-1;i>=0;i--)
		{
			while(a[i]%b[i]!=0)
			{
				for(j=0;j<=i;j++)
					a[j]++;
			}
			c++;
		}
		printf("%d\n",c);
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: 'n' was not declared in this scope
    6 |         while(scanf("%d",&n)!=EOF)
      |                           ^
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		boolean[] used = new boolean[n];
		int[] appear = new int[n];
		int ans = 0;
		int max = 0;
		int p = 0;

		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
			appear[ a[i]-1 ]++;
			if( appear[ a[i]-1 ] > max ){
				p = 
		}


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

		System.out.println(ans);
		return;
	}
}

Compiler output:
Main.java:19: error: illegal start of expression
		}
		^
Main.java:34: error: reached end of file while parsing
}
 ^
2 errors
Language: C++

#include<stdio.h>
int a[100005],b[100005];
int main()
{
	int t,i,j,c;
	while(scanf("%d",&n)!=EOF)
	{
		c=0;
		for(i=0;i<n;i++)
			scanf("%d%d",&a[i],&b[i]);
		for(i=n-1;i>=0;i++)
		{
			while(a[i]%b[i]!=0)
			{
				for(j=0;j<=i;j++)
					a[j]++;
			}
			c++;
		}
		printf("%d\n",c);
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: 'n' was not declared in this scope
    6 |         while(scanf("%d",&n)!=EOF)
      |                           ^