Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
if(mod[0]==mod[1]):
    answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
    if count == 2018:
        break
    count = count + 1
print(answer)

Fixed submission:
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
if(mod[0]==mod[1]):
    answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    if 2019<=mod[1]-mod[0]:
        answer = 0
        break
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
    if count == 2018:
        break
    count = count + 1
print(answer)

Buggy python submission (verdict: Runtime Error):
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
if(i+1==mod[1]):
    answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
            print(answer)
    if count == 2018:
        break
    count = count + 1
print(answer)

Fixed submission:
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
if(mod[0]==mod[1]):
    answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    if 2019<=mod[1]-mod[0]:
        answer = 0
        break
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
    if count == 2018:
        break
    count = count + 1
print(answer)
Buggy python submission (verdict: Runtime Error):
p=list(input())
f=0
for i in range(len(l)-1):
  if l[i]==l[i+1]:
    f+=1
    break
if f>0:
  print("Bad")
else:
  print("Good")
  

Fixed submission:
p=list(input())
f=0
for i in range(len(p)-1):
  if p[i]==p[i+1]:
    f+=1
    break
if f>0:
  print("Bad")
else:
  print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
s1=reversed(s)
l=["dream","dreamer","erase","eraser"]
s2=[]
for item in s1:
  s2.insert(0,item)
  str=''.join(s2)
  if str in l:
    s2=[]
if len(s2)==0:
  print("YES")
else:
  print("NO")

Fixed submission:
s=list(input())
s1=reversed(s)
l=["dream","dreamer","erase","eraser"]
s2=[]
for item in s1:
  s2.insert(0,item)
  str=''.join(s2)
  if str in l:
    s2=[]
  elif len(s2)>7:
    break
if len(s2)==0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
input = input()
is_good = True
for i, s in enumerate(input):
    if i > 0 and s == input[i-1]:
        is_good = False
        break
    if i < len(input) and s == input[i+1]:
        is_good = False
        break
if is_good:
    print('Good')
else:
    print('Bad')

Fixed submission:
code = input()
is_bad = False
for i, s in enumerate(code):
  if i > 0 and s == code[i-1]:
    print('Bad')
    is_bad = True
    break
  if i < len(s) -1 and s == code[i+1]:
    print('Bad')
    is_bad = True
    break
if not is_bad:
  print('Good')
Buggy python submission (verdict: Runtime Error):
import math
def lcm(a, b):
  return (a * b) // math.gcd(a, b)
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = math.floor(input[1] / input[2]) - math.floor(input[0] / input[2])
if input[0] % input[2] == 0:
  div_c += 1
div_d = math.floor(input[1] / input[3]) - math.floor(input[0] / input[3])
if input[0] % input[3] == 0:
  div_d += 1
div_cd = math.floor(input[1] / lcm(input[2], input[3])) - math.floor(input[0] / lcm(input[2], input[3]))
if input[0] % lcm(input[2], input[3]) == 0:
  div_cd += 1
print(total_count - (div_c + div_d - div_cd))

Fixed submission:
from fractions import gcd
def floor(a, b):
  # return int((a - a%b)/b)
  return a//b
# def gcd(a, b):
#   while a % b != 0:
#       a, b = b, a % b
#   return a
def lcm(a, b):
  return floor((a * b), gcd(a, b))
input = list(map(int, input().split(' ')))
total_count = input[1] + 1 - input[0]
div_c = floor(input[1], input[2]) - floor(input[0] -1, input[2])
div_d = floor(input[1], input[3]) - floor(input[0] -1, input[3])
div_cd = floor(input[1], lcm(input[2], input[3])) - floor(input[0] -1, lcm(input[2], input[3]))
print(total_count - (div_c + div_d - div_cd))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
points = []
for i in range(0, N):
    points.append(list(map(int, input().split(' '))))
abcd = set(sum(points, []))
count = 0
for a in abcd:
    for b in abcd:
        for c in abcd:
            for d in abcd:
                if a == c and b == d:
                    continue
                p = []
                if [a, b] not in points:
                    p.append([a, b])
                if [a, d] not in points:
                    p.append([a, d])
                if [c, b] not in points:
                    p.append([c, b])
                if [c, d] not in points:
                    p.append([c, d])
                if len(p) == 1:
                    count += 1
                    points.append(p[0])
print(count)

Fixed submission:
N = int(input())
points = []
for i in range(0, N):
    points.append(list(map(int, input().split(' '))))
X = dict()
Y = dict()
count = 0
for p in points:
    if p[0] not in X.keys():
        X[p[0]] = []
    X[p[0]].append(p[1])
    if p[1] not in Y.keys():
        Y[p[1]] = []
    Y[p[1]].append(p[0])
while len(X.items()) > 0:
    item = list(X.items())[0]
    del X[item[0]]
    queue = [item]
    point_dict = {'x': [], 'y': []}
    queue_is_x = [True]
    while len(queue) > 0:
        item = queue.pop(0)
        is_x = queue_is_x.pop(0)
        if is_x:
            point_dict['x'].append(item[0])
            for i in item[1]:
                if i in Y.keys():
                    queue.append((i, Y[i]))
                    queue_is_x.append(False)
                    del Y[i]
        else:
            point_dict['y'].append(item[0])
            for i in item[1]:
                if i in X.keys():
                    queue.append((i, X[i]))
                    queue_is_x.append(True)
                    del X[i]
    # print((point_dict['x']))
    # print(len((point_dict['x'])))
    # print((point_dict['y']))
    # print(len((point_dict['y'])))
    count += len(set(point_dict['x'])) * len(set(point_dict['y']))

print(count - len(points))
Buggy python submission (verdict: Runtime Error):
info = list(map(int, input().split(' ')))
array = list(map(int, input().split(' ')))

print((info[0]-1)//(info[1]-1))

Fixed submission:
calc = input()
result = 0
for letter in calc:
    if letter == '+':
        result = result+1
    else:
        result = result-1
print(result)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math


A, B, C, D = map(int,input().split())

lcm = C * D // math.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print((B-A+1)-(lcmB-lcmA))


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

A, B, C, D = map(int,input().split())

lcm = C * D // fractions.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print((B-A+1)-(lcmB-lcmA))

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


A, B, C, D = map(int,input().split())

lcm = C * D // math.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print((B-A+1)-(lcmB-lcmA))


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

A, B, C, D = map(int,input().split())

lcm = C * D // fractions.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print((B-A+1)-(lcmB-lcmA))

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


A, B, C, D = map(int,input().split())

lcm = C * D // math.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print(lcmB)
print(lcmA)
print((B-A+1)-(lcmB-lcmA))

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

A, B, C, D = map(int,input().split())

lcm = C * D // fractions.gcd(C, D)

maxC = B // C
maxD = B // D
maxlcm = B // lcm

minC = (A-1) // C
minD = (A-1) // D
minlcm = (A-1) // lcm

lcmB = (maxC + maxD - maxlcm)
lcmA = (minC + minD - minlcm)

print((B-A+1)-(lcmB-lcmA))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

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

# sort
for i in range(len(list)):
    Ai, Bi = list[i]
    minIndex = None
    min = Bi
    for j in range(i+1,len(list)):
        Aj, Bj = list[j]

        if min > Bj:
            min = Bj
            minIndex = j

    if minIndex != None:
        list[i],list[minIndex] = list[minIndex],list[i]

#check
time = 0
result = True
for i in list:
    A, B = i
    time += A

    #print("work[{0}({1},{2})] time:{3}".format(i,A,B,time))

    if time > B:
        result = False
        break

message = "Yes" if result else "No"
print(message)


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

N = int(input())

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

# sort
list.sort(key=lambda x:x[1])
#check
time = 0
result = True
for i in list:
    A, B = i
    time += A

    #print("work[{0}({1},{2})] time:{3}".format(i,A,B,time))

    if time > B:
        result = False
        break

message = "Yes" if result else "No"
print(message)

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

N = int(input())

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

# sort
for i in range(len(list)):
    for j in range(i+1,len(list)):
        Ai, Bi = list[i]
        Aj, Bj = list[j]

#        pr_i = Bi - Ai
#        pr_j = Bj - Aj

        if Bi > Bj:
            list[i], list[j] = list[j], list[i]

#check
time = 0
result = True
for i in list:
    A, B = i
    time += A

#    print("work[{0}({1},{2})] time:{3}".format(i,A,B,time))

    if time > B:
        result = False
        break

message = "Yes" if result else "No"
print(message)


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

N = int(input())

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

# sort
list.sort(key=lambda x:x[1])
#check
time = 0
result = True
for i in list:
    A, B = i
    time += A

    #print("work[{0}({1},{2})] time:{3}".format(i,A,B,time))

    if time > B:
        result = False
        break

message = "Yes" if result else "No"
print(message)
Buggy python submission (verdict: Runtime Error):
a,b=map(int(),input().split())
print("Even" if a*b%2==0 else"Odd")

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy python submission (verdict: Runtime Error):
a,b=map(int(),input().split())
print("Even" if a*b%2==0 else"Odd")

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy python submission (verdict: Runtime Error):
a,b=map(int(),input().split())
print("Even" if a*b%2==0 else"Odd"

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2==0
    print("Odd")
else:
    print("Even")

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b%2==0
   print("Even")
else
   print("Odd")

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(a+b+c)

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split(" "))
L = list(map(int,input().split(" ")))
D = 0
ans = 0

for i in range(N):
  if D <= X:
    D += L[i]
    ans += 1
  else:
    break
print(ans)


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

if X >= A:
    print(10)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
B = [0]*M
for j in range(M):
	B[j] = list(map(int,input().split(" ")))

tmp = sorted(B,key=lambda x:x[1],reverse=True)
A.sort()

r = 0
for i in tmp:
	for k in range(r,N,1):
		if i[1] > A[k] and i[0] > 0:
			A[k] = i[1]
			i[0] -= 1
			r = k

print(sum(A))

Fixed submission:
N,M = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
B = [0]*M
for j in range(M):
	B[j] = list(map(int,input().split(" ")))

tmp = sorted(B,key=lambda x:x[1],reverse=True)
A.sort()

r = 0
for i in tmp:
	for k in range(r,N,1):
		if i[1] > A[k] and i[0] > 0:
			A[k] = i[1]
			i[0] -= 1
			r = k+1
		elif A[k] > i[1] or i[0] == 0:
			break

print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
B = [0]*M
for j in range(M):
	B[j] = list(map(int,input().split(" ")))

tmp = sorted(B,key=lambda x:x[1],reverse=True)
A.sort()

for i in tmp:
	for k in range(N):
		if i[1] > A[k] and i[0] > 0:
			A[k] = i[1]
			i[0] -= 1

print(sum(A))

Fixed submission:
N,M = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
B = [0]*M
for j in range(M):
	B[j] = list(map(int,input().split(" ")))

tmp = sorted(B,key=lambda x:x[1],reverse=True)
A.sort()

r = 0
for i in tmp:
	for k in range(r,N,1):
		if i[1] > A[k] and i[0] > 0:
			A[k] = i[1]
			i[0] -= 1
			r = k+1
		elif A[k] > i[1] or i[0] == 0:
			break

print(sum(A))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
S = input()

tmp = S[K-1].lower()
S[K-1] = tmp
ans = "".join(S)

print(ans)

Fixed submission:
N,K = map(int,input().split(" "))
S = list(input())

tmp = S[K-1].lower()
S[K-1] = tmp
ans = "".join(S)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = map(int,input().split(" "))
C = map(int,input().split(" "))
P = []

for i in range(N):
    P.append(V[i] - C[i])

result = list(filter(lambda x:x>=1,P))
print(sum(result))

Fixed submission:
N = int(input())
V = list(map(int,input().split(" ")))
C = list(map(int,input().split(" ")))
P = []

for i in range(N):
    P.append(V[i] - C[i])

result = list(filter(lambda x:x>=1,P))
print(sum(result))
Buggy python submission (verdict: Runtime Error):
import numpy

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

l = []
for v in range(n):
    l.append(list(map(int, input().split())))

ans = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        if i == j:
            continue
        a = numpy.array(l[i])
        b = numpy.array(l[j])
        c = numpy.linalg.norm(b - a)
        if (c.is_integer()):
            ans += 1

print(ans)


Fixed submission:
n, a, b = map(int, input().split())
ans = 0

if (n * a > b):
    ans = b
else:
    ans = n * a

print(ans)
Buggy python submission (verdict: Runtime Error):
x, a = map(int, input())

if x < a:
    print('0')

if x >= a:
    print('10')


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

if x < a:
    print('0')

if x >= a:
    print('10')
Buggy python submission (verdict: Runtime Error):
import math


def is_distance_integer(p1, p2):
    n = len(p1)

    total = 0
    for i in range(n):
        total += ((p1[i] - p2[i])**2)

    dist = math.sqrt(total)

    return (dist**2) == total


def count_pairs(points):
    cnt = 0
    n = len(points)

    for i in range(n):
        for j in range(i + 1, n):
            if is_distance_integer(points[i], points[j]):
                cnt += 1

    return cnt


def main():
    N, D = map(int, input().split())

    points = []
    for _ in range(N):
        points.append(map(int, input().split()))

    ans = count_pairs(points)

    print(ans)


main()
 


Fixed submission:
import math


def is_distance_integer(p1, p2):
    n = len(p1)

    total = 0
    for i in range(n):
        total += ((p1[i] - p2[i])**2)

    dist = int(math.sqrt(total))

    return (dist**2) == total


def count_pairs(points):
    cnt = 0
    n = len(points)

    for i in range(n):
        for j in range(i + 1, n):
            if is_distance_integer(points[i], points[j]):
                cnt += 1

    return cnt


def main():
    N, D = map(int, input().split())

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

    ans = count_pairs(points)

    print(ans)


main()
Buggy python submission (verdict: Time Limit Exceeded):
s = raw_input()
while True:
    t = s.replace("ST", "")
    if len(t) == len(s):
        break
    s = t
print len(s.replace("ST", ""))


Fixed submission:
s = raw_input()
c = len(s)
l = 0
was_es = True
for i in xrange(len(s)):
    if s[i] == "S":
        if was_es == True:
            l += 1
        was_es = True
    else:
        if l > 0:
            l -= 1
            c -= 2
print c
Buggy python submission (verdict: Time Limit Exceeded):
knots = []
n, l = map(int, raw_input().split())
a = map(int, raw_input().split())
index = range(0,n+1)
# print a
while len(knots) < n-1:
    i = 0
    untied = False
    while i < (len(a)-1):
        if a[i] + a[i+1] >= l:
            untied = True
            a[i] += a.pop(i+1)
            # print a
            # print "i", index
            knots.append(index[i+1])
            del index[i+1]
        i += 1
    if untied == False:
        print "Impossible"
        exit()
print "Possible"
for k in reversed(knots):
    print k


Fixed submission:
n, l = map(int, raw_input().split())
a = map(int, raw_input().split())
# print a
i = 0
untied  = False
while i < (len(a)-1):
    if a[i] + a[i+1] >= l:
        # print i, a[i]
        untied = True
        break
    i += 1
if untied == False:
    print "Impossible"
    exit()
print "Possible"
for k in xrange(n-1, i+1, -1):
    print k
for k in xrange(1, i+2):
    print k
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
dunder = 0
count = 0
for i in range(max(d)):
    dunder = sum (x<i for x in d)
    if 2*dunder == len(d):
        count += 1
    elif 2*dunder > len(d):
        break
print(count)


Fixed submission:
S = input()
S = sorted(S,key=str)
if S.count(S[0]) == 2 and S[2] == S[3]:
    print("Yes")
    exit()
print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
dunder = 0
count = 0
for i in range():
    dunder = sum (x<i for x in d)
    if 2*dunder == len(d):
        count += 1
    elif 2*dunder > len(d):
        break
print(count)


Fixed submission:
N = int(input())
d = list(map(int,input().split()))
d.sort()
m = N//2
if d[m] == d[m-1]:
    print(0)
else:
    print(d[m]-d[m-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = [tuple(map(int,input().split())) for _ in range(n)]
li.sort(key=lambda x: x[1])
t = 0
for i in range(n):
    if t + li[i][0] > li[i][1]:
        print("No")
        exit()
    else:
        t += li[i][0]
print("Yes")

Fixed submission:
S = input()
for i in range(len(S)-1):
  if S[i] == S[i+1]:
    print("Bad")
    exit()
print("Good")
Buggy python submission (verdict: Runtime Error):
N,L = map(int,input().split())
sumL = 0
mainasu = 0
plus = 0
aji = []
for i in range(N):
  aji.append(L + i)
  sumL += L + i
  if L + i == 0:
    count = 1
  elif L + i  < 0:
    mainasu += 1
  elif L + i > 0:
    plus += 1
if count == 1:
  print(sumL)
elif mainasu > plus :
  print(sumL-max((aji)))
else:
  print(sumL-min((aji)))
  

Fixed submission:
N,L = map(int,input().split())
sumL = 0
mainasu = 0
plus = 0
aji = []
count = 0
for i in range(N):
  aji.append(L + i)
  sumL += L + i
  if L + i == 0:
    count = 1
  elif L + i  < 0:
    mainasu += 1
  elif L + i > 0:
    plus += 1
if count == 1:
  print(sumL)
elif mainasu > plus :
  print(sumL-max((aji)))
else:
  print(sumL-min((aji)))
Buggy python submission (verdict: Runtime Error):
import math 
A, B, C, D = map(int, input().split())
a = B - A + 1
b = (B//C) - ((A-1)//C)
c = (B//D) - ((A-1)//D)
d = C*D//math.gcd(C,D)
dd = (B//d) - ((A-1)//d)
print(a-b-c+dd)


Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
a = B - A + 1
b = (B//C) - ((A-1)//C)
c = (B//D) - ((A-1)//D)
d = C*D//fractions.gcd(C,D)
dd = (B//d) - ((A-1)//d)
print(a-b-c+dd)
Buggy python submission (verdict: Runtime Error):
#-*- coding: utf-8 -*-
N,X = map(int,input().split())
li = list(map(int,input().split()))
d = 0
count = 1
for i in range(len(li)):
  d += li[i]
  if d <= x:
    count += 1
  else:
    break
print(count)

Fixed submission:
#-*- coding: utf-8 -*-
X,A = map (int,input().split())
if X < A:
    print("0")
else:
    print("10")
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = []
R = []
LR = [list(map(int,input().split())) for _ in range(M)]
for i in range(M):
    L.append(LR[i][0])
countL = 0
countL = max(L)
for j in range(M):
    R.append(LR[j][1])
countR = 0
countR = min(R)
if countR - countL + 1 <= 0:
    print("0")
else:
    print(countR-countL+1)
    


    



Fixed submission:
A,B = map(int,input().split())
if A >= 13:
    print(B)
elif 6 <= A <= 12:
    print(int(B/2))
else:
    print("0")

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
L = []
R = []
LR = [list(map(int,input().split())) for _ in range(M)]
for i in range(M):
    L.append(LR[i][0])
countL = 0
countL = max(L)
for j in range(M):
    R.append(LR[j][1])
countR = 0
countR = min(R)
if countR >= countL:
    print(0)
else:
    print(countR-countL+1)
    


    



Fixed submission:
A,B = map(int,input().split())
if A >= 13:
    print(B)
elif 6 <= A <= 12:
    print(int(B/2))
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
n = sorted(list(map(int,input().split())),revese=True)
print(10*n[0]+n[1]+n[2])



Fixed submission:
n = sorted([int(num) for num in input().split()])
print(n[2]*10+n[1]+n[0])
Buggy python submission (verdict: Runtime Error):
tasks = sorted([int(v) for v in input.split()])
print(tasks[-1]-tasks[0])


Fixed submission:
tasks = sorted([int(v) for v in input().split()])
print(tasks[-1]-tasks[0])
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int,input().split())
AL, AR = [],[]
for i in range(M):
  a = int(input())
  if a < X:
    AL.append(a)
  else:
    AR.append(a)
    
print(min(len(AL),len(AR)))


Fixed submission:
N, M, X = map(int,input().split())
AL, AR = [],[]
for a in map(int,input().split()):
  if a < X:
    AL.append(a)
  else:
    AR.append(a)
    
print(min(len(AL),len(AR)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for i in range(N)]
M = int(input())
T = [int(input()) for i in range(M)]
 
Scores = []
for s in S:
  score = len([s2 for s2 in S if s == s2])
  score -= len([s2 for s2 in T if s == s2])
  Scores.append(score)
print(max(Scores))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
 
Scores = []
for s in S:
  score = len([s2 for s2 in S if s == s2])
  score -= len([s2 for s2 in T if s == s2])
  Scores.append(score)
print(max(Scores) if max(Scores)>0 else 0)
Buggy python submission (verdict: Runtime Error):
from sys inmport stdin
X,A,B = map(int, stdin.read().splitlines())
print( (X-A)%B )

Fixed submission:
from sys import stdin
X,A,B = map(int, stdin.read().splitlines())
print( (X-A)%B )
Buggy python submission (verdict: Runtime Error):
from sys in stdin
N = input()
print(len(set(stdin.read().splitlines())))

Fixed submission:
from sys import stdin
N = input()
print(len(set(stdin.read().splitlines())))
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = [int(x) for x in input().split()]

total = sum([min(2*x, (K-x)*2) for x in X]
print(total)

Fixed submission:
N = int(input())
K = int(input())
X = [int(x) for x in input().split()]
 
total = sum([min(2*x, (K-x)*2) for x in X])
print(total)