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):
A=[list(map(int,input().split())) for i  in range(3)]
if A[0][0]+A[1][1]==A[0][1]+A[1][0] and A[1][1]+A[2][2]==A[1][2]+A[2][1] and A[0][0]+A[2][2]==A[0][2]+A[2][0] :
    print("Yes")
else:
    print("No")

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

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

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

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

Solution (Python):
import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    c = []
    for _ in range(3):
        c.append(input_int_list())

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

    return


if __name__ == "__main__":
    main()

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

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

Solution (Python):



def main():
    l = list()
    for i in range(3):
        l.append(list(map(int, input().split())))

    for a1 in range(0, l[0][0] + 1):
        b1 = l[0][0] - a1
        b2 = l[0][1] - a1
        b3 = l[0][2] - a1
        a2 = l[1][0] - b1
        a3 = l[2][0] - b1
        if b1 < 0:
            continue
        if b2 < 0:
            continue
        if b3 < 0:
            continue
        if a2 < 0:
            continue
        if a3 < 0:
            continue
        if (
            l[1][1] == b2 + a2
            and l[1][2] == b3 + a2
            and l[2][1] == b2 + a3
            and l[2][2] == b3 + a3
        ):
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    main()

Solution (Python):
List = []
for i in range (3):
  List.append(list(map(int, input().split())))
a = 0
b = 0
c = 0
flg = True
for i in range(2):
  a = List[0][i+1] - List[0][i]
  b = List[1][i+1] - List[1][i]
  c = List[2][i+1] - List[2][i]
  if a != b or b != c or c != a:
    flg = False
  a = List[i+1][0] - List[i][0]
  b = List[i+1][1] - List[i][1]
  c = List[i+1][2] - List[i][2]
  if a != b or b != c or c != a:
    flg = False
if flg:
  print("Yes")
else:
  print("No")

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

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

dx1=c[1]-c[0]
dx2=c[2]-c[1]
dy1=d[1]-d[0]
dy2=d[2]-d[1]

for i in range(3):
  c=a[i]
  d=b[i]
  if dx1==c[1]-c[0] and dx2==c[2]-c[1] and dy1==d[1]-d[0] and dy2==d[2]-d[1]:
    f=True
  else:
    f=False
    break
if f:
  print('Yes')
else:
  print('No')

Solution (Python):
List=[list(map(int,input().split())) for i in range(3)]
newlist=[]
new = [x-y for (x,y) in zip(List[0],List[1])]
new2 = [x-y for (x,y) in zip(List[2],List[1])]
if new[0]==new[1] and new[1]==new[2]:
    pass
else:
    print('No')
    exit()
if new2[0]==new2[1] and new2[1]==new2[2]:
    pass
else:
    print('No')
    exit()
    
if List[0][0]-List[0][1]==List[1][0]-List[1][1] and List[2][0]-List[2][1]==List[1][0]-List[1][1]:
    pass
else:
    print('No')
    exit()
if List[0][0]-List[0][2]==List[1][0]-List[1][2] and List[2][0]-List[2][2]==List[1][0]-List[1][2]:
    pass
else:
    print('No')
    exit()
print('Yes')

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

for a1 in range(min(c[0])+1):
    b = [c[0][0] - a1, c[0][1] - a1, c[0][2] - a1]
    if c[1][0] - b[0] == c[1][1] - b[1] == c[1][2] - b[2]:
        if c[2][0] - b[0] == c[2][1] - b[1] == c[2][2] - b[2]:
            print("Yes")
            exit()
print("No")

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

a = [0, 0, 0]
b = [0, 0, 0]

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

for i in range(101):
    b[0] = i
    a[0] = c[0][0] - b[0]
    a[1] = c[1][0] - b[0]
    a[2] = c[2][0] - b[0]
    b[1] = c[0][1] - a[0]
    b[2] = c[0][2] - a[0]

    if check(c, a, b):
        print("Yes")
        exit()

print("No")

Solution (Python):
import numpy as np
C = np.array([[int(x) for x in input().split()] for _ in range(3)])
ans = 'Yes'
for i in range(2):
    if not(C[0,i+1]-C[0,i] == C[1,i+1]-C[1,i] == C[2,i+1]-C[2,i]):
        ans = 'No'
    if not(C[i+1,0]-C[i,0] == C[i+1,1]-C[i,1] == C[i+1,2]-C[i,2]):
        ans = 'No'
print(ans)

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

ans = True
for i in range(2):
    tmp = c[0][i + 1] - c[0][i]
    for j in range(2):
        if c[j + 1][i + 1] - c[j + 1][i] != tmp:
            ans = False
            break

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

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

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

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

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

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

Solution (Python):
c_1_1, c_1_2, c_1_3 = map(int, input().split())
c_2_1, c_2_2, c_2_3 = map(int, input().split())
c_3_1, c_3_2, c_3_3 = map(int, input().split())

ans = "No"
for a_1 in range(101):
  b_1 = c_1_1 - a_1
  b_2 = c_1_2 - a_1
  b_3 = c_1_3 - a_1
  for a_2 in range(101):
    if c_2_1 != a_2 + b_1:
      continue
    if c_2_2 != a_2 + b_2:
      continue
    if c_2_3 != a_2 + b_3:
      continue
    for a_3 in range(101):
      if c_3_1 != a_3 + b_1:
        continue
      if c_3_2 != a_3 + b_2:
        continue
      if c_3_3 != a_3 + b_3:
        continue
      ans = "Yes"
      break
    if ans == "Yes":
      break
  if ans == "Yes":
    break

print(ans)

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

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

ans=[[a1+b1,a1+b2,a1+b3],[a2+b1,a2+b2,a2+b3],[a3+b1,a3+b2,a3+b3]]

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

Solution (Python):

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

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

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

Solution (Python):
import itertools
def main():
    grid = [list(map(int, input().split())) for i in range(3)]
    all = sum(sum(grid, []))
    a = [0] * 3
    b = [0] * 3
    for i, j, k in itertools.product(range(grid[0][0] + 1), range(grid[1][1] + 1), range(grid[2][2] + 1)):
        a = [i, j, k]
        b = [grid[idx][idx] - v for idx, v in enumerate(a)]
        if (sum(a) * 3) + (sum(b) * 3) == all:
            print("Yes")
            exit()
    print('No')


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    grid = [list(map(int, input().split())) for i in range(3)]
    all = sum(sum(grid, []))
    a = [0] * 3
    b = [0] * 3
    for i1 in range(0, grid[0][0] + 1):
        a[0] = i1
        b[0] = grid[0][0] - i1
        for j2 in range(0, grid[1][1] + 1):
            a[1] = j2
            b[1] = grid[1][1] - j2
            for k3 in range(0, grid[2][2] + 1):
                a[2] = k3
                b[2] = grid[2][2] - k3
                if (sum(a) * 3) + (sum(b) * 3) == all:
                    print("Yes")
                    exit()
    print('No')





if __name__ == '__main__':
    main()

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

flag = True

for i in range(1, 3):
    if not(c[i][0] - c[0][0] == c[i][1] - c[0][1] == c[i][2] - c[0][2]):
        flag = False
    if not(c[0][i] - c[0][0] == c[1][i] - c[1][0] == c[2][i] - c[2][0]):
        flag = False

if flag:
    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())
f=0
if not c11-c12==c21-c22==c31-c32:
    f=1
if not c11-c13==c21-c23==c31-c33:
    f=1
if not c12-c13==c22-c23==c32-c33:
    f=1
if not c11-c21==c12-c22==c13-c23:
    f=1
if not c11-c31==c12-c32==c13-c33:
    f=1
if not c21-c31==c22-c32==c23-c33:
    f=1
print("Yes" if f==0 else "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 c11 - c12 == c21 -c22 == c31-c32 and c12 - c13 == c22 -c23 == c32-c33 and c11 - c21 == c12 -c22 == c13-c23 and c21 - c31 == c22 -c32 == c23-c33 :
    print('Yes')
else :
    print('No')

Solution (Python):
def is_valid(m, a, b):
    for i in range(3):
        for j in range(3):
            if (m[i][j] != a[i] + b[j]):
                return 0
    return 1


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

for a0 in range(101):
    b0 = m[0][0] - a0
    b1 = m[0][1] - a0
    b2 = m[0][2] - a0
    a1 = m[1][0] - b0
    a2 = m[2][0] - b0
    if (is_valid(m, [a0, a1, a2], [b0, b1, b2])):
        print("Yes")
        exit()
print("No")

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

for i in range(1, 3):
    d = c[i][0] - c[0][0]
    e = c[0][i] - c[0][0]
    for j in range(1, 3):
        if d != c[i][j] - c[0][j]:
            print("No")
            exit()
        if e != c[j][i] - c[j][0]:
            print("No")
            exit()
print("Yes")

Solution (Python):
arr = []

for _ in range(3):
    arr += list(map(int, input().split()))

a = [0] * 3
b = [0] * 3
a[0] = 0
b[0] = arr[0]
b[1] = arr[1]
b[2] = arr[2]
a[1] = arr[4] - b[1]
a[2] = arr[8] - b[2]

tmp = [a[i] + b[j] for i in range(3) for j in range(3)]

print('Yes' if arr == tmp else 'No')

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

b = c[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]:
            ok = False
        
if ok:
    print('Yes')
else:
    print('No')

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

ok = True

lis = [[0,1],[1,2],[2,0]]

d = [[c[l[0]][i]-c[l[1]][i] for i in range(3)]for l in lis]
e = [[c[i][l[0]]-c[i][l[1]] for i in range(3)]for l in lis]

for i in range(3):
    if d[i].count(d[i][0])!=3:
        ok = False
    if e[i].count(e[i][0])!=3:
        ok = False
        
if ok:
    print('Yes')
else:
    print('No')

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

ans="No"
for a1 in range(c11+1):
    
    b1=c11-a1
    b2=c12-a1
    b3=c13-a1
    a2=c21-b1
    a3=c31-b1

    if c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b3:
        ans="Yes"
        break

print(ans)

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

if c[2][1] - c[2][0] == c[0][1] - c[0][0] and c[0][2] - c[1][2] == c[0][0] - c[1][0] and c[1][2] - c[2][2] == c[1][0] - c[2][0] and c[0][2] - c[2][2] == c[0][0] - c[2][0] and c[1][1] - c[0][1] == c[1][0] - c[0][0]:
    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()))
c = [c1,c2,c3]
for a1 in range(100):
    b1 = c1[0] - a1
    b2 = c1[1] - a1
    b3 = c1[2] - a1
    a21 = c2[0] - b1
    a22 = c2[1] - b2
    a23 = c2[2] - b3
    a31 = c3[0] - b1
    a32 = c3[1] - b2
    a33 = c3[2] - b3




    if (a21 == a22 == a23) and (a31 == a32 == a33):
        print('Yes')
        break
    elif a1 == 99:
        print('No')
        break
    else:
        continue

Solution (Python):
c = [list(map(int, input().split())) for _ in range(3)]
for i in [1, 2]:
  d1 = c[0][0] - c[i][0]
  d2 = c[0][1] - c[i][1]
  d3 = c[0][2] - c[i][2]
  d4 = c[0][0] - c[0][i]
  d5 = c[1][0] - c[1][i]
  d6 = c[2][0] - c[2][i]
  if d1 != d2 or d1 != d3 or d4 != d5 or d4 != d6:
    print("No")
    exit()
print("Yes")

Solution (Python):

def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())
    
    for a1 in range(-200, 200):
        b1 = c11 - a1
        b2 = c12 - a1
        b3 = c13 - a1
        a2 = c21 - b1
        a3 = c31 - b1
        if c22 == a2 + b2 and c23 == a2 + b3 and c32 == a3 + b2 and c33 == a3 + b3:
            print('Yes')
            exit()
    print('No')
    
    




if __name__ == "__main__":
    main()

Solution (Python):
grid = [[-1] * 4 for i in range(4)]
for i in range(1,4):
    grid[i][1],grid[i][2],grid[i][3] = map(int,input().split())
    grid[i][0] = min(grid[i][1],grid[i][2],grid[i][3])




isOK = False
for i in range(grid[1][0]+1):
    grid[0][0] = i
    grid[0][1] = grid[1][1]-i
    grid[0][2] = grid[1][2]-i
    grid[0][3] = grid[1][3]-i



    if grid[2][1]-grid[0][1] == grid[2][2]-grid[0][2] and grid[2][2]-grid[0][2] == grid[2][3]-grid[0][3]:
        if grid[3][1]-grid[0][1] == grid[3][2]-grid[0][2] and grid[3][2]-grid[0][2] == grid[3][3]-grid[0][3]:
            isOK = True
            break
if isOK:
    print('Yes')
else:
    print('No')

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    grid = []
    for _ in range(3):
        grid.append(LI())
    
    ans = True
    l1 = grid[0][1] - grid[0][0]
    l2 = grid[0][2] - grid[0][1]
    ans &= grid[1][1] - grid[1][0] == l1 and grid[1][2] - grid[1][1] == l2
    ans &= grid[2][1] - grid[2][0] == l1 and grid[2][2] - grid[2][1] == l2

    r1 = grid[1][0] - grid[0][0]
    r2 = grid[1][0] - grid[0][0]
    ans &= grid[1][1] - grid[0][1] == r1 and grid[1][1] - grid[0][1] == r2
    ans &= grid[1][2] - grid[0][2] == r1 and grid[1][2] - grid[0][2] == r2
    print("Yes" if ans else "No")
main()

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

Solution (Python):
c = [[0]*3]*3

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

ans = False

if c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1] and\
    c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]:
    ans = True

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

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

sw = 1
b1 = min(c1)
a = [c1[0]-b1, c1[1]-b1, c1[2]-b1]

if not(c2[0]-a[0] == c2[1]-a[1] == c2[2]-a[2]):
    sw = 0
if not(c3[0]-a[0] == c3[1]-a[1] == c3[2]-a[2]):
    sw = 0
    
print(["No","Yes"][sw])

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

Solution (Python):
A1 = 0
B1, B2, B3 = map(int, input().split())
C1, C2, C3 = map(int, input().split())
D1, D2, D3 = map(int, input().split())
flag = 0
if not( C2-B2 == C1-B1 and C3-B3 == C1-B1 and C2-B2 == C3-B3):
    flag = 1
if not( D2-B2 == D1-B1 and D3-B3 == D1-B1 and D2-B2 == D3-B3):
    flag = 1
print("Yes" if flag == 0 else "No")

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

Solution (Python):
c = list(map(int, input().split()))
x, y, z = c[0]-c[1], c[1]-c[2], c[2]-c[0]
flag = True
for i in range(2):
  c = list(map(int, input().split()))
  s, t, u = c[0]-c[1], c[1]-c[2], c[2]-c[0]
  if (x!=s) or (y!=t) or (z!=u):
    flag = False
    break
    
if flag:
  print('Yes')
else:
  print('No')

Solution (Python):

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





Flag=1
for ii in range(1,3):
    for jj in range(1,3):
        if C[ii-1][jj-1]-C[ii][jj-1]!=C[ii-1][jj]-C[ii][jj]:
            Flag=0
            break
    if Flag==0:
        break

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

Solution (Python):
c=[0]*3
c_max=0
for i in range(3):
    c[i]=list(map(int,input().split()))
    c_max=max(c_max,max(c[i]))
c_max+=1
for a1 in range(c_max):
    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 a2+b2==c[1][1] and a2+b3==c[1][2] and a3+b1==c[2][0] and a3+b2==c[2][1] and a3+b3==c[2][2]:
        print('Yes')
        exit()
print('No')

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

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

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

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

D = [[] for _ in range(4)]
for i in range(2):
    for j in range(3):
        D[i].append(C[i+1][j] - C[i][j])
        D[i+2].append(C[j][i+1] - C[j][i])

for d in D:
    if len(set(d)) != 1:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
C_grid = [list(map(int, input().split())) for i in range(3)]
a1, a2, a3 = C_grid[0][1] - C_grid[0][0], C_grid[0][2] - C_grid[0][1], C_grid[0][0] - C_grid[0][2]
for i in range(1, 3):
    gyo = C_grid[i]
    k1, k2, k3 = gyo[1] - gyo[0], gyo[2] - gyo[1], gyo[0] - gyo[2]
    if a1 == k1 and a2 == k2 and a3 == k3:
        continue
    else:
        print('No')
        exit(0)

a1, a2, a3 = C_grid[1][0] - C_grid[0][0], C_grid[2][0] - C_grid[1][0], C_grid[0][0] - C_grid[2][0]
for i in range(1, 3):
    k1, k2, k3 = C_grid[1][i] - C_grid[0][i], C_grid[2][i] - C_grid[1][i], C_grid[0][i] - C_grid[2][i]
    if a1 == k1 and a2 == k2 and a3 == k3:
        continue
    else:
        print('No')
        exit(0)
print('Yes')

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):
[a,b,c]=[int(i) for i in input().split()]
[d,e,f]=[int(j) for j in input().split()]
[g,h,i]=[int(k) for k in input().split()]
t=0
if d-a == e-b and e-b == f-c:
  t+=1
if g-d == h-e and h-e == i-f:
  t+=1
if b-a == e-d and e-d == h-g:
  t+=1
if c-b == f-e and f-e == i-h:
  t+=1
if t== 4:
  print("Yes")
else:
  print("No")

Solution (Python):
import numpy as np
c1 = list(map(int,input().split()))
A = np.array(c1)
c1 = list(map(int,input().split()))
B = np.array(c1)
c1 = list(map(int,input().split()))
C = np.array(c1)

D = A-B 
D1 = list(D)
D1 = set(D1)
if len(D1) == 1:
    pass 
else:
    print('No')
    exit()

E = B-C
E1 = list(E)
E1 = set(E1) 
if len(E1)== 1:
    print('Yes') 
else:
    print('No')

Solution (Python):
C=[list(map(int,input().split())) for _ in range(3)]
x=[0]*3
y=[0]*3
x[0]=0
y[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]
    
ans=True
for i in range(3):
    for j in range(3):
        if C[i][j]!=x[i]+y[j]: ans=False
print('Yes' if ans else 'No')

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

j1 = c[0][0] - c[0][1]
j2 = c[0][1] - c[0][2]
for i in range(1, 3):
    _j1 = c[i][0] - c[i][1]
    _j2 = c[i][1] - c[i][2]
    if j1 == _j1 and j2 == _j2:
        continue
    print("No")
    break
else:
    print("Yes")

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]:
    if  b[0] - c[0] == b[1] - c[1] == b[2] - c[2]:
        print("Yes")
        exit()
    else:
        pass

print("No")

Solution (Python):
c = [list(map(int, input().split())) for i in range(3)]
x = c[0][2] - c[0][1]
y = c[0][1] - c[0][0]
ans = 'Yes'
for i in range(1, 3):
  if c[i][2] - c[i][1] != x or c[i][1] - c[i][0] != y:
    ans = "No"
    break

print(ans)

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

Solution (Python):
c = [[int(cn) for cn in input().split()] for _ in range(3)]
max_val = max(c[0])
ans = 'No'
for a1 in range(max_val + 1):
  b = [c[0][i] - a1 for i in range(3)]
  correct = True
  for i in range(2):
    ai_cand = []
    for j in range(3):
      cand = c[i + 1][j] - b[j]
      correct = cand >= 0
      if correct:
        ai_cand.append(cand)
      else:
        break
    correct = correct and (ai_cand[0] == ai_cand[1] and ai_cand[1] == ai_cand[2])
    if not correct:
      break
  if correct:
    ans = 'Yes'
    break
print(ans)

Solution (Python):
c = [[int(cn) for cn in input().split()] for _ in range(3)]
max_val = max(c[0])
ans = 'No'
for a1 in range(max_val + 1):
  b = [c[0][i] - a1 for i in range(3)]
  correct = True
  for i in range(2):
    ai_cand = []
    for j in range(3):
      cand = c[i + 1][j] - b[j]
      correct = cand >= 0
      if correct:
        ai_cand.append(cand)
      else:
        break
    if correct:
      correct = ai_cand[0] == ai_cand[1] and ai_cand[1] == ai_cand[2]
      if not correct:
        break
    else:
      break
  if correct:
    ans = 'Yes'
    break
print(ans)

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

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

Solution (Python):
g=[[*map(int,input().split())]for _ in range(3)]
for h in [0,1]:
  for w in [0,1]: 
    if g[h][w]+g[h+1][w+1]!=g[h+1][w]+g[h][w+1]:
      exit(print('No'))
print('Yes')

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

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1 0 1
2 1 2
1 0 1"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 2 2
2 1 2
2 2 2"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """0 8 8
0 8 8
0 8 8"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """1 8 6
2 9 7
0 7 7"""
        output = """No"""
        self.assertIO(input, output)


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

    a1 = 0
    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")
    else:
        print("No")


if __name__ == "__main__":
    
    resolve()

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

res = 0
ans = 0

for i in range(3):
  res += sum(c[i])
  ans += c[i][i]*3
  
if res == ans:
  print('Yes')
else:
  print('No')

Solution (Python):
import numpy as np
a = np.array(input().split(), dtype='int')
b = np.array(input().split(), dtype='int') - a
c = np.array(input().split(), dtype='int') - a

if np.all(b == b[0]) and np.all(c == c[0]):
    print('Yes')
else:
    print('No')

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = c[0] - a1
            b2 = c[1] - a1
            b3 = c[2] - a1
            if c[3] == a2 + b1 and c[4] == a2 + b2 and c[5] == a2 + b3 and c[6] == a3 + b1 and c[7] == a3 + b2 and c[8] == a3 + b3:
                print('Yes')
                exit()
print('No')

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

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

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

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

	for i in range(3):
		for j in range(3):
			if a[i] + b[j] != c[i][j]:
				is_able = False
				break

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

  
if __name__ == "__main__":
  	main()

Solution (Python):








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

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

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

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

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

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





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

Solution (Python):
import numpy as np
IN = [list(map(int, input().split())) for _ in range(3)]
c = np.array(IN)
column = np.sum(c, axis=0)
row = np.sum(c, axis=1)
S = np.sum(c)
if S%3==0:
    S_ = S//3
    for i in range(S_+1):
        x = i
        y = S_ - x
        row_ = row - y
        column_ = column - x
        if all(col % 3 == 0 for col in column_) and all(ro % 3 == 0 for ro in row_):
            print("Yes")
            break
    else:
        print("No")
else:
    print("No")