Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
value = input()
list = value.split()
A = int(list[2] - list[0])
print(int(list[1]) - A)

Fixed submission:
a,b,k = map(int,input().split())
if a - k >= 0 :
    print(a - k,b)
elif a + b - k >= 0  :
    print(0,b-(k-a))
else:
    print(0,0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input()
count = 0
split = [int(i) for i in A.split(" ")]

for i in range(N):
    if split[i] == 1:
        count +=1
        break

if count != 0:
    count = 0
    for i in range(N):
        i -= count
        if i + 1 != split[i]:
            del split[i]
            count += 1
    print(count)
else:
    print(-1)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count = 0
num = 1

for i in range(N):
    if A[i] == num:
        num += 1
    else:
        count += 1

if count == N:
    print(-1)
else:
    print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input()
count = 0
split = [int(i) for i in A.split(" ")]

for i in range(N):
    i -= count
    if i + 1 != split[i]:
        del split[i]
        count += 1

if split == []:
    print(-1)
else:
    print(count)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count = 0
num = 1

for i in range(N):
    if A[i] == num:
        num += 1
    else:
        count += 1

if count == N:
    print(-1)
else:
    print(count)

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

for i in range(N):
    i -= count
    if i + 1 != split[i]:
        del split[i]
        count += 1

if split == []:
    print(-1)
else:
    print(count)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count = 0
num = 1

for i in range(N):
    if A[i] == num:
        num += 1
    else:
        count += 1

if count == N:
    print(-1)
else:
    print(count)
Buggy python submission (verdict: Runtime Error):
sum = 0
for num range(3):
  num = input()
  sum += int(num)
 if sum >= 22:
  print("bust")
 else:
  print("win")

Fixed submission:
a , b , c  = map(int , (input().split()))
sum = a + b + c
if sum >= 22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
s,t = input.split()
print(t.lower()+s.lower())

Fixed submission:
s,t = input().split()
print(t.lower() + s.lower())

Buggy python submission (verdict: Runtime Error):
s,t = raw_input.split()
print(t.lower() + s.lower())

Fixed submission:
s,t = input().split()
print(t.lower() + s.lower())

Buggy python submission (verdict: Runtime Error):
s,t = raw_input.split()
print(t+s)

Fixed submission:
s,t = input().split()
print(t.lower() + s.lower())

Buggy python submission (verdict: Runtime Error):
print(''.join(sorted(S+T)))

Fixed submission:
s,t = input().split()
print(t.lower() + s.lower())

Buggy python submission (verdict: Runtime Error):
print(''.join(sorted(S+T)))

Fixed submission:
s,t = input().split()
print(t.lower() + s.lower())
Buggy python submission (verdict: Time Limit Exceeded):
import sys

n = int(input())
cnt = 0

for i in range(1, int(n / 2)):
    for j in range(1, n):
        if (i + j) == n and i != j:
            cnt += 1
print(cnt)

Fixed submission:
import sys

n = int(input())

if n % 2 == 0:
    ans = int(n / 2) - 1
else:
    ans = int(n / 2)

print('{}'.format(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans = []
for i in range(1, n+1):
  ans.append(l.index(i)+1)

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

Fixed submission:
import numpy as np

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

k = np.argsort(l)

for i in range(n):
  k[i]+=1

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

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

ans = []
for i in range(1, n+1):
  ans.append(l.index(i)+1)

a = ""
for idx in range(n-1):
  a += str(ans[idx])
  a += " "

a += str(ans[n-1])
print(a)

Fixed submission:
import numpy as np

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

k = np.argsort(l)

for i in range(n):
  k[i]+=1

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

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

ans = []
for i in range(1, n+1):
  ans.append(l.index(i)+1)

a = ""
for idx in range(n-1):
  a += str(ans[idx])
  a += " "

a += str(ans[n-1])
print(a)

Fixed submission:
import numpy as np

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

k = np.argsort(l)

for i in range(n):
  k[i]+=1

print(' '.join(map(str, k)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
b = list(map(int, input().split()))

a = [0 for k in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]

for i in range(1, n-1):
  j=0
  while not j == min(b[i], b[i-1]):
    j += 1
  a[i]=j
  
ans = 0
for x in range(n):
  ans += a[x]

print(ans)

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

a = [0 for k in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]

for i in range(1, n-1):
  a[i]=min(b[i], b[i-1])
  
ans = 0
for x in range(n):
  ans += a[x]

print(ans)

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

a = [0 for k in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]

for i in range(1, n-1):
  j=0
  while not j == min(b[i], b[i-1]):
    j += 1
  a[i]=j
  
ans = 0
for x in range(n):
  ans += a[x]

print(ans)

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

a = [0 for k in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]

for i in range(1, n-1):
  a[i]=min(b[i], b[i-1])
  
ans = 0
for x in range(n):
  ans += a[x]

print(ans)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())

listX = []
sw = 0
i = 1
for i in range(1, 990590):
  listX.append(i*2019)

for n in range(len(listX)):
  if L < listX[n] and R > listX[n]:
    sw += 1

if sw > 0:
  print(0)

elif sw == 0:      
  L_1 = L % 2019
  R_1 = R % 2019
  
  idx1 = 0
  listA = []
  for idx1 in range(L_1, R_1):
    for idx2 in range(idx1 + 1, R_1 + 1):
      listA.append(idx1 * idx2)
 
  print(min(listA))

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

if N*A < B:
  print(N*A)
else:
  print(B)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

if K >= A:
    K = K - A
    A = 0
else:
    A = A - K
    K = 0


if K >= B:
    K = K - B
    B = 0
else:
    B = B - K
    K = 0



for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    else:
        pass

print('{} {}'.format(A, B))


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

if K >= A:
    K = K - A
    A = 0
else:
    A = A - K
    K = 0


if K >= B:
    K = K - B
    B = 0
else:
    B = B - K
    K = 0


if A or B:
    for i in range(K):
        if A >= 1:
            A -= 1
        elif B >= 1:
            B -= 1
        else:
            pass

print('{} {}'.format(A, B))
Buggy python submission (verdict: Runtime Error):
import random


def is_prime(q, k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1) >> 1
    while d & 1 == 0:
        d >>= 1

    #判定をk回繰り返す
    for i in xrange(k):
        a = random.randint(1, q-1)
        t = d
        y = pow(a, t, q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q-1 and t & 1 == 0:
            return False
    return True

X = int(input())

while True:
    if is_prime(X):
        break
    X += 1
print(X)





Fixed submission:
import random


def is_prime(q, k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1) >> 1
    while d & 1 == 0:
        d >>= 1

    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q-1)
        t = d
        y = pow(a, t, q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q-1 and t & 1 == 0:
            return False
    return True

X = int(input())

while True:
    if is_prime(X):
        break
    X += 1
print(X)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if N % 2 == 1:
  print('No')
  exit()

if S[:N/2] == S[N/2:]:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
S = input()

if S[:N//2] == S[N//2:]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())


for a in range(N // 100 + 1):
  for b in range(N // 101 + 1):
    for c in range(N // 102 + 1):
      for d in range(N // 103 + 1):
        for e in range(N // 104 + 1):
          for f in range(N // 105 + 1):
            if a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105 == N:
              print(1)
              exit()
print(0)




Fixed submission:
N = int(input())


for a in range(N // 100 + 1):
  for b in range(N // 101 + 1):
    for c in range(N // 102 + 1):
      for d in range(N // 103 + 1):
        for e in range(N // 104 + 1):
          for f in range(N // 105 + 1):
            if a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105 == N:
              print(1)
              exit()
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for a in range(N // 100 + 1):
  for b in range(N // 101 + 1):
    for c in range(N // 102 + 1):
      for d in range(N // 103 + 1):
        for e in range(N // 104 + 1):
          for f in range(N // 105 + 1):
            if a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105 == N:
              print(1)
              exit()
print(0)

Fixed submission:
N = int(input())


for a in range(N // 100 + 1):
  for b in range(N // 101 + 1):
    for c in range(N // 102 + 1):
      for d in range(N // 103 + 1):
        for e in range(N // 104 + 1):
          for f in range(N // 105 + 1):
            if a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105 == N:
              print(1)
              exit()
print(0)
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
e = False
first = True
n = 0
chk = ''

if a * 1000000000 + b * len(str(1000000000)) <= x:
    print(1000000000)
    exit()


n = int((x -(len(str(int(x // a)))*b))//a) - 1000000
if n < 0:
    n = 0
    
while e == False:
    p = a * n + b * len(str(n))
    if p <= x:
        chk = 'kaeru'
    elif p > x:
        chk += 'kaenai'
    if first == True and chk == 'kaenai':
        print(0)
        break
        
    if chk == 'kaerukaenai':
        print(n - 1)
        break
    n += 1
    first = False


Fixed submission:
s = input()
a = ''
if s == 'SUN':
    a = 7
elif s == 'MON':
    a = 6
elif s == 'TUE':
    a = 5
elif s == 'WED':
    a = 4
elif s == 'THU':
    a = 3
elif s == 'FRI':
    a = 2
elif s == 'SAT':
    a = 1
    
print(a)

Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
e = False
first = True
n = 0
chk = ''

if a * 1000000000 + b * len(str(1000000000)) <= x:
    print(1000000000)
    exit()

if x - (a+b) > 0:
    n = a+b-1
    
    
while e == False:
    p = a * n + b * len(str(n))
    if p <= x:
        chk = 'kaeru'
    elif p > x:
        chk += 'kaenai'
    if first == True and chk == 'kaenai':
        print(0)
        break
        
    if chk == 'kaerukaenai':
        print(n - 1)
        break
    n += 1
    first = False

Fixed submission:
s = input()
a = ''
if s == 'SUN':
    a = 7
elif s == 'MON':
    a = 6
elif s == 'TUE':
    a = 5
elif s == 'WED':
    a = 4
elif s == 'THU':
    a = 3
elif s == 'FRI':
    a = 2
elif s == 'SAT':
    a = 1
    
print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)
  exit()
if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)


Fixed submission:
a, b, c = map(int,input().split())
ans = c-(a-b)
if ans < 0:
  ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)

if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)


Fixed submission:
a, b, c = map(int,input().split())
ans = c-(a-b)
if ans < 0:
  ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)

if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)


Fixed submission:
a, b, c = map(int,input().split())
ans = c-(a-b)
if ans < 0:
  ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K =  map(int,input().split())

for i in range(K):
    if A>=1:
        A=A-1
    elif B>=1:
        B=B-1
    else:
        break
    
print("{} {}".format(A, B))

Fixed submission:
A,B,K =  map(int,input().split())
if K==0:
    print("{} {}".format(A, B))
elif A==0&B==0:
    A=0
    B=0
    print("{} {}".format(A, B))
elif A<K:
    B=B-(K-A)
    if B<0:
        B=0
    A=0
    print("{} {}".format(A, B))
elif A==K:
    A=0
    print("{} {}".format(A, B))
else :
    A = A-K
    print("{} {}".format(A, B))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K =  map(int,input().split())

for i in range(K):
    if A>=1:
        A=A-1
    elif B>=1:
        B=B-1
    else:
        break
    
print("{} {}".format(A, B))

Fixed submission:
A,B,K =  map(int,input().split())
if K==0:
    print("{} {}".format(A, B))
elif A==0&B==0:
    A=0
    B=0
    print("{} {}".format(A, B))
elif A<K:
    B=B-(K-A)
    if B<0:
        B=0
    A=0
    print("{} {}".format(A, B))
elif A==K:
    A=0
    print("{} {}".format(A, B))
else :
    A = A-K
    print("{} {}".format(A, B))
Buggy python submission (verdict: Runtime Error):
s = input()

if s % 1.08 < 0.1:
  print(':(')
else:
  x = s // 1.08
  x = int(x)
  print(x)

Fixed submission:
import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))

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

x = s / 1.08

rx = round(x)
tashikame = rx * 1.08
tashikames = math.floor(tashikame)
tashikames = int(tashikames)
if s != tashikames:
  print(':(')
else:
  x = int(x)
  print(x)

Fixed submission:
import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))

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

x = s / 1.08

rx = round(x)
tashikame = rx * 1.08
tashikames = math.floor(tashikame)
tashikames = int(tashikames)
if s != tashikames:
  print(':(')
else:
  print(x)

Fixed submission:
import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))

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

x = s / 1.08

tashikame = round(x) * 1.08
tashikame = math.floor(tashikame)
if s != tashikame:
    print(':(')
else:
    print(x)

Fixed submission:
import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
  score += b[i]
  _order = a[i]
  
  if order+1 == _order:
    score += c[order - 1]
  order = _order
  
print(score)

Fixed submission:
n = int(input())
answer = n * n * n
print(answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
  score += b[i]
  _order = a[i]
  
  if order+1 == _order:
    score += c[order - 1]
  order = _order
  
print(score)

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

score = 0
order = -1

for i in range(n):
  score += b[i]
  _order = a[i]

  if order + 1 == _order:
    score += c[order - 1]
    
  order = _order

print(score)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))score = 0
order = -1
for i in range(n):
 score += b[i]
 _order = a[i]
 if order+1 == _order:
   score += c[order - 1]
 order = _orderprint(score)

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

score = 0
order = -1

for i in range(n):
  score += b[i]
  _order = a[i]

  if order + 1 == _order:
    score += c[order - 1]
    
  order = _order

print(score)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout

input = stdin.readline()[:-1].split(' ')

takahashi = int(input[0])
aoki = int(input[1])
k = int(input[2])

for n in range(k):
    if takahashi > 0:
        takahashi -= 1
    elif aoki > 0:
        aoki -= 1

print('{} {}'.format(takahashi, aoki))


Fixed submission:
from sys import stdin, stdout

input = stdin.readline()[:-1].split(' ')

takahashi = int(input[0])
aoki = int(input[1])
k = int(input[2])

if k > 0:
    if takahashi > k:
        prev_k = k
        takahashi = takahashi - prev_k
        k = prev_k - takahashi
    else:
        k = k - takahashi
        takahashi = 0

if k > 0:
    if aoki > k:
        aoki = aoki - k
    else:
        aoki = 0

print('{} {}'.format(takahashi, aoki))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

m = T + S
            
print(m)

Fixed submission:
S,T = input().split()

print(T + S)
Buggy python submission (verdict: Time Limit Exceeded):
At,Ba,K = (int(x) for x in input().split())

for i in range(K):
    if At >= 1:
        At -= 1
    elif Ba >= 1:
        Ba -= 1
    
print(At)
print(Ba)

Fixed submission:
At,Ba,K = (int(x) for x in input().split())

if K <= At:
    print(At - K)
    print(Ba)
elif K <= At + Ba:
    print(0)
    print(Ba - (K - At))
else :
    print(0)
    print(0)

Buggy python submission (verdict: Runtime Error):
At = int(input())
Ba = int(input())
K = int(input())

for i in range(K):
    if At >= 1:
        At -= 1
    elif Ba >= 1:
        Ba -= 1
    
print(At)
print(Ba)

Fixed submission:
At,Ba,K = (int(x) for x in input().split())

if K <= At:
    print(At - K)
    print(Ba)
elif K <= At + Ba:
    print(0)
    print(Ba - (K - At))
else :
    print(0)
    print(0)

Buggy python submission (verdict: Runtime Error):
At = int(input())
Ba = int(input())
K = int(input())

for i in range(K):
    if At >= 1:
        At -= 1
    elif Ba >= 1:
        Ba -= 1
    
print(At)
print(Ba)
    

Fixed submission:
At,Ba,K = (int(x) for x in input().split())

if K <= At:
    print(At - K)
    print(Ba)
elif K <= At + Ba:
    print(0)
    print(Ba - (K - At))
else :
    print(0)
    print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

count = None

for i in range(3):
    if(S[i] == T[i]):
        count += 1
        
if(count == 0):
    print(0)
elif(count == 1):
    print(1)
elif(count == 2):
    print(2)
else:
    print(3)

Fixed submission:
S = input()
T = input()

count = 0

for i in range(3):
    if(S[i] == T[i]):
        count += 1
        
if(count == 0):
    print(0)
elif(count == 1):
    print(1)
elif(count == 2):
    print(2)
else:
    print(3)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())


for i in range(K):
    if A >0:
        A -= 1
    elif A==0 and B>0:
        B -= 1
    else:
        pass
    
print(A, B)


Fixed submission:
A, B, K = map(int, input().split())
 
if K<=A:
    ansa=A-K
    ansb=B
elif K>A and K<=A+B:
    ansa=0
    ansb=B-(K-A)
else:
    ansa=0
    ansb=0

print(ansa, ansb)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())

while True:
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            break
    n += 1

    
print(n)

Fixed submission:
import math
n=int(input())

def prime(n):
    if n <= 1:
        return False
    
    for k in range(2, int(math.sqrt(n))+1):
        if n%k ==0:
            return False
    return True
    
while not(prime(n)):
    n += 1

    
print(n)

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

X += 1
while True:
    std = X**0.5
    for i in range(1,int(std)):
        if X%i == 0:
            break
    X += 1

print(X)


Fixed submission:
import math
n=int(input())

def prime(n):
    if n <= 1:
        return False
    
    for k in range(2, int(math.sqrt(n))+1):
        if n%k ==0:
            return False
    return True
    
while not(prime(n)):
    n += 1

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

total =min(A, B)

while True:
    if total %A ==0 and total %B ==0:
        ans = total
        break
    else:
        total +=1

print(ans)

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

k = B
while True:
    if k % A ==0:
        ans = k
        break
    else:
        k += B

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: (sp[0], -sp[1]))

for i in range(sort):
    print(i[2])
    

Fixed submission:
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: (sp[0], -sp[1]))

for i in sort:
    print(i[2])

Buggy python submission (verdict: Runtime Error):
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: sp[0], -sp[1])

for i in range(sort):
    print(i[2])
    

Fixed submission:
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append([s,int(p),i+1])
    
sort=sorted(sp, key=lambda sp: (sp[0], -sp[1]))

for i in sort:
    print(i[2])
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
count=[]*n
for i in range(1,n):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":
        count[i]+=1

for i in range(q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])


Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count("AC"))
    



Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])
Buggy python submission (verdict: Runtime Error):
import deque
S=input()

stack=deque()
cnt=0
for s in S:
    if not stack:
        stack.append(s)
    elif s!=stack[-1]:
        stack.pop()
        cnt+=2
    else:
        stack.append(s)
        
print(cnt)
        

Fixed submission:
S=input()

stack=[]
cnt=0
for s in S:
    if not stack:
        stack.append(s)
    elif s!=stack[-1]:
        stack.pop()
        cnt+=2
    else:
        stack.append(s)
        
print(cnt)