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):
S = [list(map(int, input().split())) for i in range(3)]
C1=S[0][0]
C2=S[0][1]
C3=S[0][2]
C4=S[1][0]
C5=S[1][1]
C6=S[1][2]
C7=S[2][0]
C8=S[2][1]
C9=S[2][2]

if C4-C1==C6-C3 and C6-C3==C5-C2 and C7-C1==C8-C2 and C8-C2==C9-C3:
    print('Yes')
else:print('No')

Solution (Python):
def examC():
    C = [LI() for _ in range(3)]
    ans = "Yes"
    cur = [0]*3
    for i in range(2):
        cur[0] = C[0][i+1]-C[0][i]
        cur[1] = C[1][i+1]-C[1][i]
        cur[2] = C[2][i+1]-C[2][i]
        if not cur[0]==cur[1]==cur[2]:
            ans = "No"
    for i in range(2):
        cur[0] = C[i+1][0]-C[i][0]
        cur[1] = C[i+1][1]-C[i][1]
        cur[2] = C[i+1][2]-C[i][2]
        if not cur[0]==cur[1]==cur[2]:
            ans = "No"
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

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

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





b1=c11
b2=c12
b3=c13
a2=c21-b1
a3=c31-b1

if c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b3:
    print("Yes")
else:
    print("No")

Solution (Python):
import numpy as np
array = np.zeros((3, 3), dtype="int8")
for i in range(3):
    inputs = [int(x) for x in input().split()]
    for j in range(3):
        array[i, j] = inputs[j]
    
b_1 = array[0, 0]
b_2 = array[0, 1]
b_3 = array[0, 2]
a_2 = array[1, 0] - b_1
a_3 = array[2, 0] - b_1
if (array[1, 1] == (a_2+b_2)) & (array[2, 2] == (a_3+b_3) ) & (array[1, 2] == (a_2+b_3)) & (array[2, 1] == (a_3+b_2)):
    flag = 1
else:
    flag = 0

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

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

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

sum = s[0][0] + s[1][1] + s[2][2]

fail = 0

if s[0][0] + s[1][2] + s[2][1] != sum:
  fail = 1
if s[1][1] + s[0][2] + s[2][0] != sum:
  fail = 1
if s[2][2] + s[0][1] + s[1][0] != sum:
  fail = 1
  
if fail == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
R = []

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

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    C=[list(map(int,input().split())) for _ in range(3)]

    if(not (C[1][0]-C[0][0]==C[1][1]-C[0][1]==C[1][2]-C[0][2])):
        print("No")
        return
    if(not (C[2][0]-C[1][0]==C[2][1]-C[1][1]==C[2][2]-C[1][2])):
        print("No")
        return
    if(not (C[0][0]-C[2][0]==C[0][1]-C[2][1]==C[0][2]-C[2][2])):
        print("No")
        return
    if(not (C[0][1]-C[0][0]==C[1][1]-C[1][0]==C[2][1]-C[2][0])):
        print("No")
        return
    if(not (C[0][2]-C[0][1]==C[1][2]-C[1][1]==C[2][2]-C[2][1])):
        print("No")
        return
    if(not (C[0][0]-C[0][2]==C[1][0]-C[1][2]==C[2][0]-C[2][2])):
        print("No")
        return
    print("Yes")
resolve()

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

for i in range(c_li[0][0]+1):
    a1 = i
    b1 = c_li[0][0] - a1
    b2 = c_li[0][1] - a1
    b3 = c_li[0][2] - a1
    
    a2 = c_li[1][0] - b1
    a3 = c_li[2][0] - b1
    
    if c_li[1][1] != a2+b2:
        continue
    if c_li[1][2] != a2+b3:
        continue
    if c_li[2][1] != a3+b2:
        continue
    if c_li[2][2] != a3+b3:
        continue
    
    res = 1
    
if res == 0:
    print("No")
else:
    print("Yes")

Solution (Python):
from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np

li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(3)]

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

lin = [[a1,a2,a3],[b1,b2,b3]]

for i in range(3):
    for j in range(3):
        if li[i][j] != lin[0][i]+lin[1][j]:
            print("No")
            exit()

print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
import bisect
from logging import getLogger, StreamHandler, DEBUG, WARNING
logger = getLogger(__name__)
handler = StreamHandler()
handler.setLevel(DEBUG)
logger.setLevel(DEBUG)


logger.addHandler(handler)












def judge(a1, a2, a3, nums):
    b1 = nums[0][0] - a1
    b2 = nums[0][1] - a1
    b3 = nums[0][2] - a1
    if a2 + b1 == nums[1][0] and a2 + b2 == nums[1][1] and a2 + b3 == nums[1][2]:
        if a3 + b1 == nums[2][0] and a3 + b2 == nums[2][1] and a3 + b3 == nums[2][2]:
            return True

    return False

def main():
    nums = [getList() for _ in range(3)]
    for a1 in range(101):
        for a2 in range(101):
            for a3 in range(101):
                if judge(a1, a2, a3, nums):
                    print("Yes")
                    return

    print("No")

if __name__ == "__main__":
    main()

Solution (Python):
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
cnt=[]
ans=0
for k in range(2):
    cnt=c[k]
    for i in range(k+1,3):
        for j in range(-100,101,1):
            if k==i:
                break
            else:
                d=c[i]
                d=[a+j for a in c[i]]
                if d==c[k]:
                    ans+=1
                    break
                
if ans==3:
    for k in range(2):
        c1=c[0][k]
        c2=c[1][k]
        c3=c[2][k]
        for i in range(k+1,3):
            d1=c[0][i]
            d2=c[1][i]
            d3=c[2][i]
            for j in range(-100,101,1):
                if k==i:
                    break
                else:
                    d1+=j
                    d2+=j
                    d3+=j
                    if d1==c1 and d2==c2 and d3==c3:
                        ans+=1
                        break
                    else:
                        d1=c[0][i]
                        d2=c[1][i]
                        d3=c[2][i]
                    
    
    if ans==6:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
C = [list(map(int, input().split())) for i in range(3)]
ans = 'No'
for a1 in range(100):
    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 and C[1][2] == a2 + b3 and C[2][1] == a3 + b2 and C[2][2] == a3 + b3:
        ans = 'Yes'
        break
print(ans)

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

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


for i in range(2):
    for j in range(2):
        if L[2-i][2-j]-L[1-i][2-j]!=L[2-i][1-j]-L[1-i][1-j]:
            print("No")
            exit()
        
for i in range(2):
    for j in range(2):
        if L[2-j][2-i]-L[1-j][2-i]!=L[2-j][1-i]-L[1-j][1-i]:
            print("No")
            exit()
print("Yes")

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

Solution (Python):
row0 = list(map(int,input().split()))
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))

rows = [row0,row1,row2]
rowsdiff = []
for item in rows:
  rowsdiff.append([item[1]-item[0],item[2]-item[1]])
columns = [[rows[0][i],rows[1][i],rows[2][i]] for i in range(3)]
columnsdiff = []
for item in columns:
  columnsdiff.append([item[1]-item[0],item[2]-item[1]])

Answer = 'Yes'
rowscheck = (rowsdiff[0]==rowsdiff[1])*(rowsdiff[1]==rowsdiff[2])
columnscheck = (columnsdiff[0]==columnsdiff[1])*(columnsdiff[1]==columnsdiff[2])
if rowscheck*columnscheck != 1:
  Answer = 'No'

print(Answer)

Solution (Python):
def main():
    c=[list(map(int,input().split())) for i in range(3)]
    a=[0,0,0]
    b=[0,0,0]
    for i in range(0,101):
        a[0]=i
        a[1]=-1
        a[2]=-1
        b[0]=c[0][0]-a[0]
        b[1]=c[0][1]-a[0]
        b[2]=c[0][2]-a[0]
        for j in range(1,3):
            if c[j][0]-b[0]!=c[j][1]-b[1] or c[j][1]-b[1]!=c[j][2]-b[2]:
                break
            a[j]=c[j][0]-b[0]

            if j == 2 and check(a,b):
                print('Yes')
                return
    print('No')

def check(a,b):
    for i in range(0,3):
        if a[i] >= 0 and b[i] >= 0 :
            continue
        else:
            return False
    return True

if __name__=='__main__':
    main()

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

if __name__=='__main__':
    main()

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

sum_mat = (sum(c[0]) + sum(c[1]) + sum(c[2])) / 3
print('Yes' if sum_mat == c[0][0] + c[1][1] + c[2][2] else 'No')

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

fin = False

for a1 in range(101):
	if fin:
		break
	for a2 in range(101):
		if fin:
			break
		for a3 in range(101):
			if (grid[0][0]-a1==grid[1][0]-a2 and grid[1][0]-a2==grid[2][0]-a3) and (grid[0][1]-a1==grid[1][1]-a2 and grid[1][1]-a2==grid[2][1]-a3) and (grid[0][2]-a1==grid[1][2]-a2 and grid[1][2]-a2==grid[2][2]-a3):
				print("Yes")
				fin = True
				break
if not fin:
	print("No")

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


for i in range(n):
    for j in range(n):
        if x[i][j] != (a[i] + b[j]):
            print('No')
            exit()
print('Yes')

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

def main():
  mC = [tuple(map(int, input().split()))
        for _ in range(3)]

  
  mD = [[mC[i][j]-mC[i][j+1] for j in range(2)]
        for i in range(3)]
  

  
  mE = [[mC[i][j]-mC[i+1][j] for i in range(2)]
        for j in range(3)]
  

  res = "Yes"
  if any(vd!=mD[0] for vd in mD[1:]) \
     or any(ve!=mE[0] for ve in mE[1:]):
    res = "No"

  print(res)

main()

Solution (Python):
L1 = list(map(int, input().split()))
for i in range(2):
	l = list(map(int, input().split()))
	sabun = None
	for j in range(3):
		if sabun == None:
			sabun = L1[j] - l[j]
		elif L1[j] - l[j] != sabun:
			print("No")
			exit()
print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline
a = [list(map(int, input().split())) for _ in range(3)]
dx = [0] * 2
dy = [0] * 2
for i in range(2):
  dx[i] = a[0][i + 1] - a[0][i]
for i in range(2):
  dy[i] = a[i + 1][0] - a[i][0]
for i in range(3):
  for j in range(2):
    if a[i][j + 1] - a[i][j] != dx[j]:
      print("No")
      exit(0)
for i in range(3):
  for j in range(2):
    if a[j + 1][i] - a[j][i] != dy[j]:
      print("No")
      exit(0)
print("Yes")

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

mat_dif = [0, 0, 0]
for i in range(3):
    mat_dif[i] = ([matrix[i][0]-matrix[i][1]], [matrix[i][1]-matrix[i][2]])

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

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

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

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

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

print("Yes")

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

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

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

print("Yes")

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

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


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

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

Solution (Python):
C = [[int(x) for x in input().split()],[int(x) for x in input().split()],[int(x) for x in input().split()]]
a1max = min(C[0])
for a1 in range(a1max + 1):
  b1, b2, b3 = C[0][0] - a1, C[0][1] - a1, C[0][2] - a1
  a2 = C[1][0] - b1
  a3 = C[2][0] - b1
  if C[1][1] == a2 + b2 and C[1][2] == a2 + b3 and C[2][1] == a3 + b2 and \
    C[2][2] == a3 + b3:
      print('Yes')
      break
else:
  print('No')

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

list_a = [0 for _ in range(3)]
list_b = [0 for _ in range(3)]
for i in range(3):
  list_b[i] = list_c[i][0]
for i in range(3):
  if i != 0:
    list_a[i] = list_c[0][i] - list_b[0]

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

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

Solution (Python):
C=[list(map(int,input().split())) for i in range(3)]
for a in range(101):
    for b in range(101):
        for c in range(101):
            d=C[0][0]-a
            e=C[1][1]-b
            f=C[2][2]-c
            if all([b+d==C[0][1],c+d==C[0][2],a+e==C[1][0],c+e==C[1][2],a+f==C[2][0],b+f==C[2][1]]):
                print('Yes')
                exit()
print('No')

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    t = [list(map(int, input().split())) for _ in range(3)]
    for i in range(2):
        if not t[i][0] - t[i + 1][0] == t[i][1] - t[i + 1][1] == t[i][2] - t[i + 1][2]:
            print("No")
            exit()
    for j in range(2):
        if not t[0][j] - t[0][j + 1] == t[1][j] - t[1][j + 1] == t[2][j] - t[2][j + 1]:
            print("No")
            exit()
    print("Yes")

main()

Solution (Python):
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))
ar3 = list(map(int, input().split()))

for i in range(100):
	a1 = i
	b1 = ar1[0] - a1
	b2 = ar1[1] - a1
	b3 = ar1[2] - a1
	a2 = ar2[0] - b1
	a3 = ar3[0] - b1
	if a2 + b2 == ar2[1] and a2 + b3 == ar2[2] and a3 + b2 == ar3[1] == ar3[1] and a3 + b3 == ar3[2]:
		print ("Yes")
		exit()
print ("No")

Solution (Python):
X = [[int(a) for a in input().split()] for _ in range(3)]
f = 0
for i in range(1, 3):
    for j in range(1, 3):
        if X[i][j] + X[0][0] != X[i][0] + X[0][j]:
            print("No")
            f = 1
            break
    if f:
        break
else:
    print("Yes")

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



pairs = [(0, 1), (1, 2), (0, 2)]

for i, j in pairs:
    values = [C[i][col] - C[j][col] for col in range(3)]
    if len(set(values)) != 1:
        print('No')
        exit()

for i, j in pairs:
    values = [C[row][i] - C[row][j] for row in range(3)]
    if len(set(values)) != 1:
        print('No')
        exit()

print('Yes')

Solution (Python):


import sys








def main():
    c = [[int(x) for x in sys.stdin.readline().split()] for _ in range(3)]
    n = 3  
    d = []
    for i in range(1, n):
        d0i = c[0][i] - c[0][0]
        d.append(d0i)
    for i in range(1,n):
        for j in range(1, n):
            if c[i][j] - c[i][0] == d[j-1]:
                continue
            else:
                print('No')
                exit()
    print('Yes')

if __name__ == "__main__":
    
    main()

Solution (Python):
c = [list(map(int, input().split())) for _ in range(3)]
try:
    assert (sum(c[2]) - sum(c[1])) % 3 == 0
    assert (sum(c[1]) - sum(c[0])) % 3 == 0
    assert (sum([line[2] for line in c]) - sum([line[1] for line in c])) % 3 == 0
    assert (sum([line[1] for line in c]) - sum([line[0] for line in c])) % 3 == 0
    print("Yes")
except AssertionError:
    print("No")

Solution (Python):
import numpy as np
c1,c2,c3 = map(int,input().split())
c4,c5,c6 = map(int,input().split())
c7,c8,c9 = map(int,input().split())
A = np.array([[1,0,0,1,0,0,c1],[1,0,0,0,1,0,c2],[1,0,0,0,0,1,c3],[0,1,0,1,0,0,c4],[0,1,0,0,1,0,c5],[0,1,0,0,0,1,c6],[0,0,1,1,0,0,c7],[0,0,1,0,1,0,c8],[0,0,1,0,0,1,c9]])
if np.linalg.matrix_rank(A) ==5:
  print("Yes")
else:
  print("No")

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

right = c[0][1] + c[1][0] == c[0][0] + c[1][1] \
    and c[1][2] + c[2][1] == c[1][1] + c[2][2] \
    and c[2][0] + c[0][2] == c[2][2] + c[0][0]
print('Yes' if right else 'No')

Solution (Python):
import sys


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


if __name__ == '__main__':
    solve()

Solution (Python):
grid = [[], [], []]
for i in range(3):
    grid[i] = [int(i) for i in input().split()]
x = [0] * 3
y = []
ret = True
for i in range(3):
    y.append(grid[0][i] - x[0])
for i in range(3):
    x[i] = grid[i][0] - y[0]
for i in range(3):
    for j in range(3):
        if not x[i] + y[j] == grid[i][j]:
            ret = False
    else:
        continue
    break
print("Yes" if ret else "No")

Solution (Python):
s=[];
for i in range(3):
  s.append(list(map(int,input().split())))
sum=0
for i in range(3):
  for j in range(3):sum+=s[i][j]
c1=s[0][0]+s[1][1]+s[2][2]
c2=s[0][2]+s[1][1]+s[2][0]
print('Yes'if sum==c1*3 and sum==c2*3 else 'No')

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

c = c1 + c2 + c3

if sum(c) % 3 == 0 and c[0] + c[4] + c[8] == c[1] + c[3] + c[8]:
    print("Yes")
else:
    print("No")

Solution (Python):
import collections
import math
import numpy as np






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

field = np.array(field)
for i in range(3):
  field[i] -= min(field[i])

is_true = np.where(field==field[0], True, False).all()

field = np.array(field).T
for i in range(3):
  field[i] -= min(field[i])

is_true2 = np.where(field==field[0], True, False).all()

print('Yes' if is_true * is_true2 else 'No')

Solution (Python):
C1 = list(map(int, input().split()))
C2 = list(map(int, input().split()))
C3 = list(map(int, input().split()))

if (C1[0]-C1[1]==C2[0]-C2[1] and C2[0]-C2[1] ==C3[0]-C3[1]) and (C1[0]-C1[2]==C2[0]-C2[2] and C2[0]-C2[2]==C3[0]-C3[2]):
    print('Yes')
else:
    print('No')

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

c1 = many_int()
c2 = many_int()
c3 = many_int()

import numpy as np
temp_array=np.asarray([c1,c2,c3])
temp = temp_array.T

same_flg=True

same = c1[0]-c2[0]
for a,b in zip(c1[1:],c2[1:]):
    if a-b != same:
        same_flg=False
        
same = c1[0]-c3[0]
for a,b in zip(c1[1:],c3[1:]):
    if a-b != same:
        same_flg=False
        
same = c2[0]-c3[0]
for a,b in zip(c2[1:],c3[1:]):
    if a-b != same:
        same_flg=False





c1=list(temp[0])
c2=list(temp[1])
c3=list(temp[2])

same = c1[0]-c2[0]
for a,b in zip(c1[1:],c2[1:]):
    if a-b != same:
        same_flg=False

same = c1[0]-c3[0]
for a,b in zip(c1[1:],c3[1:]):
    if a-b != same:
        same_flg=False

same = c2[0]-c3[0]
for a,b in zip(c2[1:],c3[1:]):
    if a-b != same:
        same_flg=False

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

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

Solution (Python):
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))
L3 = list(map(int,input().split()))

a1 = 0
b1 = L1[0]
b2 = L1[1]
b3 = L1[2]
a2 = L2[1]-b2
a3 = L3[2]-b3

if a1+b1==L1[0] and a1+b2==L1[1] and a1+b3==L1[2] and a2+b1==L2[0] and a2+b2==L2[1] and a2+b3==L2[2] and a3+b1==L3[0] and a3+b2==L3[1] and a3+b3==L3[2]:
  print("Yes")
else:
  print("No")

Solution (Python):
def main():
    import numpy as np
    A = np.array([[1, 0, 0, 1, 0, 0],
                  [1, 0, 0, 0, 1, 0],
                  [1, 0, 0, 0, 0, 1],
                  [0, 1, 0, 1, 0, 0],
                  [0, 1, 0, 0, 1, 0],
                  [0, 1, 0, 0, 0, 1],
                  [0, 0, 1, 1, 0, 0],
                  [0, 0, 1, 0, 1, 0],
                  [0, 0, 1, 0, 0, 1]])
    C = [[int(i) for i in input().split()] for j in range(3)]
    C = np.array(C)
    C = C.reshape([9, 1])
    ext_A = np.concatenate([A, C], axis=1)
    A_rank = np.linalg.matrix_rank(A)
    ext_A_rank = np.linalg.matrix_rank(ext_A)
    
    if A_rank == ext_A_rank:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

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

Solution (Python):
c0= list(map(int, input().split()))
c1= list(map(int, input().split()))
c2= list(map(int, input().split()))
if c0[1]-c0[0]==c1[1]-c1[0]==c2[1]-c2[0] and c0[2]-c0[0]==c1[2]-c1[0]==c2[2]-c2[0]:
    print('Yes')
else:
    print('No')

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

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

Ans = "Yes"
for i in range(3):
    if (C[i][1] - C[i][0] != dx1 or C[i][2] - C[i][1] != dx2 or
        C[1][i] - C[0][i] != dy1 or C[2][i] - C[1][i] != dy2):
        Ans = "No"
        break

print(Ans)

Solution (Python):
c = ['' for _ in range(3)]
c[0] = list(map(int, input().split()))
c[1] = list(map(int, input().split()))
c[2] = list(map(int, input().split()))
ans = 'Yes'
for i in range(2):
    line = [0 for _ in range(3)]
    column = [0 for _ in range(3)]
    for j in range(3):
        line[j] = c[i + 1][j] - c[i][j]
        column[j] = c[i + 1][j] - c[i][j]
    if len(set(line)) != 1 or len(set(column)) != 1:
        ans = 'No'
        break
print(ans)

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

Solution (Python):
import sys
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]:
    if a[1]-a[2]==b[1]-b[2]==c[1]-c[2]:
        print("Yes")
        sys.exit()
print("No")

Solution (Python):
C1=list(map(int,input().split()))
C2=list(map(int,input().split()))
C3=list(map(int,input().split()))
k2=C2[0]-C1[0]
k3=C3[0]-C1[0]
C2=[i-k2 for i in C2]
C3=[i-k3 for i in C3]
print(['No','Yes'][C1==C2==C3])

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

Solution (Python):
c = []
c_diff = []

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

for i in range(3) :
    c_min = min(c[i])
    c_diff.append([c[i][j] - c_min for j in range(3)])

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

Solution (Python):
line1 = list(map(int, input().split()))
line2 = list(map(int, input().split()))
line3 = list(map(int, input().split()))

b1 = [line1[1]-line1[0], line1[2]-line1[0]]
b2 = [line2[1]-line2[0], line2[2]-line2[0]]
b3 = [line3[1]-line3[0], line3[2]-line3[0]]

a1 = [line2[0] - line1[0], line3[0] - line1[0]]
a2 = [line2[1] - line1[1], line3[1] - line1[1]]
a3 = [line2[2] - line1[2], line3[2] - line1[2]]

check = False
if b1[0] == b2[0] and b1[0] == b3[0]:
    if b1[1] == b2[1] and b1[1] == b3[1]:
        if a1[0] == a2[0] and a1[0] == a3[0]:
            if a1[1] == a2[1] and a1[1] == a3[1]:
                check = True

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

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

count = 0
for i in range(3):
    for j in range(3):
        if c[i][j] + c[j][i] == c[i][i] + c[j][j]:
            count += 1
if count == 9:
    print('Yes')
else:
    print('No')

Solution (Python):

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

a = [None, None, None]
b = [None, None, None]
for a1 in range(101):
    a[0] = a1
    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]


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

for i in range(1,3):
  if C[i][0]-C[0][0]==C[i][1]-C[0][1] and C[i][0]-C[0][0]==C[i][2]-C[0][2]:
    pass
  else:
    print("No")
    exit()
    
print("Yes")

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

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

for i in range(1,3):
  if C[i][0]-C[0][0]==C[i][1]-C[0][1] and C[i][0]-C[0][0]==C[i][2]-C[0][2]:
    pass
  else:
    print("No")
    exit()
    
print("Yes")

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

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

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

Solution (Python):
c=[list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))]
f=True
if not c[1][0]-c[0][0]==c[1][1]-c[0][1]==c[1][2]-c[0][2]: 
    f=False
if not c[2][0]-c[1][0]==c[2][1]-c[1][1]==c[2][2]-c[1][2]: 
    f=False
if not c[0][1]-c[0][0]==c[1][1]-c[1][0]==c[2][1]-c[2][0]: 
    f=False
if not c[0][2]-c[0][1]==c[1][2]-c[1][1]==c[2][2]-c[2][1]: 
    f=False
print('Yes' if f else 'No')

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

ans = "Yes"
tmp=C[0][0]

A=[0]*3
B=[0]*3
for i in range(3):
    B[i]=C[0][i]
for i in range(3):
    A[i]=C[i][0]-B[0]

for i in range(3):
    for j in range(3):
        if(C[i][j]!=A[i]+B[j]):
            ans = "No"
            
print(ans)

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

closs1 = 0
closs2 = 0

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