Harryxun/stf_run huggingface dataset:
def digit_sum(a):
    res = 0
    while a:
        res += a % 10
        a /= 10
        a = int(a)
    return res

def main():

    d = {}
    MAX = 10**15
    for i in range(16):
        for j in range(100):
            if i == 0 and j == 0: continue
            tmp = int(str(j) + str(9) * i)
            if tmp > MAX: continue
            d[tmp] = tmp / digit_sum(tmp)

    ls = []
    for a, b in d.items():
        ls.append([b, a])
    ls.sort()

    ls.append([0, MAX])

    k = int(input())

    idx, last = 0, 0
    while k:
        while ls[idx][1] < last: idx += 1
        print(ls[idx][1])
        k -= 1
        last = ls[idx][1]
        idx += 1

    """while True:
        k = int(input())
        if k == 0:
            return True
        print(">", k / digit_sum(k))
    """

if __name__ == "__main__":
    main()



### FIXED CODE ###

def digit_sum(a):
    res = 0
    while a:
        res += a % 10
        a /= 10
        a = int(a)
    return res

def main():

    d = {}
    MAX = 10**17
    for i in range(18):
        for j in range(1000):
            if i == 0 and j == 0: continue
            tmp = int(str(j) + str(9) * i)
            if tmp > MAX: continue
            d[tmp] = tmp / digit_sum(tmp)

    ls = []
    for a, b in d.items():
        ls.append([b, a])
    ls.sort()

    ls.append([0, MAX])

    k = int(input())

    idx, last = 0, 0
    while k:
        while ls[idx][1] < last: idx += 1
        print(ls[idx][1])
        k -= 1
        last = ls[idx][1]
        idx += 1

    """while True:
        k = int(input())
        if k == 0:
            return True
        print(">", k / digit_sum(k))
    """

if __name__ == "__main__":
    main()
N = int(input())
s = [int(input()) for i in range(N)]
sums = sum(s)
others = filter(lambda x: x% 10, s)
if sums % 10:
    print(sums)
elif list(others) != []:
    print(sums-min(others))
else:
    print(0)

### FIXED CODE ###

N = int(input())
s = [int(input()) for i in range(N)]
sums = sum(s)
others = list(filter(lambda x: x % 10, s))
if sums % 10:
    print(sums)
elif others != []:
    print(sums-min(others))
else:
    print(0)
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
  	counter += 1
 
prrint(counter)

### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)
def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    print('%d %d' % (a[0] * a[1], 2 * (a[0] + a[1]))

if __name__ == "__main__":
    main()


### FIXED CODE ###

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    print('%d %d' % (a[0] * a[1], 2 * (a[0] + a[1])))

if __name__ == "__main__":
    main()
a, b=map(str,input().split())
if(a=="H"):
	print(b)
else:
	if(b=="H"):
		print(D)
	else:
		print(H)


### FIXED CODE ###

a, b=map(str,input().split())
if(a=="H"):
	print(b)
else:
	if(b=="H"):
		print("D")
	else:
		print("H")
while True:
    n = int(input())
    if n == 0:
        break
    dataset = [map(int, input().split()) for _ in range(n)]
    for map_ in dataset:
        pm, pe, pj = map_
        x = (pm + pe + pj) // 3
        if 100 in p:
            print("A")
        elif (pm + pe) // 2 >= 90:
            print("A")
        elif x >= 80:
            print("A")
        elif x >= 70:
            print("B")
        elif x >= 50 and (pm >= 80 or pe >= 80):
            print("B")
        else:
            print("C")

### FIXED CODE ###

while True:
    n = int(input())
    if n == 0:
        break
    dataset = [list(map(int, input().split())) for _ in range(n)]
    for p in dataset:
        x = (p[0] + p[1] + p[2]) // 3
        if 100 in p:
            print("A")
        elif (p[0] + p[1]) // 2 >= 90:
            print("A")
        elif x >= 80:
            print("A")
        elif x >= 70:
            print("B")
        elif x >= 50 and (p[0] >= 80 or p[1] >= 80):
            print("B")
        else:
            print("C")
q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)
z=[0]*MAX

print('YES')

### FIXED CODE ###


q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

dic = {}

for k in x :
    if k in dic.keys() :
        dic[k] += 1
    else :
        dic[k] = 1
    
for i in y :
    if i in dic.keys() :
        dic[i] -= 1
        if dic[i] == -1 :
            print('NO')
            exit()
    else :
        print('NO')
        exit()
print('YES')
n=0
i = int(input())
while i != 0:
    n+=1
    print("Case " + str(n) + ":" +i)
    i = int(input())


### FIXED CODE ###

n=0
i = int(input())
while i != 0:
    n+=1
    print("Case " + str(n) + ": " +str(i))
    i = int(input())
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
for i in range(N-1):
    T[i]=T[i]//math.gcd(T[i], T[i+1])
for i in range(N):
    ans=ans*T[i]
print(ans)

### FIXED CODE ###

#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
def grcode(x, y):
    if y==0:
        return (x)
    else:
        return grcode(y, x%y)
for i in range(N-1):
    T[i]=T[i]//grcode(T[i],T[i+1])
    T[i+1]=T[i]*T[i+1]
print(T[N-1])
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree < 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree < 0:
            max_i = i + 1
            break
    else:
        max_i = counter

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )
result = []

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    if ree != 0:
        print(candidates[(start + j) % N])
    else:
        1/0


### FIXED CODE ###


import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])
while True:
    h,w=map(int, input().split())
    if h==w== 0:break
    for x in (h):
        if h%2==1:print('#.'*(w//2) + '\n')
        else:print('.#'*(w//2) + '\n')

### FIXED CODE ###

while 1:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:print('#',end='')
            if (x+y)%2==1: print('.',end='')
        print()
    print()
def answer(n, m, taro, hanako):
    for t in sorted(taro):
        for h in sorted(hanako):
            if sum(taro) - t + h == sum(hanako) - h + t:
                return '{t} {h}'
    return -1

while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break
    taro = []
    hanako = []
    for I in range(n)
        taro.append(int(input()))
    for I in range(m)
        hanako.append(int(input()))
    print(answer(n, m, taro, hanako)


### FIXED CODE ###

def answer(n, m, taro, hanako):
    for t in sorted(taro):
        for h in sorted(hanako):
            if sum(taro) - t + h == sum(hanako) - h + t:
                return f'{t} {h}'
    return -1


while True:
    n, m = map(int, input().split()) # 組み込み関数input()は標準入力から読み込まれた1行を返す．
    if n == 0 and m == 0:
        break
    taro = []
    hanako = []
    for i in range(n):
        taro.append(int(input()))
    for i in range(m):
        hanako.append(int(input()))
    print(answer(n, m, taro, hanako))
import sys
import numpy as np

input=sys.stdin.readline

n,k=map(int,input().split())
h=[0]*n
h=list(map(int,input().split()))

dp=np.zeros(n,dtype=int)
h=np.array(h)

for i in range(1,n):
  start=max(0,i-k)
  dp[i]=min(dp[start:i] + np.abs(h[i]-h[start:i]))

print(dp[n-1])

### FIXED CODE ###

import sys
import numpy as np

input=sys.stdin.readline

n,k=map(int,input().split())
h=[0]*n
h=list(map(int,input().split()))

dp=np.zeros(n,dtype=int)
h=np.array(h)

for i in range(1,n):
  start=max(0,i-k)
  dp[i]=min(dp[start:i] + np.abs(h[i]-h[start:i]))

print(dp[n-1])
H,W=[int(x) for x in input().split()]
N=int(input())
a=[int(x) for x in input().split()]
s=""
for i in range(N):
    s=s+str(i+1)*a[i]
for l in range(H):
    if l%2==0:
        print(" ".join(s[W*l:W*(l+1)]))
    else:
        print(" ".join(s[W*l:W*(l+1)][::-1]))

### FIXED CODE ###

i=[int(x)-1 for x in input().split()]
print(i[0]*i[1])
n = int(input())
s = input()
ans = 0
for i in range(1000):
    seq = f"{i:03d}"
    cnt = 0
    for j in s:
        if seq[cnt] == j:
            cnt += 1
            if cnt == 3:
                break
    if cnt == 3:
        ans +=1
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
ans = 0
for i in range(1000):
    seq = "{:03d}".format(i)
    cnt = 0
    for j in s:
        if seq[cnt] == j:
            cnt += 1
            if cnt == 3:
                break
    if cnt == 3:
        ans += 1
print(ans)
while True:
	n = int(raw_input())
	if n == 0:
		break
	for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
		print i
	 

### FIXED CODE ###

n = int(raw_input())
for i in [raw_input().replace("Hoshino", "Hoshina") for i in range(n)]:
	print i
N=int(input())
pages=N // 2
if N % 2==0:
  	else:
    	pages=pages+1
print(pages)

### FIXED CODE ###

N=int(input())
pages=N // 2
if N % 2==0:
        pass
else:
    pages=pages+1
print(pages)
L = 100005
n,c = map(int,input().split(" "))

# arr[col] には、区間の始まり ==> 1,区間中 ==> 0,区間終わり ==> -1
# 連続した区間は結合した形で表現される

arr = [[0]*L for j in range(c)]
for i in range(n):
    s,t,col = map(int,input().split(" "))
    arr[col][s] += 1
    arr[col][t] -= 1

imos = [0]*L

#全チャンネルを同時に考えたいもす法
for i in range(c):
    for p in range(L):
        if arr[i][p] == 1: imos[p] += 1    
        if arr[i][p] == -1: imos[p+1] -= 1


#累積和をとれば、区間内の最大のrec数は値のmax.
ans = 0
for i in range(1,L):
    imos[i] += imos[i-1]
    ans = max(ans, imos[i])

print(ans)


### FIXED CODE ###

L = 100005
n,c = map(int,input().split(" "))

# arr[col] には、区間の始まり ==> 1,区間中 ==> 0,区間終わり ==> -1
# 連続した区間は結合した形で表現される

arr = [[0]*L for _ in range(c)]

for i in range(n):
    s,t,col = map(int,input().split(" "))
    arr[col-1][s-1] += 1
    arr[col-1][t-1] -= 1

imos = [0]*L

#全チャンネルを同時に考えたいもす法
for i in range(c):
    for p in range(L):
        if arr[i][p] == 1: imos[p] += 1    
        if arr[i][p] == -1: imos[p+1] -= 1


#累積和をとれば、区間内の最大のrec数は値のmax.
ans = 0
for i in range(1,L):
    imos[i] += imos[i-1]
    ans = max(ans, imos[i])

print(ans)
D = int(input)
if D == 25:
    print("Christmas")
elif D ==24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")

### FIXED CODE ###

D = int(input())
if D == 25:
    print("Christmas")
elif D ==24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")
def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
words = []
for i in range(N):
    words.append(input())
hantei = 0
for i in range(N-1):
    a = [x for x in words[i]]
    b = [x for x in words[i+1]]
    if a[len(a)-1] == b[1]:
        pass
    else:
        hantei += 1
        break
if hantei == 0 and is_unique(words) == True:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
words = []
for i in range(N):
    words.append(input())
hantei = 0
for i in range(N-1):
    a = [x for x in words[i]]
    b = [x for x in words[i+1]]
    if a[len(a)-1] == b[0]:
        pass
    else:
        hantei += 1
        break
if hantei == 0 and is_unique(words) == True:
    print("Yes")
else:
    print("No")
def main():
	# n,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	h = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	ans = 0
	dp = [0] * n
	if h[0] >= h[1]:
		dp[0] = 1

	for i in range(1,n-1):
		if h[i] >= h[i+1]:
			dp[i] = dp[i-1] + 1
		else:
			dp[i] = 0
	print(max(dp))

	





if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	# n,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	h = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	ans = 0
	dp = [0] * n
	if n == 1:
		print(0)
	elif n == 2:
		if h[0] >= h[1]:
			print(1)
		else:
			print(0)
	else:
		if h[0] >= h[1]:
			dp[0] = 1
		for i in range(1,n-1):
			if h[i] >= h[i+1]:
				dp[i] = dp[i-1] + 1
			else:
				dp[i] = 0
		print(max(dp))

	





if __name__ == '__main__':
	main()
N,x = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    D += L[i]
print(result)

### FIXED CODE ###

N,X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    if i != N:
        D += L[i]
print(result)
a=str(input())
b=str(input())
c=str(input())
print(“a[:1]+b[1:2]+c[2:3]”)

### FIXED CODE ###

a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))
import math

R = int(input())

print(R * 2 * math.PI)

### FIXED CODE ###

import math

R = int(input())

print(R * 2 * math.pi)
import sys
n = int(input())
a = [list(map(int,input().split()))]

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy % 2):
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()

print("Yes")

### FIXED CODE ###

import sys
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy) % 2:
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
    h = a[i][0]
    j = a[i][1]
    k = a[i][2]
print("Yes")
n,m=map(int,input().split())
a=[0]*n

for i in range(m):
    s,c=map(int,input().split())
    a[s-1]=c


if a[0]==0:
    print(-1)
else:
    b=""
    for i in range(3):
        b+=str(a[i])
    print(b)

### FIXED CODE ###

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

a=["0"]*n

for i in range(m):
    s,c=map(int,input().split())
    if a[s-1]=="0":
        a[s-1]=c
    elif a[s-1]!=c:
        print(-1)
        exit()

if n>1 and a[0]==0:
    print(-1)
    exit()

if n>1 and a[0]=="0":
    a[0]=1

print(*a,sep="")
s = input()
ns = sorted(s)
ans = 'yes'
for i in range(len(s)):
  if s[i] == s[i+1]:
    ans = 'no'
print(ans)

### FIXED CODE ###

s = input()
if len(s) == len(set(s)):
  print('yes')
else :
  print('no')
import sys

argvs = sys.argv

def main(_old, _fee):
  if int(_old) >= 13:
    return int(_fee)
  elif 6 <= int(_old) <= 12:
    return int(_fee) / 2
  else:
    return 0
  
if __name__ == '__main__':
  print(main(argvs[1], argvs[2]))

### FIXED CODE ###

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

def main(_old, _fee):
    if int(_old) >= 13:
        return int(_fee)
    elif 6 <= int(_old) <= 12:
        return int(_fee) // 2
    else:
        return 0

if __name__ == '__main__':
    print(main(a, b))
N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
if 0 in A:
    print(0)
else:
    for a in A:
    ret *= a
    if ret > MAX:
        print(-1)
        break
    if ret < MAX:
    print(ret)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
MAX = 10**18
ret = 1
flag = True
if 0 in A:
    print(0)
else:
    for a in A:
        ret *= a
        if ret > MAX:
            print(-1)
            flag = False
            break
    if flag and ret <= MAX:
        print(ret)
import sys
n,y = map(int, input().split())

for a in range(n+1):
	for b in range(n+1-a):
	  if (a * 10000 + b * 5000 + (n-a-b) * 1000 == y):
				print(str(a) + ' ' + str(b) + ' ' + str(c))
				sys.exit()

print('-1 -1 -1')
sys.exit()

### FIXED CODE ###

import sys

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

for a in range(n+1):
	for b in range(n+1-a):
		c = n - a - b
		if (a * 10000 + b * 5000 + c * 1000 == y):
				print(str(a) + ' ' + str(b) + ' ' + str(c))
				sys.exit()
	
print('-1 -1 -1')
sys.exit()
a=int(input(''))
b=int(input(''))
if (a*b)%2=0:
  print('Even')
elif:
  prp('Odd')

### FIXED CODE ###

a,b=map(int,input().split())
print("Even" if a*b%2==0 else "Odd")
import math
n,k = map(int,input().split())
alist = list(map(int,input().split()))

max = 0
for i in range(n):
    if max < alist[i]:
        max = alist[i]

max_length = max

cur_length = max_length//2

cuts = 0
for i in range(n):
    cuts += math.ceil(alist[i]/cur_length)-1

test_k = cuts
prev_length = 0
while(cur_length != prev_length):

    prev_length = cur_length
    cuts = 0
    if test_k <= k:
        max_length = cur_length
        cur_length = cur_length//2
        for i in range(n):
            cuts += math.ceil(alist[i]/cur_length)-1
    else:
        cur_length = (cur_length+max_length)//2
        for i in range(n):
            cuts += math.ceil(alist[i]/cur_length)-1
    test_k = cuts

if test_k > k:
    print(cur_length+1)
else:
    print(cur_length)


### FIXED CODE ###

import math
n,k = map(int,input().split())
alist = list(map(int,input().split()))

max_length = max(alist)
cur_length = 0

while(max_length - cur_length > 1):
    next_length = (max_length+cur_length)//2

    test_k = 0
    for i in range(n):
        test_k += math.ceil(alist[i]/next_length)-1

    if test_k <= k:
        max_length = next_length
    else:
        cur_length = next_length
        

print(max_length)
if A<B<C<D:
    if "##" not in S:
        print("Yes")
    else:
        print("No")
else A<C<B<D:
    if "##" not in S[A:C-1] or "##" in S[B:D-1]:
        print("Yes")
    else:
        print("No")
elif A<B<D<C
    if "##" not in S and "..." in S[B-2:D+1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

N,A,B,C,D=map(int,input().split())
S=input()

if "##" in S[A:C-1] or "##" in S[B:D-1]:
    print("No")
    exit()
elif C>D and "..." not in S[B-2:D+1]:
    print("No")
else:
    print("Yes")
def main():
  
  n, k, q = map(int, input().split())
  a = [ int(input()) for i in range(q) ]
  a_count = a.count

  for i in range(1,n+1):
    x = a_count(i)
    if k-q+x > 0:
      print('Yes')
      else:
        print('No')


if __name__ == '__main__':
    main()

### FIXED CODE ###

n, k, q = map(int, input().split())
a = [ int(input()) for i in range(q) ]
score = [k-q]*n
for i in a:
    score[i-1] += 1
for i in score:
    print('Yes' if i > 0 else 'No')
n = int(input())
number = map(int,input().split())
print('{:.16g}').format(1/x for x in number)



### FIXED CODE ###

n = int(input())
a = map(int, input().split())
print('{:.16g}'.format(1/sum(1/x for x in a)))
input_number = int(input())

a = input_number//1000
b = (input_number-1000*a)//100
c = (input_number-1000*a-100*b)//10
d = input_number-1000*a-100*b-c*10
if a==b;
	print('Bad')
elif b==c;
	print('Bad')
elif c==d;
	print('Bad')
else:
    print('Good')

### FIXED CODE ###

input_number = int(input())
 
a = input_number//1000
b = (input_number-1000*a)//100
c = (input_number-1000*a-100*b)//10
d = input_number-1000*a-100*b-c*10
if a==b:
	print('Bad')
elif b==c:
	print('Bad')
elif c==d:
	print('Bad')
else:
    print('Good')
S = int(input())
Q = int(input())
rev = 1

for i in range(Q):
  line = input()
  if line == '1':
    rev *= -1
  else:
    a, F, C = input().split()
    if rev * int(F) in [1, -2]:
      S = C + S
    else:
      S = S + C

if rev == -1:
  S = S[::-1]
  
print(S)

### FIXED CODE ###

S = input()
Q = int(input())
rev = 1

head = []
tail = []

for i in range(Q):
  line = input()
  if line == '1':
    rev *= -1
  else:
    line = line.split()
    F = int(line[1])
    C = line[2]
    if rev * F in [1, -2]:
      head.append(C)
    else:
      tail.append(C)

head = head[::-1]
S = ''.join(head + [S] + tail)

if rev == -1:
  S = S[::-1]
  
print(S)
S=input()
K=int(input())
cnt=0
i=0
while S[i]=='1':
  cnt+=1
  i+=1
if cnt>K:
  ans=1
else:
  ans=S[cnt]
print(ans)

### FIXED CODE ###

s = str(input())
k = int(input())

for i in range(min(len(s),k)):
#「Sの長さ」と「K」の少ない方の回数分ループを回す
    if s[i] != '1':#Kまで１が続かなかったら
        print(s[i])#最初に出てきた１以外の数が出力される
        exit()#ループを抜けて終了

print('1')#Kまで１が続けば、１が出力される
while True:
	k=map(int,raw_input().split(" "))
	ct=0
	a=0
	b=0
	c=0	
	max=k[0]
	sum=k[1]
	a=max+1
	
	while True:
		a-=1
		b=a-1
		c=sum-a-b
		if not a>b>c:
			print ct
			break
		while a>b>c:
			if a>b>c>0:
				ct+=1
			b-=1
			c+=1
			

### FIXED CODE ###

while True:
	k=map(int,raw_input().split(" "))
	if k[0]==k[1]==0:
		break
	ct=0
	max=k[0]
	sum=k[1]
	a=max+1

	while True:
		a-=1
		b=a-1
		c=sum-a-b
		if not a>c:
			print ct
			break
		while b>c:
			if c>0:
				ct+=1
			b-=1
			c+=1
in_sec = int(input())

sec = in_sec % 60
min = (in_sec // 60) % 60
hour = (in_sec // 3600 )

print(hour,min,sec,sep(":"))

### FIXED CODE ###

time = int(input())

h = int(time/ 3600)
m = int((time%3600)/60)
s = int((time%3600)%60)

print(h,m,s,sep=':')