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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B = [int(i) for i in input().split()]
c = 0
if 1 <= A <= 99999:
    if 1 <= B <= 99999:
        for p in range(A,B):
            if p // 10000 == i % 10 and p // 1000 == p % 100 - p % 10:
                c += 1
            elif p // 100 == i % 10:
                c += 1
print(c)

Submission status: Runtime Error

Solution code:
A, B = map(int input().split())
cou = B//100 - A//100
Astr = str(A)
Aup = 10 * int(Astr[1]) + int(Astr[0])
Adown = A%100
Bstr =str(B)
Bup = 10 * int(Bstr[1]) + int(Bstr[0])
Bdown = B%100
if Adown < Aup :
    cou += 1
if Bdown > Bup :
    cou += 1
print(cou)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())


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

print(cnt)

Submission status: Runtime Error

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

count = 0
for i in range(a, b+1):
  n = list(str[i])
  n = n[::-1]
  n = int(''.join(map(str, n)))
  if n == i:
    count += 1
  n = -1

print(count)

Submission status: Runtime Error

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

count = 0
for i in range(a, b+1):
  n = list(str[i])
  n = n[::-1]
  n = int(''.join(map(str, n)))
  if n == i:
    count += 1
    n = -1

print(count)

Submission status: Runtime Error

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

count = 0
for i in range(a, b+1):
  n = list(str[i])
  n = n[::-1]
  n = int(''.join(map(str, n)))
  if n == i:
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
cnt = 0
for i in range(A, B + 1):
  x = str(i)
  j, k = 0, len(x) - 1
  while j < k:
    if x[j] != x[k]:
      break
   	j += 1
    k -= 1
  if k <= j:
    cnt += 1
print(cnt)

Submission status: Runtime Error

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: Runtime Error

Solution code:
a,b=map(int,input().split())
s=0
for i in range(a,b+1):
    x=list(str(i))
    y=[]
    for k in range(len(x)):
        y.append(x[len(x)-i-1])
    z=""
    for j in y:
        z+=j
    if i==int(z):
        s+=1
print(s)

Submission status: Runtime Error

Solution code:
def main():
	n = list(map(int, input().split()))
	ans = 0
	for i in range(n[0], n[1]+1):
		temp = str(i)
		if temp == temp[::-1]:
			an += 1
	print(ans)
main()

Submission status: Runtime Error

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

for i in range(a, b+1):
    i_str = str(i)
    length= len(i_str)
    list1 = []
    list2 = []
    for j in length:
        list1.append(i_str[i])
    for k in length:
        list2.append(i_str[-i])
    if list1 == list2:
        count += 1

print(count)

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

def is_palind(x):
  sx = str(x)
  if x[0]==x[-1] and x[1]==x[-2]:
    return True
  else:
    return False

c = 0
for a in range(A, B+1):
  if is_palind(a):
    c+=1

print(c)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
counter = 0
for _ in range(A,B+1):
    str = str(_)
    alist = list(str)
    list_ = []
    long = len(alist)
    for i in range(long-1,-1,-1):
        list_.append(alist[i])
    num = "".join(list_)
    if num == str:
        counter += 1
        continue
    else:
        continue

print(counter)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
counter = 0
for _ in range(A,B+1):
    str = str(_)
    alist = list(str)
    print(alist)
    list_ = []
    long = len(alist)
    for i in range(long-1,-1,-1):
        list_.append(alist[i])
    num = "".join(list_)
    if num == str:
        counter += 1
        continue
    else:
        continue

print(counter)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split( ))
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
  temp = []
  for j in range(5):
    d = 10**(4-i)
    p = i//d
    temp.append(p)
    i -= p*d
  if temp[0] == temp[4] and temp[1] == temp[3]:
    ans += 1
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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 = cnt + 1

print cnt

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
cnt=0
for i in range(A,B+1):
    if  A/10000 == A%10 and  A/1000%10 == A/10%10:
        cnt+=1
print(cnt)

Submission status: Runtime Error

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

count = 0
num = []

for i in range(A, B+1):
    while i != 0:
        num.append(i%10)
    
    if num[0] == num[4] and num[1] == num[3]:
        count += 1


print(count)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
cnt = 0
for n in range(A,B+1):
  n_str = str(n)
  n_len = len(n)
  is_kaibun = True
  for i in range(n_len//2):
    if n_str[i] != n_str[n_len-1-i]:
      is_kaibun = False
  if is_kaibun is True:
    cnt += 1
print(cnt)

# if n_str[0] == n_str[4] and n_str[1] == n_str[3]:
#   cnt += 1

Submission status: Runtime Error

Solution code:
N = int(input())
s = [int(input()) for i in range(N)]
M = int(input())
t = [int(input()) for i in range(M)]

s1 = list(set(s))
a = []
for i in range (len(s1)):
    for j in range (N):
        if s1[i] == s[j]:
            a[i]+=1
for i in range (len(s1)):
    for j in range (M):
        if s1[i] == t[j]:
            a[i]-=1
print(max(a))

Submission status: Runtime Error

Solution code:
N = int(input())
s = [int(input()) for i in range(N)]
M = int(input())
t = [int(input()) for i in range(M)]

s1 = list(set(s))
a = []
for i in range len(s1):
    for j in range (N):
    if s1[i] == s[j]:
        a[i]+=1
for i in range len(s1):
    for j in range (M):
    if s1[i] == t[j]:
        a[i]-=1
print(max(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def solve_with_loop():
    A, B = map(int, input().split())
    if A == B:
        if int(str(A)[:2][::-1]) > int(str(A)[-2:]):
            print(1)
        else:
            print(0)
        return
    ans = 0
    if int(str(A)[:2][::-1]) > int(str(A)[-2:]):
        ans += 1
    A += 100

    while int(A/100) < int(B/100):
        ans += 1
        A += 100
    if int(str(B)[:2][::-1]) < int(str(B)[-2:]):
        ans += 1
    print(ans)
solve()

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())

cnt = 0
for i in range(A, B + 1):
	S = str(i)
	ok = True
	for j in range(0, 3):
		if S[j] != S[4 - j]:
			ok = False
			break

	if ok:
		cnt = cnt + 1

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
def main():
    #1. input
    a = int(input())
    b = int(input())
    
    ans = 0
    counter=0
    
    #2. from A to B
    for i in range(a, b+1):
        counter = counter+1
        #2.1. judge if the number is palindromic
        if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):
            ans = ans+1
        
    #3. output
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
a,b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
  s = "{}".format(i)
  if s == s[:,:,-1]: cnt += 1
print(cnt)

Submission status: Runtime Error

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

count = 0

for i in range(a, b + 1):
    work_i = i
    n = 1
    while work_i >= 10:
        n++ 
        work_i = int(work_i / 10)

    flag = True
    for j in range(int(n/2)):
        if int(i / 10**j) % 10 != int(i / 10**(n-j-1)) % 10:
            flag = False

    if flag:
        count++

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
B - Palindromic Numbers
https://beta.atcoder.jp/contests/abc090/tasks/abc090_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B):
    ans = 0
for i in range(A, B+1):
        s1 = str(i)
        s2 = s1[::-1]
        if s1 == s2:
            ans += 1
    return ans


def main(args):
    A, B = map(int, input().split())
    ans = solve(A, B)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Runtime Error

Solution code:
a,b=map(input().split());print(len([1 for i in range(a,b+1) if i//1000==i%100]))

Submission status: Runtime Error

Solution code:
a,b=map(input().split());print(len([1 for i in range(a,b+1)if i//1000==i%100]))

Submission status: Runtime Error

Solution code:
 A,B = map(int,input().split())
 
 
  def kaibun(m, n):
      key = 0
      for i in range(m,n+1):
          s = i//10000
          t = i%10
          u = i//1000 % 10
          v = i//10 % 10
          if (s==t)&(u==v):
              key += 1
      return key
 
  print(kaibun(A,B))

Submission status: Runtime Error

Solution code:
 A,B = map(int,input().split())
   ...:
   ...:
   ...: def kaibun(m, n):
   ...:     key = 0
   ...:     for i in range(m,n+1):
   ...:         s = i//10000
   ...:         t = i%10
   ...:         u = i//1000 % 10
   ...:         v = i//10 % 10
   ...:         if (s==t)&(u==v):
   ...:             key += 1
   ...:     return key
   ...:
   ...: print(kaibun(A,B))

Submission status: Runtime Error

Solution code:

Tmp = []
Tmp = input().rstrip().split(' ')
A = Tmp[0]
B = Tmp[1]

Ans = 0
Data = A
while Data <= B:
    A = Data // 10000
    B = Data // 1000
    D = Data // 10
    E = Data % 10
    if (A==E) and (B==D):
        Ans += 1
    
    Data += 1 

print(Ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(cnt)

Submission status: Runtime Error

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

if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1)
        c = str(i)
        length = len(c)
        if length%2 == 0:
            continue
        for j in range(length):
            if c[j] == c[length-1-j]:
                if j == length-1-j:
                    ans += 1
                    break
                continue
            else:
                break
        print(ans)

Submission status: Runtime Error

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

if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1)
        c = str(i)
        if len(c)%2 == 0:
            continue
        J = len(c)
        for j in range(J):
            if c[j] == c[J-1-j]:
                if j == J-1-j:
                    ans += 1
                    break
            else:
                break
        print(ans)

Submission status: Runtime Error

Solution code:
start, end= input().split()
cnt = 0
for i in range(start, end+1):
    i_front = str(i)[0:2]
    i_back = str(i)[-1:-3]
    if i_front == i_back:
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:

A,B = input().split(' ')
num = 0
for i in range(int(A), int(B)+1):
    s = str(i)
    for j in range(len(s)//2):
        if s[j] != s[len(s)-1-j]:
            break
        if j == len(s)//2 - 1:
            num += 1
print(num

Submission status: Runtime Error

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

Submission status: Runtime Error

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