From 67f1378e8a8694668f5732688d6bf1e81d3ba412 Mon Sep 17 00:00:00 2001 From: Benjamin Qi Date: Fri, 27 Dec 2019 18:41:02 -0500 Subject: [PATCH] graders, LICENSE, minor --- Contests/{grader.py3 => Graders/grader.py} | 59 ++++++-- Contests/{ => Graders}/grader.sh | 0 Contests/Graders/sub.py | 49 ++++++ .../BattleCode/2018/Attackable.java | 0 .../BattleCode/2018/CumSum.java | 0 .../BattleCode/2018/Globals.java | 0 .../BattleCode/2018/HealthComparator.java | 0 .../2018/MapLocationComparator.java | 0 .../BattleCode/2018/Movable.java | 0 .../BattleCode/2018/PiiComparator.java | 0 .../BattleCode/2018/Player.java | 0 .../BattleCode/2018/Structure.java | 0 .../BattleCode/2018/Test.java | 0 .../BattleCode/2018/UnitComparator.java | 0 .../BattleCode/2018/WorkerComparator.java | 0 .../BattleCode/2018/botHealer.java | 0 .../BattleCode/2018/botKnight.java | 0 .../BattleCode/2018/botMage.java | 0 .../BattleCode/2018/botRanger.java | 0 .../BattleCode/2018/botWorker.java | 0 .../BattleCode/2018/fastGC.java | 0 .../BattleCode/2018/genBFS.java | 0 .../BattleCode/2018/pii.java | 0 .../BattleCode/2018/run.bat | 0 .../BattleCode/2018/run.sh | 0 .../BattleCode/2018/structFactory.java | 0 .../BattleCode/2018/structRocket.java | 0 .../BattleCode/2019/Action2.java | 0 .../BattleCode/2019/Attackable.java | 0 .../BattleCode/2019/Building.java | 0 .../BattleCode/2019/Castle.java | 0 .../BattleCode/2019/Church.java | 0 .../BattleCode/2019/Consts.java | 0 .../BattleCode/2019/Crusader.java | 0 .../BattleCode/2019/Movable.java | 0 .../BattleCode/2019/MyRobot.java | 0 .../BattleCode/2019/Pilgrim.java | 0 .../BattleCode/2019/Preacher.java | 0 .../BattleCode/2019/Prophet.java | 0 .../BattleCode/2019/Robot2.java | 0 .../BattleCode/2019/bfsMap.java | 0 .../BattleCode/2019/moveMap.java | 0 .../BattleCode/2019/pi.java | 0 .../BattleCode/2019/safeMap.java | 0 .../BattleCode/2019/secretMap.java | 0 .../BattleCode/2019/unitCounter.java | 0 .../UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - mazes.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - perfect.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - shapes.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - squircle.cpp | 0 .../UCF HSPT/2016/UCF HSPT 16 - stacks.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - coins.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - dinner.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - elemental.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - lerps.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - multiply.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - optimal.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - unite.cpp | 0 .../UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp | 0 .../UCF HSPT/2018/colony.cpp | 0 .../UCF HSPT/2018/even.cpp | 0 .../UCF HSPT/2018/expansion.cpp | 0 .../UCF HSPT/2018/fire.cpp | 0 .../UCF HSPT/2018/fireworks.cpp | 0 .../UCF HSPT/2018/flooding.cpp | 0 .../UCF HSPT/2018/laptop.cpp | 0 .../UCF HSPT/2018/lights.cpp | 0 .../UCF HSPT/2018/nails.cpp | 0 .../UCF HSPT/2018/poker.cpp | 0 .../UCF HSPT/2018/slayer.cpp | 0 .../VT HSPC/2017/Coconut.cpp | 0 .../VT HSPC/2017/Code.cpp | 0 .../VT HSPC/2017/Criss-Cross.cpp | 0 .../VT HSPC/2017/Difficulty Order.md | 0 .../VT HSPC/2017/Monk.cpp | 0 .../VT HSPC/2017/Provinces.cpp | 0 .../VT HSPC/2017/RA Duty.cpp | 0 .../VT HSPC/2017/Saving.cpp | 0 .../VT HSPC/2017/Shiritori.cpp | 0 .../VT HSPC/2017/Stopcard.cpp | 0 .../VT HSPC/2017/Swish.cpp | 0 .../VT HSPC/2017/Through.cpp | 0 .../VT HSPC/2017/Weight.cpp | 0 .../1D Range Queries (9.2)/Treap (15.3).h | 4 +- .../content/graphs (12)/Misc/DirectedMST.h | 13 +- LICENSE | 142 +++++++++++++++--- 89 files changed, 224 insertions(+), 43 deletions(-) rename Contests/{grader.py3 => Graders/grader.py} (79%) rename Contests/{ => Graders}/grader.sh (100%) create mode 100644 Contests/Graders/sub.py rename Contests/{Other => Other Solutions}/BattleCode/2018/Attackable.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/CumSum.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/Globals.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/HealthComparator.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/MapLocationComparator.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/Movable.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/PiiComparator.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/Player.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/Structure.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/Test.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/UnitComparator.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/WorkerComparator.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/botHealer.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/botKnight.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/botMage.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/botRanger.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/botWorker.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/fastGC.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/genBFS.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/pii.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/run.bat (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/run.sh (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/structFactory.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2018/structRocket.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Action2.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Attackable.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Building.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Castle.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Church.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Consts.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Crusader.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Movable.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/MyRobot.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Pilgrim.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Preacher.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Prophet.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/Robot2.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/bfsMap.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/moveMap.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/pi.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/safeMap.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/secretMap.java (100%) rename Contests/{Other => Other Solutions}/BattleCode/2019/unitCounter.java (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - mazes.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - perfect.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - squircle.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2016/UCF HSPT 16 - stacks.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - coins.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - dinner.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - elemental.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - lerps.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - multiply.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - optimal.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - unite.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/colony.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/even.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/expansion.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/fire.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/fireworks.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/flooding.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/laptop.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/lights.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/nails.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/poker.cpp (100%) rename Contests/{Other => Other Solutions}/UCF HSPT/2018/slayer.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Coconut.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Code.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Criss-Cross.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Difficulty Order.md (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Monk.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Provinces.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/RA Duty.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Saving.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Shiritori.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Stopcard.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Swish.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Through.cpp (100%) rename Contests/{Other => Other Solutions}/VT HSPC/2017/Weight.cpp (100%) diff --git a/Contests/grader.py3 b/Contests/Graders/grader.py similarity index 79% rename from Contests/grader.py3 rename to Contests/Graders/grader.py index fa9a9d2d..b1cb12e6 100644 --- a/Contests/grader.py3 +++ b/Contests/Graders/grader.py @@ -6,11 +6,11 @@ from termcolor import colored # print in color + bold import getopt # command line -IN="I.$" # $ is replaced with file number +IN="$.in" # $ is replaced with file number OUT="O.$" TL=2 -CPP="g++ -std=c++11 -O2 -Wl,-stack_size -Wl,0x10000000 -w $.cpp -o $" +CPP="g++-9 -std=c++17 -O2 -Wl,-stack_size -Wl,0x10000000 -w $.cpp -o $" # C++, -w = suppress warnings def replace(x,y): # replace occurrences of $ in x with y @@ -32,7 +32,7 @@ def error(a,b): # min of absolute and relative error for two doubles def parse(output): # split output by spaces assert os.path.isfile(output), f'File "{output}" does not exist, cannot parse' output = list(open(output)) - output = " ".join(output).split(" ") + output = " ".join(output).split() return [i for i in output if i] def compile(x): # compile cpp file x @@ -169,7 +169,7 @@ def compare(f0,f1,inputF): return interpret(e1)+(t1,) return check(o0,o1)+((t0,t1),) -def COMPARE(f0,f1): +def COMPARE(f0,f1,wrong): print(cb(f"COMPARING CORRECT {f0}.cpp AGAINST {f1}.cpp","blue")) print() compile(f0), compile(f1) @@ -184,18 +184,29 @@ def COMPARE(f0,f1): if not os.path.isfile(inputF): break res,message,t = compare(f0,f1,inputF) - output(label,res,message,t) + if not wrong or res != 'A': + output(label,res,message,t) total = i if res == 'A': correct += 1 print() outputRes(correct,total) +def cppFiles(): + res = [] + for root, dirs, files in os.walk("."): + for filename in files: + if filename.endswith(".cpp"): + res.append(filename[:-4]) + return res + def main(): try: correct = None + start = None output = False - opts, args = getopt.getopt(sys.argv[1:], "ohc:t:", ["output","help","correct","time"]) + grade = False + opts, args = getopt.getopt(sys.argv[1:], "ohc:t:gs:", ["output","help","correct","time","grade","start"]) for option, value in opts: if option in ("-h", "--help"): print("This is the help section for this program.") @@ -203,11 +214,13 @@ def main(): print("Available options are:") print("\t -h --help: display help") print("\t -t --time: set time limit") + print("\t -s --start: set starting time (for grade)") print() print("Available commands are:") - print("\t 'python3 grader.py3 A': test if A.cpp produces correct output file for every input file") - print("\t 'python3 grader.py3 -o A': display output of A.cpp for every input file") - print("\t 'python3 grader.py3 -c B A': test if A.cpp produces same output as B.cpp for every input file") + print("\t 'python3 grader.py A': test if A.cpp produces correct output file for every input file") + print("\t 'python3 grader.py -o A': display output of A.cpp for every input file") + print("\t 'python3 grader.py -c B A': compare A.cpp against correct B.cpp for every input file") + print("\t 'python3 grader.py -g A': compare A.cpp against all submissions in folder") return if option in ("-t", "--time"): TL = float(value) @@ -215,14 +228,36 @@ def main(): correct = value if option in ("-o"): output = True + if option in ("-g"): + grade = True + if option in ("-s"): + start = value if len(args) != 1: raise ValueError("must have exactly one argument") + cnt = 0 + if grade: + cnt += 1 if correct: - if output: - raise ValueError("cannot have both -c and -o") + cnt += 1 + if output: + cnt += 1 + if cnt > 1: + raise ValueError("too many options") + + if grade: + subs = [] + for filename in cppFiles(): + if len(filename) >= 8 and filename[0:8].isdigit(): + subs.append(filename) + subs.sort() + for sub in subs: + if start and sub < start: + continue + COMPARE(args[0],sub,True) + elif correct: if correct == args[0]: raise ValueError("can't compare same prog against itself") - COMPARE(correct,args[0]) + COMPARE(correct,args[0],False) elif output: GETOUTPUT(args[0]) else: diff --git a/Contests/grader.sh b/Contests/Graders/grader.sh similarity index 100% rename from Contests/grader.sh rename to Contests/Graders/grader.sh diff --git a/Contests/Graders/sub.py b/Contests/Graders/sub.py new file mode 100644 index 00000000..607ce127 --- /dev/null +++ b/Contests/Graders/sub.py @@ -0,0 +1,49 @@ +# download CF submissions +# use with 'python3 grader.py -g ok' + +from bs4 import BeautifulSoup +import urllib.request +import sys +import time + +def parse(url): + page = urllib.request.urlopen(url) + return BeautifulSoup(page,'html.parser') + +sep='-'*50 +prefix="https://codeforces.com/contest/" +contest="1279" +prob="B" + +def subs(page): + url = prefix+contest+"/status/"+prob+"/page/"+page + soup = parse(url) + subs = soup.body.findAll('tr',attrs={'data-submission-id': True}) + L = [] + for s in subs: + L.append(s['data-submission-id']) + return L + +L = subs("1") +for sub in L: + url = prefix+contest+"/submission/"+sub + soup = parse(url) + table = soup.body.find('table') + cpp = None + cnt = 0 + for b in table.findAll('td'): + cnt += 1 + if cnt == 4: + lang = b.text.strip() + if 'C++' in lang: + prog = soup.body.find('pre',attrs={'id':"program-source-text"}) + name = sub+".cpp" + f = open(name, "w") + f.write(prog.text) + f.close() + print(sub+": "+lang+", OK") + if "%I64d" in open(name).read(): + print("warning: %I64d\n") + else: + print(sub+": "+lang+", NOT OK") + time.sleep(0.5) \ No newline at end of file diff --git a/Contests/Other/BattleCode/2018/Attackable.java b/Contests/Other Solutions/BattleCode/2018/Attackable.java similarity index 100% rename from Contests/Other/BattleCode/2018/Attackable.java rename to Contests/Other Solutions/BattleCode/2018/Attackable.java diff --git a/Contests/Other/BattleCode/2018/CumSum.java b/Contests/Other Solutions/BattleCode/2018/CumSum.java similarity index 100% rename from Contests/Other/BattleCode/2018/CumSum.java rename to Contests/Other Solutions/BattleCode/2018/CumSum.java diff --git a/Contests/Other/BattleCode/2018/Globals.java b/Contests/Other Solutions/BattleCode/2018/Globals.java similarity index 100% rename from Contests/Other/BattleCode/2018/Globals.java rename to Contests/Other Solutions/BattleCode/2018/Globals.java diff --git a/Contests/Other/BattleCode/2018/HealthComparator.java b/Contests/Other Solutions/BattleCode/2018/HealthComparator.java similarity index 100% rename from Contests/Other/BattleCode/2018/HealthComparator.java rename to Contests/Other Solutions/BattleCode/2018/HealthComparator.java diff --git a/Contests/Other/BattleCode/2018/MapLocationComparator.java b/Contests/Other Solutions/BattleCode/2018/MapLocationComparator.java similarity index 100% rename from Contests/Other/BattleCode/2018/MapLocationComparator.java rename to Contests/Other Solutions/BattleCode/2018/MapLocationComparator.java diff --git a/Contests/Other/BattleCode/2018/Movable.java b/Contests/Other Solutions/BattleCode/2018/Movable.java similarity index 100% rename from Contests/Other/BattleCode/2018/Movable.java rename to Contests/Other Solutions/BattleCode/2018/Movable.java diff --git a/Contests/Other/BattleCode/2018/PiiComparator.java b/Contests/Other Solutions/BattleCode/2018/PiiComparator.java similarity index 100% rename from Contests/Other/BattleCode/2018/PiiComparator.java rename to Contests/Other Solutions/BattleCode/2018/PiiComparator.java diff --git a/Contests/Other/BattleCode/2018/Player.java b/Contests/Other Solutions/BattleCode/2018/Player.java similarity index 100% rename from Contests/Other/BattleCode/2018/Player.java rename to Contests/Other Solutions/BattleCode/2018/Player.java diff --git a/Contests/Other/BattleCode/2018/Structure.java b/Contests/Other Solutions/BattleCode/2018/Structure.java similarity index 100% rename from Contests/Other/BattleCode/2018/Structure.java rename to Contests/Other Solutions/BattleCode/2018/Structure.java diff --git a/Contests/Other/BattleCode/2018/Test.java b/Contests/Other Solutions/BattleCode/2018/Test.java similarity index 100% rename from Contests/Other/BattleCode/2018/Test.java rename to Contests/Other Solutions/BattleCode/2018/Test.java diff --git a/Contests/Other/BattleCode/2018/UnitComparator.java b/Contests/Other Solutions/BattleCode/2018/UnitComparator.java similarity index 100% rename from Contests/Other/BattleCode/2018/UnitComparator.java rename to Contests/Other Solutions/BattleCode/2018/UnitComparator.java diff --git a/Contests/Other/BattleCode/2018/WorkerComparator.java b/Contests/Other Solutions/BattleCode/2018/WorkerComparator.java similarity index 100% rename from Contests/Other/BattleCode/2018/WorkerComparator.java rename to Contests/Other Solutions/BattleCode/2018/WorkerComparator.java diff --git a/Contests/Other/BattleCode/2018/botHealer.java b/Contests/Other Solutions/BattleCode/2018/botHealer.java similarity index 100% rename from Contests/Other/BattleCode/2018/botHealer.java rename to Contests/Other Solutions/BattleCode/2018/botHealer.java diff --git a/Contests/Other/BattleCode/2018/botKnight.java b/Contests/Other Solutions/BattleCode/2018/botKnight.java similarity index 100% rename from Contests/Other/BattleCode/2018/botKnight.java rename to Contests/Other Solutions/BattleCode/2018/botKnight.java diff --git a/Contests/Other/BattleCode/2018/botMage.java b/Contests/Other Solutions/BattleCode/2018/botMage.java similarity index 100% rename from Contests/Other/BattleCode/2018/botMage.java rename to Contests/Other Solutions/BattleCode/2018/botMage.java diff --git a/Contests/Other/BattleCode/2018/botRanger.java b/Contests/Other Solutions/BattleCode/2018/botRanger.java similarity index 100% rename from Contests/Other/BattleCode/2018/botRanger.java rename to Contests/Other Solutions/BattleCode/2018/botRanger.java diff --git a/Contests/Other/BattleCode/2018/botWorker.java b/Contests/Other Solutions/BattleCode/2018/botWorker.java similarity index 100% rename from Contests/Other/BattleCode/2018/botWorker.java rename to Contests/Other Solutions/BattleCode/2018/botWorker.java diff --git a/Contests/Other/BattleCode/2018/fastGC.java b/Contests/Other Solutions/BattleCode/2018/fastGC.java similarity index 100% rename from Contests/Other/BattleCode/2018/fastGC.java rename to Contests/Other Solutions/BattleCode/2018/fastGC.java diff --git a/Contests/Other/BattleCode/2018/genBFS.java b/Contests/Other Solutions/BattleCode/2018/genBFS.java similarity index 100% rename from Contests/Other/BattleCode/2018/genBFS.java rename to Contests/Other Solutions/BattleCode/2018/genBFS.java diff --git a/Contests/Other/BattleCode/2018/pii.java b/Contests/Other Solutions/BattleCode/2018/pii.java similarity index 100% rename from Contests/Other/BattleCode/2018/pii.java rename to Contests/Other Solutions/BattleCode/2018/pii.java diff --git a/Contests/Other/BattleCode/2018/run.bat b/Contests/Other Solutions/BattleCode/2018/run.bat similarity index 100% rename from Contests/Other/BattleCode/2018/run.bat rename to Contests/Other Solutions/BattleCode/2018/run.bat diff --git a/Contests/Other/BattleCode/2018/run.sh b/Contests/Other Solutions/BattleCode/2018/run.sh similarity index 100% rename from Contests/Other/BattleCode/2018/run.sh rename to Contests/Other Solutions/BattleCode/2018/run.sh diff --git a/Contests/Other/BattleCode/2018/structFactory.java b/Contests/Other Solutions/BattleCode/2018/structFactory.java similarity index 100% rename from Contests/Other/BattleCode/2018/structFactory.java rename to Contests/Other Solutions/BattleCode/2018/structFactory.java diff --git a/Contests/Other/BattleCode/2018/structRocket.java b/Contests/Other Solutions/BattleCode/2018/structRocket.java similarity index 100% rename from Contests/Other/BattleCode/2018/structRocket.java rename to Contests/Other Solutions/BattleCode/2018/structRocket.java diff --git a/Contests/Other/BattleCode/2019/Action2.java b/Contests/Other Solutions/BattleCode/2019/Action2.java similarity index 100% rename from Contests/Other/BattleCode/2019/Action2.java rename to Contests/Other Solutions/BattleCode/2019/Action2.java diff --git a/Contests/Other/BattleCode/2019/Attackable.java b/Contests/Other Solutions/BattleCode/2019/Attackable.java similarity index 100% rename from Contests/Other/BattleCode/2019/Attackable.java rename to Contests/Other Solutions/BattleCode/2019/Attackable.java diff --git a/Contests/Other/BattleCode/2019/Building.java b/Contests/Other Solutions/BattleCode/2019/Building.java similarity index 100% rename from Contests/Other/BattleCode/2019/Building.java rename to Contests/Other Solutions/BattleCode/2019/Building.java diff --git a/Contests/Other/BattleCode/2019/Castle.java b/Contests/Other Solutions/BattleCode/2019/Castle.java similarity index 100% rename from Contests/Other/BattleCode/2019/Castle.java rename to Contests/Other Solutions/BattleCode/2019/Castle.java diff --git a/Contests/Other/BattleCode/2019/Church.java b/Contests/Other Solutions/BattleCode/2019/Church.java similarity index 100% rename from Contests/Other/BattleCode/2019/Church.java rename to Contests/Other Solutions/BattleCode/2019/Church.java diff --git a/Contests/Other/BattleCode/2019/Consts.java b/Contests/Other Solutions/BattleCode/2019/Consts.java similarity index 100% rename from Contests/Other/BattleCode/2019/Consts.java rename to Contests/Other Solutions/BattleCode/2019/Consts.java diff --git a/Contests/Other/BattleCode/2019/Crusader.java b/Contests/Other Solutions/BattleCode/2019/Crusader.java similarity index 100% rename from Contests/Other/BattleCode/2019/Crusader.java rename to Contests/Other Solutions/BattleCode/2019/Crusader.java diff --git a/Contests/Other/BattleCode/2019/Movable.java b/Contests/Other Solutions/BattleCode/2019/Movable.java similarity index 100% rename from Contests/Other/BattleCode/2019/Movable.java rename to Contests/Other Solutions/BattleCode/2019/Movable.java diff --git a/Contests/Other/BattleCode/2019/MyRobot.java b/Contests/Other Solutions/BattleCode/2019/MyRobot.java similarity index 100% rename from Contests/Other/BattleCode/2019/MyRobot.java rename to Contests/Other Solutions/BattleCode/2019/MyRobot.java diff --git a/Contests/Other/BattleCode/2019/Pilgrim.java b/Contests/Other Solutions/BattleCode/2019/Pilgrim.java similarity index 100% rename from Contests/Other/BattleCode/2019/Pilgrim.java rename to Contests/Other Solutions/BattleCode/2019/Pilgrim.java diff --git a/Contests/Other/BattleCode/2019/Preacher.java b/Contests/Other Solutions/BattleCode/2019/Preacher.java similarity index 100% rename from Contests/Other/BattleCode/2019/Preacher.java rename to Contests/Other Solutions/BattleCode/2019/Preacher.java diff --git a/Contests/Other/BattleCode/2019/Prophet.java b/Contests/Other Solutions/BattleCode/2019/Prophet.java similarity index 100% rename from Contests/Other/BattleCode/2019/Prophet.java rename to Contests/Other Solutions/BattleCode/2019/Prophet.java diff --git a/Contests/Other/BattleCode/2019/Robot2.java b/Contests/Other Solutions/BattleCode/2019/Robot2.java similarity index 100% rename from Contests/Other/BattleCode/2019/Robot2.java rename to Contests/Other Solutions/BattleCode/2019/Robot2.java diff --git a/Contests/Other/BattleCode/2019/bfsMap.java b/Contests/Other Solutions/BattleCode/2019/bfsMap.java similarity index 100% rename from Contests/Other/BattleCode/2019/bfsMap.java rename to Contests/Other Solutions/BattleCode/2019/bfsMap.java diff --git a/Contests/Other/BattleCode/2019/moveMap.java b/Contests/Other Solutions/BattleCode/2019/moveMap.java similarity index 100% rename from Contests/Other/BattleCode/2019/moveMap.java rename to Contests/Other Solutions/BattleCode/2019/moveMap.java diff --git a/Contests/Other/BattleCode/2019/pi.java b/Contests/Other Solutions/BattleCode/2019/pi.java similarity index 100% rename from Contests/Other/BattleCode/2019/pi.java rename to Contests/Other Solutions/BattleCode/2019/pi.java diff --git a/Contests/Other/BattleCode/2019/safeMap.java b/Contests/Other Solutions/BattleCode/2019/safeMap.java similarity index 100% rename from Contests/Other/BattleCode/2019/safeMap.java rename to Contests/Other Solutions/BattleCode/2019/safeMap.java diff --git a/Contests/Other/BattleCode/2019/secretMap.java b/Contests/Other Solutions/BattleCode/2019/secretMap.java similarity index 100% rename from Contests/Other/BattleCode/2019/secretMap.java rename to Contests/Other Solutions/BattleCode/2019/secretMap.java diff --git a/Contests/Other/BattleCode/2019/unitCounter.java b/Contests/Other Solutions/BattleCode/2019/unitCounter.java similarity index 100% rename from Contests/Other/BattleCode/2019/unitCounter.java rename to Contests/Other Solutions/BattleCode/2019/unitCounter.java diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - hyenas.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - keyboard.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - mazes.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - mazes.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - mazes.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - mazes.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - perfect.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - perfect.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - perfect.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - perfect.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - sandwich.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - squircle.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - squircle.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - squircle.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - squircle.cpp diff --git a/Contests/Other/UCF HSPT/2016/UCF HSPT 16 - stacks.cpp b/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - stacks.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2016/UCF HSPT 16 - stacks.cpp rename to Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - stacks.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - coins.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - coins.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - coins.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - coins.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - dinner.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - dinner.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - dinner.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - dinner.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - elemental.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - elemental.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - elemental.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - elemental.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - lerps.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - lerps.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - lerps.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - lerps.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - multiply.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - multiply.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - multiply.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - multiply.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - optimal.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - optimal.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - optimal.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - optimal.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - unite.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - unite.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - unite.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - unite.cpp diff --git a/Contests/Other/UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp b/Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp rename to Contests/Other Solutions/UCF HSPT/2017/UCF HSPT 17 - wipeout.cpp diff --git a/Contests/Other/UCF HSPT/2018/colony.cpp b/Contests/Other Solutions/UCF HSPT/2018/colony.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/colony.cpp rename to Contests/Other Solutions/UCF HSPT/2018/colony.cpp diff --git a/Contests/Other/UCF HSPT/2018/even.cpp b/Contests/Other Solutions/UCF HSPT/2018/even.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/even.cpp rename to Contests/Other Solutions/UCF HSPT/2018/even.cpp diff --git a/Contests/Other/UCF HSPT/2018/expansion.cpp b/Contests/Other Solutions/UCF HSPT/2018/expansion.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/expansion.cpp rename to Contests/Other Solutions/UCF HSPT/2018/expansion.cpp diff --git a/Contests/Other/UCF HSPT/2018/fire.cpp b/Contests/Other Solutions/UCF HSPT/2018/fire.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/fire.cpp rename to Contests/Other Solutions/UCF HSPT/2018/fire.cpp diff --git a/Contests/Other/UCF HSPT/2018/fireworks.cpp b/Contests/Other Solutions/UCF HSPT/2018/fireworks.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/fireworks.cpp rename to Contests/Other Solutions/UCF HSPT/2018/fireworks.cpp diff --git a/Contests/Other/UCF HSPT/2018/flooding.cpp b/Contests/Other Solutions/UCF HSPT/2018/flooding.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/flooding.cpp rename to Contests/Other Solutions/UCF HSPT/2018/flooding.cpp diff --git a/Contests/Other/UCF HSPT/2018/laptop.cpp b/Contests/Other Solutions/UCF HSPT/2018/laptop.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/laptop.cpp rename to Contests/Other Solutions/UCF HSPT/2018/laptop.cpp diff --git a/Contests/Other/UCF HSPT/2018/lights.cpp b/Contests/Other Solutions/UCF HSPT/2018/lights.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/lights.cpp rename to Contests/Other Solutions/UCF HSPT/2018/lights.cpp diff --git a/Contests/Other/UCF HSPT/2018/nails.cpp b/Contests/Other Solutions/UCF HSPT/2018/nails.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/nails.cpp rename to Contests/Other Solutions/UCF HSPT/2018/nails.cpp diff --git a/Contests/Other/UCF HSPT/2018/poker.cpp b/Contests/Other Solutions/UCF HSPT/2018/poker.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/poker.cpp rename to Contests/Other Solutions/UCF HSPT/2018/poker.cpp diff --git a/Contests/Other/UCF HSPT/2018/slayer.cpp b/Contests/Other Solutions/UCF HSPT/2018/slayer.cpp similarity index 100% rename from Contests/Other/UCF HSPT/2018/slayer.cpp rename to Contests/Other Solutions/UCF HSPT/2018/slayer.cpp diff --git a/Contests/Other/VT HSPC/2017/Coconut.cpp b/Contests/Other Solutions/VT HSPC/2017/Coconut.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Coconut.cpp rename to Contests/Other Solutions/VT HSPC/2017/Coconut.cpp diff --git a/Contests/Other/VT HSPC/2017/Code.cpp b/Contests/Other Solutions/VT HSPC/2017/Code.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Code.cpp rename to Contests/Other Solutions/VT HSPC/2017/Code.cpp diff --git a/Contests/Other/VT HSPC/2017/Criss-Cross.cpp b/Contests/Other Solutions/VT HSPC/2017/Criss-Cross.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Criss-Cross.cpp rename to Contests/Other Solutions/VT HSPC/2017/Criss-Cross.cpp diff --git a/Contests/Other/VT HSPC/2017/Difficulty Order.md b/Contests/Other Solutions/VT HSPC/2017/Difficulty Order.md similarity index 100% rename from Contests/Other/VT HSPC/2017/Difficulty Order.md rename to Contests/Other Solutions/VT HSPC/2017/Difficulty Order.md diff --git a/Contests/Other/VT HSPC/2017/Monk.cpp b/Contests/Other Solutions/VT HSPC/2017/Monk.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Monk.cpp rename to Contests/Other Solutions/VT HSPC/2017/Monk.cpp diff --git a/Contests/Other/VT HSPC/2017/Provinces.cpp b/Contests/Other Solutions/VT HSPC/2017/Provinces.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Provinces.cpp rename to Contests/Other Solutions/VT HSPC/2017/Provinces.cpp diff --git a/Contests/Other/VT HSPC/2017/RA Duty.cpp b/Contests/Other Solutions/VT HSPC/2017/RA Duty.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/RA Duty.cpp rename to Contests/Other Solutions/VT HSPC/2017/RA Duty.cpp diff --git a/Contests/Other/VT HSPC/2017/Saving.cpp b/Contests/Other Solutions/VT HSPC/2017/Saving.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Saving.cpp rename to Contests/Other Solutions/VT HSPC/2017/Saving.cpp diff --git a/Contests/Other/VT HSPC/2017/Shiritori.cpp b/Contests/Other Solutions/VT HSPC/2017/Shiritori.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Shiritori.cpp rename to Contests/Other Solutions/VT HSPC/2017/Shiritori.cpp diff --git a/Contests/Other/VT HSPC/2017/Stopcard.cpp b/Contests/Other Solutions/VT HSPC/2017/Stopcard.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Stopcard.cpp rename to Contests/Other Solutions/VT HSPC/2017/Stopcard.cpp diff --git a/Contests/Other/VT HSPC/2017/Swish.cpp b/Contests/Other Solutions/VT HSPC/2017/Swish.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Swish.cpp rename to Contests/Other Solutions/VT HSPC/2017/Swish.cpp diff --git a/Contests/Other/VT HSPC/2017/Through.cpp b/Contests/Other Solutions/VT HSPC/2017/Through.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Through.cpp rename to Contests/Other Solutions/VT HSPC/2017/Through.cpp diff --git a/Contests/Other/VT HSPC/2017/Weight.cpp b/Contests/Other Solutions/VT HSPC/2017/Weight.cpp similarity index 100% rename from Contests/Other/VT HSPC/2017/Weight.cpp rename to Contests/Other Solutions/VT HSPC/2017/Weight.cpp diff --git a/Implementations/content/data-structures/1D Range Queries (9.2)/Treap (15.3).h b/Implementations/content/data-structures/1D Range Queries (9.2)/Treap (15.3).h index 503e7b70..a6035a10 100644 --- a/Implementations/content/data-structures/1D Range Queries (9.2)/Treap (15.3).h +++ b/Implementations/content/data-structures/1D Range Queries (9.2)/Treap (15.3).h @@ -62,8 +62,8 @@ pair splitsz(pt t, int sz) { // sz nodes go to left } } pt merge(pt l, pt r) { - if (!l || !r) return l ? l : r; - prop(l), prop(r); + if (!l || !r) return l?:r; + prop(l), prop(r); pt t; if (l->pri > r->pri) l->c[1] = merge(l->c[1],r), t = l; else r->c[0] = merge(l,r->c[0]), t = r; diff --git a/Implementations/content/graphs (12)/Misc/DirectedMST.h b/Implementations/content/graphs (12)/Misc/DirectedMST.h index 7d9b5db9..3c7539a9 100644 --- a/Implementations/content/graphs (12)/Misc/DirectedMST.h +++ b/Implementations/content/graphs (12)/Misc/DirectedMST.h @@ -1,6 +1,6 @@ /** * Description: Chu-Liu-Edmonds algorithm. Computes minimum weight directed - * spanning tree rooted at $r$, edge from $inv[i]\to i$ for all $i\neq r.$ + * spanning tree rooted at $r$, edge from $par[i]\to i$ for all $i\neq r.$ * Use DSU with rollback if need to return edges. * Time: O(M\log M) * Source: KACTL @@ -29,7 +29,7 @@ Node *merge(Node *a, Node *b) { if (!a || !b) return a ?: b; a->prop(), b->prop(); if (a->key.w > b->key.w) swap(a, b); - swap(a->l, (a->r = merge(b, a->r))); + swap(a->l, a->r = merge(b, a->r)); return a; } void pop(Node*& a) { a->prop(); a = merge(a->l, a->r); } @@ -72,10 +72,7 @@ pair dmst(int n, int r, const vector& g) { trav(t,c.s) in[dsu.get(t.b)] = {t.a,t.b}; in[dsu.get(inEdge.s)] = inEdge; } - vi inv; - F0R(i,n) { - assert(i == r ? in[i].s == -1 : in[i].s == i); - inv.pb(in[i].f); - } - return {res,inv}; + vi par(n); F0R(i,n) par[i] = in[i].f; + // i == r ? in[i].s == -1 : in[i].s == i + return {res,par}; } \ No newline at end of file diff --git a/LICENSE b/LICENSE index a6229941..0e259d42 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,121 @@ -MIT License - -Copyright (c) 2017 Benjamin Qi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +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.