Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = map(int input().split())
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))

Fixed submission:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = [0 for i in range(n)]
for a in a_list:
    nl[a-1] += 1
for i in nl:
    print("{}".format(i))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = [i for i in input().split()]

for i in range(n):
    print("{}".format(a_list.count(str(i+1))))

Fixed submission:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = [0 for i in range(n)]
for a in a_list:
    nl[a-1] += 1
for i in nl:
    print("{}".format(i))
Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0 and len(number) != 1:
        print("-1")
    else:
        for i, index in enumerator(number):
            if index == -1:
                if i == 0:
                    index = 1
                else:
                    index = 0
            print(index, end="")

Fixed submission:
n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0:
        if len(number) != 1:
            print("-1")
        else:
            print("0")
    else:
        for i, index in enumerate(number):
            if index == -1:
                if i == 0 and len(number) != 1:
                    index = 1
                else:
                    index = 0
            print(index, end="")

Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0 and len(number) != 1:
        print("-1")
    else:
        for i, index in enumrator(number):
            if index == -1:
                if i == 0:
                    index = 1
                else:
                    index = 0
            print(index, end="")

Fixed submission:
n, m = [int(i) for i in input().split(' ')]
c_list = []
for i in range(m):
    c_list.append([int(i) for i in input().split(' ')])
number = [-1 for i in range(n)]
for line in c_list:
    if number[line[0] - 1] == -1:
        number[line[0] - 1] = line[1]
    else:
        if number[line[0] - 1] == line[1]:
            continue
        else:
            print("-1")
            break
else:
    if number[0] == 0:
        if len(number) != 1:
            print("-1")
        else:
            print("0")
    else:
        for i, index in enumerate(number):
            if index == -1:
                if i == 0 and len(number) != 1:
                    index = 1
                else:
                    index = 0
            print(index, end="")
Buggy python submission (verdict: Runtime Error):
a, b, k = [int(i) for i in input().split(' ')]
if(k>a):
    k -= a
    a = 0
    if(k>b):
        b = 0
    else:
        b -= k
print(f'{a} {b}')

Fixed submission:
a, b, k = [int(i) for i in input().split(' ')]
if(k>a):
    k -= a
    a = 0
    if(k>b):
        b = 0
    else:
        b -= k
else:
    a -= k
print(str(a) + ' ' + str(b))
Buggy python submission (verdict: Runtime Error):
n = input()
list_v = list(map(int, input.split()))
list_c = list(map(int, input.split()))

max_value = 0

for i in range(n):
    if list_v[i]>list_c[i]:
        max_value = max_value + (list_v[i]-list_c[i])
        
print(max_value)

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

max_value = 0

for i in range(n):
    if list_v[i]>list_c[i]:
        max_value = max_value + (list_v[i]-list_c[i])

print(max_value)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int(input().split()))
s = 0
for i in range(n):
    x = sum(list(map(int,str(i).split())))
    if a <= x and x <= b:
        s += x
print(s)


Fixed submission:
n,a,b = map(int,input().split())
s = 0
for i in range(n):
    x = sum(list(map(int,str(i+1))))
    if a <= x and x <= b:
        s += i+1
print(s)

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int(input().split()))
s = 0
for i in range(n):
    x = sum(list(map(int,str(i).split())))
    if a <= x && x <= b:
        s += x
print(s)


Fixed submission:
n,a,b = map(int,input().split())
s = 0
for i in range(n):
    x = sum(list(map(int,str(i+1))))
    if a <= x and x <= b:
        s += i+1
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

mod_ini = 7%K
mod = 0
cnt = 0

while True:
    if K%2 == 0:
        print(-1)
        break
    
    cnt += 1
    mod = (mod*10 + 7)%K
    #print(mod)
    
    if mod == 0:
        print(cnt)
        break
    elif mod == mod_ini and cnt != 1:
        print(-1)
        break
    

Fixed submission:
K = input()
K_1 = int(K[-1])
K = int(K) 

mod_ini = 7%K
mod = 0
cnt = 0

while True:
    if K%2 == 0 or K_1 == 5:
        print(-1)
        break
    
    cnt += 1
    mod = (mod*10 + 7)%K
    #print(mod)
    
    if mod == 0:
        print(cnt)
        break
    elif mod == mod_ini and cnt != 1:
        print(-1)
        break

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

mod_ini = 7%K
mod = 0
cnt = 0

while True:
    cnt += 1
    mod = (mod*10 + 7)%K
    #print(mod)
    
    if mod == 0:
        print(cnt)
        break
    elif mod == mod_ini and cnt != 1:
        print(-1)
        break

Fixed submission:
K = input()
K_1 = int(K[-1])
K = int(K) 

mod_ini = 7%K
mod = 0
cnt = 0

while True:
    if K%2 == 0 or K_1 == 5:
        print(-1)
        break
    
    cnt += 1
    mod = (mod*10 + 7)%K
    #print(mod)
    
    if mod == 0:
        print(cnt)
        break
    elif mod == mod_ini and cnt != 1:
        print(-1)
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
SUM = 1
flag = 0
         
for a in A:
  SUM = SUM*a


if SUM > 10**18:
  print(-1)
else:
  print(SUM)

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

ans = 1
for x in A:
    ans *= x
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list( map(int, input().split()) )
A = []
for m in range(M):
    A.append( list( map(lambda x: x-1, list(map(int, input().split()))) ) )
    
K = [i for i in range(N)]

for m in range(M):
    if A[m][0] in K:
        if H[ A[m][1] ] >= H[ A[m][0] ]:
            K.remove(A[m][0])
            
    if A[m][1] in K:
        if H[ A[m][0] ] >= H[ A[m][1] ]:
            K.remove(A[m][1])
            
print(len(K))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 08:53:27 2020

@author: asaka
"""

N, M = map(int, input().split())
H = list( map(int, input().split()) )
A = []
for m in range(M):
    A.append( list( map(lambda x: x-1, list(map(int, input().split()))) ) )
    
K = [1]*N

for m in range(M):
    if H[ A[m][1] ] >= H[ A[m][0] ] and K[A[m][0]] ==1 :
        K[A[m][0]] -= 1
            
    if H[ A[m][0] ] >= H[ A[m][1] ] and K[A[m][1]] ==1:
        K[A[m][1]] -= 1
            
print(sum(K))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
i = 0

for n in range(N):
    f = input()
    if f in S:
        continue
    else:
        S.append(f)
        i += 1
        
print(i)

Fixed submission:
N = int(input())
S = set()

for n in range(N):
    S.add(input())

print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
S = input()
S_No = []

for n in range(N):
    S_No.append( (n, S[n]) )
    
ans = 0

C = list(itertools.combinations(S_No ,3))

for c in C:
    if c[0][1] != c[1][1] and c[0][1] != c[2][1] and c[1][1] != c[2][1] and c[1][0] - c[0][0] != c[2][0] - c[1][0] :
        ans += 1

print(ans)
        

Fixed submission:
N = int(input())
S = input()

A = [0]*3

for s in S:
    if s == "R":
        A[0] += 1
    elif s =="G":
        A[1] += 1
    elif s == "B":
        A[2] += 1
        
ans = 1

for a in A:
    ans *= a

for i in range(N-1):
    for j in range(i+1, N):
        k = 2*j - i
        if(k >= N):
            continue
        if(S[j] != S[i] and S[j] != S[k] and S[i] != S[k]):
            ans -= 1
            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

sum = 0
A.sort(reverse=False)

for i in range(N):
    for j in range(N-(i+1)):
        sum += A[i]*A[j+i+1]

print(sum%((10**9)+7))


Fixed submission:

n = int(input())
A = list(map(int, input().split()))


mod = 10**9+7
s = sum(A)

ans = 0

for i in range(n):
    s -= A[i]
    ans += (A[i] * s) % mod

print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):

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

sum = 0
A.sort(reverse=False)

for i in range(N):
    for j in range(N-(i+1)):
        sum += A[i]*A[j+i+1]

print(sum%((10**9)+7))

Fixed submission:

n = int(input())
A = list(map(int, input().split()))


mod = 10**9+7
s = sum(A)

ans = 0

for i in range(n):
    s -= A[i]
    ans += (A[i] * s) % mod

print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

ans = 0

while n > 0:
    ans += n % 10
    n //= 10

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:

n = int(input())

ans = 0

l = [int(x) for x in list(str(n))]
ans = sum(l)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

ans = 0

while n != 0:
    ans += n % 10
    n //= 10

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:

n = int(input())

ans = 0

l = [int(x) for x in list(str(n))]
ans = sum(l)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):

n = int(input())

ans = 0

while n != 0:
    ans += n % 10
    n = int(n/10)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:

n = int(input())

ans = 0

l = [int(x) for x in list(str(n))]
ans = sum(l)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):

n = int(input())

ans = 0

while n != 0:
    ans += n % 10
    n = int(n/10)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:

n = int(input())

ans = 0

l = [int(x) for x in list(str(n))]
ans = sum(l)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)
    print(ans)

print(ans)

Fixed submission:

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

num = 0

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


for i in range(n):
    i +=1
    f = len(make_divisors(i))
    num += f*i

print(num)

Fixed submission:

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

num = 0

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


for i in range(n):
    i +=1
    f = len(make_divisors(i))
    num += f*i

print(num)

Fixed submission:

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)

print(ans)

Buggy python submission (verdict: Runtime Error):

import sympy

n = int(input())

num = 0

for i in range(n):
    i +=1
    f = sympy.divisor_count(i)
    num += f*i

print(num)

Fixed submission:

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

for i in range(1, n+1):
    ans += calc(i, n//i * i)

print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
lst = list(map(int, input().split()))
i = 1
cnt = 0
a = lst[0]
while True:
    b = lst[i]
    if b < a:
        cnt += abs(b - a)
        a = a
    else:
        a = b
    if i == x - 1:
        break
    i += 1
print(cnt)

Fixed submission:
x = int(input())
lst = list(map(int, input().split()))
i = 1
cnt = 0
a = lst[0]
if x == 1:
    print(0)
else:
    while True:
        b = lst[i]
        if b < a:
            cnt += abs(b - a)
            a = a
        else:
            a = b
        if i >= x - 1:
            break
        i += 1
    print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_lst = list(map(int, input().split()))
ans = []
for i in range(1,n+1):
    ans.append(str(a_lst.index(i)+1))
print(' '.join(ans))

Fixed submission:
n = int(input())
a_lst = list(map(int, input().split()))
lst = []
for i,a in enumerate(a_lst):
    lst.append([i+1,a])
ans = []
for l in sorted(lst, key=lambda x:x[1]):
    ans.append(l[0])
print(' '.join(map(str,ans)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_lst = list(map(int, input().split()))
cnt = 0
res = 0
left = 0
for i, h1 in enumerate(h_lst):
  left = h1
  while i <= len(h_lst)-2 and left >= h_lst[i+1]:
    cnt+=1
    left = h_lst[i+1]
    i+=1
  res = max(res, cnt)
  cnt = 0
print(res)

Fixed submission:
n = int(input())
h_lst = list(map(int, input().split()))
cnt = 0
res = 0
for i, left in enumerate(h_lst):
  if i <= len(h_lst)-2 and left >= h_lst[i+1]:
    cnt +=1
  else:
    res = max(res, cnt)
    cnt = 0
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_lst = [e for e in range(1,n+1)]
first, last = 1, n-1
res = (n-1)*(first+last)/2
print(int(res))

Fixed submission:
n = int(input())
first, last = 1, n-1
res = (n-1)*n//2
print(int(res))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_lst = [e for e in range(1,n+1)]
lst = [p_lst[-1]] + p_lst[0:-1]
res = 0
for i, e in enumerate(lst):
  r = e%(i+1)
  res += r
print(res)

Fixed submission:
n = int(input())
first, last = 1, n-1
res = (n-1)*n//2
print(int(res))
Buggy python submission (verdict: Runtime Error):
x,a  = [int(e) for e in input().split()]
if x < a:
  return 0
else:
  return 10

Fixed submission:
x,a  = [int(e) for e in input().split()]
if x < a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
lst = list(map(int, input().split()))
res = []
for i in range(k):
  throwaways = i
  take = k - throwaways
  # throwaways cannot be larger than take
  if throwaways > take:
    break
  for j in range(take+1):
    right = lst[:j]
    if len(right) < take:
      l = take - len(right)
      left = lst[l*-1:]
    else:
      left = []
    m_lst = sorted(right + left)
    for t in range(throwaways):
      del m_lst[0]
    res.append(m_lst)
max_num = max([sum(e) for e in res])
if max_num <= 0:
  print(0)
else:
  print(max_num)

Fixed submission:
n, k = map(int, input().split())
lst = list(map(int, input().split()))
res = []
for i in range(min(k, len(lst))):
  throwaways = i
  take = min(k - throwaways, len(lst))
  # throwaways cannot be larger than take
  if throwaways > take:
    break
  for j in range(take+1):
    right = lst[:j]
    if len(right) < take:
      l = take - len(right)
      left = lst[l*-1:]
    else:
      left = []
    m_lst = sorted(right + left)
    for t in range(throwaways):
      # throw away if it's value is negative
      if m_lst[0] < 0:
        del m_lst[0]
    res.append(m_lst)
max_num = max([sum(e) for e in res])
if max_num <= 0:
  print(0)
else:
  print(max_num)
Buggy python submission (verdict: Runtime Error):
l_lst, r_lst = [], []
for i in range(m):
  l,r = map(int, input().split())
  l_lst.append(l)
  r_lst.append(r)
res = min(r_lst)-max(l_lst)+1
if res > 0:
  print(res)
else:
  print(0)

Fixed submission:
n,m = map(int, input().split())
l_lst, r_lst = [], []
for i in range(m):
  l,r = map(int, input().split())
  l_lst.append(l)
  r_lst.append(r)
res = min(r_lst)-max(l_lst)+1
if res > 0:
  print(res)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
keys = []
for i in range(m):
  l,r = map(int, input().split())
  keys.append([l,r])
cnt = 0
for key in range(1, n+1):
  for x, y in keys:
    if key < x or key > y:
      cnt -= 1
      break
  cnt += 1
print(cnt)

Fixed submission:
n,m = map(int, input().split())
l_lst, r_lst = [], []
for i in range(m):
  l,r = map(int, input().split())
  l_lst.append(l)
  r_lst.append(r)
res = min(r_lst)-max(l_lst)+1
if res > 0:
  print(res)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
keys = []
for i in range(m):
  l,r = map(int, input().split())
  keys.append(set(range(l,r+1)))
print(len(set.intersection(*keys)))

Fixed submission:
n,m = map(int, input().split())
l_lst, r_lst = [], []
for i in range(m):
  l,r = map(int, input().split())
  l_lst.append(l)
  r_lst.append(r)
res = min(r_lst)-max(l_lst)+1
if res > 0:
  print(res)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
m,k = map(int, input().split())
s = input()
s = s[:k] + s[k].lower() + s[k+1:]
print(s)

Fixed submission:
m,k = map(int, input().split())
s = input()
i = k-1
s = s[:i] + s[i].lower() + s[i+1:]
print(s)

Buggy python submission (verdict: Runtime Error):
m,k = map(int, input().split())
s = input()
s[k] = s[k].lower()
print(s)

Fixed submission:
m,k = map(int, input().split())
s = input()
i = k-1
s = s[:i] + s[i].lower() + s[i+1:]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction
n,k = map(int, input().split())
ttl = 0
res = []
for i in range(1,n+1):
  ttl = i
  cnt = 0
  while True:
    if ttl >= k:
      break
    ttl = ttl*2
    cnt+=1
  p = Fraction(1,n)*Fraction(1,2)**cnt
  res.append(p)
ans = sum(res)
print(float(ans))

Fixed submission:
n,k = map(int, input().split())
ttl = 0
res = []
for i in range(1,n+1):
  ttl = i
  cnt = 0
  while True:
    if ttl >= k:
      break
    ttl = ttl*2
    cnt+=1
  p = 0.5**cnt
  res.append(p)
ans = sum(res)/n
print(float(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction
n,k = map(int, input().split())
ttl = 0
res = []
for i in range(1,n+1):
  ttl = i
  cnt = 0
  while True:
    if ttl >= k:
      break
    ttl = ttl*2
    cnt+=1
  res.append(cnt)
ans = sum([Fraction(1,n)*Fraction(1,2)**e for e in res])
print(float(ans))

Fixed submission:
n,k = map(int, input().split())
ttl = 0
res = []
for i in range(1,n+1):
  ttl = i
  cnt = 0
  while True:
    if ttl >= k:
      break
    ttl = ttl*2
    cnt+=1
  p = 0.5**cnt
  res.append(p)
ans = sum(res)/n
print(float(ans))
Buggy python submission (verdict: Runtime Error):
A,B,C = input()
if A == B == C:
  print('Yes')
else:
  print('No')

Fixed submission:
A,B,C = input().split()
if A == B == C:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
R = len([e for e in s if e == 'R'])
B = len(s) - R
if R > B:
  return 'Yes'
else:
  return 'No'

Fixed submission:
n = input()
s = input()
R = len([e for e in s if e == 'R'])
B = len(s) - R
if R > B:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int, input().split())
s = input()
for _ in range(q):
    l,r = map(int,input().split())
    ss = s[l-1:r]
    cnt = len([e for e in ss.replace('AC', '1') if e == '1'])
    print(cnt)

Fixed submission:
n,q = map(int, input().split())
s = input()
lst = []
num = 0
for i in range(n):
    if i == 0:
        lst.append(num)
        continue
    ss = s[i-1:i+1]
    if ss == 'AC':
        num += 1
    lst.append(num)
for _ in range(q):
    l,r = map(int,input().split())
    ans = lst[r-1] - lst[l-1]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans = 0
while True:
    beore = len(S)
    S = S.replace('01', '').replace('10','')
    after = len(S)
    if beore == after:
        break
    else:
        ans += beore-after
print(ans)

Fixed submission:
S = input()
ans = 2*min(S.count('0'),S.count('1'))
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(raw_input())
y = int(raw_input())
print x+y/2

Fixed submission:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
x, y = na()
print(x+y//2)

Buggy python submission (verdict: Runtime Error):
x = int(raw_input())
y = int(raw_input())
print(x+y/2)

Fixed submission:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
 
x, y = na()
print(x+y//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
sum1 = 0
for i in range(n):
  for j in range(i+1, n):
    sum1 += a[i] * a[j]
print(sum1 % (10**9 + 7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sum1 = sum(a)
sum2 = 0
for i in range(n):
  sum2 += a[i] ** 2
sum3 = (sum1 * sum1 - sum2) // 2
print(sum3 % (10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())
add_list = []
for i in range(k//2+1):
  num = k - 2*i
  add_list.append(d * num)
answer = float('inf')
for add in add_list:
  answer = min(abs(x + add), abs(x - add), answer)
print(answer)

Fixed submission:
x, k, d = map(int, input().split())
x_abs = abs(x)
if x_abs - k * d >= 0:
  print(x_abs - k * d)
else:
  kk = k - x_abs // d
  x_now = x_abs - (k - kk) * d
  if kk % 2 == 0:
    print(x_now)
  else:
    print(abs(x_now - d))

Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())
dp = [[float('inf'), float('inf')] for i in range(k+1)]
dp[0] = [x, x]
for i in range(k):
  if abs(dp[i][0] + k) < abs(dp[i][1] + k):
    dp[i+1][0] = dp[i][0] + d
  else:
    dp[i+1][0] = dp[i][1] + d
  if abs(dp[i][0] - k) < abs(dp[i][1] - k):
    dp[i+1][1] = dp[i][0] - d
  else:
    dp[i+1][1] = dp[i][1] - d
if abs(dp[k][0]) < abs(dp[k][1]):
  print(abs(dp[k][0]))
else:
  print(abs(dp[k][1]))

Fixed submission:
x, k, d = map(int, input().split())
x_abs = abs(x)
if x_abs - k * d >= 0:
  print(x_abs - k * d)
else:
  kk = k - x_abs // d
  x_now = x_abs - (k - kk) * d
  if kk % 2 == 0:
    print(x_now)
  else:
    print(abs(x_now - d))