Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

N,D = map(int, sys.stdin.readline().rstrip().split())
ds = map(int, sys.stdin.readline().rstrip().split())
Q, = map(int, sys.stdin.readline().rstrip().split())
qs = map(int, sys.stdin.readline().rstrip().split())
qs.sort()


targets = [1]
for d in reversed(ds):
    if(d//2 < targets[-1]):
        targets.append(targets[-1] + d)
    else:
        targets.append(targets[-1])
targets.reverse()

current = D
can_avoids = []
for i in range(N):
    d = ds[i]
    target = targets[i+1]
    #print("current:", current)
    can_avoids.append(current >= target)
    if d//2 < current:
        current -= d
        current = max(-current, current)

#print(targets)
#print(can_avoids)

for q in qs:
    if (can_avoids[q-1]):
        print("YES")
    else:
        print("NO")


exit(0)


Fixed submission:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

N,D = map(int, sys.stdin.readline().rstrip().split())
ds = list(map(int, sys.stdin.readline().rstrip().split()))
Q, = map(int, sys.stdin.readline().rstrip().split())
qs = list(map(int, sys.stdin.readline().rstrip().split()))


targets = [1]
for d in reversed(ds):
    if(d//2 < targets[-1]):
        targets.append(targets[-1] + d)
    else:
        targets.append(targets[-1])
targets.reverse()

current = D
can_avoids = []
for i in range(N):
    d = ds[i]
    target = targets[i+1]
    #print("current:", current)
    can_avoids.append(current >= target)
    if d//2 < current:
        current -= d
        current = max(-current, current)

#print(targets)
#print(can_avoids)

for q in qs:
    if (can_avoids[q-1]):
        print("YES")
    else:
        print("NO")


exit(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

List_S = list(S)
Ans = 1

for i in range(N-1):
    if List_S[i] != List_S[i+1]:
        Ans += 1
    
print(Ans)


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

C = int(A) - int(B) * 2

if C < 1:
    print(0)
elif C > 100:
    print(100)
else:
    print(C)

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

print("A = ")
A = input()

print("B = ")
B = input()

C = int(A) - int(B) * 2

if C < 0:
    print(0)
elif C > 100:
    print(100)
else:
    print(C)

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

C = int(A) - int(B) * 2

if C < 1:
    print(0)
elif C > 100:
    print(100)
else:
    print(C)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort()
for i in range(n):
    if h(i) < k:
        break
print(i)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))

c = 0

for i in range(n):
    if h[i] >= k:
        c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(min(n*a,b)

Fixed submission:
n,a,b = map(int,input().split())
print(min(n*a,b))
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
c = [4*10**18]
for i in range(l,r):
    for j in range(i+1,r+1):
        c.append((i*j)%2019)
print(min(c))

Fixed submission:
l,r = map(int,input().split())
r = min(r,l+2019)
c = [4*10**18]
for i in range(l,r):
    for j in range(i+1,r+1):
        c.append((i*j)%2019)
print(min(c))

Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
c = 4*10**18
for i in range(l,r):
    for j in range(i+1,r+1):
        d = (i*j)%2019
        if d < c:
            c = d
print(c)

Fixed submission:
l,r = map(int,input().split())
r = min(r,l+2019)
c = [4*10**18]
for i in range(l,r):
    for j in range(i+1,r+1):
        c.append((i*j)%2019)
print(min(c))
Buggy python submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i in range(10):
  x=r*d-x
    print(x)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
    x=r*x-d
    print(x)
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: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[0]
G = A[1]
B = A[2]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Fixed submission:
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[2]
G = A[1]
B = A[0]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print((N+1)*(N+2)//2)
    exit()

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())

rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Fixed submission:
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[2]
G = A[1]
B = A[0]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print((N+1)*(N+2)//2)
    exit()

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
4
RRBR

Fixed submission:
n = int(input())
s = input()
a = s.count('R')
if a > n-a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s=input()
print(2*min(s.count(0),s.count(1)))

Fixed submission:
s=input()
print(2*min(s.count('0'),s.count('1')))
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = 0
for i in range(n):
    a,b = map(input().split())
    if b == 'JPY':
        c += a
    else:
        c +=380000*a
print(c)


Fixed submission:
n = int(input())
c = 0
for i in range(n):
    a,b = input().split()
    if b == 'JPY':
        c += int(a)
    else:
        c +=380000*float(a)
print(c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = 0
for i in range(n):
    a,b = map(int,input().split())
    if b == 'JPY':
        c += a
    else:
        c +=380000*a
print(c)

Fixed submission:
n = int(input())
c = 0
for i in range(n):
    a,b = input().split()
    if b == 'JPY':
        c += int(a)
    else:
        c +=380000*float(a)
print(c)
Buggy python submission (verdict: Runtime Error):
K,A,B=map(int,input().split())
K1=K-(A+1)
n=K1//2
print(max(K+1,((n+1)*B-n*A+K1%2)))
#
K,A,B=map(int,input().split())
print(A+((K-A+1)//2)*(B-A)+(K-A+1)%2) if(B-A>2 and K-A>0) else print(K+1)
#
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    print(a-1 + (b-a)*(k-a+1)//2 + (k-a+1)%2)

Fixed submission:
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    print(a + (b-a)*((k-a+1)//2) + (k-a+1)%2)

Buggy python submission (verdict: Time Limit Exceeded):
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    c = 0
    k = k+1
    while k>0 :
        if c>=a and k>=2:
            c += b-a
            k -= 2
        else:
            if k < a:
                c += k
                k -= k
            else:
                c += a
                k -= a
    print(c)

Fixed submission:
k,a,b = map(int,input().split())
if a+2 > b:
    print(k+1)
else:
    print(a + (b-a)*((k-a+1)//2) + (k-a+1)%2)
Buggy python submission (verdict: Runtime Error):
def f(n):
    if n%2==0:
        n//2
    else:
        3*n+1
s=int(input())
a=list()
i=1
while 1:
    if f(s) in a:
        break
    a.append(f(s))
    s=f(s)
    i+=1
print(i)

Fixed submission:
def f(n):
    if n%2==0:
        return n//2
    else:
        return 3*n+1
s=int(input())
a=list()
i=1
while 1:
    if s in a:
        break
    a.append(s)
    s=f(s)
    i+=1
print(i)
Buggy python submission (verdict: Runtime Error):
a = 'keyence'
s = input()
S = len(s)
c = 0
i = 0
while i < S:
    if s[i] == a[c]:
        c += 1
    i += 1
if c == 7:
    print('YES')
else:
    print('NO')

Fixed submission:
a = 'keyence'
s = input()
S = len(s)
if s[:7] == 'keyence':
    print('YES')
elif s[:6] == 'keyenc' and s[-1] == 'e':
    print('YES')
elif s[:5] == 'keyen' and s[-2:] == 'ce':
    print('YES')
elif s[:4] == 'keye' and s[-3:] == 'nce':
    print('YES')
elif s[:3] == 'key' and s[-4:] == 'ence':
    print('YES')
elif s[:2] == 'ke' and s[-5:] == 'yence':
    print('YES')
elif s[0] == 'k' and s[-6:] == 'eyence':
    print('YES')
elif s[-7:] == 'keyence':
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())

if n ==1:
    print('Hello World')
else:
    print(a + b)

Fixed submission:
n = int(input())
if n ==1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a + b)
Buggy python submission (verdict: Runtime Error):
from sympy import divisors

n,m = map(int,input().split())
l = m//n
a = list(divisors(m,generator=True))
c = 0

for i in range(len(a)):
    if a[i] > c and a[i] <= l:
        c = a[i]

print(c)

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

def x():
    for i in range(l+1)[::-1]:
        if m % i == 0:
            return i
print(x())

Buggy python submission (verdict: Runtime Error):
from sympy import divisors
n,m = map(int,input().split())
l = m//n
a = list(divisors(m,generator=True))
c = 0

for i in range(len(a)):
    if a[i] > c and a[i] <= l:
        c = a[i]

print(c)

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

def x():
    for i in range(l+1)[::-1]:
        if m % i == 0:
            return i
print(x())

Buggy python submission (verdict: Runtime Error):
import sympy
n,m = map(int,input().split())
l = m//n
a = list(sympy.divisors(m,generator=True))
c = 0
for i in range(1,len(a)):
    if a[i] > c and a[i] <= l:
        c = a[i]

print(c)

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

def x():
    for i in range(l+1)[::-1]:
        if m % i == 0:
            return i
print(x())
Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(3):
    if s[i] == '1':
        s[i] = '9'
    elif s[i] == '9':
        s[i] = '1'
print(s)

Fixed submission:
n = int(input())
if n ==111:
    print(999)
elif n ==119:
    print(991)
elif n == 191:
    print(919)
elif n == 199:
    print(911)
elif n== 911:
    print(199)
elif n == 919:
    print(191)
elif n== 991:
    print(119)
else:
    print(111)
Buggy python submission (verdict: Runtime Error):
from collections import Counter as C
print(["No", "Yes"][C(C(input()).values()) == C(C(input()).values())])
#I understood

import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s)))
T = sorted(list(collections.Counter(t)))

if S == T:
    print('Yes')
else:
    print('No')

Fixed submission:
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if S == T:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s = list(input().split())
t = list(input().split())

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

S =collections.Counter(s)
T =collections.Counter(t)

S1 = S.values()
T1 = S.values()

if x == y and sorted(S1) == sorted(T1):
    print('Yes')
else:
    print('No')

Fixed submission:
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if S == T:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
a = list(map(int,input().split()))
a.sort()

b = []
for i in range(N):
    b.append(i)
c = 0
d = []
for i in range(N):
    d.append(i)
for i in range(N):
    b[i] = d
    for j in range(N):
        d[j] += a[j]
for i in range(N):
    if b[i] <= X:
        c += 1
print(c)

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

b = []
for _ in range(N):
    b.append(0)
    
c = 0

for i in range(N):
    for j in range(i+1):
        b[i] += a[j]

for k in range(N-1):
    if b[k] <= X:
        c += 1
if b[N-1] == X:
    c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
N,i =map(int(),input().split())
print(N-i+1)

Fixed submission:
N,i = map(int,input().split())
print(N-i+1)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print((A-1) * (B-1))

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

print((A-1) * (B-1))

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

print((A-1) * (B-1))

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

print((A-1) * (B-1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt = 0

for i in range(1,N+1):
    if i % 2 == 0:continue
    c = 0
    for j in range(1,N+1):
        if c > 8:
            cnt -= 1:continue
        if i % j == 0:
            c += 1
    if c ==8:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)

Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt = 0

for i in range(1,N+1)
    if i % 2 == 0:continue
    c = 0
    for j in range(1,N+1):
        if c > 8:
            cnt -= 1:continue
        if i % j == 0:
            c += 1
    if c ==8:
        cnt += 1
print(cnt)


Fixed submission:
N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)

Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt = 0

for i in range(1,N+1)
    if i % 2 == 0:continue
    c = 0
    for j in range(1,N+1):
        if cnt > 8:
            cnt -= 1:continue
        if i % j == 0:
            c += 1
    if c ==8:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)

Buggy python submission (verdict: Runtime Error):
if N < 105:
    print(0)
elif N < 165:
    print(1)
elif N < 195:
    print(2)
else:
    print(3)

Fixed submission:
N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)

Buggy python submission (verdict: Runtime Error):
if N < 105:
    print(0)
elif N < 165:
    print(1)
else N < 195:
    print(2)
else:
    print(3)

Fixed submission:
N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
n=0
for i in s:
    if int(i)==1:
        n+=1
    else:
        break
if n < k:
    pritn(s[n])
else:
    print(1)

Fixed submission:
s=input()
k=int(input())
n=0
for i in s:
    if int(i)==1:
        n+=1
    else:
        break
if n < k:
    print(s[n])
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())

A = S.count('1')

for i in range(0,A):
    S.remove('1')

print(S[0])

Fixed submission:
s=input()
k=int(input())
n=0
for i in s:
    if int(i)==1:
        n+=1
    else:
        break
if n < k:
    print(s[n])
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input())
if N % K = 0:
    print(0)
else:
    print(1)

Fixed submission:
N,K = map(int,input().split())
if N % K == 0:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=''
while a:
 b=str(a&1)+b
 a=-(a<<1)
print(b if b else 0)


Fixed submission:
a=int(input())
b=''
while a:
 b=str(a&1)+b
 a=-(a>>1)
print(b if b else 0)
Buggy python submission (verdict: Runtime Error):
S = input()
S1 = list(S)
i = 0

if ((S1[1] == 'C') or (S1[-1] == 'C')):
    print('WA')
elif ((S1[0] == 'A') and (S1[2:-1].count('C') == 1)):
    S1.remove('A')
    S1.remove('C')
    while i <= len(S1):
        if S1[i].isupper():
            print('WA')
            i += 1
        break
    else:
        print('AC')

Fixed submission:
R = int(input())

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')
Buggy python submission (verdict: Runtime Error):
a = sorted(list(map(int,input().split())))

print(a[2]-[0])

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

print(a[2]-a[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
x = min(3000,reduce(gcd,_ for _ in a))
m = [0]*x

for i in range(x):
    for j in a:
        m[i] += m%j

print(max(m))

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

print(sum(a)-n)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
x = min(3000,gcd(_ for _ in a))
m = [0]*x

for i in range(x):
    for j in a:
        m[i] += m%j

print(max(m))

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

print(sum(a)-n)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
x = min(3000,gcd(a[i] for i in range(n)))
m = [0]*x

for i in range(x):
    for j in a:
        m[i] += m%j

print(max(m))


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

print(sum(a)-n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

c = 0
i = 0
ans = 0
while i < n:
    if a[i] == a[i+1]:
        c += 1
        i += 1
    else:
        ans += c//2
        c = 0
        i += 1
print((ans+c//2,ans)[c==0])

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

c = 0
i = 0
ans = 0
while i < n-1:
    if a[i] == a[i+1]:
        c += 1
        i += 1
    else:
        ans += (c+1)//2
        c = 0
        i += 1
print((ans+(c+1)//2,ans)[c==0])
Buggy python submission (verdict: Runtime Error):
a = input()
if int(a) % sum(map(int,a)):
    print('No')
else:
    print('Yes')
print('No' if int(a) % sum(map(int,a)) else 'Yes')

Fixed submission:
S = input()
print(S.count('+') - S.count('-'))

Buggy python submission (verdict: Runtime Error):
a = input()
print('No' if int(a) % sum(map(int,a)) else 'Yes')

Fixed submission:
S = input()
print(S.count('+') - S.count('-'))
Buggy python submission (verdict: Runtime Error):
D,N = map(int,input().split())

if D == 0:
    pritn(N)
elif D == 1:
    print(N * 100)
else:
    print(N * 10000)

Fixed submission:
d, n = map(int, input().split())
print((n + n // 100) * 100 ** d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

if n%2 == 0:
    s1 = set(s[:n//2:])
    s2 = set(s[n//2::])
    print(len(s1&s2))
else:
    s1 = set(s[:n//2:])
    s2 = set(s[n//2::])
    s3 = set(s[:(n//2)+1:])
    s4 = set(s[(n//2)+1::])
    print(max(len(s1&s2),len(s3,s4)))


Fixed submission:
n = int(input())
s = list(input())
l = [0]*n
for i in range(n):
    s1 = set(s[:i:])
    s2 = set(s[i::])
    l[i] = len(s1&s2)
print(max(l))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

if n%2 == 0:
    s1 = set(s[:n//2])
    s2 = set(s[n//2:])
    print(len(s1&s2))
else:
    s1 = set(s[:n//2])
    s2 = set(s[n//2:])
    s3 = set(s[:(n//2)+1])
    s4 = set(s[(n//2)+1:])
  print(max(len(s1&s2),len(s3,s4)))

Fixed submission:
n = int(input())
s = list(input())
l = [0]*n
for i in range(n):
    s1 = set(s[:i:])
    s2 = set(s[i::])
    l[i] = len(s1&s2)
print(max(l))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
c=[]
cnt=1
for i in range(n-1):
    if s[i] = s[i+1]:
        cnt += 1
    else:
        c.append(cnt)
        cnt=1
if s[n-2]==s[n-1]:
    c.append(cnt)
else:
    c.append(1)
print(min(c))


Fixed submission:
n=int(input())
s=input()
c=s[1:].count('E')
a=c
for i in range(1,n):
    if s[i-1]=='W':
        c+=1
    if s[i]=='E':
        c-=1
    a=min(a,c)
print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
c=[]
cnt=1
for i in range(n-1):
    if s[i] = s[i+1]:
        cnt += 1
    else:
        c+=cnt
        cnt=1
if s[n-2]==s[n-1]:
    c+=cnt
else:
    c+=1
print(min(c))

Fixed submission:
n=int(input())
s=input()
c=s[1:].count('E')
a=c
for i in range(1,n):
    if s[i-1]=='W':
        c+=1
    if s[i]=='E':
        c-=1
    a=min(a,c)
print(a)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
l,m = 0,1
for i in renge(k-1):
    l,m = 2*m,l+m
ans = (l-m)*a + (m-l)*b
if ans > 10**18:
    print('Unfair')
else:
  print(ans)

Fixed submission:
a,b,c,k = map(int,input().split())
if k%2 == 0:
    print(a-b)
else:
    print(b-a)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int,input().split())
for i in range(k):
    a,b,c = b+c,a+c,a+b
ans = a-b
if ans > 10**18:
    print('Unfair')
else:
  print(ans)

Fixed submission:
a,b,c,k = map(int,input().split())
if k%2 == 0:
    print(a-b)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
x = int(input())
a =[]
c = 1
n = 2
while c <= 33:
	n = 2
    c += 1
    while c**n<=1000:
        a.append(c*n)
        n +=1
a.sort()
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))])

Fixed submission:
x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
c=[0]*10
for i in range(1:10):
    c[i]=(int(n**(1/i)))**i
    if c[i]>n:
        c[i]=0
print(max(c))

Fixed submission:
x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
c=[0]*10
for i in range(1:10):
    c[i]=(int(n**(1/i)))**i
    if c[i]>0:
        c[i]=0
print(max(c))

Fixed submission:
x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)
a = set()
for i in range(n):
    for j in range(n-i):
        a.add(s[j:j+i+1])
a = sorted(list(a))
print(a[k-1])

Fixed submission:
s = input()
k = int(input())
n = len(s)
a = set()
for i in range(5):
    for j in range(n-i):
        a.add(s[j:j+i+1])
a = sorted(list(a))
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y = map(int,input().splir())
cnt = 0
if 2*c < a+b:
    cnt += abs(x-y)*c*2
    if x > y:
        c += (x-y)*a
    else:
        c += (y-x)*b
else:
    cnt += a*x + b*y
print(cnt)

Fixed submission:
a,b,c,x,y = map(int,input().split())
cnt = 0
if 2*c < a+b:
    cnt += min(x,y)*c*2
    if x >= y:
        cnt += min((x-y)*a,(x-y)*2*c)
    else:
        cnt += min((y-x)*b,(y-x)*2*c)
else:
    cnt += a*x + b*y
print(cnt)