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



Sample input:
1 0 1
2 1 2
1 0 1


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
import sys
check_ary = [[0 for i in range(3)]for i in range(2)]
num_ary   = [[0 for i in range(3)]for i in range(3)]
check_minus = True

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

for i in range(num_ary[0][0]+1):
    check_ary[0][0] = i

    for x in range(3):
        check_ary[1][x] = num_ary[0][x] - i
        if check_ary[1][x] < 0:
            check_minus = False

    for a in range(1,3):
        check_ary[0][a] = num_ary[a][0] - check_ary[1][0]
        if check_ary[0][a] < 0:
            check_minus = False

    if check_minus == False:
        continue

    for x in range(3):
        for y in range(3):
            if not check_ary[0][x] +check_ary[1][y] == num_ary[x][y]:
                break
        else:
            continue
        break
    else :
        print("Yes")
        sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

C = [[0]*3 for i in range(3)]

def exit_if_under_zero(i):
    if i < 0:
        print("No")
        exit()
    return i
def exit_if_not_eq(i, j):
    if i != j:
        print("No")
        exit()

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

for i in range(C[0][0]):
    a1 = i
    b1 = exit_if_under_zero(C[0][0] - a1)
    b2 = exit_if_under_zero(C[0][1] - a1)
    b3 = exit_if_under_zero(C[0][2] - a1)
    a2 = exit_if_under_zero(C[1][0] - b1)
    exit_if_not_eq(C[1][1], a2 + b2)
    exit_if_not_eq(C[1][2], a2 + b3)
    a3 = exit_if_under_zero(C[2][0] - b1)
    exit_if_not_eq(C[2][1], a3 + b2)
    exit_if_not_eq(C[2][2], a3 + b3)
print("Yes")

Submission status: Wrong Answer

Solution code:
def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n//i)
    if sort:
        d.sort()
    return d


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

for a0 in divisors(sum(C[0])):
    a = [a0, None, None]
    b = [None, None, None]
    b[0] = C[0][0] - a[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]
    ok = True
    for i in range(3):
        for j in range(3):
            if C[i][j] != a[i] + b[j]:
                ok = False
    if ok:
        print('Yes')
        exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            if ((3* a1 - 3 * a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (3* a1- 3 * a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (3 * a2 - 3 * a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
print(result)

Submission status: Wrong Answer

Solution code:
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            if ((a1 - a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (a1-a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (a2 - a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
print(result)

Submission status: Wrong Answer

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

a_list = [0]
b_list = []

for c in c_list[0]:
    b = c - a_list[0]
    b_list.append(b)

for c,b in zip(c_list[0][1:],b_list[1:]):
    a = c - b
    a_list.append(a)

def check():
    for i in range(3):
        for j in range(3):
            a = a_list[i]
            b = b_list[j]
            c = c_list[i][j]
            if not c == a + b:
                return False
    return True

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

Submission status: Wrong Answer

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

tr = []
for c in zip(*cs):
    tr.append(list(c))

def transpose(cs):
    tr = []
    for c in zip(*cs):
        tr.append(list(c))
    return tr

def diff_equal(cs):
    kl = []
    lm = []
    for c in cs:
        k,l,m = c
        kl.append(k-l)
        lm.append(l-m)
#     print(kl)
#     print(lm)
    if len(set(kl)) != 1:
        return False
    if len(set(lm)) != 1:
        return False

def check():
    if not diff_equal(cs):
        return False
    if not diff_equal(transpose(cs)):
        return False
    return True

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

main()

Submission status: Wrong Answer

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

d = []
for i in range(3):
  sum = 0
  d.append([])
  for j in range(3):
    sum += c[i][j]
  for j in range(3):
    d[i].append(c[i][j] - sum/3)
    
for i in range(3):
  if d[0][i]==d[1][i] and d[0][i]==d[2][i]:
    pass
  else:
    print('No')
    break
else:
  print('Yes')

Submission status: Wrong Answer

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

d = []
for i in range(3):
  sum = 0
  d.append([])
  for j in range(3):
    sum += c[i][j]
  for j in range(3):
    d[i].append(c[i][j] - sum/3)
    
if d[0]==d[1] and d[1]==d[2]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

import sys

r1 = list(map(int,input().split()))
r2 = list(map(int,input().split()))
r3 = list(map(int,input().split()))

for ai in range(11):
    for aj in range(11):
        for ak in range(11):
            for bi in range(11-ai):
                for bj in range(11-aj):
                    for bk in range(11-ak):
                        if r1[0] == ai + bi and \
                            r1[1] == ai + bj and \
                            r1[2] == ai + bk and \
                            r2[0] == aj + bi and \
                            r2[1] == aj + bj and \
                            r2[2] == aj + bk and \
                            r3[0] == ak + bi and \
                            r3[1] == ak + bj and \
                            r3[2] == ak + bk:
                            print('Yes')
                            sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
n = [[0 for i in range(3)] for j in range(3)]

for i in range(3):
  x,y,z = input().split()
  n[i][0] = int(x)
  n[i][1] = int(y)
  n[i][2] = int(z)
  
a = [0,0,0]
b = [0,0,0]

isCmp = False

for j in range(100 +1):
  b[0] = j
  
  a[0] = n[0][0] -b[0]
  a[1] = n[1][0] -b[0]
  a[2] = n[2][0] -b[0]
  b[1] = n[0][1] -a[0]
  b[2] = n[0][2] -a[0]
  
  if  n[0][0] == a[0]+b[0] \
  and n[1][1] == a[1]+b[1] \
  and n[2][2] == a[2]+b[2]:
    print('Yes')
    isCmp = True
    break

    
if isCmp == False:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1max = max([c11, c12, c13])
    for a1 in range(0, r1max):
        r2max = max([c21, c22, c23])
        for a2 in range(0, r2max):
            r3max = max([c31, c32, c33])
            for a3 in range(0, r3max):
                m = max([a1, a2, a3])
                for b1 in range(0, 101 - m):
                    C11 = a1 + b1
                    C21 = a2 + b1
                    C31 = a3 + b1
                    if C11 == c11 and C21 == c21 and C31 == c31:
                        for b2 in range(0, 101 - m):
                            C12 = a1 + b2
                            C22 = a2 + b2
                            C32 = a3 + b2
                            if C12 == c12 and C22 == c22 and C32 == c32:
                                for b3 in range(0, 101 - m):
                                    C13 = a1 + b3
                                    C23 = a2 + b3
                                    C33 = a3 + b3
                                    if C13 == c13 and C23 == c23 and C33 == c33:
                                        print('Yes')
                                        return

    print('No')
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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(0, 101):
        for a2 in range(0, 101):
            for a3 in range(0, 101):
                for b1 in range(0, 101):
                    if a1 + b1 > 100 or a2 + b1 > 100 or a3 + b1 > 100:
                        break
                    if a1 + b1 == c11 and a2 + b1 == c21 and a3 + b1 == c31:
                        for b2 in range(0, 101):
                            if a1 + b2 > 100 or a2 + b2 > 100 or a3 + b2 > 100:
                                break
                            if a1 + b2 == c11 and a2 + b2 == c21 and a3 + b2 == c31:
                                for b3 in range(0, 101):
                                    if a1 + b3 > 100 or a2 + b3 > 100 or a3 + b3 > 100:
                                        break
                                    if a1 + b3 == c11 and a2 + b3 == c21 and a3 + b3 == c31:
                                        print('Yes')
                                        return

    print('No')
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
c=[[0 for i in range(3)] for j in range(3)]


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

Submission status: Wrong Answer

Solution code:
# ABC 088 C

from collections import deque

def resolve():
    def all_same(a, b, c):
        if a ==b and b ==c:
            return True
        return False

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

    if not all_same(c[0][0]-c[1][0], c[0][1] - c[1][1], c[2][0]-c[1][0]):
        ans = False
    if not all_same(c[0][0]-c[2][0], c[0][1] - c[2][1], c[2][0]-c[2][0]):
        ans = False
    if not all_same(c[0][0] - c[0][1], c[1][0] - c[1][1], c[2][0] - c[2][1]):
        ans = False
    if not all_same(c[0][0] - c[0][2], c[1][0] - c[1][2], c[2][0] - c[2][2]):
        ans = False

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


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def Infomation():
    if not (c11 - c21 == c12 - c22 == c13 - c23):
        return False
    if not (c11 - c31 == c12 - c33 == 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())

flag = Infomation()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
lis_a = [0] * 3

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

b = [0] * 3

for i in range(min(lis_a[0])):
    a_1 = i
    for k in range(3):
        b[k] = lis_a[0][k] - a_1
    a_2 = lis_a[1][0] - b[0]
    a_3 = lis_a[2][0] - b[0]
    a = [a_1, a_2, a_3]
    for l in range(3):
        for m in range(3):
            if a[l] + b[m] != lis_a[l][m]:
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
lis_a = [0] * 3

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

b = [0] * 3

for i in range(min(lis_a[0])):
    a_1 = i
    for k in range(3):
        b[k] = lis_a[0][k] - a_1
    a_2 = lis_a[1][1] - b[0]
    a_3 = lis_a[1][2] - b[0]
    a = [a_1, a_2, a_3]
    for l in range(3):
        for m in range(3):
            if a[l] + b[m] != lis_a:
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
o =0
for i in range(3):
  t = list(map(int,input().split()))
  o += sum(t)
if o%3 ==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

sa=[c[0][0]-c[0][1], c[0][1]-c[0][2]]
for i in range(2):
    if sa[i]!=c[i+1][i]-c[i+1][i+1]:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

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

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

flag = True
for i in range(3):
    for j in range(3):
        if a[i] + b[j] == c[i][j]:
            pass
        else:
            flag = False
            break

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

Submission status: Wrong Answer

Solution code:
c = [[int(i) for i in input().split()] for i in range(3)]
a,b = [],[]
for i in range(3):
    a.append(min(c[i]))
    b.append(min(c[0][i],c[1][i],c[2][i]))

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

Submission status: Wrong Answer

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

a1 = 0
a2 = 0
a3 = 0
b1 = 0
b2 = 0
b3 = 0

flag = 0
for i in range(0, 101):
    for j in range(0, 101):
        for k in range(0, 101):
            if i+j == int(c[0][0]) and i+k == int(c[0][1]):
                a1 = i
                b1 = j
                b2 = k
                b3 = int(c[0][2])-i

if int(c[1][0])-b1 == int(c[1][1])-b2 and int(c[1][1])-b2 == int(c[1][2])-b3:
    if int(c[2][0])-b1 == int(c[2][1])-b2 and int(c[1][1])-b2 == int(c[1][2])-b3:
        flag = 1 

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

Submission status: Wrong Answer

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

flg = "Yes"

for i in range(2):
    if ls[0][i]-ls[0][i] == ls[1][i]-ls[1][i] and ls[0][i]-ls[0][i] == ls[2][i]-ls[2][i]:
        pass
    else:
        flg = "No"
print(flg)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
tmp = sum(a)
tmp += a[0]
a = list(map(int, input().split()))
tmp += sum(a)
tmp += a[1]
a = list(map(int, input().split()))
tmp += sum(a)
tmp += a[2]
print('Yes' if tmp % 4 == 0 else 'No')

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
tmp = sum(a)
tmp += a[0] + a[2]
a = list(map(int, input().split()))
tmp += sum(a)
tmp += a[1] + a[1]
a = list(map(int, input().split()))
tmp += sum(a)
tmp += a[0] + a[2]
print('Yes' if tmp % 5 == 0 else 'No')

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
tmp = sum(a)
a = list(map(int, input().split()))
tmp += sum(a)
a = list(map(int, input().split()))
tmp += sum(a)
print('Yes' if tmp % 3 == 0 else 'No')

Submission status: Wrong Answer

Solution code:
from itertools import product as p

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

a = [0]*3
b = [0]*3
for a1 in range(c[0][0]+1):
    a[0] = a1
    b[0] = c[0][0] - a1
    for a2 in range(c[1][1]+1):
        a[1] = a2
        b[1] = c[1][1] - a2
        for a3 in range(c[2][2]):
            a[2] = a3
            b[2] = c[2][2] - a3

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

print('No')

Submission status: Wrong Answer

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    c = []
    for _ in range(3):
        c.append(list(int(_) for _ in input().split()))
    c_sum = []
    for i in range(3):
        c_sum.append(sum(c[i]))
    
    for b in range(301):
        a1 = (c_sum[0] - b)/3
        a2 = (c_sum[1] - b)/3
        a3 = (c_sum[2] - b)/3
        if a1.is_integer() and a2.is_integer() and a3.is_integer():
            print('Yes')
            # print(a1,a2,a3,b)
            return
    print('No')
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
c = [[0] * 3 for i in range(3)]
for i in range(3):
    c[i][0], c[i][1], c[i][2] = map(int, input().split(' '))


a_list = [0] * 3
b_list = [0] * 3
for a0 in range(c[0][0] + 1):
    a_list[0] = a0
    b_list[0] = c[0][0] - a_list[0]
    a_list[1] = c[1][0] - b_list[0]
    a_list[2] = c[2][0] - b_list[0]
    b_list[1] = c[0][1] - a_list[0]
    b_list[2] = c[0][2] - a_list[0]
    
    tmp = [[0] * 3 for i in range(3)]
    for i in range(3):
        for j in range(3):
            tmp[i][j] = a_list[i] + b_list[j]

    for n, m in zip(c, tmp):
        if not n == m:
            print('No')        
            break
    else:
        print('Yes')
        exit()
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



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


    if a1 < 0 or a2 < 0 or a3 < 0 or b1 < 0 or b2 < 0 or b3 < 0:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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



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


    if a1 < 0 or a2 < 0 or a3 < 0 or b1 < 0 or b2 < 0 or b3 < 0:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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



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


    if a1 < 0 or a2 < 0 or a3 < 0 or b1 < 0 or b2 < 0 or b3 < 0:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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



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

Submission status: Wrong Answer

Solution code:
c=[list(map(int,input().split())) for i in range(3)]
s=0
for x in c:
     s+=sum(x)
if s%3==0:
     print('Yes')
else:
     print('No')

Submission status: Wrong Answer

Solution code:
C = [list(map(int, input().split()))  for _ 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] :
      break
    if C[j][i] - C[j+1][i] != C[j][i+1] - C[j+1][i+1] :
      break
else:
  print("Yes")
  out = True
if not out:
  print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    G = [[0 for _ in range(3)] for _ in range(3)]
    for i in range(3):
        G[i] = [int(e) for e in input().split()]

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

        a1 = G[1][0] - b0
        a2 = G[2][0] - b1

        if a0 + b0 == G[0][0] and \
           a0 + b1 == G[0][1] and \
           a0 + b2 == G[0][2] and \
           a1 + b0 == G[1][0] and \
           a1 + b1 == G[1][1] and \
           a1 + b2 == G[1][2] and \
           a2 + b0 == G[2][0] and \
           a2 + b1 == G[2][1] and \
           a2 + b2 == G[2][2]:
               print("Yes")
               return
    print("No")


main()

Submission status: Wrong Answer

Solution code:
sum=0
for i in range(3):
  for c in input().split():
  	sum+=int(c)
print("Yes" if sum%3==0 else "No")

Submission status: Wrong Answer

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


if (grid[0][0] - grid[1][0]) == (grid[0][1] - grid[1][1]) == (grid[0][2] - grid[1][2]) and (grid[0][0]-grid[0][1]) == (grid[1][0]-grid[1][1]) == (grid[2][0] - grid[2][1]):
    print('Yes')

else:
    print('No')

Submission status: Wrong Answer

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


if (grid[0][0] - grid[1][0]) == (grid[0][1] - grid[1][1]) == (grid[0][2] - grid[1][2]):
    print('Yes')

else:
    print('No')

Submission status: Wrong Answer

Solution code:
lst = []
for i in range(3):
	a = list(map(int,input().split()))
	lst.append(a)
#print(lst)
F = False

for i in range(100):
	b1 = lst[0][0] - i
	b2 = lst[0][1] - i
	b3 = lst[0][0] - i
	if lst[1][0] - b1 == lst[1][1] - b2 and +\
	lst[1][1] - b2 == lst[1][2] - b3 and +\
	lst[2][0] - b1 == lst[2][1] - b2 and +\
	lst[2][1] - b2 == lst[2][2] - b3:
		F = True

if F == False:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
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 a1 == 100 and count != 3:
      	print("No")

Submission status: Wrong Answer

Solution code:
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 a1 == 100:
      	print("No")

Submission status: Wrong Answer

Solution code:
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] - a1 == lis3[0] - a1:
                count += 1
            if lis1[1] - a2 == lis2[1] - a2 == lis3[1] - a2:
                count += 1
            if lis1[2] - a3 == lis2[2] - a3 == lis3[2] - a3:
                count += 1
            if count == 3:
                print("Yes")
                break
    if a1 == 100:
      	print("No")

Submission status: Wrong Answer

Solution code:
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] - a1 == lis3[0] - a1:
                count += 1
            if lis1[1] - a2 == lis2[1] - a2 == lis3[1] - a2:
                count += 1
            if lis1[2] - a3 == lis2[2] - a3 == lis3[2] - a3:
                count += 1
            if count == 3:
                print("Yes")
                break
print("No")

Submission status: Wrong Answer

Solution code:
c = list([list(map(int,input().split())) for i in range(3)])
#00 01 02 a1+b1 a1+b2 a1+b3 
#10 11 12 a2+b1 a2+b2 a2+b3
#20 21 22 a3+b1 a3+b2 a3+b3
sum1=0
for k in c:
    sum1+=sum(k)
if sum1%3 == 0 and c[0][0]+c[2][2] == c[0][2]+c[2][0]:
    for i in range(2):
        for j in range(2):
            if not ((c[i+1][j+1] - c[i+1][j] - c[j][i+1] + c[i][j]) == 0):
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
c = list([list(map(int,input().split())) for i in range(3)])
#00 01 02 a1+b1 a1+b2 a1+b3 
#10 11 12 a2+b1 a2+b2 a2+b3
#20 21 22
sum1=0
for k in c:
    sum1+=sum(k)
for i in range(2):
    for j in range(2):
        if not ((c[i+1][j+1] - c[i+1][j] - c[j][i+1] + c[i][j]) == 0)or not sum1%3 == 0:
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
c = list([list(map(int,input().split())) for i in range(3)])
#00 01 02 a1+b1 a1+b2 a1+b3 
#10 11 12 a2+b1 a2+b2 a2+b3
#20 21 22
sum1=0
for k in c:
    sum1+=sum(k)
for i in range(2):
    for j in range(2):
        if not ((c[i+1][j+1] - c[i+1][j] - c[j][i+1] + c[i][j]) == 0)and not sum1%3 == 0:
            print("No")
            break
    else:
        continue
    break
else:
    print("Yes")

Submission status: Wrong Answer

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

flag = False
m = max(c1)

for a1 in range(m):
    for a2 in range(m):
        for a3 in range(m):
            for b1 in range(m):
                for b2 in range(m):
                    for b3 in range(m):
                        p = a1 + b1 == c1[0] and a1 + b2 == c1[1] and a1 + b3 == c1[2] and a2 + b1 == c1[3] and a2 + b2 == c1[4] and a2 + b3 == c1[5] and a3 + b1 == c1[6] and a3 + b2 == c1[7] and a3 + b3 == c1[8]
                        if p:
                            flag = True

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

Submission status: Wrong Answer

Solution code:
c = list([list(map(int,input().split())) for i in range(3)])
#00 01 02 a1+b1 a1+b2 a1+b3 
#10 11 12 a2+b1 a2+b2 a2+b3
#20 21 22
sum1=0
for k in c:
    sum1+=sum(k)
if sum1%3 == 0:
    for i in range(2):
        for j in range(2):
            if not ((c[i+1][j+1] - c[i+1][j] - c[j][i+1] + c[i][j]) == 0):
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
c = list([list(map(int,input().split())) for i in range(3)])
sum1=0
for k in c:
    sum1+=sum(k)
if sum1%3 == 0:
    for i in range(2):
        for j in range(2):
            if not c[i+1][j+1] - c[i+1][j] - c[j][i+1] + c[i][j] == 0:
                print("No")
                break
        else:
            continue
        break
    else:
        print("Yes")
else :
    print("No")

Submission status: Wrong Answer

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