Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
while(True):
  n=int(input())
  mns=list(map(int,input().split()))
  hrs=list(map(int,input().split()))
  mk=0
  for i in range(n):
    if(hrs[i]>=mns[i]+mns[i+1]):
      mk+=mns[i]+mns[i+1]
      mns[i]=0
      mns[i+1]=0
    else:
      if(hrs[i]<=mns[i]):
        mk+=hrs[i]
      else:
        mk+=hrs[i]
        mns[i+1]-=(hrs[i]-mns[i])
  print(mk)


Fixed submission:

n=int(input())
mns=list(map(int,input().split()))
hrs=list(map(int,input().split()))
mk=0
for i in range(n):
  if(hrs[i]>=mns[i]+mns[i+1]):
    mk+=mns[i]+mns[i+1]
    mns[i]=0
    mns[i+1]=0
  else:
    if(hrs[i]<=mns[i]):
      mk+=hrs[i]
    else:
      mk+=hrs[i]
      mns[i+1]-=(hrs[i]-mns[i])
print(mk)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

if __name__ == '__main__':
    N = int(input())
    colors = [
        10000000000
    ]
    # R = [0 for i in range(N)]
    # M = 0

    for i in range(N-1, -1, -1):
        # print('i={}'.format(i))
        a = int(input())
        for j in range(len(colors)):
            if a < colors[j]:
                colors[j] = a
                break
        else:
            colors.append(
                a
            )

    print(len(colors))


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



if __name__ == '__main__':
    r = int(input())
    area = 3 * r * r
    print(area)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

if __name__ == '__main__':
    N = int(input())
    A = []
    current_max = -1
    for i in range(N):
        A.append(int(input()))

    index = sorted(range(len(A)), key=lambda k: A[k])
    value = sorted(A)

    # print(A)

    for i in range(N):
        if index[i] < N-1:
            print(value[N-1])
        else:
            print(value[N-2])

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



if __name__ == '__main__':
    r = int(input())
    area = 3 * r * r
    print(area)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import math

if __name__ == '__main__':
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))

    for i in range(N):
        b = A[:i] + A[i+1:]
        print(max(b))


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

import math

if __name__ == '__main__':
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))

    value = sorted(A)
    first = value[N-1]
    second = value[N-2]


    # print(A)

    for i in range(N):
        if A[i] != first:
            print(first)
        else:
            print(second)
Buggy python submission (verdict: Runtime Error):
A , B = map(int, input().split())

temp = A+B
if temp%2 == 0:
  K = int(temp/2)
else:
  print("IMPOSSIBLE")
print(K)

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

temp = A+B
if temp%2 == 0:
  K = int(temp/2)
  print(K)
else:
  print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
large = max(a, b)
ans = 0

for i in range((a+b)//2, large):
	if abs(a - i) == abs(b - i):
		ans = i
		break

if ans == 0:
	print("IMPOSSIBLE")
else:
	print(ans)


Fixed submission:
a, b = map(int, input().split())
large = max(a, b)
ans = ((a + b) / 2)

if ans.is_integer():
	print(int(ans))
else:
	print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
large = max(a, b)
ans = 0

for i in range(large//2, large):
	if abs(a - i) == abs(b - i):
		ans = i
		break

if ans == 0:
	print("IMPOSSIBLE")
else:
	print(ans)


Fixed submission:
a, b = map(int, input().split())
large = max(a, b)
ans = ((a + b) / 2)

if ans.is_integer():
	print(int(ans))
else:
	print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
large = max(a, b)
ans = 0

for i in range(large):
	if abs(a - i) == abs(b - i):
		ans = i
		break

if ans == 0:
	print("IMPOSSIBLE")
else:
	print(ans)


Fixed submission:
a, b = map(int, input().split())
large = max(a, b)
ans = ((a + b) / 2)

if ans.is_integer():
	print(int(ans))
else:
	print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = np.array(range(L, R+1))
    tmp2 = []
    for i in range(len(tmp)):
        for j in range(i+1, len(tmp)):
            tmp2.append((tmp[i] * tmp[j]) % 2019)
    print(min(tmp2))


Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp.append((i * j) % 2019)
    print(min(tmp))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = np.array(range(L, R+1))
    tmp = tmp % 2019
    tmp = np.sort(tmp)

print(tmp[0] * tmp[1])

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp.append((i * j) % 2019)
    print(min(tmp))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp.append((i * j) % 2019)
    print(min(tmp))


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

N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])

r = map(str, r)
print(" ".join(r))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

r = []
for i in range(N):
    if i%2 == 0:
        tmp = sum(A[i::2])
        tmp -= sum(A[i+1::2])
        tmp -= sum(A[0:i:2])
        tmp += sum(A[1:i:2])
    else:
        tmp = sum(A[i::2])
        tmp -= sum(A[i+1::2])
        tmp -= sum(A[1:i:2])
        tmp += sum(A[0:i:2])

    r.append(str(tmp))

print(" ".join(r))

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

N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])

r = map(str, r)
print(" ".join(r))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

r = []
for i in range(N):
    flag = True
    tmp = 0
    for j in range(N):
        if flag: tmp += A[(i+j)%N]
        else: tmp -= A[(i+j)%N]
        flag = not flag
    r.append(tmp)

r = map(str, r)
print(" ".join(r))

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

N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])

r = map(str, r)
print(" ".join(r))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))

Fixed submission:
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    if i <= N-K+1:
        print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))
    else:
        print(0)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) % (10**9 + 7)

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i))

Fixed submission:
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    if i <= N-K+1:
        print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))
    else:
        print(0)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return int(factorial(n) / (factorial(r) * factorial(n - r)) % (10**9 + 7))

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i))

Fixed submission:
# -*- coding: utf-8 -*-
from math import factorial

N, K= map(int, input().split())

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    if i <= N-K+1:
        print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
lights = [map(int, input().split()[1:]) for i in range(M)]
p = map(int, input().split())

combi = 0
for i in range(1<<N):
    flag = True
    for j, switch in enumerate(lights):
        if sum([1 for s in switch if (i>>(s-1)) & 1 == 1])%2 != p[j]:
            flag = False
            break
    if flag:
        combi += 1

print(combi)

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

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])

lights = []
for i in range(M):
    switch = input().split(' ')[1:]
    switch = [int(s) for s in switch]
    lights.append(switch)

p = input().split(' ')
p = [int(x) for x in p]

combi = 0
for i in range(2**N):
    i = str(bin(i)).split('0b')[1]
    if len(i) < N:
        i = '0'*(N-len(i)) + i
    flag = True
    for j, switch in enumerate(lights):
        on = 0
        for s in switch:
            if i[s-1] == '1':
                on += 1
        if (on%2) != p[j]:
            flag = False
            break
    if flag:
        combi += 1

print(combi)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])

inputs = input().split(' ')
L = int(inputs[0])
R = int(inputs[1])
res = {x for x in range(L, R+1)}
for _ in range(M-1):
    inputs = input().split(' ')
    L = int(inputs[0])
    R = int(inputs[1])
    tmp = {x for x in range(L, R+1)}
    res = res & tmp

print(len(res))

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

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])

maxL = 1
minR = 100000
for _ in range(M):
    inputs = input().split(' ')
    L = int(inputs[0])
    R = int(inputs[1])
    if L > maxL:
        maxL = L
    if R < minR:
        minR = R

if minR < maxL:
    print(0)
else:
    print(minR - maxL + 1)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=(a+b)//2
k=(a+b)/2
if(c==k):
    print(k)
else:
    print("IMPOSSIBLE")


Fixed submission:
a,b=[int(x) for x in input().split()] 
c=(a+b)/2
k=(a+b)//2
if(k==c):
  if(abs(a-k)==abs(b-k)):
     print(k)
else:
     print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print("{}".format((3A+b)/2))

Fixed submission:
a, p = map(int, input().split())
c = int((3*a+p) / 2)
print("{}".format(c))

Buggy python submission (verdict: Runtime Error):
printf((3A + P)/2)

Fixed submission:
a, p = map(int, input().split())
c = int((3*a+p) / 2)
print("{}".format(c))
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
a, b = int(a), int(b)
if (a + b) % 2 == 0:
  	print((a + b) // 2)
else:
  	print("IMPOSSIBLE")

Fixed submission:
a, b = input().split()
a, b = int(a), int(b)
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

h = []
a = 1
b = 0
mod = 10 ** 9 + 7

for i in range(m):
    h += [int(input()),]

for i in range(1,n+1):
    if i in h:
        a,b = 0,a
    else:
        a,b = a + b,a
        a %= mod
        

print(a % mod)

Fixed submission:
n,m = map(int,input().split())
 
h = []
a = 1
b = 0
mod = 10 ** 9 + 7
 
for i in range(m):
    h += [int(input()),]
h += [0,]
    
cur = 0
for i in range(1,n):
    if i == h[cur]:
        a,b = 0,a
        cur += 1
    else:
        a,b = a + b,a
        a %= mod

print((a + b) % mod)
Buggy python submission (verdict: Runtime Error):
n, a, b, c ,d = map(int, input().split())
# s = input()[:max(c,d)]

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[c:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d-1]:
            return "Yes"
                
        return "No"

print(main())

Fixed submission:
n, a, b, c ,d = map(int, input().split())
s = input()[:max(c,d)]

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[a:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"

print(main())

Buggy python submission (verdict: Runtime Error):
n, a, b, c ,d = map(int, input().split())

flag = 1

def main():
    for i in range(len(s[b:d-2])):
        if s[i:i+2] == "##":
            return "No"
    for i in range(len(s[a:c-2])):
        if s[i:i+2] == "##":
            return "No"

    if c < d:
        return "Yes"
    
    else:

        if s[b-2] == "." and s[b] == ".":
            return "Yes"
        else:
            for i in range(len(s[b:d-3])):
                if s[i:i+3] == "...":
                    return "Yes"
                    
            return "No"

print(main())

Fixed submission:
n, a, b, c ,d = map(int, input().split())
s = input()[:max(c,d)]

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[a:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"

print(main())
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8
 
n,m = map(int,input().split())
 
s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]
 
p = list(map(int,input().split()))
 
ret = 0
all = [(str(bin(i)))[2:].zfill(n) for i in range(2 ** n)]
all = [[int(i) for i in case] for case in all]
for case in all:
    flag = 0
    for num,i in enumerate(s):
 
        sw = [0 for z in range(n)]
        for k in i[1:]:
            sw[k-1] = 1
 
        if (sum(i*j for i,j in zip(sw,case)) % 2) != p[num]:
            flag = 1
           
    if flag == 0:
        ret += 1
 
print(ret)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

a,p = input().split()

a = int(a)
p = int(p)

print((3 * a + p) // 2)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8

n,m = map(int,input().split())

s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]

p = list(map(int,input().split()),)

ret = 0
all = [(str(bin(i)))[2:].zfill(m) for i in range(2 ** n),]
all = [[int(i) for i in case] for case in all,]
for case in all:
    # print("------------------------------------------------")
    # print("[case = ",case,"]")
    flag = 0
    for num,i in enumerate(s):
        if flag == 1:
            continue

        # print("  [case = ",i[1:],"]")

        sw = [0 for z in range(n),]
        # print("sw",sw)
        for k in i[1:]:
            sw[k-1] = 1

        # print(sw,case)
        # print(sum(i*j for i,j in zip(sw,case)) % 2," =? ",p[num])
        if (sum(i*j for i,j in zip(sw,case),) % 2) != p[num]:
            flag = 1
        # print("flag is ",flag)
           
    if flag == 0:
        # print(case," is ok.")
        ret += 1

print(ret)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

n,m = map(int,input().split())

s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]

p = list(map(int,input().split()))

ret = 0
all = [(str(bin(i)))[2:].zfill(n) for i in range(2 ** n)]
all = [[int(i) for i in case] for case in all]
for case in all:
    flag = 0
    for num,i in enumerate(s):
        if flag == 1:
            continue

        sw = [0 for z in range(n)]
        for k in i[1:]:
            sw[k-1] = 1

        if (sum(i*j for i,j in zip(sw,case)) % 2) != p[num]:
            flag = 1
           
    if flag == 0:
        ret += 1

print(ret)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8

a, b, c = map(int,input().split("/"))

if a * b == 0:
  print(0)
elif a + b >= c:
  print(b + c)
else:
  print(a + b * 2 + 1)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

a, b, c = map(int,input().split())

if a * b == 0:
  print(0)
elif a + b >= c:
  print(b + c)
else:
  print(a + b * 2 + 1)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())

PY_list = []
for num,i in enumerate(range(M)):
    p,y = map(int, input().split())
    PY_list = PY_list + [(num,p,y),]

rec = []
for i in range(N):
    cities = []
    for k in PY_list:
        if k[1] == i+1:
            cities = cities + [k,]
    cities = sorted(cities, key=lambda x:x[2])

    rec_list = []
    for num,k in enumerate(cities):
        rec_list = rec_list + [(k[0],str(k[1]).zfill(6) + str(num+1).zfill(6)),]

    rec = rec + rec_list
rec = sorted(rec, key=lambda x:x[0])

for s in rec:
    print(s[1])

Fixed submission:
a,b = map(int, input().split())
print(a+(b//2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())

if n == 1:
    print("Hello World")
elif n == 2:
    print(a + b)

Fixed submission:
n = input()

if n == "1":
  print("Hello World")
  
elif n == "2":
  a = int(input())
  b = int(input())
  print(a + b)

Buggy python submission (verdict: Runtime Error):
n = input()
a = int(input())
b = int(input())

if n == "1":
    print("Hello World")
elif n == "2":
    print(a + b)

Fixed submission:
n = input()

if n == "1":
  print("Hello World")
  
elif n == "2":
  a = int(input())
  b = int(input())
  print(a + b)

Buggy python submission (verdict: Runtime Error):
n = input()
a = input()
b = input()

if n == 1:
  print("Hello World")
elif n == 2:
  print(a + b)

Fixed submission:
n = input()

if n == "1":
  print("Hello World")
  
elif n == "2":
  a = int(input())
  b = int(input())
  print(a + b)
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 ** 9 + 7

n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum = 0
for i in range(n-1):
  for j in range(m-1):
    h = x[i+1] - x[i]
    v = y[j+1] - y[j]
    sum = (sum + h*v*(i+1)*(n-i-1)*(j+1)*(m-j-1)) % mod


print(sum % mod)

Fixed submission:
mod = 10 ** 9 + 7

n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum_h = 0
sum_v = 0
for i in range(n-1):
  sum_h += (x[i+1] - x[i])*(i+1)*(n-i-1)
sum_h = sum_h % mod

for j in range(m-1):
  sum_v += (y[j+1] - y[j])*(j+1)*(m-j-1)
sum_v = sum_v % mod

sum = (sum_h * sum_v) % mod

#print(sum_h,sum_v)
print(sum)

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

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum = 0
for i in range(n-1):
  for j in range(m-1):
    h = x[i+1] - x[i]
    v = y[j+1] - y[j]
    sum += h*v*(i+1)*(n-i-1)*(j+1)*(m-j-1)

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

Fixed submission:
mod = 10 ** 9 + 7

n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum_h = 0
sum_v = 0
for i in range(n-1):
  sum_h += (x[i+1] - x[i])*(i+1)*(n-i-1)
sum_h = sum_h % mod

for j in range(m-1):
  sum_v += (y[j+1] - y[j])*(j+1)*(m-j-1)
sum_v = sum_v % mod

sum = (sum_h * sum_v) % mod

#print(sum_h,sum_v)
print(sum)

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

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum = 0
for i in range(n-1):
  for j in range(i+1,n):
    for k in range(m-1):
      for l in range(k+1,m):
        h = x[j] - x[i]
        v = y[l] - y[k]
        
        sum += h*v

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

Fixed submission:
mod = 10 ** 9 + 7

n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum_h = 0
sum_v = 0
for i in range(n-1):
  sum_h += (x[i+1] - x[i])*(i+1)*(n-i-1)
sum_h = sum_h % mod

for j in range(m-1):
  sum_v += (y[j+1] - y[j])*(j+1)*(m-j-1)
sum_v = sum_v % mod

sum = (sum_h * sum_v) % mod

#print(sum_h,sum_v)
print(sum)
Buggy python submission (verdict: Runtime Error):
n = input
l = map(int, input().split())
l = sorted(l)

ans = 0
for i in range(len(n)):
  a = l[2*i]
  b = l[2*i+1]
  ans =+ min(a,b)

print(ans)

Fixed submission:
n = int(input())
l = map(int, input().split())
l = sorted(l)

ans = 0
for i in range(n):
    a = l[2 * i]
    b = l[2 * i + 1]
    ans = ans + min(a, b)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = list(map(int, input().split()))

if a >= b:
    max = a
    min = b
else:
    min = a
    max = b
for num in range(min,max+1):
    if abs(a - num) == abs(b-num):
        print(num)
        exit()
print("IMPOSSIBLE")


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

if a >= b:
    max = a
    min = b
else:
    min = a
    max = b

ans = int((max-min) / 2)
if abs(max - ans) == abs(min + ans):
    print(abs(max-ans))
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n = input() 
v = list(map(int, input().split())) 
c = list(map(int, input().split())) 
otoku = []

for i in range(n):
  otoku.append(v[i] - c[i])

res = 0
for j in range(n):
  if otoku[j] > 0:
    res += otoku[j]
    
print(res)

Fixed submission:
n = int(input(), 10) 
v = list(map(int, input().split())) 
c = list(map(int, input().split())) 
otoku = []
 
for i in range(n):
  otoku.append(v[i] - c[i])
 
res = 0
for j in range(n):
  if otoku[j] > 0:
    res += otoku[j]
    
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

for j in range(b):
 for k in range(b-j):
  c=((a[0] + j ) * (a[0] + j  + k + 1)) % 2019
  if c<=d:
   d=c
  if d==0:
   break

print(d)

Fixed submission:
a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

if b > 2019:
 print(0)
else:
 for j in range(b):
  for k in range(b-j):
    c= ((a[0] + j )* (a[0] + j  + k + 1)) % 2019
    if c<=d:
     d=c
 print(d)

Buggy python submission (verdict: Time Limit Exceeded):
a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

for j in range(b):
 for k in range(b-j):
  c=((a[0] + j ) * (a[0] + j  + k + 1)) % 2019
  if c<=d:
   d=c

print(d)


Fixed submission:
a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

if b > 2019:
 print(0)
else:
 for j in range(b):
  for k in range(b-j):
    c= ((a[0] + j )* (a[0] + j  + k + 1)) % 2019
    if c<=d:
     d=c
 print(d)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
a1 = a // 2
b1=list(input().split( ))
b=list(map(int, b1))
d=[]
for j in range(a):
    e=b[:]
    for k in range(a1):
        c=(j+1+2*k)%a
        e[c]=e[c]*(-1)
    d.append(sum(e))

print(' '.join(map(str, d)))


Fixed submission:
a=int(input())
a1 = a // 2
b1=list(input().split( ))
b=list(map(int, b1))
d=[]

s1=0
for j in range(a1):
    s1 += b[(2*j + 1)]
x1 = sum(b) - 2 * s1
d.append(x1)

for k in range(a-1):
    x = 2 * b[k] - d[k]
    d.append(x)

print(' '.join(map(str, d)))