Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

r = False

for i in range(q):
    ts = input().split()
    if len(ts) == 1:
        r = not r
        # print(f"reverse: {r}")
    else:
        f, c = int(ts[1]), ts[2]
        if (r and f == 1) or (not r and f == 2):
            # 最後尾
            s += c
        else:
            # 先頭
            s = c + s
if not r:
    print(s)
else:
    print(s[::-1])

Fixed submission:
# list(map(int, input().split()))

s = input()
q = int(input())

r = False
first = []
last = []
for i in range(q):
    ts = input().split()
    if len(ts) == 1:
        r = not r
        # print(f"reverse: {r}")
    else:
        f, c = int(ts[1]), ts[2]
        if (r and f == 1) or (not r and f == 2):
            # 最後尾
            # s += c
            last.append(c)
        else:
            # 先頭
            # s = c + s
            first.append(c)
s = "".join(first)[::-1] + s + "".join(last)
if not r:
    print(s)
else:
    print(s[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

r = False

for i in range(q):
    ts = input().split()
    if len(ts) == 1:
        r = not r
        # print(f"reverse: {r}")
    else:
        f, c = int(ts[1]), ts[2]
        if (r and f == 1) or (not r and f == 2):
            # 最後尾
            s += c
        else:
            # 先頭
            s = c + s
if not r:
    print(s)
else:
    print(s[::-1])

Fixed submission:
# list(map(int, input().split()))

s = input()
q = int(input())

r = False
first = []
last = []
for i in range(q):
    ts = input().split()
    if len(ts) == 1:
        r = not r
        # print(f"reverse: {r}")
    else:
        f, c = int(ts[1]), ts[2]
        if (r and f == 1) or (not r and f == 2):
            # 最後尾
            # s += c
            last.append(c)
        else:
            # 先頭
            # s = c + s
            first.append(c)
s = "".join(first)[::-1] + s + "".join(last)
if not r:
    print(s)
else:
    print(s[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        if sum(d) > vmax:
            vmax = sum(d)
    else:
        d.append(p)
        vmax += p
    # print(vmax, d)

print(vmax)






Fixed submission:
from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
v = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        v = v + new - old
        if v > vmax:
            # print("v > vmax")
            vmax = v
    else:
        d.append(p)
        v += p
        vmax = v
    # print(vmax, v, d)

print(vmax)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        if sum(d) > vmax:
            vmax = sum(d)
    else:
        d.append(p)
        vmax += p
    # print(vmax, d)

print(vmax)






Fixed submission:
from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
v = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        v = v + new - old
        if v > vmax:
            # print("v > vmax")
            vmax = v
    else:
        d.append(p)
        v += p
        vmax = v
    # print(vmax, v, d)

print(vmax)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
ps = list(map(int, input().split()))

maxs = [0]
# print(ps)
for i in range(n-k + 1):

    vs = ps[i:i+k]
    # print(i, vs)
    if sum(vs) > sum(maxs):
        maxs = vs

result = 0
for m in maxs:
    result += (m + 1)/2
print(result)

Fixed submission:
from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
v = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        v = v + new - old
        if v > vmax:
            # print("v > vmax")
            vmax = v
    else:
        d.append(p)
        v += p
        vmax = v
    # print(vmax, v, d)

print(vmax)
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

# AB = []
# for i in range(N):
#     A, B = map(int, input().split())
#     AB.append((A, B))


d = [0] + [10**18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
H, A = map(int, input().split())

ans = 0

a, b = H // A, H % A
if b == 0:
  print(a)
else:
  print(a+1)

Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
# AB = [list(map(int, input().split())) for _ in range(N)]

AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))


d = [0] + [10**18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
H, A = map(int, input().split())

ans = 0

a, b = H // A, H % A
if b == 0:
  print(a)
else:
  print(a+1)
Buggy python submission (verdict: Runtime Error):
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)
    print(hp, np.amin(c))

print(d[H])

Fixed submission:
H = int(input())

# monster HP is X
# X==1 >> X=0
# X>1  other 2 monster appear. These 2 mosters have [X/2] HP.
# No.i monster vitalitiy is Hi
# two actions
# attack : reduce 1 vitaility
# special: make vitality 0. Fenek can use K times of specials.
# print(type(2*10**14))

# from collections import deque
#
# print(f"H={H}")
#
# monsters = deque()
# monsters.append(H)
# attack = 0
#
# while monsters:
# # for _ in range(3):
#     hp = monsters.popleft()
#     # print(f"attack to monster(HP={hp})")
#     if hp != 1:
#         # print(f"new 2 monsters(HP={hp//2}) appears!")
#         hp_hp = hp//2
#         monsters.extend([hp_hp, hp_hp])
#         # print(monsters)
#     attack += 1

i = 1
while H > 1:
    H //= 2
    i += 1
# print(attack)
print(2**i - 1)
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())

# AB = [list(map(int, input().split())) for _ in range(N)]

AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))

d = [0] + [10 ** 18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)

print(d[H])

Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())

AB = [list(map(int, input().split())) for _ in range(N)]

d = [0] + [10 ** 18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)

print(d[H])

Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())

AB = [list(map(int, input().split())) for _ in range(N)]

import numpy as np

d = [0] + [10**18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = np.max(hp - ab[0], 0)
        # if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)

print(d[H])

Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())

AB = [list(map(int, input().split())) for _ in range(N)]

d = [0] + [10**18] * H

for hp in range(1, H + 1):
    for ab in AB:
        # print(ab)
        hp_remain = hp - ab[0]
        if hp_remain < 0: hp_remain = 0
        # print(hp_remain)
        c = d[hp_remain] + ab[1]
        if c < d[hp]: d[hp] = c

print(d[H])




Fixed submission:
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
a, b = np.array(AB, dtype=np.int64).reshape(N, 2).T

d = np.zeros(H + 1, dtype=np.int64)

for hp in range(1, H + 1):
    c = d[np.maximum(hp - a, 0)] + b
    d[hp] = np.amin(c)

print(d[H])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b, c = map(int, input().split())
s = input()

print("{} {}".format( a + b + c, s))

Fixed submission:
def main(n, m):
    if n == m:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    n, m = input().split()
    main(n, m)

Buggy python submission (verdict: Runtime Error):
import sys


def main():
    if sys.argv[1] == sys.argv[2]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Fixed submission:
def main(n, m):
    if n == m:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    n, m = input().split()
    main(n, m)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
p = np.array(list(map(int, input().split())))

cnt = 0
for i in range(n):
    if p[i] <= np.min(p[:i+1]):
    # if all(map(lambda pj: p[i] <= pj, p[:i + 1])):
        cnt += 1
        if p[i] == 1:
            break


print(cnt)

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

cnt = 0
pjmin = P[0]
for pi in P:
    if pi <= pjmin:
        cnt +=1
        pjmin = pi
        if pi ==1:
            break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if all(map(lambda pj: p[i] <= pj, p[:i + 1])):
        cnt += 1
        if p[i] == 1:
            break
print(cnt)

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

cnt = 0
pjmin = P[0]
for pi in P:
    if pi <= pjmin:
        cnt +=1
        pjmin = pi
        if pi ==1:
            break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if all(map(lambda pj: p[i] <= pj, p[:i + 1])):
        cnt += 1
print(cnt)

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

cnt = 0
pjmin = P[0]
for pi in P:
    if pi <= pjmin:
        cnt +=1
        pjmin = pi
        if pi ==1:
            break
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
def main(n, p):

    cnt = 0

    for i in range(n):
        # print(f"pi={p[i]}, pj={p[:i+1]}")
        if all(map(lambda pj: p[i] <= pj, p[:i+1])):
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    n = int(input())
    p = list(map(int, input().split()))
    main(n, p)

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

cnt = 0
pjmin = P[0]
for pi in P:
    if pi <= pjmin:
        cnt +=1
        pjmin = pi
        if pi ==1:
            break
print(cnt)
Buggy python submission (verdict: Runtime Error):
def solve():
	s = input()
   	if s[2] == s[3] and s[4] == s[5]:
		print("Yes")
    else:
		print("No")
          
if __name__ == "__main__":
	solve()

Fixed submission:
def solve():
  s = input()
  if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
  else:
    print("No")

  return

if __name__ == "__main__":
  solve()
Buggy python submission (verdict: Runtime Error):
str = input()
a, b = str.split()
a, b = int(a), int(b)

print(len(str(int(a, b))))


Fixed submission:
a, b = input().split()
a, b = int(a), int(b)
 
digit = 0
for i in range(100):
  if a <= b ** i - 1:
    digit = i
    break
    
print(digit)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
 
def com(n, r):
  return factorial(n) // factorial(n - r) // factorial(r)
 
n, a, b = [int(s) for s in input().split()]
 
print((2**n - com(n, a) - com(n, b) - 1) % (10**9 + 7))

Fixed submission:
import functools

def get_mul_inverse(x: int, p: int) -> int:
    return iterative_square(x, p - 2, p)

def _iterative_square(x: int, n: int, p: int) -> int:
    if n <= 1:
        return x
    div, mod = divmod(n, 2)
    return (((iterative_square(x, div, p) ** 2) % p) * x ** mod) % p

def iterative_square(x: int, n: int, p: int) -> int:
    if n <= 0:
        return None

    return _iterative_square(x, n, p)

def factorial(a, b, p):
  x = 1

  x = functools.reduce(lambda x, y: (x * y) % p, range(a, b + 1), 1)
  return x

def com(n, r, p):
  fact_div_r = get_mul_inverse(factorial(1, r, p), p)

  _result = factorial(n - r + 1, n, p)
  result = (_result * fact_div_r) % p
  
  return result


n, a, b = [int(i) for i in input().split()]
p = 10**9 + 7


pow_2_n_1 = iterative_square(2, n, p) - 1

_result = pow_2_n_1 - com(n, a, p)

_result = _result - com(n, b, p)

result = _result % p
print(result)

Buggy python submission (verdict: Runtime Error):
from math import factorial

def com(n, r):
  return factorial(n) // facotrial(n - r) // factorial(r)

n, a, b = [int(s) for s in input().split()]

print((2**n - com(n, a) - com(n, b) - 1) % (10**9 + 7))

Fixed submission:
import functools

def get_mul_inverse(x: int, p: int) -> int:
    return iterative_square(x, p - 2, p)

def _iterative_square(x: int, n: int, p: int) -> int:
    if n <= 1:
        return x
    div, mod = divmod(n, 2)
    return (((iterative_square(x, div, p) ** 2) % p) * x ** mod) % p

def iterative_square(x: int, n: int, p: int) -> int:
    if n <= 0:
        return None

    return _iterative_square(x, n, p)

def factorial(a, b, p):
  x = 1

  x = functools.reduce(lambda x, y: (x * y) % p, range(a, b + 1), 1)
  return x

def com(n, r, p):
  fact_div_r = get_mul_inverse(factorial(1, r, p), p)

  _result = factorial(n - r + 1, n, p)
  result = (_result * fact_div_r) % p
  
  return result


n, a, b = [int(i) for i in input().split()]
p = 10**9 + 7


pow_2_n_1 = iterative_square(2, n, p) - 1

_result = pow_2_n_1 - com(n, a, p)

_result = _result - com(n, b, p)

result = _result % p
print(result)
Buggy python submission (verdict: Runtime Error):
from fractions import lcm

def solve():
    a, b = list(map(int, input().split()))
    print(lcm(a, b))

if __name__ == "__main__":
    solve()

Fixed submission:
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def solve():
    a, b = list(map(int, input().split()))
    print(lcm(a, b))

if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
import math
def lcm(a, b):
    return a * b // math.gcd(a, b)

def solve():
    a, b = list(map(int, input().split()))
    print(lcm(a, b))

if __name__ == "__main__":
    solve()

Fixed submission:
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def solve():
    a, b = list(map(int, input().split()))
    print(lcm(a, b))

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        break
if idx == n - 2:
    print('YES')

Fixed submission:
s,t = input().split()
a,b = list(map(int, input().split()))
u = input()

if u == s:
    a -= 1
if u == t:
    b -= 1
print("{} {}".format(a,b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
a =set(a)
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        break
if idx == n - 2:
    print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
flag = True
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        flag= False
        break
if flag:
    print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for idx, i in enumerate(a):
    if i in a[idx+1:]:
        print('NO')
        break
if idx == n - 1:
    print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
flag = True
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        flag= False
        break
if flag:
    print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for idx, i in enumerate(a):
    if i in a[idx+1:]:
        print('NO')
        break
if idx == n - 1:
    print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
flag = True
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        flag= False
        break
if flag:
    print('YES')
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	N, M=map(int, input().split())
	a=[]
	b=[]
	for i in range(M):
		x,y=[int(i) for i in input().split()]
		a.append(x)
		b.append(y)
		n=[]
		for j in range(N):
			n.append(0)

	for i in range(N):
		n[a[i]-1]+=1
		n[b[i]-1]+=1

	flag = 0
	for i in range(N):
		if(n[i]%2==1):
			flag +=1

	if(flag<2):
		print('YES')
	else:
		print('NO')

Fixed submission:
if __name__ == '__main__':
	N, M=map(int, input().split())

	n=[]
	for j in range(N):
		n.append(0)

	for i in range(M):
		a,b=[int(i) for i in input().split()]
		n[a-1]+=1
		n[b-1]+=1

	flag = 0
	for i in range(N):
		if(n[i]%2==1):
			flag +=1

	if(flag<2):
		print('YES')
	else:
		print('NO')
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
a += k
l = 0
for i in range(n+1):
  l = max(l, a[i+1]-a[i])
 
print(k-l)

Fixed submission:
# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
distance = []
for i in range(len(a)):
  if i == len(a) - 1:
    distance.append(k+a[0] - a[i])
  else:
  	distance.append(a[i+1] - a[i])
distance.sort()
print(sum(distance[:-1]))

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
a += k
for i in range(n+1):
  l = max(l, a[i+1]-a[i])

print(k-l)

Fixed submission:
# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
distance = []
for i in range(len(a)):
  if i == len(a) - 1:
    distance.append(k+a[0] - a[i])
  else:
  	distance.append(a[i+1] - a[i])
distance.sort()
print(sum(distance[:-1]))
Buggy python submission (verdict: Runtime Error):
n,y = map(int, input().strip().split())
a_x, a_y, a_z = -1, -1, -1
for xi in range(n + 1):
  for yi in range(n - xi + 1):
    zi = n - xi - yi
    if 10000*xi + 5000*yi + 1000*zi == y:
      a_x = xi
      a_y = yi
      a_z = zi
      break
 
print(a_x, a_y, a_z)

Fixed submission:
# -*- coding:utf-8 -*-



def main():
  n = int(input())
  tmp = {}
  for i in range(n):
    x = int(input())
    if x in tmp.keys():
      tmp[x] += 1
    else:
      tmp[x] = 0
  print(len(tmp))
    
  
if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += int(n % 10)
    n = n //10
  return sum
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)
 
    
if __name__=="__main__":
  main()
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += int(n % 10)
    n = (n //10)
  return sum
   
 
  
def main():
  n, a, b = map(int, list(input().strip().split()))
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)
 
    
if __name__=="__main__":
  main()


Fixed submission:
def sum_digits(n):
  sum_ = 0
  while(n > 0):
    sum_ += (n % 10)
    n = (n // 10)
  return sum_
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(1, n+1):
    tmp = sum_digits(i)
    
    if (tmp >= a) & (tmp <= b):
      total += i
  print(total)
 
    
if __name__=="__main__":
  main()

Buggy python submission (verdict: Runtime Error):
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += n % 10
    n /= 10
  return sum
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)
 
    
if __name__=="__main__":
  main()

Fixed submission:
def sum_digits(n):
  sum_ = 0
  while(n > 0):
    sum_ += (n % 10)
    n = (n // 10)
  return sum_
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(1, n+1):
    tmp = sum_digits(i)
    
    if (tmp >= a) & (tmp <= b):
      total += i
  print(total)
 
    
if __name__=="__main__":
  main()

Buggy python submission (verdict: Runtime Error):

def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += n % 10
    n /= 10
  return sum
   

  
def main():
  n, a, b = map(int, input())
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)

    
if __name__=="__main__":
  main()
    

Fixed submission:
def sum_digits(n):
  sum_ = 0
  while(n > 0):
    sum_ += (n % 10)
    n = (n // 10)
  return sum_
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(1, n+1):
    tmp = sum_digits(i)
    
    if (tmp >= a) & (tmp <= b):
      total += i
  print(total)
 
    
if __name__=="__main__":
  main()
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-7 -*-
r, g, b = map(int, input().strip().split())

if (r*100 + g*10 +b) % 4 == 0:
  print('YES')
else:
  print('NO')

Fixed submission:
# -*- coding:utf-8 -*-
r, g, b = map(int, input().strip().split())
 
if (r*100 + g*10 +b) % 4 == 0:
  print('YES')
else:
  print('NO')