Language: C++

#include<bits/stdc++.h>

using namespace std;

struct I{I(){ios::sync_with_stdio(false);cin.tie(0);}}init;
typedef long long LL;
const LL MOD=1e9+7;
typedef vector<LL> V;
typedef vector<V> M;

LL d[70][100][100];
void pow_init(int n){
    for(int b=1;b<60;b++){
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++){
                d[b][i][j]=0;
                for(int k=0;k<n;k++)
                    d[b][i][j]+=d[b-1][i][k]*d[b-1][k][j]%MOD;
                d[b][i][j]%=MOD;
            }
    }
}
M o(int n){
    return M(n,V(n,0));
}
M e(int n){
    M ret=o(n);
    for(int i=0;i<n;i++)
        ret[i][i]=1;
    return ret;
}
M mul(M a, M b){
    int n=a.size();
    M c=o(n);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++)
                c[i][j]+=a[i][k]*b[k][j]%MOD;
            c[i][j]%=MOD;
        }
    return c;
}
M mul(M a,int m){
    int n=a.size();
    M c=o(n);
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++)
                c[i][j]+=a[i][k]*d[m][k][j]%MOD;
            c[i][j]%=MOD;
        }
    return c;
}
M pow(M ret,LL n){
    int i=0;
    while(n){
        if(n&1)ret=mul(ret,i);
        n>>=1;
        i++;
    }
    return ret;
}

V mul(V a,M b){
    int n=a.size();
    V res(n,0);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            res[i]+=a[j]*b[j][i]%MOD;
        res[i]%=MOD;
    }
    return res;
}

LL solve(LL C,LL R,LL N){
    map<LL,vector<int>> O;
    O[R]=vector<int>();
    for(LL i=0,r,c;i<N;i++){
        cin>>c>>r;
        O[r].push_back(c-1);
    }
    int now=1;
    for(int i=0;i<C;i++)
        for(int j=0;j<C;j++)
            d[0][i][j]=0;
    for(int i=0;i<C;i++)
        for(int j=max(0,i-1);j<min(C,i+2);j++)
            d[0][i][j]++;
    pow_init(C);
    V res(C,0);
    res[0]=1;
    for(auto &it:O){
        int nxt=it.first;
        res=mul(res,pow(e(C),nxt-now));
        for(auto &c:it.second)res[c]=0;
        now=nxt;
    }
    return res[C-1];
}
int main(){
    for(LL i=0,w,h,n;cin>>w>>h>>n,w+h+n;i++){
        cout<<"Case "<<i<<": "<<solve(w,h,n)<<endl;
    }
    return 0;
}


    


    

Compiler output:
a.cc: In function 'LL solve(LL, LL, LL)':
a.cc:87:35: error: no matching function for call to 'min(LL&, int)'
   87 |         for(int j=max(0,i-1);j<min(C,i+2);j++)
      |                                ~~~^~~~~~~
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:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:87:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   87 |         for(int j=max(0,i-1);j<min(C,i+2);j++)
      |                                ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:87:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   87 |         for(int j=max(0,i-1);j<min(C,i+2);j++)
      |                                ~~~^~~~~~~