Problem p02760 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define popf pop_front
#define pf push_front
#define si size()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound

#define ask(i, m, n) for (lli i = m; i < n; i++)
#define anket ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define o0(a) cout << a << " "
#define o1(a) cout << a << "\n"
#define o2(a, b) cout << a << " " << b << "\n"
#define o3(a, b, c) cout << a << " " << b << " " << c << "\n"
#define o4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << "\n"
using namespace std;

#define prime1 1000000007
#define prime2 998244353

lli modadd(lli n, lli m, lli mod) {
  lli sum = ((n + m) % mod + mod) % mod;
  return sum;
}

lli modsub(lli n, lli m, lli mod) {
  lli diff = ((n - m + mod) % mod + mod) % mod;
  return diff;
}

lli modpro(lli n, lli m, lli mod) {
  lli pro = ((n * m) % mod + mod) % mod;
  return pro;
}

lli powmod(lli x, lli y, lli mod) {
  x %= mod;
  y %= mod;
  lli res = 1;
  while (y > 0) {
    if (y & 1)
      res = modpro(res, x, mod);
    y = y >> 1;
    x = modpro(x, x, mod);
  }
  return res;
}

lli moddiv(lli n, lli m, lli mod) {
  // return n/m mod (mod) or n*(m)^-1 mod (mod)
  lli a = powmod(m, mod - 2, mod);
  // this is because of fermats thm i.e. a^-1 = a^p-2 mod(p) check
  // multiplying p on both sides
  lli res = modpro(a, n, mod);
  return res;
}

int main() {
  anket;
  lli a[3][3], c[3][3];

  ask(i, 0, 3) {
    ask(j, 0, 3) {
      cin >> c[i][j];
      a[i][j] = 0;
    }
  }
  lli n;
  cin >> n;
  ask(i, 0, n) {
    lli b;
    cin >> b;
    ask(j, 0, 3){ask(k, 0, 3){if (c[j][k] == b){a[i][j] = 1;
  }
}
}
;
}
if ((a[0][0] && a[0][1] && a[0][2]) || (a[1][0] && a[1][1] && a[1][2]) ||
    (a[2][0] && a[2][1] && a[2][2]) || (a[0][0] && a[1][0] && a[2][0]) ||
    (a[0][1] && a[1][1] && a[2][1]) || (a[0][2] && a[1][2] && a[2][2]) ||
    (a[0][0] && a[1][1] && a[2][2]) || (a[0][2] && a[1][1] && a[2][0])) {
  o1("Yes");
} else {
  o1("No");
}
return 0;
}


Fixed submission:
#include <bits/stdc++.h>

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define popf pop_front
#define pf push_front
#define si size()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound

#define ask(i, m, n) for (lli i = m; i < n; i++)
#define anket ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define o0(a) cout << a << " "
#define o1(a) cout << a << "\n"
#define o2(a, b) cout << a << " " << b << "\n"
#define o3(a, b, c) cout << a << " " << b << " " << c << "\n"
#define o4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << "\n"
using namespace std;

#define prime1 1000000007
#define prime2 998244353

lli modadd(lli n, lli m, lli mod) {
  lli sum = ((n + m) % mod + mod) % mod;
  return sum;
}

lli modsub(lli n, lli m, lli mod) {
  lli diff = ((n - m + mod) % mod + mod) % mod;
  return diff;
}

lli modpro(lli n, lli m, lli mod) {
  lli pro = ((n * m) % mod + mod) % mod;
  return pro;
}

lli powmod(lli x, lli y, lli mod) {
  x %= mod;
  y %= mod;
  lli res = 1;
  while (y > 0) {
    if (y & 1)
      res = modpro(res, x, mod);
    y = y >> 1;
    x = modpro(x, x, mod);
  }
  return res;
}

lli moddiv(lli n, lli m, lli mod) {
  // return n/m mod (mod) or n*(m)^-1 mod (mod)
  lli a = powmod(m, mod - 2, mod);
  // this is because of fermats thm i.e. a^-1 = a^p-2 mod(p) check
  // multiplying p on both sides
  lli res = modpro(a, n, mod);
  return res;
}

int main() {
  anket;
  lli a[3][3], c[3][3];

  ask(i, 0, 3) {
    ask(j, 0, 3) {
      cin >> c[i][j];
      a[i][j] = 0;
    }
  }
  lli n;
  cin >> n;
  ask(i, 0, n) {
    lli b;
    cin >> b;
    ask(j, 0, 3){ask(k, 0, 3){if (c[j][k] == b){a[j][k] = 1;
  }
}
}
;
}
if ((a[0][0] && a[0][1] && a[0][2]) || (a[1][0] && a[1][1] && a[1][2]) ||
    (a[2][0] && a[2][1] && a[2][2]) || (a[0][0] && a[1][0] && a[2][0]) ||
    (a[0][1] && a[1][1] && a[2][1]) || (a[0][2] && a[1][2] && a[2][2]) ||
    (a[0][0] && a[1][1] && a[2][2]) || (a[0][2] && a[1][1] && a[2][0])) {
  o1("Yes");
} else {
  o1("No");
}
return 0;
}