<s> """<STR_LIT>""" <EOL> import math <EOL> try : <EOL> import itertools <EOL> combinations = itertools . combinations <EOL> except AttributeError : <EOL> def combinations ( seq , r = None ) : <EOL> """<STR_LIT>""" <EOL> if r == None : <EOL> r = len ( seq ) <EOL> if r <= <NUM_LIT:0> : <EOL> yield [ ] <EOL> else : <EOL> for i in xrange ( len ( seq ) ) : <EOL> for cc in combinations ( seq [ i + <NUM_LIT:1> : ] , r - <NUM_LIT:1> ) : <EOL> yield [ seq [ i ] ] + cc <EOL> try : <EOL> factorial = math . factorial <EOL> except AttributeError : <EOL> def factorial ( x ) : <EOL> n = abs ( int ( x ) ) <EOL> if n < <NUM_LIT:1> : <EOL> n = <NUM_LIT:1> <EOL> x = <NUM_LIT:1> <EOL> for i in range ( <NUM_LIT:1> , n + <NUM_LIT:1> ) : <EOL> x = i * x <EOL> return x </s>
