Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []
for i in range(N):
    A.append(list(map(int,input().split())))
B = []
for i in range(N):
    B.append(list(map(int,input().split())))
C = []
for i in range(N-1):
    C.append(list(map(int,input().split())))

ans = 0
before = 9999
for i in range(N):
    ans += B[A[i]-1]
    if A[i]==before + 1:
        ans += c[i-1]

print(ans)

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

ans = 0
before = 9999
for i in range(N):
    ans += B[A[i]-1]
    if A[i]== (before+1):
        ans += C[A[i]-2]
    before = A[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for _ in range(n):
    s.append(input())

sdict = []
for x in s:
    tmp = {}
    for y in x:
        if y in tmp:
            tmp[y] += 1
        else:
            tmp[y] =1
    sdict.append(tmp)
cnt = 0
for i in range(n-1):
    for j in range(i+1,n):
        if sdict[i] == sdict[j]:
            cnt += 1
print(cnt)


Fixed submission:
n = int(input())
s = []
for _ in range(n):
    tmp = list(input())
    tmp.sort()
    s.append(str(tmp))
cnt = 0
dict = {}
for x in s:
    if x in dict:
        cnt += dict[x]
        dict[x] += 1
    else:
        dict[x] = 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
def cmp(A,B):
    ans = True
    n = len(A)
    i = 0
    while i < n:
        if A[i] == B[i]:
            i += 1
        else:
            ans = False
            break
    return ans

N = int(input())
L = []
i = 0
while i < N:
    tmp = input()
    L.append(sorted(tmp))
    i += 1

cnt = 0
i = 0

while i < N-1:
    j = i+1
    while j < N:
        if cmp(L[i],L[j]):
            cnt += 1
        j += 1
    i += 1

print(cnt)

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    tmp = list(input())
    tmp.sort()
    s.append(str(tmp))
cnt = 0
dict = {}
for x in s:
    if x in dict:
        cnt += dict[x]
        dict[x] += 1
    else:
        dict[x] = 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = []
i = 0
while i < N:
    tmp = input()
    L.append(sorted(tmp))
    i += 1

cnt = 0
i = 0

while i < N-1:
    j = i+1
    while j < N:
        if L[i] == L[j]:
            cnt += 1
        j += 1
    i += 1

print(cnt)

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    tmp = list(input())
    tmp.sort()
    s.append(str(tmp))
cnt = 0
dict = {}
for x in s:
    if x in dict:
        cnt += dict[x]
        dict[x] += 1
    else:
        dict[x] = 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
ans = a-b-c
if ans < 0:
    print(ans*-1)
else:
    print(0)

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

ans = a-b-c
if ans < 0:
    print(ans*-1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int,input().split()))

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) && (c == 0):
    ans = "YES"

print(ans)


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

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) or (c == 0):
    ans = "YES"

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = []
for i in range(N):
    s,p = map(str,input().split())
    tmp = [i+1,s,int(p)]
    B.append(tmp)
B.sort(key=lambda x:x[2],reverse=True)
B.sort(key=lambda x:x[1])
for x in B:
    print(x[0])


Fixed submission:
a,p=map(int,input().split())
print((3*a+p)//2)

Buggy python submission (verdict: Runtime Error):
a,p=map(int,input().split())
print((3*a+p)//2))

Fixed submission:
a,p=map(int,input().split())
print((3*a+p)//2)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A>=13 :
  print(B)
elif A >=6 and A<=12:
  print(B//2)
 else:
  print(0)

Fixed submission:
A,B = map(int,input().split())
if A>=13 :
  print(B)
elif A >=6 and A<=12:
  print(B//2)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
  if v[i]>c[i]:
    sum+=v[i]-c[i]
    i+=1
print(sum)


Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
    if v[i]>c[i]:
        sum+=v[i]-c[i]
    i+=1
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
  if v[i]>c[i]:
    sum+=v[i]-c[i]
print(sum)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
    if v[i]>c[i]:
        sum+=v[i]-c[i]
    i+=1
print(sum)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
r=s[k]
ans=""
for i in range(n):
  if s[i]==r:
    ans+=r
  else:
    ans+="*"
print(ans)

Fixed submission:
n=int(input())
s=input()
k=int(input())
r=s[k-1]
ans=""
for i in range(n):
  if s[i]==r:
    ans+=r
  else:
    ans+="*"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
Query = [list(map(int,input().split())) for _ in range(q)]
x = [0]
for i in range(n):
    if s[i:i+2] == "AC":
        x.append(1)
    else:
        x.append(0)
for l,r in Query:
    tmp = x[l:r]
    print(tmp.count(1))


Fixed submission:
n,q = map(int,input().split())
s = input()
Query = [list(map(int,input().split())) for _ in range(q)]
x = [ 0 for _ in range(n) ]
for i in range(n-1):
    if s[i:i+2] == "AC":
        x[i+1] = x[i] + 1
    else:
        x[i+1] = x[i]
for l,r in Query:
    print(x[r-1]-x[l-1])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)

Fixed submission:
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c-1] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c] += 1
print(d.count(n))

Fixed submission:
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c-1] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(n)]
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
for i in range(n):
    for j in range(w+1):
        if j >= L[i][0]:
            dp[i+1][j] = max(dp[i][j-L[i][0]]+L[i][1],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[n][w])

Fixed submission:
n,w = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(n)]
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
for i in range(n):
    for j in range(w+1):
        if j >= L[i][0]:
            dp[i+1][j] = max(dp[i][j-L[i][0]]+L[i][1],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))

Fixed submission:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input.split())
print(a-b+1)

Fixed submission:
a,b=map(int,input().split())
print(a-b+1)
Buggy python submission (verdict: Runtime Error):
import itertools
a=map(int,input().split())
ans=999
l=[0,1,2]
for x in itertools(l,3):
  tmp=abs(a[x[0]]-a[x[1]])+abs(a[x[1]]-a[x[2]])
  if tmp <=ans:
    ans =tmp
print(ans)

Fixed submission:
import itertools
a=list(map(int,input().split()))
ans=999
l=[0,1,2]
for x in itertools.permutations(l,3):
  tmp=abs(a[x[0]]-a[x[1]])+abs(a[x[1]]-a[x[2]])
  if tmp <=ans:
    ans =tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a+b = 15:
  print("+")
elif a*b = 15:
  print("*")
else:
  print("x")

Fixed submission:
a,b = map(int,input().split())
if a+b == 15:
  print("+")
elif a*b == 15:
  print("*")
else:
  print("x")
Buggy python submission (verdict: Runtime Error):
s=input()
n=int(s)
ss=0
for i in len(s):
  ss+=int(s[i])
if n%ss=0:
  print("Yes")
else:
  print("No")
 

Fixed submission:
s=input()
n=int(s)
ss=0
for i in range(len(s)):
  ss+=int(s[i])
if n%ss==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
def func(x,y):
    global s,h,w,seen
    d = [1,-1]
    flag = False
    for i in d:
        if x+i < h and x+i >= 0:
            if s[x+i][y] == "#":
                seen[x+i+y*w] = 1
                seen[x+y*w] = 1
                flag = True
        if y+i < h and y+i >= 0:
            if s[x][y+i] == "#":
                seen[x+(y+i)*w] = 1
                seen[x+y*w] = 1
                flag = True
    return flag


h,w = map(int,input().split())
s = [input() for _ in range(h)]
seen = [0 for _ in range(h*w)]
ans = False
for i in range(h):
    for j in range(w):
        if s[i][j] == "#" and seen[i+j*w] == 0:
            if not func(i,j):
                ans = True
if ans:
    print("No")
else:
    print("Yes")

Fixed submission:
def func(x,y):
    global s,h,w,seen
    d = [1,-1]
    flag = False
    for i in d:
        if x+i < h and x+i >= 0:
            if s[x+i][y] == "#":
                seen[(x+i)*w+y] = 1
                seen[x*w+y] = 1
                flag = True
        if y+i < w and y+i >= 0:
            if s[x][y+i] == "#":
                seen[x*w+y+i] = 1
                seen[x*w+y] = 1
                flag = True
    return flag


h,w = map(int,input().split())
s = [input() for _ in range(h)]
seen = [0 for _ in range(h*w)]
ans = False
for i in range(h):
    for j in range(w):
        if s[i][j] == "#" and seen[j + i*w] == 0:
            if not func(i,j):
                ans = True
if ans:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input())
print(math.ceil((a+b)/2))

Fixed submission:
import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
L = [0 for _ in range(86)]
L[0]=2
L[1]=1
if n > 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])

Fixed submission:
n = int(input())
L = [0 for _ in range(n+2)]
L[0]=2
L[1]=1
if n >= 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])

Buggy python submission (verdict: Time Limit Exceeded):
def func(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return func(i-1)+func(i-2)

n = int(input())
print(func(n))

Fixed submission:
n = int(input())
L = [0 for _ in range(n+2)]
L[0]=2
L[1]=1
if n >= 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(2*b -a)

Fixed submission:
a = int(input())
b = int(input())
print(2*b -a)
Buggy python submission (verdict: Time Limit Exceeded):
input()
A=list(map(int,input().split()))
B=set(A)
dict={}
for x in B:
  dict[x]=A.count(x)
max=0
for x in B:
  tmp = dict[x]
  if x-1 in B:
    tmp+=dict[x-1]
  if x+1 in B:
    tmp+=dict[x+1]
  if tmp>max:
    max=tmp
print(max)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
Ap = [a+1 for a in A]
Am = [a-1 for a in A]
label = set(A+Ap+Am)
dict = {l:0 for l in label}
for a in A+Ap+Am:
    dict[a]+=1
print(max(dict.values()))
Buggy python submission (verdict: Runtime Error):
n = input()
a = map(int,input().split())
print(max(a)-min(a))

Fixed submission:
n = input()
a = list(map(int,input().split()))
print(max(a)-min(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
cnt = 0
B = [False for _ in range(n)]
for i,a in enumerate(A):
    print(A[a-1],i)
    print(B)
    if A[a-1] == i+1 and B[i] == False:
        cnt+=1
        B[a-1] = True
    B[i] = True
print(cnt)


Fixed submission:
n = int(input())
A = list(map(int,input().split()))
cnt = 0
B = [False for _ in range(n)]
for i,a in enumerate(A):
    if A[a-1] == i+1 and B[i] == False:
        cnt+=1
        B[a-1] = True
    B[i] = True
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):

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

ans = 1
if N % 2 == 1 and A.count(0) != 1:
    ans = 0

if N % 2 == 1:
    A.remove(0)
    
c = -1
if N % 2 == 0:
    c = 1
else:
    c = 2

for i in range(c, N, 2):
    if A.count(i) != 2:
        ans = 0
    else:
        ans *= 2
        A.remove(i)
        A.remove(i)

if len(A) != 0:
    ans = 0

print(ans % 1000000007)



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

ans = 1
A.sort()
if N % 2 == 1 and not A.count(0) == 1:
    ans = 0

s = -1
if N % 2 == 1:
    A.remove(0)
    s = 2
else:
    s = 1

for i in range(0, len(A), 2):
    if A[i] == A[i + 1] == s:
        ans *= 2
    else:
        ans = 0
    s += 2
    
print(ans % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
end = len(S) // 2
for i in range(end):
    S = S.replace("ST","")

print(len(S))


Fixed submission:
X = input()
N = len(X)
S = 0
ans = 0
for i in range(N):
    if X[i] == 'S':
        S += 1
    elif S > 0:
        S -= 1
        ans += 2
        
print(N - ans)

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

for i in range(60000):
    S = S.replace("ST","")

print(len(S))


Fixed submission:
X = input()
N = len(X)
S = 0
ans = 0
for i in range(N):
    if X[i] == 'S':
        S += 1
    elif S > 0:
        S -= 1
        ans += 2
        
print(N - ans)

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

for i in range(100000):
    S = S.replace("ST","")

print(len(S))


Fixed submission:
X = input()
N = len(X)
S = 0
ans = 0
for i in range(N):
    if X[i] == 'S':
        S += 1
    elif S > 0:
        S -= 1
        ans += 2
        
print(N - ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ans=0

R = 'R'*i
for i in range(1,4):
  R = 'R'*i
  if R in s:
    ans = i
    
print(ans)

Fixed submission:
s = input()
ans = 0

for i in range(1, 4):
    p = "R" * i
    if p in s:
        ans = i

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if l[k]<l[i]+l[j]:
        if l[i]!=l[j] and l[j]!=l[k]:
            ans +=1
            
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if l[k]<l[i]+l[j]:
        if l[i]!=l[j] and l[j]!=l[k]:
        ans +=1

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if l[k]<l[i]+l[j] and i!=j and j!=k:
        ans +=1

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if k<i+j and i!=j and j!=k:
        ans +=1

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
print(N**2-A)

Fixed submission:
N = int(input())
A = int(input())
print(N**2-A)
Buggy python submission (verdict: Runtime Error):
N = input()
K = input()
l = list(map(int(input().split()))

print(N,K,l)
         
for i in l:
     ans = 0    
	 ans += min(i,K-i)
    
print(ans*2)
         

Fixed submission:
N = input()
K = int(input())
l = input().split()
         

         
ans =0 
for i in l:
	s = int(i)
	ans += min(s,K-s)
print(ans*2)

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

for i in l:
     ans = 0    
	ans += min(i,K-i)
    
print(ans*2)
         

Fixed submission:
N = input()
K = int(input())
l = input().split()
         

         
ans =0 
for i in l:
	s = int(i)
	ans += min(s,K-s)
print(ans*2)
Buggy python submission (verdict: Runtime Error):
n = int(input())  # nは入力回数
num_list = [int(input()) for _ in range(n)]
 
a = num_list[0] / num_list[2]

if a <= num_list[1]:
  print("Yes")
else :
  print("No")
 

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

ans = a/c
 
if ans <= b:
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())  # nは入力回数
num_list = [int(input()) for _ in range(n)]
 
arriving_tm = num_list[0] / num_list[2]
if arriving_tm <= num_list[1]:
  print("Yes")
else :
  print("No")
 

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

ans = a/c
 
if ans <= b:
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
待ち合わせ場所は高橋君の家から 
D
 メートル離れた地点であり、待ち合わせの時刻は 
T
 分後です。

高橋君は今から家を出発し、分速 
S
 メートルで待ち合わせ場所までまっすぐ移動します。

待ち合わせに間に合うでしょうか？

n = int(input())  # nは入力回数
num_list = [int(input()) for _ in range(n)]

arriving_tm = num_list[0] / num_list[2]
if arriving_tm <= num_list[1]:
  print("Yes")
else :
  print("No")



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

ans = a/c
 
if ans <= b:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
Sr = input()
Tg = input()

ans = 10000
for i in range(len(Sr)-len(Tg)+1):
  mat = 0
  trimmedSr = Sr[i:i + len(Tg)]
  for j in range(len(Tg)):
    if trimmedSr != Tg[j]:
      mat++;
  ans = min(mat, ans)
print(ans)

Fixed submission:
from sys import stdin

S = input()
T = input()

ans  =10000
# 全探索を実施
for i in range(len(S) - len(T) + 1):
    # 不一致だった文字数
    mat = 0
    # i番目からTの長さ分の文字列が入る
    U = S[i:i + len(T)]
    for j in range(len(T)):
        # 一文字ずつアンマッチかを確認する
        if U[j] != T[j]:
            mat += 1
    # 小さいほうが入る
    ans = min(ans, mat)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n, *a = map(int, open(0).read().split())
ans = reduce(lambda x, y: x * y, a)
print([ans, -1, 0][10**18 < ans + 2*(ans == 0)])

Fixed submission:
import sys
n = int(input())
a = sorted(map(int,input().split()))
ans = 1
if a[0] == 0:
  print(0)
else:
  for i in a:
    ans *= i
    if 1000000000000000000<ans:
      print(-1)
      sys.exit()
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=sorted(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[k]<l[i]+l[j]:
        ans+=1
      else:
        break
print(ans)

Fixed submission:
import bisect
n=int(input())
l=sorted(map(int,input().split()))
print(sum(bisect.bisect_left(l,l[i]+l[j])-j-1for i in range(n)for j in range(i+1,n)))
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='')
    if i!=n+1:
        print(" ",end="")
print()

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    b[a[i]-1]=i+1

for i in range(n):
    print(b[i],end="")
    if i!=n-1:
        print(" ",end="")
print()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
s=input()
t=input()
for i in t:
    if i not in s:
        print("-1")
        sys.exit()
l=len(s)
ans=0
p=0
for i in t:
    j=p
    while True:
        #print("{} ".format(s[j]),end="")
        if i==s[j]:
            ans+=1
            if j!=l-1:
                p=j+1
            else:
                p=0
            break
        elif j==l-1:
            ans+=1
            j=-1
        else:
            ans+=1
        j+=1
    #print()

print(ans)

Fixed submission:
from collections import*
from bisect import*

s=input()
t=input()
slen=len(s)
d=defaultdict(list)

for i,c in enumerate(s):
    d[c].append(i)

nowplace=-1
roop=0
for c in t:
    if not d[c]:
        print(-1)
        exit()
    i=bisect(d[c],nowplace)
    if len(d[c])==i:
        roop+=1
        nowplace=d[c][0]
    else:
        nowplace=d[c][i]

print(roop*slen+nowplace+1)
Buggy python submission (verdict: Runtime Error):
n=input();print("YNeos"[int(n)%(int(n[0])+int(n[1]))!=0::2])

Fixed submission:
n=input();print("YNeos"[int(n)%sum([int(i)for i in n])!=0::2])
Buggy python submission (verdict: Runtime Error):
r,g=map(int,input().split());print(g*2-r)

Fixed submission:
a,b=map(int,open(0));print(2*b-a)
Buggy python submission (verdict: Runtime Error):
N, T = [int(i) for i in input().split(" ")]
c = []
t = []

for i in range(N):
    t = [int(i) for i in input().split(" ")]
    if t[1] <= T:
        c.append(t[0])
        t.append(t[1])

print(min(c))

Fixed submission:
N, T = [int(i) for i in input().split(" ")]
c = []
t = []

for i in range(N):
    t = [int(i) for i in input().split(" ")]
    if t[1] <= T:
        c.append(t[0])
        t.append(t[1])

if c == []:
    print("TLE")
else:
    print(min(c))
Buggy python submission (verdict: Runtime Error):
L = int(input())
r = 0
while 2 ** r <= L:
    r += 1
r -= 1

ans = []
N = r + 1
for i in range(1, N):
    ans.append((i, i + 1, 0))
    ans.append((i, i + 1, 2 ** (i - 1)))
    
for t in range(N - 1, 0, -1):
    if L - 2 ** (t - 1) >= 2 ** r:
        ans.append((L - 2 ** (t - 1)))
        L -= 2 ** (t - 1)
        
print(N, len(ans))
for i in ans:
    print(i[0], i[1], i[2])

Fixed submission:
L = int(input())
r = 0
while 2 ** r <= L:
    r += 1
r -= 1

ans = []
N = r + 1
for i in range(1, N):
    ans.append((i, i + 1, 0))
    ans.append((i, i + 1, 2 ** (i - 1)))
    
for t in range(N - 1, 0, -1):
    if L - 2 ** (t - 1) >= 2 ** r:
        ans.append((t, N, L - 2 ** (t - 1)))
        L -= 2 ** (t - 1)
        
print(N, len(ans))
for i in ans:
    print(i[0], i[1], i[2])