func_code_string: #include <bits/stdc++.h>   using namespace std;   using pii = pair<int, int>;   const int mx = 2e5 + 9;   int game[2][mx];   int f_occ[2][mx];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int x;       scanf( %d , &x);       x--;       game[x][i]++;     }     memset(f_occ, -1, sizeof f_occ);     for (auto x : {0, 1}) {       for (int i = 1; i <= n; i++) {         game[x][i] += game[x][i - 1];         if (f_occ[x][game[x][i]] != -1) continue;         f_occ[x][game[x][i]] = i;       }     }     vector<pii> ans;     for (int t = 1; t <= n; t++) {       int s = 0;       int last[] = {0, 0};       int win[] = {0, 0};       int idx = 0;       int latest = -1;       while (true) {         int next[] = {0, 0};         for (auto x : {0, 1}) next[x] = last[x] + t;         int f[] = {0, 0};         for (auto x : {0, 1}) f[x] = f_occ[x][next[x]];         if (f[0] == -1 and f[1] == -1) break;         if (f[0] == -1) {           last[0] = game[0][f[1]];           last[1] = game[1][f[1]];           idx = f[1];           win[1]++;           latest = 1;           continue;         }         if (f[1] == -1) {           last[0] = game[0][f[0]];           last[1] = game[1][f[0]];           idx = f[0];           win[0]++;           latest = 0;           continue;         }         if (f[0] < f[1]) {           last[0] = game[0][f[0]];           last[1] = game[1][f[0]];           idx = f[0];           win[0]++;           latest = 0;         } else {           last[0] = game[0][f[1]];           last[1] = game[1][f[1]];           idx = f[1];           win[1]++;           latest = 1;         }       }       if (idx != n) continue;       if (win[0] == win[1]) continue;       if (win[latest] < win[1 - latest]) continue;       s = win[latest];       ans.emplace_back(s, t);     }     sort(ans.begin(), ans.end());     printf( %d n , (int)ans.size());     for (auto [s, t] : ans) {       printf( %d %d n , s, t);     }   }   