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
def steps(n, m) | |
d = n - m | |
ans = d/5 | |
d = d%5 | |
ans += d/2 | |
d = d%2 | |
ans + d | |
end | |
t = gets.to_i |
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
(ns Player | |
(:gen-class)) | |
; Auto-generated code below aims at helping you parse | |
; the standard input according to the problem statement. | |
(def tick (atom 0)) | |
(def distance-stress 11) | |
(defn log [& args] | |
(binding [*out* *err*] |
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
(defn permutations [s] | |
(lazy-seq | |
(if (seq (rest s)) | |
(apply concat (for [x s] | |
(map #(cons x %) (permutations (remove #{x} s))))) | |
[s]))) | |
(defn cost [proposoals s] | |
{:permutation s | |
:cost (apply + (map-indexed (fn [project candidate-str] |
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
#include <WiFi.h> | |
#include <WiFiClient.h> | |
#include <WiFiServer.h> | |
#include <WiFiUdp.h> | |
#include <SPI.h> | |
char ssid[] = "NULL_INDUS"; // your network SSID (name) | |
char pass[] = "90046686"; // your network password |
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
(let [ex-agent (agent {:user_id 1 :user_email "[email protected]"}) | |
fn-agent (fn [{id :user_id email :user_email}] | |
(println "staring super heavy IO task") | |
(Thread/sleep 10000) | |
(println "email send to" email))] | |
(println "sending task to agent") | |
(send-off ex-agent fn-agent) | |
(println "end let")) |
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
(defn subseq? [s l] | |
"subseq? returns true if you can transform l by only removing elements into s" | |
(if (empty? l) | |
(empty? s) | |
(if (= (first l) (first s)) | |
(recur (rest s) (rest l)) | |
(recur s (rest l))))) |
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
(defn preffix [& args] | |
(map first (take-while (partial apply =) (apply map vector args)))) | |
(defn suffix-with-p [s p] | |
(drop (count p) s)) | |
(defn nice-print [col] | |
(println (count col) (apply str col))) | |
(defn *nice-print [& args] |
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 pulls2 { | |
bopen=0 | |
while getopts ":o" Option | |
do | |
case $Option in | |
o ) bopen=1 ;; | |
esac | |
done | |
echo $bopen | |
if [ $bopen -eq 1 ]; then |
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
curl -v http://quiet-journey-7568.herokuapp.com/registers.json -X POST -H "Content-Type: application/json" -d '{"lng": "-32.323", "lat": "114.133111", "imei": "loa0"}' | |
* Adding handle: conn: 0x7fe4ab803a00 | |
* Adding handle: send: 0 | |
* Adding handle: recv: 0 | |
* Curl_addHandleToPipeline: length: 1 | |
* - Conn 0 (0x7fe4ab803a00) send_pipe: 1, recv_pipe: 0 | |
* About to connect() to quiet-journey-7568.herokuapp.com port 80 (#0) | |
* Trying 23.23.214.121... | |
* Connected to quiet-journey-7568.herokuapp.com (23.23.214.121) port 80 (#0) | |
> POST /registers.json HTTP/1.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
#include <stdio.h> | |
int main() | |
{ | |
int near_max = (int) ((1LL<<31) - 2); | |
do { | |
printf("%d\n", ++near_max); | |
} while (near_max > 0); | |
return 0; |
NewerOlder