Language: C++


#include<bits/stdc++.h>

using namespace std;


typedef long long ll ;
const ll mk = 100055;
const ll logn  = 29;

#define endl "\n"
#define IOS  ios::sync_with_stdio(0); cin.tie(0);
#define fi first
#define se second
#define pii pair<int,int>
#define pq priority_queue
#define UwU              uwu
#define UwU              Mikuwu
#define Miku             best_waifu
#define Miku_dancing     god_waving
#define a_Miku           cho_doi_bot_ngu

ll Sum, ans = 0  ; 

int log10(int x) {
	if(x == 0) return 0;
	return log10(x / 10) + 1;
}

ll query(ll x, ll y)
{
    if (!y) return 1;
    ll l = query(x, y / 2);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

signed main()
{
    
    cin >> Sum;
    int r = 1, sub_sum = 0 ; 
    for (int l = 1; l < 1e7; l++)
    {
        while (sub_sum + log10(r) <= Sum) sub_sum += log10(r), r++;
        if (sub_sum == Sum) ans++;
        si -= log10(l);
    }   // brute_forces for Miku to dance uwu
    for (int dig = 8; dig <= Sum; dig++)
    {
        if (Sum % dig == 0)
        {
            ans = (ans  + query(10, dig) - query(10, dig - 1) - Sum / dig + 1 + mod) % mod;   // number of start a sequence
        }
        int r = Sum % dig;
        if (r == 0) r += dig;
        ll val = r * (dig + 1);
        ll c = 1ll * dig * (dig + 1);
        if (val < Sum) ans = (ans + (Sum - val) / c + ((Sum - val) % c > 0)) % mod;   // still can take those numbers as a sequence
    }
    cout << ans % mod;
}

Compiler output:
a.cc:18:9: warning: "UwU" redefined
   18 | #define UwU              Mikuwu
      |         ^~~
a.cc:17:9: note: this is the location of the previous definition
   17 | #define UwU              uwu
      |         ^~~
a.cc: In function 'll query(ll, ll)':
a.cc:34:31: error: 'mod' was not declared in this scope; did you mean 'modf'?
   34 |     if (y % 2) return l * l % mod * x % mod;
      |                               ^~~
      |                               modf
a.cc:35:20: error: 'mod' was not declared in this scope; did you mean 'modf'?
   35 |     return l * l % mod;
      |                    ^~~
      |                    modf
a.cc: In function 'int main()':
a.cc:47:9: error: 'si' was not declared in this scope; did you mean 'sin'?
   47 |         si -= log10(l);
      |         ^~
      |         sin
a.cc:53:81: error: 'mod' was not declared in this scope; did you mean 'modf'?
   53 |             ans = (ans  + query(10, dig) - query(10, dig - 1) - Sum / dig + 1 + mod) % mod;   // number of start a sequence
      |                                                                                 ^~~
      |                                                                                 modf
a.cc:59:80: error: 'mod' was not declared in this scope; did you mean 'modf'?
   59 |         if (val < Sum) ans = (ans + (Sum - val) / c + ((Sum - val) % c > 0)) % mod;   // still can take those numbers as a sequence
      |                                                                                ^~~
      |                                                                                modf
a.cc:61:19: error: 'mod' was not declared in this scope; did you mean 'modf'?
   61 |     cout << ans % mod;
      |                   ^~~
      |                   modf