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

Fixed submission:
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K-1])

Buggy submission (verdict: Runtime Error):
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K+1])

Buggy submission (verdict: Runtime Error):
K = int(input())
list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
print(list[K])
Problem p02747 (python)

Fixed submission:
import math
import sys
#読み込み
s = input()
num = len(s)

#偶数個の文字でなければno
if num % 2 != 0:
    print("No")
    sys.exit()

#偶数番目がhか判定
for i in range(math.floor(num/2)):
    if s[2 * i] != "h":
        print("No")
        sys.exit()

#奇数番目がiか判定
for j in range(math.floor(num/2)):
    if s[2 * j + 1]  != "i":
        print("No")
        sys.exit()
        
print("Yes")

Buggy submission (verdict: Runtime Error):
list_num = input().split(" ") #A,B,M
list_ref = input().split(" ") #冷蔵庫の値段
list_ren = input().split(" ") #レンジの値段
list2 = [] #割引できるやつの組み
for i in range(int(list_num[2])):
    list_c = input().split(" ")
    list2.append(list_c)
A = int(list_num[0])
B = int(list_num[1])
M = int(list_num[2])
 
#割引なしで総当たり
list_price = []
for i in range(A):
    for j in range(B):
        list_price.append(int(list_ref[i]) + int(list_ren[j]))
 
#割引きを総当たり
for k in range(M):
    price = int(list_ref[int(list2[k][0])-1]) + int(list_ren[int(list2[k][1])-1]) - int(int(list2[k][2])-1) - 1
    list_price.append(price)
 
 
print(min(list_price))
Problem p02783 (python)

Fixed submission:
list = input().split(" ")
H = int(list[0])
A = int(list[1])

t = 0
while H > 0:
    H = H - A
    t = t + 1

print(t)

Buggy submission (verdict: Runtime Error):
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp,reverse=True)

if K < N:
    for i in range(K):
        list_hp.pop(0)
    print(sum(list_hp))
    
else:
    print(0)
Problem p02784 (python)

Fixed submission:
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

sum = 0
for i in skill:
    sum = sum + i

if sum >= H:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
list = input().split(" ")
H = int(list[0])
skill = input().split(" ")
skill = [int(i) for i in skill]

a1 = max(skill)
skill.remove(a1)
a2 = max(skill)

if a1 + a2 >= H:
    print("YES")
else:
    print("NO")
Problem p02786 (python)

Fixed submission:
H = int(input())

def attack(x):
    if x > 1:
        return attack(int(x/2)) * 2 + 1
    else:
        return 1
        
print(attack(H))

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

def attack(x):
    if H > 0:
        return 2 * attack(int(x/2)) + 1
    else:
        return 1
      
print(attack(H))
Problem p02791 (python)

Fixed submission:
N = int(input())
P = input().split(" ")

t = 1
list = []
for i in range(N):
    list.append(int(P[i]))
    if i == 0:
        m = int(P[0])
    elif int(P[i]) < m:
        m = int(P[i])
        t = t + 1
        
print(t)

Buggy submission (verdict: Runtime Error):
t = 0
list = []
for i in range(N):
    list.append(int(P[i]))
    m = min(list)
    if m == int(P[i]):
        t = t + 1

print(t)
Problem p02802 (python)

Fixed submission:
N,M = map(int,input().split(" "))
L = [0] * M
for i in range(M):
    L[i] = input().split(" ")
    
memoAC = [0] * N
memoWA = [0] * N
for list in L:
    if list[1] == "AC":
        memoAC[int(list[0])-1] = 1
    else:
        if memoAC[int(list[0])-1] != 1:
            memoWA[int(list[0])-1] += 1

for j in range(N):
    if memoAC[j] == 0:
        memoWA[j] = 0

AC = sum(memoAC)
WA = sum(memoWA)
print(AC,WA)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split(" "))
L = [0] * M
for i in range(M):
  L(i) = input().split(" ")

memoAC = [0]*N
memoWA = [0]*N
for list in L:
  if list[1]=="AC":
    memoAC[int(list[0])]=1
  else:
    if memoAC[int(list[0])]!=1:
      memoWA[int(list)[0]]+=1
      
AC = sum(memoAC)
WA = sum(memoWA)
print(AC,WA)
Problem p02910 (python)

Fixed submission:
import math
S = input()
n = len(S)

for i in range(math.ceil(n/2)):
    if S[2*i] != "R" and S[2*i] != "U" and S[2*i] != "D":
        print("No")
        exit()
for i in range(int(n/2)):
    if S[2*i + 1] != "L" and S[2*i + 1] != "U" and S[2*i + 1] != "D":
        print("No")
        exit()
print("Yes")

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

for i in range(int(n/2)+1):
    if S[2*i] != "R" and S[2*i] != "U" and S[2*i] != "D":
        print("No")
        exit()
for i in range(int(n/2)):
    if S[2*i + 1] != "L" and S[2*i + 1] != "U" and S[2*i + 1] != "D":
        print("No")
        exit()
print("Yes")
Problem p03434 (python)

Fixed submission:
N = int(input())
list = map(int,input().split(" "))
cards = sorted(list,reverse=True)

if len(cards) % 2 == 0:
    alice = 0
    for i in range(int(N/2)):
        alice = alice + cards[2 * i]
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
else:
    alice = 0
    for i in range(int(N/2) + 1):
        alice = alice + cards[2 * i]
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
        
print(alice - bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = map(int,input().split(" "))
cards = sorted(list,reverse=True)

if len(cards) % 2 == 0:
    alice = 0
    for i in range(int(N/2)):
        alice = alice + cards[2 * i]
        
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
    else:
        alice = 0
    for i in range(int(N/2) + 1):
        alice = alice + cards[2 * i]
        
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
    
print(alice - bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
list = map(int,input().split(" "))
cards = sorted(list,reverse=True)

#Aliceの得点（偶数番目の総和）
alice = 0
for i in range(int(N/2) + 1):
    alice = alice + cards[2 * i]

#Bobの得点（奇数番目の総和）
bob = 0
for j in range(int(N/2)):
    bob = bob + cards[2 * j + 1]
    
print(alice - bob)
Problem p02717 (python)

Fixed submission:
def solve(a, b, c):
    print("%d %d %d"% (c, a, b))


if __name__ == '__main__':
    xyz = input().split()

    x = int(xyz[0])
    y = int(xyz[1])
    z = int(xyz[2])

    solve(x, y, z)

Buggy submission (verdict: Runtime Error):
def solve(a, b, c):
    print(f"{c} {a} {b}")


if __name__ == '__main__':
    xyz = input().split()

    x = int(xyz[0])
    y = int(xyz[1])
    z = int(xyz[2])

    solve(x, y, z)
Problem p02690 (python)

Fixed submission:
n = int(input())
flag = False
for i in range(10**8):
    for j in range(-10**4,10**4):
        if i**5 - j **5 == n :
            print(i,j)
            flag = True
            break
    if flag == True :
        break

Buggy submission (verdict: Runtime Error):
for i in range(10**8):
	for j in range(-10**4,10**4):
    	if i**5 - j **5 :
      		print(i.j)
      		break
Problem p02991 (python)

Fixed submission:
from collections import deque
N, M = map(int, input().split())
INF = -1
dist = [[INF]*3 for _ in range(N)]
vector = [[] for _ in range(N)]

for i in range(M):
    graf1, graf2 = map(int, input().split())
    vector[graf1-1].append(graf2-1)
S, T = map(int, input().split())
S, T = S-1, T-1

# BFS
dist[S][0] = 0
q = deque()
q.append((S, 0))
while q:
    v, l = q.popleft()
    for i in vector[v]:
        new_l = (l+1)%3
        if dist[i][new_l] != INF:
            continue
        dist[i][new_l] = dist[v][l] + 1
        q.append((i, new_l))

ans = dist[T][0]
if ans == INF:
    print("-1")
else:
    print(int(ans/3))

Buggy submission (verdict: Runtime Error):
import numpy as np
from queue import Queue
N, M = map(int, input().split())
INF = -1
dist = [INF]*N*3
dist = np.array(dist).reshape(N, 3)
vector = np.zeros((N, N))

for i in range(M):
    graf1, graf2 = map(int, input().split())
    vector[graf1-1, graf2-1] = 1
S, T = map(int, input().split())
S, T = S-1, T-1

# BFS
dist[S][0] = 0
q = Queue(3*N+1)
q.put((S, 0))
while not q.empty():
    v, l = q.get()
    for i in range(N):
        if vector[v][i] != 1:
            continue
        new_l = (l+1)%3
        if dist[i][new_l] != INF:
            continue
        dist[i][new_l] = dist[v][l] + 1
        q.put((i, new_l))

ans = dist[T][0]
if ans == INF:
    print("-1")
else:
    print(int(ans/3))

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import deque
N, M = map(int, input().split())
INF = 100000
dist = [INF]*N*3
dist = np.array(dist).reshape(N, 3)
vector = np.zeros((N, N))

for i in range(M):
    graf1, graf2 = map(int, input().split())
    vector[graf1-1, graf2-1] = 1
S, T = map(int, input().split())
S, T = S-1, T-1

# BFS
dist[S][0] = 0
queue = deque()
queue.append((S, 0))
while len(queue) > 0:
    v, l = queue.popleft()
    for i in range(N):
        if vector[v][i] != 1:
            continue
        new_l = (l+1)%3
        if dist[i][new_l] != INF:
            continue
        dist[i][new_l] = dist[v][l] + 1
        queue.append((i, new_l))

ans = dist[T][0]
if ans == INF:
    print("-1")
else:
    print(ans // 3)
Problem p02765 (python)

Fixed submission:
n, r = map(int, input().split())
if n<10:
    print(100*(10-n)+r)
else:
    print(r)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
mod = pow(10, 9) + 7

def comb(N, x):
    numerator = 1
    for i in range(N-x+1, N+1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1, x+1):
        denominator = denominator * j % mod
    d = pow(denominator, mod-2, mod)
    return numerator * d

a = comb(n, a)
b = comb(n, b)

print((pow(2, n, mod) -1 -a -b) % mod)
Problem p02690 (python)

Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    c = {0:0}
    s = set([0])
    cnt = 1
    flag = True
    while flag:
        k = pow(cnt, 5)
        c[k] = cnt
        s.add(k)
        r = k-X
        if r in s:
            print(c[k], c[r])
            flag = False
            break
        if -r in s:
            print(c[k], -c[-r])
            flag = False
            break
        cnt += 1
resolve()

Buggy submission (verdict: Runtime Error):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    c = {0:0}
    cnt = 1
    while True:
        c[pow(cnt, 5)] = cnt
        r = cnt-X
        if r in c.keys():
            print(c[cnt], c[r])
            break
        if -r in c.keys():
            print(c[cnt], -c[-r])
            break
        cnt += 1
resolve()
Problem p02727 (python)

Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X, Y, A, B, C = lr()
    p = sorted(lr())[-X:][::-1]
    q = sorted(lr())[-Y:][::-1]
    r = sorted(lr())
    tmp = r.pop()
    pt = p[-1]
    qt = q[-1]
    ext = [0]
    while (tmp > pt or tmp > qt) and len(r) >= 0:
        if pt > qt:
            g = q.pop()
            ext.append(tmp)
            if len(q) == 0:
                qt = pow(10, 9)+1
            else:
                qt = q[-1]
        else:
            g = p.pop()
            ext.append(tmp)
            if len(p) == 0:
                pt = pow(10, 9)+1
            else:
                pt = p[-1]
        if len(r) > 0:
            tmp = r.pop()
        else:
            break
    print(sum(p)+sum(q)+sum(ext))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X, Y, A, B, C = lr()
    p = sorted(lr())[-X:][::-1]
    q = sorted(lr())[-Y:][::-1]
    r = sorted(lr())
    tmp = r.pop()
    pt = p[-1]
    qt = q[-1]
    ext = [0]
    while (tmp > pt or tmp > qt) and len(r) >= 0:
        if pt > qt:
            g = q.pop()
            ext.append(tmp)
            qt = q[-1]
        else:
            g = p.pop()
            ext.append(tmp)
            pt = p[-1]
        if len(r) > 0:
            tmp = r.pop()
    print(sum(p)+sum(q)+sum(ext))
resolve()
Problem p02732 (python)

Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# import numpy as np
def resolve():
    N = ir()
    # A = np.array(lr(), np.int32)
    A = lr()
    A = [[A[i], i] for i in range(N)]
    A.append([2*10**5+1, N+1])
    A = sorted(A, key=lambda x: x[0])
    c = []
    d = []
    e = []
    tmp = 1
    st = 0
    for i in range(N+1):
        if tmp == A[i][0]:
            st += 1
        else:
            if st > 1:
                c.append(tmp)
                d.append(st)
                e.append(st*(st-1)//2)
            else:
                c.append(tmp)
                d.append(st)
                e.append(0)
            tmp = A[i][0]
            st = 1
    ans = []
    tmp = 0
    # print(c, d, e)
    se = sum(e)
    for i in range(N):
        if A[i][0] > c[tmp]:
            tmp += 1
        num = d[tmp]
        plu = 0
        if num > 2:
            plu = (num-1)*(num-2)//2
        ans.append([se-e[tmp]+plu, A[i][1]])
    # print(ans)
    # print(iA)
    ans = sorted(ans, key=lambda x: x[1])
    for i in range(N):
        print(ans[i][0])

resolve()

Buggy submission (verdict: Runtime Error):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N = ir()
    # A = np.array(lr(), np.int32)
    A = lr()
    A = [[A[i], i] for i in range(N)]
    A.append([2*10**5+1, N+1])
    A = sorted(A, key=lambda x: x[0])
    c = []
    d = []
    e = []
    tmp = 1
    st = 0
    for i in range(N+1):
        if tmp == A[i][0]:
            st += 1
        else:
            if st > 1:
                c.append(tmp)
                d.append(st)
                e.append(st*(st-1)//2)
            else:
                c.append(tmp)
                d.append(st)
                e.append(0)
            tmp = A[i][0]
            st = 1
    ans = []
    tmp = 0
    # print(c, d, e)
    for i in range(N):
        if A[i][0] > c[tmp]:
            tmp += 1
        num = d[tmp]
        plu = 0
        if num > 2:
            plu = (num-1)*(num-2)//2
        ans.append([sum(e)-e[tmp]+plu, A[i][1]])
    # print(ans)
    # print(iA)
    ans = sorted(ans, key=lambda x: x[1])
    for i in range(N):
        print(ans[i][0])

resolve()
Problem p02742 (python)

Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    H, W = lr()
    a = H*W
    if H == 1 or W == 1:
        print(1)
    elif a%2 == 1:
        print((a+1)//2)
    else:
        print(a//2)
    return
resolve()

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = H*W
if a%2 == 1:
    print((a+1)//2)
else:
    print(a//2)
return
Problem p02756 (python)

Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import deque
def resolve():
    S = deque(sr())
    Q = ir()
    rev = 1
    for i in range(Q):
        T = list(sr().split())
        if int(T[0]) == 1:
            rev *= -1
        else:
            x, F, C = T
            if int(F) == 1:
                if rev == 1:
                    S.appendleft(C)
                else:
                    S.append(C)
            else:
                if rev == 1:
                    S.append(C)
                else:
                    S.appendleft(C)
    if rev == -1:
        S.reverse()
    print(*S, sep='')
resolve()

Buggy submission (verdict: Runtime Error):
mport sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import deque
def resolve():
    S = deque(list(sr().split()), maxlen=1000000)
    Q = ir()
    rev = 1
    for i in range(Q):
        T = list(sr().split())
        if int(T[0]) == 1:
            rev *= -1
        else:
            x, F, C = T
            if int(F) == 1:
                if rev == 1:
                    S.appendleft(C)
                else:
                    S.append(C)
            else:
                if rev == 1:
                    S.append(C)
                else:
                    S.appendleft(C)
    if rev == -1:
        S.reverse()
    print(*S, sep='')
resolve()

Buggy submission (verdict: Runtime Error):
mport sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import deque
def resolve():
    S = deque(list(sr().split()), maxlen=1000000)
    Q = ir()
    rev = 1
    for i in range(Q):
        T = list(sr().split())
        if int(T[0]) == 1:
            rev *= -1
        else:
            x, F, C = T
            if int(F) == 1:
                if rev == 1:
                    S.appendleft(C)
                else:
                    S.append(C)
            else:
                if rev == 1:
                    S.append(C)
                else:
                    S.appendleft(C)
    if rev == -1:
        S.reverse()
    print(*S, sep='')
resolve()
Problem p02782 (python)

Fixed submission:
def resolve():
    r1, c1, r2, c2 = map(int, input().split())
    r1 -= 1
    c1 -= 1

    def cmb(n, r, mod):
        if (r<0 or r>n):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    mod = 10**9+7 #出力の制限
    N = 3*10**6
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)

    print((cmb(r2+c2+2, r2+1, mod) - cmb(r1+c2+2, r1+1, mod) - cmb(r2+c1+2, c1+1, mod) + cmb(r1+c1+2, r1+1, mod))%mod)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    r1, c1, r2, c2 = map(int, input().split())

    def cmb(n, r, mod):
        if (r<0 or r>n):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    mod = 10**9+7 #出力の制限
    N = 10**6
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range(2, N + 1):
        g1.append((g1[-1] * i ) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)

    print((cmb(r2+1+c2+1, r2+1, mod) - cmb(r1+c2+1, r1, mod) - cmb(r2+1+c1, c1, mod) + cmb(r1+c1, r1, mod)%mod))
resolve()
Problem p02789 (python)

Fixed submission:
def resolve():
    N, M = map(int, input().split())
    if N == M:
        print('Yes')
    else:
        print('No')
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    import fractions
    n=int(input())
    a=[int(i) for i in input().split()]
    g=1
    dx=fractions.gcd
    for i in a:
        g*=i//dx(g,i)
    suml=0
    mod=10**9+7
    for i in a:
        suml+=g*pow(i,mod-2,mod)
        suml%=mod
    print(suml)
resolve()
Problem p02995 (python)

Fixed submission:
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x
import math
A, B, C, D = (int(a) for a in input().split())
lcm = gcd(C, D)
a = B - A + 1
b = abs(B // C - (A - 1) // C)
c = abs(B // D - (A - 1) // D)
d = abs(B // ((C * D) // lcm) - (A - 1) // ((C * D) // lcm))
print(a - (b + c - d))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A, B, C, D = (int(a) for a in input().split())
a = B - A + 1
b = abs(B // C - (A - 1) // C)
c = abs(B // D - (A - 1) // D)
d = abs(B // (C * D) - (A - 1) // (lcm(C, D)))
print(a - (b + c - d))
Problem p02999 (python)

Fixed submission:
X,A = (int(a) for a in input().split())
if A>X:
  print("0")
else:
  print("10")

Buggy submission (verdict: Runtime Error):
X,A = int(a) for a in input().split()
if X<A:
    print("0")
else:
    print("10")
Problem p02983 (python)

Fixed submission:
l, r = (int(x) for x in input().split())
tmpmin = 2019
if r-l >= 2019:
    print(0)
else:
    for i in range(l, r):
        for j in range(l+1, r+1):
            tmp = (i*j)%2019
            if tmp < tmpmin:
                tmpmin = tmp
                if tmpmin == 0:
                    break
    print(tmpmin)

Buggy submission (verdict: Runtime Error):
l, r = (int(x) for x in input().split())
tmpmin = 2020
tmprem = i*r%2019
if l*r<2019:
    print(l*(l+1))
else:
    for i in range(l, r+1):
        for j in range(l+1, r+1):
            tmp = (i*j)%2019
            tmpnxt = (i*(j+1))%2019
            if tmp < tmpmin:
                tmpmin = tmp
            if tmp < tmpnxt:
                break
    print(tmpmin)
Problem p03565 (python)

Fixed submission:
def getLastMatch(s,t):
    for i in range(len(s)-len(t), -1, -1):
        if s[i] == '?' or s[i] == t[0]:
            match = True
            for j in range(len(t)):
                if s[i+j] == '?': continue
                if s[i+j] != t[j]:
                    match = False
                    break
            if match: return i
    return -1

def getS(s,t,lastMatch):
    s = list(s)
    for i in range(len(t)):
        s[i+lastMatch] = t[i]
    for i in range(len(s)):
        if s[i]=='?': s[i] = 'a'
    res = ''
    for c in s: res+=c
    return res


s,t = input(), input()
lastMatch = getLastMatch(s,t)
if lastMatch == -1:
    print('UNRESTORABLE')
else:
    print(getS(s,t,lastMatch))

Buggy submission (verdict: Runtime Error):
def getLastMatch(s,t):
    for i in range(len(s)-len(t), -1, -1):
        if s[i] == '?' or s[i] == t[0]:
            match = True
            for j in range(len(t)):
                if s[i+j] == '?': continue
                if s[i+j] != t[j]:
                    match = False
                    break
            if match: return i
    return -1

s,t = input(), input()
lastMatch = getLastMatch(s,t)
if lastMatch == -1:
    print('UNRESTORABLE')
else:
    for i in range(len(s)):
        if i >= lastMatch:
            print(t[i-lastMatch],end='')
            continue
        
        if s[i] == '?': print('a',end='')
        else: print(s[i],end='')
    print()
Problem p03210 (python)

Fixed submission:
x=int(input())
if x==3 or x==5 or x==7:
  print ("YES")
else :
	print("NO")

Buggy submission (verdict: Runtime Error):
x=int(intput())
if x==3||x==5||x==7:
  print ("YES")
else :
	print("NO")
Problem p03377 (python)

Fixed submission:
A,B,X = map (int,input().split())
if A+B>=X and not A>X :
	print ('YES')
else:
	print ('NO')

Buggy submission (verdict: Runtime Error):
A,B,X = map (int,input().split())
if A+B>=X and not A>X :
	print "YES"
else:
	print "NO"

Buggy submission (verdict: Runtime Error):
A,B,X = map (int,input().split())
if A+B>=X and not A>X
	print "YES"
else
	print "NO"
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())

if N < 10:
    print(R + 100 * (10 - N))
else:
    print(R)

Buggy submission (verdict: Runtime Error):
N = int(input(""))
R = int(input(""))

if N < 10:
    R += 100 * (10 - N)

print(R)
Problem p02783 (python)

Fixed submission:
#a,b = map(int, input().split())
import math
if __name__ == "__main__":
    H,A = map(int,input().split())
    print(math.ceil(H / A))

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = list(map(int, input().split()))
if H <= sum(A):
  print ('Yse')
else:
  print ('No')