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
Undefined symbols for architecture x86_64: | |
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from: | |
_main in n3-81953a.o | |
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in n3-81953a.o | |
"std::__1::ios_base::getloc() const", referenced from: | |
_main in n3-81953a.o | |
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in n3-81953a.o | |
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from: | |
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<cha |
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 <iostream> | |
#include <iomanip> | |
using namespace std; | |
#if 1 | |
int gcd(int a,int b){ //Euclidean algorithm | |
int t; | |
while(b){ |
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
//VYF+VYF=TIEN | |
function check(e,f,i,n,t,v,y){return 2*(100*v+10*y+f)==1000*t+100*i+10*e+n;} | |
function search(acc,ansvec){if(acc.length==7){if(check.apply(null,acc))ansvec.push(acc.slice());return;}for(var i=0;i<10;i++)search(acc.concat([i]),ansvec);} | |
function get(){var ansvec=[];search([],ansvec);return ansvec;} | |
function distinct(){return get().filter(function(v){return v.map(function(e,i){return v.indexOf(e)!=i;}).reduce(function(a,b){return a+b;})==0;});} | |
function reasonable(){return distinct().filter(function(v){return v[5]!=0&&v[4]!=0;});} | |
function goodnozero(){return distinct().filter(function(v){return v.reduce(function(a,b){return a&&b!=0;},true);});} | |
function format(v){return ""+v[5]+v[6]+v[1]+"+"+v[5]+v[6]+v[1]+"="+v[4]+v[2]+v[0]+v[3];} | |
function printall(vv){console.log(vv.map(format).join("\n"));} | |
function TIEN(v){return 1000*v[4]+100*v[2]+10*v[0]+v[3];} |
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 <iostream> | |
#include <fstream> | |
#include <sstream> | |
#include <iomanip> | |
#include <string> | |
#include <vector> | |
#include <unordered_map> | |
#include <utility> | |
#include <tuple> | |
#include <algorithm> |
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 breakstuff(s,maxlen){ | |
var idx=s.indexOf("\n"); | |
if(idx!=-1){ | |
return breakstuff(s.slice(0,idx),maxlen).concat(breakstuff(s.slice(idx+1),maxlen)); | |
} | |
var punct=".,;:?!"; //stuff that has a space after it | |
var wspace=" \t"; //whitespace chars, NOT NEWLINE! | |
var i; | |
var lines=[]; | |
var linestart=0,lastend=0; |
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 bash | |
LASTUPDATEAT="Thu Aug 6 14:54:49 CEST 2015" | |
#this is self-modifying code. | |
which gtail >/dev/null && TAIL=gtail || TAIL=tail | |
which gstat >/dev/null && STAT=gstat || STAT=stat | |
if ! eval $TAIL --version >/dev/null; then | |
echo "Error: Your 'tail' is the BSD version, not the GNU version." | |
exit 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
$ g++-5 -Wall -O2 -o postrun postrun.cpp -std=c++11 | |
postrun.cpp: In function 'std::vector<std::__cxx11::basic_string<char> > tokenise(std::istream&)': | |
postrun.cpp:62:13: error: the value of 'stringmode' is not usable in a constant expression | |
case stringmode:c=stringmode;break; | |
^ | |
postrun.cpp:20:9: note: 'char stringmode' is not const | |
char c,stringmode; | |
^ | |
postrun.cpp:62:13: error: the value of 'stringmode' is not usable in a constant expression | |
case stringmode:c=stringmode;break; |
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
module Main where | |
import Control.Monad (liftM) | |
data Tree a = Null | Node a (Tree a) (Tree a) | |
instance (Show a) => Show (Tree a) where | |
show Null = "(null)" | |
show (Node val Null Null) = (show val) | |
show (Node val Null t2) = (show val) ++ " " ++ (show t2) |
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
parenpairs :: String -> [(Int,Int)] | |
parenpairs = go 0 [] | |
-- index stack string | |
where go _ [] [] = [] | |
go i st ('[':cs) = go (i+1) (i:st) cs | |
go i (s:st) (']':cs) = (s,i) : go (i+1) st cs | |
go i [] (']':cs) = error "rip -- unmatched closing bracket" | |
go i st (_:cs) = go (i+1) st cs | |
go _ (_:_) [] = error "rip -- unmatched open bracket" |
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
.PHONY: all clean remake | |
CC = gcc | |
CFLAGS = -Wall -Wextra -pedantic -O2 | |
CXX = g++ | |
CXXFLAGS = -Wall -Wextra -pedantic -O2 | |
SYS = $(shell $(CC) -dumpmachine) | |
ifneq (,$(findstring mingw,$(SYS))$(findstring cygwin,$(SYS))$(findstring windows,$(SYS))) | |
#windows |