Language: C++

//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
ll s;
ll solve(ll val){
	ll n,m,a,b,c,val1,val2;
	n=1;
	m=-1;
	a=val;
	b=val-1;
	c=s;
	m*=-1;
	val1=m*c/a;
	val2=n*c/b;
	if(n*c%b==0)
		val2--;
	val1++;
	
	ll ans=val2-val1+1;
	return max(ans,0);

}
ll power(ll a){
	ll ans=1,val=10;
	while(a>0){
		if(a%2)
			ans*=val;
		ans%=mod;
		val*=val;
		val%=mod;
		a/=2;
	}
	return ans;
}
int dig[31234567];
int main(){
    std::ios::sync_with_stdio(false);
    ll i;
    ll val=0;
    ll haha=1;
    cin>>s;
    ll ans=0;
    f(i,1,3100*10000){
    	if(haha==i){
    		haha*=10;
    		val++;
    	}
    	dig[i]=val;
    }
    //return 0;
    ll j=1,lol=0;
    f(i,1,10000000){
    	//cout<<i<<endl;
    	while(ans<s){
    		ans+=dig[j];
    		j++;
    	}
    	if(ans==s){
    		lol++;
    	}
    	ans-=dig[i];
    }
    //cout<<lol<<endl;
    //return 0;
    ans=lol;
    ans%=mod;
    for(i=1;i*i<=s;i++){
    	if(s%i==0){
    		//cout<<i<<endl;
    		
    		if(i>=8){
    			//cout<<"dassd"<<endl;
	    		val=s/i;
	    		ans+=power(i)-power(i-1)-val+1;
	    		ans%=mod;
	    	}
    		i=s/i;
	    	if(i>=8){
	    		//cout<<i<<endl;
	    		val=s/i;
	    		ans+=power(i)-power(i-1)-val+1;
	    		//cout<<power(i+1)
	    		ans%=mod;
	    	}
	    	i=s/i;
    	}
    	//cout<<i<<endl;
    	
    }
    //cout<<ans<<endl;
    //return 0;
    f(i,9,s+1){
    	//cout<<"dasds";
    	ans+=solve(i);
    	ans%=mod;
    }
    ans+=mod;
    ans%=mod;
    cout<<ans<<endl;
    return 0;  
    
}



Compiler output:
a.cc: In function 'long long int solve(long long int)':
a.cc:62:19: error: no matching function for call to 'max(long long int&, int)'
   62 |         return max(ans,0);
      |                ~~~^~~~~~~
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:2:
/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:62:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   62 |         return max(ans,0);
      |                ~~~^~~~~~~
/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:62:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   62 |         return max(ans,0);
      |                ~~~^~~~~~~