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

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
const int MAX = 1000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i=2; i<MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
    string n;
    int k;
    cin >> n;
    cin >> k;
    int count = 0, i = 0, result = 0;
    int mul = 1;
    for(int i=0; i<k; i++) mul *= 9;
    while(count < k || i < n.length()){
        if(n[i] != '0'){
            result += (int)(n[i] - '1') * mul * COM(n.length - i, k-count-1);
            mul /= 9;
            result += mul * COM(n.length - i, k-count-1);

        }
        i++;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:55: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   38 |             result += (int)(n[i] - '1') * mul * COM(n.length - i, k-count-1);
      |                                                     ~~^~~~~~
      |                                                             ()
a.cc:40:35: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   40 |             result += mul * COM(n.length - i, k-count-1);
      |                                 ~~^~~~~~
      |                                         ()
Language: C++

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

int main(){
	string n;
	int k;
	cin>>n;
	cin>>k;
	long long ans=0;
	if(k==1){
		ans+=n[0]-'0';
		int x=n.size()-1;
		ans+=x*9;
	}
	if(k==2){
		int x=n.size()-1;
		ans+=(n[0]-'0'-1)*x*9;
		int y=1;
		whilea(n[y]-'0'==0) y++; 
		ans+=n[y]-'0';
		for(int i=y+1;i<n.size();i++) ans+=n[i]-'0';
		for(int i=x;i>=2;i--){
			ans+=(9*9*(i-1));
		}
	}
	if(k==3){
		int x=n.size()-1;
		ans+=(n[0]-'0'-1)*x*(x-1)*81/2;
//		cout<<ans<<endl;
		int y=1;
		while(n[y]-'0'==0) y++;
//		cout<<y<<endl;
		for(int i=y;i<x;i++){
			for(int j=i+1;j<=x;j++){
				if(i==1&&j==i+1&&n[i]-'0'>0) ans+=(n[i]-'0'-1)*9+n[j]-'0';
				else ans+=9*9;
			}
		}
//		cout<<ans<<endl;
		for(int i=x;i>=3;i--){
			for(int j=i-1;j>=2;j--){
				ans+=9*9*9*(j-1);
			}
		}
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'whilea' was not declared in this scope
   20 |                 whilea(n[y]-'0'==0) y++;
      |                 ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int num,n,m,w,k;
long long ans=0;
string x;
void func(int a,int b,int c){
	string temp="";
	for(int i=0;i<num;i++)
		temp+='0';
	if(b==999){
		for(int i='1';i<='9';i++){
			temp[a]=i;
			if(temp=<x)
				ans++;
		}
		return;
	}
	else if(c==999){
		for(int i='1';i<='9';i++)
			for(int j='1';j<='9';j++){
				temp[a]=i;
				temp[b]=j;
				if(temp=<x)
					ans++;
			}
		return; 
	}
	for(int i='1';i<='9';i++)
		for(int j='1';j<='9';j++)
			for(int f='1';f<='9';f++){
				temp[a]=i;
				temp[b]=j;
				temp[c]=f;
				if(temp=<x)
					ans++;
			}
	return;
}
int main(){
	cin>>x>>k;
	num=x.size();
	if(k==1){
		for(int i=0;i<num;i++)
			func(i,999,999);
		cout<<ans;
		return 0;
	}
	else if(k==2){
		for(int i=1;i<num;i++)
			for(int j=0;j<i;j++)
				func(j,i,999);
		cout<<ans;
		return 0;
	}
	for(int i=2;i<num;i++)
		for(int j=1;j<i;j++)
			for(int f=0;f<j;f++)
				func(f,j,i);
	cout<<ans;
	return 0; 
}

Compiler output:
a.cc: In function 'void func(int, int, int)':
a.cc:13:33: error: expected primary-expression before '<' token
   13 |                         if(temp=<x)
      |                                 ^
a.cc:23:41: error: expected primary-expression before '<' token
   23 |                                 if(temp=<x)
      |                                         ^
a.cc:34:41: error: expected primary-expression before '<' token
   34 |                                 if(temp=<x)
      |                                         ^
Language: C++

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

int main(){
  string N;
  cin>>N;
  int K;
  cin>>K;

  if(K==1){
    if(N.size()==1) cout<<N[0]<<endl;
    if(N.size()>1){
      int n=N[0]-'0';
      int64_t ans;
      ans += (int64_t)pow(9,N.size()-1);
      ans += n;
      cout<<ans<<endl;
    }
  }
  else if(K==2){
    if(N.size()==1) cout<<0<<endl;
    else if(N.size()>=2){
      int n=N.size();
      int64_t sum=0;
      vector<int> a(n,0);
      for(int i=0;i<N.size();++i){
        a[i]=N[i]-'0';
      }
      for(int i=1;i<=9;++i){
        for(int j=1;j<=9;++j){
          for(int k=0;k<n;++k){
            for(int l=k+1;l<n;++l){
              vector<int> b(n,0);
              b[k]=i;
              b[l]=j;
              if(a>=b){
                ++sum;
              }
            }
          }
        }
      }
      cout<<sum<<endl;
  }
}

   else if(K==3){
     if(N.size()<=2) cout<<0<<endl;
     else {
     int n=N.size();
     int64_t sum=0;
     vector<int> v(n,0);
     for(int i=0;i<N.size();++i){
       v[i]=N[i]-'0';
     }
     
     for(int i=1;i<=9;++i){
       for(int j=1;j<=9;++j){
         for(int k=1;k<=9;++k){
         for(int a=0;a<n;++a){
           for(int b=a+1;b<n;++b){
           for(int c=b+1;c<n;++c){
             vector<int> w(n,0);
             w[a]=i;
             w[b]=j;
             w[c]=k;
             if(v>=w){
               ++sum;
             }
           }
         }
       }
     }
    }
   }
 }
  cout<<sum<<endl;
  }

}

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

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

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

    reverse(n.begin(), n.end());

    if (k == 1)
    {
        int ans = 0;
        for (int i = 0; i < n.size(); i++)
        {
            if (i == n.size() - 1)
            {
                ans += n[i] - '1' + 1;
            }
            else
            {
                ans += 9;
            }
        }
        cout << ans << endl;
    }
    else if (k == 2)
    {
        int ans = 0;
        for (int i = 0; i < n.size(); i++)
        {
            for (int j = i + 1; j < n.size(); j++)
            {
                if (j == n.size() - 1)
                {
                    ans += (n[j] - '1') * 9;
                    if (i == n.size() - 2)
                    {
                        ans += (n[i] - '1' + 1);
                    }
                    else
                    {
                        ans += 9;
                    }
                }
                else
                {
                    ans += 9 * 9;
                }
            }
        }
        cout << ans << endl;
    }
    else
    {
        array<int, 1> vs;
        vs[-1000] = 0;
        cout << -1 << endl;
        return;
        int64_t ans = 0;
        for (int i = 0; i < n.size(); i++)
        {
            for (int j = i + 1; j < n.size(); j++)
            {
                for (int l = j + 1; l < n.size(); l++)
                {
                    if (l == n.size() - 1)
                    {
                        ans += (n[l] - '1') * 81;

                        if (j == n.size() - 2)
                        {
                            ans += (n[j] - '1') * 9;

                            if (i == n.size() - 3)
                            {
                                ans += (n[i] - '1' + 1);
                            }
                            else
                            {
                                ans += 9;
                            }
                        }
                        else
                        {
                            ans += 9 * 9;
                        }
                    }
                    else
                    {
                        ans += 9 * 9 * 9;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   70 |         return;
      |         ^~~~~~
Language: C++

N=int(input())
K=int(input())
an_cnt=0
for i in range(N+1):
    cnt=0
    moji=list(str(i))
    for m in moji:
        if m!='0':
            cnt+=1
    if cnt==K:
        
        an_cnt+=1
print(an_cnt)

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

#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<cassert>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)

typedef long long i64;
typedef pair<i64,i64> P;

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


string s;
int k;

i64 mod_pow(i64 x, i64 y, i64 mod){
	i64 res = 1;
	while(y > 0){
		if(y & 1) res = res * x % mod;
		x = x*x %mod;
		y >>= 1;
	}
	return res;
}

int main(){
	cin >> s;
	cin >> k;
	int n = s.size();
	
	P p[3];
	int c = 0;
	for(int i = 0; i < n; i++){
		if(s[i] != '0'){
			p[c] = P(s[i]-'0', n-i-1);
			c++;
		}
		if(c == k) break;
	}
	
	i64 ans = 0;
	if(k == 3){
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(k < n-1){
					ans += 9 * 9 * 9;
				}
				else{
					if(p[1].second > j){
						ans += 9 * 9 * p[0].first;
					}
					else if(p[1].second == j && p[2].second > i){
						ans += 9 * p[1].first * p[0].first;
					}
					else if(p[1].second == j && p[2].second == i){
						ans += (p[2].first);
						ans += 9 * (p[1].first-1);
						ans += 9 * 9 * (p[0].first-1);
					}
					else if(p[1].second == j){
						ans += 9 * (p[1].fisrt-1);
						ans += 9 * 9 * (p[0].first-1);
					}
					else{
						ans += 9 * 9 * (p[0].first-1);
					}
				}
				ans %= INF;
			}
		}
	}
	}
	if(k == 2){
		for(int j = 0; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(k < n-1){
					ans += 9 * 9;
				}
				else{
					if(p[1].second > j){
						ans += 9 * p[0].first;
					}
					else if(p[1].second == j){
						ans += 9 * (p[0].first-1);
						ans += p[1].first;
					}
					else{
						ans += 9 * (p[0].first-1);
					}
				}
				ans %= INF;
			}
		}
	}
	if(k == 1){
		for(int k = 0; k < n; k++){
			if(k < n-1){
				ans += 9;
			}
			else{
				ans += p[0].first;
			}
			ans %= INF;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:66: error: 'P' {aka 'struct std::pair<long long int, long long int>'} has no member named 'fisrt'; did you mean 'first'?
   75 |                                                 ans += 9 * (p[1].fisrt-1);
      |                                                                  ^~~~~
      |                                                                  first
Language: C

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

long int calc1(long int keta, long int k);
long int calc2(long int keta, long int k);

int main(void)
{
	long int i, j, k;
	long int k;
	long int ans = 0;
	long int count = 0;
	long int keta[3];
	char n[200];
	
	scanf("%s %ld", n, &k);
	
	for(i = 0; i < strlen(n); i++) {
		if(n[i] != '0') {
			keta[count] = strlen(n) - i;
			count++;
		}
		if(count == k) {
			break;
		}
	}
	
	if(k == 1) {
		printf("%ld\n", (n[0] - '0') + (keta[0] - 1) * 9);
		return 0;
	} else if(k == 2) {
		ans = (keta[1] - '0') + calc2(keta[1] - 1, 1);
		ans += (keta[0] - '0') * calc2(keta[0] - 1, 1);
		printf("%ld\n", ans);
		return 0;
	} else {
		return 0;
	}
	
	return 0;
}
//最上位桁が必要
long int calc1(long int keta, long int k)
{
	if(k == 1) {
		return 9;
	} else if(k == 2) {
		return 9 * 9 * (keta - 1);
	} else {
		return 9 * calc2(keta - 1, 2);
	}
}

//最上位桁が必要ない
long int calc2(long int keta, long int k)
{
	if(k == 1) {
		return 9 * keta;
	} else if(k == 2) {
		return 9 * 9 * keta * (keta - 1) / 2;
	} else {
		return 9 * 9 * 9 * keta * (keta - 1) * (keta - 2) / 6;
	}
}

Compiler output:
main.c: In function 'main':
main.c:14:18: error: redeclaration of 'k' with no linkage
   14 |         long int k;
      |                  ^
main.c:13:24: note: previous declaration of 'k' with type 'long int'
   13 |         long int i, j, k;
      |                        ^
Language: C++

#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)

typedef long long i64;
typedef pair<i64,i64> P;

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


string s;
int k;

i64 mod_pow(i64 x, i64 y, i64 mod){
	i64 res = 1;
	while(y > 0){
		if(y & 1) res = res * x % mod;
		x = x*x %mod;
		y >>= 1;
	}
	return res;
}

int main(){
	cin >> s;
	cin >> k;
	int n = s.size();
	
	P p[3];
	int c = 0;
	for(int i = 0; i < n; i++){
		if(s[i] != '0'){
			p[c] = P(s[i]-'0', n-i-1);
			c++;
		}
		if(c == k) break;
	}
	
	i64 ans = 0;
	if(k == 3){
		assert(0);
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(k < n-1){
					ans += 9 * 9 * 9;
				}
				else{
					if(p[1].second > j){
						ans += 9 * 9 * p[0].first;
					}
					else if(p[1].second == j && p[2].second > i){
						ans += 9 * p[1].first * p[0].first;
					}
					else if(p[1].second == j && p[2].second == i){
						ans += (p[2].first);
						ans += 9 * (p[1].first-1);
						ans += 9 * 9 * (p[0].first-1);
					}
					else{
						ans += 9 * 9 * (p[0].first-1);
					}
				}
				ans %= INF;
			}
		}
	}
	}
	if(k == 2){
		for(int j = 0; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(k < n-1){
					ans += 9 * 9;
				}
				else{
					if(p[1].second > j){
						ans += 9 * p[0].first;
					}
					else if(p[1].second == j){
						ans += 9 * (p[0].first-1);
						ans += p[1].first;
					}
					else{
						ans += 9 * (p[0].first-1);
					}
				}
				ans %= INF;
			}
		}
	}
	if(k == 1){
		for(int k = 0; k < n; k++){
			if(k < n-1){
				ans += 9;
			}
			else{
				ans += p[0].first;
			}
			ans %= INF;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:17: error: 'assert' was not declared in this scope
   55 |                 assert(0);
      |                 ^~~~~~
a.cc:10:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    9 | #include<bitset>
  +++ |+#include <cassert>
   10 | #include<tuple>
Language: C++

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

// 桁数を求めるプログラム
unsigned GetDigit(ll num)
{
  return log10(num) + 1;
}

void calc_one(ll N){
  int digit = GetDigit(N);
  ll ans = 9 * (digit - 1);
  // 最後の桁については細かく調べる
  ll num = pow(10, (digit - 1));
  ll i = num;
  while(i <= N){
    cout << i << endl;
    ans++;
    i += num;
  }
  cout << ans << endl; 
}

void calc_two(ll N){
  int digit = GetDigit(N);
  int i = 2;
  while(i < digit){ // 近い桁までたす
    ans += pow(9, i);
    i++;
  }
  cout << ans << endl;
  
  
}


void calc_three(ll N){
    // 100以下の場合はそもそも0こ
    if (N<=100) cout << 0 << endl;
    else {

    }
      cout << 0 << endl;

  
}

int main() {
  ll N; int K;
  cin >> N >> K;
  
  // 1の時
  if (K==1){
    calc_one(N);
  } else if(K==2){
    calc_two(N);
  } else {
    calc_three(N);
  }
  

}


Compiler output:
a.cc: In function 'void calc_two(long long int)':
a.cc:41:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |     ans += pow(9, i);
      |     ^~~
      |     abs
a.cc:44:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

using ll = long long;

// 組合せを素数で割った値を求める
const int MAX = 510000;
const ll MOD = 1e18 + 7;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int k;
  cin >> s >> k;
  
  if(k == 1){
    int x = s.at(0) - 48;
    cout << (s.size() - 1) * 9 + x << '\n';
  }
  
  COMinit();
  
  if(k == 2){
    if(s.size() < 2){
      cout << 0 << '\n';
      return 0;
    }
    
    int x = s.at(0) - 48, y = s.at(1) - 48;
    ll ans = (s.size() - 1) * (s.size() - 2) / 2 * 81;
    ans += x * (s.size() - 2) * 9;
    ans += (x - 1) * 9 + y;
    cout << ans << '\n';
  }
  
  if(k == 3){
    if(s.size() < 3){
      cout << 0 << '\n';
      return 0;
    }
    
    int x = s.at(0) - 48, y = s.at(1) - 48, z = s.at(2) - 48;
    
    if(s.size() == 3){
      int num = stoi(s);
      ll ans = (x - 1) * 81;
      if(y != 0) ans += (y - 1) * 9 + z;
      cout << ans << '\n';
      return 0;
    }
    
    ll ans = (s.size() - 1) * (s.size() - 2) * (s.size() - 3) / 6 * 729;
    ans += x * (s.size() - 2) * (s.size() - 3) / 2 * 81;
    if(z != 0) ans += ((x - 1) * 9 + y) * (s.size() - 3) * 9;
    else if(s.size() >= 4){
      w = s.at(3) - 48;
      ans += ((x - 1) * 9 + y) * ((s.size() - 4) * 9 + w);
    }
    if(y != 0) ans += (x - 1) * 81 + (y - 1) * 9 + z;
    else ans += (x - 1) * 81;
    cout << ans << '\n';
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:7: error: 'w' was not declared in this scope
   78 |       w = s.at(3) - 48;
      |       ^
Language: C++

#include<stdio.h>
#include<string.h>

char n[101];
int k,l,dp[100][4],bd[100][4];

int max(int a,int b){return a>b?a:b;}

int main(){
  scanf("%s%d",n,&k);
  l=strlen(n);
  dp[0][1]=n[0]-'1';
  bd[0][1]=1;
  for(int i=1;i<l;i++){
    if(s[i]=='0'){
      bd[i][1]=bd[i-1][1];
      bd[i][2]=bd[i-1][2];
      bd[i][3]=bd[i-1][3];
    }
    else{
      bd[i][2]=bd[i-1][1];
      bd[i][3]=bd[i-1][2];
    }
    dp[i][1]=dp[i-1][1]+9+bd[i-1][1];
    dp[i][2]=dp[i-1][2]+dp[i-1][1]*9+bd[i-1][1]*(n[i]-'0')+bd[i-1][2];
    dp[i][3]=dp[i-1][3]+dp[i-1][2]*9+bd[i-1][2]*(n[i]-'0')+bd[i-1][3];
  }
  printf("%d",dp[l-1][k]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 's' was not declared in this scope
   15 |     if(s[i]=='0'){
      |        ^
Language: Java

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.text.*;

public class ABC154A {

	static char[] arr;
	static BigInteger[][][] dp;
	static BigInteger zero = BigInteger.ZERO, one = BigInteger.ONE;

	public static BigInteger dp(int idx, int less, int rem) {
		if (rem < 0)
			return zero;
		if (idx == arr.length)
			return rem == 0 ? one : zero;
		if (dp[idx][less][rem] != null)
			return dp[idx][less][rem];
		if (less == 1) {
			BigInteger ans = zero;
			ans = ans.add(dp(idx + 1, less, rem));
			for (int i = 1; i <= 9; i++) {
				ans = ans.add(dp(idx + 1, less, rem - 1));
			}
			return dp[idx][less][rem] = ans;
		} else {
			BigInteger ans = zero;
			ans = ans.add((dp(idx + 1, arr[idx] == '0' ? 0 : 1, rem)));
			for (char i = '1'; i < arr[idx]; i++) {
				ans = ans.add((dp(idx + 1, 1, rem - 1)));
			}
			ans = ans.add((dp(idx + 1, 0, rem - 1)));
			return dp[idx][less][rem] = ans;
		}
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		arr = sc.next().toCharArray();
		int k = sc.nextInt();
		dp = new BigInteger[arr.length][2][k + 1];

		pw.println(dp(0, 0, k));
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < arr.length; i++)
				arr[i] = nextInt();
			return arr;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int f,m=0;
  cin>>s>>f;
  if(f==1){
    if(s.size()>1)
      m+=9;
    else{
      m+=f;
      cout<<m;
      return 0;
    }
    while(s!="0"){
      int o=s.size();
      o-=2;
      m+=o*10;
      s=substr(0,s.size()-2);
    }
  }
  else if(f==2){
    if(s.size()>2)
      m+=81;
    
  }
  cout<<m;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   19 |       s=substr(0,s.size()-2);
      |         ^~~~~~
      |         strstr
Language: C++

#include<stdio.h>
#include<string.h>

char n[101];
int k,l,dp[100][4],bd[100][4];

int max(int a,int b){return a>b?a:b;}

int main(){
  scanf("%s%d",n,&k);
  l=strlen(n);
  dp[0][1]=s[0]-'1';
  bd[0][1]=1;
  for(int i=1;i<l;i++){
    if(s[i]=='0'){
      bd[i][1]=bd[i-1][1];
      bd[i][2]=bd[i-1][2];
      bd[i][3]=bd[i-1][3];
    }
    else{
      bd[i][2]=bd[i-1][1];
      bd[i][3]=bd[i-1][2];
    }
    dp[i][1]=dp[i-1][1]+9+bd[i-1][1];
    dp[i][2]=dp[i-1][2]+dp[i-1][1]*9+bd[i-1][1]*(n[i]-'0')+bd[i-1][2];
    dp[i][3]=dp[i-1][3]+dp[i-1][2]*9+bd[i-1][2]*(n[i]-'0')+bd[i-1][3];
  }
  printf("%d",dp[l-1][k]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 's' was not declared in this scope
   12 |   dp[0][1]=s[0]-'1';
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5000001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
    ll int dp[4][105],fact[101];
    fact[0]=1;
    fo(i,1,101)
    fact[i]=fact[i-1]*i;
    fo(i,0,4)
    fo(j,0,101)
    {
        if(j>=i)
        {
            if(i==1)
        dp[i][j]=j;
        else if(i==2)
        dp[i][j]=(j*(j-1))/2;
        else dp[i][j]=(j*(j-1)*(j-2))/6;
        }
        else dp[i][j]=0;
        fo(k,1,i+1)
        dp[i][j]*=9;
    }
    fo(j,0,101)
    dp[0][j]=1;
  string s;
  cin>>s;
  int k;
  cin>>k;
  int y=k;
  int n=sz(s);
  ll int ans=0,cnt=0;
  fo(i,0,n)
  {
      
      ll int h=(s[i]-'0'-1);
      if(h>=0) cnt++;
    //cout<<n-i-1<<" "<<k<<" "<<h<<endl;
      if(h>0)
      ans=ans+h*dp[k-1][n-i-1];
      if(h>=0)
      {
      ans+=dp[k][n-i-1];
      //cout<<dp[k][n-i-1]<<" "<<dp[k-1][n-i-1]<<endl;
      
      k--;
      }
      if(k==0) break;a
  }
  int fg=0;
  if(cnt==y) fg=1;
 
  cout<<ans+fg;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:22: error: 'a' was not declared in this scope
   72 |       if(k==0) break;a
      |                      ^
Language: C++

#include<stdio.h>
#include<string.h>

char n[101];
int k,l,dp[100][4],bd[100][4];

int max(int a,int b){return a>b?a:b;}

int main(){
  scanf("%s%d",n,&k);
  l=strlen(n);
  dp[0][1]=s[0]-'1';
  bd[0][1]=1;
  for(int i=1;i<l;i++){
    if(s[i]=='0'){
      bd[i][1]=bd[i-1][1];
      bd[i][2]=bd[i-1][2];
      bd[i][3]=bd[i-1][3];
    }
    else{
      bd[i][2]=bd[i-1][1];
      bd[i][3]=bd[i-1][2];
    }
    dp[i][1]=dp[i-1][1]+9+bd[i-1][1];
    dp[i][2]=dp[i-1][2]+dp[i-1][1]*9+bd[i-1][1]*(s[i]-'0')+bd[i-1][2];
    dp[i][3]=dp[i-1][3]+dp[i-1][2]*9+bd[i-1][2]*(s[i]-'0')+bd[i-1][3];
  }
  printf("%d",dp[l-1][k]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 's' was not declared in this scope
   12 |   dp[0][1]=s[0]-'1';
      |            ^
Language: Java

mport java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int count = 0;
        for (int i=1;i<=n/2;i++){
            String temp = Integer.toString(i).replace("0","");
            if (temp.length() == k)
                count++;
        }
        System.out.println(count);

    }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

string num;
int k;

int dfs(int idx,bool limit,int k){
	if(k<0) return 0;
	if(idx==0) {
		if(k>1) return 0;
		else if(k==0) return 1;
		else {
			if(limit) return num[idx]-'0';
			else return 9;
		} 
	}
	int up = limit? num[idx]-'0' : 9;
	if(limit) return dfs(idx-1,limit,k-1)+dfs(idx-1,false,k-1)*(up-1)+dfs(idx-1,false,k);
	else return dfs(idx-1,false,k-1)*up + dfs(idx-1,false,k);

}

int main(){
	//freopen("in","r",stdin);
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> num >> k;
	reverse(num.begin(),num.end());
	int res = dfs(num.size()-1,true,k);
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'reverse' was not declared in this scope
   30 |         reverse(num.begin(),num.end());
      |         ^~~~~~~
Language: C++

// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		string s;
		int len, k = -1;
		cin >> s >> k;
		if (k <= 0) break;
		len = (int)s.length();
		vector<int> r(len), w(len);
		for (int i = 0; i < len; ++i) {
			r[i] = s[i] - '0';
		}
		int ans = 0;
		switch (k) {
		case 1:
			for (int i = 0; i < len; ++i) {
				for (int a = 1; a <= 9; ++a) {
					if (i == 0 && a > r[0]) break;
					w[i] = a;
					if (w <= r) {
						++ans;
					}
					w[i] = 0;
				}
			}
			break;
		case 2:
			for (int i = 0; i < len; ++i) {
				for (int a = 1; a <= 9; ++a) {
					if (i == 0 && a > r[0]) break;
					bool x = i == 0 && a == r[0];
					if (x) w[0] = a;
					for (int j = i + 1; j < len; ++j) {
						for (int b = 1; b <= 9; ++b) {
							if (x) w[j] = b;
							if (w <= r) {
								++ans;
							}
						}
						if (x) w[j] = 0;
					}
				}
			}
			break;
		case 3:
			for (int i = 0; i < len; ++i) {
				for (int a = 1; a <= 9; ++a) {
					if (i == 0 && a > r[0]) break;
					bool x = i == 0 && a == r[0];
					if (x) w[0] = a;
					for (int j = i + 1; j < len; ++j) {
						for (int b = 1; b <= 9; ++b) {
							if (x) w[j] = b;
							for (int k = j + 1; k < len; ++k) {
								for (int c = 1; c <= 9; ++c) {
									if (x) {
										w[k] = c;
										if (w <= r) {
											++ans;
										}
									} else {
										++ans;
									}
								}
								if (x) w[k] = 0;
							}
						}
						if (x) w[j] = 0;
					}
				}
			}
			break;
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:18:29: error: break statement not within loop or switch
   18 |                 if (k <= 0) break;
      |                             ^~~~~
Language: C++

#include "stdafx.h"
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
using namespace std;
int x[1000000];
string s;
int n;
int nCr(int a, int b) {
	if (a < b)return 0;
	int z = 1;
	for (int i = a; i > a - b; i--) {
		z *= i;
	}
	for (int i = 1; i <= b; i++) {
		z /= i;
	}
	return z;
}
int mutu(int x,int y) {
	if (y == n)return 1;
	if (x >= s.size())return 0;
	if (s[x] == '0') {
		return mutu(x + 1, y);
	}
	else {
		return nCr((int)s.size() - x - 1, n - y)*pow(9, n - y) + nCr((int)s.size() - x - 1, n - y - 1)*(s[x] - '1')*pow(9, n - y - 1) + mutu(x + 1, y + 1);
	}
}
signed main() {
	cin >> s >> n;
	cout<<mutu(0, 0)<<endl;
}

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

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  Combination<MOD> comb(100000);

  string s; cin >> s;
  int k; cin >> k;
  int dig = SZ(s);
  vector<int> a(dig);
  for(int i=0;i<dig;++i) {
    a[i] = s[i] - '0';
  }

  ll ans = 0;
  ll mul = 1;
  for(int i=0;i<k;++i) {
    mul *= 9;
  }
  for(int i=k;i<dig;++i) {
    ans += mul * comb.C(i-1, k-1);
  }

  vector<vector<vector<ll>>> dp(dig, vector<vector<ll>>(k+1, vector<ll>(2, 0)));
  if(a[0] > 0) {
    dp[0][1][1] = 1;
    dp[0][1][0] = a[0] - 1;
  }

  for(int i=0;i<dig-1;++i) {
    for(int j=0;j<k+1;++j) {
      dp[i+1][j][0] += dp[i][j][0]; // 0えらぶ
      if(j > 0) dp[i+1][j][0] += 9 * dp[i][j-1][0]; // 0以外えらぶ
      if(a[i+1] > 0) {
        dp[i+1][j][0] += dp[i][j][1]; // 0えらぶ
        if(j > 0) dp[i+1][j][0] += (a[i+1]-1) * dp[i][j-1][1]; // 0以外えらぶ
      }

      if(a[i+1] == 0) dp[i+1][j][1] += dp[i][j][1]; // ちょうど
      else if(j > 0) dp[i+1][j][1] += dp[i][j-1][1]; // ちょうど
    }
  }



  ans += dp[dig-1][k][1] + dp[dig-1][k][0];


  cout << ans << endl;
}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>

long long count2(long long first, long long second, long long size) {
	return (size - 1) * (size - 2) / 2 * 81 + (first - 1) * (size - 1) * 9 + (size - 2) * 9 + second;
}

long long count3(long long first, long long second, long long third, long long size) {
	return (size - 1) * (size - 2) * (size - 3) / 6 * 729 + (first - 1) * count2(9, 9, size - 1) + count2(second, third, size - 1);
}

long long main() {
	std::string n;
	std::cin >> n;
	
	long long k;
	std::cin >> k;
	
	if(k > n.size()){
		std::cout << 0 << std::endl;
		return 0;
	}
	
	if(k == 1){
		std::cout << 9*(n.size() - 1) + n[0] - '0' << std::endl;
		return 0;
	}
	if(k == 2){
		std::cout << count2(n[0] - '0', n[1] - '0', n.size()) << std::endl;
		return 0;
	}
	if(k == 3){
		std::cout << count3(n[0] - '0', n[1] - '0', n[2] - '0', n.size()) << std::endl;
		return 0;
	}
}

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

#include <bits/stdc++.h>

#define task "E"
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (ll i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define db1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define db2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define db3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, n) { cerr << #A << " = "; rep(_, 1, n) cerr << A[_] << ' '; cerr << '\n'; }
#define SZ(x) ((ll)(x).size())
#define pb push_back
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;

typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;
string s;
ll k;
ll res;
inline ll C(ll k, ll n)
{
    if (k == 0) return 1;
    if (k == 1) return n;
    if (k == 2) return n * (n - 1) / 2;
    return n * (n - 1) * (n - 2) / 6;
}
inline mu(ll k)
{
    if (k == 0) return 1;
    if (k == 1) return 9;
    if (k == 2) return 9 * 9;
    return 9 * 9 * 9;
}
void Solve(ll pos, ll num_l)
{
    if (pos == SZ(s) || num_l == 0) return;
    rep(i, 0, s[pos] - '1') res += C(num_l - (i != 0), SZ(s) - pos - 1) * mu(num_l - (i != 0));
    Solve(pos + 1, num_l - (s[pos] != '0'));
}
int main()
{
	//freopen(task".in","r",stdin);
	//freopen(task".out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	cin >> s >> k;
	Solve(0, k);
	cout << res + 1;
}


Compiler output:
a.cc:45:8: error: ISO C++ forbids declaration of 'mu' with no type [-fpermissive]
   45 | inline mu(ll k)
      |        ^~
Language: C++

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

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

#define MAXCHAR 255
#define ll unsigned long long

using namespace std;
const ll dividend = 1000000007;

ll funcComb(int n, int k) 
{
	ll output = 1;
	int sum = n + k;
	vector<int> dividends;
	for (int i = 0; i < k; i++)
	{
		dividends.push_back(k - i);
	}
	for (int i = 0; i < k; i++)
	{
		output *= sum - i;
		for (auto it = dividends.begin(); it != dividends.end(); it++)
		{
			if (output % *it == 0)
			{
				output /= *it;
				*it = LONG_MAX;
			}
		}
	}

	return output % dividend;
}

int main()
{
	int r1;
	int r2;
	int c1;
	int c2;
	cin >> r1 >> c1 >> r2 >> c2;
	ll output = 0;
	output = funcComb(r2 + 1, c2 + 1) - funcComb(r2 + 1, c1) - funcComb(r1, c2 + 1) + funcComb(r1, c1);
	cout << output << endl;
	return 0;
}

Compiler output:
a.cc: In function 'long long unsigned int funcComb(int, int)':
a.cc:36:39: error: 'LONG_MAX' was not declared in this scope
   36 |                                 *it = LONG_MAX;
      |                                       ^~~~~~~~
a.cc:12:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <queue>
  +++ |+#include <climits>
   12 |
Language: C++

#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

constexpr int MOD = 1e9 + 7; // 1e9 + 7

#include "Factorial.h"
#include "Modint.h"

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // f(r,c) = r+cCr = (r+c)! / r! / c!

  // abc+ade = a(bc+de)

  // 分子
  //  (r+c)!  (r+c+1)! (r+c+2)!
  //
  // (r+c+1)! (r+c+2)!
  //
  // (r+c+2)!

  // 分母
  //   r!c!     r!(c+1)!    r!(c+2)!
  //
  // (r+1)!c! (r+1)!(c+1)!
  //
  // (r+2)!c!

  // r1 = 0, c1 = 0 なら計算できるか？
  // r1 = 0, c1 = 0 での r2, c2 に対する解を g(r2, c2)とする

  // 0C0 1C0 2C0
  // 1C1 2C1 3C1
  // 2C2 3C2 4C2

  // f(r,c)
  // 1 1  1  1
  // 1 2  3  4
  // 1 3  6 10
  // 1 4 10 20
  //
  // g(r,c)
  // 1  2  3  4
  // 2  5  9 14
  // 3  9 19 34
  // 4 14 34 69

  //           r  c
  // g(r,c) = Σ Σ (a+b)Ca
  //          a=0 b=0

  // 分子
  // 0! 1! 2!
  // 1! 2! 3!
  // 2! 3! 4!

  // 分母
  // 0!0! 0!1! 0!2!
  //
  // 1!0! 1!1!
  //
  // 2!0!

  // 解説を読む
  //
  //           c
  // f(r,c) = Σ f(r-1,a)
  //          a=0
  // これを用いると、g(r,c)の計算がO(N^2)からO(N)になる

  // g(r,c) = f(1, c) + f(2,c) + ... f(r + 1,c)

  // さらに上の式をもう一度使うと
  // g(r,c) = f(r +1, c + 1) - f(0, c)



  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  Factorial fc(r2 + 1 + c2 + 1, MOD);

  auto g = [&fc](int r, int c)->mint<MOD> {
    mint<MOD> rs = fc.Ncr(r + 1 + c + 1, c + 1) - 1;
    return rs;
  };

  mint<MOD> result = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1);
  cout << result.val;
}
#endif


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

#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

constexpr int MOD = 1e9 + 7; // 1e9 + 7

#include "Factorial.h"
#include "Modint.h"

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // f(r,c) = r+cCr = (r+c)! / r! / c!

  // abc+ade = a(bc+de)

  // 分子
  //  (r+c)!  (r+c+1)! (r+c+2)!
  //
  // (r+c+1)! (r+c+2)!
  //
  // (r+c+2)!

  // 分母
  //   r!c!     r!(c+1)!    r!(c+2)!
  //
  // (r+1)!c! (r+1)!(c+1)!
  //
  // (r+2)!c!

  // r1 = 0, c1 = 0 なら計算できるか？
  // r1 = 0, c1 = 0 での r2, c2 に対する解を g(r2, c2)とする

  // 0C0 1C0 2C0
  // 1C1 2C1 3C1
  // 2C2 3C2 4C2

  // f(r,c)
  // 1 1  1  1
  // 1 2  3  4
  // 1 3  6 10
  // 1 4 10 20
  //
  // g(r,c)
  // 1  2  3  4
  // 2  5  9 14
  // 3  9 19 34
  // 4 14 34 69

  //           r  c
  // g(r,c) = Σ Σ (a+b)Ca
  //          a=0 b=0

  // 分子
  // 0! 1! 2!
  // 1! 2! 3!
  // 2! 3! 4!

  // 分母
  // 0!0! 0!1! 0!2!
  //
  // 1!0! 1!1!
  //
  // 2!0!

  // 解説を読む
  //
  //           c
  // f(r,c) = Σ f(r-1,a)
  //          a=0
  // これを用いると、g(r,c)の計算がO(N^2)からO(N)になる



  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  Factorial fc(r2 + c2 + 1, MOD);

  auto g = [&fc](int r, int c)->mint<MOD> {
    mint<MOD> rs = 0;
    F0R(i, r + 1) {
      rs += fc.Ncr(i + 1 + c, c);
    }
    return rs;
  };

  mint<MOD> result = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1);
  cout << result.val;
}
#endif


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

#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include<climits>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
ll d[2000010]; 
ll go(ll x, ll y) {
	if (y == 0)return 1;
	else if (y == 1)return x;
	else if (y == 2)return x * x % mod;
	else if (y & 1) {
		return (x * go(x, y - 1)) % mod;
	}
	else {
		ll tmp = go(x, y / 2) %  mod;
		return (tmp * tmp) % mod;
	}
}
ll go2(ll x, ll y) {
	if (x == 0 && y == 0)return 0;
	ll cnt = d[x];
	ll tmp = d[y] * (d[x - y]) % mod;
	tmp = go(tmp, mod - 2);
	cnt *= tmp; cnt %= mod;
	return cnt;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cout << log2(1000000000);
	ll r, c, r1, c1; cin >> r >> c >> r1 >> c1;
	ll ans = 0;
	d[0] = 1;
	d[1] = 1;
	for (ll i = 2; i <= 2000002; i++) {
		d[i] = d[i - 1] * i; d[i] %= mod;
	}

	for (int i = r; i <= r1; i++) {
		ll x = i + 1, y = c1;
		ll cnt = go2(x + y, x);
		x = i + 1; y = c - 1;
		ll tmp = go2(x + y, x);
		tmp = (cnt - tmp);
		while (tmp < 0)tmp += mod;
		ans += tmp;
		ans %= mod;
	}

	cout << ans << '\n';

}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'log2' was not declared in this scope
   38 |         cout << log2(1000000000);
      |                 ^~~~
Language: C++

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

const long long M=1e9+7;

int a,b,c,d;
long long inv[MAXN],fac[MAXN],invfac[MAXN],ans;

inline void fadd(long long &a,long long b){a+=b;if (a>=M) a-=M;return ;}

int main()
{
	inv[0]=inv[1]=invfac[0]=fac[0]=1LL;
	for (int i=1;i<MAXN;i++) fac[i]=fac[i-1]*i%M;
	for (int i=2;i<MAXN;i++) inv[i]=(M-M/i)*inv[M%i]%M;
	for (int i=1;i<MAXN;i++) invfac[i]=invfac[i-1]*inv[i]%M;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	for (int i=b;i<=d;i++)
	{
		long long t=C(i+c+1,i+1);
		fadd(t,M-C(i+a,i+1));
		fadd(ans,t);
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:29: error: 'C' was not declared in this scope
   21 |                 long long t=C(i+c+1,i+1);
      |                             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#include "../Algo/NumberTheory/modulo.h"

ModuloOps OPS(1e9 + 7);

long long calc(int n, int m) {
    long long v = 1;
    long long div = 1;
    for (int i = n+1; i <= n+m; i++) {
        v = OPS.mul(v, i);
    }
    for (int i = 1; i <= m; i++) {
        div = OPS.mul(div, i);
    }
    return OPS.mul(v, OPS.inv(div));
}

long long sum(int n, int m) {
    return OPS.sub(calc(n+1, m+1), 1);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    long long ans = OPS.sub(
        OPS.add(sum(r2, c2), sum(r1-1, c1-1)),
        OPS.add(sum(r2, c1-1), sum(r1-1, c2)));
    cout << ans << endl;
}



Compiler output:
a.cc:5:10: fatal error: ../Algo/NumberTheory/modulo.h: No such file or directory
    5 | #include "../Algo/NumberTheory/modulo.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long 
typedef long long ll;
typedef pair<int,int>pi;
const int MAXN=2000005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

ll qmult(ll X, ll Y, ll M) {
	return X * Y % M;
}

ll qexp(ll A, ll B, ll M) {
	if (B == 0) return 1; 
	ll half = qexp(A, B/2, M); 
	half = qmult(half, half, M);
	half %= M;
	if (B%2==1) half *= A%M;
	return half%M;
}

int f[MAXN], invf[MAXN], r1, r2, c1, c2; 

int g(int N, int M){
	int ans=0;
	FOR(i,0,N){
		int tmp=f[M+i+1];
		tmp*=invf[M];tmp%=MOD;
		tmp*=invf[i+1];tmp%=MOD;
		ans+=tmp;ans%=MOD;
	}
	return ans;
}
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> r1 >> c1 >> r2 >> c2;
	f[0]=1; invf[0]=1;
	FOR(i,1,R+C) {
		f[i]=(f[i-1]*i)%MOD;
		invf[i]=qexp(f[i],MOD-2,MOD);
	}
	int res=g(r2,c2);
	res-=g(r1-1,c2); res%=MOD;
	res-=g(r2,c1-1); res%=MOD;
	res+=g(r1-1,c1-1); res%=MOD;
	cout<<res;
}


Compiler output:
a.cc:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   45 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:50:17: error: 'R' was not declared in this scope
   50 |         FOR(i,1,R+C) {
      |                 ^
a.cc:9:38: note: in definition of macro 'FOR'
    9 | #define FOR(i,a,b) for(int i=(a);i<=(b);i++)
      |                                      ^
a.cc:50:19: error: 'C' was not declared in this scope
   50 |         FOR(i,1,R+C) {
      |                   ^
a.cc:9:38: note: in definition of macro 'FOR'
    9 | #define FOR(i,a,b) for(int i=(a);i<=(b);i++)
      |                                      ^
Language: Java

import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(g,h):
        return (fac[g+h]*pow(fac[g],MOD-2,MOD)*pow(fac[h],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()

Compiler output:
Main.java:1: error: '.' expected
import sys
          ^
Main.java:2: error: ';' expected
input = sys.stdin.buffer.readline
     ^
2 errors