Language: C++

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

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

int main(){
      string s;
      int d;
      cin>>s>>d;
      int len=s.length();
      vector<vector<int>>dp(d, vector<int>(2, 0));

      dp[0][0] = 1;

      for(int where = 0; where < len; where++){
            
            vector<vector<int>>new_dp(d, vector<int>(2, 0));
            
            for(int sum = 0; sum < d; sum++){
                  
                  for(bool sm_already: {false, true}){
                        
                        for(int digit = 0; digit < 10; digit++){
                              
                              if((digit > s[where] - '0') && !sm_already){
                                    break;
                              }
                              //add_self(new_dp[(sum + digit)%d][sm_already || (digit < (s[where] - '0'))], dp[sum][sm_already]);
                              new_dp[(sum + digit)%d][sm_already || (digit < s[where] - '0')] = (new_dp[(sum + digit)%d][sm_already || (digit < (s[where] - '0'))] + dp[sum][sm_already])%mod;
                              //new_dp[(sum + digit)%d][sm_already || (digit < s[where] - '0')] = (new_dp[(sum + digit)%d][sm_already || (digit < (s[where] - '0'))] + dp[sum][sm_already])%mod;
                        }
                  }
            }
            dp = new_dp;
      }
      int ans=dp[0][1]+dp[0][0];
      ans--;
      ans%=mod;
      if(ans<0)ans=mod-1;
      cout<<ans;
}

Compiler output:
a.cc:3:9: warning: ISO C++11 requires whitespace after the macro name
    3 | #define mod= 1000000007;
      |         ^~~
a.cc: In function 'void add_self(int&, int)':
a.cc:3:12: error: expected primary-expression before '=' token
    3 | #define mod= 1000000007;
      |            ^
a.cc:7:15: note: in expansion of macro 'mod'
    7 |       while(a>mod)
      |               ^~~
a.cc:3:24: error: expected ')' before ';' token
    3 | #define mod= 1000000007;
      |                        ^
a.cc:7:15: note: in expansion of macro 'mod'
    7 |       while(a>mod)
      |               ^~~
a.cc:7:12: note: to match this '('
    7 |       while(a>mod)
      |            ^
a.cc:7:18: error: expected primary-expression before ')' token
    7 |       while(a>mod)
      |                  ^
a.cc: In function 'int main()':
a.cc:3:12: error: expected primary-expression before '=' token
    3 | #define mod= 1000000007;
      |            ^
a.cc:34:187: note: in expansion of macro 'mod'
   34 |                               new_dp[(sum + digit)%d][sm_already || (digit < s[where] - '0')] = (new_dp[(sum + digit)%d][sm_already || (digit < (s[where] - '0'))] + dp[sum][sm_already])%mod;
      |                                                                                                                                                                                           ^~~
a.cc:3:12: error: expected primary-expression before '=' token
    3 | #define mod= 1000000007;
      |            ^
a.cc:43:12: note: in expansion of macro 'mod'
   43 |       ans%=mod;
      |            ^~~
a.cc:3:12: error: expected primary-expression before '=' token
    3 | #define mod= 1000000007;
      |            ^
a.cc:44:20: note: in expansion of macro 'mod'
   44 |       if(ans<0)ans=mod-1;
      |                    ^~~