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

Fixed submission:

from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
    d[input()] += 1
for _ in range(int(input())):
    d[input()] -= 1
print(max(max(d.values()),0))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
    d[input()] += 1
for _ in range(int(input())):
    d[input()] -= 1
print(max(d.values(),0))
Problem p03416 (python)

Fixed submission:
a,b=map(int,input().split());print(len([1 for i in range(a,b+1)if i//1000==i%10*10+i%100//10]))

Buggy submission (verdict: Runtime Error):
a,b=map(input().split());print(len([1 for i in range(a,b+1) if i//1000==i%100]))

Buggy submission (verdict: Runtime Error):
a,b=map(input().split());print(len([1 for i in range(a,b+1)if i//1000==i%100]))
Problem p03433 (python)

Fixed submission:
n, a = [int(input()) for _ in range(2)]
print("Yes" if n%500<=a else "No")

Buggy submission (verdict: Runtime Error):
n, a = [int(input()) for _ range(2)]
print("Yes" if (n%500)<=a else "No")

Buggy submission (verdict: Runtime Error):
n, a = [int(input()) for _ range(2)]
print("Yes"if n%500<=a else"No")
Problem p03434 (python)

Fixed submission:
input();
al=[int(i) for i in input().split()]
al.sort()
al = al[::-1]
print(sum(al[::2])-sum(al[1::2]))

Buggy submission (verdict: Runtime Error):
input();
al=[int(i) for i in input().split()]
al.sort()[::-1]
print(sum(al[::2])-sum(al[1::2]))
Problem p03485 (python)

Fixed submission:
print((lambda x: int(0.999999999999 + ((int(x[0]) + int(x[1])) / 2)))(input().split()))

Buggy submission (verdict: Runtime Error):
print((lambda x: int((int(x[0]) + int(x[1])) / 2 + 0.999999999999999999999999999999))(input().split())print((lambda x: int(0.999999999999 + ((int(x[0]) + int(x[1])) / 2)))(input().split()))
Problem p03497 (python)

Fixed submission:
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in input().split()]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if len(d.keys()) > k:
  # 色を塗り替えないといけないので数えなければ…
  v = list(d.values())
  v.sort()
  ans = sum(v[:len(d.keys()) - k])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in input().split()]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
  # 色を塗り替えないといけないので数えなければ…
  v = d.values()
  v.sort()
  ans = sum(v[:d.keys() - k])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in range(n)]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
  # 色を塗り替えないといけないので数えなければ…
  v = d.values()
  v.sort()
  ans = sum(v[:d.keys() - k])
print(ans)
Problem p03504 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[0], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (2 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[1], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (1 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()
Problem p03556 (python)

Fixed submission:
print((lambda x:max([i*i for i in range(100001) if x>=i*i]))(int(input())))

Buggy submission (verdict: Runtime Error):
print(max([i*i for i in range(10001) if int(input())>=i]))
Problem p03563 (python)

Fixed submission:
i,p=int,input
print(-i(p())+2*i(p()))

Buggy submission (verdict: Runtime Error):
n,g=map(int,input().split())
print(2*(n-g))
Problem p03593 (python)

Fixed submission:
from collections import Counter
from math import floor

def solve():
    h, w = map(int, input().split())
    word_dict = dict(Counter(list("".join([input() for _ in range(h)]))))

    g1 = (w % 2) & (h % 2)
    g2 = floor((w % 2) * h/2) + floor((h % 2) * w/2)
    g4 = floor(h/2) * floor(w/2)
    
    for k, v in word_dict.items():
        if g1 == 0:
            break
        if v % 4 == 1 or v % 4 == 3:
            g1 -= 1
            word_dict[k] -= 1
            v -= 1
            
    for k, v in word_dict.items():
        if g4 == 0:
            break
        while v >= 4:
            g4 -= 1
            word_dict[k] -= 4
            v -= 4

    for k, v in word_dict.items():
        if g2 == 0:
            break
        while v >= 2:
            g2 -= 1
            word_dict[k] -= 2
            v -= 2
            
    print("No" if [1 for v in word_dict.values() if v != 0] else "Yes")
    
if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
from collections import Counter

def solve():
    h, w = map(int, input().split())
    wd = dict(Counter(list("".join([input() for _ in range(h)]))))

    g1 = (w % 2) & (h % 2)
    g2 = (w % 2) * h//2 + (h % 2) * w//2
    g4 = h//2 * w//2
    
    for k in wd.keys():
        if (g1 > 0) and v % 4 == 1 or v % 4 == 3:
            g1 -= 1
            wd[k] -= 1
        while (g4 > 0) and v >= 4:
            g4 -= 1
            wd[k] -= 4
        while (g2 > 0) and v >= 2:
            g2 -= 1
            wd[k] -= 2
            
    print("No" if sum(wd.values()) else "Yes")
    
if __name__=="__main__":
    solve()
Problem p03598 (python)

Fixed submission:
p=input;p();k=int(p());print(sum([2*min(i,abs(k-i))for i in map(int,p().split())]))

Buggy submission (verdict: Runtime Error):
p=input;p();k=p();print(sum([2*min(int(i),abs(k-int(i)))for i in p().split()]))
Problem p03605 (python)

Fixed submission:
print("Yes" if input().count("9") > 0 else "No")

Buggy submission (verdict: Runtime Error):
print("YNeos"["9"not in input()::2])
print("Yes"if"9"in input()else"No")
Problem p03606 (python)

Fixed submission:
ans = 0
for i in range(int(input())):
  a, b = map(int, input().split())
  ans += b + 1 - a
print(ans)

Buggy submission (verdict: Runtime Error):
print(sum([(lambda x:b+1-a)(map(int,input().split())for _ in  int(input())]))
Problem p03614 (python)

Fixed submission:
def solve():
    n = int(input())
    al = [int(i) for i in input().split()]
    memos = [0]*n
    for i in range(n):
        memos[i] = i - (al[i] - 1)
    # print(memos)
    ans = 0
    for idx in range(n):
        if memos[idx] == 0:
            if idx != n - 1:
                memos[idx+1], memos[idx] = memos[idx+1]-1, memos[idx]+1
            else:
                memos[idx], memos[idx-1] = memos[idx-1]+1, memos[idx]-1
            ans += 1
        # print(memos)
    print(ans)

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    al = [int(i) for i in input().split()]
    memos = [0]*n
    for i in range(n):
        memos[i] = i - (al[i] - 1)
    # print(memos)
    ans = 0
    for idx in range(n):
        if memos[idx] == 0:
            memos[idx+1], memos[idx] = memos[idx+1]-1, memos[idx]+1
            ans += 1
        # print(memos)
    print(ans)

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    al = [int(i) for i in input().split()]
    memos = [0]*n
    for i in range(n):
        memos[i] = i - (al[i] - 1)
    # print(memos)
    ans = 0
    for idx in range(n):
        while memos[idx] == 0:
            if idx == 0:
                memos[idx], memos[idx+1] = memos[idx+1]-1, memos[idx]+1
            elif idx == n-1:
                memos[idx], memos[idx+1] = memos[idx+1]-1, memos[idx]+1
            else:
                if memos[idx-1] > memos[idx+1]:
                    memos[idx-1], memos[idx] = memos[idx]-1, memos[idx-1]+1
                else:
                    memos[idx], memos[idx+1] = memos[idx+1]-1, memos[idx]+1
            ans += 1
        # print(memos)
    print(ans)

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    al = [int(i) for i in input().split()]
    memos = [0]*n
    for i in range(n):
        memos[i] = i - (al[i] - 1)
    # print(memos)
    ans = 0
    for idx in range(n):
        if memos[idx] == 0:
            if idx == 0:
                memos[idx], memos[idx+1] = memos[idx+1]-1, memos[idx]+1
            else:
                if memos[idx-1] > memos[idx+1]:
                    memos[idx-1], memos[idx] = memos[idx]-1, memos[idx-1]+1
                else:
                    memos[idx], memos[idx+1] = memos[idx+1]-1, memos[idx]+1
            ans += 1
        # print(memos)
    print(ans)

if __name__=="__main__":
    solve()
Problem p03624 (python)

Fixed submission:
print((lambda x:"None" if not x else sorted(list(x))[0])(set([chr(i) for i in range(97,97+26)])-set(list(input()))))

Buggy submission (verdict: Runtime Error):
print(("None" if not x else x[0])(sorted(set(chr(97+i) for i in range(26))-set(input())))

Buggy submission (verdict: Runtime Error):
print((lambda x:"None" if not x else x[0])(sorted(set([chr(97+i) for i in range(26)]-list(input()))))))
Problem p03628 (python)

Fixed submission:
def solve():
    n = int(input())
    pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
    pointer, ans = 0, 0
    if pattern[0][0] == pattern[0][1]:
        ans = 3
    else:
        ans = 6
    while pointer < n - 1:
        current = pattern[pointer][0]
        if current == pattern[pointer][1]:
            if pattern[pointer+1][0] == pattern[pointer+1][1]:
                ans *= 2
                # print("X->X")
            else:
                ans *= 2
                # print("X->Y")
            pointer += 1
        else:
            if pointer + 2 >= n - 1:
                break
            if pattern[pointer+2][0] == pattern[pointer+2][1]:
                ans *= 1
                # print("Y->X")
            else:
                ans *= 3
                # print("Y->Y")
            pointer += 2
    print(ans % 1000000007)

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
    pointer, ans = 0, 0
    if pattern[0][0] == pattern[0][1]:
        ans = 3
    else:
        ans = 6
    while pointer < n - 1:
        current = pattern[pointer][0]
        if current == pattern[pointer][1]:
            if pattern[pointer+1][0] == pattern[pointer+1][1]:
                ans *= 2
                # print("X->X")
            else:
                ans *= 2
                # print("X->Y")
            pointer += 1
        else:
            if pattern[pointer+2][0] == pattern[pointer+2][1]:
                ans *= 1
                # print("Y->X")
            else:
                ans *= 3
                # print("Y->Y")
            pointer += 2
    print(ans % 1000000007)

if __name__=="__main__":
    solve()
Problem p03645 (python)

Fixed submission:
from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

d = defaultdict([0])
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import defaultdict from collections

d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
  from, to = map(int, input().split())
  d[from].append(to)
  d[to].append(from)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import defaultdict from collections

d = defaultdict([])
goal, n = map(int,  input().split())
for _ in range(n):
  from, to = map(int, input().split())
  d[from].append[to]
  d[to].append[from]
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")
Problem p03671 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a)
Problem p03680 (python)

Fixed submission:
def solve():
    n = int(input())
    lst = [int(input())-1 for _ in[0]*n]
    visit = set()
    current = 0
    while True:
        visit.add(current)
        current = lst[current]
        if current == 1:
            print(len(visit))
            break
        if current in visit:
            print(-1)
            break

if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int(input()) for _ in[0]*n]
visit = set()
current = 0
while True:
  visit.add(current)
  current = lst[current]
  if current == 2:
    print(len(visit) + 1)
    break
  if current in visit:
    print(-1)
    break
Problem p03681 (python)

Fixed submission:
def solve():
    n, m = map(int, input().split())
    if -2 < (n - m) < 2:
        ans = 1
        for i in range(1, n+1):
            ans *= i
            ans %= 1000000007
        for i in range(1, m+1):
            ans *= i
            ans %= 1000000007
        if n != m:
            print(ans)
        else:
            print(((ans) * 2) % 1000000007)
    else:
        print(0)


if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if -2 < (n - m) < 2:
  ans = 1
  for i in range(n):
    ans *= n
    ans %= 10_0000_0007
  for i in range(m):
    ans *= n
    ans %= 10_0000_0007
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if -2 < (n -m) < 2:
  ans = 1
  for i in range(n):
    ans *= n
    ans %= 10_0000_0007
  for i in range(m):
    ans *= n
    ans %= 10_0000_0007
  print(ans)
else:
  print(0)
Problem p03695 (python)

Fixed submission:
al=[0]*13
input()
for i in input().split():
    al[int(i)//400]+=1
tuyoi=sum(al[8:])
iru=sum([1 for a in al[:8] if a > 0])
print(max(1,iru),iru+tuyoi)

Buggy submission (verdict: Runtime Error):
l=[0]*13
input()
for i in input().split():;l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r),r+sum(l[8:]))

Buggy submission (verdict: Runtime Error):
cat ABC064C.py
l=[0]*13
input()
for i in input().split():;l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r),r+sum(l[8:]))

Buggy submission (verdict: Runtime Error):
l=[0]*13
input()
for i in input().split():
  l[int(i)//400]+=1
r=sum([1 for a in l[:8] if a > 0])
print(max(1,r,r+sum(l[8:])
Problem p03711 (python)

Fixed submission:
s=[int(i)for i in input().split()];f=lambda x,l:not(set(x[:])-set(l));print(["No","Yes"][f(s,[1,3,5,7,8,10,12])or f(s,[4,6,9,11])or f(s,[2])])

Buggy submission (verdict: Runtime Error):
s=map(int,input().split());print(["No","Yes"[s in[1,3,5,7,8,10,12]or s in[4,6,9,11]])
Problem p03712 (python)

Fixed submission:
h,w=map(int,input().split());w+=2;print("#"*w);print("\n".join(["#"+input().strip()+"#"for _ in [0]*h]));print("#"*w)

Buggy submission (verdict: Runtime Error):
p=input();h,w=map(int,p().split());w+=2;print("#"*w);print("\n".join(["#"+p().strip()+"#"for _ in[0]*h]));print("#"*w)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split());print("#"*w);print("\n".join(["#"input()"#"for _ in [0]*h]));print("#"*w)
Problem p03738 (python)

Fixed submission:
a,b=[int(input())for _ in[0]*2]
print("GREATER"if a>b else"ELQEUSASL"[a<b::2])

Buggy submission (verdict: Runtime Error):
p=input;a=int(p())-int(p());print(['EQUAL','LESS'][a<0],'GREATER'][a>0])
Problem p03760 (python)

Fixed submission:
from itertools import zip_longest
print("".join(["".join(a) for a in zip_longest(input(),input(),fillvalue="")]))

Buggy submission (verdict: Runtime Error):
a,b=input(),input()
l=len(a+b)
ans=""
for i in range(l):
  if i % 2 == 0:
    ans += a.pop(0)
  else:
    ans += b.pop(0)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=input(),input()
l=len(a+b)
ans=""
for i in range(l):
  if l % 2 == 0:
    ans += a.pop(0)
  else:
    ans += b.pop(0)
print(ans)
Problem p03944 (python)

Fixed submission:
w,h,n = map(int,input().split())
lx,hx,ly,hy = 0,w,0,h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    lx = max(lx, x)
  elif a == 2:
    hx = min(hx, x)
  elif a == 3:
    ly = max(ly, y)
  elif a == 4:
    hy = min(hy, y)
print(max(0, hx-lx) * max(0, hy-ly))

Buggy submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
lx,hx,ly,hy = 0,w,0,h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    lx = max(lx, x)
  elif a == 2:
    hx = min(hx, x)
  elif a == 3:
    ly = max(ly, y)
  elif a == 4:
    hy = min(hy, y)
print(max(0,(hx-lx)*(hy-ly))
Problem p04019 (python)

Fixed submission:
from collections import Counter
c = Counter(input())
print("Yes" if ((c["N"] > 0 and c["S"] > 0) or c["N"] == c["S"]) \
     and ((c["E"] > 0 and c["W"] > 0) or c["E"] == c["W"]) else "No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
c = Counter(input())
print("Yes" if ((c["N"] > 0 and c["S"] > 0) or c["N"] == s["S"]) \
 and ((c["E"] > 0 and c["W"] > 0) or c["E"] == s["W"]) else "No")
Problem p04044 (python)

Fixed submission:
def solve():
    n, _ = input().split()
    print("".join(sorted([input() for i in range(int(n))])))


if __name__=="__main__":
    solve()

Buggy submission (verdict: Runtime Error):
print("".join(sorted([input() for i in range(int(input().split[0]))])))
Problem p02702 (python)

Fixed submission:

"""
：余りの等しい物をカウントし、その累積和
：Aの余りとBの余り(mod 2019)が等しい場合
　A-Bは2019の倍数である
：計算量を抑えるため各項と１０の指数乗は分けて計算する
：
"""

import sys
input=sys.stdin.readline
s = input()[:-1][::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0

for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
a = input()
while (int(a) != 0):
    remain = [0for i in range(2019)]
    remain[int(a[0])] = remain[int(a[0])] + 1  ##V0
    n = len(a)
    cnt = 0
    for i in range(1,n):
        copy = remain[:]
        remain = [0for i in range(2019)]
        a_i = int(a[i])
        if (a_i != 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
            remain[a_i] += 1
        elif (a_i == 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
        cnt += remain[0]
    print(cnt)
    exit(0)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
a = input()
while (int(a) != 0):
    remain = [0for i in range(2019)]
    remain[int(a[0])] = remain[int(a[0])] + 1  ##V0
    n = len(a)
    cnt = 0
    for i in range(1,n):
        copy = remain[:]
        remain = [0for i in range(2019)]
        a_i = int(a[i])
        if (a_i != 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
            remain[a_i] += 1
        elif (a_i == 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
        cnt += remain[0]
    print(cnt)
    exit(0)

Buggy submission (verdict: Runtime Error):

import sys
input=sys.stdin.readline()
a = input()
while (int(a) != 0):
    remain = [0for i in range(2019)]
    remain[int(a[0])] = remain[int(a[0])] + 1  ##V0
    n = len(a)
    cnt = 0
    for i in range(1,n):
        copy = remain[:]
        remain = [0for i in range(2019)]
        a_i = int(a[i])
        if (a_i != 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
            remain[a_i] += 1
        elif (a_i == 0):
            for k in range(2019):
                rem = (k*10 + a_i)%2019
                remain[rem] += copy[k]
        cnt += remain[0]
    print(cnt)
    exit(0)
Problem p02706 (python)

Fixed submission:

n=list(map(int,input().split()))
L=list(map(int,input().split()))
print(n[0]-sum(L) if n[0]-sum(L)>=0 else "-1")

Buggy submission (verdict: Runtime Error):
n,m＝ map(int,input().split())
L=list(map(int,input().split()))
print(n-sum(L) if n-sum(L)>=0 else -1)
Problem p02719 (python)

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
ans1=min(n%k,k-n%k)
print(ans1)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
num=min(n,k)
a=max(n,k)%min(n,k)
b=min(n,k)
for i in range(10):
    b=abs(b-a)
    num=min(b,num)
print(num if min(n,k)!=1 else 0)
Problem p02911 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,K,Q = map(int,input().split())
A = (int(x) for x in sys.stdin.read().split())

score = [K-Q] * (N+1) 
for x in A:
    score[x] += 1

answer = '\n'.join('No' if x <= 0 else 'Yes' for x in score[1:])
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
input=sys.stdin.readline
N,K,Q=map(int,input().split())
J=[int(input()) for _ in range(Q)]
for i in range(1,N+1):
    print("Yes" if K-Q+J.count(i)>0 else "No")
Problem p03219 (python)

Fixed submission:
x,y = map(int,input().split())
print(x+y//2)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input())
print(x+y//2)