Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
r=[0]*3
r[0],r[1],r[2],n=map(int, input().split())
ct=0
r=sorted(r)

for i in range(n//r[2]+1):
    for j in range(min(n//r[1]+1, n-r[2]*i+1)):
        if (n-(i*r[2]+j*r[1]))%r[0]==0 and 0<=(n-(i*r[2]+j*r[1]))<=n+1:
            ct+=1
print(ct)
    

Fixed submission:
r=[0]*3
r[0],r[1],r[2],n=map(int, input().split())
ct=0
r=sorted(r)

for i in range(n//r[2]+1):
    for j in range(min(n//r[1]+1, n-r[2]*i+1)):
        if (n-(i*r[2]+j*r[1]))%r[0]==0 and 0<=(n-(i*r[2]+j*r[1]))<=n+1:
            ct+=1
print(ct)

Buggy python submission (verdict: Time Limit Exceeded):
r=[0]*3
r[0],r[1],r[2],n=map(int, input().split())
ct=0
r=sorted(r)

for i in range(n//r[2]+1):
    for j in range(n//r[1]+1):
        if (n-(i*r[2]+j*r[1]))%r[0]==0 and 0<=(n-(i*r[2]+j*r[1]))<=n+1:
            ct+=1
print(ct)
    

Fixed submission:
r=[0]*3
r[0],r[1],r[2],n=map(int, input().split())
ct=0
r=sorted(r)

for i in range(n//r[2]+1):
    for j in range(min(n//r[1]+1, n-r[2]*i+1)):
        if (n-(i*r[2]+j*r[1]))%r[0]==0 and 0<=(n-(i*r[2]+j*r[1]))<=n+1:
            ct+=1
print(ct)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int, input().split())
ct=0

for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(i*r+j*g))%b==0 and 0<=(n-(i*r+j*g))<=n+1:
            ct+=1
print(ct)
    

Fixed submission:
r=[0]*3
r[0],r[1],r[2],n=map(int, input().split())
ct=0
r=sorted(r)

for i in range(n//r[2]+1):
    for j in range(min(n//r[1]+1, n-r[2]*i+1)):
        if (n-(i*r[2]+j*r[1]))%r[0]==0 and 0<=(n-(i*r[2]+j*r[1]))<=n+1:
            ct+=1
print(ct)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
a=[]
for i in range(1<<N):
    tmp=0
    for j in range(N):
        if ((i >> j) & 1) == 1:
          tmp+=V[j]-C[j]
    a.append(tmp)
print(max(a))

Fixed submission:
N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in range(N):
    if V[i]-C[i]>0:
        a+=V[i]-C[i]
print(a)
Buggy python submission (verdict: Runtime Error):
S=input()
ls=[]
tmp=0
aaa=['A', 'T', 'G', 'C']
for i in range(len(S)):
	if S[i] not in aaa:
		ls.append(tmp)
		tmp=0
		continue
	else:
		tmp+=1
print(max(ls))

Fixed submission:
S=input()
ls=[]
tmp=0
aaa=['A', 'T', 'G', 'C']
for i in range(len(S)):
	if S[i] not in aaa:
		ls.append(tmp)
		tmp=0
		continue
	else:
		tmp+=1
ls.append(tmp)
print(max(ls))
Buggy python submission (verdict: Time Limit Exceeded):
A,B=map(int, input().split())

if A==B:
	print(A)
	exit(0)
ans=A^(A+1)
for i in range(A+2,B+1):
	ans=ans^i
print(ans)

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

# if A==B:
# 	print(A)
# 	exit(0)
# ans=A^(A+1)
# for i in range(A+2,B+1):
# 	ans=ans^i
# print(ans)

# A,B=0,456

# if A==B:
# 	print(A)
# 	exit(0)
# ans=A^(A+1)
# print(1, bin(ans))
# for i in range(A+2,B+1):
# 	ans=ans^i
# 	print(i, bin(ans))

if A==B:
	print(A)
	exit(0)

def func(c):
	if c%2==1:
		if c%4==1:
			return 1
		else:
			return 0
	else:
		if (c-1)%4==1:
			return 1^c
		else:
			return 0^c
print(func(A-1)^func(B))
Buggy python submission (verdict: Runtime Error):
N, M=map(int, input().split())
KA=[list(map(int,input().split())) for _ in range(N)]

tmp=[0]*M
for i in range(N):
	for j in range(KA[i][0]):
		tmp[KA[i][j]]+=1
# print(tmp)
ans=0
for i in range(M):
	if tmp[i]==N:
		ans+=1
print(ans)

Fixed submission:
N, M=map(int, input().split())
KA=[list(map(int,input().split())) for _ in range(N)]

tmp=[0]*(M+1)
for i in range(N):
	for j in range(1,KA[i][0]+1):
		tmp[KA[i][j]]+=1
# print(tmp)
ans=0
for i in range(M+1):
	if tmp[i]==N:
		ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())

def func(ls, n):
    m=0
    for i in range(len(ls)-1):
        if ls[i]=='B' and ls[i+1]=='W':
            ls[i]='W'
            ls[i+1]='B'
            n+=1
            m+=1
    if m==0:
        return n
    else:
        return func(ls, n)
print(func(S,0))


Fixed submission:
S=list(input())
ans=0
aki=0
for i in range(len(S)):
    if S[i]=='W':
        ans+=i-aki
        aki+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
odd=[]
even=[]
for i in A:
    if i%2:
        odd.append(i)
    else:
        even.append(i)

ls=[]
for i in range(30):
    ls.append(2<<i)

ans=0
for i in range(len(odd)):
    ct=0
    for j in range(len(odd)-1):
        if i!=j:
            if odd[i]+odd[j] in ls:
                ct+=1
                tmpi=i
                tmpj=j
    if ct==1:
        odd.pop(tmpi)
        odd.pop(tmpj)
        ans+=1
for i in range(len(even)):
    ct=0
    for j in range(len(even)-1):
        if i!=j:
            if even[i]+even[j] in ls:
                ct+=1
                tmpi=i
                tmpj=j
    if ct==1:
        even.pop(tmpi)
        even.pop(tmpj)
        ans+=1
print(ans)


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

A.sort(reverse=True)
dic={}
for a in A:
    dic[a]=dic.get(a,0)+1

ans=0

for a in A:
    small=(1<<(len(format(a,"b")))) -a
    if small==a:
        if dic[a]>=2:
            dic[a]-=2
            ans+=1
        continue
    if dic.get(a,0)>0 and dic.get(small,0)>0:
        dic[a]-=1
        dic[small]-=1
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce

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

N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x.sort()
y=[]

for i in range(N):
    y.append(x[i+1]-x[i])
print(gcd_list(y))

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

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

x.append(X)
y=sorted(x)
z=[]
for i in range(N):
    z.append(y[i+1]-y[i])
Min=z[0]
for i in range(N-1):
    if Min>gcd(z[i],z[i+1]):
        Min=gcd(z[i],z[i+1])
print(Min)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(X)
x.sort()
y=[]

for i in range(N):
    y.append(x[i+1]-x[i])
print(gcd_list(y))

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

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

x.append(X)
y=sorted(x)
z=[]
for i in range(N):
    z.append(y[i+1]-y[i])
Min=z[0]
for i in range(N-1):
    if Min>gcd(z[i],z[i+1]):
        Min=gcd(z[i],z[i+1])
print(Min)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
ans=0
for h in range(2//K,(2*N//K)+1):
    if h*K%2==1:
        continue
    a=h*K//2
    if 1<=a<=N:
        for i in range((1+a)//K,(N+a)//K+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range((1+b)//K,(N+b)//K+1):
                    c=j*K-b
                    if 1<=c<=N and (c+a)%K==0:
                            ans+=1
print(ans)


Fixed submission:
N,K=map(int,input().split())
if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+(2*N//K-N//K)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
lmnk=(2*N//K)
ans=0
for h in range(2//K,lmnk+1):
    a=h*K//2
    if 1<=a<=N:
        for i in range((1+a)//K,(N+a)//K+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range((1+b)//K,(N+b)//K+1):
                    c=j*K-b
                    if 1<=c<=N and (c+a)%K==0:
                            ans+=1
print(ans)


Fixed submission:
N,K=map(int,input().split())
if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+(2*N//K-N//K)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
lmnk=(2*N//K)
ans=0
for h in range(1,lmnk+1):
    a=h*K//2
    if 1<=a<=N:
        for i in range((1+a)//K,(N+a)//K+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range((1+b)//K,(N+b)//K+1):
                    c=j*K-b
                    if 1<=c<=N and (c+a)%K==0:
                            ans+=1
print(ans)


Fixed submission:
N,K=map(int,input().split())
if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+(2*N//K-N//K)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
lmnk=(2*N//K)
ans=0
for h in range(1,lmnk+1):
    a=h*K//2
    if 1<=a<=N:
        for i in range(1,(N+a)//K+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range(1,(N+b)//K+1):
                    c=j*K-b
                    if 1<=c<=N:
                        if (a+b)%K==0 and (b+c)%K==0 and (c+a)%K==0:
                            ans+=1
print(ans)


Fixed submission:
N,K=map(int,input().split())
if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+(2*N//K-N//K)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
lmnk=(2*N//K)
ans=0
for h in range(1,lmnk+1):
    a=h*K//2
    if 1<=a<=N:
        for i in range(1,lmnk+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range(1,lmnk+1):
                    c=j*K-b
                    if 1<=c<=N:
                        if (a+b)%K==0 and (b+c)%K==0 and (c+a)%K==0:
                            ans+=1
print(ans)


Fixed submission:
N,K=map(int,input().split())
if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+(2*N//K-N//K)**3)
Buggy python submission (verdict: Runtime Error):
N, i=list(map(int,input().split()))
print(N+1-K)


Fixed submission:
N, i=list(map(int,input().split()))
print(N+1-i)
Buggy python submission (verdict: Runtime Error):
N=int(input())
is_ans=0
for i in range(25):
    if is_ans:
        break
    for j in range(14):
        if 4*i+7*j==N:
            is_ans=1
            break
print("Yes" if is_ans else "No")

Fixed submission:
N, K=list(map(int,input().split()))
print(0 if N%K==0 else 1)
Buggy python submission (verdict: Runtime Error):
N=-int(input())
if N=0:
    print(0)
else:
    tmp=[]
    while N!=0:
        tmp.insert(0,N%(2))
        N=-N//2
    s=''.join([str(_) for _ in tmp])
    print(s)


Fixed submission:
N=-int(input())
if N==0:
    print(0)
else:
    tmp=[]
    while N!=0:
        tmp.insert(0,N%(2))
        N=-N//2
    s=''.join([str(_) for _ in tmp])
    print(s)
Buggy python submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

j=lcm(A[0],A[1])
for i in range(2,len(A)):
    j=lcm(j, A[i])

tmp=[]
for i in A:
    tmp.append((j-1)%i)
ans=sum(tmp)
print(ans)


Fixed submission:

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

j=lcm(A[0],A[1])
for i in range(2,len(A)):
    j=lcm(j, A[i])

tmp=[]
for i in A:
    tmp.append((j-1)%i)
ans=sum(tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
A = list(map(int,input().split()))

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

# ave1=sum(A)//len(A)
# ave2=-(-sum(A)//len(A))
# median=Counter(A).most_common(1)[0][0]
B=[]
C=[]
for k in range(min(A),max(A)+1):
    B.append(A[:])

    for i in range(0,N):
        B[k][i]-=k

        B[k][i]=abs(B[k][i])
    C.append(sum(B[k]))
print(min(C))


Fixed submission:
from collections import Counter
N=int(input())
A = list(map(int,input().split()))

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

# ave1=sum(A)//len(A)
# ave2=-(-sum(A)//len(A))
# median=Counter(A).most_common(1)[0][0]

B=A[:]
C=A[:]

B.sort()
# 偶数の場合
if N % 2 == 0:
    median1 = N/2
    median2 = N/2 + 1
    median1 = int(median1) - 1
    median2 = int(median2) - 1
    median = (B[median1] + B[median2]) / 2

    # 奇数の場合
else:
    median = (N + 1) / 2
    median = int(median) - 1
    median = B[median]

median=int(median)

for i in range(0,N):
    C[i]-=median
    C[i]=abs(C[i])

print(sum(C))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())


min_ct = 1000000000
for i in range(N):
    ct = 0
    j = 0
    k = N-1
    while k > i:
        if ct > min_ct: break
        if S[k] == "E":
            ct += 1
        k -= 1
    while j < i:
        if ct > min_ct: break
        if S[j] == "W":
            ct += 1
        j += 1

    if min_ct > ct:
        min_ct = ct

print(min_ct)


Fixed submission:
N = int(input())
S = list(input())

num_W = 0
num_E = 0
for i in range(1,N):
    if S[i] == "E":
        num_E += 1
min_ct = num_W + num_E

for i in range(1,N):
    if S[i-1] == "W":
        num_W += 1
    if S[i] == "E":
        num_E -= 1
    ct = num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct)

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


min_ct = 1000000000
for i in range(N):
    ct = 0
    j = 0
    k = N-1
    while j < i:
        if ct > min_ct: break
        if S[j] == "W":
            ct += 1
        j += 1
    while k > i:
        if ct > min_ct: break
        if S[k] == "E":
            ct += 1
        k -= 1
    if min_ct > ct:
        min_ct = ct

print(min_ct)


Fixed submission:
N = int(input())
S = list(input())

num_W = 0
num_E = 0
for i in range(1,N):
    if S[i] == "E":
        num_E += 1
min_ct = num_W + num_E

for i in range(1,N):
    if S[i-1] == "W":
        num_W += 1
    if S[i] == "E":
        num_E -= 1
    ct = num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct)

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


min_ct = 1000000000
for i in range(N):
    ct = 0
    j = 0
    k = N-1
    while j < i:
        if S[j] == "W":
            ct += 1
        j += 1
    while k > i:
        if S[k] == "E":
            ct += 1
        k -= 1
    if min_ct > ct:
        min_ct = ct


print(min_ct)


Fixed submission:
N = int(input())
S = list(input())

num_W = 0
num_E = 0
for i in range(1,N):
    if S[i] == "E":
        num_E += 1
min_ct = num_W + num_E

for i in range(1,N):
    if S[i-1] == "W":
        num_W += 1
    if S[i] == "E":
        num_E -= 1
    ct = num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct)

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


min_ct = 1000000000
for i in range(N):
    ct = 0
    num_W = S[0:i+1].count("W")
    num_E = S[i:N].count("E")
    ct += num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct-1)


Fixed submission:
N = int(input())
S = list(input())

num_W = 0
num_E = 0
for i in range(1,N):
    if S[i] == "E":
        num_E += 1
min_ct = num_W + num_E

for i in range(1,N):
    if S[i-1] == "W":
        num_W += 1
    if S[i] == "E":
        num_E -= 1
    ct = num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct)
Buggy python submission (verdict: Runtime Error):
s = list(input())
K = int(input())

l =[]

for i in range(len(s)):
    tmp = ''
    for j in range(i, len(s)):
        if j > i + 4: break
        tmp += s[j]
        l.append(tmp)
l.sort()

l2 = list(set(l))

ans = l2[K - 1]

print(ans)


Fixed submission:
a, b, c, d = map(int, input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or abs(a-c)<=d:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math


X = int(input())

p = 1
q = 1
tmp = 1

while p < math.sqrt(X):
    q = 1
    while 1:
        if p ** q > X:
            break
        else:
            if tmp < p ** q:
                tmp = p ** q
            q += 1
    p += 1

print(tmp)


Fixed submission:
import math


X = int(input())

p = 2
q = 2
tmp = 4

while p < math.sqrt(X):
    q = 2
    while 1:
        if p ** q > X:
            break
        else:
            if tmp < p ** q:
                tmp = p ** q
            q += 1
    p += 1
if X > 3:
    print(tmp)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())

if b >= a:
    print(a)
else:
    print(a)


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

if b >= a:
    print(a)
else:
    print(a-1)
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())

price = min(A*X+B*Y, C*2*max(X, Y))

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)


Fixed submission:
s = input()

ct = 0

for i in range(len(s)):
    if s[i] == 'o':
        ct += 1

print(700 + 100 * ct)
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())

price = min(A*X+B*Y, C*2*max(x, y))

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1):
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)


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

price = min(A*X+B*Y, C*2 * (max(X, Y)))

is_break = 0

for i in range(100000):
    if price >= A*max(0, X - i) + B*max(0, Y - i)+2*C*i:
        price = A*max(0, X - i) + B*max(0, Y - i)+2*C*i
print(price)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, X, Y = map(int, input().split())

price = 5000 * 100000 * 2

for a in range(X+1):
    for b in range(Y+1):
        for c in range(min([2*(X-a), 2*(Y-b)]), X + Y + 1):
            if X <= a + c // 2 and Y <= b + c // 2:
                if price > A*a+B*b+C*c:
                    price = A*a+B*b+C*c

print(price)


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

price = min(A*X+B*Y, C*2 * (max(X, Y)))

is_break = 0

for i in range(100000):
    if price >= A*max(0, X - i) + B*max(0, Y - i)+2*C*i:
        price = A*max(0, X - i) + B*max(0, Y - i)+2*C*i
print(price)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
X = list(map(int, input().split()))

for i in range(N):
    tmp = copy.deepcopy(X)
    tmp.pop(i)
    tmp.sort()
    print(tmp[(len(tmp)+1)//2-1])


Fixed submission:
import copy
N = int(input())
X = list(map(int, input().split()))
tmp = copy.deepcopy(X)
tmp.sort()

a = tmp[int(len(tmp)/2)-1]
b = tmp[int(len(tmp)/2)]

for i in X:
    print(b if i<(a+b)/2 else a)

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

for i in range(N):
    tmp = copy.deepcopy(X)
    tmp.pop(i)
    tmp.sort()
    if len(tmp)%2 == 0:
        print(tmp[len(tmp)//2-1])
    else:
        print(tmp[(len(tmp)+1)//2-1])


Fixed submission:
import copy
N = int(input())
X = list(map(int, input().split()))
tmp = copy.deepcopy(X)
tmp.sort()

a = tmp[int(len(tmp)/2)-1]
b = tmp[int(len(tmp)/2)]

for i in X:
    print(b if i<(a+b)/2 else a)
Buggy python submission (verdict: Runtime Error):
S=list(input())

chara=list("abcdefghijklmnopqrstuvwxyz")
chara_dic={}
for i in range(len(chara)):
	chara_dic[chara[i]]=i
chara_dic_2={}
for i in range(len(chara)):
	chara_dic_2[i]=chara[i]

count={}
for s in S:
	count[s]=count.get(s,0)+1

flag=0
if len(count)==len(chara):
	cur_chara=len(S)-1
	for pt in range(len(S)-2,0,-1):
		if chara_dic[S[cur_chara]]==chara_dic[S[pt]]-1:
			cur_chara-=1
		else:
			flag=1
			ans=''
			for i in range(0,pt):
				ans+=str(S[i])
			ans+=chara_dic_2[chara_dic[S[pt]]+1]
			break
else:
	flag=1
	ans=''
	for i in range(len(S)):
		ans+=S[i]
	for i in range(len(chara)):
		if chara[i] not in S:
			end=chara[i]
			break
	ans+=end

print(ans if flag else "-1")

Fixed submission:
S=list(input())

chara=list("abcdefghijklmnopqrstuvwxyz")
chara_dic={}
for i in range(len(chara)):
	chara_dic[chara[i]]=i
chara_dic_2={}
for i in range(len(chara)):
	chara_dic_2[i]=chara[i]

count={}
for s in S:
	count[s]=count.get(s,0)+1

flag=0
if len(count)==len(chara):
	cur_chara=len(S)-1
	for pt in range(len(S)-2,-1,-1):
		if chara_dic[S[cur_chara]]<chara_dic[S[pt]]:
			cur_chara-=1
		else:
			flag=1
			ans=''
			for i in range(0,pt):
				ans+=str(S[i])
			ls=[]
			for i in range(pt+1,len(S)):
				if chara_dic[S[pt]]<chara_dic[S[i]]:
						ls.append(chara_dic[S[i]])
			ans+=chara_dic_2[min(ls)]
			break
else:
	flag=1
	ans=''
	for i in range(len(S)):
		ans+=S[i]
	for i in range(len(chara)):
		if chara[i] not in S:
			end=chara[i]
			break
	ans+=end

print(ans if flag else "-1")
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=map(int, input().split())
print("Four" if "Y" in a else "Three")


Fixed submission:
N=int(input())
a=input().split()
print("Four" if "Y" in a else "Three")
Buggy python submission (verdict: Runtime Error):
3 4
269-6650

Fixed submission:
from collections import Counter
A,B=list(map(int, input().split()))
S=list(input())

print("Yes" if S[A]=='-' and Counter(S)['-']==1 else "No")
Buggy python submission (verdict: Runtime Error):
a = list(str(int(input)))
print(a.count("1"))


Fixed submission:
a = list(str(int(input())))
print(a.count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

A_set = list(set(A))
len_A_set = len(A_set)

# i = 0
# ct = 0
# while True:
#     if ct >= len_A_set - K:
#         break
#     min = 10000000
#     for i in A_set:
#         if A.count(i) < min:
#             min = A.count(i)
#     ct += min
# 
# print(ct)



A_count =[]
for i in range(len_A_set):
    A_count.append(A.count(A_set[i]))

ans=0
for i in range(len_A_set-K):
    ans += min(A_count)
    A_count.pop(A_count.index(min(A_count)))

print(ans)


Fixed submission:
from collections import Counter
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))

X=Counter(A)
X2 = sorted(X.items(), key=lambda x:x[1])
ans=0
for i in range(len(X2)-K):
    ans+=X2[i][1]
print(ans)

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

A_set = list(set(A))
len_A_set = len(A_set)

A_count =[]
for i in range(len_A_set):
    A_count.append(A.count(A_set[i]))

ans=0
for i in range(len_A_set-K):
    ans += min(A_count)
    A_count.pop(A_count.index(min(A_count)))

print(ans)


Fixed submission:
from collections import Counter
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))

X=Counter(A)
X2 = sorted(X.items(), key=lambda x:x[1])
ans=0
for i in range(len(X2)-K):
    ans+=X2[i][1]
print(ans)

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

A_set = list(set(A))

A_count =[]
for i in range(len(A_set)):
    A_count.append(A.count(A_set[i]))

A_count.sort()

ans=0
for i in range(len(A_set)-K):
    ans += A_count[i]

print(ans)


Fixed submission:
from collections import Counter
N, K=list(map(int, input().split()))
A=list(map(int, input().split()))

X=Counter(A)
X2 = sorted(X.items(), key=lambda x:x[1])
ans=0
for i in range(len(X2)-K):
    ans+=X2[i][1]
print(ans)