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

Fixed submission:
N, M = map(int, input().split())  # N個のコマ, M個の訪れるべき座標

if N >= M:
    print(0)
else:
    A = sorted(list(map(int, input().split())))
    B = sorted(A[i]-A[i-1] for i in range(1, len(A)))
    print(sum(B[0:M-N]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())  # N個のコマ, M個の訪れるべき座標

if N >= M:
    print(0)
else:
    A = sorted(list(map(int, input().split())))
    B = sorted(A[i]-A[i-1] for i in range(1, len(A)))
    print(sum[B[:M-N]])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())  # N個のコマ, M個の訪れるべき座標

if N >= M:
    print(0)
else:
    A = sorted(list(map(int, input().split())))
    B = sorted(A[i]-A[i-1] for i in range(1, len(A)))
    print(sum[B[0:M-N]])
Problem p03286 (python)

Fixed submission:
N = int(input())
ans = ""
if N == 0:
    print(0)
    exit()
while N != 0:
    # 下の桁から求めていく
    r = N % 2
    if r < 0:
        r += 2
    N = (N-r) // (-2)
    ans += str(r)
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
# -2進数を求める
N = int(input())

if N == 0:
    print(0)
else:
    ans = ""
    while N != 0:
        if N % 2 != 0:
            N -= 1
            ans = "1" + ans
        else:
            ans = "0" + ans
        N = N // (-2)
print(ans)
Problem p03315 (python)

Fixed submission:
S = input()
ans = 0
for i in range(4):
  if S[i] == "+":
    ans += 1
  else:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
print(ans)
for i in range(4):
  if S[i] == "+":
    ans += 1
  else:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
for i in range(4):
  if S[i] == "+":
    ans += 1
   else:
    ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
ans = 0
for i in range(len(S)):
  if S[i] == "+":
    ans += 1
   else:
    ans -= 1

print(ans)
Problem p03805 (python)

Fixed submission:
def dfs(visited, s):  #
    global ans
    visited[s] = True
    for t in graph[s]:
        if not visited[t]:
            dfs(visited[:], t)
    if all(visited):
        ans += 1


N, M = map(int, input().split())  # N頂点, M辺存在する

graph = [[] for _ in range(N)]
visited = [False] * N

for _ in range(M):  # M辺を受け取る
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)


ans = 0
dfs(visited, 0)

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools


N, M = map(int, input().split())
graph = [[False]*N for _ in range(M)]

for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a][b] = True
    graph[b][a] = True

ans = 0
for x in itertools.permutations(range(1, N)):
    # このxの順番で訪問できるか確かめる
    flag = True
    now = 0
    for e in x:
        if not graph[now][e]:
            flag = False
        now = e
    if flag:
        ans += 1
print(ans)
Problem p02779 (python)

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

if len(a) == len(set(a)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
aa = tuple(map(int, input().strip()))
if len(set(aa)) == n:
    print("YES")
else:
    print("NO")
Problem p02831 (python)

Fixed submission:
from fractions import gcd
#from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
#import math

a, b = map(int, input().split())
print(a * b // math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
print(a * b // math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
print(a * b // math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
print(a * b // math.gcd(a, b))
Problem p02880 (python)

Fixed submission:
n = int(input())
for i in range(1, 10):
    for j in range(1, 10):
        if i * j == n:
            print("Yes")
            exit(0)
print("No")

Buggy submission (verdict: Runtime Error):
n = int(input()):
for i in range(1, 10):
    for j in range(1, 10):
        if i * j == n:
            print("Yes")
            exit(0)
print("No")
Problem p03137 (python)

Fixed submission:
n, k = map(int, input().split())
pp = tuple(sorted(map(int, input().split())))

if n >= k:
    print(0)
    exit(0)

intv = []
for i in range(1, len(pp)):
    intv.append(pp[i] - pp[i - 1])
intv = sorted(intv)

ans = pp[-1] - pp[0]
for i in range(n - 1):
    ans -= intv[-i - 1]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
pp = tuple(sorted(map(int, input().split())))
intv = []
for i in range(1, len(pp)):
    intv.append(pp[i] - pp[i - 1])
intv = sorted(intv)

ans = pp[-1] - pp[0]
for i in range(n - 1):
    ans -= intv[-i - 1]
print(ans)
Problem p02578 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
import copy
b = copy.copy(a)
tall = a[0]
for i in range(n):
    if a[i]<tall:
        a[i] = tall
    elif a[i]>tall:
        tall = a[i]
print(sum(a)-sum(b))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import copy
b = copy.copy(a)
tall = a[0]
for i in range(n):
    if a[i]<tall:
        a[i] = tall
        cnt +=tall-a[i]
    elif a[i]>tall:
        tall = a[i]
print(sum(a)-sum(b))
Problem p02773 (python)

Fixed submission:
N = int(input())

d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Buggy submission (verdict: Runtime Error):
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Buggy submission (verdict: Runtime Error):
ss = sorted(list(set(s)))
lens = len(ss)
l = [0]*len(ss)
for i in range(lens):
    l[i] =s.count(ss[i])
for i in range(lens):
    if l[i] == max(l):
        print(ss[i])
Problem p03785 (python)

Fixed submission:
N, C, K = map(int, input().split())
T = list(int(input()) for i in range(N))
T.sort()
bus = 1
passenger = 0
limit = T[0] + K
for i in range(N):
    if T[i] <= limit and passenger < C:
        passenger += 1
    else:
        bus += 1
        limit = T[i]+K
        passenger = 1
print(bus)

Buggy submission (verdict: Runtime Error):
N, C, K = map(int, input().split())
T = list(int(input()) for i in range(N))
T.sort()
bus = 1
passenger = 0
limit = T[0] + K
for i in range(N):
    if T[i] <= limit and passenger < c:
        passenger += 1
    else:
        bus += 1
        limit = T[i]+K
        passenger = 1
print(bus)

Buggy submission (verdict: Runtime Error):
bus = 1
time = 0
for i in range(N):
    if T[i]-time > K:
        bus +=1
        time = T[i]
    else:
        time = time
print(bus)
Problem p02580 (python)

Fixed submission:
H, W, M = list(map(int, input().split()))

targets = set()
row = [0]*H
col = [0]*W

for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    row[h] += 1
    col[w] += 1
    targets.add((h, w))

r_max = max(row)
c_max = max(col)
ans = 0

maxed_h = set([h for h in range(H) if row[h] == r_max])
maxed_w = set([w for w in range(W) if col[w] == c_max])
bomb_option_sites_n = len(maxed_h)*len(maxed_w)
targets_on_bomb_option = 0
for th, tw in targets:
    if th in maxed_h and tw in maxed_w:
        targets_on_bomb_option += 1

if bomb_option_sites_n == targets_on_bomb_option:
    print(r_max + c_max - 1)
else:
    print(r_max + c_max)

Buggy submission (verdict: Runtime Error):
H, W, M = list(map(int, input().split()))
hrz = [0]*H
vrt = [0]*W
targets = set()
for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    targets.add((h, w))
    hrz[h] += 1
    vrt[w] += 1

hrz_max = max(hrz)
vrt_max = max(vrt)
for h in [i for i in range(H) if hrz[i] == hrz_max]:
    for w in [i for i in range(H) if vrt[i] == vrt_max]:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit()
print(hrz_max+vrt_max-1)

Buggy submission (verdict: Runtime Error):
H, W, M = list(map(int, input().split()))
hrz = [0]*H
vrt = [0]*W
targets = set()
target_x = set()
target_y = set()
for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    targets.add((h, w))
    hrz[h] += 1
    vrt[w] += 1
    target_x.add(w)
    target_y.add(h)

hrz_max = max(hrz)
vrt_max = max(vrt)
for h in [i for i in range(H) if hrz[i] == hrz_max]:
    for w in [i for i in range(H) if vrt[i] == vrt_max]:
        if not (h, w) in targets:
            print(hrz_max+vrt_max)
            exit()
print(hrz_max+vrt_max-1)

Buggy submission (verdict: Runtime Error):
H, W, M = list(map(int, input().split()))

targets = set()
row = [0]*H
col = [0]*W
bomb = [[0]*W for _ in range(H)]

for _ in range(M):
    h, w = list(map(lambda x: int(x) - 1, input().split()))
    row[h] += 1
    col[w] += 1
    bomb[h][w] = 1

r_max = max(row)
c_max = max(col)
ans = 0
# print([h for h in range(H) if row[h] == r_max])
# print([w for w in range(W) if col[w] == c_max])
for h in [h for h in range(H) if row[h] == r_max]:
    for w in [w for w in range(W) if col[w] == c_max]:
        # print(r_max + c_max - 1 if (h, w) in targets else 0)
        if bomb[h][w]:
            ans = max(ans, r_max + c_max - 1)
        else:
            ans = max(ans, r_max + c_max)
print(ans)
Problem p02879 (python)

Fixed submission:
A, B = list(map(int, input().split()))
if A > 9 or B > 9:
    print(-1)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
import bisect

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
if sum(A) <= K:
    print(0)
else:
    left = 0
    right = max([A[i]*F[i] for i in range(N)])
    while left + 1 != right:
        mid = int((left + right) / 2)
        train_n = sum([A[i]-mid//F[i] for i in range(N)])
        if train_n > K:
            left = mid
        else:
            right = mid
    print(right)
Problem p02912 (python)

Fixed submission:
import bisect

N, M = list(map(int, input().split()))
A = list(map(lambda x: int(x) * -1, input().split()))
A.sort()

cnt = 1
while cnt <= M:
    x = bisect.bisect(A, A[0]/2)
    for i in range(x):
        A[i] /= 2
        cnt += 1
        if cnt > M:
            break
    if x != 0 or x != len(A):
        A.sort()
print(sum(map(lambda x: int(-x), A)))

Buggy submission (verdict: Runtime Error):
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

cnt = 1
while cnt <= M:
    x = bisect.bisect_right(A, A[-1]/2)
    for i in range(x + 1):
        A[-i -1] /= 2
        cnt += 1
        if cnt > M:
            break
    A.sort()

print(sum(map(int, A)))

Buggy submission (verdict: Runtime Error):
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

cnt = 1
while cnt <= M:
    x = bisect.bisect_right(A, A[-1]/2)
    for i in range(x + 1):
        A[-i -1] /= 2
        cnt += 1
        if cnt > M:
            break

print(sum(map(int, A)))

Buggy submission (verdict: Runtime Error):
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

cnt = 1
while cnt <= M:
    x = bisect.bisect_right(A, A[-1]/2)
    for i in range(x + 1):
        A[-i -1] /= 2
        cnt += 1
        if cnt > M:
            break

print(sum(map(int, A)))

Buggy submission (verdict: Runtime Error):
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

cnt = 1
while cnt <= M:
    x = bisect.bisect(A, A[-1]/2)
    for i in range(x + 1):
        A[-i -1] /= 2
        cnt += 1
        if cnt > M:
            break

print(sum(map(int, A)))
Problem p02594 (python)

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy submission (verdict: Runtime Error):
k = int(input())

if k == 7:
    ans = 1
elif k % 2 == 0:
    ans = -1
else:
    for i in range(1, (len(str(k)) * 3) + 1):
        tgt = int("7" * i)
        if tgt % k == 0:
            ans = i
            break

print(ans)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = input()
c = [char for char in c]

ans = 0
for i in range(c.count("R")):
    if c[i] == "W":
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
c = [char for char in c]

def op1(l, id1, id2):
    temp = l[id1]
    l[id1] = l[id2]
    l[id2] = temp
    return l

r_idx, w_idx = [], []
for j in range(n):
    if c[j] == "R":
        r_idx.append(j)
    elif c[j] == "W":
        w_idx.append(j)

ans = 0
for i in range(min(len(r_idx), len(w_idx))): # i is number of op1
    c_i = c[:]
    c_i = op1(c_i, w_idx[j], r_idx[-j - 1])
    ans[i] += 1
if "W" in "".join(c_i).rstrip("W"):
    ans[i] += "".join(c_i).rstrip("W").count("W")
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
c = [char for char in c]

def op1(l, id1, id2):
    temp = l[id1]
    l[id1] = l[id2]
    l[id2] = temp
    return l

r_idx, w_idx = [], []
for j in range(n):
    if c[j] == "R":
        r_idx.append(j)
    elif c[j] == "W":
        w_idx.append(j)

ans = 0
else:
    for i in range(min(len(r_idx), len(w_idx))): # i is number of op1
        c_i = c[:]
        c_i = op1(c_i, w_idx[j], r_idx[-j - 1])
        ans[i] += 1
    if "W" in "".join(c_i).rstrip("W"):
        ans[i] += "".join(c_i).rstrip("W").count("W")
    print(min(ans))
Problem p02595 (python)

Fixed submission:
N, D = map(int, input().split())
ans = 0
for i in range(N):
  X, Y = map(int, input().split())
  if X**2 + Y**2 <= D**2:
    ans += 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
ans = 0
for in range(N):
  X, Y = map(int, input().split())
  if x**2 + y**2 <= D**2:
    ans += 1

print(ans)
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())

if W >= S:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)

l = [0] * 2019
for i in range(N):
    l[int(S[i:N])%2019] += 1

ans = l[0]

for i in range(1, 2019):
    ans += l[i] * (l[i]-1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
import collections

S = input()
N = len(S)
l = []
for i in range(N):
    l.append(int(''.join(S[i:N]))%2019)

c = collections.Counter(l)

values, counts = zip(*c.most_common())
counts = list(counts)

try:
    ans = counts.pop(list(values).index(0))
except:
    ans = 0

for i in range(len(counts)):
    if counts[i] != 1:
        ans += counts[i] * (counts[i]-1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
l = []
temp = 0
index = 0
for i in range(N):
    l.append(int(''.join(S[i:N])))

ans = 0
for i in range(N-1):
    for j in range(i,N):
        if (l[i] - l[j])/(10**(N-j)) % 2019 == 0 and l[i]-l[j] != 0:
            ans += 1

if ans == 0:
    print(0)
else:
    print(ans+1)
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))

c = Counter(S)
max_value = max(list(c.values()))
ans_list = sorted(list(c.items()))

for i in range(len(ans_list)):
  if ans_list[i][1] == max_value:
    print(ans_list[i][0])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
  
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
ans_list = []
  

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())

if A1 + A2 + A3 > 21:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
A = list(map(int, input().split()))
ans = 0

for v in itertools.combinations(A, 2):
    ans += v[0] ^ v[1]
    
print(ans % (10**9 + 7))
Problem p02847 (python)

Fixed submission:
l =  ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = str(input())

print(int(7 - l.index(S)))

Buggy submission (verdict: Runtime Error):
l =  ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = str(input())

print(int(7 - S.index()))l =  ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = str(input())

print(int(7 - l.index(S)))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = sum(B)

for i in range(N-1):
  if A[i] + 1 == A[i+1]:
    ans += C[A[i]-1]
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(N):
  ans += B[A[i]]
  if i > 0:
    if A[i-1]+1 == A[i]:
      ans += C[i-1]
      
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(N):
  ans += B[A[i]]
  if i > 0:
    if int(A[i-1]+1) == int(A[i]):
      ans += C[i-1]
      
print(ans)
Problem p03834 (python)

Fixed submission:
s = list(input())

for i in range(len(s)):
  if s[i] == ',':
    s[i] = ' '
 
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())

for i in range(len(s)):
  if s[i] == ',':
    s[i] == ' '

print(''.join())
Problem p02753 (python)

Fixed submission:
s = input()

if s == "AAA" or s == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()

if s == "AAA" or s == "BBB":
  print("No")
else
  print("Yes")
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if S[:N//2]==S[N//2:]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
if S[:N]==S[N:]:
  print("Yes")
else:
  print("No")
Problem p02685 (python)

Fixed submission:
fact = [1 for _ in range(200000)]
inv = [1 for _ in range(200000)]
fact_inv = [1 for _ in range(200000)]

mod = 998244353
for i in range(2, 200000):
    fact[i] = (fact[i-1]*i) % mod
    inv[i] = mod - (inv[mod % i] * (mod // i)) % mod
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod

N, M, K = map(int, input().split())
ans = 0
a = pow(M-1, N-1-K, mod)
for i in range(K, -1, -1):
    ans += (fact[N-1] * fact_inv[i] * fact_inv[N-1-i]) * M * a
    ans = ans % mod
    a *= M-1
    a = a % mod
print(ans)

Buggy submission (verdict: Runtime Error):
fact = [1 for _ in range(100000)]
inv = [1 for _ in range(100000)]
fact_inv = [1 for _ in range(100000)]

mod = 998244353
for i in range(2, 100000):
    fact[i] = (fact[i-1]*i) % mod
    inv[i] = mod - (inv[mod % i] * (mod // i)) % mod
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod

N, M, K = map(int, input().split())
ans = 0
a = pow(M-1, N-1-K, mod)
for i in range(K, -1, -1):
    ans += (fact[N-1] * fact_inv[i] * fact_inv[N-1-i]) * M * a
    ans = ans % mod
    a *= M-1
    a = a % mod
print(ans)
Problem p02580 (python)

Fixed submission:
#実験 貼り付けコード
h,w,m = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(m)]

r = [0] * (h + 1)
c = [0] * (w + 1)
for x, y in s:
    r[x] += 1
    c[y] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))

Buggy submission (verdict: Runtime Error):
h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*h
wlist = [0]*w
hwlist = [[0]*w for _ in range(h)]
for i in hw:
    hlist[i[0]-1]+=1
    wlist[i[1]-1]+=1
    hwlist[i[0]-1][i[1]-1]+=1

hmax=max(hlist) 
h_index = [n for n, v in enumerate(hlist) if v == hmax]
wmax=max(wlist)
w_index = [n for n, v in enumerate(wlist) if v == wmax]

import sys
for i in h_index:
    for j in w_index:
        if hwlist[i][j]==0:
            print(hlist[i]+wlist[j])
            sys.exit()
else:
    print(hlist[i]+wlist[j]-1)

Buggy submission (verdict: Runtime Error):
h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*h
wlist = [0]*w
hwlist = [[0]*w for _ in range(h)]
for i in hw:
    hlist[i[0]-1]+=1
    wlist[i[1]-1]+=1
    hwlist[i[0]-1][i[1]-1]+=1

h_index = [n for n, v in enumerate(hlist) if v == max(hlist)]

w_index = [n for n, v in enumerate(wlist) if v == max(wlist)]

li = []
for i in h_index:
    for j in w_index:
        li += [hlist[i]+wlist[j]-int(hwlist[i][j]==1)]
print(max(li))
Problem p02659 (python)

Fixed submission:
a,b = input().split()
aa = int(a)
bb = int(b.replace(".",""))
print(aa*bb//100)

Buggy submission (verdict: Runtime Error):
a,b = input().split()
aa = int(a)
bb = b.replace(".","")
print(aa*bb//100)
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s <= w:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
s,w = map(int,input().split())
if s <= w:
    print(unsafe)
else:
    print(safe)
Problem p02773 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]

s_sort = sorted(s)

s_num = [1]*n

for i in range(1,n):
    if s_sort[i] == s_sort[i-1]:
        s_num[i] += s_num[i-1]

Maxnum = max(s_num)

index_num = [n for n, v in enumerate(s_num) if v == Maxnum]

[print(s_sort[i]) for i in index_num]

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]

s_sort = sorted(s)

s_num = [1]*n

for i in range(1,n):
    if s_sort[i] == s_sort[i-1]:
        s_num[i] += s_num[i-1]

Maxnum = max(s_num)

index_num = [n for n, v in enumerate(s_num) if v == Maxnum]

[print(s_sort[i]) for i in index_num,]
Problem p02862 (python)

Fixed submission:
x,y = map(int,input().split())
import sys
sys.setrecursionlimit(10**6)



a = (2*x-y)/3
b = (2*y-x)/3
if not (a.is_integer() and  b.is_integer()) or 2*x<y or 2*y<x:
    print(0)
    sys.exit()
    
a = int(a)
b = int(b)

from functools import reduce
def mycmb(n,r,p):
    r = min(r,n-r)
    if r == 0:
        return 1
    over = reduce(lambda x,y:x*y%p,range(n,n-r,-1))
    under = reduce(lambda x,y:x*y%p,range(1,r+1))
    return (over * pow(under,p-2,p))%p

mod = 10**9+7
print(mycmb(a+b,a,mod))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
import sys
sys.setrecursionlimit(10**6)



a = (2*x-y)/3
b = (2*y-x)/3
if not (a.is_integer() and  b.is_integer()):
    print(0)
    sys.exit()
a = int(a)
b = int(b)
from functools import reduce
def mycmb(n,r,p):
    r = min(r,n-r)
    if r == 0:
        return 1
    over = reduce(lambda x,y:x*y%p,range(n,n-r,-1))
    under = reduce(lambda x,y:x*y%p,range(1,r+1))
    return (over * pow(under,p-2,p))%p

mod = 10**9+7
print(mycmb(a+b,a,mod))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
import sys

a = (2*x-y)/3
b = (2*y-x)/3
if not (a.is_integer() and  b.is_integer()):
    print(0)
    sys.exit()
a = int(a)
b = int(b)
from functools import reduce
def mycmb(n,r,p):
    r = min(r,n-r)
    if r == 0:
        return 1
    over = reduce(lambda x,y:x*y%p,range(n,n-r,-1))
    under = reduce(lambda x,y:x*y%p,range(1,r+1))
    return (over * pow(under,p-2,p))%p

mod = 10**9+7
print(mycmb(a+b,a,mod))
Problem p03242 (python)

Fixed submission:
print(input().replace("1","x").replace("9","1").replace("x","9"))

Buggy submission (verdict: Runtime Error):
#111a
print(input().replace(1,x).replace(9.1).replace(x,9))