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:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())


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

    
    a, b = mi()
    cnt = 0
    for i in range(a, b+1):
        s_i = str(i)
        if check_palindrome(s_i):
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

count=0
#10000<= a<=b <=99999

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

print(count)

Submission status: Accepted

Solution code:
a, b = input().split()
ans = 0
for i in range(int(a), int(b)+1):
    if str(i)[0]==str(i)[-1] and str(i)[1]==str(i)[-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 i//10000 == i%10 and i//1000 %10 == i//10 %10:
        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
    else:
        pass
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)
    cnt = 1
    for j in range((len(i)//2)+1):
        if i[j] != i[-j-1]:
            cnt = 0
            break
    ans += cnt
print(ans)

Submission status: Accepted

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

c = 0
for i in range(a,b+1):
  a = str(i)
  if(a == a[::-1]):
    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):
    if str(i)==str(i)[::-1]:
        ans+=1
print(ans)

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

Submission status: Accepted

Solution code:
def invr():
    return(map(int, input().split()))


A, B = invr()
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())
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(str,input().split())
ans = 0
for i in range(int(a),int(b)+1):
    j = str(i)[::-1]
    if str(i) == str(j):
        ans+=1
print(ans)

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())
ans = 0
for i in range(a,b+1):
    s = str(i)
    hl = len(s)//2
    if s[:hl]== s[-1:-1-hl:-1]:
        ans+=1
print(ans)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

A,B = inputIL()

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B = map(int, input().split())
lst = []
for i in range(1, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            lst.append(i * 10000 + j * 1000 + k * 100 + j * 10 + i)

ans = [0 for i in lst if A <= i <= B]
print(len(ans))

Submission status: Accepted

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

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[:2] == i[:-3:-1]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
def is_palindromic(n):
    tmp = list(str(n))
    return tmp == tmp[::-1]


A, B = map(int, input().split())
count = 0
for i in range(A, B + 1):
    if is_palindromic(i):
        count += 1
print(count)

Submission status: Accepted

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

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())
S = list(map(str, range(A, B+1)))
ans = 0
for i in range(B-A+1):
  if S[i][0] == S[i][4] and S[i][1] == S[i][3]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n, k = map(int, input().split())
    ans = 0

    for i in range(n,k+1):
        string = str(i)
        lenI = len(string)
        count = 0
        for j in range(lenI //2 ):
            if string[j] == string[lenI-j-1]:
                count +=1
            if count == lenI //2:
                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[0] == s[-1] and s[1] == s[-2]:
        cnt += 1

print(cnt)

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 == str_i[::-1]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
min_n, max_n = map(int,input().split())
ans = 0
for i in range(min_n, max_n+1):
  c = str(i)
  if c ==c[::-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):
    c = str(i)
    d = c[::-1]

    if c == d:
        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 str(i) == str(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):
    if str(i)==str(i)[::-1]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
a, b = list(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:
import sys
import math
import bisect

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b, = map(int,input().split())
ans = 0
for i in range(a,b+1):
	stri = str(i)
	if stri[0] == stri[-1] and stri[1] == stri[-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):
  a = str(i)
  b = a[::-1]
  if a == 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):
    dum = str(i)
    dum_len = len(dum)
    flag = "on"
    for i in range(dum_len//2):
        if dum[i] != dum[-(i+1)]:
            flag = "off"
    if flag == "on":
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    flag = True
    si = str(i)
    for j in range(len(si) // 2):
        if si[j] != si[-(j + 1)]:
            flag = False
    if flag:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0
for x in range(A, B+1):
    l=[]
    while x>0 :
        r = x%10
        l.append(r)
        x //= 10
    if l[0]==l[4] and l[1]==l[3]:
        cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
import math
import copy

neko = 0
nuko = 0
a,b = map(int,input().split())
for i in range(a,b+1):
    s1 = i//10000
    s2 = (i%10000)//1000
    s3 = (i%100)//10
    s4 = i%10
    if (s1 == s4)and(s2 == s3):
        neko += 1
print(neko)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    A, B = map(int, input().split())
    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:
def palindrom(i):
  s = str(i)
  return s[0] == s[4] and s[1] == s[3]

a, b = map(int, input().split())
ans = 0
for i in range(a, b + 1):
  if palindrom(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):
    n = str(i)
    r = str(i)[::-1]
    if n == r:
        c += 1
print(c)

Submission status: Accepted

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

    res = 0

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
a, b = list(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 judge_kaibun(p):
    p = str(p)
    return p==p[::-1]

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
l=[]
for i in range(a,b+1):
  l.append(i)

def st(n):
  return str(n)

li=list(map(st,l))

ans=0
for j in li:
  if j[0]==j[-1] and j[1]==j[-2]:
    ans+=1
  else:
    pass

print(ans)

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
c=0
while a<=b:
  s=str(a)
  if s==s[::-1]:
    c+=1
  a+=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 all(s == t for s, t in zip(i, i[::-1])):
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
while A <= B:
    n = str(A)
    if n[0] == n[-1] and n[1] == n[-2]:
        count += 1
    A += 1
print(count)

Submission status: Accepted

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

for num in range(a, b+1):
    num=str(num)
    if num[0]==num[-1] and num[1]==num[-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):
  i = str(i)
  if i == i[::-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[0] == i[4] and i[1] == i[3]:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    A,B=pin()
    cnt=0
    for i in range(A,B+1):
        temp=str(i)
        if temp==temp[::-1]:cnt+=1
    print(cnt)
#%%submit!    
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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:
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())
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 = tuple(map(int,input().split()))

ans = 0
for i in range(a,b+1):
  pal = int(str(i)[::-1])
  if i==pal:
    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[-1] and s[1] == s[-2]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
    st = str(i)
    for j in range(len(st)):
        if st[j] != st[-j-1]:
            break
    else:
        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 = str(i)
  front = i_str[4]+i_str[3]
  back = i_str[0]+i_str[1]
  if front == back:
    cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for n in range(A, B+1):
    if str(n) == str(n)[::-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):
    li = list(str(i))
    if li[0] == li[-1] and li[1] == li[-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):
    s = str(i)
    if s == s[::-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 i == int(str(i)[::-1]):
        count += 1

print(count)

Submission status: Accepted

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

for n in range(A, B+1):
    n = str(n)
    if (n[0] == n[4]) & (n[1] == n[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):
  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())
ans = []
for i in range(a, b+1):
    str_i = str(i)
    f = True
    for j in range(len(str_i)//2):
        if str_i[j] == str_i[-j-1]:
            continue
        else:
            f = False
    if f:
        ans.append(f)

print(len(ans))

Submission status: Accepted

Solution code:
import sys
import math
def isLoop(n):
    if (n[0] != n[4] or n[1] != n[3]):
        return False
    else:
        return True
a, b = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    if (isLoop(str(i))):
        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())

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())
t = a
c = 0
while t <= b:
  k = str(t)
  hoge = k[::-1]
  poge = int(hoge)
  if poge == t:
    c += 1
  t += 1
print(c)

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:
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(a, b+1):
    if str(i) == str(i)[::-1]:
        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):
        tmp = str(i)
        if tmp[0] == tmp[4] and tmp[1] == tmp[3]:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
A, B = ri_()
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())
res = 0
for i in range(a,b+1):
  i = str(i)
  flg = 0
  for j in range(len(i)//2):
    if i[j] != i[-j-1]:
      flg = 1
  if flg == 0:
    res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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[:2] == s[3:][::-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):
    if str(i) == str(i)[::-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):
    d = str(i)
    if d[0] == d[4] and d[1] == d[3]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    l=list(range(a,b+1))
    cnt=0
    for i in range(len(l)):
        if str(l[i])==str(l[i])[::-1]:
            cnt+=1
    print(cnt)
resolve()

Submission status: Accepted

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


def f(n):
    '''
    >>> f(1)
    True
    >>> f(2)
    True
    >>> f(22)
    True
    >>> f(34)
    False
    >>> f(565)
    True
    >>> f(789)
    False
    '''
    def g(n, m):
        return n // m % 10

    head = tail = 1
    while n // head > 10:
        head *= 10
    while head >= tail:
        if g(n, head) != g(n, tail):
            return False
        head //= 10
        tail *= 10
    return True

def solve(A: int, B: int):
    return sum(map(f, range(A, B+1)))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
s = 0
for n in range(a,b+1):
  n = str(n)
  l = len(n)
  for i in range(int((l+1)/2)):
    if n[i] != n[l-1-i]:
      break
    elif n[i] == n[l-1-i] and i == (l-1)/2:
      s+= 1
    else:
      continue
print(s)

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*10001+j*1010+k*100<=b:
        ans+=1
print(ans)

Submission status: Accepted

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

def it():
    for x in range(a, b+1):
        x = str(x)
        if x[0] == x[4] and x[1] == x[3]:
            yield 1

print(sum(it()))

Submission status: Accepted

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

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