func_code_string: #include <bits/stdc++.h>   const int MOD = 1e9 + 7;   const int INF = 1e9 + 7;   const int MAXN = 1e3 + 5;   const double eps = 1e-14;   using namespace std;   int a[MAXN][5], acp[5], acVasya[5], price[5], curAc[5], curP[5];   int n;   int ans = INF + 1;   bool cmpFrac(int x, int y, int p, int q) { return (x * q > y * p); }   int problem_price(int x, int y) {     if (cmpFrac(x, y, 1, 2))       return 500;     else if (cmpFrac(x, y, 1, 4))       return 1000;     else if (cmpFrac(x, y, 1, 8))       return 1500;     else if (cmpFrac(x, y, 1, 16))       return 2000;     else if (cmpFrac(x, y, 1, 32))       return 2500;     else       return 3000;   }   bool ok(int k) {     for (int i = 0; i < 5; i++) {       curAc[i] = acp[i];       if (acVasya[i]) {         curAc[i] += k;       }     }     for (int i = 0; i < 5; i++) {       curP[i] = problem_price(curAc[i], n + k);     }     int VasyaS = 0, PetyaS = 0;     for (int i = 0; i < 5; i++) {       if (a[0][i] != -1) {         VasyaS += curP[i] - (curP[i] / 250 * a[0][i]);       }       if (a[1][i] != -1) PetyaS += curP[i] - (curP[i] / 250 * a[1][i]);     }     if (VasyaS > PetyaS)       return true;     else       return false;   }   void solve() {     cin >> n;     for (int i = 0; i < n; i++) {       for (int j = 0; j < 5; j++) {         cin >> a[i][j];         if (a[i][j] != -1) {           acp[j]++;         }       }     }     for (int j = 0; j < 5; j++) {       if (a[0][j] != -1 && a[1][j] != -1 && a[0][j] > a[1][j]) {         acVasya[j] = 1;       }     }     for (int i = 0; i < 1e6; i++) {       if (ok(i)) {         cout << i;         return;       }     }     if (ans == INF + 1) cout << -1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     if (!1) {       freopen(            474             .in ,            r , stdin);       freopen(            474             .out ,            w , stdout);     }     int t = 1;     while (t--) solve();     return 0;   }   