fork download
  1. def MODexp(x,n,M):
  2. if n==0:
  3. return 1
  4. elif n%2==0:
  5. y=MODexp(x,n//2,M)
  6. return (y*y)%M
  7. else:
  8. return((x%M)*MODexp(x,n-1,M))%M
  9.  
  10. def solve(L, R):
  11. for i in range(L, R+1):
  12. if i==0:
  13. print(1,end=" ")
  14. elif i==1:
  15. print(5,end=" ")
  16. else:
  17. print((MODexp(2,i,MOD) + (3*i)%MOD)%MOD, end=" ")
  18.  
  19. MOD = 10**9 +7
  20.  
  21. for _ in range(int(input())):
  22. L, R = map(int, input().split())
  23. solve(L,R)
  24. print("")
  25.  
  26.  
  27.  
Runtime error #stdin #stdout #stderr 0.01s 27664KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 21, in <module>
EOFError: EOF when reading a line