Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03273 (python)

Fixed submission:
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    temp = list(input())
    if "#" in temp:
        grid.append(temp)
    else:
        h -= 1
i = 0
while i < len(grid[0]):
    for j in range(h):
        if grid[j][i] == "#":
            i += 1
            break
        if j == h - 1:
            for k in range(h):
                del grid[k][i]
for i in range(h):
    print("".join(grid[i]))

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    temp = list(input())
    if "#" in temp:
        grid.append(temp)
    else:
        h -= 1
i = 0
while i < len(grid[0]):
    for j in range(h):
        if grid[j][i] == "#":
            i += 1
            break
        if j == h - 1:
            for k in range(h):
                del grid[k][i]
for i in range(len(grid[0])):
    print("".join(grid[i]))

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    temp = list(input())
    if "#" in temp:
        grid.append(temp)
    else:
        h -= 1
i = 0
while i < len(grid[0]):
    for j in range(h):
        if grid[j][i] == "#":
            i += 1
            break
        if j == h - 1:
            for k in range(h):
                del grid[k][i]
for i in range(len(grid[0])):
    print("".join(grid[i]))
Problem p03305 (python)

Fixed submission:
import numpy as np
import sys
from heapq import heappush, heappop
input = sys.stdin.readline
def dijkstra(start, mode):
    INF = 10 ** 15
    dist = [INF] * (n+1)
    dist[start] = 0
    q = [(0,start)]
    while q:
        d,v = heappop(q)
        if dist[v] < d:
            continue
        for w,*a in graph[v]:
            d1 = d + a[mode]
            if dist[w] > d1:
                dist[w] = d1
                heappush(q, (d1,w))
    return dist

n,m,s,t = map(int, input().split())
graph = [[] for i in range(n+1)]
for i in range(m):
    u,v,a,b = map(int, input().split())
    graph[u].append([v,a,b])
    graph[v].append([u,a,b])
money = dijkstra(s,0)
snu = dijkstra(t,1)
start = 10**15
#何年目か？
ans = []
ans_max = 10**15
for j in range(n,-1,-1):
    ans_max = min(ans_max, (money[j] + snu[j]))
    ans.append(ans_max)
for i in range(n-1,-1,-1):
    print(int(start - ans[i]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,m,s,t = map(int, input().split())
money = np.zeros((n+1,n+1))
snu = np.zeros((n+1,n+1))
for i in range(m):
    u,v,a,b = map(int, input().split())
    money[u][v] = money[v][u] = a
    snu[u][v] = snu[v][u] = b
money = dijkstra(csr_matrix(money))
snu = dijkstra(csr_matrix(snu))
start = 10**15
#何年目か？
for i in range(n):
    ans = 0
    #i年目なので、iまででは両替出来ない。両替する場所を探す
    for j in range(i+1,n+1):
        ans = max(ans, start - (money[s][j] + snu[j][t]))
    print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
import sys
input = sys.stdin.readline
n,m,s,t = map(int, input().split())
money = np.zeros((n+1,n+1))
snu = np.zeros((n+1,n+1))
for i in range(m):
    u,v,a,b = map(int, input().split())
    money[u][v] = money[v][u] = a
    snu[u][v] = snu[v][u] = b
money = dijkstra(csr_matrix(money))
snu = dijkstra(csr_matrix(snu))
for i in range(n):
    ans = 0
    for j in range(i+1,n+1):
        ans = max(ans, (10**15) - (money[s][j] + snu[j][t]))
    print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
n,m,s,t = map(int, input().split())
money = np.zeros((n+1,n+1))
snu = np.zeros((n+1,n+1))
for i in range(m):
    u,v,a,b = map(int, input().split())
    money[u][v] = money[v][u] = a
    snu[u][v] = snu[v][u] = b
money = dijkstra(csr_matrix(money))
snu = dijkstra(csr_matrix(snu))
for i in range(n):
    ans = 0
    for j in range(i+1,n+1):
        ans = max(ans, (10**15) - (money[s][j] + snu[j][t]))
    print(int(ans))
Problem p03309 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n == 1:
    print(0)
    exit()
a.sort()
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total2)
    else:
        print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n % 2 == 0:
    ave = a[int(n/2)]
else:
    ave = int((a[int(n/2)] + a[int((n + 1)/2)]) / 2)
for i in range(n):
    total += abs(a[i] - ave)
print(total)
Problem p03504 (python)

Fixed submission:
n, c = map(int, input().split())
data = [[0 for i in range(c+1)] for j in range(10**5+2)]
for i in range(n):
    s, t, channel = map(int, input().split())
    data[s][channel] += 1
    data[t+1][channel] -= 1
for i in range(c+1):
    for j in range(1,10**5+2):
        data[j][i] += data[j-1][i]
ans = 0
for i in range(10**5+2):
    sum_channel = 0
    for j in range(c+1):
        if data[i][j] == 1:
            sum_channel += 1
    ans = max(ans, sum_channel)
print(ans)

Buggy submission (verdict: Runtime Error):
n, c = map(int, input().split())
data = [[0 for i in range(c+1)] for j in range(10**5+1)]
for i in range(n):
    s, t, channel = map(int, input().split())
    data[s][channel] += 1
    data[t+1][channel] -= 1
for i in range(c+1):
    for j in range(1,10**5+1):
        data[j][i] += data[j-1][i]
ans = 0
for i in range(10**5+1):
    sum_channel = 0
    for j in range(c+1):
        if data[i][j] == 1:
            sum_channel += 1
    ans = max(ans, sum_channel)
print(ans)

Buggy submission (verdict: Runtime Error):
n, c = map(int, input().split())
data = [0 for j in range(10**5+1)]
for i in range(n):
    s, t, channel = map(int, input().split())
    data[s] += 1
    data[t+1] -= 1
for i in range(10**5):
    data[i+1] += data[i]
print(max(data))
Problem p03544 (python)

Fixed submission:
n = int(input())
L = [0 for i in range(100)]
L[0] = 2
L[1] = 1
def Lucas(n):
    if L[n] != 0:
        return L[n]
    else:
        L[n - 1] = Lucas(n - 1)
        L[n - 2] = Lucas(n - 2)
        return L[n - 1] + L[n - 2]
print(Lucas(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
def Lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else
        return Lucas(n - 1) + Lucas(n - 2)
print(Lucas(n))
Problem p03546 (python)

Fixed submission:
from scipy.sparse.csgraph import floyd_warshall

#input
h, w = list(map(int, input().split()))

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

wall = []

for i in range(h):
    wall.append(list(map(int, input().split())))

#solve
#1へのコスト
costone = [(10**3) + 1 for i in range(11)]
#-1, 1はコストがかからないため０で初期化
costone[1] = 0
#-1の処理
costone[10] = 0
#ワーシャルフロイド法を使う
#iは出発、jは経由,
c = floyd_warshall(c)
##for i in range(10):
##    for j in range(10):
##        for k in range(10):
##            c[i][k] = min(c[i][k], c[i][j] + c[j][k])
#costoneを更新
for i in range(10):
    costone[i] = min(costone[i], c[i][1])
sum = 0


for i in range(h):
    for j in range(w):
        sum += costone[wall[i][j]]
print(int(sum))

Buggy submission (verdict: Runtime Error):
#input
h, w = list(map(int, input().split()))

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

wall = [0 for i in range(w)]

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

#solve
#1へのコスト
costone = [(10**3) + 1 for i in range(11)]
#-1, 1はコストがかからないため０で初期化
costone[1] = 0
#-1の処理
costone[10] = 0
#ワーシャルフロイド法を使う
#iは出発、jは経由,
for i in range(10):
    for j in range(10):
        for k in range(10):
            c[i][k] = min(c[i][k], c[i][j] + c[j][k])
#costoneを更新
for i in range(10):
    costone[i] = min(costone[i], c[i][1])
sum = 0
for i in range(h):
    for j in range(w):
        sum += costone[wall[i][j]]
print(sum)

Buggy submission (verdict: Runtime Error):
#input
h, w = list(map(int, input().split()))

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

wall = [0 for i in range(w)]

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

#solve
#0へのコスト
costone = [((10**4) + 1) for i in range(11)]
#-1, 1はコストがかからないため０で初期化
costone[1] = 0
costone[10] = 0
#ワーシャルフロイド法を使う
#iは出発、jは経由,
for i in range(10):
    for j in range(10):
        for k in range(10):
            c[i][k] = min(c[i][k], c[i][j] + c[j][k])
#costoneを更新
for i in range(10):
    costone[i] = min(costone[i], c[i][1])
sum = 0
for i in range(h):
    for j in range(w):
        sum += costone[wall[i][j]]
print(sum)

Buggy submission (verdict: Runtime Error):
#input
h, w = list(map(int, input().split()))

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

wall = [0 for i in range(w)]

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

#solve
#0へのコスト
costone = [((10**3) + 1) for i in range(11)]
#-1, 1はコストがかからないため０で初期化
costone[1] = 0
costone[10] = 0
#ワーシャルフロイド法を使う
#iは出発、jは経由,
for i in range(10):
    for j in range(10):
        for k in range(10):
            c[i][k] = min(c[i][k], c[i][j] + c[j][k])
#costoneを更新
for i in range(10):
    costone[i] = min(costone[i], c[i][1])
sum = 0
for i in range(h):
    for j in range(w):
        sum += costone[wall[i][j]]
print(sum)
Problem p03590 (python)

Fixed submission:
import copy
import sys
input = sys.stdin.readline
n,k = map(int, input().split())
data = []
bit_k = format(k, 'b')
len_k = len(bit_k)
for i in range(n):
    a, b = map(int, input().split())
    if a <= k:
        tmp = format(a, 'b')
        tmp = tmp.zfill(len_k)
        data.append([tmp,b])
def check_value(bit):
    res = 0
    for i in range(len(data)):
        flag = True
        dd = data[i][0]
        for j in range(len_k):
            if bit[j] == '0' and dd[j] == '1':
                flag = False
                break
        if flag:
            #print("tmp:{} bit{}".format(tmp, bit))
            res += data[i][1]
    return res
ans = check_value(bit_k)
tmp = []
for i in range(len_k):
    p = []
    if bit_k[i] == '1':
        p = tmp + ['0'] + ['1']*(len_k-1-i)
    else:
        tmp += bit_k[i]
        continue
    p = "".join(p)
    ans = max(ans, check_value(p))
    tmp += bit_k[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
import sys
input = sys.stdin.readline
n,k = map(int, input().split())
data = []
bit_k = format(k, 'b')
len_k = len(bit_k)
for i in range(n):
    a, b = map(int, input().split())
    if a <= k:
        tmp = format(a, 'b')
        tmp = tmp.zfill(len_k)
        data.append([tmp,b])
def check_value(bit):
    res = 0
    for i in range(len(data)):
        flag = True
        dd = data[i][0]
        for j in range(len_k):
            if bit[j] == '0' and dd[j] == '1':
                flag = False
                break
        if flag:
            #print("tmp:{} bit{}".format(tmp, bit))
            res += data[i][1]
    return res
ans = 0
tmp = []
for i in range(len_k):
    p = []
    if bit_k[i] == '1':
        p = tmp + ['0'] + ['1']*(len_k-1-i)
    else:
        continue
    p = "".join(p)
    ans = max(ans, check_value(p))
    tmp += bit_k[i]
print(ans)
Problem p03612 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if i == n - 1 and i + 1 == p[i]:
        count += 1
    elif i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if i == n - 1 and i + 1 == p[i]:
        count += 1
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)
Problem p03638 (python)

Fixed submission:
h, w = list(map(int, input().split()))
n = int(input())
ans = [[0 for i in range(w)] for j in range(h)]
dec = 1
p = 1
cnt = 0
index = 0
a = list(map(int, input().split()))
for i in range(h):
    while 0 <= index < w:
        if cnt == a[p-1]:
            p += 1
            cnt = 0
        ans[i][index] = p
        cnt += 1
        index += dec
    dec *= (-1)
    index += dec
for i in range(h):
    for j in range(w):
        print("{} ".format(ans[i][j]), end = '')
    print()

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
n = int(input())
ans = [[0 for i in range(w)] for j in range(w)]
dec = 1
p = 1
cnt = 0
index = 0
a = list(map(int, input().split()))
for i in range(h):
    while 0 <= index < w:
        if cnt == a[p-1]:
            p += 1
            cnt = 0
        ans[i][index] = p
        cnt += 1
        index += dec
    dec *= (-1)
    index += dec
for i in range(h):
    for j in range(w):
        print("{} ".format(ans[i][j]), end = '')
    print()
Problem p03781 (python)

Fixed submission:
x = int(input())
total = 0
for i in range(1,x+1):
    total += i
    if total >= x:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
import itertools
import bisect
x = int(input())
acc = list(itertools.accumulate(list(range(1, x+1))))
index = bisect.bisect_left(acc, x)
#print(acc)
if acc[index] == x:
    print(index+1)
else:
    print(index+1)
Problem p03911 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,m = map(int, input().split())
adjacent_list = [[] for i in range(n+1+m+1)]
for i in range(1,n+1):
    for j in list(map(int, input().split()))[1:]:
        adjacent_list[i].append(j+n)
        adjacent_list[j+n].append(i)
finished = set()
def dfs(node):
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)
dfs(1)
flag = True
for i in range(1,n+1):
    if i not in finished:
        flag = False
if flag:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
adjacent_list = [[] for i in range(n+1+m+1)]
for i in range(1,n+1):
    for j in list(map(int, input().split()))[1:]:
        adjacent_list[i].append(j)
        adjacent_list[i].append(j)
finished = set()
def dfs(node):
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)
dfs(1)
flag = True
for i in range(1,n+1):
    if i not in finished:
        flag = False
if flag:
    print("YES")
else:
    print("NO")
Problem p03994 (python)

Fixed submission:
s = list(input())
k = int(input())
z_asc = ord('z')
for i in range(len(s)):
    tmp = ord(s[i])
    if 1 + z_asc - tmp <= k and s[i] != 'a':
        k -= 1 + z_asc - tmp
        s[i] = 'a'
if k % 26 != 0:
    s[-1] = chr(ord(s[-1]) + k%26)
ans = "".join(s)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
z_asc = ord('z')
for i in range(len(s)):
    tmp = ord(s[i])
    if 1 + z_asc - tmp <= k and s[i] != 'a':
        k -= 1 + z_asc - tmp
        s[i] = 'a'
if k % 26 != 0:
    s[-1] = chr(ord(s[-1]) + k)
ans = "".join(s)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
z_asc = ord('z')
for i in range(len(s)):
    tmp = ord(s[i])
    if 1 + z_asc - tmp <= k and s[i] != 'a':
        k -= 1 + z_asc - tmp
        s[i] = 'a'
if k % 26 != 0:
    s[-1] = chr(ord(s[-1]) + k)
print("".join(s))
Problem p04019 (python)

Fixed submission:
s = input()
s = set(list(s))
if ("N" in s) != ("S" in s):
    print("No")
    exit()
if ("E" in s) != ("W" in s):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
s = set(list(s))
if s in "N" != s in "S":
    print("No")
    exit()
if s in "W" != s in "E":
    print("No")
    exit()
print("Yes")
Problem p02554 (python)

Fixed submission:
mod =10**9 + 7
N=int(input())
a=10**N
b=9**N
c=8**N
print((a-(2*b)+c)%mod)

Buggy submission (verdict: Runtime Error):
mod =10**9 + 7
N=int(input())
a=10**N
b=a*((8/10)**N)
print(int(a-b)/mod)
Problem p02613 (python)

Fixed submission:
n = int(input())
ans_ac = 0
ans_wa = 0
ans_tle = 0
ans_re = 0

for i in range(n):
    s = input()
    if s == 'AC':
        ans_ac += 1
    elif s == 'WA':
        ans_wa += 1
    elif s == 'TLE':
        ans_tle += 1
    else:
        ans_re += 1
        
print('AC x '+str(ans_ac))
print('WA x '+str(ans_wa))
print('TLE x '+str(ans_tle))
print('RE x '+str(ans_re))

Buggy submission (verdict: Runtime Error):
a,b,c,d=0,0,0,0
N=int(input())
S=[input() for _ in range(N)]
for i in range(N):
    if S[i]=='AC':
        a=a+1
    elif S[i]=='WA':
        b=b+1
    elif S[i]=='TLE':
        c=c+1
    elif S[i]=='RE':
        d=d+1
print('AC x　'+str(a))        
print('WA ×　'+str(b))    
print('TLE ×　'+str(c))       
print('RE ×　'+str((d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=0
N=int(input())
S=[input() for _ in range(N)]
for i in range(N):
    if S[i]=='AC':
        a=a+1
    elif S[i]=='WA':
        b=b+1
    elif S[i]=='TLE':
        c=c+1
    elif S[i]=='RE':
        d=d+1
print('AC ×　{}'.format(a))        
print('WA ×　{}'.format(b))       
print('TLE ×　{}'.format(c))       
print('RE ×　{}'.format(d))
Problem p02639 (python)

Fixed submission:
X=list(map(int,input().split()))
for i in range(0,5):
    if X[i]==0:
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
X=map(int,input().split())
for i in range(1,6):
    if X[i]==0:
        print(i)
        exit()
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
s=1
if 0 in A:
    print(0)
    exit()
for i in range(N):
    s*=A[i]
    if s>10**18:
        print(-1)
        exit()
print(s)

Buggy submission (verdict: Runtime Error):
101 9901 999999000001
Problem p02760 (python)

Fixed submission:
B=[]
for i in range(3):
    A=list(map(int,input().split()))
    B.append(A[0])
    B.append(A[1])
    B.append(A[2])
N=int(input())
for j in range(N):
    b=int(input())
    if b in B:
        B[B.index(b)]=0
if B[0]==0 and B[1]==0 and B[2]==0:
    print('Yes')
elif B[3]==0 and B[4]==0 and B[5]==0:
    print('Yes')
elif B[6]==0 and B[7]==0 and B[8]==0:
    print('Yes')
elif B[0]==0 and B[3]==0 and B[6]==0:
    print('Yes')
elif B[1]==0 and B[4]==0 and B[7]==0:
    print('Yes')
elif B[2]==0 and B[5]==0 and B[8]==0:
    print('Yes')
elif B[0]==0 and B[4]==0 and B[8]==0:
    print('Yes')
elif B[2]==0 and B[4]==0 and B[6]==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
B=[]
for i in range(3):
    A=list(map(int,input().split()))
    B.append(A[0])
    B.append(A[1])
    B.append(A[2])
N=int(input())
for j in range(N):
    b=int(input())
    if b in B:
        B[B.index(b)]=0
if B[0],B[1],B[2]==0,0,0:
    print('Yes')
elif B[3],B[4],B[5]==0,0,0:
    print('Yes')
elif B[6],B[7],B[8]==0,0,0:
    print('Yes')
elif B[0],B[3],B[6]==0,0,0:
    print('Yes')
elif B[1],B[4],B[7]==0,0,0:
    print('Yes')
elif B[2],B[5],B[8]==0,0,0:
    print('Yes')
elif B[0],B[4],B[8]==0,0,0:
    print('Yes')
elif B[2],B[4],B[6]==0,0,0:
    print('Yes')
else:
    print('No')
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
n=['0']*N
a=0
for i in range(M):
    s,c=map(str,input().split())
    if n[int(s)-1]!='0' and n[int(s)-1]!=c:
        a=1
    if s=='1' and c=='0' and N!=1:
        a=1
    n[int(s)-1]=c
if n[0]=='0' and N!=1:
    n[0]='1'
if a==0:
    print(''.join(n))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
n=['0']*N
for i in range(M):
    s,c=map(str,input().split())
    S.append(s)
    if n[int(s)-1]!='0' and n[int(s)-1]!=c:
        print(-1)
        exit()
    if s=='1' and c=='0':
        print(-1)
        exit()
    n[int(s)-1]=c
if n[0]=='0':
    n[0]='1'
print(''.join(n))
Problem p02778 (python)

Fixed submission:
S=input()
a=[]
for i in range(len(S)):
    a.append('x')
print(''.join(a))

Buggy submission (verdict: Runtime Error):
S=input()
for i in range(len(S)):
    S[i]='×'
print(S)
Problem p02945 (python)

Fixed submission:
A,B=map(int,input().split())
l=[A+B,A-B,A*B]
print(max(l))

Buggy submission (verdict: Runtime Error):
A,B=map(int(input().split()))
l=[A+B,A-B,A*B]
print(max(l))
Problem p02999 (python)

Fixed submission:
X,A=map(int,input().split())
if X<A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
X,A=map(int(input().split()))
if X<A:
    print(0)
else:
    print(10)
Problem p03076 (python)

Fixed submission:
S = [int(input()) for _ in range(5)]
l=[]
m=10
for i in range(5):
    if (S[i]%10)<m and S[i]%10!=0:
        m=S[i]%10
        a=S[i]
        j=i
if m==10:
    a=S[0]  
    j=0      
for i in range(5):
    if  i!=j:
        if S[i]%10!=0:
            S[i]+=10-(S[i]%10)
        l.append(S[i])
l.append(a)
print(sum(l))

Buggy submission (verdict: Runtime Error):
S = [int(input()) for _ in range(5)]
l=[]
m=10
for i in range(5):
    if (S[i]%10)<m and S[i]%10!=0:
        m=S[i]%10
        a=S[i]
        j=i
if m==10:
    a=S[0]        
for i in range(5):
    if  i!=j:
        if S[i]%10!=0:
            S[i]+=10-(S[i]%10)
        l.append(S[i])
l.append(a)
print(sum(l))

Buggy submission (verdict: Runtime Error):
S = [int(input()) for _ in range(5)]
l=[]
m=10
for i in range(5):
    if (S[i]%10)<m and S[i]%10!=0:
        m=S[i]%10
        a=S[i]
        j=i
for i in range(5):
    if  i!=j:
        if S[i]%10!=0:
            S[i]+=10-(S[i]%10)
        l.append(S[i])
l.append(a)
print(sum(l))

Buggy submission (verdict: Runtime Error):
S = [int(input()) for _ in range(5)]
l=[]
m=10
for i in range(5):
    if (S[i]%10)<m and S[i]%10!=0:
        m=S[i]%10
        a=S[i]
        j=i
for i in range(5):
    if  i!=j:
        if S[i]%10!=0:
            S[i]+=10-(S[i]%10)
        l.append(S[i])
l.append(a)
print(sum(l))
Problem p03106 (python)

Fixed submission:
A,B,K=map(int,input().split())
l=[]
for i in range(1,101):
    if A%i==0 and B%i==0:
        l.append(i)
print(l[-K])

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
l=[]
for i in range(101):
    if A%i==0 and B%i==0:
        l.append(i)
print(l[i-1])
Problem p03109 (python)

Fixed submission:
S=input()
l=S.split('/')
if int(l[0])<=2019:
    if int(l[1])<=4:
        if int(l[2])<=30:
            print('Heisei')
            exit()
    print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
l=S.split('/')
if l[0]<=2019:
    if l[1]<=4:
        if l[2]<=30:
            print('Heisei')
            exit()
    print('TBD')