USACO 2019 December Contest, Cow Gymnastics

I’m not getting anything aside from the first case correct. I looked at the solution on usaco.guide and it seems to be the same as mine. Could someone please tell me what I’m doing wrong here.

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    freopen("gymnastics.in", "r", stdin);
    freopen("gymnastics.out", "w", stdout);
    int k, n;
    cin >> k >> n;
    bool better[20][20];
    for (int s = 0; s < k; s++) {
        vector<int> test(n);
        for (int i = 0; i < n; i++) {
            cin >> test[i];
            test[i]--;
        }
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                better[test[i]][test[j]] = true;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            ans += !better[i][j] || !better[j][i];
        }
    }
    cout << ans;
}

Nvmd i didn’t initialize the array to false.