An Edinburgh school pupil has been crowned the best at sums in Europe after finishing second in a worldwide mental arithmetic competition.
Rock Tsui attends George Heriot's School in Edinburgh
Rock Tsui, 17, a sixth-year pupil at George Heriot's School, restricted himself to just 30 minutes' sleep in two days during the contest.
The World Maths Day online exam attracted 750,000 entrants.
Rock, who correctly answered over 60,000 questions, was eventually pipped at the post by an Australian rival.
The gruelling competition started at 1100 GMT last Tuesday, finishing 48 hours later. It saw him answer an average of more than 40 questions per minute.
An online leader board was kept and automatically updated as entrants continued to answer questions correctly.
Rock said: "After finishing in 17th position last year, my minimum aim was to break into the top 10.
"I managed to keep myself awake by drinking lots of Red Bull so didn't feel too sleepy - the excitement of the competition also kept me alert.
"My teachers kept on emailing me to tell me to sleep but I was so determined to do my best I didn't listen to them.
"I could see my name at the top of the leader board which was great motivation but unfortunately it wasn't enough and I couldn't hold on."
After correctly answering a total of 62,273 questions and leading for more than 24 hours, Rock was narrowly beaten by 2,926 answers by a pupil called Tatiana D from Australia who overtook him with just three hours to go.
In total, the Heriot's pupil answered 97.5% of his questions correctly.
The competition was split into one minute games where students went head-to-head with another player of similar ability.
After each test, pupils were only given 20 seconds until the next one started.
Each sum, which was either addition, subtraction, multiplication or division, was limited to two numbers of one or two digits.
Alistair Hector, George Heriot's headmaster, said: "The whole school is immensely proud of Rock and what he has achieved.
"To come second in such a massive competition is outstanding and is testament to the hard work of Rock and his teachers."
The World Maths Day competition is hosted by Australian e-Learning company 3P Learning together with Voyager Expanded Learning.
Jayne Warburton, from 3P Learning, says his performance was fantastic.
She said: "Rock did really well last year but was determined to do better this year so like a true competitor practiced to make himself better.
"He was very unlucky to lose out just at the end but should still be immensely proud of his finishing second."