Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = input()[::-1]
import sys
sys.setrecursionlimit(1000)
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    while 1:
        l = len(s)
        if l==0:
            return True
        if l<5:
            return False
        if s[:5] in c:
            s = s[5:]
        elif l>=6 and s[:6]=='resare':
            s = s[6:]
        elif l>=7 and s[:7]=='remaerd':
            s = s[7:]

if dfs(S):
    print('YES')
else:
    print('NO')
        

Fixed submission:
S = input()[::-1]
import sys
sys.setrecursionlimit(1000)
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    L = len(s)
    while 1:
        if L==0:
            return True
        if L<5:
            return False
        if s[:5] in c:
            s = s[5:]
            L -= 5
        elif L>=6 and s[:6]=='resare':
            s = s[6:]
            L -= 6
        elif L>=7 and s[:7]=='remaerd':
            s = s[7:]
            L -= 7
        else:
            return False

if dfs(S):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()[::-1]
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    while 1:
        l = len(s)
        if l==0:
            return True
        if l<5:
            return False
        if s[:5] in c:
            s = s[5:]
        elif l>=6 and s[:6]=='resare':
            s = s[6:]
        elif l>=7 and s[:7]=='remaerd':
            s = s[7:]

if dfs(S):
    print('YES')
else:
    print('NO')
        

Fixed submission:
S = input()[::-1]
import sys
sys.setrecursionlimit(1000)
c = ['maerd', 'remaerd', 'esare', 'resare']

def dfs(s):
    L = len(s)
    while 1:
        if L==0:
            return True
        if L<5:
            return False
        if s[:5] in c:
            s = s[5:]
            L -= 5
        elif L>=6 and s[:6]=='resare':
            s = s[6:]
            L -= 6
        elif L>=7 and s[:7]=='remaerd':
            s = s[7:]
            L -= 7
        else:
            return False

if dfs(S):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
cnt = 0
s = set()
for i in range(1, N):
    cnt += i
    s.add(i)
    if cnt>=N:
        break
if N!=cnt:
    s.remove(cnt-N)

for i in s:
    print(i)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
cnt = 0
s = set()
for i in range(1, N+1):
    cnt += i
    s.add(i)
    if cnt>=N:
        break
if N!=cnt:
    s.remove(cnt-N)

for i in s:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = input()
sum = 0
def sumN(n):
    sum = 0
    for i in range(len(n)):
        sum += int(n[i])
    return sum
sum = sumN(n)
while sum > 10000:
    sum = sumN(sum)
if sum % 9 == 0:
    print('Yes')
else:
    print('No')


Fixed submission:
n = input()
def sumN(n):
    sum = 0
    for i in range(len(n)):
        sum += int(n[i])
    return sum
sum = sumN(n)
if sum % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = str(input())
dai = [Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M]
syou = [q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m]
if n in dai:
  print('A')
else:
  print('a')

Fixed submission:
n = str(input())
dai = ["Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M"]
syou = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"]
if n in dai:
  print('A')
else:
  print('a')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
re = 1

li = list(map(int, input().split()))

for i in range(n):
    re = re * li[i]
if re > 1000000000000000000:
    print(-1)
else:
    print(re)


Fixed submission:
n = int(input())
re = 1

li = list(map(int, input().split()))

for i in range(n):
    if re > 1000000000000000000:
        break
    re = re * li[i]
if 0 in li:
    print(0)
elif re > 1000000000000000000:
    print(-1)
else:
    print(re)
Buggy python submission (verdict: Runtime Error):
import math
li = list(map(int,input().split()))
countC = li[1] // li[2] - (li[0]-1) // li[2]

countD = li[1] // li[3] - (li[0]-1) // li[3]

lcm = (li[2] * li[3]) // math.gcd(li[2], li[3])

countCD = li[1] // lcm - (li[0]-1) // lcm

re = (li[1] - li[0] + 1) - (countC +countD - countCD)

print(re)


Fixed submission:
import fractions
li = list(map(int,input().split()))
countC = li[1] // li[2] - (li[0]-1) // li[2]

countD = li[1] // li[3] - (li[0]-1) // li[3]

lcm = (li[2] * li[3]) // fractions.gcd(li[2], li[3])

countCD = li[1] // lcm - (li[0]-1) // lcm

re = (li[1] - li[0] + 1) - (countC +countD - countCD)

print(re)
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
K=int(input())
s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[K-1])

Buggy python submission (verdict: Runtime Error):
K=int(input().split())
s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[K-1])


Fixed submission:
K=int(input())
s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[K-1])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())

S[K] = S[K].lower()

print(''.join(S))

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

S[K - 1] = S[K - 1].lower()

print(''.join(S))

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

S[K] = S[K].lower()

print(S)

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

S[K - 1] = S[K - 1].lower()

print(''.join(S))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = [int(e) for e in input().split()]
ans = 1
for i in range(n):
    ans *= nums[i]
print(ans if ans <= 10 ** 18 else -1)

Fixed submission:
N = int(input())
num = sorted([int(e) for e in input().split(" ")])
lim = 10 ** 18
i = -1
ans = 1
for a in num:
    ans *= a
    if(ans > lim):
        print(-1)
        break
    elif(ans == 0):
        print(0)
        break
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
fn main(){
    let raw = input();
    let x: Vec<&str> = raw.split(' ').collect();
    
    let a: f64 = x[0].parse::<f64>().unwrap();
    let b: f64 = x[1].parse::<f64>().unwrap() * 100.0;
    
    println!("{}", (a * b / 100.0) as i32);
}

fn input() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_string()
}

Fixed submission:
raw = input().split(' ')
a = int(raw[0])
b = int(raw[1].replace('.', ""))

print(a * b // 100)

Buggy python submission (verdict: Runtime Error):
fn main(){
    let raw = input();
    let x: Vec<&str> = raw.split(' ').collect();
    
    println!("{:?}", x);
    
    let a: f64 = x[0].parse::<f64>().unwrap();
    let b: f64 = x[1].parse::<f64>().unwrap() * 100.0;
    
    println!("{}", (a * b / 100.0) as i32);
}

fn input() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_string()
}

Fixed submission:
raw = input().split(' ')
a = int(raw[0])
b = int(raw[1].replace('.', ""))

print(a * b // 100)
Buggy python submission (verdict: Runtime Error):
print("APPROVED" if int(input()) == xsum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)]) else "DENIED")

Fixed submission:
n = int(input())
x = sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)])
print("APPROVED" if n == x else "DENIED")
Buggy python submission (verdict: Runtime Error):
n = [int(e) for e in input().split(" ")]
if(n[0] == n[1]):
    print(f"{n[0]}" * n[0])
elif(n[0] < n[1]):
    print(f"{n[0]}" * n[1])
else:
    print(f"{n[1]}" * n[0])

Fixed submission:
n = [int(e) for e in input().split(" ")]
if(n[0] == n[1]):
    print(str(n[0]) * n[0])
elif(n[0] < n[1]):
    print(str(n[0]) * n[1])
else:
    print(str(n[1]) * n[0])

Buggy python submission (verdict: Runtime Error):
n = [int(e) for e in input().split(" ")]
if(n[0] == n[1]):
    print(f"{n[0]}" * n[0])
elif(n[0] < n[1]):
    print(f"{n[0]}" * n[1])
else:
    print(f"{n[1]}" * n[0])

Fixed submission:
n = [int(e) for e in input().split(" ")]
if(n[0] == n[1]):
    print(str(n[0]) * n[0])
elif(n[0] < n[1]):
    print(str(n[0]) * n[1])
else:
    print(str(n[1]) * n[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = [int(e) for e in input().split(" ")]
c = 0
for i in range(N):
    if(p[i] <= min(p[0:i + 1])):
        c += 1
print(c)

Fixed submission:
N = int(input())
p = [int(e) for e in input().split(" ")]
low = p[0]
c = 0
for i in range(N):
    if(p[i] <= low):
        c += 1
        low = p[i]
print(c)
Buggy python submission (verdict: Runtime Error):
s = input()
v = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
i = 7
for w in v:
  if s != v[i]:
    i -= 1
  else:
    print(i)
    break

Fixed submission:
s = input()
v = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
i = 7
for w in v:
  if s != w:
    i -= 1
  else:
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
nk = [int(e) for e in input().split(" ")]
h = [int(f) for f in input().split()]
c = 0
for e_h in h: if nk[1] <= e_h: c += 1
print(c)

Fixed submission:
k = int(input().split(" ")[1])
c = 0
for e_h in [int(e) for e in input().split()]:
    if(k <= e_h): c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
print(" ".join(map(lambda x: str(x[1]), sorted([(int(a), num) for a, num in zip(input().split(" "), list(range(1,int(input()) + 1)))]))))

Fixed submission:
n = int(input())
a = [(int(a), num) for a, num in zip(input().split(" "), list(range(1,n + 1)))]
a.sort()
m = len(a)
for i in range(m):
    print(a[i][1],end="")
    if(i + 1 < m):
        print(" ",end="")
print()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    num = makeNumList(input())
    ans = 0.0
    
    for i in range(n):
        ans += invNum(num[i])
    
    print(invNum(ans))

def invNum(n):
    return 1 / n

def makeNumList(raw):
    num = []
    raw = raw.split(" ")
    for i in range(len(raw)):
        num.append(raw[i])
    return num

main()

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    num = makeNumList(input())
    ans = 0.0
    
    for i in range(n):
        ans += invNum(num[i])
    
    print(invNum(ans))

def invNum(n):
    return 1 / n

def makeNumList(raw):
    num = []
    raw = raw.split(" ")
    for i in range(len(raw)):
        num.append(int(raw[i]))
    return num

main()
Buggy python submission (verdict: Runtime Error):
r = int(input())
g = int (input())
b = int(input())
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')

Fixed submission:
cores=input().split()
r,g,b=int(cores[0]), int(cores[1]), int(cores[2])
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
r = int(input())
g = int (input())
b = int(input())
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')

Fixed submission:
cores=input().split()
r,g,b=int(cores[0]), int(cores[1]), int(cores[2])
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input().strip()
assert n == len(s)

maxlen = 0
for offset in range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)

Fixed submission:
n = int(input())
s = input().strip()
assert n == len(s)

maxlen = 0
for offset in range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)

Buggy python submission (verdict: Runtime Error):
n: int = input()
s: str = input()
assert n == len(s)

maxlen = 0
for offset range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)


Fixed submission:
n = int(input())
s = input().strip()
assert n == len(s)

maxlen = 0
for offset in range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)
Buggy python submission (verdict: Runtime Error):
x=input()
print('ACL'*x)

Fixed submission:
x=int(input())
print('ACL'*x)
Buggy python submission (verdict: Runtime Error):
x = input()
y = input()
if x[::-1] = y:
	print('YES')
else:
	print('NO')

Fixed submission:
x = input()
y = input()
if x[::-1] == y:
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
y= math.sqrt(x)
z= y//1
print(int(z)

Fixed submission:
import math
x=int(input())
y= math.sqrt(x)
z= y//1
a=z**2
print(int(a))

Buggy python submission (verdict: Runtime Error):
x=input()
float(y)= sqrt(x)
z= y//1
print(z)

Fixed submission:
import math
x=int(input())
y= math.sqrt(x)
z= y//1
a=z**2
print(int(a))
Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int, input().split())

sy, sx = map(int, input().split())
sy -= 1
sx -= 1
gy, gx = map(int, input().split())
gy -= 1
gx -= 1

s = [[] for _ in range(h)]
for i in range(h):
    s[i] = input()

from collections import deque
d = deque()

visited = [[False]*w for _ in range(h)]

d.append([sy,sx,0])

while len(d) > 0:
    y,x,c = d.popleft()
    
    if visited[y][x] is True:
        continue
    
    if gy == y and gx == x:
        print(c)
        exit(0)

    dxy = [[1,0], [-1, 0], [0, 1], [0, -1]]
    for dx, dy in dxy:
        nx = dx + x
        ny = dy + y
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if s[ny][nx] == "#":
            continue
        if visited[ny][nx] is True:
            continue
        d.appendleft([ny, nx, c])

    for dy in range(-2, 3):
        for dy in range(-2, 3):
            nx = dx + x
            ny = dy + y
            if nx < 0 or nx >= w or ny < 0 or ny >= h:
                continue
            if s[ny][nx] == "#":
                continue
            if visited[ny][nx] is True:
                continue
            d.append([ny, nx, c+1])

print(-1)


Fixed submission:
h,w = map(int, input().split())

sy, sx = map(int, input().split())
sy -= 1
sx -= 1
gy, gx = map(int, input().split())
gy -= 1
gx -= 1

s = [[""] for _ in range(h)]
for i in range(h):
    s[i] = input()

from collections import deque
d = deque()

visited = [[False]*w for _ in range(h)]

d.append([sy,sx,0])

while len(d) > 0:
    y,x,c = d.popleft()
    
    if visited[y][x] is True:
        continue
    else:
        visited[y][x] = True
    
    if gy == y and gx == x:
        print(c)
        exit(0)

    dxy = [[1,0], [-1, 0], [0, 1], [0, -1]]
    for dx, dy in dxy:
        nx = dx + x
        ny = dy + y
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if s[ny][nx] == "#":
            continue
        if visited[ny][nx] is True:
            continue
        d.appendleft([ny, nx, c])

    for dy in range(-2, 3):
        for dx in range(-2, 3):
            nx = dx + x
            ny = dy + y
            if nx < 0 or nx >= w or ny < 0 or ny >= h:
                continue
            if s[ny][nx] == "#":
                continue
            if visited[ny][nx] is True:
                continue
            d.append([ny, nx, c+1])

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
h, w, k = map(int, input().split())

r_n = [0] * h
c_n = [0] * w
bomb_table = set()
for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

for i in range(h):
    if r_n[i] != max_y:
        continue
    for j in range(w):
        if c_n[j] != max_x:
            continue
        if (i, j) not in bomb_table:
            print(ans)
            exit(0)

print(ans - 1)


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

r_n = [0] * h
c_n = [0] * w
bomb_table = set()
for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

max_x_table = set()
max_y_table = set()

for i in range(h):
    if r_n[i] == max_y:
        max_y_table.add(i)

for i in range(w):
    if c_n[i] == max_x:
        max_x_table.add(i)

for i in max_y_table:
    for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0)
print(ans - 1)

Buggy python submission (verdict: Runtime Error):
h,w,k = map(int, input().split())

r_n = [0]*h
c_n = [0]*w
bomb_table = set()
for i in range(m):
	hi, wi = map(int, input().split())
	hi-=1
	wi-=1
	r_n[hi] += 1
	c_n[wi] += 1
	bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

for i in range(h):
	if r_n[i] != max_y:
		continue
	for j in range(w):
		if c_n[j] != max_x:
			continue
		if (i,j) not in bomb_table:
			print(ans)
			exit()
			
print(ans - 1)

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

r_n = [0] * h
c_n = [0] * w
bomb_table = set()
for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

max_x_table = set()
max_y_table = set()

for i in range(h):
    if r_n[i] == max_y:
        max_y_table.add(i)

for i in range(w):
    if c_n[i] == max_x:
        max_x_table.add(i)

for i in max_y_table:
    for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0)
print(ans - 1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

total = 1

for i in range(k - 1, -1, -1):
    total *= a[i]

after = total
for i in range(k + 1, n + 1):
    before = total
    after //= a[i - k - 1]
    after *= a[i - 1]

    if before < after:
        print("Yes")
    else:
        print("No")

    total = after



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

for i in range(k + 1, n + 1):
    if a[i - k - 1] < a[i - 1]:
        print("Yes")
    else:
        print("No")

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

total = 1

for i in range(k - 1, -1, -1):
    total *= a[i]

after = total
for i in range(k + 1, n + 1):
    before = total
    after //= a[i - k - 1]
    after *= a[i - 1]

    if before < after:
        print("Yes")
    else:
        print("No")

    total = after


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

for i in range(k + 1, n + 1):
    if a[i - k - 1] < a[i - 1]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
from collections import deque

n, m, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

a = deque(a)
b = deque(b)

ans = 0

while n > 0 and m > 0 and k > 0:
    if a[0] == b[0]:
        i = 0
        while i + 1 < m and i + 1 < n and a[i + 1] != b[i + 1]:
            i += 1
        if a[i] >= b[i]:
            k -= b[0]
            if k >= 0:
                ans += 1
            b.popleft()
            n -= 1
        else:
            k -= a[0]
            if k >= 0:
                ans += 1
            a.popleft()
            m -= 1
    elif a[0] > b[0]:
        k -= b[0]
        if k >= 0:
            ans += 1
        b.popleft()
        m -= 1
    else:
        k -= a[0]
        if k >= 0:
            ans += 1
        a.popleft()
        n -= 1

if n <= 0:
    while k > 0 and m > 0:
        k -= b[0]
        if k >= 0:
            ans += 1
        b.popleft()
elif m <= 0:
    while k > 0 and n > 0:
        k -= a[0]
        if k >= 0:
            ans += 1
        a.popleft()

print(ans)



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

a = list(map(int, input().split()))
b = list(map(int, input().split()))

sum_a = [0]
sum_b = [0]

for i in range(n):
    sum_a.append(sum_a[-1] + a[i])

for i in range(m):
    sum_b.append(sum_b[-1] + b[i])

ans = 0
j = m
for i in range(n + 1):
    while sum_a[i] + sum_b[j] > k and j >= 0:
        j -= 1

    if j < 0:
        break

    if sum_a[i] + sum_b[j] <= k:
        ans = max(ans, i + j)

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

ans = 0
for i in range(1, n + 1):
    t = int(n / i)
    ans += i * t * (t + 1) // 2

print(ans)


Fixed submission:
n = int(input())

ans = 0
for i in range(1, n + 1):
    t = int(n / i)
    ans += i * t * (t + 1) // 2

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

a.sort()

is_divisible = [-1] * (2 * (10 ** 5) + 1)
is_divisible[0] = False

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 2 * (10 ** 5) + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)


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

a.sort()

is_divisible = [-1] * (10 ** 6 + 1)
is_divisible[0] = 1

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 10 ** 6 + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)

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

a.sort()

is_divisible = [-1] * (2 * (10 ** 5) + 1)
is_divisible[0] = False

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 2 * (10 ** 5) + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)


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

a.sort()

is_divisible = [-1] * (10 ** 6 + 1)
is_divisible[0] = 1

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 10 ** 6 + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)