Language: C++

#include<cstdint>

template<std::uint_fast32_t MODULO>
struct modint {
private:
	using uint32 = std::uint_fast32_t;
	using uint64 = std::uint_fast64_t;

public:
	uint32 a;
	modint() :a(0) {}
	modint(const std::int_fast64_t &x) :a(set(x%MODULO + MODULO)) {}
	static uint32 set(const uint32 &x) { return(x<MODULO) ? x : x - MODULO; }
	static modint make(const uint32 &x) { modint ret;ret.a = x;return ret; }
	modint operator+(const modint &o)const { return make(set(a + o.a)); }
	modint operator-(const modint &o)const { return make(set(a + MODULO - o.a)); }
	modint operator*(const modint &o)const { return make((uint64)a*o.a%MODULO); }
	modint operator/(const modint &o)const { return make((uint64)a*~o%MODULO); }
	modint &operator+=(const modint &o) { return *this = *this + o; }
	modint &operator-=(const modint &o) { return *this = *this - o; }
	modint &operator*=(const modint &o) { return *this = *this * o; }
	modint &operator/=(const modint &o) { return *this = *this / o; }
	modint &operator^=(const uint32 &o) { return *this = *this^o; }
	modint operator~ ()const { return *this ^ (MODULO - 2); }
	modint operator- ()const { return make(set(MODULO - a)); }
	modint operator++() { return *this = make(set(a + 1)); }
	modint operator--() { return *this = make(set(a + MODULO - 1)); }
	bool operator==(const modint &o)const { return a == o.a; }
	bool operator!=(const modint &o)const { return a != o.a; }
	bool operator< (const modint &o)const { return a <  o.a; }
	bool operator<=(const modint &o)const { return a <= o.a; }
	bool operator> (const modint &o)const { return a >  o.a; }
	bool operator>=(const modint &o)const { return a >= o.a; }
	explicit operator bool()const { return a; }
	explicit operator uint32()const { return a; }
	modint operator^(uint32 x)const {
		uint64 t = a, u = 1;
		while (x) { if (x & 1) u = u*t%MODULO;t = (t*t) % MODULO;x >>= 1; }
		return make(u);
	}
};
 

int main(void) {
	using mint = modint<1000000007>;
	int n;
	std::string s;
	std::cin >> n >> s;
	mint dp[5003][5003] = {};
	dp[0][0] = 1;
	for (int i = 1;i <= n;++i) {
		dp[i][0] = dp[i - 1][1] * 2 + dp[i - 1][0];
		for (int j = 1;j <= i;++j) {
			dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j + 1] * 2;
		}
	}
	std::cout << dp[n][s.length()].a << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:14: error: 'string' is not a member of 'std'
   47 |         std::string s;
      |              ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<cstdint>
  +++ |+#include <string>
    2 | 
a.cc:48:14: error: 'cin' is not a member of 'std'
   48 |         std::cin >> n >> s;
      |              ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdint>
  +++ |+#include <iostream>
    2 | 
a.cc:48:26: error: 's' was not declared in this scope
   48 |         std::cin >> n >> s;
      |                          ^
a.cc:57:14: error: 'cout' is not a member of 'std'
   57 |         std::cout << dp[n][s.length()].a << std::endl;
      |              ^~~~
a.cc:57:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:57:50: error: 'endl' is not a member of 'std'
   57 |         std::cout << dp[n][s.length()].a << std::endl;
      |                                                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstdint>
  +++ |+#include <ostream>
    2 |