Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
lis=list(map(int,input().split()))
A=lis[0]
B=lis[1]
C=lis[2]
D=lis[3]
sum=B-A+1
gcd=1
for x in range(C):
  if D%(1+x)==0 and C%(1+x)==0:
    gcd=1+x
times=C*D//gcd
restac=A%C
restbc=B%C
restad=A%D
restbd=B%D
restat=A%times
restbt=B%times
x=int((B-restbc)//C)-int((A-restac)//C)
y=int((B-restbd)//D)-int((A-restad)//D)
z=int((B-restbt)//times)-int((A-restat)//times)
if restac==0:
  x+=1
if restad==0:
  y+=1
if(restat==0):
  z+=1
print(sum-x-y+z)

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
lis=list(map(int,input().split()))
A=lis[0]
B=lis[1]
C=lis[2]
D=lis[3]
sum=B-A+1

times=C*D//gcd(C,D)
restac=A%C
restbc=B%C
restad=A%D
restbd=B%D
restat=A%times
restbt=B%times
x=int((B-restbc)//C)-int((A-restac)//C)
y=int((B-restbd)//D)-int((A-restad)//D)
z=int((B-restbt)//times)-int((A-restat)//times)
if restac==0:
  x+=1
if restad==0:
  y+=1
if(restat==0):
  z+=1
print(sum-x-y+z)
Buggy python submission (verdict: Runtime Error):
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1
  else:
    print(count)
if count==n+1:
  print(n+1)


Fixed submission:
lis=input().split(' ')
x=int(lis[0])
a=int(lis[1])
if x<a:
  print(0)
else:
  print(10)

Buggy python submission (verdict: Runtime Error):
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1;
  else:
    print(count)
if count==n+1:
  print(n+1)


Fixed submission:
lis=input().split(' ')
x=int(lis[0])
a=int(lis[1])
if x<a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%d %d'%(inp[0]*inp[1]*0.5,ans))
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))
提出情報

Fixed submission:
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))

Buggy python submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=0;
else:
  ans=1;
printf('%d %d'%(inp[0]*inp[1]*0.5,ans))

Fixed submission:
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())
inp=list(map(int,input().split(' ')))
su=sum(inp)
ab=su
for i in range(N):
  s1=0
  for j in range(i):
    s1+=inp[j]
  if (ab>abs(2*s1-su)):
    ab=abs(2*s1-su)
print(ab)

Fixed submission:
inp=list(map(int,input().split(' ')))
print(min(inp)+sorted(inp)[1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
no1 = -1
no1_i = -1
no2 = -2
no2_i = -1
S = []
for _ in range(n):
    S.append(int(input()))

for i in range(n):
  	if s[i] > no1:
    	no1_i = i
    	no1 = s[i]
    elif s[i] > no2:
    	no2_i = i
    	no2 = s[i]
      
for i in range(n):
 	if no1_i == i:
    	print(no2)
    else:
    	print(no1)

Fixed submission:
n = int(input())
no1 = -1
no1_i = -1
no2 = -2
no2_i = -1
S = []
for _ in range(n):
    S.append(int(input()))
 
for i in range(n):
  if S[i] > no1:
    no1_i =i
    no1 = S[i]
  elif S[i] > no2:
    no2_i = i
    no2 = S[i]
      
for i in range(n):
  if no1_i == i:
    print(no2)
  else:
    print(no1)
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort(reverse=True)
	return divisors

n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.append(0)
a.sort(reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0

result = make_divisors(a[0] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 1) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans1 = result[i]
		break

result = make_divisors(a[0] - a[1])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 2) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans2 = result[i]
		break

result = make_divisors(a[1] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 0) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans3 = result[i]
		break
max = ans1
if(ans2 > max):
	max = ans2
if(ans3 > max):
	max = ans3
print(max)

Fixed submission:
A, B, T = map(int, input().split())
tmp = (T+0.5) / A
print(int(tmp)*B)

Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort(reverse=True)
	return divisors

n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.append(0)
a.sort(reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0

result = make_divisors(a[0] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 1) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans1 = result[i]
		break

result = make_divisors(a[0] - a[1])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 2) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans2 = result[i]
		break

result = make_divisors(a[1] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 0) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans3 = result[i]
		break
max = ans1
if(ans2 > max):
	max = ans2
if(ans3 > max):
	max = ans3
print(max)


Fixed submission:
A, B, T = map(int, input().split())
tmp = (T+0.5) / A
print(int(tmp)*B)
Buggy python submission (verdict: Runtime Error):
import collections

n=int(input())
v = input().split()

v1 = v[0::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)
if(c1.most_common()[0][0] != c2.most_common()[0][0]):
	print(n - c1.most_common()[0][1] - c2.most_common()[0][1])
else:
	if(c1.most_common()[0][1] == n/2):
		count1 = c2.most_common()[0][1]
	else:
		count1 = c1.most_common()[1][1] + c2.most_common()[0][1]

	if(c2.most_common()[0][1] == n/2):
		count2 = c1.most_common()[0][1]
	else:
		count2 = c1.most_common()[0][1] + c2.most_common()[1][1]

	if(count1 < cont2):
		print(n - count2)
	else:
		print(n - count1)


Fixed submission:
import collections

n=int(input())
v = input().split()

v1 = v[0::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)
if(c1.most_common()[0][0] != c2.most_common()[0][0]):
	print(n - c1.most_common()[0][1] - c2.most_common()[0][1])
else:
	if(c1.most_common()[0][1] == n/2):
		count1 = c2.most_common()[0][1]
	else:
		count1 = c1.most_common()[1][1] + c2.most_common()[0][1]

	if(c2.most_common()[0][1] == n/2):
		count2 = c1.most_common()[0][1]
	else:
		count2 = c1.most_common()[0][1] + c2.most_common()[1][1]

	if(count1 < count2):
		print(n - count2)
	else:
		print(n - count1)
Buggy python submission (verdict: Runtime Error):
N = input()
data = int(input().split())
bef = -1
count = 0
result = 0

for i in range(len(data)):
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++

print(result)

Fixed submission:
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	t = int(data[i])
	if bef != t:
		if count > 1:
			result += int(count / 2)
		count = 1
		bef = t
	else:
		count += 1

if count > 1:
	result += int(count / 2)
print(result)

Buggy python submission (verdict: Runtime Error):
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++

print(result)

Fixed submission:
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	t = int(data[i])
	if bef != t:
		if count > 1:
			result += int(count / 2)
		count = 1
		bef = t
	else:
		count += 1

if count > 1:
	result += int(count / 2)
print(result)

Buggy python submission (verdict: Runtime Error):
N = input()
data = input().split()
bef = -1
count = 0
result = 0
for i in data:
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++
print(result)

Fixed submission:
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	t = int(data[i])
	if bef != t:
		if count > 1:
			result += int(count / 2)
		count = 1
		bef = t
	else:
		count += 1

if count > 1:
	result += int(count / 2)
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
from collections import defaultdict
encodes = [hash(tuple(sorted(list(s)))) for s in S]
hash_table = defaultdict(int)
for encode in encodes:
  hash_table[encode] += 1
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
count = sum(c_list)
print(count)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
 
from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in sorted(list(s)):
    d[c] += 1
  return d
 
decodes = [decode(s) for s in S]
 
hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
#print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)
 
print(count)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
 
from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in list(sorted(s)):
    d[c] += 1
  return d
 
decodes = [decode(s) for s in S]
 
hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
#print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)
 
print(count)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]

from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in list(sorted(s)):
    d[c] += 1
  return d

decodes = [decode(s) for s in S]

hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)

print(count)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
def count(start, end):
  return end - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

Buggy python submission (verdict: Runtime Error):
N = int(input())
def count(start, end_):
  return end_ - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1  
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

Buggy python submission (verdict: Runtime Error):
N = int(input())
def count(start, end):
  return end - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1  
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

Buggy python submission (verdict: Runtime Error):
N = int(input())
def count(start, end):
	return end - start + 1
keta = 1
while True:
	if 10**keta > N:
    	break
	else:
    	keta += 1
num = 0
for k in range(1, keta+1):
	if k % 2 == 1:
		num += count(10**(k-1), min(N, 10**k-1))

print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

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

def count(start, end):
  return end - start + 1

keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1
      
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))

print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

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

def count(start, end):
  return end - start + 1

keta = 1
while True:
  if 10**keta > N:
    break
  else:
  	keta += 1
      
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))

print(num)

Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)

Buggy python submission (verdict: Runtime Error):
A, B, C = input().split()

ABgap = A - B
remain = max(0, C - ABgap)

print(remain)




Fixed submission:
A, B, C = list(map(int, input().split()))
 
ABgap = A - B
remain = max(0, C - ABgap)
 
print(remain)
Buggy python submission (verdict: Runtime Error):
N = int(input())

def count(start, end):
  return end - start + 1

keta = 1
while True:
  if 10**keta > N:
    break
  else:
  	keta += 1

num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
	num += count(10**(k-1), min(N, 10**k)-1)
    
print(num)

Fixed submission:
N = int(input())
def count(start, end):
  return end - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
lenH = len(H)
for i in range(lenH-1):
  h_2 = H[lenH-i]
  h_1 = H[lenH-i-1]
  if h_2 < h_1:
    if h_1 - h_2 > 1:
      print('No')
      break
    else:
	  H[lenH-i-1] -= 1
print('Yes')

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
lenH = len(H)
if lenH <= 1:
  print('Yes')
  exit()
for i in range(lenH-1):
  h_2 = H[lenH-i-1]
  h_1 = H[lenH-i-2]
  if h_2 < h_1:
    if h_1 - h_2 > 1:
      print('No')
      exit()
    else:
      H[lenH-i-2] -= 1
print('Yes')
Buggy python submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())
a = []
b = []
for i in range(N):
    data = list(input())
    a.append(data)
for i in range(M):
    data = list(input())
    b.append(data)

#N=4
#M=2
#a=[['a','s','a','s'],['a','a','s','s'],['s','a','a','s'],['s','a','a','a']]
#b=[['s','a'],['a','s']]

L = N-M

def check(i,j):
    ans=True
    for line in range(M):
        if (ans==False):
            break
        for row in range(M):
            if (a[i+line][j+row]!=b[line][row]):
                ans=False
                break
    return ans

ans=False
for i in range(L+1):
    if(ans==True):
        break
    for j in range(L+1):
        ansnow=check(i,j)
        print(ansnow,i,j)
        if(ansnow==True):
            ans=True
            break
if(ans==True):
    print('Yes')
else:
    print('No')
    


Fixed submission:
a, b = (int(i) for i in input().split())

if a==1:
    a=14
if b==1:
    b=14

if a==b:
    print("Draw")
elif a>b:
    print("Alice")
else:
    print("Bob")

Buggy python submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())
a = []
b = []
for i in range(N):
    data = list(input())
    a.append(data)
for i in range(M):
    data = list(input())
    b.append(data)
    
L = N-M

def check(i,j):
    ans=True
    for line in range(L+1):
        for row in range(L+1):
            if (a[i+line][j+row]!=b[line][row]):
                ans=False
                break
    return ans

ans=False
for i in range(L+1):
    for j in range(L+1):
        ansnow=check(i,j)
#        print(ansnow,i,j)
        if(ansnow==True):
            ans=True
            break
if(ans==True):
    print('Yes')
else:
    print('No')
    

Fixed submission:
a, b = (int(i) for i in input().split())

if a==1:
    a=14
if b==1:
    b=14

if a==b:
    print("Draw")
elif a>b:
    print("Alice")
else:
    print("Bob")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

total, select = map(int, input().split(' '))

trees = []

for _ in range(total):
  trees.append(int(input()))

result = 10000000000
for t in list(itertools.combinations(trees, select)):
  result = min(result, max(t)-min(t))

print(result)



Fixed submission:
import itertools

total, select = map(int, input().split(' '))

trees = []

for _ in range(total):
  trees.append(int(input()))

"""
result = 10000000000
for t in list(itertools.combinations(trees, select)):
  result = min(result, max(t)-min(t))
"""

trees.sort()

result = 10000000000
for i in range(total-select+1):  
  result = min(result, trees[i+select-1] - trees[i])

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

maxA=max(A)

for i in range(N):
  if A[i]<maxA:
    print(maxA)
  else:
    B=A[:]
    del B[i]
    print(max(B))


Fixed submission:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

maxA=max(A)
countNumber=A.count(maxA)

for i in range(N):
  if A[i]<maxA:
    print(maxA)
  elif countNumber>1:
    print(maxA)
  else:
    B=A[:]
    del B[i]
    print(max(B))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[input() for i in range(N)]

for i in range(N):
  B=A[:]
  del B[i]
  print(max(B))


Fixed submission:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

maxA=max(A)
countNumber=A.count(maxA)

for i in range(N):
  if A[i]<maxA:
    print(maxA)
  elif countNumber>1:
    print(maxA)
  else:
    B=A[:]
    del B[i]
    print(max(B))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

for i in range(N):
  B=A[:]
  del B[i]
  print(max(B))


Fixed submission:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

maxA=max(A)
countNumber=A.count(maxA)

for i in range(N):
  if A[i]<maxA:
    print(maxA)
  elif countNumber>1:
    print(maxA)
  else:
    B=A[:]
    del B[i]
    print(max(B))
Buggy python submission (verdict: Runtime Error):
L,R=map(int,input().split())

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
      j=j+2019
print(keep)

Fixed submission:
N,A,B=map(int,input().split())
print(min(N*A,B))
Buggy python submission (verdict: Time Limit Exceeded):
L,R=map(int,input().split())

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
      j=j+2019
      i=i+2019
print(keep)

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

keep=2018
for i in range(L,R+1):
  for j in range(i+1,R+1):
    keep=min(keep,(i*j)%2019)
    if keep==0:
      print(0)
      exit()
print(keep)

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

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
      j=j+2019
print(keep)

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

keep=2018
for i in range(L,R+1):
  for j in range(i+1,R+1):
    keep=min(keep,(i*j)%2019)
    if keep==0:
      print(0)
      exit()
print(keep)

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

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
print(keep)

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

keep=2018
for i in range(L,R+1):
  for j in range(i+1,R+1):
    keep=min(keep,(i*j)%2019)
    if keep==0:
      print(0)
      exit()
print(keep)

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

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
print(keep)

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

keep=2018
for i in range(L,R+1):
  for j in range(i+1,R+1):
    keep=min(keep,(i*j)%2019)
    if keep==0:
      print(0)
      exit()
print(keep)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))

c=0
for i in range(1,n-1):
  if (p[i-1]<p[i]<p[i+1]) or  (p[i-1]>p[i]>p[i+1]):
    c=c+1

print(c)

Fixed submission:
S=input()

if len(S)!=4:
  print('No')
else:  
  Sorted_S = sorted(S)
  
  L1=Sorted_S[0]
  L2=Sorted_S[1]
  L3=Sorted_S[2]
  L4=Sorted_S[3]

  if (L1==L2) and (L3==L4) and (L2!=L3):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

cnt = Counter()
for num in A:
    cnt[str(num)] += 1

values = sorted(cnt.values())
ans = 0
for x in xrange(len(values) - K):
    ans += values.pop(0)

print ans

Fixed submission:
from collections import Counter
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

cnt = Counter()
for num in A:
    cnt[str(num)] += 1

values = sorted(cnt.values())
ans = sum(values[:max(len(values)-K, 0)])

print ans
Buggy python submission (verdict: Runtime Error):
import numpy as np
S = input().strip()

MOD = 10**9 + 7
dp = np.zeros((100005, 13))
N = len(S)

dp[0][0] = 1
for i in range(N):
    c = -1
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])

    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) % 13] += dp[i][ki]

    for j in range(13):
        dp[i+1][j] %= MOD

res = int(dp[N][5])

print(res)


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

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