Skip to content

Instantly share code, notes, and snippets.

View neizod's full-sized avatar
📚
phd completed, seeking my new goal in life

Nattawut Phetmak neizod

📚
phd completed, seeking my new goal in life
View GitHub Profile
from itertools import cycle, izip
k, l, m, n, d = [int(raw_input()) for _ in range(5)]
dragons = [cycle([False] * (i-1) + [True]) for i in {k, l, m, n}]
print sum(any(next(izip(*dragons))) for _ in xrange(d))
@neizod
neizod / LICENSE.txt
Last active December 14, 2015 04:39 — forked from Python1Liners/LICENSE.txt
Happy Valentine's Day
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
-- groupIndices 5 [1..20] -> [[1,6,11,16],[2,7,12,17],[3,8,13,18],[4,9,14,19],[5,10,15,20]]
groupIndices n = map reverse . foldl (\a x -> [if length h /= length t then x:h else h | (h,t) <- zip a ((42:last a):init a)]) (take n $ repeat [])
@neizod
neizod / LICENSE.txt
Created September 3, 2012 00:40 — forked from Python1Liners/LICENSE.txt
Google Recruiting Board
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Created July 28, 2012 15:53 — forked from Python1Liners/LICENSE.txt
Letter A
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Last active April 27, 2019 07:32 — forked from 140bytes/LICENSE.txt
Fibonacci (Recursive Lambda)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Created February 27, 2012 18:17 — forked from Python1Liners/LICENSE.txt
Stockbroker
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Created February 26, 2012 21:16 — forked from Python1Liners/LICENSE.txt
Quicksort
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Created February 21, 2012 21:36 — forked from Python1Liners/LICENSE.txt
Store Credit
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / LICENSE.txt
Created February 21, 2012 01:58 — forked from Python1Liners/LICENSE.txt
Random Separate Element into 2 Lists
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE