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:
C=[list(map(int,input().split())) for _ in range(3)]
ans='Yes'
if C[0][0]-C[1][0]!=C[0][1]-C[1][1]!=C[0][2]-C[1][2]:
    ans='No'
elif C[1][0]-C[2][0]!=C[1][1]-C[2][1]!=C[1][2]-C[2][2]:
    ans='No'
elif C[0][0]-C[0][1]!=C[1][0]-C[1][1]!=C[2][0]-C[2][1]:
    ans='No'
elif C[0][1]-C[0][2]!=C[1][1]-C[1][2]!=C[2][1]-C[2][2]:
    ans='No'

print(ans)

Submission status: Wrong Answer

Solution code:
def myAnswer(C:list) -> int:
   a = [0 for _ in range(3)]
   b = [0 for _ in range(3)]
   for n,c in enumerate(C):
      a[n]=min(c)
   C = list(zip(*C))
   for n,c in enumerate(C):
      b[n] = min(c)
   C = list(zip(*C))
   for i in range(3):
      for j in range(3):
         if(C[i][j] != a[i]+b[j]):
            return "No"
   return "Yes"






def modelAnswer():
   return
def main():
   C = [list(map(int,input().split())) for _ in range(3)]
   print(myAnswer(C[:]))
   
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:

def myAnswer(C:list) -> int:
   a = [0 for _ in range(3)]
   b = [0 for _ in range(3)]
   for n,c in enumerate(C):
      a[n]=min(c)
   C = list(zip(*C))
   for n,c in enumerate(C):
      b[n] = min(c)
   print(b)
   C = list(zip(*C))
   for i in range(3):
      for j in range(3):
         if(C[i][j] != a[i]+b[j]):
            return "No"
   return "Yes"






def modelAnswer():
   return
def main():
   C = [list(map(int,input().split())) for _ in range(3)]
   print(myAnswer(C[:]))
   
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:

def myAnswer(C:list) -> int:
   a = [0 for _ in range(3)]
   b = [0 for _ in range(3)]
   for n,c in enumerate(C):
      a[n]=min(c)
   print(a)
   C = list(zip(*C))
   for n,c in enumerate(C):
      b[n] = min(c)
   print(b)
   C = list(zip(*C))
   for i in range(3):
      for j in range(3):
         if(C[i][j] != a[i]+b[j]):
            return "No"
   return "Yes"






def modelAnswer():
   return
def main():
   C = [list(map(int,input().split())) for _ in range(3)]
   print(myAnswer(C[:]))
   
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

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

total1 = 0
total2 = 0
 
for i in range(3):
    total1 += sum(l[i])
    total2 += l[i][i]
    print(total1, total2)
    
if total1 == total2 * 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

total1 = total2 = 0
 
for i in range(3):
    total1 += sum(l[i])
    total2 += l[i][i]
    print(total1, total2)
    
if total1 == total2 * 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
x = [list(map(int,input().split())) for i in range(3)]
m=0
for i in range(3):
    m+=sum(x[i])
if m%3 == 0 and (x[0][0]+x[1][1]+x[2][2])%3==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():
    grid = [[ int(c) for c in input().split()] for i in range(3)]

    a1 = 0
    a2 = 0
    a3 = 0
    b1 = 0
    b2 = 0
    b3 = 0

    find_a1 = False
    find_a2 = False
    find_a3 = False
    find_b1 = False
    find_b2 = False
    find_b3 = False

    for a in range(101):
        find_b1 = False
        find_b2 = False
        find_b3 = False

        for b in range(101):
            if a + b == grid[0][0]:
                b1 = b
                find_b1 = True
            
            if a + b == grid[0][1]:
                b2 = b
                find_b2 = True
            
            if a + b == grid[0][2]:
                b3 = b
                find_b3 = True

        if find_b1 and find_b2 and find_b3 :
            a1 = a
            find_a1 = True
            break
   
    for a in range(101):
        if (a == grid[1][0] - b1) and (a == grid[1][1] - b2) and (a == grid[1][2] - b3):
            a2 = a
            find_a2 = True
            break

    for a in range(101):
        if (a == grid[2][0] - b1) and (a == grid[2][1] - b2) and (a == grid[2][2] - b3):
            a3 = a
            find_a3 = True
            break

    if find_a1 and find_a2 and find_a3 and find_b1 and find_b2 and find_b3:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def myAnswer(C:list) -> int:
   a = [0 for _ in range(3)]
   b = [0 for _ in range(3)]
   for n,c in enumerate(C):
      a[n]=min(c)
   C = list(zip(*C))
   for n,c in enumerate(C):
      b[n] = min(c)
   C = list(zip(*C))
   for i in range(3):
      for j in range(3):
         if(C[i][j] != a[i]+b[j]):
            return "No"
   return "Yes"




def modelAnswer():
   return
def main():
   C = [list(map(int,input().split())) for _ in range(3)]
   print(myAnswer(C[:]))
   
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
data = [list(map(int,input().split())) for i in range(3)]
flg = 0
n = max(max(data))
for i in range(n):
    for j in range(n):
        for k in range(n):
            flg = 0
            if data[0][0]-i==data[1][0]-j==data[2][0]-k: 
                flg += 1
            if data[0][1]-i==data[1][1]-j==data[2][1]-k:
                flg += 1
            if data[0][2]-i==data[1][2]-j==data[2][2]-k:
                flg += 1
    else:
        continue
    break        
        
if flg==3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc088/tasks/abc088_c

matrix = []
MAX = 0
for _ in range(3):
    row = [int(i) for i in input().split()]
    matrix.append(row)
    MAX += row[0]

trio = set()
for i in range(MAX + 1):
    for j in range(MAX + 1):
        for k in range(MAX + 1):
            trio.add((i, j, k))


for a in trio:
    b = [matrix[0][0] - a[0], matrix[1][1] - a[1], matrix[2][2] - a[2]]
    c = 0
    for i in range(3):
        for j in range(3):
            if i == j:
                continue
            if matrix[i][j] == a[i] + b[j]:
                c += 1
            else:
                break
        if c != 3:
            break
    if c == 9:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
c=0
for i in range(3):
  c+=sum(list(map(int, input().split())))
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())))

c0 = c[0][0] + c[0][1] + c[0][2]
c1 = c[1][0] + c[1][1] + c[1][2]
c2 = c[2][0] + c[2][1] + c[2][2]

# a0 + b0 = c00
# a0 + b1 = c01
# a0 + b2 = c02
# 3*a2 + b0 + b1 + b2 = c20 + c21 + c22
# 3*a2 - 3*a0 = c20 + c21 + c22 - (c00 + c01 + c02)
print(str(c))
for a0 in range(101):
    b0 = c[0][0] - a0
    b1 = c[0][1] - a0
    b2 = c[0][2] - a0
    for a1 in range(101):
        a2 = (c2 - c0 + 3 * a0) / 3
        if (
            c[1][0] - a1 == b0
            and c[1][1] - a1 == b1
            and c[1][2] - a1 == b2
            and c[2][0] - a2 == b0
            and c[2][1] - a2 == b1
            and c[2][2] - a2 == b2
        ):
            print("Yes")
            exit(0)
print("No")

Submission status: Wrong Answer

Solution code:
C = []
for _ in range(3):
    C.append(list(map(int,input().split())))
flag = 1
for i in range(2):
    if C[i+1][0] - C[i][0] != C[i+1][1] - C[i][1] and C[i+1][1] - C[i][1] != C[i+1][2] - C[i][2]:
        flag = 0
    if C[0][i+1] - C[0][i] != C[1][i+1] - C[1][i] and C[1][i+1] - C[1][i] != C[2][i+1] - C[2][i]:
        flag = 0

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

Submission status: Wrong Answer

Solution code:
data = [list(map(int,input().split())) for i in range(3)]
flg = 0
n = max(max(data))
for i in range(n):
    for j in range(n):
        for k in range(n):
            if data[0][0]-i==data[1][0]-j==data[2][0]-k and data[0][1]-i==data[1][1]-j==data[2][1]-k \
            and data[0][2]-i==data[1][2]-j==data[2][2]-k:
                flg = 1
    else:
        continue
    break        
        
if flg==1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())

if a-d==b-e==c-f and a-g==b-h==c-i and a-b--d-e==g-h and a-c==d-f==g-i:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c = [list(map(int,input().split())) for  _ in range(3)]
OK = False
for a1 in range(100):
    for a2 in range(100):
        for a3 in range(100):
            a = [a1,a2,a3]
            ok = True
            for j in range(3):
                v = c[0][j]-a[0]
                for i in range(2):
                    if c[i+1][j] - a[i+1] != v:
                        ok = False
                        break
            if ok :
                OK = True
                break
              
                    
if OK:print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
ans = 0
for i in range(3):
  k = list(map(int,input().split()))
  ans += sum(k)
if ans%3 == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
ans = 0
for i in range(3):
  k = list(map(int,input().split()))
  ans += sum(k)
if ans >= 6 and ans%3 == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] - a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] - a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] - a3):
                        if k[0][0] - a1 >= 0 and k[0][1] - a2 >= 0 and k[0][2] - a3 >= 0:
                            if (k[1][0] - a1) >= 0 and (k[1][1] - a2) >= 0 and (k[1][2] - a3) >= 0:
                                if (k[2][0] - a1) >= 0 and (k[2][1] - a2) >= 0 and (k[2][2] - a3) >= 0:
                                    print(a1, a2, a3, k[0][0] - a1, k[1][0] - a1, k[2][0] - a1)
                                    print("Yes")
                                    exit()

print("No")

Submission status: Wrong Answer

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

for a1 in range(100):
    for a2 in range(100):
        for a3 in range(100):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] - a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] - a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] - a3):
                        if k[0][0] - a1 >= 0 and k[0][1] - a2 >= 0 and k[0][2] - a3 >= 0:
                            if (k[1][0] - a1) >= 0 and (k[1][1] - a2) >= 0 and (k[1][2] - a3) >= 0:
                                if (k[2][0] - a1) >= 0 and (k[2][1] - a2) >= 0 and (k[2][2] - a3) >= 0:
                                    print("Yes")
                                    exit()

print("No")

Submission status: Wrong Answer

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

for a1 in range(100):
    for a2 in range(100):
        for a3 in range(100):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] - a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] - a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] - a3):
                        if k[0][0] - a1 >= 0 and k[1][0] - a1 >= 0 and k[2][0] - a1 >= 0:
                            if (k[1][0] - a1) >= 0 and (k[1][1] - a2) >= 0 and (k[1][2] - a3) >= 0:
                                if (k[2][0] - a1) >= 0 and (k[2][1] - a2) >= 0 and (k[2][2] - a3) >= 0:
                                    print("Yes")
                                    exit()

print("No")

Submission status: Wrong Answer

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

for a1 in range(100):
    for a2 in range(100):
        for a3 in range(100):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] - a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] - a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] - a3):
                        if k[0][0] - a1 >= 0 and k[1][0] - a2 >= 0 and k[2][0] - a3 >= 0:
                            print("Yes")
                            exit()

print("No")

Submission status: Wrong Answer

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

for a1 in range(100):
    for a2 in range(100):
        for a3 in range(100):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] == a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] == a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] == a3):
                        print("Yes")
                        exit()

print("No")

Submission status: Wrong Answer

Solution code:
c=[[0 for i in range(3)] for j in range(3)]
a=[0]*3
b=[0]*3

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

for i in range(-500,500):
  a[0]=i
  b[0]=c[0][0]-a[0]
  b[1]=c[0][1]-a[0]
  b[2]=c[0][2]-a[0]
  a[1]=c[1][0]-b[0]
  a[2]=c[2][0]-b[0]
  
  if c[1][1]==a[1]+b[1] and c[1][2]==a[1]+b[2] and c[2][1]==a[2]+b[1] and (c[2][2]==a[2]+b[2]):
    print("Yes")
    print(a,b)
    break
    
  if c[1][1]!=a[1]+b[1] or c[1][2]!=a[1]+b[2] or c[2][1]!=a[2]+b[1] or (c[2][2]!=a[2]+b[2]):
    if i==499:
      print("No")

Submission status: Wrong Answer

Solution code:
C=[0]*3;A=[0]*3
d1=0;d2=0;e1=0;e2=0;z=0;p=0
for i in range(3):
  c1,c2,c3=map(int,input().split())
  C[i]=[c1,c2,c3]
  A[i]=[0,0,0]
 
d1=C[1][0]-C[0][0];d2=C[2][0]-C[0][0]
e1=C[0][1]-C[0][0];e2=C[0][2]-C[0][0]
z=C[0][0]
A[0][0]=z;A[0][1]=z+e1;A[0][2]=z+e2
A[1][0]=z+d1;A[1][1]=z+e1+d1;A[1][2]=z+d1+e2
A[2][0]=z+d2;A[2][1]=z+d2+e1;A[2][2]=z+d2+e2
 
print(C)
for i in range(3):
  for j in range(3):
    if C[i][j]==A[i][j]:
      p=p+1
print("Yes" if p==9 else "No")

Submission status: Wrong Answer

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

for i in range(3):
    a[i] = min(c[i])
    b[i] = min(c[0][i], c[1][i], c[2][i])
    
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            print("No")
            exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np

c = np.array([list(map(int, input().split())) for i in range(3)])

flag = True
for a1 in range(c.max()+1):
  b1, b2, b3 = c[0, :] - a1
  if (c[1, 0] - b1 != c[1, 1] - b2) or (c[1, 2] - b3 == c[1, 0] - b1):
    flag = False
    break
    
  if (c[2, 0] - b1 != c[2, 1] - b2) or (c[2, 2] - b3 == c[2, 0] - b1):
    flag = False
    break

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

Submission status: Wrong Answer

Solution code:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))

for a1 in range(101):
    b1 = [l1[0]-a1, l1[1]-a1, l1[2]-a1]
    for a2 in range(101-a1):
        b2 = [l2[0] - a2, l2[1] - a2, l2[2] - a2]
        for a3 in range(101-a1-a2):
            b3 = [l3[0] - a3, l3[1] - a3, l3[2] - a3]
            if b1 == b2 == b3:
                print("Yes")
                exit()
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import sys

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

total_c = 0
for i in range(3):
    for j in range(3):
        total_c += array[i][j]

for a_0 in range(101):
    b_0 = array[0][0] - a_0
    b_1 = array[0][1] - a_0
    b_2 = array[0][2] - a_0
    if b_0 >= 0 and b_1 >= 0 and b_2 >= 0:
        if array[1][0] - b_0 == array[1][1] - b_1 and array[1][0] - b_0 == array[1][2] - b_2:
            a_1 = array[1][0]
            if array[2][0] - b_0 == array[2][1] - b_1 and array[2][0] - b_0 == array[2][2] - b_2:
                a_2 = array[2][0]
                if a_1 >= 0 and a_2 >= 0:
                    print("yes")
                    sys.exit()
print("No")

Submission status: Wrong Answer

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

s = [sum(c[i]) for i in range(3)]
S = sum(s)

if S % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
ii=3
s=[]
icase=0
if icase==0:
    for ii in range(ii):
        s.append(list(map(int,input().split())))  # 二次元配列入力　二次元マップみたいな入力のとき
elif icase==1:
    s.append([1,0,1])
    s.append([2,1,2])
    s.append([1,0,1])

yn=1
for i in range(ii-1):
    if (s[i][1]-s[i][0])!=(s[i+1][1]-s[i+1][0]):
        yn=0
for i in range(ii-1):
    if (s[i][2]-s[i][0])!=(s[i+1][2]-s[i+1][0]):
        yn=0
for j in range(ii-1):
    if (s[1][j]-s[0][j])!=(s[1][j+1]-s[0][j+1]):
        yn=0
for j in range(ii-1):
    if (s[2][j]-s[0][j])!=(s[2][j+1]-s[0][j+1]):
        yn=0

if yn==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
ii=3
s=[]
icase=1
if icase==0:
    for ii in range(ii):
        s.append(list(map(int,input().split())))  # 二次元配列入力　二次元マップみたいな入力のとき
elif icase==1:
    s.append([1,0,1])
    s.append([2,1,2])
    s.append([1,0,1])

yn=1
for i in range(ii-1):
    if (s[i][1]-s[i][0])!=(s[i+1][1]-s[i+1][0]):
        yn=0
for i in range(ii-1):
    if (s[i][2]-s[i][0])!=(s[i+1][2]-s[i+1][0]):
        yn=0
for j in range(ii-1):
    if (s[1][j]-s[0][j])!=(s[1][j+1]-s[0][j+1]):
        yn=0
for j in range(ii-1):
    if (s[2][j]-s[0][j])!=(s[2][j+1]-s[0][j+1]):
        yn=0

if yn==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def solve():
    c = [list(map(int, input().split())) for _ in range(3)]
    for y1, x1 in ((0, 0), (0, 1), (0, 2)):
        sm = -1
        for y2, x2 in ((1, 0), (1, 1), (1, 2)):
            if x1 == x2:
                continue
            for y3, x3 in ((2, 0), (2, 1), (2, 2)):
                if x1 == x3 or x2 == x3:
                    continue
                if sm == -1:
                    sm = c[y1][x1] + c[y2][x2] + c[y3][x3]
                else:
                    if sm != c[y1][x1] + c[y2][x2] + c[y3][x3]:
                        print('No')
                        exit()
    print('Yes')


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

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

if (a2 + b2 == c[1][1] and
    a2 + b3 == c[1][2] and
    a3 + b2 == c[2][1] and
    a3 + b3 == c[2][2]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
number=[]
a=input().split()
b=input().split()
c=input().split()
lista=[int(d) for d in a]
listb=[int(e) for e in b]
listc=[int(f) for f in c]
if (sum(lista)+sum(listb)+sum(listc))%3==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#088_C
c = [sum(list(map(int, input().split()))) for _ in range(3)]
print('Yes' if sum(c)%3==0 else 'No')

Submission status: Wrong Answer

Solution code:
c = []
for _ in range(3):
    c.append(list(input().split()))
A, B, C, D, E, F, G, H, I = c[0][0], c[0][1], c[0][2], c[1][0], c[1][1], c[1][2], c[2][0], c[2][1], c[2][2]

if max(A+E+I, A+F+H, B+D+I, B+F+G, C+D+H, C+E+G) == min(A+E+I, A+F+H, B+D+I, B+F+G, C+D+H, C+E+G):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c = [list(map(int, input().split())) for _ in range(3)]
# 回答例を見ると 「各列に対して 行ごとの変化量が等しい」ことが分かる.
# 実際,a_i + b_j = c_ij が成り立つならば
# a_1 = c_11 - b_1 = c_12 - b_2 = c_13 - b_3 が成り立つ.
if c[0][1] - c[0][0] == 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] == c[2][2] - c[2][1]:
        print('Yes')
print('No')

Submission status: Wrong Answer

Solution code:
c=[]

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

a=[0]*3
b=[0]*3
for i in range(3):
    a[i]=sum(c[i][0:3])
    b[i]=sum(c[0:3][i])

if (a[0]-a[1])%3!=0 or (a[1]-a[2])%3!=0 or (a[2]-a[0])%3!=0:
    ans="No"
elif (b[0]-b[1])%3!=0 or (b[1]-b[2])%3!=0 or (b[2]-b[0])%3!=0:
    ans="No"
else:
    ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:

S=0
for i in range(3):
    a=list(map(int,input().split()))
    S+=sum(a)

if S%3==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

c = [list(map(int, input().split())) for ii in range(3)]

for a1 in range(100):
    # a1 が決まると b1, b2, b3は決まる
    b1, b2, b3 = c[0][0]-a1, c[0][1]-a1, c[0][2]-a1
    if b1 < 0 or b2 < 0 or b3 < 0:
        # この a1 で１列目は満たせない
        continue
    # b1 が決まれば a2, a3 も決まる。
    a2, a3 = c[1][0]-b1, c[2][0]-b1
    if a2 < 0 or a3 < 0:
        # この a1 では満たせない
        continue
    # ここまでで１列目、C21, c31 はOK
    # 2列目の残りチェック
    if a2 + b2 != c[1][1] or a2 + b3 != c[1][2]:
        # この a1 で２列目は満たせない
        continue
    # 3列目の残りチェック
    if a3 + b2 != c[2][1] or a3 + b3 != c[2][2]:
        # この a1 で３列目は満たせない
        continue
    # 一致した!!
    print("Yes")
    break
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_c1, total_c2, total_c3 = sum(c1), sum(c2), sum(c3)
ans = False
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            left1 = (3 * a2) + total_c1 - (3 * a1)
            right1 = total_c2
            left2 = (3 * a3) + total_c1 - (3 * a1)
            right2 = total_c3
            if left1 == right1 and left2 == right2:
                ans = True
if ans == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
C = [list(map(int, input().split())) for i in range(3)]
ans = [[], []]
for i in range(3):
    l = []
    for j in range(3):
        l.append(C[j][i])
    ans[1].append(min(C[i]))
    ans[0].append(min(l))

for i in range(3):
    for j in range(3):
        if ans[0][i] + ans[1][j] != C[j][i]:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

a= {i : [j for j in range(100)] for i in range(3)}
b= {i : [j for j in range(100)] for i in range(3)}

#print(a, b)
checker=False

for i, column in enumerate(M):
  for j, value in enumerate(column):
    candidate_a = [] 
    candidate_b = []
    for k in a[i]:
      for l in b[j]:
        if k + l == M[i][j]:
          candidate_a.append(k)
          candidate_b.append(l)
    b[j] = candidate_b
    a[i] = candidate_a
    if len(candidate_b) ==0 or len(candidate_a) == 0:
      #print("no candidate")
      checker =True
      break
      
    #print("i:{0},j:{1},a:{2},b:{3}".format(i,j, a, b))
    #print("\n")
  else:
    continue
  break

if checker:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys


def validation(c, a, b):
    for i in range(3):
        for j in range(3):
            if c[i][j] != a[i] + b[j]:
                print('No')
                return sys.exit()
    print('Yes')
    return sys.exit()


c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = np.array([c_1, c_2, c_3])
for i in range(np.max(c)):
    a = []
    b = []
    a.append(i)
    b.append(c[0][0] - a[0])
    b.append(c[0][1] - a[0])
    b.append(c[0][2] - a[0])
    a.append(c[1][0] - b[0])
    a.append(c[2][0] - b[0])
    validation(c, a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
import collections

#n, a, b= map(int, input().split())
#n, y  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
c = np.zeros([3,3],dtype=int)
a = np.zeros([1,3],dtype=int)
b = np.zeros([1,3],dtype=int)
b1 = np.zeros([1,3],dtype=int)
b2 = np.zeros([1,3],dtype=int)
for i in range(3):
  c[i,0], c[i,1], c[i,2]  = map(int, input().split())

for i in range(c[0,0]+1):
  a[0,0] = i
  b[0,0] = c[0,0] - i
  b[0,1] = c[0,1] - i
  b[0,2] = c[0,2] - i
  for ii in range(c[1,0]+1):
    if(np.any(b<0) == True):
      break
    a[0,1] = ii
    b1[0,0] = c[1,0] - ii
    b1[0,1] = c[1,1] - ii
    b1[0,2] = c[1,2] - ii
    for iii in range(c[2,0]+1):
      if((b == b1).all() == False):
        break
      a[0,2] = iii
      b2[0,0] = c[2,0] - iii
      b2[0,1] = c[2,1] - iii
      b2[0,2] = c[2,2] - iii
      if((b == b2).all() == False):
        break
      else:
        print('Yes')
        sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
import math
import sys
import numpy as np
import collections

#n, a, b= map(int, input().split())
#n, y  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
c = np.zeros([3,3],dtype=int)
a = np.zeros([1,3],dtype=int)
b = np.zeros([1,3],dtype=int)
b1 = np.zeros([1,3],dtype=int)
b2 = np.zeros([1,3],dtype=int)
for i in range(3):
  c[i,0], c[i,1], c[i,2]  = map(int, input().split())

for i in range(c[0,0]+1):
  a[0,0] = i
  b[0,0] = c[0,0] - i
  b[0,1] = c[0,1] - i
  b[0,2] = c[0,2] - i
  for ii in range(c[1,0]+1):
    if(np.any(b<0)):
      break
    a[0,1] = ii
    b1[0,0] = c[1,0] - ii
    b1[0,1] = c[1,1] - ii
    b1[0,2] = c[1,2] - ii
    for iii in range(c[2,0]+1):
      if((b == b1).all() == False):
        break
      a[0,2] = iii
      b2[0,0] = c[2,0] - iii
      b2[0,1] = c[2,1] - iii
      b2[0,2] = c[2,2] - iii
      if((b == b2).all() == False):
        break
      else:
        print('Yes')
        sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
c =[[],[],[]]

c[0] = [int(x) for x in input().split(" ")]
c[1] = [int(x) for x in input().split(" ")]
c[2] = [int(x) for x in input().split(" ")]

a=[0,0,0]
b=[0,0,0]

result = "No"
cnt = 0

for i in range(0,3):
  for j in range(0,i):
    for a[i] in range(0,101):
      for b[j] in range(0,101):
        if c[i][j] == a[i]+b[j]:
          cnt +=1
                    
if cnt == 6:
  result = "Yes"
  
print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = np.array([c_1, c_2, c_3])
a_min = np.min(c, axis=1)
b_min = np.min(c, axis=0)
for i in range(3):
    for j in range(3):
        if c[i][j] < a_min[i] + b_min[j]:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
ans = 0
for _ in range(3):
    c = list(map(int, input().split()))
    ans += sum(c)

if ans % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import copy
def solve():
    c = []
    for i in range(3):
        tmp = list(map(int,input().split()))
        c.append(tmp)

    elem = []
    
    for a1 in range(0, 100+1):
        b1 = c[0][0] - a1
        b2 = c[0][1] - a1
        b3 = c[0][2] - a1
        elem.append(b1)
        elem.append(b2)
        elem.append(b3)

        a2 = c[1][0] - b1
        if a2 != c[1][1] - b2 or a2 != c[1][2] - b3:
            continue

        elem.append(a2)

        a3 = c[2][0] - b1
        if a3 != c[2][1] - b2 or a3 != c[2][2] - b3:
            continue

        elem.append(a3)

        if inRange(0, 100, elem):
            print('Yes')
            break
        else:
            continue
    else:
        print('No')

def inRange(mn, mx, elem):
    for e in elem:
        if mn <= e and e <= mx:
            pass
        else:
            return False
    return True

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import numpy as np
c = np.ones([3,3])
for i in range(3):
    c[i] = [int(j) for j in input().split()]
    
if ((((c[2]-c[1])/(c[2]-c[1])[0])).all() ==(((c[2]-c[0])/(c[2]-c[0])[0])).all()) & ((((c[:][2]-c[:][1])/((c[:][2]-c[:][1])[0])).all()) ==(((c[:][2]-c[:][0])/(c[:][2]-c[:][0])[0])).all()):
    if ((((c[2]-c[1])/(c[2]-c[1])[1])).all() ==(((c[2]-c[0])/(c[2]-c[0])[1])).all()) & ((((c[:][2]-c[:][1])/((c[:][2]-c[:][1])[1])).all()) ==(((c[:][2]-c[:][0])/(c[:][2]-c[:][0])[1])).all()):
        if ((((c[2]-c[1])/(c[2]-c[1])[2])).all() ==(((c[2]-c[0])/(c[2]-c[0])[2])).all()) & ((((c[:][2]-c[:][1])/((c[:][2]-c[:][1])[2])).all()) ==(((c[:][2]-c[:][0])/(c[:][2]-c[:][0])[2])).all()):
            print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
c = np.ones([3,3])
for i in range(3):
    c[i] = [int(j) for j in input().split()]
    
if ((((c[2]-c[1])/(c[2]-c[1])[0])).all() ==(((c[2]-c[0])/(c[2]-c[0])[0])).all()) & ((((c[:][2]-c[:][1])/((c[:][2]-c[:][1])[0])).all()) ==(((c[:][2]-c[:][0])/(c[:][2]-c[:][0])[0])).all()):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
m = 0
for _ in range(3):
    m += sum(map(int, input().split()))
if m % 3 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
dat = []
for _ in range(3):
    dat.append(list(map(int, input().split())))
f = True
a1,a2,a3,b1,b2,b3 = -1,-1,-1,-1,-1,-1
a1 = 0
b1 = dat[0][0]
b2 = dat[0][1]
b3 = dat[0][2]
a2 = dat[1][0] - b1
if dat[1][1] != a2 + b2:
    f = False
if dat[1][2] != a2 + b3:
    f = False
a3 = dat[2][0] - b1
if dat[2][1] != a3 + b2:
    f = False
if dat[2][2] != a3 + b3:
    f = False
if 0 > a1 or 0>a2 or 0>a3 or 0>b1 or 0>b2 or 0>b3:
    f = False
print("Yes" if f else "No")

Submission status: Wrong Answer

Solution code:
c = [tuple(map(int, input().split())) for i in range(3)]

for x in range(0, 101):
    a = [x, 101, 101]
    b = [101, 101, 101]
    flag = True
    for i in range(3):
        for j in range(3):
            if a[i] <= 100 and b[j] <= 100:
                if c[i][j] == a[i] + b[j]:
                    continue
                else:
                    flag = False
                    break
            else:
                if a[i] > 100:
                    a[i] = c[i][j] - b[j]
                else:
                    b[j] = c[i][j] - a[i]
    if flag:
        print("Yes")
        exit(0)

print("No")