Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int  __int128
#define rep(i,n) for(long long i=0;i<n;i++)
#define rp(i,n) for(long long i=1;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000000007;
vel rui(19, 1);
vel par;
int ru(int a,int  r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
int inv(int a) {
	return ru(a, p - 2);
}
int dig(int n) {
	for (int i = 0; i < 18; i++) {
		if (rui[i] <= n and n < rui[i + 1]) { return i+1; }
	}
}
int ret1(int diff, int dg) {
	if (diff == 0) { return 0; }
	else if (diff == 1) { return 1; }
	int hl = diff / 2;
	int ans1 = ret1(hl,dg);
	ans1 *= (ru(10, dg*hl) + 1); ans1 %= p;
	if (diff % 2 == 1) {
		ans1 += ru(10, dg*(diff - 1));
	}
	return ans1 % p;
}
int ret2(int diff, int dg) {
	if (diff == 0) { return 0; }
	else if (diff == 1) { return 1; }
	int hl = diff / 2;
	int ans2 = ret2(hl, dg);
	ans2 *= (ru(10, dg*hl) + 1); ans2 %= p;
	ans2 += ret1(hl, dg)*hl; ans2 %= p;
	if (diff % 2 == 1) {
		ans2 += ret1(diff, dg);
	}
	return ans2 % p;
}
signed main() {
	int l, a, b; cin >> l >> a >> b;
	cin >> p;
	rep(i, 18) { rui[i + 1] = rui[i] * 10; }
	int dg = dig(a); int st_dig = dg;
	vel st(19), go(19); int now_st = 0; int now_val = a;
	for (; dg <= 18; dg++) {
		st[dg] = now_st;
		go[dg] = st[dg] + ((rui[dg] - now_val + b - 1) / b);
		now_st = go[dg];
		if (go[dg] >= l) { mmin(go[dg], l); break; }
	}
	int ans = 0;
	int now_dig = 0;
	for (int i = dg; i >= st_dig; i--) {
		int st_val = a + st[i] * b;
		int diff = go[i] - st[i];
		int ans1 = ret1(diff, i);
		ans1 *= (st_val%p); ans1 %= p;
		int ans2 = ret2(diff - 1, i);
		ans2 *= (b%p); ans2 %= p;
		ans1 += ans2; ans1 %= p;
		ans1 *= ru(10, now_dig); ans1 %= p;
		ans += ans1; ans %= p;
		now_dig += diff * dg;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:26: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__int128')
   62 |         int l, a, b; cin >> l >> a >> b;
      |                      ~~~ ^~ ~
      |                      |      |
      |                      |      __int128
      |                      std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
                 from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'float&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'double&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type '__int128'
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: invalid conversion from '__int128' to 'void*' [-fpermissive]
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
      |                             |
      |                             __int128
a.cc:62:29: error: cannot bind rvalue '(void*)((long int)l)' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
   62 |         int l, a, b; cin >> l >> a >> b;
      |                             ^
      |                             |
      |                             __int128
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
  126 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:126:7: note:   conversion of argument 1 would be ill-formed:
a.cc:62:29: error: invalid conversion from '__int128' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::bas