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

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

for a1 in range(max(C[0])+1):
    b1 = C[0][0] - a1
    for a2 in range(max(C[1])+1):
        b2 = C[1][1] - a2
        if a1 + b2 != C[0][1] or a2 + b1 != C[1][0]:
            continue
        for a3 in range(max(C[2])+1):
            b3 = C[2][2] - a3
            if a1 + b3 == C[0][2] and a2 + b3 == C[1][2] and a3 + b1 == C[2][0] and a3 + b2 == C[2][1]:
                print("Yes")
                exit()
print("No")

Solution (Python):
c = []
for i in range(3):
    c1 = list(map(int,input().split()))
    c.append(c1)
count = 0
ans = "Yes"
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]:
            ans = "No"
        if c[i][j] - c[i+1][j] != c[i][j+1] - c[i+1][j+1]:
            ans = "No"
print(ans)

Solution (Python):
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[1][0] == c[2][1] - c[1][1] == c[2][2] - c[1][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][1] == c[1][2] - c[1][1] == c[2][2] - c[2][1]:
    print("Yes")
else:
    print("No")

Solution (Python):
import numpy as np

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

judge = "Yes"

for i in range(2):
    
    if len(set(c[i] - c[i + 1])) != 1:
        
        judge = "No"
        
        break
    
    if len(set(c[:, i] - c[:, i + 1])) != 1:
        
        judge = "No"
        
        break

print(judge)

Solution (Python):
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())

print('Yes' if solve() else 'No')

Solution (Python):


c = [list(map(int,input().split())) for _ in range(3)]
a = [0]
b = [c[0][i] for i in range(3)]
a.append(c[1][0] - c[0][0])
a.append(c[2][0] - c[0][0])
for i in range(3):
    for j in range(3):
        if a[i] + b[j] == c[i][j]:
            continue
        else:
            print('No')
            quit()
print('Yes')

Solution (Python):
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
a=[0,c[1][0]-c[0][0],c[2][0]-c[0][0]]
b=[c[0][0],c[0][1],c[0][2]]

ok=0
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i]+b[j]:
            ok=1
            break
print("Yes" if ok==0 else "No")

Solution (Python):
def i():return map(int,input().split())
a,b,c = i()
d,e,f = i()
g,h,i = i()
print('Yes' if (d-a==e-b==f-c) and (g-d==h-e==i-f) and (b-a==e-d==h-g) and (c-b==f-e==i-h) else 'No')

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

if c[1][0] - c[0][0] == c[1][1] - c[0][1] \
    and c[1][0] - c[0][0] == c[1][2] - c[0][2] \
        and 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] \
                and c[2][0] - c[0][0] == c[2][2] - c[0][2] \
                    and c[2][1] - c[0][1] == c[2][2] - c[0][2]:
                        print('Yes')
else:
    print('No')

Solution (Python):
c = [list(map(int, input().split())) for i in range(3)]
if c[0][0]-c[0][1] != c[1][0]-c[1][1] or c[1][0]-c[1][1] != c[2][0]-c[2][1] or c[0][0] - c[0][1] != c[2][0]-c[2][1] or c[0][1]-c[0][2] != c[1][1]-c[1][2] or c[1][1]-c[1][2] != c[2][1]-c[2][2] or c[0][1] - c[0][2] != c[2][1]-c[2][2] or c[0][0]-c[0][2] != c[1][0]-c[1][2] or c[1][0]-c[1][2] != c[2][0]-c[2][2] or c[0][0] - c[0][2] != c[2][0]-c[2][2]:
		print("No")
		exit()
print("Yes")

Solution (Python):
ans = 'Yes'
C = []
for i in range(0, 3):
	C.append(list(map(int, input().split())))
a1ma2 = C[0][0] - C[1][0]
if a1ma2 != C[0][1] - C[1][1] or a1ma2 != C[0][2] - C[1][2]:
	ans = 'No'
a1ma3 = C[0][0] - C[2][0]
if a1ma3 != C[0][1] - C[2][1] or a1ma3 != C[0][2] - C[2][2]:
	ans = 'No'
a2ma3 = C[1][0] - C[2][0]
if a2ma3 != C[1][1] - C[2][1] or a2ma3 != C[1][2] - C[2][2]:
	ans = 'No'
b1mb2 = C[0][0] - C[0][1]
if b1mb2 != C[1][0] - C[1][1] or b1mb2 != C[2][0] - C[2][1]:
	ans = 'No'
b1mb3 = C[0][0] - C[0][2]
if b1mb3 != C[1][0] - C[1][2] or b1mb3 != C[2][0] - C[2][2]:
	ans = 'No'
b2mb3 = C[0][1] - C[0][2]
if b2mb3 != C[1][1] - C[1][2] or b2mb3 != C[2][1] - C[2][2]:
	ans = 'No'
print(ans)

Solution (Python):



def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    c = read_v(n=3, m=3)

    
    a = [0, 0, 0]
    b = c[0]
    for i in (1, 2):
        a[i] = c[i][0] - b[0]

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

    print('Yes')


if __name__ == '__main__':
    main()

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

if c1[0]-c2[0]==c1[1]-c2[1]==c1[2]-c2[2] and c1[0]-c3[0]==c1[1]-c3[1]==c1[2]-c3[2]:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
lis_a = [0] * 3

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

b = [0] * 3

for i in range(min(lis_a[0]) + 1):
    a_1 = i
    for k in range(3):
        b[k] = lis_a[0][k] - a_1
    a_2 = lis_a[1][0] - b[0]
    a_3 = lis_a[2][0] - b[0]
    a = [a_1, a_2, a_3]
    for l in range(3):
        for m in range(3):
            if a[l] + b[m] != lis_a[l][m]:
                print('No')
                sys.exit()
print('Yes')

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

sum_yoko = [0 for i in range(3)]
for i in range(3):
    sum_yoko[i] = sum(c[i])
    
sum_tate = [0 for i in range(3)]
for i in range(3):
    sum_tate[i] = c[0][i]+c[1][i]+c[2][i]
    
b1mb2 = (sum_yoko[0]-sum_yoko[1])/3
b2mb3 = (sum_yoko[1]-sum_yoko[2])/3
b3mb1 = (sum_yoko[2]-sum_yoko[0])/3
a1ma2 = (sum_tate[0]-sum_tate[1])/3
a2ma3 = (sum_tate[1]-sum_tate[2])/3
a3ma1 = (sum_tate[2]-sum_tate[0])/3

chk =[b1mb2,b2mb3,b3mb1,a1ma2,a2ma3,a3ma1]

flg = 0
for i in chk:
    if (i*10)%10 != 0:
        flg = 1

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

Solution (Python):
def main():
	C = [[0 for _ in range(3)] for _ in range(3)]
	for i in range(3):
		C[i] = list(map(int, input().split()))
	possible = True
	for i in range(1, 3):
		tmp = C[i][0]-C[i-1][0]
		for j in range(1, 3):
			if C[i][j]-C[i-1][j] != tmp:
				possible = False
				break
	for j in range(1, 3):
		tmp = C[0][j]-C[0][j-1]
		for i in range(1, 3):
			if C[i][j]-C[i][j-1] != tmp:
				possible = False
				break
	if possible:
		print("Yes")
	else:
		print("No")


if __name__ == '__main__':
    main()

Solution (Python):
o =0
t1 = list(map(int,input().split()))
t2 = list(map(int,input().split()))
t3 = list(map(int,input().split()))
o = sum(t1)+sum(t2)+sum(t3)
if o%3 >0:
  print('No')
elif (t1[0]-t1[1]==t2[0]-t2[1]==t3[0]-t3[1] and t1[2]-t1[1]==t2[2]-t2[1]==t3[2]-t3[1] and t1[0]-t2[0]==t1[1]-t2[1]==t1[2]-t2[2] and t1[0]-t3[0]==t1[1]-t3[1]==t1[2]-t3[2]):
  print('Yes')
else:
  print('No')

Solution (Python):
import numpy as np
row = [input().split() for i in range(3)]
f = np.vectorize(int)
c = f(row)

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

Solution (Python):
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())
for a1 in range(101):
    b1 = c11-a1
    b2 = c12-a1
    b3 = c13-a1
    a2 = c21-b1
    a3 = c31-b1
    if (c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b3):
        print("Yes")
        break
else:
    print("No")

Solution (Python):
C1 = list(map(int, input().split()))
C2 = list(map(int, input().split()))
C3 = list(map(int, input().split()))

if ((C1[1]-C1[0]) == (C2[1]-C2[0]) == (C3[1]-C3[0]) and
    (C1[2]-C1[1]) == (C2[2]-C2[1]) == (C3[2]-C3[1])):
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Solution (Python):
if __name__ == '__main__':
    c =[list(map(int, input().split())) for _ in range(3)]

    answer = 'No'
    for a1 in range(101):
        for a2 in range(101):
            for a3 in range(101):
                b1 = (c[0][0] + c[1][0] + c[2][0]) - (a1 + a2 + a3)
                b2 = (c[0][1] + c[1][1] + c[2][1]) - (a1 + a2 + a3)
                b3 = (c[0][2] + c[1][2] + c[2][2]) - (a1 + a2 + a3)

                if b1 % 3 == 0 and b2 % 3 == 0 and b3 % 3 == 0:
                    answer = 'Yes'
                    break
    print(answer)

Solution (Python):
c0=list(map(int, input().split()))
c1=list(map(int, input().split()))
c2=list(map(int, input().split()))

c=[c0,c1,c2]

judge = 0

if c[0][0]-c[0][1]==c[1][0]-c[1][1] and c[1][0]-c[1][1]==c[2][0]-c[2][1]:
  judge +=1
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]:
  judge +=1
if c[0][0]-c[1][0]==c[0][1]-c[1][1] and c[0][1]-c[1][1]==c[0][2]-c[1][2]:
  judge +=1
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]:
  judge +=1

if judge == 4:
  print("Yes")
else:
  print("No")

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

if (c[0][0]+c[1][1]+c[2][2])*3==(sum(c[0])+sum(c[1])+sum(c[2])):
  print('Yes')
else:
  print('No')

Solution (Python):
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=[0]*3
e=d
for i in range(3):
  d[i]=a[i]-b[i]
  e[i]=b[i]-c[i]
f=[a[0]-a[1],b[0]-b[1],c[0]-c[1]]
g=[a[1]-a[2],b[1]-b[2],c[1]-c[2]]
d=len(set(d));e=len(set(e));f=len(set(f));g=len(set(g))
if d==1 and e==1 and f==1 and g==1:
  print('Yes')
else:
  print('No')

Solution (Python):
c = []
for i in range(3):
    c.append(list(map(int,input().split())))
"""
変数6個で解9個
b1-b2 : c*1-c*2
b2-b3 : c*2-c*3 
b3-b1 : c*3-c*1
a1-a2 : c1*-c2* 
a2-a3 : c2*-c3*
a3-a1 : c3*-c1*
"""

i = 0
flaga12 = True
flaga23 = True 
flaga31 = True
flagb12 = True
flagb23 = True 
flagb31 = True

b12 = c[i][0]-c[i][1]
b23 = c[i][1]-c[i][2]
b31 = c[i][2]-c[i][0]

for i in range(3):
    flagb12 = flagb12 and (b12 == c[i][0]-c[i][1])
    flagb23 = flagb23 and (b23 == c[i][1]-c[i][2])
    flagb31 = flagb31 and (b31 == c[i][2]-c[i][0])
    
j = 0
a12 = c[0][j]-c[1][j]
a23 = c[1][j]-c[2][j]
a31 = c[2][j]-c[0][j]
for i in range(3):
    a12 = c[0][j]-c[1][j]
    a23 = c[1][j]-c[2][j]
    a31 = c[2][j]-c[0][j]
    flaga12 = flaga12 and (a12 == c[0][j]-c[1][j])
    flaga23 = flaga23 and (a23 == c[1][j]-c[2][j])
    flaga31 = flaga31 and (a31 == c[2][j]-c[0][j])

judge = (flaga12 and flaga23 and flaga31 and flagb12 and flagb23 and flagb31)
if judge:
    print("Yes")
else:
    print("No")

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

sa_a=[c[0][0]-c[1][0], c[1][0]-c[2][0]]
sa_b=[c[0][0]-c[0][1], c[0][1]-c[0][2]]
for i in range(2):
    if sa_a[i]!=c[i][i+1]-c[i+1][i+1]:
        print("No")
        quit()
for i in range(2):
    if sa_b[i]!=c[i+1][i]-c[i+1][i+1]:
        print("No")
        break
else:
    print("Yes")

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

Solution (Python):
c=[]
for i in range(3):
    sub_list=list(map(int,input().split()))
    c.append(sub_list)
a=[0]*3
b=[0]*3
for i in range(101):
    a[0]=i
    b[0]=c[0][0]-i
    b[1]=c[0][1]-i
    b[2]=c[0][2]-i
    a[1]=c[1][0]-b[0]
    a[2]=c[2][0]-b[0]
    count=0
    for j in a:
        if not 0<=j<=100:
            count=1
    for j in b:
        if not 0<=j<=100:
            count=1
    if count==1:
        continue
    count=0
    for m in range(3):
        for n in range(3):
            if not c[m][n]==a[m]+b[n]:
                count=1
    if count==1:
        continue
    else:
        print('Yes')
        import sys
        sys.exit()
print('No')

Solution (Python):
c = []
ans = "No"

for i in range(3):

    nc = list(map(int,input().split()))
    c.append(nc)


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] and 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[1][0]-c[0][0] == c[1][1] - c[0][1] and c[1][1]-c[0][1] == c[1][2] - c[0][2] and 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]:

        ans = "Yes"

print (ans)

Solution (Python):
c_11, c_12, c_13 = [int(c) for c in input().split()]
c_21, c_22, c_23 = [int(cc) for cc in input().split()]
c_31, c_32, c_33 = [int(ccc) for ccc in input().split()]
if c_11 + c_22 == c_12 + c_21 and c_11 + c_33 == c_13 + c_31 and c_22 + c_33 == c_23 + c_32:
  print("Yes")
else:
  print("No")

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

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in range(len(a)):
      for bi in range(len(b)):  
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)

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

a=[-1,-1,-1]
b=[-1,-1,-1]
N=min(c[0])
ans='No'
for i in range(N+1):
    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]

    flag=1
    for j in range(3):
        for k in range(3):
            if c[j][k]!=a[j]+b[k]:
                flag=0
    if flag==1:
        ans='Yes'
        break
print(ans)

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

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

flag = True
for i in range(3):
    for j in range(3):
        if a[i] + b[j] == c[i][j]:
            pass
        else:
            flag = False
            break

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

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

if c21-c11+c12-c22==0 and c31-c11+c12-c32==0 and c21-2*c11+c12+c13-c23==c31-2*c11+c12+c13-c33:
    print('Yes')
else:
    print('No')

Solution (Python):
from sys import stdin

data = []
for _ in range(3):
    data.append([int(x) for x in stdin.readline().rstrip().split()])

flag = False

for j in range(0,101):
    b1 = data[0][0] - j
    b2 = data[0][1] - j
    b3 = data[0][2] - j
    cnt = 0
    for k in data[1:]:
        if (k[0] - b1) == (k[1] - b2) == (k[2] - b3):
            cnt += 1
    if cnt == 2:
        flag = True
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())
def wrong():
	print('No')
	exit()
if c12 - c11 == c22 - c21 == c32 - c31:
	pass
else:wrong()
if c13 - c11 == c23 - c21 == c33 - c31:
	pass
else:wrong()
if c13 - c12 == c23 - c22 == c33 - c32:
	pass
else:wrong()
if c21 - c11 == c22 - c12 == c23 - c13:
	pass
else:wrong()
if c31 - c11 == c32 - c12 == c33 - c13:
	pass
else:wrong()
if c31 - c21 == c32 - c22 == c33 - c23:
	pass
else:wrong()
print('Yes')

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

ans = 'No'
if C[0][0] - C[1][0] == C[0][1] - C[1][1] == C[0][2] - C[1][2]:
    if C[1][0] - C[2][0] == C[1][1] - C[2][1] == C[1][2] - C[2][2]:
        if C[0][0] - C[0][1] == C[1][0] - C[1][1] == C[2][0] - C[2][1]:
            if C[0][1] - C[0][2] == C[1][1] - C[1][2] == C[2][1] - C[2][2]:
                ans = 'Yes'
print(ans)

Solution (Python):
c = [[int(i) for i in input().split()] for i in range(3)]
a = []
b = [c[0][i] for i in range(3)]
a = [c[i][0]-b[0] for i in range(3)]
for i in range(3):
    for j in range(3):
        if a[i]+b[j] != c[i][j]:
            print('No')
            exit()
print('Yes')

Solution (Python):
c=[]
for _ in range(3):
    c.append(list(map(int,input().split())))
a=[0]
b=[]
for i in range(3):
    b.append(c[0][i]-a[0])
for i in range(1,3):
    a.append(c[i][0]-b[0])
for i in range(3):
    for j in range(3):
        if c[i][j]!=a[i]+b[j]:
            print("No")
            exit()
print("Yes")

Solution (Python):
c = [[int(i) for i in input().split()] for i in range(3)]
ans = 'Yes'
for j in range(2):
  if c[j][0]-c[j+1][0] == c[j][1]-c[j+1][1] == c[j][2]-c[j+1][2]:
    ans = 'Yes'
  else:
    ans = 'No'
    print(ans)
    exit()
for j in range(2):
  if c[0][j]-c[0][j+1] == c[1][j]-c[1][j+1] == c[2][j]-c[2][j+1]:
    ans = 'Yes'
  else:
    ans = 'No'
    print(ans)
    exit()
print(ans)

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

import sys
C = [nl(), nl(), nl()]

d1 = C[0][0] - C[0][1]
d2 = C[1][0] - C[1][1]
d3 = C[2][0] - C[2][1]
if d1 != d2 or d2 != d3:
    print('No')
    sys.exit()

d4 = C[0][0] - C[0][2]
d5 = C[1][0] - C[1][2]
d6 = C[2][0] - C[2][2]
if d4 != d5 or d5 != d6:
    print('No')
    sys.exit()

e1 = C[0][0] - C[1][0]
e2 = C[0][1] - C[1][1]
e3 = C[0][2] - C[1][2]
if e1 != e2 or e2 != e3:
    print('No')
    sys.exit()

e4 = C[0][0] - C[2][0]
e5 = C[0][1] - C[2][1]
e6 = C[0][2] - C[2][2]
if e4 != e5 or e5 != e6:
    print('No')
    sys.exit()


print('Yes')

Solution (Python):
C = [0] * 3
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(3):
  D = [0] * 3
  for j in range(3):
    D[j] = C[i][j] - C[i - 1][j]
  if D[0] != D[1] or D[1] != D[2] or D[2] != D[0]:
    print('No')
    exit()
for i in range(3):
  D = [0] * 3
  for j in range(3):
    D[j] = C[j][i] - C[j][i - 1] 
  if D[0] != D[1] or D[1] != D[2] or D[2] != D[0]:
    print('No')
    exit()
print('Yes')

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

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

ans = 0

if c[1][0] - c[1][1] == b[0] - b[1] and c[1][1] - c[1][2] == b[1] - b[2]:
    ans += 1

if c[2][0] - c[2][1] == b[0] - b[1] and c[2][1] - c[2][2] == b[1] - b[2]:
    ans += 1

if ans == 2:
    print('Yes')
else:
    print('No')

Solution (Python):
c = [input().split() for i in range(3)]

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

flag = 0
for i in range(0, 101):
    for j in range(0, 101):
        for k in range(0, 101):
            if i+j == int(c[0][0]) and i+k == int(c[0][1]):
                a1 = i
                b1 = j
                b2 = k
                b3 = int(c[0][2])-i

if int(c[1][0])-b1 == int(c[1][1])-b2 and int(c[1][1])-b2 == int(c[1][2])-b3 and int(c[1][0])-b1 == int(c[1][2])-b3:
    if int(c[2][0])-b1 == int(c[2][1])-b2 and int(c[2][1])-b2 == int(c[2][2])-b3 and int(c[2][0])-b1 == int(c[2][2])-b3:
        flag = 1 

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

Solution (Python):
c = [[0]*3 for i in range(3)];
for i in range(3) :
	s = input().split(" ");
	for j in range(3) :
		c[i][j] = int(s[j]);
if c[1][0] - c[0][0] == c[1][1] - c[0][1] and c[1][0] - c[0][0] == c[1][2] - c[0][2] and c[2][0] - c[0][0] == c[2][1] - c[0][1] and c[2][2] - c[0][2] == c[2][0] - c[0][0] and c[0][1] - c[0][0] == c[1][1] - c[1][0] and c[0][1] - c[0][0] == c[2][1] - c[2][0] and c[0][2] - c[0][0] == c[1][2] - c[1][0] and c[0][2] - c[0][0] == c[2][2] - c[2][0] :
	print('Yes');
else :
	print('No')

Solution (Python):

def main():
    arr = [list(map(int, input().rstrip().split())) for _ in range(3)]
    memo = []
    for i, j, k in arr:
        memo += [(i - j, j - k)]
    print("Yes" if len(set(memo)) == 1 else "No")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    arr = [list(map(int, input().rstrip().split())) for _ in range(3)]
    memo = []
    for i, j, k in arr:
        memo += [(i - j, j - k)]
    flg = True if memo[0] == memo[1] and memo[1] == memo[2] else False

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


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    arr = [list(map(int, input().rstrip().split())) for _ in range(3)]
    memo = []
    for i, j, k in arr:
        memo += [(i - j, j - k)]
    flg = True if memo[0] == memo[1] and memo[1] == memo[2] else False

    memo = []
    for i in range(3):
        i, j, k = arr[0][i], arr[1][i], arr[2][i]
        memo += [(i - j, j - k)]
    flg = True if memo[0] == memo[1] and memo[1] == memo[2] else False
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    arr = [list(map(int, input().rstrip().split())) for _ in range(3)]
    memo = []
    for i, j, k in arr:
        memo += [(i - j, j - k)]
    flg_1 = True if memo[0] == memo[1] == memo[2] else False

    memo = []
    for i in range(3):
        i, j, k = arr[0][i], arr[1][i], arr[2][i]
        memo += [(i - j, j - k)]
    flg_2 = True if memo[0] == memo[1] == memo[2] else False
    
    print("Yes" if flg_1 and flg_2 else "No")


if __name__ == "__main__":
    main()

Solution (Python):
l = [list(map(int, input().split())) for i in range(3)]
b = l[0]
a2 = l[1][0] - b[0]
a3 = l[2][0] - b[0]
if l[1] == [a2 + b[0], a2 + b[1], a2 + b[2]] and l[2] == [a3 + b[0], a3 + b[1], a3 + b[2]]:
    print('Yes')
else:
    print('No')

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

a_flag = [0,0,0]
b_flag = [0,0,0]
for i in range(3):
    if i !=0:
        if c[0][i] - c[0][i-1] == c[1][i] - c[1][i-1] and c[1][i] - c[1][i-1] == c[2][i] - c[2][i-1]:
            a_flag[i]=1
    else:
        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]:
            a_flag[i]=1
            
for j in range(3):
    if j !=0:
        if c[j][0] - c[j-1][0] == c[j][1] - c[j-1][1] and c[j][1] - c[j-1][1] == c[j][2] - c[j-1][2]:
            b_flag[j]=1
    else:
        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]:
            b_flag[j]=1

if sum(a_flag) ==3 and sum(b_flag)==3:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
C=[]
A=[0]*3
B=[0]*3
for i in range(3):
    C.append(list(map(int,input().split())))
for i in range(3):
    A[i]=min(C[i])

for i in range(3):
    B[i]=C[0][i]-A[0]


for i in range(3):
    for j in range(1,3):
        if B[i]+A[j]!=C[j][i]:
            print('No')
            sys.exit()
print('Yes')

Solution (Python):
c_list=[]
for i in range(3):
    c_list.append([int(i) for i in input().split()])

for a1 in range(101):
    b1 = c_list[0][0] - a1
    a2 = c_list[1][0] - b1
    a3 = c_list[2][0] - b1
    b2 = c_list[0][1] - a1
    b3 = c_list[0][2] - a1
    if a2 + b2 == c_list[1][1] and a2 + b3 == c_list[1][2] and a3 + b2 == c_list[2][1] and a3 + b3 == c_list[2][2]:
        print('Yes')
        exit()
print('No')

Solution (Python):
c1,c2,c3=map(int,input().split())
c4,c5,c6=map(int,input().split())
c7,c8,c9=map(int,input().split())
d1,d2,d3,d4,d5,d6=c2-c1,c3-c2,c5-c4,c6-c5,c8-c7,c9-c8
if d1==d3 and d3==d5 and d2==d4 and d4==d6:print("Yes")
else:print("No")

Solution (Python):
ls = [[int(x) for x in input().split()] for _ in range(3)]

flg = "Yes"

for i in range(2):
    if ls[0][i]-ls[0][i+1] == ls[1][i]-ls[1][i+1] and ls[0][i]-ls[0][i+1] == ls[2][i]-ls[2][i+1]:
        pass
    else:
        flg = "No"
print(flg)

Solution (Python):
c =[]

for _ in range(3):
    c1,c2,c3 = map(int,input().split())
    c.append((c1,c2,c3))

a_test = [[0,0,0] for _ in range(2)]
b = [0,0,0]

for a1 in range(c[0][0]+1):
    dec = [True,True]
    for j in range(3):
        b[j] = c[0][j] - a1
    
    for i in range(2):
        for j in range(3):
            a_test[i][j] = c[i+1][j] - b[j]
            
        a_set = set(a_test[i])
        if len(a_set) != 1:
            dec[i] = False
    if all(dec):
        break
        
if all(dec):
    print('Yes')
else:
    print('No')

Solution (Python):
C = [list(map(int, input().split())) for i in range(3)]
a =[]
b = []
for i in range(3):
    a.append(C[1][i] - C[0][i])
for j in range(3):
    b.append(C[2][j] - C[0][j])
if (a[0] == a[1] and a[1] == a[2]) and (b[0] == b[1] and b[1] == b[2]):
    print('Yes')
else:
    print('No')

Solution (Python):
c=[list(map(int,input().split())) for i in range(3) ]
Y=[c[0][1]-c[0][0],c[0][2]-c[0][1]]
T=[c[1][0]-c[0][0],c[2][0]-c[1][0]]
flg=0
for i in range(1,3):
    if (c[i][1]-c[i][0])!=Y[0] or (c[i][2]-c[i][1])!=Y[1]:
        flg=1
        break
if flg<1:
    for i in range(1,3):
        if (c[1][i]-c[0][i])!=T[0] or (c[2][i]-c[1][i])!=T[1]:
            print("T",i)
            flg=1
            break
print(["Yes","No"][flg])

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

b0 = C[0][0]
b1 = C[0][1]
b2 = C[0][2]

a2_1 = C[1][0] - b0
a2_2 = C[1][1] - b1
a2_3 = C[1][2] - b2

a3_1 = C[2][0] - b0
a3_2 = C[2][1] - b1
a3_3 = C[2][2] - b2

if a2_1 == a2_2 and a2_2 == a2_3:
    if a3_1 == a3_2 and a3_2 == a3_3:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
from itertools import product as p
c = [list(map(int, input().split())) for _ in range(3)]
 
a = [-1]*3
a[0] = 0
b = c[0]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]
 
for i, j in p(range(3), range(3)):
    if c[i][j] != a[i] + b[j]:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
C = [[int(i) for i in input().split()] for k in range(3)]
tC = [list(k) for k in zip(*C)]
for i in range(2):
    p = [C[i][k]-C[i+1][k] for k in range(3)]
    tp = [tC[i][k]-tC[i+1][k] for k in range(3)]
    if p[0] == p[1] == p[2] and tp[0] == tp[1] == tp[2]:
        continue
    else:
        print("No")
        exit()
else:
    print("Yes")

Solution (Python):
C = [[int(i) for i in input().split()] for k in range(3)]
tC = [list(k) for k in zip(*C)]
for i in range(2):
    p = [C[i][k]-C[i+1][k] for k in range(3)]
    tp = [tC[i][k]-tC[i+1][k] for k in range(3)]
    if p[0] == p[1] == p[2] and tp[0] == tp[1] == tp[2]:
        continue
    else:
        print("No")
        exit()
else:
    print("Yes")

Solution (Python):
C1 = list(map(int,input().split()))
C2 = list(map(int,input().split()))
C3 = list(map(int,input().split()))
a = 0
b1,b2,b3 = C1[0],C1[1],C1[2]
a1,a2,a3  = 0,C2[1]-b2,C3[1]-b2
if C1[0]!=a1+b1 or C1[1]!=a1+b2 or C1[2]!=a1+b3 or C2[0]!=a2+b1 or C2[1]!=a2+b2 or C2[2]!=a2+b3 or C3[0]!=a3+b1 or C3[1]!=a3+b2 or C3[2]!=a3+b3:
    print("No")
else:
    print("Yes")

Solution (Python):
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2]:
  print("Yes")
else:
  print("No")

Solution (Python):


import sys


mat = [[x for x in map(int, sys.stdin.readline().rstrip().split()) ] for y in range(3)]



t = mat[0][0]

da1 = mat[1][0] - t
da2 = mat[2][0] - t

db1 = mat[0][1] - t
db2 = mat[0][2] - t

flag = True


if not (mat[1][1] == t + da1 + db1 and mat[1][2] == t + da1 + db2):
  flag = False


if not (mat[2][1] == t + da2 + db1 and mat[2][2] == t + da2 + db2):
  flag = False

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

Solution (Python):
C = [0]*3
for i in range(3):
    l = input().split()
    C[i] = [int(x) for x in l]



A = [0*3]*3
B = [0]*3
B[0] = C[0][0]
B[1] = C[0][1]
B[2] = C[0][2]
A[1] = C[1][0] - B[0]
A[2] = C[2][0] - B[0]

for i in range(3):
    for j in range(3):
        if A[i] + B[j] != C[i][j]:
            print('No')
            exit()

print('Yes')

Solution (Python):
a = [list(map(int, input().split())), list(map(int, input().split())), list(map(int, input().split()))]

def main():
    for i in range(1,3):
        x = a[0][0] - a[0][i] == a[1][0] - a[1][i]== a[2][0] -a[2][i]
        y = a[0][0] - a[i][0] == a[0][1] - a[i][1]== a[0][2] -a[i][2]
        if x is False or y is False:
            return "No"
    return "Yes"

if __name__ == "__main__":
    print(main())

Solution (Python):
c = [[int(i) for i in input().split()] for _ in range(3)]

ans = 'Yes'
if c[0][0] - c[0][1] != c[1][0] - c[1][1] or c[0][0] - c[0][1] != c[2][0] - c[2][1]:
    ans = 'No'
if c[0][0] - c[0][2] != c[1][0] - c[1][2] or c[0][0] - c[0][2] != c[2][0] - c[2][2]:
    ans = 'No'
if c[0][0] - c[1][0] != c[0][1] - c[1][1] or c[0][0] - c[1][0] != c[0][2] - c[1][2]:
    ans = 'No'
if c[0][0] - c[2][0] != c[0][1] - c[2][1] or c[0][0] - c[2][0] != c[0][2] - c[2][2]:
    ans = 'No'

print(ans)

Solution (Python):
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(101):
    for j in range(101):
        for h in range(101):
            X = [a-i for a in A]
            Y = [b-j for b in B]
            Z = [c-h for c in C]
            if  X == Y == Z:
                print('Yes')
                exit()
print("No")

Solution (Python):
c = [[i for i in map(int,input().split())] for j in range(3)]
for i in range(101):
    para = [0]*6
    para[0] = i 
    para[3] = c[0][0] - para[0]
    para[4] = c[0][1] - para[0]
    para[5] = c[0][2] - para[0]
    para[1] = c[1][0] - para[3]
    para[2] = c[2][0] - para[3]
    if c[1][1] == para[1]+para[4] and c[1][2] == para[1] + para[5]:
        if c[2][1] == para[2] + para[4] and c[2][2] == para[2] + para[5]:
            print("Yes") 
            exit()
print("No")

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


lst_diff_i = []
for i in range(3):
    diff1 = lst_c[i][0] - lst_c[i][1]
    diff2 = lst_c[i][1] - lst_c[i][2]
    diff3 = lst_c[i][2] - lst_c[i][0]
    lst_diff_i.append([diff1, diff2, diff3])
if lst_diff_i[0] == lst_diff_i[1] == lst_diff_i[2]:
    ans = "Yes"
else:
    print("No")
    exit()


print(ans)