[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
MAXINT = const int with MAXINT = 2147483640
MAXLL = const long long with MAXLL = 9223372036854775800LL
MAXN = const long long with MAXN = 1e6
eps = const double with eps = 1e-9
mod = const long long with mod = 998244353
dp = 3d array of long long of size [100006][202][2], pref = 2d array of size [300][2]
n = long long, a = integer array of size MAXN
define the main function
    call srand on time(0)
    read n
    for i = 1 to n, read a[i]
    if a[1] is -1
        for i = 1 to 200 dp[1][j][0] = 1
    else
        dp[1][a[1]][0] = 1
    for i = 2 to n
        for j = 1 to 200
            (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) = (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) modulo mod
            (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) = (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) modulo mod
        end of the block
        if a[i] is -1
            for cur = 1 to 200
                sum = long long with sum = 0
                (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) = (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) modulo mod
                (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod
                (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod
                sum = pref[cur - 1][1] + pref[cur - 1][0]
                (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod
            end of the block
        else
            sum = long long with sum = 0
            cur = long long with cur = a[i]
            for j = cur to 200, sum = sum + (dp[i - 1][j][1]) = sum + (dp[i - 1][j][1]) modulo mod
            (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod
            (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod
            sum = 0
            for j = 1 to cur exclusive, (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) = (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) modulo mod
            (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod
        end of the block
    end of the block
    ans = long long with ans = 0
    for i = 1 to 200, (ans = ans + dp[n][i][1]) = (ans = ans + dp[n][i][1]) modulo mod
    print ans
    return to indicate successful execution
end of the block

[CODE]:

const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1e6;
const double eps = 1e-9;
const long long mod = 998244353;
long long dp[100006][202][2], pref[300][2];
long long n, a[MAXN];
int main() {
    srand(time(0));
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    if (a[1] == -1)
        for (int j = 1; j <= 200; ++j) dp[1][j][0] = 1;
    else
        dp[1][a[1]][0] = 1;
    for (int i = 2; i <= n; ++i) {
        for (int j = 1; j <= 200; ++j) {
            (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) %= mod;
            (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) %= mod;
        }
        if (a[i] == -1) {
            for (int cur = 1; cur <= 200; ++cur) {
                long long sum = 0;
                (sum += (pref[200][1] - pref[cur - 1][1] + mod)) %= mod;
                (sum += dp[i - 1][cur][0]) %= mod;
                (dp[i][cur][1] += sum) %= mod;
                sum = pref[cur - 1][1] + pref[cur - 1][0];
                (dp[i][cur][0] += sum) %= mod;
            }
        } else {
            long long sum = 0;
            long long cur = a[i];
            for (int j = cur; j <= 200; ++j) sum += (dp[i - 1][j][1]) %= mod;
            (sum += dp[i - 1][cur][0]) %= mod;
            (dp[i][cur][1] += sum) %= mod;
            sum = 0;
            for (int j = 1; j < cur; ++j) (sum += dp[i - 1][j][0] + dp[i - 1][j][1]) %= mod;
            (dp[i][cur][0] += sum) %= mod;
        }
    }
    long long ans = 0;
    for (int i = 1; i <= 200; ++i) (ans += dp[n][i][1]) %= mod;
    cout << ans << "\n";
    return 0;
}