my $basename = fileparse $name, qr/\..*/;
given ($format){
- exec 'gcc', qw/-DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o/, $basename, $name when 'C';
- exec 'g++', qw/-DONLINE_JUDGE -std=gnu++11 -Wall -Wextra -O2 -o/, $basename, $name when 'CPP';
+ exec 'gcc', qw/-DONLINE_JUDGE -std=gnu11 -Wall -Wextra -lm -O2 -o/, $basename, $name when 'C';
+ exec 'g++', qw/-DONLINE_JUDGE -std=gnu++11 -Wall -Wextra -lm -O2 -o/, $basename, $name when 'CPP';
when ('MONO') {
system 'gmcs', '-d:ONLINE_JUDGE', $name and die "gmcs failed: errno=$! return=$?";
rename "$basename.exe", $basename;