Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split)

if N==M:
  print("Yes")
else:
  print("No")

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

if N==M:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
for i, s in enumerate(S):
    if s == 'B':
        count += S[i + 1:].count('W')
print(count)

Fixed submission:
S = input()
count = 0
foundB = 0
for s in S:
    if s == 'W':
        count += foundB
    elif s == 'B':
        foundB += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
while 'BW' in S:
    for i in range(len(S)):
        if S[i:i+2] == 'BW':
            lS = list(S)
            lS[i:i+2] = ['W', 'B']
            S = ''.join(lS)
            count += 1
print(count)

Fixed submission:
S = input()
count = 0
foundB = 0
for s in S:
    if s == 'W':
        count += foundB
    elif s == 'B':
        foundB += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
dict = {}
for Ai in A:
    if Ai in dict:
        dict[Ai] += 1
    else:
        dict[Ai] = 1
count = 0
while len(dict) > K:
    max_key = max(dict, key=dict.get)
    min_key = min(dict, key=dict.get)
    dict[max_key] += 1
    dict[min_key] -= 1
    count += 1
    if dict[min_key] == 0:
        del dict[min_key]
print(count)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
dict = {}
for Ai in A:
    if Ai in dict:
        dict[Ai] += 1
    else:
        dict[Ai] = 1
count = 0
if len(dict) > K:
    count = sum(sorted(dict.values())[:len(dict) - K])
print(count)
Buggy python submission (verdict: Runtime Error):
S = input()
T = 'abcdefghijklmnopqrstuvwxyz'
print(sorted(list(set(T) - set(S)))[0])

Fixed submission:
S = input()
T = 'abcdefghijklmnopqrstuvwxyz'
diff = sorted(list(set(T) - set(S)))
if diff:
    print(diff[0])
else:
    print('None')

Buggy python submission (verdict: Runtime Error):
S = input()
T = 'abcdefghijklmnopqrstuvwxyz'
print(sorted(list(set(T) - set(S)))[0])

Fixed submission:
S = input()
T = 'abcdefghijklmnopqrstuvwxyz'
diff = sorted(list(set(T) - set(S)))
if diff:
    print(diff[0])
else:
    print('None')
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for X in range(K + 1):
    for Y in range(K + 1):
        for Z in range(K + 1):
            if X + Y + Z > S:
                break
            if X + Y + Z == S:
                count += 1
print(count)

Fixed submission:
K, S = map(int, input().split())
count = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if X + Y <= S and S - X - Y <= K:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for X in range(K + 1):
    for Y in range(K + 1):
        for Z in range(K + 1):
            if X + Y + Z == S:
                count += 1
print(count)

Fixed submission:
K, S = map(int, input().split())
count = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if X + Y <= S and S - X - Y <= K:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
def main():
  a = int(input())
  answer = a + a**2 + a**3
  print(answer)

if __name__ = '__main__':
  main()

Fixed submission:
def main():
  a = int(input())
  print(a+a**2+a**3)

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

import collections

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    cnt = collections.defaultdict(int)
    for var in a:
        cnt[var] += 1
    
    sum_a = sum[a]
    
    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        diff = (c-b) * cnt[b]
        sum_a += diff
        print(sum_a)
        cnt[c] += cnt[b]
        cnt[b] = 0
        
if __name__ == '__main__':
    main()

Fixed submission:
import collections

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    cnt = collections.defaultdict(int)
    for var in a:
        cnt[var] += 1
    
    sum_a = sum(a)
    
    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        diff = (c-b) * cnt[b]
        sum_a += diff
        print(sum_a)
        cnt[c] += cnt[b]
        cnt[b] = 0
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**18:
            answer = -1
            break

    print(answer)

main()

Fixed submission:
str_num = input()
num_list = str_num.split()

answer = int(num_list[0]) * int(num_list[1])
print(answer)
Buggy python submission (verdict: Runtime Error):
str_num = input()
num_list = str_num.split()

answer = 1
for i in range(1, int(num_list[0])+1):
    answer *=int(num_list[i])
    if answer >= 10**18:
        answer = -1
        break

print(answer)

Fixed submission:
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**18:
            answer = -1
            break

    print(answer)

main()
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    n, m, x = list(map(int, input().split()))
    
    c = []
    a = []
    
    def calc_price(bit):
        price_total = 0
        learn_total = [0] * m #理解度
        
        for i in range(n):
            if (bit >> i) & 1:
                price_total += c[i]
                learn = a[i]
                for j, la in enumerate(learn):
                    learn_total[j] += la
        
        if check(learn_total):
            return price_total
        else:
            return INF
        
    def check(learn_total):
        for i in range(m):
            if learn_total[i] < x:
                return False
        return True
    
    for i in range(n):
        c_temp, *a_temp = list(map(int, input().split()))
        c.append(c_temp)
        a.append(a_temp)
        
    INF = float("inf")
    ans = INF
    
    for bit in range(1 << n):
        price = calc_price(bit)
        ans = min(ans, price)
    
    if ans == INF:
        print(-1)
    else:
        print(ans)

Fixed submission:
def Registration():
    S = input()
    T = input()
    
    flag = False
    if len(S) + 1 == len(T):
        if S == T[:-1]:
            flag = True
    
    if flag:
        print('Yes')
    else:
        print('No')

Registration()
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    print(max(floor_list))

if __name__ == '__main__':
    main()

Fixed submission:
def we_love_golf():
    K = int(input())
    condition = input()
    condition_list = condition.split()
    A = int(condition_list[0])
    B = int(condition_list[1])
    
    for i in range(A, B+1):
        if i % K == 0:
            print('OK')
            return
    
    print('NG')
    return

we_love_golf()
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    #print(floor_list)
    #floor_list.sort()
    #print(floor_list[-1])
    print(max(floor_list))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, n = list(map(int, input().split()))
    
    limit = 0
    if n >= b-1:
        limit = b-1
    else:
        limit = n
    
    floor_sub = int(limit * a / b) - int(limit / b) * a
    print(floor_sub)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    print(max(floor_list))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, n = list(map(int, input().split()))
    
    limit = 0
    if n >= b-1:
        limit = b-1
    else:
        limit = n
    
    floor_sub = int(limit * a / b) - int(limit / b) * a
    print(floor_sub)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    print(max(floor_list))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, n = list(map(int, input().split()))
    
    limit = 0
    if n >= b-1:
        limit = b-1
    else:
        limit = n
    
    floor_sub = int(limit * a / b) - int(limit / b) * a
    print(floor_sub)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
int main() {
    long long N, K;
    cin >> N >> K;
    long long M = N+1, L = K-1;
    long long res = M*(M*M+5)/6 + L*(L*L*2+L*3-5-M*(L+1)*3)/6;
    cout << res%MOD << endl;
}

Fixed submission:
n,k=map(int,input().split())
print(((n*(n+1)*(n+2)-(3*n-2*k+4)*(k-1)*k)//6-k+n+2)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(input())

import numpy as np

snp=np.array(S)
R=list(np.where(snp=='R')[0])
G=list(np.where(snp=='G')[0])
B=np.where(snp=='B')[0]
ans=0
for r in R:
    for g in G:
        d=abs(r-g)
        front=min(r,g)
        back=max(r,g)
        ans+=sum((B!=front-d)*(B!=back+d)*(B!=(front+back)/2))
print(ans)

Fixed submission:
import math
def gcd(a,b,c):
    a = math.gcd(a, b)
    a = math.gcd(a, c)
    return a
ans=0
K=int(input())
for i in range(1,K+1): 
    for j in range(1,K+1):
        for k in range(1, K+1):
            ans+=gcd(i,j,k)
print(ans)
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int,input().split())
P = sorted(list(map(int,input().split())), reverse=True)
Q = sorted(list(map(int,input().split())), reverse=True)
R = sorted(list(map(int,input().split())), reverse=True)
P = P[:X]
Q = Q[:Y]
A = P + Q + R
A.sorted(reverse=True)
ans = sum(A[:X+Y])
print(ans)

Fixed submission:
X, Y, A, B, C = map(int,input().split())
P = sorted(list(map(int,input().split())), reverse=True)
Q = sorted(list(map(int,input().split())), reverse=True)
R = sorted(list(map(int,input().split())), reverse=True)
P = P[:X]
Q = Q[:Y]
A = P + Q + R
A.sort(reverse=True)
ans = sum(A[:X+Y])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S=deque(input())
Q=int(input())
for _ in range(Q):
    target = input()
    if target == '1':
        S.reverse()
    else:
        a,b,c=target.split()
        if b=='1':
            S.appendleft(c)
        else:
            S.append(c)
print(''.join(list(S)))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
r='1'
for _ in range(Q):
    target = input()
    if target == '1':
        if r=='1':
            r='2'
        else:
            r='1'
    else:
        a,b,c=target.split()
        if b=='1' and r=='1':
            S.appendleft(c)
        elif b=='2' and r=='1':
            S.append(c)
        elif b=='1' and r=='2':
            S.append(c)
        else:
            S.appendleft(c)
if r=='2':
    S.reverse()
print(''.join(list(S)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S=deque(input())
Q=int(input())
for _ in range(Q):
    target = input()
    if target == '1':
        S.reverse()
    else:
        a,b,c=target.split()
        if b=='1':
            S.appendleft(c)
        else:
            S.append(c)
print(''.join(list(S)))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
r='1'
for _ in range(Q):
    target = input()
    if target == '1':
        if r=='1':
            r='2'
        else:
            r='1'
    else:
        a,b,c=target.split()
        if b=='1' and r=='1':
            S.appendleft(c)
        elif b=='2' and r=='1':
            S.append(c)
        elif b=='1' and r=='2':
            S.append(c)
        else:
            S.appendleft(c)
if r=='2':
    S.reverse()
print(''.join(list(S)))

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
for _ in range(Q):
    target = input()
    if target == '1':
        S=S[::-1]
    else:
        a,b,c=target.split()
        if b=='1':
            S=c+S
        else:
            S=S+c
print(S)

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
r='1'
for _ in range(Q):
    target = input()
    if target == '1':
        if r=='1':
            r='2'
        else:
            r='1'
    else:
        a,b,c=target.split()
        if b=='1' and r=='1':
            S.appendleft(c)
        elif b=='2' and r=='1':
            S.append(c)
        elif b=='1' and r=='2':
            S.append(c)
        else:
            S.appendleft(c)
if r=='2':
    S.reverse()
print(''.join(list(S)))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=(p+1).cumsum()

print((pcm[K:]-pcm[0:-K]).max() /2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

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

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

print((np.max(np.convolve(p,np.ones(K),'valid'))+K)/2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

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

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

def rolling_window(a, window, step_size):
    shape = a.shape[:-1] + (a.shape[-1] - window + 1 - step_size + 1, window)
    strides = a.strides + (a.strides[-1] * step_size,)
    return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)

print((max(np.sum(rolling_window(p,K,1),axis=1))+K)/2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

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

ans=0
for i in range(N-K+1):
    ans=max(ans, sum(p[i:i+K]))

print((ans+K)/2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

ans=0
for i in range(N-K+1):
    ans=max(ans, sum(p[i:i+K]))

print((ans+K)/2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

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

ans=0
for i in range(N-K+1):
    ans=max(ans, sum(p[i:i+K]))

print((ans+K)/2)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P=list(map(int,input().split()))

ans=1
for i in range(1,N):
    if min(P[:i])>P[i]:
        ans+=1
print(ans)

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

ans=1
m=P[0]
for i in range(1,N):
    m=min(m,P[i-1])
    if m>P[i]:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))

import numpy as np

A=np.array(A)

from bisect import bisect
s = bisect(A.cumsum(), A.sum()/2)

if A.sum()/2 in A.cumsum():
    print(0)
else:
    print(min(A.sum() - A[0:s+1].sum(), A.sum() - A[s+1:N].cumsum()))

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

import numpy as np

A=np.array(A)

from bisect import bisect_left
s = bisect_left(A.cumsum(), A.sum()/2)

if A.sum()/2 in A.cumsum():
    print(0)
else:
    print(int(min(abs(A.sum()/2 - A[0:s].sum()) * 2, abs(A.sum()/2 - A[0:s+1].sum()) * 2)))
Buggy python submission (verdict: Runtime Error):
X,Y=map(int,input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

MOD = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

Z=X+Y
if Z%3 == 0:
    D=int(Z/3)
    print(cmb(D,abs(D-X),MOD))
else:
    print(0)

Fixed submission:
X,Y=map(int,input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

MOD = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % MOD )
    inverse.append( ( -inverse[MOD % i] * (MOD//i) ) % MOD )
    g2.append( (g2[-1] * inverse[-1]) % MOD )

Z=X+Y
if Z%3 == 0:
    D=int(Z/3)
    d=min(X,Y)
    print(cmb(D,d-D,MOD))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import numpy as np
S=input();T=S[::-1];a=[];c=0
for t in T:
    if t==">":
        c+=1
    else:
        c=0
    a.append(c)
A=np.array(a[::-1]+[0])
b=[];c=0
for s in S:
    if s=="<":
        c+=1
    else:
        c=0
    b.append(c)
B=np.array([0]+b)
print(np.maximum(A,B).sum())

Fixed submission:
S=input()
S_rev=S[::-1]

import numpy as np

arr_rev=[]
cnt=0
for s_rev in S_rev:
    if s_rev==">":
        cnt+=1
    else:
        cnt=0
    arr_rev.append(cnt)

A=np.array(arr_rev[::-1]+[0])

arr=[]
cnt=0
for s in S:
    if s=="<":
        cnt+=1
    else:
        cnt=0
    arr.append(cnt)

B=np.array([0]+arr)

print(sum(np.maximum(A,B)))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))

l=-1
r=10**12+2
mid=(l+r)//2
while r-l>1:
    m=0
    for i in range(N):
        a=mid//F[i]
        m+=max(0,A[i]-a)
    if m>K:
        l=mid
    else:
        r=mid
    mid=(l+r)//2
print(l+1)  

Fixed submission:
import math
a,b,x=map(int,input().split())
ans = math.degrees(math.atan(2*(b-x/a**2)/a))
if ans <= math.degrees(math.atan(b/a)):
    print(max(ans,0))
else:
    ans = math.degrees(math.atan(b/(2*x/a/b)))
    print(max(ans,0))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))

l=-1
r=10**12+2
mid=(l+r)//2
while r-l>1:
    m=0
    for i in range(N):
        a=mid//F[i]
        m+=max(0,A[i]-a)
    if m>K:
        l=mid
    else:
        r=mid
    mid=(l+r)//2
print(l+1)  

Fixed submission:
import numpy as np
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))
s=A.sum()
l=-1
r=10**12+2
while l+1<r:
    m=(l+r)//2
    if s-np.minimum(A,m//F).sum()<=K:
        r=m
    else:
        l=m
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N=int(input())
L=list(map(int,input().split()))

def aaa(l):
    x=0
    a=l[0]
    b=l[1]
    c=l[2]
    if a+b>c:
        if b+c>a:
            if c+a>b:
                x=1
    return x
ans=0
for l in list(itertools.combinations(L, 3)):
    ans+=aaa(list(l))
print(ans)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        ab=L[i]+L[j]
        r=bisect.bisect_left(L,ab)
        l=j+1
        ans+=r-l
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))

def aaa(l):
    x=0
    a=l[0]
    b=l[1]
    c=l[2]
    if a+b>c:
        if b+c>a:
            if c+a>b:
                x=1
    return x
ans=0
for l in list(itertools.combinations(L, 3)):
    ans+=aaa(list(l))
print(ans)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        ab=L[i]+L[j]
        r=bisect.bisect_left(L,ab)
        l=j+1
        ans+=r-l
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
T=list(range(1,N+1))
for i in T:
    print(A.index(i)+1,end=" ")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
K=list(range(1,N+1))

d=dict(zip(A,K))

for i in range(1,N+1):
    print(d[i], end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
for i in range(1,N+1):
    print(A.index(i)+1,end=" ")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
K=list(range(1,N+1))

d=dict(zip(A,K))

for i in range(1,N+1):
    print(d[i], end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
A,B=map(int,input().split())
arr=set()
X=min(A,B)
for i in range(1,(X+1)//2+1):
    if A%i==0 and B%i==0:
        arr.add(i)
s=min(arr);e=max(arr)
def make_divisors(n,s,e):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if i!=s and i!=e:
            if n % i == 0 :
                divisors.add(i)
                if i != n // i:
                    divisors.add(n//i)
    return divisors
cnt=0

for j in arr:
    if len(make_divisors(j,0,0) & arr)<3:
        cnt+=1
print(cnt)

Fixed submission:
A,B=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)
        
    if arr==[]:
        if n!=1:
            arr.append(n)

    return arr

print(len(set(factorization(A)) & set(factorization(B)))+1)