peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import collections
n=int(input())
S=[]

for i in range(n):
    s=list(str(input()))
    cc=collections.Counter(s)
    S.append(cc)
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','m','o','p','q','r','s','t','u','v','w','x','y','z']

ans=[]
for lets in alphabet:
    nin=10**5
    for i in range(n):
        nin=min(nin,S[i][lets])
    if nin!=10**5:
        for j in range(nin):
            ans.append(lets)

print("".join(ans))
# Judge status: Accepted

n=int(input())
s=list(input())
temp=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(s)):
    s[i]=temp[((temp.index(s[i]))+n)%26]
print(*s,sep='')
# Judge status: Accepted
import itertools
n = int(input())
dic = {}
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      f_xyz = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if f_xyz in dic:
        dic[f_xyz] += 1
      else:
        dic[f_xyz] = 1
for i in range(1, n+1):
  if i in dic:
    print(dic[i])
  else:
    print(0)
# Judge status: Wrong Answer
from sys import stdin

# S,T = stdin.readline().rstrip().split()
H,N = [int(x) for x in stdin.readline().rstrip().split()]
s = list(map(int,input().split()))

if H>sum(s):
  print("NO")
else :
  print("YES")
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
d = [A[i+1]-A[i] for i in range(N-1)]
d.append(K-A[-1]+A[0])
print(sum(d)-max(d))
# Judge status: Accepted
N = int(input())
lis = [int(input()) for _ in range(N)]
lis_c = lis.copy()

mx1 = max(lis_c)
lis_c.remove(mx1)
mx2 = max(lis_c)

for i in lis:
    if i == mx1:
        print(mx2)
    else:
        print(mx1)
# Judge status: Accepted
import sys
from bisect import bisect_left, bisect_right

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

l = [1, 2, 4, 8, 16, 32, 64]

if N >= 64:
    print(64)
elif N >=32:
     print(32)
elif N >=16:
     print(16)
elif N >=8:
     print(8)
elif N >=4:
     print(4)
elif N >=2:
     print(2)
elif N ==1:
     print(1)
# Judge status: Accepted
n, m = map(int, input().split())
c = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    c[a - 1] += 1
    c[b - 1] += 1
for i in c:
    print(i)
# Judge status: Accepted
n = int(input())
alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list = [[] for _ in range(26)]
ans = []

for i in range(n):
    s = input()
    for j in range(26):
        list[j].append(s.count(alp[j]))

for i in range(26):
    for j in range(min(list[i])):
        ans.append(alp[i])

ans = sorted(ans)

for i in ans:
    print(i, end = '')
# Judge status: Accepted
n,d = map(int,input().split())
dl = []

for x in range(n):
    dd = []
    d1,d2 = map(int,input().split())
    dd.append(d1)
    dd.append(d2)
    dl.append(dd)

count = 0
for dd in dl:
    if (dd[0]**2 + dd[1]**2) <= d**2:
        count += 1
    
print(count)
# Judge status: Accepted
a,b = map(int,input().split())
if a<=8 and b<=8: print("Yay!")
else: print(":(")
# Judge status: Accepted
a, b = map(int, input().split())
ans = a if a <= b else a - 1
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())

if a < 0 and b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")

elif a <= 0 and b >= 0:
    print("Zero")

else:
    print("Positive")
# Judge status: Accepted
S = str(input())

chr = 'abcdefghijklmnopqrstuvwxyz'

res =""

for i in range(len(chr)):
    
    if chr[i] not in S:
        res = chr[i]
        break
    
if res =="":
    print("None")
else:
    print(res)
# Judge status: Wrong Answer
n=int(input())
s,p=10**9+1,10**9+1
t,q=-1,-1

for i in range(n):
  x,y=map(int,input().split())
  s=min(s,x+y)
  t=max(t,x+y)
  p=min(p,x-y)
  q=max(q,x-y)
  
print(max(t-s,q-p))
# Judge status: Wrong Answer
w,a,b=map(int,input().split())
print(min(abs(a-b)-w,0))
# Judge status: Wrong Answer
def main():
  S = input()
  while len(S)>=5:
    if len(S)>=7 and S[:-7]=="dreamer":
      S = S[-7:]
      continue
    
    elif len(S)>=6 and S[:-6]=="eraser":
      S = S[-6:]
      continue
    elif S[:-5]=="dream" or S[:-5]=="erase":
      S = S[-5:]
      continue
    else:
      break
  if len(S)==0:
    print('Yes')
  else:
    print('No')
    
main()
# Judge status: Accepted
#abc116 b
n=int(input())
a=[]
a.append(n)
i=0
while True:
    if a[i]%2==0:
        x=int(a[i]/2)
        if x in a:
            ans=i+1
            break
        else:
            a.append(x)
    else:
        x=a[i]*3+1
        if x in a:
            ans=i+1
            break
        else:
            a.append(x)
    i+=1
print(ans+1)
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())
if k <= a: 
  print(k)
if a < k <= b:
  print(a)
if b < k <= c:
  print(a+(-1)*(k-a-b))
# Judge status: Accepted
x = int(input())
for i in range(1,9):
  if x >= 200*(10-i):
    print(i)
    break
# Judge status: Wrong Answer
n,m=map(int,input().split())
li=[list(map(int,input().split())) for _ in range(m)]
box=[[1,0]]
for i in range(n-1):
    box.append([0,1])
for x,y in li:
    tmp=box[x-1].copy()
    box[x-1][0]-=tmp[0]/(tmp[0]+tmp[1])
    box[x-1][1]-=tmp[1]/(tmp[0]+tmp[1])
    box[y-1][0]+=tmp[0]/(tmp[0]+tmp[1])
    box[y-1][1]+=tmp[1]/(tmp[0]+tmp[1])
ans=0
for i in box:
    if i[0]>0.01:
        ans+=1
print(ans)
# Judge status: Accepted
import math

N_inu, M_saru = map(int, input().split())

d = abs(N_inu - M_saru)

if (d > 1):
    ans = 0

else:
    if (d == 1):
        ans = math.factorial(N_inu) * math.factorial(M_saru)
    else:
        ans = 2 * math.factorial(N_inu) * math.factorial(M_saru)

ans = ans % (10 ** 9 + 7)

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

def isOk(x):
    cnt = 0
    for a in A:
        cnt += (a - 1) // x
    return cnt <= K

ok = max(A)
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if isOk(mid):
        ok = mid
    else:
        ng = mid

print(ok)
# Judge status: Accepted
Q,H,S,D = map(int, input().split())
N = int(input())

onelit = min((4*Q),(2*H),(S))

pattern1 = N * onelit
pattern2 = ((N//2)*D) + ((N%2) * onelit)

print(min(pattern1, pattern2))
# Judge status: Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
a = list(map(int,input().split()))
h = Decimal(str(sum(a)/n)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
a = list(map(lambda x:(x-h)**2,a))
print(sum(a))
# Judge status: Accepted
r,g,b=[x for x in input().rstrip().split()]

ans=int(r+g+b)
if ans%4==0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
S = list(input())
n = int(input())
s = []
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
for i in range(n):
    if s[i][0] == "1":
        S.reverse()
    else:
        if s[i][1] == "1":
            S.insert(0,s[i][2])
        else:
            S.append(s[i][2])

print("".join(S))
# Judge status: Accepted
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    payment = N // 1000 + 1
    change = payment*1000 - N
    print(change)
# Judge status: Wrong Answer
S=input()
ans = "WA"
if S[0] == "A" and ("a" <= S[1] <= "z") and ("a" <= S[-1] <= "z"):
  s0 = S[2:-2]
  for i in range(len(s0)):
    if s0[i] == "C":
      if ans == "AC":
        ans = "NG"
      else:
        ans = "AC"

print(ans)
# Judge status: Wrong Answer
import sys
s = sys.stdin.readline()
flag = True
i = 0
while i < len(s):
  if i % 2:
    if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
      flag = False
      break
  else:
    if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
      flag = False
      break
  i += 1
if flag:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
x = math.pi
r = int(input())
print(2*x*r)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print("No" if a<b and b<c or c<b and b<a else "Yes")
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline
A,B,C,K = list(map(int, input().split()))
a=1
b=0
c=-1
count =K
point =0
if A< K:
    point +=A
    count -=A
    K -=A
else:
    point +=K
    count =0
    print(point)
    exit()

if B < count:
    point +=0
    count -=B
    K -=B
else:
    point +=0
    count =0
    print(point)
    exit()    

if C <= count:
    point -=C
else:
    point -=count
    count =0
    
print(point)
# Judge status: Accepted
S = input()
acgt = ['A', 'C', 'G', 'T']

c = 0
ans = 0

for i in S:
    if i in acgt:
        c += 1
        ans = max(ans, c)
    else:
        c = 0

print(ans)
# Judge status: Wrong Answer
K = int(input())
S = str(input())

if len(S) < K :
    print(S)
else:
    print(S[0:K+1]+'...')
# Judge status: Accepted
n = input()

if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
d={'r':p,'s':r,'p':s}
#r:グー、s:チョキ、p:パー
ans=t.count('r')*d['r']+t.count('s')*d['s']+t.count('p')*d['p']
#print(ans)
for i in range(k,n):
  if t[i]==t[i-k]:
    ans-=d[t[i]]
    t[i]='x'
print(ans)
# Judge status: Accepted
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p_l = list(map(int, input().split()))
    p_x_l = [ x-i for i in p_l ]
    for i in range(101):
        if i not in p_x_l:
            print(x-i)
            break
        if -i not in p_x_l:
            print(x+i)
            break
# Judge status: Wrong Answer
#!/usr/bin/env python3

def main():
    S = int(input())

    x1, y1 = 0, 0
    x2, y2 = 1000000000, 1

    x3 = (x2 - S % x2) % x2
    y3 = (S + x3) / x2

    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
q = int(input())

ans = 0
for _ in range(q):
    b, c = map(int, input().split())
    if b in A:
        A = [c if a==b else a for a in A]
        ans = sum(A)
    print(ans)
# Judge status: Wrong Answer
a=input()
s=input()
a=int(a)
if a>=3200:
    print(a)
    print(s)
else:
    print('red')
# Judge status: Accepted
a = input()
print('a' if a.islower() == True else 'A')
# Judge status: Wrong Answer
N=int(input())

DP=[0]*N

h = list(map(int, input().split()))
DP[0] = max(h)
pidx = h.index(max(h))

for i in range(1,N):
    h=list(map(int,input().split()))
    h[pidx]=0
    DP[i]=DP[i-1]+max(h)
    pidx=h.index(max(h))

print(DP[N-1])
# Judge status: Wrong Answer
def main():
    w, h, n = map(int, input().split())
    a = [0, 0]
    b = [w, h]
    for _ in range(n):
        x, y, t = map(int, input().split())
        if t == 1:
            a[0] = x
        elif t == 2:
            b[0] = x
        elif t == 3:
            a[1] = y
        else:
            b[1] = y
    print(max(b[0] - a[0], 0) * max(b[1] - a[1], 0))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
n, d = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
    if math.sqrt(xy[i][0] ** 2 + xy[i][1] ** 2) <= d:
        ans += 1
print(ans)
# Judge status: Accepted
from fractions import gcd
from functools import reduce
n,x=map(int,input().split())
num=[abs(int(i)-x) for i in input().split() if abs(int(i)-x)!=0]
print(reduce(gcd,num))
# Judge status: Accepted
c = [list(map(int,input().split())) for i in range(3)]
for i in range(2):
    if (c[i+1][0]-c[i][0]) == (c[i+1][1]-c[i][1]) == (c[i+1][2]-c[i][2]):
        continue
    else:
        print('No')
        exit(0)
for j in range(2):
    if (c[0][j+1]-c[0][j]) == (c[1][j+1]-c[1][j]) == (c[2][j+1]-c[2][j]):
        continue
    else:
        print('No')
        exit(0)
print('Yes')
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())

if N%2:
    if D/2 < min(Q*4, H*2, S):
        print(N//2*D+(N-2*(N//2))*min(Q*4, H*2, S))
    else:
        print(N*min(Q*4, H*2, S))
else:
    print(int(N*min(Q*4, H*2, S, D/2)))
# Judge status: Accepted
A,B,K=map(int,input().split())
if B-A>200:
    k=range(A,A+K)
    l=range(B-K+1,B+1)
    for i in k:
        print(i)
    for i in l:
        print(i)
else:
    s=range(A,B+1)
    t=[x for x in s if A<=x<=A+K-1 or B-K+1<=x<=B]
    t.sort()
    for i in t:
        print(i)
# Judge status: Accepted
import bisect
from collections import deque

N, H = map(int, input().split())
furi = deque()
nage = deque()
for _ in range(N):
  a, b = map(int, input().split())
  furi.append(a)
  nage.append(b)
furu = sorted(furi)[-1]
nage = sorted(nage)
nage = deque(nage[bisect.bisect(nage, furu):])
ans = 0
while H > 0 and nage:
  ans += 1
  n = nage.pop()
  H -= n
if H > 0:
  ans += H//furu+(0 if H%furu==0 else 1)
print(ans)
# Judge status: Accepted
def is_acgt(s):
    for c in s:
        if c not in ["A", "C", "G", "T"]:
            return False
    return True


S = input()
ml = 0
for l in range(len(S)+1):
    for r in reversed(range(len(S)+1)):
        if l <= r and is_acgt(S[l:r]):
            ml = max(ml, r-l)
print(ml)
# Judge status: Accepted
n,p=map(int,input().split())
a=list(map(int,input().split()))
if all(i%2==0for i in a):print(0 if p%2else 2**n)
else:print(2**(n-1))
# Judge status: Accepted
import sys
import math
import numpy

n , x , y = map(int,input().split())

k = [0] * (n-1)

for i in range(n):
    for j in range(i+1,n):
        cost = min( j-i , abs( (x-1) - i ) + 1 + abs( j-(y-1) )  )
        k[cost - 1 ] += 1

[print(p) for p in k]
# Judge status: Wrong Answer
N = int(input())
A = [_ for _ in map(int,input().split())]
B = [_ for _ in map(int,input().split())]
C = [_ for _ in map(int,input().split())]
Happy = 0
temp = -1
for i in range(N):
  Happy += B[A[i]-1]
  if A[i]-1 == (temp+1):
    Happy += C[temp]
  temp = A[i] - 1
print(Happy)
# Judge status: Accepted
str_n = input()
digits = [int(c) for c in str_n]

if sum(digits[1:]) == 9 * (len(digits) - 1):
    print(sum(digits))
else:
    print(digits[0] + 9 * (len(digits) - 1) - 1)
# Judge status: Wrong Answer
N,M = map(int,input().split())
source = []
goal = ''
for i in range(M):
  keta,number = map(int,input().split())
  source.append((keta,number))
source.sort()
for i in range(N):
  if i < len(source):
    keta,number = source[i]
    if i == keta-1:
      goal += str(number)
    else:
      goal += '0'
  else:
    goal += '0'
k = int(goal)
if len(str(k)) == len(goal):
  print(goal)
else:
  print('-1')
# Judge status: Wrong Answer
N,Q=map(int,input().split())
S=input()
s_cnt=[]
for i in range(N):
    s_cnt.append(S[:i+2].count("AC"))
for i in range(Q):
    l,r=map(int,input().split())
    print(s_cnt[r-1] - s_cnt[l-1])
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    n = int(input())
    b = list(map(int, input().split()))
    a = []
    for i in range(n):
        if i == 0:
            a.append(b[0])
        elif i == n - 1:
            a.append(b[-1])
        else:
            a.append(min(b[i - 1], b[i]))
    print(sum(a))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

sum = 0
for i in a:
    sum += i

sum = sum * sum % 1000000007

for j in a:
    sum = (sum - j*j) % 1000000007

print(int(sum/2))
# Judge status: Accepted
N,A,B=map(int,input().split())
if (A-B)%2==0:
    print(abs(A-B)//2)
else:
    if (A+B)>N:
        print((abs(A-B)-1)//2+(min(N-A,N-B)+1))
    else:
        print((abs(A-B)-1)//2+(min(A-1,B-1)+1))
# Judge status: Accepted
#068_C
n,m=map(int,input().split())
s1=set()
sn=set()
for _ in range(m):
    a,b=map(int,input().split())
    if a==1:
        s1.add(b)
    if b==n:
        sn.add(a)
print('POSSIBLE' if len(s1&sn) else 'IMPOSSIBLE')
# Judge status: Wrong Answer
n = int(input())
v = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        p = (v[i] + v[j]) / 2
        for k in range(n):
            if k == i or k == j: continue
            p = (p + v[k]) / 2
        ans = max(ans, p)
print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == k:
    print(1)
elif k == 2:
    print(n-1)
else:
    print(n // (k-1))
# Judge status: Accepted
from math import sqrt, ceil, floor

def factorize(x):
    result = []
    for p in range(2, floor(sqrt(x))):
        exp = 0
        while x % p == 0:
            exp += 1
            x = x // p
        if exp > 0:
            result.append((p, exp))
    if x > 1:
        result.append((x, 1))
    return result

N = int(input())
factors = factorize(N)
ans = sum([floor((sqrt(exp * 8 + 1) - 1) / 2) for p, exp in factors])
print(ans)
# Judge status: Accepted
K = int(input())
A,B = (int(x) for x in input().split())
Flag = 0
for T in range(0,B-A+1):
    if (A+T)%K==0:
        Flag = 1
        break
if Flag:
    print('OK')
else:
    print('NG')
# Judge status: Accepted
S = input()

S_rev = S[::-1]
total = 0

for i in range(len(S)):
  if S[i] != S_rev[i]:
    total += 1

if total % 2 == 0:
  total = int(total / 2)
else:
  total = int(total / 2) + 1

print(total)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
count=0
sum=0
A=float("inf")
for i in L:
	sum+=abs(i)
	A=min(A,abs(i))
	if i<0:
		count+=1
if count%2==0:
	print(sum)
else:
	print(sum-A*2)
# Judge status: Wrong Answer
def main():
    t = list(map(int, input().split()))
    if t[1] - t[0] == t[2] - t[1]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
if int(input())<=999:
  print("ABC")
else:
  print("ABD")
# Judge status: Accepted
# one example of valid A is {X, (2 * X), (2 * 2 * X), ...}
X, Y = list(map(int, input().split()))
answer = 0
while X <= Y:
    answer += 1
    X *= 2
print(answer)
# Judge status: Wrong Answer
N = int(input())
W = [input() for _ in range(N)]

a = []
pre = W[0]
flag = False
for wi in W[1:]:
    if wi in a or pre[-1] != wi[0]:
        flag = True
        break
    a.append(wi)
        
if flag:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
x = int(input())

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5 - b**5 == x:
            print(a, b)
            exit()
# Judge status: Accepted
C1 = list(input())
C2 = list(input())
print("YES" if C1 == C2[::-1] else "NO")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
temp = []
for i in range(N):
    ans = sum(a[0:i+1]) + sum(b[i:])
    temp.append(ans)
print(max(temp))
# Judge status: Wrong Answer
X, K, D = map( int, input().split())

Y = X // D
if K > Y:
  A = Y
  if A % 2 != 0:
    if X > 0:
      X += D
    else:
      X -= D
else:
  A = K

print( abs( X ) - abs( A * D ) )
# Judge status: Accepted
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
dif = []

h.sort()

for i in range(N-K+1):
  dif.append(h[i+K-1] - h[i])
  
print(min(dif))
# Judge status: Wrong Answer
s,c = map(int,input().split())
res = 0
if c == 1:
    print(0)
    exit()
if s*2 <= c:
    res += s
    c -= s*2
else:
    res += c//2
    c //= 2
print(res+c//4)
# Judge status: Wrong Answer
from heapq import heappush, heappop, heapify
import math
def solve():
	n , k= map(int, input().strip().split())
	if k >= 10*7:
		return 1
	a= [(-int(x),1,int(x)) for x in input().strip().split()]
	heapify(a)
	for i in range(k):
		x,cnt,orig = heappop(a)
		x = -x
		if x <= 1:
			return 1
		heappush(a,(-((orig+cnt)//(cnt+1)),cnt+1,orig))
	return -(heappop(a)[0])
 
 
print(solve())
# Judge status: Accepted
import bisect

n = (int)(input())
a = sorted(list(map(int, input().split(" "))))
b = list(map(int, input().split(" ")))
c = sorted(list(map(int, input().split(" "))))

count = 0
for i in b:
  #print((a[:bisect.bisect_right(a, i - 1)]), i, c[bisect.bisect_left(c, i + 1):]) 
  #print(bisect.bisect_right(a, i - 1), i, (n - bisect.bisect_left(c, i + 1)) ) 
  count += bisect.bisect_right(a, i - 1) * (n - bisect.bisect_left(c, i + 1)) 
print(count)
# Judge status: Accepted
List = []
for _ in range(6):
  List.append(int(input()))
Count = 5
MIN = min(List[1],List[2],List[3],List[4],List[5],)
Count += List[0]//MIN if List[0]%MIN != 0 else (List[0]//MIN)-1

print(Count)
# Judge status: Accepted
s = input()
if (s[0] == s[1]) or (s[1] == s[2]) or (s[2] == s[3]):
    print("Bad")
else:
    print("Good")
# Judge status: Accepted
S = int(input())
arr = [0]*(S+1)
MOD = 10**9 + 7

arr[0] = 1
for i in range(3,S+1):
    for j in range(i-3+1):
        arr[i] += arr[j]
        arr[i] = arr[i]%MOD

print(arr[S])
# Judge status: Accepted
import math
N,D = map(int,input().split())
Xs = [list(map(int,input().split()))for i in range(N)]
c = 0
for i in range(N-1):
  X1 = Xs[i]
  for j in range(i+1,N):
    X2 = Xs[j]
    su = 0
    for k in range(D):
      su += abs(X1[k]-X2[k]) **2
    distance = math.sqrt(su)
    if distance.is_integer():
      c+=1
print(c)
# Judge status: Accepted
n=int(input())
x=0
y=0
t=0
f=0
for i in range(n):
    T,a,b=map(int,input().split())
    if not(abs(a-x)+abs(b-y)<=T-t and (abs(a-x)+abs(b-y)-(T-t))%2==0):
        f=1
    x=a
    y=b
    t=T
print("Yes" if f==0 else "No")
# Judge status: Accepted
s = input()
s = sorted(s)
s = set(s)
alpha = 'a'
flg = 0
for i in range(1,27):
    if (alpha not in s):
        flg = 1
        break
    else : alpha = chr(ord(alpha)+1)
if (flg): print(alpha)
else: print("None")
# Judge status: Accepted
from collections import Counter

n = int(input())
a = list(map(int,input().split()))
a_count = sorted(Counter(a).items(),reverse=True)
f = False

for k,v in a_count:
    if (4 <= v) and (not f):
        print (k**2)
        exit ()
    elif 2 <= v:
        if f:
            print (x*k)
            exit ()
        else:
            x = k
            f = True
    else:
        pass

print (0)
# Judge status: Accepted
l = list(map(int, input().split()))
print(l.index(0)+1)
# Judge status: Wrong Answer
N = int(input())
mod = 10 ** 9 + 7

e = pow(8, N, mod)
f = pow(9, N, mod)
g = pow(10, N, mod)

# 全体 - (0を含まない + 9を含まない) + 0と9どちらも含まない 
ans = g - 2 * f + e
print(ans)
# Judge status: Accepted
N,A,B= map(int,input().split())
S=input()
f=[]
d=0
e=1
for i in range(N):
  if S[i]=='a':
    if d < A+B:
      f.append('Yes')
      d+=1
    else:
      f.append('No')
  if S[i]=='b':
    if d <A+B and e<=B:
      f.append('Yes')
      d+=1
      e+=1
    else:
      f.append('No')
  if S[i]=='c':
    f.append('No')

for F in f:
  print(F)
# Judge status: Accepted
n=int(input())
l=[["a"]]+[[] for i in range(9)]
for i in range(9):
  for j in l[i]:
    k=len(set(list(j)))
    for h in range(k+1):
      l[i+1].append(j+chr(97+h))
for i in l[n-1]:print(i)
# Judge status: Accepted
M,a=-float("inf"),0
for X,L in sorted(zip(*[iter(map(int,open(0).read().split()[1:]))]*2),key=sum):
 l,r=X-L,X+L
 if M<=l:a+=1;M=r
print(a)
# Judge status: Accepted
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans1, ans2 = x, x
cnt1, cnt2 = 0, 0
while ans1 in p:
    ans1 += 1
    cnt1 += 1
while ans2 in p:
    ans2 -= 1
    cnt2 += 1
if cnt1 >= cnt2:
    print(ans2)
else:
    print(ans1)
# Judge status: Wrong Answer
import collections
n=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
firstnum=0
secondnum=0
firstl=0
secondl=0
for i,j in a.items():
  if i>=firstl and j>=2:
    secondnum=firstnum
    firstnum=j
    secondl=firstl
    firstl=i
  elif secondl<=i<firstl and j>=2:
    secondnum=j
    secondl=i
print(firstl*secondl)
# Judge status: Accepted
k = int(input())

num = [1,2,3,4,5,6,7,8,9]
def lunlun(m):
    for i in range(10):
        if(abs((m%10) - i ) <=1):
            if(m*10+i > 3234566667):
                return
            num.append(m*10+i)
            lunlun(m*10+i)

for j in range(1,10):
    lunlun(j)

num = sorted(num)

print(num[k-1])