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
from __future__ import division, print_function | |
H=1.008; He=4.002602; | |
Li=6.94; Be=9.012182; B=10.81; C=12.011; N=14.007; O=15.999; F=18.9984032;Ne=20.1797; | |
Na=22.98976928;Mg=24.3050; Al=26.9815386;Si=28.085; P=30.973762; S=32.06; Cl=35.45; Ar=39.948; | |
K=39.0983; Ca=40.078; Sc=44.955912;Ti=47.867;V=50.9415; Cr=51.9961;Mn=54.938045;Fe=55.845; Co=58.933195;Ni=58.6934;Cu=63.546; Zn=65.38; Ga=69.723; Ge=72.63; As=74.92160; Se=78.96; Br=79.904; Kr=83.798; | |
Rb=85.4678; Sr=87.62; Y=88.90585; Zr=91.224;Nb=92.90638; Mo=95.96; Tc=98.0; Ru=101.07; Rh=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
public class Troll { | |
static volatile int a; | |
public static void main(String[] args) { | |
new Thread(new Runnable(){ | |
public void run(){ | |
while (true){ a = -42; a = 1337; } | |
} | |
}).start(); | |
for (int i = 0; i < 1000000; i++){ | |
if (a != a) { |
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 Control.Applicative (liftA2, liftA3) | |
import qualified Data.Map as M (empty, lookup, insertWith, delete) | |
import Data.Function (fix) | |
import Control.Monad (join) | |
primes = fix (flip (flip liftA2 head) tail . (liftA2 (liftA3 liftA2 (flip flip | |
. M.lookup)) (liftA2 ($) ((.) . (.) (liftA3 maybe) . (.) . (:)) . ((. flip | |
(.) . liftA2 (M.insertWith (++)) (join (*)) (replicate 1)) . flip (.))) | |
(((. flip (.) . liftA2 (.) (foldl . ((. flip flip) . flip flip (replicate | |
1) . flip liftA2 . (.) (M.insertWith (++)) . (+))) M.delete) . (flip (.)) | |
. (.) (.) ) ))) [2..] M.empty |
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 javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class CurrencyExchange { // I'm not an actionListener! | |
String[] differentCurrency = {"US Dollars","Japanese YEN","Chinese YUAN", "Korean WON"}; | |
JFrame frame; | |
JPanel contentPane; | |
JLabel label, result; |
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 Control.Applicative | |
import Data.Maybe | |
-- Calculator digit rotation | |
cRotateDigit 0 = Just 0 | |
cRotateDigit 1 = Just 1 | |
cRotateDigit 2 = Just 2 | |
cRotateDigit 5 = Just 5 | |
cRotateDigit 6 = Just 9 | |
cRotateDigit 8 = Just 8 | |
cRotateDigit 9 = Just 6 |
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
hello | |
hello | |
hello | |
hello | |
hello | |
hello |
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
-- @betaveros | |
-- Google Code Jam Round 1A 2014: Proper Shuffle (polished version) | |
import Control.Applicative | |
import Control.Monad | |
import Text.Printf | |
inputInt :: IO Int | |
inputInt = read <$> getLine | |
inputInts :: IO [Int] | |
inputInts = map read . words <$> getLine |
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.awt.image.BufferedImage | |
import java.io.File | |
import java.awt.Color | |
import javax.imageio.ImageIO | |
object ImageTabler { | |
var classMap: Map[Int, Int] = Map() | |
var nextClass: Int = 1 | |
def addClassFor(c: Int): Unit = if (!(classMap contains c)) { | |
var cls = nextClass |
OlderNewer