Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
if N <= 3:
    print('0')
else:
    Rlist = []
    Glist = []
    Blist = []
    for i in range(N):
        if S[i] == 'R':
            Rlist.append(i)
        elif S[i] == 'G':
            Glist.append(i)
        else:
            Blist.append(i)
    for i in Rlist:
        for j in Glist:
            for k in Blist:
                listijk = sorted([i,j,k])
                if listijk[1] - listijk[0] != listijk[2] -listijk[1]:
                    count += 1
    print(count)

Fixed submission:
N = int(input())
S = input()
if N <= 3:
    print('0')
else:
    minuscount = 0
    Rcount = 0
    Gcount = 0
    Bcount = 0 
    for i in range(N):
        if S[i] == 'R':
            Rcount += 1
        elif S[i] == 'G':
            Gcount += 1
        else:
            Bcount += 1
        for j in range(1,N):
            if i+2*j>=N:
                break
            if S[i] != S[i+j] and S[i+j] != S[i+2*j] and S[i+2*j] != S[i]:
                minuscount += 1

    print(Rcount*Gcount*Bcount-minuscount)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
if N <= 3:
    print('0')
else:
    for i in range(N-2):
        for j in range(i+1,N-1):
            for k in range(j+1,N):
                if S[i] != S[j] and S[j] != S[k] and S[k] != S[i] and j-i != k-j:
                    count += 1
    print(count)

Fixed submission:
N = int(input())
S = input()
if N <= 3:
    print('0')
else:
    minuscount = 0
    Rcount = 0
    Gcount = 0
    Bcount = 0 
    for i in range(N):
        if S[i] == 'R':
            Rcount += 1
        elif S[i] == 'G':
            Gcount += 1
        else:
            Bcount += 1
        for j in range(1,N):
            if i+2*j>=N:
                break
            if S[i] != S[i+j] and S[i+j] != S[i+2*j] and S[i+2*j] != S[i]:
                minuscount += 1

    print(Rcount*Gcount*Bcount-minuscount)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    if ask==0:
        Ans=0
        break
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    if ask==0:
        Ans=0
        break
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)
Buggy python submission (verdict: Runtime Error):
#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

N,M = map(int,input().split())

#辺を登録
Sides = []
for i in range (M):
    Sides.append(map(int,input().split()))
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*N+1
Vertexes[1] = [0]

#負閉路のチェック用
negative = [False] * N+1

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N):
                negative[to_v] = True:
            Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] and negative[to_v] is False:
            negative[to_v] = True
            flag = 1
    if flag ==0:
        break

if negative[N]:
    print('inf')
else:
    print(Vertexes[N])

Fixed submission:
#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

N,M = map(int,input().split())

#辺を登録
Sides = []
for i in range (M):
    Side = list(map(int,input().split()))
    Sides.append(Side)
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*(N+1)
Vertexes[1] = 0

#負閉路のチェック用
negative = [False] * (N+1)

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N-1):
                negative[to_v] = True
            else:
                Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] :
            negative[to_v] = True
            flag = 1
    #if flag ==0:
     #   break

if negative[N]:
    print('inf')
else:
    print(-Vertexes[N])
Buggy python submission (verdict: Runtime Error):
n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+n[i]-"0"

if Sum%9==0:
    print("yes")
else:
    print("no")
    

        

Fixed submission:
n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+int(n[i])

if Sum%9==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()


Fixed submission:
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()

Buggy python submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()


Fixed submission:
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()

Buggy python submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()


Fixed submission:
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()
Buggy python submission (verdict: Runtime Error):
def Qb():
    from functools import reduce
    from operator import mul

    n = int(input())
    lina = map(int, input().split())

    if 0 in lina:
        print(0)
        exit()

    ans = reduce(mul, lina)

    if 10 ** 18 < ans:
        ans = -1
    print(ans)


def Qc():
    pass


if __name__ == '__main__':
    Qb()


Fixed submission:
def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()

Buggy python submission (verdict: Time Limit Exceeded):
def Qb():
    from functools import reduce
    from operator import mul

    n = int(input())
    lina = map(int, input().split())

    ans = reduce(mul, lina)

    # for i, a in enumerate(lina):
    #     ans *= a
    if 10 ** 18 < ans:
        ans = -1
    print(ans)


def Qc():
    pass


if __name__ == '__main__':
    Qb()


Fixed submission:
def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()

Buggy python submission (verdict: Time Limit Exceeded):
def Qb():
    n = int(input())
    lina = map(int, input().split())

    ans = 1
    for i, a in enumerate(lina):
        ans *= a
    if 10 ** 18 < ans:
        ans = -1
    print(ans)


if __name__ == '__main__':
    Qb()


Fixed submission:
def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()

Buggy python submission (verdict: Time Limit Exceeded):
def Qb():
    n = int(input())
    lina = map(int, input().split())

    ans = 1
    for i, a in enumerate(lina):
        ans = a * ans
    if 10 ** 18 < ans:
        ans = -1
    print(ans)


if __name__ == '__main__':
    Qb()


Fixed submission:
def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  sum_aj = sum(a[i+1:])
  ans += ((ai%MOD)*(sum_aj%MOD))%MOD

print(ans%MOD)

Fixed submission:
import numpy as np
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
cum_a = np.cumsum(a[::-1])
cum_a = cum_a[::-1]
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  sum_aj = cum_a[i+1]
  ans += ((ai%MOD)*(sum_aj%MOD))%MOD

print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  for aj in a[i+1:]:
    ans += ((ai%MOD)*(aj%MOD))%MOD

print(ans%MOD)

Fixed submission:
import numpy as np
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
cum_a = np.cumsum(a[::-1])
cum_a = cum_a[::-1]
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  sum_aj = cum_a[i+1]
  ans += ((ai%MOD)*(sum_aj%MOD))%MOD

print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  for aj in a[i+1:]:
    ans += ((ai%MOD)*(aj%MOD))%MOD

print(ans%MOD)

Fixed submission:
import numpy as np
MOD = 10**9+7
n = input()
a = list(map(int, input().split()))
ans = 0
cum_a = np.cumsum(a[::-1])
cum_a = cum_a[::-1]
for i, ai in enumerate(a):
  if i == len(a)-1:
    continue
  sum_aj = cum_a[i+1]
  ans += ((ai%MOD)*(sum_aj%MOD))%MOD

print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
ans = A[0]
exist_zero = False
def solve(A):
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(A)


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

def solve(N, A):
  ans = A[0]
  exist_zero = False
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(N, A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
  ans *= A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

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

def solve(N, A):
  ans = A[0]
  exist_zero = False
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(N, A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
  ans *= A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

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

def solve(N, A):
  ans = A[0]
  exist_zero = False
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(N, A)
Buggy python submission (verdict: Runtime Error):
atcoder-tools: The pre-rendered templates are not found.#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
S=str(input())
ans="Yes"
for i,s in S:
  if i%2==0:#odd
    if s=="L":
      ans="No"
  else:#even
    if s=="R":
      ans="No"
print(ans)

Fixed submission:
S=str(input())
ans="Yes"
for i,s in enumerate(S):
  if i%2==0:#odd
    if s=="L":
      ans="No"
      break
  else:#even
    if s=="R":
      ans="No"
      break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=True)
for m in range(M):
  if len(a)>1:
    max_=max(a[:2])
    a.remove(max_)
    flag=1
    for n in range(N-1):
      if max_//2<a[n]:
        pass
      else:
        a.insert(n,max_//2)
        flag=0
        break
    if flag:
      a.append(max_//2)
  else:
    a[0]=a[0]//2
print(sum(a))

Fixed submission:
from heapq import heapify,heappush,heappop

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = [(-x, x) for x in a]

heapify(a)

for m in range(M):
  max_ = heappop(a)
  a_ = max_[1]//2
  heappush(a,(-a_,a_))

ans=0
for a_ in a:
  ans+=a_[1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=True)
for m in range(M):
  if len(a)>1:
    max_=max(a[:2])
    a.remove(max_)
    flag=1
    for n in range(N-1):
      if max_//2<a[n]:
        continue
      else:
        a.insert(n,max_//2)
        flag=0
        break
    if flag:
      a.append(max_//2)
  else:
    a[0]=a[0]//2
print(sum(a))

Fixed submission:
from heapq import heapify,heappush,heappop

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = [(-x, x) for x in a]

heapify(a)

for m in range(M):
  max_ = heappop(a)
  a_ = max_[1]//2
  heappush(a,(-a_,a_))

ans=0
for a_ in a:
  ans+=a_[1]
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=True)
for m in range(M):
  max_=max(a[:2])
  a.remove(max_)
  if max_//2<a[0]:
    a.insert(1,max_//2)
  else:
    a.insert(0,max_//2)
print(sum(a))

Fixed submission:
from heapq import heapify,heappush,heappop

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = [(-x, x) for x in a]

heapify(a)

for m in range(M):
  max_ = heappop(a)
  a_ = max_[1]//2
  heappush(a,(-a_,a_))

ans=0
for a_ in a:
  ans+=a_[1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=list(map(int,input().split()))
for m in range(M):
  max_=max(a)
  a.remove(max_)
  a.append(max_//2)
print(sum(a))

Fixed submission:
from heapq import heapify,heappush,heappop

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = [(-x, x) for x in a]

heapify(a)

for m in range(M):
  max_ = heappop(a)
  a_ = max_[1]//2
  heappush(a,(-a_,a_))

ans=0
for a_ in a:
  ans+=a_[1]
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))

for i in range(N):
  if i == 0:
    ans=='YES'
  if H[i-1] < H[i]:
    H[i] -= 1
  elif H[i-1]==H[i]:
    continue
  else:
    ans = "NO"
    break;
print(ans)

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

for i in range(N):
  ans='Yes'
  if N == 1:
    ans='Yes'
    break;
  if i== 0:
    H[i]-=1
    continue
    
  if H[i-1] < H[i]:
    H[i] -= 1
  elif H[i-1]==H[i]:
    continue
  else:
    ans = "No"
    break;
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [ int(input()) for i in range(N) ]
ans = [1]*N
for i,x in enumerate(a):
  if i == N-1:
    ans[i]=max(a[:i])
  else:
    ans[i]=max(max(a[:i],a[i+1:]))
    
for i in range(N):
  print(ans[i])

Fixed submission:
N = int(input())
a = [ int(input()) for i in range(N) ]

max_a = max(a)
sec_max_a = sorted(a)[-2]
ans = [max_a]*N
max_index = []
for i in range(N):
  if a[i] == max_a:
    max_index.append(i)
#print(max_index)

for i in max_index:
  ans[i] = sec_max_a
for i in ans:
  print(i)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    pass
print(bound)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split() ) )
bound=1
D=0
for n in L:
  D+=n
  if D<=X:
    bound+=1
  else:
    break
print(bound)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    break;
print(bound)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split() ) )
bound=1
D=0
for n in L:
  D+=n
  if D<=X:
    bound+=1
  else:
    break
print(bound)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    break
print(bound)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split() ) )
bound=1
D=0
for n in L:
  D+=n
  if D<=X:
    bound+=1
  else:
    break
print(bound)
Buggy python submission (verdict: Runtime Error):
r,d,x_2000=map(int,input().split())
x_i = x_2000
for i in range(10):
  x_ii = r*x_i-D
  x_i = x_ii
  print(x_ii)

Fixed submission:
r,d,x_2000=map(int,input().split())
x_i = x_2000
for i in range(10):
  x_ii = r*x_i-d
  x_i = x_ii
  print(x_ii)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
k-=1
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"

print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(str(input()))
k-=1
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"

print("".join(s))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
k-=1
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"
else
print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(str(input()))
k-=1
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"

print("".join(s))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"
print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(str(input()))
k-=1
if s[k]=="A":
  s[k]="a"
elif s[k]=="B":
  s[k]="b"
elif s[k]=="C":
  s[k]="c"

print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
    for (li, ri) in zip(l, r):
        print(S[li - 1 : ri].count("AC"))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    l = [int()] * (Q)  # type: "List[int]"
    r = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, Q, S, l, r)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
    table = [0] * (N + 1)

    for i in range(N):
        table[i + 1] = table[i] + (1 if S[i : i + 2] == "AC" else 0)

    for i in range(Q):
        print(table[r[i] - 1] - table[l[i] - 1])

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    l = [int()] * (Q)  # type: "List[int]"
    r = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, Q, S, l, r)

if __name__ == '__main__':
    main()