This file contains hidden or 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
import sys | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') | |
print sum(int(line.rstrip())for line in test_cases) | |
test_cases.close() | |
This file contains hidden or 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
print '\n'.join([str(i) for i in range(1, 100) if i % 2 != 0]) |
This file contains hidden or 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
import sys | |
import os | |
print os.path.getsize(sys.argv[1]) |
This file contains hidden or 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
from itertools import ifilterfalse | |
import sys | |
def unique(iterable): | |
seen = set() | |
seen_add = seen.add | |
for element in ifilterfalse(seen.__contains__, iterable): | |
seen_add(element) |
This file contains hidden or 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
import sys | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') | |
for line in test_cases: | |
lists = line.rstrip().split(';') | |
l1, l2 = [l.split(',') for l in lists] | |
intersection = list(set(l1).intersection(set(l2))) |
This file contains hidden or 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
import sys | |
def rightmost_char(line): | |
s, t = line.rstrip().split(',') | |
return s.rfind(t) | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') |
This file contains hidden or 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
// 検索ワード入力フィールドでEnterを押下してもSubmitさせない | |
$('input[name=search_query]').keypress(function(e){ | |
return !((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)); | |
}); |
This file contains hidden or 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
import sys | |
def is_happy_number(n, mem=None): | |
if mem is None: | |
mem = [] | |
candidate = sum([int(i) ** 2 for i in n]) |
This file contains hidden or 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
import sys | |
def is_self_describing_numbers(s): | |
if all([s.count(str(idx)) == int(num) for idx, num in enumerate(s)]): | |
return 1 | |
else: | |
return 0 | |
if __name__ == '__main__': |
This file contains hidden or 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
import sys | |
def longest_lines(l, n): | |
l.sort(key=lambda x: len(x) * -1) | |
return l[:n] | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') |