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 System.Environment | |
| main = do | |
| expr <- getArgs | |
| print $ head $ foldl rpn [] expr | |
| rpn :: [Double] -> String -> [Double] | |
| rpn [] a = [read a] | |
| rpn xs@[_] a = (read a) : xs | |
| rpn xs@(x:y:xs') a | a == "+" = (x + y) : xs' |
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
| #!/usr/bin/env python3 | |
| import math | |
| def distance(xs, ys): | |
| return math.sqrt(sum([math.pow(q - p, 2) for (q,p) in zip(xs, ys)])) | |
| a = [1,2,4,5,2] |
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
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "os" | |
| "strconv" | |
| ) | |
| var Dir [][]int |
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
| package main | |
| import ( | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "log" | |
| ) | |
| func 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
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| "sync" | |
| ) | |
| func init() { | |
| fmt.Println("func init()") |
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
| f = zipWith3 (\a b c -> let x = b ++ c in if null x then show a else x) [1..] (cycle ["", "", "Fizz"]) (cycle ["", "", "", "", "Buzz"]) |
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
| function! s:load_yaml(filename) | |
| python << EOS | |
| import vim, yaml | |
| with open(vim.eval('a:filename'), 'r') as f: | |
| obj = yaml.load(f) | |
| obj_hash = str(obj).replace('None', '{}') | |
| vim.command('let l:ret = %s' % obj_hash) | |
| EOS | |
| return l:ret | |
| endfunction |
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 java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| import java.util.stream.IntStream; | |
| public class Main { | |
| public static void main(String[] args) throws Exception { | |
| int ans = new BufferedReader( | |
| new InputStreamReader(System.in)) | |
| .lines() | |
| .skip(1) |
NewerOlder