Problem:


Score : 200 points

Problem Statement

Find the number of palindromic numbers among the integers between A and B (inclusive).
Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.

Constraints

10000 \leq A \leq B \leq 99999

All input values are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the number of palindromic numbers among the integers between A and B (inclusive).

Sample Input 1

11009 11332

Sample Output 1

4

There are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.

Sample Input 2

31415 92653

Sample Output 2

612



Sample input:
11009 11332


Sample output:
4

Submission status: Wrong Answer

Solution code:
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


if int(A) == int(B):
  ans = 1

for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
# スペース区切りの整数
l = list(map(int, input().split()))

res_count = 0

min_1 = (str(l[0])[:3])
min_2 = (str(l[0])[-3:])
max_1 = (str(l[1])[:3])
max_2 = (str(l[1])[-3:])

if int(min_1) >= int(min_2[2] + min_2[1] + min_2[0]):
    res_count = 1
if int(max_1) <= int(max_2[2] + max_2[1] + max_2[0]):
    res_count = res_count + 1
print(int(max_1) - int(min_1) + res_count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# n1, n2 = map(int, input().split())
n1, n2 = map(int, "31415 92653".split())

l1 = [int(x) for x in list(str(n1))]
l2 = [int(x) for x in list(str(n2))]

n1Low = n1%100
n2Low = n2%100

n1HighRev = int(str(l1[1])+str(l1[0]))
n2HighRev = int(str(l2[1])+str(l2[0]))

ans = 0

if n1Low - n1HighRev <= 0:
    ans += 1
elif n2Low - n2HighRev >= 0:
    ans += 1

ans += 9 - l1[2] + l2[2]

ans += (l2[0] - l1[0] - 1) * 100

ans += (9 - l1[1] + l2[1]) * 10

print(ans)

Submission status: Wrong Answer

Solution code:
AB = input().split()
A, B = int(AB[0]), int(AB[1])
a, b = 0, 0
rA, rB  = '', ''
for i in range(len(AB[0])):
    rA += AB[0][-(i+1)]
for i in range(len(AB[1])):
    rB += AB[1][-(i+1)]

if A >= int(rA):
    a = 1
if B <= int(rB):
    b = 1

ans = int(str(B)[0:3])-int(str(A)[0:3])+a+b

print(ans)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
count = 0
for i in range(A, B + 1):
  i = str(i)
  if i[:2] == i[-2:] :
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
count = 0
for i in range(A, B):
  i = str(i)
  if i[:2] == i[-2:] :
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


for i in range(0,int(B) - int(A)):
  I = int(A) + i
  C = list(str(I))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
A,B= map(int,input().split(" "))
count = 0
x = int(A/10**4)
y = int(A/10**3) - x*10
z = 0
N = A 
while N <= B:
    while y < 10:
        while z < 10:
                    N = x*(10**4)+y*(10**3)+z*(10**2)+y*(10**1)+x
                    if N >= B:
                        break
                    count = count + 1
                    z = z + 1
        y = y + 1
    x = x + 1
    y = 0
    z = 0
print(count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

a,b = input().split()
A = int(a)
B = int(b)

def judge(n):
    J = 0
    s = str(n)
    if s == s[::-1]:
        J = 1
    else:
        pass
    return J

num = 0
for i in range(A,B):
    j = 0
    j = judge(i)
    if j == 1:
        num += 1
    else:
        pass

print(num)

Submission status: Wrong Answer

Solution code:
# スペース区切りの整数
l = list(map(int, input().split()))

res_count = 0

min_1 = (str(l[0])[:3])
min_2 = (str(l[0])[-2:])
max_1 = (str(l[1])[:3])
max_2 = (str(l[1])[-2:])

if int(min_1[:2]) >= int(min_2[1] + min_2[0]):
    res_count = 1
if int(max_1[:2]) <= int(max_2[1] + max_2[0]):
    res_count = res_count + 1
print(int(max_1) - int(min_1) + res_count)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
cnt=0
for num in range(a, b):
    num_str=str(num)
    if num_str[0] == num_str[4]:
        if num_str[1] == num_str[3]:
            cnt +=1

print(cnt)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
cnt=0
for i in range(a,b):
    i_lst=[]
    i_lst.append(str(i%10))
    i_lst.append(str(int((i%100)/10)))
    i_lst.append(str(int((i%1000)/100)))
    i_lst.append(str(int((i%10000)/1000)))
    i_lst.append(str(int((i%100000)/10000)))
    i_rvs=list(i_lst)
    i_lst.reverse()
#    print(i_lst, i_rvs)
    if(i_lst==i_rvs):
        cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
A = input().split(" ")

B = int(A[0])
C = int(A[1])
Blis = list(A[0])
Clis = list(A[1])
# print(B)
# print(C)
# print(Blis)
# print(Clis)

NUM = B
kazu = 0
while NUM < C:
    NUMlis = list(str(NUM))
    if NUMlis[0] == NUMlis[4] and NUMlis[1] == NUMlis[3]:
        kazu += 1
    NUM += 1
print(kazu)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
tmp=str(a)
c=0
for i in range(a,b):
    tmp=str(i)
    tmp2=""
    for s in range(len(tmp)):
        tmp2=tmp2+tmp[len(tmp)-1-s]
    if tmp==tmp2:
        c=c+1
print(c)

Submission status: Wrong Answer

Solution code:
def palindrome(string): return 1 if string==string[::-1] else 0

A = map(int,raw_input().split())
count = 0
for i in range(A[0],A[1]+1):
    print(i)
    if(palindrome(str(i))):
        count += 1
    
print(count)

Submission status: Wrong Answer

Solution code:
n = input().split()
dis = int(n[0]) - int(n[1])
cnt = 0
for i in range(dis):
    nm = str(i + a)
    if nm[0] == nm[-1]:
        if nm[1] == nm[-2]:
            cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
def palindrome(string): return 1 if string==string[::-1] else 0

A = map(int,raw_input().split())
count = 0
for i in range(A[0],A[1]):
    if(palindrome(str(i))):
        count += 1
    
print(count)

Submission status: Wrong Answer

Solution code:
# coding : utf-8

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


_list = list(range(A, B+1))
count = 0
buff = 0
for elm in _list:
    buff = 0
    m = str(elm)
    _len = len(m) - 1
    for i in range(3):
        if m[i] == m[4-i]:
            buff += 1
    if buff >= 3:
        print(m)
        count += 1



print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
count=0
for i in range(A,B):
    l = [int(x) for x in list(str(i))]
    if l[0]==l[4]:
        if l[1]==l[3]:
            count+=1

print(count)

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))

count=0
for i in range(a[0],a[1]+1):
    if str(i)[0:2] == str(i)[3:5]:
        count=count+1
    elif str(i)[0:2] == str(i)[-1:-3:-1]:
        count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

count=int(0)

for i in range(b-a+1):
    print(a+i)
    if str(a+i)[0]==str(a+i)[1] and str(a+i)[1]==str(a+i)[3] and str(a+i)[3]==str(a+i)[4]:
        count+=1
    elif str(a+i)[0]==str(a+i)[4] and str(a+i)[1]==str(a+i)[3]:
        count+=1

print(count)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

count=int(0)

for i in range(b-a):
    if str(a+i)[0]==str(a+i)[1] and str(a+i)[1]==str(a+i)[3] and str(a+i)[3]==str(a+i)[4]:
        count+=1
    elif str(a+i)[0]==str(a+i)[4] and str(a+i)[1]==str(a+i)[3]:
        count+=1

print(count)

Submission status: Wrong Answer

Solution code:
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))

A,B = ria()
l = []
for i in range(A, B):
    s = str(i)
    if s == s[::-1]:
        l.append(i)
print(len(l))

Submission status: Wrong Answer

Solution code:
def kaibun(x):
    x_str = str(x)
    x_str_reverse = x_str[::-1]
    if(x_str == x_str_reverse):
        return True
    else:
        return False

def main():
    ans  = 0
    A,B = list(map(int,input().split()))
    for i in range(A,B):
        if kaibun(i):
            ans = ans + 1
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
f, t = [int(i) for i in input().split()]
print(len([i for i in range(f, t) if str(i) == str(i)[::-1]]))

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split(" "))
ans = 0
for i in range(A,B):
    if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))

count=0
for i in range(a[0],a[1]+1,1):
    if str(i)[0:2] == str(i)[3:5]:
        count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
count = 0
for i in range(A,B,1):
    l = list(str(i))
    if l[0] == l[4] and l[1] == l[3]:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
a,b = map(int,raw_input().split(" "))
ans = 0
for x in range(a,b+1):
  q = str(x)
  if q[0:2] == q[3:5]:
    ans += 1
print ans

Submission status: Wrong Answer

Solution code:
A, B = list(map(int, input().split()))

result = 0
for i in range(A, B):
    num = str(i)
    if num[0] == num[4] and num[1] == num[3]:
        result += 1

print(result)

Submission status: Wrong Answer

Solution code:
cnt = 0
for _ in xrange(*map(int, raw_input().split())):
    if str(_) == str(_)[::-1]:
        cnt += 1
print cnt

Submission status: Time Limit Exceeded

Solution code:
def digit10_str(n):
    dten_str = ""
    while(n>0):
        dten_str+=str(n%10)
        n/=10
    return dten_str

a,b = map(int,input().split())
c = 0
for i in range(a,b):
    if digit10_str(i)[0]==digit10_str(i)[-1] and digit10_str(i)[1]==digit10_str(i)[-2]:
        c+=1
print(c)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

cnt = 0
for i in range(a, b+1):
  str_i = str(i)
  if str_i[0] == str_i[4] and str_i[1] == str_i[3]:
    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
    i = str(i)
    if i[0] == i[-1] and i[1] == i[-2]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0

for i in range(a//10000, b//10000+1):
    for j in range(0,10):
        for k in range(0,10):
            x = i*10001 + j*1010 + k*100
            if a<=x<=b:
                ans+=1
print(ans, flush=True)

Submission status: Accepted

Solution code:
def answer(a: int, b: int) -> int:
    count = 0
    for i in range(a, b + 1):
        i_str = str(i)
        if i_str[0] == i_str[-1] and i_str[1] == i_str[-2]:
            count += 1

    return count


def main():
    a, b = map(int, input().split())
    print(answer(a, b))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
count = 0
for i in range(1,10):
    for j in range(10):
        for k in range(10):
            if a <= 10000*i+1000*j+100*k+10*j+i <= b:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

count = 0
for i in range(A, B+1):
    num = str(i)
    if num[0] == num[4]:
        if num[1] == num[3]:
            count += 1

print(count)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

cnt = 0

for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
def kaibun(n):
    if str(n)[0]==str(n)[-1] and str(n)[1]==str(n)[-2]:
        return True
    else:
        return False

a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    if kaibun(i):
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

def ans090(A:int, B:int):
    count=0
    for i in range(A,B+1):
        if str(i)[0]==str(i)[-1] and str(i)[1]==str(i)[-2]:
            count+=1
    return count

print(ans090(A,B))

Submission status: Accepted

Solution code:
a,b = [int(x) for x in input().split()]

def check(p):
  p = str(p)
  if p[0] == p[4] and p[1] == p[3]:
    return True
  return False

res = 0
for i in range(a,b+1):
  if check(i):
    res += 1
print(res)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0
l = []
newl = []

for i in range(a, b+1):
    l = []
    while (i > 0):
        l.append(i%10)
        i//=10
    newl = l[::-1]
    if (l == newl):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0

for i in range(a, b+1):
    l = []
    while (i > 0):
        l.append(i%10)
        i//=10
    if (l[0] == l[4] and l[1] == l[3]):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
lst = input().split()

count = 0

def judge(n):
   if str(n) == str(n)[::-1]:
      return True
   else:
      return False

for i in range(int(lst[0]), int(lst[1]) + 1):
   if judge(i):
      count += 1

print(count)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

ans = 0

for i in range(1,10):
    for j in range(10):
        for k in range(10):
            if A <= i*10000+j*1000+k*100+j*10+i <= B:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
def reverse(num):
    test_num = 0
    while (num > 0):
        remainder = num % 10
        test_num = (test_num * 10) + remainder
        num = num // 10
    return test_num

a,b = list(map(int,input().split()))
c = 0
for i in range(a,b+1):
    if i == reverse(i):
        c+=1
print(c)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    i=str(i)
    if i==i[::-1]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
result=0
for i in range(A,B+1):
  i=str(i)
  for j in range(int(((len(i))-1)/2)+1):
    if not i[j]==i[-j-1]:
      break
  else:
    result+=1
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
count = 0
for i in range(A,B+1):
    i = str(i)
    if i == i[::-1]:
        count += 1
print(count)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
A, B = [int(x) for x in input().split()]
ans = 0
for i in range(A, B+1):
  s = str(i)
  S = list(s)
  if(S[0]==S[4] and S[1]==S[3]):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B =map(int, input().split())
num_palin = [0] * (B+1)
for i in range(1,B+1):
    if str(i) == str(i)[::-1]:
        num_palin[i] = num_palin[i-1] + 1
    else:
        num_palin[i] = num_palin[i-1]
print(num_palin[B]-num_palin[A-1])

Submission status: Accepted

Solution code:
def isPal(s):
    s = str(s)
    n = len(s)
    f = 1
    for i in range(n//2):
        f &= s[i] == s[n-i-1]
    return f

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

ans = 0
for i in range(a, b+1):
    if(isPal(i)):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
count = 0
for i in range(A,B+1):
  i = str(i)
  num = 1
  if len(i)%2 == 0:
    num = 0
  left = i[:len(i)//2]
  right = i[len(i)//2+num:]
  right = right[::-1]
  if left == right:
    count += 1
print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    s=str(i)
    if s[:2]==s[3:][::-1]:ans+=1 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    if i%10==i//10000 and i//10%10==i//1000%10:ans+=1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

ans = 0
for i in range(A, B+1):
  if str(i) == str(i)[::-1]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b =  map(int,input().split())
cnt = 0

for i in range(b-a+1):
    r = str(a+i)[::-1]
    if a+i == int(r):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0

for i in range(A, B + 1):
    i = str(i)

    flag = True
    for j in range(len(i) // 2):
        if i[j] != i[len(i) - 1 - j]:
            flag = False
    if flag == True:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
count = 0
for i in range(a,b+1):
    s = str(i)
    if s == s[::-1]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
cnt = 0
for i in range(a,b+1):
    i = str(i)
    if i == i[::-1]:
        cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  if str(i)==str(i)[::-1]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a,b+1):
    key = str(i)
    #print(key)
    if key[:2] == key[4]+key[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    a,b = map(int,input().split())
    numbers=list(range(a,b+1))
    count=0

    for number in numbers:
        if str(number)[0]==str(number)[-1] and str(number)[1]== str(number)[3]:
            count+=1
    print(count)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

count = 0

for i in range(A, B+1):
    check = 0
    str_i = str(i)
    for j in range(0, (len(str_i)//2)+1):
        if int(str_i[j]) != int(str_i[-1-j]):
            check += 1
    if check == 0:
        count += 1

print("{}".format(count))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
from itertools import accumulate
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def floor(a, b): return -(-a // b)


def zz(): return list(map(int, sys.stdin.readline().split()))


def z(): return int(sys.stdin.readline())


def S(): return sys.stdin.readline()[:-1]


def C(line): return [sys.stdin.readline() for _ in range(line)]


def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True


a, b = zz()
ans = 0
for num in range(a, b + 1):
    if is_kaibun(str(num)):
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
k = 0

for i in range(a,b+1):
    if str(i) == ''.join(list(reversed(str(i)))):
        k += 1

print(k)

Submission status: Accepted

Solution code:
A,B = map(str,input().split())
La = [int(A[:3]),int(A[3:])]
Lb = [int(B[:3]),int(B[3:])]
L = 900 - (La[0] - 100) - (999 - Lb[0])
ch1 = int(A[1] + A[0])
ch2 = int(B[1] + B[0])
if Lb[1] < ch2:
  L -= 1
if ch1 < La[1]:
  L -= 1
print(L)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
ans=0
for x in range(A,B+1):
    S=str(x)
    if S==S[::-1]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0
for i in range(a, b+1):
    i = list(str(i))
    t_size = len(i)
    if t_size%2 == 0:
        if i[:t_size//2] == list(reversed(i[t_size//2:])):
            ans+=1
    else:
        if i[:t_size//2] == list(reversed(i[t_size//2+1:])):
            ans+=1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

count = 0
for i in range(A, B+1):
    if(str(i) == str(i)[::-1]):
        count += 1
    else: continue
print(count)

Submission status: Accepted

Solution code:
A,B= map(int,input().split())

ans=0

for i in range(A,B+1):
    for j in range(len(str(i))):
        zen = j
        kou = len(str(i))-1-j
        if zen >= kou:
            ans+=1
            break
        if str(i)[zen] != str(i)[kou]:
            break
    
print(ans)

Submission status: Accepted

Solution code:
A,B= map(int,input().split())

ans=0

for i in range(A,B+1):
    if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
        ans +=1
    
print(ans)

Submission status: Accepted

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
l = [int(c) for c in input().split()]
A = l[0]
B = l[1]
cnt=0
for i in range(A,B+1):
    if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

cnt = 0
for i in range(A,B+1):
  s = str(i)
  half = len(s) // 2
  add = len(s) % 2
  #print(s,-1, s[0:half],-1, s[half+add:][::-1])
  if s[0:half] == s[half+add:][::-1]:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
  if list(reversed(str(i))) == list(str(i)):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

ans = 0
for v in range(a, b+1):
    v = str(v)
    if v == ''.join(reversed(v)):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# import math
# import statistics
# a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
e1,e2 = map(str,input().split())
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
c=[]
count=0
ans=0
for i in range(int(e1),int(e2)+1):
    count=0
    for k in range(len(str(i))//2):
        if str(i)[k]==str(i)[-(k+1)]:
            count+=1
            if len(str(i))//2 == count:
                ans+=1

print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
total=0
for i in range(a,b+1):
    x=str(i)
    y=int(x[::-1])
    if i==y:
        total+=1
print(total)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c = 0
for i in range(a,b+1):
    if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
        c += 1
print(c)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
ans_cou = 0
for i in range(A, B + 1):
    str_i = str(i)
    reverse_str_i = ''.join(list(reversed(str_i)))
    reverse_int_i = int(reverse_str_i)
    if i == reverse_int_i:
        ans_cou += 1
print(ans_cou)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ans = 0
for i in range(a,b+1):
    x = str(i)
    y = x[::-1]
    if x == y:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
cnt=0
for i in range(a,b+1):
    j=str(i)
    if j==j[::-1]:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

cnt = 0

for i in range(A, B+1):
    l = list(str(i))
    if l[0] == l[4] and l[1] == l[3]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

ans = 0
for i in range(a, b+1):
    i = str(i)
    if i[0] == i[-1] and i[1] == i[-2]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

ans = 0

for i in range(A, B+1, 1):
  x = list(str(i))
  if x[0] == x[4] and x[1] == x[3]:
    ans += 1
else:
  print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
cnt = 0
for num in range(A, B+1):
    num = list(str(num))
    for i in range(len(num)//2):
        if num[i] != num[len(num)-i-1]:
            break
    else:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    s=str(i)
    for j in range(len(s)//2):
        if s[j]!=s[-1-j]:
            break
    else:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

cnt = 0
for i in range(A,B+1):
  i = str(i)
  if i == i[::-1]:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B = map(int, readline().split())

    ans = 0
    for i in range(A, B + 1):
        s = str(i)
        if s == s[::-1]:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

result = 0
for x in range(a, b+1):
  if str(x) == ''.join(reversed(str(x))):
    result += 1
print(result)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
ans = 0

for i in range(A, B+1):
    num = str(i)
    #print(i,num[0:2],num[::-1][0:2])
    if num[0:2] == num[::-1][0:2]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
a,b = map(int, sys.stdin.readline().rstrip("\n").split())
ans = 0
for i in range(a,b+1):
    i,n1 = divmod(i, 10)
    i,n2 = divmod(i, 10)
    i,n3 = divmod(i, 10)
    n5,n4 = divmod(i, 10)
    if n1 == n5 and n2 == n4:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0
for x in range(a, b + 1):
    if x // 10000 == x % 10 and (x // 1000) % 10 == (x // 10) % 10:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
  s = str(i)
  if s == s[::-1]:
    c += 1
print(c)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
cnt = 0

for i in range(a,b+1):
  lis_i = list(str(i))
  lis_i.reverse()
  rev_i = int(''.join(lis_i))
  if rev_i == i:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
cnt = 0

for i in range(a,b+1):
    if str(i) == str(i)[::-1]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

c=0
for i in range(a,b+1):
  s=str(i)
  if s==s[::-1]:
    c+=1
print(c)

Submission status: Accepted

Solution code:
A, B = map(str, input().split())
l = list(range(int(A), int(B)+1))
c = 0
for i in l:
  t = str(i)
  if t[0] == t[4] and t[1] == t[3]:
    c += 1
print(c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def judege_palindromic(val_str):
    length = len(val_str)
    match = True
    for i in range(length//2):
        if val_str[i] != val_str[length-i-1]:
            match = False
            break

    return match       


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

cnt = 0
for i in range(A, B+1, 1):
    if judege_palindromic(str(i)):
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = {} #10000以上key以下の回文数の個数
cnt = 0
for i in range(10000, 100000):
    L = list(str(i))
    if L == list(reversed(L)):
        cnt += 1
    N[i] = cnt
A, B = map(int, input().split())
print(N[B]-N[A-1] if A > 10000 else N[B])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=0
for i in range(a,b+1):
  if (i//10000)==(i-(i//10)*10) and (i//1000-(i//10000)*10) ==(i//10-(i//100)*10):
    c=c+1
print(c)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

ans=0
for i in range(a,b+1):
  j=str(i)
  if j[0]==j[4] and j[1]==j[3]:
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=list(map(int,input().split()))
ct=0
for i in range(A,B+1):
  t=str(i)
  for j in range(len(t)):
    if t[j]!=t[-j-1]:
      break
  else:
      ct+=1
print(ct)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

cnt = 0
for i in range(a, b+1, 1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        cnt += 1
    else:
        continue

print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

ans = 0
for i in range(a, b+1):
    s = str(i)
    ok = True
    for j in range(2):
        ok = ok and s[j] == s[4-j]
    if ok:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
# vim: fileencoding=utf-8


def main():
    a, b = map(int, input().split())
    c = 0
    for i in range(a, b + 1):
        #     s = str(i)
        #     r = "".join(reversed(list(s)))
        #     if s == r:
        #         c += 1
        if (i % 10) == (i // 10000) and (i % 100 // 10) == (i % 10000 // 1000):
            c += 1
    print(c)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# vim: fileencoding=utf-8


def main():
    a, b = map(int, input().split())
    c = 0
    for i in range(a, b + 1):
        #     s = str(i)
        #     r = "".join(reversed(list(s)))
        #     if s == r:
        #         c += 1
        if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):
            c += 1
    print(c)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# vim: fileencoding=utf-8


def main():
    a, b = map(int, input().split())
    c = 0
    for i in range(a, b + 1):
        s = str(i)
        r = "".join(reversed(list(s)))
        if s == r:
            c += 1
    print(c)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
cnt = 0
for i in range(A, B + 1):
	if str(i) == str(i)[::-1]:
		cnt += 1
print(cnt)