Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x, k, d = map(int, input().split())
x = abs(x)
s = x//d
elif s>k:
    print(x-d*k)
elif s<k:
    if (k-s)%2==0:
        print(x-d*s)
    elif (k-s)%2==1:
        print(abs(x-d*(s+1)))

Fixed submission:
x, k, d = map(int, input().split())
x = abs(x)
s = x//d
if s>k:
    print(x-d*k)
elif s<=k:
    if (k-s)%2==0:
        print(x-d*s)
    elif (k-s)%2==1:
        print(abs(x-d*(s+1)))

Buggy python submission (verdict: Runtime Error):
x, k, d = map(int, input().split())
minus=False
if x<0:
    minus = True
x = abs(x)
s = x//d
if s==0:
    k%2==0:
        if minus==True
            print(-x)
        else: print(x)
    k%2==1:
        if minus==True
            print(-x+d)
        else: print(x-d)
elif s>k:
    if minus==True
        print(x-d*k)
    else: print(-x+d*k)
elif s<k:
    (k-s)%2==0:
        if minus==True
            print(-x+d*s)
        else: print(x-d*s)
    (k-s)%2==1:
        if minus==True
            print(-x+d*(s+1))
        else: print(x-d*(s+1))

Fixed submission:
x, k, d = map(int, input().split())
x = abs(x)
s = x//d
if s>k:
    print(x-d*k)
elif s<=k:
    if (k-s)%2==0:
        print(x-d*s)
    elif (k-s)%2==1:
        print(abs(x-d*(s+1)))
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())

if n==0:
    print(x)
p = list(range(n))
p = list(map(int, input().split()))
p_2 = list(range(n))
for i in range(n):
    p_2[i] = x-p[i]

for i in range(100):
    h = p_2.count(i)
    h_2 = p_2.count(-i)
    if h==0 and h_2!=0:
        print(x-i)
        break
     elif h!=0 and h_2==0:
        print(x+i)
        break
    elif h==0 and h_2==0:
        print(x-i)
        break

Fixed submission:
x, n = map(int, input().split())
#if n==0:
#    print(x)
p = list(range(n))
p = list(map(int, input().split()))
p_2 = list(range(n))
for i in range(n):
    p_2[i] = x-p[i]
for i in range(100):
    h = p_2.count(i)
    h_2 = p_2.count(-i)
    if h==0 and h_2!=0:
        print(x-i)
        break
    elif h!=0 and h_2==0:
        print(x+i)
        break
    elif h==0 and h_2==0:
        print(x-i)
        break
#if n==0:
#    print(x)
Buggy python submission (verdict: Runtime Error):
s = input()
list_S = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in list_s:
  if list_s[i] == s:
    print(list_s[i+1])
   

Fixed submission:
s = input()
list_s = list(range(97, 97+26))
for i in range(26):
    if ord(s) == list_s[i]:
        print(chr(list_s[i+1]))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i)for i in input().split()]
A = [int(i) for i in input().split()]

S = []
cnt = 0
for i in range(K-1,N):
    s = 1
    for j in range(i,i-K,-1):
        s *= A[j]
    S.append(s)
    
    if cnt == 0:
        cnt += 1
        continue
    print("Yes" if S[cnt-1]<S[cnt] else "No")
    cnt += 1

Fixed submission:
N,K = [int(i)for i in input().split()]
A = [int(i) for i in input().split()]

for i in range(K,N):
    if A[i] / A[i-K] > 1 :
        print("Yes")

    else :
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i)for i in input().split()]
A = [int(i) for i in input().split()]

S = []
for i in range(K-1,N):
    s = 1
    for j in range(i,i-K,-1):
        s *= A[j]
    S.append(s)

for i in range(1,len(S)):
    print("Yes" if S[i-1]<S[i] else "No")

Fixed submission:
N,K = [int(i)for i in input().split()]
A = [int(i) for i in input().split()]

for i in range(K,N):
    if A[i] / A[i-K] > 1 :
        print("Yes")

    else :
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = [int(i) for i in input().split() ]



for ai in A:
  if ai == 0 :
    print('0')
    exit()
	    
ans = A[0]
border = 18 ** 10
      
for i in range(1,N):
  
  ansCp = ans
  ansCnt = 1
  while ansCp >= 10:
    ansCp /= 10
    ansCnt += 1
    
  if ansCnt == 18 and ansCp > 0:
    print("-1")
    exit()
    
  ans *= A[i]
  
      
print(str(ans))

Fixed submission:
N = int(input())

A = [int(i) for i in input().split() ]



for ai in A:
  if ai == 0 :
    print('0')
    exit()
	    
ans = A[0]      
for i in range(1,N):
  
  ans *= A[i]
  
  ansCp = ans
  ansCnt = 1
  while ansCp >= 10:
    ansCp /= 10
    ansCnt += 1
    
  if (ansCnt > 19) or ( ansCnt == 19 and ans%10 > 0 ) :
    print("-1")
    exit()
  
  
      
print(str(ans))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

if A >= K:
  A = A - K
  print(A, B)

elif A + B >= K:
  B = A + B - K
  print(0, B)
    
else:
  print(0,0)

Fixed submission:
S, T = input().split()
print(T + S)
Buggy python submission (verdict: Runtime Error):
n = int(input()
s, t = list(input().split()
ans = []
for i in range(n):
  ans += s[i]
  ans += t[i]

print(ans)

Fixed submission:
n = int(input())
s, t = list(input().split())
ans = ""
for i in range(n):
  ans += s[i]
  ans += t[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
hash = [0 for i in range(n)]
a = [int(i) for i in input().split()]
for i in a:
	hash[i-1] += 1
for i in hash:
	print(i

Fixed submission:
n = int(input())
hash = [0 for i in range(n)]
a = [int(i) for i in input().split()]
for i in a:
	hash[i-1] += 1
for i in hash:
	print(i)

Buggy python submission (verdict: Runtime Error):
n = int(input())
hash = [0 for i in range(n))
a = [int(i) for i in input().split()]
for i in a:
	hash[i-1] += 1
for i in hash:
	print(i)

Fixed submission:
n = int(input())
hash = [0 for i in range(n)]
a = [int(i) for i in input().split()]
for i in a:
	hash[i-1] += 1
for i in hash:
	print(i)
Buggy python submission (verdict: Runtime Error):
n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0
for i in a:
	if(i * 4 * n[1] >= n[0]):
		count += 1
if(count >= n[1]):
	print('Yes')
else:
	print('No')

Fixed submission:
a = [int(i) for i in input().split()]
print(a[2],a[0],a[1],sep=' ')
Buggy python submission (verdict: Runtime Error):
n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0
for i in a:
	if(i * 4 * n[1] >= n[0]):
    	count += 1
if(count >= n[1]):
	print('Yes')
else:
	print('No')

Fixed submission:
n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
tot = sum(a)
count = 0
for i in a:
	if((i * 4 * n[1]) >= tot):
		count += 1
if(count >= n[1]):
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
a = [i in input().split()]
nums = [int(i) in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1])

Fixed submission:
a = [i for i in input().split()]
nums = [int(i) for i in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [float(i) for i in input().split()]
dp = [[0 for i in range(len(p)+1)] for j in range(n)]
dp[0][0] = 1 - p[0]
dp[0][1] = p[0]
for i in range(1,n):
	for j in range(len(p)+1):
		dp[i][j] += (1-p[i])*dp[i-1][j]
		dp[i][j] += p[i]*dp[i-1][j-1]
sum1 = 0
for i in dp[n-1][n//2+1:]:
	sum1+=i
print(sum1)

Fixed submission:
n = int(input())
p = [float(i) for i in input().split()]
dp = [[0 for i in range(len(p)+1)] for j in range(n)]
dp[0][0] = 1 - p[0]
dp[0][1] = p[0]
for i in range(1,n):
	for j in range(len(p)+1):
		dp[i][j] += (1-p[i])*dp[i-1][j]
		dp[i][j] += p[i]*dp[i-1][j-1]
sum1 = 0
for i in dp[n-1][n//2+1:]:
	sum1+=i
print(sum1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=map(int,input().split())
ans=0
maxt=0
for i in l:
  if i<maxt:
    ans+=maxt-i
  maxt=max(i,maxt)
print(ans)


Fixed submission:
N,X,T=map(int,input().split())
if N%X==0:
  s=N//X
  print(s*T)
else:
  s=N//X+1
  print(s*T)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans=0
maxt=0
for i in l:
  if i<maxt:
    ans+=maxt-1
    maxt=max(i,maxt)
print(ans)


Fixed submission:
N,X,T=map(int,input().split())
if N%X==0:
  s=N//X
  print(s*T)
else:
  s=N//X+1
  print(s*T)
Buggy python submission (verdict: Runtime Error):
n=int(nput())
if n%9==0:
  print("Yes")
else:
  print("No")

Fixed submission:
N=input()
l = [int(x) for x in list(N)]
s=sum(l)
if s%9==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input(),split()))

ans=0
cur_max=0

for x in a:
  if cur_max>x:
    ans+=cur_max-x
  cur_max=max(cur_max,x)

print(ans)


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

ans=0
cur_max=0

for x in a:
  if cur_max>x:
    ans+=cur_max-x
  cur_max=max(cur_max,x)

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input(),split())

ans=0
cur_max=0

for x in a:
  if cur_max>x:
    ans+=cur_max-x
  cur_max=max(cur_max,x)

print(ans)

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

ans=0
cur_max=0

for x in a:
  if cur_max>x:
    ans+=cur_max-x
  cur_max=max(cur_max,x)

print(ans)
Buggy python submission (verdict: Runtime Error):
l=input()
if l="RRR":
  print(3)
elif l="RRS" or "SRR":
  print(2)
elif l="SSS":
  print(0)
else:
  print(1)
    


Fixed submission:
l=input()
for i in range(4):
  if "R"*i in l:
    ans=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l=input()
if l="RRR":
  print(3)
elif l="RRS" or "SRR":
  print(2)
elif l="SSS":
  print(0)
else:
  print(1)
    

Fixed submission:
l=input()
for i in range(4):
  if "R"*i in l:
    ans=i
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = 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)

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):
X=int(input())
if 30<=X<=40:
   print("Yes")
elif:-40<=X<30
   print("No")


Fixed submission:
X=int(input(""))
if 30<=X:
   print("Yes")
else:
   print("No")

Buggy python submission (verdict: Runtime Error):
X=int(input("X:"))
if 30<=X<=40:
	print("Yes")
elif:-40<=X<30
	print("No")


Fixed submission:
X=int(input(""))
if 30<=X:
   print("Yes")
else:
   print("No")

Buggy python submission (verdict: Runtime Error):
X=int(input("X="))
if 30<=X<=40:
    print("Yes")
elif:-40<=X<30
    print("No")


Fixed submission:
X=int(input(""))
if 30<=X:
   print("Yes")
else:
   print("No")

Buggy python submission (verdict: Runtime Error):
X=int(input("X="))
if 30<=X<=40:
   print("Yes")
elif:-40<=X<30
   print("No")

Fixed submission:
X=int(input(""))
if 30<=X:
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):
D=int(input())
if D=25:
  print("Christmas")
elif D=24:
  print("Christmas Eve")
elif D=23:
  print("Christmas Eve Eve")
elif D=22:
  print("Christmas Eve Eve Eve")


Fixed submission:
D=int(input())
if D==25:
  print("Christmas")
elif D==24:
  print("Christmas Eve")
elif D==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
D=int(input())
if D=25:
  print("Christmas")
elif D=24:
  print("Christmas Eve")
elif D=23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Fixed submission:
D=int(input())
if D==25:
  print("Christmas")
elif D==24:
  print("Christmas Eve")
elif D==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(index(min(a))+1)

Fixed submission:
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(a.index(min(a))+1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(index(max(a))+1)

Fixed submission:
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(a.index(min(a))+1)
Buggy python submission (verdict: Runtime Error):
n=int(input())

for i in range(26):
  for j in range(15):
    if 4*i+7*j=n:
      print("Yes")
    else:
      print("No")

Fixed submission:
n=int(input())

s="No"
for i in range(26):
  for j in range(15):
    if 4*i+7*j==n:
      s="Yes"
print(s)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

c=0
for i in range(a,b+1):
  s=list(map(str,i))
  if s=reversed(s):
    c+=1
print(c)

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

c=0
for i in range(a,b+1):
  s=str(i)
  if s==s[::-1]:
    c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*a+100*b+50*c=x:
        count+=1
print(count)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
s=list(input())
s[3]=8
for in in s:
  print(s,end="")


Fixed submission:
s=input()
print("2018"+s[4:])

Buggy python submission (verdict: Runtime Error):
s=list(input())
s[3]=8
print("".join(s))

Fixed submission:
s=input()
print("2018"+s[4:])
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[int(input()) for _ in range(n)]
c = collections.Counter(d)
print(len(c))

Fixed submission:
n=int(input())
d=[int(input()) for _ in range(n)]
print(len(set(d)))
Buggy python submission (verdict: Runtime Error):
s=list(input())
t=list(input())
s1=s.sort()
t1=t.sort()
if s1<t1:
  print("Yes")
else:
  print("No")
  

Fixed submission:
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if s<t:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s=input()
if s="111":
  print(3)
elif s="110" or "101" or "011":
  print(2)
elif s="100" or "010" or "001":
  print(1)
else s="000":
  print(0)


Fixed submission:
s=input()
print(s.count("1"))

Buggy python submission (verdict: Runtime Error):
s=input()
if s="111":
  print(3)
elif s="110" or "101" or "011":
  print(2)
elif s="100" or "010" or "001":
  print(1)
else:
  print(0)

Fixed submission:
s=input()
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(it,input().split()))
count=-0
while all(i%2==0 for i in s):
  s=[i/2 for i in s]
  count+=1
print(count)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
count=-0
while all(i%2==0 for i in s):
  s=[i/2 for i in s]
  count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
s=list(input())
s1=[]
for i in s:
  if (s.index(i)+1)%2!=0:
    s1.append(i)
print(i for i in s1,end="")


Fixed submission:
n=input()
print(n[::2])
Buggy python submission (verdict: Runtime Error):
s=input()
print(s[0]+(len(s)-2)+s[len(s)-1])


Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[len(s)-1])

Buggy python submission (verdict: Runtime Error):
s=input()
print(s[0]+(len(s)-2)+s[len(s)])

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[len(s)-1])
Buggy python submission (verdict: Runtime Error):
r,g,b=input().split()
n=int("r+g+b")
if n%4==0:
  print("Yes")
else:
  print("No")


Fixed submission:
r,g,b=input().split()
n=int(r+g+b)
if n%4==0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

count=0
for i in range(k+1):
  for j in range(k+1):
    for k in range(k+1):
      if i+j+k==s:
        count+=1
print(count)


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

count=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      count+=1
      
print(count)

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

count=0
for i in range(k+1):
  for j in range(k+1):
    for k in range(k+1):
      if i+j+k==s:
        count+=1
print(count)


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

count=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      count+=1
      
print(count)

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

count=0
for i in range(k+1):
  for j in range(k+1):
    for k in range(k+1):
      if i+j+k==s:
        count+=1
print(count)

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

count=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      count+=1
      
print(count)
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[int(input()) for _ in range(n)]
s.sort()

for i in s:
  print(i,end="")


Fixed submission:
n,l=map(int,input().split())
s=[input() for _ in range(n)]
s.sort()

for i in s:
  print(i,end="")

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[int(input()) for _ in range(n)]
s.sort()

print(i for i in s,end="")

Fixed submission:
n,l=map(int,input().split())
s=[input() for _ in range(n)]
s.sort()

for i in s:
  print(i,end="")
Buggy python submission (verdict: Runtime Error):
from sys import stdin

r = stdin.readline().rstrip()

print(r ** 2)


Fixed submission:
from sys import stdin
 
r = int(stdin.readline().rstrip())
 
print(r ** 2)
Buggy python submission (verdict: Runtime Error):
a, *b, c = input()
print(f'{a}{len(b)}{c}')

Fixed submission:
a,*b,c=input()
print(a+str(len(b))+c)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.buffer.readline

n, k = map(int, input().split())
*a, = map(int, input().split())
p = 1
for i in range(k):
	p *= a[i]
for i in range(k, n):
	q = p * a[i] // a[i - k]
	if q > p:
		print('Yes')
	else:
		print('No')
	p = q


Fixed submission:
from sys import stdin
input = stdin.buffer.readline

n, k = map(int, input().split())
*a, = map(int, input().split())
for i in range(k, n):
	if a[i] > a[i - k]:
		print('Yes')
	else:
		print('No')
Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
dp = [[-1] * 1000001 for i in range(n + 1)]
dp[0][0] = 1000
for i in range(n):
	for j in range(1000001):
		if dp[i][j] >= 0:
			dp[i + 1][j + dp[i][j] // a[i]] = max(dp[i + 1][j + dp[i][j] // a[i]], dp[i][j] % a[i])
			dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a[i] * j)
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][0])


Fixed submission:
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
b = 1000
for i in range(n - 1):
	if a[i] < a[i + 1]:
		b = b // a[i] * a[i + 1] + b % a[i]
print(b)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
dp = [[-1] * 100001 for i in range(n + 1)]
dp[0][0] = 1000
for i in range(n):
	for j in range(100001):
		if dp[i][j] >= 0:
			dp[i + 1][j + dp[i][j] // a[i]] = max(dp[i + 1][j + dp[i][j] // a[i]], dp[i][j] % a[i])
			dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a[i] * j)
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][0])


Fixed submission:
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
b = 1000
for i in range(n - 1):
	if a[i] < a[i + 1]:
		b = b // a[i] * a[i + 1] + b % a[i]
print(b)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
dp = [[-1] * 1001 for i in range(n + 1)]
dp[0][0] = 1000
for i in range(n):
	for j in range(1001):
		if dp[i][j] >= 0:
			if dp[i][j]:
				dp[i + 1][j + dp[i][j] // a[i]] = max(dp[i + 1][j + dp[i][j] // a[i]], dp[i][j] % a[i])
			dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a[i] * j)
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][0])


Fixed submission:
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
b = 1000
for i in range(n - 1):
	if a[i] < a[i + 1]:
		b = b // a[i] * a[i + 1] + b % a[i]
print(b)
Buggy python submission (verdict: Runtime Error):
x, n = [int(x) for x in input().split()]
ps = [int(x) for x in input().split()]

best = 100000000
ret = x

if n:
	mn = min(ps)
	mx = max(ps)
	s = set(ps)
	for i in range(mn, mx+1):
		if i not in s:
			d = abs(x-i)
			if d < best:
				best = d
				ret = i
	if ret == x:
		up = abs(mx + 1 - x)
		down = abs(mn - 1 - x)
		ret = mn-1 if down <= up else mx+1
		
if x not in s:
	ret = x

print(ret)

Fixed submission:
x, n = [int(x) for x in input().split()]
ps = [int(x) for x in input().split()]

best = 100000000
ret = x

if n:
	mn = min(ps)
	mx = max(ps)
	s = set(ps)
	for i in range(mn, mx+1):
		if i not in s:
			d = abs(x-i)
			if d < best:
				best = d
				ret = i
	if ret == x:
		up = abs(mx + 1 - x)
		down = abs(mn - 1 - x)
		ret = mn-1 if down <= up else mx+1
	if x not in s:
		ret = x

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

a = [int(x) for x in input().split()]

ans = 0

for i in range(n):
	good = True
	for j in range(n):
		if j != i:
			if a[i] % a[j] == 0:
				good = False
				break
	if good:
		ans += 1

print(ans)

Fixed submission:
n = int(input())

a = [int(x) for x in input().split()]

mx = max(a)

mark = [0 for _ in range(mx+1)]

for i in range(n):
	for x in range(a[i], mx+1, a[i]):
		mark[x] += 1

ans = 0

for i in range(n):
	if mark[a[i]] == 1:
		ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
s = readline()
  
ans = "x" * len(s)

print(ans)

Fixed submission:
s = input()
  
ans = "x" * len(s)

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]

as = str(a) * b
bs = str(b) * a

print(as if as < b else bs)

Fixed submission:
a, b = [int(x) for x in input().split()]

As = str(a) * b
Bs = str(b) * a

print(min(As, Bs))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

if n % 2 != 0:
  print("No")
else:
  half = n // 2
  found = False
  for i in range(0, half + 1):
    if s[i] != s[half + i]:
      found = True
      break
  print("No" if found else "Yes")
  


Fixed submission:
n = int(input())
s = input()

if n % 2 != 0:
  print("No")
else:
  half = n // 2
  found = False
  for i in range(0, half):
    if s[i] != s[half + i]:
      found = True
      break
  print("No" if found else "Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted([int(x) for x in input().split()])

ret = 0

for i in range(len(l)):
	a = l[i]
	for j in range(i + 1, len(l)):
		b = l[j]
		for k in range(j+1, len(l)):
			c = l[k]
			if c >= a+b:
				break
			if a<b+c and b<a+c and c<a+b:
				ret += 1

print(ret)

Fixed submission:
n = int(input())
a = sorted([int(x) for x in input().split()])
ret = 0
for i in range(n-1, 0, -1):
	l = 0
	r = i-1
	while l<r:
		if a[l]+a[r]>a[i]:
			ret += r - l
			r -= 1
		else:
			l += 1

print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(x) for x in input().split()]

ret = 0

for i in range(len(l)):
	a = l[i]
	for j in range(i + 1, len(l)):
		b = l[j]
		for k in range(j+1, len(l)):
			c = l[k]
			if a<b+c and b<a+c and c<a+b:
				ret += 1

print(ret)

Fixed submission:
n = int(input())
a = sorted([int(x) for x in input().split()])
ret = 0
for i in range(n-1, 0, -1):
	l = 0
	r = i-1
	while l<r:
		if a[l]+a[r]>a[i]:
			ret += r - l
			r -= 1
		else:
			l += 1

print(ret)
Buggy python submission (verdict: Runtime Error):
S = list(input())

cnt = 0

for i in range(len(S)):
  if S[i] == 'R':
	  if cnt == 0:
    	cnt += 1
  	  elif S[i - 1] == 'R':
      	cnt += 1

print(cnt)

Fixed submission:
S = list(input())

cnt = 0

for i in range(len(S)):
  if S[i] == 'R':
    if cnt == 0:
      cnt += 1
    elif S[i - 1] == 'R':
      cnt += 1

print(cnt)