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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for x in range(A, B+1):
    if str(x) == str(x)[::-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):
    num = ''.join(list(str(i)))
    if num == num[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

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

print(sum_s)

Submission status: Accepted

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

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

print(sum_n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
for num in range(A, B+1):
    nl = list(str(num))
    kai = [nl[-i] for i in range(1, len(nl)+1)]
    if int("".join(kai))==num:
        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[4] and S[1] == S[3]:
		cnt += 1
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a, b = map(str, input().split())
count = 0
for i in range(int(a), int(b)+1):
        num = str(i)
        if num[0] == num[4] and \
        num[1] == num[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):
  if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
    count += 1
print(count)

Submission status: Accepted

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


def read_h(typ=int):
    return map(typ, input().split())


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def main():
    a, b = read_h()
    cnt = 0
    for i in range(a, b + 1):
        s = str(i)
        if s[:2] == s[3:][::-1]:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
lx=[]
cnt=0
for i in range(a,b+1):
    t=i
    kai=0
    for j in range(5):        
        t2=t%10
        kai=kai+t2*10**(4-j)
        t=t//10
    #print(kai,i)
    if(kai==i):
        cnt=cnt+1
print(cnt)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
x=0
for i in range(b-a+1):
    v=list(reversed(list(str(a+i))))
    if list(str(a+i))==v:
        x+=1
print(x)

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
a,b = map(int,input().split())
l_1=range(10,100)
l_2=range(0,10)
l=[]
for i in l_1:
    for j in l_2:
        tmp=int(str(i)+str(j)+str(i)[::-1])
        l.append(tmp)
print(bisect_right(l,b)-bisect_left(l,a))

Submission status: Accepted

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

for i in range(a[1]-a[0]+1):
  b = str(a[0]+i)
  if b==b[::-1]:
    z+=1
else:
  print(z)

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

def is_palindromic(n):
    l = list(str(n))
    l.reverse()
    return n == int("".join(l))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
row = input().split()
A = int(row[0])
B = int(row[1])
count = 0
for i in range(A, B+1):
    s = list(str(i))
    if s == list(reversed(s)):
        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)
  listA=list(a)
  listA.reverse()
  rev="".join(listA)
  if a==rev:
    ans+=1
print(ans)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt=0
for num in range(a,b+1):
    if int(str(num)[0:2])==int(str(num)[4]+str(num)[3]):
        cnt+=1
print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
a,b = map(str, input().split())
count = 0
num = a
sub = 0
line = int(b) - int(a) + 1

for i in range(line):
	if num[0] == num[4] and num[1] == num[3]:
		count = count + 1
	sub = int(num) + 1
	num = str(sub)
	
print(count)

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
ans = 0
for i in range (A,B+1):
    s = str(i)
    kai = True
    for j in range (0, math.ceil(len(s)/2)):
        if s[j] != s[-j - 1]:
            kai = False
            break
    if kai == True:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math
import fractions

def main():
    A,B=map(int,input().split())
    count=0
    for a in range(A,B+1):
        s=str(a)
        r="".join(reversed(list(s)))
        if s==r:
            count+=1
    print(count)
    
    
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

Submission status: Accepted

Solution code:
a, b = list(map(int, input().rstrip().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:
# ABC090B - Palindromic Numbers
def main():
    a, b = list(map(int, input().rstrip().split()))
    cnt = 0
    for i in range(a, b + 1):
        s = str(i)
        if s == s[::-1]:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b = map(int, input().split())

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

    print(count)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b = map(int, input().split())

    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

    print(count)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    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 = [int(ab) for ab in input().split()]
ans = 0
for AB in range(A, B+1):
  AB_str = str(AB)
  for i in range(len(AB_str)//2):
    if AB_str[i] != AB_str[-i-1]:
      break
  else:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=input().split()
if a!='10000':
  a=str(int(a)-1)
def f(x):
  c=int(x[0])
  d=int(x[1])
  m=(c-1)*100+d*10
  e=int(x[2])
  g=int(x[3])*10+int(x[4])
  if g<d*10+c:
    m+=e
  else:
    m=m+e+1
  return m
print(f(b)-f(a))

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
#greedy O(B-A)*len(B)(=5)
kaibun = 0 # num of kaibun
for i in range(A,B+1,1):
  s = str(i)
  #print(s)
  for i in range(len(s)):
    if s[i] != s[len(s)-1-i]:
      break
    if i == len(s)-1:
      kaibun += 1
print(kaibun)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A, B = nl()

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:
def resolve():
	a,b=map(str,input().split())
	s=int(a[:2])
	e=int(b[:2])
	ans=0
	for i in range(s,e+1):
		for j in range(10):
			kai=i*1000+j*100+int(str(i)[::-1])
			if int(a)<=kai<=int(b):
				ans+=1
	print(ans)
resolve()

Submission status: Accepted

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

P = [0] * (B + 1)
for i in range(10000,B + 1):
  if (i // 10000 == i % 10) and ((i // 1000) % 10 == (i // 10) % 10):
    P[i - 9999] = P[i - 10000] + 1
  else:
    P[i - 9999] = P[i - 10000]
print(P[B - 9999] - P[A - 10000])

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 i >= 100000:break
  s=str(i)
  if s[0]==s[-1] and s[1]==s[-2]:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
def isSym(x):
  y = str(x)
  z = y[::-1]
  return y == z

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

Submission status: Accepted

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


abc()

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    A, B = (int(_) for _ in input().split())
    cnt = 0
    for i in range(A,B+1):
        if str(i) == str(i)[::-1]:
            cnt += 1
    print(cnt)
    
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())
tmp = ''
ans = 0
for i in range(A,B+1):
    tmp = 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):
    i = str(i)
    if i == i[::-1]:
        count += 1
    else:
        pass
print(count)

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

# sys.setrecursionlimit(2147483647)
# INF = float("inf")
#
# N = int(sys.stdin.readline())
# S = [sys.stdin.readline().rstrip() for _ in range(N)]
# M = int(sys.stdin.readline())
# T = [sys.stdin.readline().rstrip() for _ in range(M)]
#
# ans = 0
# for s in set(S):
#     a = S.count(s)
#     b = T.count(s)
#     ans = max(ans, a - b, 0)
#
# print(ans)

A, B = list(map(int, sys.stdin.readline().split()))

ans = 0
for i in range(A, B+1):
    ans += str(i) == ''.join(list(reversed(str(i))))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

setes = set()
for i in range(1,10):
  for j in range(10):
    for k in range(10):
      setes.add(10001*i + 1010*j + 100*k)
print(len(set(range(a,b+1))&setes))

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())
count = 0
for i in range(b - a + 1):
    l = len(str(a + i))
    if l % 2 != 0:
        l = l - 1
    check = 0
    for j in range(l // 2):
        if int(str(a + i)[j]) == int(str(a + i)[l - j]):
            check += 1
    if check == l // 2:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

def is_palind(x):
  s = str(x)
  return s == s[::-1]

answer = 0
for n in range(a,b+1):
  if is_palind(n):
    answer += 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

A,B = input().split()

A = int(A)
B = int(B)

ans = 0

for i in range(B - A + 1):
    
    i += A
    
    i = str(i)
    
    rot = ""
    
    for j in i:
        
        rot = j + rot
        
    if i == rot :
        
        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:
ab = input().split(" ")
start = int(ab[0])
stop = int(ab[1])+1
ans = 0
for i in range(start, stop):
  x = i%10*10 + int(i/10)%10
  y = int(i/1000)
  #print(i%10*10 + int(i/10)%10)
  #print(int(i/1000))
  if x==y:
    ans = ans+1
   # print("{} {} {}".format(i,x,y))
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)
    if x[0] == x[4] and x[1] == x[3]:
        ans += 1
print(ans)

Submission status: Accepted

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


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



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(A, B)

if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
i = input().split(' ')
counter = 0
#print(int(i[0]),int(i[1]))
for i in range(int(i[0]),int(i[1])+1):
  if str(i) == str(i)[::-1]:
    counter +=1

print(counter)

Submission status: Accepted

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

def judge(x):
  L = [0] * 5
  for i in range(5):
    L[i] = x % 10
    x //= 10
  if L[0] == L[4] and L[1] == L[3]:
    return 1
  else:
    return 0

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

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
c = list(range(a,b+1))
count = 0
for i in c:
  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())
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) :
    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())
c=0
for i in range(a,b+1):
    i=str(i)
    if i[:2]==i[3:][::-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):
    i = str(i)
    if i[0] == i[4]:
        if i[1] == i[3]:
            ans += 1
        else:
            ans += 0
    else:
        ans += 0
print(ans)

Submission status: Accepted

Solution code:
def dsum(n,x):
  for i in range(n-1):
    x //= 10
  return x % 10  

a, b = map(int, input().split())
total = 0
for i in range(a,b+1):
  if dsum(1,i) == dsum(5,i) and dsum(2,i) == dsum(4,i):
    total += 1
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

j=0

for i in range(A,B+1):
    if str(i)[0]==str(i)[-1] and str(i)[1]==str(i)[-2]:
        j+=1

print(j)

Submission status: Accepted

Solution code:
i = list(map(int, input().split()))
A = i[0]
B = i[1]

count = 0
for i in range (A,B+1,1):
    I = str(i)
    if int(I[-1]) == int(I[-5]) and int(I[-2]) == int(I[-4]):
        count = count + 1
    else :
        pass

print(count)

Submission status: Accepted

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

count = 0
for i in range (A,B+1):
    length = len(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):
    temp=str(i)
    if temp[0]==temp[-1] and temp[1]==temp[-2]:
        cnt+=1
        
print(cnt)

Submission status: Accepted

Solution code:
A, B = [int(i) for i in 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())
k=0
for i in range(A,B+1):
    if i == int(str(i)[::-1]):
        k+=1
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ls = [str(x) for x in range(a,b+1)]

flg = 0

for i in ls:
    if (i[0]==i[4]) and (i[1]==i[3]):
        flg += 1
        
print(flg)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(B - A + 1):
	num = str(A + i)
	if num[0] == num[4] and num[1] == num[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):
  s1 = str(i)
  s2 = str(i)[::-1]
  if s1 == s2:
    cnt = 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 i//10000 == i%10 and (i//1000)%10 == (i%100)//10:
        count += 1 

print (count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(s):
    return all(s[i] == s[-i-1] for i in range(len(s)//2))

A, B = [int(x) for x in input().split()]

print(sum(check(str(n)) for n in range(A, B+1)))

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

ans=0
for i in range(A,B+1):
    s=str(i)
    if all( s[j]==s[4-j] for j in range(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):
    s=str(i)
    l=len(s)
    if all( s[j]==s[l-1-j] for j in range(l) ): ans+=1

print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
#As,Bs = str(A),str(B)
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
print(count)

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

Submission status: Accepted

Solution code:
A, B = map(int, raw_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())
count = 0
for i in range(a, b+1):
    now = str(i)
    tmp =  now[::-1]
    if now == tmp:
        count += 1
print(count)

Submission status: Accepted

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

cnt = 0
for i in range (A, B+1):
    a = (i // 10000) % 10 #5桁目
    b = (i // 1000) % 10 #4桁目
    c = (i // 10) % 10 #2桁目
    d = i % 10 #1桁目
    if a == d and b == c:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
a, b = [ int(v) for v in 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())
x=[]
for i in map(str,range(a,b+1)):
    if i==i[::-1]:
        x.append(i)

print(len(x))

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    s = str(i)
    f = True
    for j in range(len(s) // 2):
        # print(s[j], s[-j])
        if s[j] != s[-(j+1)]:
            f = False
    # print(i)
    if f:
        
        ans += 1
print(ans)
# else:
#     for j in range(len(s) //2):

Submission status: Accepted

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

Submission status: Accepted

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


def solve(A: int, B: int):
    def is_pal(n):
        s = str(n)
        for i in range(len(s)):
            if s[i] != s[-1 - i]:
                return False
        return True
    ret = 0
    for i in range(A, B + 1):
        if is_pal(i):
            ret += 1
    print(ret)
    return


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
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# user: herp_sy

import math
import statistics

cnt = 0
keta = []
a,b = map(int, input().split())
for i in range(a,b + 1):
  n = i
  for j in range(5):
    keta.append(n % 10)
    n = n // 10
  if keta[0] == keta[4] and keta[1] == keta[3]:
    cnt = cnt + 1
  keta = []
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(A,B+1):
    figure = list(str(i))
    inverse = figure[::-1]
    if figure == inverse:
        result += 1
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
A,B=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for i in range(A,B+1):
    if str(i)[:2] == str(i)[-2:][::-1]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
A,B = input().split()
g = 0
for i in range(int(A[0:3]),int(B[0:3])+1):
    p = i//100
    q = (i%100)//10
    new_k = i*100+q*10+p
    if int(A) <= new_k <= int(B):
        g += 1
print(g)

Submission status: Accepted

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

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

  # 1桁目と5桁目が一致する
  # かつ2桁目と4桁目が一致する場合
  if i[0]==i[4] and i[1]==i[3]:
    c+=1

# 出力
print(c)

Submission status: Accepted

Solution code:
A,B = list(map(int,input().split()))
count = 0
for i in range(A,B+1):
  x = i
  a1 = x//10000
  x = x - 10000*a1
  a2 = x//1000
  x = x - 1000*a2
  a3 = x//100
  x = x - 100*a3
  a4 = x//10
  a5 = x - 10*a4
  if a1 == a5 and a2 == a4:
    count +=1
    
print(count)