Problem:


Score : 200 points

Problem Statement

We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.

The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.

Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Constraints

All values in input are integers.

1 \leq A_{i, j} \leq 100

A_{i_1, j_1} \neq A_{i_2, j_2} ((i_1, j_1) \neq (i_2, j_2))

1 \leq N \leq 10

1 \leq b_i \leq 100

b_i \neq b_j (i \neq j)

Input

Input is given from Standard Input in the following format:

A_{1, 1} A_{1, 2} A_{1, 3}
A_{2, 1} A_{2, 2} A_{2, 3}
A_{3, 1} A_{3, 2} A_{3, 3}
N
b_1
\vdots
b_N

Output

If we will have a bingo, print Yes; otherwise, print No.

Sample Input 1

84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

Sample Output 1

Yes

We will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.

Sample Input 2

41 7 46
26 89 2
78 92 8
5
6
45
16
57
17

Sample Output 2

No

We will mark nothing.

Sample Input 3

60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Sample Output 3

Yes

We will mark all the squares.



Sample input:
84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30


Sample output:
Yes

Submission status: Runtime Error

Solution code:
import sys
rl = sys.stdin.readline

rows = 3
cols = 3
a11,a12,a13 = [int(x) for x in rl().split(' ')]
a11,a12,a13 = [int(x) for x in rl().split(' ')]
a31,a32,a33 = [int(x) for x in rl().split(' ')]

n = int(rl())
b = []

for i in range(n):
    b.append(int(rl()))

#####################

card = [a11,a12,a13,a1,a22,a23,a31,a32,a33]

for num in b:
    for i in range(len(card)):
        if card[i] == num:
            card[i] = 0

def check(card):
    for y in range(rows):
        if all([card[y*rows+x] == 0 for x in range(cols)]):
            return True

    # col
    for x in range(cols):
        if all([card[y*rows+x] == 0 for y in range(rows)]):
            return True

    # diagonal
    if all([card[xy*rows+xy] == 0 for xy in range(rows)]):
            return True

    if all([card[xy*rows+cols-1-xy] == 0 for xy in range(rows)]):
            return True

    return False

if check(card):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a=[[map(int, input().split())] for j in range(3)]
n=int(input())
b=[int(input()) for i in range(n)]
diag1=[a[0][0], a[1][1], a[2][2]]
diag2=[a[0][2], a[1][1], a[2][0]]
f=True
for i in a:
  if any(b) in i:
    print("Yes")
    break
  elif any(b) in diag1 or any(b) in diag2:
    print("Yes")
    break
  else:
    f=False
if not f:
  print("No")

Submission status: Runtime Error

Solution code:
/* 
 * Created by solzard on 2020-03-05.
 * 
 */
#include <iostream>
#include <vector>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool is_bingo(int player) {
  std::unordered_set<int> winnable_conditions
      {0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100};
  for (const auto &condition : winnable_conditions) {
    if ((player & condition) == condition) return true;
  }
  return false;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);

  std::vector<int> sheet;
  std::unordered_set<int> bingo;
  int a, n, b;
  rep(_, 9) {
    std::cin >> a;
    sheet.emplace_back(a);
  }
  std::cin >> n;
  rep(_, n) {
    std::cin >> b;
    bingo.emplace(b);
  }
  int player = 0;
  rep(i, 9) {
    if (bingo.find(sheet[i]) != bingo.end()) {
      player |= 1 << i;
    }
  }
  std::cout << (is_bingo(player) ? "Yes" : "No") << "\n";
}

Submission status: Runtime Error

Solution code:
/* 
 * Created by solzard on 2020-03-05.
 * 
 */
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool is_bingo(int player) {
  std::unordered_set<int> winnable_conditions
      {0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100};
  for (const auto &condition : winnable_conditions) {
    if ((player & condition) == condition) return true;
  }
  return false;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);

  std::vector<int> sheet;
  std::unordered_set<int> bingo;
  int a, n, b;
  rep(_, 9) {
    std::cin >> a;
    sheet.emplace_back(a);
  }
  std::cin >> n;
  rep(_, n) {
    std::cin >> b;
    bingo.emplace(b);
  }
  int player = 0;
  rep(i, 9) {
    if (bingo.find(sheet[i]) != std::end(bingo)) {
      player |= 1 << i;
    }
  }
  std::cout << (is_bingo(player) ? "Yes" : "No") << "\n";
}

Submission status: Runtime Error

Solution code:
import numpy as np

bingo = np.zeros([3,3])
check = np.zeros([3,3])
choice = []
flag = "No"

for i in range(3):
    a = input().split()
    a = [int(x) for x in a]
    bingo[i] = a
N = int(input())
for i in range(N):
    choice.append(int(input()))

convert = bingo.reshape([9])
for i in range(9):
    for j in range(N):
        if(convert[i] == j):
            ckeck[i//3][i%3] = 1
            continue

for i in range(3):
    if(check[i][0] == 1 and check[i][1] == 1 and check[i][2] == 1):
        flag = "Yes"
    elif(check[0][i] == 1 and check[1][i] == 1 and check[2][i] == 1):
        flag = "Yes"
if(check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1):
    flag = "Yes"
elif(check[2][0] == 1 and check[1][1] == 1 and check[0][2] == 1):
    flag = "Yes"

print(flag)

Submission status: Runtime Error

Solution code:
bingo = np.zeros([3,3])
check = np.zeros([3,3])
choice = []
flag = "N0"

for i in range(3):
    a = input().split()
    a = [int(x) for x in a]
    bingo[i] = a
N = int(input())
for i in range(N):
    choice.append(int(input()))

convert = bingo.reshape([9])
for i in range(9):
    for j in range(N):
        if(convert[i] == j):
            ckeck[i//3][i%3] = 1
            continue

for i in range(3):
    if(check[i][0] == 1 and check[i][1] == 1 and check[i][2] == 1):
        ok = "Yes"
    elif(check[0][i] == 1 and check[1][i] == 1 and check[2][i] == 1)
        ok = "Yes"
if(check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1):
    ok = "Yes"
elif(check[2][0] == 1 and check[1][1] == 1 and check[0][2] == 1):
    ok = "Yes"

print(ok)

Submission status: Runtime Error

Solution code:
A1st = input().split(' ')
A2th = input().split(' ')
A3rd = input().split(' ')
Alist = []
ans = []
b = []
A11 = int(A1st[0]) ; A12 = int(A1st[1]) ; A13 = int(A1st[2])
A21 = int(A2th[0]) ; A22 = int(A2th[1]) ; A23 = int(A2th[2])
A31 = int(A3rd[0]) ; A32 = int(A3rd[1]) ; A33 = int(A3rd[2])
Alist.append(A11) ;Alist.append(A12) ; Alist.append(A13)
Alist.append(A21) ; Alist.append(A22) ; Alist.append(A23)
Alist.append(A31) ; Alist.append(A32) ; Alist.append(A33)
N = int(input())
for k in range(N):
    b.append(input())
for s in range(9):
    if str(Alist[s]) in b:
        ans.append(s+1)
ans.sort()
if (1 and 2 and 3 in ans) or (4 and 5 and 6 in ans) or (7 and 8 and 9 in ans) or (1 and 4 and 7 in ans) or (2 and 5 and 8 in ans) or (3 and 6 and 9 in ans) or (1 and 5 and 9 in ans) or ( 3 and 5 and 7 in ans):
    pirnt('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A1st = input().split(' ')
A2th = input().split(' ')
A3rd = input().split(' ')
Alist = []
ans = []
b = []
A11 = int(A1st[0]) ; A12 = int(A1st[1]) ; A13 = int(A1st[2])
A21 = int(A2th[0]) ; A22 = int(A2th[1]) ; A23 = int(A2th[2])
A31 = int(A3rd[0]) ; A32 = int(A3rd[1]) ; A33 = int(A3rd[2])
Alist.append(A11) ;Alist.append(A12) ; Alist.append(A13)
Alist.append(A21) ; Alist.append(A22) ; Alist.append(A23)
Alist.append(A31) ; Alist.append(A32) ; Alist.append(A33)
N = int(input())
for k in range(N):
    b.append(input())
for s in range(9):
    if str(Alist[s]) in b:
        ans.append(s+1)
ans.sort()
if (ans in 1 and 2 and 3) or (ans in 4 and 5 and 6) or (ans in 7 and 8 and 9) or (ans in 1 and 4 and 7) or (ans in 2 and 5 and 8) or (ans in 3 and 6 and 9) or (ans in 1 and 5 and 9) or (ans in 3 and 5 and 7):
    pirnt('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def check(bing):
    for j in range(3):
        if bing[j][0] == bing[j][1] == bing[j][2]:
            return True
        elif bing[0][j] == bing[1][j] == bing[2][j]:
            return True
        else:
            pass

    if bing[0][0] == bing[1][1] == bing[2][2]:
        retun True
    elif bing[2][0] == bing[1][1] == bing[0][2]:
        return True
    else:
        False

bing = []
for _ in range(3):
    bing.append(list(map(int,input().split)))

n = int(input())

for _ in range(n):
    b = int(input())

    for i in range(3):
        for j in range(3):
            if bing[i][j] == b:
                bing[i][j] ==0
                
if check(bing) == True:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
  a = input().split()
  a = [int(num) for num in a]
  A.append(a)

N = int(input())
b = [int(input()) for i in range(N)]

for i in range(3):
  for j in range(3):
    if b.count(A[i][j]) != 0:
      A[i][j] = 0
    else:
      continue

if A[1][1] == 0:
  if A[0][0]==A[2][2]==0 or A[0][2]==A[2][0]==0:
    print("Yes")
  else:
    print("No")
elif A[1][1] != 0:
  if sum(A[0])==0 or sum(A[2])==0 or sum(A[:][0])==0 or sum(A[:][2]==0):
    print("Yes")
  else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
  a = input().split()
  a = [int(num) for num in a]
  A.append(a)
print(A)

N = int(input())
b = [int(input()) for i in range(N)]
print(b)

for i in range(3):
  for j in range(3):
    if b.count(A[i][j]) != 0:
      A[i][j] = 0
    else:
      continue

if A[1][1] == 0:
  if A[0][0]==A[2][2]==0 or A[0][2]==A[2][0]==0:
    print("Yes")
  else:
    print("No")
elif A[1][1] != 0:
  if sum(A[0])==0 or sum(A[2])==0 or sum(A[:][0])==0 or sum(A[:][2]==0):
    print("Yes")
  else:
    print("No")

Submission status: Runtime Error

Solution code:
a = []
for i in range(3):
    a.append(list(map(int, input().split())))

b = []

for n in range(int(input())):
    # b.append(int(input()))
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == a[i][j]:
                a[i][j] = 0

for i in range(3):
    if set([0]) == set(a[i]):
        print('Yes')
        exit()
    elif set([0]) == set([a[i][0], a[i][1], a[i][2]]):
        print('Yes')
        exit()

if set([0]) == set([a[0][0], a[1][1], a[2][2]]):
    print('Yes')
    exit()
elif set([0]) == set(a[2][0], a[1][1], a[0][2]):
    print('Yes')
    exit()

print('No')

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>

int a[4][4],b,vis[4][4],n;

int main()
{
	for(int i=1;i<=3;++i)
		for(int j=1;j<=3;++j)
			scanf("%d",&a[i][j]);
	scanf("%d",&n);
	for(int _=1;_<=n;++_) {
		scanf("%d",&b);
		for(int i=1;i<=3;++i)
			for(int j=1;j<=3;++j)
				if(a[i][j]==b) vis[i][j]=1;
	}
	int f,g;
	for(int i=1;i<=3;++i) {
		f=0,g=0;
		for(int j=1;j<=3;++j) {
			if(vis[i][j]) f++;
			if(vis[j][i]) g++;
		}
		if(f==3||g==3) {
			printf("Yes");
			return 0;
		}
	}
	f=0,g=0;
	for(int i=1;i<=3;++i) {
		if(vis[i][4-i]) f++;
		if(vis[4-i][i]) g++;
	}
	if(f==3||g==3){ 
		printf("Yes");
		return 0;
	}
	printf("No");
	return 0;
}

Submission status: Runtime Error

Solution code:
t=[]
for i in range(3):
    t.append([int(i) for i in input().split()])
n = int(input())
lst = []
for i in range(n):lst+=[int(input())]
def ligne(i):
    for j in range(3):
        if not t[i][j] in lst:
            return False
    return True
def col(j):
    for i in range(3):
        if not t[i][j] in lst:
            retur False
    return True
def diag1():
    for i in range(3):
        if not t[i][i] in lst:
            return False
    return True
def diag2():
    for i in range(3):
        if not t[2-i][i] in lst:
            return False
    return True
ans = False
for i in range(3):
    ans = ans or ligne(i)
    ans = ans or col(i)
ans  = ans or diag1() or diag2()
if ans :
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
b = []
for i in range(n) :
    b = int(input())
    for j in range(3) :
        for k in range(3) :
            if a[j][k] == b :
                m[j][k] = 1

if a[0].count(1) == 3 :
    print('Yes')
elif a[1].count(1) == 3 :
    print('Yes')
elif a[2].count(1) == 3 :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
mylist=[]

mylist= map(int,input().rstrip().split())
mylist= map(int,input().rstrip().split())
mylist = map(int,input().rstrip().split())

num = int(input())

for i in range(num):
    x = map(int,input().rstrip().split())
    k=0
    for j in mylist:
      if j==x:
        mylist[k]=0
      k+=1
            
bingo(0,1,2)
bingo(3,4,5)
bingo(6,7,8)
bingo(0,3,6)
bingo(1,4,7)
bingo(2,5,8)
bingo(0,4,8)
bingo(2,4,6)

      
def bingo(x,y,z):
  if mylist[a]==0 and mylist[b]==0 mylist[c]==0:
    print("Yes")
  else:
    print("No")

print(result)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
int main(){
    int ar[4][4];
    for(int i=1;i<=3;i++){
        for(int j = 1;j<=3;j++){
            cin>>ar[i][j];
        }
    }
    int m;
    I(m);
    for(int i=1;i<=m;i++){
        int x;
        I(x);
        for(int j=1;j<=3;j++){
            for(int k=1;k<=3;k++){
                if(ar[j][k] == x)ar[j][k] = -1;
            }
        }
    }
    bool fl =0;
    for(int i=1;i<=3;i++){
        if(ar[i][1] == -1 && ar[i][1] == ar[i][2] && ar[i][2] == ar[i][3])fl =1;
        if(ar[1][i] == ar[2][i] && ar[3][i] == ar[2][i])fl =1;
    }
    if(ar[1][1] ==ar[2][2] && ar[3][3] == ar[2][2] && ar[1][1] == -1)fl =1;
    if(fl)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
def search(chart, m):
    for k in range(len(chart)):
        if m in chart[k]:
            return True
    return False

def row(chart, i):
    res = []
    for k in range(len(chart)):
        res.append(chart[k][i])
    return res


def check(numlist, bingolist):
    for num in bingolist:
        if num not in numlist:
            return False
    return True

def naname1(chart):
    resul = []
    for i in range(3):
        resul.append(chart[i][i])
    return resul

def naname2(chart):
    resul = []
    for i in range(3):
        resul.append(chart[i, (2-i)])
    return resul

def bingo(chart, listb):
    count = 0
    numlist = []
    for num in listb:
        if search(chart, num):
            count += 1
            numlist.append(num)
    if count >= 5:
        return "yes"
    elif count <= 2:
        return "no"
    else:
        for i in range(len(chart)):
            # i = 0,1,2
            if check(numlist, chart[i]):
                return "yes"
            elif check(numlist, row(chart,i)):
                return "yes"
            elif check(numlist, naname1(chart)):
                return "yes"
            elif check(numlist, naname2(chart)):
                return "yes"
            else:
                return 'no'

chart=[]
for i in range(3):
    l = list(map(int, input().split()))
    chart.append(l)

N = int(input())
listb = []
for i in range(N):
    listb.append(int(input()))

print(bingo(chart, listb))

Submission status: Runtime Error

Solution code:
b = []
for i in range(N) :
    b.append(int(input()))

m = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N) :
    for j in range(3) :
        for k in range(3) :
            if b[i] == a[j][k] :
                m[j][k] = 1
if  m[0].count(1) == 3 or \
    m[1].count(1) == 3 or \
    m[2].count(1) == 3 or \
    [x[0] for x in m].count(1) == 3 or \
    [x[1] for x in m].count(1) == 3 or \
    [x[2] for x in m].count(1) == 3 or \
    (m[0][0] == 1 and m [1][1] == 1 and m [2][2] == 2) or \
    (m[2][0] == 1 and m [1][1] == 1 and m [2][0] == 2) :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
import math
a1 = list(map(int, input().split())) 
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

N = int(input())

b = []
for i in range(N) :
    b.append(int(input()))

m = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N) :
    for j in range(3) :
        for k in range(3) :
            if b[i] == a[j][k] :
                m[j][k] = 1
if  m[0].count(1) == 3 or \
    m[1].count(1) == 3 or \
    m[2].count(1) == 3 or \
    [x[0] for x in m].count(1) == 3 or \
    [x[1] for x in m].count(1) == 3 or \
    [x[2] for x in m].count(1) == 3 or \
    (x[0][0] == 1 and x [1][1] == 1 and x [2][2] == 2) or \
    (x[2][0] == 1 and x [1][1] == 1 and x [2][0] == 2) :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
import math
a1 = list(map(int, input().split())) 
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

N = int(input())

b = []
for i in range(N) :
    b.append(int(input()))

m = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N) :
    for j in range(3) :
        for k in range(3) :
            if b[i] == a[j][k] :
                m[j][k] = 1

if  m[0].count(1) == 3 or \
    m[1].count(1) == 3 or \
    m[2].count(1) == 3 or \
    [x[0] for x in m].count(1) == 3 or \
    [x[1] for x in m].count(1) == 3 or \
    [x[2] for x in m].count(1) == 3 or \
    (x[0][0] == 1 and x [1][1] == 1 and x [2][2] == 2) or \
    (x[2][0] == 1 and x [1][1] == 1 and x [2][0] == 2) :
    print('YES')
else :
    print('NO')

Submission status: Runtime Error

Solution code:
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
li=set(input() for ini in range(n))
d=[0 for i in range(9)]
for j in range(3):
  for i in range(3):
    if l[j][i] in li:d[3*j+i]=1
if set(1) in [set(l[h::3])for h in range(3)]+[set(l[h:h+3])for h in range(3)]+[set([l[0],l[4],l[8]]),set([l[2],l[4],l[6]])]:
  print("Yes")
else:print("No")

Submission status: Runtime Error

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
n = input()
B = list(map(int, input().split()))
ans = False

bingolist = []
for i in range(3):
  bingolist.append([A[i][0], A[i][1], A[i][2]])
  bingolist.append([A[0][i], A[1][i], A[2][i]])

bingolist.append([A[0][0], A[1][1], A[2][2]])
bingolist.append([A[2][0], A[1][1], A[0][2]])

for i in bingolist:
  ans = True if (i[0] in B and i[1] in B and i[2] in B)
  
print(ans)

Submission status: Runtime Error

Solution code:
a[0] = map(int,input().split())
a[1] = map(int,input().split())
a[2] = map(int,input().split())
n = int(input())
b = []
for i in n:
  b.appned(i)

for i in range(3):
    for j in range(n):
      a[k-1][i-1] == b[n-1]
      a[k-1][i-1] == 0

flag = false
for i in range(3):
  if(a[i-1][0] == a[i-1][1] == a[i-1][2] == 0):
    flag = true

if (a[0][0] == a[1][1] == a[2][2] == 0):
  flag = true

if (a[2][0] == a[1][1] == a[0][2] == 0):
  flag = true
  
if (flag== true):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A=list(map(int,input().spliy()))
B=list(map(int,input().spliy()))
C=list(map(int,input().spliy()))
n=input()
for i range(n):
  D[i]=int(input())

Acount=0 
Bcount=0
Ccount=0
  
for i in range(0,n):
  if A[0]==D[i]:
    Acount+=1
  if A[1]==D[i]:
    Acount+=1
  if A[2]==D[i]:
    Acount+=1
  if(Acpunt)==3:
    exit()
for i in range(0,n):
  if B[0]==D[i]:
    Bcount+=1
  if B[1]==D[i]:
    Bcount+=1
  if B[2]==D[i]:
    Bcount+=1
  if(Bcpunt)==3:
    exit()
for i in range(0,n):
  if C[0]==D[i]:
    Ccount+=1
  if C[1]==D[i]:
    Ccount+=1
  if C[2]==D[i]:
    Ccount+=1
  if(Ccpunt)==3:
    exit()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  3 22:38:51 2020

@author: Kanaru Sato
"""

A = []
[A.append(list(map(int, input().split()))) for i in range(0,3)]

N = int(input())

b = []
[b.append(list(map(int, input()))) for i in range(0,N)]

flag = [[0, 0, 0]
        [0, 0, 0]
        [0, 0, 0]]

for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b:
            flag[i][j] = 1

column = 0
raw = 0
naname = 0

for i in range(0,3):
    column += flag[i][0]*flag[i][1]*flag[i][2]
    raw += flag[0][i]*flag[1][i]*flag[2][i]
naname = flag[0][0]*flag[1][1]*flag[2][2]+flag[0][2]*flag[1][1]*flag[2][0]

if column>=1 or raw>=1 or naname>=1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
n=int(input())

for i in range(n):
	b=int(input())
	for j in range(3):
		for k in range(3):
			if a[j][k]==b:
				a[j][k]=0

ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
# print("a",a)
# print(a[0][0])
n=int(input())
#print("b:",b)
for i in range(n):
    b=int(input())
	for j in range(3):
		for k in range(3):
			#print("e",e)
			if a[j][k]==b:
				a[j][k]=0
				#print("a:",a)
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
# print("a",a)
# print(a[0][0])
n=int(input())
#print("b:",b)
for i in range(n):
    b=int(input())
	for j in range(3):
		for k in range(3):
			#print("e",e)
			if a[j][k]==e:
				a[j][k]=0
				#print("a:",a)
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
v = []
m = [False for _ in range(9)]
for i in range(3):
    a, b, c = map(int, input().split())
    v += [a, b, c]

n = int(input())
for i in range(n):
    a = int(input())
    if a in v:
        m[v.index(a)] = True

def control():
    for i in range(3):
        if all(m[3*i:3*i+3]):
            return True
        if all(m[i::3]):
            return True

    if all(m[::4]) or all(m[2:8:2]):
        return True
    return False

print("Yes" if control() else "No")

Submission status: Runtime Error

Solution code:
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
ans  = 'No'
for i in range(3):
  for j in range(3):
    for k in b:
      if a[i][j] == k:
        a[i][j] = 0
for i in range(3):
  if a[i][0] + a[i][1] + a[i][2] == 0:
    ans = 'Yes'
  if a[0][i] + a[1][i] + a[2][i] == 0:
    ans = 'Yes'
if A[0][0]+A[1][1]+A[2][2]==0:
  ans = "Yes"
if A[0][2]+A[1][1]+A[2][0]==0:
  ans = "Yes"
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(input()) for i in range(N)]
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if (A[i][j] == b(k)):
                    A[i][j] = 0
    
    ans = "No"
    for i in range(3):
        if A[i][0]+A[i][1]+A[i][2]==0:
            ans = "Yes"
        if A[0][i]+A[1][i]+A[2][i]==0:
            ans = "Yes"
    if A[0][0]+A[1][1]+A[2][2]==0:
        ans = "Yes"
    if A[0][2]+A[1][1]+A[2][0]==0:
        ans = "Yes"
    print(ans)
main()

Submission status: Runtime Error

Solution code:
def main():
    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(i) for i in range(N)]
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if (A[i,j] == b(k)):
                    A[i,j] = 0
    
    ans = "No"
    for i in range(3):
        if A[i,0]+A[i,1]+A[i,2]==0: ans = "Yes"
        if A[0,i]+A[1,i]+A[2,i]==0: ans = "Yes"
    if A[0,0]+A[1,1]+A[2,2]==0: ans = "Yes"
    if A[0,2]+A[1,1]+A[2,0]==0: ans = "Yes"
    print(ans)
main()

Submission status: Runtime Error

Solution code:
def main():
    A = [list(map(int, input().split())) for i in range(3)]
    N = int(input())
    b = [int(i) for i in range(N)]
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if (A[i,j] == b(k)):
                    A[i,j] = 0
    
    ans = "No"
    for i in range(3):
        if A[i,0]==A[i,1]==A[i,2]==0: ans = "Yes"
        if A[0,i]==A[1,i]==A[2,i]==0: ans = "Yes"
    if A[0,0]==A[1,1]==A[2,2]==0: ans = "Yes"
    if A[0,2]==A[1,1]==A[2,0]==0: ans = "Yes"
    print(ans)
main()

Submission status: Runtime Error

Solution code:
import numpy as np
A_mat = np.array([list(map(int, input().split())) for _ in range(3)])
N = int(input())
b_list = [int(input()) for _ in range(N)]
tf_mat = np.zeros_like(A_mat)
for i in range(3):
    for j in range(3):
        a = A_mat[i, j]
        if a in b_list:
            tf_mat[i][j] = 1
ANS = 'No'
if np.all(tf_mat[0][:]) or np.all(tf_mat[1][:]) or np.all(tf_mat[2][:]): print('Yes')
if np.all(tf_mat[:][0]) or np.all(tf_mat[:][1]) or np.all(tf_mat[:][2]): print('Yes')
if np.all(tf_mat[0][0], tf_mat[1][1], tf_mat[2][2]): print('Yes')
if np.all(tf_mat[0][2], tf_mat[1][1], tf_mat[2][0]): print('Yes')

Submission status: Runtime Error

Solution code:
ソースコード 

Copy
Copy
A=[]
flag=0
for i in range(3):
  A.append(list(map(int,input().split())))
n=int(input())
for i in range(n):
  s=int(input())
  for k in range(3):
    if s in A[k]:
      A[k][A[k].index(s)]=0

if A[0]==[0,0,0] or A[1]==[0,0,0] or A[2]==[0,0,0]:
  print("Yes")
  flag=1
elif A[1][1]==0 and A[2][2]==0 and A[0][0]==0:
  print("Yes")
  flag=1
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  flag=1
else:
  for i in range(3):
    if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
      print("Yes")
      flag=1
      break
if flag == 0:
  print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
ls = []
count = [0]*9
for i in range(3):
    ls.extend(input().split(' '))
for i in range(int(input())):
    s = input()
    if s in ls:
        i = ls.index(s)
        count[i]="1"
flag = 0
for i in range(3):
    if count[i] == count[i+3] == count[i+6]=="1":
        flag = 1
        break
if flag == 0:
	for i in range(0,8,3):
    	if count[i] == count[i+1] == count[i+2] == "1":
       		flag = 1
        	break
if count[0]==count[4]==count[8]=="1":
    flag = 1
if count[2] == count[4] == count[6] == "1":
    flag = 1
if flag == 1:
    print("Yes")
elif flag == 0:
    print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
def f(s,box):
    for j in range(3):
        t=0
        for i in range(N):
            if s[i] in box[j]:
                t+=1
        if t==3:
            print('Yes')
            sys.exit()
box=[]
for i in range(3):
    box = box+[input().split()]
N=int(input())
s = [input() for i in range(N)]
box = np.array(box).T
f(s,box)
box = np.array(box).T
if box[0][0] in s:
    if box[1][1] in s:
        if box[2][2] in s:
            print('Yes')
            sys.exit()
if box[0][2] in s:
    if box[1][1] in s:
        if box[2][0] in s:
            print('Yes')
            sys.exit()
print('No')

Submission status: Runtime Error

Solution code:
import sys

bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

nums = [ r[i]for i in range(3) for r in bingo ]

n = int(input())
appear = [ int(input()) for _ in range(n) ]

for x in range(3):
  for y in range(3):
    if bingo[x][y] in appear:
      t_or_f[x][y] = True

is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
  print('Yes')
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
  print('Yes')
else:
  for i in range(3):
    if t_or_f[i][i] and t_or_f[i+1][i+1] and t_or_f[i+2][i+2]:
      is_bingo = True
      print('Yes')
      sys.exit()

if not is_bingo: print('No')

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
        
for i in range(3):
  if(a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0):
    ans = 'yes'
  if(a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0):
    ans = 'yes'
    
if(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0):
  ans = 'yes'
if(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
  ans = 'yes'

print(ans)