Harryxun/stf_run huggingface dataset:
import numpy as np


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
B = np.zeros(N, dtype="int")
coordinate = np.arange(1, N+1)

limit = np.log(N)
for j in range(K):
    for i in range(N):
        c = coordinate[i]
        B[i] = (A >= np.abs(coordinate - c)).sum()
    A = B.copy()
    if j > limit_count:
        break


print(" ".join(map(str, A.tolist())))


### FIXED CODE ###

def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = read_input()
K = min(K, 41)

for _ in range(K):
    B = [0]*N
    for i in range(N):
        start = max(i-A[i], 0)
        end = min(i+A[i], N-1)

        B[start] += 1
        if end+1 < N:
            B[end+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()


print(" ".join(map(str, A)))
def f(y,x,c0):
  global A
  c=A[y][x]
  if c==" " or c!=c0:
    return 0
  else:
    A[y][x]=" "
    for i,j in [[0,-1],[0,1],[-1,0],[1,0]]:
      f(y+i,x+j,c0)
    return 1

while 1:
  H,W=map(int,raw_input().split())
  if H==W==0: break
  A=[]
  for i in range(H+2):
    if i==0 or i==H+1:
      A.append(list(" "*(W+2)))
    else:
      A.append(list(" "+raw_input()+" "))
  c=0
  for i in range(1,H+1):
    for j in range(1,W+1):
      c+=f(i,j,A[i][j])
  print c

### FIXED CODE ###

def f(y,x,a):
  M.append([y,x])
  while M:
    y,x=M.pop()
    if A[y][x]==a:
      A[y][x]=' '
      for i,j in [[0,-1],[-1,0],[0,1],[1,0]]: M.append([y+i,x+j])
  return 1

M=[]
while 1:
  H,W=map(int,raw_input().split())
  if H==W==0: break
  A=[list(' '*(W+2)) for _ in range(H+2)]
  for i in range(H): A[i+1][1:W+1]=list(raw_input())
  c=0
  for i in range(1,H+1):
    for j in range(1,W+1):
      a=A[i][j]
      if a!=' ': c+=f(i,j,a)
  print c
print("NO")


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
aa = set(a)
if len(a) == len(aa):
    print("YES")
else:
    print("NO")
from sys import stdin

N, M, *A = map(int, stdin.read().split())
req = {1: 2,
       2: 5,
       3: 5,
       4: 4,
       5: 5,
       6: 6,
       7: 3,
       8: 7,
       9: 6}

B = sorted([(a, req[a]) for a in A], key=lambda x: x[0], reverse=True)
a_min, n_min = min(B, key=lambda x: x[1])
g = [(a, n-n_min) for a, n in B if a > a_min and n > n_min]
l = [(a, n-n_min) for a, n in B if a < a_min and n > n_min][::-1]


def dp(rem, C):
    ret = None
    if rem == 0:
        ret = []
    elif rem > 0:
        for a, m in C:
            nxt = dp(rem-m, C)
            if nxt is not None:
                ret = [a] + nxt
                break
    return ret


lst = dp(N % n_min, g + l)
lst = sorted(lst + [a_min] * (N//n_min - len(lst)), reverse=True)
print(''.join(map(str, lst)))

### FIXED CODE ###

from sys import stdin

N, M, *A = map(int, stdin.read().split())
req = {1: 2,
       2: 5,
       3: 5,
       4: 4,
       5: 5,
       6: 6,
       7: 3,
       8: 7,
       9: 6}

B = sorted([(a, req[a]) for a in A], key=lambda x: x[0], reverse=True)
a_min, n_min = min(B, key=lambda x: x[1])
g = [(a, n-n_min) for a, n in B if a > a_min and n > n_min]
l = [(a, n-n_min) for a, n in B if a < a_min and n > n_min]
l.sort(key=lambda x: x[1], reverse=True)
C = g + l

def dp(rem, C):
    ret = None
    if rem == 0:
        ret = []
    elif rem > 0:
        for i in range(len(C)):
            a, m = C[i]
            nxt = dp(rem-m, C[i:])
            if nxt is not None:
                ret = [a] + nxt
                break
    return ret


i = 0
while True:
    quo = N // n_min - i
    rem = N % n_min + i * n_min
    lst = dp(rem, C)
    if lst is not None:
        lst = sorted(lst + [a_min] * (quo-len(lst)), reverse=True)
        print(''.join(map(str, lst)))
        break
    i += 1
a = input()
a = int(a)
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])

### FIXED CODE ###

a = input()
a = int(a)
 
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(l[a-1])
n,x = map(int,input().split())

if n == 2:
    if x == 2:
        print('Yes')
        print('\n'.join([1,2,3]))
    else:
        print('No')
else:
    if x == 1 or x == 2*n - 1:
        print('No')
    else:
        print('Yes')
        if x == 2:
            ans = list(range(3,2*n-2))
            ans = ans[:n-3] + [2*n - 1,1,2,2*n - 2] + ans[n-3:]
        else:
            ans = list(range(2*n - 1))
            ans = ans[3:x] + ans[x+1:2*n - 1]
            ans = ans[:n-3] + [1,2*n - 1,x,2] + ans[n-3:]
        print('\n'.join(str(i) for i in ans))


### FIXED CODE ###

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

if n == 2:
    if x == 2:
        print('Yes')
        print('\n'.join(['1','2','3']))
    else:
        print('No')
else:
    if x == 1 or x == 2*n - 1:
        print('No')
    else:
        print('Yes')
        if x == 2:
            ans = list(range(3,2*n-2))
            ans = ans[:n-3] + [2*n - 1,1,2,2*n - 2] + ans[n-3:]
        else:
            ans = list(range(2*n - 1))
            ans = ans[3:x] + ans[x+1:2*n - 1]
            ans = ans[:n-3] + [1,2*n - 1,x,2] + ans[n-3:]
        print('\n'.join(str(i) for i in ans))
T, X = int(input().split())
print(T / X)

### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
S = int(input())
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))

### FIXED CODE ###

S = input()
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
        if p==n: break
        cnt+=n-p
        ans+=a[q]*(n-p)*2
    except:
        print(0)
        sys.exit()


ans+=(m-cnt)*md
print(ans)

### FIXED CODE ###

def f(i):
    return i
s,t=map(f,input().split())
print(t+s)
def inpl(): return [int(i) for i in input().split()]

def root(x,par):
    if par[x] == x:
        return [x,[x]]
    else:
        return [root(par[x],par)[0],root(par[x],par)[1]+[x]]


N, K, L = inpl()
parK = list(range(N))
for i in range(K):
    p, q = inpl()
    rp = root(p-1,parK)
    rq = root(q-1,parK)
    if len(rp[1]) < len(rq[1]) :
        parK[rq[0]] = rp[0] 
    else:
        parK[rp[0]] = rq[0]
    print(parK)

parL = list(range(N))
for i in range(L):
    r, s = inpl()
    rr = root(r-1,parL)
    rs = root(s-1,parL)
    for i in rr[1]:
        parL[i] = rr[0]
    for j in rs[1]:
        parL[j] = rr[0]

from collections import defaultdict
ans = defaultdict(lambda: 0)
for i in range(N):
    ans[root(i,parK)[0],root(i,parL)[0]] +=1
Ans = [0 for _ in range(N)]
for i in range(N):
    Ans[i] = ans[root(i,parK)[0],root(i,parL)[0]]
print(*Ans)

### FIXED CODE ###

def inpl(): return [int(i) for i in input().split()]
class UnionFind():
    def __init__(self, num):
        self.par = [-1 for _ in range(num)]
    
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            x = self.par[x]
            return self.find(x)
    
    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] < self.par[ry]:
                self.par[ry] = rx
            if self.par[rx] > self.par[ry]:
                self.par[rx] = ry
            else:
                self.par[rx] -= 1
                self.par[ry] = rx
        return

N, K, L = inpl()
ufk = UnionFind(N)
for i in range(K):
    p, q = inpl()
    ufk.union(p-1, q-1)

ufr = UnionFind(N)
for i in range(L):
    r, s = inpl()
    ufr.union(r-1, s-1)

from collections import defaultdict
ans = defaultdict(lambda: 0)
for i in range(N):
    ans[ufk.find(i),ufr.find(i)] +=1
Ans = [0 for _ in range(N)]
for i in range(N):
    Ans[i] = ans[ufk.find(i),ufr.find(i)]
print(*Ans)
ball = 0
while True:
 try:
  a, b = map(lambda x: ord(x) - ord("A") raw_input().strip().split(","))
  if (a == ball):
   ball = b;
 except:
  break;

print chr(ball + ord("A"))

### FIXED CODE ###

ball = 0
while True:
    try:
        a, b = map(lambda x: ord(x) - ord("A"), raw_input().strip().split(","))
        if (a == ball):
            ball = b;
        elif (b == ball):
            ball = a;
    except:
        break;

print chr(ball + ord("A"))
count = int(input())
ent_list = []
for i in range(count):
    org_list = [j for j in input()]
    new_list = sorted(org_list)
    ent_list.append(new_list)
if count == 1:
    result = "".join(ent_list[0])
    print(result)
else:    
    for i in range(count-1):
        for j in range(len(ent_list[i+1])):
            if ent_list[i+1][j] in ent_list[i] == True:           
                ent_list[i].remove(ent_list[i+1][j])
            else:
                ent_list[i+1].remove(ent_list[i+1][j])
result = "".join(ent_list[count-1])
print(result)
#3
#cbaa
#daacc
#acacac                 

### FIXED CODE ###

n = int(input())
#文字列を一列ごとにリストに入れる
S = [input() for _ in range(n)]
alphabet_str = "abcdefghijklmnopqrstuvwxyz"
#alphbetの文字列をリスト化
alphabets = list(alphabet_str)

s_maps = []
for s in S:
#sはSの文字列の一つ一つ
#文字列sをリスト化    
    strs = list(s)
#辞書を作る
    m = {}
#各alphbetの初期値を0にする
    for alphabet in alphabets:
        m[alphabet] = 0
#文字列の中にあるalphabetがあれば、辞書のvalueに1を追加
    for _str in strs:
        m[_str] += 1
#辞書をリストに突っ込む      
    s_maps.append(m) 
#print(s_maps)
ans = ""
#alphabetリストからalphabetを取り出す
for alphabet in alphabets:
    min_num = 51
#リストから辞書を一つずつ取り出す    
    for s_map in s_maps:
#n個の辞書の中から最小のvalueを取り出す
        min_num = min(s_map[alphabet], min_num)
    for i in range(min_num):
        ans += alphabet
print(ans)
#taku689さんのコードを大いに参考
import numpy as np

n = int(input())
x = np.array(list(map(int,input().split())))
# x = np.array(x)
r = np.full(100, 100 * n)

for p in range(100):
    r[p] = np.sum((x - p + 1)**2)
print(np.min(r))

### FIXED CODE ###

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

if n >= 10:
    print(r)
else:
    print(r + (100 * (10 - n)))
import math
n = int(input())
T = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

T.sort()
ans = T.pop(0)
for t in T:
    ans = lcm(ans,t)
print(ans)


### FIXED CODE ###

import fractions
n = int(input())
T = [int(input()) for _ in range(n)]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

T.sort()
ans = T.pop(0)
for t in T:
    ans = lcm(ans,t)
print(ans)
a, b = map(str, input().split())
a, b = int(a), int(b*100)
print(a*b//100)


### FIXED CODE ###

a, b = map(int, input().replace('.', '').split())
print(a*b//100)
import sys
sys.setrecursionlimit(10**9)

n = int(input())
A = list(map(int, input().split()))
count = 0


def func(a, cnt=0):
    global count
    for i in range(len(a)-1):
        if a[i] > a[i+1]:
            a[i+1] += 1
            cnt += 1
            count = max(cnt, count)
            func(a, cnt)
        else:
            continue
    return count


COUNT = func(A)
print(COUNT)

### FIXED CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))

    tallest = A[0]
    cnt = 0

    for height in A:
        if tallest > height:
            cnt += tallest - height
        else:
            tallest = height

    print(cnt)


if __name__ == "__main__":
    main()
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if a[num] in a[:num-1]:
    print('No')
    break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  print('Yes')

### FIXED CODE ###

A, B = map(int, input().split())
x = A * B
if x % 2 == 0:
    print('No')
else:
    print('Yes')
A=int(input())
B=int(input())
list["1","2","3"]
list.remove(A)
list.remove(B)
print(list[0])

### FIXED CODE ###

A=int(input())
B=int(input())
if A==1 and B==2:
  print(3)
elif A==2 and B==3:
  print(1)
elif A==3 and B==1:
  print(2)
elif A==1 and B==3:
  print(2)
elif A==2 and B==1:
  print(3)
elif A==3 and B==2:
  print(1)
N = int(input())
D =[[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    D[a].append(b)
    D[b].append(a)

c = sorted(list(map(int,input().split())))
vcost = [-1]*(N+1)
vcost[1]=c.pop()
ans = 0
def dfs(i):
    global ans
    for j in D[i]:
        if vcost[j]==-1:
            vcost[j]=c.pop()
            ans += vcost[j]
            dfs(j)
dfs(1)
print(ans)
print(*vcost[1:])

### FIXED CODE ###

from itertools import*
import math
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N = int(input())
D =[[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    D[a].append(b)
    D[b].append(a)

c = sorted(list(map(int,input().split())))
vcost = [-1]*(N+1)
vcost[1]=c.pop()
ans = 0
def dfs(i):
    global ans
    for j in D[i]:
        if vcost[j]==-1:
            vcost[j]=c.pop()
            ans += vcost[j]
            dfs(j)
dfs(1)
print(ans)
print(*vcost[1:])
import math

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    q = []
    for i in range(N):
        heappush(q,(-A[i],0))

    for i in range(K):
        l, c = heappop(q)
        heappush(q,(l*(c+1)/(c+2),c+1))
    
    ans = 0
    while q:
        l,c = heappop(q)
        ans = max(ans,-l)
    print(math.ceil(ans))

if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate
import math

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    if K == 0:
        print(max(A))
        exit()
    
    # 二分探索で答えxを求める
    MIN = 0
    MAX = max(A)

    while MAX - MIN > 1:
        MID = (MIN + MAX)//2
        cnt = 0
        for i in range(N):
            cnt += (A[i]-1)//MID
        if cnt <= K:
            MAX = MID
        else:
            MIN = MID
    print(MAX)

if __name__ == "__main__":
    main()
n = input()
lis = map(int, raw_input().split())
mn = lis[0]
mx = li[0]
for t in lis:
	if mn > t:
		mn = t
	if mx < t:
		mx = t
print mn, mx, sum(lis)

### FIXED CODE ###

n = input()
lis = map(int, raw_input().split())
mn = lis[0]
mx = lis[0]
for t in lis:
	if mn > t:
		mn = t
	if mx < t:
		mx = t
print "%s %s %s" % (mn, mx, sum(lis))
n, t = map(int, input().split())
cost = []
for i in range(n):
    c, ti = map(int, input().split())
    if ti <= t:
        cost.append(c)
cost = sorted(cost)
print(cost[0])

### FIXED CODE ###

n, t = map(int, input().split())
cost = []
time = []
for i in range(n):
    c, ti = map(int, input().split())
    if ti <= t:
        cost.append(c)
        time.append(ti)
cost = sorted(cost)
if time != []:
    print(cost[0])
else:
    print('TLE')
C=input()
for i in range(len(string.ascii_lowercase)):
  if(string.ascii_lowercase[i]==C):
    print(string.ascii_lowercase[i+1])


### FIXED CODE ###

import string
C=input()
for i in range(len(string.ascii_lowercase)):
  if(string.ascii_lowercase[i]==C):
    print(string.ascii_lowercase[i+1])
N, K=map(int, input().split())
h=list(map(int, input().split()))
count=0

for i in range(N):
    if K <= h[i]:
        count += 1
print(count)


### FIXED CODE ###

N = int(input())

if N%2 == 0:
    print((N/2)/N)
else:
    print(((N+1)/2)/N)
import copy
N = int(input())
bscs = [(int(c[-1]), c) for c in input().split(" ")]
sscs = copy.copy(bscs)
for i in range(N):
    j = N - 1
    while j > i:
        if bscs[j][0] < bscs[j - 1][0]:
            tmp = bscs[j]
            bscs[j] = bscs[j - 1]
            bscs[j - 1] = tmp
        j -= 1
print(" ".join([c[1] for c in bscs])
print("Stable")
for i in range(N):
    minj = i
    for j in range(i, N):
        if sscs[j][0] < sscs[minj][0]:
            minj = j
    tmp = sscs[i]
    sscs[i] = sscs[minj]
    sscs[minj] = tmp
print(" ".join([c[1] for c in sscs]))
print("Stable" if bscs == sscs else "Not Stable")

### FIXED CODE ###

import copy
N = int(input())
bscs = [(int(c[-1]), c) for c in input().split(" ")]
sscs = copy.copy(bscs)
for i in range(N):
    j = N - 1
    while j > i:
        if bscs[j][0] < bscs[j - 1][0]:
            tmp = bscs[j]
            bscs[j] = bscs[j - 1]
            bscs[j - 1] = tmp
        j -= 1
print(" ".join([c[1] for c in bscs]))
print("Stable")
for i in range(N):
    minj = i
    for j in range(i, N):
        if sscs[j][0] < sscs[minj][0]:
            minj = j
    tmp = sscs[i]
    sscs[i] = sscs[minj]
    sscs[minj] = tmp
print(" ".join([c[1] for c in sscs]))
print("Stable" if bscs == sscs else "Not stable")
r, c = map(int, input().split())
a = []
for i in range(r):
    a.append(list(map(int, input(),split())))
for line in arr:
    line.append(sum(line))
arr.append([sum([line[i] for line in arr]) for i in range(c+1)])
for line in arr:
    print(line)
    


### FIXED CODE ###

n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(m):print(sum(a[i]),end=' ')
print(sum(a[m]))
from collections import defaultdict

G = defaultdict(list)

N = int(input())
C = [0 for i in range(N)]
last = N


def rec(pos, c):
    """ 2 色で塗ることができることが保証されている """
    global C
    C[pos] = c
    for to in G[pos]:
        if C[to] == 0:
            rec(to, -c)


for i in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1; v -= 1
    # 無向グラフ
    if w%2 == 0:
        G[u].append(last)
        G[last].append(u)
        G[v].append(last)
        G[last].append(v)
        C.append(0)
        last += 1
    else:
        G[u].append(v)
        G[v].append(u)
rec(0, 1)
for i in range(N):
    print(0 if C[i] == -1 else 1)

### FIXED CODE ###

from collections import defaultdict
import sys

sys.setrecursionlimit(1000000)

G = defaultdict(list)

N = int(input())
C = [0 for i in range(N)]
last = N


def rec(pos, c):
    """ 2 色で塗ることができることが保証されている """
    global C
    C[pos] = c
    for to in G[pos]:
        if C[to] == 0:
            rec(to, -c)


for i in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1; v -= 1
    # 無向グラフ
    if w%2 == 0:
        G[u].append(last)
        G[last].append(u)
        G[v].append(last)
        G[last].append(v)
        C.append(0)
        last += 1
    else:
        G[u].append(v)
        G[v].append(u)
rec(0, 1)
for i in range(N):
    print(0 if C[i] == -1 else 1)
H, W, M = map(int, input().split())
Hdst = [0]*H
Wdst = [0]*W
DST = [[0] * W for i in range(H)]
for i in range(M):
    hi, wi = map(int, input().split())
    Hdst[hi-1] += 1
    Wdst[wi-1] += 1
    DST[hi-1][wi-1] = 1

Hbomb = [i for i, x in enumerate(Hdst) if x == max(Hdst)]
Wbomb = [i for i, x in enumerate(Wdst) if x == max(Wdst)]

ans = 0
for i in Hbomb:
    for j in Wbomb:
        if Hdst[i] + Wdst[j] - DST[i][j] > ans:
            ans = Hdst[i] + Wdst[j] - DST[i][j]

print(ans)

### FIXED CODE ###

H, W, M = map(int, input().split())
Hdst = [0]*H
Wdst = [0]*W
DST = [[0] * M for i in range(2)]
for i in range(M):
    hi, wi = map(int, input().split())
    Hdst[hi-1] += 1
    Wdst[wi-1] += 1
    DST[0][i] = hi-1
    DST[1][i] = wi-1

Hdstmax = max(Hdst)
Wdstmax = max(Wdst)
Hbomb = [i for i, x in enumerate(Hdst) if x == Hdstmax]
Wbomb = [i for i, x in enumerate(Wdst) if x == Wdstmax]

Hchk = [False]*H
Wchk = [False]*W
for i in Hbomb:
    Hchk[i] = True
for i in Wbomb:
    Wchk[i] = True

tmp = 0
for i in range(M):
    if Hchk[DST[0][i]] and Wchk[DST[1][i]]:
        tmp += 1

if len(Hbomb)*len(Wbomb) == tmp:
    print(Hdstmax + Wdstmax - 1)
else:
    print(Hdstmax + Wdstmax)
a=input()
h=a/3600
m=(a-(h*3600))/60
s=a-(h*3600)-(m*60)
print '%d:%d:%d' %(h,m,s)

### FIXED CODE ###

a=int(input())
h=int(a/3600)
m=int((a-(h*3600))/60)
s=int(a-(h*3600)-(m*60))
print("%d:%d:%d"%(h,m,s))
S = int(input())
h = int(S / (60*60))
m = int(S / 60) % 60
s = S % 60

print('{0}:{1}:{2}'.format(h.m.s)

### FIXED CODE ###

S = int(input())
h = int(S // (60*60))
m = int(S / 60) % 60
s = S%60

print('{}:{}:{}'.format(h,m,s))
import collections
cnt1=collections.Counter()
cnt2=collections.Counter()
n,m=map(int, input().split())
ll=[0]*1500
for i in range(n):
    x=int(input())
    for j in range(i):
        ll[j]+=x
        cnt1[ll[j]]+=1

for i in range(m):
    x=int(input())
    for j in range(i):
        ll[j]+=x
        cnt2[ll[j]]+=1
sets=set(cnt1.keys().cnt2.keys())
ans=0
for s in sets:
    ans+=cnt1[s]*cnt2[s]
print(s)

### FIXED CODE ###

import collections
while 1:
    cnt1=collections.Counter()
    cnt2=collections.Counter()
    n,m=map(int, input().split())
    if n+m==0:
        break
    ll=[0]*1500
    for i in range(n):
        x=int(input())
        for j in range(i+1):
            ll[j]+=x
            cnt1[ll[j]]+=1
    ll=[0]*1500
    for i in range(m):
        x=int(input())
        for j in range(i+1):
           ll[j]+=x
           cnt2[ll[j]]+=1
    sets=set(cnt1.keys()&(cnt2.keys()))
    ans=0
    for s in sets:
        ans+=cnt1[s]*cnt2[s]
    print(ans)
n, l = map(int, input().split())
s = sorted([input() for i in n])
print("".join(s))

### FIXED CODE ###

n, l = map(int, input().split())
s = sorted([input() for i in range(n)])
print("".join(s))
from collections import defaultdict
N,C = map(int,input().split())
D=[[int(i) for i in input().split()] for j in range(C)]
co=[[int(i) for i in input().split()] for j in range(N)]
d0= defaultdict(int)
d1= defaultdict(int)
d2= defaultdict(int)
for i in range(N):
    for j in range(N):
        if (j+i) %3==0:
            d0[co[j][i]] +=1
        elif (j+i)%3==1:
            d1[co[j][i]] +=1
        else:
            d2[co[j][i]] +=1
A0=[]#i色に帰るのに必要な違和感
A1=[]
A2=[]
for i in range(C):
    iwa =0
    for s in d0.keys():
        iwa += D[s-1][i-1]*d0[s] 
    A0.append([iwa,i])
for i in range(C):
    iwa =0
    for s in d1.keys():
        iwa += D[s-1][i-1]*d1[s] 
    A1.append([iwa,i])
for i in range(C):
    iwa =0
    for s in d2.keys():
        iwa += D[s-1][i-1]*d2[s] 
    A2.append([iwa,i])

A0.sort()
A1.sort()
A2.sort()
B=[[] for i in range(3)]
for i in range(3):
    B[0].append(A0[i])
for i in range(3):
    B[1].append(A1[i])
for i in range(3):
    B[2].append(A2[i])
ans =[]
for i in range(3):
    for j in range(3):
        for k in range(3):
            if B[0][i][1] ==B[1][j][1]:
                continue
            if B[0][i][1] ==B[2][k][1]:
                continue
            if B[1][j][1] ==B[2][k][1]:
                continue
            ans.append(B[0][i][0]+B[1][j][0]+B[2][k][0])
print(min(ans))


### FIXED CODE ###

N = int(input())
A=[]
A.append(1)
for i in range(1,7):
    A.append(6**i)
for i in range(1,6):
    A.append(9**i)
A.sort()
dp=[10*5+5]*(N+1)
dp[0]=0
for i in range(1,N+1):
    for s in range(len(A)):
        if i-A[s]>=0:
            dp[i]=min(dp[i-A[s]]+1,dp[i])
print(dp[N])
S=print()
N=len(S)
c0=0;c1=0
for i in range(N):
  if "0"==S[i]:
    c0=c0+1
  elif "1"==S[i]:
    c1=c1+1
print(str(min(c0,c1)))
    

### FIXED CODE ###

S=input()
N=len(S)
c0=0;c1=0
for i in range(N):
  if "0"==S[i]:
    c0=c0+1
  elif "1"==S[i]:
    c1=c1+1
print(str(2*min(c0,c1)))
var input=GET(require("fs").readFileSync("/dev/stdin","utf8"));
var str = input();
if(str[0] == str[1] || str[1]==str[2] || str[2]==str[3])console.log("Bad");
else console.log("Good")

### FIXED CODE ###

s = input()
if s[0] != s[1] and s[1] != s[2] and s[2]!=s[3]:
    print("Good")
else:
    print("Bad")