first commit

This commit is contained in:
fzorb 2025-05-01 12:38:17 +03:00
commit 31bda4481f
37 changed files with 4645 additions and 0 deletions

300
2015/eight/input Normal file
View file

@ -0,0 +1,300 @@
"sjdivfriyaaqa\xd2v\"k\"mpcu\"yyu\"en"
"vcqc"
"zbcwgmbpijcxu\"yins\"sfxn"
"yumngprx"
"bbdj"
"czbggabkzo\"wsnw\"voklp\"s"
"acwt"
"aqttwnsohbzian\"evtllfxwkog\"cunzw"
"ugvsgfv"
"xlnillibxg"
"kexh\"pmi"
"syvugow"
"m\"ktqnw"
"yrbajyndte\\rm"
"f\"kak\x70sn\xc4kjri"
"yxthr"
"alvumfsjni\"kohg"
"trajs\x5brom\xf1yoijaumkem\"\"tahlzs"
"\"oedr\"pwdbnnrc"
"qsmzhnx\""
"\"msoytqimx\\tbklqz"
"mjdfcgwdshrehgs"
"\"rivyxahf\""
"ciagc\x04bp"
"xkfc"
"xrgcripdu\x4c\xc4gszjhrvumvz\"mngbirb"
"gvmae\"yiiujoqvr\"mkxmgbbut\"u"
"ih"
"ncrqlejehs"
"mkno\x43pcfdukmemycp"
"uanzoqxkpsksbvdnkji\"feamp"
"axoufpnbx\\ao\x61pfj\"b"
"dz\\ztawzdjy"
"ihne\"enumvswypgf"
"\"dgazthrphbshdo\\vuqoiy\""
"dlnmptzt\\zahwpylc\\b\"gmslrqysk"
"mhxznyzcp"
"rebr\"amvxw\x5fmbnfpkkeghlntavj"
"lades\x47ncgdof\"\"jmbbk"
"dwxuis\xa5wdkx\\z\"admgnoddpgkt\\zs"
"g\\k\x27qsl\x34hwfglcdxqbeclt\xca\\"
"lhyjky\\m\"pvnm\\xmynpxnlhndmahjl"
"c\"uxabbgorrpprw\"xas\\vefkxioqpt"
"rfrvjxpevcmma\x71gtfipo"
"fgh\"kcwoqwfnjgdlzfclprg\"q"
"onxnwykrba"
"hkkg\x60f\"tjzsanpvarzgkfipl"
"\"aintes\"ofq\"juiaqlqxmvpe\\a"
"wiyczzs\"ciwk"
"mfqeu"
"v\xe1z\x7ftzalmvdmncfivrax\\rjwq"
"k\"vtg"
"exhrtdugeml\xf0"
"behnchkpld"
"mhgxy\"mfcrg\xc5gnp\"\"osqhj"
"rlvjy"
"awe"
"ctwy"
"vt"
"\x54t"
"zugfmmfomz"
"cv\"cvcvfaada\x04fsuqjinbfh\xa9cq\xd2c\"d"
"oj"
"xazanf\"wbmcrn"
"\\\\zkisyjpbzandqikqjqvee"
"dpsnbzdwnxk\\v"
"sj\"tuupr\\oyoh"
"myvkgnw\x81q\xaaokt\\emgejbsyvxcl\\\xee"
"ejeuqvunjcirdkkpt\"nlns"
"twmlvwxyvfyqqzu"
"\"xwtzdp\x98qkcis\"dm\\\"ep\"xyykq"
"vvcq\\expok"
"wgukjfanjgpdjb"
"\"mjcjajnxy\\dcpc"
"wdvgnecw\\ab\x44klceduzgsvu"
"dqtqkukr\"iacngufbqkdpxlwjjt"
"\"xj\"\x66qofsqzkoah"
"nptiwwsqdep"
"gsnlxql\x30mjl"
"yeezwokjwrhelny\""
"bjauamn\\izpmzqqasid"
"tvjdbkn\"tiziw\x82r"
"w"
"xwoakbbnjnypnaa\xa9wft\"slrmoqkl"
"vwxtnlvaaasyruykgygrvpiopzygf\"vq"
"qdancvnvmhlmpj\\isdxs"
"xzc\\elw"
"b\"wxeqvy\"qf\"g\xcaoklsucwicyw\"dovr"
"yomlvvjdbngz\"rly\"afr"
"bfb\"x\"aweuwbwmoa\x13\"t\"zhr"
"\"dmfoxb\"qvpjzzhykt\xd2\"\"ryhxi"
"psqef\"yu\\qiflie\"\x79w"
"arzewkej\"lqmh\\sayyusxxo\\"
"vuvvp"
"hc\"lg\x6bcpupsewzklai\"l"
"cjdfygc\"auorqybnuqghsh\x10"
"j"
"wqjexk\"eyq\\lbroqhk\\dqzsqk"
"dws\"ru\"dvxfiwapif\"oqwzmle"
"agcykg\\jt\\vzklqjvknoe"
"kksd\"jmslja\\z\"y\\b\xaagpyojct"
"nnpipxufvbfpoz\"jno"
"dtw"
"xlolvtahvgqkx\\dgnhj\\spsclpcxv\\"
"mxea\\mbjpi"
"lgbotkk\"zmxh\\\\qji\"jszulnjsxkqf"
"lwckmhwhx\"gmftlb\x91am"
"xxdxqyxth"
"\"lmqhwkjxmvayxy"
"tf"
"qy"
"wdqmwxdztax\"m\"\x09\x11xdxmfwxmtqgwvf"
"\xcbnazlf\"ghziknszmsrahaf"
"e\x6aupmzhxlvwympgjjpdvo\"kylfa"
"\x81vhtlillb\xactgoatva"
"dvnlgr"
"f"
"xg\xfacwizsadgeclm"
"vnnrzbtw\"\\prod\\djbyppngwayy\""
"lrt\xf4jahwvfz"
"aqpnjtom\"ymkak\\dadfybqrso\\fwv"
"gz\"aac\"mrbk\"ktommrojraqh"
"wycamwoecsftepfnlcdkm"
"nrhddblbuzlqsl\x9cben"
"vckxhyqkmqmdseazcykrbysm"
"sil\xbbtevmt\"gvrvybui\"faw\"j"
"cjex\\tp\x45pzf"
"asjobvtxszfodgf\"ibftg"
"gkyjyjdrxdcllnh\"sjcibenrdnxv"
"oswsdpjyxpbwnqbcpl\"yrdvs\\zq"
"\"\"tyowzc\\fycbp\"jbwrbvgui"
"cbpcabqkdgzmpgcwjtrchxp"
"iyrzfh\x45gw\"fdlfpiaap\x31xqq"
"evgksznidz"
"b\\w\\"
"loufizbiy\x57aim\"bgk"
"qjfyk"
"g\"anmloghvgr\x07zwqougqhdz"
"usbbmwcxd\\bdgg"
"htitqcpczml"
"eke\\cqvpexqqk\"to\"tqmljrpn\xe6lji\""
"g\xd2ifdsej"
"h\"sk\"haajajpagtcqnzrfqn\xe6btzo"
"wfkuffdxlvm\\cvlyzlbyunclhmpp"
"myaavh\"spue"
"hqvez\x68d\"eo\"eaioh"
"s\"qd\"oyxxcglcdnuhk"
"ilqvar"
"srh"
"puuifxrfmpc\"bvalwi\x2blu\\"
"yywlbutufzysbncw\\nqsfbhpz\"mngjq"
"zbl\\jfcuop"
"hjdouiragzvxsqkreup\\"
"qi"
"ckx\\funlj\xa7ahi"
"k"
"ufrcnh\"ajteit"
"cqv\"bgjozjj\x60x\xa8yhvmdvutchjotyuz"
"hkuiet\"oku\x8cfhumfpasl"
"\"\\sbe\x4d"
"vhknazqt"
"eyyizvzcahgflvmoowvs\\jhvygci"
"kki\x3ewcefkgtjap\"xtpxh\"lzepoqj"
"wvtk"
"\"ynet"
"zh\\obk\"otagx\x59txfzf"
"ocowhxlx\xe6zqg\x63wx\\tclkhq\\vmaze"
"w\"cf"
"qpniprnrzrnvykghqnalr"
"jctcqra\"\x05dhlydpqamorqjsijt\\xjdgt"
"sig"
"qhlbidbflwxe\"xljbwls\x20vht"
"irmrebfla\xefsg\"j"
"nep"
"hjuvsqlizeqobepf"
"guzbcdp\"obyh"
"\"mjagins\xf9tqykaxy\""
"knvsdnmtr\"zervsb"
"hzuy"
"zza\"k\"buapb\\elm\xfeya"
"lrqar\"dfqwkaaqifig\"uixjsz"
"\"azuo\x40rmnlhhluwsbbdb\x32pk\\yu\"pbcf"
"dplkdyty"
"rfoyciebwlwphcycmguc"
"ivnmmiemhgytmlprq\\eh"
"lhkyzaaothfdhmbpsqd\\yyw"
"tnlzifupcjcaj"
"\\qiyirsdrfpmu\\\x15xusifaag"
"\\lcomf\\s"
"uramjivcirjhqcqcg"
"kkbaklbxfxikffnuhtu\xc6t\"d"
"n\xefai"
"\"toy\"bnbpevuzoc\"muywq\"gz\"grbm"
"\"muu\\wt"
"\\srby\"ee"
"erf\"gvw\"swfppf"
"pbqcgtn\"iuianhcdazfvmidn\\nslhxdf"
"uxbp"
"up\\mgrcyaegiwmjufn"
"nulscgcewj\\dvoyvhetdegzhs\""
"masv\"k\\rzrb"
"qtx\x79d\"xdxmbxrvhj"
"fid\\otpkgjlh\"qgsvexrckqtn\xf4"
"tagzu"
"bvl\\\"noseec"
"\\xgicuuh"
"w\"a\"npemf"
"sxp"
"nsmpktic\x8awxftscdcvijjobnq\"gjd"
"uks\"\"jxvyvfezz\"aynxoev\"cuoav"
"m"
"lkvokj"
"vkfam\"yllr\"q\x92o\x4ebecnvhshhqe\\"
"efdxcjkjverw"
"lmqzadwhfdgmep\x02tzfcbgrbfekhat"
"cpbk\x9azqegbpluczssouop\x36ztpuoxsw"
"cqwoczxdd\"erdjka"
"cwvqnjgbw\\fxdlby"
"mvtm"
"lt\"bbqzpumplkg"
"ntd\xeeuwweucnuuslqfzfq"
"y\xabl\"dbebxjrlbmuoo\\\x1au"
"qjoqx\\a"
"pu\"ekdnfpmly\xbago\""
"fjhhdy"
"arl"
"xcywisim\"bwuwf\"\"raepeawwjub"
"pbe"
"dbnqfpzyaumxtqnd\xc5dcqrkwyop"
"ojv\x40vtkwgkqepm\x8bzft\\vedrry"
"wggqkfbwqumsgajqwphjec\"mstxpwz"
"zjkbem"
"icpfqxbelxazlls"
"pvpqs\\abcmtyielugfgcv\"tjxapxqxnx"
"oqddwlvmtv\"\x39lyybylfb\"jmngnpjrdw"
"gisgbve"
"\"aglg"
"y\"\"ss\xafvhxlrjv"
"qbgqjsra"
"ihshbjgqpdcljpmdwdprwloy"
"djja\\wcdn\"svkrgpqn\"uz\"hc\x43hj"
"cbjm"
"pnn"
"pqvh\"noh"
"\"\\fdktlp"
"ncea"
"pqgzphiyy"
"\xbedovhxuipaohlcvkwtxwmpz\"ckaif\"r"
"arjuzbjowqciunfwgxtph\"vlhy\"n"
"c"
"nrpdxunulgudqzlhtae"
"iefheu\"uru\""
"aqijysxuijud\"np\\opbichhudil\xbesum"
"pfpevmtstl\"lde\"bzr\"vspdxs"
"vparfbdjwvzsocpnzhp"
"g\x4ffxaarafrsjthq\\\xc1rw"
"ng\\rqx\\gwpzucbh\xafl"
"rw\"nf\\dna"
"jkkeahxurxla\\g\xb3czrlsyimmwcwthr"
"twaailoypu\"oas\"kpuuyedlaw\\\xb0vzt"
"hznex\\gdiqvtugi"
"imdibsunjeswhk"
"ta\\icileuzpxro\"cfmv\"mzp"
"coykr\x57luiysucfaflmilhlehmvzeiepo"
"u\x3dfh\xd4yt"
"piw\x1bz\"eowy\"vfk\"wqiekw"
"gan\"y"
"p\"bevidoazcznr\"hddxuuq\""
"bwzucczznutbxe"
"z\"viqgyqjisior\\iecosmjbknol"
"dmlpcglcfkfsctxydjvayhymv\x3c\\gp"
"bfvkqrintbbvgfv"
"xlzntrgdck\"cprc\xadczyarbznqmuhxyuh"
"uqdxnuwioc\"kdytxq\\ig"
"xrafmucpmfi"
"vr\"hltmfrge"
"eonf\"nt\\wtcnsocs"
"j\xb7xoslyjeyjksplkqixncgkylkw"
"njw\"pefgfbez\x9axshdmplxzquqe"
"di\x58bvptfsafirpc"
"l\x1fkco"
"x"
"mprndo\"n"
"psegit"
"svbdnkkuuqs\"sqxu\"oqcyz\"aizashk"
"cwkljukxer\\\"\\nff\"esjwiyaoy"
"ilxrkgbjjxpvhdtq\"cpiuoofdnkpp"
"hlngi\"ulxep\\qohtmqnqjb\"rkgerho"
"gxws\"bcgm\"p"
"bv\"mds\\zhfusiepgrz\\b\x32fscdzz"
"l\xfampwtme\x69qvxnx\"\"\xc4jruuymjxrpsv"
"qqmxhrn"
"xziq\\\x18ybyv\x9am\"neacoqjzytertisysza"
"aqcbvlvcrzceeyx\\j\"\"x"
"yjuhhb"
"\x5em\"squulpy"
"dpbntplgmwb"
"utsgfkm\\vbftjknlktpthoeo"
"ccxjgiocmuhf\"ycnh"
"lltj\"kbbxi"

6
2015/eight/solution.py Normal file
View file

@ -0,0 +1,6 @@
import sys
with open("./input", "r") as file:
strings = file.read().split("\n")
x = 0

5
2015/five/example.input Normal file
View file

@ -0,0 +1,5 @@
jchzalrnumimnmhp
aaa
haegwjzuvuyypxyu
jchzalrnumimnmhp
dvszwmarrgswjxmb

4
2015/five/exmpl Normal file
View file

@ -0,0 +1,4 @@
qjhvhtzxzqqjkmpb
xxyxx
uurcxstgmygtbstg
ieodomkazucvgmuy

1000
2015/five/input Normal file

File diff suppressed because it is too large Load diff

28
2015/five/solution-2.py Normal file
View file

@ -0,0 +1,28 @@
with open("./exmpl", "r") as file:
strings = list(file.read().split("\n"))
niceStrings = []
#broken af
for string in strings:
lg = 0
appeared = False
for i in range(len(string)-1):
group = f"{list(string)[i]}{list(string)[i+1]}"
appearances = -1
for j in range(len(string)-1):
if f"{list(string)[j]}{list(string)[j+1]}" == group:
appearances += 1
print(f"group {group} found in {string} - number {appearances}")
if appearances > 0:
if list(string)[j-1] == list(string)[j]:
appeared = True
for i in range(len(string)-2):
if list(string)[i] == list(string)[i+2]:
lg += 1
if appeared and lg > 0:
niceStrings.append(string)
print(len(niceStrings))

28
2015/five/solution.py Normal file
View file

@ -0,0 +1,28 @@
vowels = ["a","e","i","o","u"]
groups = ["ab", "pq", "cd", "xy"]
with open("./input", "r") as file:
strings = list(file.read().split("\n"))
niceStrings = []
for string in strings:
n = 0
dl = False
notContains = True
for character in list(string):
if character in vowels:
n += 1
for i in range(len(string)-1):
if list(string)[i] == list(string)[i+1]:
dl = True
break
for group in groups:
if group in string:
notContains = False
break
if n >= 3 and dl and notContains:
niceStrings.append(string)
print(string, n, dl, notContains)
print(len(niceStrings))

11
2015/four/solution-2.py Normal file
View file

@ -0,0 +1,11 @@
import hashlib
key = "iwrupvqb"
found = False
i = 0
while not found:
result = hashlib.md5(bytes(key+str(i), 'utf-8')).hexdigest()
i += 1
if result[:6] == "000000":
found = True
print(i-1)

11
2015/four/solution.py Normal file
View file

@ -0,0 +1,11 @@
import hashlib
key = "iwrupvqb"
found = False
i = 0
while not found:
result = hashlib.md5(bytes(key+str(i), 'utf-8')).hexdigest()
i += 1
if result[:5] == "00000":
found = True
print(i-1)

1
2015/one/input.example Normal file

File diff suppressed because one or more lines are too long

16
2015/one/solution-2.py Normal file
View file

@ -0,0 +1,16 @@
n = 7000
f = 0
peb = 0
instructions = input()
ins = list(instructions)
for i in range(n):
if ins[i] == "(":
f += 1
else:
f -= 1
if f == -1:
pob = i;
break;
print(pob+1) # variables start from zero or sum shit

12
2015/one/solution.py Normal file
View file

@ -0,0 +1,12 @@
n = 7000
f = 0
instructions = input()
ins = list(instructions)
for i in range(n):
if ins[i] == "(":
f += 1
else:
f -= 1
print(f)

339
2015/seven/input Normal file
View file

@ -0,0 +1,339 @@
lf AND lq -> ls
iu RSHIFT 1 -> jn
bo OR bu -> bv
gj RSHIFT 1 -> hc
et RSHIFT 2 -> eu
bv AND bx -> by
is OR it -> iu
b OR n -> o
gf OR ge -> gg
NOT kt -> ku
ea AND eb -> ed
kl OR kr -> ks
hi AND hk -> hl
au AND av -> ax
lf RSHIFT 2 -> lg
dd RSHIFT 3 -> df
eu AND fa -> fc
df AND dg -> di
ip LSHIFT 15 -> it
NOT el -> em
et OR fe -> ff
fj LSHIFT 15 -> fn
t OR s -> u
ly OR lz -> ma
ko AND kq -> kr
NOT fx -> fy
et RSHIFT 1 -> fm
eu OR fa -> fb
dd RSHIFT 2 -> de
NOT go -> gp
kb AND kd -> ke
hg OR hh -> hi
jm LSHIFT 1 -> kg
NOT cn -> co
jp RSHIFT 2 -> jq
jp RSHIFT 5 -> js
1 AND io -> ip
eo LSHIFT 15 -> es
1 AND jj -> jk
g AND i -> j
ci RSHIFT 3 -> ck
gn AND gp -> gq
fs AND fu -> fv
lj AND ll -> lm
jk LSHIFT 15 -> jo
iu RSHIFT 3 -> iw
NOT ii -> ij
1 AND cc -> cd
bn RSHIFT 3 -> bp
NOT gw -> gx
NOT ft -> fu
jn OR jo -> jp
iv OR jb -> jc
hv OR hu -> hw
19138 -> b
gj RSHIFT 5 -> gm
hq AND hs -> ht
dy RSHIFT 1 -> er
ao OR an -> ap
ld OR le -> lf
bk LSHIFT 1 -> ce
bz AND cb -> cc
bi LSHIFT 15 -> bm
il AND in -> io
af AND ah -> ai
as RSHIFT 1 -> bl
lf RSHIFT 3 -> lh
er OR es -> et
NOT ax -> ay
ci RSHIFT 1 -> db
et AND fe -> fg
lg OR lm -> ln
k AND m -> n
hz RSHIFT 2 -> ia
kh LSHIFT 1 -> lb
NOT ey -> ez
NOT di -> dj
dz OR ef -> eg
lx -> a
NOT iz -> ja
gz LSHIFT 15 -> hd
ce OR cd -> cf
fq AND fr -> ft
at AND az -> bb
ha OR gz -> hb
fp AND fv -> fx
NOT gb -> gc
ia AND ig -> ii
gl OR gm -> gn
0 -> c
NOT ca -> cb
bn RSHIFT 1 -> cg
c LSHIFT 1 -> t
iw OR ix -> iy
kg OR kf -> kh
dy OR ej -> ek
km AND kn -> kp
NOT fc -> fd
hz RSHIFT 3 -> ib
NOT dq -> dr
NOT fg -> fh
dy RSHIFT 2 -> dz
kk RSHIFT 2 -> kl
1 AND fi -> fj
NOT hr -> hs
jp RSHIFT 1 -> ki
bl OR bm -> bn
1 AND gy -> gz
gr AND gt -> gu
db OR dc -> dd
de OR dk -> dl
as RSHIFT 5 -> av
lf RSHIFT 5 -> li
hm AND ho -> hp
cg OR ch -> ci
gj AND gu -> gw
ge LSHIFT 15 -> gi
e OR f -> g
fp OR fv -> fw
fb AND fd -> fe
cd LSHIFT 15 -> ch
b RSHIFT 1 -> v
at OR az -> ba
bn RSHIFT 2 -> bo
lh AND li -> lk
dl AND dn -> do
eg AND ei -> ej
ex AND ez -> fa
NOT kp -> kq
NOT lk -> ll
x AND ai -> ak
jp OR ka -> kb
NOT jd -> je
iy AND ja -> jb
jp RSHIFT 3 -> jr
fo OR fz -> ga
df OR dg -> dh
gj RSHIFT 2 -> gk
gj OR gu -> gv
NOT jh -> ji
ap LSHIFT 1 -> bj
NOT ls -> lt
ir LSHIFT 1 -> jl
bn AND by -> ca
lv LSHIFT 15 -> lz
ba AND bc -> bd
cy LSHIFT 15 -> dc
ln AND lp -> lq
x RSHIFT 1 -> aq
gk OR gq -> gr
NOT kx -> ky
jg AND ji -> jj
bn OR by -> bz
fl LSHIFT 1 -> gf
bp OR bq -> br
he OR hp -> hq
et RSHIFT 5 -> ew
iu RSHIFT 2 -> iv
gl AND gm -> go
x OR ai -> aj
hc OR hd -> he
lg AND lm -> lo
lh OR li -> lj
da LSHIFT 1 -> du
fo RSHIFT 2 -> fp
gk AND gq -> gs
bj OR bi -> bk
lf OR lq -> lr
cj AND cp -> cr
hu LSHIFT 15 -> hy
1 AND bh -> bi
fo RSHIFT 3 -> fq
NOT lo -> lp
hw LSHIFT 1 -> iq
dd RSHIFT 1 -> dw
dt LSHIFT 15 -> dx
dy AND ej -> el
an LSHIFT 15 -> ar
aq OR ar -> as
1 AND r -> s
fw AND fy -> fz
NOT im -> in
et RSHIFT 3 -> ev
1 AND ds -> dt
ec AND ee -> ef
NOT ak -> al
jl OR jk -> jm
1 AND en -> eo
lb OR la -> lc
iu AND jf -> jh
iu RSHIFT 5 -> ix
bo AND bu -> bw
cz OR cy -> da
iv AND jb -> jd
iw AND ix -> iz
lf RSHIFT 1 -> ly
iu OR jf -> jg
NOT dm -> dn
lw OR lv -> lx
gg LSHIFT 1 -> ha
lr AND lt -> lu
fm OR fn -> fo
he RSHIFT 3 -> hg
aj AND al -> am
1 AND kz -> la
dy RSHIFT 5 -> eb
jc AND je -> jf
cm AND co -> cp
gv AND gx -> gy
ev OR ew -> ex
jp AND ka -> kc
fk OR fj -> fl
dy RSHIFT 3 -> ea
NOT bs -> bt
NOT ag -> ah
dz AND ef -> eh
cf LSHIFT 1 -> cz
NOT cv -> cw
1 AND cx -> cy
de AND dk -> dm
ck AND cl -> cn
x RSHIFT 5 -> aa
dv LSHIFT 1 -> ep
he RSHIFT 2 -> hf
NOT bw -> bx
ck OR cl -> cm
bp AND bq -> bs
as OR bd -> be
he AND hp -> hr
ev AND ew -> ey
1 AND lu -> lv
kk RSHIFT 3 -> km
b AND n -> p
NOT kc -> kd
lc LSHIFT 1 -> lw
km OR kn -> ko
id AND if -> ig
ih AND ij -> ik
jr AND js -> ju
ci RSHIFT 5 -> cl
hz RSHIFT 1 -> is
1 AND ke -> kf
NOT gs -> gt
aw AND ay -> az
x RSHIFT 2 -> y
ab AND ad -> ae
ff AND fh -> fi
ci AND ct -> cv
eq LSHIFT 1 -> fk
gj RSHIFT 3 -> gl
u LSHIFT 1 -> ao
NOT bb -> bc
NOT hj -> hk
kw AND ky -> kz
as AND bd -> bf
dw OR dx -> dy
br AND bt -> bu
kk AND kv -> kx
ep OR eo -> eq
he RSHIFT 1 -> hx
ki OR kj -> kk
NOT ju -> jv
ek AND em -> en
kk RSHIFT 5 -> kn
NOT eh -> ei
hx OR hy -> hz
ea OR eb -> ec
s LSHIFT 15 -> w
fo RSHIFT 1 -> gh
kk OR kv -> kw
bn RSHIFT 5 -> bq
NOT ed -> ee
1 AND ht -> hu
cu AND cw -> cx
b RSHIFT 5 -> f
kl AND kr -> kt
iq OR ip -> ir
ci RSHIFT 2 -> cj
cj OR cp -> cq
o AND q -> r
dd RSHIFT 5 -> dg
b RSHIFT 2 -> d
ks AND ku -> kv
b RSHIFT 3 -> e
d OR j -> k
NOT p -> q
NOT cr -> cs
du OR dt -> dv
kf LSHIFT 15 -> kj
NOT ac -> ad
fo RSHIFT 5 -> fr
hz OR ik -> il
jx AND jz -> ka
gh OR gi -> gj
kk RSHIFT 1 -> ld
hz RSHIFT 5 -> ic
as RSHIFT 2 -> at
NOT jy -> jz
1 AND am -> an
ci OR ct -> cu
hg AND hh -> hj
jq OR jw -> jx
v OR w -> x
la LSHIFT 15 -> le
dh AND dj -> dk
dp AND dr -> ds
jq AND jw -> jy
au OR av -> aw
NOT bf -> bg
z OR aa -> ab
ga AND gc -> gd
hz AND ik -> im
jt AND jv -> jw
z AND aa -> ac
jr OR js -> jt
hb LSHIFT 1 -> hv
hf OR hl -> hm
ib OR ic -> id
fq OR fr -> fs
cq AND cs -> ct
ia OR ig -> ih
dd OR do -> dp
d AND j -> l
ib AND ic -> ie
as RSHIFT 3 -> au
be AND bg -> bh
dd AND do -> dq
NOT l -> m
1 AND gd -> ge
y AND ae -> ag
fo AND fz -> gb
NOT ie -> if
e AND f -> h
x RSHIFT 3 -> z
y OR ae -> af
hf AND hl -> hn
NOT h -> i
NOT hn -> ho
he RSHIFT 5 -> hh

8
2015/seven/input.example Normal file
View file

@ -0,0 +1,8 @@
123 -> x
456 -> y
x AND y -> d
x OR y -> e
x LSHIFT 2 -> f
y RSHIFT 2 -> g
NOT x -> h
NOT y -> i

115
2015/seven/solution.py Normal file
View file

@ -0,0 +1,115 @@
## broken btw #therewasanattempt
# 123 -> x - signal 123 provided to x
with open("./input", "r") as f:
instructions = f.read().split("\n")
wires = []
## get all wires or sum shit idk
for instruction in instructions:
alreadyFound = False
wireIdentifier = instruction.split(" -> ")[1].replace(" -> ", "")
if wires != []:
for wire in wires:
if wire["identifier"] == wireIdentifier:
alreadyFound = True
if not alreadyFound:
wires.append({"identifier": wireIdentifier, "signal": 0})
## ok now do the operations
for instruction in instructions:
if instruction != "":
if "AND" in instruction:
"""x AND y -> d"""
fi = instruction.split(" AND ")[0]
si = instruction.split(" AND ")[1].replace(" AND ", "").split(" -> ")[0]
di = instruction.split(" AND ")[1].replace(" AND ", "").split(" -> ")[1].replace(" -> ", "")
fv = 0
sv = 0
for wire in wires:
if wire['identifier'] == fi:
fv = wire['signal']
elif wire['identifier'] == si:
sv = wire['signal']
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = fv & sv
print(wire, fi,si,fv,sv, "INSTRUCTION TYPE AND")
elif "OR" in instruction:
"""x OR y -> e"""
fi = instruction.split(" OR ")[0]
si = instruction.split(" OR ")[1].replace(" OR ", "").split(" -> ")[0]
di = instruction.split(" OR ")[1].replace(" OR ", "").split(" -> ")[1].replace(" -> ", "")
fv = 0
sv = 0
for wire in wires:
if wire['identifier'] == fi:
fv = wire['signal']
elif wire['identifier'] == si:
sv = wire['signal']
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = fv | sv
print(wire, fi,si,fv,sv, "INSTRUCTION TYPE OR")
elif "LSHIFT" in instruction:
"""x RSHIFT [ammount] -> e"""
fi = instruction.split(" LSHIFT ")[0]
ammount = instruction.split(" LSHIFT ")[1].replace(" LSHIFT ", "").split(" -> ")[0]
di = instruction.split(" LSHIFT ")[1].replace(" LSHIFT ", "").split(" -> ")[1].replace(" -> ", "")
fv = 0
for wire in wires:
if wire['identifier'] == fi:
fv = wire['signal']
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = fv << int(ammount)
print(wire, fi,si,fv,sv, "INSTRUCTION TYPE RSHIFT")
elif "RSHIFT" in instruction:
"""x RSHIFT [ammount] -> e"""
fi = instruction.split(" RSHIFT ")[0]
ammount = instruction.split(" RSHIFT ")[1].replace(" RSHIFT ", "").split(" -> ")[0]
di = instruction.split(" RSHIFT ")[1].replace(" RSHIFT ", "").split(" -> ")[1].replace(" -> ", "")
fv = 0
for wire in wires:
if wire['identifier'] == fi:
fv = wire['signal']
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = fv >> int(ammount)
print(wire, fi,si,fv,sv, "INSTRUCTION TYPE RSHIFT")
elif "NOT" in instruction:
"""NOT x -> h"""
wi = instruction.replace("NOT ", "").split(" ->")[0]
di = instruction.replace("NOT ", "").split(" ->")[1].replace(" -> ", "")
wv = 0
for wire in wires:
if wire['identifier'] == wi:
wv = wire['signal']
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = ~wv
print(wire, fi,si,vw, "INSTRUCTION TYPE NOT")
else:
"""123 -> x"""
if not instruction.split(" -> ")[0].isdigit:
value = int(instruction.split(" -> ")[0])
di = instruction.split(" -> ")[1].replace(" -> ", "")
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = value
print(wire, value, "INSTRUCTION TYPE SET")
else:
wi = instruction.split(" -> ")[0]
value = 0
for wire in wires:
if wire['identifier'] == wi:
value = wire['signal']
di = instruction.split(" -> ")[1].replace(" -> ", "")
for wire in wires:
if wire['identifier'] == di:
wire['signal'] = value
print(wire, value, "INSTRUCTION TYPE SET")
for wire in wires:
if wire['identifier'] == "a":
print(wire['signal'])

300
2015/six/input Normal file
View file

@ -0,0 +1,300 @@
turn on 489,959 through 759,964
turn off 820,516 through 871,914
turn off 427,423 through 929,502
turn on 774,14 through 977,877
turn on 410,146 through 864,337
turn on 931,331 through 939,812
turn off 756,53 through 923,339
turn off 313,787 through 545,979
turn off 12,823 through 102,934
toggle 756,965 through 812,992
turn off 743,684 through 789,958
toggle 120,314 through 745,489
toggle 692,845 through 866,994
turn off 587,176 through 850,273
turn off 674,321 through 793,388
toggle 749,672 through 973,965
turn on 943,30 through 990,907
turn on 296,50 through 729,664
turn on 212,957 through 490,987
toggle 171,31 through 688,88
turn off 991,989 through 994,998
turn off 913,943 through 958,953
turn off 278,258 through 367,386
toggle 275,796 through 493,971
turn off 70,873 through 798,923
toggle 258,985 through 663,998
turn on 601,259 through 831,486
turn off 914,94 through 941,102
turn off 558,161 through 994,647
turn on 119,662 through 760,838
toggle 378,775 through 526,852
turn off 384,670 through 674,972
turn off 249,41 through 270,936
turn on 614,742 through 769,780
turn on 427,70 through 575,441
turn on 410,478 through 985,753
turn off 619,46 through 931,342
turn on 284,55 through 768,922
turn off 40,592 through 728,685
turn on 825,291 through 956,950
turn on 147,843 through 592,909
turn off 218,675 through 972,911
toggle 249,291 through 350,960
turn off 556,80 through 967,675
toggle 609,148 through 968,279
toggle 217,605 through 961,862
toggle 407,177 through 548,910
toggle 400,936 through 599,938
turn off 721,101 through 925,455
turn on 268,631 through 735,814
toggle 549,969 through 612,991
toggle 553,268 through 689,432
turn off 817,668 through 889,897
toggle 801,544 through 858,556
toggle 615,729 through 832,951
turn off 427,477 through 958,948
turn on 164,49 through 852,946
turn on 542,449 through 774,776
turn off 923,196 through 980,446
toggle 90,310 through 718,846
turn off 657,215 through 744,252
turn off 800,239 through 811,712
turn on 502,90 through 619,760
toggle 649,512 through 862,844
turn off 334,903 through 823,935
turn off 630,233 through 839,445
turn on 713,67 through 839,865
turn on 932,50 through 982,411
turn off 480,729 through 984,910
turn on 100,219 through 796,395
turn on 758,108 through 850,950
turn off 427,276 through 439,938
turn on 178,284 through 670,536
toggle 540,27 through 625,102
turn off 906,722 through 936,948
toggle 345,418 through 859,627
toggle 175,775 through 580,781
toggle 863,28 through 929,735
turn off 824,858 through 905,973
toggle 752,312 through 863,425
turn on 985,716 through 988,852
turn off 68,504 through 763,745
toggle 76,209 through 810,720
turn off 657,607 through 676,664
toggle 596,869 through 896,921
turn off 915,411 through 968,945
turn off 368,39 through 902,986
turn on 11,549 through 393,597
turn off 842,893 through 976,911
toggle 274,106 through 581,329
toggle 406,403 through 780,950
toggle 408,988 through 500,994
toggle 217,73 through 826,951
turn on 917,872 through 961,911
toggle 394,34 through 510,572
toggle 424,603 through 583,626
toggle 106,159 through 755,738
turn off 244,610 through 472,709
turn on 350,265 through 884,690
turn on 688,184 through 928,280
toggle 279,443 through 720,797
turn off 615,493 through 888,610
toggle 118,413 through 736,632
turn on 798,782 through 829,813
turn off 250,934 through 442,972
turn on 68,503 through 400,949
toggle 297,482 through 313,871
toggle 710,3 through 839,859
turn on 125,300 through 546,888
toggle 482,39 through 584,159
turn off 536,89 through 765,962
turn on 530,518 through 843,676
turn on 994,467 through 994,676
turn on 623,628 through 744,927
toggle 704,912 through 837,983
turn on 154,364 through 517,412
toggle 344,409 through 780,524
turn off 578,740 through 725,879
turn on 251,933 through 632,957
turn on 827,705 through 971,789
toggle 191,282 through 470,929
toggle 324,525 through 446,867
toggle 534,343 through 874,971
toggle 550,650 through 633,980
toggle 837,404 through 881,915
toggle 338,881 through 845,905
turn on 469,462 through 750,696
turn on 741,703 through 892,870
turn off 570,215 through 733,562
turn on 445,576 through 870,775
turn on 466,747 through 554,878
turn off 820,453 through 868,712
turn off 892,706 through 938,792
turn off 300,238 through 894,746
turn off 306,44 through 457,444
turn off 912,569 through 967,963
toggle 109,756 through 297,867
turn on 37,546 through 41,951
turn on 321,637 through 790,910
toggle 66,50 through 579,301
toggle 933,221 through 933,791
turn on 486,676 through 878,797
turn on 417,231 through 556,317
toggle 904,468 through 981,873
turn on 417,675 through 749,712
turn on 692,371 through 821,842
toggle 324,73 through 830,543
turn on 912,490 through 977,757
turn off 634,872 through 902,949
toggle 266,779 through 870,798
turn on 772,982 through 990,996
turn off 607,46 through 798,559
turn on 295,602 through 963,987
turn on 657,86 through 944,742
turn off 334,639 through 456,821
turn off 997,667 through 997,670
turn off 725,832 through 951,945
turn off 30,120 through 952,984
turn on 860,965 through 917,976
toggle 471,997 through 840,998
turn off 319,307 through 928,504
toggle 823,631 through 940,908
toggle 969,984 through 981,993
turn off 691,319 through 865,954
toggle 911,926 through 938,929
turn on 953,937 through 968,991
toggle 914,643 through 975,840
turn on 266,982 through 436,996
turn off 101,896 through 321,932
turn off 193,852 through 751,885
turn off 576,532 through 863,684
turn on 761,456 through 940,783
turn on 20,290 through 398,933
turn off 435,335 through 644,652
turn on 830,569 through 905,770
turn off 630,517 through 905,654
turn on 664,53 through 886,976
toggle 275,416 through 408,719
turn on 370,621 through 515,793
turn on 483,373 through 654,749
turn on 656,786 through 847,928
turn off 532,752 through 945,974
toggle 301,150 through 880,792
turn off 951,488 through 958,952
turn on 207,729 through 882,828
toggle 694,532 through 973,961
toggle 676,639 through 891,802
turn off 653,6 through 905,519
toggle 391,109 through 418,312
turn on 877,423 through 957,932
turn on 340,145 through 563,522
turn off 978,467 through 988,895
turn off 396,418 through 420,885
turn off 31,308 through 816,316
turn on 107,675 through 758,824
turn on 61,82 through 789,876
turn on 750,743 through 754,760
toggle 88,733 through 736,968
turn off 754,349 through 849,897
toggle 157,50 through 975,781
turn off 230,231 through 865,842
turn off 516,317 through 630,329
turn off 697,820 through 829,903
turn on 218,250 through 271,732
toggle 56,167 through 404,431
toggle 626,891 through 680,927
toggle 370,207 through 791,514
toggle 860,74 through 949,888
turn on 416,527 through 616,541
turn off 745,449 through 786,908
turn on 485,554 through 689,689
turn on 586,62 through 693,141
toggle 506,759 through 768,829
turn on 473,109 through 929,166
turn on 760,617 through 773,789
toggle 595,683 through 618,789
turn off 210,775 through 825,972
toggle 12,426 through 179,982
turn on 774,539 through 778,786
turn on 102,498 through 121,807
turn off 706,897 through 834,965
turn off 678,529 through 824,627
turn on 7,765 through 615,870
turn off 730,872 through 974,943
turn off 595,626 through 836,711
turn off 215,424 through 841,959
toggle 341,780 through 861,813
toggle 507,503 through 568,822
turn on 252,603 through 349,655
toggle 93,521 through 154,834
turn on 565,682 through 951,954
turn on 544,318 through 703,418
toggle 756,953 through 891,964
turn on 531,123 through 856,991
turn on 148,315 through 776,559
turn off 925,835 through 963,971
turn on 895,944 through 967,964
turn off 102,527 through 650,747
toggle 626,105 through 738,720
turn off 160,75 through 384,922
toggle 813,724 through 903,941
turn on 207,107 through 982,849
toggle 750,505 through 961,697
toggle 105,410 through 885,819
turn on 226,104 through 298,283
turn off 224,604 through 508,762
turn on 477,368 through 523,506
turn off 477,901 through 627,936
turn off 887,131 through 889,670
turn on 896,994 through 938,999
toggle 401,580 through 493,728
toggle 987,184 through 991,205
turn on 821,643 through 882,674
toggle 784,940 through 968,959
turn off 251,293 through 274,632
turn off 339,840 through 341,844
turn off 675,351 through 675,836
toggle 918,857 through 944,886
toggle 70,253 through 918,736
turn off 612,604 through 772,680
turn off 277,40 through 828,348
toggle 692,139 through 698,880
toggle 124,446 through 883,453
toggle 969,932 through 990,945
toggle 855,692 through 993,693
toggle 722,472 through 887,899
toggle 978,149 through 985,442
toggle 837,540 through 916,889
turn off 612,2 through 835,82
toggle 560,767 through 878,856
turn on 461,734 through 524,991
toggle 206,824 through 976,912
turn on 826,610 through 879,892
turn on 577,699 through 956,933
turn off 9,250 through 50,529
turn off 77,657 through 817,677
turn on 68,419 through 86,426
turn on 991,720 through 992,784
turn on 668,20 through 935,470
turn off 133,418 through 613,458
turn off 487,286 through 540,328
toggle 247,874 through 840,955
toggle 301,808 through 754,970
turn off 34,194 through 578,203
turn off 451,49 through 492,921
turn on 907,256 through 912,737
turn off 479,305 through 702,587
turn on 545,583 through 732,749
toggle 11,16 through 725,868
turn on 965,343 through 986,908
turn on 674,953 through 820,965
toggle 398,147 through 504,583
turn off 778,194 through 898,298
turn on 179,140 through 350,852
turn off 241,118 through 530,832
turn off 41,447 through 932,737
turn off 820,663 through 832,982
turn on 550,460 through 964,782
turn on 31,760 through 655,892
toggle 628,958 through 811,992

62
2015/six/solution-2.py Normal file
View file

@ -0,0 +1,62 @@
with open("./input", "r") as file:
toPrase = list(file.read().split("\n"))
pol = 0
leds = []
for i in range(999 * 999):
leds.append(0)
crt = 1
for command in toPrase:
if command != "":
cmdType = 0 #0 = turn on // 1 = turn off // 2 = toggle
"""turn on x1,y1 through x2,y2"""
if command.startswith("turn on"):
cmdType = 0
crtcmd = command.replace("turn on ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
if command.startswith("turn off"):
cmdType = 1
crtcmd = command.replace("turn off ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
if command.startswith("toggle"):
cmdType = 2
crtcmd = command.replace("toggle ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
for x in range(x1-1, x2):
for y in range(y1-1, y2):
index = 1000 * x + y+1
if cmdType == 0:
leds[index] += 1
if cmdType == 1:
if leds[index] <= 1:
leds[index] = 0
else:
leds[index] -= 1
if cmdType == 2:
leds[index] += 2
print(f"succesfully parsed command \"{command}\" ({crt}/{len(toPrase)})")
crt += 1
for led in leds:
pol += led
print(pol)

63
2015/six/solution.py Normal file
View file

@ -0,0 +1,63 @@
with open("./input", "r") as file:
toPrase = list(file.read().split("\n"))
pol = 0
leds = []
for i in range(999 * 999):
leds.append(0)
crt = 1
for command in toPrase:
if command != "":
cmdType = 0 #0 = turn on // 1 = turn off // 2 = toggle
"""turn on x1,y1 through x2,y2"""
if command.startswith("turn on"):
cmdType = 0
crtcmd = command.replace("turn on ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
if command.startswith("turn off"):
cmdType = 1
crtcmd = command.replace("turn off ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
if command.startswith("toggle"):
cmdType = 2
crtcmd = command.replace("toggle ", "")
start = crtcmd.split(" through ")[0]
end = crtcmd.split(" through ")[1].replace(" through ", "")
x1 = int(start.split(",")[0])
y1 = int(start.split(",")[1])
x2 = int(end.split(",")[0])
y2 = int(end.split(",")[1])
for x in range(x1-1, x2):
for y in range(y1-1, y2):
index = 1000 * x + y+1
if cmdType == 0:
leds[index] = 1
if cmdType == 1:
leds[index] = 0
if cmdType == 2:
if leds[index] == 0:
leds[index] = 1
elif leds[index] == 1:
leds[index] = 0
print(f"succesfully parsed command \"{command}\" ({crt}/{len(toPrase)})")
crt += 1
for led in leds:
if led == 1:
pol += 1
print(pol)

1
2015/three/example Normal file
View file

@ -0,0 +1 @@
^v^v^v^v^v

1
2015/three/input Normal file

File diff suppressed because one or more lines are too long

33
2015/three/solution-2.py Normal file
View file

@ -0,0 +1,33 @@
with open("./input", "r") as f:
instructions = list(f.read())
cursor1 = [0,0]
cursor2 = [0,0]
houses = []
turn = 0
# turn 0 is santa, turn 1 is robosanta
for instruction in instructions:
if turn == 0:
if instruction == "^":
cursor1[0] += 1
if instruction == "v":
cursor1[0] -= 1
if instruction == ">":
cursor1[1] += 1
if instruction == "<":
cursor1[1] -= 1
houses.append(f"{cursor1[0]},{cursor1[1]};")
print("(*)" + str(cursor1))
turn = 1
else:
if instruction == "^":
cursor2[0] += 1
if instruction == "v":
cursor2[0] -= 1
if instruction == ">":
cursor2[1] += 1
if instruction == "<":
cursor2[1] -= 1
print("(-) " + str(cursor2))
houses.append(f"{cursor2[0]},{cursor2[1]};")
turn = 0
print(len(set(houses)))

17
2015/three/solution.py Normal file
View file

@ -0,0 +1,17 @@
with open("./input", "r") as f:
instructions = list(f.read())
cursor = [0,0]
houses = []
for instruction in instructions:
if instruction == "^":
cursor[0] += 1
if instruction == "v":
cursor[0] -= 1
if instruction == ">":
cursor[1] += 1
if instruction == "<":
cursor[1] -= 1
houses.append(f"{cursor[0]},{cursor[1]};")
print(houses)
print(len(set(houses)))

2
2015/two/example2.input Normal file
View file

@ -0,0 +1,2 @@
1x1x10
2x3x4

1000
2015/two/input Normal file

File diff suppressed because it is too large Load diff

3
2015/two/input.example Normal file
View file

@ -0,0 +1,3 @@
29x13x26
11x11x14
27x2x5

22
2015/two/solution-2.py Normal file
View file

@ -0,0 +1,22 @@
total = 0
with open("./input", "r") as f:
file = f.read()
inputs = file.split("\n")
for i in range(len(inputs)-1):
sides = inputs[i].split("x")
smallestside = 100000
for j in range(len(sides)):
sides[j] = int(sides[j].replace("x", ""))
perimeters = [sides[0]*2 + sides[1]*2, sides[1]*2 + 2*sides[2], 2*sides[2] + 2*sides[0]]
for j in range(len(perimeters)):
if perimeters[j] < smallestside:
smallestside = perimeters[j]
print(sides)
print(2*sides[0] + 2*sides[1])
print(sides[0]*sides[1]*sides[2])
total += smallestside + sides[0]*sides[1]*sides[2]
print(total)

19
2015/two/solution.py Normal file
View file

@ -0,0 +1,19 @@
total = 0
with open("./input", "r") as f:
file = f.read()
inputs = file.split("\n")
for i in range(len(inputs)-1):
sides = inputs[i].split("x")
smallestside = 1000
for j in range(len(sides)):
sides[j] = int(sides[j].replace("x", ""))
areas = [sides[0]*sides[1], sides[1]*sides[2], sides[2]*sides[0]]
for j in range(len(areas)):
if areas[j] < smallestside:
smallestside = areas[j]
print(sides)
print(smallestside)
total += 2*sides[0]*sides[1] + 2*sides[1]*sides[2] + 2*sides[2]*sides[0] + smallestside
print(total)

1
2016/one/input Normal file
View file

@ -0,0 +1 @@
R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1, R5, R1, L5, R2, L2, L4, R3, L1, R4, L5, R4, R3, L5, L3, R4, R2, L5, L5, R2, R3, R5, R4, R2, R1, L1, L5, L2, L3, L4, L5, L4, L5, L1, R3, R4, R5, R3, L5, L4, L3, L1, L4, R2, R5, R5, R4, L2, L4, R3, R1, L2, R5, L5, R1, R1, L1, L5, L5, L2, L1, R5, R2, L4, L1, R4, R3, L3, R1, R5, L1, L4, R2, L3, R5, R3, R1, L3

3
2016/one/solution.rb Normal file
View file

@ -0,0 +1,3 @@
file = File.open("./input")
instructions = file.read().replace("\n").split(", ")
puts str(instructions)

28
2024/one/one-2.lua Normal file
View file

@ -0,0 +1,28 @@
a = {}
b = {}
s = {}
n = 1000
r = 0
for i=1,n*2 do
if i % 2 == 1 then
table.insert(a, io.read("*n"))
else
table.insert(b, io.read("*n"))
end
end
table.sort(a)
table.sort(b)
for i=1, n do
ap = 0
for j=1, n do
if a[i] == b[j] then
ap = ap + 1
end
end
r = r + ap*a[i]
end
print(r)

7
2024/one/one.example Normal file
View file

@ -0,0 +1,7 @@
3 4
4 3
2 5
1 3
3 9
3 3

1000
2024/one/one.input Normal file

File diff suppressed because it is too large Load diff

21
2024/one/one.lua Normal file
View file

@ -0,0 +1,21 @@
a = {}
b = {}
s = 0
n = 6
for i=1,n*2 do
if i % 2 == 1 then
table.insert(a, io.read("*n"))
else
table.insert(b, io.read("*n"))
end
end
table.sort(a)
table.sort(b)
for i=1, n do
s = s + math.abs(a[i] - b[i])
end
print(s)

7
2024/two/two.example Normal file
View file

@ -0,0 +1,7 @@
7 6 4 2 1
1 2 7 8 9
9 7 6 2 1
1 3 2 4 5
8 6 4 4 1
1 3 6 7 9

45
2024/two/two.lua Normal file
View file

@ -0,0 +1,45 @@
v = {}
n = 6
c = 0
for i = 1, n do
z = {}
for j = 1, 5 do
table.insert(z, io.read("*n"))
end
v[i] = z
end
for i = 1, n do
ci = 0
for j = 1, 4 do
if math.abs(v[i][j] - v[i][j+1]) > 3 then
ci = 1
end
end
sort1 = v[i]
table.sort(sort1)
sort2 = v[i]
table.sort(sort2, function(a,b) return a > b end)
x = 0
y = 0
for j = 1,5 do
if v[i][j] ~= sort1[j] then
x = 1
end
if v[i][j] ~= sort2[j] then
y = 1
end
end
if x == 1 or y == 1 then
c1 = 1
end
if ci == 0 then
c = c + 1
end
end
print(c)

121
copying.txt Normal file
View file

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

5
licence.txt Normal file
View file

@ -0,0 +1,5 @@
AOC SOLUTIONS
Written in 2025 by fzorb fzorb@fzorb.xyz
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.