From 67497bd0037f899944354f8a45474dc6a874b485 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 14 Dec 2025 16:00:43 -0600 Subject: [PATCH] remove scripts and more --- atcoder/042/compile_flags.txt | 31 ---------- atcoder/042/debug_flags.txt | 14 ----- atcoder/042/makefile | 30 --------- atcoder/042/scripts/debug.sh | 29 --------- atcoder/042/scripts/run.sh | 29 --------- atcoder/042/scripts/utils.sh | 61 ------------------- cses/dynamic-programming/compile_flags.txt | 31 ---------- cses/dynamic-programming/debug_flags.txt | 12 ---- cses/dynamic-programming/makefile | 28 --------- cses/dynamic-programming/scripts/debug.sh | 29 --------- cses/dynamic-programming/scripts/run.sh | 29 --------- cses/dynamic-programming/scripts/utils.sh | 53 ---------------- cses/graph-algorithms/compile_flags.txt | 31 ---------- cses/graph-algorithms/debug_flags.txt | 14 ----- cses/graph-algorithms/makefile | 30 --------- cses/graph-algorithms/scripts/debug.sh | 29 --------- cses/graph-algorithms/scripts/run.sh | 29 --------- cses/graph-algorithms/scripts/utils.sh | 61 ------------------- cses/introductory-problems/compile_flags.txt | 30 --------- cses/introductory-problems/debug_flags.txt | 12 ---- cses/introductory-problems/makefile | 29 --------- cses/introductory-problems/scripts/debug.sh | 29 --------- cses/introductory-problems/scripts/run.sh | 29 --------- cses/introductory-problems/scripts/utils.sh | 53 ---------------- cses/range-queries/compile_flags.txt | 31 ---------- cses/range-queries/debug_flags.txt | 12 ---- cses/range-queries/makefile | 28 --------- cses/range-queries/scripts/debug.sh | 29 --------- cses/range-queries/scripts/run.sh | 29 --------- cses/range-queries/scripts/utils.sh | 53 ---------------- cses/sorting-and-searching/compile_flags.txt | 31 ---------- cses/sorting-and-searching/debug_flags.txt | 12 ---- cses/sorting-and-searching/makefile | 28 --------- cses/sorting-and-searching/scripts/debug.sh | 29 --------- cses/sorting-and-searching/scripts/run.sh | 29 --------- cses/sorting-and-searching/scripts/utils.sh | 53 ---------------- kattis/11-02-2025/compile_flags.txt | 5 -- kattis/18-2-2025/compile_flags.txt | 6 -- kattis/25-2-2025/compile_flags.txt | 6 -- .../bronze/complete-search/compile_flags.txt | 30 --------- usaco/bronze/complete-search/debug_flags.txt | 14 ----- usaco/bronze/complete-search/makefile | 29 --------- usaco/bronze/complete-search/scripts/debug.sh | 29 --------- .../complete-search/scripts/memdebug.sh | 31 ---------- usaco/bronze/complete-search/scripts/run.sh | 29 --------- usaco/bronze/complete-search/scripts/utils.sh | 53 ---------------- usaco/bronze/scripts/debug.sh | 29 --------- usaco/bronze/scripts/run.sh | 29 --------- usaco/bronze/scripts/utils.sh | 53 ---------------- usaco/bronze/simulation/compile_flags.txt | 30 --------- usaco/bronze/simulation/debug_flags.txt | 12 ---- usaco/bronze/simulation/makefile | 29 --------- usaco/bronze/simulation/scripts/debug.sh | 29 --------- usaco/bronze/simulation/scripts/run.sh | 29 --------- usaco/bronze/simulation/scripts/utils.sh | 53 ---------------- usaco/bronze/sorting/compile_flags.txt | 30 --------- usaco/bronze/sorting/debug_flags.txt | 14 ----- usaco/bronze/sorting/makefile | 29 --------- usaco/bronze/sorting/scripts/debug.sh | 29 --------- usaco/bronze/sorting/scripts/run.sh | 29 --------- usaco/bronze/sorting/scripts/utils.sh | 53 ---------------- 61 files changed, 1825 deletions(-) delete mode 100644 atcoder/042/compile_flags.txt delete mode 100644 atcoder/042/debug_flags.txt delete mode 100644 atcoder/042/makefile delete mode 100644 atcoder/042/scripts/debug.sh delete mode 100644 atcoder/042/scripts/run.sh delete mode 100644 atcoder/042/scripts/utils.sh delete mode 100644 cses/dynamic-programming/compile_flags.txt delete mode 100644 cses/dynamic-programming/debug_flags.txt delete mode 100644 cses/dynamic-programming/makefile delete mode 100644 cses/dynamic-programming/scripts/debug.sh delete mode 100644 cses/dynamic-programming/scripts/run.sh delete mode 100644 cses/dynamic-programming/scripts/utils.sh delete mode 100644 cses/graph-algorithms/compile_flags.txt delete mode 100644 cses/graph-algorithms/debug_flags.txt delete mode 100644 cses/graph-algorithms/makefile delete mode 100644 cses/graph-algorithms/scripts/debug.sh delete mode 100644 cses/graph-algorithms/scripts/run.sh delete mode 100644 cses/graph-algorithms/scripts/utils.sh delete mode 100644 cses/introductory-problems/compile_flags.txt delete mode 100644 cses/introductory-problems/debug_flags.txt delete mode 100644 cses/introductory-problems/makefile delete mode 100644 cses/introductory-problems/scripts/debug.sh delete mode 100644 cses/introductory-problems/scripts/run.sh delete mode 100644 cses/introductory-problems/scripts/utils.sh delete mode 100644 cses/range-queries/compile_flags.txt delete mode 100644 cses/range-queries/debug_flags.txt delete mode 100644 cses/range-queries/makefile delete mode 100644 cses/range-queries/scripts/debug.sh delete mode 100644 cses/range-queries/scripts/run.sh delete mode 100644 cses/range-queries/scripts/utils.sh delete mode 100644 cses/sorting-and-searching/compile_flags.txt delete mode 100644 cses/sorting-and-searching/debug_flags.txt delete mode 100644 cses/sorting-and-searching/makefile delete mode 100644 cses/sorting-and-searching/scripts/debug.sh delete mode 100644 cses/sorting-and-searching/scripts/run.sh delete mode 100644 cses/sorting-and-searching/scripts/utils.sh delete mode 100644 kattis/11-02-2025/compile_flags.txt delete mode 100644 kattis/18-2-2025/compile_flags.txt delete mode 100644 kattis/25-2-2025/compile_flags.txt delete mode 100644 usaco/bronze/complete-search/compile_flags.txt delete mode 100644 usaco/bronze/complete-search/debug_flags.txt delete mode 100644 usaco/bronze/complete-search/makefile delete mode 100644 usaco/bronze/complete-search/scripts/debug.sh delete mode 100644 usaco/bronze/complete-search/scripts/memdebug.sh delete mode 100644 usaco/bronze/complete-search/scripts/run.sh delete mode 100644 usaco/bronze/complete-search/scripts/utils.sh delete mode 100644 usaco/bronze/scripts/debug.sh delete mode 100644 usaco/bronze/scripts/run.sh delete mode 100644 usaco/bronze/scripts/utils.sh delete mode 100644 usaco/bronze/simulation/compile_flags.txt delete mode 100644 usaco/bronze/simulation/debug_flags.txt delete mode 100644 usaco/bronze/simulation/makefile delete mode 100644 usaco/bronze/simulation/scripts/debug.sh delete mode 100644 usaco/bronze/simulation/scripts/run.sh delete mode 100644 usaco/bronze/simulation/scripts/utils.sh delete mode 100644 usaco/bronze/sorting/compile_flags.txt delete mode 100644 usaco/bronze/sorting/debug_flags.txt delete mode 100644 usaco/bronze/sorting/makefile delete mode 100644 usaco/bronze/sorting/scripts/debug.sh delete mode 100644 usaco/bronze/sorting/scripts/run.sh delete mode 100644 usaco/bronze/sorting/scripts/utils.sh diff --git a/atcoder/042/compile_flags.txt b/atcoder/042/compile_flags.txt deleted file mode 100644 index 17821f8..0000000 --- a/atcoder/042/compile_flags.txt +++ /dev/null @@ -1,31 +0,0 @@ --pedantic-errors --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++23 diff --git a/atcoder/042/debug_flags.txt b/atcoder/042/debug_flags.txt deleted file mode 100644 index 62a0135..0000000 --- a/atcoder/042/debug_flags.txt +++ /dev/null @@ -1,14 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC --DLOCAL --std=c++23 diff --git a/atcoder/042/makefile b/atcoder/042/makefile deleted file mode 100644 index 3c50267..0000000 --- a/atcoder/042/makefile +++ /dev/null @@ -1,30 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f .clang-format || cp $(HOME)/.config/cp-template/.clang-format . - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/atcoder/042/scripts/debug.sh b/atcoder/042/scripts/debug.sh deleted file mode 100644 index 1e63f37..0000000 --- a/atcoder/042/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" true -exit $? diff --git a/atcoder/042/scripts/run.sh b/atcoder/042/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/atcoder/042/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/atcoder/042/scripts/utils.sh b/atcoder/042/scripts/utils.sh deleted file mode 100644 index e4cf8f8..0000000 --- a/atcoder/042/scripts/utils.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - is_debug="$4" - - start=$(date '+%s.%N') - if [ -n "$is_debug" ]; then - asan="$(ldconfig -p | grep libasan.so | head -n1 | awk '{print $4}')" - LD_PRELOAD="$asan" timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - else - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - fi - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - test -n "$is_debug" && is_debug_string=true || is_debug_string=false - printf '\n[debug]: %s' "$is_debug_string" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/cses/dynamic-programming/compile_flags.txt b/cses/dynamic-programming/compile_flags.txt deleted file mode 100644 index 5725a8c..0000000 --- a/cses/dynamic-programming/compile_flags.txt +++ /dev/null @@ -1,31 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wsign-conversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++23 diff --git a/cses/dynamic-programming/debug_flags.txt b/cses/dynamic-programming/debug_flags.txt deleted file mode 100644 index 03cba1b..0000000 --- a/cses/dynamic-programming/debug_flags.txt +++ /dev/null @@ -1,12 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC diff --git a/cses/dynamic-programming/makefile b/cses/dynamic-programming/makefile deleted file mode 100644 index 9c5450b..0000000 --- a/cses/dynamic-programming/makefile +++ /dev/null @@ -1,28 +0,0 @@ -.PHONY: run debug clean setup init - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . - test -f .clang-format || cp $(HOME)/.config/cp-template/.clang-format . - -init: - make setup - -%: - @: diff --git a/cses/dynamic-programming/scripts/debug.sh b/cses/dynamic-programming/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/cses/dynamic-programming/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/dynamic-programming/scripts/run.sh b/cses/dynamic-programming/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/cses/dynamic-programming/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/dynamic-programming/scripts/utils.sh b/cses/dynamic-programming/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/cses/dynamic-programming/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/cses/graph-algorithms/compile_flags.txt b/cses/graph-algorithms/compile_flags.txt deleted file mode 100644 index cabab0b..0000000 --- a/cses/graph-algorithms/compile_flags.txt +++ /dev/null @@ -1,31 +0,0 @@ --pedantic-errors --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++20 diff --git a/cses/graph-algorithms/debug_flags.txt b/cses/graph-algorithms/debug_flags.txt deleted file mode 100644 index 62a0135..0000000 --- a/cses/graph-algorithms/debug_flags.txt +++ /dev/null @@ -1,14 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC --DLOCAL --std=c++23 diff --git a/cses/graph-algorithms/makefile b/cses/graph-algorithms/makefile deleted file mode 100644 index 3c50267..0000000 --- a/cses/graph-algorithms/makefile +++ /dev/null @@ -1,30 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f .clang-format || cp $(HOME)/.config/cp-template/.clang-format . - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/cses/graph-algorithms/scripts/debug.sh b/cses/graph-algorithms/scripts/debug.sh deleted file mode 100644 index 1e63f37..0000000 --- a/cses/graph-algorithms/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" true -exit $? diff --git a/cses/graph-algorithms/scripts/run.sh b/cses/graph-algorithms/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/cses/graph-algorithms/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/graph-algorithms/scripts/utils.sh b/cses/graph-algorithms/scripts/utils.sh deleted file mode 100644 index e4cf8f8..0000000 --- a/cses/graph-algorithms/scripts/utils.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - is_debug="$4" - - start=$(date '+%s.%N') - if [ -n "$is_debug" ]; then - asan="$(ldconfig -p | grep libasan.so | head -n1 | awk '{print $4}')" - LD_PRELOAD="$asan" timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - else - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - fi - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - test -n "$is_debug" && is_debug_string=true || is_debug_string=false - printf '\n[debug]: %s' "$is_debug_string" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/cses/introductory-problems/compile_flags.txt b/cses/introductory-problems/compile_flags.txt deleted file mode 100644 index 5373b01..0000000 --- a/cses/introductory-problems/compile_flags.txt +++ /dev/null @@ -1,30 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++23 diff --git a/cses/introductory-problems/debug_flags.txt b/cses/introductory-problems/debug_flags.txt deleted file mode 100644 index 03cba1b..0000000 --- a/cses/introductory-problems/debug_flags.txt +++ /dev/null @@ -1,12 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC diff --git a/cses/introductory-problems/makefile b/cses/introductory-problems/makefile deleted file mode 100644 index 78778b6..0000000 --- a/cses/introductory-problems/makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/cses/introductory-problems/scripts/debug.sh b/cses/introductory-problems/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/cses/introductory-problems/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/introductory-problems/scripts/run.sh b/cses/introductory-problems/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/cses/introductory-problems/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/introductory-problems/scripts/utils.sh b/cses/introductory-problems/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/cses/introductory-problems/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/cses/range-queries/compile_flags.txt b/cses/range-queries/compile_flags.txt deleted file mode 100644 index af7fb72..0000000 --- a/cses/range-queries/compile_flags.txt +++ /dev/null @@ -1,31 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wsign-conversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++20 diff --git a/cses/range-queries/debug_flags.txt b/cses/range-queries/debug_flags.txt deleted file mode 100644 index 03cba1b..0000000 --- a/cses/range-queries/debug_flags.txt +++ /dev/null @@ -1,12 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC diff --git a/cses/range-queries/makefile b/cses/range-queries/makefile deleted file mode 100644 index 9c5450b..0000000 --- a/cses/range-queries/makefile +++ /dev/null @@ -1,28 +0,0 @@ -.PHONY: run debug clean setup init - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . - test -f .clang-format || cp $(HOME)/.config/cp-template/.clang-format . - -init: - make setup - -%: - @: diff --git a/cses/range-queries/scripts/debug.sh b/cses/range-queries/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/cses/range-queries/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/range-queries/scripts/run.sh b/cses/range-queries/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/cses/range-queries/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/range-queries/scripts/utils.sh b/cses/range-queries/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/cses/range-queries/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/cses/sorting-and-searching/compile_flags.txt b/cses/sorting-and-searching/compile_flags.txt deleted file mode 100644 index af7fb72..0000000 --- a/cses/sorting-and-searching/compile_flags.txt +++ /dev/null @@ -1,31 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wsign-conversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++20 diff --git a/cses/sorting-and-searching/debug_flags.txt b/cses/sorting-and-searching/debug_flags.txt deleted file mode 100644 index 03cba1b..0000000 --- a/cses/sorting-and-searching/debug_flags.txt +++ /dev/null @@ -1,12 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC diff --git a/cses/sorting-and-searching/makefile b/cses/sorting-and-searching/makefile deleted file mode 100644 index 9c5450b..0000000 --- a/cses/sorting-and-searching/makefile +++ /dev/null @@ -1,28 +0,0 @@ -.PHONY: run debug clean setup init - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . - test -f .clang-format || cp $(HOME)/.config/cp-template/.clang-format . - -init: - make setup - -%: - @: diff --git a/cses/sorting-and-searching/scripts/debug.sh b/cses/sorting-and-searching/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/cses/sorting-and-searching/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/sorting-and-searching/scripts/run.sh b/cses/sorting-and-searching/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/cses/sorting-and-searching/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/cses/sorting-and-searching/scripts/utils.sh b/cses/sorting-and-searching/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/cses/sorting-and-searching/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/kattis/11-02-2025/compile_flags.txt b/kattis/11-02-2025/compile_flags.txt deleted file mode 100644 index 0adea68..0000000 --- a/kattis/11-02-2025/compile_flags.txt +++ /dev/null @@ -1,5 +0,0 @@ --std=c++23 --Wall --Wextra --Wpedantic --Wshadow diff --git a/kattis/18-2-2025/compile_flags.txt b/kattis/18-2-2025/compile_flags.txt deleted file mode 100644 index 7a6e5ad..0000000 --- a/kattis/18-2-2025/compile_flags.txt +++ /dev/null @@ -1,6 +0,0 @@ --std=c++23 --Wall --Wextra --Wpedantic --Wshadow --DLOCAL diff --git a/kattis/25-2-2025/compile_flags.txt b/kattis/25-2-2025/compile_flags.txt deleted file mode 100644 index 504aea8..0000000 --- a/kattis/25-2-2025/compile_flags.txt +++ /dev/null @@ -1,6 +0,0 @@ --Wall --Wextra --Wpedantic --Wshadow --DLOCAL --std=c++23 diff --git a/usaco/bronze/complete-search/compile_flags.txt b/usaco/bronze/complete-search/compile_flags.txt deleted file mode 100644 index 785091b..0000000 --- a/usaco/bronze/complete-search/compile_flags.txt +++ /dev/null @@ -1,30 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++17 diff --git a/usaco/bronze/complete-search/debug_flags.txt b/usaco/bronze/complete-search/debug_flags.txt deleted file mode 100644 index af1b521..0000000 --- a/usaco/bronze/complete-search/debug_flags.txt +++ /dev/null @@ -1,14 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC --DLOCAL --std=c++20 diff --git a/usaco/bronze/complete-search/makefile b/usaco/bronze/complete-search/makefile deleted file mode 100644 index 78778b6..0000000 --- a/usaco/bronze/complete-search/makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/usaco/bronze/complete-search/scripts/debug.sh b/usaco/bronze/complete-search/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/usaco/bronze/complete-search/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/complete-search/scripts/memdebug.sh b/usaco/bronze/complete-search/scripts/memdebug.sh deleted file mode 100644 index 0862869..0000000 --- a/usaco/bronze/complete-search/scripts/memdebug.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @mem_debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -# Use ulimit to restrict memory to 256MB (262144 KB) -# This will run the binary with memory restrictions -execute_binary_with_memory_limit "$DBG_BIN" "$INPUT" "$OUTPUT" 262144 -exit $? \ No newline at end of file diff --git a/usaco/bronze/complete-search/scripts/run.sh b/usaco/bronze/complete-search/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/usaco/bronze/complete-search/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/complete-search/scripts/utils.sh b/usaco/bronze/complete-search/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/usaco/bronze/complete-search/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/usaco/bronze/scripts/debug.sh b/usaco/bronze/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/usaco/bronze/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/scripts/run.sh b/usaco/bronze/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/usaco/bronze/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/scripts/utils.sh b/usaco/bronze/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/usaco/bronze/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/usaco/bronze/simulation/compile_flags.txt b/usaco/bronze/simulation/compile_flags.txt deleted file mode 100644 index 785091b..0000000 --- a/usaco/bronze/simulation/compile_flags.txt +++ /dev/null @@ -1,30 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++17 diff --git a/usaco/bronze/simulation/debug_flags.txt b/usaco/bronze/simulation/debug_flags.txt deleted file mode 100644 index 03cba1b..0000000 --- a/usaco/bronze/simulation/debug_flags.txt +++ /dev/null @@ -1,12 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC diff --git a/usaco/bronze/simulation/makefile b/usaco/bronze/simulation/makefile deleted file mode 100644 index 78778b6..0000000 --- a/usaco/bronze/simulation/makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/usaco/bronze/simulation/scripts/debug.sh b/usaco/bronze/simulation/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/usaco/bronze/simulation/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/simulation/scripts/run.sh b/usaco/bronze/simulation/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/usaco/bronze/simulation/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/simulation/scripts/utils.sh b/usaco/bronze/simulation/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/usaco/bronze/simulation/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -} diff --git a/usaco/bronze/sorting/compile_flags.txt b/usaco/bronze/sorting/compile_flags.txt deleted file mode 100644 index 785091b..0000000 --- a/usaco/bronze/sorting/compile_flags.txt +++ /dev/null @@ -1,30 +0,0 @@ --O2 --Wall --Wextra --Wpedantic --Wshadow --Wformat=2 --Wfloat-equal --Wlogical-op --Wshift-overflow=2 --Wnon-virtual-dtor --Wold-style-cast --Wcast-qual --Wuseless-cast --Wno-sign-promotion --Wcast-align --Wunused --Woverloaded-virtual --Wconversion --Wmisleading-indentation --Wduplicated-cond --Wduplicated-branches --Wlogical-op --Wnull-dereference --Wformat=2 --Wformat-overflow --Wformat-truncation --Wdouble-promotion --Wundef --DLOCAL --std=c++17 diff --git a/usaco/bronze/sorting/debug_flags.txt b/usaco/bronze/sorting/debug_flags.txt deleted file mode 100644 index af1b521..0000000 --- a/usaco/bronze/sorting/debug_flags.txt +++ /dev/null @@ -1,14 +0,0 @@ --g3 --fsanitize=address,undefined --fsanitize=float-divide-by-zero --fsanitize=float-cast-overflow --fno-sanitize-recover=all --fstack-protector-all --fstack-usage --fno-omit-frame-pointer --fno-inline --ffunction-sections --D_GLIBCXX_DEBUG --D_GLIBCXX_DEBUG_PEDANTIC --DLOCAL --std=c++20 diff --git a/usaco/bronze/sorting/makefile b/usaco/bronze/sorting/makefile deleted file mode 100644 index 78778b6..0000000 --- a/usaco/bronze/sorting/makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: run debug clean setup init - -VERSION ?= 20 - -SRC = $(word 2,$(MAKECMDGOALS)) - -.SILENT: - -run: - sh scripts/run.sh $(SRC) - -debug: - sh scripts/debug.sh $(SRC) - -clean: - rm -rf build/* - -setup: - test -d build || mkdir -p build - test -d io || mkdir -p io - test -d scripts || mkdir -p scripts - test -f compile_flags.txt || cp $(HOME)/.config/cp-template/compile_flags.txt . && echo -std=c++$(VERSION) >>compile_flags.txt - test -f .clangd || cp $(HOME)/.config/cp-template/.clangd . && echo -e "\t\t-std=c++$(VERSION)" >>.clangd - -init: - make setup - -%: - @: diff --git a/usaco/bronze/sorting/scripts/debug.sh b/usaco/bronze/sorting/scripts/debug.sh deleted file mode 100644 index 2979422..0000000 --- a/usaco/bronze/sorting/scripts/debug.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -DBG_BIN="${BASE}.debug" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -DBG_BIN="build/$DBG_BIN" - -compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/sorting/scripts/run.sh b/usaco/bronze/sorting/scripts/run.sh deleted file mode 100644 index ab9aa7d..0000000 --- a/usaco/bronze/sorting/scripts/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -. ./scripts/utils.sh - -SRC="$1" -BASE=$(basename "$SRC" .cc) -INPUT="${BASE}.in" -OUTPUT="${BASE}.out" -RUN_BIN="${BASE}.run" - -test -d build || mkdir -p build -test -d io || mkdir -p io - -test -f "$INPUT" && test ! -f "io/$INPUT" && mv "$INPUT" "io/" -test -f "$OUTPUT" && test ! -f "io/$OUTPUT" && mv "$OUTPUT" "io/" - -test -f "io/$INPUT" || touch "io/$INPUT" -test -f "io/$OUTPUT" || touch "io/$OUTPUT" - -INPUT="io/$INPUT" -OUTPUT="io/$OUTPUT" -RUN_BIN="build/$RUN_BIN" - -compile_source "$SRC" "$RUN_BIN" "$OUTPUT" "" -CODE=$? -test $CODE -gt 0 && exit $CODE - -execute_binary "$RUN_BIN" "$INPUT" "$OUTPUT" -exit $? diff --git a/usaco/bronze/sorting/scripts/utils.sh b/usaco/bronze/sorting/scripts/utils.sh deleted file mode 100644 index e99b25b..0000000 --- a/usaco/bronze/sorting/scripts/utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -execute_binary() { - binary="$1" - input="$2" - output="$3" - - start=$(date '+%s.%N') - timeout 2s ./"$binary" <"$input" >"$output" 2>&1 - CODE=$? - end=$(date '+%s.%N') - truncate -s "$(head -n 1000 "$output" | wc -c)" "$output" - - if [ $CODE -ge 124 ]; then - MSG='' - case $CODE in - 124) MSG='TIMEOUT' ;; - 128) MSG='SIGILL' ;; - 130) MSG='SIGABRT' ;; - 131) MSG='SIGBUS' ;; - 136) MSG='SIGFPE' ;; - 135) MSG='SIGSEGV' ;; - 137) MSG='SIGPIPE' ;; - 139) MSG='SIGTERM' ;; - esac - [ $CODE -ne 124 ] && sed -i '$d' "$output" - test -n "$MSG" && printf '\n[code]: %s (%s)' "$CODE" "$MSG" >>"$output" - else - printf '\n[code]: %s' "$CODE" >>"$output" - fi - - printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output - return $CODE -} - -compile_source() { - src="$1" - bin="$2" - output="$3" - flags="$4" - - test -f "$bin" && rm "$bin" || true - g++ @compile_flags.txt $flags "$src" -o "$bin" 2>"$output" - CODE=$? - - if [ $CODE -gt 0 ]; then - printf '\n[code]: %s' "$CODE" >>"$output" - return $CODE - else - echo '' >"$output" - return 0 - fi -}