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

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

for i in range(2):
    if c[i+1][0] -c[i][0] == c[i+1][1] -c[i][1] == c[i+1][2] -c[i][2]:
        pass
    else:
        print('No')
        exit(0)
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:
        print('No')
        exit(0)
print('Yes')

Solution (Python):

c = []
for i in range(3):
    a = list(map(int,input().split()))
    c.append(a)
flag = True
b = [[0]*3]*3
B = dict()
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        l = []
        for k in range(3):
            x = c[k][i] - c[k][j]
            if len(l) < 1:
                l.append(x)
            else:
                for m in range(len(l)):
                    if x != l[m]:
                        flag = False
                l.append(x)
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
src = []
src.append(list(map(int, input().split())))
src.append(list(map(int, input().split())))
src.append(list(map(int, input().split())))
for n1, n2 in zip([0, 1, 2], [1, 2, 0]):
    if not len(set(s[n1] - s[n2] for s in src)) == 1 or\
       not len(set(s1 - s2 for s1, s2 in zip(src[n1], src[n2]))) == 1:
        dst = "No"
        break
else:
    dst = "Yes"
print(dst)

Solution (Python):

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

Solution (Python):
ans = []
flag = True
for i in range(3):
    ans.append(list(map(int,input().split())))
for i in range(2):
    diff1 = ans[i][0]-ans[i+1][0]
    diff2 = ans[i][1]-ans[i+1][1]
    diff3 = ans[i][2]-ans[i+1][2]
    if diff1!=diff2 or diff2!=diff2 or diff3!=diff1:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')

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

Solution (Python):
def solve(CC):
    R = [sum(CC[i]) for i in range(3)]
    C = [sum(CC[j][i] for j in range(3)) for i in range(3)]
    checked = all((R[i] - R[i - 1]) % 3 == 0 for i in range(3))
    checked &= all((C[i] - C[i - 1]) % 3 == 0 for i in range(3))
    return 'Yes' if checked else 'No'

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

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

d = [[-1, -1, -1] for _ in range(3)]

for a1 in range(c[0][0]+1):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1

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

    d[0][0] = a1 + b1
    d[0][1] = a1 + b2
    d[0][2] = a1 + b3
    d[1][0] = a2 + b1
    d[1][1] = a2 + b2
    d[1][2] = a2 + b3
    d[2][0] = a3 + b1
    d[2][1] = a3 + b2
    d[2][2] = a3 + b3

    if c == d:
        print('Yes')
        exit(0)
    else:
        continue

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())
A1=-1
A2=-1
A3=-1
B1=-1
B2=-2
B3=-1
flag=0
for j in range(a+1):
    A1=j
    B1=a-A1
    B2=b-A1
    B3=c-A1
    if B1<0 or B2<0 or B3 <0:
        continue
    A2=d-B1
    A3=g-B1
    if A2<0 or A3<0:
        continue
    if d-B1==e-B2 and e-B2==f-B3 and g-B1==h-B2 and h-B2 == i-B3:
        flag=1
        break
print('Yes' if flag else 'No')

Solution (Python):
import math
import calendar
import fractions
import itertools

c = [[0, 0, 0] for _ in range(3)]

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

x = min(c[0])
y = min(c[1])
z = min(c[2])
ans = 0
for a1 in range(x + 1):
    for a2 in range(y + 1):
        for a3 in range(z + 1):
            if a1 - c[0][0] == a2 - c[1][0] == a3 - c[2][0] and a1 - c[0][1] == a2 - c[1][1] == a3 - c[2][1] and a1 - c[0][2] == a2 - c[1][2] == a3 - c[2][2]:
                ans = 1
                break
        if ans == 1:
            break
    if ans == 1:
        break

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

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

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

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

flag = True
for i in range(2):
	for j in range(i+1,3):
		c = grid[i][0] - grid[j][0]
		for k in range(1,3):
			if(c!=(grid[i][1] - grid[j][1]) or c!=(grid[i][2] - grid[j][2]) ):
				flag = False

for i in range(2):
	for j in range(i+1,3):
		c = grid[0][i] - grid[0][j]
		for k in range(1,3):
			if(c!=(grid[1][i] - grid[1][j]) or c!=(grid[2][i] - grid[2][j]) ):
				flag = False

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

Solution (Python):
c1 = [int(n) for n in input().split()]
c2 = [int(n) for n in input().split()]
c3 = [int(n) for n in input().split()]
if ((c1[0]-c1[1]) == (c2[0]-c2[1])) and ((c1[0]-c1[1]) == (c3[0]-c3[1])) and ((c2[0]-c2[1]) == (c3[0]-c3[1])):
    pass
else:
    print("No")
    exit()
if ((c1[1]-c1[2]) == (c2[1]-c2[2])) and ((c1[1]-c1[2]) == (c3[1]-c3[2])) and ((c2[1]-c2[2]) == (c3[1]-c3[2])):
    pass
else:
    print("No")
    exit()
if ((c1[0]-c1[2]) == (c2[0]-c2[2])) and ((c1[0]-c1[2]) == (c3[0]-c3[2])) and ((c2[0]-c2[2]) == (c3[0]-c3[2])):
    pass
else:
    print("No")
    exit()
print("Yes")

Solution (Python):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

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

print("Yes")

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

x = a + e == b + d and b + f == c + e and d + h == e + g and e + i == f + h
print('YNeos'[0 if x else 1::2])

Solution (Python):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

mis = 0
if a[0] + b[1] != a[1] + b[0]:
    print("No")
    quit(0)
elif a[1] + b[2] != a[2] + b[1]:
    print("No")
    quit(0)
elif a[0] + b[2] != a[2] + b[0]:
    print("No")
    quit(0)
elif a[0] + c[1] != c[1] + a[0]:
    print("No")
    quit(0)
elif a[1] + c[2] != a[2] + c[1]:
    print("No")
    quit(0)
elif a[0] + c[2] != a[2] + c[0]:
    print("No")
    quit(0)
elif b[0] + c[1] != c[1] + b[0]:
    print("No")
    quit(0)
elif b[1] + c[2] != b[2] + c[1]:
    print("No")
    quit(0)
elif b[0] + c[2] != b[2] + c[0]:
    print("No")
    quit(0)

print("Yes")

Solution (Python):



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

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

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

d = c12 - c11
e = c13 - c12
f = c21 - c11
g = c31 - c21

c12 -= c11
c13 -= c11
c21 -= c11
c22 -= c11
c23 -= c11
c31 -= c11
c32 -= c11
c33 -= c11
c11 -= c11

ok = 1
ok &= (c11 == 0)
ok &= (c12 == d)
ok &= (c13 == d + e)
ok &= (c21 == f)
ok &= (c22 == f + d)
ok &= (c23 == f + d + e)
ok &= (c31 == f + g)
ok &= (c32 == f + g + d)
ok &= (c33 == f + g + d + e)

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

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


c_11 = P[0][0]

for i in range(3):
    for j in range(3):
        P[i][j] -= c_11



A_1 = 0
A_2 = P[1][0]
A_3 = P[2][0]
B_1 = 0
B_2 = P[0][1]
B_3 = P[0][2]

Flag = "Yes"

if not A_2 + B_2 == P[1][1]:
    Flag = "No"
if not A_2 + B_3 == P[1][2]:
    Flag = "No"
if not A_3 + B_2 == P[2][1]:
    Flag = "No"
if not A_3 + B_3 == P[2][2]:
    Flag = "No"

print(Flag)

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

for i in range(2):
    if C[i+1][0]-C[0][0] == C[i+1][1]-C[0][1] == C[i+1][2]-C[0][2]:
        continue
    else:
        print('No')
        exit()

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()

print('Yes')

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

b[0] = s[0][0]
b[1] = s[0][1]
b[2] = s[0][2]

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

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

Solution (Python):

import sys
import math
import os

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]

class Util():
    def round_up(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x

C = [[int(x)for x in cin.string().split()]  for y in range(3)]
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
    a3 = C[2][0] - b1
    m = [[a1 + b1,a1 + b2,a1 + b3],[a2 + b1,a2 + b2,a2 + b3],[a3 + b1,a3 + b2,a3 + b3]]
    if m == C:
        print("Yes")
        sys.exit()
print("No")

Solution (Python):
import sys

input = sys.stdin.readline


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


    is_yes = True
    for j in range(2):
        tmp = 0
        for i in range(3):
            if i == 0:
                tmp = C[j + 1][i] - C[j][i]
            else:
                if tmp != C[j + 1][i] - C[j][i]:
                    is_yes = False
                    break

    for i in range(2):
        tmp = 0
        for j in range(3):
            if j == 0:
                tmp = C[j][i + 1] - C[j][i]
            else:
                if tmp != C[j][i + 1] - C[j][i]:
                    is_yes = False
                    break

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




if __name__ == '__main__':
    main()

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



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

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

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

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

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

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

b2_1 = A[0][1] - A[0][0]
b3_1 = A[0][2] - A[0][0]

if any([b2_1 != A[x][1] - A[x][0] for x in [1, 2]]) or any([b3_1 != A[x][2] - A[x][0] for x in [1,2]]):
    print("No")
else:
    print("Yes")

Solution (Python):
c=[[int(i) for i in input().split()] for j in range(3)]
ans='No'
for x in range(101):
  for y in range(101):
    for z in range(101):
      d=[]
      d.append([c[0][j]-x for j in range(3)])
      d.append([c[1][j]-y for j in range(3)])
      d.append([c[2][j]-z for j in range(3)])
      if sum(len(set(d[i][j] for i in range(3))) for j in range(3))==3:
             ans='Yes'
print(ans)

Solution (Python):
C = [0] * 3
A = [0] * 3
B = [0] * 3

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

B[0], B[1], B[2] = C[0][0], C[0][1], C[0][2]
A[1], A[2] = C[1][0]-B[0], C[2][0]-B[0]
flag = 0
for i in range(3):
    for k in range(3):
        if C[i][k] != A[i] + B[k]:
            flag = 1
            break
if flag == 1:
    print("No")
else:
    print("Yes")

Solution (Python):

import sys
c = list()
for i 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]

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]:
            print("No")
            sys.exit()

print("Yes")

Solution (Python):
C = [tuple(map(int, input().split())) for _ in range(3)]
print("YNeos"[not all(C[i][j]+C[(i+1)%3][(j+1)%3] == C[(i+1)%3][j]+ C[i][(j+1)%3]for i in range(3) for j in range(3))::2])

Solution (Python):
def is_right(a0, a1, a2):
    for j in range(H):
        if grids[j][0] - a0 == grids[j][1] - a1 == grids[j][2] - a2:
            continue
        else:
            return False
    return True


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

for a0 in range(100 + 1):
    for a1 in range(100 + 1):
        for a2 in range(100 + 1):
            if is_right(a0, a1, a2):
                print('Yes')
                exit()
print('No')

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


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] ])

Ab = np.array([
    [1, 0, 0, 1, 0, 0, C[0][0]],
    [1, 0, 0, 0, 1, 0, C[0][1]],
    [1, 0, 0, 0, 0, 1, C[0][2]],
    [0, 1, 0, 1, 0, 0, C[1][0]],
    [0, 1, 0, 0, 1, 0, C[1][1]],
    [0, 1, 0, 0, 0, 1, C[1][2]],
    [0, 0, 1, 1, 0, 0, C[2][0]],
    [0, 0, 1, 0, 1, 0, C[2][1]],
    [0, 0, 1, 0, 0, 1, C[2][2]] ])


rankA = np.linalg.matrix_rank(A)
rankAb = np.linalg.matrix_rank(Ab)

if rankA == rankAb:
    print('Yes')
else:
    print('No')

Solution (Python):
c = []
for h in range(3):
    c.append([int(x) for x in input().split()])
b = c[0]
a = [0, c[1][0]-b[0], c[2][0]-b[0]]
for n in range(1,3):
    for h in range(1,3):
        if c[h][n] != a[h]+b[n]:
            print("No")
            exit()
print("Yes")

Solution (Python):


import numpy as np

a=np.array([[int(x) for x in input().split()]for y in range(3)],dtype=np.int64)

for i in range(3):
    for j in range(0,3):
        a[i][j]-=a[i][2]


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

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

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

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

Solution (Python):
c1, c2, c3 = map(int, input().split())
c4, c5, c6 = map(int, input().split())
c7, c8, c9 = map(int, input().split())

if c4-c1 == c5-c2 == c6-c3 and\
   c7-c1 == c8-c2 == c9-c3 and\
   c7-c4 == c8-c5 == c9-c6:
  print('Yes')
else:
  print('No')

Solution (Python):

points = [ [None for j in range(3)] for i in range(3) ]
from itertools import product

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

valid = False

for a1 in range(101):
  maxA1 = min(points[0])

  if a1 > maxA1:
    continue

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

  A = {0: a1, 1: a2, 2: a3}
  B = {0: b1, 1: b2, 2: b3}

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


print("Yes")

Solution (Python):
li = []

li.append(list(map(int,input().split())))
li.append(list(map(int,input().split())))
li.append(list(map(int,input().split())))

ans = 'Yes'

for a0 in range(li[0][0] + 1):
  b0 = li[0][0] - a0
  b1 = li[1][0] - a0
  b2 = li[2][0] - a0

  a1 = li[0][1] - b0
  a2 = li[0][2] - b0

  if li[0][0] != a0 + b0:
    ans = 'No'
  
  if li[0][1] != a1 + b0:
    ans = 'No'

  if li[0][2] != a2 + b0:
    ans = 'No'

  if li[1][0] != a0 + b1:
    ans = 'No'

  if li[1][1] != a1 + b1:
    ans = 'No'

  if li[1][2] != a2 + b1:
    ans = 'No'

  if li[2][0] != a0 + b2:
    ans = 'No'

  if li[2][1] != a1 + b2:
    ans = 'No'

  if li[2][2] != a2 + b2:
    ans = 'No'

print(ans)

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

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 (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")
        break
else:
    print("No")

Solution (Python):
c = [list(map(int,input().split())) for _ in range(3)]
a = [0]*3
b = c[0]
a[1] = c[1][0]-b[0]
a[2] = c[2][0]-b[0]
flag = False
ans = "Yes"
for i in range(3):
    if flag:
        break
    for j in range(3):
        if c[i][j] != a[i]+b[j]:
            ans = "No"
            flag = True
            break
print(ans)

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

Solution (Python):
c = [list(map(int, input().split())) for i in range(3)]
r1 = sum(c[0][j] for j in range(3))
r2 = sum(c[1][j] for j in range(3))
r3 = sum(c[2][j] for j in range(3))
c1 = sum(c[i][0] for i in range(3))
c2 = sum(c[i][1] for i in range(3))
c3 = sum(c[i][2] for i in range(3))
if r1 % 3 == r2 % 3 == r3 % 3 and c1 % 3 == c2 % 3 == c3 % 3:
  print("Yes")
else:
  print("No")

Solution (Python):
c1, c2, c3 = map(int, input().split())
c4, c5, c6 = map(int, input().split())
c7, c8, c9 = map(int, input().split())

if c1-c4 == c2-c5 == c3-c6 and \
   c1-c7 == c2-c8 == c3-c9 and \
   c4-c7 == c5-c8 == c6-c9:
    print('Yes')
else:
    print('No')

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

Solution (Python):

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


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

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

flag = [0, 0, 0, 0]

if ls[0][0] - ls[1][0] == ls[0][1] - ls[1][1] and ls[0][1] - ls[1][1] == ls[0][2] - ls[1][2]:
    flag[0] = 1

if ls[1][0] - ls[2][0] == ls[1][1] - ls[2][1] and ls[1][1] - ls[2][1] == ls[1][2] - ls[2][2]:
    flag[1] = 1

if ls[0][0] - ls[0][1] == ls[1][0] - ls[1][1] and ls[1][0] - ls[1][1] == ls[2][0] - ls[2][1]:
    flag[2] = 1

if ls[0][1] - ls[0][2] == ls[1][1] - ls[1][2] and ls[1][1] - ls[1][2] == ls[2][1] - ls[2][2]:
    flag[3] = 1

if sum(flag) == 4:
    print("Yes")
else:
    print("No")

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


import sys
min_a1 = min(C[0])
min_a2 = min(C[1])
min_a3 = min(C[2])

for a1 in range(min_a1+1):
    b1_a1 = C[0][0] - a1
    b2_a1 = C[0][1] - a1
    b3_a1 = C[0][2] - a1
    for a2 in range(min_a2+1):
        b1_a2 = C[1][0] - a2
        b2_a2 = C[1][1] - a2
        b3_a2 = C[1][2] - a2
        for a3 in range(min_a3+1):
            b1_a3 = C[2][0] - a3
            b2_a3 = C[2][1] - a3
            b3_a3 = C[2][2] - a3

            if b1_a1 == b1_a2 == b1_a3 and b2_a1 == b2_a2 == b2_a3 and b3_a1 == b3_a2 == b3_a3:
                print('Yes')
                sys.exit()

print('No')

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

Solution (Python):
import sys


def solve(inp):
    A = [list(map(int, inp.readline().split(' '))) for i in range(3)]

    m = list(map(min, A))
    for a1 in range(m[0] + 1):
        c1 = [A[0][0] - a1, A[0][1] - a1, A[0][2] - a1]
        for a2 in range(m[1] + 1):
            c2 = [A[1][0] - a2, A[1][1] - a2, A[1][2] - a2]
            for a3 in range(m[2] + 1):
                c3 = [A[2][0] - a3, A[2][1] - a3, A[2][2] - a3]
                if c1 == c2 == c3:
                    return "Yes"

    return "No"


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()

Solution (Python):
f = []
for i in range(3):
    f.append(list(map(int, input().split())))
"""
a1+a2+a3+b1+b2+b3が3通りで合うか
"""
s1 = f[0][0] + f[1][1] + f[2][2]
s2 = f[0][1] + f[1][2] + f[2][0]
s3 = f[0][2] + f[1][0] + f[2][1]

if s1==s2==s3:
    print("Yes")
else:
    print("No")

Solution (Python):
c=[]
for i in range(3):
    x=list(map(int,input().split()))
    c.append(x)
flag=False
if c[0][0]-c[0][1]==c[1][0]-c[1][1]==c[2][0]-c[2][1]:
    if c[0][1]-c[0][2]==c[1][1]-c[1][2]==c[2][1]-c[2][2]:
        if c[0][0]-c[0][2]==c[1][0]-c[1][2]==c[2][0]-c[2][2]:
            if c[0][0]-c[1][0]==c[0][1]-c[1][1]==c[0][2]-c[1][2]:
                if c[0][0]-c[2][0]==c[0][1]-c[2][1]==c[0][2]-c[2][2]:
                    if c[2][0]-c[1][0]==c[2][1]-c[1][1]==c[2][2]-c[1][2]:
                        flag=True

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

Solution (Python):
import sys

c = []

for _ in range(3):
    *C, = map(int, input().split())
    c.append(C)

for a1 in range(0,101,1):
    b1 = c[0][0]-a1
    b2 = c[0][1]-a1
    b3 = c[0][2]-a1

    a2 = c[1][0]-b1
    if (a2+b2)!=c[1][1]:
        print("No")
        sys.exit()
    if (a2+b3)!=c[1][2]:
        print("No")
        sys.exit()
    a3 = c[2][0]-b1
    if (a3+b2)!=c[2][1]:
        print("No")
        sys.exit()
    if (a3+b3)!=c[2][2]:
        print("No")
        sys.exit()   
print("Yes")

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

Solution (Python):
c = []
for i in range(3):
  r = list(map(int, input().split()))
  c.append(r)
  
d1 = set([])
d2 = set([])
d3 = set([])
d4 = set([])
for i in range(3):
  d1.add(c[i][1] - c[i][0])
  d2.add(c[i][2] - c[i][1])
  d3.add(c[1][i] - c[0][i])
  d4.add(c[2][i] - c[1][i])
if len(d1) == 1 and len(d2) == 1 and len(d3) == 1 and len(d4) == 1:
  print('Yes')
else:
  print('No')

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  


def solve(c: "List[List[int]]"):
    for b1 in range(0,101):
        for b2 in range(0,101):
            for b3 in range(0,101):
                for i in range(3):
                    if c[i][0]-b1 == c[i][1]-b2 == c[i][2]-b3:
                        continue
                    else:
                        break
                else:
                    print(YES)
                    return

    print(NO)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    c = [[int(next(tokens)) for _ in range(3)] for _ in range(3)]  
    solve(c)

if __name__ == '__main__':
    main()

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

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

for j in range(2):
    for i in range(2):
        if C[i+1][j+1]-C[i+1][j]!=C[i][1+j]-C[i][j]:
            print('No')
            sys.exit()

print('Yes')

Solution (Python):
a = [list(map(int, input().split())) for i in range(3)]
for i in range(101):
    b1 = a[0][0] - i
    b2 = a[0][1] - i
    b3 = a[0][2] - i
    a1 = i
    a2 = a[1][0] - b1
    a3 = a[2][0] - b1
    A = [a1, a2, a3]
    B = [b1, b2, b3]
    flag = True

    for l in range(3):
        for r in range(3):
            if A[l]<0 or B[r] < 0 or a[l][r]!=A[l]+B[r]:
                flag = False
    if flag:
        print('Yes')
        exit()

print('No')

Solution (Python):
def check(a,b):
    for i in range(3):
        diffc[i] = c[i][a]-c[i][b]
        diffr[i] = c[a][i]-c[b][i]
    if diffc[0] != diffc[1] or diffc[1] != diffc[2] or diffr[0] != diffr[1] or diffr[1] != diffr[2]:
        print("No")
        exit()
        

c = [[int(i) for i in input().split()] for i in range(3)]
diffr = [0]*3
diffc = [0]*3
check(0,1)
check(1,2)
print("Yes")

Solution (Python):
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
x = min(c1)
y = min(c2)
z = min(c3)
for i in range(3):
  c1[i] -= x
  c2[i] -= y
  c3[i] -= z
print('NYoe s' [c1==c2==c3::2])

Solution (Python):
c = []
for i in range(3):
    x = list(map(int,input().split()))
    c.append(x)
check = 0
for i in range(100):
    b1 = c[0][0] - i
    b2 = c[0][1] - i
    b3 = c[0][2] - i
    if (c[0][0] - b1 == c[0][1] - b2 == c[0][2] - b3 and
        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):
        check = 1
        break
if check == 1:
    print('Yes')
else:
    print('No')

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

ans = 0
for i in range(101):
    b1 = A[0][0] - i
    b2 = A[0][1] - i
    b3 = A[0][2] - i
    a2_1 = A[1][0] - b1
    a2_2 = A[1][1] - b2
    a2_3 = A[1][2] - b3
    a3_1 = A[2][0] - b1
    a3_2 = A[2][1] - b2
    a3_3 = A[2][2] - b3
    if (a2_1 == a2_2) and (a2_2 == a2_3) and (a2_3 == a2_1) and (a3_1 == a3_2) and (a3_2 == a3_3) and (a3_3 == a3_1):
        ans += 0        
    else:
        ans += 1
if ans != 0:
    print('No')
else:
    print('Yes')

Solution (Python):
import numpy as np

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

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]])

B = np.array([
    [1,0,0,1,0,0,c[0][0]],
    [1,0,0,0,1,0,c[0][1]],
    [1,0,0,0,0,1,c[0][2]],
    [0,1,0,1,0,0,c[1][0]],
    [0,1,0,0,1,0,c[1][1]],
    [0,1,0,0,0,1,c[1][2]],
    [0,0,1,1,0,0,c[2][0]],
    [0,0,1,0,1,0,c[2][1]],
    [0,0,1,0,0,1,c[2][2]]])

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    print('Yes')
else:
    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 and a-d==b-e==c-f and d-g==e-h==f-i:
  print("Yes")
else:
  print("No")

Solution (Python):
import math
import numpy as np
from fractions import gcd
import collections

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

C = np.array(C)

cross1 = C[0][0] + C[1][1] + C[2][2]
cross2 = C[0][2] + C[1][1] + C[2][0]
if(cross1 == cross2 and np.sum(C)/6 == cross1/2):
    print('Yes')
else:
    print('No')

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

a1=0
b1=grid[0][0] - a1
b2=grid[0][1] - a1
b3=grid[0][2] - a1
a21=grid[1][0] - b1
a22=grid[1][1] - b2
a23=grid[1][2] - b3
a31=grid[2][0] - b1
a32=grid[2][1] - b2
a33=grid[2][2] - b3
if a21==a22==a23:
    if a31==a32==a33:
        print('Yes')
        exit()
print('No')

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    c = []
    csum = 0
    for _ in range(3):
        _c = LI()
        csum += sum(_c)
        c.append(_c)

    if c[0][0] + c[1][1] + c[2][2] == csum/3:
        print('Yes')
    else:
        print('No')
main()