Harryxun/stf_run huggingface dataset:
a, b, h, m = [int(x) for x in input().split()]

#a, b, h, m = 3, 4, 11, 0

h_dig = 360 * (float(h) / 12) + 30 * (float(m) / 60)
m_dig = 360 * (float(m) / 60)

#print(str(h_dig) + " " +  str(m_dig))

abs_dig = abs(h_dig - m_dig)
if(abs_dig > 180):
    abs_dig = 360 - abs_dig

#print(abs_dig)

c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(abs_dig / 360 * 2 * math.pi))

print('{:.09f}'.format(c))

### FIXED CODE ###

import math

a, b, h, m = [int(x) for x in input().split()]

#a, b, h, m = 3, 4, 11, 0

h_dig = 360 * (float(h) / 12) + 30 * (float(m) / 60)
m_dig = 360 * (float(m) / 60)

#print(str(h_dig) + " " +  str(m_dig))

abs_dig = abs(h_dig - m_dig)
if(abs_dig > 180):
    abs_dig = 360 - abs_dig

#print(abs_dig)

c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(abs_dig / 360 * 2 * math.pi))

print('{:.09f}'.format(c))
prin(int(int(input()) ** 0.5))

### FIXED CODE ###

X = int(input())
a = 2
res = 1
while True:
  b = 2
  if a > 33:
    break
  while True:
    t = a ** b
    if t <= X:
      res = max(res, t)
      b += 1
    else:
      break
  a += 1

print(res)
s=input()
ans = 0
for I in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)

### FIXED CODE ###

s=input()
ans = 0
for i in range(len(s)-1):
 if s[i]!=s[i+1]:
  ans += 1
print(ans)
n = int(input())

print(800*n - int(n/15)200)

### FIXED CODE ###

n = int(input())

print(800*n - int(n/15)*200)
mod = 1000000007
n = int(input())

up = input()
dw = input()

arrays = 1

j = 0
justBefore = None

if up[j] == dw[j]:
    arrays *= 3
    j += 1
    justBefore = 0
else:
    arrays *= 6
    j += 2
    justBefore = 1

while(j != len(up)-1):
    if justBefore:
        if up[j] == dw[j]:
            arrays *= 1
            j += 1
            justBefore = 0
        else:
            arrays *= 4
            j += 2
            justBefore = 1
    else:
        if up[j] == dw[j]:
            arrays *= 2
            j += 1
            justBefore = 0
        else:
            arrays *= 2
            j += 2
            justBefore = 1
            
print(arrays/mod)

### FIXED CODE ###

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

if abs(a-x) < abs(b-x):
    print("A")
else:
    print("B")
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def is_prime3(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in xrange(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

if __name__ == "__main__":
    list = input().split(" ")
    N = int(list[0])
    M = int(list[1])
    if is_prime3(M):
        print(1)
        exit()
    for i in range(M):
        if M%(N+i) == 0:
            print(int(M/(N+i)))
            exit()
        if M/(N+i) < 2:
            print(1)
            exit()


### FIXED CODE ###


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

if __name__ == "__main__":
    list = input().split(" ")
    N = int(list[0])
    M = int(list[1])
    list = []
    for i in range(1,int(math.sqrt(M)+1)):
        if M%i == 0:
            list.append(i)
    for i in range(len(list)):
        list.append(int(M/list[i]))
    print(max([i for i in list if i <= M // N]))
def solve():
    import numpy as np
    ans=0
    for i in range(n-1):
        for j in range(i+1,n):
            ans+=a[i]^a[j]
    
    print(ans%(10**9+7))
    
n=int(input())
a=np.array(list(map(int,input().split())) )
solve()

### FIXED CODE ###

import sys
input=sys.stdin.readline
n=int(input())
a=tuple(map(int,input().split()))
mod=10**9+7
cnt=[0]*60

for temp in a:
    if temp==0:continue
    digit=len(bin(temp))-2
    for j in range(digit):
        if (temp>>j)&1:
            cnt[j]=cnt[j]+1

#print(cnt)
ans=0
for i in range(60):
    if cnt[i]==0:continue
    ans=(ans+pow(2,i)*cnt[i]*(n-cnt[i]))%mod
print(ans%mod)
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#print("A=",A)
#print("B=",B)

count = 0
for i in range(N+1):
    if i == 0:
        taosita = B[i]-max((B[i]-A[i]),0)
        count = taosita
        B[i]= B[i]-taosita
#        print("i=0")
    elif i!=N
        #1つ前の勇者
        taosita1 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita1
        A[i] = A[i]-taosita1
        #今回の勇者
        taosita2 = B[i]-max((B[i]-A[i]),0)
        count =count + taosita2
        B[i]= B[i]-taosita2
    if i == N:
        #1つ前の勇者
        taosita3 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita3
#        A[i] = A[i]-taosita1
print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#print("A=",A)
#print("B=",B)

count = 0
for i in range(N+1):
    if i == 0:
        taosita = B[i]-max((B[i]-A[i]),0)
        count = taosita
        B[i]= B[i]-taosita
#        print("i=0")
    elif i!=N:
        #1つ前の勇者
        taosita1 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita1
        A[i] = A[i]-taosita1
        #今回の勇者
        taosita2 = B[i]-max((B[i]-A[i]),0)
        count =count + taosita2
        B[i]= B[i]-taosita2
    if i == N:
        #1つ前の勇者
        taosita3 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita3
#        A[i] = A[i]-taosita1
print(count)
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

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

LCM = lcm(A)

ans = 0
for a in A:
    ans += int(LCM/a)
    ans %= 1000000007

print(ans)

### FIXED CODE ###

import sys #追加
sys.setrecursionlimit(500*500)

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return int(x)

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

LCM = lcm(A)

ans = 0
for a in A:
    ans += LCM//a

ans %= 1000000007

print(ans)
import math

n, d, a = map(int,input().split())
xh = [[0 for i in range(2)] for j in range(n)]
rang = [0 for i in range(n)]
for i in range(n):
    x,h = map(int,input().split())
    xh[i] = [x,h]
    rang[i] = x

num = 0
xh.sort(key=lambda xh:xh[0])]

dam = [0]*n
for i in range(n):
    res = xh[i][1]-dam[i]
    pos = xh[i][0]
    if res > 0:
        nat = math.ceil(res/a)
        num += nat
        for j in range(i+1,n):
            if rang[j] <= pos + 2d:
                dam[j] += a*nat
            else:
                break
print(num)


### FIXED CODE ###

import math

n, d, a = map(int,input().split())
xh = [[0 for i in range(2)] for j in range(n)]
left = [i for i in range(n)]
for i in range(n):
    x,h = map(int,input().split())
    xh[i] = [x,h]

num = 0
xh.sort(key=lambda xh:xh[0])

for i in range(n):
    for j in range(left[i-1],i):
        if xh[j][0]+d >= xh[i][0]-d:
            left[i] = j
            break

dam = [0]*n

def dsum(k):
    if k == 0:
        return 0
    elif left[k] == 0:
        return dam[k-1]
    else:
        return dam[k-1]-dam[left[k]-1]

for i in range(n):
    res = xh[i][1]-dsum(i)
    nat = max([math.ceil(res/a),0])
    dam[i] = dam[i-1]+a*nat
    if res > 0:
        num += nat

print(num)
import math

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

num_mul_c = 0
num_mul_d = 0
num_mul_cd = 0

n=1
while True:
    nc = n*c
    if nc>b:
        break
    if (a<=nc)and(nc<=b):
        num_mul_c += 1
    n += 1
n=1
while True:
    nd = n*d
    if nd>b:
        break
    if (a<=nd)and(nd<=b):
        num_mul_d += 1
    n += 1
n=1
cd = (c*d)//math.gcd(c, d)
while True:
    ncd = cd*n
    if ncd>b:
        break
    if (a<=ncd)and(ncd<=b):
        num_mul_cd += 1
    n += 1
print(b-a+1 - num_mul_c - num_mul_d + num_mul_cd)

### FIXED CODE ###

def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x

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

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

print(
    b - (b//c) - (b//d) + (b//cd) \
    -((a-1) - ((a-1)//c) - ((a-1)//d) + ((a-1)//cd))
    )
import math
import fractions
import functools
n, m = map(int, input().split())
*a, = map(int, input().split())

def lcm(a: int, b: int) -> int:
    return (a*b) // fractions.gcd(a, b)

l = functools.reduce(lcm, a)/2

ans = math.ceil((m//l)/2)
print(ans)


### FIXED CODE ###

import fractions
n, m = map(int, input().split())
*a, = map(int, input().split())

lcm = a[0]//2

for x in a:
    x //= 2
    g = fractions.gcd(lcm, x)
    if (lcm//g)%2 != (x//g)%2:
        print(0)
        quit()

    lcm = lcm*x//g

print((m//lcm + 1)//2)
from functools import reduce

n, m = map(int, input().split())
A =[i//2 for i in list(map(int, input().split()))]

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

def lcm(a, b):
    return a * b / gcd(a, b)


def cntTwo(n):
    cnt = 0
    while n % 2 == 0:
        cnt += 1
        n //= 2
    return cnt

if len(set(map(cntTwo, A))) != 1:
    print(0)
    exit()

def merge(a, b):
    l = lcm(a, b)
    if l > 10 ** 9:
        return 0
    return l

x = int(reduce(merge, A))
print(m//x - m//(x*2))

### FIXED CODE ###

from functools import reduce

n, m = map(int, input().split())
A =[i//2 for i in list(map(int, input().split()))]

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

def lcm(a, b):
    return a * b // gcd(a, b)


def cntTwo(n):
    cnt = 0
    while n % 2 == 0:
        cnt += 1
        n //= 2
    return cnt

if len(set(map(cntTwo, A))) != 1:
    print(0)
    exit()

def merge(a, b):
    l = lcm(a, b)
    if l > 10 ** 9:
        return 0
    return l

x = reduce(merge, A)
if x == 0:
    print(0)
else:
    print(m//x - m//(x*2))
import math
N,K= map(int,input().split())
choose_count = 1
for i in range(N):
	left = K - choose_count
	if left < 0:
		break
	choose = math.factorial(N-K+1)//(math.factorial(choose_count)*math.factorial(N-K+1-choose_count))
	if left < 0:
		break
	else:
		ans = choose*math.factorial(left+choose_count-1)//(math.factorial(left)*math.factorial(choose_count-1))
		print(int(ans)%1000000007)
	choose_count += 1

### FIXED CODE ###

import math
N,K= map(int,input().split())
choose_count = 1
for i in range(K):
	left = K - choose_count
	if left < 0:
		print(0)
		continue
	if N-K+1-choose_count<0:
		print(0)
		continue
	choose = math.factorial(N-K+1)//(math.factorial(choose_count)*math.factorial(N-K+1-choose_count))
	ans = choose*math.factorial(left+choose_count-1)//(math.factorial(left)*math.factorial(choose_count-1))
	print(int(ans)%1000000007)
	choose_count += 1
class BIT:
    '''
    0-indexed
    '''
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = n.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & -i
        return ret

    def bitsum(self, l, r=None): # [l, r)
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

    def bitadd(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        return

n = int(input())
m = (n * (n - 1) // 2) // 2
a = list(map(int, input().split()))
d = dict()
_a = sorted(set(a))
for i, x in enumerate(_a):
  d[x] = i
a = [d[x] for x in a]


def check(X):
  b = [0] + [(y>=X)*2 - 1 for y in a]
  for i in range(n):
    b[i+1] += b[i]
  c = min(b)
  b = [x-c for x in b] 
  bit = BIT(n + 10)
  ans = 0
  for x in b:
    ans += bit.bitsum(x+1)
    bit.bitadd(x, 1)
  return ans >= m

t = [len(_a) + 1, -1]
while t[0] - t[1] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(_a[t[1]])


### FIXED CODE ###

class BIT:
    '''
    0-indexed
    '''
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = n.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & -i
        return ret

    def bitsum(self, l, r=None): # [l, r)
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

    def bitadd(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        return

n = int(input())
m = n * (n + 1) // 4
a = list(map(int, input().split()))
d = dict()
_a = sorted(set(a + [0]))
for i, x in enumerate(_a):
  d[x] = i
a = [d[x] for x in a]


def check(X):
  b = [0] + [(y>=X)*2 - 1 for y in a]
  for i in range(n):
    b[i+1] += b[i]
  c = min(b)
  b = [x-c for x in b] 
  bit = BIT(max(b) + 2)
  ans = 0
  for x in b:
    ans += bit.bitsum(x + 1)
    bit.bitadd(x, 1)
  return ans >= m

t = [len(_a), 0]
while t[0] - t[1] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(_a[t[1]])
import sys
sys.setrecursionlimit(2000)
n, m, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n+1)]
uni = [-1 for i in range(n+1)]

def root(num, pea):
    if pea[num] < 0:
        return num
    else:
        pea[num] = root(pea[num], pea)
        return pea[num]

for i in range(m):
    a, b = ab[i]
    con[a] += 1
    con[b] += 1
    if uni[a] != uni[b] or uni[a] < 0 or uni[b] < 0:
        root_a = root(a, uni)
        root_b = root(b, uni)
        root_a, root_b = sorted([root_a, root_b])
        uni[root_a] += uni[root_b]
        uni[root_b] = root_a
        root(root_b, uni)

for i in range(k):
    c, d = cd[i]
    if root(c, uni) == root(d, uni):
        con[c] += 1
        con[d] += 1

result = []
for i in range(1, n+1):
    root_i = root(i, uni)
    result.append(-uni[root_i]-con[i])
print(*result)


### FIXED CODE ###

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


n, m, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n+1)]
uni = UnionFind(n+1)


for i in range(m):
    a, b = ab[i]
    con[a] += 1
    con[b] += 1
    uni.Unite(a, b)

for i in range(k):
    c, d = cd[i]
    if uni.isSameGroup(c,d):
        con[c] += 1
        con[d] += 1

result = []
for i in range(1, n+1):
    result.append(uni.Count(i)-con[i])
print(*result)
a,b = input().split()

print("H" if a == "H" ^ b == "H" else "D")

### FIXED CODE ###

a,b = input().split()

print("H" if (a == "D") ^ (b == "H") else "D")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
MOD = 10**9+7
es = [[] for _ in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)

cs = [1] * N
def dfs(v,p=-1):
    ret = 1
    for to in es[v]:
        if to==p: continue
        ret += dfs(to,v)
    cs[v] = ret
    return ret
dfs(0)
ans = 0
for i in range(N):
    if len(es[i]) == 1: continue
    ans += pow(2,N-1,MOD) - 1
    c = 0
    for to in es[i]:
        if cs[to] > cs[i]: continue
        c += cs[to]
        ans -= pow(2,cs[to],MOD) - 1
    ans -= pow(2,N-c-1,MOD) - 1

ans *= pow(2,-N,MOD)
print(ans%MOD)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

def solve():
    N = int(input())
    AB = [tuple(map(int,input().split())) for i in range(N-1)]
    MOD = 10**9+7
    es = [[] for _ in range(N)]
    for a,b in AB:
        a,b = a-1,b-1
        es[a].append(b)
        es[b].append(a)

    cs = [1] * N
    def dfs(v,p=-1):
        ret = 1
        for to in es[v]:
            if to==p: continue
            ret += dfs(to,v)
        cs[v] = ret
        return ret
    dfs(0)

    pow2 = [1]
    for i in range(N):
        pow2.append((pow2[-1]*2) % MOD)

    ans = 0
    for i in range(N):
        if len(es[i]) == 1: continue
        ans += pow2[N-1] - 1
        c = 0
        for to in es[i]:
            if cs[to] > cs[i]: continue
            c += cs[to]
            ans -= pow2[cs[to]] - 1
        ans -= pow2[N-c-1] - 1

    ans *= pow(pow2[N], MOD-2, MOD)
    print(ans%MOD)
solve()
from collections import deque

d=[(1,0),(0,1),(-1,0),(0,-1)]
H,W=map(int,input().split())
M = []
Max_list = []
for i  in range(H):
    t = input()
    M.append(t)
dist = [[-1]*W for _ in range(H)]
def BFS(i,j):
    q = deque()
    dist = [[-1]*W for _ in range(H)]
    if M[i][j] == '.':

        #前処理
        Ma = 0
        q.append((i, j))#スタート地点挿入
        dist[i][j] = 0
        while q:
            cx,cy = q.popleft()
            for nx,ny in d:
                x ,y= cx+nx,cy+ny
                if 0<= x < H and 0<= y < W and M[x][y] == "." and dist[x][y]==-1:
                    dist[x][y]=dist[cx][cy]+1
                    Ma = max(Ma,dist[x][y])
                    q.append((x,y))
        return Ma
for i in range(H):#全部の地点でBFSをためす
    for j in range(W):
        Max_list.append(BFS(i,j))

print(max(Max_list))


### FIXED CODE ###

from collections import deque
 
INF = float('inf')
MOD = 10 ** 9 + 7
dy = (0, -1, 0, 1)
dx = (1, 0, -1, 0)


H,W=map(int,input().split())
M = []
Max_list = []
for i  in range(H):
    t = input()
    M.append(t)
dx = [0,0,-1,1]
dy = [1,-1,0,0]
dist = [[-1]*W for _ in range(H)]
q = deque()
for i in range(H):
    for j in range(W):
        dist = [[-1]*W for _ in range(H)]
        if M[i][j] == '.':
            Ma = 0
            q.append((i, j))
            dist[i][j] = 0
            while q:
                cx,cy = q.popleft()
                for nx,ny in zip(dx,dy):
                    x ,y= cx+nx,cy+ny
                    if x<0 or y<0 or x>=H or y>=W or dist[x][y]>0:
                        continue
                    if M[x][y] == "." and dist[x][y] == -1:
                        dist[x][y]=dist[cx][cy]+1
                        Ma = max(Ma,dist[x][y])
                        q.append((x,y))
            # print(Ma)
            Max_list.append(Ma)
# print(Max_list)

print(max(Max_list))
n = int(input())
v = input().split()

v = map(lambda x: int(x), v)
for i in range(n-1):
  v.sort()
  v.append((v.pop()+v.pop())/2)
print(v[0])

### FIXED CODE ###

n = int(input())
v = input().split()

v = list(map(lambda x: int(x), v))
for i in range(n-1):
  v.sort()
  v.append((v.pop(0)+v.pop(0))/2)
print(v[0])
import math

p = input().split()
a = int(p[0])
b = int(p[1])

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

print(lcm(a, b))



### FIXED CODE ###



p = input().split()
a = int(p[0])
b = int(p[1])

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
def lcm(m, n):
    return int(m*n//gcd(m, n))

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

B-A = abs(b-a)
C-B = abs(c-b)
C-A = abs(c-a)

if B-A <= d and C-B <= d:
    print("Yes")
elif c-a =< d:
    print("Yes") 
else:
    print("No")

### FIXED CODE ###

a,b,c,d = map(int,input().split())
B_A = abs(b - a)
C_B = abs(c - b)
C_A = abs(c - a)
if B_A <= d and C_B <=d:
    print('Yes')
elif C_A <= d:
    print('Yes')
else:
    print('No')
n = int(input())
values = [int(input()) for i in range(n)]

maxv = -99999999
minimum = values[0]

for i in range(1, N):
    if values[i] - minimum > maxv:
        maxv = values[i] - minimum
    if values[i] < minimum:
        minimum = values[i]

print(maxv)

### FIXED CODE ###

n = int(input())
values = [int(input()) for i in range(n)]

maxv = -999999999
minimum = values[0]

for i in range(1, n):
    if values[i] - minimum > maxv:
        maxv = values[i] - minimum
    if values[i] < minimum:
        minimum = values[i]

print(maxv)
s = list(input())
t = list(input())

r = len(s) - len(t)
l = []
for start in range(r):
    count = 0
    for i in range(len(t)):
        if t[i] == s[start+i]:
            count +=1
    l.append(count)
ans = len(t)- max(l)
print(ans)
        

### FIXED CODE ###

s = list(input())
t = list(input())

r = len(s) - len(t)
l = []
if r != 0:
    for start in range(r):
        count = 0
        for i in range(len(t)):
            if t[i] == s[start+i]:
                count +=1
        l.append(count)
    ans = len(t)- max(l)
else:
    count = 0
    for i in range(len(t)):
        if t[i] == s[i]:
            count +=1
    ans = len(t)- count   

print(ans)
H,W,A,B = map(int, input().split())
MOD = 10 ** 9 + 7

N = H+W+1

def power(base, num):
    if num == 0:
        return 1
    elif num % 2==0:
        return power(base, num//2) **2 % MOD
    elif num==1:
        return base % MOD
    else:
        return power(base, num//2) **2 * base % MOD

fact = [0 for i in range(N)]
inv_fact = [0 for i in range(N)]

fact[0] = 1
for i in range(1, N):
    fact[i] = fact[i-1] * i % MOD
    
inv_fact[H+W] = power(fact[H+W], MOD-2)
for i in range(1, N):
    inv_fact[N-1-i] = inv_fact[N-i] * (N-i) % MOD

    
def comb(x,y):
    return (fact[x] * inv_fact[y])%MOD * inv_fact[x-y] % MOD

ans = 0

for i in range(1, W-B+1):
    ans += comb(H-A+B-2+i, H-A-1) * comb(A-1+W-B-i, A-1) % MOD
    ans %= MOD
print(ans%MOD)


### FIXED CODE ###

sx, sy, tx, ty = map(int, input().split())

ans = ""
for j in range(ty-sy):
    ans += "U"
for i in range(tx-sx):
    ans += "R"
for j in range(ty-sy):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
for j in range(ty-sy+1):
    ans += "U"
for i in range(tx-sx+1):
    ans += "R"
ans += "D"
ans += "R"
for j in range(ty-sy+1):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
ans += "U"

print(ans)
X = int(input())
def check(n):
    if n == 0:  return 1
    elif (n < 100):    return 0
    else:
        flag = check(n-100) + check(n-101) + check(n-102) + check(n-103) + check(n-104) + check(n-105)
        if flag == 0:   return 0
        else:   return 1

print(check(X))

### FIXED CODE ###

X = int(input())

check = [0]*(X+106)
check[0] = 1
for i in range(X+1):    ##0-Xまで
    if check[i] == 1:
        for tmp in [100, 101, 102, 103, 104, 105]:
            check[i + tmp] = 1


print(check[X])