Harryxun/stf_run huggingface dataset:
class Queue():
    def __init__(self, size=10):
        self.queue = [None] * size
        self.head = self.tail = 0
        self.MAX = size
        self.num_items = 0

    def is_empty(self):
        return self.num_items == 0

    def is_full(self):
        return self.num_items == self.MAX

    def enqueue(self, x):
        if self.is_full():
            raise IndexError

        self.queue[self.tail] = x
        self.num_items += 1
        if self.tail+1 == self.MAX:
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            raise IndexError

        x = self.queue[self.head]
        self.num_items -= 1
        if self.head+1 == self.MAX:
            self.head = 0
        else:
            self.head += 1

        return x


class Process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

    def print_time(self):
        return self.time

    def print_name(self):
        return self.name


def main():
    n, q = map(int, input().split())
    qq = Queue()

    t = 0
    for i in range(n):
        name, time = input().split()
        p = Process(name, int(time))
        qq.enqueue(p)

    while not qq.is_empty():
        p = qq.dequeue()

        if p.time - q <= 0:
            t += p.time
            print("{} {}".format(p.name, t))
        else:
            p.time -= q
            t += q
            qq.enqueue(p)


if __name__ == '__main__':
    main()



### FIXED CODE ###

class Queue():
    def __init__(self, size=10):
        self.queue = [None] * size
        self.head = self.tail = 0
        self.MAX = size
        self.num_items = 0

    def is_empty(self):
        return self.num_items == 0

    def is_full(self):
        return self.num_items == self.MAX

    def enqueue(self, x):
        if self.is_full():
            raise IndexError

        self.queue[self.tail] = x
        self.num_items += 1
        if self.tail+1 == self.MAX:
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            raise IndexError

        x = self.queue[self.head]
        self.num_items -= 1
        if self.head+1 == self.MAX:
            self.head = 0
        else:
            self.head += 1

        return x


class Process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

    def print_time(self):
        return self.time

    def print_name(self):
        return self.name


def main():
    n, q = map(int, input().split())
    qq = Queue(n)

    t = 0
    for i in range(n):
        name, time = input().split()
        p = Process(name, int(time))
        qq.enqueue(p)

    while not qq.is_empty():
        p = qq.dequeue()

        if p.time - q <= 0:
            t += p.time
            print("{} {}".format(p.name, t))
        else:
            p.time -= q
            t += q
            qq.enqueue(p)


if __name__ == '__main__':
    main()
def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += ans[i] + "\n"
    else:
      string += ans[i]
  return string

n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))
    

### FIXED CODE ###

def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += str(ans[i]) + "\n"
    else:
      string += str(ans[i])
  return string
 
n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))
a,b,c,d,e,f = map(int, input().split())
max_a = a * 100 * e * 10 ** (-2)
max_b = b * 100 * e * 10 ** (-2)

sugar_a = []
sugar_b = []
for i in range(100):
    for j in range(100):
        sugar_check = c * i + d * j
        if a * 100 + sugar_check <= f:
            sugar_a.append(sugar_check)
        if b * 100 + sugar_check <= f:
            sugar_b.append(sugar_check)
            
sugar_sort_a = sorted(list(set(sugar_a)))
sugar_sort_b = sorted(list(set(sugar_b)))

from bisect import bisect_left,bisect_right
sugar_max_a = sugar_sort_a[bisect_right(sugar_sort_a, max_a)-1]
a_check = sugar_max_a / (a* 100 + sugar_max_a)

sugar_max_b = sugar_sort_b[bisect_right(sugar_sort_b, max_b)-1] 
b_check = sugar_max_b / (b*100 + sugar_max_b)

if a_check >= b_check:
    print(a*100+sugar_max_a, sugar_max_a)
else:
    print(b*100+sugar_max_b, sugar_max_b)

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())
water_list = []
for i in range(f+1):
    for j in range(f+1):
        water = a * 100 * i + b * 100 * j
        if water <= f:
            water_list.append(water)
        else:
            break
            
sugar_list = []
for i in range(f+1):
    for j in range(f+1):
        sugar = c * i + d * j
        if sugar <= f:
            sugar_list.append(sugar)
        else:
            break
            
ans = []
for i in list(set(water_list)):
    for j in list(set(sugar_list)):
        if i != 0:
            if float(j) / i  <= e / 100 and (i + j) <= f:
                ans.append((i+j, j))
                
ans_sorted = sorted(ans, key=lambda x: (x[1] / (x[0])))[-1]
print(ans_sorted[0],ans_sorted[1])
N,M = list(map(int, input().split()))
a = [0]*N
b = [0]*N
c = [0]*M
d = [0]*M
for k in range(N):
     a[k],b[k] = list(map(int, input().split()))
for l in range(M):
     c[l],d[l] = list(map(int, input().split()))

for i in range(N):
    s=10**8
    for j in range(M):
        if  s>abs(a[i]-c[j])+abs(b[i]-d[j]):
             s=abs(a[i]-c[j])+abs(b[i]-d[j])
             e=j+1
    print(e)


### FIXED CODE ###

N,M = list(map(int, input().split()))
a = [0]*N
b = [0]*N
c = [0]*M
d = [0]*M
for k in range(N):
     a[k],b[k] = list(map(int, input().split()))
for l in range(M):
     c[l],d[l] = list(map(int, input().split()))

for i in range(N):
    s=10**9
    for j in range(M):
        if  s>abs(a[i]-c[j])+abs(b[i]-d[j]):
             s=abs(a[i]-c[j])+abs(b[i]-d[j])
             e=j+1
    print(e)
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if n % 3 != 0:
    print('No')

counter = collections.Counter(input_list)
if len(counter) != 3:
    print('No')

unique_list = list(counter.keys())
counts = list(counter.values())
if (unique_list[0] ^ unique_list[1] == unique_list[2]):
    if (all(counts[0] == num for num in counts)):
        print('Yes')
print('No')

### FIXED CODE ###

import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(unique_list) != 3:
                print('No')
            elif (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
                else:
                    print('No')
            else:
                print('No')
    else:
        print('No')
a = input()

print(a + a ** 2 + a ** 3)

### FIXED CODE ###

a = int(input())

print(a + a ** 2 + a ** 3)
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
b = sorted(list(map(int, input().split())), reverse = True)
c = sorted(list(map(int, input().split())), reverse = True)
d = min(x*y*z, 3000)
dp = [0] * (x*y*z)
count = 0
for i in range(x):
    for j in range(y):
        for t in range(z):
            dp[count] = a[i] + b[j] +  c[t]
            count += 1

dp = sorted(dp, reverse = True)

for i in range(d):
    print(dp[i])

### FIXED CODE ###

x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
li = []
box = []
for i in a:
    for j in b:
        li.append(i + j) 
li.sort(reverse = True)
li = li[:min(k,x*y)]
for i in c:
    for j in li:
        box.append(i + j)
box.sort(reverse = True)
for i in range(k):
    print(box[i])
H,W = [int(i) for i in input().split()]
pic = [list(input()) for _ in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
def dfs(x,y):
    pic[x][y] = "."
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        if pic[nx][ny] == ".":
            continue
        dfs(nx,ny)
a = 1
ans = "Yes"
for i in range(H):
    for j in range(W):
        if pic[i][j] == "#":
            count = 0
            for k in range(4):
                nx = i + dx[k]
                ny = j + dy[k]
                if nx < 0 or ny < 0 or nx >= W or ny >= H:
                    continue
                if pic[nx][ny] == "#":
                    count+=1
            if count == 0:
                ans = "No"
                a = 0
                break
    if a == 0:
        break
print(ans)

### FIXED CODE ###

h, w = list(map(int, input().split()))
graph = []
def check(s,t):
    if (0 <=  s <= w - 1) and (0 <= t <= h - 1):
        return True
    else:
        return False
def check_around(x,y):
    if check(x+1,y) and graph[y][x+1] == '#':
        return True
    if check(x,y+1) and graph[y+1][x] == '#':
        return True
    if check(x-1,y) and graph[y][x-1] == '#':
        return True
    if check(x,y-1) and graph[y-1][x] == '#':
        return True
    return False
for i in range(h):
    graph.append(list(input()))
for i in range(h):
    for j in range(w):
        if graph[i][j] == '#':
            if  not check_around(j,i):
                print("No")
                exit()
print("Yes")
x=[(int(input()) for i in range(5)]
k=int(input())

if x[-1]-x[0]<=k:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

x=[int(input()) for i in range(5)]
k=int(input())

if x[-1]-x[0]<=k:
  print("Yay!")
else:
  print(":(")
n,m,k=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
d=0
e=0
ans=0
while c<=k:
  if a[d]>=b[e]:
    c+=b[e]
    e+=1
    ans+=1
  else:
    c+=a[d]
    d+=1
    ans+=1
if c==k:
  print(ans)
else:
  print(ans-1)

### FIXED CODE ###

n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
aa = [0]
bb = [0]
 
for s in range(n):
    aa.append(aa[s] + a[s])
for s in range(m):
    bb.append(bb[s] + b[s])      
ans = 0
j = m
 
for i in range(n+1):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)
import sys,math,collections,itertools,copy
input = sys.stdin.readline

H,W=list(map(int,input().split()))
s = []
dot_cnt = 0
for _ in range(W):
    a = input().rstrip()
    dot_cnt += a.count('.')
    s.append(list(a))

numOpe = 0
while dot_cnt:
    numOpe += 1
    tmp = copy.deepcopy(s)
    for ih in range(H):
        for iw in range(W):
            if s[ih][iw]=='#':
                if (ih+1 != H) and (s[ih+1][iw]!='#')and(tmp[ih+1][iw]!='#'):
                    tmp[ih+1][iw]='#'
                    dot_cnt -=1
                elif(ih-1 != -1) and (s[ih-1][iw]!='#')and(tmp[ih-1][iw]!='#'):
                    tmp[ih-1][iw]='#'
                    dot_cnt -=1
                elif(iw+1 != W) and (s[ih][iw+1]!='#')and( tmp[ih][iw+1]!='#'):
                    tmp[ih][iw+1]='#'
                    dot_cnt -=1
                elif(iw-1 != -1) and (s[ih][iw-1]!='#')and(tmp[ih][iw-1]!='#'):
                    tmp[ih][iw-1]='#'
                    dot_cnt -=1        

    s = copy.deepcopy(tmp)
print(numOpe)


### FIXED CODE ###

import sys,math,collections,itertools,copy
input = sys.stdin.readline

H,W=list(map(int,input().split()))
s = []
dot_cnt = 0
for _ in range(H):
    a = input().rstrip()
    dot_cnt += a.count('.')
    s.append(list(a))

num_lis = [[float('inf')]*W for _ in range(H)]

#--#
for ih in range(H):
    for iw in range(W):
        if s[ih][iw]=='#':
            num_lis[ih][iw]=0
        else:
            if iw-1>=0:
                num_lis[ih][iw] = min(num_lis[ih][iw-1]+1,num_lis[ih][iw])
                
    for iw in range(W-1,-1,-1):
        
        if s[ih][iw]=='#':
            num_lis[ih][iw]=0
        else:
            if iw+1<=W-1:
                num_lis[ih][iw] = min(num_lis[ih][iw+1]+1,num_lis[ih][iw])

#--#
for iw in range(W):
    for ih in range(H):
        if s[ih][iw]=='#':
            num_lis[ih][iw]=0
        else:
            if ih-1>=0:
                num_lis[ih][iw] = min(num_lis[ih-1][iw]+1,num_lis[ih][iw])
                
    for ih in range(H-1,-1,-1):
        if s[ih][iw]=='#':
            num_lis[ih][iw]=0
        else:
            if ih+1<=H-1:
                num_lis[ih][iw] = min(num_lis[ih+1][iw]+1,num_lis[ih][iw])

maxOpe = 0
for iw in range(W):
    for ih in range(H):
        maxOpe = max(maxOpe,num_lis[ih][iw])
print(maxOpe)
a = input()
b = input()


cnt = 0
for i in range(3):
  if a[i]== b[i]:
    cnt += 1
pint(cnt)


### FIXED CODE ###

s = input()
t = input()
cnt = 0
for i in range(3):
  if s[i] == t[i]:
    cnt += 1
print(cnt)
n, m = [int(i) for i in input().split()]
G = [[] for i in range(n + 1)]
C = [m for i in range(n + 1)]
for i in range(n - 1):
    x, y = [int(i) for i in input().split()]
    G[x].append(y)
    G[y].append(x)

ans = 1
def dfs(u):
    global ans, C, G
    ans *= C[u]
    ans %= 1000000007
    # print(u, C[u], ans)
    tot = 1
    if u != 1:
        tot += 1
    for v in G[u]:
        C[v] -= tot
        G[v].remove(u)
        dfs(v)
        tot += 1
dfs(1)
print(ans)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
# n, m = 100000, 100000

G = [[] for i in range(n + 1)]
C = [m for i in range(n + 1)]
for i in range(n - 1):
    x, y = [int(i) for i in input().split()]
    # x, y = i + 1, i + 2
    G[x].append(y)
    G[y].append(x)

ans = 1
def dfs(s):
    global ans, C, G
    stack = [s]
    while len(stack):
        u = stack[len(stack) - 1]
        stack.pop()
        ans *= C[u]
        ans %= 1000000007
        # print(u, C[u], ans)
        tot = 1
        if u != 1:
            tot += 1
        for v in G[u]:
            C[v] -= tot
            G[v].remove(u)
            stack.append(v)
            tot += 1

dfs(1)
print(ans)
X = input()

fx = 0
for x in X:
    fx += int(x)

if X % fx == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

def main():
    N = int(input())
    M = list(map(int, list(str(N))))

    t = 0
    for m in M:
        t += m

    if N % t == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
a, b = map(int, input().split())

if a+b=15:
    print('+')

elif:
    a*b=15
    print('*')

else:
    print('×')

### FIXED CODE ###

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

if a + b == 15:
    print('+')
elif a*b==15:
    print('*')
else:
    print('x')
n[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(n[k+1])

### FIXED CODE ###

number = [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(number[int(input())-1])
import math
a,b = map(int,input().split())

print((a*b) // math.gcd(a,b))

### FIXED CODE ###

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

print((a*b) // fractions.gcd(a,b))
import math
def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M // math.gcd(N, M)
    cand = (result // N) * (result // M) // math.gcd((result // N), (result // M))
    for i in range(0, result // cand):
        if S[(i * cand) // (result // N)] != T[(i * cand) // (result // M)]:
            return -1
    return result
print(main())

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M / gcd(N, M)
    cand = (result / N) * (result / M) / gcd(int((result / N)), int((result / M)))
    for i in range(0, int(result / cand)):
        if S[int((i * cand) / (result / N))] != T[int((i * cand) / (result / M))]:
            return '-1'
    return int(result)
print(main())
n = int(input())
 
li = list(map(int, input().split()))
 
ans = [0]*n
for i in range(n):
    li2 = li.copy()
    del li2[i]
    li3 = list(set(li2))
    for j in range(len(li3)):
        m = li2.count(li3[j])*(li2.count(li3[j])-1)/2
        ans[i] += m
for l in range(len(ans)):
    print(int(ans[l]))

### FIXED CODE ###

N=int(input())
K=list(map(int, input().split()))
from collections import Counter
ans = 0
C = Counter(K)
for k, v in C.items():
    ans += v*(v-1)//2

for a in K:
    e = C[a]
    print(ans-e*(e-1)//2+(e-1)*(e-2)//2)
n = int(input())

a = []
s = 0
while (-2)**s<1000000000:
    a.append((-2)**s)
    s += 1


def judge(n):
    sum = 0
    count = 0
    dig = 0
    if n >0:
        for num in a:
            count += 1
            if num >0:
                sum += num
            if sum >= n:
                dig = count
                break
    else:
        for num in a:
            count += 1
            if num <0:
                sum += num
            if sum <= n:
                dig = count
                break
            
    return dig
    
ans = ["0" for i in range(judge(n))]

while n!=0:
    ans[judge(n)-1] = "1"
    n -= a[judge(n)-1]

    
answer = ""
for i in range(len(ans)-1,-1,-1):
    answer += ans[i]
    
print(answer)

    
    

### FIXED CODE ###

n = int(input())

a = []
s = 0
while (-2)**s<10000000000:
    a.append((-2)**s)
    s += 1


def judge(n):
    sum = 0
    count = 0
    dig = 0
    if n >0:
        for num in a:
            count += 1
            if num >0:
                sum += num
            if sum >= n:
                dig = count
                break
    else:
        for num in a:
            count += 1
            if num <0:
                sum += num
            if sum <= n:
                dig = count
                break
            
    return dig
    
ans = ["0" for i in range(judge(n))]


while n!=0:
    ans[judge(n)-1] = "1"
    n -= a[judge(n)-1]

    
answer = ""
for i in range(len(ans)-1,-1,-1):
    answer += ans[i]
    
print(answer)
n = int(input())
if n < 1 or n > 100:
    exit()

n1 = input()

i = len(n1)
if i < 1 or i > 100:
    exit()

n2 = '...'

if n >= i:
    print(n1)
else:
    print(n1[:n] + n2)

### FIXED CODE ###

n = list(input())

i = len(n) - 1

if n[i] == '3':
    print('bon')
elif n[i] == '0' or n[i] == '1' or n[i] == '6' or n[i] == '8':
    print('pon')
else:
    print('hon')
in_t = input().split()
n = int(in_t[0])
k = int(in_t[1])
list = []
for i in range(k):
 list.append(int(input()))
for i in range(n - k):
 new = int(input())
 if (list[k-1] > new) | (new > list[2]):
  list.append(new)
  list.sort()
  diff_max = list[k-1] - list[k-2]
  diff_min = list[1] - list[2]
  if (diff_max > diff_min):
   list.remove(list[0])
  else:
    list.remove(list[k-1])
print(list[k-1] - list[0])

### FIXED CODE ###

d = 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")
n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
    if a<=sum(list(map(int, list(str(i)))))<=b:
        ans += i
print(ans)

### FIXED CODE ###

A,B,C,D =map(int,input().split())
if A+B>C+D:
  print("Left")
elif A+B==C+D:
  print("Balanced")
else:
  print("Right")
N = int(input())

def f(n):
    if n < 2:
        return 1
    if n >= 2:
        return n*f(n-2)

def memoize(f): #メモ化関数
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func
      
@memoize
def memf(n):
    if ( n<=1 ):
        return 1
    else:
        return n*f(n-2)
        
ans = memf(N)
# print(ans)
str_ans = str(ans)
count = 0
for s in reversed(str_ans):
    if s != '0':
        break
    count += 1
print(count)

### FIXED CODE ###

N = int(input())

def factorial(n, p):
    if n == 0: return 0
    return n//p + factorial(n//p, p)

def duble_factorial(n, p):
    if n%2 == 1:
        return factorial(n,p) - duble_factorial(n-1, p) # n!! = n!/(n-1)!!だからpで割ると引き算で表せるよね
    else:
        res = factorial(n//2, p)
        if p == 2: 
            res += n//2
        return res

ans = min(duble_factorial(N,2), duble_factorial(N,5))
print(ans)
# coding: utf-8
# Your code here!

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

if K=1:
    print(0)
else:
    print(N-K)
    

### FIXED CODE ###

# coding: utf-8
# Your code here!

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

if K==1:
    print(0)
else:
    print(N-K)
a, b, c, d = mao(int, input().split())

if abs(a - c) <= d:
    print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if abs(a - c) <= d:
    print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
else:
    print('No')
n = int(input())
l = [int(input()) for i in range(n)]
#print(n,l)

L = 0
cnt = 0
for i in range(n):
    if l[i] >= l[i+1]:
        cnt += 1
    else:
        cnt = 0
    if L <= cnt:
        L = cnt
print(L)

### FIXED CODE ###

import bisect

N = int(input())
A = [10**10 - int(input()) for i in range(N)]
INF = 10**12

dp = [INF for i in range(N+1)]
#print(A,dp)

for a in A:
    i = bisect.bisect_right(dp,a)
    dp[i] = a
#print(dp)
res = bisect.bisect_left(dp,INF)
print(res)
a,b,k=map(int, input().split())
l=list(range(a,b+1))
for i in l:
	if i<(a+k) or i>(b-k):
		print(i)

### FIXED CODE ###

a,b,k = map(int, input().split())
for i in range(a,min(b+1,a+k)):
    print(i)
for i in range(max(b-k+1,(a+k)),b+1):
    print(i)
import math
n,k = map(int,input().split())

m = math.floor(n/k)
n = n-m*k

print(min(n,abs(n-k))

### FIXED CODE ###

import math
n,k = map(int,input().split())
     
#m = math.floor(n/k)
n = n%k
     
print(min(n,k-n))
s = input()
if s[5] == '1' or s[6] > 4 : print("TBD")
else : print("Heisei")

### FIXED CODE ###

s = input()
if s[5] == '1' or s[6] > '4' : print("TBD")
else : print("Heisei")