Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
dx = (0, 0, 1, -1)
dy = (1, -1, 0, 0)
seen = [[False] * w for _ in range(h)]

numb = 0
numw = 0


def dfs(x, y):
    global numb, numw
    seen[x][y] = True
    if s[x][y] == '#':
        numb += 1
    else:
        numw += 1
    for di in range(4):
        nx = x + dx[di]
        ny = y + dy[di]
        if (nx < 0 or nx >= h or ny < 0 or ny >= w):
            continue
        if s[x][y] == s[nx][ny]:
            continue
        if seen[nx][ny]:
            continue
        dfs(nx, ny)


ans = 0
for x in range(h):
    for y in range(w):
        if seen[x][y]:
            continue
        if s[x][y] == '.':
            continue
        numb = 0
        numw = 0
        dfs(x, y)
        ans += numb * numw
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10**6)
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
dx = (0, 0, 1, -1)
dy = (1, -1, 0, 0)
seen = [[False] * w for _ in range(h)]

numb = 0
numw = 0


def dfs(x, y):
    global numb, numw
    seen[x][y] = True
    if s[x][y] == '#':
        numb += 1
    else:
        numw += 1
    for di in range(4):
        nx = x + dx[di]
        ny = y + dy[di]
        if (nx < 0 or nx >= h or ny < 0 or ny >= w):
            continue
        if s[x][y] == s[nx][ny]:
            continue
        if seen[nx][ny]:
            continue
        dfs(nx, ny)


ans = 0
for x in range(h):
    for y in range(w):
        if seen[x][y]:
            continue
        if s[x][y] == '.':
            continue
        numb = 0
        numw = 0
        dfs(x, y)
        ans += numb * numw
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
grid = [list(input()) for _ in range(H)]
#print(grid)
MOD = 10**9+7
dp = [[0]*W for i in range(H)]
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if i+1 < H and grid[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= MOD
        if j+1 < W and grid[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= MOD
print(dp[H-1][W-1])

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
dp = [0]*(N+1)
# dp[i+1]はindexでiの足場までのコストの最小値
# dp[N]は求める値
dp[2] = abs(h[1]-h[0])
for i in range(2,N):
    dp[i+1] = min(dp[i] + abs(h[i]-h[i-1]),dp[i-1] + abs(h[i]-h[i-2]))
print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = float('inf')
H += [inf for _ in range(K+5)]
dp = [inf]*(N+K+5)
dp[0] = 0
dp[1] = abs(H[0]-H[1])
#dp[2] = abs(H[1]-H[0])
# for i in range(2,N):
#     dp[i] = min(dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i]))
# print(dp[N-1])

for i in range(N):
    for j in range(K+1):
        dp[i+j] = min(dp[i+j],dp[i]+abs(H[i]-H[i+j])) # 配るdp,Hの配列外参照が微妙
print(dp[N-1])


Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = float('inf')
H += [inf for _ in range(K+5)]
dp = [inf]*(N+K+5)
dp[0] = 0
dp[1] = abs(H[0]-H[1])
#dp[2] = abs(H[1]-H[0])
# for i in range(2,N):
#     dp[i] = min(dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i]))
# print(dp[N-1])

for i in range(N):
    for j in range(K+1):
        dp[i+j] = min(dp[i+j],dp[i]+abs(H[i]-H[i+j])) # 配るdp,Hの配列外参照が微妙
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
ls = len(s)
lt = len(t)

dp = [[0]*(lt+1) for _ in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
# #print(dp[ls][lt])
# for i in range(ls+1):
#     print(dp[i])

ans = ''
i = ls
j = lt
while (i>0 and j>0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1
print(ans)

Fixed submission:
s = input()
t = input()
ls = len(s)
lt = len(t)

dp = [[0]*(lt+1) for _ in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
# #print(dp[ls][lt])
# for i in range(ls+1):
#     print(dp[i])

ans = ''
i = ls
j = lt
while (i>0 and j>0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
a = [0]*110
a[1:] = list(map(int,input().split()))
MOD = 10**9+7
dp = [[0]*110000 for _ in range(110)]
dp_sum = [[0]*110000 for _ in range(110)]
dp[0][0] = 1
for i in range(K+1):
    dp_sum[0][i] = 1

for i in range(1,N+1):
    for j in range(K+1):
        dp[i][j] = dp_sum[i-1][j]
        if j - a[i]-1 >= 0:
            dp[i][j] -= dp_sum[i-1][j-a[i]-1]

        if j-1 >= 0:
            dp_sum[i][j] = dp_sum[i][j-1] + dp[i][j]
        else:
            dp_sum[i][j] = dp[i][j]
        dp[i][j] %= MOD
        dp_sum[i][j] %= MOD
print(dp[N][K])
# for i in range(N+1):
#     print(dp[i])

Fixed submission:
N,K = map(int,input().split())
a = [0]*110
a[1:] = list(map(int,input().split()))
MOD = 10**9+7
dp = [[0]*110000 for _ in range(110)]
dp_sum = [[0]*110000 for _ in range(110)]
dp[0][0] = 1
for i in range(K+1):
    dp_sum[0][i] = 1

for i in range(1,N+1):
    for j in range(K+1):
        dp[i][j] = dp_sum[i-1][j]
        if j - a[i]-1 >= 0:
            dp[i][j] -= dp_sum[i-1][j-a[i]-1]

        if j-1 >= 0:
            dp_sum[i][j] = dp_sum[i][j-1] + dp[i][j]
        else:
            dp_sum[i][j] = dp[i][j]
        dp[i][j] %= MOD
        dp_sum[i][j] %= MOD
print(dp[N][K])
# for i in range(N+1):
#     print(dp[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(int(input()) for _ in range(N)))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

Fixed submission:
N = int(input())
a = list(int(input()) for _ in range(N))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

Fixed submission:
N = int(input())
a = list(int(input()) for _ in range(N))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
cities = [[] for _ in range(N)]
order_p = []
order_y = []
for _ in range(M):
    p,y = map(int,input().split())
    cities[p-1].append(y)
    order_p.append(p)
    order_y.append(y)
#print(cities)
for pref in range(N):
    cities[pref].sort()
#print(cities)
for key_pref, key_year in zip(order_p,order_y):
    print(str(key_pref).zfill(6)+str((cities[key_pref-1].index(key_year))+1).zfill(6))




Fixed submission:
N,M=map(int, input().split())
py=[list(map(int, input().split())) for _ in range(M)]
cnt=[0]*(N+1)
ids={}
for p,y in sorted(py, key=lambda x: x[1]):
	cnt[p] += 1
	ids[y] = "%06d%06d" % (p, cnt[p])
for _,y in py:
	print(ids[y])
Buggy python submission (verdict: Runtime Error):
N = int(input())
k = 1
n = 0
while n < N:
    n += k
    k += 1
if n!=N:
    print('No')
    exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k-1):
    for j in range(i+1,k):
        ans[i].append(v)
        ans[j].append(v)
        v += 1
for row in ans:
    print(len(row),*row)


Fixed submission:
a = input()
if len(a) == 2:
  print(a)
else:
  print(a[::-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
k = 1
n = 0
while n < N:
    n += k
    k += 1
if n!=N:
    print('No')
    exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k-1):
    for j in range(i+1,k):
        ans[i].append(v)
        ans[j].append(v)
        v += 1
for row in ans:
    print(len(row)+ *row))


Fixed submission:
N = int(input())
k = 1
n = 0
while n < N:
    n += k
    k += 1
if n!=N:
    print('No')
    exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k-1):
    for j in range(i+1,k):
        ans[i].append(v)
        ans[j].append(v)
        v += 1
for row in ans:
    print(len(row),*row)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
#semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
#semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
else:
    semimostl1 = l1.most_common()[1]
    semimostl2 = l2.most_common()[1]
    print(min(n - mostl1[1] - semimostl2[1], n - semimostl1[1] - mostl2[1]))
    
    
#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))

Fixed submission:
n = int(input())
l = list(map(int,input().split()))

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
#semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
#semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
elif len(l1.keys()) == 1 and len(l2.keys()) == 1:
    print(int(n/2))

else:
    semimostl1 = l1.most_common()[1]
    semimostl2 = l2.most_common()[1]
    print(min(n - mostl1[1] - semimostl2[1], n - semimostl1[1] - mostl2[1]))


#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))

Fixed submission:
n = int(input())
l = list(map(int,input().split()))

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
#semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
#semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
elif len(l1.keys()) == 1 and len(l2.keys()) == 1:
    print(int(n/2))

else:
    semimostl1 = l1.most_common()[1]
    semimostl2 = l2.most_common()[1]
    print(min(n - mostl1[1] - semimostl2[1], n - semimostl1[1] - mostl2[1]))


#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    while b!=0:
        a,b = b,b%a
    return a
def lcm(a,b):
    return (a*b)//gcd(a,b)

N,X = map(int,input().split())
x = list(map(int,input().split()))
x = list(map(lambda q:abs(q-X),x))
ans = 1
for xx in x:
    ans = gcd(ans,xx)
print(ans)

Fixed submission:
a,b = map(int,input().split())
if (a*b)%2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools
N, M = map(int, input().split())
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

x = np.array(x)
y = np.array(y)
z = np.array(z)

ans = 0
vals = []
for op1,op2,op3 in itertools.product([-1,1],repeat=3):
    #print(op1,op2,op3)
    s = x*op1 + y*op2 + z*op3
    #print(s)
    s.sort()
    vals.append(s[-M:].sum())


print(max(vals))

Fixed submission:
import numpy as np
import itertools
N, M = map(int, input().split())
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

x = np.array(x)
y = np.array(y)
z = np.array(z)

ans = 0
vals = []
for op1,op2,op3 in itertools.product([-1,1],repeat=3):
    #print(op1,op2,op3)
    s = x*op1 + y*op2 + z*op3
    #print(s)
    s.sort()
    vals.append(s[N-M:].sum())


print(max(vals))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
d = max(a,b,c)
s = sum(a,b,c)
if (3*d-s)%2 == 0:
    print(d)
else:print(d+1)

Fixed submission:
n = list(map(int,input().split()))
d = max(n)
s = sum(n)
if (3*d-s)%2 == 0:
    print(int((3*d-s)/2))
else:print(int((3*(d+1)-s)/2))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
from collections import deque
H, W = map(int,input().split())
grid = [list(input()) for _ in range(H)]
w_cnt = 0
for i in range(H):
    w_cnt += grid[i].count('.')


inf = float('inf')
d = [[inf]*W for _ in range(H)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]


d[0][0] = 0
que = deque()
que.append([0,0])
while len(que) != 0:
    p = que.popleft()
    if p[0] == H-1 and p[1] == W-1:break
    for i in range(4):
        nx = p[0] + dx[i]
        ny = p[1] + dy[i]
        if 0 <= nx <= W-1 and 0 <= ny <= H-1:
            #print(nx,ny)
            if grid[nx][ny] != '#' and d[nx][ny] == inf:
                que.append([nx,ny])
                d[nx][ny] = d[p[0]][p[1]] + 1

# print(d)
# print(d[H-1][W-1])
if d[H-1][W-1] == inf:
    print(-1)
else:
    print(w_cnt-d[H-1][W-1]-1)


Fixed submission:
from collections import deque
H, W = map(int,input().split())
grid = [list(input()) for _ in range(H)]
w_cnt = 0
for i in range(H):
    w_cnt += grid[i].count('.')


inf = float('inf')
d = [[inf]*W for _ in range(H)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]


d[0][0] = 0
que = deque()
que.append([0,0])
while len(que) != 0:
    p = que.popleft()
    if p[0] == W-1 and p[1] == H-1:break
    for i in range(4):
        nx = p[0] + dx[i]
        ny = p[1] + dy[i]
        #print(nx,ny)
        if 0 <= nx <= W-1 and 0 <= ny <= H-1 and grid[ny][nx] == '.' and d[ny][nx] == inf:
            que.append([nx,ny])
            d[ny][nx] = d[p[1]][p[0]] + 1

# print(d)
# print(d[H-1][W-1])
if d[H-1][W-1] == inf:
    print(-1)
else:
    print(w_cnt-d[H-1][W-1]-1)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in A:
    for b in B:
        for c in C:
            if 500*(a+1)+100*(b+1)+50*(c+1) == X:
                ans += 1
print(ans)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*(a)+100*(b)+50*(c) == X:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
/home/hiroya/.pyenv/versions/anaconda3-5.3.1/bin/python /home/hiroya/06_coding/aa.py
2
5 1 1
100 1 1No

Process finished with exit code 0


Fixed submission:
N = int(input())
prevt,prevx,prevy = 0,0,0
for i in range(N):
    t, x, y = map(int,input().split())
    dt,dx,dy = t-prevt,x-prevx,y-prevy
    if dt < dx+dy or (dt-dx-dy)%2 != 0:
        print('No')
        exit()
    prevt,prevx,prevy = t,x,y
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
from collections import Counter
a = list(map(int,input().split()))
c = Counter(a)
ks = 0
if len(c.keys()) <= K:print(0)
else:
    for i in range(K):

        ks += c.most_common()[i][1]
    print(N-ks)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int, input().split()))
from collections import Counter

values = Counter(A).values()
length = len(values)
values = sorted(values)
ANS = 0

for i in range(length - K):
  ANS += values[i]
print(ANS)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
from collections import Counter
a = list(map(int,input().split()))
c = Counter(a)
ks = 0
if len(c.keys()) <= K:print(0)
else:
    for i in range(K):

        ks += c.most_common()[i][1]
    print(N-ks)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int, input().split()))
from collections import Counter

values = Counter(A).values()
length = len(values)
values = sorted(values)
ANS = 0

for i in range(length - K):
  ANS += values[i]
print(ANS)
Buggy python submission (verdict: Runtime Error):
# bit全探索
N = int(input())
F = [list(map(int,input().split())) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
ans = -float('inf')
for i in range(2**10):
    if i == 0: # 全く営業しないパターン
        continue
    profit = 0
    pattern = [0]*10
    for j in range(10):
        if 1 << j & i:
            pattern[j] = 1
    #print(pattern)

    for k in range(N):
        l = sum([pattern[m] == F[k][m] == 1 for m in range(10)])
        # l = 0
        # for m in range(10):
        #     if pattern[m] == F[k][m] == 1:
        #         l += 1

        #print(l)
        profit += P[k][l]
    ans = max(ans,profit)
print(ans)





Fixed submission:
n,a,b = map(int,input().split())
print(min(n*a,b))
Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
temp = S[0]
for s in S:
    if s == temp:
        cnt += 1
    else:
        cnt = 0
        temp = s
    if s >= 3:
        print("Yes")
        exit()
print("No")
        

Fixed submission:
S = input()
cnt = 0
temp = S[0]
for s in S[1:]:
    if s == temp:
        cnt += 1
    else:
        cnt = 0
        temp = s
    if cnt >= 2:
        print("Yes")
        exit()
print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
memo = [0]*N
memo[0] = 2
memo[1] = 1
for n in range(2,N):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[-1])

Fixed submission:
N = int(input())
memo = [0]*(N+1)
memo[0] = 2
memo[1] = 1
for n in range(2,N+1):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
memo = [0]*N
memo[0] = 2
memo[1] = 1
for n in range(2,N):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[N])

Fixed submission:
N = int(input())
memo = [0]*(N+1)
memo[0] = 2
memo[1] = 1
for n in range(2,N+1):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for n in range(1,3501):
    for w in range(1,3501):
        if 4*n*w-N*(n+w) != 0:
            h = (N*n*w)/(4*n*w-N*(n+w))

            if h > 0 and h.is_integer():
                print(int(h), n, w)
                exit()



Fixed submission:
N = int(input())
for n in range(1,3501):
    for w in range(1,3501):
        if 4*n*w-N*(n+w) != 0:
            h = (N*n*w)/(4*n*w-N*(n+w))

            if h > 0 and h.is_integer():
                print(int(h), n, w)
                exit()
Buggy python submission (verdict: Runtime Error):
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += N//K
r = N%K
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)


Fixed submission:
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += K//N
r = K%N
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)

Buggy python submission (verdict: Runtime Error):
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += N//K
r = N%K
for _ in range(r):
    head = num.pop(0)
    for i in range(N-1):
        num[i] += 1
    num.append(head+N)
print(N)
print(*num)


Fixed submission:
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += K//N
r = K%N
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a:
    #print(i)
    b.append(i)
    b = b[::-1]
    #print(b)
print(*b)

Fixed submission:
from collections import deque

n = int(input())
a = list(map(int,input().split()))
b_deque = deque()

for i in range(len(a)):
    if (n-i)%2 == 1:
        b_deque.appendleft(a[i])
    else:
        b_deque.append(a[i])
print(*b_deque)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)

def my_factorial(n):
    if n == 0:
        return 1

    else:
        return n * my_factorial(n-1)

N,M = map(int,input().split())
if abs(N-M) >= 2:
    print(0)
elif abs(N-M) == 1:
    print(my_factorial(N) * my_factorial(M))
else:
    print(2*my_factorial(N)*my_factorial(M))

Fixed submission:
import math
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>1:
    print(0)
elif abs(n-m)==1:
    print(math.factorial(n)*math.factorial(m)%mod)
else:
    print(2*math.factorial(n)*math.factorial(m)%mod)

Buggy python submission (verdict: Runtime Error):
/home/hiroya/.pyenv/versions/anaconda3-5.3.1/bin/python /home/hiroya/06_coding/aaa.py
4 4
1152

Process finished with exit code 0


Fixed submission:
import math
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>1:
    print(0)
elif abs(n-m)==1:
    print(math.factorial(n)*math.factorial(m)%mod)
else:
    print(2*math.factorial(n)*math.factorial(m)%mod)
Buggy python submission (verdict: Runtime Error):
N = int(input())
color = [0]*8
free = 0
for _ in range(N):
    a  = int(input())
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color += 1
    elif 800<=a<=1199:
        color += 1
    elif 1200<=a<=1599:
        color += 1
    elif 1600<=a<=1999:
        color += 1
    elif 2000<=a<=2399:
        color += 1
    elif 2400<=a<=2799:
        color += 1
    elif 2800<=a<=3199:
        color += 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = sum(color)
print(mincolor,maxcolor)

Fixed submission:
N = int(input())
color = [0]*8
free = 0
A = list(map(int,input().split()))
for a in A:
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color[1] = 1
    elif 800<=a<=1199:
        color[2] = 1
    elif 1200<=a<=1599:
        color[3] = 1
    elif 1600<=a<=1999:
        color[4] = 1
    elif 2000<=a<=2399:
        color[5] = 1
    elif 2400<=a<=2799:
        color[6] = 1
    elif 2800<=a<=3199:
        color[7] = 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = max(sum(color),1)
print(mincolor,maxcolor)

Buggy python submission (verdict: Runtime Error):
N = int(input())
color = [0]*8
free = 0
for _ in range(N):
    a  = int(input())
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color += 1
    elif 800<=a<=1199:
        color += 1
    elif 1200<=a<=1599:
        color += 1
    elif 1600<=a<=1999:
        color += 1
    elif 2000<=a<=2399:
        color += 1
    elif 2400<=a<=2799:
        color += 1
    elif 2800<=a<=3199:
        color += 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = sum(color)
print(mincolor,maxcolorx)

Fixed submission:
N = int(input())
color = [0]*8
free = 0
A = list(map(int,input().split()))
for a in A:
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color[1] = 1
    elif 800<=a<=1199:
        color[2] = 1
    elif 1200<=a<=1599:
        color[3] = 1
    elif 1600<=a<=1999:
        color[4] = 1
    elif 2000<=a<=2399:
        color[5] = 1
    elif 2400<=a<=2799:
        color[6] = 1
    elif 2800<=a<=3199:
        color[7] = 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = max(sum(color),1)
print(mincolor,maxcolor)
Buggy python submission (verdict: Runtime Error):
import math
N,A,B = map(int,input().split())
H = [int(input()) for _ in range(N)]


def enough(T):
    temp = 0
    ch = H[:]
    for h in ch:
        left = h - B*T
        if left > 0:
            temp += (left + A-B-1)//(A-B)
            #temp += math.ceil(left/(A-B))
            #print(temp)

    if temp > T:
        return False
    else:
        return True

#print(enough(2))
ok = 10**15
ng = 0

while ok - ng > 1:
    mid = (ok + ng)//2
    if enough(mid):
        ok = mid
    else:
        ng = mid
    #print(ok,ng)
print(ok)

Fixed submission:
a,b = map(int,input().split())
if a+b >= 10:print("error")
else:print(a+b)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
l = list(input())
c = Counter(l)
if max(c) >= 2:
    print('yes')
else:
    print('no')

Fixed submission:
from collections import Counter
l = list(input())
c = Counter(l)
if max(c.values()) >= 2:
    print('no')
else:
    print('yes')