input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
c = [list(map(int,input().split())) for _ in range(3)]
ok = True
lis = [[0,1],[1,2],[2,0]]
d = [[c[l[0]][i]-c[l[1]][i] for i in range(3)]for l in lis]
e = [[c[i][l[0]]-c[i][l[1]] for i in range(3)]for l in lis]
for i in range(3):
if d[i].count(d[i][0])!=3:
ok = False
if e[i].count(e[i][0... | c = [list(map(int,input().split())) for _ in range(3)]
a = [0]*3
b = [0]*3
ok = True
b = c[0]
a[1] = c[1][0]-b[0]
a[2] = c[2][0]-b[0]
for i in range(3):
for j in range(3):
if c[i][j]!=a[i]+b[j]:
ok = False
if ok:
print('Yes')
else:
print('No')
| p03435 |
c = []
for _ in range(3):
c.append(list(map(int, input().split())))
a = []
for i in range(3):
tmp = []
for j in range(3):
tmp.append(c[i][j%3] - c[i][(j+1)%3])
a.append(tmp)
for i in range(2):
for j in range(3):
if a[i][j]!=a[i+1][j]:
print('No')
... | c = []
for _ in range(3):
c.append(list(map(int, input().split())))
for i in range(2):
if c[i][0]-c[i][1]!=c[i+1][0]-c[i+1][1]:
print('No')
break
if c[i][1]-c[i][2]!=c[i+1][1]-c[i+1][2]:
print('No')
break
if c[i][2]-c[i][0]!=c[i+1][2]-c[i+1][0]:
print... | p03435 |
c=[0]*3
c_max=0
for i in range(3):
c[i]=list(map(int,input().split()))
c_max=max(c_max,max(c[i]))
c_max+=1
for a1 in range(c_max):
for a2 in range(c_max):
for a3 in range(c_max):
for b1 in range(c_max):
for b2 in range(c_max):
for b3 in rang... | c=[0]*3
c_max=0
for i in range(3):
c[i]=list(map(int,input().split()))
c_max=max(c_max,max(c[i]))
c_max+=1
for a1 in range(c_max):
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 a1+b1==c[0][0] and a1+b2==c[0][1] and a1+b3==c[0][2]... | p03435 |
area=[list(map(int,input().split())) for i in range(3)]
count=0
for a1 in range(area[0][0]+1):
b1=area[0][0]-a1
b2=area[0][1]-a1
b3=area[0][2]-a1
a2=area[1][0]-b1
a3=area[2][0]-b1
if b1>=0 and b2>=0 and b3>=0 and a2>=0 and a3>=0:
if a2+b2== area[1][1]:
if a2+b3==area[1][2]:
if a... | C=[list(map(int,input().split())) for i in range(3)]
for a1 in range(101):
b1=C[0][0]-a1
b2=C[0][1]-a1
b3=C[0][2]-a1
a2=C[1][0]-b1
a3=C[2][0]-b1
if b1>=0 and b2>=0 and b3>=0 and a2>=0 and a3>=0:
if a2+b2==C[1][1]:
if a2+b2==C[1][1]:
if a2+b3==C[1][2]:
if a3+b1==C[2][0]... | p03435 |
grid = []
for _ in range(3):
grid.append((list)(list(map(int, input().split()))))
for i in range(3):
j = (i+1) % 3
diff1 = grid[i][0] - grid[j][0]
diff2 = grid[i][1] - grid[j][1]
diff3 = grid[i][2] - grid[j][2]
if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
print("No... | grid = []
for _ in range(3):
grid.append((list)(list(map(int, input().split()))))
for i in range(3):
j = (i+1) % 3
diff1 = grid[i][0] - grid[j][0]
diff2 = grid[i][1] - grid[j][1]
diff3 = grid[i][2] - grid[j][2]
if diff1 != diff2 or diff2 != diff3:
print("No")
exit()... | p03435 |
def main():
c = [list(map(int, input().split())) for _ in range(3)]
N = 100
for i in range(-N, N+1):
for j in range(-N, N+1):
for k in range(-N, N+1):
if c[0][0] - i == c[0][1] - j == c[0][2] - k:
if c[1][0] - i == c[1][1] - j == c[1][2] - k:
... | a, b, c = list(map(int, input().split()))
d, e, f = list(map(int, input().split()))
g, h, i = list(map(int, input().split()))
if a - b == d - e == g - h and b - c == e - f == h - i:
print('Yes')
else:
print('No') | p03435 |
c = [list(map(int, input().split())) for i in range(3)]
q1 = c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1]
q2 = c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]
q3 = c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2]
q4 = c[0][0] - c[2][0] == c[0][1] - c[2][1] == c[0][2] - c[2][2... | [(a, b, c), (d, e, f), (g, h, i)] = [
list(map(int, input().split())) for i in range(3)]
q1 = a - b == d - e== g - h
q2 = a - c == d - f == g - i
q3 = a - d == b - e== c - f
q4 = a - g == b - h == c - i
print(("Yes" if q1 and q2 and q3 and q4 else "No"))
| p03435 |
def resolve():
g = [list(map(int, input().split())) for _ in range(3)]
t = [[None]*3 for _ in range(3)]
m = max(list(map(max, g)))
for a in range(m+1):
for b in range(m+1):
for c in range(m+1):
for d in range(m+1):
for e in range(m+1):
for f in range(m+1):
y = [a, b, c]
... | def resolve():
g = [list(map(int, input().split())) for _ in range(3)]
m = max(list(map(max, g)))
for a in range(m+1):
for b in range(m+1):
for c in range(m+1):
y = [a, b, c]
x = [g[i][i] - y[i] for i in range(3)]
ans = True
for i in range(3):
for j in range(3):
v = y[i] + ... | p03435 |
c = [list(map(int, input().split())) for i in range(3) ]
ans = False
for i in range(101) :
for j in range(101) :
for k in range(101) :
b1 = c[0][0] - i
b2 = c[1][0] - i
b3 = c[2][0] - i
if j + b1 != c[0][1] :
continue
... | c = [list(map(int, input().split())) for i in range(3) ]
ans = False
for i in range(101) :
a1 = 0
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][0] - b1
a3 = c[2][0] - b1
a = []
a.append(a1)
a.append(a2)
a.append(a3)
if a2 + b2 != c[1][1] :
continu... | p03435 |
c = [list(map(int, input().split())) for i in range(3) ]
ans = False
for i in range(101) :
a1 = 0
b1 = c[0][0]
b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][0] - b1
a3 = c[2][0] - b1
a = []
a.append(a1)
a.append(a2)
a.append(a3)
if a2 + b2 != c[1][1] :
continu... | c = [list(map(int, input().split())) for i in range(3) ]
ans = True
X = 0
b = [c[i][0] - X for i in range(3)]
a = [c[0][i] - b[0] for i in range(3)]
for i in range(3) :
for j in range(3) :
if a[j] + b[i] != c[i][j] :
ans = False
if ans :
print('Yes')
else :
print('No'... | p03435 |
from itertools import product
C = [0 for _ in range(3)]
for i in range(3):
C[i] = list(map(int, input().split()))
x = [0] * 3
y = [0] * 3
for i in range(3):
y[i] = C[0][i] - x[0]
x[i] = C[i][0] - y[0]
ans = 'Yes'
for i, j in product(list(range(3)), list(range(3))):
if(x[i] + y[j] != C[i... | C = [[int(x) for x in input().split()] for _ in range(3)]
a = [0] * 3
b = [0] * 3
for i in range(3):
b[i] = C[0][i] - a[0]
a[i] = C[i][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'
break
print(ans) | p03435 |
l=[]
for i in range(3):
l1=list(map(int,input().split()))
l.append(l1)
flag=0
for i in range(-1000,1000,):
y0=l[0][0]-i
y1=l[1][0]-i
y2=l[2][0]-i
x1=l[0][1]-y0
x2=l[0][2]-y0
if l[1][1]==y1+x1 and l[1][2]==y1+x2 and l[2][1]==y2+x1 and l[2][2]==y2+x2:
flag=1
else:
continue
if flag... | l=[]
for i in range(3):
l1=list(map(int,input().split()))
l.append(l1)
flag=0
y0=l[0][0]-0
y1=l[1][0]-0
y2=l[2][0]-0
x1=l[0][1]-y0
x2=l[0][2]-y0
if l[1][1]==y1+x1 and l[1][2]==y1+x2 and l[2][1]==y2+x1 and l[2][2]==y2+x2:
flag=1
else:
pass
if flag==1:
print('Yes')
else:
print('No') | p03435 |
c = []
for i in range(3):
c.append(list(map(int,input().split())))
"""
変数6個で解9個
b1-b2 : c*1-c*2
b2-b3 : c*2-c*3
b3-b1 : c*3-c*1
a1-a2 : c1*-c2*
a2-a3 : c2*-c3*
a3-a1 : c3*-c1*
"""
i = 0
flaga12 = True
flaga23 = True
flaga31 = True
flagb12 = True
flagb23 = True
flagb31 = True
b12 = c[i][0]... | f = []
for i in range(3):
f.append(list(map(int, input().split())))
"""
a1+a2+a3+b1+b2+b3が3通りで合うか
"""
s1 = f[0][0] + f[1][1] + f[2][2]
s2 = f[0][1] + f[1][2] + f[2][0]
s3 = f[0][2] + f[1][0] + f[2][1]
if s1==s2==s3:
print("Yes")
else:
print("No")
| p03435 |
c = [list(map(int, input().split())) for _ in range(3)]
if 2*c[0][2]-c[1][2]-c[2][2]+c[1][0]+c[2][0] == 2*c[0][0]:
if 2*c[1][0]-c[2][0]-c[0][0]+c[2][1]+c[0][1] == 2*c[1][1]:
if 2*c[2][1]-c[0][1]-c[1][1]+c[0][2]+c[1][2] == 2*c[2][2]:
print('Yes')
else:
print('No')
else:
print('No')
e... | c = []
for i in range(3):
c_ = list(map(int, input().split()))
c.append(c_)
if c[2][2] == c[0][2] + c[2][0] -c[0][0] and c[2][2] == c[1][2] + c[2][1] -c[1][1] and c[1][1] == c[0][1] + c[1][0] -c[0][0]:
print('Yes')
else:
print('No') | p03435 |
c = [list(map(int, input().split())) for i in range(3)]
res = 0
ans = 0
for i in range(3):
res += sum(c[i])
ans += c[i][i]*3
if res == ans:
print('Yes')
else:
print('No') | c=[list(map(int,input().split())) for i in range(3)]
if (c[0][0]+c[1][1]+c[2][2])*2==c[0][1]+c[0][2]+c[1][0]+c[1][2]+c[2][0]+c[2][1]:
print('Yes')
else:
print('No') | p03435 |
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | #!/usr/bin/python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cac... | p03435 |
import sys
def solve():
input = sys.stdin.readline
C = [[int(c) for c in input().split()] for _ in range(3)]
possible = False
for i in range(101):
for j in range(101):
for k in range(101):
a11 = C[0][0] - i
a12 = C[0][1] - j
... | def solve():
C = [[int(c) for c in input().split()] for _ in range(3)]
diffr1 = C[0][1] - C[0][0]
diffr2 = C[0][2] - C[0][1]
diffc1 = C[1][0] - C[0][0]
diffc2 = C[2][0] - C[1][0]
if C[1][1] - C[1][0] == C[2][1] - C[2][0] == diffr1:
if C[1][2] - C[1][1] == C[2][2] - C[2][1] == diff... | p03435 |
import sys
input = sys.stdin.readline
c = [[int(x) for x in input().split()] for _ in range(3)]
for i in range(101):
for j in range(101):
for k in range(101):
b1, b2, b3 = [x - i for x in c[0]]
if [b1 + j, b2 + j, b3 + j] == c[1] and [b1 + k, b2 + k, b3 + k] == c[2]:
... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
c = [[int(x) for x in input().split()] for _ in range(3)]
flag = 1
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if c[0][0] - a1 == c[1][0] - a2 and c[1][0] - a2 == c[2][0] - a3:
if c... | p03435 |
c11,c12,c13 = list(map(int,input().split()))
c21,c22,c23 = list(map(int,input().split()))
c31,c32,c33 = list(map(int,input().split()))
count = 0
if c21 - c11 == c22 - c12 == c23 - c13:
count += 1
if c31 - c21 == c32 - c22 == c33 - c23:
count += 1
if c12 - c11 == c22 - c21 == c32 - c31:
count += 1
if c13... | c11,c12,c13 = list(map(int,input().split()))
c21,c22,c23 = list(map(int,input().split()))
c31,c32,c33 = list(map(int,input().split()))
count = 0
if c11-c12 == c21-c22 == c31-c32:
count += 1
if c12-c13 == c22-c23 == c32-c33:
count += 1
if c21-c11 == c22-c12 == c23-c13:
count += 1
if c21... | p03435 |
c = [list(map(int, input().split())) for _ in range(3)]
ok = False
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]
ok_... | c = [list(map(int, input().split())) for _ in range(3)]
ok = True
b = [c[0][0], c[0][1], c[0][2]]
a = [0, c[1][0] - b[0], c[2][0] - b[0]]
for i in range(3):
for j in range(3):
if a[i] + b[j] != c[i][j]:
ok = False
print('Yes') if ok else print('No')
| p03435 |
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
for a1 in range(101):
b1 = [l1[0]-a1, l1[1]-a1, l1[2]-a1]
for a2 in range(101):
b2 = [l2[0] - a2, l2[1] - a2, l2[2] - a2]
for a3 in range(101):
b3 = [l3[0] - a3, l... | c = [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):
if (c[0][0] - a1 == c[1][0] - a2 == c[2][0] - a3) and (c[0][1] - a1 == c[1][1] - a2 == c[2][1] - a3) and (c[0][2] - a1 == c[1][2] - a2 == c[2][2] - a3):
... | p03435 |
c = [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):
if (c[0][0] - a1 == c[1][0] - a2 == c[2][0] - a3) and (c[0][1] - a1 == c[1][1] - a2 == c[2][1] - a3) and (c[0][2] - a1 == c[1][2] - a2 == c[2][2] - a3):
... | c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
for b1 in range(101):
for b2 in range(101):
for b3 in range(101):
if c1[0] - b1 == c1[1] - b2 == c1[2] - b3:
if c2[0] - b1 == c2[1] - b2 == c2[2] - b3:
... | p03435 |
c = []
for _ in range(3):
c.append([int(i) for i in input().split()])
def validate(a, b, c):
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
return False
return True
found = False
min_b1 = min(c[0][0], c[1][0], c[2][0])
for b1 in range(min_... | c = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
for j in range(2):
d = c[i][j] - c[i+1][j]
e = c[i][j+1] - c[i+1][j+1]
if d != e:
print("No")
exit(0)
for i in range(2):
for j in range(2):
d = c[i][j] - c[i][j+1]
... | p03435 |
# 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] ... | def resolve():
c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
a01 = c[0][0] - c[0][1]
a02 = c[0][0] - c[0][2]
a12 = c[0][1] - c[0][2]
b01 = c[0][0] - c[1][0]
b02 = c[0][0] - c[2][0]
b12 = c[1][0] - c[2][0... | p03435 |
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
if not c1[0]-c1[1] == c2[0]-c2[1] == c3[0]-c3[1]:
print('No')
exit()
if not c1[2]-c1[1] == c2[2]-c2[1] == c3[2]-c3[1]:
print('No')
exit()
if not c1[0]-c2[0] == c1[1]-c2[1] == c1[2]-c2[2]:... | a1,a2,a3 = list(map(int,input().split()))
b1,b2,b3 = list(map(int,input().split()))
c1,c2,c3 = list(map(int,input().split()))
if not (a1-a2 == b1-b2 == c1-c2) or not (a2-a3 == b2-b3 == c2-c3):
print('No')
elif not (a1-b1 == a2-b2 == a3-b3) or not (b1-c1 == b2-c2 == b3-c3):
print('No')
else:
print(... | p03435 |
C = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3
for i in range(101):
a[0] = i
flg = True
for j in range(3):
b[j] = C[0][j] - i
if b[j] < 0:
flg = False
break
if flg:
for j in range(1, 3):
a[j] = C[j]... | C = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3
flg = True
for j in range(3):
b[j] = C[0][j] - a[0]
for j in range(1, 3):
a[j] = C[j][0] - b[0]
for j in range(3):
for k in range(3):
if C[j][k] != a[j] + b[k]:
flg = False
break
if... | p03435 |
c = [[]]*3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [[0]* 6]*3
for i in range(3):
arr[i][0] = c[i][0] - c[i][1]
arr[i][1] = c[i][0] - c[i][2]
arr[i][2] = c[i][1] - c[i][0]
... | c = [[]]*3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [0]*3
sum = 0
for i in range(3):
arr[0] += c[i][i]
for i in range(3):
if i + 1 < 3:
arr[1] += c[i][i+1]
... | p03435 |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
return int(eval(input()))
def getList():
return list(map(int, input().split()))
import math
import bisect
from logging import getLogger, StreamHandler, DEBUG, WARNING
logger = getLogger(__na... | import sys
# input = sys.stdin.buffer.readline
def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getlist():
return list(map(int, input().split()))
import math
import bisect
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + ... | p03435 |
c = [list(map(int,input().split())) for _ in range(3)]
for i in range(2):
x = c[0][i] - c[0][i+1]
y = c[1][i] - c[1][i+1]
z = c[2][i] - c[2][i+1]
if not (x==y and y==z and z==x):
print('No')
exit()
for i in range(2):
x = c[i][0] - c[i+1][0]
y = c[i][1] - c[i+1][1]
... | l = [list(map(int,input().split())) for _ in range(3)]
m = [[0, 0, 0] for _ in range(3)]
for i in range(3):
for j in range(3):
m[i][j] = l[i][j] - l[0][j]
for i in range(3):
f = True
for j in range(3):
if m[i][j] != m[i][0]:
f = False
break
if not f... | p03435 |
C = [list(map(int,input().split())) for _ in range(3)]
b = [0]*3
for i in range(3):
b[i] = C[0][i]-0
a = [0]*3
for i in range(3):
a[i] = C[i][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) | C = [list(map(int,input().split())) for _ in range(3)]
#a1 = 0 と固定
b = []
for i in range(3):
b.append(C[0][i] - 0)
a = []
for i in range(3):
a.append(C[i][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) | p03435 |
# -*- coding: utf-8 -*-
def solve():
c = [list(map(int, input().split())) for _ in range(3)]
for a0 in range(-100, 101) :
b = [c[0][i] - a0 for i in range(3)]
if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)):
continue
if any(c[2][0] - b[0] != c[2][i] - b[i]... | # -*- coding: utf-8 -*-
def solve():
c = [list(map(int, input().split())) for _ in range(3)]
for a0 in range(-100, 101) :
b = [c[0][i] - a0 for i in range(3)]
if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)):
continue
if any(c[2][0] - b[0] != c[2][i] - b[i]... | p03435 |
c=[[int(x) for x in input().split()] for _ in range(3)]
ans="No"
for a1 in c[0]:
for a2 in c[1]:
for a3 in c[2]:
b1=c[0][0]-a1
b2=c[1][1]-a2
b3=c[2][2]-a3
if a1+b2==c[0][1] and a1+b3==c[0][2] and a2+b1==c[1][0] and a2+b3==c[1][2] and a3+b1==c[2][0] and... | c=[[int(x) for x in input().split()] for _ in range(3)]
ans="No"
for a1 in c[0]:
for a2 in c[1]:
for a3 in c[2]:
b1=c[0][0]-a1
b2=c[1][1]-a2
b3=c[2][2]-a3
if a1+b2==c[0][1] and a1+b3==c[0][2] and a2+b1==c[1][0] and a2+b3==c[1][2] and a3+b1==c[2][0] and... | p03435 |
c = []
for i in range(3):
c.append(list(map(int, input().split())))
ans = 'Yes'
for i in range(2):
a0 = c[0][i] - c[0][i + 1]
a1 = c[1][i] - c[1][i + 1]
a2 = c[2][i] - c[2][i + 1]
if not (a0 == a1 == a2):
ans = 'No'
break
print(ans) | c = [list(map(int, input().split())) for i in range(3)]
ans = 'Yes'
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]:
ans = 'No'
break
print(ans) | p03435 |
def c_takahashi_information(C):
a = []
b = []
for a_0 in range(min(C[0]) + 1):
for a_1 in range(min(C[1]) + 1):
for a_2 in range(min(C[2]) + 1):
tmp1 = [a_0, a_1, a_2]
tmp2 = [[C[i][j] - tmp1[i]
for j in range(3)] for i in ... | def c_takahashi_information(C):
a = [min(C[0]), min(C[1]), min(C[2])]
tmp = [[C[i][j] - a[i] for j in range(3)] for i in range(3)]
b = list(map(list, set(map(tuple, tmp))))
for bb in b:
f = True
for i in range(3):
for j in range(3):
if a[i] + bb[j] != ... | p03435 |
def c_takahashi_information(C):
a = [min(C[0]), min(C[1]), min(C[2])]
tmp = [[C[i][j] - a[i] for j in range(3)] for i in range(3)]
b = list(map(list, set(map(tuple, tmp))))
for bb in b:
f = True
for i in range(3):
for j in range(3):
if a[i] + bb[j] != ... | def c_takahashi_information(C):
b = [C[0][i] - 0 for i in range(3)]
a = [0] + [C[i][0] - b[0] for i in range(1, 3)] # a_1=0と仮定してよい
for i in range(3):
for j in range(3):
if a[i] + b[j] != C[i][j]:
return 'No'
return 'Yes'
C = [[int(i) for i in input().split(... | p03435 |
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
A = list([x-min(a) for x in a])
B = list([x-min(b) for x in b])
C = list([x-min(c) for x in c])
A.sort()
B.sort()
C.sort()
if A==B==C:
print('Yes')
else:
print('No') | a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
A = list([x-min(a) for x in a])
B = list([x-min(b) for x in b])
C = list([x-min(c) for x in c])
if A==B==C:
print('Yes')
else:
print('No')
| p03435 |
def main():
c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))
r1max = max([c11, c12, c13])
r2max = max([c21, c22, c23])
r3max = max([c31, c32, c33])
c1max = max([c11, c21, c31])
c2max ... | def main():
c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))
r1max = max([c11, c12, c13])
r2max = max([c21, c22, c23])
r3max = max([c31, c32, c33])
c1max = max([c11, c21, c31])
c2max ... | p03435 |
#f = open("input.txt")
#N, K = [int(x) for x in f.readline().split(' ')]
#lines = f.readlines()
#f.close()
import sys
N, K = [int(x) for x in sys.stdin.readline().split(' ')]
lines = sys.stdin.readlines()
schedule = [0]*N
for line in lines:
strs = line.split(' ')
schedule[int(strs[0])-1] = int(str... | #f = open("input.txt")
#N, K = [int(x) for x in f.readline().split(' ')]
#lines = f.readlines()
#f.close()
from sys import stdin
N, K = [int(x) for x in stdin.readline().split(' ')]
lines = stdin.readlines()
schedule = [0]*N
for line in lines:
strs = line.split(' ')
schedule[int(strs[0])-1] = int(st... | p00491 |
#coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
field = [int(n) for n in line.split()]
num = int(sys.stdin.readline())
data = []
... | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#整列
field = [int(n) for n in line.split()]
# 横、縦
num = int(sys.stdin.rea... | p00438 |
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
read... | import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
read... | p03003 |
MOD = 10 ** 9 + 7
_, _ = list(map(int, input().strip().split()))
S = list(map(int, input().strip().split()))
T = list(map(int, input().strip().split()))
sdp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
for i, s in enumerate(S):
for j, t in enumerate(T):
v = sdp[i][j + 1] + sdp[i + 1][j] + (1 if ... | MOD = 10 ** 9 + 7
def main(S, T):
sdp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
for i, s in enumerate(S):
for j, t in enumerate(T):
v = sdp[i][j + 1] + sdp[i + 1][j] + (1 if s == t else -sdp[i][j])
sdp[i + 1][j + 1] = v % MOD
return (sdp[-1][-1] + 1)
if __name__ == '__m... | p03003 |
MOD = 10 ** 9 + 7
def main(S, T):
sdp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
for i, s in enumerate(S):
for j, t in enumerate(T):
v = sdp[i][j + 1] + sdp[i + 1][j] + (1 if s == t else -sdp[i][j])
sdp[i + 1][j + 1] = v % MOD
return (sdp[-1][-1] + 1)
if __name__ == '__m... | MOD = 10 ** 9 + 7
def main(S, T):
l = len(T) + 1
dp = [0] * l
# sdp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
# for i, s in enumerate(S):
# for j, t in enumerate(T):
# v = sdp[i][j + 1] + sdp[i + 1][j] + (1 if s == t else -sdp[i][j])
# sdp[i + 1][j + 1] = v % MOD
for i, s i... | p03003 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 20:56:46 2019
@author: Yamazaki Kenichi
"""
N, M = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
mod = 10**9 + 7
A = [[1 for j in range(M+1)]]
A += [[0 for j in range(M+1)] for i in range(N)]
A += [... | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 22:15:18 2019
@author: Yamazaki Kenichi
"""
N, M = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
mod = 10**9 + 7
A = [[1 for j in range(M+1)]]
A += [[0 for j in range(M+1)]]
#A += [[0 for j in range... | p03003 |
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
DBG = True and False
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
... | import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(eval(input()))
inl = lambda: list(map(int, input().split()))
inm = lambda: list(map(int, input().split()))
DBG = True and False
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
... | p03003 |
#解説読み 2次元dp
mod = 10**9 + 7
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
tmp = [1 for _ in range(m+1)]
dp = [tmp]
for ni in range(n):
last = tmp
tmp = [1]
for mi in range(m):
if A[ni] != B[mi]:
x = tmp[-1]+last[mi+1]-last[mi]
... | #15:35
h,w = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
mod = 10 ** 9 + 7
now = [1 for _ in range(w+1)]
for i in range(h):
last = now
now = [1]
for j in range(w):
if a[i] == b[j]:
now.append((last[j+1]+now[-1])%mod)
else:
n... | p03003 |
from collections import defaultdict
import sys
from copy import copy
input = sys.stdin.readline
mod = 10**9+7
N, M = list(map(int, input().split()))
S = "".join(input().split())
T = "".join(input().split())
dS = defaultdict(int)
dT = defaultdict(int)
dS[""] += 1
dT[""] += 1
for i in range(N):
tmp = cop... | mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = [None] + list(map(int, input().split()))
T = [None] + list(map(int, input().split()))
dp = [[0 for _ in range(M+1)] for _ in range(N+1)]
for i in range(1, N+1):
for j in range(1, M+1):
if S[i] == T[j]:
dp[i][j] = (dp[i][j-1] + dp... | p03003 |
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*m for _ in range(n)]
sum=[[0]*m for _ in range(n)]
mod=10**9+7
for i in range(n):
if s[i]==t[0]:
dp[i][0]=1
else:
dp[i][0]=0
for i in range(m):
if t[i]==s[0]:
dp[0][i]=1
else:
... | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*m for _ in range(n)]
sum=[[0]*m for _ in range(n)]
mod=10**9+7
ans=0
for i in range(n):
if s[i]==t[0]:
dp[i][0]=1
else:
dp[i][0]=0
ans+=dp[i][0]
sum[i][0]=sum[i-1][0]+dp[i][0]
for... | p03003 |
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*m for _ in range(n)]
sum=[[0]*m for _ in range(n)]
mod=10**9+7
ans=0
for i in range(n):
if s[i]==t[0]:
dp[i][0]=1
else:
dp[i][0]=0
ans+=dp[i][0]
sum[i][0]=sum[i-1][0]+dp[i][0]
for... | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*(m+1) for _ in range(n+1)]
sum=[[0]*(m+1) for _ in range(n+1)]
mod=10**9+7
ans=0
for i in range(n):
for j in range(m):
if s[i]==t[j]:
dp[i+1][j+1]=(sum[i][j]+1)%mod
else:
dp[i+1... | p03003 |
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecurs... | '''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecurs... | p03003 |
mod = 10**9+7
from bisect import bisect
from collections import defaultdict
N,M = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
dp = [[0]*(M+1) for _ in range(N+1)]
for n in range(N):
for m in range(M):
dp[n][m] = dp[n-1][m]+dp[n][m-1]-dp[n... | mod = 10**9+7
N,M = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
dp = [[0]*(len(T)+1) for _ in range(len(S)+1)]
for s in range(len(S)+1):
for t in range(len(T)+1):
if s == 0 or t == 0:
dp[s][t] = 1
for s in range(len(S)):
fo... | p03003 |
N, M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10**9 + 7
ns = len(S)
nt = len(T)
dp = [[0] * (nt + 1) for i in range(ns + 1)]
for i in range(1, ns + 1):
for j in range(1, nt + 1):
if (S[i - 1] == T[j - 1]):
dp[i]... | N, M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10**9 + 7
ns = len(S)
nt = len(T)
dp = [[0] * (nt + 1) for i in range(ns + 1)]
for i in range(1, ns + 1):
for j in range(1, nt + 1):
if (S[i - 1] == T[j - 1]):
dp[i]... | p03003 |
#!/usr/bin/env python3
import sys
from pprint import pprint
MOD = 1000000007 # type: int
def solve(N: int, M: int, S: "List[int]", T: "List[int]"):
dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0] = 1
for j in range(M + 1):
dp[0][j] = 1
for i in... | #!/usr/bin/env python3
import sys
from pprint import pprint
MOD = 1000000007 # type: int
def solve(N: int, M: int, S: "List[int]", T: "List[int]"):
dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N + 1):
dp[i][0] = 1
for j in range(M + 1):
dp[0][j] = 1
for i in r... | p03003 |
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | p03003 |
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
from math import gcd
except Exception:
from fractions import gcd
MOD = 1000000007 # type: int
def solv... | #!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
from math import gcd
except Exception:
from fractions import gcd
MOD = 1000000007 # type: int
def solve(N: int, M: int, S: "List[int]", T: "... | p03003 |
[N,M] = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
ta = [[0] * (M+1) for i in range(N+1)]
ta[0][0]=1
wa = [[0] * (M+1) for i in range(N+1)]
wa[0][:]=[1]*(M+1)
for i in range(N+1):
wa[i][0]=1
output = 1
for i in range(1,N+1):
for j in range(1... | [N,M] = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
ta = [[0] * (M+1) for i in range(N+1)]
ta[0][0]=1
wa = [[0] * (M+1) for i in range(N+1)]
wa[0][:]=[1]*(M+1)
for i in range(N+1):
wa[i][0]=1
output = 1
for i in range(1,N+1):
for j in range(1... | p03003 |
n,m=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
mod=10**9+7
dp = [0]*m
for s in S:
k=0
d = [0]*(m+1)
for i in range(m):
if T[i]==s:
k+=dp[i-1]+1
d[i]=(dp[i]+k)%mod
dp=d
print((dp[-2]+1)) | n,m=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
p=[0]*m
for s in S:
k=0
d=[0]*(m+1)
for i in range(m):
if T[i]==s:
k+=p[i-1]+1
d[i]=(p[i]+k)%(10**9+7)
p=d
print((p[-2]+1)) | p03003 |
N, M = list(map(int, input().split()))
*S, = list(map(int, input().split()))
*T, = list(map(int, input().split()))
MOD = 10**9 + 7
P = []
for i in range(N):
for j in range(M):
if S[i] == T[j]:
P.append((i, j))
P.sort(key=lambda x: (x[0], -x[1]))
data = [0]*(M+2)
def get(k):
s... | N, M = list(map(int, input().split()))
*S, = list(map(int, input().split()))
*T, = list(map(int, input().split()))
data = [0]*(M+2)
def get(k):
s = 0
while k:
s += data[k]
k -= k & -k
return s % MOD
def add(k, x):
while k <= M:
data[k] = (data[k] + x) % MOD
... | p03003 |
mod=10**9+7
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp1=[1]*(m+1)
dp2=[1]*(m+1)
for i in range(n):
if i%2==0:
for j in range(m):
if s[i]==t[j]:dp1[j+1]=dp2[j+1]+dp1[j]
else:dp1[j+1]=dp2[j+1]+dp1[j]-dp2[j]
dp1[j+1]%=mod
el... | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[(m+1)*[1]for _ in range(n+1)]
for i in range(n):
for j in range(m):
dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]
if s[i]!=t[j]:dp[i+1][j+1]-=dp[i][j]
dp[i+1][j+1]%=(10**9+7)
print((dp[-1][-1])) | p03003 |
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[(m+1)*[1]for _ in range(n+1)]
for i in range(n):
for j in range(m):
dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]
if s[i]!=t[j]:dp[i+1][j+1]-=dp[i][j]
dp[i+1][j+1]%=(10**9+7)
print((dp[-1][-1])) | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[1]*(m+1)for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
for j in range(1,m+1):
dp[i][j]=dp[i-1][j]+dp[i][j-1]
if s[i-1]!=t[j-1]:
dp[i][j]-=dp[i-1][j-1]
dp[i]... | p03003 |
mod = 10**9+7
n, m = list(map(int,input().split()))
s = list(map(int,input().split()))
t = list(map(int,input().split()))
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n)[::-1]:
for j in range(m)[::-1]:
if s[i] == t[j]:
dp[i][j] += 1 + dp[i+1][j+1]
dp[i][j] %= mod
... | mod = 10**9+7
n, m = list(map(int,input().split()))
s = list(map(int,input().split()))
t = list(map(int,input().split()))
dp = [0]*(m+1)
for i in range(n)[::-1]:
old = 0
for j in range(m)[::-1]:
tmp = dp[j] + dp[j+1] - old
tmp %= mod
if s[i]== t[j]:
tmp += 1 + old
... | p03003 |
def solve():
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
Ss = list(map(int, input().split()))
Ts = list(map(int, input().split()))
dp = [[0]*(M+1) for _ in range(N+1)]
for i in range(N+1):
dp[i][0] = 1
for j in range(M+1):
dp[0][j] = 1
for i, S ... | def solve():
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
Ss = list(map(int, input().split()))
Ts = list(map(int, input().split()))
dp = [1]*(M+1)
for i, S in enumerate(Ss, 1):
dp2 = [1]*(M+1)
for j, T in enumerate(Ts, 1):
dp2[j] = dp[j] + dp2[j... | p03003 |
import sys
sys.setrecursionlimit(1000000000)
mod = 10**9+7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
memo = [[-1]*(M+1) for _ in range(N)]
List = [[]for _ in range(N)]
for i in range(N):
for j in range(M):
if S[i]==T[j]:
... | mod = 10**9+7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [[0]*(M+1) for _ in range(N+1)]
dp[0][0] = 1
Sum = [[1]*(M+1) for _ in range(N+1)]
for i in range(1, N+1):
for j in range(1, M+1):
if S[i-1] == T[j-1]:
dp[i... | p03003 |
MOD = int(1e9 + 7)
def f(N, M, s, t):
dp = [[0] * (M + 1) for _ in range(N + 1)]
cums = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(1, M + 1):
dp[i][j] = 0 if s[i-1] != t[j-1] else (cums[i-1][j-1] + 1) % MOD
cums[i][j] = cums[i-1]... | # coding: utf-8
MOD = int(1e9 + 7)
def f(N, M, s, t):
dp = [[0] * (M + 1) for _ in range(N + 1)]
cums = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(1, M + 1):
dp[i][j] = 0 if s[i-1] != t[j-1] else (cums[i-1][j-1] + 1) % MOD
cums[... | p03003 |
import sys
from collections import deque # 双方向キュー
from collections import defaultdict # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop # プライオリティキュー
from bisect import bisect_left, bisect_right # 二分探索
#import numpy as np # 1.8.2
#import scipy # 0.13.3
s2nn = lambda s: [int(c) for c in s... | import sys
from collections import deque # 双方向キュー
from collections import defaultdict # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop # プライオリティキュー
from bisect import bisect_left, bisect_right # 二分探索
#import numpy as np # 1.8.2
#import scipy # 0.13.3
s2nn = lambda s: [int(c) for c in s... | p03003 |
import sys
from collections import deque # 双方向キュー
from collections import defaultdict # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop # プライオリティキュー
from bisect import bisect_left, bisect_right # 二分探索
#import numpy as np # 1.8.2
#import scipy # 0.13.3
s2nn = lambda s: [int(c) for c in s... | import sys
from collections import deque # 双方向キュー
from collections import defaultdict # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop # プライオリティキュー
from bisect import bisect_left, bisect_right # 二分探索
#import numpy as np # 1.8.2
#import scipy # 0.13.3
s2nn = lambda s: [int(c) for c in s... | p03003 |
n,m=list(map(int,input().split()))
s=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]
maxim=(10**3)*2
mod=10**9+7
dp=[[0 for i in range(m+1)]for j in range(n+1)]
for i in range(n):
for j in range(m):
x=0
if s[i]==t[j]:
x=dp[i][j]+1
dp[i+1][j+1]... | n,m=list(map(int,input().split()))
s=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]
mod=10**9+7
dp=[[0 for i in range(m+1)]for j in range(n+1)]
for i in range(n):
for j in range(m):
x=0
if s[i]==t[j]:
x=dp[i][j]+1
dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+... | p03003 |
md=10**9+7
n,m=list(map(int,input().split()))
s=list(input().split())
t=list(input().split())
dp=[[1]*(m+1) for _ in range(n+1)]
for i,sk in enumerate(s):
dp[i+1]=dp[i][:]
cs=0
for j,tk in enumerate(t):
if sk==tk:
cs+=dp[i][j]
dp[i+1][j+1]+=cs
print((dp[-1][-1]%md)) | def f(n, m):
s = list(input().split())
t = list(input().split())
dp = [[1] * (m + 1) for _ in range(n + 1)]
for i, sk in enumerate(s):
dpi1 = dp[i + 1] = dp[i][:]
cs = 0
for j, tk in enumerate(t):
if sk == tk:
cs = (cs + dp[i][j]) % md
... | p03003 |
def f(n, m):
s = list(map(int,input().split()))
t = list(map(int,input().split()))
dp = [[1] * (m + 1) for _ in range(n + 1)]
for i, sk in enumerate(s):
dpi1 = dp[i + 1] = dp[i][:]
cs = 0
for j, tk in enumerate(t):
if sk == tk:
cs = (cs + dp[i... | def f(n, m):
s = list(map(int,input().split()))
t = list(map(int,input().split()))
dpi = [1] * (m + 1)
for i, sk in enumerate(s):
dpi1 = dpi[:]
cs = 0
for j, tk in enumerate(t):
if sk == tk:
cs = (cs + dpi[j]) % md
dpi1[j + 1] = (... | p03003 |
N , M = list(map(int,input().split()))
S = list(map(int,input().split()))
T = list(map(int,input().split()))
# 累積和参照のために0の行,列を追加
sm = [[0] * (M+1) for _ in range(N+1)]
for i , s in enumerate(S) :
l1 = sm[i][:]
l2 = 0
for j , t in enumerate(T) :
new = l1[j+1] + l2
if s == t :
... | N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 1) for _ in range(N + 1)] # dp[s][t]
for i, s in enumerate(S, start=1):
for j, t in enumerate(T, start=1):
v = dp[i - 1][j] + dp[i][j - 1]
if s... | p03003 |
N, M = list(map(int, input().split()))
S = list(input().split())
T = list(input().split())
MOD = 10**9+7
dp = [[0] * (M+1) for _ in range(N+1)]
sum = [[0] * (M+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N+1):
sum[i][0] = 1
for j in range(M+1):
sum[0][j] = 1
for i in range(N):
for j in r... | N, M = list(map(int, input().split()))
S = list(input().split())
T = list(input().split())
MOD = 10**9+7
dp = [[0] * (M+1) for _ in range(N+1)]
sum = [[0] * (M+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N+1):
sum[i][0] = 1
for j in range(M+1):
sum[0][j] = 1
for i in range(N):
for j in r... | p03003 |
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,m=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
C=[[0]*(m+1) for _ in range(n+1)]
from itertools import ... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
n,m=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
C=[[0]*(m+1) for _ in range(n+1)] # dp の累積和を持つ
for i in r... | p03003 |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
dp[0][0]=1
#dp[i][j]はSのi文字目,Tのj文字目を使う時の通り数
cumsum=[[... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
#シンプルに!!
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
#i文字目までとj文字目まで見た.
for i in rang... | p03003 |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
#シンプルに!!
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
#i文字目までとj文字目まで見た.
for i in rang... |
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M=MI()
S=LI()
T=LI()
dp=[[0]*(M+1) for _ in range(N+1)]
# dp[i][j]はSをi文字,Tをj文字見た時の通り数
for i in range(N+1):
... | p03003 |
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 2) for _ in range(N + 2)]
sdp = [[0] * (M + 2) for _ in range(N + 2)]
dp[0][0] = 1
sdp[1][1] = 1
for i in range(N + 1):
for j in range(M + 1):
if i - 1 >=... | # dp[i][j] SとTの最後の文字を採用するような文字列の個数。これにより各DPテーブルの値が排反になる。元の文字列の最後を必ず採用するので
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0] * (M + 2) for _ in range(N + 2)]
sdp = [[0] * (M + 2) for _ in range(N + 2)]
dp[0][0] = 1
sdp[1][1] =... | p03003 |
N,M=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
dp=[[0]*(M+1) for i in range(N+1)]
mod=10**9+7
def Mod(n,mod):
return n-mod if n>=mod else n
for n in range(1,N+1):
for m in range(1,M+1):
x=dp[n-1][m-1]+1 if S[n-1]==T[m-1] else 0
dp[n... | N,M=list(map(int,input().split()))
S=list(map(int,input().split()))
T=list(map(int,input().split()))
dp=[[0]*(M+1) for i in range(N+1)]
mod=10**9+7
for n in range(1,N+1):
for m in range(1,M+1):
x=1 if S[n-1]==T[m-1] else -dp[n-1][m-1]
y=dp[n-1][m]+dp[n][m-1]+x
dp[n][m]=y if y<mod el... | p03003 |
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 10 ** 9 + 7
dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]
dp0[0][0] = 1
for i in range(N + 1):
for j ... | N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
S.append(0)
T.append(0)
MOD = 1000000007
dp0 = [[0 for _ in range(2005)] for _ in range(2005)]
dp1 = [[0 for _ in range(2005)] for _ in range(2005)]
dp0[0][0] = 1
for i in range(N + 1):
for j i... | p03003 |
# 解説AC
from collections import defaultdict
N,M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
# dp[i][j]: S[:i]とT[:j]での共通部分列の個数
dp = [[0] * (M + 1) for _ in range(N + 1)]
# 初期条件
for i in range(N + 1):
dp[i][0] = 1
fo... | # 解説AC
N,M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
# dp[i][j]: S[:i]とT[:j]での共通部分列の個数
dp = [[0] * (M + 1) for _ in range(N + 1)]
def main():
# 初期条件
for i in range(N + 1):
dp[i][0] = 1
for j in ran... | p03003 |
# 解説AC
from collections import defaultdict
N,M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
# (i, j): S[:i]とT[:j]での共通部分列の個数
dp = defaultdict(int)
# 初期条件
for i in range(N + 1):
dp[(i, 0)] = 1
for j in range(M + 1):
... | # 解説AC
N,M = list(map(int, input().split()))
S = [int(i) for i in input().split()]
T = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
# dp[i][j]: S[:i]とT[:j]の共通部分列のうち、
# S[i - 1] == T[j - 1]で、これを選ぶ場合の個数
dp = [[0] * (M + 1) for _ in range(N + 1)]
# DPの二次元累積和
sdp = [[0] * (M + 1) for _ in range(N + 1)... | p03003 |
# 入力
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
class ModInt:
def __init__(self, x):
self.x = x % MOD
def __str__(self):
return str(self.x)
__repr__ = __str__
def __add__(self, ot... | # 入力
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7
class ModInt:
def __init__(self, x):
self.x = x % MOD
def __str__(self):
return str(self.x)
__repr__ = __str__
def __add__(self, ot... | p03003 |
from copy import deepcopy as de
n,m =[int(i) for i in input().split()]
s=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]
a=[1]*(m+1)
for i,b in enumerate(s):
d=de(a)
k=0
for j,c in enumerate(t):
d[j]=(k+d[j])%1000000007
if b==c:
k=(k+a[j])%1000000007
d[-1]=(k+d[-1... | n,m =[int(i) for i in input().split()]
s=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]
a=[1]*(m+1)
for b in s:
d=a[:]
k=0
for j,c in enumerate(t):
d[j]=(k+d[j])%1000000007
if b==c:
k=(k+a[j])%1000000007
d[-1]=(k+d[-1])%1000000007
a=d[:]
print((a[-1]))
| p03003 |
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | p03003 |
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
ans = int(0)
N, M = LI()
S = LI()
T = LI()
dp = [[0]*(M+1) for _ in range(N+1)]
sumdp = [[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
for j in range(1,M+1):
... | import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
ans = int(0)
N, M = LI()
S = LI()
T = LI()
dp = [[0]*(M+1) for _ in range(N+1)]
sumdp = [[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
for j in range(1,M+1):
... | p03003 |
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod = 10**9+7
dp = [[0 for j in range(m)]for i in range(n)]
for i in range(m):
if s[0] ==t[i]:
dp[0][i] = 1
for i in range(n):
if s[i] ==t[0]:
dp[i][0] = 1
for i in range(n):
fo... | n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod = 10**9+7
dp = [[0 for j in range(m)]for i in range(n)]
for i in range(m):
if s[0] ==t[i]:
dp[0][i] = 1
for i in range(n):
if s[i] ==t[0]:
dp[i][0] = 1
sumdp = [[0 for j in range... | p03003 |
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [1] * (M+1)
dpleft = [0] * (M)
MOD = 10 ** 9 + 7
ndp = [1] * (M+1)
for n in range(N):
for m in range(M):
if S[n] == T[m]:
ndp[m+1] = ndp[m] + dp[m+1]
dpleft[... | N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [1] * (M+1)
dpleft = [0] * (M)
MOD = 10 ** 9 + 7
ndp = [1] * (M+1)
for n in range(N):
for m in range(M):
if S[n] == T[m]:
ndp[m+1] = (ndp[m] + dp[m+1]) % MOD
... | p03003 |
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
N,M=map(int,input().... | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
N,M=map(int,input().... | p03003 |
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [[0] * (M + 1) for _ in range(N + 1)]
dp[0][0] = 1
sm = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
for j in range(1, M + 1):
if S[i - 1] =... | MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
sm = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N + 1):
sm[i][0] = 1
for j in range(M + 1):
sm[0][j] = 1
for i in range(1, N + 1):
for j in range(1, M + 1)... | p03003 |
def main():
e=enumerate
n,m,*u=list(map(int,open(0).read().split()))
dp=[[1]*(m+1)for _ in range(n+1)]
for i,s in e(u[:n]):
for j,t in e(u[n:]):
dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j]-dp[i][j]*(s!=t))%(10**9+7)
print((dp[n][m]))
main() | def main():
e=enumerate
n,m,*u=list(map(int,open(0).read().split()))
dp=[[1]*(m+1)for _ in range(n+1)]
dpi=dp[0]
for i,s in e(u[:n]):
dpi1=dp[i+1]
for j,t in e(u[n:]):
dpi1[j+1]=(dpi[j+1]+dpi1[j]-dpi[j]*(s!=t))%(10**9+7)
dpi=dpi1
print((dpi[m]))
mai... | p03003 |
def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split())) + [0]
T = list(map(int, input().split())) + [0]
dp0 = [[0] * (M + 5) for _ in range(N + 5)]
dp1 = [[0] * (M + 5) for _ in range(N + 5)]
MOD = 10 ** 9 + 7
dp0[0][0] = 1
for i in range(N + 1):
... | def main():
N, M = list(map(int, input().split()))
S = list(map(int, input().split())) + [0]
T = list(map(int, input().split())) + [0]
dp0 = [[0] * (M + 5) for _ in range(N + 5)]
dp1 = [[0] * (M + 5) for _ in range(N + 5)]
MOD = 10 ** 9 + 7
dp0[0][0] = 1
for i in range(N + 1):
... | p03003 |
mod=1000000007
n,m=list(map(int,input().split()))
S=tuple(map(int,input().split()))
T=tuple(map(int,input().split()))
DP=[[0]*(m+1) for _ in range(n+1)]
for i,s in enumerate(S):
for j,t in enumerate(T):
if s==t:
DP[i+1][j+1]=DP[i][j+1]+DP[i+1][j]+1
else:
DP[i+1][j+1... | mod=1000000007
n,m=list(map(int,input().split()))
S=tuple(map(int,input().split()))
T=tuple(map(int,input().split()))
DP=[[0]*(m+1) for _ in range(n+1)]
for i in range(n+1):
DP[i][0]=1
for i in range(m+1):
DP[0][i]=1
for i,s in enumerate(S):
for j,t in enumerate(T):
if s==t:
... | p03003 |
import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
dp = [[0] * (M + 1) for i in range(N + 1)]
for x in range(1, N + 1):
for y in range(1, M + 1):
dp[x][y] = dp[x][y - 1] + dp[x - 1][... | import sys
readline = sys.stdin.readline
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
P = 10 ** 9 + 7
dp = [[0] * (M + 1) for i in range(N + 1)]
for x in range(1, N + 1):
for y in range(1, M + 1):
dp[x][y] = dp[x][... | p03003 |
n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
MOD = 10**9 + 7
dp = [[0]*(m+1) for i in range(n+1)]
for si in range(n+1):
dp[si][0] = 1
for ti in range(m+1):
dp[0][ti] = 1
for si in range(n):
for ti in range(m):
if s[si] ... | def count_cs(str1, str2, MOD):
"""文字列str1, str2の共通部分列(Common Subsequence, CS)を数え上げる。
添字が異なる場合は異なる部分列として考える。
計算量 O(|str1||str2|)
"""
dp = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]
for i in range(len(str1)):
for j in range(len(str2)):
if str1[i] == str2[j]:
... | p03003 |
from collections import defaultdict as dd
N, M = list(map(int, input().split()))
MOD = 10**9 + 7
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[0 for i in range(M+1)] for j in range(N+1)]
for j in range(M):
dp[1][j + 1] = dp[1][j] + 1 if s[0] == t[j] else dp[1][j]
for i... | N, M = list(map(int, input().split()))
MOD = 10**9 + 7
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[0 for i in range(M+1)] for j in range(N+1)]
for j in range(M):
dp[1][j + 1] = dp[1][j] + 1 if s[0] == t[j] else dp[1][j]
for i in range(N):
dp[i + 1][1] = dp[i][1] + ... | p03003 |
N,M=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
sm=[[ 0 for i in range(M)] for j in range(N)]
s1=0
s2=0
if N>M:
for i in range(N):
if t[0]==s[i]:
a=1
else:
a=0
s1=s1+a
sm[i][0]=s1
if i<M:
if s[0]==t[... | N,M=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
sm=[[ 0 for i in range(M)] for j in range(N)]
s1=0
s2=0
if N>M:
for i in range(N):
if t[0]==s[i]:
a=1
else:
a=0
s1=s1+a
sm[i][0]=s1
if i<M:
if s[0]==t[... | p03003 |
def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
u = [1] * (N + 1)
v = [1] * (N + 1)
for t in T:
for i, s in enumerate(S, 1):
if s == t:
v[i] = v[i - 1] + u... | def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
V = [1] * N
for t in T:
p, q = 1, 1
for i, (s, v) in enumerate(zip(S, V)):
V[i] = q = v + q if s == t else v + q - p
... | p03003 |
#!/usr/bin/env python3
MOD = 10**9 + 7
n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[0] * (m + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(m):
dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - ... | #!/usr/bin/env python3
MOD = 10**9 + 7
n, m = list(map(int, input().split()))
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 1
for j in range(m + 1):
dp[0][j] = 1
for i in range(n):
for j... | p03003 |
import copy
N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array[0] = 1
for i, s in enumerate(S_array):
... | N, M = list(map(int, input().split()))
S_array = list(map(int, input().split()))
T_array = list(map(int, input().split()))
mod = 10**9 + 7
add_num_array = [0] * N
ans_array = [0] * (N + 1)
ans_old = [1] * (N + 1)
for t in T_array:
ans_array = [1] * (N+1)
for i, s in enumerate(S_array):
i... | p03003 |
def main():
from collections import defaultdict
import bisect
n,m = list(map(int,input().split()))
s = list(map(int,input().split()))
t = list(map(int,input().split()))
mod = 10**9+7
p = max(n,m)
if n>m:
t.extend((0,)*(n-m))
else:
s.extend((0,)*(m-n))
dcs = defaultdict(list)
d... | from collections import defaultdict
import bisect
n,m = list(map(int,input().split()))
s = list(map(int,input().split()))
t = list(map(int,input().split()))
mod = 10**9+7
p = max(n,m)
if n>m:
t.extend((0,)*(n-m))
else:
s.extend((0,)*(m-n))
dp = [[1 for i in range(p+1)] for j in range(p+1)]
for i in rang... | p03003 |
MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = 1 + dp[i - 1... | MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = (1 + dp[i - ... | p03003 |
import sys
sys.setrecursionlimit(10**6+32)
mod=10**9+7
input=sys.stdin.buffer.readline
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[ [0 for _ in range(m)] for _ in range(n)]
for i in range(0,n):
for j in range(0,m):
ret=0
if i-1>... | import sys
mod=10**9+7
input=sys.stdin.buffer.readline
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[ [0 for _ in range(m)] for _ in range(n)]
for i in range(0,n):
for j in range(0,m):
ret=0
if i-1>=0:
ret+=dp[i-1][j]
... | p03003 |
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, M = list(map(int, readline().split()))
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))
... | p03003 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.