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: Accepted

Solution code:
# Problem: https://atcoder.jp/contests/abc090/tasks/abc090_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


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


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


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


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(fromNum, toNum):
    result = 0
    # algorithm
    for number in range(fromNum, toNum+1):
        strNum = str(number)
        if strNum[0] == strNum[4]:
            if strNum[1] == strNum[3]:
                result = result + 1
    return result


if __name__ == "__main__":
    A, B = MI()
    print("{}".format(solver(A, B)))

Submission status: Accepted

Solution code:
def kai(n):
    a=""
    for i in reversed(range(len(n))):
        a+=(n[i])
    if n==a:
        return True

a,b=input().split()
cnt=0
for i in range(int(b)-int(a)+1):
    if kai(str(int(a)+i)):
        cnt+=1

print(cnt)

Submission status: Accepted

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

ans = 0
for i in range(A, B + 1):
    res = str(i)
    if res == res[::-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):
    x = str(i)
    y = x[::-1]
    if x == y:ans +=1
    
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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][::-1] == s[3:]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys

def resolve():
    A, B = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(A, B+1):
        s = str(i)
        if s[0] == s[4] and s[1] == s[3]:
            cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
# Problem:
# Python  Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


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


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


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


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def palindromic(Num):
    result = False
    strNum = str(Num)
    strRevNum = strNum[::-1]
    checkDigit = 0
    for j in range(0, len(strNum)):
        if strNum[j] == strRevNum[j]:
            checkDigit = checkDigit + 1
    if checkDigit == len(strNum):
        result = True
    return result


def solver(fromNum, ToNum):

    result = 0
    for j in range(fromNum, ToNum+1, +1):
        if palindromic(j):
            result = result + 1
    return result


if __name__ == "__main__":
    A, B = MI()
    print("{}".format(solver(A, B)))

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:
        if (i % 100 - i % 10) // 10 == i // 1000 - i // 10000 * 10:
            ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Kaibun(s):
    imax = int(len(s)/2)
    i = 0
    while i < imax:
        if s[i] != s[-(1+i)]:
            return False
        i += 1
    return True
    
a,b = map(int,input().split(' '))
List = [str(i) for i in range(a,b+1)]
count = 0
for s in List:
    if Kaibun(s):
        count += 1
print(count)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
#h, w = list(map(int, input().split()))
count = 0
for i in range(a, b+1):
    x = str(i)
    flag = True
    for j in range(len(x)//2):
        if x[j]!=x[len(x)-1-j]:
            flag = False
        #print(x[j]+" "+x[len(x)-1-j])
        #print(flag)
    
    #print("--------")
    if flag:
        count += 1          

print(count)

Submission status: Accepted

Solution code:

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = il()
    ret = 0
    for n in range(A, B+1):
        n = list(str(n))
        if n[:len(n)//2] == n[len(n)//2+1:][::-1]:
            ret += 1
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0

for number in range(A,B+1):
    number = str(number)
    if number[0] == number[4] and number[1] == number[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):
    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())
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(str(count))

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ans = 0
for i in range(a, b+1):
    num = list(str(i))
    num_re = list(reversed(num))
    if num == num_re:
        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 == s[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def kaibun(s):
    l=len(str(s))
    check=list(s)
    half=l//2
    a=check[:half]
    b=check[::-1][:half]
    if a==b:
        return True
    return False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = input().split(" ")
count = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc090/tasks/abc090_b"

def main():
    f = list(map(int, input().split(' ')))
    count = 0
    for i in range(f[0], f[1] + 1):
        n_str = list(str(i))
        n_str_r = list(reversed(n_str))
        flg = True
        for n in n_str:
            if n_str != n_str_r:
                flg = False
        if flg:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def f(x):
  if x==''.join(list(reversed(x))):
    return 1
  else:
    return 0

ans = 0
for i in range(A, B+1):
  ans += f(str(i))
  
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
ans = 0
for i in range(A,B+1):
  i1 = i % 10
  i2 = (i // 10) % 10
  i4 = (i // 1000) % 10
  i5 = (i // 10000) % 10
  if (i1 == i5) and (i2 == i4):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
# ABC 090 B - Palindromic Numbers
a, b = map(int, input().split())

def kaibun(x):
    l = str(x)
    r = str(x)[::-1]
    if l == r:
        return True
    else:
        return False
    
count = 0
for i in range(a, b+1):
    if kaibun(i):
        count += 1
    else:
        continue
        
print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  if str(i)==str(i)[::-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):
  i=str(i)
  if(i[0]==i[len(i)-1] and i[1]==i[len(i)-2]):
      cnt+=1
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)
    s = list(s)
    for j in range(len(s) // 2):
        if s[j] != s[len(s) - 1 - j]:
            break
        if j == (len(s) // 2) - 1:
            ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for number in range(int(A), int(B)+1):
    number = str(number)
    reverse_num = ""
    for i in reversed(range(len(number))):
        reverse_num += number[i]
    if number == reverse_num:
        ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    num = list(str(i))
    re = list(reversed(num))
    cnt = 0
    for i in range(len(num)):
        if num[i] == re[i]:
            cnt += 1
    if cnt == len(num):
        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(map(int,str(i)))
  I2=list(reversed(I))
  if I==I2:
    ans+=1
print(ans)

Submission status: Accepted

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

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

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

print(count)

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[:2] == s[4] + s[3]:
        c += 1
print(c)

Submission status: Accepted

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

ans = 0

def judge(s):
    for i in range(len(s) // 2):
        if s[i] != s[len(s) - i - 1]:
            return 0
    return 1

for i in range(a, b + 1):
    ans += judge(str(i))

print(ans)

Submission status: Accepted

Solution code:
n = input().rstrip().split()
n=[int(x) for x in n]

ans=0
for i in range(n[0],n[1]+1):
  ct=0
  a=list(str(i))
  for j in range(len(a)):
    if a[j]==a[-j-1]:
    	ct+=1
  if ct==len(a):
    ans+=1
print(ans)

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())
ans = 0

for number in range(A, B+1):
  x1 = str(number)
  x2 = x1[::-1]
  if x1[0:2] == x2[0:2]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = il()
    ret = 0
    for n in range(A, B+1):
        if str(n) == str(n)[::-1]:
            ret += 1

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
N = 0
for i in range(A, B + 1):
  S = str(i)
  for j in range(2):
    if S[j] != S[4 - j]:
      break
  else:
    N += 1
print(N)

Submission status: Accepted

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

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

Submission status: Accepted

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

def li(x):
    L = []
    while x > 0:
        L.append(x % 10)
        x = x // 10
    return L

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a,b = map(int,input().split())
  p = a
  cnt = 0
  while a <= p <= b:
    P = str(p)
    if P == P[::-1]:
      cnt += 1
    p += 1
  print(cnt)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def cnt(n):
    m = str(n)
    l = len(m)
    if l == 1: return n + 1
    tot = 0
    tot += pow(10, (l - 1) // 2) * (int(m[0]) - 1)
    tot += pow(10, l // 2) - 1 - 9 * pow(10, l // 2 - 1) * (l & 1 ^ 1)
    while l >= 2:
        l -= 2
        if l == 0: tot += m[1] >= m[0]
        elif l == 1: tot += int(m[1]) + 1 - (m[-1] < m[0])
        else:
            m = str(int(m[1:-1]) - (m[-1] < m[0]))
            m = '0' * (l - len(m)) + m
            tot += int(m[0]) * pow(10, (l - 1) // 2)
    return tot

a, b = map(int, sys.stdin.readline().split())

def main():
    print(cnt(b) - cnt(a-1))

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=(int(i) for i in input().split())  
ans=[]
count=0
for i in range(x,y+1):
	n=str(i)
	if n[0]==n[-1] and n[1]==n[-2]:
		count +=1
print(count)

Submission status: Accepted

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

ans=0
for i in range(A,B+1):
  n=str(i)
  if n[0]==n[-1] and n[1]==n[-2]:
    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

print(count)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
count = 0
for i in range(a,b+1):
  line = list(map(int,str(i)))
  if line[0] == line[4] and line[1] == line[3]:
    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)
    l=len(s)
    for i in range(l//2):
        if s[i]!=s[l-1-i]:
            break
    else:
        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())

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

def ok(n):
    s = str(i)
    l = len(s)
    for j in range(l):
        if s[j] != s[-(j + 1)]:
            return False
    return True

ans = 0
for i in range(A, B + 1):
    if ok(i):
        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 = ans + 1

print(ans)

Submission status: Accepted

Solution code:
def isp(str): return True if str == str[::-1] else False
a,b= map(int, input().split())
ans=0
for i in range(a,b+1):
  i_s=str(i)
  if isp(i_s):
    ans+=1

print(ans)

Submission status: Accepted

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

c=0
for x in range(a,b+1):
    s=str(x)
    if s[0]==s[4] and s[1]==s[3]:
        c=c+1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

cnt = 0
for i in range(a, b+1):
  r = ''.join(list(reversed(str(i))))
  if 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):
  if str(i) == str(i)[::-1]:
    ans += 1

print(ans)

Submission status: Accepted

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


def f(s):
    return ''.join(reversed(s))


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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    s = str(i)
    if s == s[:: -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):
    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())
parind = [0]*(B+1)
for i in range(1,B+1):
  parind[i] = parind[i-1]
  if str(i) == str(i)[::-1]:
    parind[i] += 1

ans = parind[B]-parind[A-1]
print(ans)

#print(*ans, sep='\n')

Submission status: Accepted

Solution code:

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

count=0
for n in range(a,b+1):
    s = str(n)
    array = list(map(int, s))

    if array[0]==array[-1]:
        if array[1]==array[-2]:
            if array[2]==array[-3]:
                count+=1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def Palindrome(string):
    number=str(string)
    if number==number[::-1]:
        return True
    else:
        return False

for i in range(a,b+1):
    if Palindrome(i)==True:
        count+=1
print(count)

Submission status: Accepted

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

cnt = 0
for n in range(A, B + 1):
    s = str(n)
    if s[:2] == s[4] + s[3]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
def main():
    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)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
cnt=0
for i in range(a,b+1):
    r = ''.join(list(reversed(str(i))))
    if str(i)==r:
        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())
count = 0
for n in range(A, B+1):
  strn = str(n)
  if strn[0] == strn[-1] and strn[1] == strn[-2]:
    count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
for n in range(A, B+1):
  if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:
    count += 1
print(count)

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[0]==i[4] and i[1]==i[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 = str(i)

    if (num_str[0] == num_str[4]) and (num_str[1] == num_str[3]):
        count += 1
print(count)

Submission status: Accepted

Solution code:
def chekdigits(i):
    s = str(i)
    return (s[0]==s[-1]) and (s[1]==s[-2])
A,B=map(int, input().split())
print(len([x for x in range(A,B+1) if chekdigits(x)]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def reverseDisits(n):
    s = ""
    while n > 0:
        s += str(n % 10)
        n //= 10
    return int(s)


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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


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

a, b = map(int, input().split())
l = [None]*5
cnt = 0
for i in range(1, 10):
    l[0] = str(i)

    for j in range(0, 10):
        l[1] = str(j)

        for k in range(0, 10):
            l[2] = str(k)
            l[3] = str(j)
            l[4] = str(i)
            s = ''.join(l)
            # print(int(s))
            if int(s) >= a and int(s) <= b:
                cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import math

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

kaibun_cnt = 0
length = len(str(a))
length_half = math.floor(len(str(a))/2)

for i in range(a, b+1):
    num_list = []
    num = i
    
    for j in range(len(str(i))):
        num_list.append(num%10)
        num = math.floor(num/10)
    
    cnt = 0
    for j in range(length_half):
        if num_list[j] == num_list[length-j-1]:
            cnt += 1
    
    if cnt == length_half:
        kaibun_cnt += 1

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

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[4] and i[1] == 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):
  if str(i) == str(i)[::-1]:
    count += 1
print(count)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c = 0
f = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def P_Number(a , b):

    ans = 0

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

    return ans

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


if __name__ == '__main__':
    main()

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[4] and i[1] == i[3]:
        cnt += 1
print(cnt)

Submission status: Accepted

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

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[-1] and j[1] == j[-2]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
x = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp = i*10001 + j*1010 + k*100
            x.append(tmp)
x.sort()

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

ret = sum((a<= z and z <= b) for z in x)
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(a, b+1):
  digit1 = i % 10
  i = i // 10
  digit2 = i % 10
  i = i // 10
  digit3 = i % 10
  i = i // 10
  digit4 = i % 10
  i = i // 10
  digit5 = i % 10
  
  if digit1 == digit5 and digit2 == digit4:
    count +=1

print(count)

Submission status: Accepted

Solution code:
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

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


if __name__ == '__main__':
    main()

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:
# Author: cr4zjh0bp
# Created: Thu Mar 12 19:37:38 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

A, B = na()

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

print(ans)

Submission status: Accepted

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

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[0] == i[4] and i[1] == i[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):
    l = list(str(i))
    if l[0] == l[4] and l[1] == l[3]:
        ans += 1
print(ans)

Submission status: Accepted

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

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):
    tmp = list(str(i))
    if tmp == tmp[::-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):
    stri = str(i)
    if stri[0] == stri[4] and stri[1] == stri[3]:
        count += 1
print(count)