Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
def count(n, a):
    c = 0
    for i in range(n+1):
        if a[i] == n:
            c += 1
    return c
for j in range(N):
    print(count(j+1, A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
buka = list()
for i in range(N):
    buka.append(0)
for j in range(len(A)):
    buka[A[j]-1] += 1
for k in range(len(buka)):
    print(buka[k])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
def count(n, a):
    c = 0
    for i in range(len(a)):
        if a[i] == n:
            c += 1
    return c
for j in range(N):
    print(count(j+1, A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
buka = list()
for i in range(N):
    buka.append(0)
for j in range(len(A)):
    buka[A[j]-1] += 1
for k in range(len(buka)):
    print(buka[k])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count = 0
for k in range(2, N):
    for j in range(1, k):
        if S[k] != S[j]:
            for i in range(0, j):
                if (S[i]!=S[j] and S[i]!=S[k]) and j-i!=k-j:
                    count += 1
        else:
            continue
print(count)

Fixed submission:
N = int(input())
S = input()
r = 0
g = 0
b = 0
for a in range(N):
    if S[a] == "R":
        r += 1
    elif S[a] == "G":
        g += 1
    elif S[a] == "B":
        b += 1
all = r*g*b
count = 0
for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if k < N:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count += 1
print(all-count)

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

Fixed submission:
N = int(input())
S = input()
r = 0
g = 0
b = 0
for a in range(N):
    if S[a] == "R":
        r += 1
    elif S[a] == "G":
        g += 1
    elif S[a] == "B":
        b += 1
all = r*g*b
count = 0
for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if k < N:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count += 1
print(all-count)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
numgcd = [0]*(K+1)
sumgcd = 0
mod = 10**9+7
for i in range(1, K+1)[::-1]:
    r = K//i
    num = r**N
    count = 2
    while count*i <= K:
        num -= numgcd[count*i]
        count += 1
    numgcd[i] = num
    sumgcd += num*i%mod
print(sumgcd%mod)

Fixed submission:
N, K = map(int, input().split())
numgcd = [0]*(K+1)
sumgcd = 0
mod = 10**9+7
for i in range(1, K+1)[::-1]:
    numgcd[i] = pow(K//i, N, mod)
    count = 2
    while count*i <= K:
        numgcd[i] -= numgcd[count*i]
        count += 1
    sumgcd += numgcd[i]*i
print(sumgcd%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
numgcd = [0]*(K+1)
for i in range(1, K+1)[::-1]:
    r = K//i
    num = r**N
    count = 2
    while count*i <= K:
        num = num - numgcd[count*i]
        count += 1
    numgcd[i] = num
sumgcd = 0
for j in range(1, K+1):
    sumgcd += j*numgcd[j]
mod = 10**9+7
print(sumgcd%mod)

Fixed submission:
N, K = map(int, input().split())
numgcd = [0]*(K+1)
sumgcd = 0
mod = 10**9+7
for i in range(1, K+1)[::-1]:
    numgcd[i] = pow(K//i, N, mod)
    count = 2
    while count*i <= K:
        numgcd[i] -= numgcd[count*i]
        count += 1
    sumgcd += numgcd[i]*i
print(sumgcd%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        r = a%b
        a = b
        b = r
    return a
gcdlist = list()
for i in range(2, K+1):
    for j in range(1, i):
        gcdlist.append(gcd(i, j))
        gcdlist.append(gcd(i, j))
for i in range(1, K+1):
    gcdlist.append(i)

for i in range(3, N+1):
    gcdnew = list()
    for j in range(1, K+1):
        for k in range(len(gcdlist)):
            gcdnew.append(gcd(j, gcdlist[k]))
    gcdlist = gcdnew
print(sum(gcdlist))

Fixed submission:
N, K = map(int, input().split())
numgcd = [0]*(K+1)
sumgcd = 0
mod = 10**9+7
for i in range(1, K+1)[::-1]:
    numgcd[i] = pow(K//i, N, mod)
    count = 2
    while count*i <= K:
        numgcd[i] -= numgcd[count*i]
        count += 1
    sumgcd += numgcd[i]*i
print(sumgcd%mod)
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
print(f"{A[2]} {A[0]} {A[1]}")

Fixed submission:
A = list(map(int, input().split()))
print("{} {} {}".format(A[2], A[0], A[1]))
Buggy python submission (verdict: Runtime Error):
R=int.input()
print(2*3.14159*R)

Fixed submission:
R=int(input())
print(2*3.14159*R)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

for i in range(N):
    print(A.count(i+1))

Fixed submission:
import collections

N=int(input())
A=list(map(int,input().split()))
count=collections.Counter(A)

for i in range(N):
    print(count[i+1])

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

for i in range(N):
    print(A.count(i+1))

Fixed submission:
import collections

N=int(input())
A=list(map(int,input().split()))
count=collections.Counter(A)

for i in range(N):
    print(count[i+1])
Buggy python submission (verdict: Runtime Error):
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        if 2*j-i>N:
            continue
        if (S[i] != S[j]) and (S[i]!=S[2*j-i]) and (S[j]!=S[2*j-i]):
            count+=1
    
print(lenR*lenG*lenB-count)

Fixed submission:
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        k=2*j-i
        if k>=N:
            continue
        else:
            if (S[i] != S[j]) and (S[i]!=S[k]) and (S[j]!=S[k]):
                count+=1
    
print(lenR*lenG*lenB-count)

Buggy python submission (verdict: Runtime Error):
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        if 2*j-i>N:
            continue
        if (S[i] != S[j]) and (S[i]!=S[2*j-i]) and (S[j]!=S[2*j-i]):
                    count+=1
    
print(lenR*lenG*lenB-count)

Fixed submission:
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        k=2*j-i
        if k>=N:
            continue
        else:
            if (S[i] != S[j]) and (S[i]!=S[k]) and (S[j]!=S[k]):
                count+=1
    
print(lenR*lenG*lenB-count)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):

        if (S[i] != S[j]) and (2*j-i<N):
                if (S[i]!=S[2*j-i]) and (S[j]!=S[2*j-i]):
                    count+=1
    
print(lenR*lenG*lenB-count)

Fixed submission:
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        k=2*j-i
        if k>=N:
            continue
        else:
            if (S[i] != S[j]) and (S[i]!=S[k]) and (S[j]!=S[k]):
                count+=1
    
print(lenR*lenG*lenB-count)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N=int(input())
S=input()

count=0
for i in range(N-2):
    for j in range(i,N-1):
        if (S[i] != S[j]) :
            for k in range(j,N):
                if (j-i)==(k-j):
                    continue
                if (S[i]!=S[k]) and (S[j]!=S[k]):
                    count+=1
    
print(count)

Fixed submission:
import collections

N=int(input())
S=input()

lenR=S.count("R")
lenG=S.count("G")
lenB=S.count("B")

count=0
for i in range(N-2):
    for j in range(i,N-1):
        k=2*j-i
        if k>=N:
            continue
        else:
            if (S[i] != S[j]) and (S[i]!=S[k]) and (S[j]!=S[k]):
                count+=1
    
print(lenR*lenG*lenB-count)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

roop=0
i=[]
while roop==0 :
    N=abs(N-k)
    i.append(N)
    if collections.Counter(i)["N"] > 2 :
        roop=1

print(min(i))

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

print(min(N%k,abs(N%k-k)))

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

roop=0
counter=0
i=[]
while roop==0 :
    N=abs(N-k)
    i.append(N)
    counter+=1
    if i.count(N) > 2 :
        roop=1

print(min(i))

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

print(min(N%k,abs(N%k-k)))
Buggy python submission (verdict: Runtime Error):
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(N): print(f'{a[i]}')

Fixed submission:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(len(a)): print(f'{a[i]}')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input().strip())
As = np.array(input().strip().split(" ")).astype(np.int32)
for i in range(1,N+1):
    indices = [j for j,val in enumerate(As) if val==i]
    print(len(indices))

Fixed submission:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(len(a)): print(f'{a[i]}')
Buggy python submission (verdict: Runtime Error):
n = input()
if n<100 or n>999:
	x = len(n)
	for i in range(x):
    	if n[i] is '7':
       		print('Yes')
        	break
else:
  print('No')

Fixed submission:
n = input()
x = len(n)
b = 'false'
for i in range(x):
    if n[i] is '7':
        b = 'true'
        print('Yes')
        break
if b is not 'true':
  print('No')

Buggy python submission (verdict: Runtime Error):
n = input()
if n<100 or n>999:
    n = 107
x = len(n)
for i in range(x):
    if n[i] is '7':
        print('Yes')
        break

Fixed submission:
n = input()
x = len(n)
b = 'false'
for i in range(x):
    if n[i] is '7':
        b = 'true'
        print('Yes')
        break
if b is not 'true':
  print('No')

Buggy python submission (verdict: Runtime Error):
n = input()
while n<100 or n>999:
    n = input()
x = len(n)
for i in range(x):
    if n[i] is '7':
        print('Yes')
        break

Fixed submission:
n = input()
x = len(n)
b = 'false'
for i in range(x):
    if n[i] is '7':
        b = 'true'
        print('Yes')
        break
if b is not 'true':
  print('No')
Buggy python submission (verdict: Runtime Error):
#ライブラリの読み込み
import math

#入力値の格納
x = int(input())

#得点の計算
score = int((x // 500 * 1000) + (x % 500 // 5 * 5))

#表示
print(score)

Fixed submission:
#ライブラリの読み込み
import math

#入力値の格納
n,k = map(int, input().split())

#n進数への変換定義
def convert(x,y):
    if int(x/y):
        return convert(int(x/y),y) + str(x%y)
    return str(x%y)

#n進数へ変換し長さを算出
text = len(convert(n,k))

#結果を表示
print(text)
Buggy python submission (verdict: Runtime Error):
pi = 3.141592653589793238462643383279

a = input()
ans = a * 2 * pi
print(ans)

Fixed submission:
#copy
import math

R = int(input())
print(R * 2 * math.pi)

Buggy python submission (verdict: Runtime Error):
pi = 3.1415926535

a = input()
ans = a * 2 * pi
print(ans)

Fixed submission:
#copy
import math

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

s = chr(input())
t = chr(input())

ans = 0

for i in range(3):
    if s[i] == t[i]:
        ans += 1
print(ans)

Fixed submission:
#copy

s = input()
t = input()

ans = 0

for i in range(3):
    if s[i] == t[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
13 3

Fixed submission:
a, b = map(int, input().split())
print(max(a + b, a - b, a * b))
Buggy python submission (verdict: Runtime Error):
N = int(input())

count = 0

for i in range(N):
	num = int(input())
    if num % 3 == 0 and num % 5 == 0:
    	continue
    elif num % 3 == 0:
    	continue
    elif num % 5 == 0:
    	continue
    else:
    	count += num

print(count)

Fixed submission:
n = int(input())

list = []

count = 1

for i in range(n):
  if count % 3 != 0 and count % 5 != 0:
    list.append(count)
  count += 1
    
print(sum(list))
Buggy python submission (verdict: Runtime Error):
nums = map(int,input().split())

print(nums[2],nums[0],nums[1])

Fixed submission:
nums = input().split()
print(nums[2],nums[0],nums[1],sep = ' ')
Buggy python submission (verdict: Runtime Error):
a = input()
	if a == 'AAA':
    	print('NO')
    elif a == 'BBB':
    	print('NO')
    else:
    	print('YES')

Fixed submission:
bus = input()
if bus == 'AAA' or bus == 'BBB':
	print('No')
else:
	print('Yes')
Buggy python submission (verdict: Runtime Error):
num = int(input())
if num % 2 == 0:
	print(num // 2)
elif:
	print(num // 2 + 1)

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N // 2)
elif N % 2 == 1:
	print(N // 2 + 1)
Buggy python submission (verdict: Runtime Error):
n = int(input())

f = 'True'

for i in range(n):
  a = int(input())
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      f = 'False'

if f == 'True':
  print('APPROVED')
else:
  print('DENIED')

Fixed submission:
n = int(input())

a = input().split()

f = 'True'

for i in a:
  if int(i) % 2 == 0:
    if int(i) % 3 != 0 and int(i) % 5 != 0:
      f = 'False'

if f == 'True':
  print('APPROVED')
else:
  print('DENIED')
Buggy python submission (verdict: Runtime Error):
H,A = map(int,input())

count = 0

while H > 0:
	H -= A
	count += 1
    
print(count)


Fixed submission:
H,A = map(int,input().split())
count=0
while H>0:
	H -= A
	count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a > = 13:
  print(b)
elif 6 <= a <= 12:
  print(b // 2)
else:
  print(0)

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

if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b // 2)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
dict = {'A':'T','G':'C'}
b = input()

print(dict[b])

Fixed submission:
dict = {'A':'T','C':'G','T':'A','G':'C'}
b = input()

print(dict[b])
Buggy python submission (verdict: Runtime Error):
d = int(input())
dict = {'25':'Christmas','24':'Christmas Eve',
        '23':'Christmas Eve Eve',
        '22':'Christmas Eve Eve Eve'}

print(dict[d])

Fixed submission:
d = input()
dict = {'25':'Christmas','24':'Christmas Eve',
        '23':'Christmas Eve Eve',
        '22':'Christmas Eve Eve Eve'}

print(dict[d])
Buggy python submission (verdict: Runtime Error):
dict = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = map(int,input().split())

if dict[x] > dict[y]:
  print('>')
elif dict[x] == dict[y]:
  print('=')
else:
  print('<')

Fixed submission:
dict = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = map(str,input().split())

if dict[x] > dict[y]:
  print('>')
elif dict[x] == dict[y]:
  print('=')
else:
  print('<')
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

group1 = list(1,3,5,7,8,10,12)
group2 = list(4,6,9,11)

if x in group1 and y in group1:
  print('Yes')
elif x in group2 and y in group2:
  print('Yes')
elif x == y == 2:
  print('Yes')
else:
  print('No')

Fixed submission:
x,y = map(int,input().split())

group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]

if x in group1 and y in group1:
  print('Yes')
elif x in group2 and y in group2:
  print('Yes')
elif x == y == 2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c = input.split()

if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

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

if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input.split())

if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')

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

if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
nums = map(int,input.split())
if nums[0] = 5 and nums[1] = 5 and nums[2] = 7:
	print('YES')
elif nums[0] = 5 and nums[1] = 7 and nums[2] = 5:
	print('YES')
elif nums[0] = 7 and nums[1] = 5 and nums[2] = 5:
	print('YES')
else:
	print('NO')

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

if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    n, a, b = na()
    
    if a == 0 and b == 0 || a == 0:
        print(0)
        return

    if n <= a:
        print(n)
        return
      
    AB = a + b
    if n <= AB:
        print(min(n, a))
        return 
    
    x = int(n / AB)
    print(x * a + n - (x * AB))

if __name__ == '__main__':
    main()


Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    n, a, b = na()
    
    if (a == 0 and b == 0) or a == 0:
        print(0)
        return

    if n <= a:
        print(n)
        return
      
    AB = a + b
    if n <= AB:
        print(min(n, a))
        return 
    
    x = int(n / AB)

    print(x * a + min(n - (x * AB), a))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def main():
  n = ni()

  x = divi(n)
  
  ans = 1e18+7
  for i in range(0, len(x), 2):
    print(x[i])
    ans = min(ans, x[i] - 1 + x[i+1] - 1)
  print(ans)
  

main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def main():
  n = ni()

  x = divi(n)
  
  ans = 1e18+7
  for i in range(0, len(x), 2):
    # print(x[i])
    try:
      ans = min(ans, x[i] - 1 + x[i+1] - 1)
    except:
      ans = min(ans, (x[i] - 1) * 2)  
  print(ans)
  
main()
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()

  odd = 1 if i%2 == 1 else 0
  for i in range(1, n+1):
    if i%2 == 0:
      odd += 1
  print(odd/n)

main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()

  odd = 1 if n%2 == 1 else 0
  for i in range(1, n+1):
    if i%2 == 0:
      odd += 1
  print(odd/n)

main()
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  res = []
  for i in range(1,n+1):
    res.append(a[i])
  print(*res)

main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  d = {}
  for i, a in enumerate(a):
    d[a] = i+1
  res = []
  for i in range(n):
    res.append(d[i+1])
  print(*res)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  res = []
  for i in range(1,n+1):
    res.append(a.index(i)+1)
  print(*res)

main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  d = {}
  for i, a in enumerate(a):
    d[a] = i+1
  res = []
  for i in range(n):
    res.append(d[i+1])
  print(*res)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  sorta = sorted(a)
  res = []
  for aa in sorta:
    res.append(a.index(aa)+1)
  print(*res)

main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def main():
  n = ni()
  a = list(na())
  d = {}
  for i, a in enumerate(a):
    d[a] = i+1
  res = []
  for i in range(n):
    res.append(d[i+1])
  print(*res)

main()
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin.readline
na = lambda: map(int, stdin().split())
ns = lambda: stdin().rstrip()
ni = lambda: int(ns())
def main():
  n, k = na()
  s = ns()+"0"

  ans = 0
  LRcnt = []
  cnt = 1
  LR = []
  for i in range(n):
    if s[i] == s[i+1]:
      ans += 1
      cnt += 1
    else:
      LR.append(s[i])
      LRcnt.append(cnt)
      cnt = 1

  N = len(LRcnt)
  wa = [0] * (N+1)
  for i in range(N):
    wa[i+1] = wa[i] + LRcnt[i]

  ans = 0
  for i in range(N-k-2):
    x = wa[i+k+2] - wa[i] - 1 + sum(LRcnt[i+k+2:]) - len(LRcnt[i+k+2:]) + sum(LRcnt[:i+k+2]) - len(LRcnt[:i+k+2])
    if ans < x:
      ans = x
      if LR[i] == "R":
        ans -= 1
      if LR[i+k+1] == "L"::
        ans += 1

  if ans == 0:
    print(sum(LRcnt)-1)
  else:
    print(ans)
main()

Fixed submission:
import sys

stdin = sys.stdin.readline
na = lambda: map(int, stdin().split())
ns = lambda: stdin().rstrip()
ni = lambda: int(ns())

def main():
  n, k = na()
  s = ns()

  ans = n-1
  for i in range(1, n):
    if s[i] != s[i-1]:
      ans -= 1
  print(min(n-1, ans+2*k))
main()
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

sn = lambda : stdin.readline().rstrip()
an = lambda : map(int, stdin.readline().split())
ni = lambda : int(sn())

def f(n):
  return n*(n+1)//2

x = 0
y = 0

n, k = an()
a = list(an())

mod = int(1e9)+7
ans = 0

for i, ai in range(n):
  for j in range(i+1, n):
    if ai > a[j]:
      x += 1
  
  for j in range(i+1):
    if ai > a[j]:
      y += 1

ans += x * f(k)
ans += y * f(k - 1)
print(ans % mod)

Fixed submission:
import sys

stdin = sys.stdin

sn = lambda : stdin.readline().rstrip()
an = lambda : map(int, stdin.readline().split())
ni = lambda : int(sn())

def f(n):
    return n*(n+1)//2

def main():
  n, k = an()
  a = list(an())

  mod = int(1e9)+7
  ans = 0
  x = a[:] 
  for i, ai in enumerate(x):
    cnt = 0
    for j in range(i+1, n):
      if ai > x[j]:
        cnt += 1
    tcnt = 0
    for j in range(i+1):
      if ai > x[j]:
        tcnt += 1

    ans += f(k) * cnt
    ans %= mod
    ans += f(k - 1) * tcnt
    ans %= mod

  print(ans)

main()