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):
n = 3
rows = [list(map(int, input().split())) for i in range(n)]
nums = rows[0] + rows[1] + rows[2]
isTrue = False
if nums[0]-nums[1] == nums[3]-nums[4] == nums[6]-nums[7] and nums[0]-nums[3] == nums[1]-nums[4] == nums[2]-nums[5]:
    isTrue = True
else:
    isTrue = False
if nums[1]-nums[2] == nums[4]-nums[5] == nums[7]-nums[8] and nums[3]-nums[6] == nums[4]-nums[7] == nums[5]-nums[8]:
    isTrue = True
else:
    isTrue = False
if isTrue:
    print("Yes")    
else:
    print("No")

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

for i in range(3):
    for j in range(3):
        if ls[i % 3][j % 3] - ls[i % 3][(j+1) % 3] == ls[(i+1) % 3][j % 3] - ls[(i+1) % 3][(j+1) % 3]:
            cnt += 1

print('Yes' if cnt == 9 else 'No')

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

print('Yes') if a-d == b-e == c-f and d-g == e-h == f-i 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]-b[0] == a[1]-b[1] == a[2]-b[2] and b[0]-c[0] == b[1]-c[1] == b[2]-c[2]:
    print('Yes')
else:
    print('No')

Solution (Python):
import copy


def check(l):
    return l[0] == l[1] == l[2]


lst = []
for _ in range(3):
    lst.append([int(x) for x in input().split()])

for i in range(3):
    l = copy.deepcopy(lst)

    l[0][0] -= i
    l[0][1] -= i
    l[0][2] -= i
    if l[0][0] < 0 or l[0][1] < 0 or l[0][2] < 0:
        continue

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

    l[1][0] -= b1
    l[1][1] -= b2
    l[1][2] -= b3
    l[2][0] -= b1
    l[2][1] -= b2
    l[2][2] -= b3

    if check(l[1]) and check(l[2]):
        print("Yes")
        exit()

print("No")

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

Solution (Python):
def main():
    c = [list(map(int, input().split())) for _ in range(3)]
    N = 100
    for i in range(-N, N+1):
        for j in range(-N, N+1):
            for k in range(-N, N+1):
                if c[0][0] - i == c[0][1] - j == c[0][2] - k:
                    if c[1][0] - i == c[1][1] - j == c[1][2] - k:
                        if c[2][0] - i == c[2][1] - j == c[2][2] - k:
                            print('Yes')
                            return
    print('No')
main()

Solution (Python):
c = []
for i in range(3):
    c.append(list(map(int,input().split())))
ans = "Yes"
for i in range(3):
    for j in range(i+1,3):
        tmp = []
        for h in range(3):
            tmp.append(c[h][i]-c[h][j])
        if len(set(tmp)) != 1:
            ans = "No"
            break

print(ans)

Solution (Python):
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
if not c1[0]-c1[1] == c2[0]-c2[1] == c3[0]-c3[1]:
    print('No')
    exit()
if not c1[2]-c1[1] == c2[2]-c2[1] == c3[2]-c3[1]:
    print('No')
    exit()
if not c1[0]-c2[0] == c1[1]-c2[1] == c1[2]-c2[2]:
    print('No')
    exit()
if not c3[0]-c2[0] == c3[1]-c2[1] == c3[2]-c2[2]:
    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())
ma1 = max(c11, c12, c13) + 1
ma2 = max(c21, c22, c23) + 1
ma3 = max(c31, c32, c33) + 1
mb1 = max(c11, c21, c31) + 1
mb2 = max(c12, c22, c32) + 1
mb3 = max(c13, c23, c33) + 1
for a1 in range(ma1):
    for b1 in range(mb1):
        if a1 + b1 != c11:
            continue
        for a2 in range(ma2):
            if a2 + b1 != c21:
                continue
            for b2 in range(mb2):
                if a1 + b2 != c12 or a2 + b2 != c22:
                    continue
                for a3 in range(ma3):
                    if a3 + b1 != c31 or a3 + b2 != c32:
                        continue
                    for b3 in range(mb3):
                        if a1 + b3 != c13 or a2 + b3 != c23 or a3 + b3 != c33:
                            continue
                        print('Yes')
                        exit()
print('No')

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

for i in range(3):
    for j in range(3):
        if al[i]+bl[j]!=l[i][j]:print("No");exit()
print("Yes")

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

Solution (Python):
def main():
  c = []
  for _ in range(3):
    c.append(list(input_list()))
  
  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 a1+b1 == c[0][0] and a1+b2 == c[0][1] and a1+b3 == c[0][2] and\
    a2+b1 == c[1][0] and a3+b1 == c[2][0] and 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')
    
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
import collections
from functools import reduce
main()

Solution (Python):
matrix = [0]*3
for i in range(3):
    matrix[i] = [int(j) for j in input().split()]
for a1 in range(101):
    for b1 in range(101):
        a2 = matrix[1][0]-b1
        a3 = matrix[2][0]-b1
        b2 = matrix[0][1]-a1
        b3 = matrix[0][2]-a1
        if matrix[1][1]==a2+b2 and matrix[1][2]==a2+b3 and matrix[2][1]== a3+b2 and matrix[2][2] == a3+b3:
            print("Yes")
            exit()
print("No")

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

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

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

ans = "Yes"

for i in range(3):
    if not c[1][0] - b[0] == c[1][1] - b[1] == c[1][2] - b[2]:
        ans = "No"
    if not c[2][0] - b[0] == c[2][1] - b[1] == c[2][2] - b[2]:
        ans = "No"
print(ans)

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

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

ans = True

for i in range(2):
    if (c[0][i] - c[0][i+1]) == (c[1][i] - c[1][i+1]) == (c[2][i] - c[2][i+1]):
        pass
    else:
        ans = False
        break
for i in range(2):
    if (c[i][0] - c[i+1][0]) == (c[i][1] - c[i+1][1]) == (c[i][2] - c[i+1][2]):
        pass
    else:
        ans = False
        break

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

Solution (Python):
c=[]

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

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

if S%3!=0:
    ans="No"
if (a[0]-a[1])%3!=0 or (a[1]-a[2])%3!=0 or (a[2]-a[0])%3!=0:
    ans="No"
elif (b[0]-b[1])%3!=0 or (b[1]-b[2])%3!=0 or (b[2]-b[0])%3!=0:
    ans="No"
elif c[0][0]+c[1][1]+c[2][2]!=S//3:
    ans="No"
else:
    ans="Yes"
print(ans)

Solution (Python):

a=[]
for i in range(3):
    line=list(map(int,input().split()))
    a.append(line)
r=[]
g=[]
for i in range(3):
    x=a[0][i]
    r.append(x)
    y=a[i][0]-a[0][0]
    g.append(y)
g[0]=0
flag=True
for i in range(3):
    for j in range(3):
        if a[i][j]!=(g[i]+r[j]):
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
c=[list(map(int,input().split())) for _ in [0]*3]
x1,x2,y1,y2=c[0][0]-c[0][1],c[0][1]-c[0][2],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]!=x1 or c[i][1]-c[i][2]!=x2:
    print('No')
    exit()
  if c[0][i]-c[1][i]!=y1 or c[1][i]-c[2][i]!=y2:
    print('No')
    exit()
print('Yes')

Solution (Python):
c=[list(map(int,input().split())) for _ in range(3)]
S=0
for i in range(3):
    S+=sum(c[i])
ans="No"
if S%3==0:
    tmp=S//3
    tmp1=c[0][0]+c[1][1]+c[2][2]
    tmp2=c[0][1]+c[1][2]+c[2][0]
    tmp3=c[0][2]+c[1][0]+c[2][1]
    tmp4=c[0][2]+c[1][1]+c[2][0]
    tmp5=c[0][1]+c[1][0]+c[2][2]
    tmp6=c[0][0]+c[1][2]+c[2][1]
    if tmp==tmp1 and tmp==tmp2 and tmp==tmp3 and tmp==tmp4 and tmp==tmp5 and tmp==tmp6:
        ans="Yes"
print(ans)

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

Flg = True

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

Solution (Python):



def main():
    
    a = [[0] * 3 for i in range(3)]
    a[0] = list(map(int, input().split()))
    a[1] = list(map(int, input().split()))
    a[2] = list(map(int, input().split()))

    

    for i in range(3):
        minum = min(a[i])
        for j in range(3):
            a[i][j] = a[i][j] - minum
    

    ans = True

    for i in range(3):
        if a[0][i] != a[1][i] or a[1][i] != a[2][i]:
            ans = False
    

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


main()

Solution (Python):
c = [[int(i) for i in input().split()] for _ in range(3)]
 
h1 = c[1][0] - c[0][0] == c[1][1] - c[0][1] == c[1][2] - c[0][2]
h2 = c[2][0] - c[1][0] == c[2][1] - c[1][1] == c[2][2] - c[1][2]
w1 = c[0][1] - c[0][0] == c[1][1] - c[1][0] == c[2][1] - c[2][0]
w2 = c[0][2] - c[0][1] == c[1][2] - c[1][1] == c[2][2] - c[2][1]

if h1 and h2 and w1 and w2 :
    print('Yes')
else :
    print('No')

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

a2 = l[0][1] - l[0][0]
a3 = l[0][2] - l[0][0]
b2 = l[1][0] - l[0][0]
b3 = l[2][0] - l[0][0]

is_takahashi_true = True

for i in range(1, 3):
    ta2 = l[i][1] - l[i][0]
    ta3 = l[i][2] - l[i][0]
    tb2 = l[1][i] - l[0][i]
    tb3 = l[2][i] - l[0][i]
    if a2 != ta2 or a3 != ta3 or b2 != tb2 or b3 != tb3:
        is_takahashi_true = False

print("YNeos"[not is_takahashi_true::2])

Solution (Python):
import sys
import numpy as np

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

a = np.empty(3)
b = np.empty(3)
c_n = np.array(c)

for a1 in range(101):
    a[0] = a1
    
    b = c_n[0, :] - a1
    
    a[1:] = c_n[1:, 0] - b[0]
    if a.min() < 0 or b.min() < 0:
        
        continue
    ab = a.reshape(3, 1) + b.reshape(1, 3)
    if np.all(c_n == ab):
        
        print("Yes")
        break
else:
    print("No")

Solution (Python):
import sys
import numpy as np

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

for a1 in range(101):
    
    b1, b2, b3 = c[0][0]-a1, c[0][1]-a1, c[0][2]-a1
    if b1 < 0 or b2 < 0 or b3 < 0:
        
        continue
    
    a2, a3 = c[1][0]-b1, c[2][0]-b1
    if a2 < 0 or a3 < 0:
        
        continue
    
    
    if a2 + b2 != c[1][1] or a2 + b3 != c[1][2]:
        
        continue
    
    if a3 + b2 != c[2][1] or a3 + b3 != c[2][2]:
        
        continue
    
    print("Yes")
    break
else:
    print("No")

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


flag = True
if not C[0][0] - C[0][1] == C[1][0] - C[1][1] == C[2][0] - C[2][1]:
    flag = False
if not C[0][1] - C[0][2] == C[1][1] - C[1][2] == C[2][1] - C[2][2]:
    flag = False


print("Yes" if flag is True else "No")

Solution (Python):
import numpy as np

c = np.array([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 i in range(3):
    x[i] = c[i][0] - y[0]
flag = True

for i in range(3):
    for j in range(3):
        if x[i] + y[j] != c[i][j]:
            flag = False

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

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

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

Solution (Python):
res = 0
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
for j in range(2):
  s = a[0][j] - a[0][j+1]
  t = a[1][j] - a[1][j+1]
  u = a[2][j] - a[2][j+1]
  if s == t and t == u:
    res = res + 1
for j in range(2):
  s = a[j][0] - a[j+1][0]
  t = a[j][1] - a[j+1][1]
  u = a[j][2] - a[j+1][2]
  if s == t and t == u:
    res = res + 1
if res == 4:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
C = [[0]*3 for _ in range(3)]
for i in range(3):
  C[i] = list(map(int,input().split()))
  
d = [[0]*3 for _ in range(2)]
for i in range(2):
  for j in range(3):
    d[i][j] = C[i+1][j] - C[i][j]

for i in range(2):
  for j in range(2):
    if d[i][j] != d[i][j+1]:
      print("No")
      exit()

print("Yes")

Solution (Python):
import numpy as np

c = np.array([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 i in range(3):
    x[i] = c[i][0] - y[0]
flag = True

for i in range(3):
    for j in range(3):
        if x[i] + y[j] != c[i][j]:
            flag = False

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

Solution (Python):
c=[list(map(int,input().split())) for _ in range(3)]
yoko=[c[0][1]-c[0][0],c[0][2]-c[0][1]]
tate=[c[1][0]-c[0][0],c[2][0]-c[1][0]]
flag=1
for i in range(1,3):
 if not((c[i][1]-c[i][0]==yoko[0])and(c[i][2]-c[i][1]==yoko[1])):
  flag=0
 if not((c[1][i]-c[0][i]==tate[0])and(c[2][i]-c[1][i]==tate[1])):
  flag=0

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

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

Solution (Python):
c = [input().split() for i in range(3)]
for i in range(3):
    for j in range(3):
        c[i][j] = int(c[i][j])
for i in range(100):
    for j in range(100):
        if i + j == c[0][0]:
            a0, b0 = i, j
            a1, b1 = c[1][0]-b0, c[0][1]-a0
            a2, b2 = c[2][0]-b0, c[0][2]-a0
            if (a1+b1 == c[1][1])and(a1+b2==c[1][2])and(a2+b1==c[2][1])and(a2+b2==c[2][2]):
                print("Yes")
                exit()
print("No")

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

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

A = {i : -1 for i in range(3)}
B = {i : -1 for i in range(3)}

checker =False
for a1 in range(100):
  A[0] = a1
  B[0] = M[0][0] - a1
  B[1] = M[0][1] - a1
  B[2] = M[0][2] - a1
  A[1] = M[1][0] - B[0]
  A[2] = M[2][0] - B[0]
  
  cnt=0
  for i in range(3):
    for j in range(3):
      if M[i][j] == A[i] + B[j]:
        cnt += 1
  if cnt == 9:
    checker =True
    
    break
  
if checker:
  print('Yes')
else:
  print('No')

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


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

ans = 'No'
if a[0] == a[1] and a[0] == a[2] and a[3] == a[4] and a[3] == a[5]:
	if b[0] == b[1] and b[0] == b[2] and b[3] == b[4] and b[3] == b[5]:
		ans = 'Yes'

print(ans)

Solution (Python):
c = []
for i in range(3):
  c.append(list(map(int, input().split())))
a = [c[0][1]-c[0][0], c[0][2]-c[0][1]]
b = [c[1][0]-c[0][0], c[2][0]-c[1][0]]
f = True
for i in range(3):
  t = []
  for j in range(2):
    t.append(c[i][j+1] - c[i][j])
  if a != t:
    f = False

for i in range(3):
  t = []
  for j in range(2):
    t.append(c[j+1][i] - c[j][i])
  if b != t:
    f = False
if f: print("Yes")
else: print("No")

Solution (Python):
import numpy as np
import sys


def validation(c, a, b):
    for i in range(3):
        for j in range(3):
            if c[i][j] != a[i] + b[j]:
                print('No')
                return sys.exit()
    print('Yes')
    return sys.exit()


c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = np.array([c_1, c_2, c_3])
for i in range(np.max(c)+1):
    a = []
    b = []
    a.append(i)
    b.append(c[0][0] - a[0])
    b.append(c[0][1] - a[0])
    b.append(c[0][2] - a[0])
    a.append(c[1][0] - b[0])
    a.append(c[2][0] - b[0])
    validation(c, a, b)

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

Solution (Python):
import numpy as np
import sys


def validation(c, a, b):
    for i in range(3):
        for j in range(3):
            if c[i][j] != a[i] + b[j]:
                return False
    print('Yes')
    sys.exit()
    return True


c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = np.array([c_1, c_2, c_3])
for i in range(101):
    a = []
    b = []
    a.append(i)
    b.append(c[0][0] - a[0])
    b.append(c[0][1] - a[0])
    b.append(c[0][2] - a[0])
    a.append(c[1][0] - b[0])
    a.append(c[2][0] - b[0])
    validation(c, a, b)
print('No')

Solution (Python):
mat = [list(map(int, input().split())) for _ in range(3)]
checks = [[0,1],[0,2],[1,2]]

for i,j in checks:
    if mat[i][i]+mat[j][j] != mat[i][j] + mat[j][i]:
        print('No')
        exit()

print('Yes')

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

for i in range(1):
    q=deque([C[0][0]-i,C[0][1]-i,C[0][2]-i,C[0][0]-i,C[0][1]-i,C[0][2]-i])
    flag=0
    for j in range(1,3):
        d=set()
        for k in range(3):
            d.add(C[j][k]-q.popleft())
        if len(d)==1:
            flag+=1
    if flag==2:
        print('Yes')
        exit()

print('No')

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

for i in range(C[0][0]+1):
    q=deque([C[0][0]-i,C[0][1]-i,C[0][2]-i,C[0][0]-i,C[0][1]-i,C[0][2]-i])
    flag=0
    for j in range(1,3):
        d=set()
        for k in range(3):
            d.add(C[j][k]-q.popleft())
        if len(d)==1:
            flag+=1
    if flag==2:
        print('Yes')
        exit()

print('No')

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

import sys

a1 = max(C[0])
a2 = max(C[1])
a3 = max(C[2])

for i in range(a1+1):
    for j in range(a2+1):
        for k in range(a3+1):
            if C[0][0] - i == C[1][0] - j and C[1][0] - j == C[2][0] - k:
                if C[0][1] - i == C[1][1] - j and C[1][1] - j == C[2][1] - k:
                    if C[0][2] - i == C[1][2] - j and C[1][2] - j == C[2][2] - k:
                        print('Yes')
                        sys.exit()
                        
print('No')

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

x = []
for i in range(3):
    x.append([c[i][1]-c[i][0], c[i][2]-c[i][0], c[i][2]-c[i][1]])
if x[0] != x[1] or x[1] != x[2]:
    print("No")
    sys.exit()

y = []
for j in range(3):
    y.append([c[1][i]-c[0][i], c[2][i]-c[0][i], c[2][i]-c[1][i]])
if y[0] != y[1] or y[1] != y[2]:
    print("No")
    sys.exit()
print("Yes")

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

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

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

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

ans = "No"

for i in range(0,101):
  a = i
  b = [C[0][0] - a,C[0][1] - a,C[0][2] - a]
  for j in range(1,3):
    v = C[j]
    diff = [v[k] - b[k] for k in range(3)]
    if len(set(diff)) != 1 or any([i < 0 for i in diff]):
      break
  else:
    ans = "Yes"
    break

print(ans)

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

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

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

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

for i in range(3):
    y.append(c[0][i] - x[0])
for i in range(1,3):
    x.append(c[i][0] - y[0])

ans = True
for i in range(3):
    for j in range(3):
        if x[i]+y[j] != c[i][j]:
            ans = False

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

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

A[0] = min(C[0])
A[1] = min(C[1])
A[2] = min(C[2])

for i in range(3):
    for j in range(3):
        B_cand[i][j] = C[i][j] - A[i]

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

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

a1 = c[0][0] - c[0][1]
a2 = c[0][0] - c[0][2]
b1 = c[0][0] - c[1][0]
b2 = c[0][0] - c[2][0]

ans = "No"
if c[1][1] + a1 == c[1][0] and c[1][1] + b1 == c[0][1]:
    if c[1][2] + a2 == c[1][0] and c[1][2] + b1 == c[0][2]:
        if c[2][1] + a1 == c[2][0] and c[2][1] + b2 == c[0][1]:
            if c[2][2] + a2 == c[2][0] and c[2][2] + b2 == c[0][2]:
                ans = "Yes"

print(ans)

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

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

Solution (Python):
C = [list(map(int, input().split())) for _ in range(3)]
A = [0] * 3
B = [0] * 3
for i in range(3):
    B[i] = C[0][i] - A[0]
for j in range(1, 3):
    A[j] = C[j][0] - B[0]
ans = 'Yes'
for k in range(3):
    for l in range(3):
        if C[k][l] != A[k] + B[l]:
            ans = 'No'
            print(ans)
            exit()
print(ans)

Solution (Python):
import copy
def solve():
    c = []
    for i in range(3):
        tmp = list(map(int,input().split()))
        c.append(tmp)
    
    for a1 in range(0, 100+1):
        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 or a2 != c[1][2] - b3:
            continue


        a3 = c[2][0] - b1
        if a3 != c[2][1] - b2 or a3 != c[2][2] - b3:
            continue

        print('Yes')
        break
    else:
        print('No')

if __name__ == '__main__':
    solve()

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

row_dis = []
col_dis = []

for i in range(3):
    row_dis.append([arr[0][i]-arr[1][i], arr[0][i]-arr[2][i], arr[1][i]-arr[2][i]])
    col_dis.append([arr[i][0]-arr[i][1], arr[i][0]-arr[i][2], arr[i][1]-arr[i][2]])

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

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

Solution (Python):
b1,b2,b3=map(int,input().split())
for _ in range(2):
    x,y,z=map(int,input().split())
    if x-b1==y-b2==z-b3:
        continue
    else:
        print('No')
        exit()
print('Yes')

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

b_patterns = []
for i in range(grid[0][0] + 1):
    b_pattern = [grid[0][j] - i for j in range(3)]
    b_patterns.append(b_pattern)

def patternCecker(grid, b_patterns):
    for pattern in b_patterns:
        a1 = grid[0][0] - pattern[0]
        a2 = grid[1][0] - pattern[0]
        a3 = grid[2][0] - pattern[0]

        a1_row = [a1 + pattern[l] for l in range(3)]
        a2_row = [a2 + pattern[l] for l in range(3)]
        a3_row = [a3 + pattern[l] for l in range(3)]

        if a1_row == grid[0] and a2_row == grid[1] and a3_row == grid[2]:
            return True
    return False

if patternCecker(grid, b_patterns):
    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(' ')))


check_b12 = c1[0] - c2[0] == c1[1] - c2[1] == c1[2] - c2[2]
check_b13 = c1[0] - c3[0] == c1[1] - c3[1] == c1[2] - c3[2]

check_a12 = c1[0] - c1[1] == c1[0] - c1[1] == c2[0] - c2[1]
check_a13 = c1[0] - c1[2] == c1[0] - c1[2] == c2[0] - c2[2]

if check_a12 and check_a13 and check_b12 and check_b13:
    print('Yes')
else:
    print('No')

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

Solution (Python):
c=[list(map(int,input().split())) for i in range(3)]
flag='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]:
    pass
  else:
    flag='No'

for j in range(2):
  if c[j+1][0]-c[j][0] == c[j+1][1]-c[j][1] == c[j+1][2]-c[j][2]:
    pass
  else:
    flag='No'
print(flag)

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

Solution (Python):

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


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


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


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


ans = "Yes"
for i in range(3):
    for j in range(3):
        if C[i][j] == (a[i] + b[j]):
            pass
        else:
            ans = "No"
            break

print(ans)

Solution (Python):
x=[]
y=[]
z=[]
for j in range (3):
  x1,y1,z1=[int(i) for i in input().split()]
  x.append(x1)
  y.append(y1)
  z.append(z1)

for p in range (2):
  if x[p]-x[p+1]!=y[p]-y[p+1] or y[p]-y[p+1]!=z[p]-z[p+1]:
    print("No")
    break
    
  if x[0]-y[0]!=x[1]-y[1] or x[1]-y[1]!=x[2]-y[2]:
    print("No")
    break
    
  if z[0]-y[0]!=z[1]-y[1] or z[1]-y[1]!=z[2]-y[2]:
    print("No")
    break
    
  if p==1:
    print("Yes")

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter


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

flg = 0
for i in range(C[0][0]+1):
    A[0] = i
    B[0] = C[0][0]-i
    for j in range(1,3):
        A[j] = C[j][0]-B[0]
        B[j] = C[0][j]-A[0]
    
    tmp = abs(C[1][1]-A[1]-B[1])+abs(C[1][2]-A[1]-B[2])+abs(C[2][1]-A[2]-B[1])+abs(C[2][2]-A[2]-B[2])
    if tmp==0:
        flg = 1

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines







def main():
	data=[list(map(int,input().split())) for _ in range(3)]
	
	ans="Yes"
	for i in range(-1,2,1):
		s=set()
		for j in range(3):
			s.add(data[i][j]-data[i+1][j])
			if len(s)!=1:
				ans="No"
	
	for i in range(-1,2,1):
		s=set()
		for j in range(3):
			s.add(data[j][i]-data[j][i+1])
			if len(s)!=1:
				ans="No"
	
	print(ans)
	
	
	
	
if __name__ == "__main__":
	main()

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

list_a = [0, C[1][0] - C[0][0], C[2][0] - C[0][0]]
list_b = [C[0][0], C[0][1], C[0][2]]

for i in range(3) :
    for j in range(3) :
        if C[i][j] != list_a[i] + list_b[j] :
            print("No")
            exit()

print("Yes")

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

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

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

print("No")