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):
def judge(c, north, west):
    if (c[north][west+1] - c[north][west]) != (c[north+1][west+1] - c[north+1][west]):
        return False
    elif (c[north+1][west] - c[north][west]) != (c[north+1][west+1] - c[north][west+1]):
        return False
    
    return True

def find_ans(c):
    for i in range(2):
        for j in range(2):
            if not judge(c,i,j):
                return False
            
    return True

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

if find_ans(c):
    print("Yes")
else:
    print("No")

Solution (Python):
C = [[0]*3]*3
for i in range(3):
    C[i] = list(map(int,input().split()))
ans = 'Yes'
for i in range(3):
    j = (i+1)%3
    if C[i][0] - C[j][0] == C[i][1] - C[j][1] and C[i][1] - C[j][1] == C[i][2] - C[j][2]:
        pass
    else:
        ans = 'No'
for i in range(3):
    j = (i+1)%3
    if C[0][i] - C[0][j] == C[1][i] - C[1][j] and C[1][i] - C[1][j] == C[2][i] - C[2][j]:
        pass
    else:
        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())

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

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

Solution (Python):
grid=[[0]*3 for i in range(3)]
for i in range(3):
    row=[int(k) for k in input().split()]
    for j in range(3):
        grid[i][j]=row[j]
sum1=grid[0][0]+grid[1][1]+grid[2][2]
sum2=grid[0][1]+grid[1][0]+grid[2][2]
sum3=grid[0][2]+grid[1][1]+grid[2][0]
sum4=grid[0][0]+grid[1][2]+grid[2][1]
if sum1==sum2 and sum2==sum3 and sum3==sum4:
    print('Yes')
else:
    print('No')

Solution (Python):



if __name__ == '__main__':
    C = [[-1 for i in range(3)] for j in range(3)]
    minv = 101
    min_a_i = -1  
    min_b_i = -1
    for a_i in range(3):
        lists = list(map(int, input().split()))
        for b_i in range(3):
            C[a_i][b_i] = lists[b_i]
            if lists[b_i] < minv:
                minv = lists[b_i]
                min_a_i = a_i
                min_b_i = b_i

    
    for v in range(0, minv+1):
        A = [-1]*3
        B = [-1]*3
        A[min_a_i] = v
        for b_i in range(3):
            B[b_i] = C[min_a_i][b_i] - v
        a_i = min_a_i
        for _ in range(2):
            a_i += 1
            if a_i == 3: a_i = 0
            A[a_i] = C[a_i][a_i] - B[a_i]
        
        ans = [[-1 for i in range(3)] for j in range(3)]
        for a_i in range(3):
            for b_i in range(3):
                ans[a_i][b_i] = A[a_i] + B[b_i]
        if ans == C:
            print("Yes")
            exit()
    print("No")

Solution (Python):



if __name__ == '__main__':
    C = [[-1 for i in range(3)] for j in range(3)]
    minv = 101
    min_a_i = -1  
    min_b_i = -1
    for a_i in range(3):
        lists = list(map(int, input().split()))
        for b_i in range(3):
            C[a_i][b_i] = lists[b_i]
            if lists[b_i] < minv:
                minv = lists[b_i]
                min_a_i = a_i
                min_b_i = b_i

    
    for v in range(0, minv+1):
        A = [-1]*3
        B = [-1]*3
        A[min_a_i] = v
        for b_i in range(3):
            B[b_i] = C[min_a_i][b_i] - v
        a_i = min_a_i
        for _ in range(2):
            a_i += 1
            if a_i == 3: a_i = 0
            A[a_i] = C[a_i][a_i] - B[a_i]
        
        ans = [[-1 for i in range(3)] for j in range(3)]
        for a_i in range(3):
            for b_i in range(3):
                ans[a_i][b_i] = A[a_i] + B[b_i]
        if ans == C:
            print("Yes")
            exit()
    print("No")

Solution (Python):


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


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

Solution (Python):


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


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

Solution (Python):
c = []
nil = [c.append([int(x) for x in input().split(" ")]) for y in range(3)]

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

Solution (Python):
def line_input(f, type):
    return f(map(type, input().split(" ")))

c = []
for _ in range(3):
    c.append(line_input(list, int))

def check(in_c):
    for bdx in range(3):
        if (in_c[bdx][0] - a1) == (in_c[bdx][1] - a2) == (in_c[bdx][2] - a3):
            pass
        else:
            return False

    return True


for a1 in range(100 + 1):
    for a2 in range(100 + 1):
        for a3 in range(100 + 1):
            if check(c):
                print("Yes")
                exit(0)
print("No")

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

Solution (Python):
import numpy as np
c=np.array([list(map(int,input().split())) for _ in range(3)])
flag = True
a=[c[0]-c[1],c[1]-c[2]]
c.transpose()
b=[c[0]-c[1],c[1]-c[2]]
for i in range(2):
    flag = flag and a[i][0]==a[i][1] and a[i][2]==a[i][1]
    flag = flag and b[i][0]==b[i][1] and b[i][2]==b[i][1]
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
c1=list(map(int,input().split()))
c1.append(c1[0])
c4=c1
c2=list(map(int,input().split()))
c2.append(c2[0])
c3=list(map(int,input().split()))
c3.append(c3[0])

c=[]
c.append(c1)
c.append(c2)
c.append(c3)
c.append(c1)

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

Solution (Python):
c = [list(map(int, input().split())) for i in range(3)]
combos = []
count = 0
for a in range(101):
  b1, b2, b3 = c[0][0] - a, c[0][1] - a, c[0][2] - a
  if b1 >= 0 and b2 >= 0 and b3 >= 0:
    combos.append([b1, b2, b3])

for combo in combos:
  b1, b2, b3 = combo
  count = 0
  for i in range(3):
    for a in range(101):
      if c[i][0] == a + b1 and c[i][1] == a + b2 and c[i][2] == a + b3:
        count += 1
        break
  if count == 3:
    break

if count == 3:
  print('Yes')
else:
  print('No')

Solution (Python):
import sys

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


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

print('No')

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

x=[[c[i][0]-c[i][1],c[i][1]-c[i][2]] for i in range(3)]
y=[[c[0][j]-c[1][j],c[1][j]-c[2][j]] for j in range(3)]

def f(l):
    return l[0]==l[1] and l[1]==l[2]
  
print(['No','Yes'][f(x) and f(y)])

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

L1 = [(i[1]-i[0],i[2]-i[0]) for i in c]
L2 = [(c[1][i] - c[0][i],c[2][i] - c[0][i]) for i in range(3)]
if (L1[0] == L1[1] == L1[2]) and (L2[0] == L2[1] == L2[2]):
    print('Yes')
else:
    print('No')

Solution (Python):
c = [list(map(int, input().split())) for _ 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):
from itertools import product, permutations, combinations, combinations_with_replacement

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

result = [c[i][j] - c[i+1][j] - c[i][j+1] + c[i+1][j+1]  for i,j in product(range(2),repeat=2)]
for i in result:
    if i!=0:
        print("No")
        exit()
print("Yes")

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

po = [[0,1],[0,2],[1,2]]
for m in po:
    tmp = [0,0,0]
    for i in range(3):
        tmp[i] = grid[m[1]][i] - grid[m[0]][i]

    if tmp[0] == tmp[1] == tmp[2]:
        pass
    else:
        flag = False
        break

for m in po:
    tmp = [0,0,0]
    for i in range(3):
        tmp[i] = grid[i][m[1]] - grid[i][m[0]]

    if tmp[0] == tmp[1] == tmp[2]:
        pass
    else:
        flag = False
        break

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

Solution (Python):
xs = [[int(x) for x in input().split()] for _ in range(3)]
ys = list(zip(*xs))

def check(row1, row2):
    return len(set(a-b for a,b in zip(row1, row2))) == 1

rowcheck = all(check(row1, row2) for row1, row2 in zip(xs, xs[1:]))
colcheck = all(check(col1, col2) for col1, col2 in zip(ys, ys[1:]))

print('Yes' if rowcheck and colcheck else 'No')

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

Solution (Python):

"""
Created on Fri Jun 15 11:27:37 2018

@author: Yuya

問題
3×3 のグリッドがあります. 上から i 番目で左から j 番目のマスを (i,j) で表すとき, マス (i,j) には数 ci,j が書かれています.
高橋君によると, 整数 a1,a2,a3,b1,b2,b3 の値が決まっており, マス (i,j) には数 ai+bj が書かれているらしいです.
高橋君の情報が正しいか判定しなさい. 

c1,1 c1,2 c1,3
c2,1 c2,2 c2,3
c3,1 c3,2 c3,3

入力
1 0 1
2 1 2
1 0 1

出力
Yes

"""

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

flag = 0

for a1 in range(C[0][0]+1):
    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] and a3+b2 == C[2][1] and a2+b3 == C[1][2] and a3+b3 == C[2][2]:
        flag = -1

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

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

a1=0
b1=gridNumber[0][0] - a1
b2=gridNumber[0][1] - a1
b3=gridNumber[0][2] - a1

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

numbers.append([a1+b1, a1+b2, a1+b3])
numbers.append([a2+b1, a2+b2, a2+b3])
numbers.append([a3+b1, a3+b2, a3+b3])

for i in range(3):
    for j in range(3):
        if not(numbers[i][j] == gridNumber[i][j]):
            print("No")
            quit()
        else:
            pass

print("Yes")

Solution (Python):
c1, c2, c3 = map(int, input().split())
c4, c5, c6 = map(int, input().split())
c7, c8, c9 = map(int, input().split())
if c4-c1==c5-c2 and c5-c2 == c6-c3 and c7-c4 ==c8-c5 and c8-c5 == c9-c6:
    if c2-c1 == c5-c4 and c5-c4 == c8-c7 and c3-c2 == c6-c5 and c6-c5 == c9-c8:
      print('Yes')
    else:print('No')
else:
  print('No')

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

for a1 in range(100+1):
    for b1 in range(100+1):
        if not a1 + b1 == c[0][0]:
            continue
        a2 = c[1][0] - b1
        b2 = c[0][1] - a1
        a3 = c[2][0] - b1
        b3 = c[0][2] - a1
        if a2 + b2 == c[1][1] and a2 + b3 == c[1][2] and a3 + b2 == c[2][1] and a3 + b3 == c[2][2]:
            print('Yes')
            exit()

print('No')

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

a = [0]
b = []
result = 'Yes'

b.append(C[0][0])
b.append(C[0][1])
b.append(C[0][2])
a.append(C[1][0] - b[0])
a.append(C[2][0] - b[0])

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

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

A = [-1, -1, -1]
B = [-1, -1, -1]

A[0] = 0

B[0] = matrix[0][0] - A[0]
B[1] = matrix[0][1] - A[0]
B[2] = matrix[0][2] - A[0]
A[1] = matrix[1][0] - B[0]
A[2] = matrix[2][0] - B[0]

i = 0
j = 0
flag = 0

for i in range(3):
    for j in range(3):
        if(matrix[i][j] != A[i] + B[j]):
            flag = 1

if(flag == 0):
    print("Yes")
elif(flag == 1):
    print("No")

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

Solution (Python):
prev = list(map(int, input().split()))
flag = True
for _ in range(2):
  cur = list(map(int, input().split()))
  if not (cur[0] - prev[0] == cur[1] - prev[1] == cur[2] - prev[2]):
    flag = False
print('Yes' if flag else 'No')

Solution (Python):


def main():
    L = [list(map(int, input().split())) for x in range(3)]
    b = L[0]
    a = [0, L[1][0] - b[0], L[2][0] - b[0]]
    for i in range(3):
        for j in range(3):
            if L[i][j] != a[i] + b[j]:
                print('No')
                return
    print('Yes')
    return
main()

Solution (Python):


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

res = True

diff = []
for row in range(3):
    diff.append([c[row][0]-c[row][1], c[row][1]-c[row][2], c[row][2]-c[row][0]])

for i in range(3):
    if not(diff[0][i] == diff[1][i] and diff[1][i] == diff[2][i]):
        res = False

diff = []
for col in range(3):
    diff.append([c[0][col]-c[1][col], c[1][col]-c[2][col], c[2][col]-c[0][col]])

for i in range(3):
    if not(diff[0][i] == diff[1][i] and diff[1][i] == diff[2][i]):
        res = False

if res == True:
    print('Yes')
else:
    print('No')

Solution (Python):
from itertools import permutations
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
S = sum([c[i][i] for i in range(3)])
perms = list(permutations([1, 2, 3], 3))


def judge(c, S):
    for p in perms:
        s = sum([c[i][p[i] - 1] for i in range(3)])
        if S != s:
            return "No"
    return "Yes"


print(judge(c, S))

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

for i in range(3):
    if i == 0:
        minList = C[i]
    else:
        for j in range(3):
            minList[j] = min(minList[j], C[i][j])

for i in range(3):
    diff = [x-y for (x,y) in zip(C[i], minList)]
    if diff[0] == diff[1] == diff[2]:
        if i == 2:
            print("Yes")
    else:
        print("No")
        break

Solution (Python):
from itertools import product

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

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

ans = 'Yes'
for i, j in product(range(3), range(3)):
    if(x[i] + y[j] != C[i][j]):
        ans = 'No'
        break
print(ans)

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

Solution (Python):
[(a,b,c),(d,e,f),(g,h,i)]=[map(int,input().split())for _ in [0]*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)]
for i in range(c[0][0]+1):
    b=[c[0][0]-i,c[0][1]-i,c[0][2]-i]
    a=[i,c[1][0]-b[0],c[2][0]-b[0]]
    t=1
    for j in range(3):
        for k in range(3):
            if c[j][k]!=a[j]+b[k]:
                t=0
                break
    if t:
        print('Yes')
        exit()
print('No')

Solution (Python):
c=[[int(i) for i in input().split()]for i in range(3)]
a=[0]*3
b=[0]*3
for i in range(3):
    for j in range(3):
        b[j]=c[i][j]-a[0]
for i in range(3):
    for j in range(3):
        a[j]=c[j][0]-b[0]
judge=True
for i in range(3):
    for j in range(3):
        if a[j]+b[i]!=c[j][i]:
            judge=False
if judge:
    print("Yes")
else:
    print("No")

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

def solve():
    if not (c1[0]-c1[1] == c2[0]-c2[1] == c3[0]-c3[1]): return False
    if not (c1[1]-c1[2] == c2[1]-c2[2] == c3[1]-c3[2]): return False
    if not (c1[0]-c2[0] == c1[1]-c2[1] == c1[2]-c2[2]): return False
    if not (c2[0]-c3[0] == c2[1]-c3[1] == c2[2]-c3[2]): return False
    return True
print('Yes' if solve() else 'No')

Solution (Python):
import sys

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

a = [0, 1, 2]
b = [0, 1, 2]

for i in range(3):
    for j in range(3):
        a_ = list(a)
        b_ = list(b)
        del a_[i]
        del b_[i]
        if C[a_[0]][b_[0]] + C[a_[1]][b_[1]] != C[a_[1]][b_[0]] + C[a_[0]][b_[1]]:
            print("No")
            sys.exit()

print("Yes")

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

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

a = []
b = []

a.append(0)
for i in range(n):
    b.append(c[0][i] - a[0])

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


ans = True
for i in range(n):
    for j in range(n):
        if(c[i][j] != (a[i] + b[j])):
            ans = False

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

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

right = 0
left = 0
for i in range(3):
    for j in range(3):
        if i == j:
            right += c[i][j]
        else:
            left += c[i][j]
if right * 2 == left:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
def c_takahashi_information(C):
    b = [C[0][i] - 0 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]:
                return 'No'
    return 'Yes'

C = [[int(i) for i in input().split()] for j in range(3)]
print(c_takahashi_information(C))

Solution (Python):
import sys

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

b = [c[0][0], c[0][1], c[0][2]]
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')
            sys.exit()
print('Yes')

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

if data[0][1]-data[0][0] != data[1][1]-data[1][0]:
    print('No')
    exit()
if data[0][2]-data[0][0] != data[1][2]-data[1][0]:
    print('No')
    exit()
if data[0][1]-data[0][0] != data[2][1]-data[2][0]:
    print('No')
    exit()
if data[0][2]-data[0][0] != data[2][2]-data[2][0]:
    print('No')
    exit()

print('Yes')

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

if c[0][0] + c[1][1] + c[2][2] == c[1][0] + c[2][1] + c[0][2] == c[2][0] + c[0][1] + c[1][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(3):
    flag = flag and (c[0][i]-c[0][i-1]==c[1][i]-c[1][i-1] == c[2][i]-c[2][i-1])
    flag = flag and (c[i][0]-c[i-1][0]==c[i][1]-c[i-1][1] == c[i][2]-c[i-1][2])
    if not flag:
        break
print("Yes" if flag else "No")

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

Solution (Python):
CC = []

for i in range(3):
    C = list(map(int,input().split()))
    C = list(map(lambda x:str(x-min(C)),C))
    CC.append(" ".join(C))
    
if len(set(CC))>1:
    print("No")
else:
    print("Yes")

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

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

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

Flag='No'

if c[1][0]-c[0][0] == c[1][1]-c[0][1] == c[1][2]-c[0][2]:
    if c[2][0]-c[0][0] == c[2][1]-c[0][1] == c[2][2]-c[0][2]:
        Flag='Yes'

print(Flag)

Solution (Python):
cs = []
for _ in range(3):
    c0, c1, c2 = input().split()
    cs.append([int(c0), int(c1), int(c2)])
flag = True
for i in range(3):
    for k in range(3):
        if i != k:
            for j in range(3):
                for l in range(3):
                    if j != l:
                        if cs[i][j] - cs[i][l] != cs[k][j] - cs[k][l]:
                            flag = False
                        if cs[i][j] - cs[k][j] != cs[i][l] - cs[k][l]:
                            flag = False
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
cs = []
for _ in range(3):
    c0, c1, c2 = input().split()
    cs.append([int(c0), int(c1), int(c2)])
flag = True
for i in range(3):
    for k in range(3):
        if i != k:
            for j in range(3):
                for l in range(3):
                    if j != l:
                        if cs[i][j] - cs[i][l] != cs[k][j] - cs[k][l]:
                            flag = False
                        if cs[i][j] - cs[k][j] != cs[i][l] - cs[k][l]:
                            flag = False
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
from sys import stdin


def main():
    c = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(3)]
    for x, y in [(0, 1), (1, 2), (2, 0)]:
        if not (c[0][x] - c[0][y] == c[1][x] - c[1][y] == c[2][x] - c[2][y]):
            print('No')
            break
        if not (c[x][0] - c[y][0] == c[x][1] - c[y][1] == c[x][2] - c[y][2]):
            print('No')
            break
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin


def main():
    c = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(3)]
    for a, b in [(0, 1), (1, 2), (2, 0)]:
        if (c[0][a] - c[0][b]) == (c[1][a] - c[1][b]) == (c[2][a] - c[2][b]):
            pass
        else:
            print('No')
            return

    for a, b in [(0, 1), (1, 2), (2, 0)]:
        if (c[a][0] - c[b][0]) == (c[a][1] - c[b][1]) == (c[a][2] - c[b][2]):
            pass
        else:
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()

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

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

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

t22 = c12+c21-c11
t32 = t22+c31-c21
t23 = t22+c13-c12
t33 = t23+t32-t22
t = [t22,t23,t32,t33]
c = [c22,c23,c32,c33]
flag = True
for i in range(0,4):
    if t[i]!=c[i]:
        flag = False

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

Solution (Python):
c = [[int(elem) for elem in input().split(' ')] for _ in range(3)]
assert len(c) == 3
assert len(c[0]) == 3

c_11 = c[0][0]
for a1 in range(c_11 + 1):
    b1 = c_11 - 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]):
        print("No")
        break
    else:
        print("Yes")
        break

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) == (c22 - c12) == (c23 - c13) and
    (c31 - c11) == (c32 - c12) == (c33 - c13)):
    print("Yes")

else:
    print("No")

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

def diff(row):
    min_num = min(row)
    return list(map(lambda c: c - min_num, row))

def main():
    ans = None
    prev = None
    while GRID:
        row = GRID.pop()
        curr = diff(row)
        if prev is None:
            prev = curr[:] 
        if curr != prev:
            ans = "No"
            break
    if ans is None:
        ans = "Yes"
    print(ans)

if __name__ == "__main__":
    main()

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

Solution (Python):
import numpy as np
c = np.array([list(map(int, input().split())) for i in range(3)])
c[0,:]-=c[2,:]
c[1,:]-=c[2,:]
c[2,:]-=c[2,:]
c[:,0]-=c[:,2]
c[:,1]-=c[:,2]
c[:,2]-=c[:,2]
if np.all(c==0):
    print('Yes')
else:
    print('No')

Solution (Python):
def six_integers(c):
    return 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] and \
        c[0][2] - c[0][0] == c[1][2] - c[1][0] == c[2][2] - c[2][0] and \
        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[2][0] - c[0][0] == c[2][1] - c[0][1] == c[2][2] - c[0][2]


if __name__ == '__main__':
    c = [list(map(int, input().split())) for _ in range(3)]
    print('Yes') if six_integers(c) 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())


a1 = c11
a2 = c21
a3 = c31

if (c12-a1 == c22-a2 and c22-a2==c32-a3 and c13-a1 == c23-a2 and c23-a2 == c33-a3) is True:
    print('Yes')
else:
    print('No')

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

Solution (Python):
c1 = list(int(i) for i in input().split())
c2 = list(int(i) for i in input().split())
c3 = list(int(i) for i in input().split())

flag1 = False
flag2 = False

for i in range(101):
    if c1[0]+i == c2[0] and c1[1]+i == c2[1] and c1[2]+i == c2[2]:
        flag1=True
    elif c1[0]-i == c2[0] and c1[1]-i == c2[1] and c1[2]-i == c2[2]:
        flag1=True
        
for i in range(101):
    if flag1 == True:
        if c1[0]+i == c3[0] and c1[1]+i == c3[1] and c1[2]+i == c3[2]:
            flag2=True
        elif c1[0]-i == c3[0] and c1[1]-i == c3[1] and c1[2]-i == c3[2]:
            flag2=True

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

Solution (Python):
def judge(c):
    
    a = [0]*3
    b = [0]*3
    
    for i in range(len(b)):
        b[i] = c[0][i]
    
    
    for i in range(1,len(a)):
        a[i] = c[i][i] - b[i]
        
        
    
    
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i]+b[j] is not c[i][j]:
                print("No")
                return 0
    
    print("Yes")
    return 0

def main():
    
    matrix = []
    for _ in range(3):
        matrix.append(list(map(int, input().split())))
        
    judge(matrix)
    
if __name__ == "__main__":
    main()

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

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

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

dy1,dy2 = C[1][0]-C[0][0], C[2][0]-C[1][0]
dx1,dx2 = C[0][1]-C[0][0], C[0][2]-C[0][1]

Ans = "Yes"
for i in range(1,3):
    if C[1][i]-C[0][i] != dy1 or C[2][i]-C[1][i] != dy2:
        Ans = "No"
        break
    if C[i][1]-C[i][0] != dx1 or C[i][2]-C[i][1] != dx2:
        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[1]-a[2] == b[1] - b[2] == c[1] - c[2]:
  print("Yes")
else:
  print("No")

Solution (Python):
c = [list(map(int, input().split())) for _ in range(3)]
a = [0,0,0]
b = [0,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]
for x in range(3):
    for y in range(3):
        if c[x][y] != (a[x]+b[y]):
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Solution (Python):


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

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

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

c = grid[0][0]
for i in range(c+1):
    a, b = [], []
    a.append(i)
    for j in range(3):
        b.append(grid[0][j]-a[0])

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

    for j in range(3):
        for k in range(3):
            if a[j]+b[k] != grid[j][k]:
                break

        else:
            continue
        break

    else:
        print("Yes")
        break

else:
    print("No")