Problem:
 Score: 300 points    Problem Statement  We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j) , where (i, j) denotes the square at the i -th row from the top and the j -th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j . Determine if he is correct.      Constraints   c_{i, j} \ (1 \leq i \leq 3, 1 \leq j \leq 3) is an integer between 0 and 100 (inclusive).         Input  Input is given from Standard Input in the following format:  c_{1,1}  c_{1,2}  c_{1,3}  c_{2,1}  c_{2,2}  c_{2,3}  c_{3,1}  c_{3,2}  c_{3,3}       Output  If Takahashi's statement is correct, print Yes ; otherwise, print No .        Sample Input 1 1 0 1
2 1 2
1 0 1      Sample Output 1 Yes  Takahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1 .       Sample Input 2 2 2 2
2 1 2
2 2 2      Sample Output 2 No  Takahashi is incorrect in this case.       Sample Input 3 0 8 8
0 8 8
0 8 8      Sample Output 3 Yes       Sample Input 4 1 8 6
2 9 7
0 7 7      Sample Output 4 No

Solution (Python):

C = []
for i in range(3):
    C.append(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] or C[i][j]-C[i+1][j]!=C[i][j+1]-C[i+1][j+1]:
            print("No")
            exit()
print("Yes")

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

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

Solution (Python):
c = [list(map(int, input().split())) for _ in range(3)]
b0 = c[0][0]
b1 = c[0][1]
b2 = c[0][2]
for i in range(1, 3):
    a0 = c[i][0] - b0
    a1 = c[i][1] - b1
    a2 = c[i][2] - b2
    if not a0 == a1 == a2:
        print('No')
        exit()
print('Yes')

Solution (Python):
C = []
for i in range(3) :
    C.append(list(map(int,input().split())))
for i in range(C[0][0]+1) :
    a1 = i
    b1 = C[0][0] - i
    b2 = C[0][1] - i
    b3 = C[0][2] - i
    a2 = C[1][0] - b1
    a3 = C[2][0] - b1
    flag = 0
    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
        break
if flag == 1 :
    print("Yes")
else :
    print("No")

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

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

for i in range(1, 3):
    if not ((c[i][0] - b0) == (c[i][1] - b1) and (c[i][1] - b1) == (c[i][2] - b2)):
        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())

d1,d2 = c12-c11, c13-c12
d3,d4 = c22-c21, c23-c22
d5,d6 = c32-c31, c33-c32

d7,d8,d9 = c21-c11,c22-c12,c23-c13
da,db,dc = c31-c21,c32-c22,c33-c23

if not(d1 == d3 == d5):
    print('No')
elif not(d2 == d4 == d6):
    print('No')
elif not(d7 == d8 == d9):
    print('No')
elif not(da == db == dc):
    print('No')
else:
    print('Yes')

Solution (Python):
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())

check=1

if b-a!=e-d or e-d!=h-g:
    check=0

if b-c!=e-f or e-f!=h-i:
    check=0

if d-a!=e-b or e-b!=f-c:
    check=0

if d-g!=e-h or e-h!=f-i:
    check=0


if check==1:
    print("Yes")

else:
    print("No")

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

c = []
for _ in range(3):
    c.append(list(li()))
    
correct = True
a1 = 0
a2 = c[1][0] - c[0][0]
a3 = c[2][0] - c[0][0]
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]

a = [a1,a2,a3]
b = [b1,b2,b3]

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

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

d = [list([c[i][j+1] - c[i][j] for j in range(2)]) for i in range(3)]

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

Solution (Python):

import itertools

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

sum = 0
for (a,b,c) in cn:
    sum += a+b+c

if sum % 3 != 0:
    print('No')
    exit()

c = list(itertools.combinations([0,1,2], 2))
for ((i1,i2),(j1,j2)) in itertools.product(c,c):
        sum2 = cn[i1][j1] + cn[i2][j1] + cn[i1][j2] + cn[i2][j2]
        if sum2 % 2 != 0:
            print('No')
            exit()

print('Yes')

Solution (Python):


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

sum = 0
for (a,b,c) in cn:
    sum += a+b+c

if sum % 3 != 0:
    print('No')
    exit()

for i in range(2):
    for j in range(2):
        sum2 = cn[i][j] + cn[i+1][j] + cn[i][j+1] + cn[i+1][j+1]
        if sum2 % 2 != 0:
            print('No')
            exit()


print('Yes')

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

c1 = C[0][0] + C[1][1] + C[2][2]
c2 = C[0][1] + C[1][2] + C[2][0]
c3 = C[0][2] + C[1][0] + C[2][1]
if c1 == c2 and c2 == c3:
	print("Yes")
else:
	print("No")

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

if c[0][0]-c[0][1] == c[1][0]-c[1][1] == c[2][0]-c[2][1]:
    if c[0][1]-c[0][2] == c[1][1]-c[1][2] == c[2][1]-c[2][2]:
        print("Yes")
        exit()

print("No")

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

flag = True
for i in [0,1]:
  for j in [0,1]:
    if c[i][j] + c[i+1][j+1] != c[i+1][j] + c[i][j+1]:
      flag = False
print("Yes" if flag else "No")

Solution (Python):

from sys import stdin

a = [[int(x) for x in stdin.readline().rstrip().split()] for l in range(3)]

for i in range(3):
    to101 = 101 - a[i][0]
    for j in range(3):
        a[i][j] += to101

for i in range(3):
    if a[0][i] != a[1][i] or a[0][i] != a[2][i]:
        print("No")
        exit()
print("Yes")

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

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

    
    dif0 = c[i + 1][0] - c[i][0]
    dif1 = c[i + 1][1] - c[i][1]
    dif2 = c[i + 1][2] - c[i][2]
    if dif0 == dif1 and dif1 == dif2:
        continue
    else:
        print("No")
        exit()

print("Yes")

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

d = []
for i in range(3):
	d.append([c[i][0]-c[i][1],c[i][1]-c[i][2]])
if d[0]==d[1]==d[2]:
	print("Yes")
else:
	print("No")

Solution (Python):
c = [list(map(int, 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
    a2 = c[1][0] - b1
    a3 = c[2][0] - b1
    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):
c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))

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

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

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

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

num1 = list_c[0][1] - list_c[0][0]
num2 = list_c[0][2] - list_c[0][0]
ans = "Yes"
for i in range(3):
    if not (list_c[i][0] + num1 == list_c[i][1] and list_c[i][0] + num2 == list_c[i][2]):
        ans = "No"
        break

print(ans)

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

b12 = c[0][1] - c[0][0] == c[1][1] - c[1][0] == c[2][1] - c[2][0]
b13 = c[0][2] - c[0][0] == c[1][2] - c[1][0] == c[2][2] - c[2][0]
a12 = c[1][0] - c[0][0] == c[1][1] - c[0][1] == c[1][2] - c[0][2]
a13 = c[2][0] - c[0][0] == c[2][1] - c[0][1] == c[2][2] - c[0][2]

print("Yes" if b12 and b13 and a12 and a13 else "No")

Solution (Python):
x=[]
y=[]
z=[]

for i in range(3):
    a,b,c=map(int,input().split())
    x.append(a-b)
    y.append(a-c)
    z.append(b-c)

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

Solution (Python):
L = []
for i in range(3) :
    L.append(list(map(int,input().split())))
flag = 0
for j in range(L[0][0]+1) :
    a1 = j
    b1 = L[0][0]-a1
    a2 = L[1][0]-b1
    b2 = L[1][1]-a2
    a3 = L[2][0]-b1
    b3 = L[2][2]-a3
    if (a1+b2) == L[0][1] and (a1+b3) == L[0][2] and (a2+b3) == L[1][2] and (a3+b2) == L[2][1] :
        flag += 1
        break
if flag == 1 :
    print("Yes")
else :
    print("No")

Solution (Python):
l=[]
for i in range(3):
  l1=list(map(int,input().split()))
  l.append(l1)
flag=0
y0=l[0][0]-0
y1=l[1][0]-0
y2=l[2][0]-0
x1=l[0][1]-y0
x2=l[0][2]-y0
if l[1][1]==y1+x1 and l[1][2]==y1+x2 and l[2][1]==y2+x1 and l[2][2]==y2+x2:
    flag=1
else:
    pass
if flag==1:
  print('Yes')
else:
  print('No')

Solution (Python):
l=[]
for i in range(3):
  l1=list(map(int,input().split()))
  l.append(l1)
flag=0
for i in range(-1000,1000,):
  y0=l[0][0]-i
  y1=l[1][0]-i
  y2=l[2][0]-i
  x1=l[0][1]-y0
  x2=l[0][2]-y0
  if l[1][1]==y1+x1 and l[1][2]==y1+x2 and l[2][1]==y2+x1 and l[2][2]==y2+x2:
    flag=1
  else:
    continue
if flag==1:
  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[2] - a[1] == b[2] - b[1] == c[2] - c[1]:
    print("Yes")
else:
    print("No")

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

for irow in range(len(c)-1):
    flag = False
    for mina in range(min(c[irow])):

        b_pre = [c[irow][i] - mina for i in range(3)]
        for i in range(irow+1):
            check = [c[i+1][j] - b_pre[j] for j in range(3)]
            if len(set(check)) != 1:
                flag = True
                
    if flag:
        print("No")
        exit()
print("Yes")

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            if (c[0][0] - a1 == c[1][0] - a2 and c[1][0] - a2 == c[2][0] - a3) \
                    and (c[0][1] - a1 == c[1][1] - a2 and c[1][1] - a2 == c[2][1] - a3) \
                    and (c[0][2] - a1 == c[1][2] - a2 and c[1][2] - a2 == c[2][2] - a3):
                print("Yes")
                exit()
print("No")

Solution (Python):
c1 = [int(v) for v in input().split()]
c2 = [int(v) for v in input().split()]
c3 = [int(v) for v in input().split()]

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

Solution (Python):
import numpy as np

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

if len(set(d[1]-d[0])) == 1 and len(set(d[2]-d[0])) == 1:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
f = lambda: list(map(int,input().split()))
c1 = f()
c2 = f()
c3 = f()
c12 = [c1[i]-c2[i] for i in range(3)]
c23 = [c2[i]-c3[i] for i in range(3)]
if all([c12[i] == c12[0] for i in range(3)]) and all([c23[i] == c23[0] for i in range(3)]):
    print('Yes')
else:
    print('No')

Solution (Python):
C = [[] for i in range(3)]
for i in range(3):
  C[i] = [int(x) for x in input().split()]
row = [[c - C[i][0] for c in C[i]] for i in range(3)]
C = list(zip(*C))
col = [[c - C[i][0] for c in C[i]] for i in range(3)]
for i in range(3):
  if row[0][i] != row[1][i] or row[0][i] != row[2][i]:
    print('No')
    break
  if col[0][i] != col[1][i] or col[0][i] != col[2][i]:
    print('No')
    break
else:
  print('Yes')

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

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

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

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

for j in range(2):
    diff = [0] * 3
    for i in range(3):
        diff[i] = C[i][j] - C[i][j+1]
    if diff[0] != diff[1] or diff[1] != diff[2]:
        print("No")
        sys.exit()
for j in range(2):
    diff = [0] * 3
    for i in range(3):
        diff[i] = C[j][i] - C[j+1][i]
    if diff[0] != diff[1] or diff[1] != diff[2]:
        print("No")
        sys.exit()
print("Yes")

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

c = [inpl() 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
	a2 = c[1][0]-b1
	a3 = c[2][0]-b1

	if c[1][1] != a2+b2: continue
	if c[1][2] != a2+b3: continue
	if c[2][1] != a3+b2: continue
	if c[2][2] != a3+b3: continue

	break
else:
	print('No')
	sys.exit()

print('Yes')

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):
C = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
  for j in range(2):
    if C[i][j] + C[i+1][j+1] != C[i][j+1] + C[i+1][j]:
      print('No')
      exit()
print('Yes')

Solution (Python):
c1_list = list(map(int, input().split()))
c2_list = list(map(int, input().split()))
c3_list = list(map(int, input().split()))

for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            b1 = c1_list[0] - a1
            b2 = c1_list[1] - a1
            b3 = c1_list[2] - a1
            if c2_list[0] == a2+b1 and c2_list[1] == a2+b2 \
                    and c2_list[2] == a2 + b3 and c3_list[0] == a3 + b1 \
                    and c3_list[1] == a3 + b2 and c3_list[2] == a3 + b3:
                print("Yes")
                exit()
print("No")

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

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

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

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

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


flg = True
for dj in range(2):
    t = c[0][1 + dj] - c[0][0 + dj]
    for i in range(3):
        if t != c[i][1 + dj] - c[i][0 + dj]:
            flg = False
            break
for di in range(2):
    t = c[1 + di][0] - c[0 + di][0]
    for j in range(3):
        if t != c[1 + di][j] - c[0 + di][j]:
            flg = False
            break
print('Yes' if flg else 'No')

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

def ok(a1, c):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1

    if len(set([c[1][0] - b1,  c[1][1] - b2,  c[1][2] - b3])) != 1:
        return False
    if len(set([c[2][0] - b1, c[2][1] - b2, c[2][2] - b3])) != 1:
        return False

    return True

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

    for a1 in range(101):
        if ok(a1, c):
            print(Yes)
            return
    print(No)

if __name__ == '__main__':
    main()

Solution (Python):
c = [list(map(int,input().split())) for _ in range(3)]
for i in range(2):
    x = c[0][i] - c[0][i+1]
    y = c[1][i] - c[1][i+1]
    z = c[2][i] - c[2][i+1]
    if not (x==y and y==z and z==x):
        print('No')
        exit()
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]
    if not (x==y and y==z and z==x):
        print('No')
        exit()
print('Yes')

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

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

for i in range(101):
    a1 = i
    b1 = c11 - a1
    b2 = c12 - a1
    b3 = c13 - a1
    a2 = c21 - b1
    a3 = c31 - b1
    
    if a2+b2 == c22 and a2+b3 == c23 and a3+b2 == c32 and a3+b3 == c33:
        print('Yes')
        sys.exit(0)
print('No')

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

a1 = sum(c[0])
a2 = sum(c[1])
a3 = sum(c[2])
b1 = sum([c[0][0], c[1][0], c[2][0]])
b2 = sum([c[0][1], c[1][1], c[2][1]])
b3 = sum([c[0][2], c[1][2], c[2][2]])

if (a1 - a2) % 3 == 0 and (a2 - a3) % 3 ==0 and (a3 - a1) % 3 ==0 and (b1-b2)%3 ==0 and (b2-b3)%3==0 and (b3-b1)%3==0:
    print('Yes')
else:
    print('No')

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

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

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

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

a1 = sum(c[0])
a2 = sum(c[1])
a3 = sum(c[2])
b1 = sum([c[0][0], c[1][0], c[2][0]])
b2 = sum([c[0][1], c[1][1], c[2][1]])
b3 = sum([c[0][2], c[1][2], c[2][2]])

if (a1 - a2) % 3 == 0 and (a2 - a3) % 3 ==0 and (a3 - a1) % 3 ==0 and (b1-b2)%3 ==0 and (b2-b3)%3==0 and (b3-b1)%3==0:
    print('Yes')
else:
    print('No')

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

def f():
    for i in range(3):
        for j in range(3):
            k = (i + 1) % 3
            l = (j + 1) % 3
            if C[i][j] - C[i][(j + 1) % 3] != C[k][j] - C[k][l]:
                return False
    return True
            
print("Yes" if f() else "No")

Solution (Python):
C = []
for i in range(3):
  C.append(map(int, raw_input().split()))
r = 'Yes'
for i in range(1,3):
  for j in range(1,3):
    if C[i][j] != C[i][0] + (C[0][j]-C[0][0]):
      r = 'No'
print r

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

for i in range(3):
    for j in range(3):
        if x[i]+y[j] != c[i][j]:
            print("No")
            exit(0)

print("Yes")
exit(0)

Solution (Python):
def main():
    c = []
    for i in range(3):
        t = input().split(" ")
        c.append([int(i) for i in t])

    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(1,3):
        if c[i][0] - c[i][1] != da[0]:
            print("No")
            return
        if c[i][1] - c[i][2] != da[1]:
            print("No")
            return
        if c[0][i] - c[1][i] != db[0]:
            print("No")
            return
        if c[1][i] - c[2][i] != db[1]:
            print("No")
            return
    for i in range(2):
        for j in range(2):
            if c[i][j] + c[i+1][j+1] != c[i+1][j] + c[i][j+1]:
                print("No")
                return
    print("Yes")
main()

Solution (Python):
import itertools
import numpy as np

C = np.zeros((3, 3), dtype=int)

C[0][0], C[0][1], C[0][2] = map(int, input().split())
C[1][0], C[1][1], C[1][2] = map(int, input().split())
C[2][0], C[2][1], C[2][2] = map(int, input().split())



for x in range(3):
    for y in range(3):
        if not ((C[x][0] - C[y][0]) == (C[x][1] - C[y][1]) and \
            (C[x][0] - C[y][0]) == (C[x][2] - C[y][2])):
            print('No')
            exit(0)

for x in range(3):
    for y in range(3):
        if not ((C[0][x] - C[0][y]) == (C[1][x] - C[1][y]) and \
            (C[0][x] - C[0][y]) == (C[2][x] - C[2][y])):
            print('No')
            exit(0)

print('Yes')

Solution (Python):
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print("Yes" if a[0]-b[0]==a[1]-b[1]==a[2]-b[2] and a[0]-c[0]==a[1]-c[1]==a[2]-c[2] else "No")

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

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

if c[1][2] - c[1][0] != b or c[1][1] - c[1][0] != a:
    print("No")
elif c[2][2] - c[2][0] != b or c[2][1] - c[2][0] != a:
    print("No")
else:
    print("Yes")

Solution (Python):
C=[list(map(int, input().split())) for _ in range(3)]
is_Yes=0
a=[0]*3
for i in range(3):
    a[i]=C[i][1]-C[i][0]
if a[0]==a[1]==a[2]:
    for i in range(3):
        a[i]=C[i][1]-C[i][2]
    if a[0]==a[1]==a[2]:
        for i in range(3):
            a[i]=C[1][i]-C[0][i]
        if a[0]==a[1]==a[2]:
            for i in range(3):
                a[i]=C[i][2]-C[i][1]
            if a[0]==a[1]==a[2]:
                print("Yes")
                is_Yes=1
if is_Yes==0:
    print("No")

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

bi_list = []
for b1 in range(-50000, 50000):
    b2 = b1 - (cij[0][0] - cij[0][1])
    b3 = b1 - (cij[0][0] - cij[0][2])

    a1 = cij[0][0]+cij[0][1]+cij[0][2] -b1-b2-b3
    a2 = cij[1][0]+cij[1][1]+cij[1][2] -b1-b2-b3
    a3 = cij[2][0]+cij[2][1]+cij[2][2] -b1-b2-b3
    if a1/3+b1 ==cij[0][0] and a1/3+b2 ==cij[0][1] and a1/3+b3 ==cij[0][2] and a2/3+b1 ==cij[1][0] and a2/3+b2 ==cij[1][1] and a2/3+b3 ==cij[1][2] and a3/3+b1 ==cij[2][0] and a3/3+b2 ==cij[2][1] and a3/3+b3 ==cij[2][2]:
            print("Yes")
            exit()

print("No")

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

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

Solution (Python):
c = []
for i in range(3):
    c.append(list(map(int,input().split())))
flg = False
for a1 in range(101):
    for b1 in range(101):
        if c[0][0] != a1 + b1:
            continue
        for a2 in range(101):
            if c[1][0] != a2 + b1:
                continue
            for b2 in range(101):
                if c[0][1] != a1 + b2:
                    continue
                if c[1][1] != a2 + b2:
                    continue
                for a3 in range(101):
                    if c[2][0] != a3 + b1:
                        continue
                    if c[2][1] != a3 + b2:
                        continue
                    for b3 in range(101):
                        if c[0][2] != a1 +b3:
                            continue
                        if c[1][2] != a2 + b3:
                            continue
                        if c[2][2] != a3 + b3:
                            continue
                        flg = True

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

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

c_rotated = zip(*c)
c_rotated = [[n-min(v_line) for n in v_line] for v_line in c_rotated]
c = zip(*c_rotated[::-1])
c = [[n-min(line) for n in line] for line in c]
print("No" if any([any(c_i) for c_i in c]) else "Yes")

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

Solution (Python):
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
func=lambda x:x%3==0

aa=func(a+b+c-d-e-f)
bb=func(a+b+c-g-h-i)
cc=func(a+d+g-b-e-h)
dd=func(a+d+g-c-f-i)
if aa and bb and cc and dd:
  print("Yes")
else:
  print("No")

Solution (Python):
C = [list(map(int,input().split(" "))) for i in range(3)]
r = max(max(C))+1
flag = False
for a1 in range(r):
    for a2 in range(r):
        for a3 in range(r):
            if list(map(lambda x:x-a1,C[0])) == list(map(lambda x:x-a2,C[1])) and list(map(lambda x:x-a2,C[1]))  == list(map(lambda x:x-a3,C[2])):
                flag = True
                break
if flag:
    print("Yes")
else:
    print("No")

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

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

p = c[0][1] - c[0][0]
q = c[0][2] - c[0][1]
r = c[1][0] - c[0][0]
s = c[2][0] - c[1][0]

flg = True
for i in range(1, 3):
    if (p != c[i][1] - c[i][0]) or (q != c[i][2] - c[i][1]) or (r != c[1][i] - c[0][i]) or (s != c[2][i] - c[1][i]):
        flg = False
        break
print('Yes' if flg else 'No')

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

ans = 'Yes'

b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]

a1 = 0
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]):
    ans = 'No'

print(ans)

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

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

Solution (Python):


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

if __name__ == '__main__':
    main()

Solution (Python):
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())
def solve():
    if not (c11-c12 == c21-c22 == c31-c32):
        return False
    if not (c12-c13 == c22-c23 == c32-c33):
        return False
    if not (c11-c21 == c12-c22 == c13-c23):
        return False
    if not (c21-c31 == c22-c32 == c23-c33):
        return False
    return True

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

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

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

Solution (Python):
d = list(map(int,input().split()))
e = list(map(int,input().split()))
f = list(map(int,input().split()))


k =0
for i in range(0,2):
        if d[i+1]-d[i]==e[i+1]-e[i]==f[i+1]-f[i]:
            k = k + 1
            
if d[0]-e[0]==d[1]-e[1]==d[2]-e[2] and d[0]-f[0] == d[1]-f[1] == d[2]-f[2]:
    k = k+1
    
if d[0] + f[2] == d[2] + f[0]:
    k = k +1
    

if k == 4:
    print('Yes')
else:
    print('No')