This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT language, COUNT(*) AS lang_count FROM submissions GROUP BY language; | |
SELECT nickname FROM players WHERE TIMESTAMPDIFF(YEAR, birth, NOW()) = 25; | |
WITH distinct_submissions AS ( | |
SELECT DISTINCT user_id, problem_id FROM submissions | |
) | |
SELECT players.nickname, COUNT(distinct_submissions.problem_id) AS problems_attempted | |
FROM distinct_submissions | |
INNER JOIN players ON players.user_id = distinct_submissions.user_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma GCC optimize ("Ofast") | |
#include <algorithm> | |
#include <chrono> | |
#include <fstream> | |
#include <iostream> | |
#include <iterator> | |
#include <ostream> | |
#include <string> | |
#include <vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stringMultiply(x, y) { | |
if (x === '0' || y === '0') { | |
return '0'; | |
} | |
if (x === '1') { | |
return y; | |
} | |
if (y === '1') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayDiff(array, diff) { | |
const size = array.length; | |
if (size === 0) { | |
return 0; | |
} | |
const map = new Map(); | |
for (let i = 0; i < size; ++i) { | |
const value = array[i]; | |
if (!map.has(value)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2011 Andrei Mackenzie | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |