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):
grid = []
for _ in range(3):
    grid.append((list)(map(int, input().split())))

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]
    diff3 = grid[i][2] - grid[j][2]

    if diff1 != diff2 or diff2 != diff3:
        print("No")
        exit()

print("Yes")

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

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]
    diff3 = grid[i][2] - grid[j][2]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[0][i] - grid[0][j]
    diff2 = grid[1][i] - grid[1][j]
    diff3 = grid[2][i] - grid[2][j]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

print("Yes")

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

ans = 'Yes'
for i in range(2):
    if A[i][0] - A[i+1][0] != A[i][1] - A[i+1][1] or A[i][1] - A[i+1][1] != A[i][2] - A[i+1][2]:
        ans = 'No'
        
print(ans)

Solution (Python):
a1,a2,a3 = map(int, input().split())
b1,b2,b3 = map(int, input().split())
c1,c2,c3 = map(int, input().split())
if (b1 - a1) == (b2 - a2) == (b3 - a3) and (c1 - b1) == (c2 - b2) == (c3 - b3):
  if a2 - a1 == b2 - b1 == c2 - c1 and a3 - a2 == b3 - b2 == c3 - c2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Solution (Python):
A = [[int(i) for i in input().split()] for i in range(3)]
ans = 'Yes'

for i in range(2):
    if A[i][0] - A[i + 1][0] != A[i][1] - A[i + 1][1]:
        ans = 'No'
        break
    if A[i][1] - A[i + 1][1] != A[i][2] - A[i + 1][2]:
        ans = 'No'
        break
        
print(ans)

Solution (Python):
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

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

Solution (Python):
c=[]
for i in range(3):
    c.append(list(int(i) for i in input().split()))
flag = True
tmp = [[],[],[]]
tmp2 = [[],[],[]]
for i in range(3):
    tmp[0].append(c[i][1]-c[i][0])
    tmp[1].append(c[i][2]-c[i][1])
    tmp[2].append(c[i][0]-c[i][2])
    tmp2[0].append(c[1][i]-c[0][i])
    tmp2[1].append(c[2][i]-c[1][i])
    tmp2[2].append(c[0][i]-c[2][i])
for i in range(3):
    if not tmp[i][0]==tmp[i][1]==tmp[i][2]:
        flag = False
        break
    if not tmp2[i][0]==tmp2[i][1]==tmp2[i][2]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


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

Solution (Python):
import numpy as np
c_vec1 = list(map(int, input().split(" ")))
mat_size = len(c_vec1)
c_mat = np.asarray([c_vec1] + [list(map(int, input().split(" "))) for i in range(mat_size-1)])

flag1 = len(set(c_mat[0] - c_mat[1])) == 1 and len(set(c_mat[1] - c_mat[2])) == 1 and len(set(c_mat[2] - c_mat[0])) == 1
flag2 = len(set(c_mat[:, 0] - c_mat[:, 1])) == 1 and len(set(c_mat[:, 1] - c_mat[:, 2])) == 1 and len(set(c_mat[:, 2] - c_mat[:, 0])) == 1
flag = flag1 and flag2
out_txt = "Yes" if flag else "No"

print(out_txt)

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

ok = True
a = [0]*3
b = [0]*3
d = [0]*3
e = [0]*3
for i in range(3):
    a[i] = c[i][1]-c[i][0]
    b[i] = c[i][2]-c[i][1]
    d[i] = c[1][i]-c[0][i]
    e[i] = c[2][i]-c[1][i]
    
if a[0] != a[1] or a[0] != a[2] or a[1] != a[2]:
    ok = False
elif b[0] != b[1] or b[0] != b[2] or b[1] != b[2]:
    ok = False
elif d[0] != d[1] or d[0] != d[2] or d[1] != d[2]:
    ok = False
elif e[0] != e[1] or e[0] != e[2] or e[1] != e[2]:
    ok = False

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

Solution (Python):
A = [[int(i) for i in input().split()] for i in range(3)]
diff1 = []
diff2 = []

for i in range(3):
    diff1.append(A[0][i] - A[1][i])
    
for i in range(3):
    diff2.append(A[1][i] - A[2][i])
    
if len(set(diff1)) == 1 and len(set(diff2)) == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
c = [list(map(int,input().split())) for i in range(3)]
a1,a2,a3,b1,b2,b3 = 0,c[1][0]-c[0][0],\
c[2][0]-c[0][0],c[0][0],c[0][1],c[0][2]

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

Solution (Python):
c = []

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

ok = False

if c[0][1] == c[1][1] + c[0][0] - c[1][0] and c[0][1] == c[2][1] + c[0][0] -c[2][0]:
    if c[0][2] == c[1][2] + c[0][0] - c[1][0] and c[0][2] == c[2][2] + c[0][0] -c[2][0]:
        ok = True

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

Solution (Python):


def main():
    c0 = [int(s) for s in input().split(' ')]
    c1 = [int(s) for s in input().split(' ')]
    c2 = [int(s) for s in input().split(' ')]

    if c0[0] + c1[1] == c0[1] + c1[0] \
    and c0[0] + c2[1] == c0[1] + c2[0] \
    and c0[0] + c1[2] == c0[2] + c1[0] \
    and c0[0] + c2[2] == c0[2] + c2[0]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    cs = [list(map(int, input().split())) for _ in range(3)]
    if cs[0][0] - cs[0][1] == cs[1][0] - cs[1][1] == cs[2][0] - cs[2][1] \
            and cs[0][0] - cs[0][2] == cs[1][0] - cs[1][2] == cs[2][0] - cs[2][2] \
            and cs[0][0] - cs[1][0] == cs[0][1] - cs[1][1] == cs[0][2] - cs[1][2] \
            and cs[0][0] - cs[2][0] == cs[0][1] - cs[2][1] == cs[0][2] - cs[2][2]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
[a, b, c,\
 d, e, f,\
 g, h, i] = map(int, open(0).read().split())

x1 = 0
[y1, y2, y3] = [a - x1, b - x1, c - x1]
[x1, x2, x3] = [a - y1, d - y1, g - y1]

good = [(e, f), (h, i)] == [(x2 + y2, x2 + y3), (x3 + y2, x3 + y3)]
if good:
    print('Yes')
else:
    print('No')

Solution (Python):
c = [list(map(int, input().split())) for _ in range(3)]
if all([c[i][j] - c[i][j + 1] == c[i + 1][j] - c[i + 1][j + 1]
        for i in range(2) for j in range(2)]):
    print('Yes')
else:
    print('No')

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 \
    and a - d == b - e == c - f and d - g == e - h == f - i else 'No')

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

can_ans = True
for i in range(1, 4):
    if c[i%3][0]-c[i-1][0] != c[i%3][1]-c[i-1][1] or c[i%3][1]-c[i-1][1] != c[i%3][2]-c[i-1][2]:
        can_ans = False

    if c[0][i%3]-c[0][i-1] != c[1][i%3]-c[1][i-1] or c[1][i%3]-c[1][i-1] != c[2][i%3]-c[2][i-1]:
        can_ans = False

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

Solution (Python):
import sys
c = []
for _ in range(3):
    c.append(map(int, raw_input().split()))
for i in range(3):
    for j in range(i):
        for k in range(3):
            for l in range(k):
                if not abs(c[k][i] - c[k][j]) == abs(c[l][i] - c[l][j]) or \
                   not abs(c[i][k] - c[j][k]) == abs(c[i][l] - c[j][l]):
                       print "No"
                       sys.exit()
print "Yes"

Solution (Python):
int_list=[]

list1=list(map(int,input().split()))
list2=list(map(int,input().split()))
list3=list(map(int,input().split()))

int_list=[list1,list2,list3]

if(sum(list1)+sum(list2)+sum(list3)==(int_list[0][0]+int_list[1][1]+int_list[2][2])*3):
    print("Yes")
else:
    print("No")

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

nlis = np.array(nlis)
for i in [nlis[2] - nlis[1],nlis[1] - nlis[0],nlis.T[2] - nlis.T[1],nlis.T[1] - nlis.T[0]]:
    if not (i[0] == i[1] and i[1] == i[2]):
        print('No')
        exit()
print('Yes')

Solution (Python):
area=[list(map(int,input().split())) for i in range(3)]
count=0
for a1 in range(area[0][0]+1):
  b1=area[0][0]-a1
  b2=area[0][1]-a1
  b3=area[0][2]-a1
  a2=area[1][0]-b1
  a3=area[2][0]-b1
  if b1>=0 and b2>=0 and b3>=0 and a2>=0 and a3>=0:
    if a2+b2== area[1][1]:
      if a2+b3==area[1][2]:
        if a3+b1==area[2][0]:
          if a3+b2==area[2][1]:
            if a3+b3==area[2][2]:
              print('Yes')
              exit()
print('No')

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

a1 = 0
b1 = row[0][0]
b2 = row[1][0]
b3 = row[2][0]

a2 = row[0][1] - b1
a3 = row[0][2] - b1

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

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

for a_1_1 in range(0,C[0][0] + 1):
    b = [c_1_j - a_1_1 for c_1_j in C[0]]
    a = [C[i][0] - b[0] for i in range(3)]
    
    C_empty = []
    for i in range(3):
        c = [a[i] + b[j] for j in range(3)]
        C_empty.append(c)
    if C == C_empty:
        print("Yes")
        exit()
print("No")

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

for i in range(3):
    row.append(sum(c[i])%3)

for i in range(3):
    tmp = 0
    for j in range(3):
        tmp += c[j][i]
    col.append(tmp%3)

if len(set(row)) == 1 and len(set(col)) == 1:
    print("Yes")
else:
    print("No")

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

Solution (Python):
def main():
    c = [list(map(int, input().split())) for i in range(3)]
    for x in range(101):
        b = (c[0][0] - x, c[0][1] - x, c[0][2] - x)
        a = (x, c[1][0] - b[0], c[2][0] - b[0])
        flag = True
        for i in (1, 2):
            for j in (1, 2):
                if a[i] + b[j] != c[i][j]:
                    flag = False
        if flag:
            return 'Yes'
    return 'No'

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

Solution (Python):
def confirm(a, b, c):
    for i in range(3):
        for j in range(3):
            if a[i] + b[j] != c[i][j]:
                return False
    return True


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

    for a1 in range(101):
        for a2 in range(101):
            for a3 in range(101):
                a = (a1, a2, a3)
                b = (c[0][0] - a1, c[0][1] - a1, c[0][2] - a1)
                if confirm(a, b, c):
                    return 'Yes'
    return 'No'


if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):

c = tuple(tuple(map(int, input().split())) for _ in range(3))
a1 = 0
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][0]-b1
a3 = c[2][0]-b1
if c[1][1]==a2+b2 and c[1][2]==a2+b3 and c[2][1]==a3+b2 and c[2][2]==a3+b3:
    print('Yes')
else:
    print('No')

Solution (Python):
C = []
for i in range(3):
    a,aa,aaa = (int(i) for i in input().split())
    C.append((a,aa,aaa))

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

Solution (Python):


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

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

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

flg = 0

for j in range(100):
	b1 = arr[0][0] - j
	a2 = arr[0][1] - b1
	a3 = arr[0][2] - b1
	b2 = arr[1][0] - j
	b3 = arr[2][0] - j
	if (arr[1][1] == b2 + a2) and \
	(arr[2][1] == b3 + a2) and \
	(arr[1][2] == b2 + a3) and \
	(arr[2][2] == b3 + a3):
		flg = 1

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

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

Solution (Python):
def inpl(): return [int(i) for i in input().split()]

c11, c12, c13 = inpl()
c21, c22, c23 = inpl()
c31, c32, c33 = inpl()
for a1 in range(1,101):
    b1 = c11-a1
    a2 = c21-b1
    a3 = c31-b1
    b2 = c12-a1
    b3 = c13-a1
    if a2+b2 != c22 or\
    a2+b3 != c23 or\
    a3+b2 != c32 or\
    a3+b3 != c33:
        continue
    print('Yes')
    break
else:
    print('No')

Solution (Python):
ar = [list(map(int,input().split(" "))),list(map(int,input().split(" "))),list(map(int,input().split(" ")))]
count = 0
if ar[0][0] - ar[0][1] == ar[1][0] - ar[1][1] and ar[1][0] - ar[1][1] == ar[2][0] - ar[2][1]:
    count += 1
if ar[0][1] - ar[0][2] == ar[1][1] - ar[1][2] and ar[1][1] - ar[1][2] == ar[2][1] - ar[2][2]:
    count += 1
if ar[0][0] - ar[1][0] == ar[0][1] - ar[1][1] and ar[0][1] - ar[1][1] == ar[0][2] - ar[1][2]:
    count += 1
if ar[1][0] - ar[2][0] == ar[1][1] - ar[2][1] and ar[1][1] - ar[2][1] == ar[1][2] - ar[2][2]:
    count += 1
if count == 4:
    print("Yes")
else:
    print("No")

Solution (Python):
matrix = [list(map(int,input().split())) for i in range(3)]
a_1 = 0
a_2 = matrix[1][0] - matrix[0][0]
a_3 = matrix[2][0] - matrix[0][0]
b_1 = matrix[0][0]
b_2 = matrix[0][1]
b_3 = matrix[0][2]

if a_2 + b_2 == matrix[1][1] and a_2 + b_3 == matrix[1][2] and a_3 + b_2 == matrix[2][1] and a_3 + b_3 == matrix[2][2]:
    print('Yes')
else:
    print('No')

Solution (Python):
C = [[int(_) for _ in input().split()] for _ in range(3)]
D = [(C[_][1]-C[_][0], C[_][2] - C[_][0]) for _ in range(3)]
if D[0] == D[1] and D[0] == D[2]:
    print('Yes')
else:
    print('No')

Solution (Python):

from sys import stdin
import numpy as np

s_in = lambda: stdin.readline()[:-1]  
d_in = lambda: int(stdin.readline())  
ds_in = lambda: list(map(int, stdin.readline().split()))  


c_list = []
for _ in range(3):
    c_list.append(ds_in())
c_list = np.array(c_list)

flag = 1
for i in [1, 2]:
    diff = c_list[i] - c_list[i-1]
    if diff[0] == diff[1] == diff[2]:
        continue
    else:
        flag = 0
        break

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

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

array = []
for i in c:
    array.append([i[0]-i[1], i[0]-i[2]])

print('Yes' if array[0] == array[1] and array[0] == array[2] else 'No')

Solution (Python):
c = [[0 for j in range(3)] for i in range(3)]

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

for i in range(3):
    if not c[i % 3][0] - c[(i + 1) % 3][0] == \
                    c[i % 3][1] - c[(i + 1) % 3][1] == \
                    c[i % 3][2] - c[(i + 1) % 3][2]:
        print("No")
        exit()
for i in range(3):
    if not c[0][i % 3] - c[0][(i + 1) % 3] == \
                    c[1][i % 3] - c[1][(i + 1) % 3] == \
                    c[2][i % 3] - c[2][(i + 1) % 3]:
        print("No")
        exit()
print("Yes")

Solution (Python):
c1=list(map(int,input().split()))
c2=list(map(int,input().split()))
c3=list(map(int,input().split()))
if c2[0]-c1[0]==c2[1]-c1[1]==c2[2]-c1[2] and c3[0]-c2[0]==c3[1]-c2[1]==c3[2]-c2[2] and 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]:
  print('Yes')
else:print('No')

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

for i in range(2):
    for j in range(2):
        if cells[i][j+1] - cells[i][j] == cells[i+1][j+1] - cells[i+1][j]:
            pass
        else:
            print('No')
            exit()
print('Yes')

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

f1 = abs(c11 - c21) == abs(c12 - c22) == abs(c13 - c23)
f2 = abs(c21 - c31) == abs(c22 - c32) == abs(c23 - c33)
f3 = abs(c11 - c12) == abs(c21 - c22) == abs(c31 - c32)
f4 = abs(c12 - c13) == abs(c22 - c23) == abs(c32 - c33)

if f1 and f2 and f3 and f4:
    print("Yes")
else:
    print("No")

Solution (Python):
from itertools import permutations
grid = []
for i in range(3):
    grid.append(list(map(int,input().split())))

A = []
B = []
for i in range(3):
    B.append(grid[0][i])
    A.append(grid[i][i]-B[i])

flag = True
for i in range(3):
    for j in range(3):
        if grid[i][j] != A[i] + B[j]:
            flag = False
            break
    if not flag: break

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

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

for a1 in range(101):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1
    if 0 <= b1 <= 100 or 0 <= b2 <= 100 or 0 <= b3 <= 100:
        if c[1][0] - b1 == c[1][1] - b2 == c[1][2] -b3 and 0<=c[1][0] <= 100 and c[2][0] - b1 == c[2][1] - b2 == c[2][2] -b3 and 0<=c[2][0] <= 100:
            print('Yes')
            break
else:
    print('No')

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

c -= np.min(c,axis=0)
c -= np.reshape(np.min(c,axis=1),(3, 1))

if(np.all(c==0)):
    print("Yes")
else:
    print("No")

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

frag = True
c = np.zeros((3,3))
for a1 in range(0,C[0][0] + 1):
  b1 = C[0][0] - a1
  b2 = C[1][0] - a1
  b3 = C[2][0] - a1
  a2 = C[0][1] - b1
  a3 = C[0][2] - b1
  c[:,0] += a1
  c[:,1] += a2
  c[:,2] += a3
  c[0,:] += b1
  c[1,:] += b2
  c[2,:] += b3
  
  frag = True
  for i in range(3):
    for j in range(3):
      if C[i][j] != c[i][j]:
        frag = False
  
  if frag:
    print("Yes")
    break
if frag == False:
  print("No")

Solution (Python):



import numpy as np

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

for i in range(3):
    c[i] -= min(c[i])
    
for i in range(3):
    c[:,i] -= min(c[:,i])
    
if(np.all(c==0)):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    C = []

    for _ in range(3):
        C.append(li_input())

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

    b1 = C[0][0]
    a2 = C[1][0] - b1
    a3 = C[2][0] - b1
    b2 = C[1][1] - a2
    b3 = C[2][2] - a3


    for i,a in enumerate([a1, a2, a3]):
        for j,b in enumerate([b1, b2, b3]):
            if C[i][j] != a + b:
                print("No")
                return

    print("Yes")


main()

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

Solution (Python):

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


ans = "Yes"

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

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

print(ans)

Solution (Python):
def solve(c1, c2, c3):
    if (c1[0] + c2[1] + c3[2]) * 3 == sum(c1) + sum(c2) + sum(c3):
        return "Yes"
    return "No"


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

Solution (Python):
s1,s2,s3 = map(int, input().split())
s4,s5,s6 = map(int, input().split())
s7,s8,s9 = map(int, input().split())

if s1-s4==s2-s5==s3-s6 and s4-s7==s5-s8==s6-s9:
  print("Yes")
else:
  print("No")

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


for i in range(2):
    for j in range(2):
        if L[i][j]-L[i][j+1]==L[i+1][j]-L[i+1][j+1]:
            pass
        else:
            print("No")
            exit()
for k in range(2):
    for l in range(2):
        if L[k][l]-L[k][l+1]==L[k+1][l]-L[k+1][l+1]:
            pass
        else:
            print("No")
            exit()
print("Yes")

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

a[0]=0
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]

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

Solution (Python):
grid = []
all = 0
for i in range(3):
    c1,c2,c3 = map(int,input().split(" "))
    all += c1
    all += c2
    all += c3
    grid.append([c1,c2,c3])
if (all//3 > 600)or(all < 0):
    print("No")
    exit()
else:
    for i in range(101):
        a1=i
        b1 = grid[0][0] - a1
        b2 = grid[0][1] - a1
        b3 = grid[0][2] - a1
        a2 = grid[1][0] - b1
        a3 = grid[2][0] - b1
        if (a2+b2==grid[1][1])and(a2+b3==grid[1][2])and(a3+b2==grid[2][1])and(a3+b3==grid[2][2]):
            print("Yes")
            exit()
print("No")

Solution (Python):
import copy
import sys
input=sys.stdin.readline

l=[list(map(int,input().split())) for i in range(3)]
a=l[0][0]-l[0][1]
b=l[0][1]-l[0][2]
c=l[0][0]-l[1][0]
d=l[1][0]-l[2][0]
for i in range(1,3):
    if a!=l[i][0]-l[i][1]:
        print('No')
        break
    elif b!=l[i][1]-l[i][2]:
        print('No')
        break
    elif c!=l[0][i]-l[1][i]:
        print('No')
        break
    elif d!=l[1][i]-l[2][i]:
        print('No')
        break
else:
    print('Yes')

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

b = [grid[0][0], grid[0][1], grid[0][2]]
a = [0, grid[1][0]-b[0], grid[2][0]-b[0]]
 
for i in range(1,3):
    for j in range(1,3):
        if grid[i][j] != a[i]+b[j]:
            print('No')
            exit()
print('Yes')

Solution (Python):
a=[list(map(int,input().split()))for i in range(3)]
s=a[0]+a[1]+a[2]
def f(i):
    return s[i]+s[i+2]-s[i-1]-s[i+3]
if f(1)==f(2)==f(4)==f(5)==0:
    print("Yes")
else:
    print("No")

Solution (Python):
a=[list(map(int,input().split()))for i in range(3)]
s=a[0]+a[1]+a[2]
def f(i):
    return s[i]+s[i+2]-s[i-1]-s[i+3]
if s[0]+s[4]+s[8]==sum(s)//3 and f(1)==0 and f(2)==0 and f(4)==0 and f(5)==0:
    print("Yes")
else:
    print("No")

Solution (Python):
a=[list(map(int,input().split()))for i in range(3)]
s=a[0]+a[1]+a[2]
def f(i):
    return s[i]+s[i+2]-s[i-1]-s[i+3]
if s[0]+s[4]+s[8]==sum(s)//3 and f(1)==0 and f(2)==0 and f(4)==0 and f(5)==0 and s[8]+s[0]==s[2]+s[6]:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

if(a[0] - b[0] == a[1] - b[1] == a[2]-b[2]):
    if(b[1]-c[1]==b[0]-c[0]==b[2]-c[2]):
        print("Yes")
        sys.exit()
print("No")

Solution (Python):
import sys
aC = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]












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

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

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

for i in range(1, len(c)):
    ss = c[i - 1][0] - c[i][0]
    for j in range(1, len(c[i])):
        if ss != c[i - 1][j] - c[i][j]:
            print('No')
            sys.exit(0)

for i in range(1, len(c[0])):
    ss = c[0][i - 1] - c[0][i]
    for j in range(1, len(c)):
        if ss != c[j][i - 1] - c[j][i]:
            print('No')
            sys.exit(0)
print('Yes')

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

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

b21, b32 = C[0][1] - C[0][0], C[0][2] - C[0][1]
a21, a32 = C[1][0] - C[0][0], C[2][0] - C[1][0]
for i in range(1, 3):
    if b21 != C[i][1] - C[i][0] or b32 != C[i][2] - C[i][1] or \
        a21 != C[1][i] - C[0][i] or a32 != C[2][i] - C[1][i]:
        print("No")
        break
else:
    print("Yes")

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

da = [c[0][0] - c[0][1], c[0][1] - c[0][2]]
db = [c[0][0] - c[1][0], c[1][0] - c[2][0]]

for i in range(3):
    if da != [c[i][0] - c[i][1], c[i][1] - c[i][2]]:
        ans += 1

for i in range(3):
    if db != [c[0][i] - c[1][i], c[1][i] - c[2][i]]:
        ans += 1 


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

Solution (Python):
import numpy as np

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

A = np.array([
    [1, 0, 0, 1, 0, 0],
    [1, 0, 0, 0, 1, 0],
    [1, 0, 0, 0, 0, 1],
    [0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 0],
    [0, 1, 0, 0, 0, 1],
    [0, 0, 1, 1, 0, 0],
    [0, 0, 1, 0, 1, 0],
    [0, 0, 1, 0, 0, 1]])

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

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    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()))
a1 = a[1]-a[0]
a2 = a[2]-a[1]
b1 = b[1]-b[0]
b2 = b[2]-b[1]
c1 = c[1]-c[0]
c2 = c[2]-c[1]
if (a1==b1) and (b1==c1) and (a2==b2) and (b2==c2):
    print('Yes')
else:
    print('No')