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

#include <bits/stdc++.h>
#define re register
#define int long long
#define SIZE 3005
#define MOD 1000000007 
using namespace std;
string k;
int d;
int dp[10005][105];
signed main()
{
	cin>>k>>d;
	dp[0][0]=1;
	for(re int i=1;i<=k.size();++i)
		for(re int j=0;j<=d;++j)
			for(re int k=0;k<=9;++k)
				(dp[i][j]+=dp[i-1][(j+k*d-k)%d])%MOD;
	int n=k.size();
	int ans=dp[n][d];
	int tot=0;
	for(re int i=1;i<=k.size();++i)
	{
		for(re int j=k[i-1]-'0'+1;j<=9;++j)
			ans=(ans%MOD-dp[n-i][(d+(tot+j)*d-(tot+j))%d]%MOD+MOD)%MOD;
		tot+=k[i-1]-'0';
	
	cout<<(ans-1)%MOD<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |         for(re int i=1;i<=k.size();++i)
      |                    ^
a.cc:15:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |                 for(re int j=0;j<=d;++j)
      |                            ^
a.cc:16:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |                         for(re int k=0;k<=9;++k)
      |                                    ^
a.cc:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         for(re int i=1;i<=k.size();++i)
      |                    ^
a.cc:23:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |                 for(re int j=k[i-1]-'0'+1;j<=9;++j)
      |                            ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:11:1: note: to match this '{'
   11 | {
      | ^
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";
#define mod 1000000007


int dp[10001][90001][2];
int d;
vector<int> num;

int ans(int idx, int sum, int flag)
{
	if(idx == (int) num.size())
		return sum % d == 0;
	
	if( dp[idx][sum][flag] != -1)
		return dp[idx][sum][flag];
	
	int res = 0;
	int lim = 9;
	if(flag == 0) lim = num[idx];
	
	for(int i=0; i<=lim; i++)
	{
		int new_flag = flag;
		
		if(i < lim && flag == 0) new_flag = 1;
		
		int temp = ans(idx+1, sum+i, new_flag);
		res = (res + temp) % mod;
	}
	
	return dp[idx][sum][flag] = res;
	
}

int solve(string s)
{
	
	for(int i=0; i<s.length(); i++)
		num.push_back(s[i] - '0');
	
	memset(dp, -1, sizeof(dp));
	int res = ans(0, 0, 0);
	return res;
}

signed main()
{
	string k; cin>>k;
	cin>>d;
	
	int res = solve(k);
	cout << (res - 1 + mod) % mod <<"\n";
}



Compiler output:
/tmp/ccqpq2vN.o: in function `ans(long long, long long, long long)':
a.cc:(.text+0x17): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccqpq2vN.o
a.cc:(.text+0x31): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccqpq2vN.o
a.cc:(.text+0xde): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccqpq2vN.o
/tmp/ccqpq2vN.o: in function `solve(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccqpq2vN.o
/tmp/ccqpq2vN.o: in function `main':
a.cc:(.text+0x2e0): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccqpq2vN.o
/tmp/ccqpq2vN.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x3d1): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccqpq2vN.o
a.cc:(.text+0x3ea): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccqpq2vN.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;
const int MAXK=10010;
long long dp[MAXK][90000];
int d,a[MAXK];
string k;

long long dfs(int pos,int sum,bool limit){
	if(pos==-1) return sum%d==0;
	if(!limit && dp[pos][sum]!=-1) return dp[pos][sum];
	int up=limit?a[pos]:9;
	long long res=0;
	for(int i=0;i<=up;++i)
		(res+=dfs(pos-1,sum+i,limit&&i==a[pos]))%=MOD;
	return dp[pos][sum]=res%MOD;
}

long long solve(){
	for(int i=k.size()-1;i>=0;--i) a[k.size()-1-i]=k[i]-'0';
	return dfs(k.size()-1,0,1);
}

int main(){
	memset(dp,-1,sizeof(dp));
	cin>>k;
	cin>>d;
	cout<<(solve()-1+MOD)%MOD<<endl;
	return 0;
}

Compiler output:
/tmp/cccXgCui.o: in function `dfs(int, int, bool)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cccXgCui.o
/tmp/cccXgCui.o: in function `solve()':
a.cc:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `k[abi:cxx11]' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0x225): relocation truncated to fit: R_X86_64_PC32 against symbol `k[abi:cxx11]' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0x23d): relocation truncated to fit: R_X86_64_PC32 against symbol `k[abi:cxx11]' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0x277): relocation truncated to fit: R_X86_64_PC32 against symbol `k[abi:cxx11]' defined in .bss section in /tmp/cccXgCui.o
/tmp/cccXgCui.o: in function `main':
a.cc:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `k[abi:cxx11]' defined in .bss section in /tmp/cccXgCui.o
a.cc:(.text+0x2de): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cccXgCui.o
/tmp/cccXgCui.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x361): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
vector < vector < int > > dp(105, vector < int > (2, 0));
int d;
string s;
int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) {
    a += MOD;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  int ans = 0;
  cin >> s >> d;
  // DP[sum][f] --> numarul de moduri in care putem obtine DP[nr % d] (f == 0 daca suntem pe margine, f == 1 daca nu)
  dp[0][0] = 1;
  for (int pos = 0; pos < s.size(); pos++) {
    vector < vector < int > > new_dp(105, vector < int > (2, 0));
    for (int sum = 0; sum <= d - 1; sum++) {
        for (bool f : {0, 1}) {
          for (int cur_digit = 0; cur_digit <= 9; cur_digit++) {
            if (cur_digit > s[pos] - '0' && !f) {
              break;
            }
            new_dp[(sum + cur_digit) % d][f || (cur_digit < s[pos] - '0')] = add(new_dp[(sum + cur_digit) % d][f || (cur_digit < s[pos] - '0')], dp[sum][f]);
          }
        }
     }
     dp = new_dp;
  }
  cout << sub(add(dp[0][0], dp[0][1]) - 1) << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:14: error: too few arguments to function 'int sub(int, int)'
   43 |   cout << sub(add(dp[0][0], dp[0][1]) - 1) << "\n";
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:16:5: note: declared here
   16 | int sub(int a, int b) {
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void add_self(int& a, int b)
{
	a+=b;
	if(a >= mod)
		a -= mod;
}
int main()
{
	string k;
	int d;
	cin>>k>>d;
	int len = k.size();
	vector<vector<int> > dp(d, vector<int>(2));
	dp[0][0] = 1;
	for(int where = 0; where< len; ++where)
	{
		vector<vector<int> > new_dp(d, vector<int>(2));
		for(int sum = 0; sum< d; ++sum){
			for(bool sm_already : {false, true}){
				for(int dig = 0; dig< 10; ++dig)
				{
					if(dig > k[where] - '0' && !sm_already)
						break;
						
					add_self(new_dp[(sum + dig) % d][sm_already || (dig < k[where] - '0')],dp[sum][sm_already]);
				}
			}
		}
		dp = new_dp;
	}
	int answer = (dp[0][false] + dp[0][true]) % mod;
	asnwer--;
	if(answer == -1)
		answer = mod - 1;
	cout<<answer<<endl; // -1 bidejki 0 se racuna kako resenie
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'asnwer' was not declared in this scope; did you mean 'answer'?
   35 |         asnwer--;
      |         ^~~~~~
      |         answer
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define tr(it, a)   for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define endl  "\n"
const ll MAX=1e5+3;
const ll mod=1e9+7;
 vector<ll>v;
 ll  d,x;
 ll dp[MAX][120][2];
 ll fun(ll n,ll sum,bool edge)
 {
     if(n<0 && sum==0)
       {
        return 1;
       }
       if(n<0)
        return 0;
        if(dp[n][sum][edge]!=-1)
            return dp[n][sum][edge];
        ll range=9;
     if(edge)
     {
         range=v[n];
     }
     ll ans=0;
     for(ll j=0;j<=range;j++)
     {
         bool patakaro=(j==v[n] && edge );
            ans=((ans%mod)+(fun(n-1,(sum+j%d)%d,patakaro)%mod))%mod;
     }
     return dp[n][sum][edge]=ans%mod;
 }
int main()
{
   FASTIO
   int t=1;
   //cin>>t;
   while(t--)
  {
    string s;cin>>s;cin>>d;
    ll n=s.size();
    rep(i,0,n)
    v.pb(s[i]-'0');
    reverse(all(v));
    memset(dp,-1,sizeof(dp));
    ll z=(fun(n-1,0,true)%mod;
    cout<<z-1<<"\n";

   }
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:30: error: expected ')' before ';' token
   52 |     ll z=(fun(n-1,0,true)%mod;
      |          ~                   ^
      |                              )
Language: C++


#include <iostream>

using namespace std;

const int MOD = 1000000007;
int countAll[10001][100];

int main() {
  string K
  int D;
  cin >> K >> D;
  countAll[0][0] = 1;
  for (int r = 1; r < D; r++) {
    countAll[0][r] = 1;
  }
  for (int n = 1; n + 1 < (int)k.size(); i++) {
    for(int r = 0; r < D; r++) {
      countAll[n + 1][(r + x) % D] += countAll[n][r];
      countAll[n + 1][(r + x) % D] %= MOD;
    }
  }
  int answer = MOD - 1;
  int r = 0;
  for (int defined = 1; defined <= K.size(); defined++) {
    for (int x = 0; x < (K[defined - 1] - '0'); x++) {
      answer += countAll[K.size() - defined][r];
      answer %= MOD;
      // r = (r - 1 + D) % D;
      if (r == 0) {
        r = D - 1;
      } else {
        r--;
      }
    }
  }
  // consider K (count K if its sum of digits is a multiple of D)
  answer += countAll[0][r];
  answer %= MOD;
  cout << answer << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected initializer before 'int'
   11 |   int D;
      |   ^~~
a.cc:12:10: error: 'K' was not declared in this scope
   12 |   cin >> K >> D;
      |          ^
a.cc:12:15: error: 'D' was not declared in this scope
   12 |   cin >> K >> D;
      |               ^
a.cc:17:32: error: 'k' was not declared in this scope
   17 |   for (int n = 1; n + 1 < (int)k.size(); i++) {
      |                                ^
a.cc:17:42: error: 'i' was not declared in this scope
   17 |   for (int n = 1; n + 1 < (int)k.size(); i++) {
      |                                          ^
a.cc:19:28: error: 'x' was not declared in this scope
   19 |       countAll[n + 1][(r + x) % D] += countAll[n][r];
      |                            ^
Language: C++

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

const int MOD = 1e9 + 7;
ll dp[10005][2][100];

int main(){
	
	string s;
	cin >> s;
	int d;
	cin >> d;
	
	// 1桁目
	int first = s[0] - '0';
	rep(i,first+1) dp[0][i < first][i%d]++;
	
	// 2桁目以降
	rep(i,s.size()-1) rep(j,2) rep(k,d){
		int lim = j? 9 : s[i+1] - '0';
		rep(next, lim+1){
			dp[i+1][j || next < lim][(k + next) % d] = (dp[i+1][j || next < lim][(k + next) % d] + dp[i][j][k]) % MOD;
		}
	}
	
	ll res = 0;
	rep(j,2) res = (res + dp[s.size()-1][j][0]) %= MOD;
	
	cout << --res << endl; // 0を含んでいる為1減算
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:29: error: lvalue required as left operand of assignment
   29 |         rep(j,2) res = (res + dp[s.size()-1][j][0]) %= MOD;
      |                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
 
long dp[10005][101][2];
 
int main(void) {
    long d;
    string s;
    cin >> s >> d;#include<bits/stdc++.h>
 
using namespace std;
 
long dp[10005][101][2];
 
int main(void) {
    long d;
    string s;
    cin >> s >> d;
    constexpr long MOD = 1e9 + 7;
 
    dp[0][0][1] = 1;
 
    for(int i=0; i<s.size(); i++) {
        for(int j=0; j<d; j++) {
            for(int k=0; k<=9; k++) {
                dp[i+1][(j+k)%d][0] += dp[i][j][0];
                dp[i+1][(j+k)%d][0] %= MOD;
            }
            for(int k=0; k<s[i]-'0'; k++) {
                dp[i+1][(j+k)%d][0] += dp[i][j][1];
                dp[i+1][(j+k)%d][0] %= MOD;
            }
            {
                int k = s[i]-'0';
                dp[i+1][(j+k)%d][1] += dp[i][j][1];
                dp[i+1][(j+k)%d][1] %= MOD;
            }
        }
    }
 
    cout << (dp[s.size()][0][1] + dp[s.size()][0][0]-1) << endl;
}

    constexpr long MOD = 1e9 + 7;
 
    dp[0][0][1] = 1;
 
    for(int i=0; i<s.size(); i++) {
        for(int j=0; j<d; j++) {
            for(int k=0; k<=9; k++) {
                dp[i+1][(j+k)%d][0] += dp[i][j][0];
                dp[i+1][(j+k)%d][0] %= MOD;
            }
            for(int k=0; k<s[i]-'0'; k++) {
                dp[i+1][(j+k)%d][0] += dp[i][j][1];
                dp[i+1][(j+k)%d][0] %= MOD;
            }
            {
                int k = s[i]-'0';
                dp[i+1][(j+k)%d][1] += dp[i][j][1];
                dp[i+1][(j+k)%d][1] %= MOD;
            }
        }
    }
 
    cout << dp[s.size()][0][0]-1 << endl;
}

Compiler output:
a.cc:10:19: error: stray '#' in program
   10 |     cin >> s >> d;#include<bits/stdc++.h>
      |                   ^
a.cc: In function 'int main()':
a.cc:10:20: error: 'include' was not declared in this scope
   10 |     cin >> s >> d;#include<bits/stdc++.h>
      |                    ^~~~~~~
a.cc:10:28: error: 'bits' was not declared in this scope
   10 |     cin >> s >> d;#include<bits/stdc++.h>
      |                            ^~~~
a.cc:10:33: error: 'stdc' was not declared in this scope; did you mean 'std'?
   10 |     cin >> s >> d;#include<bits/stdc++.h>
      |                                 ^~~~
      |                                 std
a.cc:12:1: error: expected primary-expression before 'using'
   12 | using namespace std;
      | ^~~~~
a.cc:16:16: error: a function-definition is not allowed here before '{' token
   16 | int main(void) {
      |                ^
Language: C++

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}z
int dp[100001][101][2];
int d;
string s;
int solve(int pos,int di,int f,int sum)
{
    if(di>d)
        return 0;
    if(pos==s.length())
    {
        //cout<<sum<<endl;
        if(di==0)
        return 1;
    else
        return 0;
    }
  //  cout<<pos<<" "<<di<<" "<<f<<" "<<sum<<endl;
    int &res=dp[pos][di][f];
    if(res!=-1)
        return dp[pos][di][f];
    res=0;
    int fin;
    if(f==0)
    {
        fin=s[pos]-'0';
    }
    else
        fin=9;
   // cout<<fin<<endl;
    for(int x=0;x<=fin;++x)
    {
        int k=f;
        if(f==0 and x<fin)
            k=1;
        
        
                res+=solve(pos+1,(sum+x)%d,k,sum+x);
                res=res%mod;
        
        
    }

    return res%mod;
}
int32_t main()
{
    IOS
    
    
    cin>>s;
    
    cin>>d;
    memset(dp,-1,sizeof(dp));
    int x=solve(0,0,0,0);
    int n=s.length();
    cout<<(x-1+mod)%mod<<endl;

}



Compiler output:
a.cc:41:2: error: 'z' does not name a type
   41 | }z
      |  ^
a.cc: In function 'll solve(ll, ll, ll, ll)':
a.cc:58:14: error: 'dp' was not declared in this scope; did you mean 'di'?
   58 |     int &res=dp[pos][di][f];
      |              ^~
      |              di
a.cc: In function 'int32_t main()':
a.cc:93:12: error: 'dp' was not declared in this scope; did you mean 'd'?
   93 |     memset(dp,-1,sizeof(dp));
      |            ^~
      |            d
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

const int maxn = 1e4 + 100, maxl = 110, dig = 10, mod = 1e9 + 7;
ll dp[maxn][maxl], ps[maxn][maxl];

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

    for (int i = 0; i < maxn - dig; i++)
        for (int j = 0; j < d; j++)
            for (int x = 0; x < dig; x++)
                if (!i)
                    dp[i + 1][j] += (((x % d) == j) && x);
                else
                    dp[i + 1][(j + x) % d] = (dp[i + 1][(j + x) % d] + dp[i][j]) % mod;

    for (int j = 0; j < d; j++)
        for (int i = 1; i < maxn - dig; i++)
            ps[i][j] = ps[i - 1][j] + dp[i][j];

    ll ans = 0, s = 0, x;
    for (int i = 0; i < k.size(); s += x, i++)
    {
        x = k[i] - '0';

        if (i == k.size() - 1)
            for (int j = 0; j <= x; j++)
                ans += !((s + j) % d);
        else
            for (int j = 0; j < x; j++)
                ans = (ans + ps[k.size() - i - 1][(maxn * dig * d - s - j) % d] + ((!((s + x) % d)) && (j || i))) % mod;
    }

    cout << (ans) % mod;

    return 0;
}f

Compiler output:
a.cc:44:2: error: 'f' does not name a type
   44 | }f
      |  ^
Language: C++

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

#define ll long long int

const int MAXK = 10005;
const int MAXD = 105;

ll d, dp[MAXS][MAXD][2][2], mod = 1e9 + 7;
string a, b;

ll rec(ll pos, ll rem, bool flag1, bool flag2)
{
	if(dp[pos][rem][flag1][flag2] != -1) return dp[pos][rem][flag1][flag2];
	if(pos == a.length()) return !rem;
	ll ans = 0, start1 = 0, end1 = 9;
	if(!flag1) start1 = a[pos] - '0';
	if(!flag2) end1 = b[pos] - '0';
	for(int i=start1;i<=end1;i++)
	{
		ans = (ans + rec(pos + 1, (rem + i) % d, (flag1 | i > start1), (flag2 | i < end1))) % mod;
	}
	return dp[pos][rem][flag1][flag2] = ans;
}

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

	cin >> b >> d;
	a = "";
	for(int i=0;i<b.length() - 1;i++) a += '0';
	a += '1'; 
	memset(dp, -1, sizeof(dp));
	cout << rec(0, 0, 0, 0) << endl;
    return 0;
}  

Compiler output:
a.cc:9:10: error: 'MAXS' was not declared in this scope; did you mean 'MAXK'?
    9 | ll d, dp[MAXS][MAXD][2][2], mod = 1e9 + 7;
      |          ^~~~
      |          MAXK
a.cc: In function 'long long int rec(long long int, long long int, bool, bool)':
a.cc:14:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |         if(dp[pos][rem][flag1][flag2] != -1) return dp[pos][rem][flag1][flag2];
      |            ^~
      |            dup
a.cc:23:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |         return dp[pos][rem][flag1][flag2] = ans;
      |                ^~
      |                dup
a.cc: In function 'int main()':
a.cc:36:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   36 |         memset(dp, -1, sizeof(dp));
      |                ^~
      |                dup
Language: C++

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

#define ll long long int

const int MAXK = 10005;
const int MAXD = 105

ll d, dp[MAXS][MAXD][2][2], mod = 1e9 + 7;
string a, b;

ll rec(ll pos, ll rem, bool flag1, bool flag2)
{
	if(dp[pos][rem][flag1][flag2] != -1) return dp[pos][rem][flag1][flag2];
	if(pos == a.length()) return !rem;
	ll ans = 0, start1 = 0, end1 = 9;
	if(!flag1) start1 = a[pos] - '0';
	if(!flag2) end1 = b[pos] - '0';
	for(int i=start1;i<=end1;i++)
	{
		ans = (ans + rec(pos + 1, (rem + i) % d, (flag1 | i > start1), (flag2 | i < end1))) % mod;
	}
	return dp[pos][rem][flag1][flag2] = ans;
}

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

	cin >> b >> d;
	a = "";
	for(int i=0;i<b.length() - 1;i++) a += '0';
	a += '1'; 
	memset(dp, -1, sizeof(dp));
	cout << rec(0, 0, 0, 0) << endl;
    return 0;
}  

Compiler output:
a.cc:4:12: error: expected ',' or ';' before 'long'
    4 | #define ll long long int
      |            ^~~~
a.cc:9:1: note: in expansion of macro 'll'
    9 | ll d, dp[MAXS][MAXD][2][2], mod = 1e9 + 7;
      | ^~
a.cc: In function 'long long int rec(long long int, long long int, bool, bool)':
a.cc:14:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |         if(dp[pos][rem][flag1][flag2] != -1) return dp[pos][rem][flag1][flag2];
      |            ^~
      |            dup
a.cc:21:55: error: 'd' was not declared in this scope
   21 |                 ans = (ans + rec(pos + 1, (rem + i) % d, (flag1 | i > start1), (flag2 | i < end1))) % mod;
      |                                                       ^
a.cc:21:103: error: 'mod' was not declared in this scope; did you mean 'modf'?
   21 |                 ans = (ans + rec(pos + 1, (rem + i) % d, (flag1 | i > start1), (flag2 | i < end1))) % mod;
      |                                                                                                       ^~~
      |                                                                                                       modf
a.cc:23:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |         return dp[pos][rem][flag1][flag2] = ans;
      |                ^~
      |                dup
a.cc: In function 'int main()':
a.cc:32:21: error: 'd' was not declared in this scope
   32 |         cin >> b >> d;
      |                     ^
a.cc:36:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   36 |         memset(dp, -1, sizeof(dp));
      |                ^~
      |                dup
Language: C++

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

const int MOD = 1000000007;

string k;
int d;
long long dp[10001][2][100];
bool sht[10001][2][100];

long long rec(int pos, int free, int csum)
{
    if (sht[pos][free][csum]) return dp[pos][free][csum];
    sht[pos][free][csum] = 1;
    
    if (pos == k.size()) return dp[pos][free][csum] = (csum == 0);
    
    if (free)
    {
        for (int i = 0; i != 10; ++i)
            dp[pos][free][csum] += rec(pos + 1, 1, (csum + i) % d);
        return dp[pos][free][csum] %= MOD;
    }
    else
    {
        for (int i = 0; i != k[pos]; ++i)
            dp[pos][free][csum] += rec(pos + 1, 1, (csum + i) % d);
        return (dp[pos][free][csum] += rec(pos + 1, 0, (csum + k[pos]) % d)) %= MOD;
    }
}

int main()
{    
    cin >> k >> d;
    for (int i = 0; i != k.size(); ++i)
        k[i] -= '0';
    
    cout << (rec(0, 0, 0) - 1) %= MOD;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:32: error: no match for 'operator%=' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'const int')
   38 |     cout << (rec(0, 0, 0) - 1) %= MOD;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
Language: Java

import java.util.*;
import java.io.*;

public class Main
{
  	char[] n;
  	int d, l;
  	long mod = (long)1e9+7;
  	long[][][] dp;
  
    Main(Scanner in, PrintWriter out)
    {
      n = in.next().toCharArray();
      d = in.nextInt();
      dp = new long[2][d][l = n.length];
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < d; j++)
          Arrays.fill(dp[i][j], -1L);
      out.println(dp(1, 0, 0));
    }
  
  	long dp(int b, int s, int at)
    {
      if (s >= d) s %= d;
      if (at == l) return s == 0 ? 1L : 0L;
      if (dp[b][s][at] != -1L) return dp[b][s][at];
      
      long ans = 0L;
	  int lo = b == 0 && at == n-1 ? 1 : 0;
      int up = b == 1 ? n[at]-'1' : 9;
      if (b == 1)
        ans += dp(1, s+n[at]-'0', at+1);
      for (int i = lo; i <= up; i++)
        ans += dp(0, s+i, at+1);
      return dp[b][s][at] = ans % mod;
    }
	
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new	Main(in, out);
		out.close();
	} 
}


Compiler output:
Main.java:29: error: bad operand types for binary operator '-'
	  int lo = b == 0 && at == n-1 ? 1 : 0;
	                            ^
  first type:  char[]
  second type: int
1 error
Language: Java

import java.util.*;
import java.io.*;

public class Main
{
  	char[] n;
  	int d, l;
  	long mod = (long)1e9+7;
  	int[][][] dp;
  
    Main(Scanner in, PrintWriter out)
    {
      n = in.next().toCharArray();
      l = n.length;
      d = in.nextInt();
      dp = new int[2][d][l];
      for (int i = 0; i < 2; i++)
        for (int j = 0; j < d; j++)
          Arrays.fill(dp[i][j], -1);
      out.println(dp(1, 0, 0));
    }
  
  	int dp(int b, int s, int at)
    {
      if (at == l && s == 0) return 1;
      if (dp[b][s][at] != -1) return dp[b][s][at];
      
      int ans = 0, up = b == 1 ? n[at] : 10;
      if (b == 1)
        ans += dp(1, (s+n[at]-'0') % mod, at+1);
      for (int i = 0; i < up; i++)
        ans += dp(0, (s+i) % mod, at+1);
      return dp[b][s][at] = ans;
    }
	
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new	Main(in, out);
		out.close();
	} 
}

Compiler output:
Main.java:30: error: incompatible types: possible lossy conversion from long to int
        ans += dp(1, (s+n[at]-'0') % mod, at+1);
                                   ^
Main.java:32: error: incompatible types: possible lossy conversion from long to int
        ans += dp(0, (s+i) % mod, at+1);
                           ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

#include"bits/stdc++.h"
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
#define ll long long
#define endl '\n'
//       Author
//        ::
//    (  NOBODY  )
//   No Copyright .....You can copy and paste it without my permission...................................
// !!!!!!!!!!!!!!!
#define pb push_back
#define N 300009
int a[N],b[N],c[N];
int dp[40008][999][3];
int mo=1e9+7;
ll digit(int indx,int sum,int ok,int div,vector<int>v)
{
   if(indx==-1)return (sum%div==0&&sum>0);
   if(dp[indx][sum][ok]!=-1)return dp[indx][sum][ok];
   int num=(ok)?v[indx]:9;
   ll sm=0;
   for(int i=0;i<=num;i++)
   {
     int new_ok=(i==v[indx])?ok:0;
     sm+=(ll)digit(indx-1,sum+i,new_ok,div,v);
     sm%=mo;
   }
   if(!ok)dp[indx][sum][ok]=sm;
   return (sm%mo);

}
int main()
{
    FAST_IO;
    string s;
    memset(dp,-1,sizeof(dp));
    int k;
    cin>>s>>k;
    vector<int>v;
    int n=s.size();
    cout<<ans<<endl;
    for(int i=n-1;i>=0;i--)
    {
      v.pb(s[i]-'0');
      //cout<<v.back()<<" ";
    }
   cout<< digit(n-1,0,1,k,v)%mo;
    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int f[10001][101][2];
char a[10001];
int main()
{
	int i,j,l;
	int n,D;
	scanf("%s",a);
	scanf("%d",&D);
	n=strlen(a);
	for(i=0;i<n;i++)
    	{
		for(j=0;j<D;j++)
		{
			for(l=0;l<=9;l++)
				f[i+1][(j+1)%D][0]=(f[i+1][(j+l)%D][0]+f[i][j][0])%1000000007;
			for(l=0;l<=a[i]-'0';l++)
				if(l==a[i]-'0');
					f[i+1][(j+1)%D][1]=(f[i+1][(j+l)%D][1]+f[i][j][1])%1000000007;
				else
					f[i+1][(j+1)%D][0]=(f[i+1][(j+l)%D][0]+f[i][j][1])%1000000007;
		}
      	}
	printf("%d",(f[n][0][1]+f[n][0][0]+1000000006)%1000000007);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: 'else' without a previous 'if'
   21 |                                 else
      |                                 ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int f[10001][101][2];
char a[10001];
int main()
{
	int i,j,l;
	int n,D;
	scanf("%s",k);
	scanf("%d",&D);
	n=strlen(a);
	for(i=0;i<n;i++)
    	{
		for(j=0;j<D;j++)
		{
			for(l=0;l<=9;l++)
				f[i+1][(j+1)%D][0]=(f[i+1][(j+l)%D][0]+f[i][j][0])%1000000007;
			for(l=0;l<=a[i]-'0';l++)
				if(l==a[i]-'0');
					f[i+1][(j+1)%D][1]=(f[i+1][(j+l)%D][1]+f[i][j][1])%1000000007;
				else
					f[i+1][(j+1)%D][0]=(f[i+1][(j+l)%D][0]+f[i][j][1])%1000000007;
		}
      	}
	printf("%d",(f[n][0][1]+f[n][0][0]+1000000006)%1000000007);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: 'k' was not declared in this scope
    9 |         scanf("%s",k);
      |                    ^
a.cc:21:33: error: 'else' without a previous 'if'
   21 |                                 else
      |                                 ^~~~
Language: C++

#include"bits/stdc++.h"i
using namespace std;
int f[10001][101][2];
int d,n;
char a[10001];
int main()
{
	cin>>a;
	cin>>d;
	n=strlen(a);
	f[0][0][1]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
			for(int k=0;k<=9;k++)
				f[i+1][(j+k)%d][0]=((long long)f[i+1][(j+k)%d][0]+f[i][j][0])%1000000007;
			for(int k=0;k<=a[i]-'0';k++)
			{
				if(k==(a[i]-'0'))
					f[i+1][(j+k)%d][1]=((long long)f[i+1][(j+k)%d][1]+f[i][j][1])%1000000007;
				else
					f[i+1][(j+k)%d][0]=((long long)f[i+1][(j+k)%d][0]+f[i][j][1])%1000000007;
			}
		}
	}
	printf("%d",(int)((((long long)f[n][0][0]+f[n][0][1])-1)%1000000007));
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include"bits/stdc++.h"i
      |         ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin>>a;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #include"bits/stdc++.h"i
a.cc:10:11: error: 'strlen' was not declared in this scope
   10 |         n=strlen(a);
      |           ^~~~~~
a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | #include"bits/stdc++.h"i
a.cc:27:9: error: 'printf' was not declared in this scope
   27 |         printf("%d",(int)((((long long)f[n][0][0]+f[n][0][1])-1)%1000000007));
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #include"bits/stdc++.h"i
Language: C++

#include<bits/stdc++.h>
using namespace std;
char n[100001];
long long f[10001][101][2];
int main()
{
	int i,D,j,k;
	scanf("%s",n);
	scanf("%d",D);
	f[0][0][1]=1;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<D;j++)
		{
			for(k=0;k<=9;k++)
			{
				f[i+1][(j+k)%D][0]=(f[i+1][(j+k)%D][0]+f[i][j][0])%1000000007;
			}
			for(k=0;k<=a[i];k++)
			{
				if(k==a[i])
					f[i][j][1]=(f[i+1][(j+k)%D][0]+f[i][j][1])%1000000007;
				else
					f[i][j][0]=(f[i+1][(j+k)%D][0]+f[i][j][1])%1000000007;
			}
		}
	}
	printf("%lld",f[n][0][0]+f[n][0][1]-1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |         for(i=1;i<=n;i++)
      |                 ~^~~
a.cc:19:36: error: 'a' was not declared in this scope
   19 |                         for(k=0;k<=a[i];k++)
      |                                    ^
a.cc:28:24: error: invalid types 'long long int [10001][101][2][char [100001]]' for array subscript
   28 |         printf("%lld",f[n][0][0]+f[n][0][1]-1);
      |                        ^
a.cc:28:35: error: invalid types 'long long int [10001][101][2][char [100001]]' for array subscript
   28 |         printf("%lld",f[n][0][0]+f[n][0][1]-1);
      |                                   ^
Language: C++

#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

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

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng,l,q,ans;
ll x[500005],y[500005],z[500005];
ll dp[10005][105][3];
char s[500005],t[500005];
bool flag,dame;

void solve(ll i,ll sum,bool flag){
	//now looking i bit
	if(i == n){
		if(sum == 0){
			p("hoi");
			ans += 1;
		}
		return;
	}else if(!flag){
		for(int j=0;j<=9;j++){
			solve(i+1,(sum+j)%d,0);
		}
	}else{
		a = s[i] - '0';
		for(int j=0;j<a;j++){
			solve(i+1,(sum+j)%d,0);
		}
		solve(i+1,(sum+a)%d,1);
	}
}

int main(){
    cin >> s >> d;
	n = strlen(s);
	dp[0][0][1] = 1;
	for(i=0;i<n;i++){
		for(j=0;j<d;j++){
			for(k=0;k<=9;k++){
				dp[i+1][(j+k)%d][0] += dp[i][j][0];
				dp[i+1][(j+k)%d][0] %= mod;
			}
			a = s[i] - '0';
			for(k=0;k<a;k++){
				dp[i+1][(j+k)%d][0] += dp[i][j][1];
				dp[i+1][(j+k)%d][0] %= mod;
			}
			dp[i+1][(j+a)%d][1] += dp[i][j][1];
			dp[i+1][(j+a)%d][1] %= mod;
		}
	}
	for(i=0;i<=n;i++){
		for(j=0;j<d;j++){
			//pe(dp[i][j][0]);
		}
	//	el;
	}
	p((dp[n][0][0] + dp[n][0][1] + mod - 1) % mod;);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: expected primary-expression before '<<' token
   43 | #define p(x) cout<<x<<endl;
      |                     ^~
a.cc:149:9: note: in expansion of macro 'p'
  149 |         p((dp[n][0][0] + dp[n][0][1] + mod - 1) % mod;);
      |         ^
Language: C++

    /*
      Vivek Rathi
      CSE 2nd Year
      MNNIT
    */
    #include<bits/stdc++.h>
    using namespace std;
    #define M 1000000007
    #define ll long long int
    #define pb push_back
    #define pf push_front
    #define pob pop_back
    #define pof pop_front
    #define debug1(x) cout<<#x<<" "<<x<<endl;
    #define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
    #define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
    #define present(c,x) ((c).find(x) != (c).end())
    #define null NULL
    #define mp make_pair
    #define fi first
    #define se second
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define inf 1e17
    #include <ext/pb_ds/assoc_container.hpp> 
    #include <ext/pb_ds/tree_policy.hpp> 
    using namespace __gnu_pbds; 
    #define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
    //-------------------------------Template--Above------------------------------------------------
    string digs;
    ll d;
     
    ll dp[101][100001][2];
    ll solve(ll pos,ll sum,ll tight)
    {
    	if(pos==digs.size())
    	{
          	if(sum==0) returm 0;
    		if(sum%d==0) return 1;
    		else return 0;
    	}
    	if(dp[pos][sum][tight]!=-1) return dp[pos][sum][tight];
    	ll ans=0;
    	if(tight==1)
    	{
    		ans=(ans+solve(pos+1,sum+digs[pos]-'0',1))%M;
    		for(ll i=digs[pos]-1-'0';i>=0;i--)
    		{
    			ans=(ans+solve(pos+1,sum+i,0))%M;
    		}
    	}
    	else
    	{
    		for(ll i=9;i>=0;i--)
    		{
    			ans=(ans+solve(pos+1,sum+i,0))%M;
    		}
    	}
    	return dp[pos][sum][tight]=ans;
    }
    int main()
    {
    	boost
    	cin>>digs>>d;
    	memset(dp,-1,sizeof(dp));
    	cout<<solve(0,0,1)<<endl;
    	return 0;
    }

Compiler output:
a.cc: In function 'long long int solve(long long int, long long int, long long int)':
a.cc:37:28: error: 'returm' was not declared in this scope
   37 |                 if(sum==0) returm 0;
      |                            ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>


#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

ll dp[10010][2][100];
const int mod = 1e9+7;

int main(){
    string s;
    int d;
    cin >> s >> d ;
    int n = s.size();
    dp[0][0][0] = 1;
    
    rep(i,n){
        rep(j,2){
            rep(k,d){
                int x = j ? 9 : s[i] - '0';
                for(int num = 0; num <= x; num++){
                    dp[i+1][j || num < x ][(k+num) % d] += dp[i][j][k];
                    dp[i+1][j || num < x ][(k+num) % d] %= mod;
                }
            }
        }
    }
    ll ans = (dp[n][0][0] + dp[n][1][0]) % mod
    cout << max(0LL,ans - 1) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: expected ',' or ';' before 'cout'
   37 |     cout << max(0LL,ans - 1) << endl;
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>


#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

ll dp[10010][2][100];
const int mod = 1e9+7;

int main(){
    string s;
    int d;
    cin >> s >> d ;
    int n = s.size();
    dp[0][0][0] = 1;
    
    rep(i,n){
        rep(j,2){
            rep(k,d){
                int x = j ? 9 : s[i] - '0';
                for(int num = 0; num <= x; num++){
                    dp[i+1][j || num < x ][(k+num) % d] += dp[i][j][k];
                    dp[i+1][j || num < x ][(k+num) % d] %= mod;
                }
            }
        }
    }
    int ans = (dp[n][0][0] + dp[n][1][0]) % mod
    cout << max(0LL,ans - 1) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: expected ',' or ';' before 'cout'
   37 |     cout << max(0LL,ans - 1) << endl;
      |     ^~~~
Language: C++

#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <iterator>
#include <map>
#include <set>
#ifndef ONLINE_JUDGE
#include <prettyprint/prettyprint.hpp>
#endif

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define TEST int T; std::cin >> T; while(T--)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

const int mod = 1e9 + 7;

void add_self(int& a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	ifstream fin("in.txt");
	ofstream fout("out.txt");
	auto cinbuf = cin.rdbuf(fin.rdbuf());    // save and redirect
	auto coutbuf = cout.rdbuf(fout.rdbuf()); // save and redirect
#endif	
	string digits;
	int d;
	cin >> digits >> d;

	vector<int[2]> dp(d);
	dp[0][0] = 1;

	for(int i = 0; i < digits.size(); ++i) {
		vector<int[2]> next(d);
		for(int j = 0; j < d; ++j) {
			for(auto s : {false, true}) {
				for(int digit = 0; digit < 10; ++digit) {
					if(s == false && digit > (digits[i] - '0')) break;
					add_self(next[(j + digit) % d][s || (digit < digits[i] - '0')],
							 dp[j][s]);
				}
			}
		}
		for(int i = 0; i < d; ++i) {
			dp[i][0] = next[i][0];
			dp[i][1] = next[i][1];
		}
	}
	int ans = dp[0][0];
	add_self(ans, dp[0][1]);
	--ans;
	if(ans < 0) ans += mod;
	cout << ans << endl;
#ifndef ONLINE_JUDGE
	cin.rdbuf(cinbuf);    // restore
	cout.rdbuf(coutbuf); // restore
#endif	
}


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ cin>>vec[i];}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define S second
#define F first
const int  MOD = 1e9 + 7;
const int  N = 1005;
ll dp[N][105][2];
string K;
int d , n;

ll rec(int ind, int s, int less){
    if(ind == n) return s == 0;
    ll res = dp[ind][s][less] , k ;
    if(res != -1) return res;
    res = 0;
    k = (less)? (K[idx] - '0') : 9;
    for(int i = 0; i <= k; i++){
        int less2;
		if(less == 1 || i < k) {
            less2 = 1;
        }else less2 = 0;
        res += rec( ind + 1, less2, (s + i) % D );
		res %= MOD;
    }
    dp[ind][s][less] = res;
    return res;
}

//  a d f j k  l  ;
int main(){
    ios::sync_with_stdio(0);  cin.tie(0);
    cin>>K>>d;
    n = K.size();
    memset(dp, -1, sizeof(dp)); 
    rec(0 , 0 , 0);
    cout << (rec(0,0,0) - 1 + MOD)%MOD << endl;


    return 0;
}

Compiler output:
a.cc: In function 'long long int rec(int, int, int)':
a.cc:21:20: error: 'idx' was not declared in this scope
   21 |     k = (less)? (K[idx] - '0') : 9;
      |                    ^~~
a.cc:27:47: error: 'D' was not declared in this scope
   27 |         res += rec( ind + 1, less2, (s + i) % D );
      |                                               ^
Language: C++

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

#define int long long

template<class T>void chmod(T &a, const T &b, const T &mod) {
  int val = (a % mod) + (b % mod);
  if (val < 0) { ret += mod; }
  a = val;
}

const int MOD = 1e9 + 7;
string K;
int D;

int dp[10010][2][110] = {0};

signed main() {
  cin >> K >> D;
  int n = K.size();

  dp[0][0][0] = 1;
  for (int digit = 0; digit < n; digit++) { // 上からdigit桁目
    for (int smaller : {0, 1}) {
      int lim = smaller == 1 ? 9 : K[digit] - '0'; // この桁の上限値
      for (int num = 0; num <= lim; num++) {
        for (int modD = 0; modD < D; modD++) {
          chmod(dp[digit+1][smaller || num < lim][(modD + num) % D], dp[digit][smaller][modD], MOD);
        }
      }
    }
  }

  int ans = 0;
  for (int smaller : {0, 1}) {
    chmod(ans, dp[n][smaller][0], MOD);
  }
  chmod(ans, -1LL, MOD);
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'void chmod(T&, const T&, const T&)':
a.cc:8:18: error: 'ret' was not declared in this scope
    8 |   if (val < 0) { ret += mod; }
      |                  ^~~
Language: C++

#include <iostream>
#include <string>

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main() {
    string k;
    int d;
    cin >> k >> d;
    reverse(k.begin(), k.end());

    int n = k.length();
    ll dp[n + 1][d][2];
    fill(dp[0][0], dp[n + 1][0], 0);
    dp[0][0][0] = dp[0][0][1] = 1;

    for (int m = 1; m <= n; ++m) {
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < d; ++j) {
                dp[m][(i + j) % d][0] += dp[m - 1][j][0];
                dp[m][(i + j) % d][0] %= MOD;
            }
        }

        int p = k[m - 1] - '0';
        for (int i = 0; i < p; ++i) {
            for (int j = 0; j < d; ++j) {
                dp[m][(i + j) % d][1] += dp[m - 1][j][0];
                dp[m][(i + j) % d][1] %= MOD;
            }
        }

        for (int j = 0; j < d; ++j) {
            dp[m][(p + j) % d][1] += dp[m - 1][j][1];
            dp[m][(p + j) % d][1] %= MOD;
        }
    }

    cout << dp[n][0][1] - 1 << endl;
}


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

#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const long long inf2=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int dp[100001][101][3];
//dp[i][j]:number with j digits mod D=i;
int d;
string s;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>s>>d;
	//0:<s 1:==s 2:>s
	s=" "+s;
	dp[0][0][1]=1;
	for(int i=1;i<s.size();i++){
		for(int j=0;j<d;j++){
			for(int k=0;k<10;k++){
				dp[i][(j+k)%d][0]+=dp[i-1][j][0];
				dp[i][(j+k)%d][0]%=mod;
				if(k<s[i]-'0')dp[i][(j+k)%d][0]+=dp[i-1][j][1],dp[i][(j+k)%d][0]%=mod;
				else if(k==s[i]-'0')dp[i][(j+k)%d][1]+=dp[i-1][j][1],dp[i][(j+k)%d][1]%=mod;
				else dp[i][(j+k)%d][2]+=dp[i-1][j][1],dp[i-1][j][1]%=mod;
				dp[i][(j+k)%d][2]+=dp[i-1][j][2];
				dp[i][(j+k)%d][2]%=mod;
			}
		}
	}
	ll ans=0;
	ans+=dp[s.size()-1][0][0];ans+=dp[s.size()-1][0][1];ans%=mod;
	cout<<max(0,ans-1)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: no matching function for call to 'max(int, ll)'
   36 |         cout<<max(0,ans-1)<<endl;
      |               ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:36:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   36 |         cout<<max(0,ans-1)<<endl;
      |               ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:36:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   36 |         cout<<max(0,ans-1)<<endl;
      |               ~~~^~~~~~~~~