Problem: 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.

Submission attempts (in order):
import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(1,'YES')
        sys.exit()

CheckHorizontalBingo(1,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(1,'YES')
        sys.exit()

CheckHorizontalBingo(0,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        sys.exit()

CheckHorizontalBingo(1,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(1,'YES')
        sys.exit()

CheckHorizontalBingo(0,1,2)
CheckHorizontalBingo(3,4,5)
CheckHorizontalBingo(6,7,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        print(Index,InputValue)
                        print('値が重複しています。')
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    print(Index,InputValue)
                    print('値が重複しています。')
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

print(Bingo)

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(1,'YES')
        sys.exit()

CheckHorizontalBingo(1,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(2,'YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print(2,'YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckHorizontalBingo(0,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('YES')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        print('No')
                        sys.exit()

                A.append (InputValue)
        else:
            print('No')
            sys.exit()

N = int(input())
if N<=0 and N>10:
    print('No')
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    print('No')
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckHorizontalBingo(0,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(2,4,6)

print('No')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted