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:
import sys 

def main():
    input = sys.stdin.readline
    mat = []
    for i in range(3):
        mat.append(sum(list(map(int, input().split()))))
    
    if sum(mat) % 3 == 0:
      print("Yes")
    else:
      print("No")

    


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
c = [input().split() for _ in range(3)]

for a1 in range(100):
    b1 = int(c[0][0]) - a1
    if b1 < 0:
        continue

    b2 = int(c[0][1]) - a1
    if b2 < 0:
        continue

    b3 = int(c[0][2]) - a1
    if b3 < 0:
        continue

    a2 = int(c[1][0]) - b1
    if a2 < 0:
        continue

    a3 = int(c[2][0]) - b1
    if a3 < 0:
        continue

    if int(c[1][1]) != (a2 + b2):
        continue

    if int(c[1][2]) != (a2 + b3):
        continue

    if int(c[2][1]) != (a3 + b2):
        continue

    if int(c[2][2]) != (a3 + b3):
        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()))
result = 'No'

if sum(c1[:2]) == c1[2] or c1[0] == c1[2]:
    if sum(c2[:2]) == c2[2] or c2[0] == c2[2]:
        if sum(c2[:2]) == c3[2] or c3[0] == c3[2]:
            result = 'Yes'

print(result)

Submission status: Wrong Answer

Solution code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
result = 'No'

if sum(c1[:2]) == c1[2]:
    if sum(c2[:2]) == c2[2]:
        if sum(c2[:2]) == c3[2]:
            result = 'Yes'

print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))
    sum_all = sum(c1)+sum(c2)+sum(c3)
    if sum_all%3 != 0:
        print('No')
    else:
        for a1 in range(c1[0]+1):
            b1 = c1[0]-a1
            b2 = c2[1]-a1
            b3 = c3[2]-a1
            if sum_all/3 - a1 - b1 - b2 - b3 < 0:
                print('No')
                break
        print('Yes')

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))
    sum_all = sum(c1)+sum(c2)+sum(c3)
    if sum_all%3 != 0:
        print('No')
    else:
        for a1 in range(c1[0]):
            b1 = c1[0]-a1
            b2 = c2[2]-a1
            b3 = c3[0]-a1
            if sum_all/3 - a1 - b1 - b2 - b3 < 0:
                print('No')
                break
        print('Yes')

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))

    if (sum(c1)+sum(c2)+sum(c3))%3 == 0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
      if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
      if ll[i][k]==ll[j][k]:
        if not all(ll[i][t]==ll[j][t] for t in range(3)):
          print('No')
          exit()
su=0
for lll in ll:
  s=sum(lll)
  su+=s
if su%3!=0:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
      if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
      if ll[i][k]==ll[j][k]:
        if not all(ll[i][t]==ll[j][t] for t in range(3)):
          print('No')
          exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
su=0
for i in range(3):
  l=list(map(int,input().split()))
  s=sum(l)
  su+=s
print('Yes' if su%3==0 else 'No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

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

sum = 0
for i in range(H):
    sum += C[i][0] + C[i][1] + C[i][2]

if sum % 3 == 0:
    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+e==b+d:
  if b+f==c+e:
    if d+h==e+g:
      if e+i==f+h:
        print('Yes')
print('No')

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='Yes'
if a[1]-a[0]!=b[1]-b[0] or a[2]-a[1]!=b[2]-b[1]:
  ans='No'
elif b[0]-a[0]!=b[1]-a[1] or  b[2]-a[2]!=b[1]-a[1]:
  ans='No'
elif c[0]!=a[2]+b[0] or c[1]!=a[2]+b[1] or c[2]!=a[2]+b[2]:
  ans='No'
print(ans)

Submission status: Wrong Answer

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

#print(List)
if List%3==0 :
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for i in range(3):
    y[i] = a[0][i]-x[0]

for i in range(3):
    x[i] = a[i][0]-y[0]

flag = True
print(y)
print(x)
for i in range(3):
    for j in range(3):
        if a[i][j] != x[i]+y[j]:
            flag=False

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

Submission status: Wrong Answer

Solution code:
import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)
i, j, k = np.max(C + 2, axis=1) // 2
flag = 0
for i, j, k in product(range(i), range(j), range(k)):
    x = C[0, :] - i
    y = C[1, :] - j
    z = C[2, :] - k

    if np.all((x == y) & (y == z)):
        flag = 1
        break

print(['No', 'Yes'][flag])

Submission status: Wrong Answer

Solution code:
import sys
C11,C12,C13 = map(int, input().split())
C21,C22,C23 = map(int, input().split())
C31,C32,C33 = map(int, input().split())





if (abs(C11+C22) == abs(C12 - C21)) and (abs(C12+C23) == abs(C13+C22)) and (abs(C22+C33) == abs(C23 + C32)) and (C21+C32 == C23+C32):
    print("Yes")

print("No")

Submission status: Wrong Answer

Solution code:
import sys
C11,C12,C13 = map(int, input().split())
C21,C22,C23 = map(int, input().split())
C31,C32,C33 = map(int, input().split())





if (abs(C11+C22) == abs(C12 - C21)) and (abs(C12+C23) == abs(C13+C22)) and (abs(C22+C33) == abs(C23 + C32)):
    print("Yes")

print("No")

Submission status: Wrong Answer

Solution code:
import sys 
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

N = 101

for i in range(N):
    a1 = i

    b1 = c11 - a1
    b2 = c12 - a1
    b3 = c13 - a1

    a2 = c21 - b1
    a3 = c31 - b1

    if c22 == a2+b2 and c23 == a2 + b3 and c33 == a3+b3:
        print("Yes")
        sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

ans = 'No'

# a1b1, a1b2, a1b3
# a2b1, a2b2, a2b3
# a3b1, a3b2, a3b3

for i in range(c11):
  a1 = i
  b1 = c11 - a1
  a2 = c21 - b1
  b2 = c12 - a1
  a3 = c31 - b1
  b3 = c13 - a1
  
  if (a2+b2 == c22) and (a2+b3 == c23) and (a3+b2 == c32) and (a3+b3 == c33):
    ans = 'Yes'
    break
print(ans)

Submission status: Wrong Answer

Solution code:
s1, s2, s3 = [list(map(int, input().split())) for _ in range(3)]
a1 = s1[0] - s2[0] == s1[1] - s2[1] == s1[2] - s2[2]
a2 = s2[0] - s3[0] == s2[1] - s3[1] == s2[2] - s3[2]
a3 = s3[0] - s1[0] == s3[1] - s1[1] == s3[2] - s3[2]
print("Yes" if a1 and a2 and a3 else "No")

Submission status: Wrong Answer

Solution code:
grid = []
for i in range(3):
    grid.append(list(map(int, input().split())))
flag = True
for i in range(1, 3):
    if grid[i][0] - grid[0][0] == grid[i][1] - grid[0][1] == grid[i][2] - grid[0][2]:
        continue
    else:
        flag = False
        print('No')
if flag:
    print('Yes')

Submission status: Wrong Answer

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

s0 = 0
for i in range(3):
    for j in range(3):
        s0 += C[i][j]

s1 = 0
for j in range(3):
    for i in range(3):
        s1 += C[i][j]

if s0 == s1 and s0%3 == 0 and s1%3 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
C=[list(map(int,input().split())) for i in range(3)]
a=[min(C[i]) for i in range(3)]
b=[min(C[0][i],C[1][i],C[2][i]) for i in range(3)]
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:
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
if (sum(A)+sum(B)+sum(C))//3 == A[0]+B[1]+C[2] == A[2]+B[1]+C[0]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
c = [list(map(int,input().split())) for i in range(3)]
import numpy as np
c = np.array(c)
if np.sum(c)%3 != 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# ans

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

for i in range(2):
  for j in range(2):
    if c[i][j] - c[i][j+1] == c[i+1][j] - c[i+1][j+1]:
      pass
    else:
      print('NO')
      exit()
      
print('YES')

Submission status: Wrong Answer

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

flag = True

for i in range(101):
    for j in range(101):
        for k in range(101):
            for x in range(3):
                c[x][0] -= i
                c[x][1] -= j
                c[x][2] -= k
            for x in range(3):
                if c[x][0] == c[x][1] == c[x][2]:
                    continue
                else:
                    break
            else:
                print("Yes")
                flag = False
                break
        if flag:
            continue
        else:
            break
    if flag:
        continue
    else:
        break
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
c= [list(map(int, input().split())) for i in range(3)]
sumc=0
for i in range(3):
  sumc+=sum(c[i])

if sumc%3==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

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

  a2=c[1][0]-b1
  a3=c[2][0]-b1
  if a2==c[1][1]-b2 and a2==c[1][2]-b3:
    if a3==c[2][1]-b2 and a2==c[2][2]-b3:
      print('Yes')
      sys.exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
import sys
c= [list(map(int, input().split())) for i in range(3)]
csum=[0]*3
for a1 in range(100):
  if (a1-(sum(c[0])-sum(c[1]))/3)>=0 and (a1-(sum(c[0])-sum(c[2]))/3)>=0:
    for b1 in range(100):
      for k in range(3):
        csum[k]=c[0][k]+c[1][k]+c[2][k]
      if (b1-(csum[0]-csum[1])/3)>=0 and (b1-(csum[0]-csum[2])/3)>=0:
        print('Yes')
        sys.exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
c = [list(map(int,input().split())) for _ in range(3)]
b = c[0]
a = [0]
for i in range(1,3):
    a.append(c[i][i]-b[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:

box = []

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


for a1 in range(100):
        for a2 in range(100):
                a1_b1 = box[0][0]-a1
                a1_b2 = box[1][0]-a1
                a1_b3 = box[2][0]-a1
                a2_b1 = box[0][1]-a2
                a2_b2 = box[1][1]-a2
                a2_b3 = box[2][1]-a2
                
                f = True
                if a1_b1 != a2_b1 or a1_b2 != a2_b2 or a1_b3 != a2_b3:
                        f = False
                a1_b = [a1_b1,a1_b2,a1_b3] 
                a2_b = [a2_b1,a2_b2,a2_b3] 
                res = True
                a1_a3 = []
                a2_a3 = []
                for i in range(3):
                        if (box[i][2]-a1_b[i]) != (box[i][2]-a2_b[i]):
                                res = False
                        a1_a3.append(box[i][2] - a1_b[i])
                        a2_a3.append(box[i][2] - a2_b[i])
                
                a3 = a1_a3[0]
                for i in range(1,3):
                        if a3 != a1_a3[i]:
                                res = False
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2]- a3)
                
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2] - a3)
                
                a = [a1,a2,a3]
                b = a3_b

                for i in range(3):
                        for j in range(3):
                                if box[i][j] != (b[i]+a[j]):
                                        res = False

                res = True
                for i in range(3):
                        for j in range(3):
                                if box[i][j] != (b[i]+a[j]):
                                        res = False
                #for i in range(3):
                #        print(a1_b[i]+a1,a1_b[i]+a2,)
                if res:
                        print("Yes")
                        exit()
                
print("No")

Submission status: Wrong Answer

Solution code:

box = []

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


for a1 in range(100):
        for a2 in range(100):
                a1_b1 = box[0][0]-a1
                a1_b2 = box[1][0]-a1
                a1_b3 = box[2][0]-a1
                a2_b1 = box[0][1]-a2
                a2_b2 = box[1][1]-a2
                a2_b3 = box[2][1]-a2
                
                f = True
                if a1_b1 != a2_b1 or a1_b2 != a2_b2 or a1_b3 != a2_b3:
                        f = False
                a1_b = [a1_b1,a1_b2,a1_b3] 
                a2_b = [a2_b1,a2_b2,a2_b3] 
                res = True
                a1_a3 = []
                a2_a3 = []
                for i in range(3):
                        if (box[i][2]-a1_b[i]) != (box[i][2]-a2_b[i]):
                                res = False
                        a1_a3.append(box[i][2] - a1_b[i])
                        a2_a3.append(box[i][2] - a2_b[i])
                
                a3 = a1_a3[0]
                for i in range(1,3):
                        if a3 != a1_a3[i]:
                                res = False
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2]- a3)
                
                a3_b = []
                for i in range(3):
                        a3_b.append(box[i][2] - a3)
                
                a = [a1,a2,a3]
                b = a3_b

                for i in range(3):
                        for j in range(3):
                                if box[i][j] != (b[i]+a[j]):
                                        res = False
                #for i in range(3):
                #        print(a1_b[i]+a1,a1_b[i]+a2,)
                if res:
                        print("Yes")
                        exit()
                
print("No")

Submission status: Wrong Answer

Solution code:

box = []

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


for a1 in range(100):
        for a2 in range(100):
                a1_b1 = box[0][0]-a1
                a1_b2 = box[1][0]-a1
                a1_b3 = box[2][0]-a1
                a2_b1 = box[0][1]-a2
                a2_b2 = box[1][1]-a2
                a2_b3 = box[2][1]-a2
                
                f = True
                if a1_b1 != a2_b1 or a1_b2 != a2_b2 or a1_b3 != a2_b3:
                        f = False
                a1_b = [a1_b1,a1_b2,a1_b3] 
                a2_b = [a2_b1,a2_b2,a2_b3] 
                res = True
                a1_a3 = []
                a2_a3 = []
                for i in range(3):
                        if (box[i][2]-a1_b[i]) != (box[i][2]-a2_b[i]):
                                res = False
                        a1_a3.append(box[i][2] - a1_b[i])
                        a2_a3.append(box[i][2] - a2_b[i])
                
                a3 = a1_a3[0]
                for i in range(1,3):
                        if a3 != a1_a3[i]:
                                res = False

                #for i in range(3):
                #        print(a1_b[i]+a1,a1_b[i]+a2,)
                if res:
                        print("Yes")
                        exit()
                
print("No")

Submission status: Wrong Answer

Solution code:
c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = c_1 + c_2 + c_3
if sum(c) % 3 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0] + 1)):
    b1 = c[0, 0] - a1
    b2 = c[0, 1] - a1
    b3 = c[0, 2] - a1
    if c[1, 0] - b1 == c[1, 1] - b2 == c[1, 2] - b3 > 0 and c[2, 0] - b1 == c[2, 1] - b2 == c[2, 2] - b3 > 0:
        print('Yes')
        flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0] + 1)):
    b1 = c[0, 0] - a1
    b2 = c[0, 1] - a1
    b3 = c[0, 2] - a1
    if c[1, 0] - b1 == c[1, 1] - b2 == c[1, 2] - b3 and c[2, 0] - b1 == c[2, 1] - b2 == c[2, 2] - b3:
        print('Yes')
        flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0] + 1)):
    for a2 in range(min(c[1] + 1)):
        b1 = c[0, 0] - a1
        b2 = c[1, 1] - a2
        a3 = c[2, 0] - b1
        b3 = c[2, 2] - a3
        if b1 < 0 or b2 < 0 or a3 < 0 or b3 < 0:
            break
        if (a1 + b2 == c[0, 1]) and (a1 + b3 == c[0, 2]) and (a2 + b1 == c[1, 0]) and (a2 + b3 == c[1, 2]) and (
                a3 + b2 == c[2, 1]):
            print('Yes')
            flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(100):
    for a2 in range(100):
        print(a1, a2)
        b1 = c[0, 0] - a1
        b2 = c[1, 1] - a2
        a3 = c[2, 0] - b1
        b3 = c[2, 2] - a3
        if (a1 + b2 == c[0, 1]) and (a1 + b3 == c[0, 2]) and (a2 + b1 == c[1, 0]) and (a2 + b3 == c[1, 2]) and (
                a3 + b2 == c[2, 1]):
            print('Yes')
            flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0]) + 1):
    for a2 in range(min(c[1]) + 1):
        b1 = c[0, 0] - a1
        b2 = c[1, 1] - a2
        a3 = c[2, 0] - b1
        b3 = c[2, 2] - a3
        if (a1 + b2 == c[0, 1]) and (a1 + b3 == c[0, 2]) and (a2 + b1 == c[1, 0]) and (a2 + b3 == c[1, 2]) and (
                a3 + b2 == c[2, 1]):
            print('Yes')
            flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0]) + 1):
    for a2 in range(min(c[1]) + 1):
        b1 = c[0, 0] - a1
        b2 = c[1, 1] - a2
        a3 = c[2, 0] - b1
        b3 = c[2, 2] - a3
        if (a1 + b2 == c[0, 1]) and (a1 + b3 == c[0, 2]) and (a2 + b1 == c[1, 0]) and (a2 + b3 == c[1, 2]) and (
                a3 + b1 == c[2, 0]) and (a3 + b2 == c[2, 1]):
            print('Yes')
            flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
flag = False
for a1 in range(min(c[0]) + 1):
    for a2 in range(min(c[1]) + 1):
        for a3 in range(min(c[2]) + 1):
            b1 = c[0, 0] - a1
            b2 = c[1, 1] - a2
            b3 = c[2, 2] - a3
            if (a1 + b2 == c[0, 1]) and (a1 + b3 == c[0, 2]) and (a2 + b1 == c[1, 0]) and (a2 + b3 == c[1, 2]) and (
                    a3 + b1 == c[2, 0]) and (a3 + b2 == c[2, 1]):
                print('Yes')
                flag = True

if not flag:
    print('No')

Submission status: Wrong Answer

Solution code:
c=[]

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

c_sum = sum(c[0] + c[1] + c[2])

if c_sum//3 <= 100 and c_sum % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c=[]

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

c_sum = sum(c[0] + c[1] + c[2])

if c_sum//3 >= 100 and c_sum % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c=[]

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

#c_sum = sum(c[0]) + sum(c[1]) + sum(c[2])
c_sum = sum(c[0] + c[1] + c[2])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10 ** 7)

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

    def recursion(ai=0, b0=-1, b1=-1, b2=-1):
        if ai == 3: return True
        for a in range(100 + 1):
            if (b0 == -1) or (b0 == G[ai][0] - a):
                b0 = G[ai][0] - a
            else:
                continue
            if b0 < 0: break
            if (b1 == -1) or (b1 == G[ai][1] - a):
                b1 = G[ai][1] - a
            else:
                continue
            if b1 < 0: break
            if (b2 == -1) or (b2 == G[ai][2] - a):
                b2 = G[ai][2] - a
            else:
                continue
            if b2 < 0: break
            if recursion(ai + 1, b0, b1, b2):
                return True
        return False

    cond = recursion()
    print('Yes' if cond else 'No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = 'No'

print(grid)

for a1 in range(0, 101):
    for a2 in range(0, 101):
        b1 = grid[0][0] - a1
        b2 = grid[1][1] - a2
        a3 = grid[2][1] - b2
        b3 = grid[2][2] - a3
        if a1 >= 0 and a2 >= 0 and a3 >= 0 and b1 >= 0 and b2 >= 0 and b3 >= 0:
            print(a1, a2, a3, b1, b2, b3)
            ans = 'Yes'
            break

print(ans)

Submission status: Wrong Answer

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

ans = 'No'

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = grid[0][0] - a1
            b2 = grid[1][1] - a2
            b3 = grid[2][2] - a3
            check = [a1, a2, a3, b1, b2, b3]
            if len(list(filter(lambda x: x >= 0, check))) == 6:
                ans = 'Yes'
                break

print(ans)

Submission status: Wrong Answer

Solution code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))

for i in range(51):
    for j in range(51):
        for k in range(51):
            for l in range(51):
                if i + l > c1[0] or j + l > c2[0] or k + l > c3[0]:
                    break
                for m in range(51):
                    for n in range(51):
                        if i + l == c1[0] and i + m == c1[1] and i + n == c1[2] and j + l == c2[0] and j + m == c2[1] and j + n == c2[2] and k + l == c3[0] and k + m == c3[1] and k + n == c3[2]:
                            print('Yes')
                            exit()
print('No')

Submission status: Wrong Answer

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

ok = True
for i in range(3):
  if A[i][1] - A[i][0] == A[i][2] - A[i][1]:
    continue
  else:
    ok = False
    break

for i in range(3):
  if A[1][i] - A[0][i] == A[2][i] - A[1][i]:
    continue
  else:
    ok = False
    break
    
if not ok:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
from fractions import Fraction

def is_integer(fraction):
    return fraction.numerator % fraction.denominator == 0

def main(*args, **kwargs):
    """Write Codes for contest here."""
    grid = []
    for i in range(3):
        grid.append(list(map(int, input().split())))

    for b_sum in range(1, 301):
        a1 = Fraction(Fraction(sum(grid[0]), b_sum), 3)
        a2 = Fraction(Fraction(sum(grid[1]), b_sum), 3)
        a3 = Fraction(Fraction(sum(grid[2]), b_sum), 3)
        if is_integer(a1) and is_integer(a2) and is_integer(a3) and 0 <= a1 <= 100 and 0 <= a2 <= 100 and 0 <= a3 <= 100:
            print('Yes')

    print('No')
main()

Submission status: Wrong Answer

Solution code:
sum1 = 0
i = 1
while i <=3:
    a,b,c = map(int,input().split())
    sum1 += a+b+c
    i +=1
    
if sum1%3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
c = [None]*3
for i in range(3):
    c[i] = [None]*3
for i in range(3):
    c[i] = readints()
# print(c)
# a1=0,a2=1,a3=0,b1=1,b2=0,b3=1
#a = [0, 1, 0]
#b = [1, 0, 1]


def func(a, b):
    for i in range(3):
        for j in range(3):
            if a[i]+b[j] == c[i][j]:
                continue
            return False
            break
    return True


a = [None]*3
b = [None]*3

for i in range(100):
    for j in range(100):
        for k in range(100):
            for l in range(3):
                a[0] = i
                a[1] = j
                a[2] = k
                b[0] = c[l][0]-a[l]
                b[1] = c[l][1]-a[l]
                b[2] = c[l][2]-a[l]
                if func(a, b):
                    print('Yes')
                    exit()
print('No')

Submission status: Wrong Answer

Solution code:
c=[list(map(int, input().split())) for _ in range(3)]
p=sum(c[0])%3
print("Yes" if (sum(c[1])-p)%3==(sum(c[2])-p)%3==0 else "No")

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    c=[]
    s=0
    for i in range(3):
        li=list(map(int,readline().split()))
        s+=sum(li)
        c.append(li)

    print(s)
    
    if s%3!=0:
        print("No")
    else:
        if c[0][0]+c[1][1]+c[2][2]==s//3:
            print("Yes")
        else:
            print("No")

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

# print('c', c)
if sum(c) % 3:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))


for a in range(0,10):
    for b in range(0,10):
        for c in range(0,10):
            for d in range(0,10):
                for e in range(0,10):
                    for f in range(0,10):
                        a1 = f
                        a2 = e
                        a3 = d
                        b1 = c
                        b2 = b
                        b3 = a
                        if a1 + b1 == c1[0] and a1 +b2 == c1[1] and a1 + b3 ==c1[2] \
                            and a2 + b1 == c2[0] and a2 +b2 == c2[1] and a2 + b3 ==c2[2] \
                                and a3 + b1 == c3[0] and a3 +b2 == c3[1] and a3 + b3 ==c3[2]:
                                print("Yes")
                                exit()
print("No")

Submission status: Wrong Answer

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

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'
elif C[0][0]-C[0][2]!=C[1][0]-C[1][2]!=C[2][0]-C[2][2]:
  ans='No'
elif C[0][0]-C[2][0]!=C[0][1]-C[2][1]!=C[0][2]-C[2][2]:
  ans='No'

print(ans)