Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from fractions import gcd
from functools import reduce
 
N,*A = map(int,read().split())
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum((lcm//x) % MOD for x in A)
answer %= MOD
print(answer)

Fixed submission:
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum((lcm//x) % MOD for x in A)
answer %= MOD
print(answer)

Fixed submission:
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
 
N,*A = map(int,read().split())
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum((lcm//x) % MOD for x in A)
answer %= MOD

Fixed submission:
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
  return reduce(lcm, numbers, 1)         
         
lcm_ans = lcm_list(A)
ans = 0

for i in range(N):
  ans += (lcm_ans // A[i]) % MOD
  ans = ans % MOD
        
print(ans)         


Fixed submission:
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
  return reduce(lcm, numbers, 1)         
         
lcm_ans = lcm_list(A)
ans = 0

for i in range(N):
  ans += (lcm_ans // A[i]) % MOD
  ans = ans % MOD
        
print(ans)         

Fixed submission:
from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
start = [0] * N
end = [0] * N
imosu = [0] * (2 * N)
imosu2 = [-10 ** 10] * (2 * N)
imosu3 = [0] * (2 * N)
for i in range(N):
  x, l = map(int, input().split())
  start[i] = x - l
  end[i] = x + l
  imosu[2 * i] = x - l
  imosu[2 * i + 1] = x + l
imosu = sorted(imosu)
#print(start, end, imosu)
j = 0
for i in range(2 * N):
  if i == 0:
    imosu2[j] = imosu[i]
  else:
    if imosu[i] != imosu[i - 1]:
      j += 1
      imosu2[j] = imosu[i]
#print(imosu2)
for i in start:
  x = imosu2.index(i)
  imosu3[x] += 1
#print(imosu3)
for i in end:
  x = imosu2.index(i)
  imosu3[x] -= 1
#print(imosu3)

for i in range(1, 2 * N):
  imosu3[i] += imosu3[i - 1]
#print(imosu3)

ans = 0 
now = 0
for i in range(2 * N):
  #print(i)
  if imosu3[i] > 0:
    now = max(now, imosu3[i])
  else:
    if now >= 2:
      ans += now - 1
      now = 0
    else:
      now = 0

print(N - ans)


Fixed submission:
N = int(input())
xl = [0] * N
for i in range(N):
  x, l = map(int ,input().split())
  a = x - l
  b = x + l
  xl[i] = [a, b]
  
xl = sorted(xl, key = lambda x:x[1])

ans = 0
now = 0
for i in range(N):
  if i == 0:
    ans += 1
    now = xl[0][1]
  else:
    if xl[i][0] >= now:
      ans += 1
      now = xl[i][1]
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
maze = [0] * H
for i in range(H):
  maze[i] = str(input())

ans = 0  
for i in range(H):#20
  for j in range(W):#20
    if maze[i][j] != "#":
      visited = [[float("inf")] * W for _ in range(H)]
      visited[i][j] = 0
      queue = [[i, j]]
      while queue:#400
        x, y = queue.pop()
        for p, q in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
          if (0 <= x + p < H) and (0 <= y + q < W):
            if (maze[x+p][y+q] !="#"):       
              if visited[x+p][y+q] > visited[x][y] + 1:
                queue.append([x+p, y+q])
                visited[x+p][y+q] = visited[x][y] + 1
      #print(visited)        
      now = 0
      for k in range(H):
        for k2 in range(W):
          if visited[k][k2] < 10 ** 10:
            now = max(now, visited[k][k2])
      ans = max(ans, now)
      
print(ans)

            
            
            
            
        


Fixed submission:
H, W = map(int, input().split())
maze = [0] * H
for i in range(H):
  maze[i] = str(input())

ans = 0  
for i in range(H):#20
  for j in range(W):#20
    if maze[i][j] != "#":
      visited = [[float("inf")] * W for _ in range(H)]
      visited[i][j] = 0
      queue = [[i, j]]
      while queue:#400
        x, y = queue.pop()
        for p, q in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
          if (0 <= x + p < H) and (0 <= y + q < W):
            if (maze[x+p][y+q] !="#"):       
              if visited[x+p][y+q] > visited[x][y] + 1:
                queue.append([x+p, y+q])
                visited[x+p][y+q] = visited[x][y] + 1
      #print(visited)        
      now = 0
      for k in range(H):
        for k2 in range(W):
          if visited[k][k2] < 10 ** 10:
            now = max(now, visited[k][k2])
      ans = max(ans, now)
      
print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse = True)#長さがN

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def half_lcm_list(numbers):
    return reduce(lcm_base, numbers, 1) / 2

min_A = half_lcm_list(A)

#print(min_A)
ans = 0
if min_A > M:
  ans = 0
else:
  ans = 1
  ans += int((M - min_A) / (min_A * 2))
  
print(ans)
  



Fixed submission:
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
  A[i] = A[i] // 2
  
p = 0
de_2 = 0
x = A[0]
while (p == 0):
  if x % 2 == 0:
    x = x // 2
    de_2 += 1
  else:
    p = 1
    
de = 2 ** de_2
for i in range(1, N):
  if A[i] % de == 0:
    if A[i] % (de * 2) != 0:
      continue
    else:
      print("0")
      quit()
  else:
    print("0")
    quit()
  
lcm = lcm_list(A)
p = M // lcm
if p % 2 == 0:
  ans = p // 2
else:
  ans = (p + 1) // 2
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

len1 = T1 * A1 + T2 * A2
len2 = T1 * B1 + T2 * B2
if len1 == len2:
  print("infinity")
  quit()

ans = 0
subs = 0  
sub1 = T1 * (A1 - B1)
sub2 = T2 * (A2 - B2)
X = [1, 1]
i = 0
while (X != [0, 0]):
  i += 1
  if subs != 0:
    if subs ** 2 + subs * sub1 <= 0:
      ans += 1
      X[0] = 1
    else:
      X[0] = 0
  subs = subs + sub1
  if subs != 0:
    if subs ** 2 + subs * sub2 <= 0:
      ans += 1
      X[1] = 1
    else:
      X[1] = 0
  subs = subs + sub2

print(ans)
   
    

Fixed submission:
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

len1 = T1 * A1 + T2 * A2
len2 = T1 * B1 + T2 * B2
if len1 == len2:
  print("infinity")
  quit()

ans = 0
subs = 0  
sub1 = T1 * (A1 - B1)
sub2 = T2 * (A2 - B2)

if sub1 > 0:
  if len1 - len2 > 0:
    ans = 0
  else:
    S = (-1 * sub1) // (sub1 + sub2)
    T = (-1 * sub1) % (sub1 + sub2)
    if T == 0:
      ans = 2 * S
    else:
      ans = 2 * S + 1
else:
  if len1 - len2 < 0:
    ans = 0
  else:
    S = (-1 * sub1) // (sub1 + sub2)
    T = (-1 * sub1) % (sub1 + sub2)
    if T == 0:
      ans = 2 * S
    else:
      ans = 2 * S + 1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

len1 = T1 * A1 + T2 * A2
len2 = T1 * B1 + T2 * B2
if len1 == len2:
  print("infinity")
  quit()

ans = 0
subs = 0  
sub1 = T1 * (A1 - B1)
sub2 = T2 * (A2 - B2)
X = [1, 1]
i = 0
while (X != [0, 0]):
  i += 1
  if subs != 0:
    if (subs + sub1)(subs) <= 0:
      ans += 1
      X[0] = 1
    else:
      X[0] = 0
  subs = subs + sub1
  if subs != 0:
    if subs(subs + sub2) <= 0:
      ans += 1
      X[1] = 1
    else:
      X[1] = 0
  subs = subs + sub2

print(ans)
   
    

Fixed submission:
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

len1 = T1 * A1 + T2 * A2
len2 = T1 * B1 + T2 * B2
if len1 == len2:
  print("infinity")
  quit()

ans = 0
subs = 0  
sub1 = T1 * (A1 - B1)
sub2 = T2 * (A2 - B2)

if sub1 > 0:
  if len1 - len2 > 0:
    ans = 0
  else:
    S = (-1 * sub1) // (sub1 + sub2)
    T = (-1 * sub1) % (sub1 + sub2)
    if T == 0:
      ans = 2 * S
    else:
      ans = 2 * S + 1
else:
  if len1 - len2 < 0:
    ans = 0
  else:
    S = (-1 * sub1) // (sub1 + sub2)
    T = (-1 * sub1) % (sub1 + sub2)
    if T == 0:
      ans = 2 * S
    else:
      ans = 2 * S + 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
for i in range(3000):
  for j in range(3000):
    print(i + j)

Fixed submission:
N, T = map(int, input().split())
food = [0] * N
for i in range(N):
  food[i] = list(map(int, input().split()))

food = sorted(food)  
#i番目までの商品でj分いないに完食できる美味しさの最大値  
dp = [[0] * (T + 1) for i in range(N + 1)]  

for i in range(N):
  for j in range(1, T + 1):
    #i番目の商品を使わない場合
    now = max(dp[i + 1][j - 1], dp[i][j])
    #使う場合
    if (j - food[i][0]) >= 0:
      now2 = dp[i][j - food[i][0]] + food[i][1]
    else:
      now2 = 0
    dp[i + 1][j] = max(now, now2)
    
#print(dp)
#T - 1分に i + 1番目の商品を注文
ans = 0
for i in range(N):
  now3 = dp[i][T - 1] + food[i][1]
  #print(dp[i][T - 1], food[i][1])
  ans = max(ans, now3)
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, input().split())
food = [0] * N
for i in range(N):
  food[i] = list(map(int, input().split()))

food = sorted(food)  
#i番目までの商品でj分いないに完食できる美味しさの最大値  
dp = [[0] * (T + 1) for i in range(N + 1)]  

for i in range(N):
  for j in range(1, T + 1):
    #i番目の商品を使わない場合
    now = max(dp[i + 1][j - 1], dp[i][j])
    #使う場合
    if (j - food[i][0]) >= 0:
      now2 = dp[i][j - food[i][0]] + food[i][1]
    else:
      now2 = 0
    dp[i + 1][j] = max(now, now2)
    
#print(dp)
#T - 1分に i + 1番目の商品を注文
ans = 0
for i in range(N):
  now3 = dp[i][T - 1] + food[i][1]
  #print(dp[i][T - 1], food[i][1])
  ans = max(ans, now3)
  
print(ans)  
  
  
  

Fixed submission:
N, T = map(int, input().split())
food = [0] * N
for i in range(N):
  food[i] = list(map(int, input().split()))

food = sorted(food)  
#i番目までの商品でj分いないに完食できる美味しさの最大値  
dp = [[0] * (T + 1) for i in range(N + 1)]  

for i in range(N):
  for j in range(1, T + 1):
    #i番目の商品を使わない場合
    now = max(dp[i + 1][j - 1], dp[i][j])
    #使う場合
    if (j - food[i][0]) >= 0:
      now2 = dp[i][j - food[i][0]] + food[i][1]
    else:
      now2 = 0
    dp[i + 1][j] = max(now, now2)
    
#print(dp)
#T - 1分に i + 1番目の商品を注文
ans = 0
for i in range(N):
  now3 = dp[i][T - 1] + food[i][1]
  #print(dp[i][T - 1], food[i][1])
  ans = max(ans, now3)
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = list(map(int, input().split()))
MOD = 998244353
ans = 1
x = [0] * N
for i in range(N):
  p = D[i]
  x[p] += 1 

if (D[0] != 0) or (x[0] != 1):
  ans = 0
  print(ans % MOD)
  quit()
  
fi = 0
for i in range(N-1):
  ans = ans * (x[i] ** x[i + 1])
  if x[i] == 0:
    fi = 1
  if (fi == 1) and (x[i] != 0):
    ans = 0
    print(ans)
    quit()
    
if (fi == 1) and (x[N-1] != 0):
  ans = 0
print(ans % MOD)

Fixed submission:
import collections
N = int(input())
D = list(map(int, input().split()))
D_C = collections.Counter(D)
D_C = D_C.items()
D_C = sorted(D_C)

#print(D_C)
N = len(D_C)
MOD = 998244353
ans = 1

if (D[0] != 0) or (D_C[0][1] != 1):
  ans = 0
  print(ans % MOD)
  quit()
  
for i in range(N-1):
  ans = ans * (D_C[i][1] ** D_C[i + 1][1])
  if i > 0:
    if D_C[i][0] != x + 1:
      ans = 0
      print(ans)
      quit()
  x = D_C[i][0]

if D_C[N-1][0] != x + 1:
  ans = 0
print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

left, right = -1, a[-1] * f[0]

while right - left > 1:#2分探索で探す。
    mid = (left + right) // 2
    ck = 0#修行回数
    for i in range(n): 
      ck += max(0, a[i] - mid // f[i])# (a[i] - ck) * f[i] = midを解いて左記になる。
    if ck <= k: right = mid
    else: left = mid

print(right)


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

left, right = -1, a[-1] * f[0]

while right - left > 1:#2分探索で探す。
    mid = (left + right) // 2
    ck = 0#修行回数
    for i in range(n): 
      ck += max(0, a[i] - mid // f[i])# (a[i] - ck) * f[i] = midを解いて左記になる。
    if ck <= k: right = mid
    else: left = mid

print(right)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L= sorted(list(map(int, input().split())))

count = 0
for i in range(N):
  for j in range(i + 1, N):
    x = L[i] + L [j]
    y = L[j]
    count += sum(x > p > y for p in L)
    #print(count)
print(count)


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

count = 0
for i in range(N):
  z = 0
  for j in range(i + 1, N):
    x = L[i] + L[j]
    if z < N:
      while L[z] < x:
        z += 1
        if z == N:
          break
    count += z - j - 1
    #print(count)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
L= sorted(list(map(int, input().split())))
L = np.array(L)

def find_nearest(array, value):
  idx = (np.abs(array-value)).argmin()
  return idx

count = 0
for i in range(N):
  for j in range(i + 1, N):
    x = L[i] + L [j]
    y = find_nearest(L, x)
    #print(y, j)
    if L[y] < x:
      if y - j > 0:
        count += y - j
    else:
      if y - j > 1:
        count += y - j - 1

print(count)


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

count = 0
for i in range(N):
  z = 0
  for j in range(i + 1, N):
    x = L[i] + L[j]
    if z < N:
      while L[z] < x:
        z += 1
        if z == N:
          break
    count += z - j - 1
    #print(count)
print(count)
Buggy python submission (verdict: Runtime Error):
S = str(input())
K = int(input())
N = len(S)

count1 = 0
x = "A"
con = 1
#仮に1回でもダメなやつ
for i in range(N):
  if x == S[i]:
    con += 1 
  else:
    x = S[i]
    if con != 1:
      count1 += con //2
    con = 1
  #print(count1, i)
if con != 1:
  count1 += con //2
  
if con == N:
  print(N * K // 2)
  quit()
#print(count1)
count2 = 0
if S[0] == S[-1]:
  p = 0
  q = 0
  count0 = 1
  countf = 1
  i = 0
  j = -1
  while p == 0:
    if S[i] == S[i + 1]:
      count0 += 1
      i += 1
    else:
      p = 1
  while q == 0:
    if S[j] == S[j - 1]:
      countf += 1
      j -= 1
    else:
      q = 1

if (count0 % 2 == 1) and (countf % 2 == 1):
  count2 = 1
print(count1 * K + count2 * (K - 1))
    

Fixed submission:
S = str(input())
K = int(input())
N = len(S)

count1 = 0
x = "A"
con = 1
#仮に1回でもダメなやつ
for i in range(N):
  if x == S[i]:
    con += 1 
  else:
    x = S[i]
    if con != 1:
      count1 += con //2
    con = 1
  #print(count1, i)
if con != 1:
  count1 += con //2
  
if con == N:
  print(N * K // 2)
  quit()
#print(count1)
count2 = 0
count0 = 0
countf = 0
if S[0] == S[-1]:
  p = 0
  q = 0
  count0 = 1
  countf = 1
  i = 0
  j = -1
  while p == 0:
    if S[i] == S[i + 1]:
      count0 += 1
      i += 1
    else:
      p = 1
  while q == 0:
    if S[j] == S[j - 1]:
      countf += 1
      j -= 1
    else:
      q = 1

if (count0 % 2 == 1) and (countf % 2 == 1):
  count2 = 1
print(count1 * K + count2 * (K - 1))
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

def gcd(x,y):
  if y > x:
    x, y = y, x
  while x % y != 0:
    x, y = y, x % y
  return y

#print(gcd(660, 420))

def soinsu(n):
  count = 0
  i = 2
  while n != 1:
    if n % i == 0:
      count += 1
    while n % i == 0:
      n = n // i
    i += 1
  return count

#print(soinsu(9))

if __name__ == "__main__":
  gcd = gcd(A, B)
  ans = soinsu(gcd) + 1
  print(ans)

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

def gcd(x,y):
  if y > x:
    x, y = y, x
  while x % y != 0:
    x, y = y, x % y
  return y

#print(gcd(660, 420))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

#print(prime_factorize(9))

if __name__ == "__main__":
  gcd = gcd(A, B)
  c = collections.Counter(prime_factorize(gcd))
  ans = len(c.keys()) + 1
  print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse = True)

c = 0
for i in range(M):
  if c < M:
    x = max(math.log(A[0]/A[1] ,2)//1, 1)
    y = min(x, M - c)
    A[0] = A[0] //(2 ** y)
  A = sorted(A, reverse = True)
  
print(sum(A))


Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
Ai = list(map(lambda x: x*(-1), A))
heapq.heapify(Ai)

for i in range(M):
  maxA = heapq.heappop(Ai)*(-1)
  waribiki = maxA // 2
  heapq.heappush(Ai,waribiki * (-1))
  #print(Ai)
  
print(sum(Ai) * (-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))

for i in range(M):
  A[-1] = A[-1] //2
  A = sorted(A)
  
print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
Ai = list(map(lambda x: x*(-1), A))
heapq.heapify(Ai)

for i in range(M):
  maxA = heapq.heappop(Ai)*(-1)
  waribiki = maxA // 2
  heapq.heappush(Ai,waribiki * (-1))
  #print(Ai)
  
print(sum(Ai) * (-1))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())

counts = []
count = 0
lr = 0
rl = 0
for i in range(N - 1):#start
  z = S[i]
  if S[i] == S[i + 1]:
    count += 1
  elif (S[i] == "L") and (S[i+1] == "R"):
    lr += 1
  elif (S[i] == "R") and (S[i+1] == "L"):
    rl += 1
 
minlr = min(lr, rl)
maxlr = max(lr, rl) 
T = [S[0],S[1],S[-2],S[-1]]
U = [["L", "R", "R", "R"],["L", "R", "L", "L"],["R", "R", "L", "R"],["L", "L", "L", "R"]]
if (maxlr == 1) and (minlr == 0):
  count += 1
  if T in U:
    count -= 1
  print(count)
else:
  minK = min(K, minlr)
  count += 2 * minK
  print(count)


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

RL = 0
for i in range(N-1):
  if S[i]=='R' and S[i+1]=='L':
    RL += 2
    
if S[0]=='L':
  RL += 1
if S[-1]=='R':
  RL += 1

ans = N - RL
ans = min(N - 1, ans + 2 * K)
print(ans)

Buggy python submission (verdict: Runtime Error):
["L", "R", "R", "R"]N, K = map(int, input().split())
S = str(input())

counts = []
count = 0
lr = 0
rl = 0
for i in range(N - 1):#start
  z = S[i]
  if S[i] == S[i + 1]:
    count += 1
  elif (S[i] == "L") and (S[i+1] == "R"):
    lr += 1
  elif (S[i] == "R") and (S[i+1] == "L"):
    rl += 1
 
minlr = min(lr, rl)
maxlr = max(lr, rl) 
T = [S[0],S[1],S[-2],S[-1]]
U = [["L", "R", "R", "R"],["L", "R", "L", "L"],["R", "R", "L", "R"],["L", "L", "L", "R"]]
if (maxlr == 1) and (minlr == 0):
  count += 1
  if T in U:
    count -= 1
  print(count)
else:
  minK = min(K, minlr)
  count += 2 * minK
  print(count)


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

RL = 0
for i in range(N-1):
  if S[i]=='R' and S[i+1]=='L':
    RL += 2
    
if S[0]=='L':
  RL += 1
if S[-1]=='R':
  RL += 1

ans = N - RL
ans = min(N - 1, ans + 2 * K)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]

for i in range(N):
  leng = ((A[i][0]) ** 2 + (A[i][1]) ** 2) ** (1/2)
  if (A[i][0] == 0) and (A[i][1] == 0):
    angle = 0
  elif A[i][0] == 0:
    if A[i][1] > 0:
      angle = 90
    else:
      angle = 270
  elif A[i][1] == 0:
    if A[i][0] > 0:
      angle = 0
    else:
      angle = 180
  else:  
    radian = math.atan2(A[i][1], A[i][0])
    angle = math.degrees(radian)
  A[i].append(leng)
  A[i].append(angle)
  
#エンジンは100しかないからN**2でも間に合うはず

ans = 0
for i in range(N):
  x, y = A[i][0], A[i][1]
  for j in range(N):
    angle =A[i][3] 
    if i != j:
      if -90 < angle < 90 :
        if angle - 90 < A[j][3] < angle + 90:
          x += A[j][0]
          y += A[j][1]
      elif -180 < angle < -90:
        if (A[j][3] < angle + 90) or (angle + 270 < A[j][3]):
          x += A[j][0]
          y += A[j][1]
      else: 
        if (angle - 90 < A[j][3]) or (A[j][3] < angle - 270):
          x += A[j][0]
          y += A[j][1]
  ans1 = (x ** 2 + y ** 2 ) ** (1/2)
  ans = max(ans, ans1)
  
print(ans)
#print(A)
   
   
        
      
    
    
 


Fixed submission:
S = str(input())
T = str(input())
count = 0

for i in range(len(S)):
  if S[i] == T[i]:
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


N,Q=map(int,input().split())
EDGE=[list(map(int,input().split())) for i in range(N-1)]
PLUS=[list(map(int,input().split())) for i in range(Q)]

SCORE=[0]*(N+1)
for p,x in PLUS:
    SCORE[p]+=x

ELIST=[[] for i in range(N+1)]

for x,y in EDGE:
    ELIST[x].append(y)
    ELIST[y].append(x)
#print(ELIST)

from collections import deque
Q=deque([1])

USED=[0]*(N+1)
USED[1]=1
#USED = [0, 1, 0, 0, 0] Ex1
#SCORE = [0, 100, 10, 1, 0] Ex1
#ELIST = [[], [2], [1, 3, 4], [2], [2]] Ex1

while Q:
    x=Q.pop()

    for to in ELIST[x]:
        if USED[to]==0:
            USED[to]=1
            SCORE[to]+=SCORE[x]
            Q.append(to)

print(*SCORE[1:])


Fixed submission:
a = int(input())
s = str(input())

if a >= 3200:
  print(s)
else:
  print("red")