Problem:


Score: 300 points

Problem Statement

We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.

According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.

Determine if he is correct.  

Constraints

c_{i, j} \ (1 \leq i \leq 3, 1 \leq j \leq 3) is an integer between 0 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

c_{1,1} c_{1,2} c_{1,3}
c_{2,1} c_{2,2} c_{2,3}
c_{3,1} c_{3,2} c_{3,3}

Output

If Takahashi's statement is correct, print Yes; otherwise, print No.

Sample Input 1

1 0 1
2 1 2
1 0 1

Sample Output 1

Yes

Takahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.

Sample Input 2

2 2 2
2 1 2
2 2 2

Sample Output 2

No

Takahashi is incorrect in this case.

Sample Input 3

0 8 8
0 8 8
0 8 8

Sample Output 3

Yes

Sample Input 4

1 8 6
2 9 7
0 7 7

Sample Output 4

No



Sample input:
1 0 1
2 1 2
1 0 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
def dfs(depth, array, sums, b):
    if depth == 3:
        sumb=0 
        for i in b:
            sumb+=i

        a=[int((sums[0]-sumb)/3), int((sums[1]-sumb)/3), int((sums[2]-sumb)/3)]
        for i in range(3):
            for j in range(3):
                if a[i]+b[j] != array[i][j]:
                    return False
        return True
    else:
        for i in range(100):
            b[depth]=i
            if dfs(depth+1, array, sums, b):
                return True
        return False

array=[]
b=[0 for i in range(3)]
sums=[0 for i in range(3)]
for i in range(3):
    array.append([int(i) for i in input().split()])

for i in range(3):
    sums[i]+=array[i][0]+array[i][1]+array[i][2]

if(dfs(0, array, sums, b)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def dfs(depth, array, sums, b):
    if depth == 3:
        sumb=0 
        for i in b:
            sumb+=i

        a=[int((sums[0]-sumb)/3), int((sums[1]-sumb)/3), int((sums[2]-sumb)/3)]
        for i in range(3):
            for j in range(3):
                if a[i]+b[j] != array[i][j]:
                    return False
        return True
    else:
        for i in range(0, 2):
            b[depth]=i
            if dfs(depth+1, array, sums, b):
                return True
        return False

array=[]
b=[0 for i in range(3)]
sums=[0 for i in range(3)]
for i in range(3):
    array.append([int(i) for i in input().split()])

for i in range(3):
    sums[i]+=array[i][0]+array[i][1]+array[i][2]

if(dfs(0, array, sums, b)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
result = 0

b1 = c11
b2 = c12
b3 = c13
a1 = 0
a2 = c21 - b1
a3 = c31 - b1

if(c11 == a1 + b1):
    if(c12 == a1 + b2):
        if(c13 == a1 + b3):
            if(c21 == a2 + b1):
                if(c22 == a2 + b2):
                    if(c23 == a2 + b3):
                        if(c31 == a3 + b1):
                            if(c32 == a3 + b2):
                                if(c33 == a3 + b3):
                                    result = 1
if(result == 1):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import numpy as np

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
result = 0

b0 = c11
b1 = c12
b2 = c13
a0 = 0
a1 = c21 - b0
a2 = c31 - b0

if(c11 == a0 + b0):
    if(c12 == a0 + b1):
        if(c13 == a0 + b2):
            if(c21 == a1 + b0):
                if(c22 == a1 + b1):
                    if(c23 == a1 + b2):
                        if(c31 == a2 + b0):
                            if(c32 == a2 + b1):
                                if(c33 == a2 + b2):
                                    result = 1
if(result):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import numpy as np

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
c = np.zeros((0,3))
for i in range(3):
    alist = input().split()
    aint = list(map(int, alist))
    c1 = np.array(aint).reshape(1,3)
    c = np.concatenate([c,c1],axis=0)

result = 0

b0 = c[0][0]
b1 = c[0][1]
b2 = c[0][2]
a0 = 0
a1 = c[1][0] - b0
a2 = c[2][0] - b0

if(c[0][0] == a0 + b0):
    if(c[0][1] == a0 + b1):
        if(c[0][2] == a0 + b2):
            if(c[1][0] == a1 + b0):
                if(c[1][1] == a1 + b1):
                    if(c[1][2] == a1 + b2):
                        if(c[2][0] == a2 + b0):
                            if(c[2][1] == a2 + b1):
                                if(c[2][2] == a2 + b2):
                                    result = 1
if(result):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import numpy as np

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
c = np.zeros((0,3))
for i in range(3):
    alist = input().split()
    aint = list(map(int, alist))
    c1 = np.array(aint).reshape(1,3)
    c = np.concatenate([c,c1],axis=0)

result = 0

b0 = c[0][0]
b1 = c[0][1]
b2 = c[0][2]
a0 = 0
a1 = b0 - c[1][0]
a2 = b0 - c[2][0]

if(c[0][0] == a0 + b0):
    if(c[0][1] == a0 + b1):
        if(c[0][2] == a0 + b2):
            if(c[1][0] == a1 + b0):
                if(c[1][1] == a1 + b1):
                    if(c[1][2] == a1 + b2):
                        if(c[2][0] == a2 + b0):
                            if(c[2][1] == a2 + b1):
                                if(c[2][2] == a2 + b2):
                                    result = 1
if(result):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import numpy as np

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
c = np.zeros((0,3))
for i in range(3):
    alist = input().split()
    aint = list(map(int, alist))
    c1 = np.array(aint).reshape(1,3)
    c = np.concatenate([c,c1],axis=0)

result = 0

if(c[1][0]-c[0][0] == c[1][1]-c[0][1] and c[1][1]-c[0][1] == c[1][2]-c[0][2]):
    if(c[2][0]-c[1][0] == c[2][1]-c[1][1] and c[2][1]-c[1][1] == c[2][2]-c[1][2]):
        if(c[2][0]-c[0][0] == c[2][1]-c[0][1] and c[2][1]-c[0][1] == c[2][2]-c[0][2]):
            if(c[0][1]-c[0][0] == c[1][1]-c[1][0] and c[1][1]-c[1][0] == c[2][1]-c[2][0]):
                if(c[0][2]-c[0][1] == c[1][2]-c[1][1] and c[1][2]-c[1][1] == c[2][2]-c[2][1]):
                    if(c[0][2]-c[0][0] == c[1][2]-c[1][0] and c[1][2]-c[1][0] == c[2][2]-c[2][0]):
                        result = 1;
if(result):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import numpy as np

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
c = np.zeros((0,3))
for i in range(3):
    alist = input().split()
    aint = list(map(int, alist))
    c1 = np.array(aint).reshape(1,3)
    print(c1)
    c = np.concatenate([c,c1],axis=0)

result = 0

if(c[1][0]-c[0][0] == c[1][1]-c[0][1] and c[1][1]-c[0][1] == c[1][2]-c[0][2]):
    if(c[2][0]-c[1][0] == c[2][1]-c[1][1] and c[2][1]-c[1][1] == c[2][2]-c[1][2]):
        if(c[2][0]-c[0][0] == c[2][1]-c[0][1] and c[2][1]-c[0][1] == c[2][2]-c[0][2]):
            if(c[0][1]-c[0][0] == c[1][1]-c[1][0] and c[1][1]-c[1][0] == c[2][1]-c[2][0]):
                if(c[0][2]-c[0][1] == c[1][2]-c[1][1] and c[1][2]-c[1][1] == c[2][2]-c[2][1]):
                    if(c[0][2]-c[0][0] == c[1][2]-c[1][0] and c[1][2]-c[1][0] == c[2][2]-c[2][0]):
                        result = 1;
if(result):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
C = [list(map(lambda x:int(x),input().split())) for i in range(3)]
#print(C)
a,b,c = C[0],C[1],C[2]
if (a[0]-a[1])==(b[0]-b[1]) and (a[2]-a[1])==(b[2]-b[1]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
total = 0
for (x,y,z) in zip(c1,c2,c3):
    total = total + x + y + z
print('Yes' if total%3==0 else 'No')

Submission status: Wrong Answer

Solution code:
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))

if A1[2]+A3[0]-A1[0]==A3[2]:
    if A1[1]+A2[0]-A1[0]==A2[1]:
        print ('Yes')
    else:
        print ('No')
else:    
    print ('No')

Submission status: Wrong Answer

Solution code:
for i in range(3):
    input_str = input()
    nums = list(map(int, input_str.split()))
    if (nums[0] + nums[1] is nums[2]):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
c = [list(map(int, input().split())) for _ in range(3)]
b = [i - c[0][0] for i in c[0]]
a = [i[0] - c[0][0] for i in c]
if all(abs(c[i][j]-a[i]-b[j]) == c[0][0] 
        for i in range(3) for j in range(3)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def ans():
    C = []
    C.append([])
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))

    A = [0] * 4
    B = [0] * 4
    A[1] = 0

    for i in range(1,4):
        B[i] = C[1][i] - A[1]

    for i in range(2, 4):
        A[i] = C[i][1] - B[1]

    for i in range(1,4):
        for j in range(1, 4):
            if C[i][j] == (A[i] + B[j]):
                pass
            else:
                return print('No')
    return print('Yes')

Submission status: Wrong Answer

Solution code:
C_0 = [int(num) for num in raw_input().split()]
C_1 = [int(num) for num in raw_input().split()]
C_2 = [int(num) for num in raw_input().split()]
C_s = [C_0, C_1, C_2]
flag = 1
if ((C_1[0] - C_0[0]) == (C_1[1] - C_0[1]) == (C_1[2] - C_0[2])):
   flag = 1
else:
   flag = 0
if ((C_2[0] - C_0[0]) == (C_2[1] - C_0[1]) == (C_2[2] - C_0[2])):
   flag = 1
else:
   flag = 0
if ((C_2[0] - C_1[0]) == (C_2[1] - C_1[1]) == (C_2[2] - C_1[2])):
   flag = 1
else:
   flag = 0

if ((C_s[0][0] - C_s[0][1]) == (C_s[1][0] - C_s[1][1]) == (C_s[2][0] - C_s[2][1])):
   flag = 1
else:
   flag = 0
if ((C_s[0][0] - C_s[0][2]) == (C_s[1][0] - C_s[1][2]) == (C_s[2][0] - C_s[2][2])):
   flag = 1
else:
   flag = 0

if ((C_s[0][1] - C_s[0][2]) == (C_s[1][1] - C_s[1][2]) == (C_s[2][1] - C_s[2][2])):
   flag = 1
else:
   flag = 0

if flag == 1:
   print "Yes"
else:
   print "No"

Submission status: Wrong Answer

Solution code:
C_0 = [int(num) for num in raw_input().split()]
C_1 = [int(num) for num in raw_input().split()]
C_2 = [int(num) for num in raw_input().split()]
C_s = [C_0, C_1, C_2]
flag = 1
if ((C_1[0] - C_0[0]) == (C_1[1] - C_0[1]) == (C_1[2] - C_0[2])):
   flag = 1
else:
   flag = 0
if ((C_2[0] - C_0[0]) == (C_2[1] - C_0[1]) == (C_2[2] - C_0[2])):
   flag = 1
else:
   flag = 0
if ((C_2[0] - C_1[0]) == (C_2[1] - C_1[1]) == (C_2[2] - C_1[2])):
   flag = 1
else:
   flag = 0

if ((C_s[0][0] - C_s[0][1]) == (C_s[1][0] - C_s[1][1]) == (C_s[2][0] - C_s[2][1])):
   flag = 1
else:
   flag = 0

Submission status: Wrong Answer

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

ans = True
a=[c[0][0],c[1][0],c[2][0]]
b=[c[0][0]-a[0],c[0][1]-a[0],c[0][2]-a[0]]
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i]+b[j]:
            ans = False
print(ans)

Submission status: Wrong Answer

Solution code:
from copy import copy

def sumls(ls, num):
    for i in range(len(ls)):
        ls[i] = ls[i] + num
    return

def validate(ls, a_pattern, b_pattern):
    for a_ls in a_pattern:
        for b_ls in b_pattern:
            b_cp = copy(b_ls)
            sumls(b_cp, a_ls[0])
            if(b_cp == ls[0]):
                b_cp = copy(b_ls)
                sumls(b_cp, a_ls[1])
                if(b_cp == ls[1]):
                    b_cp = copy(b_ls)
                    sumls(b_cp, a_ls[2])
                    if(b_cp == ls[2]):
                        print("Yes")
                        exit()
    print("No")
    exit()

ls = []

for _ in range(3):
    tmp = list(map(int, input().split()))
    ls.append(tmp)

l1 = sum(ls[0])
l2 = sum(ls[1])
l3 = sum(ls[2])

sub1 = (l2 - l1)/3 #3(a2 - ai)
sub2 = (l3 - l1)/3 #3(a3 - a1)
sub3 = (l2 - l3)/3 #3(a2 - a3)

max_val = max(l1,l2,l3)

a_pattern = []
for a1 in range(max_val):
    for a2 in range(max_val):
        for a3 in range(max_val):
            if( ((a2 - a1) == sub1) & ((a3 - a1) == sub2) & ((a2 - a3) == sub3)):
                tmp = []
                tmp.append(a1)
                tmp.append(a2)
                tmp.append(a3)
                a_pattern.append(tmp)


l1 = ls[0][0] + ls[1][0] + ls[2][0]
l2 = ls[0][1] + ls[1][1] + ls[2][1]
l3 = ls[0][2] + ls[1][2] + ls[2][2]

sub1 = (l2 - l1)/3 #3(a2 - ai)
sub2 = (l3 - l1)/3 #3(a3 - a1)
sub3 = (l2 - l3)/3 #3(a2 - a3)

max_val = max(l1,l2,l3)
b_pattern = []
for b1 in range(max_val):
    for b2 in range(max_val):
        for b3 in range(max_val):
            if( ((b2 - b1) == sub1) & ((b3 - b1) == sub2) & ((b2 - b3) == sub3)):
                tmp = []
                tmp.append(b1)
                tmp.append(b2)
                tmp.append(b3)
                b_pattern.append(tmp)

validate(ls, a_pattern, b_pattern)

Submission status: Wrong Answer

Solution code:
def solve():
    if not (c11 - c21 == c12 - c22 == c13 - c23):
        return False
    if not (c11 - c31 == c12 - c32 == c13 - c33):
        return False
    if not (c11 - c12 == c21 - c22 == c31 - c32):
        return False
    if not (c11 - c13 == c21 - c23 == c31 - c33):
        return False
    return True
  
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
 
if(solve()):
  print("Yes")
else:
  print("N0")

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(100, 101):
        for j in range(100, 101):
            for k in range(100, 101):
                col1 = C1[0] - i
                if col1 < 0:
                    break
                if col1 > 100:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if col2 < 0:
                    break
                if col2 > 100:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if col3 < 0:
                    break
                if col3 > 100:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(101):
        for j in range(101):
            for k in range(101):
                col1 = C1[0] - i
                if col1 < 0 or col1 > 100:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if col2 < 0 or col2 > 100:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if col3 < 0 or col3 > 100:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
l = []

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

flag = True

for i in range(2):
    for j in range(2):
        a = sum(l[i][j:j+2])
        a += sum(l[i+1][j:j+2])
        if a % 4 != 0:
            flag = False

if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
a = []
for i in range(3):
    a.append(map(int, raw_input().split()))
A = 1
B = 1
while B < 3:
    while A < 3:
        if not a[B][A]-a[B-1][A] == a[B][0]-a[B-1][0]:
            print "No"
            sys.exit()
        if not a[B][A]-a[B][A-1] == a[0][A]-a[0][A-1]:
            print "No"
            sys.exit()
        A += 1
    B += 1
print "Yes"

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(101):
        for j in range(101):
            for k in range(101):
                col1 = C1[0] - i
                if col1 < 0 and col1 > 100:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if col2 < 0 and col2 > 100:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if col3 < 0 and col3 > 100:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
C = [[int(i) for i in input().split()] for j in range(3)]


c0 = C[0][0]-C[1][0]
c1 = C[0][1]-C[1][1]
c2 = C[0][2]-C[1][2]

if c0 == c1 and c1 == c2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
grid = [list(map(int,input().split(' ')))]
grid.append(list(map(int,input().split(' '))))
grid.append(list(map(int,input().split(' '))))

flg =False
for i in range(100):
    b0,b1,b2  = grid[0][0]-i,grid[0][1]-i,grid[0][2]-i
    a1,a2 = grid[1][0]-b0,grid[2][0]-b0
    if grid[1][1] == a1+b1 and grid[1][2] == a1+b2 and grid[2][1] == a2+b1 and grid[2][2] == a2+b2:
        if grid[0][0] == i+b0 and grid[0][1] == i+b1 and grid[0][2] == i+b2 and grid[1][0] == a1+b0 and grid[2][0] == a2+b0:
            flg =True
            break
    if min([b0,b1,b2]) < 0:
        break
    
if flg:
    print('Yes')

Submission status: Wrong Answer

Solution code:
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
tmp = [[] for i in range(4)]
for i in range(3):
    for j in range(2):
        tmp[j].append(c[j+1][i] - c[0][i])
        tmp[j+2].append(c[i][j+1] - c[i][0])
if all(len(set(i)) for i in tmp):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
tmp = [[] for i in range(4)]
for i in range(3):
    for j in range(2):
        tmp[j].append(c[j+1][i] - c[0][i])
        tmp[j+2].append(c[i][j] - c[i][0])
if all(len(set(i)) for i in tmp):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
grid = [list(map(int,input().split(' ')))]
grid.append(list(map(int,input().split(' '))))
grid.append(list(map(int,input().split(' '))))

flg =False
for i in range(100):
    b0,b1,b2  = grid[0][0]-i,grid[0][1]-i,grid[0][2]-i
    a1,a2 = grid[1][0]-b0,grid[2][0]-b0
    if grid[1][1] == a1+b1 and grid[1][2] == a1+b2 and grid[2][1] == a2+b1 and grid[2][2] == a2+b2:
        flg =True
        break
    if min([b0,b1,b2]) < 0:
        break
    
if flg:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(101):
        for j in range(101):
            for k in range(101):
                col1 = C1[0] - i
                if col1 < 0:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if col2 < 0:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if col3 < 0:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
grid = [list(map(int,input().split(' ')))]
grid.append(list(map(int,input().split(' '))))
grid.append(list(map(int,input().split(' '))))

flg =False
for i in range(10):
    b0,b1,b2  = grid[0][0]-i,grid[0][1]-i,grid[0][2]-i
    a1,a2 = grid[1][0]-b0,grid[2][0]-b0
    if grid[1][1] == a1+b1 and grid[1][2] == a1+b2 and grid[2][1] == a2+b1 and grid[2][2] == a2+b2:
        flg =True
        break
    if min([b0,b1,b2]) < 0:
        break
    
if flg:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(100):
        for j in range(100):
            for k in range(100):
                col1 = C1[0] - i
                if col1 < 0:
                    break
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if col2 < 0:
                    break
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if col3 < 0:
                    break
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

Solution code:
c1 = list(map(int,input().split(" ")))
c2 = list(map(int,input().split(" ")))
c3 = list(map(int,input().split(" ")))
a1 = []
a2 = []
a3 = []
b1 = []
b2 = []
b3 = []
judge1 = False
judge2 = False
judge3 = False
judge4 = False
for i in range(c1[0]+1):
    a1.append(i)
b1 = sorted(a1,reverse = True)
for i in b1:
    a2.append(c2[0]-i)
for i in b1:
    a3.append(c3[0]-i)

for i in a1:
    b2.append(c1[1]-i)
for i in a1:
    b3.append(c1[2]-i)

for i in range(len(a1)):
    if c2[1] == a2[i]+b2[i]:
        judge1 = True
    if c3[2] == a3[i]+b3[i]:
        judge2 = True
if judge1 and judge2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    C1 = list(map(int, (input().split(' '))))
    C2 = list(map(int, (input().split(' '))))
    C3 = list(map(int, (input().split(' '))))

    for i in range(100):
        for j in range(100):
            for k in range(100):
                col1 = C1[0] - i
                if (C2[0] - j) != col1:
                    break
                if (C3[0] - k) != col1:
                    break
                col2 = C1[1] - i
                if (C2[1] - j) != col2:
                    break
                if (C3[1] - k) != col2:
                    break
                col3 = C1[2] - i
                if (C2[2] - j) != col3:
                    break
                if (C3[2] - k) != col3:
                    break
                print('Yes')
                sys.exit()
    print('No')

Submission status: Wrong Answer

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

if (c[1][0] - c[0][0] + c[0][1] == c[1][1]) and (
                c[1][0] - c[2][0] + c[0][2] == c[1][2]) and (
                c[2][0] - c[0][0] + c[0][1] == c[2][1]) and (
                c[2][0] - c[0][0] + c[0][2] == c[2][2]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A=input().split(" ")
A = list(map(int, A))
B=input().split(" ")
B = list(map(int, B))
C=input().split(" ")
C = list(map(int, C))


if (A[0]-B[0] == A[1]-B[1] and A[1]-B[1] == A[2]-B[2]):
	if(A[0]-C[0] == A[1]-C[1] and A[1]-C[1] == A[2]-C[2]):
		if(C[0]-B[0] == C[1]-B[1] and C[1]-B[1] == C[2]-B[2]):
			print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))

c = []
c.append(c_1)
c.append(c_2)
c.append(c_3)

c = [item for c in c for item in c]

count = Counter(c)
c_c = []
for x in count.values():
    c_c.append(x)
    
if 1 in c_c:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    C = 0
    for i in range(3):
        input_raw = read_func().strip().split()
        C += int(input_raw[0]) + int(input_raw[1]) + int(input_raw[2])
    if C % 3 == 0:
        print "Yes"
    else:
        print "No"



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())
wrong = "Yes"
b = 1
while b < 3:
    if not B[b] == A[b] + B[0]:
        wrong = "No"
    b += 1
b = 1
while b < 3:
    if not C[b] == A[b] + C[0]:
        wrong = "No"
    b += 1
print wrong

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    c = tuple(tuple(map(int, line.split())) for line in sys.stdin.readlines())
    for i in range(101):
        b = [c[0][0] - i]
        for j in range(101):
            b.append(c[1][1] - j)
            for k in range(101):
                b.append(c[2][2] - k)
                a = (i, j, k)
                flg = False
                for l in range(3):
                    for m in range(3):
                        if a[l] + b[m] != c[l][m]:
                            flg = True
                            break
                    if flg == True:
                        break
                else:
                    print('Yes')
                    sys.exit()
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
f = lambda :[int(i) for i in input().split()]
a = 0
C = 0
for i in range(3):
    po = f()
    if po[0] == po[1] == po[2]:
        a += 1
    C += sum(po)
if C % 3 == 0 or a == 3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    c = tuple(tuple(map(int, line.split())) for line in sys.stdin.readlines())
    for i in range(101):
        b = [c[0][0] - i]
        if b[0] < 0:
            continue
        for j in range(101 - i):
            b.append(c[1][1] - j)
            if b[1] < 0:
                continue
            for k in range(101 - i - j):
                b.append(c[2][2] - k)
                if b[2] < 0:
                    continue
                a = (i, j, k)
                flg = False
                for l in range(3):
                    for m in range(3):
                        if a[l] + b[m] != c[l][m]:
                            flg = True
                            break
                    if flg == True:
                        break
                else:
                    print('Yes')
                    sys.exit()
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def solve():
    c = []
    c.append(list(map(int, input().split())))
    c.append(list(map(int, input().split())))
    c.append(list(map(int, input().split())))

    a1_list = range(c[0][0]+1)
    for a1 in a1_list:
        b1 = c[0][0] - a1
        b2 = c[0][1] - a1
        b3 = c[0][2] - a1

        a2 = c[1][0] - b1
        a3 = c[2][0] - b2

        if c[1][1] != a2 + b2:
            continue
        if c[1][2] != a2 + b3:
            continue
        if c[2][1] != a3 + b2:
            continue
        if c[2][2] != a3 + b3:
            continue
        print("Yes")
        return

    print("No")
    return

solve()

Submission status: Wrong Answer

Solution code:
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

ans=[]

for n in range(3):
    if p[n]<=q[n] and p[n]<=r[n]:
        ans.append(True)
    else:
        ans.append(False)

if ans[0] and ans[1] and ans[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
grid = [list(map(int,input().split())) for _ in range(3)]
a1 = min(grid[0])
a2 = min(grid[1])
a3 = min(grid[2])

nums = list(grid[0] + grid[1] + grid[2])
N = max(nums)
flag = False

for i in range(1, N+1):
    if a1 < 0 or a2 < 0 or a3 < 0:
        break
    b1 = grid[0][0] - a1
    c1 = grid[1][0] - a2
    d1 = grid[2][0] - a3
    
    b2 = grid[0][1] - a1
    c2 = grid[1][1] - a2
    d2 = grid[2][1] - a3
    
    b3 = grid[0][2] - a1
    c3 = grid[1][2] - a2
    d3 = grid[2][2] - a3
    
    if b1 == c1 == d1 and b2 == c2 == d2 and b3 == c3 == d3:
        flag = True
        break
    a1 -= 1
    a2 -= 1
    a3 -= 1
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
f = lambda :[int(i) for i in input().split()]

C = 0
for _ in range(3):
    C += sum(f())
if C % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c = []
c.append(list(map(int,input().split())))
c.append(list(map(int,input().split())))
c.append(list(map(int,input().split())))
sa = [[0,0,0],[0,0,0]]
for i in range(3):
    sa[0][i]=c[1][i]-c[0][i]
    sa[1][i]=c[2][i]-c[0][i]
if(all([x == sa[0][0] for x in sa[0]]) and all([x == sa[0][0] for x in sa[0]])):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

for i in range(3):
    a[i] = min(c[i][0], c[i][1], c[i][2])

for i in range(3):
    b[i] = min(c[0][i], c[1][i], c[2][i])

for i in range(3):
    for j in range(3):
        if a[j] + b[i] != c[j][i]:
            print('No')
            exit()
print('Yes')