#!/usr/bin/perl use strict; use warnings; my ($x, $y, $d) = split / /, <>; my $count; if($y < $x) { ($x, $y) = ($y, $x); } if(($x <= $d)and($d <= $y)) { $count = $x; } elsif($d < $x) { $count = $x; } elsif($x + $y < $d) { $count = 0; } elsif(($y < $d)and($d <= $y + $x)) { $count = $y + $x - $d + 1; } print "$count\n"; exit;