peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import sys
import os
import math

def file_input():
    f = open('ABC168/input.txt', 'r')
    sys.stdin = f

def main():
    if os.getenv("ENV")=='LOCAL':
        file_input()

    A,B,H,M=map(int, input().split())

    A_r=360*(H*60+M)/(12*60)
    B_r=M*360/60

    dif=abs(A_r-B_r)
    if dif>180:
        dif-=180

    # print(math.cos(dif))
    ans=math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(dif)))

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
ab=[list(map(int,input().split())) for i in range(n)]
m=0
for i in range(n):
  i=n-1-i
  a,b=ab[i][0]+m,ab[i][1]
  m+=(b-a%b)%b
print(m)
# Judge status: Accepted
n = int(input())

sp = []
for i in range(n):
    s, p = map(str, input().split())
    sp.append([s, int(p), i + 1])
    
sp.sort(key=lambda x:x[1], reverse=True)
sp.sort(key=lambda x:x[0])

for e in sp:
    print(e[2])
# Judge status: Wrong Answer
N,Y=map(int,input().split())
ans=-1,-1,-1
for i in range(N+1):
    for j in range(N+1):
            if 1<=N-i-j<=2000 and 10000*i+5000*j+1000*(N-i-j)==Y:
                ans=i,j,N-i-j
print(*ans)
# Judge status: Accepted
import numpy as np

n, W = map(int, input().split())
dp = np.array([[0]*(W+1)]*(n+1))
for i in range(1, n+1):
    w, v = map(int, input().split())
    dp[i] = dp[i-1]
    dp[i][w:W+1] = np.maximum(dp[i-1][w:W+1], dp[i-1][:W+1-w]+v)
print(dp[n][W])
# Judge status: Wrong Answer
N = int(input())
A = int(input())


if A == 0:
    print("No")
    exit()

ans = N % A
print("Yes" if ans <= A else "No")
# Judge status: Accepted
def li():
    return [int(x) for x in input().split()]


a, b, c, d = li()

ans = max(a * c, a * d, b * c, b * d)
print(ans)
# Judge status: Accepted
from collections import deque

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

Q = deque([0])
comfort = 0
i = 0
while Q:
    if i == n:
        break
    comfort += Q.popleft()
    if i == 0:
        Q.append(a[i])
    elif i > 0:
        Q.append(a[i])
        Q.append(a[i])
    i += 1

print(comfort)
# Judge status: Wrong Answer
A, B = map(int,input().split())
cnt = 0
while B > 0:
    B -= A
    cnt += 1
print(cnt)
# Judge status: Accepted
m = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    m[i] = list(map(int, input().split()))

a1 = a2 = a3 = 0
b1, b2, b3 = m[0]
a2 = m[1][0] - b1
a3 = m[2][0] - b1

if ((m[1][1] != a2 + b2) or
    (m[1][2] != a2 + b3) or
    (m[2][1] != a3 + b2) or
    (m[2][2] != a3 + b3)):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
a,b,c,d = list(map(int,input().split()))

for i in range(100):
    c -= b
    if c <= 0:
        print('Yes')
        break

    a -= d
    if a <= 0:
        print('No')
        break
# Judge status: Accepted
A,B, C= list(map(int,input().split()))
K = int(input())

for i in range((K)):
    if(A>=B):
        B=B*2
    elif(B>=C):
        C=C*2
    else:
        break
        
    
if (C>B >A):
     print('Yes')
else:
     print('No')
# Judge status: Wrong Answer
S=str(input())
ans="WA"
if S[0]=="A":
    if "C" in S[2:-1] and S.count("C")==1:
        x=S.index("C")
        S[0].lower()
        S[x].lower()
        if S==S.lower():
            ans="AC"
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
s_ = s

while s_.count('()'):
    s_ = s_.replace('()', '')

l = s_.count(')')
r = len(s_) - l

ans = '(' * l + s + ')' * r
print(ans)
# Judge status: Accepted
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def gcd(n, m):
  while m:
    n, m = m, n%m
  return n

def main():
    a, b = na()

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

if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, k=map(int, input().split())

if b-a>=2*k:
  for i in range(k):
    print(a+i)
  for i in range(k-1,-1,-1):
    print(b-i)
else:
  for i in range(a,b+1):
    print(i)
# Judge status: Wrong Answer
N, W = list(map(int, input().split()))
WV = []
for _ in range(N):
  WV.append(list(map(int, input().split())))

dp = [[0] * (W+1) for _ in range(N+1)]

for n in range(1, N+1):
  for w in range(1, W+1):
    dp[n][w] = max(dp[n-1][max(0, w-WV[n-1][0])] + WV[n-1][1], dp[n-1][w])

print(max(dp[N]))
# Judge status: Accepted
from fractions import gcd

N = int(input())
A = tuple(map(int, input().split()))

gcd_left, gcd_right = [0] * N, [0] * N
gcd_left[0] = A[0]
gcd_right[-1] = A[-1]
for i in range(1, N):
    gcd_left[i] = gcd(gcd_left[i - 1], A[i])
for i in range(N - 2, -1, -1):
    gcd_right[i] = gcd(gcd_right[i + 1], A[i])

gcd_left = [gcd_right[-1]] + gcd_left
gcd_right = gcd_right + [gcd_left[1]]
ans = 1
for i in range(N):
    ans = max(ans, gcd(gcd_left[i], gcd_right[i + 1]))
print(ans)
# Judge status: Accepted
import math
a,b,c,d = map(int,input().split()) 

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a-=1
e=lcm(c,d)

ansb=0
ansb += b//c
ansb += b//d
ansb -= b//e



ansa=0
ansa += a//c
ansa += a//d
ansa -= a//e
print((b-a)-(ansb-ansa))
# Judge status: Accepted
from collections import defaultdict

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

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
wa=sum(a)
for i in range(n):
  wa-=a[i]
  ans=(ans+(wa*a[i]))%(10**9+7)
print(ans)
# Judge status: Accepted
from fractions import gcd

n = int(input())
*A, = map(int, input().split())
B = A[::-1]
L, R = [0]*(n+1), [0]*(n+1)
for i in range(n):
    L[i+1] = gcd(L[i], A[i])
    R[i+1] = gcd(R[i], B[i])
L, R = L[:n], R[:n][::-1]
print(max(gcd(l, r) for l, r in zip(L, R)))
# Judge status: Accepted
import math
from decimal import Decimal

 
a,b = input().split()
 
A = int(a)
B = Decimal(b)

print(math.floor(A*B))
# Judge status: Wrong Answer
a = list(map(int,input().split()))
b = a.pop(a.index(max(a)))
if b == sum(a):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import numpy as np

N = int(input())
a = np.array(list(map(int, input().split())))

a = np.bincount(a//400)

fixed = np.where(a[:8]>0)[0].shape[0]
colorful = a[8:].sum()

if fixed==0:
    fixed = 1
    colorful -= 1

print(fixed, fixed+colorful)
# Judge status: Accepted
s = input()
for i, j in zip('NWSE', 'SENW'):
    if i in s and j not in s:
        print('No')
        break
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
prev = input()
s = set([prev])
for i in range(n-1):
    w = input()
    if w in s:
        print('No')
        exit()
    if w[0] != prev[-1]:
        print('No')
        exit()
    s.add(w)
    prev = w
print('Yes')
# Judge status: Accepted
import math

n = int(input())
aL = list(map(int, input().split(" ")))

mc = 0
for a in aL:
    if a < 0:
        mc += 1

aL = list(map(lambda x: abs(x), aL))

if mc % 2 == 0:
    print(sum(aL))
else:
    print(sum(aL) - (2 * min(aL)))
# Judge status: Accepted
N = int(input())
S = input()

ws = [0]
for c in S:
    ws.append(ws[-1] + int(c=='.'))

ans = N
for i,w in enumerate(ws):
    rw = ws[-1] - w
    lb = i - w
    ans = min(ans, rw+lb)
print(ans)
# Judge status: Accepted
import sys
n, k = map(int, sys.stdin.readline().split())
r, s, p = map(int, sys.stdin.readline().split())
t = sys.stdin.readline()
ans = 0
for i in range(k, n):
  if t[i] == t[i-k]:
#    t[i] = "a"
    t = t[:i] + "a" + t[i+1:]
ans = t.count("r")*p + t.count("s")*r + t.count("p")*s

print(ans)
# Judge status: Accepted
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
w = LI()
t = float('inf')
for i in range(n):
    s_1 = sum(w[:i])
    s_2 = sum(w[i:])
    t = min(t, abs(s_1 - s_2))
print(t)
# Judge status: Wrong Answer
n,k = map(int, input().split()) #int
a = input().replace(" ","") #str
chokudai = "1" #str
fp = "1" #str
telenum = 0 #int
while True:
  chokudai = a[int(chokudai)-1]
  telenum += 1
  rooph = fp.find(chokudai) #int
  if rooph != -1:
    rooplen = len(fp)-rooph
    break
  else:
    fp = fp+chokudai
print(fp[rooph+k%rooplen])
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))

data = [0] * N
d0 = As[0] + 1
if d0 < N:
	data[d0] = 1

count = 0
for j in range(1, N):
#	print(data)
	A = As[j]
	d = j + 1 - A
	if d >= 0:
		count += data[d]
	d = A + j + 1
	if d < N:
		data[d] += 1

print(count)
# Judge status: Accepted
import math

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


def count(n, d):
    return n // d


c_dividable = count(B, C) - count(A-1, C)
d_dividable = count(B, D) - count(A-1, D)
cd = C*D // math.gcd(C, D)
cd_dividable = count(B, cd) - count(A-1, cd)

print((B-A+1) - (c_dividable+d_dividable-cd_dividable))
# Judge status: Accepted
l=[int(input()) for x in range(5)]
k=int(input())
ans='Yay!'
for l1 in l:
  for l2 in l:
    if abs(l1-l2) > k:
      ans=':('
      
print(ans)
# Judge status: Wrong Answer
n, m, k = map(int, input().split(' '))
a_list = list(map(int, input().split(' ')))
b_list = list(map(int, input().split(' ')))
a_sum = 0
b_sum = sum(b_list)

j = len(b_list)-1
best=0
for i, a in enumerate(a_list):
  a_sum+=a
  while ((a_sum + b_sum) > k) & (j>=0):
    b_sum-=b_list[j]
    j-=1
  if (a_sum + b_sum) <= k:
    if i+j+2 > best:
      best=i+j+2
  
    
print(best)
# Judge status: Accepted
n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

add_a=[]
for i in range(n-1):
    add_a.append(max(a[i]+a[i+1]-x,0))

ans=0
for i in range(n-1):
    ans+=min(add_a[i],a[i+1])
    if i!=n-2:
        add_a[i+1]=max(0,add_a[i+1]-min(add_a[i],a[i+1]))
    add_a[i]-=min(add_a[i],a[i+1])
ans+=add_a[0]

print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
lis=[0]*n
for i in range(0,n):
  lis[a[i]-1]=i+1
for i in range(0,n):
  print(a[i],end=" ")
# Judge status: Accepted
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

res = 0
for i in range(N):
    tmp1 = sum(A1[:N-i])
    tmp2 = sum(A2[-1-i:])
    res  = max(res,tmp1+tmp2)
print(res)
# Judge status: Accepted
from fractions import gcd

n,x = map(int,input().split())
x_list = list(map(int,input().split()))
hoge = set()
for y in x_list:
  hoge.add(abs(x-y))
ans = abs(x_list[0]-x)
for num in hoge:
  ans = gcd(num,ans)
print(ans)
# Judge status: Accepted
import math

n = int(input())
ans = math.ceil(n/1.08) 
if n != math.floor(ans*1.08):
    print(r':(')
else:
    print(ans)
# Judge status: Accepted
d,t,s = map(int,input().split())
print('Yes' if t*s >= d else 'No')
# Judge status: Accepted
n, i = map(int, input().split())
if n%i == 0:
    print(0)
else:
    print(1)
# Judge status: Accepted
N=int(input())
count=0
ans=0
tmp=5
if N<11:
	if N<=6:
		print(1)
	else:
		print(2)
else:
	ans=(N//11)*2
	if N%11==0:
		print(ans)
	elif N%11>6:
		print(ans+2)
	else:
		print(ans+1)
# Judge status: Accepted
from bisect import bisect_left
import numpy as np

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

border = np.arange(399, 3200, 400)
cnt = [0] * (len(border) + 1)
for i in a:
    cnt[bisect_left(border, i)] += 1

k = np.count_nonzero(cnt[:-1])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])
# Judge status: Wrong Answer
N, Y=map(int,input().split())#二つの数字をペアで入力。この時スペース区切りでInt型に変換
ans = -1,-1,-1

for i in range(N+1):
    for j in range(N):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y: #肝となる判定ロジック
            print(i, j, N-i-j)
            exit()

print('-1 -1 -1')
# Judge status: Wrong Answer
a,b,c,d,e=input().split()
if a==0:
  print("1")
if b==0:
  print("2")
if c==0:
  print("3")
if d==0:
  print("4")
if e==0:
  print("5")
# Judge status: Accepted
a,b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b= b, a%b
    return a
def lcm(a, b):
    return (a * b) // gcd(a, b)
print(lcm(a, b))
# Judge status: Accepted
N, H = map(int,input().split())
L = []
maxi = 0
for _ in range(N):
    a,b = map(int,input().split())
    maxi = max(maxi, a)
    L.append(b)
 
L = sorted([x for x in L if x > maxi],reverse=True)
throw = 0
for i in range(len(L)):
    throw += L[i]
    if throw >= H:
        print(i + 1)
        quit()
from math import ceil
print(ceil((H - throw) / maxi) + len(L))
# Judge status: Wrong Answer
n, x = map(int, input().split())
li_a = list(map(int, input().split()))

answer = 0
id = -1

for idx, a in enumerate(sorted(li_a)):
    id = idx
    if x >= a:
        answer += 1
        x -= a
    else:
        break
if x == 0 or answer == 0:
    print(answer)
else:
    if id == (n -1):
        print(answer - 1)
    else:
        print(answer)
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
MAX = 10**18
MIN = -10**18

n,k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))
# Judge status: Wrong Answer
s=[]
t=[]
s_new=input()
t_new=input()
for i in range(len(s_new)):
    s.append(s_new[i])
for i in range(len(t_new)):
    t.append(t_new[i])
s_sorted=sorted(s)
t_sorted=sorted(t)
if s[len(s)-1]<t[len(t)-1]:
    print('Yes')
elif s[len(s)-1]==t[len(t)-1] and len(s)<len(t):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

mx = 0
ans = 0
for e in p:
    mx = max(mx, e)
    if e >= mx:
        ans += 1

print(ans)
# Judge status: Accepted
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

n = ri()
a = []
b = []
for i in range(n):
    x,y = rl()
    a.append(x+y)
    b.append(x-y)
a.sort()
b.sort()
print(max(a[-1]-a[0], b[-1]-b[0]))
# Judge status: Wrong Answer
A,B = map(int, input().split())
print(A*B if A*B >= 81 else -1)
# Judge status: Accepted
n=int(input())
s=input()
W_cnt=[0]
E_cnt=[0]

for ss in s:
  w=W_cnt[-1]
  if ss=="W":
    w+=1
  W_cnt.append(w)

for ss in reversed(s):
  e=E_cnt[-1]
  if ss=="E":
    e+=1
  E_cnt.append(e)
E_cnt=E_cnt[::-1]

minc=float("inf")
for i in range(n):
  c=(W_cnt[i] + E_cnt[i+1])
  minc=min(minc,c)
print(minc)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = [0]*n
for i in range(n)[::-1]:
    tmp = 0
    for j in range(n//(i+1)):
        tmp += ans[(i+1)*(j+1)-1]
    if tmp%2 != a[i]:
        ans[i] += 1

print(n)
print(*ans)
# Judge status: Wrong Answer
n=int(input())
c=[0]*(n-1)
s=[0]*(n-1)
f=[0]*(n-1)
for i in range(n-1):
    c[i],s[i],f[i]=map(int,input().split())
for i in range(n-1):
    t=s[i]+c[i]
    for j in range(i+1,n-1):
        if t>=s[j]:
            t+=t%f[j]+c[j]
        else:
            t+=s[j]-t+c[j]
    print(t)
print('0')
# Judge status: Accepted
#usr/bin/python3
a = input()
b = input()
print(6-int(a)-int(b))
# Judge status: Accepted
import re
s = input()
print("YES" if re.match("(dream|dreamer|erase|eraser)+$", s) else "NO")
# Judge status: Accepted
n=int(input())
s=[list(map(str,input().split())) for i in range(n)]
for i in range(n):
  s[i][1]=int('-'+s[i][1])
  s[i].append(i+1)
s=sorted(s)
for i in range(n):
  print(s[i][2])
# Judge status: Accepted
n = int(input())
la = list(input().split())

if n % 2 == 0:
    l = list(reversed(la))[::2]
    l = l + la[::2]
    print(" ".join(l))

else:
    l = list(reversed(la))[::2]
    l = l + la[1::2]
    print(" ".join(l))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
four_num = 0
odd_num = 0
for a in A:
    if a % 4 == 0:
        four_num += 1
    elif a % 2 == 1:
        odd_num += 1
t = 0
if four_num + odd_num == N:
    t = 1
if four_num >= odd_num - t:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a,b,c = sorted(list(map(int,input().split())))
if a == c:
    print("1")
elif a == b:
    print("2")
else:
    print("3")
# Judge status: Accepted
S = input()
T = input()

n = len(S)
l = len(T)

for i in range(n-l+1)[::-1]:
  cnt = 0
  for j in range(l):
    if S[i+j] == "?" or S[i+j] == T[j]:
      cnt += 1
  
  if cnt == l:
    S = list(S[:i] + T + S[i+l:])
    for k in range(n):
      if S[k] == "?":
        S[k] = "a"
    print("".join(S))
    break
    
else:
  print("UNRESTORABLE")
# Judge status: Accepted
D, T, S = map(int, input().split())
if D / S <= T:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
# import math
# import statistics
# a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
e1,e2,e3 = map(int,input().split())
#f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))

if e1<=e3<=e2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()
print("2018/01/" + s[len("2017/01"):])
# Judge status: Wrong Answer
h, a = list(map(int, input().split()))
if h > a:
  print(h // a + 1)
else:
  print(1)
# Judge status: Accepted
S="012 345 678 036 147 258 048 246 "
A=[input().split()for i in range(3)]
for b in [input()for i in range(int(input()))]:
  for l in range(9):
    S=S.replace(str([9,l][b==(A[0]+A[1]+A[2])[l]]),"")
print(["No","Yes"][S.find("  ")>-1])
# Judge status: Accepted
n, m = map(int, input().split())
side1 = set()
side2 = set()

for i in range(m):
	a, b = map(int, input().split())

	if a == 1:
		side1.add(b)
	
	elif b == n:
		side2.add(a)

print(("" if side1 & side2 else "IM") + "POSSIBLE")
# Judge status: Wrong Answer
n = int(input())

s = ""

while n != 0:
    r = n % 2
    s += "0" if r == 0 else "1"
    n = (n - r) // (-2)

print(s[::-1])
# Judge status: Wrong Answer
x = int(input())
for i in range(x):
    if i**2 <= x:
        count = i**2
print(count)
# Judge status: Accepted
x,y=map(int,input().split())
ans=0
while x<=y:
  ans+=1
  x*=2
print(ans)
# Judge status: Wrong Answer
import numpy as np
def main():
  m=1000000007
  n=int(input())
  a=np.array(list(map(int,input().split())))
  b=np.flipud((np.cumsum(np.flipud(a)))[:-1])
  a=a[:-1]
  c=a*b
  d=np.sum(c)
  e=d%m
  print(e)
main()
# Judge status: Wrong Answer
from bisect import bisect_left
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()
ans=0

for elem in a:
    id1=bisect_left(b,elem)
    if id==n:
        continue
    else:
        for i in range(id1,n):
            id2=bisect_left(c,b[i])
            ans+=n-id2
print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for x in range(max(len(set(A)) - k, 0)):
    cnt = 200001
    for i in A:
        cnt = min(cnt, A.count(i))
        if cnt == A.count(i):
            rmv = i
    ans += cnt
    A.remove(rmv)
print(ans)
# Judge status: Accepted
n, k = list(map(int, input().split()))
H = list(map(int, input().split()))

dp = [0] * n

for i in range(n):
    if i == 0:
        dp[i] = 0
    elif i == 1:
        dp[i] = abs(H[0] - H[i])
    else:
        cands = []
        for j in range(1, k+1):
            if i - j >= 0:
                cost = dp[i - j] + abs(H[i - j] - H[i])
                cands.append(cost)

        dp[i] = min(cands)

print(dp[-1])
# Judge status: Wrong Answer
s=input()
count,ans=0,0
for i in range(len(s)):
  if s[i] in 'ACGT':
    count+=1
  else:
    ans=max(ans,count)
    count=0
print(ans)
# Judge status: Accepted
s = list(input())
label = [chr(i) for i in range(97, 97+26)]

ans = "None"
for l in label:
  if not l in s:
    ans = l
    break
    
print(ans)
# Judge status: Accepted
n=int(input())
ans=800*n-(n//15)*200
print(ans)
# Judge status: Wrong Answer
L = int(input())
a = L // 3
b = a
c = L - a - b
print(a*b*c)
# Judge status: Accepted
N, D = list(map(int, input().split()))
XS = [[0] * D for _ in range(N)]
for i in range(N):
	XS[i] = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
	for j in range(i + 1, N):
		c1 = 0
		for k in range(D):
			c1 += (XS[i][k] - XS[j][k]) ** 2
		c2 = c1 ** 0.5
		if c2 == int(c2):
			ans += 1
print(ans)
# Judge status: Accepted
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]

ct.sort()
jdg = False

for i in range(N):
    if ct[i][1] <= T:
      jdg = True
      break
    
print(ct[i][0] if jdg else 'TLE')
# Judge status: Accepted
import fractions
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
n = int(input())
t = [int(input()) for i in range(n)]
 
print(lcm(*t))
# Judge status: Wrong Answer
n, m = map(int, input().split())
box = [0] * (n+1)
box[1] = 1
for i in range(m):
  x, y = map(int, input().split())
  if box[x]:
    box[y] = 1
print(sum(box))
# Judge status: Wrong Answer
n, k = map(int, input().split())
#r, s, p = map(int, input().split())
p, r, s = map(int, input().split())
#h = {"r":p, "s":r, "p":s}
t = input()
lst = []
for i in range(k):
  lst.append([t[j] for j in range(len(t)) if j%k==i])
ans = 0
#print(lst)
for b in lst:
  tmp = ""
  for i in b:
    if i!=tmp:
      ans+=eval(i)
      tmp=i
print(ans)
# Judge status: Wrong Answer
x,y = map(int,input().split())

if 2*x <= y <= 4*x:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,M = map(int, input().split(' '))
heightList = input().split(' ')
checkifBestLT = [1 for i in range(N)]
nodeList =[[] for i in range(N)]

for i in range(M):
    node = input().split(' ')
    nodeList[int(node[0])-1].append(int(node[1])-1)
    nodeList[int(node[1])-1].append(int(node[0])-1)

for i in range(N):
    for j in nodeList[i]:
        if heightList[i] <= heightList[j]:
            checkifBestLT[i] = 0
            continue

print(sum(checkifBestLT))
# Judge status: Accepted
n,m = map(int, input().split())

h = [int(x) for x in input().split()]

n_list = [1]*n

for i in range(m):
    a,b = map(int, input().split())
    if h[a-1]  > h[b-1]:
        n_list[b-1] = 0
    elif h[b-1] > h[a-1]:
        n_list[a-1] = 0
    elif h[b-1] == h[a-1]:
        n_list[a-1] = 0
        n_list[b-1] = 0
print(sum(n_list))
# Judge status: Accepted
import math

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def euclid(y,z,d):
	result=0
	for i in range(d):
		result+=(y[i]-z[i])**2
	return math.sqrt(result)


n,d=input2()
X=[input_array() for _ in range(n)]

count=0
for i in range(n):
	for j in range(i+1,n):
		distance=euclid(X[i],X[j],d)
		if (distance%1) == 0:
			count+=1
print(count)
# Judge status: Wrong Answer
import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np


def main():
	n=int(input())
	s="abcdefghijklmn"

	li=[[] for _ in range(10)]
	li[0]="a"

	for i in range(1,10):
		for t in li[i-1]:
			for j in range(i+1):
				if s[j]=="a" or ord(t[-1])<=ord(s[j])<=ord(t[-1])+1:
					li[i].append(t+s[j])

	for i in li[n-1]:
		print(i)


if __name__ == "__main__":
	main()
# Judge status: Accepted
A, B, C, K = map(int, input().split())

if K < A:
    print(K)
elif K < A + B:
    print(A)
else:
    print(A - (K - A - B))
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a==1:
    a += 13
if b==1:
    b += 13
if a>b:
    print("Alice")
elif b<a:
    print("Bob")
else:
    print("Draw")
# Judge status: Wrong Answer
n = int(input())
N = n
ans = 0
i = 2
d = 0
while True:
  c=0  
  while n % i == 0:
    d = 1
    c += 1
    n //= i

  ln = 0
  leng = c
  for j in range(leng):
    if leng < j+1:
      break
    leng -= j+1
    ln += 1
  ans += ln
  if i>10**6:
    break
  i += 1

  
if d == 0 and N != 1:
  ans = 1
print(ans)