Harryxun/stf_run huggingface dataset:
import bisect
import sys
input=sys.stdin.readline
k=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
i=0
n=k
while i<n:
    s=l[-1]
    b=1
    while b<=s:
        b*=2
    g=b-s
    p=bisect.bisect_left(l,g)
    if p==len(l):
        l.pop(-1)
        i+=1
        continue
    else:
        if l[p]==g:
            l.pop(-1)
            l.pop(p)
            i+=2
            ans+=1
        else:
            l.pop(-1)
            i+=1
print(ans)


### FIXED CODE ###

from bisect import bisect_left
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while 2**t<=A[i]:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
flag=[0]*N
for i in range(N-1,0,-1):
    if flag[i]==1:
        continue
    flag[i]=1
    b=bisect_left(A,B[i])
    if A[b]==B[i] and flag[b]==0:
        flag[i]=1
        flag[b]=1
        A[b]-=1
        count+=1
print(count)
import math
import itertools
import numpy as np

t = int(input())
a=list(map(int, input().split()))
num = 0
for i in range(t):
    if i%2 == 0 and g_all[i]%2 == 1:
        num+=1
print(num)


### FIXED CODE ###

import math
import itertools
import numpy as np

t = int(input())
a=list(map(int, input().split()))
num = 0
for i in range(t):
    if i%2 == 0 and a[i]%2 == 1:
        num+=1
print(num)
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = a * b
if c%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
s = input()
ans = 0
if s[0]=="1":
    ans  += 1
if s[1]=="1":
    ans  += 1
if s[2]=="1"
    ans += 1
print(ans)

### FIXED CODE ###

s = input()
ans = 0
if s[0]=="1":
    ans += 1
    
if s[1]=="1":
    ans += 1

if s[2]=="1":
    ans += 1

print(ans)
def shuffle(str, m):
    return str[m:] + str[0:m]

if __name__ == '__main__':
    while True:
        str = input()
        if str == '-':
            break
        m = int(input())
        for _ in range(m):
            str = shuffle(str, int(input()))

        print(str)



### FIXED CODE ###

def card_game(pairs):
    points = [0, 0]
    for pair in pairs:
        if (pair[0] > pair[1]):
            points[0] += 3
        elif (pair[0] < pair[1]):
            points[1] += 3
        else:
            points[0] += 1
            points[1] += 1

    return points

if __name__ == '__main__':
    n = int(input())
    pairs = []
    for _ in range(n):
        pairs.append(input().split())

    points = card_game(pairs)
    print(' '.join(map(str, points)))
#!/usr/bin/env python3

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

a = [int(input()) for _ in range(m)]

mod = 1000000007

a_2, a_1 = 1, 0

if a[0] == 1:
    a_1 = 0
    index = 1
else:
    a_1 = 1
    index = 0

for i in range(2, n+1):
    if index < len(a):
        if i == a[index]:
            a_now = 0
            index += 1
            a_1, a_2 = a_now, a_1
            continue

    a_now = (a_1+a_2)
    # print(a_now)
    a_1, a_2 = a_now, a_1
    # print(a_now)
print(a_now % mod)

# 0, 1, 2, 3, 4, 5, 6

# 1, 1, 2, 0, 2, 2, 4


### FIXED CODE ###

#!/usr/bin/env python3

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

if m != 0:
    a = [int(input()) for _ in range(m)]
else:
    a = [-1]

mod = 1000000007

if n == 1:
    print(1)
    exit()
elif n == 2:
    if a[0] == 1:
        print(1)
    else:
        print(2)
    exit()


if a[0] == 1:
    a_2, a_1 = 1, 0
    index = 1
else:
    a_2, a_1 = 1, 1
    index = 0

for i in range(2, n+1):
    if index < len(a):
        if i == a[index]:
            a_now = 0
            index += 1
            a_1, a_2 = a_now, a_1
            continue

    a_now = (a_1+a_2) % mod
    # print(a_now)
    a_1, a_2 = a_now, a_1
    # print(a_now)
print(a_now % mod)

# 0, 1, 2, 3, 4, 5, 6

# 1, 1, 2, 0, 2, 2, 4
import sys

import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(" ")]

total = 0
n = readInt()
aa = []
for i in range(n):
    v = readInt()
    aa.append(v)
    total += v

memo = {}
def dfs(a, b, c, i):
    if i == len(aa):
        ret = 1 if c < a + b else 0
        memo[(a, b, c)] = ret
        return ret
    if total < (2 * c)
        memo[(a, b, c)] = 0
        return 0
    if (a, b, c) in memo:
        return memo[(a, b, c)]

    ret = 0
    v0 = sorted([a + aa[i], b, c])
    ret = (ret + dfs(v0[0], v0[1], v0[2], i + 1)) % 998244353

    v1 = sorted([a, b + aa[i], c])
    ret = (ret + dfs(v1[0], v1[1], v1[2], i + 1)) % 998244353

    v2 = sorted([a, b, c + aa[i]])
    ret = (ret + dfs(v2[0], v2[1], v2[2], i + 1)) % 998244353

    memo[(a, b, c)] = ret
    return ret

print(dfs(0, 0, 0, 0))

### FIXED CODE ###

import sys

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(" ")]

total = 0
ret = 1
n = readInt()
aa = []
for i in range(n):
    v = readInt()
    aa.append(v)
    total += v
    ret *= 3


L = (n * max(aa) + 1)
memo = [-1] * ((n+1) * L * 2)
def dfs(i, c):
    key = (i * L * 2) + 2 * c
    if 0 <= memo[key]:
        return memo[key: key+2]

    if i == n:
        memo[key + 0] = 3 if total <= (2 * c) else 0
        memo[key + 1] = 3 if total == (2 * c) else 0
        return memo[key: key + 2]

    v0 = dfs(i + 1, c)
    v1 = dfs(i + 1, c + aa[i])

    memo[key + 0] = (2 * v0[0] + v1[0]) % 998244353
    memo[key + 1] = (v0[1] + v1[1]) % 998244353
    return memo[key: key + 2]

a, b = dfs(0, 0)
ret = (ret - a + b) % 998244353
print(ret)
a, b, c = map(int, input().split())
if a < b:
	if b < c:
		print('Yes')
		else:
			print('No')
else:
	print('No')

### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b:
	if b < c:
		print('Yes')
	else:
		print('No')
else:
	print('No')
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = 10 ** 20


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n=I()
G=[[]for _ in range(n)]
for _ in range(n-1):
    a,b=LI()
    G[a]+=[b]
    G[b]+=[a]

visited=[0]*n
a=[0]*n
visited[0]=1
def f(x):
    ret=0
    cnt=0
    for v in G[x]:
        if visited[v]:
            continue
        visited[v] = 1
        r=f(v)
        ret+=r
        if r==0:
            cnt+=1
    if cnt>1:
        ret+=cnt-1
    a[x]=ret
    return ret

ans=f(0)
if len(G[0]) == 1:
    ans+=1

print(ans)


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = 10 ** 20
sys.setrecursionlimit(2147483647)

def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n=I()
G=[[]for _ in range(n)]
r=-1
for _ in range(n-1):
    a,b=LI()
    G[a]+=[b]
    G[b]+=[a]
    if len(G[a])>2:
        r=a
    if len(G[b]) > 2:
        r=b

visited=[0]*n
visited[r]=1
def f(x):
    ret=0
    cnt=0
    for v in G[x]:
        if visited[v]:
            continue
        visited[v] = 1
        r=f(v)
        ret+=r
        if r==0:
            cnt+=1
    if cnt>1:
        ret+=cnt-1
    return ret

print(1 if r == -1 else f(r))
import math

k = int(input())+1

for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1,k):
            sum += math.gcd(temp,x)


print(sum)

### FIXED CODE ###

import math
sum = 0
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)
print(sum)
n=int(input())
li=list(map(int,input().split()))

if 0 in li:
  print(0)
  exit
else:
  ans=1
  for i in li:
    ans*=i
    if ans>10**18:
        print(-1)
        exit
    else:
        continue
    
print(ans)


### FIXED CODE ###

import sys
n=int(input())
li=list(map(int,input().split()))
li.sort()
if li[0]==0:
  print(0)
  sys.exit()
else:
  ans=1
  for i in li:
    ans*=i
    if ans>1000000000000000000:
        print(-1)
        sys.exit()
    else:
        continue
    
  if ans>1000000000000000000:
      print(-1)
  else:
      print(ans)
W, H, x, y, r = map(int, raw_input().split))
 
if 0 <= x-r and x <= W-r and 0 <= y-r and y <= H-r:
 print 'Yes'
else:
 print 'No'

### FIXED CODE ###

W, H, x, y, r = map(int, raw_input().split())
 
if r <= x and x + r <= W and r <= y and y + r <= H:
 print 'Yes'
else:
 print 'No'
import math
r = int(input(""))
S = r * r * math.pi
l = 2 * math.pi * r
print("{0:.5f}".format(S, l))

### FIXED CODE ###

import math
r = float(input(""))
S = r * r * math.pi
l = 2 * math.pi * r
print("{0:.5f} {1:.5f}".format(S, l))
n,k=map(int(input().split()))
l=list(map(int,input().split()))
l1 = sorted(l, reverse=True)
s=0
for i in range(k):
    s+=l1[i]
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l1 = sorted(l, reverse=True)
s=0
for i in range(k):
    s+=l1[i]
print(s)
参りました

### FIXED CODE ###

#103a
a=list(map(int,input().split()))
print(max(a)-min(a))
n=input()
length=len(n)
rs=0
for i in range(1,length-2):
    num=0
    start=0
    end=length-i
    gap=length-end
    for j in range(i):
        num=int(n[start+j:end+1+j])
        if num%2019==0:
            rs+=1
print(rs)

### FIXED CODE ###

def compare():
    a,b=map(int,input().split())

    if a <= b:
        print("unsafe")
    else:
        print("safe")


compare()
X = int(input())
print 10 - X//200

### FIXED CODE ###

X = int(input())
print(10 - X//200)
from collections import defaultdict

def search(tree, target):
    subs = [target]
    for node in tree[target]:
        subs += search(tree, node)
    return subs
N, Q = map(int, input().split())

tree = defaultdict(list)
parent = [None] * N
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] += [b]

subs =[None] * (N + 1)
for i in range(1, N + 1):
    subs[i] = search(tree, i)

values = [0] * (N + 1)
for i in range(Q):
    p, q = map(int, input().split())
    for j in subs[p]:
        values[j] += q

values = map(str, values[1:])
print(" ".join(values))

### FIXED CODE ###

from collections import defaultdict

N, Q = map(int, input().split())

parent = defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    parent[b] = a

values = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    values[p] += x


for i in range(2, N + 1):
    values[i] += values[parent[i]]
values = map(str, values[1:])
print(" ".join(values))
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(1,100)]
elif d == 1:
    l = [i for i in range(100, 10000, 100)]
else:
    l = [i for i in range(10000, 1000000, 10000)]
print(l[n])

### FIXED CODE ###

d,n = map(int, input().split())
r = 100 ** d
l = [i for i in range(0, r*100, r)]
if n == 100:
    print(100 ** (d + 1) + 100 ** d)
else:
    print(l[n])
S = input()
T = input()

for i in range(len(S)-1):
    x = S[-1]
    S = list(S)
    S.pop(-1)
    S.insert(0,x)
    S = ''.join(S)
    if S == T:
        print('Yes')
        exit()

print('No')

### FIXED CODE ###

A,B,C = map(int, input().split())
num_list = [A,B,C]
num_sorted_list = sorted(num_list)
print(num_sorted_list[1]-num_sorted_list[0] + num_sorted_list[2]-num_sorted_list[1])
N = int(input())
XU = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  if XU[i][1] == 'JPN':
    ans += XU[i][0]
  else:
    ans += XU[i][0] * (380000.0)
print(ans)


### FIXED CODE ###

N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)
n = int (input())
resilt =0
for i in range(1,n):
  result =result +i
print result

### FIXED CODE ###

n = int (input())
result =0
for i in range(1,n+1):
    result =result +i
print (result)
n = int(input())
a = map(int, input().split())

ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in range(reversed(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break

for op in reversed(ops):
  print(op)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in reversed(range(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break
 
for op in reversed(ops):
  print(op)
S = input()
N = len(N)
ans = "x" * N
print(ans)

### FIXED CODE ###

import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    N = len(S)
    ans = "x" * N

    print(ans)


if __name__ == "__main__":
    main()
N, M = map(int, input().split())

sys.setrecursionlimit(10**9)

vertices = [[] for i in range(N+1)]
dp = [-1] * (N+1)

for _ in range(M):
    fro, to = map(int, input().split())
    vertices[fro].append(to)

def dfs(i):
    
    if dp[i] != -1:
        return dp[i]
    
    temp = 0
    for vertex in vertices[i]:
        temp = max(temp, dfs(vertex)+1)
        
    dp[i] = temp
    return temp

for i in range(1,N+1):
    dfs(i)
    
print(max(dp))

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)

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

g = [[] for i in range(n+1)]

dp = [-1] * (n+1)
for _ in range(m):
    v1 , v2 = map(int,input().split())
    g[v1].append(v2)
    
# finding longest path for vertice i
def dfs(i):
    if dp[i]!=-1:
        return dp[i]
    temp = 0
    for nv in g[i]:
        temp = max(temp, dfs(nv)+1)

    dp[i]=temp
    return temp
  
# finding overall longest path  
res = 0  
for i in range(1,n+1):
    res = max(res, dfs(i))
print(res)
n = int(input())
h = list(map(int,input().split()))


for i in range(n-1):
  if h[i] == h[i+1]+1:
    j = i
    p = 1
    break
  elif h[i] >= h[i+1] + 2:
    p = 2
    break
  elif h[i] <= h[i+1]:
    j = 0
    p = 3
    
if min(h[j:]) + 2 <= h[j] or p == 2:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
d = [1]+[0]*(n-1)

for i in range(n-1):
  if h[i] >= 2+ h[i+1]:
    print('No')
    exit()
  if d[i] == 1 and h[i] <= h[i+1]:
    d[i+1] = 1
  elif d[i] == 0:
    if h[i] +1 <=h[i+1]:
      d[i+1] = 1
    elif h[i] -1 == h[i+1]:
      print('No')
      exit()
      
print('Yes')
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
total = 0
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, N + 1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

for i in range(n-k+1):
    for j in range(i+k-1,n):
        total += cmb(j-i-1,k-2,mod)*(a[j]-a[i])
        total %= mod
print(total)

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
total = 0
def cmb(n, r, mod):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**5
g1 = [1,1]
g2 = [1,1]
inverse = [0,1]

for i in range(2, N + 1):
    g1.append((g1[-1]*i) % mod)
    inverse.append((-inverse[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1]*inverse[-1]) % mod)

for i in range(n-k+1):
    total += cmb(n-i-1,k-1,mod)*(a[n-i-1]-a[i])
    total %= mod
print(total)
ac=0
wa=0
tle=0
re=0
n=int(input())
for _ in range(n):
  x=input()
  if x=='AC':
    ac+=1
  elif x=='WA':
    wa+=1
  elif x=='TLE':
    tle+=1
  elif x=='RE':
    RE+=1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

### FIXED CODE ###

ac=0
wa=0
tle=0
re=0
n=int(input())
for _ in range(n):
  x=input()
  if x=='AC':
    ac+=1
  elif x=='WA':
    wa+=1
  elif x=='TLE':
    tle+=1
  elif x=='RE':
    re+=1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)
n = int(input())
list1 = []
list2 = []
for i in range(0,n):
    list1.append(int(input()))

for i in range(0,len(list1)):
    if not(list1[1] in list2):
        list2.append(list1.pop(i))
print(len(list2))

### FIXED CODE ###

n = int(input())
list1 = []
list2 = []
for i in range(0,n):
    list1.append(int(input()))

for i in range(0,len(list1)):
    if not(list1[i] in list2):
        list2.append(list1[i])
print(len(list2))
n,k=map(int,input().split())
s=input()
ans=0
cnt=0
for i in range(n-1):
  if a[i]==a[i+1]:
    ans+=1
  if a[i]!=a[i+1]:
    cnt+=1
ans=min(n-1,ans+min(cnt,k)*2)
print(ans)
    

### FIXED CODE ###

n,k=map(int,input().split())
a=input()
ans=0
cnt=0
for i in range(n-1):
  if a[i]==a[i+1]:
    ans+=1
  if a[i]!=a[i+1]:
    cnt+=1
ans=min(n-1,ans+min(cnt,k)*2)
print(ans)
N,K = map(int,input().split())

S = [0 for i in range(N)]
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(d):
    S[d]+=1
ans = 0
for i in range(N):
  if S[i]==0:
    ans+=1
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())

S = [0 for i in range(N)]

for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(d):
    S[A[j]-1]+=1
    
ans = 0
for i in range(N):
  if S[i]==0:
    ans+=1
    
print(ans)
import numpy as np
N,M = map(int,input().split())
nodes = [[False]* N for j in range(N)]
for m in range(M):
	a,b = map(int,input().split())
	nodes[a-1][b-1] = True
	nodes[b-1][a-1] = True
mat1 = np.matrix(nodes,dtype=bool)
mat2 = mat1.copy()
A = [mat1.tolist()]
for i in range(10):
	mat2 = mat2.dot(mat1)
	a = mat2.tolist()
	A.append(a)
'''
for ai,a in enumerate(A):
	for k in a:
		print(k)
	print(ai)
'''
Colour = [0] * N
Q = int(input())
for q in range(Q):
	v,d,c = map(int,input().split())
	Colour[v - 1] = c
	if d == 0:
		continue
	for n in range(N):
		if d == 1 :
			if (not A[0][v - 1][n]):
				continue
			else:
				Colour[n] = c
		else:
			if A[d - 1][v - 1][n] or A[d - 2][v - 1][n] > 0:
				Colour[n] = c
	
for C in Colour:
	print(C)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
A = A[N:]
B = A[::2]
print(sum(B))
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    N = K - A - B
    print(A - N)

### FIXED CODE ###

A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)
T = str(input())
T=list(T)
if not T[0]=='?':
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)-1]=='?':
        T[len(T)]='D'
else:
    T[0]='D'
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)]=='?':
        T[len(T)]='D'
print(','.join(T))

### FIXED CODE ###

T = str(input())
T=list(T)
if not T[0]=='?':
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)-1]=='?':
        T[len(T)-1]='D'
else:
    T[0]='D'
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)-1]=='?':
        T[len(T)-1]='D'

print(''.join(T))
n=int(input())
h=[map(int,input().split())]
dp=[0]*n
for i in range(1,n):
  if h[i-1]>=h[i]:
    dp[i]=dp[i-1]+1
print(max(dp))


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  if h[i-1]>=h[i]:
    dp[i]=dp[i-1]+1
print(max(dp))
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 < 4.0+1.0e-12 else False

def largestGroup(mtrx,num):
	mx = 1
	ls = [num]
	for i in mtrx[num]:
		if i == num:
			continue
		m = youKnow(mtrx,ls,i)
		mx = max(mx,m)
	return mx

def youKnow(mtrx,ls,num):
	mx = len(ls)
	if set(ls) <= set(mtrx[num]):
		if num not in ls:
			ls.append(num)
		for i in list(set(mtrx[num])-set(ls)):
			m = youKnow(mtrx,ls,i)
			mx = max(mx,m)
	return mx

max_over = 0
while True:
	n = int(raw_input())
	if n == 0: break
	seals = [map(float, raw_input().split(",")) for i in range(n)]

	overs = []
	for i in range(n):
		over = []
		for j in range(n):
			if isOver(seals[i],seals[j]):
				over.append(j)
		overs.append(over)
		
	ref = [i for i in range(n)]
	for i in ref:
		num_over = largestGroup(overs,i)
		for j in overs[i]:
			ref.remove(j)
		if num_over > max_over:
			max_over = num_over
	print max_over

### FIXED CODE ###

def isOver(array,x,y):
	return True if (array[0]-x)**2+(array[1]-y)**2 <= 1.01 else False
	
while True:
    mx = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
    x = 0
    while x < 10.0:
    	y = 0.0
    	while y < 10.0:
    		num = 0
    		for seal in seals:
    			if isOver(seal,x,y):
    				num += 1
    		mx = max(mx,num)
    		y += 0.1
        x += 0.1
    print mx
n,k=map(int,input().split())
ans=0
v=list(map(int,input().split()))
for i in range(min(n,k+1)):
    for j in range(min(n-i,k-i+1)):
        if j!=0
            tmp=v[:i]+v[-j:]
        else:
            tmp=v[:i]
        tmp.sort()
        t=sum(tmp)
        for d in range(min(k-i-j,len(tmp))):
            if tmp[d]<0:
                t-=tmp[d]
        if t>ans:
            ans=t
print(ans)
    

### FIXED CODE ###

n,k=map(int,input().split())
ans=0
v=list(map(int,input().split()))
for i in range(min(n,k+1)):
    for j in range(min(n-i+1,k-i+1)):
        if j!=0:
            tmp=v[:i]+v[-j:]
        else:
            tmp=v[:i]
        tmp.sort()
        t=sum(tmp)
        for d in range(min(k-i-j,len(tmp))):
            if tmp[d]<0:
                t-=tmp[d]
        if t>ans:
            ans=t
print(ans)
a = int(input())
b = int(input())
c = a + b

if c == 3:
    print("3")
elif c == 4:
    print("2")
elif c == 5:
    print*("1")

### FIXED CODE ###

a = int(input())
b = int(input())
c = a + b
print(6-c)
import math

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    print((A * B) // math.gcd(A, B))


### FIXED CODE ###

import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)
N = int(input())
A = list(map(int,input().split()))
count = 0
K = True

while K:
    for i in range(N):
        if A[i] % 2 ==1:
            K = False
        A[i] / 2

    if not K:
            break
    count += 1

print(count)

### FIXED CODE ###

s1s2s3 = input()

print(s1s2s3.count('1'))
n=int(input())
l=list(map(int,input().split()))
count=n
l=sorted(l)
newl=[]
for i  in l:
    flag=True
    for j in newl:
        if i%j==0:
            flag=False
            count-=1
            break
    if flag==True:
        newl.append(i)
if l[0]==l[1]:
        count-=1
print(count)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
counter=[0]*(10**6+1)
l=sorted(l)
for i in l:
    counter[i]+=1
    if counter[i]<2:
        for j in range(2*i,10**6+1,i):
            counter[j]+=2
print(counter.count(1))