Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    inf=10**20
    N=I()
    A=LI()
    if N%2==0:
        ans=0
        for i in range(0,N,2):
            ans+=A[i]
        ans=max(ans,sum(A)-ans)
        print(ans)
    else:
        """左から見ていく，i個を見たときに，
        iが偶数：
        　現在i//2個取得　or i//2 - 1取得(もう余裕がない)
        
        iが奇数：
        　現在i// +12個取得　or i//2取得(もう余裕がない)
        さらにi番目をとったか撮ってないかで2通り 
        ただし，余裕がある状態から取らないのは，数が足りなくなる
        """
        tight_get=[0]*N
        tight_not=[0]*N
        lo=[0]*N
        
        #最初だけ，取ったら必ずlooseになる
        lo[0]=A[0]
        lo[1]=A[1]
        
        for i in range(2,3):
            LL=[tight_get[i-2]+A[i],tight_not[i-2]+A[i]+tight_not[i-1]]
            tight_get[i]=max(LL)
            LL=[lo[i-2]]
            tight_not[i]=max(LL)
            lo[i]=lo[i-2]+A[i]
            
        for i in range(3,4):
            LL=[tight_get[i-2]+A[i],tight_not[i-2]+A[i],tight_not[i-1]+A[i],lo[i-3]+A[i]]
            tight_get[i]=max(LL)
            LL=[lo[i-2]]
            tight_not[i]=max(LL)
            lo[i]=lo[i-2]+A[i]
            
        for i in range(4,N):
            LL=[tight_get[i-2]+A[i],tight_not[i-2]+A[i],tight_not[i-1]+A[i],lo[i-3]+A[i],lo[i-4]]+A[i]
            tight_get[i]=max(LL)
            LL=[lo[i-2]]
            tight_not[i]=max(LL)
            lo[i]=lo[i-2]+A[i]
            
        print(max(tight_get[-1],tight_not[-1],lo[-1]))
    
    
    
        
        
        

main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    inf=10**20
    N=I()
    A=LI()
    """左から見ていく，i個を見たときに，
    i//2 ±1の範囲なので，状態は3N通り
    """
    
    p1=[-inf]*N
    zero=[-inf]*N
    n1=[-inf]*N
    
    p1[0]=A[0]
    zero[0]=0
    zero[1]=max(A[0],A[1])
    n1[1]=0
    
    for i in range(2,N):
        #偶奇で遷移の仕方に変化
        if i%2==0:
            p1[i]=max(p1[i-2]+A[i],p1[i-1])#2つ前の状態から取る or 1つ前の状態から取らない
            zero[i]=max(zero[i-2]+A[i],zero[i-1])
            n1[i]=max(n1[i-2]+A[i],n1[i-1])
        else:
            p1[i]=p1[i-2]+A[i]
            zero[i]=max(zero[i-2]+A[i],p1[i-1])
            n1[i]=max(n1[i-2]+A[i],zero[i-1])
            
    """        
    print(p1)
    print(zero)
    print(n1)"""
    
    print(zero[-1])
    
    
        
        
        

main()
n,q = map(int,input().split())
l = [ [] for i in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    l[a-1].append(b-1)
ans = [0 for _ in range(n)]
p = [list(map(int,input().split())) for i in range(q)]
def f(p,x):
    ans[p] +=x
    for i in l[p]:
        f(i,x)
for p1 in p:
    f(p1[0]-1,p1[1])
print((ans))

### FIXED CODE ###

#D解説実装
n,q = map(int,input().split())
l = [0 for i in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    l[b-1] = (a-1)
ans = [0 for _ in range(n)]
p = [list(map(int,input().split())) for i in range(q)]
for p1 in p:
    ans[p1[0]-1] += p1[1]
for i in range(1,n):
    ans[i] += ans[l[i]]
print(" ".join(map(str,ans)))
n,W=list(map(int,input().split()))

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i][:w]=dp[i-1][:w]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp))

### FIXED CODE ###

import numpy as np

n,W=list(map(int,input().split()))

dp=np.zeros([n+1,W+1],dtype=int)

for i in range(1,n+1):
    w,v=list(map(int,input().split()))
    dp[i]=dp[i-1]
    dp[i][w:]=np.maximum(dp[i-1][:W-w+1]+v,dp[i-1][w:])
print(np.max(dp))
n,m=map(int,input().split())
p=[]
pp=[1]
pp*=n
ans=[]
for i in range(n):
    p.append([])
for i in range(m):
    pi,yi=map(int,input().split())
    p[pi-1].append([yi,pp[pi-1]])
    ans.append([pi-1,pp[pi-1]])
    pp[pi-1]+=1
    print(p)
for i in range(n):
    p[i].sort()
for i in range(m):
    b=len(p[ans[i][0]])
    for j in range(b):
        if ans[i][1]==p[ans[i][0]][j][1]:
            print('{0:06d}{1:06d}'.format(ans[i][0]+1,j+1))
            break

### FIXED CODE ###

from operator import itemgetter
n,m=map(int,input().split())
a=[]
for i in range(m):
    pi,yi=map(int,input().split())
    a.append([i,pi,yi])
b=[]
c=[]
for i in range(n):
    b.append([])
    c.append([])
for i in range(m):
    x=a[i][0]
    y=a[i][2]
    b[a[i][1]-1].append([x,y])

for i in range(n):
    b[i].sort(key=itemgetter(1))
    l=len(b[i])
    for j in range(l):
        a[b[i][j][0]].append(j+1)
for i in range(m):
    xi=a[i][1]
    yi=a[i][3]
    print('{0:06d}{1:06d}'.format(xi,yi))
S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
if X[len(X)-1]==0:
  n +=1
print(n)


### FIXED CODE ###

S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
n += int(flag*(flag-1)/2)
if X[len(X)-1]==0:
  n +=1
print(n)
#ALDS1_3-A Elementary data structures - Stack
A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[i:]
            break
        elif(A[i]=="*"):
            print(A)
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[i:]
            break
print(A[0])

### FIXED CODE ###

A=input().split()
B=[]
for i in A:
 if i.isdigit():
  B.append(int(i))
 else:
  if i=="+":
   B[-1]=B[-2]+B[-1]
   del B[-2]
  elif i=="-":
   B[-1]=B[-2]-B[-1]
   del B[-2]
  elif i=="*":
   B[-1]=B[-2]*B[-1]
   del B[-2]
print(B[0])
while True:
    x,y = map(int(input().split())
    if (x,y) ==(0,0): break
    if x < y:
        print(x,y)
    else:
        print(y,x)


### FIXED CODE ###

while True:
    a,b = map(int,input().split())
    if a == 0 and  b==0:
        break
    if a > b:
        print(b,a)
    else:
        print(a,b)
n,d,a= map(int, input().split( ))
ms = []
for i in range(n):
    xi,hi = map(int, input().split( ))
    tmp = 0
    if hi%a:
        tmp+=1
    ms.append([xi,hi//a+tmp])

ms.sort()
ans = ms[0][1]
tmp = ms[0][1]
from collections import deque

Q = deque()
Q.append(0)

for i in range(1,n):

    while Q:###ifから変更
        tmp2 = Q.popleft();
        if ms[tmp2][0]+2*d<ms[i][0]:###tmpじゃないわms[tmp2][0]だわ
            tmp -= ms[tmp2][1]
        else:
            Q.appendleft(tmp2)
            break###
    ms[i][1]-=tmp###
    ms[i][1] = max(ms[i][1],0)###

    if ms[i][1]>0:　
        ##ms[i][1]-=tmp　二回引いてるわ
        ans += ms[i][1]
        Q.append(i)
        tmp += ms[i][1]
print(ans)


### FIXED CODE ###

n,d,a= map(int, input().split( ))
ms = []
for i in range(n):
    xi,hi = map(int, input().split( ))
    tmp = 0
    if hi%a:
        tmp+=1
    ms.append([xi,hi//a+tmp])

ms.sort()
ans = ms[0][1]
tmp = ms[0][1]
from collections import deque

Q = deque()
Q.append(0)

for i in range(1,n):

    while Q:###ifから変更
        tmp2 = Q.popleft();
        if ms[tmp2][0]+2*d<ms[i][0]:###tmpじゃないわms[tmp2][0]だわ
            tmp -= ms[tmp2][1]
        else:
            Q.appendleft(tmp2)
            break###
    ms[i][1]-=tmp###
    ms[i][1] = max(ms[i][1],0)###

    if ms[i][1]>0:
        #ms[i][1]-=tmp　二回引いてるわ
        ans += ms[i][1]
        Q.append(i)
        tmp += ms[i][1]
print(ans)
import numpy as np
n,m = map(int,input().split())
a = np.zeros((n,m))
b = np.zeros(m)
for i in range(n):
    x = list(map(int,input().split()))
    for j in range(m):
        a[i][j] = x[j]
for i in range(m):
    b[i] = int(input())
c = np.dot(a,b)
for x in c:
    print(int(x))



### FIXED CODE ###

n,m = map(int,input().split())
a = []; b= [];
for i in range(n): a.append(list(map(int,input().split())))
for i in range(m): b.append(int(input()))
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j]*b[j]
    print(c)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]  # 親の値が更新され、更新された親の値が返る, 返るのは正の値

    def size(self, x):
        return -self.parents[self.find(x)]

    def union(self, x, y):
        if self.size(x) > self.size(y):
            x, y = y, x  # 処理を行う上で、必ずxのグループの要素数の方が多くあってほしい
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)


N, M = map(int, input().split())
brige = []
for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    brige.append((a, b))

uf = UnionFind(N)
ans = [int(N*(N-1)//2)]*M

for i in reversed(range(1, M)):
    if uf.same(brige[i][0], brige[i][1]):
        ans[i-1] = ans[i]
    else:
        ans[i-1] = ans[i] - uf.size(brige[i][0]) * uf.size(brige[i][1])
        uf.union(brige[i][0], brige[i][1])
for i in range(M):
    print(ans[i])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
 
class UnionFind():
	def __init__(self, size):
		self.table = [-1 for _ in range(size)]
		self.size = [1 for _ in range(size)]
 
	def find(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self.find(self.table[x])
			return self.table[x]
 
	def union(self, x, y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] > self.table[s2]:
				self.table[s2] = s1
				self.table[s1] -= 1
				self.size[s1] += self.size[s2]
				self.size[s2] = 0
			else:
				self.table[s1] = s2
				self.table[s2] -= 1
				self.size[s2] += self.size[s1]
				self.size[s1] = 0
 
		return
 
n, m = map(int, input().split())
brs = [list(map(int, input().split())) for _ in range(m)]
 
uf = UnionFind(n)
ans = [n*(n-1)//2]
for i in range(m-1, 0, -1):
	a, b = brs[i][0], brs[i][1]
	a, b = a-1, b-1
	s1, s2 = uf.find(a), uf.find(b)
	if s1 != s2:
		ans.append(ans[-1] - uf.size[s1]*uf.size[s2])
	else:
		ans.append(ans[-1])
	uf.union(s1, s2)
print(*list(reversed(ans)), sep="\n")
n, = map(int, input().split())
a = list(map(int, input().split()))
ans = []

h = a[0]
i = a[1]
s = h + abs(h-i)
if i < h:
    ans.append(-1 * abs(h-i))
else:
    ans.append(0)
for x in range(2, n+1):
    j = a[x]
    s += abs(i-j)
    if j < i:
        ans.append(-1 * abs(i-j))
    else:
        ans.append(0)
    h = i
    i = j

for x in ans:
    print(s+x)

### FIXED CODE ###

n, = map(int, input().split())
a = list(map(int, input().split()))
a.append(0)
m = []

i = 0
j = a[0]
s = abs(a[0])
for x in range(1, n+1):
    k = a[x]
    s += abs(j-k)
    if i<=j<=k or k<=j<=i:
        m.append(0)
    else:
        ij = abs(i-j)
        jk = abs(j-k)
        if ij<jk:
            m.append(-2*ij)
        else:
            m.append(-2*jk)
    i = j
    j = k
for x in m:
    print(s+x)
s = input()
n = len(s)
for i in range(2**(n-1)):
    op = ["-"] * (n-1)
    for j in range(n-1):
        if (i >> j) & 1:
            op[n - 2 -j] = "+"
    #print(op)
    chk = ""
    for p_n, p_o in zip(n-1, op + [""]):
        chk += (p_n + p_o)
    if eval(chk) == 7:
        print(chk + "=7")
        exit()

### FIXED CODE ###

s = input()
n = len(s)
for i in range(2**(n-1)):
    op = ["-"] * (n-1)
    for j in range(n-1):
        if (i >> j) & 1:
            op[n - 2 -j] = "+"
    #print(op)
    chk = ""
    for p_n, p_o in zip(s, op + [""]):
        chk += (p_n + p_o)
    if eval(chk) == 7:
        print(chk + "=7")
        exit()
#lang:reverse.py

result = 0
str = input()
#文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(count):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)


### FIXED CODE ###

#lang:reverse.py

result = 0
str = input()
#文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(int(count)):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)
a,b,c=map(int,input())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))


### FIXED CODE ###

a,b,c=map(int,input().split())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))
n = input()
j = 10
r = 0
for i in range(200002):
  r = r + n%j
  j = j*10

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

### FIXED CODE ###

n = input()
r = 0
for i in n:
  r = r + int(i)
if r % 9 == 0:
  print("Yes")
else:
  print("No")
a = input()
b= input()
x = a*b
def odd_even():
    if x%2==0:
        return "Even"
    else:
        return"Odd"
 
odd_even(x)


### FIXED CODE ###

a,b = map(int,input().split())
if (a*b)%2==0:
    print("Even")
else:
    print("Odd")
from functools import reduce
from math import gcd
n,x = map(int,input().split())
X = list(map(int,input().split()))
X = [x-X[0] for x in X]
print(reduce(gcd,X))

### FIXED CODE ###

from functools import reduce
from fractions import gcd
n,x = map(int,input().split())
X = list(map(int,input().split()))
X = [abs(a-x) for a in X]
print(reduce(gcd,X))
def getter(targ,x,y):
    #print(x,y,len(targ[0]),len(targ))
    if 0 > x or x >= len(targ) or 0 > y or y >= len(targ[0]) or targ[x][y] == '#':
        return 0
    else:
        targ[x][y] = '#'
        return 1 + getter(targ,x+1,y) + getter(targ,x-1,y) + getter(targ,x,y+1) + getter(targ,x,y-1)
with open("input1.txt") as f:
    width,height = [int(n) for n in f.readline().split(" ")]
    global lab
    while True:
        lab,start = [],[]
        for a in range(height):
            disp = [n for n in f.readline().rstrip('\n')]
            if '@' in disp:
                start.extend([disp.index('@'),a])
            lab.append(disp)
        else:
            a,b = start
            print(getter(lab,b,a))
            width,height = [int(n) for n in f.readline().split(" ")]
            if width == 0 and height == 0:
                break

### FIXED CODE ###

def getter(targ,x,y):
    #print(x,y,len(targ[0]),len(targ))
    if 0 > x or x >= len(targ) or 0 > y or y >= len(targ[0]) or targ[x][y] == '#':
        return 0
    else:
        targ[x][y] = '#'
        return 1 + getter(targ,x+1,y) + getter(targ,x-1,y) + getter(targ,x,y+1) + getter(targ,x,y-1)
width,height = [int(n) for n in input().split(" ")]
global lab
while True:
    lab,start = [],[]
    for a in range(height):
        disp = [n for n in input().rstrip('\n')]
        if '@' in disp:
            start.extend([disp.index('@'),a])
        lab.append(disp)
    else:
        a,b = start
        print(getter(lab,b,a))
        width,height = [int(n) for n in input().split(" ")]
        if width == 0 and height == 0:
            break
n,m = list(map(int, input()))
ans = "Yes"
if m <n:
    ans = "No"
print(ans)

### FIXED CODE ###

n,m = list(map(int, input().split()))
ans = "Yes"
if m <n:
    ans = "No"
print(ans)
# coding: utf-8
# Your code here!
import math

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

print(A*B//math.gcd(A,B))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions

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

print(A*B//fractions.gcd(A,B))
D=int(input())
if D=25:
  a='Christmas'
elif D=24:
  a='Christmas Eve'
elif D=23:
  a='Christmas Eve Eve'
else:
  a='Christmas Eve Eve Eve'
print(a)

### FIXED CODE ###

D=int(input())
if D==25:
  a='Christmas'
elif D==24:
  a='Christmas Eve'
elif D==23:
  a='Christmas Eve Eve'
else:
  a='Christmas Eve Eve Eve'
print(a)
def f(current, n,k):
	if n == 0:
		return current
    return min(f(2*current, n- 1,k), f(+k + current, n- 1, k)) 
print f(1,int(raw_input()), int(raw_input()))

### FIXED CODE ###

def f(current, n,k):
	if n == 0:
		return current
	return min(f(2*current, n- 1,k), f(+k + current, n- 1, k)) 
print f(1,int(raw_input()), int(raw_input()))
a, b = map(int, input().split())
if a == 1:
    if b == 2:
        print("3")
    else:
        print("2")
if a == 2:
    if b == 1:
        print("3")
    else:
        print("1")
if a == 3:
    if b == 2:
        print("1")
    else:
        print("2")

### FIXED CODE ###

a = int(input())
b = int(input())
if a == 1:
    if b == 2:
        print("3")
    else:
        print("2")
if a == 2:
    if b == 1:
        print("3")
    else:
        print("1")
if a == 3:
    if b == 2:
        print("1")
    else:
        print("2")
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
if n==2:
  print(((x[0]-x[1])**2+(y[0]-y[1])**2)**(1/2)/2)
else:
  ans=10**5
  A=[0]*3
  B=[0]*3
  for i in range(n-2):
    for j in range(i+1,n-1):
      A[0]=x[j]-x[i]
      A[1]=y[j]-y[i]
      A[2]=A[0]*(x[i]+x[j])/2+A[1]*(y[i]+y[j])/2
      for k in range(j+1,n):
        B[0]=x[k]-x[i]
        B[1]=y[k]-y[i]
        B[2]=B[0]*(x[i]+x[k])/2+B[1]*(y[i]+y[k])/2
        if A[0]*B[1]==A[1]*B[0] and A[0]*B[1]!=0:#三点が同一直線状に存在1
          r=((max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))**2+(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))**2)**(1/2)/2
          xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2
          yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2
        elif A[0]==B[0]==0:#2
          r=(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))/2
          xc=x[i]
          yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2
        elif A[1]==B[1]==0:#3
          r=(max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))/2
          yc=y[i]
          xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2
        else:
          xc=(A[2]*B[1]-A[1]*B[2])/(A[0]*B[1]-A[1]*B[0])
          yc=(A[0]*B[2]-A[2]*B[0])/(A[0]*B[1]-A[1]*B[0])
          r=((x[i]-xc)**2+(y[i]-yc)**2)**(1/2)
        aa=0
        r=min(r*1.000000999,r+0.000000999)
        for l in range(n):
          if ((x[l]-xc)**2+(y[l]-yc)**2)**(1/2)>r:
            aa=1
        if aa==0:
          if r<ans:
            ans=r
  print(ans)

### FIXED CODE ###

print(chr(ord(input())+1))
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
ans=0
for i in range(k):
    ans+=arr[k]
print(ans)

### FIXED CODE ###

n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")] 
ans=0
arr=sorted(arr)
for i in range(k):
    ans+=arr[i]
print(ans)
def resolve():
    (N, Q) = list(map(int, input().split(" ")))
    S = input()
    LRs = [list(map(int, input().split(" "))) for i in range(Q)]
    mem = [S[i:i+2] == "AC" for i in range(N-1)]

    for (l, r) in LRs:
        print(mem[l-1:r-1].sum(True))

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

def resolve():
    (N, Q) = list(map(int, input().split(" ")))
    S = input()
    LRs = [list(map(int, input().split(" "))) for i in range(Q)]
    mem = [0] * N
    for i in range(N-1):
        if S[i] == "A" and S[i+1] == "C":
            mem[i+1] = mem[i] + 1
        else:
            mem[i+1] = mem[i]

    for (l, r) in LRs:
        print(mem[r-1]-mem[l-1])

if '__main__' == __name__:
    resolve()
A=int(input())
B=int(input())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)

### FIXED CODE ###

A,B =map(int,input().split())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)
# A - Getting Difference
import math
from functools import reduce

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

gcd = reduce(math.gcd, A) 

if max(A)>=K and K%gcd==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

# A - Getting Difference
import fractions
from functools import reduce

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

gcd = reduce(fractions.gcd, A) 

if max(A)>=K and K%gcd==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
import math
 
num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
	n = j
	for k,l in enumerate(num2):
		if  k == i:
			continue
        else:
			n += l
	c.append(n)

print(min(c))


### FIXED CODE ###

num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
    n = j
    for k,l in enumerate(num2):
        if  k == i:
            continue
        else:
            n += l
    c.append(n)

print(int(min(c)))
A = int(input()).split()
if A.count.("5") == 2 and a.count("7")==1:
	print("YSE")
else:
	print("NO")

### FIXED CODE ###

A = input().split()
if A.count('5') == 2 and A.count('7')==1:
	print("YES")
else:
	print("NO")
N, K = map(int, input())
h = []
for i in range(N):
  h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
  sub = h[i+K-1] - h[i]
  if(sub < mini){
    mini = sub
print(mini)

### FIXED CODE ###

N, K = map(int, input().split())
h = []
for i in range(N):
  h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
  sub = h[i+K-1] - h[i]
  if(sub < mini):
    mini = sub
print(mini)
#C
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
i = 0
j = 0
for _ in range(n+m):
    # print(i,j,k)
    if n <= i:#
        k -= b[j]
        j += 1
        ans += 1
        continue
    elif n <= j:
        k -= a[i]
        i += 1
        ans += 1
        continue
    if a[i] < b[j]:
        k -= a[i]
        i += 1
    else:
        k -= b[j]
        j += 1
    if k < 0:
        break
    ans += 1
    if k == 0:
        break
print(ans)

### FIXED CODE ###

#C
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A = [0]
B = [0]
#読書時間A,B
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])
ans = 0
j = m
#Aを増やしたときA+Bがkより小さくなるようなi,jを決めて最大値を決めてる
for i in range(n + 1):
    if A[i] > k:
        break
    #K<=A[i]+B[j]となるまでjを引く>>k-A<=B
    while A[i] + B[j] > k:
        j -= 1
    ans = max(ans, i + j)
print(ans)
N, M, X = map(int, input().split())
book_information = []
result = 12 * 10**5
for i in range(N):
	book_information.append(input())
for i in range(1, 1 << N):
  bought_book = []
  n = 0
  skill = [0 for j in range(M)]
  for j in range(N):
    if (i >> j) & 1:
      bought_book.append(book_information[j - 1])
      n += 1
  for j in range(n - 1):
    bought_book_information = list(map(bought_book[j].split(" ")))
    cost += bought_book_information[0]
    for k in range(M):
      skill[k] += bought_book_information[k + 1]
  if all(x >= X for x in skill):
    result = min(result, cost)
if result == 12 * 10**5:
  print(-1)
else:
  print(result)

### FIXED CODE ###

N, M, X = map(int, input().split(" "))
book_information = []
result = 12 * 10**5 + 1
for i in range(N):
	book_information.append(input())
for i in range(1, 1 << N):
  bought_book = []
  n = 0
  cost = 0
  skill = [0 for j in range(M)]
  for j in range(N):
    if (i >> j) & 1:
      bought_book.append(book_information[j])
      n += 1
  for j in range(n):
    bought_book_information = list(bought_book[j].split(" "))
    cost += int(bought_book_information[0])
    for k in range(M):
      skill[k] += int(bought_book_information[k + 1])
  if all(x >= X for x in skill):
    result = min(result, cost)
if result == 12 * 10**5 + 1:
  print(-1)
else:
  print(result)
a=int(input(''))
for i in range(1,pow(10,a)):
    b=int(i/100000)
    c=int(i/10000%10)
    d=int(i/1000%10)
    e=int(i/100%10)
    f=int(i/10%10)
    g=int(i%10)
    if((b**5+c**5+d**5+e**5+f**5+g**5)==i):
        print(i)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)
c=0
for i in range(a,b+1):
    i=str(i)
    if i[0]==i[4] and i[1]==i[3]:
        c+=1
print(c)