Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M,K=map(int,input().split())
F,B=[[] for _ in range(N)],[[] for _ in range(N)]
for _ in range(M):
  a,b = map(int,input().split())
  a,b = a-1,b-1
  F[a].append(b)
  F[b].append(a)
for _ in range(K):
  c,d = map(int,input().split())
  c,d=c-1,d-1
  B[c].append(d)
  B[d].append(c)
#print(F,B)
C=[[] for _ in range(N)]
finished = []
for i,f in enumerate(F):
  if i in finished: continue
  store = deque([i])
  c = []
  while len(store)>0:
    s = store.popleft()
    if s in c:continue
    c.append(s)
    store.extend(F[s])
  finished.extend(c)
  for c2 in c:
    C[c2] = [v for v in c if v!=c2 and v not in F[c2] and v not in B[c2]]
#print(F,B,C)
print(' '.join([str(len(v)) for v in C]))

Fixed submission:
from sys import setrecursionlimit 
setrecursionlimit(10**6)

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

fr = [set() for _ in range(n)]
bl = [set() for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    fr[a-1].add(b-1)
    fr[b-1].add(a-1)
    
for i in range(k):
    c ,d = map(int, input().split())
    bl[c-1].add(d-1)
    bl[d-1].add(c-1)
    
def dfs(v, temp):
    visited[v] = True
    temp.add(v)
    for i in fr[v]:
        if visited[i] == False:
            temp = dfs(i, temp)
    return temp
visited = [False]*n

cc = [0]*n
for v in range(n):
    if visited[v] == False:
        c = dfs(v,set())
        for i in c:
            cc[i] = c


ans = []
for i in range(n):
    aa = len(cc[i]) - len(cc[i] & fr[i]) - len(cc[i] & bl[i]) - 1
    ans.append(aa)
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M,K=map(int,input().split())
F,B=[[] for _ in range(N)],[[] for _ in range(N)]
for _ in range(M):
  a,b = map(int,input().split())
  a,b = a-1,b-1
  F[a].append(b)
  F[b].append(a)
for _ in range(K):
  c,d = map(int,input().split())
  c,d=c-1,d-1
  B[c].append(d)
  B[d].append(c)
#print(F,B)
C=[[] for _ in range(N)]
for i,f in enumerate(F):
  store = deque([i])
  c = []
  while len(store)>0:
    s = store.popleft()
    if s in c:continue
    c.append(s)
    store.extend(F[s])
  c = [v for v in c if v != i and v not in f and v not in B[i]]
  C[i]=c
#print(F,B,C)
print(' '.join([str(len(v)) for v in C]))

Fixed submission:
from sys import setrecursionlimit 
setrecursionlimit(10**6)

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

fr = [set() for _ in range(n)]
bl = [set() for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    fr[a-1].add(b-1)
    fr[b-1].add(a-1)
    
for i in range(k):
    c ,d = map(int, input().split())
    bl[c-1].add(d-1)
    bl[d-1].add(c-1)
    
def dfs(v, temp):
    visited[v] = True
    temp.add(v)
    for i in fr[v]:
        if visited[i] == False:
            temp = dfs(i, temp)
    return temp
visited = [False]*n

cc = [0]*n
for v in range(n):
    if visited[v] == False:
        c = dfs(v,set())
        for i in c:
            cc[i] = c


ans = []
for i in range(n):
    aa = len(cc[i]) - len(cc[i] & fr[i]) - len(cc[i] & bl[i]) - 1
    ans.append(aa)
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p = [(int(v)+1)/2 for v in input().split()]
e = [sum(p[i:i+k]) for i in range(n-k+1)]
print(max(e))
  
  

Fixed submission:
n,k=map(int,input().split())
p = [(int(v)+1)/2 for v in input().split()]
e = [sum(p[:k])]
for i in range(n-k):
  e.append(e[-1]-p[i]+p[i+k])
print(max(e))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
def f(n,k):
  if k<1: return 1
  if n<10:
    if k<2: return n
    return 0
  d,m=n//10,n%10
  return f(d,k-1)*m+f(d-1,k-1)*(9-m)+f(d,k)
print(f(N,K))

Fixed submission:
N,K=int(input()),int(input())
def f(n,k):
  if k<1: return 1
  if n<10:
    if k<2: return n
    return 0
  d,m=n//10,n%10
  return f(d,k-1)*m+f(d-1,k-1)*(9-m)+f(d,k)
print(f(N,K))
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
n=int(input())
A=list(map(int,input().split()))
ans = 0

for i in range(60):
  n1,n0 = 0,0
  for a in A:
    if a>>i & 1: n1+=1
    else: n0+=1
  ans += (2**i)*n1*n0 % mod
ans %= mod
print(ans)

Fixed submission:
import numpy as np

mod = 10**9+7
n=int(input())
A=np.array(list(map(int,input().split())))
ans = 0

for i in range(60):
  n1 = np.count_nonzero((A>>i)&1)
  n0 = n-n1
  ans += (2**i)*n1*n0 % mod
ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
n=int(input())
A=list(map(int,input().split()))
ans = 0
for i,a in enumerate(A[:-1]):
  for j,a2 in enumerate(A[i:]):
    ans += a^a2
print(ans%mod)

Fixed submission:
import numpy as np

mod = 10**9+7
n=int(input())
A=np.array(list(map(int,input().split())))
ans = 0

for i in range(60):
  n1 = np.count_nonzero((A>>i)&1)
  n0 = n-n1
  ans += (2**i)*n1*n0 % mod
ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
last = s[0]
cnt = 0
for s in S[1:]:
  if last != s:
    cnt+=1
    last = s
print(cnt)

Fixed submission:
N=int(input())
S=input()
last = S[0]
cnt = 1
for s in S[1:]:
  if last != s:
    cnt+=1
    last = s
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
L.sort()
from bisect import bisect_left
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    ans += th
print(ans)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
from bisect import bisect_left
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(lambda x: int(x)*(-1),input().split()))
L.sort()
from bisect import bisect
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    th = bisect(L[i2+1:],(l2-l1+1)*(-1))
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    ans += th
print(ans)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
from bisect import bisect_left
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

from bisect import insort
while M>0:
  a = A.pop()
  a /= 2
  insort(A,a)
  M-=1
ans = 0
for a in A:
  ans += int(a)
print(ans)
  

Fixed submission:
N,M=map(int,input().split())
A=list(map(lambda x: -int(x),input().split()))
import heapq
heapq.heapify(A)
for _ in range(M):
  a = heapq.heappop(A)
  a /= 2
  heapq.heappush(A,a)
ans = 0
for a in A:
  ans += int((-1)*a)
print(ans)

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

from bisect import insort
while M>0:
  a = A.pop(-1)
  a /= 2
  insort(A,a)
  M-=1
ans = 0
for a in A:
  ans += int(a)
print(ans)
  

Fixed submission:
N,M=map(int,input().split())
A=list(map(lambda x: -int(x),input().split()))
import heapq
heapq.heapify(A)
for _ in range(M):
  a = heapq.heappop(A)
  a /= 2
  heapq.heappush(A,a)
ans = 0
for a in A:
  ans += int((-1)*a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
ans = 0
for i in range(N-2):
  for l in range(1,(N-i)//2+1):
    s = S[i:i+l]
    #print(i,l,s)
    if s in S[i+l:]:
      ans = max(ans,l)
print(ans)

    

Fixed submission:
N=int(input())
S=input()
ans = 0
j = 0
for i in range(N):
  while j < N and S[i:j] in S[j:]:
    j += 1
  ans = max(ans,j-i-1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = [int(input()) for i in range(N)]
for i,a in enumerate(A):
  B = A[:]
  B[i]=0
  print(max(B))


Fixed submission:
N=int(input())
A = [int(input()) for i in range(N)]
maxval = max(A)
argmaxval = A.index(maxval)
for i,a in enumerate(A):
  if i==argmaxval:
    B = A[:]
    B[i]=0
    print(max(B))
  else:
    print(maxval)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ab = []
for _ in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok:
    #print(v)
    cnt += 1
  
print(cnt)

Fixed submission:
n,m=map(int,input().split())
ab = []
for _ in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok:
    #print(v)
    cnt += 1
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ab = []
for _ in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok:
    print(v)
    cnt += 1
  
print(cnt)

Fixed submission:
n,m=map(int,input().split())
ab = []
for _ in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok:
    #print(v)
    cnt += 1
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ab = []
for _ in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok == True:
    cnt += 1
  
print(cnt)

Fixed submission:
n,m=map(int,input().split())
ab = []
for _ in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  ab.append({a,b})
import itertools

cnt = 0
for v in itertools.permutations(range(1,n)):
  l = 0
  ok = True
  for v2 in v:
    if {l,v2} not in ab:
      ok = False
      break
    l = v2
  if ok:
    #print(v)
    cnt += 1
  
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in range(n):
    for j in range(1,n - i):
        b += a[i]*a[i + j]
        b %= (10**9 + 7)
       

print(b)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
s = sum(a)
ans = 0
for i in range(n):
    s -= a[i]
    ans += a[i]*s
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in range(n):
    for j in range(1,n - i):
        b += a[i]*a[i + j]
       

print(b%(10**9 + 7))


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
s = sum(a)
ans = 0
for i in range(n):
    s -= a[i]
    ans += a[i]*s
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in range(n):
    for j in range(i + 1,n):
        b += a[i]*a[j]
print(b%(10**9 + 7))


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
s = sum(a)
ans = 0
for i in range(n):
    s -= a[i]
    ans += a[i]*s
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in range(n):
    for j in range(i + 1,n):
        b += a[i]*a[j]
print(b%(10**9 + 7))


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
s = sum(a)
ans = 0
for i in range(n):
    s -= a[i]
    ans += a[i]*s
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

for i in range(i + 1):
    if 4*i + 2*(x-i) == y:
        print("Yes")
        exit()
        
print("No")
            

Fixed submission:
x,y = map(int,input().split())

for i in range(x + 1):
    if 4*i + 2*(x-i) == y:
        print("Yes")
        exit()
        
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
if ans >= 10**18 + 1:
    ans = -1
print(ans)


Fixed submission:
n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
    ans = min(ans,10**18 + 1)
if ans >= 10**18 + 1:
    ans = -1
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())
ans = ((a*b*100) /100)// 1
print(int(ans))

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
    ans = min(ans,10**18 + 1)
if ans >= 10**18 + 1:
    ans = -1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
    for j in range(len(a)):
        if i + 1 == a[j]:
            b[i] += 1
    print(b[i])

   
    

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in a:
    b[i - 1] += 1

for j in b:
    print(j)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n + 1):
    print(a.count(i))
    

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in a:
    b[i - 1] += 1

for j in b:
    print(j)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 0
for i in range(n - 2):
    for j in range(i + 1,n - 1):
        for k in range(j + 1,n):
            if s[i] == s[j] or s[j] == s[k] or s[i] == s[k]:
                continue
            elif j - i == k - j:
                continue
            else:
                ans += 1
               
print(ans)

Fixed submission:
n = int(input())
s = list(input())
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
     
        if s[i] != s[j] and  s[i] != s[k] and s[k] != s[j]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 0
for i in range(n - 2):
    for j in range(i + 1,n - 1):
        for k in range(j + 1,n):
            if s[i] == s[j] or s[j] == s[k] or s[i] == s[k]:
                continue
            elif j - i == k - j:
                continue
            else:
                ans += 1
               
print(ans)

Fixed submission:
n = int(input())
s = list(input())
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
     
        if s[i] != s[j] and  s[i] != s[k] and s[k] != s[j]:
            ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for _ in range(n)]
b = []
for i in range(n):
    if a[i] not in b:
        b.append(a[i])
b.sort()
c = [0]*len(b)
for i in range(len(b)):
    c[i] += a.count(b[i])
for i in range(len(b)):
    if c[i] == max(c):
        print(b[i])


Fixed submission:
n = int(input())
a = [input() for _ in range(n)]
cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 1
    else:
        cnt[a[i]] += 1
mx = max(cnt.values())
ans = []
for i in cnt.keys():
    if cnt[i] == mx:
        ans.append(i)
ans.sort()
for _ in ans:
    print(_)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for _ in range(n)]
b = []
a.sort()
for i in range(n):
    if a[i] not in b:
        b.append(a[i])
b.sort()
c = [0]*len(b)
for i in range(len(b)):
    c[i] += a.count(b[i])
for i in range(len(b)):
    if c[i] == max(c):
        print(b[i])


Fixed submission:
n = int(input())
a = [input() for _ in range(n)]
cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 1
    else:
        cnt[a[i]] += 1
mx = max(cnt.values())
ans = []
for i in cnt.keys():
    if cnt[i] == mx:
        ans.append(i)
ans.sort()
for _ in ans:
    print(_)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for _ in range(n)]
b = []
a.sort()
for i in range(n):
    if a[i] not in b:
        b.append(a[i])
b.sort()
c = [0]*len(b)
for i in range(len(b)):
    c[i] += a.count(b[i])
for i in range(len(b)):
    if c[i] == max(c):
        print(b[i])


Fixed submission:
n = int(input())
a = [input() for _ in range(n)]
cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 1
    else:
        cnt[a[i]] += 1
mx = max(cnt.values())
ans = []
for i in cnt.keys():
    if cnt[i] == mx:
        ans.append(i)
ans.sort()
for _ in ans:
    print(_)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0

for i in range(n):
    p[i] = (p[i] + 1)/2
for j in range(n - k + 1):
    ev = sum(p[j:j + k])
    ans = max(ans,ev)
print(ans)



    


Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n):
    p[i] = (p[i] + 1)/2
ev = sum(p[:k])
if n == k:
    print(sum(p))
    exit()
for i in range(n - k):
    ev += (p[i + k] - p[i])
    ans = max(ans,ev)
print(ans)

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

for i in range(n):
    p[i] = (p[i] + 1)/2
for j in range(n - k + 1):
    ev = sum(p[j:j + k])
    ans = max(ans,ev)
print(ans)



    


Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n):
    p[i] = (p[i] + 1)/2
ev = sum(p[:k])
if n == k:
    print(sum(p))
    exit()
for i in range(n - k):
    ev += (p[i + k] - p[i])
    ans = max(ans,ev)
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
flg = 0
if x == 2:
    print(2)
    exit()
while True:
   for i in range(2,int(x**0.5)+1):
        if x%i == 0:
            flg += 1
        if i == int(x**0.5) and flg == 0:
            print(x)
            exit()
    x += 1



Fixed submission:
x = int(input())
if x == 2:
    print(2)
    exit()
while True:
    flg = 0
    for i in range(2,int(x**0.5)+1):
        if x%i == 0:
            flg += 1
        if i == int(x**0.5) and flg == 0:
            print(x)
            exit()
    x += 1
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%&2 == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a,b = map(int,input().split())
if a*b%2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
time = 0
while time <= k:
    if i < n and A[i] < B[j]:
        time += A[i]
        i += 1
    elif j < m:
        time += B[j]
        j += 1
    if i >= n and j >= m:
        break
ans = i + j
if time > k:
    ans -= 1
print(ans)

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cum, B_cum = [0], [0]
for i, a in enumerate(A):
    A_cum.append(A_cum[i] + a)
for i in range(m):
    B_cum.append(B_cum[i] + B[i])

ans = 0
best = m
for i in range(n+1):
    a_time = A_cum[i]
    for j in range(best, -1, -1):
        if B_cum[j] <= k - a_time:
            ans = max(ans, i + j)
            break
    best = j
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
time = 0
while time <= k:
    print(i, j)
    if i < n and A[i] < B[j]:
        time += A[i]
        i += 1
    elif j < m:
        time += B[j]
        j += 1
    if i >= n and j >= m:
        break
ans = i + j
if time > k:
    ans -= 1
print(ans)

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cum, B_cum = [0], [0]
for i, a in enumerate(A):
    A_cum.append(A_cum[i] + a)
for i in range(m):
    B_cum.append(B_cum[i] + B[i])

ans = 0
best = m
for i in range(n+1):
    a_time = A_cum[i]
    for j in range(best, -1, -1):
        if B_cum[j] <= k - a_time:
            ans = max(ans, i + j)
            break
    best = j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
A.sort()
dp = [True] * (10 ** 6 + 1)  # 自分以外約数ないならTrue
visited = [False] * (10 ** 6 + 1)
for a in A:
    if visited[a]:
        dp[a] = False
        continue
    visited[a] = True
    i = 2
    while a * i <= 10 ** 6:
        dp[a * i] = False
        i += 1
ans = 0
for a in A:
    ans += dp[a]
print(ans)

Fixed submission:
n = input()
*A, = map(int, input().split())
max_A = max(A)
count = {a:0 for a in A}
for a in A:
    count[a] += 1
is_OK = {a:True for a in A}
for a in A:
    i = 2
    if not is_OK[a]:
        continue
    while a * i < max_A + 1:
        is_OK[a * i] = False
        i += 1
ans = 0
for a in A:
    if count[a] == 1 and is_OK[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
dp = [True] * (10 ** 6 + 1)  # 自分以外約数ないならTrue
visited = [False] * (10 ** 6 + 1)
for a in A:
    if visited[a]:
        dp[a] = False
        continue
    visited[a] = True
    i = 2
    while a * i <= 10 ** 6:
        dp[a * i] = False
        i += 1
ans = 0
for a in A:
    ans += dp[a]
print(ans)

Fixed submission:
n = input()
*A, = map(int, input().split())
max_A = max(A)
count = {a:0 for a in A}
for a in A:
    count[a] += 1
is_OK = {a:True for a in A}
for a in A:
    i = 2
    if not is_OK[a]:
        continue
    while a * i < max_A + 1:
        is_OK[a * i] = False
        i += 1
ans = 0
for a in A:
    if count[a] == 1 and is_OK[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
A = Counter(list(map(int, input().split())))
A_keys = list(A.keys())
A_keys.sort()
for key in A_keys:
    if A[key] == 0:
        continue
    for x in A_keys:
        if x != key and x % key == 0:
            A[x] = 0
ans = 0
for key in A_keys:
    if A[key] > 1 or A[key] == 0:
        continue
    ans += 1
print(ans)

Fixed submission:
n = input()
*A, = map(int, input().split())
max_A = max(A)
count = {a:0 for a in A}
for a in A:
    count[a] += 1
is_OK = {a:True for a in A}
for a in A:
    i = 2
    if not is_OK[a]:
        continue
    while a * i < max_A + 1:
        is_OK[a * i] = False
        i += 1
ans = 0
for a in A:
    if count[a] == 1 and is_OK[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
A = Counter(list(map(int, input().split())))
A_keys = list(A.keys())
A_keys.sort()
for key in A_keys:
    A_keys = [x for x in A_keys if (x == key or x % key != 0)]
ans = 0
for key in A_keys:
    if A[key] > 1:
        continue
    ans += 1
print(ans)

Fixed submission:
n = input()
*A, = map(int, input().split())
max_A = max(A)
count = {a:0 for a in A}
for a in A:
    count[a] += 1
is_OK = {a:True for a in A}
for a in A:
    i = 2
    if not is_OK[a]:
        continue
    while a * i < max_A + 1:
        is_OK[a * i] = False
        i += 1
ans = 0
for a in A:
    if count[a] == 1 and is_OK[a]:
        ans += 1
print(ans)