Harryxun/stf_run huggingface dataset:
N,M = map(int,input().split())
A = []

#フィボナッチ数列
from functools import lru_cache
@lru_cache(maxsize=None)
def Fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return Fib(n-1) + Fib(n-2)
 
for i in range(M):
  a = int(input())
  A.append(a)
#ans = {0~a1-1 a1+1~a2-1 ... a(M-1)+1~aM-1 の行き方の積}
#各a(i)+1~a(i+1)-1への行き方は1通り
#i ~ i+Nへの行き方 Fib(N+1)通り

#REになっていたのはFib(0)が定義されていなかったから
if(N == 1): 
 ans = 1
elif(M == 0): 
 ans = Fib(N)
else: 
 ans = 0
 for i in range(M):  
    if(i == 0): #0~ a1-1 // ai+1 = A[i]
      n = (A[i]-1)-0
      #print(0,A[i]-1)
    else:
      n = (A[i]-1)-(A[i-1]+1) 
      #print(A[i-1]+1,A[i]-1)
      
    if(i != 0): #「渡れない箇所が二連続」が存在するなら0通り
     dif = A[i]-A[i-1]
     if(dif == 1):
       ans = 0
       break
          
    if(ans == 0): ans += (Fib(n+1)%(10**9 + 7))
    else: ans = ans*(Fib(n+1)%(10**9 + 7))

 n = N - (A[M-1]+1)#最後にaM + 1 ~ N のルートも考慮する
 ans = ans*(Fib(n+1)%(10**9 + 7))
 #print(A[M-1]+1,N)
            
ans = ans%(10**9 + 7)
print(ans)  

### FIXED CODE ###

N,M = map(int,input().split())
A = []

#フィボナッチ数列
def Fib(n):
    a, b = 1, 1
    if n == 0:
        return 0
    elif n== 1:
        return 1
    elif n == 2:
        return 1
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b
 
for i in range(M):
  a = int(input())
  A.append(a)
#ans = {0~a1-1 a1+1~a2-1 ... a(M-1)+1~aM-1 の行き方の積}
#各a(i)+1~a(i+1)-1への行き方は1通り
#i ~ i+Nへの行き方 Fib(N+1)通り

#REになっていた理由:
#・Fib(0)が定義されていなかったから
#・フィボナッチ数列を再帰的(=Fib(n-1)+Fib(n-2))で定義していると、
#Nが大きい(100000とか）のときに深く潜りすぎるのでRE

if(N == 1): 
 ans = 1
elif(M == 0): 
 ans = Fib(N+1)
else: 
 ans = 0
 for i in range(M):  
    if(i == 0): #0~ a1-1 // ai+1 = A[i]
      n = (A[i]-1)-0
      #print(0,A[i]-1)
    else:
      n = (A[i]-1)-(A[i-1]+1) 
      #print(A[i-1]+1,A[i]-1)
      
    if(i != 0): #「渡れない箇所が二連続」が存在するなら0通り
     dif = A[i]-A[i-1]
     if(dif == 1):
       ans = 0
       break
          
    if(ans == 0): ans += (Fib(n+1)%(10**9 + 7))
    else: ans = ans*(Fib(n+1)%(10**9 + 7))

 n = N - (A[M-1]+1)#最後にaM + 1 ~ N のルートも考慮する
 ans = ans*(Fib(n+1)%(10**9 + 7))
 #print(A[M-1]+1,N)
            
ans = ans%(10**9 + 7)
print(ans)
import sys

def f(A, c):
  n = len(A)
  B = []
  for i in range(len(A) -1):
    if A[i] != A[i+1]:
      c += 2
      B += A[i+2:]
      break
    else:
      B.append(A[i])
  if len(B) == n:
    return c
  else:
    return f(B, c)


def main():
  input = sys.stdin.readline
  S = [int(c) for c in input().strip()]
  ans = f(S, 0)
  print(ans)


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def main():
  input = sys.stdin.readline
  S = [int(c) for c in input().strip()]
  n1 = 0
  n0 = 0
  for i in S:
    if i == 0:
      n0 += 1
    else:
      n1 += 1
  print(min(n1, n0) * 2)


if __name__ == '__main__':
  main()
N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans))



### FIXED CODE ###


N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=max(H) - x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans)+1)
a,b,c,d=map(int,input().split())
if a+b=c+d:
  print('Balanced')
elif a+b>c+d:
  print('Left')
else:
  print('Right')

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a+b==c+d:
  print('Balanced')
elif a+b>c+d:
  print('Left')
else:
  print('Right')
import sys
def input(): return sys.stdin.readline().strip()

def main():
    N, K = map(int, input().split())
    A = [0] + list(map(int, input().split()))
    """
    （aが不要なカード）＝（A-{a}からK-a以上の最小の部分和を取った時、それがK以上）
    まで言い換えてドボン。。。
    部分和の全列挙しなくても和がKまでで打ち切っていいんだから、ここでdpの発想が出なかったのは切腹。
    まずは部分点解法を実装してみる。
    """
    ans = 0
    for k in range(1, N + 1):
        # dp[i][j] = (i個使って(ただしA[k]を除く)部分和jが作れるか)
        dp = [1] + [0] * K
        for i in range(1, N + 1):
            if i == k: continue
            dp2 = [0] * (K + 1)
            for j in range(K + 1):
                if dp[j] == 1:
                    dp2[j] = 1
                    dp2[min(K, j + A[i])] = 1
            dp = dp2

        
        no_need = True
        for j in range(K - A[k], K):
            if dp[j] != 0:
                no_need = False
                break
        if no_need: ans += 1
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()

def main():
    N, K = map(int, input().split())
    A = [0] + list(map(int, input().split()))
    """
    （aが不要なカード）＝（A-{a}からK-a以上の最小の部分和を取った時、それがK以上）
    まで言い換えてドボン。。。
    部分和の全列挙しなくても和がKまでで打ち切っていいんだから、ここでdpの発想が出なかったのは切腹。
    まずは部分点解法を実装してみる。

    →次に二分探索でdpを行う回数を削減する。ai <= ajに対してajが不要ならばaiも不要なことが対偶を取って分かる。
    そこでAをソートしたうえで必要と不要の境目を見つければよい。

    →PypyだとO(NKlogN)は通らなかったので、O(NK)解法を実装。
    一度二分探索できる話は忘れて、A-{a}から作れる部分和は(aの左側からの部分和)+(aの右側からの部分和)と
    かけることに注意すれば、左側からとれる部分和と右側からとれる部分和を前計算しておけばよい。
    rdpのテーブルメモリが重くてMLEするので（信じられん）、rdp_shiftに1になった瞬間のiを記録することにする。
    """
    rdp_shift = [N + 1] * K  # rdp_shift[j] = (右からi個を使って部分和jを作れるような最初のi)
    rdp_shift[0] = 0
    rdp = [0] * K  # rdp[i][j] = (a(-1),...,a(-i)の部分和でjを作れるか)
    rdp[0] = 1
    for i in range(1, N):
        rdp2 = [0] * K
        for j in range(K):
            if rdp[j] == 1:
                rdp2[j] = 1
            elif (j >= A[-i] and rdp[j - A[-i]] == 1):
                rdp2[j] = 1
                rdp_shift[j] = i
        rdp = rdp2

    ldp = [0] * K  # ldp[i][j] = (a1,...,aiの部分和でjを作れるか)
    ldp[0] = 1
    S = [0] * (K + 1)
    ans = 0
    for i in range(1, N + 1):
        # A[i]が不要かチェック
        for j in range(K):
            S[j + 1] = S[j]
            if rdp_shift[j] <= N - i:
                S[j + 1] += 1
        no_need = True
        for lval in range(K):
            if ldp[lval] == 0: continue
            rval = S[K - lval] - S[max(0, K - A[i] - lval)]
            if rval > 0:
                no_need = False
                break
        if no_need: ans += 1

        # ldp[i][:]の計算
        ldp2 = [0] * K
        for j in range(K):
            if ldp[j] == 1 or (j >= A[i] and ldp[j - A[i]] == 1):
                ldp2[j] = 1
        ldp = ldp2
    print(ans)
    

if __name__ == "__main__":
    main()
N,maxx,time = map(int, input.split())
if (N!= 0):
	ans = time*(N //maxx + 1)
else :
	ans=0  
print(ans)

### FIXED CODE ###

def multiplier(N,maxx,time):
  if N%maxx==0 :
    return N//maxx
  else :
    return N//maxx+1
  
def main():
	N,maxx,time = map(int, input().split())
	if N!=0 :
		ans = time * multiplier(N,maxx,time)
	else:
		ans=0  
	print(ans)
    
if __name__ == '__main__':
  main()
N = int(input())

if N % 2 != 0:
  print('0.6000000000')
else:
  if N == 1:
    print('1.0000000000')
    break
  else:
  	print('0.5000000000')


### FIXED CODE ###

N = int(input())

odd = (N+1)//2
print(odd/N)
s="CODEFESTIVAL2016"
t=input()
ans=0
for c1,c2 in zip(s,t):
  if c1!=c2 : ns+=1
print(ans)

### FIXED CODE ###

s="CODEFESTIVAL2016"
t=input()
ans=0
for c1,c2 in zip(s,t):
  if c1!=c2 : ans+=1
print(ans)
import numpy as np


def count_multi(s, d):
  m = a = np.array([int(c) for c in s])  # .astype(np.int)
  keta = 1
  count = np.count_nonzero(m == 0)
  while len(m) > 1:
    m = (m[:-1]*10 + a[keta:]) % d
    keta += 1
    count += np.count_nonzero(m == 0)
  return count
        
print(count_multi(input().strip(), 2019))


### FIXED CODE ###

s, w = [int(x) for x in input().strip().split()]
print("safe" if s > w else "unsafe")
n=int(input())
a=26
b=1
import string
array=list(string.ascii_lowercase)
while n>a:
  b+=1
  a+=26**b
if b==1:
  print(array[n-1])
else:
  c=b-1
  d=n-26**c
  brray=[0]
  crray=[d]
  for i in range(c-1):
    brray[i+1]=crray[i]//(26**(c-i))
    crray[i+1]=crray[i]%(26**(c-i))
  ans=array[brray[1]-1]
  if c>1:
    for j in range(2,c):
      ans=ans+array[brray[j]]
  ans=ans+array[crray[c]-1]
  print(ans)

### FIXED CODE ###

n=int(input())
a=26
b=1
import math
import string
array=list(string.ascii_lowercase)
while n>a:
  b+=1
  a+=26**b
if b==1:
  print(array[n-1])
else:
  c=b-1
  d=n-a
  brray=[0]
  crray=[d]
  for i in range(c):
    brray.append(math.ceil(crray[i]/(26**(c-i))))
    crray.append(crray[i]%(26**(c-i)))
  ans=array[brray[1]-1]
  if c>1:
    for j in range(2,b):
      ans=ans+array[brray[j]-1]
  ans=ans+array[crray[c]-1]
  print(ans)
def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)
N, X, D = map(int, input().split())
g = gcd(X, D)
X //= g
D //= g
if D < 0:
    X, D = -X, -D

E = {}
for i in range(N+1):
    k = i % D
    l, r = i * (2*X+(i-1)*D) // 2, i * (2*X+(2*N-i-1)*D) // 2
    c = (r - l) // D + 1 if D else 1
    if k not in E:
        E[k] = (l, r, c)
    else:
        ll, rr, cc = E[k]
        if r < ll:
            E[k] = (l, rr, cc + c)
        elif l > rr:
            E[k] = (ll, r, cc + c)
        elif l < ll:
            E[k] = (l, rr, cc + ((ll - l) // D if D else 1))
        elif r > rr:
            E[k] = (ll, r, cc + ((r - rr) // D if D else 1))

ans = 0
for e in E:
    l, r, c = E[e]
    ans += c

print(ans)


### FIXED CODE ###

def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)
N, X, D = map(int, input().split())
if D == 0:
    print(N+1 if X else 1)
    exit()
g = gcd(X, D)
X //= g
D //= g
if D < 0:
    X, D = -X, -D

E = {}
for i in range(N+1):
    k = i % D
    l, r = i * (2*X+(i-1)*D) // 2, i * (2*X+(2*N-i-1)*D) // 2
    c = (r - l) // D + 1 if D else 1
    if k not in E:
        E[k] = (l, r, c)
    else:
        ll, rr, cc = E[k]
        if r < ll:
            E[k] = (l, rr, cc + c)
        elif l > rr:
            E[k] = (ll, r, cc + c)
        elif l < ll:
            E[k] = (l, rr, cc + ((ll - l) // D if D else 1))
        elif r > rr:
            E[k] = (ll, r, cc + ((r - rr) // D if D else 1))

ans = 0
for e in E:
    l, r, c = E[e]
    ans += c

print(ans)
import sys

args = sys.argv

n = int(args[1])
a = int(args[2])
b = int(args[3])

train = n * a
bus = b

if(train < bus):
  print(train)
else:
  print(bus)


### FIXED CODE ###

import sys

n,a,b = input().split(' ')


n = int(n)
a = int(a)
b = int(b)

train = n * a
bus = b

if(train < bus):
  print(train)
else:
  print(bus)
from collections import Counter

N = int(input())
counter = Counter(map(int, input().split()))

sum = 0

for a, cnt in counter.items():
    if a > cnt:
        sum += cnt
    else:
        sum += cnt - a

print(sum)


### FIXED CODE ###

from math import ceil

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

print(ceil((a + b) / 2))
def main():
    A, B, X = map(int, input().split())
    if X >= A*pow(10,9) + B*10:
        print(pow(10, 9))
        return
    ans = 0
    for n in range(10):
        N = (X - B*n) // A
        #print('N:{}, n:{}'.format(N, n))
        ans = max(ans, min(N, pow(10, n)-1))
 
    print(ans)
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

# coding UTF-8
# 
# problem A
# 

r = input()
if r == 'SUN':
    print(7)
if r == 'MON':
    print(6)
if r == 'TUE':
    print(5)
if r == 'WED':
    print(4)
if r == 'THU':
    print(3)
if r == 'FRI':
    print(2)
if r == 'SAT':
    print(1)
print('No')

### FIXED CODE ###

d,t,s=map(int,input().split())

if d / s <= t:
  print('Yes')
else:
  print('No')
n=int(input())
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  g[a-1].append([b-1,i])
  g[b-1].append([a-1,i])
l=[0]*(n-1)
def dfs(v,p=-1,c=-1):
  k=1
  for u,e in g[v]:
    if u==p: continue
    if k==c: k+=1
    l[e]=k
    k+=1
    dfs(u,v,l[e])
dfs(0)
print(max(len(g[v]) for v in range(n)))
for c in l: print(c)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n=int(input())
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,sys.stdin.readline().split())
  g[a-1].append([b-1,i])
  g[b-1].append([a-1,i])
print(max(len(v) for v in g))
l=[0]*(n-1)
def dfs(v,p=-1,c=-1):
  k=1
  for u,e in g[v]:
    if u==p: continue
    if k==c: k+=1
    l[e]=k
    dfs(u,v,k)
    k+=1
dfs(0)
for c in l: print(c)
n = int(input())

if n == 1:
    print("Hello World")
elif n ==2:
    a, b = map(int, input().split())
    ans = a+b
    print(ans)

### FIXED CODE ###

n = int(input())

if n == 1:
    print("Hello World")
elif n ==2:
    a = int(input())
    b = int(input())
    ans = a+b
    print(ans)
S = input()
judge = 0

for i in range(4):
  if S[i] == S[i+1]:
    judge += 1
    
if judge == 0:
  print('Good')
else:
  print('Bad')


### FIXED CODE ###

S = input()
judge = 0

for i in range(3):
  if S[i] == S[i+1]:
    judge += 1
    
if judge == 0:
  print('Good')
else:
  print('Bad')
N = int(input())
graph = [[] for _ in range(N)]
numOfEdges = [0 for _ in range(N)]
visited = [0 for _ in range(N)]
edges = []

for i in range(1, N):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    edges.append((a, b))
    graph[a].append(b)
    graph[b].append(a)

def dfs(prev, now):
    if visited[now]:
        return
    visited[now] = 1
    numOfEdges[now] = len(graph[now])
    for adj in graph[now]:
        if adj == prev:
            continue
        dfs(now, adj)

dfs(-1, 0)
maxColor = max(numOfEdges)
print(maxColor)

for e in edges:
    a, b = e
    x, y = numOfEdges[a], numOfEdges[b]

    print(max(x, y))

    if x > y:
        numOfEdges[a] -= 1
    elif y > x:
        numOfEdges[b] -= 1
    else:
        numOfEdges[a] -= 1
        numOfEdges[b] -= 1


### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10**8)

N = int(input())
graph = [[] for _ in range(N)]
numOfEdges = [0 for _ in range(N)]
visited = [0 for _ in range(N)]
edges = defaultdict(int)

for i in range(1, N):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    numOfEdges[a] += 1
    numOfEdges[b] += 1
    edges[(a, b)] = 0
    graph[a].append(b)
    graph[b].append(a)

def dfs(prev, now, col):
    if visited[now]:
        return
    visited[now] = 1
    i = 1
    for adj in graph[now]:
        if adj == prev:
            continue
        if now < adj:
            edges[(now, adj)] = col + i
        else:
            edges[(adj, now)] = col + i
        dfs(now, adj, col+i)
        i += 1

dfs(-1, 0, 1)
maxColor = max(numOfEdges)
print(maxColor)

for k, i in edges.items():
    e = i % maxColor
    if e:
        print(e)
    else:
        print(maxColor)
N = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]
q = N
ans = ''
while q >= 26:
    q, mod = divmod(q, 26)
    ans = alpha[mod-1] + ans
if mod != 0:
    ans = alpha[q-1] + ans
print(ans)

### FIXED CODE ###

# 自力では解けなかった(2020.7.6)

alpha = ['Z']
alpha.extend([chr(ord('a') + i) for i in range(26)])
N = int(input())
q = N
ans = ''
while True:
    if q <= 26:
        ans += str(alpha[q])
        break
    else:
        q, mod = divmod(q, 26)
        if mod == 0:
            q -= 1
            mod = 26
        ans += str(alpha[mod])

print(ans[::-1])
n = int(input())
v = [int(item) for item in input().split()]
c = [int(item) for item in input().split()]

d = [[v[i], c[i]] for i in range(n)]
d.sort(key=lambda x: x[0] - x[1], reverse=True)

ans = 0
i = 0
while d[i][0] - d[i][1] > 0:
    ans += d[i][0] - d[i][1]
    i += 1

print(ans)


### FIXED CODE ###

n = int(input())
v = [int(item) for item in input().split()]
c = [int(item) for item in input().split()]

d = [[v[i], c[i]] for i in range(n)]
d.sort(key=lambda x: x[0] - x[1], reverse=True)

ans = 0
i = 0
while i < n and d[i][0] - d[i][1] > 0:
    ans += d[i][0] - d[i][1]
    i += 1

print(ans)
S = list(input())
alpha_list = [chr(i) for i in range(97,97+26)]

S = set(S)
alpha_list = set(alpha_list)
answer = alpha_list - S
answer = sorted(list(answer))[0]
print(answer)

### FIXED CODE ###

S = list(input())
alpha_list = [chr(i) for i in range(97,97+26)]

S = set(S)
alpha_list = set(alpha_list)
answer = alpha_list - S
if alpha_list == S:
    print('None')
else:
    print(sorted(list(answer))[0])
import sys

def plus_and_check(lines):
c, d = lines.split()
number = c + d
return len(str(number))

a = []
answer = []
for line in sys.stdin:
    a.append(int(line))

i = 0
while i < len(a)-1:
    answer = plus_and_check(a[i])

j = 0
while j < len(answer)-1:
    print answer[i]

### FIXED CODE ###

import sys

a = []
answer_array = []
for line in sys.stdin:
    a.append(map(int, line.strip().split()))
    #except StopIteration:
        #break

for i in range(len(a)):
    sum_up = a[i][0] + a[i][1]

    answer = len(str(sum_up))

    answer_array.append(answer)

for j in range(len(answer_array)):
    print answer_array[j]
import sys
n=int(input())
L=[]
for _ in range(n):
    x,y,h=map(int,input().split())
    L.append((x,y,h))
a,b,c=L[0]
mae=a+b+c
for i in range(101):
    for j in range(101):
        takasa=abs(a-i)+(b-j)+c
        flag=1
        for p,q,r in L:
            if r==100:
                ans=(p,q,r)
            if abs(p-i)+abs(q-j)+r == takasa:
                continue
            else:
                flag=0
        if flag:
            ans=(i,j,takasa)
print(*ans, sep=' ')

### FIXED CODE ###

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

for i in range(101):
    for j in range(101):
        temp = -1
        for x, y, h in XYH:
            if h == 0:
                continue
            temp = h + abs(x - i) + abs(y - j)
            break
        flag = 0
        for x, y, h in XYH:
            kouho = temp - (abs(x - i) + abs(y - j)) - h
            if kouho == 0:
                continue
            elif h == 0 and kouho < 0:
                continue
            else:
                flag = 1
                break
        if not flag:
            print(i, j, temp)
            exit()
from operator import itemgetter
import sys
def read():
    return sys.stdin.readline().rstrip()
def main():
    N, Q = map(int, read().split())
    C = list(map(int, read().split()))
    E = []

    D = [-1] * N
    for i in range(N):
        D_i = D[C[i]]
        if D_i != -1:
            E.append((D_i, i, -1))
        D[C[i]] = i

    for i in range(Q):
        l, r = map(int, input().split())
        E.append((l - 1, r - 1, i))

    def f(tup):
        return tup[0]
    E.sort(key=f, reverse=True)

    # Binary Indexed Tree (Fenwick Tree)
    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0] * (n + 1)
            self.el = [0] * (n + 1)

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i]
                i -= i & -i
            return s

        def add(self, i, x):
            # assert i > 0
            self.el[i] += x
            while i <= self.n:
                self.data[i] += x
                i += i & -i

        def get(self, i, j=None):
            if j is None:
                return self.el[i]
            return self.sum(j) - self.sum(i)

    ANS = [0] * Q
    d = BIT(N)
    for e in E:
        if e[2] == -1:
            d.add(e[1], 1)
        else:
            ANS[e[2]] = e[1] - e[0] + 1 - d.sum(e[1])

    for i in range(Q):
        print(ANS[i])

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
import sys
def read():
    return sys.stdin.readline().rstrip()
def main():
    N, Q = map(int, read().split())
    C = list(map(int, read().split()))
    E = defaultdict(list)

    D = [-1] * (N + 1)
    for i in range(N):
        D_i = D[C[i]]
        if D_i != -1:
            E[D_i].append((D_i, i))
        D[C[i]] = i

    F = defaultdict(list)
    for i in range(Q):
        l, r = map(int, input().split())
        F[l-1].append((r - 1, i))



    # Binary Indexed Tree (Fenwick Tree)
    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0] * (n + 1)
            self.el = [0] * (n + 1)

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i]
                i -= i & -i
            return s

        def add(self, i, x):
            # assert i > 0
            self.el[i] += x
            while i <= self.n:
                self.data[i] += x
                i += i & -i

        def get(self, i, j=None):
            if j is None:
                return self.el[i]
            return self.sum(j) - self.sum(i)

    ANS = [0] * Q
    d = BIT(N)
    for x in range(N - 1, -1, -1):
        for e in E[x]:
            d.add(e[1], 1)
        for f in F[x]:
            ANS[f[1]] = f[0] - x + 1 - d.sum(f[0])

    for i in range(Q):
        print(ANS[i])

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
from decimal import *
 
a, b, c = map(Decimal, input().split())
if sqrt(a) + sqrt(b) < sqrt(c):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from decimal import *
 
a, b, c = map(Decimal, input().split())
if a.sqrt() + b.sqrt() < c.sqrt():
    print('Yes')
else:
    print('No')
import fractions
n=int(input())
glm=1
for i in range(n):
    nums=int(input())
    glm=int(glm*nums/fractions.gcd(nums,glm))
print(glm)   

### FIXED CODE ###

#早くmathを導入してほしい
from fractions import gcd
n=int(input())
glm=1
for i in range(n):
    nums=int(input())
    glm=int(glm*nums//gcd(nums,glm))
print(glm)
s = input()
b = s[0]
cou = 0
if len(s)==2:
    if s[0]=='>' and s[1] =='<':
        print(2)
        exit()

lis = []
for i in s:
    if b ==i:
        if i=='<':
            cou-=1
        else:
            cou+=1
    else:
        lis.append(cou)
        b = i
        if b=='<':
            cou =-1
        else:
            cou = 1
lis.append(cou)
l = len(lis)
sum = 0

for i in range(0,l,2):
    if i+1 == l and (i+1)%2==1:
        a = abs(lis[i])
        sum += a*(a+1)//2
        break
    a = abs(lis[i])
    b = abs(lis[i+1])

    if a < b:
		sum += b*(b+1)//2
		sum += (a-1)*a//2
    else:
        sum += a*(a+1)//2
        sum += (b-1)*b//2        
print(sum)

### FIXED CODE ###

s = input()
b = s[0]
cou = 0


lis = []
for i in s:
    if b ==i:
        if i=='<':
            cou-=1
        else:
            cou+=1
    else:
        lis.append(cou)
        b = i
        if b=='<':
            cou =-1
        else:
            cou = 1
lis.append(cou)
l = len(lis)
sum = 0
if s[0]=='<':
    for i in range(0,l,2):
        if i+1 == l and (i+1)%2==1:
            a = abs(lis[i])
            sum += a*(a+1)//2
            break
        a = abs(lis[i])
        b = abs(lis[i+1])

        if a < b:
            sum += b*(b+1)//2
            sum += (a-1)*a//2
        else:
            sum += a*(a+1)//2
            sum += (b-1)*b//2
else:
    a = abs(lis[0])
    sum += a*(a+1)//2
    for i in range(1,l,2):
        if i+1 == l and (i+1)%2==0:
            a = abs(lis[i])
            sum += a*(a+1)//2
            break
        a = abs(lis[i])
        b = abs(lis[i+1])

        if a < b:
            sum += b*(b+1)//2
            sum += (a-1)*a//2
        else:
            sum += a*(a+1)//2
            sum += (b-1)*b//2

print(sum)
a=int(input())
b=int(input())

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

### FIXED CODE ###

List=[int(j) for j in input().split()]
a=List[0]
b=List[1]

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)
import sys
A, B, C, X, Y = map(int,input().split())
 
minf = sys.maxsize
X1 = X
Y1 = Y
 
for i in range(0, max(X,Y)+1):
    price = max(0,(X1-i))*A+max(0,(Y1-i))*B+2*i*C 
print(min(price))

### FIXED CODE ###

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

## min(Ax + By + Cz) = min((A+0.5C)x + (B+0.5C)y)
# Xyen = Ai + 2Cj, Yyen = Bk + 2Cj, X = i +2j, Y = k + 2j
# Xyen + Yyen = AX + BY + 2(C-A)j + 2(C-B)j, jを求めればok?

# l = []
# for j in range(max(X,Y)+1):
#     if j <= X+Y:
#         l.append(A*X + B*Y + (C-A*0.5-B*0.5)*j)

# print(int(min(l)))

X1 = X
Y1 = Y
price = []
for i in range(0, max(X,Y)+1):
    price.append(max(0,(X1-i))*A+max(0,(Y1-i))*B+2*i*C) 
print(min(price))
x = int(input())

s = x//11

if 11*s == x:
  print(s*2)
elif x <= 11*s + 6:
  print(s*2+1)
else:
  print(S*2+2)


### FIXED CODE ###

x = int(input())
 
s = x//11
 
if 11*s == x:
  print(s*2)
elif x <= 11*s + 6:
  print(s*2+1)
else:
  print(s*2+2)