#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi INPUT="$1" main () { IFS=' ' read -r -a times <<< "$(grep Time ${INPUT} | awk '{$1=""; print $0}')" IFS=' ' read -r -a distances <<< "$(grep Distance ${INPUT} | awk '{$1=""; print $0}')" declare -a winning_counts=() records="${#times[@]}" for ((i=0; i