Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
root = [-1] * n

def r(x):
    if root[x] < 0:
        return x
    else:
        root[x] = r(root[x])
        return root[x]
    

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
    

def size(x):
    x = r(x)
    return -root[x]


for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    unite(x,y)

max_size = 0
for i in range(n):
    max_size = max(size(i), max_size)


print(max_size)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n

def r(x):
    if root[x] < 0:
        return x
    else:
        root[x] = r(root[x])
        return root[x]
    

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
    

def size(x):
    x = r(x)
    return -root[x]


for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    unite(x,y)

"""
max_size = 0
for i in range(n):
    max_size = max(size(i), max_size)
"""
max_size = max(map(size, range(n)))

print(max_size)
n = int(input())
    nStr = str(n)
    if nStr[len(nStr)-1] == '3':
        print('bon')
    elif nStr[len(nStr)-1]  == {'0','1','6','8'}:
        print('pon')
    else:
        print('hon')

### FIXED CODE ###

n = int(input()) % 10
if n == 3:
  print("bon")
elif n in(0,1,6,8):
  print("pon")
else:
  print("hon")
k = int(input())
a, b = map(int, input().split())

if k < a:
  if k >= 2 and b - a >= k - 2:
    print("OK")
elif k == a or k == b:
  print("OK")
elif a < k < b:
  print("OK")
print k == 1:
  print("OK")
else:
  print("NO")


### FIXED CODE ###

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

if b - a >= k - 1:
  print("OK")
elif  k == 1:
  print("OK")
elif b == k or a == k:
  print("OK")
elif b % k == 0 or a % k == 0:
  print("OK")
elif a < k and k < b:
  print("OK")
elif a != b and k == 2:
  print("OK")
elif b < k:
  print("NG")
elif a % k > b % k:
  print("OK")
else:
  print("NG")
A,B,C,D=(int (i) for i in input() split())
print(max(A*B,C*D))

### FIXED CODE ###

A,B,C,D=(int (i) for i in input(). split())
print(max(A*B,C*D))
N = input()

print(N//2 + N % 2)

### FIXED CODE ###

N = int(input())
 
print(N//2 + N % 2)
a = list(input().split()).sort()
print(int(a[0])*10+int(a[1])+int(a[2]))

### FIXED CODE ###

a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])
s = input()
count = 0
for i in range(3):
    if s == 1:
        count = count + 1
return count

### FIXED CODE ###

a = input()
c=0
for i in range(len(a)):
    if a[i] == '1':
        c = c + 1
print(c)
N = int(input())
L = [0]*N
if N==1:
    print(2)
if N==2:
    print(1)
else:

    L[0]=2
    L[1]=1
    for i in range(2,N-1):
        L[i] = L[i-1]+L[i-2]
    print(L[-1])

### FIXED CODE ###

N = int(input())
MAX = 86
L = [0]*(MAX+1)
L[0] = 2
L[1] = 1
for i in range(2, MAX+1):
    L[i] = L[i-1] + L[i-2]
print(L[N])
N, M = map(int,input().split())
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
base = comb(N,2)
base2 = comb(M,2)
print(base+base2)

### FIXED CODE ###

N, M = map(int,input().split())
import math
def comb(n, r):
    if (n-r) >= 0:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else:
        return 0
base = comb(N,2)
base2 = comb(M,2)
print(base+base2)
H = int(input())
total = 1
while H != 1:
  H = H // 2
  total += 1
for i in range(tatal):
  number += 2 ** i
print(number)

### FIXED CODE ###

H = int(input())
def re(a):
  if a == 1:
    return 1
  return 2 * re(a//2) + 1
print(re(H))
x = int(input())
if X == 3 or x == 5 or x == 7:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

old = input()
old = int(old)

if old == 3 or old == 5 or old == 7:
    print('YES')
else:
    print('NO')
from collections import Counter

n, q = map(int, input().split())
s = list(input())
td = [list(input().split()) for _ in range(q)]

if n == 1:
    for t, d in td:
        if s[0] == t:
            print(0)
            exit()
    print(1)
    exit()

def vanish(x):
    for t, d in td:
        if s[x] == t:
            if d == 'L':
                x -= 1
                if x == -1:
                    return -1
            else:
                x += 1
                if x == n:
                    return n
    return x

L = 0
R = n
U = 0
ans = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == -1:
        L = M
    elif ret == n:
        R = M
        U = M
    else:
        R = M

ret = vanish(L)
if ret == -1:
    ans -= L + 1
    U = max(U, L + 1)
else:
    ans -= L

L = U
R = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == n:
        R = M
    else:
        L = M

ret = vanish(L)
if ret == n:
    ans -= n - L
else:
    ans -= n - 1 - L

print(ans)




### FIXED CODE ###

from collections import Counter

n, q = map(int, input().split())
s = list(input())
td = [list(input().split()) for _ in range(q)]

if n == 1:
    for t, d in td:
        if s[0] == t:
            print(0)
            exit()
    print(1)
    exit()

def vanish(x):
    for t, d in td:
        if s[x] == t:
            if d == 'L':
                x -= 1
                if x == -1:
                    return -1
            else:
                x += 1
                if x == n:
                    return n
    return x

L = 0
R = n
U = 0
ans = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == -1:
        L = M
    else:
        R = M

ret = vanish(L)
if ret == -1:
    ans -= L + 1
else:
    ans -= L

L = 0
R = n

while R - L > 1:
    M = (L + R) // 2
    ret = vanish(M)
    if ret == n:
        R = M
    else:
        L = M

ret = vanish(L)
if ret == n:
    ans -= n - L
else:
    ans -= n - 1 - L

print(ans)
import math

n, k = map(int, input().split())
array = [int(x) for x in input().split()]

res = math.gcd(array[0], array[1])


for i in array[2:]:
    res = math.gcd(res, i)
print("POSSIBLE" if k%res==0 and max(array) >= k else "IMPOSSIBLE")

### FIXED CODE ###

import fractions
import sys

n, k = map(int, input().split())
array = [int(x) for x in input().split()]

if n == 1:
    print("POSSIBLE" if max(array) == k else "IMPOSSIBLE")
    sys.exit()

res = fractions.gcd(array[0], array[1])

for i in array[2:]:
    res = fractions.gcd(res, i)
print("POSSIBLE" if k%res==0 and max(array) >= k else "IMPOSSIBLE")
animals = list(map(int, raw_input().split()))
S = animals[0]
W = animals[1]
if(W >= S): print('unsafe')
else: print('safe')

### FIXED CODE ###

animals = list(map(int, raw_input().split()))
S = animals[0]
W = animals[1]
if(W >= S): print('unsafe')
else: print('safe')
n,m,c=map(int,input().split())
b=[0 for i in range(m)]
a=[[0 for i in range(m)]for i in range(n)]
ans=0
count=0
for i in range(m):
  b[i]=int(input())
for i in range(n):
  for j in range(m):
    a[n][j]=int(input())
for i in range(n):
  for j in range(m):
    ans=ans+a[n][j]*b[j]
  if (ans+c)>0:
    count=count+1
print(count)

### FIXED CODE ###

n,m,c=map(int,input().split())
b=[0 for i in range(m)]
a=[[0 for i in range(m)]for i in range(n)]
k=[0 for i in range(m)]
count=0
b=list(map(int,input().split()))
a=[list(map(int,input().split()))for i in range(n)]
for i in range(n):
  ans=0
  for j in range(m):
    ans=ans+(a[i][j]*b[j])
  if (ans+c)>0:
    count=count+1
print(count)
N = int(input())
A = list(map(int, input()split()))
A.sort()

if N % 2 == 0:
    A_neg = A[:N//2]
    A_pos = A[N//2:]
    M = sum(A_pos) - sum(A_neg)
    print(M)
    print(' '.join(map(str, [A[-1], A[0]])))
    num = A[-1] - A[0]
    for i in range(N-2):
        print(' '.join(map(str, [num, A[i+1]])))

if N % 2 == 1:
    A_neg = A[:N//2]
    A_pos = A[N//2:]
    M = sum(A_pos) - sum(A_neg)
    print(M)
    print(' '.join(map(str, [A[-1], A[0]])))
    num = A[-1] - A[0]
    for i in range(N-2):
        print(' '.join(map(str, [num, A[i+1]])))

### FIXED CODE ###

from collections import deque

N = int(input())
A = list(map(int, input().split()))
A.sort()

# A[cut-1] < 0 and A[cut] >= 0
cut = 0
while cut < N and A[cut] < 0:
    cut += 1

if cut == 0:
    M = sum(A[1:]) - A[0]
    print(M)
    pair = [A[0], A[N-1]]
    for i in range(N-2):
        print(' '.join(map(str, pair)))
        pair = [pair[0] - pair[1], A[N-i-2]]
    pair.reverse()
    print(' '.join(map(str, pair)))

elif cut == N:
    M = A[-1] - sum(A[:N-1])
    print(M)
    pair = [A[N-1], A[0]]
    for i in range(N-2):
        print(' '.join(map(str, pair)))
        pair = [pair[0] - pair[1], A[i+1]]
    print(' '.join(map(str, pair)))

else:
    M = sum(A[cut:]) - sum(A[:cut])
    print(M)

    B = deque(A[cut:]) # Aの正の部分
    C = deque(A[:cut]) # Aの負の部分

    while len(B) != 1:
        pair = [C[-1], B[-1]]
        print(' '.join(map(str, pair)))
        b = B.pop()
        C[-1] = C[-1] - b
    
    b = B.pop()

    while len(C) != 0:
        pair = [b, C[0]]
        print(' '.join(map(str, pair)))
        c = C.popleft()
        b = b - c
# -*- coding: utf-8 -*-
from fractions import gcd
def inpl(): return list(map(int, input().split()))
N, M = inpl()
S = input()
T = input()

G = N*M // gcd(N, M)

ans = ["*"]*(G)

x = G//N
y = G//M
for n in range(N):
    ans[n*x] = S[n]

for m in range(M):
    if (ans[m*y] == "*") or (ans[m*y] == T[m]):
        ans[m*y] = T[m]
    else:
        print(-1)
        break
else:
    print(G)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from fractions import gcd
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))
N, M = inpl()

S = input()
T = input()

if N > M:
    N, M = M, N
    S, T = T, S

G = N*M // gcd(N, M)

a = G//N
b = G//M

X = [a*i for i in range(N)]
Y = [b*j for j in range(M)]

for i, x in enumerate(X):
    j = bisect_left(Y, x)
    if j < M and Y[j] == x:
        if S[i] != T[j]:
            print(-1)
            break
else:
    print(G)
from math import gcd

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


def f(n):
    x = n//c
    x += n//d
    lcm = c*d/gcd(c, d)
    x -= n//lcm
    return n-x


print(f(b)-f(a-1))


### FIXED CODE ###

from fractions import gcd

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


def f(n):
    x = n//c
    x += n//d
    lcm = c*d//gcd(c, d)
    x -= n//lcm
    return n-x


print(f(b)-f(a-1))
### ----------------
### ここから
### ----------------

import sys
import math
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n=int(readline())

    to=int(math.sqrt(n))+1
    ans=0
    for i in range(2,to+1):
        if n%i==0:
            j=n//i
            if ans>0:
                ans=min(ans,i+j-2)
            else ans=i+j-2
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
import math
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n=int(readline())

    to=int(math.sqrt(n))+1
    ans=n-1
    for i in range(2,to+1):
        if n%i==0:
            j=n//i
            if ans>0:
                ans=min(ans,i+j-2)
            else:
                ans=i+j-2
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
import itertools

n = input()
array = []
for i in range(n):
  t = input()
  array.append(set())
  for j in range(t):
    tmp = list(map(int, input().split(" ")))
    if tmp[1] == 1:
      array[i].add(tmp[0])
      
allcombs = list(itertools.product([0, 1], repeat=n))
max_val = 0
for comb in allcombs:
  
  if sum(comb) <= max_val:
    continue
  
  for i, j in enumerate(comb):
    broke = False
    if j == 1:
      for k in array[i]:
        if comb[k] == 0:
          broke = True
          break
    if broke:
      break
  if not broke:
    max_val = max(max_val, sum(comb))
   
        
        
print(max_val)

### FIXED CODE ###

import itertools

n = int(input())
array = []
for i in range(n):
    t = int(input())
    array.append([])
    for j in range(t):
        tmp = list(map(int, input().split(" ")))
        array[i].append(tmp)

allcombs = list(itertools.product([0, 1], repeat=n))
max_val = 0
for comb in allcombs:

    if sum(comb) <= max_val:
        continue

    tmp = []
    for i, j in enumerate(comb):
        if j == 1:
            tmp += array[i]
            
    if all([comb[t[0]-1]==t[1] for t in tmp]):
        max_val = max(max_val, sum(comb))

print(max_val)
mport sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'yes'
else:
    print 'no'


### FIXED CODE ###

import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'Yes'
else:
    print 'No'
import math

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

if (b*a*a)/2>=x:
    t=((2*x)/(a*b))
    s=b
    print(math.degrees(math.atan(s/t)))
else:
    s=(2*((a*a*b)-x))/(a**2)
    t=a
    print(90-math.degrees(math.atan(t/s)))

### FIXED CODE ###

import math

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

if a*a*b==x:
    print(0)
elif (b*a*a)/2>=x:
    t=((2*x)/(a*b))
    s=b
    print(math.degrees(math.atan(s/t)))
else:
    s=(2*((a*a*b)-x))/(a**2)
    t=a
    print(90-math.degrees(math.atan(t/s)))
def main():
    s = str(input()).split(' ');
    cnt = []
    for n1 in s:
        cnt.append(0)
        for n2 in s:
            if n1 == n2:
                cnt[-1] += 1
#    print(cnt)
    for i in cnt[:-1]:
        if i == 2:
            print('Yes')
            break
    else:
        print('No')


main()


### FIXED CODE ###

def main():
    s = str(input()).split(' ');
    cnt = []
    for n1 in s:
        cnt.append(0)
        for n2 in s:
            if n1 == n2:
                cnt[-1] += 1
#    print(cnt)
    for i in cnt[:-1]:
        if i == 2:
            print('Yes')
            break
    else:
        print('No')


main()
s = int(input)
if s == 22:
    print('Christmas Eve Eve Eve')
if s == 23:
    print('Christmas Eve Eve')
if s == 24:
    print('Christmas Eve')
if s == 25:
    print('Christmas')


### FIXED CODE ###

s = int(input())
if s == 22:
    print('Christmas Eve Eve Eve')
if s == 23:
    print('Christmas Eve Eve')
if s == 24:
    print('Christmas Eve')
if s == 25:
    print('Christmas')
(x,y,a,b,c),*t=[map(int,t.split())for t in open(0)]
p,q,r=[[0]+sorted(t)[::-1]for t in t]
for i in range(a):p[i+1]+=p[i]
for i in range(b):q[i+1]+=q[i]
for i in range(c):r[i+1]+=r[i]
m=0
for i in range(x+1):
    # i:赤の個数
    # j:赤に変える無の個数
    # k:無の残り
    j=x-i
    k=c-j
    if i>a or j>c:continue
    # 赤の美味しさ総和
    t=p[i]+r[j]
    # 上手いこと緑の美味しさ総和を求める
    # sum(list(map(max,zip(r[j+1:],q)))[:y])
    # ↑みたいなことをしたい
    ok=0
    ng=k+1
    while ng-ok>1:
        mid=(ok+ng)//2
        if r[j+mid]-r[j]>=q[min(b,y)]-q[min(b,y-mid)]:
            ok=mid
        else:
            ng=mid
    t+=q[min(b,y-ok)]+r[j+ok]-r[j]
    if t>m:m=t
print(m)

### FIXED CODE ###

(x,y,a,b,c),*t=[map(int,t.split())for t in open(0)]
s=sorted
p,q,r=map(s,t)
print(sum(s(p[-x:]+q[-y:]+r)[-x-y:]))
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
s = rr()
for i in range(a):
    if int(s[i]) not in range(10):
        print('No')
        exit()
for i in range(b):
    if int(s[a+1+i]) not in range(10):
        print('No')
        exit()
print('Yes')














### FIXED CODE ###

import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
s = rr()
for i in range(a):
    if s[i] not in '0123456789':
        print('No')
        exit()
for i in range(b):
    if s[a+1+i] not in '0123456789':
        print('No')
        exit()
if s[a] != '-':
  print('No')
  exit()
print('Yes')
# coding: utf-8
# Your code here!
import fractions
N=int(input())
A=list(map(int,input().split()))
#def lcm(x,y):
 #   l=x*y/fractions.gcd(x,y)
  #  return l
l=A[0]
for i in range(N-1):
    l=int((A[i+1]*l)/fractions.gcd(A[i+1],l))
ans=0
for i in range(N):
    ans+=l//A[i]
print(ans%(10**9+7))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions
from functools import reduce
N=int(input())
A=list(map(int,input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
l=lcm_list(A)
ans=0

for i in range(N):
    ans+=(l//A[i])
print(ans%(10**9+7))
n=input()
for i in len(n):
    if(n[i]==1):
        n[i]=9
    else:
        n[i]=1
print(int(n))

### FIXED CODE ###

n=input()
for i in n:
    if(i=="1"):
        print(9,end="")
    if(i=="9"):
        print(1,end="")
n = int(input())
a = input()
b = input()
print('Hello World' if n ==1 else int(a)+int(b))

### FIXED CODE ###

n = int(input())
print('Hello World' if n ==1 else int(input())+int(input()))
import math
from decimal import Decimal
X = int(input())
now = 100
year = 0

while True:
    if now >= X:
        break
    #王道
    #now += now // 100

    #Decimal型を経由する方法
    #now = int(now * Decimal("1.01"))
    #now = int(now * round(Decimal(1.01), 2))
    now = now * Decimal(floor(now * 1.01))


    year += 1

print(year)


### FIXED CODE ###

import math
X = int(input())
now = 100

year = 0

while True:
    if now >= X:
        break
    now += now // 100
    year += 1

print(year)
N=int(input())
W=list(map(int,input().split())
s = sum(W)
s2 = s//2

a=[0]
k=[]
sss = 0
for w in W:
    sss += w
    a.append(sss)
    k.append(a[-1] - a[-2])
print(min(k))


### FIXED CODE ###

N=int(input())
W=list(map(int, input().split()))

S = sum(W)
l = 0
r = S

rrr = []
for i in range(N):
    rrr.append(r - l)
    l = sum(W[:i+1])
    r = S - l
print(min(map(abs, (rrr))))
N,K=map(int, input().split())
A=list(map(int, input().split()))

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+nokori < K:
    nokori=(K-startat) % loopcount

tmpPoint=1
for i in range(startat+nokori):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)

### FIXED CODE ###

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

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+loopcount < K:
    nokori=(K-startat) % loopcount
    K=startat+nokori

tmpPoint=1
for i in range(K):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)
string = input()
if string[2]==string[3] && string[4]==string[5]:
    print("Yes")
else: 
    print("No")

### FIXED CODE ###

string = input()
if string[2]==string[3] and string[4]==string[5]:
    print("Yes")
else: 
    print("No")
n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append('end')
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        ll.append(c)
        c = 0
    c+=1
   
count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)

### FIXED CODE ###

n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

for i in range(1, n):
    if l[i] == 0:
        print(0)
        exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append(-4)
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        if l[i] != l[i+1]-1 and l[i+1] > 0:
            print(0)
            exit()
        ll.append(c)
        c = 0
    c+=1

count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)
T=input()
ans=''
i=0
N=len(T)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:
    if i>0 and i<N-1:
      if ans[-1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='D':
        ans=ans+'P'
      elif ans[-1]=='D' and T[i+1]=='P':
        ans=ans+'D'
    elif i==0:
      if T[i+1]=='D':
        ans=ans+'P'
      elif T[i+1]=='?':
        ans=ans+'PD'
        i+=1
      else:
        ans=ans+'D'
    elif i==N-1:
      ans=ans+'D'   
  i+=1
print(ans)

### FIXED CODE ###

T=input()
ans=''
i=0
N=len(T)
if N==1 and T=='?':
  print('D')
  exit(0)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:
    if i>0 and i<N-1:
      if ans[-1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='D':
        ans=ans+'P'
      elif ans[-1]=='D' and T[i+1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='?':
        ans=ans+'PD'
        i+=1
    elif i==0:
      if T[i+1]=='D':
        ans=ans+'P'
      elif T[i+1]=='?':
        ans=ans+'PD'
        i+=1
      else:
        ans=ans+'D'
    elif i==N-1:
      ans=ans+'D'

        
  i+=1
print(ans)
a=int(input())-int(input())
print(['LESS','EQUAL','GREATER'][a>=0 + a==0])

### FIXED CODE ###

def main():
    s1, s2, s3 = list(input().split())
    print(s1[0].upper() + s2[0].upper() + s3[0].upper())

if __name__ == "__main__":
    main()
a = input()
b = input()

ans1 = a * b
ans2 = 2 * ( a + b )

print ans1 ,
print ans2

### FIXED CODE ###

a,b = map( int , raw_input().split() )

ans1 = a * b
ans2 = 2 * ( a + b )

print ans1 , ans2
S = input()
a,b= S.find('C'),S.find('F')
print('Yes') if a>0 and b>0 and> a<b else print('No')

### FIXED CODE ###

S = input()
a= S.find('C')
b= S.find('F',a+1)
print('Yes') if a>=0 and b>=0 and a<b else print('No')
from collections import deque
N, M = map(int, input().split())
A = deque()
[A.append(int(input())) for _ in range(M)]

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    if len(A) >= 2:
        b = A[1]

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])


### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
A = deque()
[A.append(int(input())) for _ in range(M)]

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    else:
        a = 0
    if len(A) >= 2:
        b = A[1]
    else:
        b = 0

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])