Harryxun/stf_run huggingface dataset:
import sys
from heapq import*
def g(s,g):
 F=[1e7]*-~n;F[s]=0
 H=[(0,s)]
 while H:
  c,u=heappop(H)
  if u==g:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
for e in iter(input,'0 0'):
 n,k=map(int,e.split())
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=input()
  if'0'==f[0]:
   c,d,e=map(int,f[2:].split())
   E[c]+=[(e,d)];E[d]+=[(e,c)]
  else:print(g(*map(int,f[2:].split())))


### FIXED CODE ###

def s():
 import sys
 r=sys.stdin.readline
 I=float('inf')
 for e in iter(r,'0 0\n'):
  n,k=map(int,e.split())
  F=[[I]*-~n for _ in[0]*-~n]
  for i in range(1,n+1):F[i][i]=0
  for _ in[0]*k:
   f=r();g=map(int,f[2:].split())
   if'0'==f[0]:a,b=g;A=F[a][b];print([A,-1][A==I])
   else:
    c,d,e=g
    if e<F[c][d]:
     for i in range(2,n+1):
      for j in range(1,i):
       F[i][j]=F[j][i]=min(F[i][j],F[i][c]+e+F[d][j],F[i][d]+e+F[c][j])
s()
import sys
input = sys.stdin.readline
import bisect
n,m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
Query = []
for _ in range(m):
    b,c = map(int,input().split())
    Query.append([c,b])
Query.sort(reverse=True)
for i in range(m):
    b,c = Query[i][1],Query[i][0]
    if A[0] >= c:
        break
    else:
        #A.sort()
        index = bisect.bisect_left(A,c)
        if b <= index:
            #for i in range(b):
            #    A[i] = c
            A = A[b:index] + [c for i in range(b)] + A[index:]
        else:
            #for i in range(index):
            #    A[i] = c
            A = [ c for i in range(index)] + A[index:]
    #print(A)
print(sum(A))

### FIXED CODE ###

a,b = map(int,input().split())
if a >= 13:
    ans = b
elif 6 <= a <= 12:
    ans = b//2
else:
    ans = 0
print(ans)
import fractions

Q = int(input())
LR = []

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    # print(int(math.sqrt(n)))
    for i in range(2,int(fractions.sqrt(n))+1):
        for j in range(i*2, n+1 ,i):
            is_prime[j] = False

    return is_prime

def like2017(is_prime,n):
    solve = [False] * (n+1)
    for i in range(3,n+1,2):
        if i < n and i >2:
            solve[i] = is_prime[i] and is_prime[int((i+1)/2)]

    return solve

for _ in range(Q):
    t = [int(i) for i in input().split(' ')]
    LR.append(t)

L = 10**5 
is_prime = primes(L)
solve = like2017(is_prime,L)
for l, r in LR:
    # print(solve[l:r+1])
    print(solve[l:r+1].count(True))

### FIXED CODE ###

import math
from itertools import accumulate

Q = int(input())
LR = []

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    # print(int(math.sqrt(n)))
    for i in range(2,int(math.sqrt(n))+1):
        for j in range(i*2, n+1 ,i):
            is_prime[j] = False

    return is_prime

def like2017(is_prime,n):
    solve = [0] * (n+1)
    for i in range(3,n+1,2):
        if is_prime[i] and is_prime[int((i+1)/2)]:
            solve[i] = 1
        
    return solve

for _ in range(Q):
    t = [int(i) for i in input().split(' ')]
    LR.append(t)

L = 10 ** 5
is_prime = primes(L)
solve = like2017(is_prime,L)
# print(solve)
ans = list(accumulate(solve))
# print(ans)

for l, r in LR:
    print(ans[r] - ans[l-1])
x,a=map(int,input(),split())
if x<A:
    print('0')

else:
    print('10')

### FIXED CODE ###

x,a=map(int,input().split())
if x<a:
    print(0)

else:
    print(10)
K = int(input())
A = int(input())
B = int(input())
""" K=4
A=5
B=7 """
q=0


for i in range(1,1000):
    if A <= i*K & i*K <= B:
        print("OK")
        q=1
        break

if q == 0:
    print("NG")




### FIXED CODE ###

k=int(input())
a,b= map(int, input().split())
q=0
 
for i in range(1,1000):
  if a<=k*i and k*i<=b:
    print('OK')
    q=1
    break
 
if q==0:
  print('NG')
import sys
input = sys.stdin.readline

A = input().rstrip()
B = input().rstrip()
C = input().rstrip()

def check(P1, P2, P3):
    L1 = len(P1)
    L2 = len(P2)
    L3 = len(P3)
    L = max([L1, L2, L3])*2+3

    P12 = [True]*L
    for i2 in range(-L2, L1+1):
        for l in range(max(i2, 0), min(i2+L2, L1)):
            if P1[l] != "?" and P2[l-i2] != "?" and P1[l] != P2[l-i2]:
                P12[i2] = False
                break
    
    P13 = [True]*L
    for i3 in range(-L3, L1+1):
        for l in range(max(i3, 0), min(i3+L2, L1)):
            if P1[l] != "?" and P3[l-i3] != "?" and P1[l] != P3[l-i3]:
                P13[i3] = False
                break
    
    P23 = [True]*L
    for i3 in range(-L3, L2+1):
        for l in range(max(i3, 0), min(i3+L2, L2)):
            if P2[l] != "?" and P3[l-i3] != "?" and P2[l] != P3[l-i3]:
                P23[i3] = False
                break

    ans = L1 + L2 + L3
    for i2 in range(-L2, L1+1):
        for i3 in range(-L3, L1+1):
            if P12[i2] and P13[i3] and P23[i3-i2]:
                ans = min(ans, max([0, i2, i3])+L1 - min([0, i2, i3]))
    return ans



print(min([check(A, B, C), check(B, A, C), check(C, A, B)]))

### FIXED CODE ###

import sys
input = sys.stdin.readline

A = input().rstrip()
B = input().rstrip()
C = input().rstrip()

def check(P1, P2, P3):
    L1 = len(P1)
    L2 = len(P2)
    L3 = len(P3)
    L = sum([L1, L2, L3])*2+3

    P12 = [True]*L
    for i2 in range(-L2, L1+1):
        for l in range(max(i2, 0), min(i2+L2, L1)):
            if P1[l] != "?" and P2[l-i2] != "?" and P1[l] != P2[l-i2]:
                P12[i2] = False
                break
    
    P13 = [True]*L
    for i3 in range(-L3, L1+1):
        for l in range(max(i3, 0), min(i3+L3, L1)):
            if P1[l] != "?" and P3[l-i3] != "?" and P1[l] != P3[l-i3]:
                P13[i3] = False
                break
    
    P23 = [True]*L
    for i3 in range(-L3, L2+1):
        for l in range(max(i3, 0), min(i3+L3, L2)):
            if P2[l] != "?" and P3[l-i3] != "?" and P2[l] != P3[l-i3]:
                P23[i3] = False
                break

    ans = L1 + L2 + L3
    for i2 in range(-L2, L1+1):
        for i3 in range(-L3, L1+1):
            if P12[i2] and P13[i3] and P23[i3-i2]:
                ans = min(ans, max([L1, L2+i2, L3+i3]) - min([0, i2, i3]))
    return ans



print(min([check(A, B, C), check(B, A, C), check(C, A, B)]))
n=int(input())
a=input()
b=input()
c=input
ans=0
for i in range(n):
  m=len(set([a[i],b[i],c[i]]))
  ans+=m-1
print(ans)

### FIXED CODE ###

n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
  m=len(set([a[i],b[i],c[i]]))
  ans+=m-1
print(ans)
H, W =  map(int, input().split())

S = []
for _ in range(H):
    tmp = list(input())
    S.append(tmp)
    
import numpy as np

Gs = np.asarray(S)
Gs_ = np.rot90(Gs, k=1)

def count_light(Gs, h, w):
    Gc = np.empty((h,w))
    for i, gs in enumerate(Gs):
        count = 0
        gc = []
        for j, s in enumerate(gs):
            if s == '#':
                count = 0
                Gc[i][j] = 0
            else:
                count += 1
                Gc[i][j] = count

    Gn = np.empty((h,w))
    for i, gc in enumerate(Gc):
        count = -1
        gn = []
        for j, c in enumerate(reversed(gc)):
            if c == 0:
                count = -1
                Gn[i][j] = 0
            else:
                if count == -1:
                    count = c
                Gn[i][w-j-1]  = count

    return Gn

Gn = count_light(Gs, H, W)
Gn_ = count_light(Gs_, W, H)
Gn_ = np.rot90(Gn_, k=-1)

Gsum = Gn+Gn_
ans = np.max(Gsum)-1

        
print(int(ans))

### FIXED CODE ###

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

S = []
for _ in range(H):
    tmp = list(input())
    S.append(tmp)
    
import numpy as np

def count_light(Gs, h, w):
    Gc = np.empty((h,w))
    for i in range(w):
        if i == 0:
            Gc[:, i] = Gs[:, i]
        else:
            Gc[:, i] = (Gc[:, i-1] + 1) * Gs[:, i]

    return Gc

Gs1 = np.asarray(S) == "."
Gn1 = count_light(Gs1, H, W)

Gs2 = np.rot90(Gs1, k=1)
Gn2 = count_light(Gs2, W, H)

Gs3 = np.rot90(Gs2, k=1)
Gn3 = count_light(Gs3, H, W)

Gs4 = np.rot90(Gs3, k=1)
Gn4 = count_light(Gs4, W, H)

Gn2 = np.rot90(Gn2, k=-1)
Gn3 = np.rot90(Gn3, k=-2)
Gn4 = np.rot90(Gn4, k=-3)

Gsum = Gn1+Gn2+Gn3+Gn4
ans = int(np.max(Gsum)-3)
print(ans)
from itertools import combinations

n,k=map(int,input().split())
lst=list(map(int,input().split()))

work=lst[0]
ini=[x-work for x in lst]
ini_seen=[0]
work=0
for i in range(1,n):
    if ini[i]>work:
        work=ini[i]
        ini_seen.append(i)

mn=None
for x in combinations(range(n-len(ini_seen)),k-len(ini_seen)):
    sm=0
    work=0
    xtoken=0
    count=1
    for i in range(1,n):
        if i in ini_seen:
            count+=1
            if work<ini[i] : work=ini[i]
            else:
                work+=1
                sm+=work-ini[i]
        elif i==x[xtoken]+count:
            work+=1
            sm+=work-ini[i]
            xtoken+=1
            if xtoken==k-len(ini_seen):break



    if not mn : mn=sm
    if mn>sm : mn=sm
print(mn)


### FIXED CODE ###

from itertools import combinations

n,k=map(int,input().split())
lst=list(map(int,input().split()))

work=lst[0]
ini=[x-work for x in lst]
ini_seen=[0]
work=0
for i in range(1,n):
    if ini[i]>work:
        work=ini[i]
        ini_seen.append(i)

mn=None
for x in combinations(range(n-len(ini_seen)),k-len(ini_seen)):
    sm=0
    work=0
    xtoken=0
    count=1
    for i in range(1,n):
        if i in ini_seen:
            count+=1
            if work<ini[i] : work=ini[i]
            else:
                work+=1
                sm+=work-ini[i]
        elif xtoken<len(x) and i==x[xtoken]+count:
            work+=1
            sm+=work-ini[i]
            xtoken+=1
    if not mn : mn=sm
    if mn>sm : mn=sm
print(mn)
n = int(input())
f = 0
k = 0
for i in range(n) :
    a = input().split("")[1] == "JPY"
    if a[1] == "JPY" :
        f +=  int(a[0])
    else :
        k += int(a[0])
print(f + k *380000 )


### FIXED CODE ###

n = int(input())
f = 0
k = 0
a = []
for i in range(n) :
    a = input().split()
    if a[1] == "JPY" :
        f +=  float(a[0])
    else :
        k += float(a[0])
print(f + k *380000 )
x1 = input().split()
N = int(x1[0])
M = int(x1[1])
S = []
A = []
K = []
F = []
for i in range(M):
    S.append(0)
for i in range(N):
    K.append(0)
for i in range(N):
    A.append(input().split())
    K[i] = int(A[i][0])
    for j in range(K[i]):
        F.append(int(A[i][j]))
    for j in F:
        S[j] += 1
ans = 0
for i in range(M):
    if S[i] == N:
        ans += 1
print(ans)


### FIXED CODE ###

x1 = input().split()
N = int(x1[0])
M = int(x1[1])
S = []
A = []
K = []
F = []
for i in range(M):
    S.append(0)
for i in range(N):
    K.append(0)
for i in range(N):
    A.append(input().split())
    K[i] = int(A[i][0])
    for j in range(K[i]):
        F.append(int(A[i][j+1]))
    for j in F:
        S[j - 1] += 1
    F = []
ans = 0
for i in range(M):
    if S[i] == N:
        ans += 1
print(ans)
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)


N, M = LI()
LR = []

for i in range(M):
    LR.append(LI())

#低い方と高い方を求める
lower = None
found = False
for i in range(1,N+1):
    if found:
        break
    for lr in LR:
        if not (lr[0] <= i <= lr[1]):
            break
    else:
        lower = i
        found = True

#  print('lower', lower)
if lower == N:
    print(1)
    exit()

upper = None
found = False
for i in reversed(range(lower+1, N+1)):
    if found:
        break
    for lr in LR:
        if not (lr[0] <= i <= lr[1]):
            break
    else:
        upper = i
        found = True
if upper == None:
    upper = lower
#  print('upper', upper)
print(upper - lower + 1)




### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)


N, M = LI()
LR = []

for i in range(M):
    LR.append(LI())

left, right = 0, inf
for lr in LR:
    left = max(left, lr[0])
    right = min(right, lr[1])
#  print(left, right)
if left > right:
    print(0)
else:
    print(right - left + 1)
n,q=list(map(int,input().split()))
s=" "+input()
a=[0]
for i in range(1,n+1):
  if c[i]=="C" and c[i-1]=="A":
    a.append(a[i-1]+1)
  else:
    a.append(a[i-1])
for i in range(q):
  l,r=list(map(int,input().split()))
  print(a[r]-a[l])

### FIXED CODE ###

n,q=list(map(int,input().split()))
s=" "+input()
a=[0]
for i in range(1,n+1):
  if s[i]=="C" and s[i-1]=="A":
    a.append(a[i-1]+1)
  else:
    a.append(a[i-1])
for i in range(q):
  l,r=list(map(int,input().split()))
  print(a[r]-a[l])
import sys
l = raw_input().split()
N = int(l[0])
M = int(l[1])
nlist = []
list1 = []
for i in range(0, M):
    tmp = raw_input().split()
    a = int(tmp[0])
    b = int(tmp[1])
    if a == 1:
        list1.append(b)
        continue
    if b == N:
        nlist.append(a)
        continue
matched_list = list(set(list1) & set(nlist))
if len(matched_list) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

### FIXED CODE ###

N = raw_input()
print('ABC{0}'.format(N))
def dfs(v, e, visited, dp):
    if v in visited:
        return []
    ret = []
    if not e[v]:
        dp[v] = 0
    for next_v in e[v]:
        ret += dfs(next_v, e, visited, dp)
    ret.append(v)
    visited.add(v)
    return ret


def main():
    N, M = map(int, input().split())
    e = [[] for _ in range(N)]
    e_ = [[] for _ in range(N)]
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
        e_[v].append(u)
    topological_sorted = []
    visited = set()
    dp = [-1]*N
    for v in range(N):
        topological_sorted += dfs(v, e, visited, dp)
    for v in topological_sorted:
        for other_side in e_[v]:
            dp[other_side] = max(dp[v] + 1, dp[other_side])
    print(max(dp))


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def main():
    N, M = map(int, input().split())
    e = [[] for _ in range(N)]
    input_edges = [0]*N
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
        input_edges[v] += 1
    queue = deque()
    dp = [-1] * N
    for i, input_edge in enumerate(input_edges):
        if input_edge == 0:
            queue.appendleft(i)
            dp[i] = 0
    topological_sorted = []
    while queue:
        v = queue.pop()
        topological_sorted.append(v)
        for other_side in e[v]:
            input_edges[other_side] -= 1
            if input_edges[other_side] == 0:
                queue.appendleft(other_side)
    for v in topological_sorted:
        for other_side in e[v]:
            dp[other_side] = max(dp[v] + 1, dp[other_side])
    print(max(dp))


if __name__ == "__main__":
    main()
a = map(int,input(),split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int,input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
S=list(input())
i=0
while 0<=i<=len(S)-1:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i-=1
        else:
            i+=1
    else:
        i+=1
print(len(S))

### FIXED CODE ###

S=input()
t=0
u=0
for i in range(len(S)):
    if S[i]=="S":
        t+=1
    else:
        if t>=1:
            u+=2
            t-=1
print(len(S)-u)
N = int(input())
ary = []
# d = []
d2 = []
for _ in range(N):
  ball = list(map(int, input().split()))
  ary.append(ball)

for i in range(N-1):
    x = ary[i][0] - ary[i+1][0]
    y = ary[i][1] - ary[i+1][1]
    # d.append(x)
    # d.append(y)
    tmp = str(x) + str(y)
    d2.append(tmp)
    # d = []
# print(ary)
# print(d2)

max = d2.count(d2[0])
for i in range(1,N-1):
    if max < d2.count(d2[i]):
        max = d2.count(d2[i])

print(len(d2) - max + 1)


### FIXED CODE ###

n=int(input())
if n==1:
	print(1)
	exit()
xy = sorted([list(map(int,input().split())) for i in range(n)])
p=q=0
ans=0
dic={}
for i in range(n-1):
	for j in range(i+1,n):
		p = xy[i][0]-xy[j][0]
		q = xy[i][1]-xy[j][1]
		if (p,q) in dic:
			dic[(p,q)]+=1
		else:
			dic[(p,q)]=1
print(n-max(dic.values()))
import sys
import numpy as np

def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    A = [[0 if c == '.' else 1 for c in input().strip()] for _ in range(H)]

    A = np.array(A)
    N = np.array(np.nonzero(A))

    x = list(range(H)) * W
    x.sort()
    y = list(range(W)) * H
    P = np.array((x, y))

    dist = np.array([2001] * (H*W))

    _, n = N.shape
    for i in range(n):
        d = np.abs(P[0] - N[0][i]) + np.abs(P[1] - N[1][i])
        dist = np.minimum(d, dist)
    
    return np.max(dist)

if __name__ == '__main__':
    print(main())


### FIXED CODE ###

#ref: https://atcoder.jp/contests/agc033/submissions/5260580

import sys
import numpy as np

def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    INF = H * W
    dp = [[INF if c == '.' else 0 for c in input().strip()] for _ in range(H)]
    dp = np.array(dp)

    for i in range(1, H):
        dp[i, :] = np.minimum(dp[i, :], dp[i-1, :] + 1)

    for i in range(H-2, -1, -1):
        dp[i, :] = np.minimum(dp[i, :], dp[i+1, :] + 1)

    for i in range(1, W):
        dp[:, i] = np.minimum(dp[:, i], dp[:, i-1] + 1)

    for i in range(W-2, -1, -1):
        dp[:, i] = np.minimum(dp[:, i], dp[:, i+1] + 1)

    return np.max(dp)

if __name__ == '__main__':
    print(main())
N, M = map(int, raw_input().split(' '))
A = [map(int, raw_input().split(' ')) for _ in xrange(N)]

answer = N
for m in xrange(M-1):
    participants = [0] * (M + 1)
    for n in xrange(N):
        participants[A[n][0]] += 1
    sport_with_max_participants = max(xrange(M), key=lambda x: participants[x])
    answer = min(answer, participants[sport_with_max_participants])
    for n in xrange(N):
        A[n].remove(sport_with_max_participants)

print answer

### FIXED CODE ###

N, M = map(int, raw_input().split(' '))
A = [map(int, raw_input().split(' ')) for _ in xrange(N)]

answer = N
for _ in xrange(M):
    participants = [0] * M
    for n in xrange(N):
        participants[A[n][0]-1] += 1
    sport_with_max_participants = max(xrange(M), key=lambda x: participants[x])
    answer = min(answer, participants[sport_with_max_participants])
    for n in xrange(N):
        A[n].remove(sport_with_max_participants+1)

print answer
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import sqrt

n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]

def R(*L):
	a,b,c=[sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in zip(L,L[1:]+L)]
	s=(a+b+c)/2
	return sqrt(s*(s-a)*(s-b)*(s-c))*4/(a*b*c)

ans=max(sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)for p1,p2 in combinations(P,2))
if n>2:
	ans_=max(R(*L) for L in combinations(P,3))
	ans=max(ans,ans_)
print(ans/2)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import hypot
n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
ans=1e9
for p1,p2 in combinations(P,2):
	X,Y=(p1[0]+p2[0])/2,(p1[1]+p2[1])/2
	r=0
	for x,y in P:
		t=hypot(X-x,Y-y)
		if r<t:r=t
	if ans>r:ans=r
if n>2:
	ans_=1e9
	for p1,p2,p3 in combinations(P,3):
		a=hypot(p2[0]-p3[0],p2[1]-p3[1])
		b=hypot(p3[0]-p1[0],p3[1]-p1[1])
		c=hypot(p1[0]-p2[0],p1[1]-p2[1])
		if (a+b+c)-2*max(a,b,c)<1e-8:continue
		s,t,u=(-a*a+b*b+c*c)*a*a,(a*a-b*b+c*c)*b*b,(a*a+b*b-c*c)*c*c
		X=(s*p1[0]+t*p2[0]+u*p3[0])/(s+t+u)
		Y=(s*p1[1]+t*p2[1]+u*p3[1])/(s+t+u)
		r=0
		for x,y in P:
			t=hypot(X-x,Y-y)
			if r<t:r=t
		if ans_>r:ans_=r
	# print(ans_)
	ans=min(ans,ans_)
print(ans)
n = int(input())
A = [int(i) for i in input().split()]

ff = -1
for i in range(n):
    if A[i] != 0:
        ff = i
        break

if A[0] != 0:
    ans = 0
    S = A[0]
    f = A[0]//abs(A[0])
else:
    if ff == -1:
        ans = 1
        S[0] = 1
        f = 1
    else:
        if ff % 2 == 0:
            ans = 1
            S[0] = 1
            f = 1
        else:
            ans = 1
            S[0] = -1
            f = -1

for a in A[1:]:
    S += a
    if S == 0:
        ans += 1
        S = -f
    else:
        if S/abs(S) != f*(-1):
            ans += abs(S)+1
            S = -f
    f *= -1
print(ans)


### FIXED CODE ###

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

ans=10**20
for flg in (-1,1):
    c=0
    s=0
    for a in a_list:
        s+=a
        if s==0:
            c+=1
            s=flg
        if s//abs(s)!=flg:
            c+=abs(s)+1
            s=flg
        flg*=-1
    ans=min(ans,c)
print(ans)
n,x = (int(i) for i in input().split())
listx=[int(i) for i in input().split()]
#print(n,x,listx)
listy=[abs(listx[i]-x) for i in range(n)]
listy.reverse()
#print(listy)

def gcd(y, x):
    if x == 0:
        return y
    else:
        return gcd(x, y % x) #再帰定義
if x==1:
  ans=listy[0]
else:
  if listy[1]==0:
    ans=listy[0]
  else:
    ans=gcd(listy[0],listy[1])
    if n > 2:
      for i in range(n-2):
        if listy[i+2]==0:
          ans=ans
        else:
          ans=gcd(ans,listy[i+2])
  
print(ans)

### FIXED CODE ###

n,x = (int(i) for i in input().split())
listx=[int(i) for i in input().split()]
#print(n,x,listx)
listy=[abs(listx[i]-x) for i in range(n)]
listy.reverse()
#print(listy)

def gcd(y, x):
    if x == 0:
        return y
    else:
        return gcd(x, y % x) #再帰定義
if n==1:
  ans=listy[0]
else:
  if listy[1]==0:
    ans=listy[0]
  else:
    ans=gcd(listy[0],listy[1])
    if n > 2:
      for i in range(0,n-2):
        if listy[i+2]==0:
          ans=ans
        else:
          ans=gcd(ans,listy[i+2])
  
print(ans)
N = int(input())
S = list(map(int, input().split()))

if 'Y' in S:
    print('Four')
else:
    print('Three')

### FIXED CODE ###

N = int(input())
S = list(input().split())

if 'Y' in S:
    print('Four')
else:
    print('Three')