fork download
  1. x = int(input())
  2. def power(a):
  3. b=0
  4. while 3**b<=a:
  5. b += 1
  6. return b
  7. for i in range(x) :
  8. moves=0
  9. y = input().split()
  10. for j in range(int(y[0]),int(y[1])+1):
  11. moves += power(j)
  12. print(moves+power(int(y[0])))
Success #stdin #stdout 0.02s 25700KB
stdin
Standard input is empty
stdout
x = int(input())
def power(a):
    b=0
    while 3**b<=a:
        b += 1
    return b
for i in range(x) :
    moves=0
    y = input().split()
    for j in range(int(y[0]),int(y[1])+1):
        moves += power(j)
    print(moves+power(int(y[0])))