Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp

Fixed submission:
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)

Buggy python submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp

Fixed submission:
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
input_data = input().split()

k=int(input_data[0])+1
s=int(input_data[1])
count=0

for i in range(k):
  for j in range(k):
    for u in range(k):
      if i + j + u == s:
        count= count +1
      else:
        pass

print(count)

Fixed submission:
input_data = input().split()

k=int(input_data[0])
s=int(input_data[1])
count=0

for i in range(k+1):
  for j in range(k+1):
    z = s - i - j
    if (0 <= z and z <= k):
      count= count +1
    else:
      pass

print(count)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L, R + 1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i] * number[j] % 2019):
            min =  number[i] * number[j] % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Fixed submission:
L, R = map(int, input().split())
min = 2100
for i in range(L, R):
    j = i + 1
    while(j < R + 1):
        if(min > i * j % 2019):
            min =  i * j % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)

Fixed submission:
L, R = map(int, input().split())
min = 2100
for i in range(L, R):
    j = i + 1
    while(j < R + 1):
        if(min > i * j % 2019):
            min =  i * j % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number)):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)

Fixed submission:
L, R = map(int, input().split())
min = 2100
for i in range(L, R):
    j = i + 1
    while(j < R + 1):
        if(min > i * j % 2019):
            min =  i * j % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)
Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = math.gcd(C,D)
l = C * D / g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))


Fixed submission:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = gcd(C,D)
l = C * D // g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))
Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[N-1] % (10**9 + 7))

Fixed submission:
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input()) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[NM[0]-1] % (10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = map(int, input().split())
ID = np.zeros(N)
for i in range(M):
    L, R = map(int, input().split())
    ID[L - 1:R] += 1
print(np.count_nonzero(ID == M))


Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())
max_L = max(L)
min_R = min(R)
if(min_R - max_L + 1 > 0):
    print(min_R - max_L + 1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = map(int, input().split())
LR = [[int(i) for i in input().split()] for i in range(M)]
ID = np.zeros(N)
for i in range(M):
    ID[LR[i][0] - 1:LR[i][1]] += 1
print(np.count_nonzero(ID == M))


Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())
max_L = max(L)
min_R = min(R)
if(min_R - max_L + 1 > 0):
    print(min_R - max_L + 1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
LR = [[int(i) for i in input().split()] for j in range(Q)]
check = [0] * (N - 1)
for i in range(N - 1):
    check[i] = 1 if S[i:i + 2] == "AC" else 0

for j in range(Q):
    print(sum(check[LR[j][0] - 1:LR[j][1] - 1]))


Fixed submission:
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
LR = [[int(i) for i in input().split()] for j in range(Q)]
check = [0] * N
for i in range(N - 1):
    check[i + 1] = check[i] + (1 if S[i:i + 2] == "AC" else 0)


for j in range(Q):
    print((check[LR[j][1] - 1]) - (check[LR[j][0] - 1]))

Buggy python submission (verdict: Time Limit Exceeded):
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
check = [0] * (N - 1)
answer = []
for i in range(N - 1):
    check[i] = 1 if S[i:i + 2] == "AC" else 0


for j in range(Q):
    lr = [int(i) for i in input().split()]
    answer.append(sum(check[lr[0] - 1:lr[1] - 1]))

for s in answer:
    print(s)

Fixed submission:
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
LR = [[int(i) for i in input().split()] for j in range(Q)]
check = [0] * N
for i in range(N - 1):
    check[i + 1] = check[i] + (1 if S[i:i + 2] == "AC" else 0)


for j in range(Q):
    print((check[LR[j][1] - 1]) - (check[LR[j][0] - 1]))

Buggy python submission (verdict: Time Limit Exceeded):
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
index = 0
answer = []
while(Q > 0):
    lr = [int(i) for i in input().split()]
    l = lr[0]
    r = lr[1]
    new_str = S[l-1:r]
    answer.append(len(re.findall("AC",new_str)))
    Q -= 1
    index += 1

for s in answer:
    print(s)

Fixed submission:
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
LR = [[int(i) for i in input().split()] for j in range(Q)]
check = [0] * N
for i in range(N - 1):
    check[i + 1] = check[i] + (1 if S[i:i + 2] == "AC" else 0)


for j in range(Q):
    print((check[LR[j][1] - 1]) - (check[LR[j][0] - 1]))

Buggy python submission (verdict: Time Limit Exceeded):
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
index = 0
answer = []
while(Q > 0):
    lr = [int(i) for i in input().split()]
    l = lr[0]
    r = lr[1]
    new_str = S[l-1:r]
    answer.append(len(re.findall("AC",new_str)))
    Q -= 1
    index += 1

index2 = 0
while(index > 0):
    print(answer[index2])
    index2 += 1
    index -= 1

Fixed submission:
import re

NQ = [int(i) for i in input().split()]
N = NQ[0]
Q = NQ[1]
S = input()
LR = [[int(i) for i in input().split()] for j in range(Q)]
check = [0] * N
for i in range(N - 1):
    check[i + 1] = check[i] + (1 if S[i:i + 2] == "AC" else 0)


for j in range(Q):
    print((check[LR[j][1] - 1]) - (check[LR[j][0] - 1]))
Buggy python submission (verdict: Time Limit Exceeded):
x = input()
y = x.split(" ")
parameters = [int(i) for i in y]
N = parameters[0]
M = parameters[1]
i = N
count = 0
A = [[0] * M for i in range(N)]
while(i > 0):
    x = input()
    y = x.split(" ")
    A[count] = [int(i) for i in y]
    count += 1
    i -= 1

cash = 0
while(M > 0):
    i = 0
    min = A[i][0]
    index = 0
    while(i < N):
        if(min > A[i][0]):
            min = A[i][0]
            index = i
        i += 1
    if(M - A[index][1] >= 0):
        M -= A[index][1]
        cash += A[index][1] * A[index][0]
    else:
        cash += A[index][0] * M
        M -= A[index][1]
    del A[index]
    N -= 1

print(cash)


Fixed submission:
NM = [int(i) for i in input().split()]
N = NM[0]
M = NM[1]
datalist = []
index = 0
cost = 0
num = 1
total_cost = 0
while(N > 0):
    data = [int(i) for i in input().split()]
    datalist.append(data)
    N -= 1
datalist.sort(key=lambda x:x[0])
while(M > 0):
    M -= datalist[index][num]
    total_cost += datalist[index][cost] * datalist[index][num]
    if(M < 0):
        n = abs(M)
        total_cost -= n * datalist[index][cost]
    index += 1
print(total_cost)

Buggy python submission (verdict: Time Limit Exceeded):
x = input()
y = x.split(" ")
parameters = [int(i) for i in y]
N = parameters[0]
M = parameters[1]
i = N
count = 0
A = [[0] * M for i in range(N)]
while(i > 0):
    x = input()
    y = x.split(" ")
    A[count] = [int(i) for i in y]
    count += 1
    i -= 1

cash = 0
while(M > 0):
    i = 0
    min = 1000000001
    index = 0
    while(i < N):
        if(min > A[i][0]):
            min = A[i][0]
            index = i
        i += 1
    if(M - A[index][1] >= 0):
        M -= A[index][1]
        cash += A[index][1] * A[index][0]
    else:
        cash += A[index][0] * M
        M -= A[index][1]
    del A[index]
    N -= 1

print(cash)


Fixed submission:
NM = [int(i) for i in input().split()]
N = NM[0]
M = NM[1]
datalist = []
index = 0
cost = 0
num = 1
total_cost = 0
while(N > 0):
    data = [int(i) for i in input().split()]
    datalist.append(data)
    N -= 1
datalist.sort(key=lambda x:x[0])
while(M > 0):
    M -= datalist[index][num]
    total_cost += datalist[index][cost] * datalist[index][num]
    if(M < 0):
        n = abs(M)
        total_cost -= n * datalist[index][cost]
    index += 1
print(total_cost)
Buggy python submission (verdict: Runtime Error):
r = input()
print(3*(r**2))

Fixed submission:
r = int(input())
print(3*(r**2))
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input())
print(-(-n // (1 + d * 2)))


Fixed submission:
n, d = map(int, input().split())
print(-(-n // (1 + d * 2)))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())

a = np.array([int(input()) for _ in range(n)])
[print(np.amax(np.amax(a[:i]), np.amax(a[i+1:]))) for i in range(n)]

Fixed submission:
import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in a]

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())

a = np.array([int(input()) for _ in range(n)])
[print(np.amax(np.hstack((a[:i], a[i+1:])))) for i in range(n)]

Fixed submission:
import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in a]

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

a = [int(input()) for _ in range(n)]
[print(max(a[:i] + a[i+1:])) for i in range(n)]


Fixed submission:
import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in a]
Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())

ll = l % 2019
rr = r % 2019
mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Fixed submission:
l,r = (int(i) for i in input().split())

if l <= 2019 <= r or r <= 2019 <= l or r - l >= 2019 or l - r >= 2019:
  print(0)
  exit(0)

while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)
if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):

      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())

mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ii = i % 2019
    jj = j % 2019
    mini = min(mini, (ii*jj) % 2019)
print(mini)

Fixed submission:
l,r = (int(i) for i in input().split())

if l <= 2019 <= r or r <= 2019 <= l or r - l >= 2019 or l - r >= 2019:
  print(0)
  exit(0)

while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)
if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):

      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())

mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Fixed submission:
l,r = (int(i) for i in input().split())

if l <= 2019 <= r or r <= 2019 <= l or r - l >= 2019 or l - r >= 2019:
  print(0)
  exit(0)

while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)
if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):

      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())

mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Fixed submission:
l,r = (int(i) for i in input().split())

if l <= 2019 <= r or r <= 2019 <= l or r - l >= 2019 or l - r >= 2019:
  print(0)
  exit(0)

while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)
if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):

      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = list(map(int, input().split()))

l = {}
ll = {}

if n % 2 == 0:
  for i in m:
    l[2*(i//2)+1] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1
else:
  for i in m:
    if 2*(i//2) == 0:
      l[2*(i//2)] = 1
    else:
      l[2*(i//2)] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1

if l != ll:
  print(0)
  exit()

print(1 << (n // 2) / (10**9+7))


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

l = {}
ll = {}

if n % 2 == 0:
  for i in m:
    l[2*(i//2)+1] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1
else:
  for i in m:
    if 2*(i//2) == 0:
      l[2*(i//2)] = 1
    else:
      l[2*(i//2)] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1

if l != ll:
  print(0)
  exit()

print((1 << (n // 2)) % ((10 ** 9) + 7))
Buggy python submission (verdict: Runtime Error):
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] or N[3]==N[4]:
    print("Bad")
else:
    print("Good")

Fixed submission:
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3]:
    print("Bad")
else:
    print("Good")

Buggy python submission (verdict: Runtime Error):
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] or N[3]==N[4]:
    print("Bad")
else:
    print("Good)

Fixed submission:
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3]:
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
A,B,C,D = map(int, input().split())
cmlist,dmlist=[],[]
count=0
for i in range(A,B+1):
    if i%C != 0 and i%D != 0:
        count+=1
print(count)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

lcm=C*D//gcd(C,D)
con1=B//C - (A-1)//C
con2=B//D - (A-1)//D
con3=B//lcm - (A-1)//lcm

print(B-(A-1)-(con1+con2-con3))

Buggy python submission (verdict: Runtime Error):
import numpy as np
A,B,C,D = map(int, input().split())
ndcage = np.arange(A,B+1)

cmlist = np.nonzero(ndcage % C)[0]
dmlist = np.nonzero(ndcage % D)[0]

count=0
for i in cmlist:
    if i in dmlist:
        count+=1
print(count)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

lcm=C*D//gcd(C,D)
con1=B//C - (A-1)//C
con2=B//D - (A-1)//D
con3=B//lcm - (A-1)//lcm

print(B-(A-1)-(con1+con2-con3))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M, C = map(int, input().split())
M=[int(x) for x in input().split()]
nlist=[]

for i in range(N):
    nlist.append([int(x) for x in input().split()])

nlist=np.array(nlist)
M= np.array(M)
ans=(nlist*M+C).sum(axis=1)
print((ans>0).sum())

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
print((H-h)*(W-w))
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if cage is None:
  print("TLE")
else:
  print(min(cage))

Fixed submission:
a = int(input())
if a==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())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
if cage is None:
  print("TLE")
else:
  print(min(cage))

Fixed submission:
a = int(input())
if a==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())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
if cage==None:
  print("TLE")
else:
  print(min(cage))

Fixed submission:
a = int(input())
if a==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())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if cage==None:
  print("TLE")
else:
  print(min(cage))

Fixed submission:
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
if cage==None:
  print("TLE")
else:
  print(min(cage))

Fixed submission:
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
if cage==None:
  print("TLE")
else:
  print(soted(cage)[0])

Fixed submission:
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
    cage2.append(n)
if cage==None:
  print("TLE")
else:
  print(soted(cage)[0])

Fixed submission:
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
cage,cage2=[],[]
for n,i in enumerate(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
    cage2.append(n)
if cage==None:
  print("TLE")
else:
  print(soted(cage)[0]

Fixed submission:
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))
Buggy python submission (verdict: Runtime Error):
s = input()
s=sorted(s)
if s[0]==S[1] and s[2]==s[3]:	print("Yes")
else:							print("No")



Fixed submission:
s = input()
s = sorted(s)
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
from scipy.special import perm, comb
n, k = map(int, input().split())
for i in range(1, k+1):
	print( comb(k-1, i-1, exact=True)*comb(n-k+1, n-k-i+1, exact=True)%(10**9+7) )


Fixed submission:
from scipy.misc import comb
n, k = map(int, input().split())
for i in range(1, k+1):
	print( comb(k-1, i-1, exact=True)*comb(n-k+1, n-k-i+1, exact=True)%(10**9+7) )
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
s = [input() for i in range(N)]
mar = s
for i in range(N):
    mar = s[:]
    mar.pop(i)
    print(max(mar))

Fixed submission:
N = int(input())
s = [int(input()) for i in range(N)]
ld = sorted(s, reverse=True)
D = int(s.index(ld[0]))

if N == 1:
    print(s[0])
else:
    for i in range(D):
        print(ld[0])
    print(ld[1])
    for i in range(N-D-1):
        print(ld[0])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n,m = map(int, raw_input().split())
# 文字列の入力
# 出力
gate = [[0,0]]*m
for i in range(m):
    gate[i]=raw_input().split()

cnt = 0
c = 0
for j in range(n):
    j = j+1
    for i in range(m):
        if j >= int(gate[i][0]) and int(gate[i][1]) >= j:
            c += 1
    if c == m:
        cnt = cnt+1
    c = 0

print cnt

Fixed submission:
# -*- coding: utf-8 -*-
n,m = map(int, raw_input().split())
# 文字列の入力
# 出力
gate = [[0,0]]*m
for i in range(m):
    gate[i]=raw_input().split()

cnt = 0
min_r = n
max_l = 0
for i in range(m):
    g0 = int(gate[i][0])
    g1 = int(gate[i][1])

    if max_l < g0:
        max_l = g0

    if min_r > g1:
        min_r = g1

for j in range(n):
    j=j+1
    if j >= max_l and min_r >= j:
            cnt += 1

print cnt