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):
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
Z=list(map(int,input().split()))

res = "Yes"
for i in range(2):
	if X[i]-X[i+1] == Y[i]-Y[i+1] and X[i]-X[i+1] == Z[i]-Z[i+1]:
		res = "No"
		break
	i
if(X[0]-X[1]==Y[0]-Y[1] and X[0]-X[1]==Z[0]-Z[1] and X[2]-X[1]==Y[2]-Y[1] and X[2]-X[1]==Z[2]-Z[1]):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys


def slove():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a = [list(map(int, input().rstrip('\n').split())) for _ in range(3)]
    for i in range(3):
        t = min(a[i])
        if t != 0:
            for j in range(3):
                a[i][j] -= t
        t = min([a[j][i] for j in range(3)])
        if t != 0:
            for j in range(3):
                a[j][i] -= t
    print("Yes" if max([a[i][j] for i in range(3) for j in range(3)]) == 0 else "No")


if __name__ == '__main__':
    slove()

Solution (Python):
import numpy as np
c=[]
for i in range(3):
    c.append(list(map(lambda x: int(x), input().split())))
c=np.array(c)
ans='Yes'
tmp=c[:,0]-c[:,1]
if np.min(tmp) != np.max(tmp):
    ans='No'
tmp=c[:,0]-c[:,2]
if np.min(tmp) != np.max(tmp):
    ans='No'
tmp=c[0,:]-c[1,:]
if np.min(tmp) != np.max(tmp):
    ans='No'
tmp=c[0,:]-c[2,:]
if np.min(tmp) != np.max(tmp):
    ans='No'
print(ans)

Solution (Python):
import sys

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



coldif = [c[0][1] - c[0][0], c[0][2] - c[0][1]]



for i in range(1, 3):
    dif = [c[i][1] - c[i][0], c[i][2] - c[i][1]]
    if dif != coldif:
        print('No')
        sys.exit()

rowdif = [c[1][0] - c[0][0], c[2][0] - c[1][0]]



for i in range(1, 3):
    dif = [c[1][i] - c[0][i], c[2][i] - c[1][i]]
    if dif != rowdif:
        print('No')
        sys.exit()

print('Yes')

Solution (Python):
C=[]

C.append(list(map(int, input().split())))
C.append(list(map(int, input().split())))
C.append(list(map(int, input().split())))




res=False

for a1 in range(0,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:
                if C[2][0] - b1 == C[2][1] - b2 == C[2][2] - b3:
                        res=True
                        break

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

Solution (Python):
S = []
for _ in range(3):
	s = list(map(int, input().split()))
	S.append(s)
	
a = [None, None, None]
b = [None, None, None]

a[0] = 0
b[0] = S[0][0] - a[0]
b[1] = S[0][1] - a[0]
b[2] = S[0][2] - a[0]
a[1] = S[1][0] - b[0]
a[2] = S[2][0] - b[0]

yes = 1

for i in range(3):
	for j in range(3):
		if not S[i][j] == a[i] + b[j]:
			yes = 0
			break

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

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

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

a = [0] * 3
b = [0] * 3

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

for i in range(1,3):
    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]:
            pass
        else:
            print("No")
            sys.exit()
print("Yes")

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

min_1 = min(c[0])
for j in range(0,min_1+1):
  a[0] = j
  b[0] = c[0][0]-j
  b[1] = c[0][1]-j
  b[2] = c[0][2]-j
  a[1] = c[1][0]-b[0]
  a[2] = c[2][0]-b[0]
  if a[1]<0 or a[2]<0: continue
  for i in [1,2]:
    for k in [1,2]:
      if c[i][k] != a[i]+b[k]:
        break
      else:
        if i==2 and k==2:
          print("Yes")
          sys.exit()
    else:
      continue
    break

print("No")

Solution (Python):



def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    cs = [list(map(int, input().split())) for _ in range(3)]
    for i in range(2):
        tmp_diff = [0] * 3
        for j in range(3):
            tmp_diff[j] = cs[i][j] - cs[i + 1][j]
        if len(set(tmp_diff)) == 1:
            pass
        else:
            print("No")
            exit()
    
    for i in range(2):
        tmp_diff = [0] * 3
        for j in range(3):
            tmp_diff[j] = cs[j][i] - cs[j][i + 1]
        if len(set(tmp_diff)) == 1:
            pass
        else:
            print("No")
            exit()
    print("Yes")



if __name__ == '__main__':
    main()

Solution (Python):
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
Z=list(map(int,input().split()))
if(X[0]-X[1]==Y[0]-Y[1] and X[0]-X[1]==Z[0]-Z[1] and X[2]-X[1]==Y[2]-Y[1] and X[2]-X[1]==Z[2]-Z[1]):
  print("Yes")
else:
  print("No")

Solution (Python):
import numpy as np

def test():
    c = np.array([list(map(int,input().split())) for i in range(3)])
    a = c - np.min(c,axis=0)
    if a[0][0]==a[0][1]==a[0][2] and a[1][0]==a[1][1]==a[1][2] and a[2][0]==a[2][1]==a[2][2]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    test()

Solution (Python):
def solve():
    c = [[int(i) for i in input().split()] for _ in range(3)]
    for i in range(2):
        for j in range(2):
            if not c[i][j]-c[i+1][j] == c[i][j+1]-c[i+1][j+1]:
                return 'No'
    for i in range(2):
        for j in range(2):
            if not c[i][j]-c[i][j+1] == c[i+1][j]-c[i+1][j+1]:
                return 'No'
    return 'Yes'

if __name__ == '__main__':
    print(solve())

Solution (Python):
def solve():
    c = [[int(i) for i in input().split()] for _ in range(3)]
    for i in range(2):
        for j in range(2):
            if not c[i][j]-c[i+1][j] == c[i][j+1]-c[i+1][j+1]:
                return 'No'
    for i in range(2):
        for j in range(2):
            if not c[j][i]-c[j][i+1] == c[j+1][i]-c[j+1][i+1]:
                return 'No'
    return 'Yes'
        

if __name__ == '__main__':
    print(solve())

Solution (Python):
def solve():
    c = [[int(i) for i in input().split()] for _ in range(3)]
    if not (c[0][0]-c[1][0] == c[0][1]-c[1][1] == c[0][2]-c[1][2]):
        return 'No'
    elif not (c[1][0]-c[2][0] == c[1][1]-c[2][1] == c[1][2]-c[2][2]):
        return 'No'
    elif not (c[0][0]-c[0][1] == c[1][0]-c[1][1] == c[2][0]-c[2][1]):
        return 'No'
    elif not (c[0][1]-c[0][2] == c[1][1]-c[1][2] == c[2][1]-c[2][2]):
        return 'No'
    else:
        return 'Yes'

if __name__ == '__main__':
    print(solve())

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

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

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

q1 = c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1]
q2 = c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]
q3 = c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2]
q4 = c[0][0] - c[2][0] == c[0][1] - c[2][1] == c[0][2] - c[2][2]

if q1 and q2 and q3 and q4 == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
a,b,c = list(map(int,input().split()))
d,e,f = list(map(int,input().split()))
g,h,i = list(map(int,input().split()))
x = [0]
y = []
ans = "No"
y+=[a-x[0],d-x[0],g-x[0]]
x+=[b-y[0],c-y[0]]
if x[1]+y[1]==e and x[2]+y[1]==f and x[1]+y[2]==h and x[2]+y[2]==i:
  ans = "Yes"
print(ans)

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

yokosa=[grid[0][i]-grid[0][i-1] for i in range(1,3)]
for y in range(1,3):
  tmp=[grid[y][i]-grid[y][i-1] for i in range(1,3)]
  if yokosa!=tmp:
    print('No')
    exit()
tatesa=[grid[i][0]-grid[i-1][0] for i in range(1,3)]
for x in range(1,3):
  tmp=[grid[i][x]-grid[i-1][x] for i in range(1,3)]
  if tatesa!=tmp:
    print('No')
    exit()
print('Yes')

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

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] and\
           C[j][i] - C[j+1][i] == C[j][i+1] - C[j+1][i+1]:
            continue
        else:
            print("No")
            sys.exit()
print("Yes")

Solution (Python):
import numpy as np

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

a0 = 0
B = np.array([c[0][0], c[0][1], c[0][2]])

if len(set(np.array(c[1]) - B)) == 1 and len(set(np.array(c[2]) - B)) == 1:
    print("Yes")
else:
    print("No")

Solution (Python):


l=[]
for i in range(3):
    l.append(list(map(int,input().split())))
    std=l[i][0]
    for j in range(3):
        l[i][j]-=std

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

Solution (Python):
li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))
li3 = list(map(int,input().split()))

dyoko1 = li1[1]-li1[0]
dyoko2 = li1[2]-li1[1]
dtate1 = li2[0]-li1[0]
dtate2 = li3[0]-li2[0]

if li2[1]-li2[0] != dyoko1 or li3[1]-li3[0] != dyoko1:
  print("No")
  exit()
elif li2[2]-li2[1] != dyoko2 or li3[2]-li3[1] != dyoko2:
  print("No")
  exit()
elif li2[1]-li1[1] != dtate1 or li2[2]-li1[2] != dtate1:
  print("No")
  exit()
elif li3[1]-li2[1] != dtate2 or li3[2]-li2[2] != dtate2:
  print("No")
  exit()
  
print("Yes")

Solution (Python):
[(a,b,c),(d,e,f),(g,h,i)]=[map(int,input().split()) for _ in range(3)]
print("Yes" if a-b==d-e==g-h and b-c==e-f==h-i else "No")

Solution (Python):
c = {}

for i in range(3):
    ci0,ci1,ci2 = list(map(int,input().split()))
    c[(i,0)] = ci0 
    c[(i,1)] = ci1
    c[(i,2)] = ci2


for ai in range(101):
    a = {0:ai}
    b ={}
    
    for i in range(3):
        for j in range(3):
            if (i in a) and (j in b):
                if a[i]+b[j] != c[(i,j)]:
                    break
                else:
                    pass
            elif (i in a) and (not j in b):
                b[j] = c[(i,j)] - a[i]
            elif (not i in a) and (j in b):
                a[i] = c[(i,j)] - b[j]
            if i==2 and j==2:
                print('Yes')
                exit()
        else:
            continue
        break

print('No')

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

if N[0][0]-N[0][1]==N[1][0]-N[1][1]==N[2][0]-N[2][1] and N[0][1]-N[0][2]==N[1][1]-N[1][2]==N[2][1]-N[2][2] and N[0][0]-N[1][0]==N[0][1]-N[1][1]==N[0][2]-N[1][2] and N[1][0]-N[2][0]==N[1][1]-N[2][1]==N[1][2]-N[2][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()))
if (A[0]-A[1]==B[0]-B[1]==C[0]-C[1])and(A[1]-A[2]==B[1]-B[2]==C[1]-C[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(0, 101):
    b1 = c11 - a1
    b2 = c12 - a1
    b3 = c13 - a1
    a2 = c21 - b1
    a3 = c31 - b1

    if all([c22 == a2 + b2,
           c23 == a2 + b3,
           c32 == a3 + b2,
           c33 == a3 + b3]):
        print("Yes")
        exit(0)
else:
    print("No")

Solution (Python):
from functools import reduce
from itertools import *

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

l= [read(), read(), read()]

a = len(list(set([l[1][i]-l[0][i] for i in range(3)])))
b = len(list(set([l[2][i]-l[1][i] for i in range(3)])))
c = len(list(set([l[i][1]-l[i][0] for i in range(3)])))
d = len(list(set([l[i][2]-l[i][1] for i in range(3)])))

if a==1 and b==1 and c==1 and d ==1:
    print("Yes")
else:
    print("No")

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

a = [0]*3
b = [0]*3

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

good = True
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            good = False
            break
    else:
        continue
    break
print('Yes' if good else 'No')

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

a = [0]*3
b = [0]*3

for i in range(0, 101):
    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]

    for j in range(3):
        for k in range(3):
            if c[j][k] != a[j] + b[k]:
                break
        else:
            continue
        break
    else:
        print('Yes')
        break
else:
    print('No')

Solution (Python):
C = [list(map(int,input().split())) for _ in range(3)]
ind = 0
for j in range(1,3):
    if not(C[0][j]-C[0][j-1]==C[1][j]-C[1][j-1]==C[2][j]-C[2][j-1]):
        ind = 1
        break
if ind==1:
    print("No")
else:
    print("Yes")

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    grid = list(map(string_to_int, inputs))

    for x in range(101):
        a = [-1, -1, -1]
        b = [-1, -1, -1]
        a[0] = x
        for j in range(3):
            b[j] = grid[0][j] - a[0]
        a[1] = grid[1][0] - b[0]
        a[2] = grid[2][0] - b[0]

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


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(3))
    print(ret)

Solution (Python):
ls1=[int(s) for s in input().split()]
ls2=[int(s) for s in input().split()]
ls3=[int(s) for s in input().split()]

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

Solution (Python):
l = [[] for _ in range(3)]
for i in range(0, 3):
    l[i] = [int(_) for _ in input().split()]
t = [0, 0, 0]
for i in range(0, 3):
    for j in range(0, 3):
        t[i] += l[j][i]
p = (t[0] - t[1]) / 3
q = (t[0] - t[2]) / 3
if l[0][0]-p == l[0][1] and l[0][0]-q == l[0][2] and l[1][0]-p == l[1][1] and l[1][0]-q == l[1][2] and l[2][0]-p == l[2][1] and l[2][0]-q == l[2][2]:
    print('Yes')
else:
    print('No')

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

flag = True
for i in range(2):
    x = c[i][0] - c[i+1][0]
    y = c[i][1] - c[i+1][1]
    z = c[i][2] - c[i+1][2]

    p = c[0][i] - c[0][i+1]
    q = c[1][i] - c[1][i+1]
    r = c[2][i] - c[2][i+1]
    if x != y or y != z or x != z:
        flag = False
        break
    elif p != q or q != r or p != r:
        flag = False
        break

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

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

for i in range(3):
    b_i = ary[0][i] - a[0]
    b.append(b_i)

for i in range(1, 3):
    a_i = ary[i][0] - b[0]
    a.append(a_i)

for i in range(3):
    for j in range(3):
        if ary[i][j] == a[i] + b[j]:
            ans += 1

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

Solution (Python):
ary = [list(map(int,input().split())) for _ in range(3)]
for i in range(ary[0][0]+1):
    a = [ary[0][0]-i,ary[0][1]-i,ary[0][2]-i]
    a2 = ary[1][0] - a[0]
    a3 = ary[2][0] - a[0]
    b = [a2+a[0],a2+a[1],a2+a[2]]
    c = [a3+a[0],a3+a[1],a3+a[2]]
    if ary == [a,b,c]:print("Yes");exit()
else:print("No")

Solution (Python):


l= [[int(i) for i in input().split()] for j in range(3)]

a = [0]
b = []

for i in range(3):
    b.append(l[0][i]-a[0])

for i in range(1,3):
    a.append(l[i][0]-b[0])


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

print("Yes")

Solution (Python):
import numpy as np
L= np.array([list(map(int, input().split())) for i in range(3)])

a1 = 0
b1 = L[0][0]
b2 = L[0][1]
b3 = L[0][2]
a2 = L[1][0] - b1
a3 = L[2][0] - b1
if (a2 + b2 != L[1][1] or a2 + b3 != L[1][2] or 
    a3 + b2 != L[2][1] or a3 + b3 != L[2][2]):
  print ("No")
else:
  print ("Yes")

Solution (Python):
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
a,b = A[1]-A[0],A[2]-A[0]
c,d = B[1]-B[0],B[2]-B[0]
e,f = C[1]-C[0],C[2]-C[0]
if a==c==e and b==d==f:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

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

for a_1 in range(min(c[0]), max(c[0])+1):
    for a_2 in range(min(c[1]), max(c[1])+1):
        for a_3 in range(min(c[2]), max(c[2])+1):
            b_1, b_2, b_3 = map(lambda x: x - a_1, c[0])
            if all([a_2 + b_1 == c[1][0],
                    a_2 + b_2 == c[1][1],
                    a_2 + b_3 == c[1][2],
                    a_3 + b_1 == c[2][0],
                    a_3 + b_2 == c[2][1],
                    a_3 + b_3 == c[2][2]]):
                print('Yes')
                sys.exit(0)
print('No')

Solution (Python):
c_0=list(map(int,input().split()))
c_1=list(map(int,input().split()))
c_2=list(map(int,input().split()))

d=c_0[0]+c_1[1]+c_2[2]
e=c_1[0]+c_0[2]+c_2[1]
f=c_0[1]+c_1[2]+c_2[0]
if d==e==f:
    print("Yes")
else:
    print("No")

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

t1=list(map(lambda x: x-min(C[0]),C[0]))
t2=list(map(lambda x: x-min(C[1]),C[1]))
t3=list(map(lambda x: x-min(C[2]),C[2]))
s1=list(map(lambda x: x-min([C[0][0],C[1][0],C[2][0]]),[C[0][0],C[1][0],C[2][0]]))
s2=list(map(lambda x: x-min([C[0][1],C[1][1],C[2][1]]),[C[0][1],C[1][1],C[2][1]]))
s3=list(map(lambda x: x-min([C[0][2],C[1][2],C[2][2]]),[C[0][2],C[1][2],C[2][2]]))

arr=[]
for i,j,k in zip(t1+s1,t2+s2,t3+s3):
    arr.append(i==j==k)

print('Yes' if all(arr) else 'No')

Solution (Python):
C=[list(map(int,input().split())) for _ in range(3)]
for i in range(2):
    if not(C[0][i+1]-C[0][i] == C[1][i+1]-C[1][i] == C[2][i+1]-C[2][i]):
        print('No')
        exit()
    if not(C[i+1][0]-C[i][0] == C[i+1][1]-C[i][1] == C[i+1][2]-C[i][2]):
        print('No')
        exit()
print('Yes')

Solution (Python):
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if abs(a[0]-a[1])==abs(b[0]-b[1])==abs(c[0]-c[1]) and abs(a[1]-a[2])==abs(b[1]-b[2])==abs(c[1]-c[2])and abs(a[0]-b[0])==abs(a[1]-b[1])==abs(a[2]-b[2]) and abs(b[0]-c[0])==abs(b[1]-c[1])==abs(b[2]-c[2]):
    print('Yes')
else:
    print('No')

Solution (Python):
C = [list(map(int,input().split())) for _ in range(3)]
for i in range(max(C[0])+1):
  flg = True
  a1 = i
  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 + b2 != C[1][1] or a2 + b3 != C[1][2] or a3 + b2 != C[2][1] or a3 + b3 != C[2][2]:
    flg = False
  if flg == True:
    print("Yes")
    exit()
print("No")

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

for i in range(c[0][0]+1):

    a = [0]*3
    b = [0]*3
    a[0] = i
    b[0] = c[0][0] - i

    for j in range(1,3):
        a[j] = c[j][0] - b[0]
        b[j] = c[0][j] - a[0]
    flag = True
    for k in range(3):
        for l in range(3):
            if c[k][l] != a[k] + b[l]:
                flag = False
    if flag:
        print("Yes")
        exit()

print("No")

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

b = list(c[0])
a = [0, c[1][0] - b[0], c[2][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):
Data = []
def yoko(a,b):
    x1 = Data[a][0]-Data[b][0]
    x2 = Data[a][1]-Data[b][1]
    x3 = Data[a][2]-Data[b][2]
    if x1 == x2 and x2 == x3:
        return 1
    else:
        return 0

def tate(a,b):
    x1 = Data[0][a]-Data[0][b]
    x2 = Data[1][a]-Data[1][b]
    x3 = Data[2][a]-Data[2][b]
    if x1 == x2 and x2 == x3:
        return 1 
    else:
        return 0 

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

ans = 1
ans &= yoko(0,1)
ans &= yoko(1,2)
ans &= yoko(2,1)

ans &= tate(0,1)
ans &= tate(1,2)
ans &= tate(2,1)
if ans == 1:
    print('Yes')
else:
    print('No')

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

for b1 in range(101):
    a = [c[0][0] - b1, c[1][0] - b1, c[2][0] - b1]
    b = [b1, c[0][1] - a[0], c[0][2] - a[0]]
    if all(a[i] + b[j] == c[i][j] for j in range(3) for i in range(3)):
        print('Yes')
        exit()

print('No')

Solution (Python):
from numpy import array
a,b,c=array([list(map(int,input().split()))for i in range(3)])
e,f,g=[array(i)for i in zip(a,b,c)]
h=lambda x:list(x)==list(set(x))*3
print("YNeos"[1^all([h(a-b),h(b-c),h(c-a),h(e-f),h(f-g),h(g-e)])::2])

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

for b1 in range(101):
    a = [c[0][0] - b1, c[1][0] - b1, c[2][0] - b1]
    b = [b1, c[0][1] - a[0], c[0][2] - a[0]]
    if all(a[i] + b[j] == c[i][j] for j in range(3) for i in range(3)):
        print('Yes')
        exit()

print('No')

Solution (Python):
c = []

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

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

  else:
    print("No")
else:
  print("No")

Solution (Python):
cube = [list(map(int, input().split())) for i in range(3)]
a = True
x = [0] * 3
y = [0] * 3
x[0] = 0
y[0] = cube[0][0] - x[0]
y[1] = cube[0][1] - x[0]
y[2] = cube[0][2] - x[0]
x[1] = cube[1][0] - y[0]
x[2] = cube[2][0] - y[0]
for i in range(3):
    for j in range(3):
        if not (x[i] + y[j] == cube[i][j]):
            a = False
if a:
    print("Yes")
else:
    print("No")

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

a = [C[0][0] - C[0][0]]
b = [C[0][0] - a[0]]

for i in range(1, 3):
    a.append(C[i][0] - b[0])
    b.append(C[0][i] - a[0])

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

print('Yes')

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

for i in range(3):
    b[i]=c[0][i]-a[0]
for i in range(1,3):
    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")
            exit()
print("Yes")

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

ans = 'Yes'
for i in range(c[0][0] + 1):
    b = [c[0][0] - i, c[0][1] - i, c[0][2] - i]
    a = [i, abs(b[0] - c[1][0]), abs(b[0] - c[2][0])]
    for j in range(1, 3):
        for k in range(3):
            if c[j][k] != a[j] + b[k]:
                ans = 'No'
                break
        if ans != 'Yes':
            break
    if ans == 'Yes':
        break
    if i != c[0][0]:
        ans = 'Yes'

print(ans)

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

for i in range(2):
    if c[0][i] - c[0][i+1] == c[1][i] - c[1][i+1] == c[2][i] - c[2][i+1]:
        continue
    else:
        print("No")
        exit()
print("Yes")

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

ans = True
row = C[0]
for i in range(1, 3):
    for j in range(3):
        C[i][j] -= C[0][j]

    if row != C[i] and len(set(C[i])) != 1:
        ans = False

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

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()


def main():
    C = [[int(x) for x in input().split()] for _ in range(3)]

    a = [0, 0, 0]

    b = [C[0][i] for i in range(3)]  

    a = [C[i][0] - b[0] for i in range(3)]  

    ans = [[a[i] + b[j] for j in range(3)] for i in range(3)]

    if ans == C:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

Solution (Python):
s=list(map(int,input().split()))
t=list(map(int,input().split()))
u=list(map(int,input().split()))
a=s[0]+s[1]+s[2]+t[0]+t[1]+t[2]+u[0]+u[1]+u[2]
b=s[1]+s[2]+t[0]+t[2]+u[0]+u[1]-2*s[0]-2*t[1]-2*u[2]
if a%3==0 and b==0:
  print('Yes')
else:
  print('No')

Solution (Python):
c = []
for i in range(3):
    c_i = [int(a) for a in input().split()]
    c.append(c_i)
if (
    c[0][0] + c[1][1] + c[2][2]
    == c[0][1] + c[1][2] + c[2][0]
    == c[0][2] + c[1][0] + c[2][1]
):
    print("Yes")
else:
    print("No")

Solution (Python):
array_1 = list(map(int, input().split()))
array_2 = list(map(int, input().split()))
array_3 = list(map(int, input().split()))
for a in range(101):
    for b in range(101):
        for c in range(101):
            if array_1[0]-a==array_2[0]-b and array_2[0]-b==array_3[0]-c and array_3[0]-c==array_1[0]-a and array_1[1]-a==array_2[1]-b and array_2[1]-b==array_3[1]-c and array_3[1]-c==array_1[1]-a and array_1[2]-a==array_2[2]-b and array_2[2]-b==array_3[2]-c and array_3[2]-c==array_1[2]-a:
                print('Yes')
                exit()
print('No')

Solution (Python):
c = [ list(map(int, input().split())) for _ in range(3)]
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[2][1] - c[2][0] == c[0][1] - c[0][0]) and (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]) and (c[2][2] - c[2][0] == c[0][2] - c[0][0]):
  print("Yes")
else:
  print("No")

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

flag = True
for i in range(2):
    if L[0][i]-L[0][i+1]!=L[1][i]-L[1][i+1] or L[1][i]-L[1][i+1]!=L[2][i]-L[2][i+1] or L[i][0]-L[i+1][0]!=L[i][1]-L[i+1][1] or L[i][1]-L[i+1][1]!=L[i][2]-L[i+1][2]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
c = [list(map(int,input().split())) for k in range(3)]
A = [sum(a) for a in c]
B = [0,0,0]
AB = 0
for y in range(3):
    for x in range(3):
        if x == y:
            AB += c[y][x]
        B[x] += c[y][x]

for k in range(3):
    t = (A[k]+B[k]-AB)
    if t >= 0 and t%3 == 0:
        pass
    else:
        print("No")
        exit(0)
print("Yes")

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

ans = "Yes"
for i in range(3):
    temp = C[i][0]-C[(i+1)%3][0]
    for j in range(3):
        if C[i][j]-C[(i+1)%3][j] != temp:
            ans = "No"
for j in range(3):
    temp = C[0][j]-C[0][(j+1)%3]
    for i in range(3):
        if C[i][j]-C[i][(j+1)%3] != temp:
            ans = "No"
            
print(ans)

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

out = 'No'
if c13-c11 == c23-c21 == c33-c31:
  if c11-c12 == c21-c22 == c31-c32:
    if c12-c13 == c22-c23 == c32-c33:
      out = 'Yes'
      
print(out)

Solution (Python):
import numpy as np
c = np.zeros((3, 3))
for i in range(3):
    c[i, :] = np.array(list(map(int, input().split())))

vert_sum = np.sum(c, axis=0)
horz_sum = np.sum(c, axis=1)

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

Solution (Python):

def main():
    *C, = map(int, open(0).read().split())
    memo = {(i - j, j - k) for i, j, k in zip(*[iter(C)] * 3)}
    flg = len(memo) == 1
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

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

q1 = c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1]
q2 = c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]
q3 = c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2]
q4 = c[0][0] - c[2][0] == c[0][1] - c[2][1] == c[0][2] - c[2][2]

print("Yes" if q1 and q2 and q3 and q4 else "No")

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

flag = 0
if c1[0]-c1[1] != c2[0]-c2[1] or c1[0]-c1[1] != c3[0]-c3[1]:
    flag = 1
if c1[0]-c1[2] != c2[0]-c2[2] or c1[0]-c1[2] != c3[0]-c3[2]:
    flag = 1
if c1[2]-c1[1] != c2[2]-c2[1] or c1[2]-c1[1] != c3[2]-c3[1]:
    flag = 1
if c1[0]-c2[0] != c1[1]-c2[1] or c1[0]-c2[0] != c1[2]-c2[2]:
    flag = 1
if c1[0]-c3[0] != c1[1]-c3[1] or c1[0]-c3[0] != c1[2]-c3[2]:
    flag = 1
if c3[0]-c2[0] != c3[1]-c2[1] or c3[0]-c2[0] != c3[2]-c2[2]:
    flag = 1

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

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

Solution (Python):
[(a, b, c), (d, e, f), (g, h, i)] = [
    map(int, input().split()) for i in range(3)]

q1 = a - b == d - e== g - h
q2 = a - c == d - f == g - i
q3 = a - d == b - e== c - f
q4 = a - g == b - h == c - i

print("Yes" if q1 and q2 and q3 and q4 else "No")