fork download
  1. t=int(input())
  2. for _ in range(t):
  3. N, M = map(int,input().split())
  4. if M == 0:
  5. arr=[0]*N
  6. print(*arr)
  7. continue
  8. times=M//N
  9. arr=[times for i in range(N)]
  10. rem=M%N
  11.  
  12. if times%2 == 0:
  13. for i in range(rem):
  14. arr[i]+=1
  15. else:
  16. for i in range((N-rem),N):
  17. arr[i]+=1
  18. print(*arr)
  19.  
Success #stdin #stdout 0.02s 9328KB
stdin
2
3 4
5 11
stdout
1 1 2
3 2 2 2 2