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

#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007

//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    
}//対combination

ll b,ten;

ll f(ll l){
    if(l==0)return 0;
    if(l%2){
        return f(l-1)*(ten%mod+1)%mod;
    }else{
        return f(l/2)*pow(10,pow(ten%mod,l-1)+f(l/2))%mod;
    }
}
ll g(ll l){
    if(l==0)return 0;
    if(l%2){
        return (g(l-1)*(ten%mod)+b*(l-1))%mod;
    }else{
        return (x*pow(ten%mod,l-1)+g(l/2)+b*(l/2)%mod*f(l-1))%mod;
    }
}
int main(){
    ll L,a,b,m;
    cin >> L>> a>> b>> m;
    ll ans=0;
    ll last=a+b*(L-1);
    ten=1;
    for(int i=1;i<=18;i++){
        ll l=ten,r=ten*10-1;
        if(last<l)continue;
        ll na=0;//初項
        ll nl=0;//長さ
        if(a>=l){
            na=a;
        }else{
            na=a+(l-a+(b-1))/b*b;
            na=min(na,last);
        }
        ll nlast=0;
        if(last<=r)nlast=last;
        else{
            nlast=(r-a)/b*b+a;
        }
        nl=(nlast-na)/b+1;
        ten*=10;
        ans+=f(nl)%mod;
        ans%=mod;
        ans+=g(nl)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'll f(ll)':
a.cc:72:54: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   72 |         return f(l/2)*pow(10,pow(ten%mod,l-1)+f(l/2))%mod;
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                      |
      |                      __gnu_cxx::__promote<double>::__type {aka double}
a.cc: In function 'll g(ll)':
a.cc:80:17: error: 'x' was not declared in this scope
   80 |         return (x*pow(ten%mod,l-1)+g(l/2)+b*(l/2)%mod*f(l-1))%mod;
      |                 ^
a.cc: In function 'll comb(int, int)':
a.cc:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }//対combination
      | ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] % m + ((A[i][k] % m) * (B[k][j] % m)) % m ) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1LL;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  vector<vector<ll>> ans(3,vector<ll>(1));
  ans[0][0] = a % m; ans[1][0] = a % m; ans[2][0] = 1LL;
  ll cnt[20];
  cnt[0] = 0;
  rep1(d, 20) {
    ll MIN = (ll)pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    if(MIN * 10 - 1 < A) continue;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = max(0LL, (MAX - a) / b + 1);
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b % m;
    A[1][0] = 1LL; A[1][1] = (ll)pow(10, d) % m; A[1][2] = b % m;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[d] - cnt[d - 1] - (cnt[d - 1] == 0 ? 1 : 0));
    ans = mul(B, ans);
    }
  cout << ans[1][0] % m << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:23: error: 'A' was not declared in this scope
   89 |     if(MIN * 10 - 1 < A) continue;
      |                       ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] % m + ((A[i][k] % m) * (B[k][j] % m)) % m ) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1LL;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  vector<vector<ll> ans(3,vector<ll>(1));
  ans[0][0] = a % m; ans[1][0] = a % m; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 20) {
    ll MIN = (ll)pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = max(0LL, (MAX - a) / b + 1);
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b % m;
    A[1][0] = 1LL; A[1][1] = (ll)pow(10, d) % m; A[1][2] = b % m;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[d] - (d - 1 >= 1 ? cnt[d - 1] : 1LL));
    ans = mul(B, ans);
    }
  cout << ans[1][0] % m << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:40: error: template argument 1 is invalid
   83 |   vector<vector<ll> ans(3,vector<ll>(1));
      |                                        ^
a.cc:83:40: error: template argument 2 is invalid
a.cc:84:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   84 |   ans[0][0] = a % m; ans[1][0] = a % m; ans[2][0] = 1LL;
      |   ^~~
      |   abs
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] % m + (A[i][k] % m) * (B[k][j] % m) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  mat ans(3, vec(1));
  ans[0][0] = a; ans[1][0] = a; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 18) {
    ll MIN= pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = max(0LL, (MAX - a) / b + 1);
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b;
    A[1][0] = 1LL; A[1][1] = (ll)pow(10, d) % m; A[1][2] = b;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[d] - (d - 1 >= 1 ? cnt[d - 1] : 1LL));
    ans = mul(B, ans);
  }
  cout << ans[1][0] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'mat mul(mat&, mat&)':
a.cc:53:105: error: expected ')' before ';' token
   53 |             for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] % m + (A[i][k] % m) * (B[k][j] % m) % m;
      |                                                         ~                                               ^
      |                                                                                                         )
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  mat ans(3, vec(1));
  ans[0][0] = a; ans[1][0] = a; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 18) {
    ll MIN= pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = max(0LL, (MAX - a) / b + 1);
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b;
    A[1][0] = 1LL; A[1][1] = pow(10, d) % m; A[1][2] = b;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[d] - (d - 1 >= 1 ? cnt[d - 1] : 1LL));
    ans = mul(B, ans);
  }
  cout << ans[1][0] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:41: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'll' {aka 'long long int'} to binary 'operator%'
   93 |     A[1][0] = 1LL; A[1][1] = pow(10, d) % m; A[1][2] = b;
      |                              ~~~~~~~~~~ ^ ~
      |                                 |         |
      |                                 |         ll {aka long long int}
      |                                 __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  mat ans(3, vec(1));
  ans[0][0] = a; ans[1][0] = a; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 18) {
    ll MIN= pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = (MAX - a) / b + 1;
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b;
    A[1][0] = 1LL; A[1][1] = pow(10, d); A[1][2] = b;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] : 1LL));
    ans = mul(B, ans);
  }
  cout << ans[0][0] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:95:20: error: 'i' was not declared in this scope
   95 |     B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] : 1LL));
      |                    ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  mat ans(3, vec(1));
  ans[0][0] = a; ans[1][0] = a; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 18) {
    ll MIN= pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = (MAX - a) / b + 1;
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b;
    A[1][0] = 1LL; A[1][1] = pow(10, d); A[1][2] = b;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL;
    B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] ? 1LL));
    ans = mul(B, ans);
  }
  cout << ans[0][0] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:95:20: error: 'i' was not declared in this scope
   95 |     B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] ? 1LL));
      |                    ^
a.cc:95:55: error: expected ':' before ')' token
   95 |     B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] ? 1LL));
      |                                                       ^
      |                                                       :
a.cc:95:55: error: expected primary-expression before ')' token
a.cc:95:55: error: expected ':' before ')' token
   95 |     B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] ? 1LL));
      |                                                       ^
      |                                                       :
a.cc:95:55: error: expected primary-expression before ')' token
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long

ll l, a, b, m;

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++) {
        for(int j = 0; j < B[0].size(); j++) {
            for(int k = 0; k < B.size(); k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++) B[i][i] = 1;
    if(n == 0) return B;
    mat C(A.size(), vec(A.size()));
    C = pow(mul(A, A), n / 2);
    if(n & 1) C = mul(C, A);
    return C;
}

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> l >> a >> b >> m;
  mat ans(3, vec(1));
  ans[0][0] = a; ans[1][0] = A=a; ans[2][0] = 1LL;
  ll cnt[20];
  rep1(d, 18) {
    ll MIN= pow(10, d - 1);
    if(a + b * (l - 1) < MIN) break;
    ll MAX = min(MIN * 10 - 1, a + b * (l - 1));
    cnt[d] = (MAX - a) / b + 1;
    mat A(3, vec(3)), B(3, vec(3));
    A[0][0] = 1LL; A[0][1] = 0; A[0][2] = b;
    A[1][0] = 1LL; A[1][1] = pow(10, d); A[1][2] = b;
    A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL:
    B = pow(A, cnt[i] - (d - 1 >= 0 ? cnt[d - 1] ? 1LL));
    ans = mul(B, ans);
  }
  cout << ans[0][0] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:30: error: 'A' was not declared in this scope
   84 |   ans[0][0] = a; ans[1][0] = A=a; ans[2][0] = 1LL;
      |                              ^
a.cc:94:44: error: expected ';' before ':' token
   94 |     A[2][0] = 0; A[2][1] = 0; A[2][2] = 1LL:
      |                                            ^
      |                                            ;
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

LL L, A, B, M;

long long modPow(long long x, long long y){
    long long r=1, a=x%M;
    while(y > 0){
        if((y&1) == 1) r = (r*a) % M;
        a = (a*a) % M;
        y /= 2;
    }
    return r;
}

long long _Pow(long long x, long long y){
    long long r=1, a=x;
    while(y > 0){
        if((y&1) == 1) r = r*a;
        a = a*a;
        y /= 2;
    }
    return r;
}

int disit(LL n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

LL term(LL a, LL b, LL i) {
  return a + b*i;
}

LL hoge(LL len, LL p) {
  // 1 + p + p^2 + ... + p^(len-1)
  if (len == 0) return 0;
  if (len == 1) return 1;
  if (len % 2 == 0) {
    return (hoge(len/2, p) * (1+_Pow(p, len/2)%M)%M) % M;
  } else {
    return (hoge(len-1, p) + _Pow(p, len-1)%M) % M;
  }
}

LL hoge2(LL len, LL p) {
  // 1*p^(len-1) + 2*p^(len-2) + ... + (len-1)*p + len*1
  // 6 + 500 + 40000 + 3000000 + 200000000 + 10000000000
  if (len == 0) return 0;
  if (len == 1) return 1;
  if (len % 2 == 0) {
    return hoge2(len/2, p)*(1+_Pow(p, len/2)%M)%M + (len/2)%M*hoge(len/2, p)%M;
  } else {
    return (len + p*hoge2(len-1, p)%M) % M;
  }
}

void solve() {
  cin >> L >> A >> B >> M;
  LL res = 0;

  LL i = L-1;
  LL zeros = 0;
  while(i >= 0) {
    LL start = term(A, B, i);
    int d = disit(start);
    LL len = min(i+1, (start-_Pow(10, d-1))/B + 1);
    i = i-len+1;
    LL end = term(A, B, i);
    i--;

    if (len <= 0) while(1){i++};

    LL tmp = end*hoge(len, _Pow(10, d)%M)%M;
    tmp = (tmp + B*hoge2(len-1, _Pow(10, d)%M)%M) % M;

    res = (res + (tmp*modPow(10, zeros))%M) % M;

    zeros += d * len;
  }

  cout << res << endl;
}

int main() {
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:114:31: error: expected ';' before '}' token
  114 |     if (len <= 0) while(1){i++};
      |                               ^
      |                               ;
Language: C++

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

vvi mult(vvi a, vvi b, ll MOD) {
    int l = a[0].size();
    int m = a.size(), n = b[0].size();
    vvi res(m, vi(n));
    REP (i, m) REP (j, n) REP (k, l) {
        res[i][j] += a[i][k] * b[k][j];
        res[i][j] %= MOD;
    }
    return res;
}

vvi pow(vvi a, ll k, ll MOD) {
    int n = a.size();
    vvi res(n, vi(n));
    REP (i, n) res[i][i] = 1;r
    while(k) {
        if (k&1) res = mult(res,a,MOD);
        a = mult(a,a,MOD);
        k >>= 1;
    }
    return res;
}

ll L, A, B, MOD;
ll digit[19];

ll s(ll n) {
    return A + B * n;
}

int solve() {
    ll k = 1;
    REP (i, 18) {
        ll lo = -1, hi = L;
        while (hi - lo > 1ll) {
            ll mid = (hi+lo)/2;
            if (s(mid) >= k*10) hi = mid;
            else lo = mid;
        }
        digit[i] = hi;
        k *= 10;
    }
    digit[18] = L;
    FORR (i, 1, 19) digit[i] = digit[i] - digit[i-1];
    REP (i, 19) assert(digit[i] >= 0);

    vvi X(3, vi(1));
    X[0][0] = A % MOD;
    X[1][0] = A % MOD;
    X[2][0] = 1;
    k = 1;
    bool f = true;
    REP (i, 19) {
        k *= 10;
        k %= MOD;
        vvi C(3, vi(3));
        C[0][0] = k;
        C[0][1] = 1;
        C[0][2] = B % MOD;
        C[1][0] = 0;
        C[1][1] = 1;
        C[1][2] = B % MOD;
        C[2][0] = 0;
        C[2][1] = 0;
        C[2][2] = 1;
        ll n = digit[i];
        if (n == 0) continue;
        if (f) {
            C = pow(C, n-1, MOD);
        }
        else C = pow(C, n, MOD);
        f = false;
        X = mult(C, X, MOD);
    }
    return X[0][0] % MOD;
}

int main() {
    cin >> L >> A >> B >> MOD;
    cout << solve() << endl;
}

Compiler output:
a.cc: In function 'vvi pow(vvi, ll, ll)':
a.cc:37:30: error: 'r' was not declared in this scope
   37 |     REP (i, n) res[i][i] = 1;r
      |                              ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int l = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
      	int m = sc.nextInt();
      	int sum = 0;
      	int ai = 0;
      	int nd = 0;
      	for(int i = l - 1; i >= 0; i--){
          nd = Math.floor(sum / 10);
          ai = a + b * i;
          sum = sum + ai * Math.pow(10,nd);
        }
		 //出力
		System.out.println(sum%m);
	}
}

Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from double to int
          nd = Math.floor(sum / 10);
                         ^
Main.java:16: error: incompatible types: possible lossy conversion from double to int
          sum = sum + ai * Math.pow(10,nd);
                    ^
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int l = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
      	int m = sc.nextInt();
      	int sum = 0;
      	int ai = 0;
      	int nd = 0;
      	for(int i = l - 1; i >= 0; i--){
          nd = (int) Math.floor(sum / 10);
          ai = a + b * i;
          sum = sum + ai * Math.pow(10,nd);
        }
		// 出力
		System.out.println(sum%m);
	}
}

Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to int
          sum = sum + ai * Math.pow(10,nd);
                    ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll fastpow(ll a, ll pw) {
	ll res = 1;
	while (pw) {
		if (pw & 1) res *= a;
		a *= a;
		pw >>= 1;
	}
	return res;
}
mat mul(mat &a,mat &b, ll mod){ //a*bなのでn*mとm*l→n*l
    mat c(a.size(),vec(b.at(0).size(),0));
    rep(i,a.size()){
        rep(k,b.size()){
            rep(j,b.at(0).size()){
                //ll ab = (a.at(i).at(k)*b.at(k).at(j))%mod;
                ll aa = a.at(i).at(k),bb =b.at(k).at(j);
                if(aa<0 || bb<0){
                    cout<<"abover"<<endl;
                    cout<<i<<' '<<k<<' '<<j<<endl;
                    cout<<aa<<' '<<bb<<endl;
                }
                (aa+=mod)%=mod;
                (bb+=mod)%=mod;
                (aa*=bb)%=mod; 
                (c.at(i).at(j) += aa)%=mod;
                if(c.at(i).at(j)<0){
                    cout<<"over"<<endl;
                    cout<<aa<<' '<<bb<<endl;
                }
            }
        }
    }
    return c;
}

mat matpow(mat a, ll pow, ll mod){
    mat b(a.size(),vec(a.size(),0));
    rep(i,a.size()) b.at(i).at(i) = 1;
    while(pow>0){
        if(pow&1) b = mul(b,a,mod);
        a = mul(a,a,mod);
        pow >>= 1;
    }
    return b;
}

int main() {
    ll L,A,B,M;
    cin>>L>>A>>B>>M;
    vector<ll> numd(19,0);//1-indexedでd桁の要素を保存
    ll last = 0;
    reps(i,1,19){
        ll next = fastpow(10,i)-(A+1);
        if(next<0) continue;
        (next+B) /= B; //i桁までの要素数
        numd.at(i) = min(next-last,L-last);
        if(L <= next) break;
        last += numd.at(i);
    }   
    /*cout<<"numd"<<endl;
    rep(i,19) cout<<numd.at(i) << ' ';
    cout<<endl;*/
    mat cd(3,vec(3,0));
    ll X = 0, s = A;
    mat ans(1,vec{X,s,1});
    //rep(i,3) cout<<ans[0][i]<<' ';
    //cout<<endl;
    reps(i,1,19){
        if(numd.at(i) == 0) continue;
        rep(p,3) rep(q,3) cd[p][q] = 0;
        cd[1][0] = cd[1][1] = cd[2][2] = 1;
        (cd[2][1] += B)%=M;
        (cd[0][0] += fastpow(10,i))%=M;
        ll num = numd.at(i);
        cd = matpow(cd,num,M);
        rep(p,3) rep(q,3) if(cd[p][q]<0)cout<<"cdover"<<endl;
        rep(p,3) if(ans[0][p]<0)cout<<"ans "<<p<<' '<<i<<' '<<ans[0][p]<<endl;
        ans = mul(ans,cd,M);
        //ans.at(0).at(1) -= B;
        while(ans.at(0).at(1) < 0){
            ans.at(0).at(1) += M;
        }
        (ans.at(0).at(1)+=M)%=M;
        //cout<<ans.at(0).at(0)<<' '<<ans[0][1]<<endl;
    }
    cout<<ans.at(0).at(0)<<endl;
    //cout<<M<<endl;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:14: error: lvalue required as left operand of assignment
   63 |         (next+B) /= B; //i桁までの要素数
      |         ~~~~~^~~
Language: Java

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class takahashis_basics_in_education_and_learning {

	public static void main(String[] args) throws Exception {
		new takahashis_basics_in_education_and_learning().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		long l = file.nextLong();
		BigInteger a = new BigInteger(file.next());
		BigInteger b = new BigInteger(file.next());
		BigInteger m = new BigInteger(file.next());
		String s = "";
		for (long i = 0; i < l; i++) {
			s += a;
			a = a.add(b);
		}
		System.out.println(new BigInteger(s).mod(m));
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, p / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, p / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}


Compiler output:
Main.java:9: error: class takahashis_basics_in_education_and_learning is public, should be declared in a file named takahashis_basics_in_education_and_learning.java
public class takahashis_basics_in_education_and_learning {
       ^
1 error
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
int main() {
	ll l, a, b, c, n, pc,r,k=1,t, ans = 0,sumd=0,count=1,cul,p1[66],cd;
	cin >> l >> a >> b >> M;
p1[0]=10;
for(i=1;i<=60;i++)
p1[i]=p1[i-1]*p1[i-1]%M;
	pc = 1;
	c = a;
	count = 1;
	k = 1;
	while (k <= a) {
		k *= 10;
		count++;
	}
	while (pc <= l) {
		n = min((k - c + b - 1) / b,l-pc+1);
		cd= (count-1)* n;
i=0;
while(cd>0){
if(cd%2==1)
ans=ans*p1[i]%M;
cd/=2;
i++;
}
		c += b * (n - 1);
		if (n == 1) {
			cul = c;
			ans = (ans + cul) % M;
		}
		else if (n >= 2) {
			ll p[66],i,cn=n-1,cr=1,ca=c%M,cb=-(b%M);
			p[0] = k%M;
			for (i = 1; i < 61; i++)
				p[i] = p[i - 1] * p[i-1] % M;
			i = 0;
			while (cn > 0) {
				if (cn % 2 == 1)
					cr = cr * p[i] % M;
				i++;
				cn /= 2;
			}
			cul = (((ca + cb* (n - 1) % M) % M*cr%M*p[0] % M + (-cb*p[0]% M*(cr - 1) % M*modinv(p[0] - 1) % M))%M+(M-ca)) % M*modinv(p[0]-1)%M;
			ans = (ans + cul) % M;
		}
		c += b;
		pc += n;
		k *= 10;
		count++;
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:5: error: 'i' was not declared in this scope
   81 | for(i=1;i<=60;i++)
      |     ^
a.cc:94:1: error: 'i' was not declared in this scope
   94 | i=0;
      | ^
Language: C++


// CE提出をしてデータ転送にAtCoderを使うテク

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

struct Matrix {
    int h;
    int w;
    vector< vector<ll> > e;
    Matrix( int _h, int _w ){
        init( _h, _w );
    }
    void init( int _h, int _w ){
        h = _h;
        w = _w;
        e.assign( _h, vector<ll>(_w) );
    }
    Matrix Dot( Matrix Mt, ll mod ){
        Matrix A( this->h, Mt.w );
        if( Mt.h != this->w ){
            return A;
        }
        Matrix A( this->h, Mt.w );
        for( int hi = 0; hi < A.h; hi++ ){
            for (int wi = 0; wi < A.w; wi++){
                for( int wwi = 0; wwi < A.w; wwi++ ){
                    A.e[hi][wi] += Mt.[wwi][hi];
                    A.e[hi][wi] %= mod;
                }
            }
        }

    }
    Matrix PowMod( ll index, ll mod ){
        if( index > N)
    }
};

int main() {

    ll l,a,b;
    Scll3(l,a,b);
    ll M;
    Scll(M);
    ll mod = M;

    return 0;
}



Compiler output:
a.cc: In member function 'Matrix Matrix::Dot(Matrix, ll)':
a.cc:58:16: error: redeclaration of 'Matrix A'
   58 |         Matrix A( this->h, Mt.w );
      |                ^
a.cc:54:16: note: 'Matrix A' previously declared here
   54 |         Matrix A( this->h, Mt.w );
      |                ^
a.cc:62:39: error: expected unqualified-id before '[' token
   62 |                     A.e[hi][wi] += Mt.[wwi][hi];
      |                                       ^
a.cc: In member function 'Matrix Matrix::PowMod(ll, ll)':
a.cc:70:21: error: 'N' was not declared in this scope
   70 |         if( index > N)
      |                     ^
a.cc:71:5: error: expected primary-expression before '}' token
   71 |     }
      |     ^
a.cc:71:5: warning: no return statement in function returning non-void [-Wreturn-type]
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  long long
#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(ru(10, dg),hl) + 1); ans1 %= p;
	if (diff % 2 == 1) {
		ans1 += ru(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(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() {
	long long 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_val = 1;
	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 *= now_val; ans1 %= p;
		ans += ans1; ans %= p;
		now_val *= (ru(10,diff),dg);now_val%=p;
	}
	long long qans = ans;
	cout << qans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:13: error: redeclaration of 'long long int now_val'
   74 |         int now_val = 1;
      |             ^~~~~~~
a.cc:66:49: note: 'long long int now_val' previously declared here
   66 |         vel st(19), go(19); int now_st = 0; int now_val = a;
      |                                                 ^~~~~~~
a.cc: In function 'long long int dig(long long int)':
a.cc:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

int mod;
ll b, ten;

ll f(ll l) {
  if (l == 0) return 0;
  if (l%2 == 1) {
    ll pl = l-1;
    ll x = f(pl);
    return (x*(ten%mod) + 1) % mod;
  } else {
    ll pl = l/2;
    ll x = f(pl);
    return (x*pow_(ten%mod, pl) + x) % mod;
  }
}
ll g(ll l) {
  if (l == 0) return 0;
  if (l%2 == 1) {
    ll pl = l-1;
    ll x = g(pl);
    return (x*(ten%mod) + b*(pl)) % mod;
  } else {
    ll pl = l/2;
    ll x = g(pl);
    return (x*pow_(ten%mod, pl) + x + b*(pl)%mod*f(pl)) % mod;
  }
}

int main() {
  ll L, a;
  cin >> L >> a >> b >> mod;
  ll last = a+b*(L-1);
  ll ans = 0;
  ten = 1;
  for (int i = 1; i <= 18; ++i) {
    ll l = ten, r = ten*10-1;
    if (last < l) continue;
    if (a > r) continue;
    ll na = 0; // 初項
    ll nl = 0; // 長さ
    {
      if (a >= l) na = a;
      else {
        na = ((l-a)+(b-1))/b*b+a;
        na = min(na, last);
      }
    }
    {
      ll nlast = 0;
      if (last <= r) nlast = last;
      else {
        nlast = (r-a)/b*b+a;
      }
      nl = (nlast-na)/b+1;
    }
    ten *= 10;
    (ans += na*f(nl) % mod) %= mod;
    (ans += g(nl)) %= mod;
  }
  cout << ans << endl;
  return 0;
}    


Compiler output:
a.cc: In function 'll f(ll)':
a.cc:18:15: error: 'pow_' was not declared in this scope; did you mean 'powl'?
   18 |     return (x*pow_(ten%mod, pl) + x) % mod;
      |               ^~~~
      |               powl
a.cc: In function 'll g(ll)':
a.cc:30:15: error: 'pow_' was not declared in this scope; did you mean 'powl'?
   30 |     return (x*pow_(ten%mod, pl) + x + b*(pl)%mod*f(pl)) % mod;
      |               ^~~~
      |               powl
Language: C++

//Optimise
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;

// #define multitest 1
#define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

void solve()
{
	cpp_int a, b, l, m;
	cin >> l >> a >> b >> m;
	cpp_int last = 0, base = 1;
	while (l--)
	{
		cpp_int temp = l2, l2 = a + l * b;
		while (temp)
		{
			temp /= 10;
			base *= 10;
		}
		last = base * l2 + last;
		if ((base * l2) % m == 0)
			break;
	}
	//cout << last << ' ';
	cout << last % m;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Compiler output:
a.cc:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    3 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int GetDigit(int a){
  return log10(a) + 1;
}

int main() {
  long long l, a, b, m, x, y;
  cin >> l >> a >> b >> m;
  
  y = a;
  for(i = 1; i < l; i++){
    x = y * GetDigit(a + b * i) * 10 + a + b * i;
    y = x % m;
  }
  
  cout << y << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   for(i = 1; i < l; i++){
      |       ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
ll ans[19]={0};
ll mod;
vector<ll> change_kt(20,0);
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2);
  ret*=ret;
  if(y%2==1) ret*=x;
  return ret;
}
ll pow2(ll x,ll y){
  y%=mod-1;
  if(y==0) return 1;
  ll ret=pow2(x,y/2);
  ret%=mod;
  ret*=ret;
  ret%=mod;
  if(y%2==1) ret*=x;
  return ret%mod;
}
ll gyaku(ll x){
  return pow2(x,mod-2);
}
int main(){
  ll l,a,b,m;
  cin>>l>>a>>b>>m;
  mod=m;
  for(int i=1;i<=18;i++){
    ll id=(pow(10,i)-a-1)/b;
    change_kt[i]=min(l,id+1);
    if(a>=pow(10,i)) change_kt[i]=0;
  }
  for(int i=0;i<18;i++){
    int kosu=change_kt[i+1]-change_kt[i];
    int j=i+1;
    cout<<kosu<<" "<<j<<" "<<endl;
    if(kosu>0){
      ll kans=b;
      kans%=mod;
      kans+=b*(gyaku(pow(10,j)-1));
      kans%=mod;
      kans*=(pow2(10,j*(kosu-1))-1)*gyaku(pow2(10,j)-1);
      kans%=mod;
      kans-=(kosu-1)*b*gyaku(pow2(10,j)-1);
      if(kans<0){
        ll p=(-kans)/mod;
        p++;
        kans+=p*mod;
      }
      kans%=mod;
      ans[i]=kans;
      ll a2=(pow2(pow2(10,j),kosu)-1)*gyaku(pow2(10,j)-1);
      ll first=a+b*change_kt[i];
      ans[i]+=first*a2;
      ans[i]%=mod;
      cout<<ans[i]<<endl;
    }
  }
  ll r=0;
  ll ans2=0;
  for(int i=17;i>=0;i++){
    int kosu=change_kt[i+1]-change_kt[i];
    ans2+=ans[i]*pow(10,r);
    ans2%=mod;
    r+=kosu*i;
  }
  cout<<ans2<<endl:
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:19: error: expected ';' before ':' token
   74 |   cout<<ans2<<endl:
      |                   ^
      |                   ;