Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n, m = map(int, input().split())
    a = sorted(list(map(int, input().split())))
    # 最大の値でチケットを使う
    # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
    for i in range(m):
        a[len(a)-1] //= 2
        if a[len(a)-1] < a[len(a)-2]:
            a = binary_search(a, a[len(a)-1])
    return sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)


Fixed submission:
import heapq  # 優先度付きキュー
# def solve():  # TLE
#     n, m = map(int, input().split())
#     # O(nlog(n))
#     a = sorted(list(map(int, input().split())))
#     # 最大の値でチケットを使う
#     # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
#     # O(m)
#     for i in range(m):
#         a[len(a)-1] //= 2
#         if a[len(a)-1] < a[len(a)-2]:
#             # O(log2m)
#             a = binary_search(a, a[len(a)-1])
#     return sum(a)


def solve():
    n, m = map(int, input().split())
    a = list(map(lambda x: int(x)*-1, input().split()))
    heapq.heapify(a)  # aを優先度付きキューに変更
    for _ in range(m):  # _　iで注意が出ない(インスタンスを作らない)
        tmp_min = heapq.heappop(a)  # aの最大の値のpop
        heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差が生じるため(//2の返り値はintのため)
    return -sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)
Buggy python submission (verdict: Runtime Error):
k=int(input())
s=list(str(input()))
if len(s)<=k:
  s=sum(s)
  print(s)
else:
  t=""
  for i in range(0,k):
    t=t+s[i]
  t=t+"..."
  print(t)

Fixed submission:
k=int(input())
s=list(str(input()))
if len(s)<=k:
  t=""
  for i in s:
    t=t+i   
  print(t)
else:
  t=""
  for i in range(0,k):
    t=t+s[i]
  t=t+"..."
  print(t)
Buggy python submission (verdict: Runtime Error):
s=str(input())
if s ="ARC":
  print("ABC")
else:
  print("ARC")

Fixed submission:
s=str(input())
if s =="ARC":
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
import math
r = int(imput())
print(2*math.pi*r)

Fixed submission:
import math
r = int(input())
print(2*math.pi*r)

Buggy python submission (verdict: Runtime Error):
import numpy
R = int(input())
print(2*np.pi*R)

Fixed submission:
import math
r = int(input())
print(2*math.pi*r)

Buggy python submission (verdict: Runtime Error):
r = int(input())
print(2*math.pi*r)

Fixed submission:
import math
r = int(input())
print(2*math.pi*r)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input)
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(n):
  print(cnt[i])
  

Fixed submission:
import collections
n = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1,n+1):
  print(cnt[i])

Buggy python submission (verdict: Runtime Error):
import collections
n = input()
a = list(map(int, input().split()))
a = Counter(a)
for i in range(n):
  print(a[i])


Fixed submission:
import collections
n = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1,n+1):
  print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
a = 0
for i in range(0,n):
  for j in range(0,n):
    for k in range(0,n):
      gcd1 = math.gcd(i+1,j+1)
      gcd2 = math.gcd(gcd1,k+1)
      a = a + gcd2
      
print(a)

Fixed submission:
import math
n = int(input())
a = 0
for i in range(0,n):
  for j in range(0,n):
    gcd1 = math.gcd(i+1,j+1)
    
    for k in range(0,n):
      gcd2 = math.gcd(gcd1,k+1)
      a = a + gcd2
      
print(a)
Buggy python submission (verdict: Runtime Error):
x,y,z = map(input().split())
print(z,x,y)

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

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

Fixed submission:
a, b, c = map(int, input().split())
print(c,a,b)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
if n<k:
  if:k<2*n:
      print(k-n)
  else:
    print(n)
elif n==k:
  print(0)
else:
  m=n//k
  r=n-m*k
  print(min(r,abs(r-k)))

Fixed submission:
n,k=map(int,input().split())
if n<k:
  if k<2*n:
      print(k-n)
  else:
    print(n)
elif n==k:
  print(0)
else:
  m=n//k
  r=n-m*k
  print(min(r,abs(r-k)))
Buggy python submission (verdict: Runtime Error):
a,b = map(int(input().split()))
s = -(-b// a)
print(s)

Fixed submission:
a,b = map(int,input().split())
print(-(-(b-1)//(a-1)))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input() .split())
if (a*b) % 2 == 1:
  print("Odd")
    else:
      print("Even")
	

Fixed submission:
a,b = map(int, input() .split())
if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
a = int(a)
b = int(b)
c = a * b

if c % 2 == 0:
  print("even")
else:
  print("odd")

Fixed submission:
a,b = map(int, input() .split())
if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
c = a * b
if c % 2 == 0:
  print("even")
else :
  print("odd")

Fixed submission:
a,b = map(int, input() .split())
if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
n,A,B = map(int,input().split())
s = list(str(input()))
p =[]
for i in range(0,n):
  if s[i] =="c":
    print("No")
  elif s[i]=="a":
    if A+B>len(p):
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  elif s[i] =="b":
    if A+B>len(p) and p.count("b")<B:
      p.append(s[i])
      print("Yes")
    else:
      print("No")

Fixed submission:
n,a,b = map(int,input().split(" "))
s = input()
accept = a+b
for i in range(len(s)):
  if s[i] == "c":
    print("No")
  elif accept <= 0:
    print("No")
  elif s[i] == "a":
    print("Yes")
    accept -= 1
  elif s[i] == "b" and b > 0:
    print("Yes")
    b -= 1
    accept -= 1
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,A,B = map(int,input().split())
s = list(str(input()))
p =[]
for i in range(0,n):
  if s[i] =="a":
    if A+B>len(p):
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  elif s[i] =="b":
    if A+B>len(p) and p.count("b")<B:
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Fixed submission:
n,a,b = map(int,input().split(" "))
s = input()
accept = a+b
for i in range(len(s)):
  if s[i] == "c":
    print("No")
  elif accept <= 0:
    print("No")
  elif s[i] == "a":
    print("Yes")
    accept -= 1
  elif s[i] == "b" and b > 0:
    print("Yes")
    b -= 1
    accept -= 1
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split())
if a.count(5) == 2 and a.count(7) == 1:
         print("Yes")
else:
         print("No")

Fixed submission:
a = list(map(int, input().split()))
if a.count(5) == 2 and a.count(7) == 1:
         print("YES")
else:
         print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
import copy
ori = copy.copy(A)

for i in range(N):
    A[i] -= (N - 1) - i
# print(A)
# import collections
# dct = dict(collections.Counter(A))
# print(dct)
# m = min(A)
# cnt = 0
# for check in range(m, 0):
#
#     if dct.get(check, 0):
#         print(check)
#         cnt += dct[check] * dct.get(check + 2, 0)
# print(cnt)
remove = 0
# for i in range(N-2):
#     if ori[i] != 1 and ori[i] == ori[i + 2]:
#         remove += 1
for i in range(N - 1):
    if ori[i] + 1 == ori[i + 1]:
        remove += 1
# print(ori)
# print(cnt - remove)

bucket = [0] * N
cnt = 0
for i in range(N):
    if A[i] < 0:
        bucket[-A[i]] += 1
        cnt += bucket[-A[i] + 2]
print(cnt- remove)



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

L = [A[i] + (i + 1) for i in range(N)]
R = [(i + 1) - A[i] for i in range(N)]
import collections
dL = dict(collections.Counter(L))
dR = dict(collections.Counter(R))

ans = 0
for k in dL.keys():
    ans += dL[k] * dR.get(k, 0)
print(ans)
# print(L)
# print(R)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

# do shakutori


Q = [0]
for i in range(len(S)-1, -1, -1):
    Q.append(int(S[i:]) % 2019)
# print(Q)

import collections
dct = dict(collections.Counter(Q))
# print(dct)
ans = 0
for val in dct.values():
    ans += val * (val - 1) // 2
print(ans)



Fixed submission:
S = input()

# do shakutori
#以下が an mod p を求めるソースコードです.
def power_func(a, n, p):
    res = 1 #これは答え
    while n > 0:
        if n & 1:
            res = res * a % p
        a = a * a % p #1が立っているかどうかに関わらず次のaの累乗を用意しておく
        n = n >> 1
    return res

Q = [0]
for i in range(len(S)-1, -1, -1):
    pow = len(S) - i - 1
    Q.append((Q[-1] + power_func(10, pow, 2019) * int(S[i])) % 2019)
# print(Q)

import collections
dct = dict(collections.Counter(Q))
# print(dct)
ans = 0
for val in dct.values():
    ans += val * (val - 1) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
RGB = ['R', 'G', 'B']
import collections
dct = dict(collections.Counter(S))

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        if 2 * j - i < N:
            for c in RGB:
                if c != S[i] and c != S[j] and S[i] != S[j]:
                    if c == S[2 * j - i]:
                        cnt += 1
                        #print(i, j)
#print(cnt)
print(dct['R'] * dct['G'] * dct['B'] - cnt)

Fixed submission:
N = int(input())
S = input()
RGB = ['R', 'G', 'B']
import collections
if len(set(list(S))) <= 2:
    print(0)
else:
    dct = dict(collections.Counter(S))

    cnt = 0
    for i in range(N-2):
        for k in range((N - 1 - i) // 2 + 1):
            temp = {S[i], S[i + k], S[i + k * 2]}
            if len(temp) == 3:
                cnt += 1
            #print(cnt)
    print(dct['R'] * dct['G'] * dct['B'] - cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
RGB = ['R', 'G', 'B']

import collections
dct = dict(collections.Counter(S))
#print(dct)

ans = 0
for i in range(0, N-1):
    for j in range(i+1, N):
        if S[i] != S[j]:
            for c in RGB:
                if c != S[i] and c != S[j]:
                    cnt = 0
                    if 0 <= 2 * j - i < N and S[2 * j - i] == c:
                        cnt += 1
                    if N > 2 * i - j >= 0 and S[2 * i - j] == c:
                        cnt += 1
                    if i % 2 == j % 2:
                        if 0 <= (i + j) // 2 < N and S[(i + j) // 2] == c:
                            cnt += 1
                    ans += dct[c] - cnt
                    #print(i, j, dct[c]-cnt)
#print(ans)
print(ans // 3)


Fixed submission:
N = int(input())
S = input()
RGB = ['R', 'G', 'B']
import collections
if len(set(list(S))) <= 2:
    print(0)
else:
    dct = dict(collections.Counter(S))

    cnt = 0
    for i in range(N-2):
        for k in range((N - 1 - i) // 2 + 1):
            temp = {S[i], S[i + k], S[i + k * 2]}
            if len(temp) == 3:
                cnt += 1
            #print(cnt)
    print(dct['R'] * dct['G'] * dct['B'] - cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
lst=list(map(int, input().split()))

import collections

dct=collections.Counter(lst)


for i in range(N):
    Sum=0
    for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)

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

import collections

dct=collections.Counter(lst)


#for i in range(N):
Sum=0
for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)

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

import collections

dct=collections.Counter(lst)


for i in range(N):
    total={}
    for k, v in dct.items():
        total[k]=v*(v-1)//2
Sum=sum(total.values())


for i in range(N):
    print(Sum-dct[lst[i]]+1)

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

import collections

dct=collections.Counter(lst)


#for i in range(N):
Sum=0
for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)

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

for i in range(N):
    answer=0
    removed=[lst[j] for j in range(N) if j!=i]
    for el in set(removed):
        el_num=removed.count(el)
        answer+=el_num*(el_num-1)//2
    print(answer)

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

import collections

dct=collections.Counter(lst)


#for i in range(N):
Sum=0
for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
lst=[]
for _ in range(Q):
    lst.append(input().split())

#print(S, Q, lst)

str=list(S)

right=True
for operation in lst:
    if operation[0]=='1':
       right=not right

    else:
        if right==True and operation[1]=='1' or right==False and operation[1]=='2':
            str=[operation[2]]+str
        else:
            str=str+[operation[2]]

if right==True:
    print(''.join(str))
else:
    print(''.join(str[::-1]))

Fixed submission:
S=input()
Q=int(input())
lst=[]
for _ in range(Q):
    lst.append(input().split())

import collections

str=list(S)
d=collections.deque(str)

right=True
for operation in lst:
    if operation[0]=='1':
       right=not right

    else:
        if right==True and operation[1]=='1' or right==False and operation[1]=='2':
            d.appendleft(operation[2])
        else:
            d.append(operation[2])
str=list(d)
if right==True:
    print(''.join(str))
else:
    print(''.join(str[::-1]))

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
lst=[]
for _ in range(Q):
    lst.append(input().split())

#print(S, Q, lst)

str=list(S)

right=True
for operation in lst:
    if operation[0]=='1':
       right=not right

    if operation[0]=='2':
        if right==True and operation[1]=='1' or right==False and operation[1]=='2':
            str=[operation[2]]+str
        else:
            str=str+[operation[2]]

if right==True:
    print(''.join(str))
else:
    print(''.join(str[::-1]))

Fixed submission:
S=input()
Q=int(input())
lst=[]
for _ in range(Q):
    lst.append(input().split())

import collections

str=list(S)
d=collections.deque(str)

right=True
for operation in lst:
    if operation[0]=='1':
       right=not right

    else:
        if right==True and operation[1]=='1' or right==False and operation[1]=='2':
            d.appendleft(operation[2])
        else:
            d.append(operation[2])
str=list(d)
if right==True:
    print(''.join(str))
else:
    print(''.join(str[::-1]))
Buggy python submission (verdict: Runtime Error):
'''
st=set(map(int, input().split()))

if len(st)==2:
    print('Yes')
else:
    print('No')
'''

print('Yes' if len(set(map(int, input().split())))==2 'No')

Fixed submission:
st=set(map(int, input().split()))

if len(st)==2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int, input().split())
p=list(map(int, input().split()))
expect=[(dice+1)/2 for dice in p]
#print(expect)
plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]
#print(plus_p)
print(max(plus_p))

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

expect=[(dice+1)/2 for dice in p]
#print(expect)
#plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]

first=sum(expect[0:K])
plus_p=[first]
for i in range(1, N-K+1):
	plus_p.append(plus_p[i-1]-expect[i-1]+expect[i-1+K])
#print(plus_p)
print(max(plus_p))

Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int, input().split())
lst=list(map(int, input().split()))
mx=0
for i in range(0, N-K+1):
	S=sum(lst[i:i+K])
	if mx<S:
		mx=S
print((mx+K)/2)

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

expect=[(dice+1)/2 for dice in p]
#print(expect)
#plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]

first=sum(expect[0:K])
plus_p=[first]
for i in range(1, N-K+1):
	plus_p.append(plus_p[i-1]-expect[i-1]+expect[i-1+K])
#print(plus_p)
print(max(plus_p))

Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int, input().split())
lst=list(map(int, input().split()))
mx=0
for i in range(0, N-K+1):
	S=sum(lst[i:i+K])
	if mx<S:
		mx=S
print((mx+K)/2)


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

expect=[(dice+1)/2 for dice in p]
#print(expect)
#plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]

first=sum(expect[0:K])
plus_p=[first]
for i in range(1, N-K+1):
	plus_p.append(plus_p[i-1]-expect[i-1]+expect[i-1+K])
#print(plus_p)
print(max(plus_p))

Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int, input().split())
lst=list(map(int, input().split()))
new_lst=[]
mx=0
for i in range(0, N-K+1):
	if mx<sum(lst[i:i+K]):
		mx=sum(lst[i:i+K])

print((mx+K)/2)


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

expect=[(dice+1)/2 for dice in p]
#print(expect)
#plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]

first=sum(expect[0:K])
plus_p=[first]
for i in range(1, N-K+1):
	plus_p.append(plus_p[i-1]-expect[i-1]+expect[i-1+K])
#print(plus_p)
print(max(plus_p))

Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int, input().split())
lst=list(map(int, input().split()))
new_lst=[]
for i in range(0, N-K+1):
	new_lst.append(sum(lst[i:i+K]))
mx=max(new_lst)
print((mx+K)/2)

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

expect=[(dice+1)/2 for dice in p]
#print(expect)
#plus_p=[sum(expect[i:i+K]) for i in range(N-K+1)]

first=sum(expect[0:K])
plus_p=[first]
for i in range(1, N-K+1):
	plus_p.append(plus_p[i-1]-expect[i-1]+expect[i-1+K])
#print(plus_p)
print(max(plus_p))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
lst=list(map(int, input().split()))
count=0
for i in range(N):
    if lst[i]==min(lst[:i+1]):
        count+=1
print(count)

Fixed submission:
N=int(input())
lst=list(map(int, input().split()))
count=0
m=2*10**5
for i in range(N):
    if m>lst[i]:
        m=lst[i]
    if lst[i]==m:
        count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
state=[]
for j in range(N):
    A=int(input())
    temp=[]
    for i in range(A):
        temp.append(tuple(map(int, input().split())))
    state.append(temp)


OK=[]
for i in range(2**N):
    conflict=0
    for person in range(N): #各人の発言を評価
        for one_state in state[person]:
            if ((i >> (one_state[0]-1)) & 1): #正直者に対して
                if (i >> person) & 1 and one_state[1] == 0:
                    conflict=1
            else: #不親切に対して
                if (i >> person) & 1 and one_state[1]==1:
                    conflict=1
    if conflict==0:
        OK.append(i)
#print(OK)

num=[]
for el in OK:
    count=0
    for j in range(N):
        if (el >> j) & 1:
            count+=1
    num.append(count)
#print(num)
print(max(num))



Fixed submission:
N=int(input())
state=[]
for j in range(N):
    A=int(input())
    temp=[]
    for i in range(A):
        temp.append(tuple(map(int, input().split())))
    state.append(temp)


OK=[]
for i in range(2**N):
    conflict=0
    for person in range(N): #各人の発言を評価
        for one_state in state[person]:
            if ((i >> (one_state[0]-1)) & 1): #正直者に対して
                if (i >> person) & 1 and one_state[1] == 0:
                    conflict=1
            else: #不親切に対して
                if (i >> person) & 1 and one_state[1]==1:
                    conflict=1
    if conflict==0:
        OK.append(i)
#print(OK)

num=[]
for el in OK:
    count=0
    for j in range(N):
        if (el >> j) & 1:
            count+=1
    num.append(count)
#print(num)
print(max(num))
Buggy python submission (verdict: Runtime Error):
r=int(input())
print(R**2)

Fixed submission:
r=int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
lst=[]
up=math.ceiling(math.sqrt(n))-1
for i in range(1,up+1):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)


Fixed submission:
n=int(input())
lst=[]
for i in range(1,n):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lst=[]
for i in range(1,n):
    #if i**2>n:
    #    break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)



Fixed submission:
n=int(input())
lst=[]
for i in range(1,n):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)
Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())

inter = 0
inner = 0

for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        S[i + 1] = '#' + S[i + 1]
        inner += 1
if S[0] == S[-1]:
    if S[-2] == '#' + S[-1]:
        pass
    else:
        inter += K - 1
# print(S)
# print(inter)
print(inter + inner * K)

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



def func(S):
    inner = 0
    S = list(S)
    for i in range(len(S) - 1):
        if S[i] == S[i + 1]:
            S[i + 1] = '#'
            inner += 1
    return inner

if len(set(list(S))) == 1:
    print(len(S) * K // 2)
else:
    inner = func(S)
    inter = func(S * 2) - func(S) * 2
    print(inner * K + inter * (K - 1))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lst=list(map(int, input().split()))
order=[]
for i in range(1,n+1):
    order.append(str(lst.index(i)+1))
print(' '.join(order))

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


order=[None]*N
for i in range(0,N):
    order[A[i]-1]=str(i+1)
print(' '.join(order))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q=map(int, input().split())
A=[None]*Q
for i in range(Q):
    A[i]=int(input())
#print(A)
for person in range(1,N+1):
    if K-Q+A.count(person)>0:
        print('Yes')
    else:
        print('No')


#print(N,K,Q,A)
'''
score=[K]*N

for answer in A:
    score=[point-1 for point in score]
    score[answer-1]+=1
    print(score)

for point in score:
    if point>0:
        print('Yes')
    else:
        print('No')
'''

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

import collections
dict=collections.Counter(A)
for person in range(1,N+1):
    if K-Q+dict[person]>0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a, s =input().split()
a=int(a)

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

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

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