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:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))

a1_a2 = c1[0] - c2[0]
a2_a3 = c2[0] - c3[0]
b1_b2 = c1[0] - c1[1]
b2_b3 = c1[1] - c1[2]

cnt = 0
if a1_a2 == c1[1]-c2[1] == c1[2]-c2[2]:
    cnt += 1
if a2_a3 == c2[1]-c3[1] == c2[2]-c3[2]:
    cnt += 1
if b1_b2 == c2[0]-c2[1] == c3[0]-c3[1]:
    cnt += 1
if b2_b3 == c2[1]-c2[2] == c3[1]-c2[2]:
    cnt += 1

if cnt == 4:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
if (sum(c1)+sum(c2)+sum(c3))%3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

for a1 in range(1, 101):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1
    for a2 in range(1, 101):
        if not (b1 == (c[1][0] - a2) and b2 == (c[1][1] - a2) and b3 == (c[1][2] - a2)):
            continue
        for a3 in range(1, 101):
            if (b1 == (c[2][0] - a3) and b2 == (c[2][1] - a3) and b3 == (c[2][2] - a3)):
                print('Yes')
                sys.exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
T = sum([sum(list(map(int, input().split()))) for _ in range(3)])
print('Yes' if (T / 3).is_integer() else 'No')

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

#N
#t1 x1 y1t1 x1 y1
#t2 x2 y2t2 x2 y2
#⋮⋮
#tN xN yNtN xN yN
N = 3
x = [0 for i in range(N)]
y = [0 for i in range(N)]
c =[[0 for i in range(N)] for i in range(N)]

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


x[0] = 0
for i in range(N):
    y[i] = c[0][i] - x[0]
x[1] = c[0][1] - y[1]
x[2] = c[0][2] - y[2]


flag = True
for i in range(N):
   for j in range(N):
       numx = x[i]
       numy = y[j]
       if not numx + numy == c[i][j]:
           flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

#N
#t1 x1 y1t1 x1 y1
#t2 x2 y2t2 x2 y2
#⋮⋮
#tN xN yNtN xN yN
N = 3
x = [0 for i in range(N)]
y = [0 for i in range(N)]
c =[[0 for i in range(N)] for i in range(N)]

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


x[0] = 0
for i in range(N):
    y[i] = c[0][i] - x[0]
x[1] = c[1][0] - y[1]
x[2] = c[2][0] - y[2]


flag = True
for i in range(N):
   for j in range(N):
       numx = x[i]
       numy = y[j]
       if not numx + numy == c[i][j]:
           flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]
    
    if sum(A) % 3 != 0:
        print('No')
        
    else:
        #要素のうち3の倍数(or 0)のみを抽出
        three = [i for i in A if i % 3 == 0]
        
        #3の倍数以外が含まれる場合
        if len(three) != len(A):
            print("Yes")
            
        #全要素が3の倍数or0の場合
        if len(three) == len(A):
            #0の個数が3の倍数個
            if np.count_nonzero(three) % 3 == 0:
                print("Yes")
            else:
                print("No")

takahashi_info()

Submission status: Wrong Answer

Solution code:
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]
    A_2d = np.array(A).reshape(3,3)
    judge = True
    
    if sum(A) % 3 != 0:
        print('No')
        judge = False
        
    else:
        for row in range(3):
            for column in range(3):

                if np.count_nonzero(A_2d[row, :]) == 1 and np.count_nonzero(A_2d[:, column]) == 1:
                    print("No")
                    judge = False
                    break
            
            else:
                continue
        
            break
    
        if judge == True:
            print("Yes")
          
takahashi_info()

Submission status: Wrong Answer

Solution code:
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]
    A_2d = np.array(A).reshape(3,3)
    judge = True
    
    if sum(A) % 3 != 0:
        print('No')
        judge = False
        
    else:
        for row in range(3):
            for column in range(3):

                #一列or一行に置いて同じ値が足されていない場合
                if np.count_nonzero(A_2d[row, :]) == 1 or np.count_nonzero(A_2d[:, column]) == 1:
                    print("No")
                    judge = False
                    break
            
            else:
                continue
        
            break
    
        if judge == True:
            print("Yes")
          
          
takahashi_info()

Submission status: Wrong Answer

Solution code:
def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]

        
    if sum(A) % 3 == 0:
        print('Yes')
    
    elif sum(A) < 3:
        print('Yes')
    
    else:
        print('No')
        
takahashi_info()

Submission status: Wrong Answer

Solution code:
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]

        
    if sum(A) % 3 == 0:
        print('Yes')
    
    else:
        print('No')
        
takahashi_info()

Submission status: Wrong Answer

Solution code:
from unittest.mock import patch
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]

        
    if sum(A) % 3 == 0:
        print("Yes\n")
    
    else:
        print("No\n")

Submission status: Wrong Answer

Solution code:
from unittest.mock import patch
import numpy as np

def takahashi_info():
    
    A = []
    for i in range(3):
        A += [int(j) for j in input().split()]

        
    if sum(A) % 3 == 0:
        print("Yes")
    
    else:
        print("No")

Submission status: Wrong Answer

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

ans = "Yes"

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

print(ans)

Submission status: Wrong Answer

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

if sum(tc) % 3 != 0:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
mycode = r'''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

ctypedef long long LL
from libc.stdio cimport scanf

cdef LL a,b,c,_,i
cdef LL[3][3] C
for i in range(3):
    scanf('%lld %lld %lld', &C[i][0],&C[i][1],&C[i][2])

    
cdef LL a0,a1,a2,b0,b1,b2
cdef bint flg=0
for a0 in range(101):
    b0=C[0][0]-a0
    b1=C[0][1]-a0
    b2=C[0][2]-a0
    for a1 in range(101):
        a2=a1
        if b0 == C[1][0]-a1 and b1==C[1][1]-a1 and b2==C[1][2]-a1 and b0 == C[2][0]-a2 and b1==C[2][1]-a2 and b2==C[2][2]-a2:
            print("Yes")
            exit()
print('No')

'''

import sys
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

# worst order: 101^6 => 10^8

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

    return flag

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

arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)

a = []
b = []
for i in range(3):
    if len(list(range(0, a_max[i], 1)))==0:
        a.append([0])
    else:
        a.append(list(range(0, a_max[i], 1)))
    
    if len(list(range(0, b_max[i], 1)))==0:
        b.append([0])
    else:
        b.append(list(range(0, b_max[i], 1)))


ans = 'No'
cnt = 0
for a0 in a[0]:
    for a1 in a[1]:
        for a2 in a[2]:
            for b0 in b[0]:
                for b1 in b[1]:
                    for b2 in b[2]:
                        a_list = [a0, a1, a2]
                        b_list = [b0, b1, b2]
                        flag = check(a_list, b_list, c)
                        if flag == True:
                            print("Yes")
                            exit(0)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

# worst order: 101^6 => 10^8

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

    return flag

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

arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
a_min = np.amin(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)
b_min = np.amin(arr_c, axis=0)

a = []
b = []
for i in range(3):
    if len(list(range(a_min[i], a_max[i], 1)))==0:
        a.append([a_min[i]])
    else:
        a.append(list(range(a_min[i], a_max[i], 1)))
    
    if len(list(range(b_min[i], b_max[i], 1)))==0:
        b.append([b_min[i]])
    else:
        b.append(list(range(b_min[i], b_max[i], 1)))


ans = 'No'
cnt = 0
for a0 in a[0]:
    for a1 in a[1]:
        for a2 in a[2]:
            for b0 in b[0]:
                for b1 in b[1]:
                    for b2 in b[2]:
                        a_list = [a0, a1, a2]
                        b_list = [b0, b1, b2]
                        flag = check(a_list, b_list, c)
                        if flag == True:
                            print("Yes")
                            exit(0)

print(ans)

Submission status: Wrong Answer

Solution code:
print("Yes")

Submission status: Wrong Answer

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

sum_l=0
ans="No"

for i in l:
  sum_l+=sum(i)
  
if sum_l%3==0 or sum_l==0:
  ans="Yes"

print(ans)

Submission status: Wrong Answer

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

sum_l=0
ans="No"

for i in l:
  sum_l+=sum(i)
  
if sum_l%3==0:
  ans="Yes"

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import itertools
C = []
s = 0
for _ in range(3):
    c = list(map(int, input().split()))
    s += sum(c)
    C.append(c)
    
if s % 3 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
gyouretu=[
    [1,0,0,1,0,0],
    [1,0,0,0,1,0],
    [1,0,0,0,0,1],
    [0,1,0,1,0,0],
    [0,1,0,0,1,0],
    [0,1,0,0,0,1],
    [0,0,1,1,0,0],
    [0,0,1,0,1,0],
    [0,0,1,0,0,1],
]
c=[]
for i in range(3):
    c+=[int(j) for j in input().split()]

for i in range(9):
    gyouretu[i].append(c[i])

import numpy as np

gyouretu=np.array(gyouretu)

if np.linalg.matrix_rank(gyouretu)<=6:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
c=[list(map(int,input().split())) for i in range(3)]
flag=True
fflag=False
for a1 in range(1,101):
  if fflag==True:
    break
  for a2 in range(1,101):
    if fflag==True:
      break
    for a3 in range(1,101):
      if fflag==True:
        break
      flag=True
      a=[a1,a2,a3]
      b=[c[0][0]-a1,c[0][1]-a2,c[0][2]-a3]
      
      for i in range(3):
        if flag==False:
          break
        for j in range(3):
          if c[i][j]!= a[i]+b[j]:
            flag=False
            break
      if flag==True:
        print("Yes")
        fflag=True
if fflag==False:
  print("No")

Submission status: Wrong Answer

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

ans=0
for i in range(3):
    for j in range(3):
        tgt=C[i][j]
        found=False
        for ii in range(i+1):
            for jj in range(j+1):
                a=C[ii][j]
                b=C[i][jj]
                if a+b==tgt:
                    ans+=1

print('Yes' if ans>=6 else 'No')

Submission status: Wrong Answer

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

ans=0
for i in range(3):
    for j in range(3):
        tgt=C[i][j]
        found=False
        for ii in range(i+1):
            for jj in range(j+1):
                a=C[ii][j]
                b=C[i][jj]
                if a+b==tgt:
                    ans+=1
                    break

print('Yes' if ans>=6 else 'No')

Submission status: Wrong Answer

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

ans=0
for i in range(3):
    for j in range(3):
        tgt=C[i][j]
        found=False
        for ii in range(i+1):
            for jj in range(j+1):
                a=C[ii][j]
                b=C[i][jj]
                if a+b==tgt:
                    ans+=1
                    found=True
                    break
            if found:
                break

print('Yes' if ans>=6 else 'No')

Submission status: Wrong Answer

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

ans=0
for i in range(3):
    for j in range(3):
        tgt=C[i][j]
        found=False
        for ii in range(i+1):
            for jj in range(j+1):
                a=C[ii][j]
                b=C[i][jj]
                if a+b==tgt:
                    ans+=1
                    found=True
                    break
            if found:
                break

print(ans>=6)

Submission status: Wrong Answer

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

min_c = min(c)
max_c = max(c)

for i in range(min_c, max_c + 1):
    for j in range(min_c, max_c + 1):
        for k in range(min_c, max_c + 1):
            for l in range(min_c, max_c + 1):
                for m in range(min_c, max_c + 1):
                    for n in range(min_c, max_c + 1):
                        if c[0] == i + l and c[1] == i + m and c[2] == i + n and c[3] == j + l and c[4] == j + m and c[5] == j + n and c[6] == k + l and c[7] == k + m and c[8] == k + n:
                            print('Yes')
                            exit()
print('No')

Submission status: Wrong Answer

Solution code:
lc = [[int(w) for w in input().split()] for i in range(3)]
cond = False

lb = lc[0]
a2 = lc[1][0]-lb[0]
a3 = lc[2][0]-lb[0]
la = [0, a2, a3]
for i in range(3):
    for j in range(3):
        if lc[i][j] != la[i]+lb[j]:
            cond = False
            break

print("Yes" if cond else "No")

Submission status: Wrong Answer

Solution code:
lc = [[int(w) for w in input().split()] for i in range(3)]
cond = False

lb = lc[0]
a2 = lc[1][0]-lb[0]
a3 = lc[2][0]-lb[0]
la = [0, a2, a3]
for i in range(3):
    for j in range(3):
        if lc[i][j] != la[i]+lb[j]:
            flag = False
            break

print("Yes" if cond else "No")

Submission status: Wrong Answer

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


def ch1(la, lb, aindex):
    return la[aindex] + lb[0] == lc[aindex][0]\
        and la[aindex] + lb[1] == lc[aindex][1]\
        and la[aindex] + lb[2] == lc[aindex][2]


cond = False

for i in range(100):
    if cond:
        break
    for j in range(100):
        la = [i//100, (i % 100)//10, i % 10]
        lb = [j//100, (j % 100)//10, j % 10]
        if ch1(la, lb, 0):
            if ch1(la, lb, 1):
                if ch1(la, lb, 2):
                    cond = True
            else:
                j += 9
        else:
            j += 99


print("Yes" if cond else "No")

Submission status: Wrong Answer

Solution code:
masu = [list(map(int,input().split())) for _ in range(3)]
import numpy as np
masu = np.array(masu)
a = []
b = []
for i in masu:
    a.append(min(list(i)))
for i in masu.T:
    b.append(min(list(i)))
flag = True
c = 0
p = masu[0][0]
for i in range(3):
    for j in range(3):
        if masu[i][j] != a[i] + b[j]:
            flag = False
        if masu[i][j] == p:
            c += 1
if flag or c==9:
    print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
C11, C12, C13 = map(int, input().split());
C21, C22, C23 = map(int, input().split());
C31, C32, C33 = map(int, input().split());

# a1 = 0と仮定して他を調整する
b1 = C11;
b2 = C12;
b3 = C13;

a2 = C21 - b1;
a3 = C31 - b1;

if (a2 >= 0 and
    a2 <= 100 and
    C22 == a2 + b2 and
    C23 == a2 + b3 and
    a3 >= 0 and
    a3 <= 100 and
    C32 == a3 + b2 and
    C33 == a3 + b3):
  print("Yes");
else:
  print("No");

Submission status: Wrong Answer

Solution code:
C11, C12, C13 = map(int, input().split());
C21, C22, C23 = map(int, input().split());
C31, C32, C33 = map(int, input().split());

# a1 = 0と仮定して他を調整する
b1 = C11;
b2 = C12;
b3 = C13;

a2 = C21 - b1;
a3 = C31 - b1;

if (a2 >= 0 and
    C22 == a2 + b2 and
    C23 == a2 + b3 and
    a3 >= 0 and
    C32 == a3 + b2 and
    C33 == a3 + b3):
  print("Yes");
else:
  print("No");

Submission status: Wrong Answer

Solution code:
C11, C12, C13 = map(int, input().split());
C21, C22, C23 = map(int, input().split());
C31, C32, C33 = map(int, input().split());

# 総和は3(a1 + a2 + a3 + b1 + b2 + b3)
# これが満たされれば後は好きなように分配すればよいはず

S = C11 + C12 + C13 + C21 + C22 + C23 + C31 + C32 + C33;
if S % 3 == 0:
  print("Yes");
else:
  print("No");

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
c = [list(map(int, input().split())) for _ in range(3)]
flg = True
s = sum(c[0]) % 3
t = sum(c[i][0] for i in range(3)) % 3
for i in range(1, 3):
  if sum(c[i]) % 3 != s:
    flg = False
  if sum(c[j][0] for j in range(3)) % 3 != t:
    flg = False
if flg:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 088
# C - Takahashi's Information

l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))

a1=min(l1)
a2=min(l2)
a3=min(l3)

b1=min(l1[0],l2[0],l3[0])
b2=min(l1[1],l2[1],l3[1])
b3=min(l1[2],l2[2],l3[2])

a=[a1,a2,a3]
b=[b1,b2,b3]

ans='Yes'

for i in range (3):
    if l1[i]!=a[0]+b[i] :
        ans ='No'
        break

for i in range (3):
    if l2[i]!=a[1]+b[i] :
        ans ='No'
        break

for i in range (3):
    if l3[i]!=a[2]+b[i] :
        ans ='No'
        break





print(ans)

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 088
# C - Takahashi's Information

l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))

a1=min(l1)
a2=min(l2)
a3=min(l3)

b1=min(l1[0],l2[0],l3[0])
b2=min(l1[1],l2[1],l3[1])
b3=min(l1[2],l2[2],l3[2])

a=[a1,a2,a3]
b=[b1,b2,b3]

ans='Yes'

for i in range (3):
    if l1[i]<a[0]+b[i] :
        ans ='No'
        break

for i in range (3):
    if l2[i]<a[1]+b[i] :
        ans ='No'
        break

for i in range (3):
    if l3[i]<a[2]+b[i] :
        ans ='No'
        break


print(ans)

Submission status: Wrong Answer

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


def ch1(la, lb, aindex):
    return la[aindex] + lb[0] == lc[aindex][0]\
        and la[aindex] + lb[1] == lc[aindex][1]\
        and la[aindex] + lb[2] == lc[aindex][2]


cond = False

for i in range(1000):
    if cond:
        break
    for j in range(1000):
        la = [i//100, (i % 100)//10, i % 10]
        lb = [j//100, (j % 100)//10, j % 10]
        if ch1(la, lb, 0):
            if ch1(la, lb, 1):
                if ch1(la, lb, 2):
                    cond = True
            else:
                j += 9
        else:
            j += 99


print("Yes" if cond else "No")

Submission status: Wrong Answer

Solution code:
import numpy as np

c1_arr = np.array(list(map(int, input().split())))
c2_arr = np.array(list(map(int, input().split())))
c3_arr = np.array(list(map(int, input().split())))
origin = np.concatenate((c1_arr, c2_arr, c3_arr))
origin = origin.reshape((3,3))

a1 = c1_arr.min()
a2 = c2_arr.min()
a3 = c3_arr.min()

a1_arr = np.zeros(3, dtype=int) + a1
a2_arr = np.zeros(3, dtype=int) + a2
a3_arr = np.zeros(3, dtype=int) + a3

df = np.concatenate((c1_arr, c2_arr, c3_arr))
df = df.reshape((3,3))
df = df.T

answer = np.concatenate((a1_arr, a2_arr, a3_arr))
answer = answer.reshape((3,3))

b1 = df[0].min()
b2 = df[1].min()
b3 = df[2].min()

answer = answer.T
answer[0] = answer[0] + b1
answer[1] = answer[1] + b2
answer[2] = answer[2] + b3
answer = answer.T

diff = origin == answer
if False in diff:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
mat = [map(int ,raw_input().split()) for _ in range(3)]
def f(m):
	return m[1] - m[0] == m[2] - m[1]
b = True
for l in mat:
	if not(f(l)):
		b = False
for j in range(3):
	c = [mat[i][j] for i in range(3)]
	if not(f(c)):
		b = False


print 'Yes' if b else 'No'

Submission status: Wrong Answer

Solution code:
c=[]
for i in range(3):
    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] and c[i+1][1]-c[i][1]==c[i+1][2]-c[i][2]:
        flg=0
    else:
        flg=1
if flg==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

sum = sum(list(itertools.chain.from_iterable(grid)))
if sum % 3 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
c = {}
for i in range(3):
  c[i] = list(map(int, input().split()))
a = [min(c.get(0)), min(c.get(1)), min(c.get(2))]
b = [min(c.get(0)[0], c.get(1)[0], c.get(2)[0]), min(c.get(0)[1], c.get(1)[1], c.get(2)[1]), min(c.get(0)[2], c.get(1)[2], c.get(2)[2])]
tf = True
for i in range(3):
  for j in range(3):
    tf = True if c.get(i)[j] == a[j] + b[j] else False
if tf:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

a = min(masu[0])
b = min(masu[1])
c = min(masu[2])

import numpy as np

masut= np.array(masu).T
d = min(masut[0])
e = min(masut[1])
f = min(masut[2])

li = [[a,b,c],[d,e,f]]

bo = 0

for i in range(3):
    for j in range(3):
        if masu[i][j] != li[0][i]+li[1][j]:bo = 1
if bo==1:
    print('No')
else:print('Yes')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
(*c, ) = map(int, open(0).read().split())
print("YNeos"[sum(c) % 3 > 0::2])

Submission status: Wrong Answer

Solution code:
c_grid = [0]*3
for i in range(3):
    c_grid[i] = list(map(int, input().split()))
res = 'No'
for a1 in range(101):
    b1 = c_grid[0][0] - a1
    b2 = c_grid[0][1] - a1
    b3 = c_grid[0][2] - a1
    if b1 < 0 or b2 < 0 or b3 < 0:
        break
    if b1 > 100 or b2 > 100 or b3 > 100:
        break
    a2 = c_grid[1][0] - b1
    if a2 < 0 or a2 > 100 or a2 != c_grid[1][1] - b2 or a2 != c_grid[1][2] - b3:
        break
    a3 = c_grid[2][0] - b1
    if a3 < 0 or a3 > 100 or a3 != c_grid[2][1] - b2 or a3 != c_grid[2][2] - b3:
        break
    res = 'Yes'
print(res)

Submission status: Wrong Answer

Solution code:
# わからん記録

Submission status: Wrong Answer

Solution code:
import sys
c = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
c.extend(c2)
c.extend(c3)
for a1 in range(c[0]+1):
  b1 = c[0]-a1
  b2 = c[1]-a1
  b3 = c[2]-a1
  a2 = c[3]-b1
  a3 = c[6]-b1
  ab = [a1,a2,a3,b1,b2,b3]
  for i in ab:
    if i < 0:
      print("No")
      sys.exit()
  if (c[4]==a2+b2) & (c[5]==a2+b3) & (c[7]==a3+b2) & (c[8]==a3+b3):
    print("Yes")
    break
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

C = [0] * 3

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

for i in range(1, 3):
    x = C[i][0] - C[i - 1][0]
    for j in range(1, 3):
        if C[i][j] - C[i - 1][j] != x:
            print("NO")
            exit()

for j in range(1, 3):
    x = C[0][j] - C[0][j - 1]
    for i in range(1, 3):
        if C[i][j] - C[i][j - 1] != x:
            print("NO")
            exit()
print("YES")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
 
a1 = list()
a2 = list()
 
for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    
if (a1[0] == a1[1] and a1[2] == a1[0])and(a2[0] == a1[1] and a2[2] == a1[0]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
L = [y1_list,y2_list,y3_list]

a1 = list()
a2 = list()
b1 = list()
b2 = list()

for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    b1.append(L[i][0] - L[i][1])
    b2.append(L[i][1] - L[i][2])


if (a1[0] == a1[1] and a1[2] == a1[0])and(b1[0] == b1[1] and b1[2] == b1[0]):
    if (a2[0] == a1[1] and a2[2] == a1[0])and(b2[0] == b2[1] and b2[2] == b2[0]):
        print("Yes")
        
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
 
a1 = list()
a2 = list()
 
for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    
if a1[0] == a1[1] and a1[2] == a1[0]:
    if a2[0] == a1[1] and a2[2] == a1[0]:
        print("Yes")
        
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
 
a1 = list()
a2 = list()

for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    
if a1[0] == a1[1] and a1[2] == a1[0]:
    if a2[0] == a1[1] and a2[2] == a1[0]:
        print("Yes")
        
    else:
        print("No")
else:
    print("Mo")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))

a1 = list()
a2 = list()
a3 = list()
for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])
    
if a1[0] == a1[1] and a1[2] == a1[0]:
    if a2[0] == a1[1] and a2[2] == a1[0]:
        print("Yes")
        
    else:
        print("No")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))

a1 = list()
a2 = list()

for i in range(3):
    a1.append(y1_list[i] - y2_list[i])
    a2.append(y2_list[i] - y3_list[i])


if a1[0] == a1[1] and a1[2] == a1[0]:
    if a2[0] == a1[1] and a2[2] == a1[0]:
        print("yes")
        
    else:
        print("no")
else:
    print("no")