This file contains 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) |
This file contains 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 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 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 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 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 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 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 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
public class FizzBuzz{ | |
public static void main(String...args){ | |
java.util.stream.Stream.iterate(1, i -> i + 1) | |
.map(i -> { | |
String x=(i % 3 < 1 ? "Fizz" : "") + (i % 5 < 1 ? "Buzz" : ""); | |
return x.equals("") ? i : x; | |
}) | |
.limit(100) | |
.forEach(System.out::println); | |
} |
This file contains 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 shapeless._, labelled._, syntax._, ops.record._ | |
import scala.annotation.implicitNotFound | |
object derive { | |
sealed trait KV | |
case class Obj(xs: List[(KV, KV)]) extends KV { | |
def ++(j: KV): KV = j match { | |
case Obj(xxs) => copy(xs ++ xxs) |
OlderNewer