Language: C++

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

typedef long long ll;
#define MOD 1000000007
ll extgcd(ll a, ll b, ll &x, ll &y) {
  ll g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
ll gcd(ll a, ll b) { ll x, y; return extgcd(a, b, x, y);}

class llm{
	ll n;
public:
	llm(){n = 0;}
	llm(ll n){this->n = (n >= 0) ? (n % MOD) : (MOD - 1 - (-n-1 % MOD));}
	operator ll() const {return n;}
	llm operator+(const llm &y) const{ return llm((ll)*this + (ll)y);}
	llm operator-(const llm &y) const{ return llm((ll)*this - (ll)y);}
	llm operator*(const llm &y) const{ return llm((ll)*this * (ll)y);}
	llm operator/(const llm &y) const{ return *this * y.inv();}
	llm inv() const{
		ll x, y;
		if (extgcd(n, MOD, x, y) == 1) return llm(x);
  		return llm(0); // unsolvable
	}
	friend istream& operator >> (istream& os, llm& x);
	friend ostream& operator << (ostream& os, const llm& x);
};
istream& operator >> (istream& is, llm& x){ll n; is >> n; x = llm(n); return is;}
ostream& operator << (ostream& os, const llm& x){os << (ll)x; return os;}

template<typename T> T comb(ll n, ll k){
	T ret = 1;
	for(ll i=1;i<=k;i++) ret = ret * T(n - k + i) / T(i);
	return ret;
}

ll H, W, K;
vector<vector<llm> > dp;
int main(){
  vector<llm> fib = {1, 1, 2, 3, 5, 8, 13, 21, 34};
  cin >> H >> W >> K;
  dp = vector<vector<llm> >(H+1, vector<llm>(W+1));
  dp[0][1] = 1;
  for(ll i=0;i<H;i++){
    for(ll j=1;j<=W;j++){
      if (j>1) dp[i+1][j-1] += dp[i][j] * fib[j-2] * fib[W-j];
      dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      if (j<W) dp[i+1][j+1] += dp[i][j] * fib[j-1] * fib[W-j-1];
    }
  }
  cout << dp[H][K] << endl;
}
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:49:29: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<llm>, llm>::value_type' {aka 'llm'} and 'llm')
   49 |       if (j>1) dp[i+1][j-1] += dp[i][j] * fib[j-2] * fib[W-j];
a.cc:50:39: error: no matching function for call to 'max(int, ll)'
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                    ~~~^~~~~~~~
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: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:50:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                    ~~~^~~~~~~~
/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:50:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                    ~~~^~~~~~~~
a.cc:50:58: error: no matching function for call to 'max(int, ll)'
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                                       ~~~^~~~~~~~~~
/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:50:58: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                                       ~~~^~~~~~~~~~
/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
/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:50:58: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   50 |       dp[i+1][j] += dp[i][j] * fib[max(0, j-2)] * fib[max(0, W-j-1)];
      |                                                       ~~~^~~~~~~~~~
a.cc:51:29: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<llm>, llm>::value_type' {aka 'llm'} and 'llm')
   51 |       if (j<W) dp[i+1][j+1] += dp[i][j] * fib[j-1] * fib[W-j-1];