Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

n = int(input())
p = [int(input()) for _ in range(n)]


lsi = list(0 for _ in range(n+1))

for i in range(n):
    num = p[i]
    lsi[num] = 1

    for j in range(num):
        if j + lsi[j] == num:
            lsi[j] += 1

print(n - max(lsi))

Fixed submission:


a, b, c, k = map(int, input().split())

if k % 2 == 0:
    if a - b > pow(10,18):
        print("Unfair")
    else:
        print(a - b)
else:
    if b - a > pow(10,18):
        print("Unfair")
    else:
        print(b - a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())

if(n%500 <= A):
    print("Yes")
else:
    print ("No")

Fixed submission:
N = int(input())
A = int(input())

if(N%500 <= A):
    print("Yes")
else:
    print ("No")
Buggy python submission (verdict: Runtime Error):
1 8 6
2 9 7
0 7 7

Fixed submission:
c = [[int(i) for i in input().split()] for j in range(3)]

a = [0 for i in range(3)]
b = [0 for i in range(3)]

a[0] = 0

b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]

if a[1] + b[0] == c[1][0] and a[2] + b[0] == c[2][0] and a[1] + b[1] == c[1][1] and a[2] + b[1] == c[2][1] and a[1] + b[2] == c[1][2] and a[2] + b[2] == c[2][2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
c = []
s = []
f = []

for i in range(N-1):
    _c, _s, _f = map(int, input().split())
    c.append(_c)
    s.append(_s)
    f.append(_f)


for i in range(N):
    sumTime = 0
    stationNumber = i
    #print("(●・▽・●)",stationNumber)
    while stationNumber < N - 1:
        #print("(●・▽・●)(●・▽・●)", stationNumber, sumTime)
        if sumTime <= s[stationNumber]:
            sumTime = s[stationNumber]

        if (sumTime - s[stationNumber]) % f[stationNumber] == 0:
            sumTime += c[stationNumber]
            stationNumber += 1
        else:
            sumTime += 1

    print(sumTime)

Fixed submission:
N = int(input())
c = []
s = []
f = []

for i in range(N-1):
    _c, _s, _f = map(int, input().split())
    c.append(_c)
    s.append(_s)
    f.append(_f)


for i in range(N):
    sumTime = 0
    stationNumber = i
    #print("(●・▽・●)",stationNumber)
    while stationNumber < N - 1:
        #print("(●・▽・●)(●・▽・●)", stationNumber, sumTime)
        if sumTime <= s[stationNumber]:
            sumTime = s[stationNumber]

        if (sumTime - s[stationNumber]) % f[stationNumber] == 0:
            sumTime += c[stationNumber]
            stationNumber += 1
        else:
            sumTime += f[stationNumber] - (sumTime - s[stationNumber]) % f[stationNumber]

    print(sumTime)
Buggy python submission (verdict: Time Limit Exceeded):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

Q = int(input())

for i in range(Q):
    a, b = map(int,input().split())
    ans = 0
    while a <= b:
        if is_prime(a):
            if is_prime((a + 1) // 2):
                ans += 1
        a += 1
    print(ans)



Fixed submission:
import math
def is_prime(x):
    if x < 2: return False  # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True  # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False  # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    pri = 7
    step = 4
    while pri <= math.sqrt(x):
        if x % pri == 0: return False

        pri += step
        step = 6 - step

    return True

Q = int(input())

prime = [0] * 100002
prime[0] = 0
prime[1] = 0
prime[2] = 0
num = 3

while num < 100002:
    prime[num] = prime[num - 1]
    if is_prime(num) and is_prime((num + 1) // 2):
        prime[num] += 1
    num += 1
ans = []

for i in range(Q):
    a, b = map(int, input().split())
    ans.append(prime[b] - prime[a-1])

for i in range(Q):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
num_an=1
tmp=H[0]
for i in range(len(H)-1):
	if tmp>=H[i+1]:
		num_an+=1
	else:
		tmp=H[i+1]
print(num_an)

Fixed submission:
A,B=map(int,input().split())
num_an=0
for i in range(2):
  if A>B:
    num=A
    num_an+=num
    A+=-1
  else:
    num=B
    num_an+=num
    B+=-1
print(num_an)
Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
sum=0
for i in range(1,N+1):
  if i>=K:
    sum=sum+(1/N)
  else:
    sum=sum+(1/N)*((1/2)**(math.ceil(math.log2(K/i)))
print(sum)

Fixed submission:
import math
N,K=map(int,input().split())
sum=0
for i in range(1,N+1):
  if i>=K:
    sum=sum+(1/N)
  else:
    sum=sum+(1/N)*((1/2)**(math.ceil(math.log2(K/i))))
print(sum)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int ,input().split())
K=int(input())

max=a
if b>max:
    max=b
if c>max:
    max=c
sum=a+b+c-max
for i in range(K):
    max*=2
print(sum+max)


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

if a<=b:
    print(a)
else:
    print(a-1)
Buggy python submission (verdict: Runtime Error):

def main():
    # parse
    N, i = parse() 
    # compute
    result = compute(N, i)
    # show result
    print(result)

def compute(N, i):
    return N + 1 - i

def parse():
    vars = split_stdin(get_stdin())
    return vars[0], vars[1] 

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    # parse
    N, i = parse()
    # compute
    result = compute(N, i)
    # show result
    print(result)

def compute(N, i):
    return N + 1 - i

def parse():
    vars = split_stdin(get_stdin())
    return int(vars[0]), int(vars[1])

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):

def main():
    # parse
    N, i = parse() 
    # compute
    result = compute(N, i)
    # show result
    print(result)

def compute(N, i):
    return N + 1 - i

def parse():
    vars = split_stdin(get_stdin())
    return vars[0], vars[1] 

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    # parse
    N, i = parse()
    # compute
    result = compute(N, i)
    # show result
    print(result)

def compute(N, i):
    return N + 1 - i

def parse():
    vars = split_stdin(get_stdin())
    return int(vars[0]), int(vars[1])

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a = input().split()
a = [int(i) for i in a]
a = sort(a)
print(a[0]+a[1])

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

def getIntList():
    return list(map(int, input().split()))    

N, K = getIntList()

res = 0
c1 ==0
c2 ==0
if K %2 ==0:
    t = K//2
else:
    t= -1

if True:
    for i in range(1,N+1):
        if i%K == t:
            c1+=1
        if i%K ==0:
            c2+=1
res =  c1 **3 + c2** 3
print(res)

Fixed submission:
def getIntList():
    return list(map(int, input().split()))    
 
N, K = getIntList()
 
res = 0
c1 =0
c2 =0
if K %2 ==0:
    t = K//2
else:
    t= -1
 
if True:
    for i in range(1,N+1):
        if i%K == t:
            c1+=1
        if i%K ==0:
            c2+=1
res =  c1 **3 + c2** 3
print(res)
Buggy python submission (verdict: Runtime Error):
T  = int(input())
def gcd(a,b):
    if b==0: return a
    return gcd(b, a%b)
for _ in range(T):
    a,b,c,d =list( map(int, input().split()) )
    if a<b or d<b:
        print('No')
        continue
    a %= b
    d%=b
    d = gcd(d,b)
    if c>= b:
        print('Yes')
        continue
    x = (b-a)//d
    y = a+ x*d
    if y == b: y-=d
    if y>c:
        print('No')
    else:
        print('Yes')


Fixed submission:
N  = int(input())
za = list( map(int, input().split()) )
res = 0
for i in range(1,N):
 if za[i]==za[i-1]:
  za[i] = -1
  res+=1

print(res)

Buggy python submission (verdict: Runtime Error):
T  = int(input())
def gcd(a,b):
 if b==0: return a
 return gcd(b, a%b)
for _ in range(T):
 a,b,c,d =list( map(int, input().split()) )
 a %= b
 d%=b
 d = gcd(d,b)
 if c>= b:
  print('Yes')
  continue
 x = (b-a)//d
 y = a+ x*d
 if y == b: y-=d
 if y>=c:
  print('No')
 else:
  print('Yes')

Fixed submission:
N  = int(input())
za = list( map(int, input().split()) )
res = 0
for i in range(1,N):
 if za[i]==za[i-1]:
  za[i] = -1
  res+=1

print(res)
Buggy python submission (verdict: Runtime Error):
# メタデータ入力
n, m = map(int,input().split())

# 座標入力
pos = list(map(int,input().split()))
# ソート
pos.sort()

# 差分計算
distances = []
for i, x in enumerate(pos):
  if i == 0:
    continue
  distances.append(abs(pos[i] - pos[i-1]))

distances.sort()
for i in range(n-1):
	distances.pop()
print(sum(distances))

Fixed submission:
import sys
# メタデータ入力
n, m = map(int,input().split())

if n >= m:
  print(0)
  sys.exit()
# 座標入力
pos = list(map(int,input().split()))
# ソート
pos.sort()

# 差分計算
distances = []
for i, x in enumerate(pos):
  if i == 0:
    continue
  distances.append(abs(pos[i] - pos[i-1]))

distances.sort()
for i in range(n-1):
	distances.pop()
print(sum(distances))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
r, g, b, n = map(int, input().split())

#sum_rg = collections.Counter()  # TLE
sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)

Fixed submission:
import collections
r, g, b, n = map(int, input().split())

#sum_rg = collections.Counter()
sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)

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

sum_rg = collections.Counter()

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)

Fixed submission:
import collections
r, g, b, n = map(int, input().split())

#sum_rg = collections.Counter()
sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)
Buggy python submission (verdict: Runtime Error):
BASE = ['A', 'T', 'C', 'G']

N, Q = map(int, input().split())
S = input()
l = [None] * N
r = [None] * N
for i in range(Q):
    l[i], r[i] = map(int, input().split())
    l[i] -= 1
    r[i] -= 1

cumsum = [0] * N
sumbgn = [0] * N
sumend = [0] * N
tmpsum = 0
for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        sumbgn[i-1] = sumbgn[i-2] + 1 if i-2 >= 0 else 1
        sumend[i] = sumend[i-1] + 1
    else:
        sumbgn[i-1] = sumbgn[i-2] if i-2 >= 0 else 0
        sumend[i] = sumend[i-1]

for i in range(Q):
    sumr = sumend[r[i]]
    suml = sumbgn[l[i]-1] if l[i] > 0 else 0
    print(sumr - suml)

Fixed submission:
N, Q = map(int, input().split())
S = input()
l = [None] * Q
r = [None] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())
    l[i] -= 1
    r[i] -= 1

sumbgn = [0] * N
sumend = [0] * N
for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        sumbgn[i-1] = sumbgn[i-2] + 1 if i-2 >= 0 else 1
        sumend[i] = sumend[i-1] + 1
    else:
        sumbgn[i-1] = sumbgn[i-2] if i-2 >= 0 else 0
        sumend[i] = sumend[i-1]

for i in range(Q):
    sumr = sumend[r[i]]
    suml = sumbgn[l[i]-1] if l[i] > 0 else 0
    print(sumr - suml)
Buggy python submission (verdict: Runtime Error):
import pandas as pd
N = int(input())
city_score = [[i for i in input().split()] for i in range(N)]
all = list()
for i in range(N):
    all.append([city_score[i][0], int(city_score[i][1])*-1, i+1])
df = pd.DataFrame(all, columns=['city', 'score', 'index'])
df = df.sort_values(["city","score"])
result = list(df["index"].values)
for i in result:
    print(i)

Fixed submission:
N = int(input())
city_score = [[i for i in input().split()] for i in range(N)]
city = list()
score = list()
all = list()
for i in range(N):
    city.append(city_score[i][0])
    score.append(city_score[i][1])
    all.append([city_score[i][0], int(city_score[i][1]), i+1])
    
while(True):
    min_word = "zzzzzzzzzz"
    max_score = -1
    ans = 0
    index = 0
    for i in range(len(all)):
        if((all[i][0] < min_word) or (all[i][0] == min_word and all[i][1] > max_score)):
                max_score = all[i][1]
                min_word = all[i][0]
                ans = all[i][2]
                index = i
    print(ans)
    all.pop(index)
    #print(all)
    if(len(all) == 0):
        break
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools
#N, M = list(map(int, input().split()))
N = 2
M = 2
tmp = [[int(i) for i in input().split()] for i in range(M)]
p = list(map(int, input().split()))
ans = 0
for switch in itertools.product(range(2),repeat=N):
    #print(switch)
    num_clear_light = 0
    for i in range(M):
        count = 0
        for j in range(tmp[i][0]):
            #print(tmp[i][j+1])
            if(switch[tmp[i][j+1] - 1] == 1):
                count += 1
        if(count % 2 == p[i]):
            num_clear_light += 1
    if(num_clear_light == M):
        ans += 1
    num_clear_light = 0

print(ans)

Fixed submission:
import numpy as np
import itertools
N, M = list(map(int, input().split()))
tmp = [[int(i) for i in input().split()] for i in range(M)]
p = list(map(int, input().split()))
ans = 0
for switch in itertools.product(range(2),repeat=N):
    #print(switch)
    num_clear_light = 0
    for i in range(M):
        count = 0
        for j in range(tmp[i][0]):
            #print(tmp[i][j+1])
            if(switch[tmp[i][j+1] - 1] == 1):
                count += 1
        if(count % 2 == p[i]):
            num_clear_light += 1
    if(num_clear_light == M):
        ans += 1
    num_clear_light = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = list(map(int, input().split()))
A = np.array([int(i) for i in input().split()])
BC_array = np.array([[int(i) for i in input().split()] for i in range(M)])
#print(A)
#print(BC_array)
#BC_array_sorted = BC_array[np.argsort(BC_array[:,1])[::-1]]
for b, c in BC_array:
    A = np.sort(A)
    tmp = np.where(A < c)
    #print("==================")
    #print(A[tmp])
    #print(A)
    #print(tmp)
    #print(len(A[tmp]))
    if(len(A[tmp]) < b):
        A[tmp] = c
    else:
        A[0:b] = c
   
print(sum(A))

Fixed submission:
import numpy as np
N, M = list(map(int, input().split()))
A = np.array([int(i) for i in input().split()])
BC_array = np.array([[int(i) for i in input().split()] for i in range(M)])
BC_array_sorted = BC_array[np.argsort(BC_array[:,1])[::-1]]
D = np.array(np.zeros(N, dtype = int))
index = 0
for b, c in BC_array_sorted:
    D[index:min(index+b, N)] = c
    index += b
    if(N < index):
        break
E = np.concatenate((A, D))
E = np.sort(E)
ans = sum(E[N:2*N])
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d= input().split()
N = int(d)
R= int(a)
G = int(b)
B = int(c)

max_r = N//R
max_g = N//G
max_b = N//B
count = 0
for i in range(max_r+1):
 rest_n_r= N - R*i
 max_g = rest_n_r // G
 for j in range(max_g+1):
  rest_n_r_g = rest_n_r - G*j
  mod = rest_n_r_g % B
  if(mod == 0):
   count += 1

print(count)

Fixed submission:
a,b= input().split()
N = int(a)
K = int(b)
print(N-K+1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
N = int(input())
H = [int(x) for x in input().split()]

cost = np.full(N, math.inf)
cost[0] = int(0)
cost[1] = abs(H[0]-H[1])
for i in range(2, N):
    cost[i] = min(abs(H[i]-H[i-1]) + cost[i-1], abs(H[i]-H[i-2]) + cost[i-2])

print(int(cost[N-1]))
    

Fixed submission:
import numpy as np
N = int(input())
H = [int(x) for x in input().split()]

cost = np.full(N, float('inf'))
cost[0] = int(0)
cost[1] = abs(H[0]-H[1])
for i in range(2, N):
    cost[i] = min(abs(H[i]-H[i-1]) + cost[i-1], abs(H[i]-H[i-2]) + cost[i-2])

print(int(cost[N-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
import time

def main():
    N = int(input())
    dp = np.array([[0]*3] * N)
    
    for i in range(N):
        w_all = list(map(int, input().split()))
        for j,  w in enumerate(w_all):
            if(i == 0):
                dp[i][j] = w
            else:
                tmp = dp[i-1]
                ind = np.ones(len(w_all), dtype=bool)
                ind[j] = False
                tmp = tmp[ind]
                dp[i][j] = max(tmp) + w
    print(int(max(dp[N-1])))

if __name__ == "__main__":
    main()

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
 
 
def main():
    N = int(input())
    A, B, C = 0, 0, 0
    for _ in range(N):
        a, b, c = abc = map(int, input().split())
        A, B, C = max(B, C) + a, max(A, C) + b, max(A, B) + c
 
    print(max(A, B, C))
 
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
count = 0
for i in range(a, b):
    s = str(i)
   if(len(s) == 1):
      break
    for j in range(len(s) // 2):
        if(s[j] != s[len(s)-1-j]):
            break
    else:
        count += 1
print(count)    

Fixed submission:
a, b = map(int, input().split())
count = 0
for i in range(a, b+1):
    s = str(i)
    if(len(s) == 1):
        count += 1
        break
    for j in range(len(s) // 2):
        if(s[j] != s[len(s)-1-j]):
            break
    else:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = (int(x) for x in input().split())
if n%2==0:
  if k <= n/2
    print("YES")
  else:
    print("NO")
if n%2!=0:
  if k <= np.ceil(n/2)
    print("YES")
  else:
    print("NO")


Fixed submission:
import numpy as np
n, k = (int(x) for x in input().split())
if n%2==0:
  if k <= n/2:
    print("YES")
  else:
    print("NO")
if n%2!=0:
  if k <= np.ceil(n/2):
    print("YES")
  else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = (int(x) for x in input().split())
if n%2==0:
  if k <= n/2.0
  print("YES")
else:
  print("NO")
if n%2!=0:
  if k <= np.ceil(n/2.0)
  print("YES")
else:
  print("NO")


Fixed submission:
import numpy as np
n, k = (int(x) for x in input().split())
if n%2==0:
  if k <= n/2:
    print("YES")
  else:
    print("NO")
if n%2!=0:
  if k <= np.ceil(n/2):
    print("YES")
  else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
s=input();print("YNEOS"[15-len(s)+s.count("o")<8::2])'

Fixed submission:
s=input();print("YNEOS"[15-len(s)+s.count("o")<8::2])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,n=map(int,input().split())
q=0
for i in range(n//a+1):
  for j in range((n-a*i)//b+1):
    t=n-i*a-j*b
    if t%c==0and t//c>=0:
      q+=1
print(q)


Fixed submission:
a,b,c,n=map(int,input().split())
q=0
for i in range(n//a+1):
  for j in range((n-a*i)//b+1):
    t=n-i*a-j*b
    if t%c==0:
      q+=1
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,n=map(int,input().split())
q=0
for i in range(n//a+1):
  for j in range((n-a*i)//b+1):
    if(n-i*a-j*b)%c==0and (n-i*a-j*b)//c>=0:
      q+=1
print(q)

Fixed submission:
a,b,c,n=map(int,input().split())
q=0
for i in range(n//a+1):
  for j in range((n-a*i)//b+1):
    t=n-i*a-j*b
    if t%c==0:
      q+=1
print(q)
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=[]
for i in range(1,int(n**.5)+1):
  if n%i==0:
    p=n//i-1
    if n%p==n//p:
      c.append(p)
print(sum(c))

Fixed submission:
n=int(input())
d=[]
c=[]
for i in range(1,int(n**.5)+1):
  if n%i==0:
    for p in [i-1,n//i-1]:
      if p==0:continue
      if n%p==n//p:
        c.append(p)
print(sum(c))
Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
b=0
for n in range(x,y+1):
    b=b^n
print(b)

Fixed submission:
x,y=map(int,input().split())
def xor(x):
    if x%2==1:
        return 0 if (x+1)/2 %2==0 else 1
    else:
        return (0 if (x+2)/2 %2==0 else 1)^(x+1)
print(xor(x-1)^xor(y))

Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
b=0
for n in range(x,y+1):
    b=b^n
print(b)

Fixed submission:
x,y=map(int,input().split())
def xor(x):
    if x%2==1:
        return 0 if (x+1)/2 %2==0 else 1
    else:
        return (0 if (x+2)/2 %2==0 else 1)^(x+1)
print(xor(x-1)^xor(y))
Buggy python submission (verdict: Runtime Error):
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for s in range(l-2):
	c[s]=abs(int(s[s:(s+3)])-T)
print(min(c))


Fixed submission:
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for sp in range(l-2):
	c[sp]=abs(int(s[sp:(sp+3)])-T)
print(min(c))

Buggy python submission (verdict: Runtime Error):
=> 0, 1, 2
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for s in range(l-2):
	c[s]=abs(int(s[s:(s+3)])-T)
print(min(c))

Fixed submission:
s=input()
l=len(s)
T=753
c=[None]*(l-2)
for sp in range(l-2):
	c[sp]=abs(int(s[sp:(sp+3)])-T)
print(min(c))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
print('Hello World' if n==1 else 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):
a=input();b=a[1:].replace('C','');print('WAAC'[a[0]=="A"and1==a[2:-1].count("C")and b.lower()==b::2])

Fixed submission:
a=input();b=a[1:].replace('C','');print('WAAC'[a[0]=="A"and 1==a[2:-1].count("C")and b.lower()==b::2])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
def cumsum(n):
  if n==1:
    return 1
  elif n>1:
    return cumsum(n-1)+n
print(cumsum(b-a)-b)

Fixed submission:
a,b=map(int,input().split())
def cumsum(n):
  return sum([i for i in range(n+1)])
print(cumsum(b-a)-b)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
def cumsum(n):
  if n==1:
    return 1
  else:
    return cumsum(n-1)+n
print(cumsum(b-a)-b)

Fixed submission:
a,b=map(int,input().split())
def cumsum(n):
  return sum([i for i in range(n+1)])
print(cumsum(b-a)-b)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

print(a if a<=b else: a-1)
  

Fixed submission:
a,b=map(int,input().split())
print(a if a<=b else a-1)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=list(range(a,b+1))
for i in sorted(set(l[:k]+l[-k:])):
  print(i)

Fixed submission:
a,b,k=map(int,input().split())
if b-a+1<2*k:
  l=range(a,b+1)
else:
  l=list(range(a,a+k))+list(range(b-k+1,b+1))
for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
print('Yes' if a+b>=c else 'No')

Fixed submission:
a,b,c=map(int,input().split())
print('Yes' if a+b>=c else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(input()) for idx in range(n)]

print(length(list(set(arr))))


Fixed submission:
n=int(input())

radii=[int(input()) for _ in range(n)]
print(len(list(set(radii))))

Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(input()) for idx in range(n)]

print(length(set(arr)))

Fixed submission:
n=int(input())

radii=[int(input()) for _ in range(n)]
print(len(list(set(radii))))