Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
for i in range(n):
    num=int(input())
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))


### FIXED CODE ###

# coding: utf-8
# Your code here!
n=int(input())
sum=0
min=1000001
max=-1000001
table=list(map(int,input().split(" ")))
for i in table:
    sum+=i
    if max<i:
        max=i
    if min>i:
        min=i

print(str(min)+" "+str(max)+" "+str(sum))
from functools import lru_cache

N = int(input())
h = list(map(int,input().split()))
#print(h)

@lru_cache(maxsize = 100001)
def func(cur):
	if cur==0:
		return 0
	elif cur==1:
		return abs(h[1]-h[0])#+func(0)
	step1 = abs(h[cur]-h[cur-1])+func(cur-1)
	step2 = abs(h[cur]-h[cur-2])+func(cur-2)
	return min(step1,step2)

ans = func(N-1)
print(ans)


### FIXED CODE ###


N = int(input())
h = list(map(int,input().split()))
#print(h)

dp = [0]*N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for n in range(2,N):
	step1 = abs(h[n]-h[n-1])+dp[n-1]
	step2 = abs(h[n]-h[n-2])+dp[n-2]
	dp[n] =  min(step1,step2)

ans = dp[N-1]
print(ans)
s=input()
if s[1]='R':
  print('ABC')
else:
  print('ARC')

### FIXED CODE ###

s=input()
if s[1]=='R':
  print('ABC')
else:
  print('ARC')
import sys
from collections import defaultdict
readline = sys.stdin.readline
N, = map(int, readline().split())
G = [[] for _ in range(N+1)]
ees = dict()
for v in range(N-1):
    a, b = map(int, readline().split())
    G[a].append(b)
    G[b].append(a)
    ees[v+1] = tuple([min(a,b), max(a,b)])
cd = dict()
cd[1] = 0
ed = dict()

def itree(v, p):
    cdd = 1
    for c in G[v]:
        if c == p:
            continue
        if cdd == cd[v]:
            cdd += 1
        cd[c] = cdd
        ed[tuple([min(c,v), max(c,v)])] = cdd
        cdd += 1
        itree(c, v)


def process():
    itree(1,0)
process()
xs = []
for i in range(N-1):
    xs.append(ed[ees[i+1]])
print(max(xs))
print("\n".join(map(str,xs)))


### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10**5+1)
readline = sys.stdin.readline
N, = map(int, readline().split())
G = [[] for _ in range(N+1)]
ees = dict()
for v in range(N-1):
    a, b = map(int, readline().split())
    G[a].append(b)
    G[b].append(a)
    ees[v+1] = tuple([min(a,b), max(a,b)])
cd = dict()
cd[1] = 0
ed = dict()

def itree(v, p):
    cdd = 1
    for c in G[v]:
        if c == p:
            continue
        if cdd == cd[v]:
            cdd += 1
        cd[c] = cdd
        ed[tuple([min(c,v), max(c,v)])] = cdd
        cdd += 1
        itree(c, v)


def process():
    itree(1,0)
process()
xs = []
for i in range(N-1):
    xs.append(ed[ees[i+1]])
print(max(xs))
print("\n".join(map(str,xs)))
a = map(int,input().split())

if max(a) == min(a):
  print("Yes")
else:
  print("No")



### FIXED CODE ###

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

if max(a) == min(a):
  print("Yes")
else:
  print("No")
import sys
n,m=map(int,input().split())
ans=[0]*n
for _ in range(m):
    s,c=map(int,input().split())
    if ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    ans[s-1]=c
if ans[0]==0:
    print(-1)
else:
    num=0
    for i in range(n):
        num+=ans[i]*(10**(n-i-1))
print(num)

### FIXED CODE ###

import sys
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
    s,c=map(int,input().split())
    if data[s-1]!=0 and data[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    data[s-1]=c
if data[0]==0 and n!=1:
    data[0]=1
ans=0
for i in range(n):
    ans+=data[i]*10**(n-i-1)
print(ans)
N=int(input())
a=int(input())

print(N**2-A)

### FIXED CODE ###

N=int(input())
a=int(input())

print(N**2-a)
import math

# 余弦定理

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

# 12時方向に対して、分針が作る角度
b_degree = 6 * m

# 12時方向に対して、時針が作る角度
# 時針は1時間に30度動くことにも注意
# 10時40分の時、時針は10時の位置から+40/60*30度動いている
a_degree = 30 * h + m / 60 * 30

print(a_degree, b_degree)

# 分針が時針を追い越しているか、追い越していないかで場合分け
# 分針が時針を追い越してない
# 分針が0の場合を考慮してminとる
if a_degree > b_degree:
    degree1 = a_degree - b_degree
    degree2 = 360 - degree1
    degree = min(degree1, degree2)
    print(degree)
    length = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(degree)))
elif a_degree < b_degree:
    degree = b_degree - a_degree
    length = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(degree))) 
else:
    lenght = b - a

print(length)

### FIXED CODE ###

import math

# 余弦定理

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

# 12時方向に対して、分針が作る角度
b_degree = 6 * m

# 12時方向に対して、時針が作る角度
# 時針は1時間に30度動くことにも注意
# 10時40分の時、時針は10時の位置から+40/60*30度動いている
a_degree = 30 * h + m / 60 * 30

# 分針が時針を追い越しているか、追い越していないかで場合分け
# 分針が時針を追い越してない
# 分針が0の場合を考慮してminとる
if a_degree > b_degree:
    degree1 = a_degree - b_degree
    degree2 = 360 - degree1
    degree = min(degree1, degree2)
    length = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(degree)))
elif a_degree < b_degree:
    degree = b_degree - a_degree
    length = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(degree))) 
else:
    length = abs(b - a)

print(length)
s=input()
t=s[::-1]
n=len(input())
if n%2==0:
    x=n//2
else:
    x=n//2+1
count=0
    for i in range(x):
        if s[i]!=t[i]:
            count+=1
print(count)

### FIXED CODE ###

s=input()
n=len(s)
cnt=0
if n%2==0:
  for i in range(n//2):
    if s[:n//2][::-1][i]!=s[n//2:n][i]:
      cnt+=1
  print(cnt)
else:
  for i in range(n//2):
    if s[:(n-1)//2][::-1][i]!=s[(n+1)//2:n][i]:
      cnt+=1
  print(cnt)
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*h*2
dp[0]=0
for i in range(h):
    for a,b in c:
        dp[i+a]=min(dp[i+a],dp[i]+b)
print(min(dp[h:]))

### FIXED CODE ###

(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*(2*10**4+1)
c.sort()
dp[0]=0
for i in range(h):
    for a,b in c:
        if i+a<=2*10**4:
            dp[i+a]=min(dp[i+a],dp[i]+b)
        else:break    
print(min(dp[h:]))
8
2 7 1 8 2 8 1 8

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = Counter(a)
ans = 0
for i in set(a):
    if b[i] < i:
        ans += b[i]
    else:
        ans += b[i]-i
print(ans)
# ABC089B

n = int(input())
s = list(map(int, input().split)))
if len(set(s)) == 4:
    print('Three')
else:
    print('Four')


### FIXED CODE ###

n = int(input())
s = list(input().split())
if len(set(s)) == 3:
    print('Three')
else:
    print('Four')
def gost(lis,ky):
    
    lens=len(lis)
    
    if lens <= 5:
        if ky in lis:
            return True
        else:
            return False
    
    if ky <= lis[lens//2]:
        return gost(lis[:lens/2],ky)
    else:
        return gost(lis[lens/2:],ky)
    

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

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


i = 0
for it in t:
    if gost(s,it):
        i = i+1
print(i)

### FIXED CODE ###

def gost(lis,ky,r,l):
    
    lens=l-r+1
    
    if lens <= 5:
        if ky in lis[r:l+1]:
            return True
        else:
            return False
    
    if ky <= lis[r+(lens//2)-1]:
        return gost(lis,ky,r,r+(lens//2)-1)
    else:
        return gost(lis,ky,r+(lens//2),l)
    

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

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


i = 0
for it in t:
    if gost(s,it,0,n-1):
        i = i+1
print(i)
def solve():
    N, A, B = map(int, input().split())

    n_times = N // (A+B)
    amari = N % (A+B)
    cnt = 0
    if amari != 0:
        S = 'b' * A + 'r' * B
        S = S[0:amari]

        for ball in S:
            if ball == 'b':
                cnt += 1
    
    print(n_times * A + cnt)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    N, A, B = map(int, input().split())

    n_times = N // (A+B)
    amari = N % (A+B)

    cnt = 0
    if A <= amari:
        cnt = A
    else:
        cnt = amari
    
    print(n_times * A + cnt)

if __name__ == '__main__':
    solve()
import itertools
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
for i in range(n-2):
    x,y=a[i],a[i+1]
    del a[i:i+2]
    a+=[x-y]
    a.sort()
    print(x,y)
print(a[1],a[0])



### FIXED CODE ###

import bisect
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
ans=[]
x=bisect.bisect_left(a, 0)
m=a[:x]
p=a[x:]

if n==2 and len(p)==2:
    print(p[1]-p[0])
    print(p[1],p[0])
    
    exit()
if m==[]:
    m+=[p[0]-p[-1]]
    ans+=[[p[0],p[-1]]]
    del p[0]
    del p[-1]

if p==[]:
    p+=[m[-1]-m[0]]
    ans+=[[m[-1],m[0]]]
    del m[-1]
    del m[0]

while len(p)!=1:

    m+=[m[0]-p[0]]
    ans+=[[m[0],p[0]]]
    del p[0]
    del m[0]
cnt=p[0]
for i in m:
    ans+=[[cnt,i]]
    cnt-=i
print(cnt)
for i,j in ans:print(i,j)
S=list(input())
counter = 0
for i in range(len(S):
    if S[i] == '+':
        counter += 1
    else:
        counter -= 1

print(counter)

### FIXED CODE ###

S=list(input())
counter = 0
for i in range(len(S)):
    if S[i] == '+':
        counter += 1
    elif S[i] == '-':
        counter -= 1

print(counter)
input_list=[input() for i in range(5)]
dishes = [int(n) for n in input_list]
s = 0
for n in dishes:
    if n%10 == 0:
        s += n

dishes = [n for n in dishes if n%10 != 0]
minmod = min([n%10 for n in dishes])


for n in dishes:
    s += n + 10 - n%10

s -= 10
s += minmod
print(s)


### FIXED CODE ###

input_list=[input() for i in range(5)]
dishes = [int(n) for n in input_list]
s = 0
for n in dishes:
    if n%10 == 0:
        s += n

dishes = [n for n in dishes if n%10 != 0]
if dishes:
    minmod = min([n%10 for n in dishes])

    for n in dishes:
        s += n + 10 - n%10

    s -= 10
    s += minmod
print(s)
MOD = 10**9 + 7
memo = None


def rec(S, k, total):
    if k == len(S)//3:
        # print(total)
        fixed_total = total + 5 if k % 2 == 0 else total - 5
        memo[k][total % 13] = int((fixed_total) % 13 == 0)
        return int((fixed_total) % 13 == 0)

    if memo[k][total % 13] is not None:
        return memo[k][total % 13]

    s = S[k*3:k*3+3]
    d1 = [str(i) for i in range(10)] if s[0] == '?' else [s[0]]
    d2 = [str(i) for i in range(10)] if s[1] == '?' else [s[1]]
    d3 = [str(i) for i in range(10)] if s[2] == '?' else [s[2]]
    ret = 0

    for i1 in d1:
        for i2 in d2:
            for i3 in d3:
                num = int(i1 + i2 + i3)
                if k % 2 == 0:
                    ret += rec(S, k+1, total + num)
                    ret %= MOD
                else:
                    ret += rec(S, k+1, total - num)
                    ret %= MOD

    memo[k][total % 13] = ret
    return ret

S = input()

if len(S) % 3 == 1:
    S = '00' + S
elif len(S) % 3 == 2:
    S = '0' + S

L = (len(S) // 3) + 1
memo = [[None for i in range(13)] for j in range(L)]
print(rec(S, 0, 0))

### FIXED CODE ###

MOD = 10**9 + 7

S = input()
L = len(S)
memo = [[0 for i in range(14)] for j in range(L + 1)]
dp = [[0 for i in range(14)] for j in range(L + 1)]

dp[0][0] = 1

for k in range(L):
    for m in range(13):
        if S[k] == '?':
            for i in range(10):
                dp[k + 1][(m * 10 + i) % 13] += dp[k][m]
        else:
            dp[k + 1][(m * 10 + int(S[k])) % 13] += dp[k][m]

        for i in range(13):
            dp[k+1][i] %= MOD

print(dp[L][5])
import numpy as np

h,w = map(int,input().split())

s = [ list(input()) for i in range(h)]
s = np.array(s)

dy = [-1,0,1,0]
dx = [0,-1,0,1]

print(s.shape)
ans =True

for i in range(0,h):
    for j in range(0,w):
        flag = False
        if s[i][j] == '#' :
            for k in range(4):
                y = i+dy[k]
                x = i+dx[k]
                if  x < 0 or x >=w or y >= h or y < 0 :continue
#                print(x,y)
                if s[x][y] == '#':
                    flag = True

        if flag :ans = False


if ans :print("No")
else:print("Yes")




### FIXED CODE ###

h, w = list(map(int, input().split()))
s = ['.'*(w+2)]

for i in range(h):
	s.append('.'+input()+'.')
s.append('.'*(w+2))

ans = True

for i in range(1, h+1):
	for j in range(1, w+1):
		if s[i][j]=='#':
			if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j-1]=='.' and s[i][j+1]=='.':
				ans = False

print('Yes' if ans else 'No')
import numpy as np


def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = np.zeros((N, N))
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp][ss] = H[ss]
        A[ss][pp] = H[pp]

    ans = 0
    for j in range(N):
        if (A[j].max() == 0 or H[j] > A[j].max()):
            ans += 1

    print(ans)


resolve()


### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


resolve()
n = int(raw_input())
L = []

for i in xrange(n):
    a, b = map(raw_input().split())
    if a == "insert":
        L.append(b)
    if a == "find":
        if b in L:
            print "yes"
        else:
            print "no"

### FIXED CODE ###

n = int(raw_input())
dic = {}

for i in xrange(n):
    a, b = raw_input().split()
    if a == "insert":
        dic[b] = True
    elif a == "find":
        if b in dic:
            print "yes"
        else:
            print "no"
N = int(input())
A = list(map(int, input().split()))

# print(A)
c = [0, 0, 0]
# r = 0
# b = 0
# g = 0
sum = 1
# print(c)
for a in A:
    # print(a)
    if a == c[0]:
        c[0] += 1
        tmp = c.count(c[0] - 1) + 1
    elif a == c[1]:
        c[1] += 1
        tmp = c.count(c[1]-1) + 1
    elif a == c[2]:
        c[2] += 1
        tmp = c.count(c[2] - 1) + 1
    # print(tmp)
    sum *= tmp
    # print(c)
print(sum % 1000000007)


### FIXED CODE ###

N = int(input())
A = map(int, input().split())
MOD = 1000000007
ans = 1
cnt = [3 if i == 0 else 0 for i in range(N + 1)]
 
for a in A:
    ans = ans * cnt[a] % MOD
    if ans == 0:
        break
    cnt[a] -= 1
    cnt[a+1] += 1
 
print(ans)
N, D = map(int, input().split())
print((N+2*D)//(2*D+1))

### FIXED CODE ###

# A - Dodecagon

r = int(input())
print(3*r**2)
x=input()
result = pow(x,3)
print(result)


### FIXED CODE ###

x=int(input())
result = x**3
print(result)
N, A, B= map(int, input().split())
re += N//(A+B) *A
re += min(N%(A+B),A)
print(re)

### FIXED CODE ###

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

result = 0
result += N // (A + B) * A
result += min(N % (A + B), A)
print(result)
W = input()

count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
   
     for s in line.lower()split():
        if s == W:        
            count += 1


print(count)

### FIXED CODE ###

W = input()
 
count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
 
    for word in line.split():
        if word.lower() == W.lower():
            count += 1
print(count)
N=int(input())
def f(x):
  s=0
  while x!=0:
    s+=x%10
    x//=10
  return(s)
minn=50
for i in range(1,N/2):
  minn=min(f(i)+f(N-i),minn)
print(minn)

### FIXED CODE ###

N=int(input())
def f(x):
  s=0
  while x!=0:
    s+=x%10
    x//=10
  return(s)
minn=50
for i in range(1,N):
  minn=min(f(i)+f(N-i),minn)
print(minn)
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k] == "1"*k:
    print("1")
else:
    print(s.replace("1","")[0])

### FIXED CODE ###

s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k].replace("1","")=="":
    print("1")
else:
    print(s.replace("1","")[0])
S = input()
ANS = ""
for i in range(len(S)):
  if S[i] == B:
    ANS = ANS[:-1]
  else:
    ANS += S[i]

print(ANS)

### FIXED CODE ###

S = input()
ANSlist = []

for i in range(len(S)):
    if S[i] == '0':
        ANSlist.append('0')
    elif S[i] == '1':
        ANSlist.append('1')
    elif S[i] == 'B':
        if len(ANSlist) >=1:
            del ANSlist[-1]

ANS = ''.join(ANSlist)

print(ANS)
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit,i8


@njit(i8[:](i8,i8,i8[:]))
def sieve(N,A,dp):
    for i in range(N):
        now = A[i]
        M = A[-1] // now
        for j in range(2,M+1):
            dp[now*j-1] = False
    return dp


@njit(i8(i8,i8,i8[:]))
def cnt(N,A,dp):
    skip = 0
    res = 0
    for i in range(N):
        now = A[i]
        if skip == now:
            continue
        if i != N - 1:
            if now == A[i+1]:
                skip = now
                continue
        if dp[now-1]:
            res += 1
    return res


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

    A = sorted(A)
    A = np.array(A)

    dp = np.array([True for i in range(A[-1])])
    # print(dp)
    dp = sieve(N,A,dp)
    # print(dp)

    res = cnt(N,A,dp)

    print(res)



main()


### FIXED CODE ###

import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit,i8


def sieve(N,A,dp):
    for i in range(N):
        now = A[i]
        M = A[-1] // now
        for j in range(2,M+1):
            dp[now*j-1] = False
    return dp


def cnt(N,A,dp):
    skip = 0
    res = 0
    for i in range(N):
        now = A[i]
        if skip == now:
            continue
        if i != N - 1:
            if now == A[i+1]:
                skip = now
                continue
        if dp[now-1]:
            res += 1
    return res


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

    A = sorted(A)
    A = np.array(A)

    dp = np.array([True for i in range(A[-1])])
    # print(dp)
    dp = sieve(N,A,dp)
    # print(dp)

    res = cnt(N,A,dp)

    print(res)



main()
x=input()
if x=="A" :
    print("T")
elif x=="C" :
    print("G")
elif x=="G" :
    print("C")
else:
    print(A)

### FIXED CODE ###

x=input()
if x=="A" :
    print("T")
elif x=="C" :
    print("G")
elif x=="G" :
    print("C")
else:
    print("A")
N,A,B = map(int,input().split())
print(min([A*T,B]))

### FIXED CODE ###

N,A,B = map(int,input().split())
print(min([A*N,B]))
a = float(input())
b = float(input())
print(2*a+b,a*b)


### FIXED CODE ###

a,b = map(int,input().split())
print(a*b,2*(a+b))
N, W = map(int, input().split())
L = [list(map(int,input().split())) for i in range(N)]

dp = [0] * (W + 1)
cnt = 0

for w, v in L:
  cnt = cnt + w
  ##3,8-5,...15-7
  for i in range(min(cnt, W), w - 1, -1):
    if dp[i] < dp[i - w] + v:
      dp[i] = dp[i - w] + v

print(max(dp))

### FIXED CODE ###

import numpy as np

N , W = map(int,input().split())
dp = np.full(N * 1000 + 1,W + 1)
dp[0] = 0

for i in range(N):
  w,v = map(int,input().split())
  dp[v:] = np.minimum(dp[v:],dp[:-v] + w)

print(np.max(np.where(dp <= W)))
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,range(26)):
    sco-=cli[i][j]
  solution.append(con)
#print(sco)
stemp=1000000
etemp=1000
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(3)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  prob = math.exp((sc-sco)/tem())
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)
#print(sco)

### FIXED CODE ###

d=int(input())
c=list(map(int, input().split()))
s=[]
for i in range(d):
  s.append(list(map(int, input().split())))
for i in s:
  print(i.index(max(i))+1)
a,b,c = map(int,input.split())

if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

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

if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')
n=int(input()
print(n**3)

### FIXED CODE ###

n=int(input())
print(n**3)
a=int(input())
b=int(input())
c=int(input())
d=int(input())

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









### FIXED CODE ###





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


if abs(c-a) <= d:
    print('Yes')
elif abs(b-a)<=d and abs(c-b)<=d:
    print("Yes")
else:
    print("No")
N, Q = map(int, input().split())
S = input()
numlist = []
for i in range(N-1):
    if S[i:i+2] == 'AC':
        numlist.append(i)

l = [0 for i in range(Q)]
r = [0 for i in range(Q)]
for i in range(Q):
    ll, rr = map(int, input().split())
    l[i], r[i] = ll-1, rr-1

for i in range(Q):
    hajime = bisect.bisect_left(numlist, l[i])
    owari = bisect.bisect_right(numlist,r[i]-1)
    print(owari - hajime)

### FIXED CODE ###

import bisect
N, Q = map(int, input().split())
S = input()
numlist = []
for i in range(N-1):
    if S[i:i+2] == 'AC':
        numlist.append(i)

l = [0 for i in range(Q)]
r = [0 for i in range(Q)]
for i in range(Q):
    ll, rr = map(int, input().split())
    l[i], r[i] = ll-1, rr-1

for i in range(Q):
    hajime = bisect.bisect_left(numlist, l[i])
    owari = bisect.bisect_right(numlist,r[i]-1)
    print(owari - hajime)
# -*- coding: utf-8 -*-
l = [0] 
r = [0]
all_gate_clear = 1


#numcard
#gatenum
N, M = map(int, input().split())
card_count = range(N+1)

#idカードの生成
for i in range(M):
    l_temp,r_temp = map(int, input().split())
    l.append(l_temp)
    r.append(r_temp)
    
for gate_num in range(1,M+1):
    #1ゲートの処理
    for card in range(1,N+1):
        num = 0
        while r[gate_num] >= l[gate_num] + num:
            if l[gate_num] + num == card:
                if card_count[card] == gate_num -1:
                    card_count[card] += 1
                    break
            num += 1

for card in range(1,N+1):
    if card_count[card] == M:
        all_gate_clear += 1

print(all_gate_clear)

### FIXED CODE ###

# -*- coding: utf-8 -*-
l = [] 
r = []
count = 0

N, M = map(int, input().split())
l = [0] * M
r = [0] * M
for i in range(0,M):
    l[i], r[i] = map(int, input().split())

#idカードの生成
    
ml = max(l)
mr = min(r)

for i in range(1,N+1):
    if  ml <= i and i <= mr:
        count += 1

print(count)