Skip to content

Instantly share code, notes, and snippets.

with participants as (
select distinct(user_id) as user_id, name as user_name
from submissions
left join problems p on submissions.problem_id = p.id
left join users on users.id = submissions.user_id
where p.contest_id = (select max(id) from contests)
), problemcount as (
select user_id, count(distinct (problem_id)) as problem_count
from users
left join submissions on users.id = submissions.user_id