Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
D=[]
A=set()
for i in range(K):
	D.append(input())
	A.add(int(input()))
S=len(A)
print(N-S)

Fixed submission:
N,K=map(int,input().split())
D=[]
A=set()
for i in range(K):
	D.append(int(input()))
	A=A|set(map(int,input().split()))
length=len(A)
print(N-length)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
p=(N+1)//B
result=0
if p!=0:
	for a in range(1,p+1):
		x=a*B-1
		s=(A*x)//B - A*(a-1)
		if result < s:
			result=s
else:
	result=A*N//B -A*(N//B)
print(result)

Fixed submission:
A,B,N=map(int,input().split())
if B!=1:
	p=(N+1)//B
	result=0
	if p!=0:
		for a in range(1,p+1):
			x=a*B-1
			s=(A*x)//B - A*(a-1)
			if result < s:
				result=s
	else:
		result=A*N//B -A*(N//B)
	print(result)
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
result=0
if N>=B:
	N=B
for x in range(0,N+1):
	a=int(A*x/B)-A*int(x/B)
	if a>result:
		result=a
print(result)

Fixed submission:
A,B,N=map(int,input().split())
if B!=1:
	p=(N+1)//B
	result=0
	if p!=0:
		for a in range(1,p+1):
			x=a*B-1
			s=(A*x)//B - A*(a-1)
			if result < s:
				result=s
	else:
		result=A*N//B -A*(N//B)
	print(result)
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
result=0
for x in range(0,N+1):
	a=(A*x)//B-A*(x//B)
	if a>result:
		result=a
print(result)

Fixed submission:
A,B,N=map(int,input().split())
if B!=1:
	p=(N+1)//B
	result=0
	if p!=0:
		for a in range(1,p+1):
			x=a*B-1
			s=(A*x)//B - A*(a-1)
			if result < s:
				result=s
	else:
		result=A*N//B -A*(N//B)
	print(result)
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
result=0
for x in range(0,N+1):
	a=int(A*x/B)-A*int(x/B)
	if a>result:
		result=a
print(result)

Fixed submission:
A,B,N=map(int,input().split())
if B!=1:
	p=(N+1)//B
	result=0
	if p!=0:
		for a in range(1,p+1):
			x=a*B-1
			s=(A*x)//B - A*(a-1)
			if result < s:
				result=s
	else:
		result=A*N//B -A*(N//B)
	print(result)
else:
	print(0)

Buggy python submission (verdict: Runtime Error):
A,B,N=map(int,input().split())
result=0
for x in range(0,n+1):
	a=int(A*x/B)-A*int(x/B)
	if a>result:
		result=a
print(result)

Fixed submission:
A,B,N=map(int,input().split())
if B!=1:
	p=(N+1)//B
	result=0
	if p!=0:
		for a in range(1,p+1):
			x=a*B-1
			s=(A*x)//B - A*(a-1)
			if result < s:
				result=s
	else:
		result=A*N//B -A*(N//B)
	print(result)
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
flag=0
for i in range((N-1)//4):
	if S[i]!=S[(N-1)//2 -i-1]:
		flag=1
		break
	if S[(N+3)//2 +i-1]!=S[N-1-i]:
		flag=1
		break
for j in range((N-1)//2):
	if S[i]!=S[N-1-i]:
		flag=1
		break
if flag==0:
	print("Yes")
else:
	print("No")


Fixed submission:
S=input()
N=len(S)
flag=0
for i in range((N-1)//4):
	if S[i]!=S[(N-1)//2 -i-1]:
		flag=1
		break
	if S[(N+3)//2 +i-1]!=S[N-1-i]:
		flag=1
		break
for j in range((N-1)//2):
	if S[j]!=S[N-1-j]:
		flag=1
		break
if flag==0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	p=(a*b)**(1/2)
	if 2*p<(c-a-b):
    	print("Yes")
    else:
    	print("No")

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
  	p=(a*b)**(1/2)
	if 2*p<(c-a-b):
    	print("Yes")
    else:
    	print("No")

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
    	print("Yes")
    else:
    	print("No")

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
    	print("Yes")
    else:
    	print("No")

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
S, W = (int(x) for in input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")

Fixed submission:
S, W = (int(x) for x in input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
import math
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):
      num=math.gcd(i,j)
      ans+=math.gcd(num,k)
print(ans)

Fixed submission:
import math
ans=0

K=int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    num=math.gcd(i,j)
    for k in range(1,K+1):
      if num==1:
        ans+=1
      else:
        ans+=math.gcd(num,k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
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):
      if i==1 or j==1 or k==1:
        ans+=1
      else:
        ans+=math.gcd(i,(math.gcd(j,k)))
print(ans)

Fixed submission:
import math
ans=0

K=int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    num=math.gcd(i,j)
    for k in range(1,K+1):
      if num==1:
        ans+=1
      else:
        ans+=math.gcd(num,k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
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+=math.gcd(i,(math.gcd(j,k)))
print(ans)

Fixed submission:
import math
ans=0

K=int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    num=math.gcd(i,j)
    for k in range(1,K+1):
      if num==1:
        ans+=1
      else:
        ans+=math.gcd(num,k)
print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()
if S[2]==S[3]andS[4]==S[5]:
  print("Yes")
else:
  print("No")

Fixed submission:
S=input()
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
if S=="AAA" or S="BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S=="AAA" or S=="BBB":
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S = input()
if S=="AAA" or S="BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S=="AAA" or S=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
for i in range(K):
  del H[0]
for i in range(len(H)):
  ans+=H[i]
print(ans)

Fixed submission:
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
del H[0:K]
for i in range(len(H)):
  ans+=H[i]
print(ans)

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

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
for i in range(K):
  del H[i]
for i in range(len(H)):
  ans+=H[i]
print(ans)

Fixed submission:
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
del H[0:K]
for i in range(len(H)):
  ans+=H[i]
print(ans)

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

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
for i in range(K):
  del H[i]
for i in range(N-K):
  ans+=H[i]
print(ans)

Fixed submission:
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
del H[0:K]
for i in range(len(H)):
  ans+=H[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
ans=0
for i in range(N-1):
  if(S[i] == S[i+1]):
    ans++
ans=N-ans
print(ans)

Fixed submission:
N = int(input())
S = input()
ans=0
for i in range(N-1):
  if(S[i] == S[i+1]):
    ans+=1
ans=N-ans
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = [i+1 for i in range(N)]
flag = False
while flag!=True:
  flag = True
  for i in range(N-1):
    if A[i]>A[i+1]:
      A[i],A[i+1] = A[i+1],A[i]
      B[i],B[i+1] = B[i+1],B[i]
      flag = False

print(*B)

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
  
print(*B)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print(a*b)


Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
import math
import sympy as sy
n = int(input())
a = sy.factorint(n)
p_list=[]
for i in a:
    p_list.append(i)

p_list.append(n)

N=n
cnt=0
while N!=1:
    for p in p_list:
        for e in range(1,int(math.log2(n))+1):
            z=p**e
            if z > N:
                break
            else:
                if N%z==0:
                    N=N//z
                    cnt+=1
    N=1    
print(cnt)



Fixed submission:
n = int(input())


def factorization(n):
    arr = []
    tmp = n 
    for i in range(2, int(n**0.5)+1):
        if tmp%i == 0:
            cnt = 0 
            while tmp%i == 0:
                cnt += 1
                tmp //= i
            arr.append([i, cnt])
    if tmp!=1:
        arr.append([tmp, 1]) # n is prime
    if arr == []: 
        arr.append([n, 1]) # n==1 only
    return arr 


p_list=factorization(n)


N=n
cnt=0
while N!=1:
    for i in range(len(p_list)):
        p=p_list[i][0]
        for e in range(1,p_list[i][1]+1):
            z=p**e
            if z > N:
                break
            else:
                if N%z==0:
                    N=N//z
                    cnt+=1
    N=1    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))


def count(N,A):

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)

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

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)

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

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)

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

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

count(N,A)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)

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:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
E = [i+1 for i in range(N)]
A = list(map(int,input().split()))
A.insert(0,0)

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


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ansbox = [0]*(N+1)

def count(N,A,Ansbox):

    for i in range(N- 1):
        Ansbox[A[i] - 1] += 1
        
    for i in range(N):
        print(Ansbox[i])
        
count(N,A,Ansbox)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
    
def solution(K):
    ans = 0
    for i in range(1,K+1):
        for j in range(1,K+1):
            for k in range(1,K+1):

                ans += euclid(euclid(i,j), euclid(j,k))
    
    print(ans)

solution(K)


Fixed submission:
K = int(input())

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def gcd(nums):
    return functools.reduce(euclid, nums)

def solution(K):
    ans = 0
    for i in range(1,K+1):
        for j in range(1,K+1):
            for k in range(1,K+1):
                num = (i,j,k)
                ans += gcd(num)
    print(ans)

solution(K)

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

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
    
def solution(K):
    ans = 0
    for i in range(1,K+1):
        for j in range(1,K+1):
            for k in range(1,K+1):
                ans += euclid(euclid(i,j), euclid(j,k))
    print(ans)

solution(K)


Fixed submission:
K = int(input())

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def gcd(nums):
    return functools.reduce(euclid, nums)

def solution(K):
    ans = 0
    for i in range(1,K+1):
        for j in range(1,K+1):
            for k in range(1,K+1):
                num = (i,j,k)
                ans += gcd(num)
    print(ans)

solution(K)
Buggy python submission (verdict: Runtime Error):
"""
N = int(input())
S = input()

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

if __name__=='__main__':
    main(N,S)
    
    """
import itertools
N = int(input())
S = input()
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))

for i in range(1, N-1):
  for j in range(i+1,N):
      for k in range(j+1,N+1):
          if (S[i], S[j], S[k]) in RGBs:
              out -= 1
print(out)


Fixed submission:

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

#(RGB)になる組み合わせをカウント
count= S.count("R")*S.count("G")*S.count("B")
count0=0

#条件を満たさないものを引いていく
for i in range(1,N-2 +1):
    for j in range(i+1,(N+i)//2 +1):
        k=2*j-i
        if S[k-1]!=S[i-1] and S[k-1]!=S[j-1] and S[i-1]!=S[j-1]:
            count0 += 1
print(count-count0)

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

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

if __name__=='__main__':
    main(N,S)

Fixed submission:

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

#(RGB)になる組み合わせをカウント
count= S.count("R")*S.count("G")*S.count("B")
count0=0

#条件を満たさないものを引いていく
for i in range(1,N-2 +1):
    for j in range(i+1,(N+i)//2 +1):
        k=2*j-i
        if S[k-1]!=S[i-1] and S[k-1]!=S[j-1] and S[i-1]!=S[j-1]:
            count0 += 1
print(count-count0)

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

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

if __name__=='__main__':
    main(N,S)

Fixed submission:

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

#(RGB)になる組み合わせをカウント
count= S.count("R")*S.count("G")*S.count("B")
count0=0

#条件を満たさないものを引いていく
for i in range(1,N-2 +1):
    for j in range(i+1,(N+i)//2 +1):
        k=2*j-i
        if S[k-1]!=S[i-1] and S[k-1]!=S[j-1] and S[i-1]!=S[j-1]:
            count0 += 1
print(count-count0)

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

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

Fixed submission:

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

#(RGB)になる組み合わせをカウント
count= S.count("R")*S.count("G")*S.count("B")
count0=0

#条件を満たさないものを引いていく
for i in range(1,N-2 +1):
    for j in range(i+1,(N+i)//2 +1):
        k=2*j-i
        if S[k-1]!=S[i-1] and S[k-1]!=S[j-1] and S[i-1]!=S[j-1]:
            count0 += 1
print(count-count0)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())

while abs(N-K) < N:
    N -= K
print(abs(N))



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

t = N//K
N -= t*K

while abs(N-K) < N:
    N -= K
print(abs(N))
Buggy python submission (verdict: Time Limit Exceeded):
L = int(input())
V = [0]*10**7
for x in range(1,10**7):
    V[x] = (x*0.0001)**2 *(L-2*(x*0.0001))
print(max(V))

Fixed submission:
L = int(input())
x = L/3

 
print(x**2 *(L-2*x))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

sc = [[0,0] for _ in range(M)]
X = [0 for _ in range(N)]

for i in range(M):
    sc[i][0],sc[i][1] = map(int,input().split())
    
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

sc = get_unique_list(sc)

sc_0 = [0 for _ in range(len(sc))]
judge = True

for i in range(len(sc)):
    sc_0[i]= sc[i][0]

cnt_sc0 = Counter(sc_0)
for i in sc_0:
    if cnt_sc0[i]> 1:
        judge = False
        break

if judge==True:    
    for i in range(len(sc)):
        X[sc[i][0]-1] = sc[i][1]
    
    for i in range(len(X)):
        if X[i] >= 1:
            x = X[i:]
            break

if judge==True:
    if len(x)==N:
        print(int("".join(map(str,x))))
else:
    print(-1)



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

for i in range(M):
    s.append(list(map(int,input().split())))

for num in range(1000):
    str_num = str(num)
    if len(str_num) != N:
        continue
    
    flag = True
    for i in range(M):
        keta = s[i][0]
        if str_num[keta - 1] != str(s[i][1]): 
            flag = False
    if flag:
        print(num)
        exit()

print(-1)

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

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

sc = [[0,0] for _ in range(M)]
X = [0 for _ in range(N)]

for i in range(M):
    sc[i][0],sc[i][1] = map(int,input().split())
    
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

sc = get_unique_list(sc)



sc_0 = [0 for _ in range(len(sc))]
judge = True

for i in range(len(sc)):
    sc_0[i]= sc[i][0]

cnt_sc0 = Counter(sc_0)
for i in sc_0:
    if cnt_sc0[i]> 1:
        judge = False
        break
    
for i in range(len(sc)):
    X[sc[i][0]-1] = sc[i][1]

for i in range(len(X)):
    if X[i] >= 1:
        x = X[i:]
        break

if len(x)==N and judge==True:
    print(int("".join(map(str,x))))
else:
    print(-1)


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

for i in range(M):
    s.append(list(map(int,input().split())))

for num in range(1000):
    str_num = str(num)
    if len(str_num) != N:
        continue
    
    flag = True
    for i in range(M):
        keta = s[i][0]
        if str_num[keta - 1] != str(s[i][1]): 
            flag = False
    if flag:
        print(num)
        exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

ans = True
for i in range(n-1):
    for j in range(i+1,n):
        if a[j]==a[i]:
            ans = False
            break
        else:
            continue
if ans==True:
    print("YES")
else:
    print("NO")


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
A = set(a)

if len(A)==len(a):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

P = [int(_) for _ in input().split()]


cnt=0
for i in range(n):
    if min(P[:i+1])==P[i]:
        cnt+=1
print(cnt)

Fixed submission:
n = int(input())

P = [int(_) for _ in input().split()]

cnt=0
a = P[0]
for i in range(n):
    a = min(a,P[i])
    if P[i] <= min(a,P[i]):
        cnt+=1
print(cnt)

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

P = [int(_) for _ in input().split()]

cnt=0
for i in range(n):
    judge=True
    for j in P[:i+1]:
        if P[i] > j:
            judge = False
    if judge==True:
        cnt +=1
print(cnt)

Fixed submission:
n = int(input())

P = [int(_) for _ in input().split()]

cnt=0
a = P[0]
for i in range(n):
    a = min(a,P[i])
    if P[i] <= min(a,P[i]):
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())

A = [ i for i in range(1,N+1)]

ab = np.zeros(81,int).reshape(9,9)

cnt=0
a = 0
b = 0

for x in A:
    a = str(x)[0]
    b = str(x)[-1]
    for y in A:
        if str(y)[0]==b and str(y)[-1]==a:
            ab[int(a)-1][int(b)-1] += 1
print(sum(sum(ab)))


Fixed submission:
N = int(input())
a = [[0] * 9 for i in range(9)]
b = [[0] * 9 for i in range(9)]
ans = 0
for A in range(1,N+1):
    list_a = str(A)
    if list_a[-1] == '0':
        continue
    a[int(list_a[0])-1][int(list_a[-1])-1] += 1
    b[int(list_a[-1])-1][int(list_a[0])-1] += 1
for i in range(9):
    for j in range(9):
        ans += a[i][j]*b[i][j]
print(ans)
Buggy python submission (verdict: Runtime Error):
A = "abcdefghijklmnopqrstu"
c = input()

print(A[A.index(c)+1])


Fixed submission:
A = "abcdefghijklmnopqrstuvwxyz"
c = input()

print(A[A.index(c)+1])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

ps=[]
pena=[[0,False] for _ in range(n)]
for i in range(m):
    ps.append(input().split())
 
for i in range(m):
    if pena[int(ps[i][0])][1]==False and ps[i][1]=="WA":
        pena[int(ps[i][0])][0]+=1
    else:
        pena[int(ps[i][0])][1]=True

p=[pena[i][0] for i in range(len(pena))]
t=[pena[i][1] for i in range(len(pena))]
print(t.count(True),sum(p))


Fixed submission:
n,m=map(int,input().split())

ps=[]
pena=[[0,False] for _ in range(n)]
for i in range(m):
    ps.append(input().split())
 
for i in range(m):
    if pena[int(ps[i][0])-1][1]==False and ps[i][1]=="WA":
        pena[int(ps[i][0])-1][0]+=1
    else:
        pena[int(ps[i][0])-1][1]=True
ans=0
for i in range(n):
    if pena[i][1]==True:
        ans+=pena[i][0]
        
t=[pena[i][1] for i in range(len(pena))]
print(t.count(True),ans)