#!/bin/bash
cd /tmp/$2
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\/\\\n\s{]+)" code.code)
cp code.code $name.java
javac $name.java
timeout -s KILL 3 xargs -a args.args -d '\n' java $name < stdin.stdin