Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
instr = map(int, input())
a = int(instr[0])
b = int(instr[2])
op = instr[1]

if op == "+":
  print (a+b)
else:
  print(a-b)


Fixed submission:
instr = list(map(str, input().split()))
a = int(instr[0])
b = int(instr[2])
op = instr[1] 
if op == "+":
  print (a+b)
else:
  print(a-b)

Buggy python submission (verdict: Runtime Error):
a,op,b = map(int, input())

if op == "+":
  print (a+b)
else:
  print(a-b)


Fixed submission:
instr = list(map(str, input().split()))
a = int(instr[0])
b = int(instr[2])
op = instr[1] 
if op == "+":
  print (a+b)
else:
  print(a-b)
Buggy python submission (verdict: Time Limit Exceeded):
N=input()
QsList=list(map(int,input().split()))

tmpList=QsList[:]
tmpList.sort()
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=tmp+1  

  a=int(tmpList.index(i))
  AnsList[a]=tmp
print(*AnsList)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)

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

tmpList=QsList[:]
tmpList.sort()

AnsList=QsList[:]
for i in QsList:
  tmp=int(QsList.index(i))+1
  a=int(tmpList.index(i))
  AnsList[a]=tmp
  
print(*AnsList)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)

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

tmpList=QsList[:]
tmpList.sort()

cnt=0
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=int(QsList.index(i))+1
  a=int(tmpList.index(i))
  a=int(a)
  AnsList[a]=tmp
  
print(*AnsList)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)

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

tmpList=QsList[:]
tmpList.sort()

cnt=0
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=int(QsList.index(i))+1
  a=int(tmpList.index(i))
  a=int(a)
  AnsList[a]=tmp
  
for i in AnsList:
  print(i,end=" ")

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)

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

tmpList=QsList[:]
tmpList.sort()

cnt=0
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=int(QsList.index(i))+1
  a=int(tmpList.index(i))
  a=int(a)
  AnsList[a]=tmp
  
for i in AnsList:
  print(i,end=" ")

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)
Buggy python submission (verdict: Runtime Error):
s=input()
i=0
for tmp in s:
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      continue
    else:
      print('No')
      break
  break
  else:
    if tmp in ['R','U','D']:
      continue
    else:
      print('No')
      break
  break
print('Yes')

Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
s=input()
i=0
for tmp in list(s):
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      continue
    else:
      x='N'
      break
  else:
    if tmp in ['R','U','D']:
      continue
    else:
      x='N'
      break
  break
if x=='N':
    print('No')
else:
    print('Yes')

Fixed submission:
s=input()
i=0
for tmp in list(s):
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  else:
    if tmp in ['R','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  break
if x=='N':
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
s=input()
i=0
for tmp in s:
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
    else:
      print('No')
      break
  break
  else:
    if tmp in ['R','U','D']:
    else:
      print('No')
      break
  break
print('Yes')    
    

Fixed submission:
s=input()
i=0
for tmp in list(s):
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  else:
    if tmp in ['R','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  break
if x=='N':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

dams = list(map(int, input().split()))

ans = sum([dams[x]*(-1)**x for x in range(n)])
out = str(ans)

for i in range(1, n):
  ans = -1 * ans + 2 * dams[i - 1]
  out += " " + str(ans)
  
print(out)
  

Fixed submission:
n = int(input())

dams = list(map(int, input().split()))
ans_list = [0 for x in range(n)]

ans_list[0] = sum([dams[x]*(-1)**x for x in range(n)])

for i in range(1, n):
  ans_list[i] = -ans_list[i-1] + 2 * dams[i - 1]

print(" ".join(list(map(str, ans_list))))

#print(*ans_list)

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

n = int(input())

dams = list(map(int, input().split()))
dams = np.array(dams, dtype = np.int)

ans_list = []

kake = [1*(-1)**x for x in range(n)]
ans_list = [0 for x in range(n)]
kake_temp = kake
out = ""
for i in range(n):
  #print(kake_temp)
  ans = int(np.dot(dams, np.array(kake_temp)))
  out += str(ans) + " " 
  kake_temp = [kake_temp[-1]] + kake_temp[0 : n - 1]
  
print(out[:-1])
  

Fixed submission:
n = int(input())

dams = list(map(int, input().split()))
ans_list = [0 for x in range(n)]

ans_list[0] = sum([dams[x]*(-1)**x for x in range(n)])

for i in range(1, n):
  ans_list[i] = -ans_list[i-1] + 2 * dams[i - 1]

print(" ".join(list(map(str, ans_list))))

#print(*ans_list)

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

n = int(input())

dams = list(map(int, input().split()))
dams = np.array(dams, dtype = np.int)

ans_list = []

kake = [1*(-1)**x for x in range(n)]
ans_list = [0 for x in range(n)]
kake_temp = kake
for i in range(n):
  ans = 0
  #print(kake_temp)
  ans = int(np.dot(dams, np.array(kake_temp)))
  ans_list[i] = str(ans)
  
  kake_temp = [kake_temp[-1]] + kake_temp[0 : n - 1]
    
print(" ".join(ans_list))
  

Fixed submission:
n = int(input())

dams = list(map(int, input().split()))
ans_list = [0 for x in range(n)]

ans_list[0] = sum([dams[x]*(-1)**x for x in range(n)])

for i in range(1, n):
  ans_list[i] = -ans_list[i-1] + 2 * dams[i - 1]

print(" ".join(list(map(str, ans_list))))

#print(*ans_list)

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

dams = list(map(int, input().split()))

ans_list = []

for i in range(n):
  ans = 0
  for j in range(i, i + n):
    ans += dams[j % n] * (-1)**(j - i)
  ans_list.append(str(ans))
    
print(" ".join(ans_list))

Fixed submission:
n = int(input())

dams = list(map(int, input().split()))
ans_list = [0 for x in range(n)]

ans_list[0] = sum([dams[x]*(-1)**x for x in range(n)])

for i in range(1, n):
  ans_list[i] = -ans_list[i-1] + 2 * dams[i - 1]

print(" ".join(list(map(str, ans_list))))

#print(*ans_list)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

print(len(links))
for link in links:
  print(link[0], link[1])

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

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

  print(len(links))
  for link in links:
    print(link[0], link[1])

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

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

#print(len(links))
for link in links:
  print(link[0], link[1])

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

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

  print(len(links))
  for link in links:
    print(link[0], link[1])
Buggy python submission (verdict: Runtime Error):
import numpy as np

antennas = []

for _ in range(5):
  antennas.append(int(input()))

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

if available:
  print("Yay!")
else:
  print(":(")


Fixed submission:
antennas = []

for _ in range(5):
  antennas.append(int(input()))

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

if available:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()

place_of_AC = []
for i in range(len(s) - 1):
  if s[i:i+2] == "AC":
    place_of_AC.append(1)
  else:
    place_of_AC.append(0)
    
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = sum(place_of_AC[l-1:r-1])
  print(out)

Fixed submission:
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()
cnt = 0
place_of_AC = [0] * n

for i in range(len(s) - 1):
  place_of_AC[i]=cnt
  if s[i:i+2] == "AC":
    cnt += 1


#print(place_of_AC)
  
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = place_of_AC[r-1] - place_of_AC[l-1]
  print(out)

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split(" "))
s = input()

place_of_AC = []
for i in range(len(s) - 1):
  if s[i:i+2] == "AC":
    place_of_AC.append(1)
  else:
    place_of_AC.append(0)
    
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = sum(place_of_AC[l-1:r-1])
  print(out)

Fixed submission:
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()
cnt = 0
place_of_AC = [0] * n

for i in range(len(s) - 1):
  place_of_AC[i]=cnt
  if s[i:i+2] == "AC":
    cnt += 1


#print(place_of_AC)
  
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = place_of_AC[r-1] - place_of_AC[l-1]
  print(out)

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split(" "))
s = input()

place_of_AC = []
ind = 0

while True:
  ind = s.find("AC", ind)
  # print(ind)
  if ind != -1:
    place_of_AC.append(ind + 1)
    ind += 2
  else:
    break
#print(place_of_AC)
    
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = [x for x in place_of_AC if l <= x < r ]
  print(len(out))

Fixed submission:
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()
cnt = 0
place_of_AC = [0] * n

for i in range(len(s) - 1):
  place_of_AC[i]=cnt
  if s[i:i+2] == "AC":
    cnt += 1


#print(place_of_AC)
  
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = place_of_AC[r-1] - place_of_AC[l-1]
  print(out)

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split(" "))
s = input()

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

Fixed submission:
import sys

input = sys.stdin.readline

n, q = map(int, input().split(" "))
s = input()
cnt = 0
place_of_AC = [0] * n

for i in range(len(s) - 1):
  place_of_AC[i]=cnt
  if s[i:i+2] == "AC":
    cnt += 1


#print(place_of_AC)
  
for _ in range(q):
  l, r = map(int, input().split(" "))
  out = place_of_AC[r-1] - place_of_AC[l-1]
  print(out)
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())

goal = list(map(int, input().split(" ")))

output = -1

def searchAns(goal, temp, left, proc):
  #print(temp, left, proc)
  if len(left) == 0:
    if temp == goal:
      return proc
    else:
      return -1
  for num in left:
    #print(num, temp, left, proc)
    if num <= len(temp) + 1:
      copyTemp = copy.copy(temp)
      copyTemp.insert(num-1, num)
      copyLeft = copy.copy(left)
      copyLeft.remove(num)
      copyProc = copy.copy(proc)
      copyProc.append(num)
      result = searchAns(goal, copyTemp, copyLeft, copyProc)
      if result != -1:
        return result
  else:
    return -1
    
proc = searchAns(goal, [], goal, [])

if proc == -1:
  print(-1)
else:
  for num in proc:
    print(num)

Fixed submission:
import copy

n = int(input())

goal = list(map(int, input().split(" ")))

output = -1

procReverse = []

temp_goal = copy.copy(goal)

for _ in range(n):
  index = list(range(1,len(temp_goal)+1))
  for i in range(len(temp_goal)-1, -1, -1):
    #print(i, index, temp_goal)
    if index[i] == temp_goal[i]:
      procReverse.append(temp_goal[i])
      temp_goal.pop(i)
      break
  else:
    print(-1)
    break
else:
  for i in range(n-1, -1, -1):
    print(procReverse[i])
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())

xor_sum = a

for i in range(a+1, b+1):
  xor_sum = xor_sum ^ i
  
print(xor_sum)

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

xor_sum = 0

for i in range(a, a+5): # 123, 124,
  if i % 4 == 0:
    break
  else:
    xor_sum = xor_sum ^ i

for i in range((b-b%4),b+1):#456
  xor_sum = xor_sum ^ i
  
  
print(xor_sum)
Buggy python submission (verdict: Time Limit Exceeded):
string = input()
# string = "1" * 50000 + "0" * 50000
start_length = len(string)


while len(string) > 0:
  if "10" in string or "01" in string:
    string = string.replace("1111111100000000", "")
    string = string.replace("11111110000000", "")
    string = string.replace("111111000000", "")
    string = string.replace("1111100000", "")
    string = string.replace("11110000", "")
    string = string.replace("111000", "")
    string = string.replace("1100", "")
    string = string.replace("0000000011111111", "")
    string = string.replace("00000001111111", "")
    string = string.replace("0000011111", "")
    string = string.replace("00001111", "")
    string = string.replace("000111", "")
    string = string.replace("0011", "")
    string = string.replace("10", "")
    string = string.replace("01", "")
  else:
    break

print(start_length - len(string))


Fixed submission:
s = input()

start_len = len(s)

num_1 = s.count("1")
num_0 = s.count("0")

end_len = abs(num_1 - num_0)

print(abs(end_len - start_len))

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

start_length = len(string)

while len(string) > 0:
  if "10" in string or "01" in string:
    string = string.replace("10", "")
    string = string.replace("01", "")
  else:
    break

print(start_length - len(string))


Fixed submission:
s = input()

start_len = len(s)

num_1 = s.count("1")
num_0 = s.count("0")

end_len = abs(num_1 - num_0)

print(abs(end_len - start_len))

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

start_length = len(string)

while len(string) > 0:
  if "10" in string:
    string = string.replace("10", "")
  elif "01" in string:
    string = string.replace("01", "")
  else:
    break

print(start_length - len(string))

Fixed submission:
s = input()

start_len = len(s)

num_1 = s.count("1")
num_0 = s.count("0")

end_len = abs(num_1 - num_0)

print(abs(end_len - start_len))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b:
  if b=c:
    if a=c:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')

Fixed submission:
a,b,c=map(int,input().split())
if a==b:
  if b==c:
    if a==c:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c=map(int,input().split())
if a==b:
  if b==c:
    if a==c:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
L=[]
for i in range(N+1):
  L.append(S.count('AC',0,i))
for j in range(Q):
  l,r=map(int,input().split())
  print(L[r]-L[l])

Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[0]
T=0
for i in range(N-1):
  T+=S.count('AC',i,i+2)
  L.append(T)
for j in range(Q):
  l,r=map(int,input().split())
  print(L[r-1]-L[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.count('AC',l-1,r))

Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[0]
T=0
for i in range(N-1):
  T+=S.count('AC',i,i+2)
  L.append(T)
for j in range(Q):
  l,r=map(int,input().split())
  print(L[r-1]-L[l-1])
Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[j]*D[j]
  if sum+C>0:
    num+=1
print(num)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)

Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
for i in range(N):
  sum=0
  A=[]
  A.append(list(map(int,input().split())))
  for j in range(M):
    sum+=A[j] * B[j]
  if sum+C>0:
    num+=1
print(num)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)

Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(int,input().split())
num=0
for i in range(N):
  sum=0
  A=[]
  A.append(list(map(int,input().split())))
  for j in range(M):
    sum+=A[j] * B[j]
  if sum+C >0:
    num+=1
print(num)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)

Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(int,input().split())
num=0
for i in range(N):
  sum=0
  A=list(int,input().split())
  for j in range(M):
    sum+=A[j] * B[j]
  if sum+C >0:
    num+=1
print(num)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=A[0]
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
for i in range(1,N):
  B=gcd(B,A[i])
prnt(B)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=A[0]
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
for i in range(1,N):
  B=gcd(B,A[i])
print(B)
Buggy python submission (verdict: Runtime Error):
t,x=int(input().split())
print(t/x)

Fixed submission:
t,x=map(int,input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
s=int(input())
count=0
if s==1:
  print(4)
elif s==2:
  print(4)
else:
  for i in range(1000000):
  if s%2==0:
    s=s//2
    count+=1
    if s==4:
      break
  else:
    s=s*3+1
    count+=1
  print(count+4)


Fixed submission:
s = int(input())
cnt = 1
box = set()
while not s in box:
	box.add(s)
	if s % 2 == 0:
		s = s / 2
	else:
		s = 3 * s + 1
	cnt += 1
	
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=[int,input() for i in range(n)]
cnt=0

for i in range(n):
  cnt+=A[i]
cnt-=max(A)*0.5
print(cnt)

Fixed submission:
n=int(input())
A=[int(input()) for i in range(n)]
cnt=0

for i in range(n):
  cnt+=A[i]
cnt-=max(A)*0.5
print(int(cnt))
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
NBC = B//C
NBD = B//D
CD_lcm = (C*D)//math.gcd(C,D)   #CとDの最小公倍数
NBCD = B//CD_lcm #CとD共通で割り切れる数
B_0 = (NBC+NBD)-NBCD  #Bの答え
ans_B = B-B_0
NAC = (A)//C
NAD = (A)//D
NACD = (A)//CD_lcm  
A_0 = (NAC+NAD)-NACD #Aの答え
ans_A = A-A_0
if A%C==0 or A%D==0:
    ans = ans_B-ans_A
else:
    ans = ans_B-ans_A+1
print(ans)

Fixed submission:
A, B, C, D = map(int, input().split())
def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x

NBC = B//C
NBD = B//D
CD_lcm = (C*D)//gcd(C,D)   #CとDの最小公倍数
NBCD = B//CD_lcm #CとD共通で割り切れる数
B_0 = (NBC+NBD)-NBCD  #Bの答え
ans_B = B-B_0
NAC = (A)//C
NAD = (A)//D
NACD = (A)//CD_lcm  
A_0 = (NAC+NAD)-NACD #Aの答え
ans_A = A-A_0
if A%C==0 or A%D==0:
    ans = ans_B-ans_A
else:
    ans = ans_B-ans_A+1
print(ans)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
full = W*H
count = 0
if x == (W/2):
    if y == (H/2):
        men = W*H/2
        print(men)
        print(1)
    else:
        men = W*H/2
        print(men)
        print(0)
elif y==(H/2):
    men = W*H/2
    print(men)
    print(0)

else:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    XX = max(X)
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    YY = max(Y)
    if XX == YY:
        print(menseki)
        print(1)
    else:
        menseki = min(XX, YY)
        print(menseki)
        print(0)

Fixed submission:
W, H, x, y = map(int, input().split())
if x == (W/2):
    if y == (H/2):
        men = W*H/2
        print(men)
        print(1)
    else:
        men = W*H/2
        print(men)
        print(0)
else:
        men = W*H/2
        print(men)
        print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
count = 0
end = 0
start = 0
double = 0
for i in range(N):
    line = input()
    if "AB" in line:
        count += 1
    if line[0] == "B":
        if line[-1] == "A":
            double +=1
        else:
            start += 1
    if line[-1] == "A":
        if line[0] == "B":
            double +=1
        else:
            end += 1
if double == 0:
    count += min(start, end)
elif start + end > 0:
    counr += double + min(start, end)
elif start + end == 0:
    count += double - 1
print(count)
        

Fixed submission:
N = int(input())
count = 0
end = 0
start = 0
double = 0
for i in range(N):
    line = input()
    if "AB" in line:
        count += line.count("AB")
    if line[0] == "B":
        if line[-1] == "A":
            double +=1
        else:
            start += 1
    elif line[-1] == "A":
            end += 1
if double == 0:
    count += min(start, end)
elif start + end > 0:
    count += double + min(start, end)
elif start + end == 0:
    count += double - 1
print(count)