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):
lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
    lis1.append(int(num))
for num in input().split():
    lis2.append(int(num))
for num in input().split():
    lis3.append(int(num))
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            count = 0
            if lis1[0] - a1 == lis2[0] - a2 == lis3[0] - a3:
                count += 1
            if lis1[1] - a1 == lis2[1] - a2 == lis3[1] - a3:
                count += 1
            if lis1[2] - a1 == lis2[2] - a2 == lis3[2] - a3:
                count += 1
            if count == 3:
                print("Yes")
                break
        if count == 3:
          	break
    if count == 3:
      break
    if a1 == 100 and count != 3:
      	print("No")

Solution (Python):

import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    c = readi(3, 3)
    d = list(zip(*c))
    print(
        "Yes"
        if all(
            len(set(i - j for i, j in zip(e[n], e[m]))) == 1
            for e in [c, d]
            for n in range(3)
            for m in range(n)
        )
        else "No"
    )


if __name__ == "__main__":
    main()

Solution (Python):
list1 = [int(s) for s in input().split()]
list2 = [int(s) for s in input().split()]
list3 = [int(s) for s in input().split()]
flag = 0
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            if (list1[0] - a1) == (list2[0] - a2) == (list3[0] - a3):
                if (list1[1] - a1) == (list2[1] - a2) == (list3[1] - a3):
                    if (list1[2] - a1) == (list2[2] - a2) == (list3[2] - a3):
                        print('Yes')
                        flag = 1
        if flag == 1:
            break
if flag == 0:
    print('No')

Solution (Python):

import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    c = readi(3, 3)
    d = list(zip(*c))
    print(
        "Yes"
        if all(
            len(set(i - j for i, j in zip(c[n], c[m]))) == 1
            for n in range(3)
            for m in range(n)
        )
        and all(
            len(set(i - j for i, j in zip(d[n], d[m]))) == 1
            for n in range(3)
            for m in range(n)
        )
        else "No"
    )


if __name__ == "__main__":
    main()

Solution (Python):
lis1 = []
lis2 = []
lis3 = []
count = 0
for num in input().split():
    lis1.append(int(num))
for num in input().split():
    lis2.append(int(num))
for num in input().split():
    lis3.append(int(num))
if lis1[0]-lis2[0]==lis1[1]-lis2[1]==lis1[2]-lis2[2]:
    count += 1
if lis1[0]-lis3[0]==lis1[1]-lis3[1]==lis1[2]-lis3[2]:
    count += 1
if lis1[0]-lis1[1]==lis2[0]-lis2[1]==lis3[0]-lis3[1]:
    count += 1
if lis1[0]-lis1[2]==lis2[0]-lis2[2]==lis3[0]-lis3[2]:
    count += 1
if count == 4:
    print("Yes")
else:
    print("No")

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

B = C[0]
A = [0, C[1][0] - B[0], C[2][0] - B[0]]

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

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

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]):
        print("No")
        exit()
    if not(c[i+1][0] - c[i][0] == c[i+1][1] - c[i][1] == c[i+1][2] - c[i][2]):
        print("No")
        exit()

print("Yes")

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

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

Solution (Python):

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
C=[IL() for i in range(3)]
A=[0,0,0]
B=[0,0,0]
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]
flag=True
for i in range(3):
    for j in range(3):
        if A[i]+B[j]!=C[i][j]:
            flag=False
if flag:
    print("Yes")
else:
    print("No")

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

AB = [0 for i in range(6)]
AB[3] = C[0][0] - 0
AB[1] = C[1][0] - AB[3]
AB[2] = C[2][0] - AB[3]
AB[4] = C[0][1] - 0
AB[5] = C[0][2] - 0
if C[1][1] != AB[1] + AB[4]:
    print('No')
    quit()
if C[1][2] != AB[1] + AB[5]:
    print('No')
    quit()
if C[2][1] != AB[2] + AB[4]:
    print('No')
    quit()
if C[2][2] != AB[2] + AB[5]:
    print('No')
    quit()

print('Yes')

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


def solve():
    for i in range(max(grid[0]) + 1):
        b1 = grid[0][0] - i
        b2 = grid[0][1] - i
        b3 = grid[0][2] - i
        if not b1 < 0 and not b2 < 0 and not b3 < 0:
            if grid[1][0] - b1 == grid[1][1] - b2 == grid[1][2] - b3:
                if grid[2][0] - b1 == grid[2][1] - b2 == grid[2][2] - b3:
                    print("Yes")
                    return 0
    print("No")
    return 0


if __name__ == "__main__":
    solve()

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


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

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

l1 = C[0]
l2 = C[1]
if not(l2[0] - l1[0] == l2[1] - l1[1] == l2[2] - l1[2]):
	print("No")
	exit()

l1 = C[0]
l2 = C[2]
if not(l2[0] - l1[0] == l2[1] - l1[1] == l2[2] - l1[2]):
	print("No")
	exit()

print("Yes")

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

Solution (Python):
b=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
for i in range(max(0,b[0]-100,b[1]-100,b[2]-100),min(100,b[0],b[1],b[2])+1):
  t1=set()
  t2=set()
  for j in range(3):
    t1.add(a2[j]-(b[j]-i))
    t2.add(a3[j]-(b[j]-i))
  if len(t1)==1 and len(t2)==1 and list(t1)[0]>=0 and list(t2)[0]>=0:
    print('Yes')
    break
else:
  print('No')

Solution (Python):
hog1=list(map(int,input().split()))
hog2=list(map(int,input().split()))
hog3=list(map(int,input().split()))

for i in range(100):
  if(hog1[0]!=0 and hog1[1]!=0 and hog1[2]!=0):
    hog1[0]-=1
    hog1[1]-=1
    hog1[2]-=1
  if(hog2[0]!=0 and hog2[1]!=0 and hog2[2]!=0):
    hog2[0]-=1
    hog2[1]-=1
    hog2[2]-=1
  if(hog3[0]!=0 and hog3[1]!=0 and hog3[2]!=0):
    hog3[0]-=1
    hog3[1]-=1
    hog3[2]-=1
  if(hog1[0]!=0 and hog2[0]!=0 and hog3[0]!=0):
    hog1[0]-=1
    hog2[0]-=1
    hog3[0]-=1
  if(hog1[1]!=0 and hog2[1]!=0 and hog3[1]!=0):
    hog1[1]-=1
    hog2[1]-=1
    hog3[1]-=1
  if(hog1[2]!=0 and hog2[2]!=0 and hog3[2]!=0):
    hog1[2]-=1
    hog2[2]-=1
    hog3[2]-=1

ans=sum(hog1)+sum(hog2)+sum(hog3)
if(ans==0):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    g = [f() for i in range(3)]

    for i in range(2):
        if g[i][0] - g[i+1][0] != g[i][1] - g[i+1][1] or g[i][1] - g[i+1][1] != g[i][2] - g[i+1][2]:
            print('No')
            return
    
    for i in range(2):
        if g[0][i] - g[0][i+1] != g[1][i] - g[1][i+1] or g[2][i] - g[2][i+1] != g[1][i] - g[1][i+1]:
            print('No')
            return

    print('Yes')

solve()

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

L = [None] * 3
for i in range(3):
    L[i] = [int(v) for v in input().split()]
    
rl = [L[0][0] - L[0][1], L[0][1] - L[0][2]]
hl = [L[0][0] - L[1][0], L[1][0] - L[2][0]]

for v in L:
    if [v[0] - v[1], v[1] - v[2]] != rl:
        print("No")
        sys.exit()
        
for i in range(3):
    if [L[0][i] - L[1][i], L[1][i] - L[2][i]] != hl:
        print("No")
        sys.exit()
        
print("Yes")

Solution (Python):
C = [[int(x) for x in input().split()] for _ in range(3)]
ans = C[0][0]+C[1][1]+C[2][2]
if(ans == C[0][2]+C[1][0]+C[2][1] and ans == C[0][1]+C[1][2]+C[2][0]):
    print('Yes')
else:
    print('No')

Solution (Python):
from sys import exit, stdin
C = [list(map(int, stdin.readline().rstrip().split())) for _ in range(3)]
a1,a2,a3,b1,b2,b3 = 0,0,0,0,0,0
for i in range(0,101):
    a1=i
    b1, b2, b3 = C[0][0]-a1,C[0][1]-a1,C[0][2]-a1
    for j in range(0,101):
        a2=j
        j_flag = a2+b1 == C[1][0] and a2+b2 == C[1][1] and a2+b3 == C[1][2]
        for k in range(0,101):
            a3=k
            k_flag = a3+b1 == C[2][0] and a3+b2 == C[2][1] and a3+b3 == C[2][2]
            if j_flag == True and k_flag == True:
                print('Yes')
                exit()
print('No')

Solution (Python):


def read_input():
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))
    return [c1, c2, c3]


def get_v(c, i):
    result = [c[j][i] for j in range(3)]
    return result


def get_h(c, i):
    result = [c[i][j] for j in range(3)]
    return result


def check_diff(a, b):
    diff = [i - j for i,j in zip(a, b)]

    d = diff[0]
    for e in diff[1:]:
        if d != e:
            return False
    return True


def submit():
    c = read_input()

    checkee = [(0, 1), (1, 2), (0, 2)]
    result = []
    for check in checkee:
        result.append(check_diff(get_v(c, check[0]), get_v(c, check[1])))
        result.append(check_diff(get_h(c, check[0]), get_h(c, check[1])))

    if all(result):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    submit()

Solution (Python):
c = []

for i in range(3):
    c.append(list(map(int, input().split())))
setset = {len({c[i][0] - c[i][1] for i in range(3)}),
          len({c[i][0] - c[i][2] for i in range(3)}),
          len({c[0][i] - c[2][i] for i in range(3)}),
          len({c[0][i] - c[2][i] for i in range(3)})
          }
l = list(setset)
print('Yes'if l == [1]else 'No')

Solution (Python):
a = [input().split() for l in range(3)]

x0 = 0
x1 = 0
x2 = 0
y0 = 0
y1 = 0
y2 = 0
judg = 0
for i in range(3):
    for j in range(3):
        a[i][j] = int(a[i][j])

for i in range(100):
    x0 = i
    y0 = a[0][0] - i
    y1 = a[0][1] - i
    y2 = a[0][2] - i
    x1 = a[1][1] - y1
    x2 = a[2][2] - y2
    if a[1][0] == x1 + y0 and a[1][2] == x1 + y2 and a[2][0] == x2 + y0 and a[2][1] == x2 + y1:
        judg = 1
    break

if judg == 0:
    print("No")
else:
    print("Yes")

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

temp = max(c1)
if temp == 0:
    temp = 1

for i in range(temp):
    x1= c1[0] - i
    x2 = c1[1] - i
    x3 = c1[2] - i
    y1 = i
    y2 = c2[0] - x1
    y3 = c3[0] - x1
    
    if x1+y1 == c1[0] and x2+y1 == c1[1] and x3+y1 == c1[2] and x1+y2 == c2[0] and x2+y2 == c2[1] and x3+y2 == c2[2] and x1+y3 == c3[0] and x2+y3 == c3[1] and x3+y3 == c3[2]:
        print("Yes")
        break
    else:
        print("No")
        break

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

X = [0,0,0]
Y = [0,0,0]

for i in range(3):
    Y[i] = C[0][i] - X[0]
for i in range(3):
    X[i] = C[i][0] - Y[0]

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

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

x1 = (c1[1]-c1[0] == c2[1]-c2[0] == c3[1]-c3[0])
x2 = (c1[2]-c1[1] == c2[2]-c2[1] == c3[2]-c3[1])
x3 = (c2[0]-c1[0] == c2[1]-c1[1] == c2[2]-c1[2])
x4 = (c3[0]-c2[0] == c3[1]-c2[1] == c3[2]-c2[2])

if x1 and x2 and x3 and x4:
  print("Yes")
else:
  print("No")

Solution (Python):
c1,c2,c3=map(int,input().split())
d1=c2-c1
d2=c3-c2
ans=0
for i in range(2):
  c1,c2,c3=map(int,input().split())
  if c2-c1!=d1 or c3-c2!=d2:
    ans+=1
print("Yes" if ans==0 else "No")

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

Solution (Python):
import itertools
l1 = list(map(int,input().split(" ")))
l2 = list(map(int,input().split(" ")))
l3 = list(map(int,input().split(" ")))

flag = True
diffs = []
for i in range(3):
    diffs.append(l1[i]-l2[i])

if len(set(diffs)) != 1:
    flag = False


diffs = []
for i in range(3):
    diffs.append(l2[i]-l3[i])

if len(set(diffs)) != 1:
    flag = False

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

Solution (Python):
x =list(map(int, input().split()))
y =list(map(int, input().split()))
z =list(map(int, input().split()))

if (sum(x)-sum(y)) % 3 == 0 and (sum(x)-sum(z)) % 3 ==0 \
    and ((x[0] + y[0] + z[0]) - (x[1] + y[1] + z[1])) % 3 ==0\
    and ((x[0] + y[0] + z[0]) - (x[2] + y[2] + z[2])) % 3 ==0:
        print('Yes')
else:
    print('No')

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

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

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

for i in range(3):
    for j in range(3):
        if c[i][j] != 0:
            print('No')
            exit()

print('Yes')

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

for i in range(101):
    b = [c[0][0]-i, c[0][1]-i, c[0][2]-i]
    a = [i, c[1][0]-b[0], c[2][0]-b[0]]
    flag = False
    for j in range(3):
        for k in range(3):
            if c[j][k] != a[j] + b[k]:
                flag = True
                break
            if j == 2 and k == 2:
                ans = True
        if flag:
            break

if ans:
    print('Yes')
else:
    print('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())))
a = []

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

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

Solution (Python):
import numpy as np

c1 = [int(i) for i in input().split(" ")]
c2 = [int(i) for i in input().split(" ")]
c3 = [int(i) for i in input().split(" ")]
c = np.array([c1, c2, c3])

a = [[i[2] - i[1], i[1] - i[0]] for i in c.T]
b = [[i[2] - i[1], i[1] - i[0]] for i in c]

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

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

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

    for a1 in range(101):
        for a2 in range(101):
            for a3 in range(101):
                b1 = c[0][0] - a1
                b2 = c[0][1] - a1
                b3 = c[0][2] - a1
                a = [a1, a2, a3]
                b = [b1, b2, b3]
                flag = True
                for i in range(3):
                    for j in range(3):
                        if c[i][j] != a[i] + b[j]:
                            flag = False
                if flag:
                    print("Yes")
                    return
    print("No")

main()

Solution (Python):
c = [list(map(int,input().split())) for _ in [0]*3]
def main():
    for i in range(3):
        tmp1 = set()
        tmp2 = set()
        for j in range(3):
            tmp1.add(c[i][j]-c[(i+1)%3][j])
            tmp2.add(c[j][i]-c[j][(i+1)%3])
        if len(tmp1) != 1 or len(tmp2) != 1:
            return "No"
    return "Yes"
print(main())

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)












a = [[int(i) for i in input().split()] for k in range(3)]
for i in range(3):
    m = min(a[i])
    for k in range(3):
        a[i][k]-=m
for i in range(3):
    if not(a[0][i] == a[1][i] and a[1][i] == a[2][i]) :j(0)
j(1)

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

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


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

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

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

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

is_true = [0, 0]
for i in range(-100, 101):
    row = [v + i for v in c1]
    if row == c2:
        is_true[0] = 1
    if row == c3:
        is_true[1] = 1

print('Yes' if all(is_true) else 'No')

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

Solution (Python):
from numpy import*
x=array([list(map(int,input().split()))for i in range(3)])
for i in range(3):
    if sum(x[i]-x[i-1])%3 or sum(x[:,i]-x[:,i-1])%3:
        print("No")
        exit()
print("Yes")

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

for i in range(2):
    for j in range(i+1, 3):
        if c[i][j] + c[j][i] != c[i][i] + c[j][j]:
            print('No')
            exit()

print('Yes')

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

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

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

Sum = 0
for i in c:
    Sum += sum(i)

if Sum % 3:
    print('No')
else:
    if c[0][0]-c[0][1] != c[1][0]-c[1][1] or c[1][0]-c[1][1] != c[2][0]-c[2][1] or c[0][1]-c[0][2] != c[1][1]-c[1][2] or c[1][1]-c[1][2] != c[2][1]-c[2][2]:
        print("No")
    else:
        print("Yes")

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

Solution (Python):
import numpy as np

if __name__ == '__main__':
    rows = []
    for i in range(3):
        rows.append([int(i) for i in input().split()])
    mat = np.matrix(rows)

    upper_a = [mat[i, :].max() for i in range(3)]
    upper_b = [mat[:, i].max() for i in range(3)]

    
    

    for a1 in range(upper_a[0]+1):
        bs = [v - a1 for v in mat[0, :].tolist()[0]]
        
        for a2 in range(upper_a[1]+1):
            vals = [a2 + b for b in bs]
            
            if vals == mat[1, :].tolist()[0]:
                for a3 in range(upper_a[2]+1):
                    vals = [a3 + b for b in bs]
                    if vals == mat[2, :].tolist()[0]:
                        print('Yes')
                        exit(0)

    print('No')

Solution (Python):
m=[list(map(int,input().split()))for i in range(3)]
ans=0
if m[0][0]-m[1][0]!=m[0][1]-m[1][1]:
  ans=1
if m[0][0]-m[1][0]!=m[0][2]-m[1][2]:
  ans=1
if m[0][0]-m[2][0]!=m[0][1]-m[2][1]:
  ans=1
if m[0][0]-m[2][0]!=m[0][2]-m[2][2]:
  ans=1
if m[0][0]-m[0][1]!=m[1][0]-m[1][1]:
  ans=1
if m[0][0]-m[0][1]!=m[2][0]-m[2][1]:
  ans=1
if m[0][0]-m[0][2]!=m[1][0]-m[1][2]:
  ans=1
if m[0][0]-m[0][2]!=m[2][0]-m[2][2]:
  ans=1
print("YNeos"[ans::2])

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

a=[0,0,0]
b=[0,0,0]
for i in range(100):
    a[0] = i
    b[0] = C1[0] - a[0]
    b[1] = C1[1] - a[0]
    b[2] = C1[2] - a[0]
    a[1] = C2[0] - b[0]
    a[2] = C3[0] - b[0]

    if a[1]+b[1]==C2[1] and a[1]+b[2]==C2[2] and a[2]+b[1]==C3[1] and a[2]+b[2]==C3[2]:
        print("Yes")
        exit()
print("No")

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

ans = True
for i in range(2):
    if c[0][i] - c[0][i + 1] == c[1][i] - c[1][i + 1] == c[2][i] - c[2][i + 1]:
        pass
    else:
        ans = False
for j in range(2):
    if c[j][0] - c[j][0] == c[j][1] - c[j][1] == c[j][2] - c[j][2]:
        pass
    else:
        ans = False
if ans:
    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())

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

ans = "Yes"

for i in range(1,3):
    a = c[0][0] - c[0][i]
    if c[1][0] - a != c[1][i] or c[2][0] - a != c[2][i]:
        ans = "No"
for i in range(1,3):
    a = c[0][0] - c[i][0]
    if c[0][1] - a != c[i][1] or c[0][2] - a != c[i][2]:
        ans = "No"
    
print(ans)

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

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

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

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

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

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

matrix = sorted(matrix)
for i in range(1, 3):
    diff = matrix[i][0] - matrix[0][0]
    for j in range(3):
        if matrix[i][j] != matrix[0][j] + diff:
            print('No')
            exit()
print('Yes')

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

C = [C1, C2, C3]
A = [0] * 3
B = [0] * 3

B = C1
A[1] = C2[0] - B[0]
A[2] = C3[0] - B[0]
flg = True
for i, a in enumerate(A):
    for j, b in enumerate(B):
        if C[i][j] != a + b:
            flg = False

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

Solution (Python):
def main():
    C1n = list(map(int, input().split()))
    C2n = list(map(int, input().split()))
    C3n = list(map(int, input().split()))

    C = [C1n, C2n, C3n]

    a_s = [0]
    b_s = [C[0][0], C[0][1],C[0][2]]

    a_s.append(C[1][0] - b_s[0])
    a_s.append(C[2][0] - b_s[0])

    for i, a_i in enumerate(a_s):
        for j, b_j in enumerate(b_s):
            if not ((a_i + b_j) == C[i][j]):
                print("No")
                return 

    print("Yes")
      
main()

Solution (Python):
def main():
    C1n = list(map(int, input().split()))
    C2n = list(map(int, input().split()))
    C3n = list(map(int, input().split()))

    C = [C1n, C2n, C3n]

    for i in range(3):
        for j in range(3):
            if (not (C[i][j] - C[(i+1)%2][j]) == (C[i][(j+1)%2] - C[(i+1)%2][(j+1)%2])) or (not (C[i][j] - C[i][(j+1)%2]) == (C[(i+1)%2][j] - C[(i+1)%2][(j+1)%2])):
                print("No")
                return

    print("Yes")

main()

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

diff_list_x=[]
diff_list_y=[]
for i in range(3):
	diff_list_x.append([c[i][0]-c[i][1],c[i][1]-c[i][2]])
for i in range(3):
	diff_list_y.append([c[0][i]-c[1][i],c[1][i]-c[2][i]])

if diff_list_x[0]==diff_list_x[1]==diff_list_x[2] and diff_list_y[0]==diff_list_y[1]==diff_list_y[2]:
	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()))

flag = 'No'
for i in range(c1[0] + 1):
    a1 = i
    b1 = c1[0] - a1
    b2 = c1[1] - a1
    b3 = c1[2] - a1
    a2 = c2[0] - b1
    a3 = c3[0] - b1

    c22 = a2 + b2
    c23 = a2 + b3
    c32 = a3 + b2
    c33 = a3 + b3

    if (c2[1] - c22) ** 2 + (c2[2] - c23) ** 2 + (c3[1] - c32) ** 2 + (c3[2] - c33) ** 2 == 0:
         flag = 'Yes'
print(flag)

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

for i in range(101):
    a1 = i
    b1 = c1[0] - a1
    b2 = c1[1] - a1
    b3 = c1[2] - a1
    a2 = c2[0] - b1
    a3 = c3[0] - b1
    c2_2 = a2 + b2
    c2_3 = a2 + b3
    c3_2 = a3 + b2
    c3_3 = a3 + b3
    if c2_2 == c2[1] and c2_3 == c2[2] and c3_2 == c3[1] and c3_3 == c3[2]:
        answer = 'Yes'
        break
print(answer)

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

for i in range(2):
  for j in range(2):
    if c[i][j]+c[i+1][j+1] == c[i+1][j]+c[i][j+1]:
      check += 1
if c[0][0]+c[2][2] == c[0][2]+c[2][0]:
  check += 1
      
if check == 5:
  print("Yes")
else:
  print("No")

Solution (Python):
c=[map(int, raw_input().split()) for i in range(3)]
def C(i,j):return c[i-1][j-1]
if C(1,1)-C(1,2) == C(3,1)-C(3,2) == C(2,1)-C(2,2) and C(1,2)-C(1,3)==C(2,2)-C(2,3)==C(3,2)-C(3,3):
    print("Yes")
else:
    print("No")

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

Solution (Python):
C = [0]*3
C1 = [[0]*2]*3
C2 = [[0]*3]*2
flg = False
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i][j+1] != C[i+1][j] -C[i+1][j+1]):
      flg = True
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i+1][j] != C[i][j+1] -C[i+1][j+1]):
      flg = True
print("No" if flg else "Yes")

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

judge = 0 
for i in range(max_c+1):
  a1 = i 
  b1,b2,b3 = C[0][0]-a1,C[0][1]-a1,C[0][2]-a1
  if( ((C[1][0]-b1)==(C[1][1]-b2))and((C[1][0]-b1)==(C[1][2]-b3)) ):
    if( ((C[2][0]-b1)==(C[2][1]-b2))and((C[2][0]-b1)==(C[2][2]-b3)) ):
       judge = 1
       break

if(judge == 0): print('No')
else: print('Yes')