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: Accepted

Solution code:
def main():
    arr = []
    for i in range(3):
        arr.append(list(map(int, input().split())))
    b1 = arr[0][0] - arr[0][1]
    b2 = arr[0][1] - arr[0][2]
    a1 = arr[1][0] - arr[0][0]
    a2 = arr[2][0] - arr[1][0]
    for i in range(3):
        if arr[i][0] - arr[i][1] != b1 or arr[i][1] - arr[i][2] != b2 or arr[1][i] - arr[0][i] != a1 or arr[2][i] - \
                arr[1][i] != a2:
            print("No")
            return
    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))

C = [inpl() for i in range(3)]

ok = True
for i in range(3):
    X = [C[i][j] - C[(i+1)%3][j] for j in range(3)]
    if X[0] == X[1] == X[2]:
        pass
    else:
        ok = False

for j in range(3):
    X = [C[i][j] - C[i][(j+1)%3] for i in range(3)]
    if X[0] == X[1] == X[2]:
        pass
    else:
        ok = False

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

Submission status: Accepted

Solution code:
C = [list(map(int, input().split())) for _ in range(3)]
ans = 1
for i in range(2):
  if C[i+1][0] - C[i][0] ==  C[i+1][1] - C[i][1]  and C[i+1][2] - C[i][2] ==  C[i+1][1] - C[i][1] :
    continue
  else: ans = 0
for i in range(2):
  if C[0][i+1] - C[0][i] ==  C[1][i+1] - C[1][i]  and C[2][i+1] - C[2][i] ==  C[1][i+1] - C[1][i]:
    continue
  else: ans = 0

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

Submission status: Accepted

Solution code:
x1,x2,x3 = map(int,input().split())
y1,y2,y3 = map(int,input().split())
z1,z2,z3 = map(int,input().split())
ans="No"
if((x1-y1)==(x2-y2)==(x3-y3) and (y1-z1)==(y2-z2)==(y3-z3) and (x1-x2)==(y1-y2)==(z1-z2) and (x2-x3)==(y2-y3)==(z2-z3)):
    ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
def f(c):
    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
                if b1 == c[1][0] - a2 and b1 == c[2][0] - a3 and \
                   b2 == c[1][1] - a2 and b2 == c[2][1] - a3 and \
                   b3 == c[1][2] - a2 and b3 == c[2][2] - a3:
                    return True
    return False
                
c = [map(int, raw_input().split()) for _ in range(3)]
if f(c): print 'Yes'
else: print 'No'

Submission status: Accepted

Solution code:
lis1 = list(map(int,input().split()))
lis2 = list(map(int,input().split()))
lis3 = list(map(int,input().split()))
a = lis1[0] -lis2[0]
if lis1[1] - lis2[1] == a and lis1[2] - lis2[2] == a:
 b = lis2[0] - lis3[0]
 if lis2[1] - lis3[1] == b and lis2[2] - lis3[2] == b:
  c = lis1[1] - lis1[0]
  if lis2[1] - lis2[0] == c and lis3[1] - lis3[0] == c:
   d = lis1[2] - lis1[1]
   if lis2[2] - lis2[1] == d and lis3[2] - lis3[1] == d:
    print("Yes")
   else:
    print("No")
  else:
   print("No")
 else:
  print("No")
else:
 print("No")

Submission status: Accepted

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

temps = []
for i in range(3):
    temp = []
    temp.append(matrix[i][1] - matrix[i][0])
    temp.append(matrix[i][2] - matrix[i][1])
    temp.append(matrix[i][2] - matrix[i][0])
    temps.append(temp)
    
if temps[0] == temps[1] and temps[0] == temps[2]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

c11, c12, c13 = map(int, input().strip().split(" "))
c21, c22, c23 = map(int, input().strip().split(" "))
c31, c32, c33 = map(int, input().strip().split(" "))
if c11 - c12 == c21 - c22 == c31 - c32 and c12 - c13 == c22 - c23 == c32 - c33 and c13 - c11 == c23 - c21 == c33 - c31 and c11 - c21 == c12 - c22 == c13 - c23 and c21 - c31 == c22 - c32 == c23 - c33 and c31 - c11 == c32 - c12 == c33 - c13:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# C

c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if not(c12 - c11 == c22 - c21 == c32 - c31):
    print("No")
    quit()
if not(c13 - c12 == c23 - c22 == c33 - c32):
    print("No")
    quit()
if not(c21 - c11 == c22 - c12 == c23 - c13):
    print("No")
    quit()
if not(c31 - c21 == c32 - c22 == c33 - c23):
    print("No")
    quit()

print("Yes")

Submission status: Accepted

Solution code:
c = [map(int, raw_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]
ans = "Yes"
for i in range(3):
  for j in range(3):
    if c[i][j] != a[i]+b[j]:
      ans = "No"
print ans

Submission status: Accepted

Solution code:

def solve(c):
    def check(xs):
        xs = [[e - es[0] for e in es] for es in xs]
        return xs[0] == xs[1] and xs[0] == xs[2]
    return check(c) and check(list(zip(*c)))

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

if solve(c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in range(2):
	if c1[i+1] - c1[i] == c2[i+1] - c2[i] == c3[i+1] - c3[i]:
		flg = True
	else:
		flg = False

if flg == False:
	print("No")
	exit(0)

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

Submission status: Accepted

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

ok = True

for x in range(2):
  ok = ok and (c[x][0]-c[x+1][0] == c[x][1]-c[x+1][1] == c[x][2]-c[x+1][2])

for x in range(2):
  ok = ok and (c[0][x]-c[0][x+1] == c[1][x]-c[1][x+1] == c[2][x]-c[2][x+1])

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

Submission status: Accepted

Solution code:
C = [list(map(int, input().split())) for i in range(3)]
N = 100
ok = 0
for a1 in range(N+1):
    b1 = C[0][0] - a1
    b2 = C[0][1] - a1
    b3 = C[0][2] - a1
    for a2 in range(N+1):
        if not (b1 == C[1][0] - a2) or not (b2 == C[1][1] - a2) or not (b3 == C[1][2] - a2):
            continue
        for a3 in range(N+1):
            if not (b1 == C[2][0] - a3) or not (b2 == C[2][1] - a3) or not (b3 == C[2][2] - a3):
                continue
            ok = 1
            break
        else:
            continue
        break
    else:
        continue
    break
print("Yes"*ok or "No")

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a = 0, s = 0;
    for (int i = 0; i < 9; i++)
    {
        cin >> a;
        s += a;
    }
    if (s % 3 == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Submission status: Runtime Error

Solution code:
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)
    
    if sum(A) % 3 != 0:
        print('No')
    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]):
                    print("No")
                    break
                    
        print("Yes")
        
        
takahashi_info()

Submission status: Runtime Error

Solution code:
l=[list(map(int,input())) 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: Runtime Error

Solution code:
from collections import deque

H, W = map(int, input().split())
C=list(list(input()) for _ in range(H))

def bfs():
	sx, sy= 0, 0
	gx, gy= H-1, W-1
	dx = [1, 0, -1, 0]
	dy = [0, 1, 0, -1]

	work_queue=deque([])
	work_queue.append((sx, sy))
	visited=[[float("inf")]*W for _ in range(H)]
	visited[sx][sy]=1

	while work_queue:
		x, y = work_queue.popleft()

		for i in range(4):
			nx, ny = x+dx[i], y+dy[i]

			if 0<=nx<H and 0<=ny<W and visited[nx][ny]==float("inf") and C[nx][ny]!="#":
				work_queue.append((nx, ny))
				visited[nx][ny]= visited[x][y]+1
	return visited[gx][gy]


temp=bfs()

black=0
white=0
for i in range(H):
	for j in range(W):
		if C[i][j]==".":
			white+=1
		else:
			black+=1

if temp==float("inf"):
	print(-1)
else:
	print(white-temp)

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
A = np.array(c1)
c1 = list(map(int,input().split()))
B = np.array(c1)
c1 = list(map(int,input().split()))
C = np.array(c1)

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:

ソースコード 

Copy
Copy
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: Runtime Error

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

Submission status: Runtime Error

Solution code:
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
      if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
      if ll[i][k]==ll[j][k]:
        if not all(ll[i][t]==ll[j][t] for t in range(3)):
          print('No')
          exit()
su=0
for lll in ll:
  s=sum(lll)
  su+=s
if su%3!=0:
  print('No')
else:

Submission status: Runtime Error

Solution code:
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
      if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
      if ll[i][k]==ll[j][k]:
        if not all(ll[i][t]==ll[j][t] for t in range(3)):
          print('No')
          exit()
s=0
for lll in ll:
  s=sum(lll)
  su+=s
if su%3!=0:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
su=0
for i in range(3):
  l=list(map(int,input().split()))
  s=sum(l)
  su+=s
if su%3!=0:
  print('No')
  exit()
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
       if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
        if ll[i][k]==ll[j][i]:
          if not all(ll[i][t]==ll[j][t] for t in range(3)):
            print('No')
            exit()
       
print('Yes')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

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

a1 = 0
b1 = C[0][0]
b2 = C[0][1]
b3 = C[0][2]

if !((C[1][0]-b1) == (C[1][1]-b2) and (C[1][1]-b2) == (C[1][2]-b2)):
    print("No")
    sys.exit()

if !((C[2][0]-b1) == (C[2][1]-b2) and (C[2][1]-b2) == (C[2][2]-b2)):
    print("No")
    sys.exit()

print("Yes")

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  b[0]-a[0]==b[1]-a[1]==b[2]-b[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
r=range
M=[list(map(int,input().split())) for _ in r(3)]
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')

Submission status: Runtime Error

Solution code:
r=range
M=[list(map(int,input().split())) for _ in r(3)]
x
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a, b, c, x, y = map(int, input().split())

price = a * x + b * y

if (a + b) // 2 > c:
    if x >= y:
        price = min(2 * x * c, 2 * y * c + (x - y) * a)

    else:
        price = min(2 * x * c + (y - x) * b,  2 * y * c)

print(price)

Submission status: Runtime Error

Solution code:
l = [list(map(int, input().split())) for i in range(3)]
d = [None]*3
for i in range(3):
  d[i] = [l[i] - l[i+1] for i in range(2)]
print('Yes' if all(d[i] == d[i+1] for i in range(2)) else 'No')

Submission status: Runtime Error

Solution code:
l = [list(map(int, input().split())) for i in range(3)]
d = [None]*3
d[i] = [l[i] - l[i+1] for i in range(2)]
print('Yes' if all(d[i] == d[i+1] for i in range(2)) else 'No')

Submission status: Runtime Error

Solution code:
N, Y  = map(int, input().split())
flag = False
for i in range(0,N): # 10000
    for j in range(0,N): #5000
        k=N-i-j
        total = i*10000 + j*5000 + k*1000
           
        if(N==i+j+k and total==Y):
            flag = True
            print(str(i)+" " +str(j) +" "+ str(k))
            break

if flag == False:
    print("-1 -1 -1")

Submission status: Runtime Error

Solution code:
c11,c12,c13=map(int,input().split())
c21,c22,c23=map(int,input().split())
c31,c32,c33=map(int,input().split())
for i in range(1,101):
    for j in range(1,101):
        if

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[2]+c3[1]
e = c1[1]+c2[0]+c3[2]
f = c1[2]+c2[1]+c3[0]
if a=b and b=c and c=d and d=e and e=f:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[2]+c3[1]
e = c1[1]+c2[0]+c3[2]
f = c1[2]+c2[1]+c3[0]
if a=b=c=d=e=f:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[1]+c3[2]
e = c1[1]+c2[2]+c3[0]
f = c1[2]+c2[0]+c3[1]
if a=b=c=d=e=f:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[1]+c3[2]
e = c1[1]+c2[2]+c3[0]
f = c1[2]+c2[0]+c3[1]
if a=b and b=c and c=d and d=e and e=f and f=a:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[1]+c3[2]
e = c1[1]+c2[2]+c3[0]
f = c1[2]+c2[0]+c3[1]
if a=b and b=c and c=d and d=e and e=f:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
for i in range(6):
  k[i] = c1[i%3]+c2[(i+1)%3]+c3[(i+2)%3]
if k[0]=k[1] and k[1]=k[2] and k[2]=k[3] and k[3]=k[4] and k[4]=k[5]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
import sys
C = [list(map(int, sys.stdin.readline().split(" "))) for i in range(3)]
for a0 in range(101):
    b1 = C[0][0] - a0
    b2 = C[0][1] - a0
    b3 = C[0][2] - a0
    if (C[1][0] - b0 == C[1][1] - b1 == C[1][2] - b2) and (C[2][0] - b0 == C[2][1] - b1 == C[2][2] - b2):
        print("Yes")
        exit()
print("No")

Submission status: Runtime Error

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

n = max(max(data))
for i in range(n):
    for j in range(n):
        for k in range(n):
            flg = 0
            if data[0][0]-i==data[1][0]-j==data[2][0]-k: 
                flg += 1
            if data[0][1]-i==data[1][1]-j==data[2][1]-k:
                flg += 1
            if data[0][2]-i==data[1][2]-j==data[2][2]-k:
                flg += 1
      
        
if flg==3:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
l = map(int, open(0).read().split())
print("YNeos"[4 != sum(sum(l[j]-l[0]+l[i] == l[i+j] for i in [1,2]) for j in [3,6])::2])

Submission status: Runtime Error

Solution code:
N = int(input())
ll = []
for i in range(3):
    l = [int(x) for x in input().split()]
    ll.append(l)
if l[0][0] - l[0][1] != l[1][0] - l[1][1] or l[2][0] - l[2][1] != l[1][0] - l[1][1]:
    print("No")
    exit()
if l[0][2] - l[0][1] != l[1][2] - l[1][1] or l[2][2] - l[2][1] != l[1][2] - l[1][1]:
    print("No")
    exit()
if l[0][0] - l[1][0] != l[0][1] - l[1][1] or l[0][2] - l[1][2] != l[0][1] - l[1][1]:
    print("No")
    exit()
if l[2][0] - l[1][0] != l[2][1] - l[1][1] or l[2][2] - l[1][2] != l[2][1] - l[1][1]:
    print("No")
    exit()
print("Yes")

Submission status: Runtime Error

Solution code:

import sys  
import numpy as np
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
k = [0] * max(3,(max(a)+1))

for p in a:
    k[p] += 1
ans = 0
for q,r,s in zip(k, k[1:] , k[2:]):
    ans = max(ans, q+r+s)

print(ans)

Submission status: Runtime Error

Solution code:
C=[0]*3;A=[0]*3
d1=0;d2=0;e1=0;e2=0;z=0;p=0
for i in range(3):
  c1,c2,c3=map(int,input().split())
  C[i]=(c1,c2,c3)
  A[i]=(0,0,0)

d1=C[1][0]-C[0][0];d2=C[2][0]-C[0][0]
e1=C[0][1]-C[0][0];e2=C[0][2]-C[0][0]
z=C[0][0]
A[0][0]=z;A[0][1]=z+e1;A[0][2]=z+e2
A[1][0]=z+d1;A[1][1]=z+e1+d1;A[1][2]=z+d1+e2
A[2][0]=z+d2;A[2][1]=z+d2+e1;A[2][2]=z+d2+e2

print(C)
for i in range(3):
  for j in range(3):
    if C[i][j]==A[i][j]:
      p=p+1
print("Yes" if p==9 else "No")

Submission status: Runtime Error

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = data[0][0] - a1
            b2 = data[0][1] - a1
            b3 = data[0][2] - a1

            if (
                b1 + a2 == data[1][0]
                and b2 + a2 == data[1][1]
                and b3 + a2 == data[1][2]
                and b1 + a3 == data[2][0]
                and b2 + a3 == data[2][1]
                and b3 + a3 == data[2][2]
            ):
                print("Yes")
                exit(1)

print("No")

Submission status: Runtime Error

Solution code:
c = [[],[],[]]
c[0] = [int(x) for x in input().split()]
c[1] = [int(x) for x in input().split()]
c[2] = [int(x) for x in input().split()]

ans = "Yes"
for i in range(3):
  for j in range(3):
  	if c[(i+1)%3][(j+1)%3] + c[(i+2)%3][(j+2)%3] != c[(i+2)%3][(j+1)%3] + c[(i+1)%3][(j+2)%3]
      ans = "No"	
      break
  if ans == "No":
    break
print(ans)

Submission status: Runtime Error

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

d1 = [c2[i] - c1[i] for i in range(3)]
d2 = [c3[i] - c1[i] for i in range(3)]

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

Submission status: Runtime Error

Solution code:
c = []
for _ in range(3):
    c.append(list(input().split()))
if c[0][0]+c[1][1]+c[2][2]] == c[0][0]+c[1][2]+c[2][1] and c[0][0]+c[1][2]+c[2][1] == c[0][1]+c[1][0]+c[2][2]:
    if c[0][1]+c[1][0]+c[2][2] == c[0][1]+c[1][2]+c[2][0] and c[0][1]+c[1][2]+c[2][0] == c[0][2]+c[1][0]+c[2][1]:
         if c[0][2]+c[1][0]+c[2][1] == c[0][2]+c[1][1]+c[2][0]:
             print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
C = [list(map(int, input().split())) for i in range(3)]
x = [0,0,0]
y = []
for i in range(3):
    y.append(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 x[i] + y[j] != C[i][j]:
            print('No')
            exit(1)
print('Yes')

Submission status: Runtime Error

Solution code:
C=[[int(i) for i in input().split()] for j in range(3)]
ans=False
for a1 in range(101):
  for a2 in range(101):
    for a3 in range(101):
      if len(set([c[i][0]-a1 for i in range(3)]))==1:
        if len(set(c[j][1]-a2 for j in range(3)))==1:
          if len(set(c[k][2]-a3 for k in range(3)))==1:
            ans=True
print('Yes' if ans else 'No')

Submission status: Runtime Error

Solution code:
l=[]
list(map(int,input().split())).append(l)
list(map(int,input().split())).append(l)
list(map(int,input().split())).append(l)
for i in range(2):
  if l[i][1]-l[i][0]!=l[i+1][1]-l[i+1][0] and l[i][2]-l[i][1]!=l[i+1][2]-l[i+1][1]:
    print('No')
    break
  if i==1:
    print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())

# F(A, B)を定義する
def F(A, B):
    A = str(A)
    B = str(B)
    if len(A) >= len(B):
        return len(A)
    else:
        return len(B)

minimumList = []
for a in range(1, int(N**0.5) + 1):
    if N % a == 0:
        b = N // a
        minimumList.append(F(a, b))
print(min(minimumList))

Submission status: Runtime Error

Solution code:
N = int(input())

# F(A, B)を定義する
def F(A, B):
    A = str(A)
    B = str(B)
    if len(A) >= len(B):
        return len(A)
    else:
        return len(B)

minimumList = []
for a in range(1, int(N**0.5) + 1):
    if N % a == 0:
        b = N // a  # 商
        minimumList.append(F(a, b))
print(min(minimumList))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

C = np.array(C)

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

Submission status: Runtime Error

Solution code:
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101):
        if not checher([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101)
        if not checher([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101)
      if not checher([i, j, k], da):
        return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
c_box = [] 
for i in range(3):
  c = list(map(int, input().split()))
  c_box.append(c)
  
for i in range(101):
  a1 = i
  b1 = c[0][0]-a1
  b2 = c[0][1]-a1
  b3 = c[0][2]-a1
  if c[1][0]-b1 == c[1][1]-b2 == c[1][2]-b3:
    if c[2][0]-b1 == c[2][1]-b2 == c[2][2]-b3:
      print('Yes')
      exit()
print('No')

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) scanf("%d",&c[i][j]);
    }

    int a[3]={0,c[1][0]-c[0][0],c[2][0]-c[0][0]};
    int b[3]={c[0][0],c[0][1],c[0][2]};

    if(c[1][1]!=a[1]+b[1]){
        printf("No\n");
        return 0;
    }
    if(c[1][2]!=a[1]+b[2]){
        printf("No\n");
        return 0;
    }
    if(c[2][1]!=a[2]+b[1]){
        printf("No\n");
        return 0;
    }
    if(c[2][2]!=a[2]+b[2]){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");

    return 0;
}