Skip to content

Instantly share code, notes, and snippets.

@masashinakata
masashinakata / acget.sh
Last active May 2, 2021 06:38
Script that downloads test cases from AtCoder.
#!/bin/sh
FILENAME="$1"
HTML="/tmp/$$.html"
if [ "x$FILENAME" == "x" ]; then
cat > "$HTML"
elif [ -f "$FILENAME" ]; then
cat "$FILENAME" > "$HTML"
while read a; do
curl -s $a |
tr -d '\n' |
sed -e 's/.*<title>//'
-e 's/<\/title>.*//'
-e 's/^ *//'
-e 's/ *$//'
-e 's/$/:/'
echo
echo $a
/show_grid {
/Times-Italic findfont 8 scalefont setfont
matrix defaultmatrix setmatrix
0.1 setlinewidth
-2000 10 2000 {
/i exch def
-2000 i moveto 4000 0 rlineto
(function () {
var ids = {};
$('#choices .action_item .status a').each(function () {
var href = $(this).attr('href');
if (! href)
return;
if (href.match(/https?:\/\/twitter.com\/[^/]+\//))
tr , '\n' |
sed -e 's/^ *//' |
awk '{print "\" "$0"=\" << "$0" << "}' |
sed -e 's/$/'\'' '\'' <</' -e 's/" /"/'
sed -e 's/^/std::cin, /' -e 's/,/ >>/g' -e 's/$/;/'
tr , '\n' |
sed -e 's/^ *//' |
awk '{print $0" << '\'" "\'' << "}' |
tr -d '\n' |
sed -e 's/^/std::cout << /' -e 's/'\'' '\'' << $/std::endl;/'
tr , '\n' |
sed -e 's/^ *//' |
awk '{print "\" "$0"=\" << "$0" << "}' |
tr -d '\n' |
sed -e 's/^/std::cerr << /' -e 's/$/std::endl;/' -e 's/" /"/'
(function () {
$('#choices .list_thumb').parent().parent().parent('.action_item').each(function() {
if ($(this).hasClass('selected_item'))
return;
this.click();
});
})();
(function () {
var url = location.href;
if (! url.match(/beta/)) {
var a = url.split('/'), b = a[2].split('.');
location.href = 'https://beta.atcoder.jp/contests/' + b[0] + '/tasks/' + a[a.length - 1];
}
else {
var a = url.split('/'), b = a[2].split('.');