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

a, b = n.split()

a = int(a)
b = int(b)

flag = False
for i in range(a):
    if flag:
        break
    for j in range(b):
        if (((i+1) * (j+1)) % a) == 0 and (((i+1) * (j+1)) % b) == 0:
            print((i+1) * (j+1))
            flag = True
            break


Fixed submission:
n = input()

a, b = n.split()

a = int(a)
b = int(b)

for i in range(10 ** 5):
    i = i + 1
    if (i * a) % b == 0:
        print(a*i)
        break

Buggy python submission (verdict: Runtime Error):
import fractions
def lcm(x,y):
	return (x*y)//math.gcd(x,y)

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

if __name__ == '__main__':
	main()

Fixed submission:
import fractions
def lcm(x,y):
	return (x*y)//fractions.gcd(x,y)

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

if __name__ == '__main__':
	main()

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

a,b = map(int,input().split())
print(lcm(a,b))

Fixed submission:
import fractions
def lcm(x,y):
	return (x*y)//fractions.gcd(x,y)

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

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(ans)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(dd)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
	for j in range((i+1),n):
		if i==j:
			continue
		dd += (d[i]*d[j])
print(ans)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(dd)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(ans)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(dd)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(ans)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(dd)

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

ans = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
     ans += (d[i]*d[j])
print(ans)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
 
dd = 0
for i in range(n):
  for j in range((i+1),n):
    if i==j:
      continue
    dd += (d[i]*d[j])
print(dd)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt = 1
for i in rage(n-1):
  if(s[i]!=s[i+1]):
    cnt = cnt+1
print(cnt)

Fixed submission:
n = int(input())
s = input()
cnt = 1
for i in range(n-1):
  if(s[i]!=s[i+1]):
    cnt = cnt+1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sympy

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

cnt = [0]*200010

b = []

for i in reversed(range(n)):

	num = i + 1
	if cnt[num]%2 != a[num-1]:
		b.append(num)
		divs = sympy.divisors(num)

		for div in divs:
			cnt[div] += 1

print(len(b))
b.sort()

for i in b:
	print(str(i)+' ',end='')

print()

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

cnt = [0]*200010

b = []

for i in reversed(range(n)):

	num = i + 1
	if cnt[num]%2 != a[num-1]:
		b.append(num)
		j = 1
		while j*j <= (num):
			if num%j==0 :
				cnt[j] += 1
				if num//j != j:
					cnt[num//j]+=1
			j = j +1


print(len(b))
b.sort()

for i in b:
	print(str(i)+' ',end='')

print()
Buggy python submission (verdict: Runtime Error):
from itertools import groupby

n,k = map(int,input().split())
s = input()

grouped = groupby(s)

res = []

if s[0] == '0':
	res.append((1,0))

for l,v in grouped:
	res.append( (l,len(list(v))) )

if s[len(s)-1] == '0':
	res.append((1,0))

now = 0
ans = 0
for i in range(2*k+1):
	now += res[i][1]

ans = max(ans,now)

for i in range(2*k+1,len(res),2):
	now -= res[i-2*k-1][1]
	now -= res[i-2*k][1]

	now += res[i][1]
	now += res[i+1][1]

	ans = max(ans,now)

print(ans)



Fixed submission:
from itertools import groupby

n,k = map(int,input().split())
s = input()


grouped = groupby (s)
res = []

if s[0] == '0':
	res.append((1,0))

for l,v in grouped:
	res.append( (l,len(list(v))) )

if s[len(s)-1] == '0':
	res.append((1,0))

#for d in res:
	#print(d)

if len(res) <= 2*k + 1:
	ans = 0;
	for d in res:
		ans += d[1];

	print(ans)
	exit()

now = 0
ans = 0
for i in range(2*k+1):
	now += res[i][1]

ans = max(ans,now)

for i in range(2*k+1,len(res),2):
	now -= res[i-2*k-1][1]
	now -= res[i-2*k][1]

	now += res[i][1]
	now += res[i+1][1]

	ans = max(ans,now)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,m = map(int,input().split())
l = []
for i in range(m):
  l.append([int(i) for i in input().split()])
ll = []
for k in range(l[0][0],l[0][1]+1):
  ll.append(k)
for j in range(1,m):
  for i in ll:
    lll = copy.copy(ll)
    if i < l[j][0] or i > l[j][1]:
      lll.remove(i)
    ll = lll
print(len(ll))

Fixed submission:
n,m = map(int,input().split())
l = []
for i in range(m):
  l.append([int(i) for i in input().split()])
maxL = l[0][0]
minR = l[0][1]
for j in range(1,m):
  if maxL <= l[j][0]:
    maxL = l[j][0]
  if minR >= l[j][1]:
    minR = l[j][1]
if maxL <= minR:
  print(minR - maxL + 1)
else:
  print(0)

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

Fixed submission:
n,m = map(int,input().split())
l = []
for i in range(m):
  l.append([int(i) for i in input().split()])
maxL = l[0][0]
minR = l[0][1]
for j in range(1,m):
  if maxL <= l[j][0]:
    maxL = l[j][0]
  if minR >= l[j][1]:
    minR = l[j][1]
if maxL <= minR:
  print(minR - maxL + 1)
else:
  print(0)

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

Fixed submission:
n,m = map(int,input().split())
l = []
for i in range(m):
  l.append([int(i) for i in input().split()])
maxL = l[0][0]
minR = l[0][1]
for j in range(1,m):
  if maxL <= l[j][0]:
    maxL = l[j][0]
  if minR >= l[j][1]:
    minR = l[j][1]
if maxL <= minR:
  print(minR - maxL + 1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    if n >= i*r + j*g and (n - (i*r + j*g)) %  b == 0:
        count += 1
print(count)


Fixed submission:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
gg = n // g
for i in range(rr+1):
  for j in range(gg+1):
    if n >= i*r + j*g and (n - (i*r + j*g)) %  b == 0:
        count += 1
print(count)


Fixed submission:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
gg = n // g
bb = n // b
l = sorted([[gg,g],[rr,r],[bb,b]])
for i in range(l[0][0]+1):
  for j in range(l[1][0]+1):
    if n >= i*l[0][1] + j*l[1][1] and (n - (i*l[0][1] + j*l[1][1])) %  l[2][1] == 0:
        count += 1
print(count)

Fixed submission:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
gg = n // g
for i in range(rr+1):
  for j in range(gg+1):
    if n >= i*r + j*g and (n - (i*r + j*g)) %  b == 0:
        count += 1
print(count)

Fixed submission:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
gg = n // g
bb = n // b
for i in range(rr+1):
  for j in range(gg+1):
    if n >= i*r + j*g and (n - (i*r + j*g)) %  b == 0:
        count += 1
print(count)


Fixed submission:
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sum = 0
for i in range(1,n):
  if n // i == n % i:
    sum += i
print(sum)

Fixed submission:
n = int(input())
count = 0
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()
    return divisors
l = make_divisors(n)
for i in range(len(l)):
  if l[i]-1 > 0 and n // (l[i]-1) == n % (l[i]-1):
    count += l[i]-1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

n = int(input())
s = input()

black = [0] * (n+1)
white = [0] * (n+1)
ans = [0] * (n+1)
for i in range(n+1):
  black[i] = s[:i].count("#")
  white[i] = s[i:].count(".")
  ans[i] = black[i] + white[i]
print(min(ans))

Fixed submission:
n = int(input())
s = str(input())
x = s.count('.')

res = x

for c in s:
    if c == '#':
        x += 1
    else:
        x -= 1
    res = min(res , x)
print(res)
Buggy python submission (verdict: Runtime Error):
s = []
for i in range(5):
  s.append(int(input()))
k = int(input())
if max(s) - min(s) =< k:
  print("Yay!")
else:
  print(":(")

Fixed submission:
s = []
for i in range(5):
  s.append(int(input()))
k = int(input())
if max(s) - min(s) > k:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [[n,a],[0,b],[0,c],[0,d],[0,e],[0,0]]
time = 0
while s[5][0] != n:
  for i in range(5):
    if s[4-i][0] <= s[4-i][1]:
      s[4-i+1][0] += s[4-i][0]
      s[4-i][0] = 0
    else:
      s[4-i+1][0] += s[4-i][1]
      s[4-i][0] = s[4-i][0] - s[4-i][1]
  time += 1
print(time)

Fixed submission:
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(math.ceil(n / min(a,b,c,d,e)) + 4)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
a,p=[1],[1] for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)
def f(N,X): #X<=0やX>a_Nを許容し解説本文から簡略化
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])
print(f(N, X))


Fixed submission:
a = input()
if a == "25":
  print("Christmas")
elif a == "24":
  print("Christmas Eve")
elif a == "23":
  print("Christmas Eve Eve")
elif a == "22":
  print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Time Limit Exceeded):
n,k  = map(int,input().split())
l = sorted([int(input()) for i in range(n)])
#print(l)
ansl = []
for m in range(n-k+1):
  ansl.append(max(l[m:m+k])-min(l[m:m+k]))
print(min(ansl))

Fixed submission:
n,k  = map(int,input().split())
l = sorted([int(input()) for i in range(n)])
print(min(l[i+k-1] - l[i] for i in range(n-k+1)))
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
l = list(int(x) for x in input().split())
el = []
ol = []
for i in range(n):
  if i % 2 == 0:
    el.append(l[i])
  else:
    ol.append(l[i])
e1 = collections.Counter(el).most_common()[0][0]
e2 = collections.Counter(el).most_common()[1][0]
o1 = collections.Counter(ol).most_common()[0][0]
o2 = collections.Counter(ol).most_common()[1][0]
cnt1 = 0
cnt2 = 0
if e1 != o1:
  for i in range(n//2):
    if el[i] != e1:
      cnt1 += 1
    if ol[i] != o1:
      cnt1 += 1
  print(cnt1)
else:
  for i in range(n//2):
    if el[i] != e1:
      cnt1 += 1
    if ol[i] != o2:
      cnt1 += 1
    if el[i] != e2:
      cnt2 += 1
    if ol[i] != o1:
      cnt2 += 1
  print(min(cnt1,cnt2))

Fixed submission:
from collections import Counter

n = int(input())

e = []
o = []
for i, v in enumerate(input().split(' ')):
    if i % 2 == 0:
        e.append(int(v))
    else:
        o.append(int(v))

if len(set(e + o)) == 1:
    print(int(len(e + o) / 2))
    exit()

if Counter(o).most_common()[0][0] == Counter(e).most_common()[0][0]:
    ans = min(len(o) - Counter(o).most_common()[1][1] + len(e) - Counter(e).most_common()[0][1], len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[1][1])
    print(ans)
else:
    print(len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

S = []
for i in range(1, N+1):
    stu = A.index(i) + 1
    S.append(stu)

S = [str(S[i]) for i in range (N)]
print(' '.join(S))


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

ans = ['a' for i in range(N)]
for i in range (N):
    k = A[i] - 1
    ans[k] = str(i+1)

print(' '.join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int,input().split())
ans = 1
if A % 2 == 0 and B % 2 == 0:
    ans += 1
    while A % 2 == 0 and B % 2 == 0:
        A /= 2
        B /= 2
if A % 3 == 0 and B % 3 == 0:
    ans += 1
    while A % 3 == 0 and B % 3 == 0:
        A /= 3
        B /= 3
if A % 5 == 0 and B % 5 == 0:
    ans += 1
    while A % 5 == 0 and B % 5 == 0:
        A /= 5
        B /= 5

i = 3
while 2*i + 1 <= A and 2*i + 1 <= B:
    k = 2*i + 1
    if k % 3 == 0 or k % 5 == 0:
        i += 1
        continue
    elif A % k == 0 and B % k == 0:
        ans += 1
        A /= k
        B /= k
        while A % k == 0 and B % k == 0:
            A /= k
            B /= k
        i += 1
    else:
        i += 1
print(ans)

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

def ssb(n):
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n /= 2
    i = 3
    while i ** 2 <= n:
        if n % i == 0:
            a.add(i)
            n /= i
        else:
            i += 2
    if n != 1:
        a.add(n)
    return a

a = ssb(A)
b = ssb(B)

print(len(a&b))

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int,input().split())
ans = 1
i = 2
while i <= A and i <= B:
    if A % i == 0 and B % i == 0:
        ans += 1
        A /= i
        B /= i
        while A % i == 0 and B % i == 0:
            A /= i
            B /= i
            continue
        i += 1
    else:
        i += 1
print(ans)

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

def ssb(n):
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n /= 2
    i = 3
    while i ** 2 <= n:
        if n % i == 0:
            a.add(i)
            n /= i
        else:
            i += 2
    if n != 1:
        a.add(n)
    return a

a = ssb(A)
b = ssb(B)

print(len(a&b))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int,input().split())
A = [int((input())) for i in range(Q)]
pt = [K for i in range(N)]

for i in range(Q):
    for j in range(N):
        if A[i] - 1 != j:
            pt[j] -= 1

for i in range(N):
    if pt[i] >= 1:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K, Q = map(int,input().split())
A = [int((input())) for i in range(Q)]
pt = [K for i in range(N)]

import collections
ct = collections.Counter(A)

for i in range(N):
    if K - (Q - ct[i+1]) >= 1:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))

l = len(H)
L = [0]
for i in range(l-1):
    if H[i] < H[i+1]:
        L.append(i)

L.append(l-1)

jump = [L[i+1] - L[i] - 1 for i in range(len(L)-1)]
print(max(jump))


Fixed submission:
S = list(input())
T = list(input())
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
v = list(map(int,input().split()))
v.sort()

for i in range(N-1):
    v[i+1] = (v[i]+v[i+1]) / 2

print(v[n-1])

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

for i in range(N-1):
    v[i+1] = (v[i]+v[i+1]) / 2

print(v[N-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
M = max(A)
c = A.count(M)
a = list(set(A))
a.sort(reverse=True)
 
for i in range(N):
  if A[i] != M:
    print(M)
  else:
    if c >= 2:
      print(M)
    else:
      print(a[1])

Fixed submission:
print(((int(input()))**2)*3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
M = max(A)
c = A.count(M)
a = list(set(A))
a.sort(reverse=True)

for i in range(N):
  if A[i] != M:
    print(M)
  elif:
    if c >= 2:
      print(M)
    elif:
      print(a[1])
    

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
M = max(A)
c = A.count(M)
a = list(set(A))
a.sort(reverse=True)
 
for i in range(N):
  if A[i] != M:
    print(M)
  else:
    if c >= 2:
      print(M)
    else:
      print(a[1])

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

for i in range(N):
  a = A[i]
  del A[i]
  print(max(A))
  A.insert(i, a)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
M = max(A)
c = A.count(M)
a = list(set(A))
a.sort(reverse=True)
 
for i in range(N):
  if A[i] != M:
    print(M)
  else:
    if c >= 2:
      print(M)
    else:
      print(a[1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
a = list(map(int,input().split()))
p = 10**9 + 7
a.insert(0, -1)
a.append(N+1)

def mod(n,p):
    return n % p

nk = [1]
for i in range(1,N+1):
    nk.append(mod((nk[-1] * i), p))

#ある数をAで割ったとき，その数をpで割ったときの余りを求めるのにかけるべき数を返す
def bunbo(A, p): 
    # p-2を2進数にする
    pp = p-2
    pb = list(str(format(pp, 'b')))
    # ひっくりかえす
    pb.reverse()
    # pbの要素の数lとして，A^1, A^2, A^4, A^8, ..., A^(2^l)をpで割った余りを求める
    lpp = [mod(A,p)]
    for _ in range(len(pb)-1):
        lpp.append(mod((lpp[-1] ** 2), p))
    # 必要なやつだけ足して，x=(A^(p-2)をpで割った余り)を求める
    x = 1
    for i in range(len(pb)):
        if pb[i] == '1':
            x *= lpp[i]
    return mod(x, p)
    
def nckp(a, b, c, p):
    # 0!, 1!, 2!, 3!, ..., n!をリストに入れる
    return mod((a * bunbo(b, p) * bunbo(c, p)),p)



for i in range(M-2):
    if a[i+1] - a[i] == 1:
        print(0)
        break
else:
    ans = 1
    for j in range(len(a)-1):
        if a[j] != N:
            up = a[j+1] - a[j] - 2
            step = 0
            for l in range(up//2 + 1):
                way = nckp(nk[up-l], nk[l], nk[up-2*l], p)
                step += way
            ans *= step
    print(mod(ans, p))

Fixed submission:
P, Q, R = map(int,input().split())
l = [P+Q, Q+R, R+P]
print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
ans = set(j for j in range(mat[0][0], mat[0][-1] + 1))
for i in range(1, M):
    s = set(j for j in range(mat[i][0], mat[i][-1] + 1))
    ans = ans & s
print(len(ans))


Fixed submission:
N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
lmax = mat[0][0]
for i in range(M):
    if mat[i][0] > lmax:
        lmax = mat[i][0]
rmin = mat[0][1]
for i in range(M):
    if mat[i][1] < rmin:
        rmin = mat[i][1]

ans = rmin - lmax + 1
if ans >= 1:
    print(ans)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
ans = 0
for i in range(mat[0][0], mat[0][-1] + 1):
    for j in range(1, M):
        if i in range(mat[j][0], mat[j][-1] + 1):
            continue
        else:
            break
    else:
        ans += 1
print(ans)

Fixed submission:
N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
lmax = mat[0][0]
for i in range(M):
    if mat[i][0] > lmax:
        lmax = mat[i][0]
rmin = mat[0][1]
for i in range(M):
    if mat[i][1] < rmin:
        rmin = mat[i][1]

ans = rmin - lmax + 1
if ans >= 1:
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
s = input()
koho = []
for i in range(len(s)-2):
    S = int(s[i:i+3])
    sa = abs(S - 753)
    koho.append(sa)
print(min(koho))

Fixed submission:
X = int(input())
if X == 7 or X == 5 or X == 3:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N, T = map(int,input().split())
mincost = 1001
for i in range(1, N+1):
    c, t = map(int,input().split())
    if t <= T:
        cost = c
        if cost < mincost:
            mincost = cost

if mincost == 1001:
  print('TLE')
if mincost < 1001:
  print(mincost)


Fixed submission:
N = int(input())

if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)

Buggy python submission (verdict: Runtime Error):
N, T = map(int,input().split())
mincost = 1000
for i in range(1, N+1):
    c, t = map(int,input().split())
    if t <= T:
        cost = c
        if cost < mincost:
            mincost = cost

if mincost == 1000:
  print('TLE')
if mincost < 1000:
  print(mincost)

Fixed submission:
N = int(input())

if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)

Buggy python submission (verdict: Runtime Error):
N, T = map(int,input().split())
mintime = 1000
for i in range(1, N):
    c, t = map(int,input().split())
    if t <= T:
        time = t
        if time < mintime:
            mintime = time

print(mintime)

Fixed submission:
N = int(input())

if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 111 == 0:
  print(N)
for i in range(10):
  if N // 111 = i:
    print(111 * (i + 1) )

Fixed submission:
N = int(input())
if N % 111 == 0:
  print(N)
for i in range(10):
  if N % 111 != 0 and N // 111 == i:
    print(111 * (i + 1) )
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if S == T:
    print('Yes')
l = len(S)
L = list(S)
for i in range(l):
    a = L[0]
    del L[0]
    L.append(a)
    s = ''.join(L)
    if s == T:
        print('Yes')
        break
else:
    print('No')

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

print(a[2]-a[0])

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
A = a.sort()

print(A[2]-A[0])

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

print(a[2]-a[0])