Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(5000000)

primes = []
MAX_NUM = 100000
is_prime = [True] * MAX_NUM
is_prime[0] = False
is_prime[1] = False
for num in range(MAX_NUM):
    if is_prime[num]:
        primes.append(num)
        for j in range(2*num, MAX_NUM, num):
            is_prime[j] = False

def do_prime_factorization(x):
    ps = []
    i = 0
    n = len(primes)
    while (x > 1) and (i < n):
        p = primes[i]
        while x % p == 0:
            x /= p
            ps.append(p)
        i += 1
    if x > 1:
        ps.append(p)
    res = {}
    for p in ps:
        if not p in res:
            res[p] = 0
        res[p] += 1
    return res

def f(x, d, n, m, ps):
    if x >= n:
        return x
    if d >= len(ps):
        return m
    p, num = ps.items()[d]
    res = m
    for i in range(num+1):
        y = x * (p**i)
        res = min(res, f(y, d+1, n, m, ps))
    return res

def solve(n, m):
    ps = do_prime_factorization(m)
    q = f(1, 0, n, m, ps)
    assert m % q == 0, (m, q)
    p = m // q
    return p

n, m = map(int, raw_input().split())
print(solve(n, m))

### FIXED CODE ###

primes = []
MAX_NUM = 100000
is_prime = [True] * MAX_NUM
is_prime[0] = False
is_prime[1] = False
for num in range(MAX_NUM):
    if is_prime[num]:
        primes.append(num)
        for j in range(2*num, MAX_NUM, num):
            is_prime[j] = False

def do_prime_factorization(x):
    res = {}
    for p in primes:
        if x == 1:
            break
        while x % p == 0:
            x /= p
            if not p in res:
                res[p] = 0
            res[p] += 1
    if x > 1:
        res[x] = 1
    return res.items()

def f(x, d, n, m, ps):
    if x >= n:
        return x
    if d < 0:
        return m
    p, num = ps[d]
    res = m
    for i in range(num+1):
        y = x * (p**i)
        res = min(res, f(y, d-1, n, m, ps))
    return res

def solve(n, m):
    ps = do_prime_factorization(m)
    q = f(1, len(ps)-1, n, m, ps)
    p = m // q
    return p

n, m = map(int, raw_input().split())
print(solve(n, m))
from collections import Counter
N = int(input())
S = input()
array = []
for i in range(1,N-1):
    S1 = list(S[:i])
    S2 = list(S[i:])
    S1c = Counter(S1)
    S2c = Counter(S2)
    suma = 0
    for k in S1c:
        if k in S2c:
            suma += 1
    array.append(suma)
print(max(array))

### FIXED CODE ###

from collections import Counter
N = int(input())
S = input()
array = []
for i in range(1,N):
    S1 = list(S[:i])
    S2 = list(S[i:])
    S1c = Counter(S1)
    S2c = Counter(S2)
    suma = 0
    for k in S1c:
        if k in S2c:
            suma += 1
    array.append(suma)
print(max(array))
A,B = map(int,input().split())


if(B-A)%2=1:
  print("IMPOSSIBLE")
  
else:
  print((B-A)//2)

### FIXED CODE ###

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

if (B%2!=A%2):
  print("IMPOSSIBLE")
  
else:
  print((B+A)//2)
N=int(input())
M,A,R,C,H=0,0,0,0,0
for i in range(N):
    s=input()[0]
    if s=='M':
        M+=1
    elif s=='A':
        A+=1
    elif s=='R':
        R+=1
    elif s=='C':
        C+=1
    elif s=='H':
        H+=1

print(M*A*R + M*A*C + M*A*H + M*R*C + M*R*H + \
      M*C*H + A*R*C + A*R*H + A*C*H + R*C*H)

### FIXED CODE ###

print(int(input())//3)
import sys
 
H,W,M = list(map(int, input().split()))

hw = [[0] * (W+1) for _ in range(H+1)]
 
w = [0] * (W+1)
h = [0] * (H+1)
mxw = []
mxw_v = 0
mxh = []
mxh_v = 0
 
 
for i in range(M):
    h_i, w_j = list(map(int, input().split()))
    hw[h_i][w_j] = 1
    h[h_i] += 1
    w[w_j] += 1
    if mxw_v < w[w_j]:
        mxw_v = w[w_j]
        mxw = [w_j]
    elif mxw_v == w[w_j]:
        mxw.append(w_j)
 
    if mxh_v < h[h_i]:
        mxh_v = h[h_i]
        mxh = [h_i]
    elif mxh_v == h[h_i]:
        mxh.append(h_i)
a = 0
for i in mxh:
    for j in mxw:
        d = hw[i][j]
        a = max(a, mxh_v + mxw_v - d)
print(a)

### FIXED CODE ###

H,W,M = list(map(int, input().split()))

hw = set()
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.add((h_i-1) + (w_j-1)*3*10**6)
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not(i + j*3*10**6 in hw):
            print(mxh_v+mxw_v)
            exit()
print(mxh_v+mxw_v-d)
import sys
for i in sys.stdin: print len(list(str(sum(map(int,raw_input().split())))))
	

### FIXED CODE ###

import sys
for i in sys.stdin: print len(list(str(sum(map(int,i.split())))))
a = int(input())
ar = list(map(int,input().split()))
if 0 in ar:
    print(0)
    return
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        exit()
print(b)


### FIXED CODE ###

a = int(input())
ar = list(map(int,input().split(" ")))
if 0 in ar:
    print(0)
    exit()
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        exit()
print(b)
import math

h = int(input())
a = int(input())

ans = math.ceil(h/a)

print(ans)

### FIXED CODE ###

import math

h,a = map(int, input().split())
ans = math.ceil(h/a)

print(ans)
N=int(input())


R=[[] for _ in range(N)]


for _ in range(N-1):
  u,v,w=map(int, input().split())
  R[u-1].append((v-1,w))
  R[v-1].append((u-1,w))

colors=[None]*N  
def set_color(vertex, color):
  colors[vertex] = color
  for v, w in edges[vertex]:
      if colors[v] == None:
        next_color = color
        if w % 2 == 1:
          next_color = (next_color+1)%2
      set_color(v, next_color)
set_color(0,0)
for c in colors:
  print(c)

### FIXED CODE ###

import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()

edges = [[] for _ in range(N)]

for _ in range(N-1):
    u,v,w = imn()
    u -= 1
    v -= 1
    edges[u].append((v,w))
    edges[v].append((u,w))

colors = [None] * (N)

def set_color(vertex, color):
    colors[vertex] = color
    for v, w in edges[vertex]:
        if colors[v] == None:
            next_color = color
            if w % 2 == 1:
                next_color = (next_color+1)%2
            set_color(v, next_color)
set_color(0, 0)

for c in colors:
    print(c)
def countSetBits(n):
    count = 0
    while (n):
        n &= (n - 1)
        count += 1

    return count



N=10**9 + 7
n=int(input())
g=[[] for _ in range(n+5)]
for _ in range(n-1):
    a,b=map(int,input().strip().split(" "))
    g[a-1].append(b-1)
    g[b-1].append(a-1)
dpr=[-1 for _ in range(n+5)]
dpb=[-1 for _ in range(n+5)]

def dfs(v,p):
    if dpr[v]!=-1:
        return
    if len(g[v])==1 and g[v][0]==p:
        dpr[v]=1
        dpb[v]=1
        return
    valr=1
    valb=1
    for c in g[v]:
        if c==p:
            continue
        dfs(c,v)
        valr=(valr*((dpr[c]+dpb[c])%N))%N
        valb=(valb*(dpr[c]))%N
    dpr[v]=valr
    dpb[v]=valb
    return
dfs(0,-1)
print((dpr[0]+dpb[0])%N)

















### FIXED CODE ###


def countSetBits(n):
    count = 0
    while (n):
        n &= (n - 1)
        count += 1

    return count


import sys
sys.setrecursionlimit(10**6)


N=10**9 + 7
n=int(input())
g=[[] for _ in range(n+5)]
for _ in range(n-1):
    a,b=map(int,input().strip().split(" "))
    g[a-1].append(b-1)
    g[b-1].append(a-1)
dpr=[-1 for _ in range(n+5)]
dpb=[-1 for _ in range(n+5)]

def dfs(v,p):
    if dpr[v]!=-1:
        return
    if len(g[v])==1 and g[v][0]==p:
        dpr[v]=1
        dpb[v]=1
        return
    valr=1
    valb=1
    for c in g[v]:
        if c==p:
            continue
        dfs(c,v)
        valr=(valr*((dpr[c]+dpb[c])%N))%N
        valb=(valb*(dpr[c]))%N
    dpr[v]=valr
    dpb[v]=valb
    return
dfs(0,-1)
print((dpr[0]+dpb[0])%N)
if __name__ == "__main__":
    n, x = map(int, input().split())
    aaa = list(map(int, input().split()))
    
    for a in sorted(aaa):
        if x < a:
            break
        ans += 1
        x -= a
    else:
        if x > 0:
            ans -= 1
    print(ans)

### FIXED CODE ###

if __name__ == "__main__":
    n, x = map(int, input().split())
    aaa = list(map(int, input().split()))
    ans = 0
    
    for a in sorted(aaa):
        if x < a:
            break
        ans += 1
        x -= a
    else:
        if x > 0:
            ans -= 1
    print(ans)
def f1():
	L.sort(key = (lambda x: - x[1]//(w1 - x[0] + 1)))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans

def f2():
	dp = [[0] * (W + 1) for i in range(N + 1)]
	for n in range(1,N + 1):
		w,v = L[n - 1]
		if w > W:
			continue
		for m in range(w):
			dp[n][m] = dp[n - 1][m]
		for m in range(w,W + 1):
			dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
	return max(dp[-1])
	
N,W = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
w1 = L[0][0]
if w1 > 10000:
	print(f1())
else:
	print(f2())


### FIXED CODE ###

def f1():
	L.sort(key = (lambda x: - x[1]//(x[0] - w1 + 40)))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
	
def f3():
	L.sort(key = (lambda x: - x[1]//x[0]))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
def f2():
	dp = [[0] * (W + 1) for i in range(N + 1)]
	for n in range(1,N + 1):
		w,v = L[n - 1]
		if w > W:
			continue
		for m in range(w):
			dp[n][m] = dp[n - 1][m]
		for m in range(w,W + 1):
			dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
	return max(dp[-1])
	
N,W = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
w1 = L[0][0]
if w1 > 10000000:
	print(f1())
elif W > 10000000:
	print(f3())
else:
	print(f2())
print("YES" is 5, 7, 5 == map(int, input().split()) else "NO")

### FIXED CODE ###

A = sorted(list(map(int, input().split())))
print("YES" if A == [5,5,7] else "NO")
h, w = map(int, input().split())
a = []
for i in range(h):
    a.extend(list(input()))

#print(*a, sep = "\n")

l = h*w
INF = 10**5

dp = [[INF]*(l) for i in range(l)]

for i in range(l):
    if a[i] == "#":
        for j in range(l):
            dp[i][j] = "#"
            dp[j][i] = "#"
            continue

    for j in range(l):
        if i == j:
            dp[i][j] = 0

    #左右上下を1にする
    #右
    if i%w+1 < w:
        dp[i][i+1] = 1
        dp[i+1][i] = 1
    #左
    if i%w-1 > 0:
        dp[i][i-1] = 1
        dp[i-1][i] = 1
    #上
    if i//h-1 > 0:
        dp[i][i-w] = 1
        dp[i-w][i] = 1
    #下
    if i//h+1 < h:
        dp[i][i+w] = 1
        dp[i+w][i] = 1

max = 0
for k in range(l):
    for i in range(l):
        for j in range(l):
            if dp[i][j] == -1:
                continue
            try:
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            except:
                dp[i][j] = dp[i][j]
max = 0
for i in dp:
    for j in i:
        try:
            if max < j:
                max = j
        except:
            pass

#print(*dp, sep="\n")
print(max)


### FIXED CODE ###

from collections import deque

h,w = map(int, input().split())
l = [list(input()) for _ in range(h)]

# 最大値の格納する
ans = 0

def bfs(y,x,m):#未実装
    #表の初期化
    graph = [[None] * w for i in range(h)]
    #最初の地点のコストは0
    graph[y][x] = 0

    q = deque()
    q.append((y,x))

    for i in range(h):
        for j in range(w):
            if l[i][j] == '#':
                graph[i][j] = -1

    #ノードの移動方向 左が縦軸, 右が横軸
    move = ((0, 1), (0, -1), (1, 0), (-1, 0))

    while q: #wがからになるまで続ける while len(q):でもOK
        #que左端から取り出す
        i, j = q.popleft()

        for di, dj in move:
            #ni, nj 遷移先の座標
            ni , nj = i + di, j + dj
            #遷移先がフィールド内であるか、Noneかどうかをチェックする
            if 0 <= ni < h and 0 <= nj < w and graph[ni][nj] is None:
                #遷移可能であれば現在のコストに1足して渡す
                #print(type(graph[i][j]))
                graph[ni][nj] = graph[i][j] + 1
                #queに格納する
                q.append((ni, nj))

    #queが空になると移動コストtableが完成
    #表中の最大値返す
    return max(max(r) for r in graph)

for i in range(h):
    for j in range(w):
        #'.'であればスタート地点になり得るので、それをbfsにかける
        if l[i][j] == '.':
            d = bfs(i,j,l) # (x, y) = (j, i), lは入力の表の情報
            #返り値が現在の最大値より大きければ値を更新する
            if ans < d:
                ans = d
print(ans)
a = input().split()
n = int(a[0])
m = int(a[1])

d = {}
ret = True
for i in range(m):
  a = input().split()
  s = int(a[0])
  c = int(a[1])
  if (d.get(s,-1) != -1) & (d.get(s,-1) != c):
    ret = False
  if (s == 1) & (c == 0):
    ret = False
  if s > n:
    ret = False
  d[s] = c

p = ""    
for i in range(1,n+1):
  if d.get(i,-1) == -1:
    if (i == 1) & (n >1):
      p += "1"
    else:
      p += "0"
  else:
    p += str(d[i])
if ret:
  print(p)
else:
  print("-1")

### FIXED CODE ###

a = int(input())
print((a + 1)//2)
a,b,c,d=map(int,input().spilit())
l=a+b
r=c+d
if l < r:
  print("Right")
else:
  print("Left")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
l=a+b
r=c+d
if l < r:
  print("Right")
elif l==r:
  print("Balanced")
else:
  print("Left")
A,B = map(int,input().split())
X = A * B

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


### FIXED CODE ###

A,B = map(int,input().split())
X = A * B

if X % 2 != 0:
    print("Yes")
else:
    print("No")
import math

A,B=map(int,(input().split()))    
ABgcd=math.gcd(A,B)
answer=A*B//ABgcd
print(answer)

### FIXED CODE ###

import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)
class Node():
    def __init__(self, v):
        self.value = v
        self.friends = set()
        self.blocked = set()

n, m, k = list(map(int, input().split()))
link = {i: Node(i) for i in range(1, n+1)}
for _ in range(m):
    a, b = list(map(int, input().split()))
    link[a].friends.add(link[b])
    link[b].friends.add(link[a])

for _ in range(k):
    c, d = list(map(int, input().split()))
    link[c].blocked.add(link[d])
    link[d].blocked.add(link[c])

def traverse(hist, friends, blocked):
    for f in friends:
        if f not in hist:
            if f not in blocked:
                hist.add(f)
            traverse(hist, f.friends, blocked)
    return hist

for i in range(1, n+1):
    node = link[i]
    hist = traverse(set(), node.friends, node.blocked)
    cnt = len(hist - set([node]) - node.friends - node.blocked)
    print(cnt, end="" if i == n else " ")


### FIXED CODE ###

class Tree:
    def __init__(self, v: int):
        self.value = v
        self.size = 1
        self.depth = 1
        self.parent = None
        self.friends = set()
        self.blocked = 0

    def get_root(self):
        t = self
        while(t.parent != None):
            t = t.parent
        return t

    def merge(self, t):
        p, c = (self, t) if self.depth > t.depth else (t, self)
        c.parent = p
        p.depth = max(p.size, c.size + 1)
        p.size += c.size

def main():
    n, m, k = [int(s) for s in input().split()]
    forest = [Tree(i+1) for i in range(n)]

    for i in range(m):
        a, b = [int(s) for s in input().split()]
        ta, tb = forest[a-1], forest[b-1]
        ta.friends.add(b)
        tb.friends.add(a)
        ra = ta.get_root()
        rb = tb.get_root()
        if ra != rb:
            ra.merge(rb)

    roots = [t.get_root() for t in forest]
    for i in range(k):
        c, d = [int(s) for s in input().split()]
        tc, td = forest[c-1], forest[d-1]
        rc = roots[c-1]
        rd = roots[d-1]
        if rc == rd:
            tc.blocked +=1
            td.blocked +=1

    cands = []
    for t in forest:
        root = roots[t.value - 1]
        cand = root.size - len(t.friends) - t.blocked - 1
        cands.append(str(cand))
    print(" ".join(cands))

if __name__ == '__main__':
    main()
N, X = map(int, input().split())
x = list(map(int, input().split()))
y = []
import math
from functools import reduce
def gcd_list(num):
    return reduce(math.gcd, num)

for i in x:
    y.append(abs(X-i))

print(gcd_list(y))

### FIXED CODE ###

import fractions
from functools import reduce

N, X = map(int, input().split())
a = list(map(int, input().split()))
y = []

def gcd_list(num):
    return reduce(fractions.gcd, num)

for i in a:
    y.append(abs(X-i))

print(gcd_list(y))
N, K = map(int, input().split())
h_list = list(map(int, input().split()))
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
import numpy as np
dp_list = [1000000000] * N
dp_list[0] = 0
dp_list[1] = abs(h_list[1] - h_list[0])
for n in range(1, N):
    for k in range(1, K+1):
        dp_list[n] = chmin(dp_list[n], dp_list[n-k] + abs(h_list[n-k] - h_list[n]))
        if n-k == 0:
            break
print(dp_list[-1])

### FIXED CODE ###

N, K = map(int, input().split())
h_list = list(map(int, input().split()))
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
dp_list = [1000000000] * N
dp_list[0] = 0
dp_list[1] = abs(h_list[1] - h_list[0])
for n in range(1, N):
    for k in range(1, K+1):
        dp_list[n] = chmin(dp_list[n], dp_list[n-k] + abs(h_list[n-k] - h_list[n]))
        if n-k == 0:
            break
print(dp_list[-1])
#n>=25なら鳩ノ巣で0
#2人以上居るdは一意
#あとはしらみつぶし

n = int(input())
if n>=25:
    print(0)
    exit()

d = list(map(int, input().split( )))
if 0 in d:##
    print(0)
    exit()
d.append(0)
dic = {}

for di in d:
    if di in dic:
        dic[di] += 1
    else:
        dic[di]= 1
solo = []
times = []
for di in dic:
    if dic[di]==1:#di=0はここに入る
        solo.append(di)
    elif dic[di]==2:
        times.append(di)
        if di!=12:
            times.append(24-di)
        else:
            print(0):
                exit()
    else:
        print(0)
        exit()
        
ans = 0
m = len(solo)
bit = 1<<m

for i in range(bit):
    times2 = []
    for t in times:
        times2.append(t)
    for j in range(m):
        if i>>j&1:
            times2.append(solo[j])
        elif solo[j]:
            times2.append(24-solo[j])
    times2.sort()
    dif = 24
    if len(times2)==1:###
        print(0)
        exit()
    #print(times2)

    for k in range(len(times2)-1):
        dif = min(dif,times2[k+1]-times2[k])
    dif = min(dif,times2[0] + 24 - times2[-1])
    ans = max(ans,dif)
print(ans)
 


### FIXED CODE ###

#n>=25なら鳩ノ巣で0
#2人以上居るdは一意
#あとはしらみつぶし

n = int(input())
if n>=25:
    print(0)
    exit()

d = list(map(int, input().split( )))
if 0 in d:##
    print(0)
    exit()
d.append(0)
dic = {}

for di in d:
    if di in dic:
        dic[di] += 1
    else:
        dic[di]= 1
solo = []
times = []
for di in dic:
    if dic[di]==1:#di=0はここに入る
        solo.append(di)
    elif dic[di]==2:
        times.append(di)
        if di!=12:
            times.append(24-di)
        else:
            print(0)
            exit()
    else:
        print(0)
        exit()
        
ans = 0
m = len(solo)
bit = 1<<m

for i in range(bit):
    times2 = []
    for t in times:
        times2.append(t)
    for j in range(m):
        if i>>j&1:
            times2.append(solo[j])
        else:####???
            times2.append(24-solo[j])
    times2.sort()
    dif = 24
    if len(times2)==1:###
        print(0)
        exit()
    #print(times2)

    for k in range(len(times2)-1):
        dif = min(dif,times2[k+1]-times2[k])
    dif = min(dif,times2[0] + 24 - times2[-1])
    ans = max(ans,dif)
print(ans)
x=int(input())


if x>0:
    if x%11>=7:
        ans=(x//11)*2+2

    elif 1<=x%11<=6:
        ans=(x//11)*2+1


print(ans)

### FIXED CODE ###

x = int(input())
 
ans = (x//11)*2
remainder = x%11
if remainder == 0:
    print(ans)
elif 1 <= remainder <= 6:
    print(ans+1)
else:
    print(ans+2)
a, b, c = input().split()

a = int(a)
b = int(b)
c = int(c)

x, y, z = sort(a, b, c)

print(x, y, x, split=" ")



### FIXED CODE ###

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

a.sort()

print(a[0], a[1], a[2])
n,q=map(int,input().split())
graph=[[] for i in range(n)]
visited=[False]*n
visited[0]=True
from collection import deque
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1;b-=1
    graph[a].append(b)
    graph[b].append(a)

s=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    s[p-1]+=x
quest=deque([0])#はじめどうせ見るし入れとく
while len(quest)!=0:
    see=quest.popleft()
    for i in graph[see]:
        if visited[i]==True:
            continue
        quest.append(i)
        visited[i]=True
        s[i]+=s[see]
#for i in range(n):
    #print(s[i],end=" ")
print(*s)

### FIXED CODE ###

n,q=map(int,input().split())
graph=[[] for i in range(n)]
visited=[False]*n
visited[0]=True
from collections import deque
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1;b-=1
    graph[a].append(b)
    graph[b].append(a)

s=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    s[p-1]+=x
quest=deque([0])#はじめどうせ見るし入れとく
while len(quest)!=0:
    see=quest.popleft()
    for i in graph[see]:
        if visited[i]==True:
            continue
        quest.append(i)
        visited[i]=True
        s[i]+=s[see]
#for i in range(n):
    #print(s[i],end=" ")
print(*s)
= int(input())
S = str(input())
cnt = 0

ans = []
for i in range(0,N):
  if S[i] == "I":
    cnt = cnt+1
  elif S[i] == "D":
    cnt = cnt-1
  ans.append(cnt)

if max(ans) <= 0:
  print("0")
else:
  print(max(ans))

### FIXED CODE ###

N = int(input())
S = str(input())
cnt = 0

ans = []
for i in range(0,N):
  if S[i] == "I":
    cnt = cnt+1
  elif S[i] == "D":
    cnt = cnt-1
  ans.append(cnt)

if max(ans) <= 0:
  print("0")
else:
  print(max(ans))
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

const double PI = acos(-1);

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double th = double(h * 60 + m) / 720 * 2 * PI;
  double tm = double(m) / 60 * 2 * PI;
  double xh = a * cos(th), yh = a * sin(th);
  double xm = b * cos(tm), ym = b * sin(tm);
  // 2乗するので絶対値を取る必要はない
  double dx = xh - xm, dy = yh - ym;
  double ans = sqrt(dx * dx + dy * dy);
  printf("%.10f\n", ans);
  return 0;
}


### FIXED CODE ###

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

rad = math.pi * 2 * (h/12.0 + m/60.0 / 12.0 - m/60.0)
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(ans)