So during this september challenge i came across a problem in this question while making a submission in JAVA.
Where i got TLE in the last subtask. Optimizing the code didn’t work i tried printing 10^6 elements by brute force but it took more than 4 seconds.
Luckily i came across this post
BufferedOutputStream really helped me get full points. I would really recommend this printing method which is comparitive to System.out.println in typing but quicker in printing. comments and better approaches are welcome.