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

#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

const int MAX = 1e4 + 5;
const int N = 105;
ll dp[MAX][N][2], d;
vector <int> v;

int rec(int pos, int sum, bool f)
{
	if(pos == v.size()) return (sum == 0);
	int &res = dp[pos][sum][f];
	if(~res) return res;
	
	int lim = (f ? 9 : v[pos]);
	res = 0;
	
	for(int i = 0; i <= lim; i++) {
		int nsum = (sum + i) % d;
		res += rec(pos + 1, nsum, f || (i < v[pos]));
		res %= MOD;
	}
	return res;
}
int main()
{
	boost;
	string s;
	cin >> s;
	cin >> d;
	
	for(char c : s)
	v.pb(c - '0');
	
	memset(dp, -1, sizeof dp);
	cout << rec(0, 0, 0) - 1;
}


Compiler output:
a.cc: In function 'int rec(int, int, bool)':
a.cc:33:34: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   33 |         int &res = dp[pos][sum][f];
      |                    ~~~~~~~~~~~~~~^
Language: C++

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

string s;
vector<int> digits;
int N,D;
const int MAXN = 1e4 + 10;
const int MAXD = 1e2 + 10;
const int MOD = 1e9 + 7;
ll dp[MAXN][2][MAXD];

ll solve(int pos,int flag,int resto){
 
	if(pos == N) return (resto == 0);
	if(dp[pos][flag][resto] != -1) return dp[pos][flag][resto];
 
	ll tot = 0;
	int limit = (flag) ? (digitos[pos]) : (9);
	for(int i = 0;i<=limit;i++){
		tot += solve(pos+1,flag && (i == limit), (resto + i) % D );
	}
 
	return dp[pos][flag][resto] = tot % MOD;
 
}

int main()
{   
 
        cin>>s;
        cin>>D;
    N=(int)s.size();
    
    for(int i=0;i<N;i++){
        digits.push_back(s[i]-'0');
    }
    
    ll ans = solve(0,1,0) - 1;
	if(ans < 0) ans += MOD;
	cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'long long int solve(int, int, int)':
a.cc:19:31: error: 'digitos' was not declared in this scope; did you mean 'digits'?
   19 |         int limit = (flag) ? (digitos[pos]) : (9);
      |                               ^~~~~~~
      |                               digits
Language: C++


#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
    //mint(2).pow(n); 2^n
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp[10005][105][2];//1 未満


ll F(ll d, ll k){
  while(k<0)k+=d;
  return k;
}
int main() {
  string k;
  ll d;
  cin>>k>>d;
  vector<ll>s(k.size());
  rep(i,k.size())s[i]=k[i]-'0';
  rep(i,10005)rep(q,105)rep(j,2)dp[i][q][j]=0;
  dp[0][0][0]=1;

  rep(i,k.size())rep(j,d){

  //  if ((j-s[i])<0){
      //s[i]-=10;

  //  dp[i+1][j][0]+=dp[i][j-s[i]+d][0];
//


      dp[i+1][j][0]+=dp[i][F(d,j-s[i])][0];


     rep(q,10){
    //   cout<<j-k+d<<' '<<dp[i][j-k+d][1]<<endl;
      // if ((j-k)<0) dp[i+1][j][1]+=dp[i][j-k+d][1];
        dp[i+1][j][1]+=dp[i][F(d,j-q)][1];
    //   cout<<dp[i+1][j][1]<<'q'<<q<<endl;
      }
      rep(q,s[i]){
      //  if ((j-q)<0) dp[i+1][j][1]+=dp[i][j-q+d][0];
         dp[i+1][j][1]+=dp[i][F(d,j-q)][0];
      //   cout<<dp[i+1][j][1]<<'q'<<q<<endl;

       }


       //cout<<dp[i+1][j][0]<<' '<<dp[i+1][j][1]<<'i'<<i<<'j'<<j<<endl;
}

mint ans=dp[k.size()][0][1];
ans+=dp[k.size()][0][0];
ans--;
cout<<ans.x;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:96:4: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   96 | ans--;
      | ~~~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
#define ll long long

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
int main()
{
	string k;
	cin >> k;
	int d;
	cin >> d;
	vector<vector<ll>> dp(d,vector<ll>(2));
	int n = k.size();
	dp[0][0] = 1;
	for(int i = 0;i < n;i++)
	{
		auto new_dp = vector<vector<ll>> (d,vector<ll>(2));
		for(int sum = 0;sum < d;sum++)
		{
			for(bool sm_already : {false,true})
			{
				for(int digit = 0;digit < 10;digit++)
				{
					if(digit > k[i]-'0' && !sm_already)
						break;
					add_self(new_dp[(sum+digit)%d][sm_already || (digit < k[i]-'0')],dp[sum][sm_already]);
				}
			}
		}
		dp = new_dp;
	}

	auto ans = (dp[0][true] + dp[0][false])%mod;
	--ans;
	if(ans == -1)
		ans = mod-1;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:49: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   32 |                                         add_self(new_dp[(sum+digit)%d][sm_already || (digit < k[i]-'0')],dp[sum][sm_already]);
      |                                         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:20: note:   initializing argument 1 of 'void add_self(int&, int)'
    6 | void add_self(int& a, int b) {
      |               ~~~~~^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define loop(i, a, b) for(lli i=a; i<b; i++)
#define loopb(i, a, b) for(lli i=a; i>=b; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
#define umap unordered_map
#define all(x) x.begin(), x.end()
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli M = 1e9 + 7;
lli power(lli x, lli y){
    lli res = 1;
    x = x%M;
    while (y > 0) {
        if (y & 1)
            res = (res*x)%M ;
        y = y>>1;
        x = (x*x)%M ;
    }
    return res%M;
}
lli dp[10009][102][2];
lli calc(string& s, lli index, lli sum, lli e, lli d){
    lli n = s.size();
    if(sum % d == 0 && index == n)
        return 1;
    else if(index >= n)
        return 0;
    else if(dp[index][sum][e] != -1)
        return dp[index][sum][e];
    lli ans = 0;
    lli m = e == 0 ? 10 : s[index]-'0'+1;
    loop(i, 0, m){
        lli ne = e & ((s[index]-'0') == i);
        lli temp = sum;
        temp += i;
        temp %= d;
        ans += calc(s, index+1, temp, ne, d);
        ans %= M;
    }
    dp[index][sum][e] = ans;
    return ans;
}w
lli solve(){
    string k;
    lli d;
    cin>>k>>d;
    memset(dp, -1, sizeof(dp));
    cout<<(calc(k, 0, 0, 1, d) - 1 + M)%M;
    return 0;
}
int main(){
    fastio;
    lli t;
	// cin>>t;
    t = 1;
    while(t>0){ 
        t--;
        solve();
    }
}

Compiler output:
a.cc:72:2: error: 'w' does not name a type
   72 | }w
      |  ^
a.cc: In function 'int main()':
a.cc:88:9: error: 'solve' was not declared in this scope
   88 |         solve();
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "/Users/rect0r/Desktop/Competitive/library/rahdirigslib.hpp"

const int mxN = 10005, mxD = 110, mod = 1e9 + 7;
ll dp[mxN][mxD][2];

class TaskS {
public:
	string K;
	int D, n;
	vector<int> digits;

	void solve(std::istream& in, std::ostream& out) {
		in >> K >> D;
		for (char it : K) digits.push_back(it - '0');
		n = (int) digits.size();
		memset(dp, -1, sizeof(dp));
		ll ans = rec(0, 0, 1);
		sub(ans, 1ll, mod);
		out << ans;
	}

	ll rec(int pos, int sum, int flag) {
		if (pos == n) {
			if (sum % D == 0) return 1;
			return 0;
		}
		if (dp[pos][sum][flag] != -1) return dp[pos][sum][flag];
		int limit = 9;
		ll tot = 0;
		if (flag == 1) limit = digits[pos];
		for (int i = 0; i <= limit; i++) {
			if (i == digits[pos]) {
				add(tot, rec(pos + 1, (sum + i) % D, flag), mod);
			} else {
				add(tot, rec(pos + 1, (sum + i) % D, 0), mod);
			}
		}
		return dp[pos][sum][flag] = tot;
	}
};


Compiler output:
a.cc:4:10: fatal error: /Users/rect0r/Desktop/Competitive/library/rahdirigslib.hpp: No such file or directory
    4 | #include "/Users/rect0r/Desktop/Competitive/library/rahdirigslib.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

typedef pair<int,int> pi;
typedef vector<int> vi;
 
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define pb push_back
#define debug(...) " [ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "

template<typename T> void max_self(T &a, T b) { a = max(a,b); return;}
template<typename T> void min_self(T &a, T b) { a = min(a,b); return;}
 
const int nax = 2e6 + 5;
const int mod = 1e9 + 7;

int modExpo(int a,int b,int c){
	if(b == 0) return 1;
	int answer = 1;
	while(b){
		if(b & 1) answer = ((answer % c) * (a % c)) % c;
		a = ((a % c) * (a % c)) % c;
		b /= 2; 
	}
	
	return answer;
}

int d;
int dp[10005][105];

int f(string s,int index,int sum,bool flag){
	int n = (int)s.size();
	if(index == n){
		if(sum % d == 0) return 1;
		return 0;
	}
	
	if(flag == false && dp[index][sum] != -1) return dp[index][sum];
	
	int limit = 9;
	if(flag) limit = s[index] - '0';
	
	int ans = 0;
	for(int i = 0; i <= limit; ++i){
		bool newflag = flag;
		if(flag && i == limit) newflag = true;
		else newflag = false;
		ans = ((ans % mod) + f(s,index + 1,(sum + i) % d,newflag) % mod) % mod; 
	}
	
	if(flag == false) dp[index][sum] = ans; 
	return ans;
}

signed main(){
	
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int t = 1;./
	//cin >> t;
	while(t--){
		string s;
		cin >> s;
		
		cin >> d;
		
		memset(dp,-1,sizeof(dp));
		
		cout << f(s,0,0,true) - 1;
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:19: error: expected primary-expression before '.' token
   64 |         int t = 1;./
      |                   ^
a.cc:64:20: error: expected unqualified-id before '/' token
   64 |         int t = 1;./
      |                    ^
a.cc:66:9: error: expected primary-expression before 'while'
   66 |         while(t--){
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int K = 1e4 + 10;
const int D = 110;
const int mod = 1e9 + 7;

int dp[K][D];
int d;
string str;

int f(int x, int s) {
    if (x < 0)
        return s % d == 0 ? 1 : 0;
    int res = 0;
    for (int i = 0; i < str[x] - '0'; i++) 
        res = (res + dp[x][(((-s - i) % d) + d) % d]) % mod;
    res = (res + f(x - 1, s + str[x] - '0')) % mod;
    return res;
}


int main() {

    cin >> str >> d;


    dp[0][0] = 1;
    for (int i = 1; i < K; i++)
        for (int j = 0; j < d; j++) 
            for (int digit = 0; digit < 10; digit++) 
                dp[i][j] = (dp[i][j] + dp[i - 1][(j - digit + d) % d]) % mod;    
            
    
    cout << f(s.size() - 1, 0) << endl;
        

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:15: error: 's' was not declared in this scope
   36 |     cout << f(s.size() - 1, 0) << endl;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

void add(int &x,int y){
    x+=y;
    x%=MOD;
    return;
}

signed main(){
    string k;int d;cin>>k>>d;
    int dp[SZ(k)+1][d][2];
    REP(i,SZ(k)+1)REP(j,d)REP(s,2)d p[i][j][s] = 0;
    dp[0][0][0] = 1;
    REP(i,SZ(k)){
        int z = k[i] - '0';
        REP(j,z) REP(s,d) add(dp[i+1][(s+j)%d][1],dp[i][s][0]);
      	REP(j,10) REP(s,d) add(dp[i+1][(s+j)%d][1],dp[i][s][1]);
        REP(s,d) dp[i+1][(s+z)%d][0] = dp[i][s][0];
    }
    cout<<dp[SZ(k)][0][0]+dp[SZ(k)][0][1]-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:36: error: expected ';' before 'p'
   41 |     REP(i,SZ(k)+1)REP(j,d)REP(s,2)d p[i][j][s] = 0;
      |                                    ^~
      |                                    ;
Language: C++

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
char num[10010];
ll dp[10010][2][101];

ll calc(int idx, bool tight, int sum, vector<int> digit, int D)
{
	int sz = digit.size();
	if(idx==sz) {
		return sum%D? 0ll:1ll;
	}
	if(dp[idx][tight][sum%D]!=-1ll) return dp[idx][tight][sum%D];

	int lmt = tight? digit[idx]:9;
	ll ret = 0ll;
	for(int i=0; i<=lmt; i++) {
		ret+=calc(idx+1, tight and i==lmt, sum+i, digit, D);
		ret%=mod;
	}
	return dp[idx][tight][sum%D] = ret%mod;
}


int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>num; int len = strlen(num);
	vector<int> digit;
	for(int i=0; i<len; i++) digit.push_back(num[i]-'0');

	int D; cin>>D;

	for(int i=0; i<len+1; i++)
		for(int j=0; j<2; j++)
			for(int k =0; k<D; k++)
				dp[i][j][k] = -1ll;
	ll ans = calc(0, 1, 0, digit, D)-1ll;
	if(ans<0ll) ans+=mod;
	cout << ans << '\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:29: error: 'strlen' was not declared in this scope
   29 |         cin>>num; int len = strlen(num);
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;
const int MOD=1000000007;
int k,n,num[10000009];
long long b,dp[2000000][1000][2];
string s;
int get_digit()
{
    fill(num,num+1000009,-1);
    int n=s.size();
    s=" "+s;
    for (int i=1; i<=n; i++)
        num[i]=(int)(s[i]-48);
    return n;
}
long long digit_dp(int idx, int sum, int tight)
{
    if (idx==n+1)
        if (sum%k==0)
            return 1;
        else
            return 0;
    if (dp[idx][sum][tight]!=-1)
        return dp[idx][sum][tight];
    int res=0,limit;
    if (tight==0)
        limit=num[idx];
    else
        limit=9;
    for (int i=0; i<=limit; i++)
    {
        int new_tight=1;
        if (i==limit&&tight==0)
            new_tight=0;
        res=(res+digit_dp(idx+1,(sum+i)%k,new_tight))%MOD;
    }
    dp[idx][sum][tight]=res%MOD;
    return res%MOD;
}
int main()
{
    cin>>s>>k;
    n=get_digit();
    memset(dp,-1,sizeof(dp));
    b=digit_dp(1,0,0);
    cout << ((b-1)+MOD)%MOD;
    return 0;
}


Compiler output:
/tmp/ccONIWAF.o: in function `get_digit()':
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
a.cc:(.text+0x68): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
/tmp/ccONIWAF.o: in function `main':
a.cc:(.text+0x2e9): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
/tmp/ccONIWAF.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x3b8): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
a.cc:(.text+0x3d1): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccONIWAF.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
long long a,b,n,k;
int dp[20][100000][2],num[20009],m;
const int MOD=1e9+7;
int get_digit(int x)
{
    fill(num,num+20,0);
    int n=0;
    stack <int> s;
    while (x!=0)
    {
        s.push(x%10);
        x/=10;
    }
    while (!s.empty())
    {
        num[++n]=s.top();
        s.pop();
    }
    return n;
}
long long solve(int idx, int sum, int tight)
{
    if (idx==n+1)
        if (sum%k==0)
            return 1;
        else
            return 0;
    if (dp[idx][sum][tight]!=-1)
        return dp[idx][sum][tight];
    long long res=0;
    int limit;
    if (tight==0)
        limit=num[idx];
    else
        limit=9;
    for (int i=0; i<=limit; i++)
    {
        int new_tight=1;
        if (i==limit&&tight==0)
            new_tight=0;
        res+=solve(idx+1,sum+i,new_tight);
    }
    dp[idx][sum][tight]=(res%MOD);
    return res;
}
int main()
{
    cin>>b>>k;
    memset(dp,-1,sizeof(dp));
    a=solve(1,0,0);
    memset(dp,-1,sizeof(dp));
    n=get_digit(b);
    b=solve(1,0,0);
    cout << (b-1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:18: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   57 |     cout << (b-1 << endl;
      |              ~~~~^~~~~~~
a.cc:57:25: error: expected ')' before ';' token
   57 |     cout << (b-1 << endl;
      |             ~           ^
      |                         )
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[2001][101][2];
ll d;
string a;
ll mod=1e9+7;
ll solve(ll pos,ll cnt,bool tight)
{
    if(pos==a.length())
    {
        return cnt==0;
    }
    if(dp[pos][cnt][tight]!=-1)
        return dp[pos][cnt][tight];
    ll ans=0;
    ll end=(tight?(a[pos]-'0'):9);
    for(ll i=0;i<=end;i++)
    {
         ans+=(solve(pos+1,(cnt+i)%d,tight&(i==end)))%mod;
    }
    return dp[pos][cnt][tight]=ans;
}

int main()
{
     cin>>a;
     cin>>d;
     memset(dp,-1,sizeof(dp));
     ll ans=solve(0,0,1)%mod;
     cout<<ans-1<<endl;
  }
   return 0;
}


Compiler output:
a.cc:33:4: error: expected unqualified-id before 'return'
   33 |    return 0;
      |    ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define mod 1000000007

ll dp[10005][101][2];
string s;
ll d;


ll solve(ll pos, ll modi, bool tight){
	//base case
	if(pos == s.length()){
		return modi==0;
	}
	//recursive case
	if(dp[pos][modi][tight]!=-1){return dp[pos][modi][tight];}

	ll ans=0
	ll end= (tight)?(s[i]-'0'):9;
	for(ll i=0; i<=end; i++){
		ans += (pos+1, (modi+i)%d, tight&(i==end));
	}
	return dp[pos][modi][tight] = ans;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	memset(dp, -1, sizeof(dp));
	cin>>s;
	cin>>d;
	cout<< solve(0, 0, 1);
}

Compiler output:
a.cc: In function 'long long int solve(long long int, long long int, bool)':
a.cc:5:12: error: expected ',' or ';' before 'long'
    5 | #define ll long long
      |            ^~~~
a.cc:22:9: note: in expansion of macro 'll'
   22 |         ll end= (tight)?(s[i]-'0'):9;
      |         ^~
a.cc:23:22: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<='
   23 |         for(ll i=0; i<=end; i++){
      |                     ~^~~~~
a.cc:24:52: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator=='
   24 |                 ans += (pos+1, (modi+i)%d, tight&(i==end));
      |                                                   ~^~~~~
Language: Java

 import java.io.*;
import java.util.*;
public class GFG {static String k;static int d;
static int dp[][][]=new int [10001][101][2];
static int mod=1000000007;
public static int solve(int pos,int sm,int tight){
    if(pos==k.length()){
        return (sm==0)?1:0;
    }
    if(dp[pos][sm][tight]!=-1)return dp[pos][sm][tight];
    int ans=0;
    int end=((tight==1)?(k.charAt(pos)-'0'):9);
    for(int i=0;i<=end;i++){
        ans=(ans+solve(pos+1,(sm+i)%d,(i==end)?tight:0))%mod;
        
        
    }
    return dp[pos][sm][tight]=ans;
    
}





	public static void main (String[] args) {
	    
	    Scanner sc=new Scanner(System.in);
	    k=sc.next();
	     d=sc.nextInt();
	     for(int i=0;i<10001;i++){
	         for(int j=0;j<101;j++){
	             for(int l=0;l<2;l++){
	                 dp[i][j][l]=-1;
	             }
	         }
	     }
		System.out.println((solve(0,0,1)-1+mod)%mod);
	    }
 
 }

Compiler output:
Main.java:3: error: class GFG is public, should be declared in a file named GFG.java
public class GFG {static String k;static int d;
       ^
1 error
Language: Java

 import java.io.*;
import java.util.*;
public class GFG {static String k;static int d;
static int dp[][][]=new int [10001][101][2];
static int mod=1000000007;
public static int solve(int pos,int sm,int tight){
    if(pos==k.length()){
        return (sm==0)?1:0;
    }
    if(dp[pos][sm][tight]!=-1)return dp[pos][sm][tight];
    int ans=0;
    int end=((tight==1)?(k.charAt(pos)-'0'):9);
    for(int i=0;i<=end;i++){
        ans=(ans+solve(pos+1,(sm+i)%d,(i==end)?tight:0))%mod;
        
        
    }
    return dp[pos][sm][tight]=ans;
    
}





	public static void main (String[] args) {
	    
	    Scanner sc=new Scanner(System.in);
	    k=sc.next();
	     d=sc.nextInt();
	     for(int i=0;i<10001;i++){
	         for(int j=0;j<101;j++){
	             for(int l=0;l<2;l++){
	                 dp[i][j][l]=-1;
	             }
	         }
	     }
		System.out.println(solve(0,0,1)-1);
	    }
 
 }

Compiler output:
Main.java:3: error: class GFG is public, should be declared in a file named GFG.java
public class GFG {static String k;static int d;
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) f(#__VA_ARGS, VA_ARGS)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[10010][100][2];
inline int add(int x, int y, int mod) {
   if (y >= mod) y %= mod;
   if (x >= mod) x %= mod;
   x  += y;
   return (x >= mod ? x - mod : x);
} 
inline int mul(int x, int y, int mod) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  return (x*y) % mod;
}
inline int sub(int x, int y, int mod) {
  x -= y;
  if (x + mod <= 0) {
  x %= mod;
  }
  return (x < 0 ? x+mod : x);
}
vector<int>v;
int k;
int solve(int pos ,int curMod , int f , int n){
  if(pos==n){
    return curMod==0;
  }
  if(dp[pos][curMod][f]!=-1)return dp[pos][curMod][f];
  int lim = (f==0 ? v[pos] : 9);
  int ans =0 ;
  for(int i =0 ;i<=lim;i++){
    int nf=f;
    int newMod =0;
    newMod+=(curMod+i%k)%k;
    if(i < lim && !f)nf =1;
    ans =add(ans, solve(pos+1,newMod,nf,n),MOD);
  }
  return dp[pos][curMod][f]=ans;
}
int go(string &s){
  v.clear();
  memset(dp,-1,sizeof(dp));
  int n = s.size();
  for(auto i : s){
    v.pb(i-'0');
  }
  int ans = solve(0,0,0,n);
  ans = sub(ans,1,MOD);
  return ans;
}
signed main(){
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  // #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    string s;
    cin >> s>> k;
    cout << go(s);
  
  }
  cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
  return 0;
}

Compiler output:
a.cc:21:18: error: '#' is not followed by a macro parameter
   21 | #define trace(...) f(#__VA_ARGS, VA_ARGS)
      |                  ^
Language: C++

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

#define int long long
#define mod 1000000007
#define maxN 10005

inline int add(int x,int y) { x+=y; if(x>=mod) x-=mod; return x; }

int dp[maxN][2][9*maxN];
vector<int> v;
int len;

void PUSH(string x)
{
    for(auto u:x) v.push_back(u-'0');
}

int sol(int index,int flag,int sum,int D)
{
    if(index==len)
    {
        if(sum%D==0) return 1;
        else return 0;
    }

    int &r=dp[index][flag][sum];
    if(r!=-1) return r;

    int res=0;
    if(flag) for(int i=0;i<10;i++) res=add(res,sol(index+1,1,sum+i,D));
    else
    {
        for(int i=0;i<=v[index];i++)
        {
            if(i<v[index]) res=add(res,sol(index+1,1,sum+i,D));
            else if(i==v[index]) res=add(res,sol(index+1,0,sum+i,D));
        }
    }

    return r=res;
}

int32_t main()
{
    ios_base::sync_with_stdio(false),cin.tie(nullptr);
    string s;
    cin>>s;

    PUSH(s);
    len=v.size();

    int d=0;
    cin>>d;

    memset(dp,-1,sizeof(dp));
    int ans=sol(0,0,0,d)-1;
    cout<<ans<<"\n";
    return 0;
}

Compiler output:
/tmp/ccJdkBpi.o: in function `PUSH(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
/tmp/ccJdkBpi.o: in function `sol(long long, long long, long long, long long)':
a.cc:(.text+0xad): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccJdkBpi.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
a.cc:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
/tmp/ccJdkBpi.o: in function `main':
a.cc:(.text+0x313): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
a.cc:(.text+0x322): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccJdkBpi.o
/tmp/ccJdkBpi.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x400): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
a.cc:(.text+0x419): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccJdkBpi.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
typedef long long int ll;
#define endl '\n'
using namespace std;
ll dp[10009][105][2],D;
const ll mod=1e9+7;
ll solve(string s, int i = 0, int sum = 0, bool tight = 1){
    if(i == s.size())
        return (sum%D==0);
    if(dp[i][sum][tight] != -1)
        return dp[i][sum][tight];
    ll ret = 0;
    for(int d = 0; d <= (tight ? s[i] - '0' : 9); d++)
        ret += solve(s, i + 1, (sum + d)%D, d == s[i] - '0' ? tight : 0);
    return dp[i][sum][tight] = ret%mod;
}

int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    string k;
    memset(dp,-1,sizeof(dp));
    cin>>k>>D;
    ll ans=solve(k)
    ans--;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'ans'
   24 |     ans--;
      |     ^~~
Language: C++

#include <iostream>
#include<map>
using namespace std;
string s;
int d,dp[100005][2][105];
int solve(int index, int less,int sum)
{
    if (index == s.size())
        return !(sum%d);
    if (dp[index][less][sum] != -1)
        return dp[index][less][sum];
    int ans = 0;
    for (int i = 0; i <=9 ; i++)
    {
        if(less||s[index]-'0'>i)
        ans=(ans% 1000000007 +solve(index+1 , 1 ,(sum+i)%d)% 1000000007)% 1000000007;
        else if(s[index]-'0'==i)
        {
           ans=(ans%1000000007+solve(index + 1, 0 ,(sum+i)%d)% 1000000007)% 1000000007;
        }
    }
    return dp[index][less][sum]=ans;
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
    memset(dp, -1, sizeof dp);
    cin >> s >>d;
    cout << solve(0,0,0)-1;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'memset' was not declared in this scope
   27 |     memset(dp, -1, sizeof dp);
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<map>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C

#include <iostream>
#include<map>
using namespace std;
string s;
int d,dp[100005][2][105];
int solve(int index, int less,int sum)
{
    if (index == s.size())
        return !(sum%d);
    if (dp[index][less][sum] != -1)
        return dp[index][less][sum];
    int ans = 0;
    for (int i = 0; i <=9 ; i++)
    {
        if(less||s[index]-'0'>i)
        ans=(ans% 1000000007 +solve(index+1 , 1 ,(sum+i)%d)% 1000000007)% 1000000007;
        else if(s[index]-'0'==i)
        {
           ans=(ans%1000000007+solve(index + 1, 0 ,(sum+i)%d)% 1000000007)% 1000000007;
        }
    }
    return dp[index][less][sum]=ans;
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
    memset(dp, -1, sizeof dp);
    cin >> s >>d;
    cout << solve(0,0,0)-1;
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    string k;
    int d;
    cin >> k >> d;
    vector<vector<int>> dp(d, vector<int>(2));
    dp[0][true] = 1;

    rep(i, k.size()) {
        int here = k[i] - '0';
        vector<vector<int>> after(d, vector<int(2));

        for(int prevmod = 0; prevmod < d; prevmod++) {
            for(int now = 0; now <= 10; now++) {
                int nowmod = (prevmod + now) % d;
                if(now < here) {
                    after[nowmod][false] += dp[prevmod][true];
                    after[nowmod][true] %= MOD;
                } else if(now == here) {
                    after[nowmod][true] += dp[prevmod][true];
                    after[nowmod][true] %= MOD;
                }
                after[nowmod][false] += dp[prevmod][false];
                after[nowmod][false] %= MOD;
            }
        }
        dp = after;
    }

    cout << (dp[0][true] + dp[0][false] - 1 + MOD) % MOD << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:50: error: template argument 1 is invalid
   42 |         vector<vector<int>> after(d, vector<int(2));
      |                                                  ^
a.cc:42:50: error: template argument 2 is invalid
Language: C++

#include <iostream>
using i64 = long long;
using namespace std;

class ModInt {
public:
  int value;
  static const int mod = 1e9 + 7;
  ModInt(int value = 0) {
    this->value = normalize(value);
  }  
  ModInt& operator+=(const ModInt& other) {
      this->value = (*this + other).value;
      return *this;
  }
  ModInt& operator-=(const ModInt& other) {
      this->value = (*this - other).value;
      return *this;
  }
  ModInt& operator*=(const ModInt& other) {
      this->value = (*this * other).value;
      return *this;
  }
  ModInt& operator/=(const ModInt& other) {
      this->value = (*this / other).value;
      return *this;
  }
  int inverse(int a) const {
    int m = mod;
    int u = 0, v = 1;
    while (a != 0) {
        int t = m / a;
        m -= t * a; swap(a, m);
        u -= t * v; swap(u, v);
    }
    assert(m == 1);
    return u;
  }
  ModInt operator+(const ModInt &R) const {
    return ModInt(ModInt::normalize(this->value + R.value));
  } 
  ModInt operator-(const ModInt &R) const {
    return ModInt(ModInt::normalize(this->value - R.value));
  } 
  ModInt operator*(const ModInt &R) const {
    return ModInt(ModInt::normalize((i64) this->value * R.value));
  } 
  ModInt operator/(const ModInt &R) const {
    return ModInt(ModInt::normalize((i64) this->value * inverse(R.value)));
  }
  int normalize(i64 value) const {
    while (value < 0) value += mod;
    value %= mod;
    return value;
  }
};

ostream& operator<<(ostream& os, ModInt const &m) {
  os << (m.value);
  return os;
}

istream& operator>>(istream& is, ModInt& r) {
    is >> r.value;
    r.value = r.normalize(r.value);
    return is;
}

const int maxn = 1e5;
ModInt dp[maxn + 1][100][2] = {0};
int main() {
  string s;
  int d;
  cin >> s >> d;
  reverse(s.begin(), s.end());
  dp[0][0][0] = 1;
  dp[0][0][1] = 1;
  for (int i = 1; i <= s.size(); i++) {
    for (int rem = 0; rem < d; rem++) {
      for (int limit = false; limit <= 1; limit++) {
        int max_digit = limit ? s[i - 1] - '0' : 9;
        for (int j = 0; j <= max_digit; j++) {
          int new_rem = (rem + j) % d;
          int new_limit = limit ? j == max_digit : false;
          dp[i][rem][limit] += dp[i - 1][new_rem][new_limit];
        }
      }
    }
  }
  
  cout << dp[s.size()][0][1] - 1 << '\n';
}

Compiler output:
a.cc: In member function 'int ModInt::inverse(int) const':
a.cc:36:5: error: 'assert' was not declared in this scope
   36 |     assert(m == 1);
      |     ^~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    1 | #include <iostream>
  +++ |+#include <cassert>
    2 | using i64 = long long;
a.cc: In function 'int main()':
a.cc:75:3: error: 'reverse' was not declared in this scope
   75 |   reverse(s.begin(), s.end());
      |   ^~~~~~~
Language: C++

#include <bits/stdc++.h> 
  
#define ll long long 
  
using namespace std; 
  
vector<ll> v; 
  
ll dp[10005][105][2],d,mod=1000000007; 

ll solve(ll n,ll sum,ll flag)
{
	if(n==v.size())
	{
		if(sum==0)
			return 1;
		else return 0;
	}
	if(dp[n][sum][flag]!=-1)
		return dp[n][sum][flag]%mod;
	
	 ll x=0,en=-1;
	 
	 if(flag==1)
		 en=v[n];
	 else
		 en=9;
	
	 for(ll i=0;i<en;i++)
		 x=(x%mod+solve(n+1,((sum%d)+i)%d,0)%mod)%mod;
	 x=(x%mod+solve(n+1,((sum%d)+en)%d,flag)%mod)%mod;
	return (dp[n][sum][flag]=x);
}


ll CountNum(string n) 
{ 
    v.clear();
    int sz=n.length();
	for(int i=0;i<sz;i++)
		v.push_back(n[i]-'0');    
      
    memset(dp, -1, sizeof(dp)); 
    return solve(0, 0, 1); 
} 
    
int main() 
{ 
    string k; 	
	cin>>k>>d;
	ll ans=CountNum(k)-1;
	if(ans==-1)
		ans=mod-1;
    cout << << endl; 
    return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: expected primary-expression before '<<' token
   54 |     cout << << endl;
      |             ^~
Language: C++

/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
vector<ll> v;
ll modV;
ll N = 1000000007;
ll dp[10009][2][112];
ll sz;
void input(string &str)
{
    int x;
    for(int i=0;i<str.size();i++)
    {
        x = str[i]-48;
        v.pb(x);
    }
}

ll DP(ll pos,ll isSmall,ll sum)
{
    if(dp[pos][isSmall][sum]!=-1)
    {
        return dp[pos][isSmall][sum];
    }
    ll res = 0,i;
    if(pos==sz)
    {
        if(sum==0)
        {
            return dp[pos][isSmall][sum] =1;
        }
        else return dp[pos][isSmall][sum] = 0;
    }
    if(!isSmall)
    {
        for(i=0;i<v[pos];i++)
        {
            res = (res+DP(pos+1,1,(sum+i)%modV))%N;
        }
        res = (res+DP(pos+1,0,(mod+i)%modV))%N;
    }
    else
    {
        for(ll i=0;i<=9;i++)
        {
            res = (res+DP(pos+1,1,(sum+i)%modV))%N;
        }
    }
    return dp[pos][isSmall][sum]  = res;
}
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    FAST
    string str;
    cin>>str>>modV;
    sz = str.size();
    input(str);
    memset(dp,-1,sizeof dp);
    x=  DP(0,0,0);
    //if(x!=0)
        x--;
    cout<<x<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'll DP(ll, ll, ll)':
a.cc:78:32: error: 'mod' was not declared in this scope; did you mean 'modf'?
   78 |         res = (res+DP(pos+1,0,(mod+i)%modV))%N;
      |                                ^~~
      |                                modf
Language: C++

#include<iostream>
#include<vector>
#include<iomanip>
#include<ctype.h>

using namespace std;

#define ll long long

int mod(string num, int a) {
    int res = 0;
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;
    return res;
}

string k;
ll d;
ll n;

ll M = 1e9+7;

ll dp[10002][2][102];

ll f(ll cur, bool b, ll sum){
    if(cur==n){
        if(sum%d==0) return 1;
        else return 0;
    }

    if(dp[cur+1][b][sum]!=-1) return dp[cur+1][b][sum]%M;

    if(b){
        ll ans=0;
        for(ll i=0;i<=9;i++){
            ans+=(f(cur+1, b, (sum+i)%d))%M;
            ans%=M;
        }
        ans%=M;
        return dp[cur+1][b][sum] = ans%M; // dp[cur][b][sum] =
    }

    else{
        ll z = k[cur]-'0';
        ll ans=0;
        for(ll i=0;i<z;i++){
            ans+=(f(cur+1, true, (sum+i)%d))%M;
            ans%=M;
        }
        ans%=M;
        ans+=(f(cur+1, false, (sum+z)%d))%M;
        ans%=M;
        return dp[cur+1][b][sum] = ans%M; //
    }
}

int main(){
    // cout<<(-1+M)%M;
    memset(dp, -1, sizeof(dp));
    cin>>k>>d;
    n=k.length();
    cout<<(f(0, false, 0) - 1 + M) % M<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:5: error: 'memset' was not declared in this scope
   59 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<iomanip>
  +++ |+#include <cstring>
    4 | #include<ctype.h>
Language: C++

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

long long dp[10000][100][2];
long long mod = 1e9 + 7;
int main() {
  string n;
  cin>>n; 
  int d;
  cin>>d;

  int len = n.length();
  for (int i=0; i<len; i++) {
    for (int j=0; j<d; j++) {
      dp[i][j][0] = 0;
      dp[i][j][1] = 0;
    }
  }
  for (int j=0; j<10; j++) {
    if (j < n[0] - '0') {
      dp[0][j%d][1] += 1;
    } else if (j == n[0] - '0') {
      dp[0][j%d][0] += 1;
      break;
    }
  }
  for (int i=1; i<len; i++) {
    for (int j=0; j<d; j++) {
      for (int k=0; k<10; k++) {
        if (k < n[i] - '0') {
          dp[i][(j+k)%d][1] += dp[i-1][j][1] + dp[i-1][j][0];
          dp[i][(j+k)%d][1] %= mod;
        } else if (k == n[i] - '0') {
          dp[i][(j+k)%d][1] += dp[i-1][j][1];
          dp[i][(j+k)%d][1] %= mod;
          dp[i][(j+k)%d][0] += dp[i-1][j][0];
          dp[i][(j+k)%d][0] %= mod;
        } else {
          dp[i][(j+k)%d][1] += dp[i-1][j][1];
          dp[i][(j+k)%d][1] %= mod;
        }
      }
    }
  }
  long long ans = dp[len-1][0][0] + dp[len-1][0][1];
  cout<<(ans-1 + MOD) % MOD<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:18: error: 'MOD' was not declared in this scope
   46 |   cout<<(ans-1 + MOD) % MOD<<endl;
      |                  ^~~
Language: C++


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; 
string K; int D, N;
int dp[10101][101][2];
//---------------------------------------------------------------------------------------------------
signed main() {
    cin >> K >> D;
    int N = K.length();

    dp[0][0][0] = 1;
    rep(dgt, 0, N) rep(d, 0, D) rep(isless, 0, 2) {
        int c = K[dgt] - '0';
        rep(nxt, 0, 10) {
            if (nxt < c){
                dp[dgt + 1][(d + nxt) % D][1] += dp[dgt][d][isless];
                dp[dgt + 1][(d + nxt) % D][1] %= MOD;
            }
            else if(nxt == c){
                dp[dgt + 1][(d + nxt) % D][isless] += dp[dgt][d][isless];
                dp[dgt + 1][(d + nxt) % D][isless] %= MOD;
            }
            else {
                if(isless){
                    dp[dgt + 1][(d + nxt) % D][isless] += dp[dgt][d][isless];
                    dp[dgt + 1][(d + nxt) % D][isless] %= MOD;
                }
            }
        }
    }

    cout << (dp[N][0][0] + dp[N][0][1] - 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:50: error: 'MOD' was not declared in this scope
   18 |                 dp[dgt + 1][(d + nxt) % D][1] %= MOD;
      |                                                  ^~~
a.cc:22:55: error: 'MOD' was not declared in this scope
   22 |                 dp[dgt + 1][(d + nxt) % D][isless] %= MOD;
      |                                                       ^~~
a.cc:27:59: error: 'MOD' was not declared in this scope
   27 |                     dp[dgt + 1][(d + nxt) % D][isless] %= MOD;
      |                                                           ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
const int maxn=1e4+10;
const ll mod=1e9+7;
template<typename T> void read(T &x){
	T f=1;x=0;
	char c=getchar();
	while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	x*=f;
}
string s;
ll d;
ll f[maxn][110],ans;
ll cnt=0;
int main(){
	cin>>s;
	read(d);
	f[0][0]=1;
	for(re int i=1;i<=s.size();i++){
		for(re int j=0;j<d;j++){
			for(re int k=0;k<10;k++){
				f[i][j]=(f[i][j]+f[i-1][(j+d*k-k)%d])%mod;
			}
			//cout<<i<<" "<<j<<" "<<f[i][j]<<endl;
		}
	}
	for(re int i=0;i<s.size();i++){
		for(re int j=0;j<s[i]-'0';j++){
			ans=(ans+f[s.size()-i-1][(d-(cnt+j)%d])%mod;                                                                                             		
		}
		cnt+=s[i]-'0';
	}
	if(cnt%d==0) ans++;
	cout<<(ans-1)%mod<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |         for(re int i=1;i<=s.size();i++){
      |                    ^
a.cc:23:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |                 for(re int j=0;j<d;j++){
      |                            ^
a.cc:24:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                         for(re int k=0;k<10;k++){
      |                                    ^
a.cc:30:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         for(re int i=0;i<s.size();i++){
      |                    ^
a.cc:31:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |                 for(re int j=0;j<s[i]-'0';j++){
      |                            ^
a.cc:32:62: error: expected ')' before ']' token
   32 |                         ans=(ans+f[s.size()-i-1][(d-(cnt+j)%d])%mod;
      |                                                  ~           ^
      |                                                              )
a.cc:32:68: error: expected ']' before ';' token
   32 |                         ans=(ans+f[s.size()-i-1][(d-(cnt+j)%d])%mod;
      |                                                                    ^
      |                                                                    ]
a.cc:32:68: error: expected ')' before ';' token
   32 |                         ans=(ans+f[s.size()-i-1][(d-(cnt+j)%d])%mod;
      |                             ~                                      ^
      |                                                                    )