{"source_code": "my ($l, $r, $b) = (0, 0, 0);\nfor (1..<>) {\n my $d = join '', map {$_%2} split ' ', <>;\n $l++ if $d eq '10';\n $r++ if $d eq '01';\n $b++ if $d eq '11';\n}\nif (($l+$b)%2==0 && ($r+$b)%2==0) {\n print 0;\n} elsif (($l+$r)%2==1) {\n print -1;\n} elsif ($l || $r) {\n print 1;\n} else {\n print -1;\n}", "positive_code": [{"source_code": "use strict;\n\nchomp(my $n = <>);\nmy ($su, $sd, $c) = (0, 0, 0);\nfor (1 .. $n) {\n chomp($_ = <>);\n my ($a, $b) = split;\n $su ^= $a & 1;\n $sd ^= $b & 1;\n ++$c if $a % 2 != $b % 2;\n}\n\nmy $res = $su != $sd ? -1 : $su == 0 ? 0 : $c > 0 ? 1 : -1;\nprint $res;\n"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# STDIN: domino.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/26/2015 09:15:44 AM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\n\n#open STDIN, \"in.txt\";\nwhile($_ = ){\n chomp($_);\n my ($sumx, $sumy, $cnt) = (0, 0, 0);\n while($_--){\n chomp(my $ln = );\n my ($x, $y) = split / /, $ln;\n $sumx += $x; $sumy += $y;\n $cnt += 1 if (abs($x - $y) % 2 == 1);\n }\n if (($sumx + $sumy) % 2 == 0) {\n if ($sumx % 2 == 1 && $cnt > 0) {\n print \"1\\n\";\n } elsif ($sumx % 2 == 0) {\n print \"0\\n\";\n } else {\n print \"-1\\n\";\n }\n } else {\n print \"-1\\n\";\n }\n}\n\n\n"}, {"source_code": "<>;\n@_=<>;\nfor(@_){\n\t/ /;\n\t$`%2 and $a++;\n\t$'%2 and $b++;\n\t$`%2 or $'%2 and $c++;\n\t$'%2 or $`%2 and $c++;\n\t}\n$a%=2;\n$b%=2;\n$a && $b && $c and print 1;\n$a && $b && !$c and print -1;\n$a or $b and print -1;\n$b or $a and print -1;\n$a or $b or print 0;"}], "negative_code": [{"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# STDIN: domino.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/26/2015 09:15:44 AM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\n\n#open STDIN, \"in.txt\";\nwhile($_ = ){\n chomp($_);\n my ($sumx, $sumy, $cnt) = (0, 0, 0);\n while($_--){\n chomp(my $ln = );\n my ($x, $y) = split / /, $ln;\n $sumx += $x; $sumy += $y;\n $cnt += 1 if (abs($x - $y) % 2 == 1);\n }\n if (($sumx + $sumy) % 2 == 0) {\n if ($sumx % 2 == 1 && $cnt > 0) {\n print \"1\\n\";\n } else {\n print \"0\\n\";\n }\n } else {\n print \"-1\\n\";\n }\n}\n\n\n"}, {"source_code": "<>;\n@_=<>;\nfor(@_){\n\t/ /;\n\t$`%2 and $a++;\n\t$'%2 and $b++;\n\t$`%2 or $'%2 and $c++;\n\t$'%2 or $`%2 and $c++;\n\t}\n\tprint \" $a $b $c\\n\";\n$a%=2;\n$b%=2;\n$a && $b && $c and print 1;\n$a && $b && !$c and print -1;\n$a or $b and print -1;\n$b or $a and print -1;\n$a or $b or print 0;"}, {"source_code": "$_ = <>-10;\nprint $_==10 ? 15 : $_<=0 || $_>11 ? 0 : 4;"}, {"source_code": "my ($l, $r, $o) = (0, 0, 0);\nfor (1..<>) {\n my @new = map {$_%2} split ' ', <>;\n $l += $new[0];\n $r += $new[1];\n $o++ if $new[0]&&$new[1];\n}\nif ($l%2==0 && $r%2==0) {\n print 0;\n} elsif ($l%2 && $r%2 && !$o) {\n print 1;\n} else {\n print -1;\n}"}], "src_uid": "f9bc04aed2b84c7dd288749ac264bb43"} {"source_code": "use warnings;\nuse strict;\nuse integer;\n$\\ = qq/\\n/, $, = qq/ / ;\nmy $n = ;\nmy @arr = sort { $a <=> $b } split qq/ /, ;\nmy $black = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $black += abs ( $arr [ $ii ] - ( 1 + ( 2 * $ii ) ) )\n}\nmy $white = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $white += abs ( $arr [ $ii ] - ( 2 + ( 2 * $ii ) ) )\n}\nprint ( $black > $white ? $white : $black );\n", "positive_code": [{"source_code": "$n = <>;\n@pieces = sort { $a <=> $b } split ' ', <>;\n($w, $b) = (0, 0);\nfor (1..$n) {\n $i = ($_ - 1) / 2;\n $w += abs $_ - $pieces[$i] if $_ % 2;\n $b += abs $_ -$pieces[$i] if $_ % 2 == 0;\n}\nprint $w < $b ? $w : $b;\n\n"}], "negative_code": [{"source_code": "use warnings;\nuse strict;\n$, = q/ /, $\\ = qq/\\n/;\nmy ( $n, $m ) = split q/ /, ;\nmy @a = ();\nfor ( 1 .. $n ) {\n chomp ( my $s = [ split q//, ] );\n push @a, $s;\n}\nmy %lamp_to_switch = ();\nfor my $i ( 0 .. ($n - 1) ) {\n my $bl = 1;\n for my $j ( 0 .. ($m - 1) ) { \n if ( $a[$i][$j] eq '1' ) { \n if ( not exists $lamp_to_switch { $j + 1} ) {\n $lamp_to_switch { $i + 1 } -> { $j + 1 } = 1;\n $bl = 0;\n }\n }\n }\n if ( $bl ) {\n print \"YES\";\n exit;\n }\n}\nprint \"NO\";\nexit;\n"}, {"source_code": "use warnings;\nuse strict;\nuse integer;\n$\\ = qq/\\n/, $, = qq/ / ;\nmy $n = ;\nmy @arr = split qq/ /, ;\nmy $sum = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $sum += abs ( $arr [ $ii ] - ( 1 + ( 2 * $ii ) ) )\n}\nprint $sum; \n"}, {"source_code": "use warnings;\nuse strict;\nuse integer;\n$\\ = qq/\\n/, $, = qq/ / ;\nmy $n = ;\nmy @arr = sort { $a <=> $b } split qq/ /, ;\nmy $black = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $black += abs ( $arr [ $ii ] - ( 1 + ( 2 * $ii ) ) )\n}\nmy $white = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $white += abs ( $arr [ $ii ] - ( 2 + ( 2 * $ii ) ) )\n}\nprint qq/white $white/;\nprint qq/black $black/;\n\nprint ( $black > $white ? $white : $black );\n"}, {"source_code": "use warnings;\nuse strict;\nuse integer;\n$\\ = qq/\\n/, $, = qq/ / ;\nmy $n = ;\nmy @arr = split qq/ /, ;\nmy $black = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $black += abs ( $arr [ $ii ] - ( 1 + ( 2 * $ii ) ) )\n}\nmy $white = 0;\nfor ( my $ii = 0; $ii < ( $n / 2 ); $ii += 1 ) {\n $white += abs ( $arr [ $ii ] - ( 2 + ( 2 * $ii ) ) )\n}\nprint ( $black > $white ? $white : $black );\n"}, {"source_code": "$n = <>;\n@pieces = split ' ', <>;\n($w, $b) = (0, 0);\nfor (1..$n) {\n $i = ($_ - 1) / 2;\n $w += abs $_ - $pieces[$i] if $_ % 2;\n $b += abs $_ -$pieces[$i] if $_ % 2 == 0;\n}\nprint $w < $b ? $w : $b;"}], "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a"} {"source_code": "#rextester.com:5.22.1--codeforces.com:5.20.1\n$a=<>*2;$b=0;\nfor($i=1;$i;\n$amax=int(sqrt($n))-1;\nfor $a (1..$amax) {\n\t$n2=$n-$a*($a+1);\n\t$b=int(sqrt($n2));\n\t$f=($b*($b+1)==$n2);\n\t# print \"a=$a b=$b f=$f\\n\";\n\tlast if $f;\n}\nprint $f?\"YES\":\"NO\", \"\\n\";\n"}, {"source_code": "my $n = ;\nmy $loop = 1;\n\nsub itr {\n my $x = shift;\n my $y = shift;\n my $i = shift;\n $loop++;\n my $sum;\n if($i){\n $sum = $i*($i+1)/2;\n $i++;\n }else{\n $i = 2;\n $sum = 1;\n }\n for($i; $sum<$y; $i++){\n $sum += $i;\n }\n \n #print \"$x, $y, $i, $sum, $loop \\n\";\n if($sum == $y){\n print \"YES\";\n } \n elsif($x > $y){\n print \"NO\";\n } \n elsif($sum > $y){\n &itr($x + $loop, $y - $loop, $i-2);\n } \n} \n&itr(1, $n-1, 0);"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\n\nmy $n = <>;\nmy $s = int ((sqrt $n) + 1) * 2;\nmy %tri = ();\nmy $i = 1;\nmy $result;\nfind: while ($i <= $s) {\n\tmy $num = ($i * ($i + 1)) / 2;\n\t$tri{$num} = 1;\n\tif ($tri{$n-$num}) {\n\t\t$result = \"YES\";\n\t\tlast find;\n\t} else {\n\t\t$i++;\n\t}\n}\n$result ||= \"NO\";\nprint $result;\n\n"}], "negative_code": [{"source_code": "#!/usr/bin/perl -w\nuse strict;\n\nmy $n = <>;\nmy $s = int (sqrt $n) + 1;\nmy %tri = ();\nmy $i = 1;\nmy $result;\nfind: while ($i <= $s) {\n\tmy $num = ($i * ($i + 1)) / 2;\n\t$tri{$num} = 1;\n\tif ($tri{$n-$num}) {\n\t\t$result = \"YES\";\n\t\tlast find;\n\t} else {\n\t\t$i++;\n\t}\n}\n$result ||= \"NO\";\nprint $result;\n\n"}], "src_uid": "245ec0831cd817714a4e5c531bffd099"} {"source_code": "use Data::Dumper;\n\nmy ($n, @lengths) = split ' ', <>;\nmy @cuts;\n$cuts[0] = 0;\n\nmy %lengths = map { $_ => 1 } @lengths;\n\n\n$\\ = \"\\n\";\n$, = \" \";\nfor my $l (1..$n) {\n for my $k (keys %lengths) {\n next unless $l >= $k && defined $cuts[$l - $k];\n my $can = $cuts[$l - $k] + 1;\n $cuts[$l] = $can if $can > $cuts[$l];\n }\n}\n\nprint \"$cuts[$n]\\n\";\n", "positive_code": [{"source_code": "#!/usr/bin/perl\n#use warnings;\n#use diagnostics;\nchomp($nums = );\n@nums = split(/ /, $nums);\n$n = $nums[0];\n$a = $nums[1];\n$b = $nums[2];\n$c = $nums[3];\n$min = -1;\n$dp;\nfor ($i = 1; $i <= $n; $i++)\n{\n $dp[$i] = 0;\n}\n$dp[$a] = 1;\n$dp[$b] = 1;\n$dp[$c] = 1;\nfor ($i = 1; $i <= $n; $i++)\n{\n if ($dp[$i] == 0)\n {\n next;\n }\n if (($i + $a <= $n) && ($dp[$i] + 1 > $dp[$i + $a])) { $dp[$i + $a] = $dp[$i] + 1; }\n if ($i + $b <= $n && $dp[$i] + 1 > $dp[$i + $b]) { $dp[$i + $b] = $dp[$i] + 1; }\n if ($i + $c <= $n && $dp[$i] + 1 > $dp[$i + $c]) { $dp[$i + $c] = $dp[$i] + 1; }\n}\nprint $dp[$n];"}, {"source_code": "#!/usr/bin/perl\nsub cut {\n my $n = shift;\n my $a = shift;\n my $b = shift;\n my $c = shift;\n my @hash;\n $hash[0] = 1;\n $hash[$n] = 1;\n for ($key = 0; $key < $n; $key++) {\n if ($hash[$key] > 0) {\n foreach $elem (($a,$b,$c)) {\n my $next = $key + $elem;\n $hash[$next] = $hash[$next] > $hash[$key] + 1 ? $hash[$next] : $hash[$key] + 1;\n } \n }\n }\n return $hash[$n] - 1;\n}\nwhile(<>) {\n my @arr = split;\n my $n = $arr[0];\n my $a = $arr[1];\n my $b = $arr[2];\n my $c = $arr[3];\n print cut($n,$a,$b, $c);\n}\n"}, {"source_code": "#!/usr/bin/perl\nuse v5.10;\n\nsub max {\n\tmy ($x, $y) = (shift, shift);\n\treturn $x>$y ? $x:$y;\n}\n\n($n, @a) = split / /, <>;\n@dp = (0) x ($n+1);\nforeach $i (1 .. $n) {\n\t($i==$_ || ($i>$_ && $dp[$i-$_]>0)) and $dp[$i] = max($dp[$i], $dp[$i-$_]+1) foreach (@a);\n}\nsay $dp[$n];"}], "negative_code": [{"source_code": "#!/usr/bin/perl\nuse v5.10;\n\nsub max {\n\tmy ($x, $y) = (shift, shift);\n\treturn $x>$y ? $x:$y;\n}\n\n($n, @a) = split / /, <>;\n@dp = (0) x 4005;\nforeach $i (1 .. $n) {\n\t$i>=$a[$_] and $dp[$i] = max($dp[$i], $dp[$i-$a[$_]]+1) foreach (0..2);\n}\nsay $dp[$n];"}], "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43"} {"source_code": "<>;\n$_=<>;\n\twhile(/\\b\\d/g){\n\t\t$&%2? $v++ : $d++\n\t\t}\n\t\n\t$t=1;\n\t\n\t$d%=2 and ($v / 2 or $t=0);\n\t$v % 2 and $t=0;\n\t\nprint $t? YES : NO", "positive_code": [{"source_code": "while(<>){\n\t$_=<>;\n\t$v=0;\n\t$d=0;\n\twhile(/\\b\\d/g){\n\t\t$& == 1 and $v++;\n\t\t$& == 2 and $d++;\n\t\t}\n#\tprint \"$v $d\\n\";\n\t\n\t$t=1;\n\t\n\t$d%=2;\n\t$d and ($v / 2 or $t=0);\n\t$v % 2 and $t=0;\n\t\n\tprint $t? \"YES\\n\" : \"NO\\n\"\n\t\n\t}"}, {"source_code": "#!perl -w\n\nuse strict;\n\nchomp ( my $n = ) ;\nmy @apples = split /\\s+/s , ;\nmy @apple200 = grep{$_ == 200} @apples;\nmy @apple100 = grep{$_ == 100} @apples;\nmy $apple200d2 = @apple200 % 2 ;\nmy $apple100minfill = $apple200d2 ? @apple100 - 2 : @apple100 ;\nif($apple100minfill < 0){\n print \"NO\\n\";\n}elsif($apple100minfill % 2){\n print \"NO\\n\";\n}else{\n print \"YES\\n\";\n}\n\n\n\n"}], "negative_code": [{"source_code": "while(<>){\n\t$_=<>;\n\t$v=0;\n\t$d=0;\n\twhile(/\\b\\d/g){\n\t\t$& == 1 and $v++;\n\t\t$& == 2 and $d++;\n\t\t}\n#\tprint \"$v $d\\n\";\n\t\n\t$t=0;\n\t\n\t$d%=2;\n\t$d and ($v / 2 and $t=1);\n\t$v % 2 and $t=0;\n\t\n\tprint $t? \"YES\\n\" : \"NO\\n\"\n\t\n\t}"}, {"source_code": "while(<>){\n\t$_=<>;\n\t$v=0;\n\t$d=0;\n\twhile(/\\b\\d/g){\n\t\t$& == 1 and $v++;\n\t\t$& == 2 and $d++;\n\t\t}\n#\tprint \"$v $d\\n\";\n\t\n\t$t=0;\n\t\n\t$d%=2;\n\t$d and ($v % 2 or $t++);\n\t$d or ($v % 2 or $t++);\n\t\n\tprint $t? \"YES\\n\" : \"NO\\n\"\n\t\n\t}"}], "src_uid": "9679acef82356004e47b1118f8fc836a"} {"source_code": "#!/usr/bin/perl\nuse v5.10;\n\n\nchomp($n = <>);\nchomp($line = <>);\nforeach (split //, $line) {\n\tif ($_ == 2) {\n\t\tpush @a, 2;\n\t} elsif ($_ == 3) {\n\t\tpush @a, 3;\n\t} elsif ($_ == 4) {\n\t\tpush @a, (2, 2, 3);\n\t} elsif ($_ == 5) {\n\t\tpush @a, 5;\n\t} elsif ($_ == 6) {\n\t\tpush @a, (3, 5);\n\t} elsif ($_ == 7) {\n\t\tpush @a, 7;\n\t} elsif ($_ == 8) {\n\t\tpush @a, (2, 2, 2, 7);\n\t} elsif ($_ == 9) {\n\t\tpush @a, (2, 3, 3, 7);\n\t}\n}\nprint $_ foreach (sort { $b <=> $a } @a);", "positive_code": [{"source_code": "$\\ = $/;\nwhile(<>){\n\t$_ = <>, chomp;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint join'', map {y/10//d; $_} reverse sort split//\n\t}"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "my $n = scalar <>;\nmy $x = scalar <>;\nchomp $x;\nmy @a = (0) x 10;\nforeach my $i (split //, $x){\n if($i == 9){$i = 7; $a[3] += 2; $a[2]++;}\n if($i == 8){$i = 7; $a[2] += 3;}\n if($i == 6){$i = 5; $a[3]++;}\n if($i == 4){$i = 3; $a[2] += 2;}\n $a[$i]++;\n }\nfor(my $i = 9; $i > 1; $i--){\n print $i x $a[$i];\n }\nprint \"\\n\";\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "<>;\nmy $inp = int <>;\n\n$inp =~ tr/01//d;\n$inp =~ s/4/223/g;\n$inp =~ s/6/53/g;\n$inp =~ s/8/7222/g;\n$inp =~ s/9/7332/g;\nprint reverse sort split //, $inp;\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "use strict;\n\nuse List::Util qw(first max maxstr min minstr reduce shuffle sum);\n<>;\nmy @input = split //, <>;\nmy $h=1;\nmy @ar;\nfor (@input)\n{\n push @ar, (Er(fact($_)));\n}\n\nmy $p ={\n2 =>\"2\",\n3 =>\"23\",\n5 =>\"22235\",\n7 =>\"22223357\"\n};\n@ar = reverse sort @ar;\nmy @s = @ar;\nmy @d;\nuntil($#s == -1)\n{\n push @d , $s[0];\n @s = Reject(@s,$p->{$s[0]}); \n}\nprint @d;\n\n\nsub Reject(\\@$)\n{\n my @a;\n my @d = split //, pop;\n @a = @_;\n g:for my $p (@d)\n {\n for (@a)\n {\n if ($p == $_)\n {\n $_ = 0;\n next g;\n }\n }\n }\n return (grep {$_ != 0} @a);\n};\n\n\n\n\nsub Er\n{\n my $n=shift;\n my @ans;\n \n for(2..$n)\n {\n until($n % $_)\n {\n push @ans, $_;\n $n /=$_;\n }\n }\n \n \n return @ans;\n};\nsub nod\n {\n return $_[0] != 0 ? nod ( ( $_[1] % $_[0] ), $_[0] ) : $_[1];\n };\n\nsub fact()\n{\n my $n = shift;\n my $s = 1;\n for (1..$n)\n {\n $s*=$_;\n }\n return $s;\n \n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "chomp (my $n = <>);\nchomp (my @d = split /\\s*/, <>);\n\nmy @r;\n\nforeach (@d) {\n if (($_ == 0) || ($_ == 1)) {\n next;\n } elsif ($_ == 9) {\n push @r, 3, 3, 2, 7\n } elsif ($_ == 8) {\n push @r, 2, 2, 2, 7\n } elsif ($_ == 4) {\n push @r, 2, 2, 3\n } elsif ($_ == 6) {\n push @r, 3, 5;\n } else {\n push @r, $_\n }\n # printf \"$_ -> @r\\n\";\n}\n\nprintf \"%s\\n\", join \"\", sort {$b <=> $a} @r;\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nsub fact{\n my ($n) = @_;\n my @res = (0) x 10;\n for(my $i = 2; $i <= $n; $i++){\n while($n % $i == 0){\n $res[$i]++;\n $n /= $i;\n }\n }\n return @res;\n}\nsub opr{\n my @a = @{$_[0]};\n my @b = @{$_[1]};\n my $opr = $_[2];\n\n #print @b, \"\\n\";\n for my $i(2..9){\n #print \"be: $a[$i]\\n\";\n $a[$i] = $opr>0? $a[$i] + $b[$i] : $a[$i] - $b[$i];\n #print \"af: $a[$i]\\n\";\n }\n return @a;\n}\n#================\n\n\nmy $n = <>;\nmy $num = <>;\nmy $res = '';\nmy @arr = (0) x 10;\nfor my $i(0..$n-1){\n my $d = substr($num, $i,1);\n for my $j(2..$d){\n my @fact = fact $j;\n #print \"fact = @fact\\n\";\n @arr = opr(\\@arr,\\@fact,1);\n #print \"arr = @arr\\n\";\n #print \"\\n\";\n }\n}\n\nfor(my $i = 9; $i >=2; $i--){\n #print \"arr $i : $arr[$i]\\n\"; \n while($arr[$i] > 0){\n $res .= $i;\n for my $d(2..$i){\n my @fact = fact $d;\n @arr = opr(\\@arr,\\@fact,-1);\n }\n }\n}\n\nprint $res;\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}, {"source_code": "use strict;\nuse warnings;\nuse Data::Dumper;\n\nmy %h = ( \"1\" => \"1\" , \"2\" => \"2\" , \"3\"=>\"3\",\n\t \"4\" => \"322\" , \"5\" => \"5\" , \"6\"=>\"53\",\n\t \"7\" => \"7\" , \"8\" => \"7222\" , \"9\"=>\"7332\"\n\t );\n\nmy $x = ;\n$x = ;\nchomp $x;\nmy @a = split(//, $x);\nmap { $a[$_] = $h{$a[$_]} } keys @a;\n\nmy $rez = join(\"\", (sort { $b <=> $a} split( // ,join(\"\",@a))));\n$rez =~ s/1//g;\nprint $rez;\n\n\n"}, {"source_code": "<>, $_ = <>, chomp;\ny/10//d;\ns/4/223/g;\ns/6/53/g;\ns/8/7222/g;\ns/9/7332/g;\nprint reverse sort split//\n"}], "negative_code": [{"source_code": "use strict;\nuse warnings;\nuse List::Util qw(reduce);\nprint \"5\\n\";"}, {"source_code": "use strict;\n\nuse List::Util qw(first max maxstr min minstr reduce shuffle sum);\n\nmy @input = split //, <>;\nmy $h=1;\nmy @ar;\nfor (@input)\n{\n push @ar, (Er(fact($_)));\n}\n\nmy $p ={\n2 =>\"2\",\n3 =>\"23\",\n5 =>\"22235\",\n7 =>\"22223357\"\n};\n@ar = reverse sort @ar;\nmy @s = @ar;\nmy @d;\nuntil($#s == -1)\n{\n push @d , $s[0];\n @s = Reject(@s,$p->{$s[0]}); \n}\nprint @d;\n\n\nsub Reject(\\@$)\n{\n my @a;\n my @d = split //, pop;\n @a = @_;\n g:for my $p (@d)\n {\n for (@a)\n {\n if ($p == $_)\n {\n $_ = 0;\n next g;\n }\n }\n }\n return (grep {$_ != 0} @a);\n};\n\n\n\n\nsub Er\n{\n my $n=shift;\n my @ans;\n \n for(2..$n)\n {\n until($n % $_)\n {\n push @ans, $_;\n $n /=$_;\n }\n }\n \n \n return @ans;\n};\nsub nod\n {\n return $_[0] != 0 ? nod ( ( $_[1] % $_[0] ), $_[0] ) : $_[1];\n };\n\nsub fact()\n{\n my $n = shift;\n my $s = 1;\n for (1..$n)\n {\n $s*=$_;\n }\n return $s;\n \n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "chomp (my $n = <>);\nchomp (my @d = split /\\s*/, <>);\n\nmy @r;\n\nforeach (@d) {\n if (($_ == 0) || ($_ == 1)) {\n next;\n } elsif ($_ == 8) {\n push @r, 2, 2, 2, 7\n } elsif ($_ == 4) {\n push @r, 2, 2, 3\n } elsif ($_ == 6) {\n push @r, 3, 5;\n } else {\n push @r, $_\n }\n # printf \"$_ -> @r\\n\";\n}\n\nprintf \"%s\\n\", join \"\", sort {$b <=> $a} @r;\n"}, {"source_code": "chomp (my $n = <>);\nchomp (my @d = split /\\s*/, <>);\n\nmy @r;\n\nforeach (@d) {\n if (($_ == 0) || ($_ == 1)) {\n next;\n } elsif ($_ == 4) {\n push @r, 2, 2, 3\n } elsif ($_ == 6) {\n push @r, 3, 5;\n } else {\n push @r, $_\n }\n # printf \"$_ -> @r\\n\";\n}\n\nprintf \"%s\\n\", join \"\", sort {$b <=> $a} @r;\n"}, {"source_code": "use strict;\nuse warnings;\nuse Data::Dumper;\n\nmy %h = ( \"1\" => \"1\" , \"2\" => \"2\" , \"3\"=>\"3\",\n\t \"4\" => \"322\" , \"5\" => \"5\" , \"6\"=>\"53\",\n\t \"7\" => \"7\" , \"8\" => \"7222\" , \"9\"=>\"8332\"\n\t );\n\nmy $x = ;\n$x = ;\nchomp $x;\nmy @a = split(//, $x);\nmap { $a[$_] = $h{$a[$_]} } keys @a;\n\nmy $rez = join(\"\", (sort { $b <=> $a} split( // ,join(\"\",@a))));\n$rez =~ s/1//g;\nprint $rez;\n\n\n"}], "src_uid": "60dbfc7a65702ae8bd4a587db1e06398"} {"source_code": "print substr( (join '', 1 .. 1e3), <> - 1, 1 )", "positive_code": [{"source_code": "print( (split '', join '', 1 .. 1e3)[ <> - 1 ] )"}, {"source_code": "$_ = join '', 1 .. 1000;\nchomp( $index = <> );\nprint substr $_, $index - 1, 1;"}], "negative_code": [], "src_uid": "2d46e34839261eda822f0c23c6e19121"} {"source_code": "#!/usr/bin/perl\nuse 5.016;\nmy %signs;\n\nmy $i = 0;\nfor (\"A\" .. \"Z\") {\n\t$signs{$_} = $i++;\n}\n\n# sub is_begramm {\n# \tmy ($a, $b) = @_;\n# \tif(abs($signs{$a} - $signs{$b}) < 2) { return 1 }\n# \tif ($a eq \"a\" && $b eq \"z\" or $a eq \"z\" && $b eq \"a\") { return 1 }\n# \treturn 0;\n# }\n\n\nmy $c = <>;\nmy $s = <>;\nchomp $s;\nmy @s = split //, $s;\nmy %bigrams;\n\n\n$bigrams{$s[$_].$s[$_ + 1]}++ for (0..$#s - 1);\n\n\nmy $max_val = 0;\nmy $max_key = \"\";\nfor (keys %bigrams) {\n\tif ($bigrams{$_} > $max_val) {\n\t\t$max_val = $bigrams{$_};\n\t\t$max_key = $_;\n\t}\n}\n\nsay $max_key;", "positive_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy %h;\n\t\n\t<> =~ /(.)(?=(.))(?{ $h{ $1 . $2 } ++ })(?!)/;\n\t\n\tmy $max = ( sort { $b <=> $a } values %h )[ 0 ];\n\t\n\tmy $ans;\n\t\n\t$h{ $_ } == $max and $ans = $_ for keys %h;\n\t\n\tprint $ans;\n\t}"}], "negative_code": [{"source_code": "#!/usr/bin/perl\nuse 5.016;\nmy %signs;\n\nmy $i = 0;\nfor (\"A\" .. \"Z\") {\n\t$signs{$_} = $i++;\n}\n\nsub is_begramm {\n\tmy ($a, $b) = @_;\n\tif(abs($signs{$a} - $signs{$b}) < 2) { return 1 }\n\tif ($a eq \"a\" && $b eq \"z\" or $a eq \"z\" && $b eq \"a\") { return 1 }\n\treturn 0;\n}\n\n\nmy $c = <>;\nmy $s = <>;\nchomp $s;\nmy @s = split //, $s;\nmy %bigrams;\n\nfor (0..$#s - 1) {\n\t$bigrams{$s[$_].$s[$_ + 1]}++ if is_begramm($s[$_], $s[$_ + 1]) \n}\n\n\nmy $max_val = 0;\nmy $max_key = \"\";\nfor (keys %bigrams) {\n\tif ($bigrams{$_} > $max_val) {\n\t\t$max_val = $bigrams{$_};\n\t\t$max_key = $_;\n\t}\n}\n\nsay $max_key;"}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy %h;\n\t\n\t<> =~ /(.)(?=(.))(?{ $h{ $1 . $2 } ++ })/;\n\t\n\tmy $max = ( sort { $b <=> $a } values %h )[ 0 ];\n\t\n\tmy $ans;\n\t\n\t$h{ $_ } == $max and $ans = $_ for keys %h;\n\t\n\tprint $ans;\n\t}"}], "src_uid": "e78005d4be93dbaa518f3b40cca84ab1"} {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n$n=@_=split/ /,<>;\n\nfor $i(0..$n-2){\n\tfor $j(0..$n-2){\n\t\t\tif ($_[$i]<$_[$i+1]){$a=$_[$i];$b=$_[$i+1]}else{$b=$_[$i];$a=$_[$i+1]};\n\t\t\tif ($_[$j]<$_[$j+1]){$c=$_[$j];$d=$_[$j+1]}else{$d=$_[$j];$c=$_[$j+1]};\n\t\t\t($a<$c && $c<$b && $b<$d) || ($c<$a && $a<$d && $d<$b) and $F++;\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";", "positive_code": [{"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n$n=@_=split/ /,<>;\n\n$i=$n-1;\nwhile($i--){\n\t$j=$n-1;\n\twhile($j--){\n\t\t\t$y=$_[$i]; $z=$_[$i+1];\n\t\t\tif ($y<$z){$a=$y;$b=$z}else{$b=$y;$a=$z};\n\t\t\t$y=$_[$j]; $z=$_[$j+1];\n\t\t\tif ($y<$z){$c=$y;$d=$z}else{$d=$y;$c=$z};\n\t\t\t(($a<$c) && ($c<$b) && ($b<$d)) || (($c<$a) && ($a<$d) && ($d<$b)) and $F++;\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n@_=split/ /,<>;\n\nfor $i(0..@_-2){\n\tfor $j(0..@_-2){\n\t\t\n\t\t\t($a,$b)=sort {$a <=> $b} ($_[$i],$_[$i+1]);\n\t\t\t($c,$d)=sort {$a <=> $b} ($_[$j],$_[$j+1]);\n\t\t\t($a<$c && $c<$b && $b<$d) || ($c<$a && $a<$d && $d<$b) and $F++;\n\t\t\t\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n$n=@_=split/ /,<>;\n\n$i=$n-1;\nwhile($i--){\n\t$j=$n-1;\n\twhile($j--){\n\t\t\tif ($_[$i]<$_[$i+1]){$a=$_[$i];$b=$_[$i+1]}else{$b=$_[$i];$a=$_[$i+1]};\n\t\t\tif ($_[$j]<$_[$j+1]){$c=$_[$j];$d=$_[$j+1]}else{$d=$_[$j];$c=$_[$j+1]};\n\t\t\t(($a<$c) && ($c<$b) && ($b<$d)) || (($c<$a) && ($a<$d) && ($d<$b)) and $F++;\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n$n=@_=split/ /,<>;\n\n$i=$n-1;\nwhile($i--){\n\t$j=$n-1;\n\twhile($j--){\n\t\t\tif ($_[$i]<$_[$i+1]){$a=$_[$i];$b=$_[$i+1]}else{$b=$_[$i];$a=$_[$i+1]};\n\t\t\tif ($_[$j]<$_[$j+1]){$c=$_[$j];$d=$_[$j+1]}else{$d=$_[$j];$c=$_[$j+1]};\n\t\t\t($a<$c && $c<$b && $b<$d) || ($c<$a && $a<$d && $d<$b) and $F++;\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n@_=split/ /,<>;\n$a=shift @_;\nwhile (@_){\n\t$max=max(@_);\n\t$min=min(@_);\n\t$a>$max || $a<$min or $F++ or last;\n\t$a=shift @_;\n\t}\n\t\nprint $F?\"yes\":\"no\";\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n@_=split/ /,<>;\n\nfor $i(0..@_-2){\n\tfor $j(0..@_-2){\n\t\tif ($i!=$j){\n\t\t\t($a,$b)=sort {$a <=> $b} ($_[$i],$_[$i+1]);\n\t\t\t($c,$d)=sort {$a <=> $b} ($_[$j],$_[$j+1]);\n\t\t\t($a<$c && $c<$b && $b<$d) || ($c<$a && $a<$d && $d<$b) and $F++ or last;\n\t\t\t}\n\t\t}\n\t}\n\n print $F?\"yes\":\"no\";\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}], "src_uid": "f1b6b81ebd49f31428fe57913dfc604d"} {"source_code": "use strict;\nuse warnings;\n\n\n<>;\nmy $str=<>;\nchomp($str);\n$str =~ s/ogo(go)*/***/g;\n\nprint $str . \"\\n\";\n", "positive_code": [{"source_code": "$dummy=;\n$word = ;\n$word =~ s/ogo(go)*/\\*\\*\\*/g;\nprint \"$word\";\n"}, {"source_code": "$n=<>;\n$ch=<>;\nchomp$ch;\nwhile($ch=~s/(ogo(go)*)/\\*\\*\\*/){\n\n}\n\nprint $ch;\n\n"}, {"source_code": "#!/usr/bin/perl\n$str=<> ;\n$str=<> ;\n$str=~s/ogo(go)*/***/g ;\nprint $str ;\n"}, {"source_code": "#Scott Heinrich - A01273823\nuse strict;\nuse warnings;\nuse 5.010;\n\nmy $length = <>;\nchomp($length);\nmy $s = <>;\nchomp($s);\n\n$s =~ s/ogo(?:go)*/***/g;\nsay $s;\n"}, {"source_code": "my $n = <>;\nmy $s = <>;\n$s =~ s/ogo(go)*/\\*\\*\\*/gi;\nprint $s;"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\n\nmy $n = int <>;\nmy $s = <>;\n$s =~ s/ogo(?:go)*/***/g;\nprint $s;\n"}, {"source_code": "#!perl\nuse v5.20;\nwhile(<>) {\n chomp; my $n=$_;\n my $s=<>;\n $s=~s/ogo(go)*/***/g;\n print $s;\n}\n"}, {"source_code": "my $line = <>;\nwhile (<>)\n{\n s/ogo(go)*/***/g;\n print;\n}\n"}], "negative_code": [{"source_code": "use strict;\nuse warnings;\nuse 5.010;\n\nmy $input = <>;\nchomp($input);\n\nmy %totalHash;\nmy @totalArr;\nmy $len = length($input);\n\nfor my $i (0 .. $len)\n{\n my $len2=$len;\n for my $j (1 .. $len2)\n {\n my $sub = substr($input, $i, $j);\n #say $sub;\n if(length($sub)>0)\n {\n if($sub % 4 == 0 or $sub == 0)\n {\n #say $sub;\n #$totalHash{$sub} = 1;\n push(@totalArr, $sub);\n }\n }\n $len2--;\n }\n $len--;\n}\n#my $size = keys %totalHash;\nmy $size = scalar @totalArr;\nsay $size;\n\n#foreach my $key(keys %totalHash)\n#{\n# say $key;\n#}\n"}, {"source_code": "$word = ;\n$word =~ s/ogo(go)*/\\*\\*\\*/g;\nprint \"$word\";\n"}], "src_uid": "619665bed79ecf77b083251fe6fe7eb3"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $l, $r ) = split;\n\t\n\tprint $r - $l >= 1 ? 2 : $r;\n\t\n\t}", "positive_code": [{"source_code": "print <>=~ /^(\\d+) \\1$/ ? $1 : 2"}, {"source_code": "( $l, $r ) = split ' ', <>;\n\nprint $r - $l ? 2 : $r"}], "negative_code": [], "src_uid": "a8d992ab26a528f0be327c93fb499c15"} {"source_code": "$\\ = $/;\n\nwhile(<>){\n\t($t, $s, $x) = split;\n\t$x -= $t;\n\tprint( ( ($x % ($s) == 0 or ($x - 1) % ($s) == 0) and ($x == 0 or $x > 1) ) ? \n\t\t'YES'\n\t:\n\t\t'NO'\n\t)\n\t\n\t}\n", "positive_code": [{"source_code": "($t, $s, $x) = split ' ', <>;\n$x -= $t;\nprint qw(NO YES)[ !($x % $s && ~- $x % $s) and !$x || $x > 1 ]"}], "negative_code": [{"source_code": "$\\ = $/;\n\nwhile(<>){\n\t($t, $s, $x) = split;\n\t$x -= $t;\n\tprint( ( ($x % ($s) == 0 or ($x - 1) % ($s) == 0) and ($x - 1 != 0) ) ? \n\t\t'YES'\n\t:\n\t\t'NO'\n\t)\n\t\n\t}"}], "src_uid": "3baf9d841ff7208c66f6de1b47b0f952"} {"source_code": "($a,$b,$c)=split' ',<>;\n@a=();\nfor$s(1..81){\n\t$x=int .5+$b*$s**$a+$c;\n\tnext if $x>=1e9||$x<=0;\n\t$sx=0;\n\t$sx+=$_ for $x=~/./g;\n\tpush @a,$x if $s==$sx;\n}\nprint 0+@a,\"\\n@a\\n\";\n", "positive_code": [{"source_code": "use bignum;\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..81){\n$_ = $x = $b * $i**$a + $c;\n$s=0;\ns/./$s+=$&/ge;\nif ($i == $s and $x<10**9){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}], "negative_code": [{"source_code": "use bignum;\n\nsub sss{\n\t$x=shift;\n\t@x=split//, $x;\n\t$s=0;\n\tfor $j(@x){$s+=$j}\n\treturn $s;\n\t}\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..81){\n$x = $b * $i**$a + $c;\nif ($i == sss($x)){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}, {"source_code": "use bignum;\n\nsub sss{\n\t$x=shift;\n\t@x=split//, $x;\n\t$s=0;\n\tfor $j(@x){$s+=$j}\n\treturn $s;\n\t}\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..81){\n$x = $b * $i**$a + $c;\nif ($i == sss($x) and $i<10**9){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}, {"source_code": "use bignum;\n\nsub sss{\n\t$x=shift;\n\t@x=split//, $x;\n\t$s=0;\n\tfor $j(@x){$s+=$j}\n\treturn $s;\n\t}\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..72){\n$x = $b * $i**$a + $c;\nif ($i == sss($x) and $i<10**9){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}, {"source_code": "($a,$b,$c)=split' ',<>;\n@a=();\nfor$s(1..45){\n\t$x=int .5+$b*$s**$a+$c;\n\tnext if $x>=1e9||$x<=0;\n\t$sx=0;\n\t$sx+=$_ for $x=~/./g;\n\tpush @a,$x if $s==$sx;\n}\nprint 0+@a,\"\\n@a\\n\";\n"}, {"source_code": "use bignum;\n\nsub sss{\n\t$x=shift;\n\t@x=split//, $x;\n\t$s=0;\n\tfor $j(@x){$s+=$j}\n\treturn $s;\n\t}\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..72){\n$x = $b * $i**$a + $c;\nif ($i == sss($x)){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}, {"source_code": "use bignum;\n\n($a,$b,$c)=split/ /,<>;\nfor $i(1..81){\n$_ = $b * $i**$a + $c;\n$s=0;\ns/./$s+=$&/ge;\nif ($i == $s and $i<10**9){\npush @a, $x;\n}\n\n}\n@a=sort{$a<=>$b}@a;\nprint 0+@a, \"\\n@a\""}], "src_uid": "e477185b94f93006d7ae84c8f0817009"} {"source_code": "#Scott Heinrich - A01273823\nuse warnings;\nuse 5.010;\n\nmy $n = <>;\n\nif($n < 13)\n{\n\tsay 2**$n;\n}\nelse\n{\n\tmy $k = $n - 13;\n\tsay 2**$n - (100*(2**$k));\t\n}\n", "positive_code": [{"source_code": "$a=<>;\nif($a<13) {\n print 2**$a,\"\\n\"; \n} else {\n print 8092*2**($a-13),\"\\n\";\n}\n"}], "negative_code": [{"source_code": "#Scott Heinrich - A01273823\nuse warnings;\nuse 5.010;\n\nmy $n = <>;\n\nsay 2**$n;\n"}, {"source_code": "#Scott Heinrich - A01273823\nuse warnings;\nuse 5.010;\n\nmy $n = <>;\n\nif($n < 13)\n{\n\tsay 2**$n;\n}\nelse\n{\n\t$n -= 13;\n\tsay 2**$n;\t\n}\n"}, {"source_code": "$a=<>;print 2**$a,\"\\n\";\n"}], "src_uid": "76f6ebfaeea789952c931d65c6a5fdff"} {"source_code": "use strict;\nuse warnings;\n\nsub main{\n\tmy $word = ;\n\tmy @array = split(//, $word);\n\n\tmy $prev = 'a';\n\tmy $result = 0;\n\n\tfor (my $i = 0; $i < scalar(@array) - 1; $i++) {\n\t\tmy $char = $array[$i];\n\n\t\tmy $var1 = abs(ord($char) - ord($prev));\n\t\tmy $var2 = 26 - abs(ord($char) - ord($prev));\n\n\t\t$result += ($var1, $var2)[$var1 > $var2];\n\t\t$prev = $char; \n\t}\n\n\tprint \"$result\\n\";\n}\n\nmain;", "positive_code": [{"source_code": "$_ = \"a\".<>;\n/(.)(.)(?{ $d=abs(ord($1)-ord($2)); $c+= ($d<13? $d: 26-$d) })(*FAIL)/;\nprint $c;\n"}, {"source_code": "$,=\" \";\nmy $k=0;\nmy %a=map {$_ => $k++ }('a'..'z');\n\nmy $s=<>;\nchomp($s);\nmy $p=0;\nmy $ans=0;\nfor(my $i=0;$i $_[1] ? $_[1] : $_[0];\n}\n\nsub max_{\n\treturn $_[1] > $_[0] ? $_[1] : $_[0];\n}\n\nsub min{\n\tmy $a=shift;\n\tmy $mm=$a->[0];\n\tfor(my $i=1;$i<@{$a};$i++)\n\t{\n\t\t$mm=min_($mm,$a->[$i]);\n\t}\n\treturn $mm;\n}\n\nsub max{\n\tmy $a=shift;\n\tmy $mm=$a->[0];\n\tfor(my $i=1;$i<@{$a};$i++)\n\t{\n\t\t$mm=max_($mm,$a->[$i]);\n\t}\n\treturn $mm;\n}\n"}, {"source_code": "$\\ = $/;\n\n$A = join '', ('a' .. 'z') x 2, (reverse 'a' .. 'z') x 2;\n\nwhile(<>){\n\tchomp;\n\ts/^/a/;\n\t$sum = 0;\n\t\n\twhile( /(?=(.)(.))/g ){\n\t\t($_1, $_2) = ($1, $2);\n\t\t$_1 eq $_2 and next;\n\t\t$sum += (sort {$a <=> $b} map -1+length, $A =~ /$_1.*?$_2/g)[ 0 ];\n\t\t}\n\t\n\tprint $sum\n\t}"}, {"source_code": "(a . <>) =~ s/(?=(.)(.))/\n\t$z += (sort {$a <=> $b} map abs($_ + ord( $1 ) - ord $2), 0, 26, -26)[ 0 ]\n\n/regex;\n\nprint $z"}], "negative_code": [], "src_uid": "ecc890b3bdb9456441a2a265c60722dd"} {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n", "positive_code": [{"source_code": "$l=<>;\nchomp($i=<>);\nprint grep /^$i$/,qw(vaporeon jolteon flareon espeon umbreon leafeon glaceon sylveon)"}, {"source_code": "$l=<>;\nchomp($i=<>);\nfor(qw(Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon)){\n if(/$i/i && $l==length) {\n print lc;\n last;\n }\n}"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\n\nmy @words = (\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\");\nchomp($_ = <>);\nchomp($_ = <>);\nmy $qr = qr/^$_$/;\nfor (@words) {\n print if /$qr/;\n}\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nno warnings 'uninitialized';\n\nmy $N = <>+0;\nmy $S = <>;\nchomp $S;\n\nmy ($res) = grep /^$S$/i,\n qw/Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon/;\n\nprint lc( $res ), \"\\n\"\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "@pok=(\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\");\n$n=<>;\n$ch=<>;\nchomp$ch;\nif($n==6){\nprint $pok[3];\n}\nelsif($n==8){\nprint $pok[0];\n}\nelsif($ch=~/^[j\\.][o\\.][l\\.][t\\.]/){\nprint $pok[1];\n}\nelsif($ch=~/^[f\\.][l\\.][a\\.][r\\.]/){\nprint $pok[2];\n}\nelsif($ch=~/^[u\\.][m\\.][b\\.][r\\.]/){\nprint $pok[4];\n}\nelsif($ch=~/^[l\\.][e\\.][a\\.][f\\.]/){\nprint $pok[5];\n}\nelsif($ch=~/^[s\\.][y\\.][l\\.][v\\.]/){\nprint $pok[7];\n}\nelse{\nprint $pok[6];\n}\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "<>;<>=~/...$/;/^$`$/&&print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)\n"}, {"source_code": "<>;\n<>=~/...$/;\n$m=$`;\n/^$m$/ && print $_.\"eon\" for qw(vapor jolt flar esp umbr leaf glac sylv)"}, {"source_code": "<>;\nchomp ($m=<>);\n/^$m$/ && print for qw(vaporeon jolteon flareon espeon umbreon leafeon glaceon sylveon)"}], "negative_code": [{"source_code": "<>; \nchomp($i=<>);\nfor(qw(Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon)){\n if(/$i/i) {\n print lc;\n last;\n }\n}"}, {"source_code": "<>; \nchomp($i=<>);\nfor(qw(Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon)){\n print lc if /$i/i;\n}"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nno warnings 'uninitialized';\n\nmy $N = <>+0;\nmy $S = <>;\nchomp $S;\n\nmy ($res) = grep /$S/i,\n qw/Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon/;\n\nprint lc( $res ), \"\\n\"\n\n\n"}, {"source_code": "@pok=(\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\");\n$n=<>;\n$ch=<>;\nchomp$ch;\nif($n==6){\nprint $pok[3];\n}\nelsif($n==8){\nprint $pok[0];\n}\nelsif($ch=~/[j\\.][o\\.][l\\.][t\\.]/){\nprint $pok[1];\n}\nelsif($ch=~/[f\\.][l\\.][a\\.][r\\.]/){\nprint $pok[2];\n}\nelsif($ch=~/[u\\.][m\\.][b\\.][r\\.]/){\nprint $pok[4];\n}\nelsif($ch=~/[l\\.][e\\.][a\\.][f\\.]/){\nprint $pok[5];\n}\nelsif($ch=~/[s\\.][y\\.][l\\.][v\\.]/){\nprint $pok[7];\n}\nelse{\nprint $pok[6];\n}"}, {"source_code": "<>;\n$m=<>;\nchomp $m;\n/$m/i and print for qw(Vaporeon Jolteon Flareon Espeon Umbreon Leafeon Glaceon Sylveon)"}, {"source_code": "<>;\nchomp ($m=<>);\n/$m/ && print for qw(vaporeon jolteon flareon espeon umbreon leafeon glaceon sylveon)"}, {"source_code": "while(<>){\n\tchomp;\n\t@_=(\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\");\n\t$match=<>;\n\tchomp $match;\n\t/$match/ and print for @_;\n\t\n\tprint \"\\n\"\n\t}"}], "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0"} {"source_code": "<>; $_ = <>;\n$a = /[1470]/ + /[123]/ + /[3690]/ + /[709]/;\nprint ($a == 4? \"YES\": \"NO\");", "positive_code": [{"source_code": "<>; $_ = <>;\n$a = /[1470]/ + /[123]/ + /[3690]/ + /[709]/;\n$b = ($a == 4? \"YES\": \"NO\");\nprint $b;\n\n\n"}, {"source_code": "<>; $_ = <>;\nprint (/[1470]/ + /[123]/ + /[3690]/ + /[709]/ == 4? \"YES\": \"NO\");"}], "negative_code": [], "src_uid": "d0f5174bb0bcca5a486db327b492bf33"} {"source_code": "($n,$m)=split/ /,<>;@a[1]=1;for$y(2..$n){@a[$y]=(@a[$y]+2*@a[$y-1]+1)%$m;@a[$y]=(@a[$y]-@a[$y-1])%$m if($y==2);@a[$_*$y]=(@a[$_*$y]+(@a[$y]-@a[$y-1]+$m)%$m)%$m for(2..$n/$y)};print@a[$n]", "positive_code": [{"source_code": " ($n,$m)=split/ /,<>;@a[1]=1;for$x(2..$n){@a[$x]=(@a[$x]+2*@a[$x-1]+1)%$m;@a[$x]=(@a[$x]-@a[$x-1])%$m if($x<3);@a[$_*$x]=(@a[$_*$x]+(@a[$x]-@a[$x-1]+$m)%$m)%$m for(2..$n/$x)};print@a[$n]"}, {"source_code": "($n,$m)=split/ /,<>;@a[1]=1;for$x(2..$n){@a[$x]=(@a[$x]+2*@a[$x-1]+1)%$m;@a[$x]=(@a[$x]-@a[$x-1])%$m if($x==2);@a[$_*$x]=(@a[$_*$x]+(@a[$x]-@a[$x-1]+$m)%$m)%$m for(2..$n/$x)};print@a[$n]"}, {"source_code": "($n,$m)=split/ /,<>;@a[1]=1;for$y(2..$n){@a[$y]=(@a[$y]+2*@a[$y-1]+1)%$m;@a[$y]=(@a[$y]-@a[$y-1])%$m if($y<3);@a[$_*$y]=(@a[$_*$y]+(@a[$y]-@a[$y-1]+$m)%$m)%$m for(2..$n/$y)};print@a[$n]"}], "negative_code": [], "src_uid": "a524aa54e83fd0223489a19531bf0e79"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\nmy $debug = 0;\n\nwhile(<>){\n\tchomp;\n\tmy $n = $_;\n\t\n\tmy $ans = '';\n\tmy $sum = 0;\n\t\n\tfor my $L ( 'a' .. 'z' ){\n\t\t\n\t\tfor my $i ( 0 .. 1e3 ){\n\t\t\t\n\t\t\t$debug and print \"sum:[$sum]\";\n\t\t\t\n\t\t\tif( $sum + $i > $n ){\n\t\t\t\tlast;\n\t\t\t\t}\n\t\t\t\n\t\t\t$sum += $i;\n\t\t\t$ans .= $L;\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t}\n\t\n\tprint $ans;\n\t$debug and print \"final sum: [$sum]\";\n\t\n\t}", "positive_code": [{"source_code": "while( $n = <> ){\n\t\n\tfor $L ( 'a' .. 'z' ){\n\t\t\n\t\tfor ( 0 .. 1e3 ){\n\t\t\t\t\t\t\n\t\t\tlast if $sum + $_ > $n;\n\t\t\t\n\t\t\t$sum += $_;\n\t\t\tprint $L;\n\t\t\t\n\t\t\t}\n\t\t}\n\t}"}], "negative_code": [], "src_uid": "b991c064562704b6106a6ff2a297e64a"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\t@_ = split ' ', <>;\n\t\n\tmy $sum = unpack( '%32i' . @_, pack( 'i' x @_, @_ ) );\n\t\n\tmy $diff = 0;\n\tmy $to_eval = 0;\n\t\n\twhile( @_ > 0 ){\n\t\tmy $last = pop @_;\n\t\t\n\t\tif( $last - $diff > $diff - $last ){\n\t\t\t$to_eval = \"( 0 + $last - $to_eval )\";\n\t\t\t}\n\t\telse{\n\t\t\t$to_eval = \"( 0 - $last + $to_eval )\";\n\t\t\t}\n\t\t\n\t\t$diff = abs( $last - $diff );\n\t\t}\n\t\n\tmy $eval = eval $to_eval;\n\t\n\tprint( ( $sum - $eval ) / 2, ' ', ( $sum - $eval ) / 2 + $eval );\n\t}", "positive_code": [{"source_code": "<>;\n\t\n@_ = split ' ', <>;\n\t\n$tE = 0;\n\nfor( reverse @_ ){\n\t\n\t$sum += $_;\n\t$tE = \"( -1 ) * \" x ( $_ - $d < $d - $_ ) . \"( $_ - $tE )\";\n\t\n\t$d = abs( $_ - $d );\n\t}\n\n$E = eval $tE;\n$D = $sum - $E >> 1;\n\nprint \"$D \", $D + $E"}, {"source_code": "<>;\n\n$x = ( sort { $b <=> $a } $x, $_ + $s - $x )[ 0 ], $s += $_ for reverse split ' ', <>;\n\nprint $s - $x, \" $x\""}], "negative_code": [], "src_uid": "414540223db9d4cfcec6a973179a0216"} {"source_code": "#!/usr/bin/perl -wn\nchomp;\n($n, $t) = split / /;\n$\\ = $/;\nif ( $n == 1 ) {\n print $t != 10 ? \"$t\" : \"-1\"; next;\n}\n$\\ = '';\n\nprint \"$t\";\nfor ( 1..($n - length $t) ) {\n print \"0\";\n}\nprint \"\\n\";\n\n", "positive_code": [{"source_code": "use bigint;\nchomp( ( $n, $t ) = split / /, <> );\nif ( $n < length($t) ) { print -1; exit; }\n$c = 10**( $n - 1 );\nwhile ( length($c) <= $n ) {\n if ( $c % $t == 0 ) {\n print $c;\n exit;\n }\n $c++;\n}\n\nprint -1;\n"}, {"source_code": "#!/usr/bin/perl -wn\nchomp;\n($n, $t) = split / /;\n$\\ = $/;\nif ( $n == 1 ) {\n print $t != 10 ? \"$t\" : \"-1\"; next;\n}\nprint \"$t\" . \"0\" x ($n - length $t);\n"}, {"source_code": "#!/usr/bin/perl -wn\n# div2a_1.pl --- \n# Author: liuxueyang \n# Created: 11 Oct 2015\n# Version: 0.01\n\n#use warnings;\n#use strict;\n\nchomp;\n($n, $t) = split / /;\n\nif ( $n == 1 ) {\n if ( $t != 10 ) {\n print \"$t\\n\";\n next;\n }\n else {\n print \"-1\\n\";\n next;\n }\n}\nelsif ($t == 5 || $t == 10) {\n print \"1\" x ($n - 1) . \"0\\n\";\n next;\n}\nelsif ( $t == 2 ) {\n print \"1\" x ($n - 1) . \"2\\n\";\n next;\n}\n$mod = 0;\n\nfor ( 2..$n ) {\n $mod = ($mod * 10 + 1) % $t;\n}\nprint \"1\" x ($n - 1);\n$mod = $mod * 10;\n\nfor ( 0..9 ) {\n if ( ($mod + $_) % $t == 0) {\n print \"$_\\n\";\n last;\n }\n}\n__END__\n\n=head1 NAME\n\ndiv2a_1.pl - Describe the usage of script briefly\n\n=head1 SYNOPSIS\n\ndiv2a_1.pl [options] args\n\n -opt --long Option description\n\n=head1 DESCRIPTION\n\nStub documentation for div2a_1.pl, \n\n=head1 AUTHOR\n\nliuxueyang, Earies@JemirE\n\n=head1 COPYRIGHT AND LICENSE\n\nCopyright (C) 2015 by liuxueyang\n\nThis program is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself, either Perl version 5.8.2 or,\nat your option, any later version of Perl 5 you may have available.\n\n=head1 BUGS\n\nNone reported... yet.\n\n=cut\n"}, {"source_code": "#!/usr/bin/perl -wn\nuse bigint;\nchomp;\n($n, $t) = split / /;\n$start = 10 ** ($n - 1);\n$end = 10 ** $n - 1;\nif ($end < $t) {\n print \"-1\\n\";\n next;\n} elsif ($start <= $t && $end >= $t) {\n print \"$t\\n\";\n next;\n}\nwhile ($start <= $end) {\n if ($start % $t == 0) {\n\tprint $start, \"\\n\";\n\tlast;\n } else { \n\t($start += 1);\n }\n}\nprint \"-1\", \"\\n\" if $start > $end;\n"}, {"source_code": "($n, $t) = split ' ', <>;\n$n eq '1' && $t == '10' ? print -1, \"\\n\" : print $t . '0' x ($n - length $t); \n"}, {"source_code": "($n, $_) = split ' ', <>;\nprint /${n}0/ ? -1 : $_ . 0 x ($n - length)"}], "negative_code": [{"source_code": "#!/usr/bin/perl -wn\n# div2a_1.pl --- \n# Author: liuxueyang \n# Created: 11 Oct 2015\n# Version: 0.01\n\n#use warnings;\n#use strict;\n\nchomp;\n($n, $t) = split / /;\nprint \"n = $n, t = $t\\n\";\n\nif ( $n == 1 ) {\n if ( $t != 10 ) {\n print \"$t\\n\";\n next;\n }\n else {\n print \"-1\\n\";\n next;\n }\n}\nelsif ($t == 5 || $t == 10) {\n print \"1\" x ($n - 1) . \"0\\n\";\n next;\n}\nelsif ( $t == 2 ) {\n print \"1\" x ($n - 1) . \"2\\n\";\n next;\n}\n$mod = 0;\n\nfor ( 2..$n ) {\n $mod = ($mod * 10 + 1) % $t;\n}\nprint \"1\" x ($n - 1);\n$mod = $mod * 10;\n\nfor ( 0..9 ) {\n if ( ($mod + $_) % $t == 0) {\n print \"$_\\n\";\n last;\n }\n}\n__END__\n\n=head1 NAME\n\ndiv2a_1.pl - Describe the usage of script briefly\n\n=head1 SYNOPSIS\n\ndiv2a_1.pl [options] args\n\n -opt --long Option description\n\n=head1 DESCRIPTION\n\nStub documentation for div2a_1.pl, \n\n=head1 AUTHOR\n\nliuxueyang, Earies@JemirE\n\n=head1 COPYRIGHT AND LICENSE\n\nCopyright (C) 2015 by liuxueyang\n\nThis program is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself, either Perl version 5.8.2 or,\nat your option, any later version of Perl 5 you may have available.\n\n=head1 BUGS\n\nNone reported... yet.\n\n=cut\n"}, {"source_code": "#!/usr/bin/perl -wn\nchomp;\n($n, $t) = split / /;\n#print \"$n-$t\\n\";\n$start = 1 . \"0\" x ($n - 1);\n$end = \"9\" x $n;\n#print \"$start-$end\\n\";\nwhile ($start <= $end) {\n !($start % $t) ? last : ($start += 1);\n}\n#print $start, \"\\n\" if ($start % $t == 0);\n($start % $t == 0) ? print $start, \"\\n\" : print -1, \"\\n\";\n\n#print ($start % $t == 0) ? $start : -1;\n"}, {"source_code": "#!/usr/bin/perl -wn\nchomp;\n($n, $t) = split / /;\n#print \"$n-$t\\n\";\n$start = 1 . \"0\" x ($n - 1);\n$end = \"9\" x $n;\n#print \"$start-$end\\n\";\nwhile ($start < $end) {\n !($start % $t) ? last : ($start += 1);\n}\nprint $start, \"\\n\";\n"}, {"source_code": "($n, $_) = split ' ', <>;\nprint /${n}0/ ? -1 : $_ . 0 x ($n - length $n)"}, {"source_code": "$a = {\n zabbix_server_list => ['smoszabbix01'],\n smoszabbix01 => {\n address => '172.16.48.19',\n port => 10051\n },\n daemon => { sleep => 120, maxproc => 20, },\n database_list =>\n [ 'PREPROD', 'INTWH', 'INTTRN', 'PSALE', 'INTPST', 'INTEMR' ],\n default => {\n user => 'zabbix',\n password => 'EvSp9XZM9g',\n query_list_file => '/opt/ZabbixDBA/conf/query.props.pl',\n },\n DISCOVERY => {\n dsn => 'DBI:Oracle:host=smosbd01;port=1521;sid=GDII',\n user => 'tech_prod',\n password => 'dd4rp93d',\n query_list_file => '/opt/ZabbixDBA/intouch/discovery.query.props.pl',\n },\n GDII => {\n dsn => 'DBI:Oracle:host=smosbd01;port=1521;sid=GDII',\n extra_query_list_file => '/opt/ZabbixDBA/intouch/gdii.query.props.pl',\n },\n GDII_STB02 => {\n dsn => 'DBI:Oracle:host=smosbd02;port=1521;sid=GDII_STB02',\n extra_query_list_file =>\n '/opt/ZabbixDBA/intouch/standby.query.props.pl',\n },\n GDII_R0 => {\n dsn => 'DBI:Oracle:host=sdrpbd01;port=1521;sid=GDII_R0',\n extra_query_list_file =>\n '/opt/ZabbixDBA/intouch/standby.query.props.pl',\n },\n PREPROD => { dsn => 'DBI:Oracle:host=smosbd02;port=1522;sid=PREPROD', },\n INTEMR => { dsn => 'DBI:Oracle:host=smosbd06;port=1521;sid=INTEMR', },\n INTWH => { dsn => 'DBI:Oracle:host=smosbd05;port=1523;sid=INTWH', },\n INTPST => { dsn => 'DBI:Oracle:host=smosbd05;port=1522;sid=INTPST', },\n INTTRN => {\n dsn => 'DBI:Oracle:host=smosbd10;port=1521;sid=INTTRN',\n user => 'c##zabbix',\n },\n PSALE => { dsn => 'DBI:Oracle:host=smosbd08;port=1521;sid=XE', },\n};\n"}, {"source_code": "( $n, $t ) = split / /, <>;\nprint -1 if $n < length($t);\n$c = 1 . 0 x ( $n - 1 );\nwhile ( length($c) <= $n ) {\n if ( $c % $t == 0 ) {\n print $c;\n exit;\n }\n $c++;\n}\n\nprint -1;\n"}], "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed"} {"source_code": "use strict;\nuse warnings;\nchomp(my ($num1,$num2,$num3) = split \" \",<>);\n\nmy $answer = 0;\nmy %hash = ();\n\nfor(my $i = 1; $i <= $num1; $i++){\n for(my $j = 1; $j <= $num2; $j++){\n for(my $k = 1; $k <= $num3; $k++){\n my $num = $i*$j*$k;\n if(exists $hash{$num}){\n $answer += $hash{$num};\n } else {\n my $divCount = 1;\n my $numbkp = $num;\n for(my $l = 2;$l*$l <= $num; $l++){\n my $factorCount = 0;\n while($num % $l == 0){\n $num /= $l;\n $factorCount++;\n }\n $divCount *= $factorCount + 1;\n }\n if($num > 1){ \n $divCount *= 2;\n }\n $answer += $divCount;\n $hash{$numbkp} = $divCount;\n }\n }\n }\n}\n$answer %= 1073741824;\nprint $answer;", "positive_code": [{"source_code": "#! /usr/bin/perl -wl\n#------------------------------------------------\n# Author: vj\n# Created: Sun Oct 21 13:04:19 IST 2012\n# File Name: b.pl\n# USAGE:\n# b.pl\n#\n#\n#------------------------------------------------\n \nmy (%pfs, %cnt);\n$pfs{2} = [2];\n$pfs{3} = [3];\n$pfs{4} = [2,2];\n$pfs{5} = [5];\n$pfs{6} = [2,3];\n$pfs{7} = [7];\n$pfs{8} = [2,2,2];\n$pfs{9} = [3,3];\n$pfs{10} = [2,5];\n$pfs{11} = [11];\n$pfs{12} = [2,2,3];\n$pfs{13} = [13];\n$pfs{14} = [2,7];\n$pfs{15} = [3,5];\n$pfs{16} = [2,2,2,2];\n$pfs{17} = [17];\n$pfs{18} = [2,3,3];\n$pfs{19} = [19];\n$pfs{20} = [2,2,5];\n$pfs{21} = [3,7];\n$pfs{22} = [2,11];\n$pfs{23} = [23];\n$pfs{24} = [2,2,2,3];\n$pfs{25} = [5,5];\n$pfs{26} = [2,13];\n$pfs{27} = [3,3,3];\n$pfs{28} = [2,2,7];\n$pfs{29} = [29];\n$pfs{30} = [2,3,5];\n$pfs{31} = [31];\n$pfs{32} = [2,2,2,2,2];\n$pfs{33} = [3,11];\n$pfs{34} = [2,17];\n$pfs{35} = [5,7];\n$pfs{36} = [2,2,3,3];\n$pfs{37} = [37];\n$pfs{38} = [2,19];\n$pfs{39} = [3,13];\n$pfs{40} = [2,2,2,5];\n$pfs{41} = [41];\n$pfs{42} = [2,3,7];\n$pfs{43} = [43];\n$pfs{44} = [2,2,11];\n$pfs{45} = [3,3,5];\n$pfs{46} = [2,23];\n$pfs{47} = [47];\n$pfs{48} = [2,2,2,2,3];\n$pfs{49} = [7,7];\n$pfs{50} = [2,5,5];\n$pfs{51} = [3,17];\n$pfs{52} = [2,2,13];\n$pfs{53} = [53];\n$pfs{54} = [2,3,3,3];\n$pfs{55} = [5,11];\n$pfs{56} = [2,2,2,7];\n$pfs{57} = [3,19];\n$pfs{58} = [2,29];\n$pfs{59} = [59];\n$pfs{60} = [2,2,3,5];\n$pfs{61} = [61];\n$pfs{62} = [2,31];\n$pfs{63} = [3,3,7];\n$pfs{64} = [2,2,2,2,2,2];\n$pfs{65} = [5,13];\n$pfs{66} = [2,3,11];\n$pfs{67} = [67];\n$pfs{68} = [2,2,17];\n$pfs{69} = [3,23];\n$pfs{70} = [2,5,7];\n$pfs{71} = [71];\n$pfs{72} = [2,2,2,3,3];\n$pfs{73} = [73];\n$pfs{74} = [2,37];\n$pfs{75} = [3,5,5];\n$pfs{76} = [2,2,19];\n$pfs{77} = [7,11];\n$pfs{78} = [2,3,13];\n$pfs{79} = [79];\n$pfs{80} = [2,2,2,2,5];\n$pfs{81} = [3,3,3,3];\n$pfs{82} = [2,41];\n$pfs{83} = [83];\n$pfs{84} = [2,2,3,7];\n$pfs{85} = [5,17];\n$pfs{86} = [2,43];\n$pfs{87} = [3,29];\n$pfs{88} = [2,2,2,11];\n$pfs{89} = [89];\n$pfs{90} = [2,3,3,5];\n$pfs{91} = [7,13];\n$pfs{92} = [2,2,23];\n$pfs{93} = [3,31];\n$pfs{94} = [2,47];\n$pfs{95} = [5,19];\n$pfs{96} = [2,2,2,2,2,3];\n$pfs{97} = [97];\n$pfs{98} = [2,7,7];\n$pfs{99} = [3,3,11];\n$pfs{100} = [2,2,5,5];\n\nsub printnewpfs { print \"$_ -> $cnt{$_}\" foreach (sort {$a <=> $b} keys %cnt) }\n\nsub div () {\n my ($x, $y, $z) = @_;\n \n my $product = $x * $y * $z;\n if (not exists $cnt{$product}) {\n my %allpfs;\n $allpfs{$_}++ foreach ( @{$pfs{$x}}, @{$pfs{$y}}, @{$pfs{$z}} );\n $cnt{$product} = 1;\n $cnt{$product} *= $_ + 1 foreach values %allpfs;\n }\n\n return $cnt{$product};\n}\n\nmy ($x, $y, $z, $buf);\nchomp ($buf = );\n($x, $y, $z) = split /\\s+/, $buf;\n\nmy $res = 0;\nforeach my $i (1 .. $x) {\n foreach my $j (1 .. $y) {\n foreach my $k (1 .. $z) {\n $res += &div ($i, $j, $k);\n }\n }\n}\nprint $res;\n#&printnewpfs;\n"}], "negative_code": [{"source_code": "use strict;\nuse warnings;\nuse POSIX;\nchomp(my @array = split \" \",<>);\n\nmy $answer = 0;\n\nfor(my $i = 1; $i <= $array[0]; $i++){\n for(my $j = 1; $j <= $array[1]; $j++){\n for(my $k = 1; $k <= $array[2]; $k++){\n my $num = $i*$j*$k;\n my $divCount = 1;\n for(my $l = 2;$l*$l <= $num; $l++){\n my $factorCount = 0;\n if($num % $l == 0){\n $num /= $l;\n $factorCount++;\n }\n $divCount *= $factorCount + 1;\n }\n if($num > 1){ \n $divCount *= 2;\n }\n $answer += $divCount;\n if($answer > 1073741824) {\n $answer %= 1073741824;\n }\n }\n }\n}\n\nprint $answer;"}, {"source_code": "use strict;\nuse warnings;\nuse POSIX;\nchomp(my @array = split \" \",<>);\n\nmy $answer = 0;\n\nfor(my $i = 1; $i <= $array[0]; $i++){\n for(my $j = 1; $j <= $array[1]; $j++){\n for(my $k = 1; $k <= $array[2]; $k++){\n my $num = $i*$j*$k;\n my $divCount = 1;\n for(my $l = 2;$l*$l <= $num; $l++){\n my $factorCount = 0;\n if($num % $l == 0){\n $num /= $l;\n $factorCount++;\n }\n $divCount *= ($factorCount + 1);\n }\n if($num > 1){ \n $divCount *= 2;\n }\n $answer += $divCount;\n if($answer > 1073741824) {\n $answer %= 1073741824;\n }\n }\n }\n}\n\nprint $answer;"}, {"source_code": "use strict;\nuse warnings;\nchomp(my ($num1,$num2,$num3) = split \" \",<>);\n\nmy $answer = 0;\nmy %hash = ();\n\nfor(my $i = 1; $i <= $num1; $i++){\n for(my $j = 1; $j <= $num2; $j++){\n for(my $k = 1; $k <= $num3; $k++){\n my $num = $i*$j*$k;\n if(exists $hash{$num}){\n $answer += $hash{$num};\n } else {\n my $divCount = 1;\n for(my $l = 2;$l*$l <= $num; $l++){\n my $factorCount = 0;\n while($num % $l == 0){\n $num /= $l;\n $factorCount++;\n }\n $divCount *= $factorCount + 1;\n }\n if($num > 1){ \n $divCount *= 2;\n }\n $answer += $divCount;\n $hash{$num} = $divCount;\n }\n }\n }\n}\n$answer %= 1073741824;\nprint $answer;"}], "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401"} {"source_code": "$suit=<>;\n$p1=<>;\n@a1=split('',$p1);\n@a2=split('',$suit);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif(@a1[1] eq @a1[4])\n{\n if($h{@a1[0]} gt $h{@a1[3]}){ print \"YES\";}\n else {print \"NO\";}\n}\nelse {\n if(@a1[1] eq @a2[0] )\n { print \"YES\";}\n else {print \"NO\";}\n}", "positive_code": [{"source_code": "$suit=<>;\n$p1=<>;\nchomp($suit);\n@a1=split('',$p1);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif(@a1[1] eq @a1[4])\n{\n\tif($h{@a1[0]}>$h{@a1[3]}){ print \"YES\";}\n\telse {print \"NO\";}\n}\nelse {\n\tif(@a1[1] eq $suit){ print \"YES\";}\n\telse {print \"NO\";}\n}"}], "negative_code": [{"source_code": "$suit=<>;\n$p1=<>;\n@a1=split('',$p1);\n@a2=split('',$suit);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif((@a1[1] eq @a2[0]) and( @a1[4] eq @a2[0]))\n{\n if($h{@a1[0]} gt $h{@a1[3]}){ print \"YES\";}\n else {print \"NO\";}\n}\nelse {\n if(@a2[0] eq @a1[4]){\n print \"NO\";\n exit;\n }\n if((@a1[1] eq @a2[0])or($h{@a1[0]} gt $h{@a1[3]}))\n { print \"YES\";}\n else {print \"NO\";}\n}"}, {"source_code": "$suit=<>;\n$p1=<>;\n@a1=split('',$p1);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif(@a1[1] == $suit and @a1[4] == $suit)\n{\n\tif($h{@a1[0]}>$h{@a1[3]}){ print \"YES\";}\n\telse {print \"NO\";}\n}\nelse {\n\tif((@a1[1] == $suit)or($h{@a1[0]}>$h{@a1[3]})){ print \"YES\";}\n\telse {print \"NO\";}\n}"}, {"source_code": "$suit=<>;\n$p1=<>;\n$p2=<>;\n@a1=split('',$p1);\n@a2=split('',$p2);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif(@a1[1] == $suit and @a2[1] == $suit)\n{\n\tif($h{@a1[0]}>$h{@a2[0]}){ print \"YES\";}\n\telse {print \"NO\";}\n}\nelse {\n\tif((@a1[1] == $suit)or($h{@a1[0]}>$h{@a2[0]})){ print \"YES\";}\n\telse {print \"NO\";}\n}\n\n"}, {"source_code": "$suit=<>;\n$p1=<>;\n@a1=split('',$p1);\n@a2=split('',$suit);\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\nif((@a1[1] eq @a2[0]) and( @a1[4] eq @a2[0]))\n{\n if($h{@a1[0]} gt $h{@a1[3]}){ print \"YES\";}\n else {print \"NoO\";}\n}\nelse {\n if(@a2[0] eq @a1[4]){\n print \"NO\";\n exit;\n }\n if((@a1[1] eq @a2[0])or($h{@a1[0]} gt $h{@a1[3]}))\n { print \"YES\";}\n else {print \"NO\";}\n}"}], "src_uid": "da13bd5a335c7f81c5a963b030655c26"} {"source_code": "chomp($_ = );\n/.*?h.*?e.*?l.*?l.*?o/ ? print \"YES\\n\" : print \"NO\\n\";", "positive_code": [{"source_code": "my $str = <>;\nprint (($str =~ /.*h.*e.*l.*l.*o.*/g) ? (\"YES\"):(\"NO\"));"}, {"source_code": "my $str = <>;\nprint (($str =~ /.*h.*e.*l.*l.*o.*/) ? (\"YES\"):(\"NO\"));"}, {"source_code": "print <>=~/h.*e.*l.*l.*o/ ? \"YES\" : \"NO\""}, {"source_code": "#!/usr/bin/perl -w\n\nchomp($_ = );\nif(/.*h.*e.*l.*l.*o.*/) {\n print \"YES\";\n} else {\n print \"NO\";\n}"}, {"source_code": "\n\nprint <>=~/h.*e.*l.*l.*o/?\"YES\":\"NO\""}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "print <>=~/h.*e.*l.*l.*o/?\"YES\":\"NO\""}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "#!/usr/bin/env perl\n\nuse v5.012;\nuse warnings;\n\nmy $word = ;\n\nif ($word =~ /h.*e.*l.*l.*o/) {\n\tprint 'YES';\n}\nelse {\n\tprint 'NO';\n}\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "my @arr = split \"\", <>;\nmy @str = split \"\", \"hello\";\nmy ($l, $end) = (scalar @arr, scalar @str);\nmy $count = 0;\nfor (0..$l-1) {\n $count++ if ($arr[$_] eq $str[$count]);\n last if ($count == $end);\n}\nprint $count == $end ? \"YES\\n\":\"NO\\n\";\n"}, {"source_code": "print <>=~/h.*e.*l.*l.*o/?\"YES\":\"NO\""}, {"source_code": "print <>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "$l=<>;\nif($l=~/.*h.*e.*l.*l.*o.*/g)\n{\n print \"YES\";\n}\nelse\n{\n print \"NO\";\n}"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\n<> =~ m/h\\w*e\\w*l\\w*l\\w*o/ and say \"YES\" or say \"NO\";"}, {"source_code": "#!/usr/bin/perl -w\n\nuse strict;\nuse Data::Dumper;\n\nsub look_for {\n my $search = shift;\n my $buf = shift;\n\n my $i1 = 0;\n\n for (split //, $buf) {\n $i1++ if (substr $search, $i1, 1) eq $_;\n last if $i1 >= length $search;\n }\n\n return $i1 == length $search;\n}\n\nmy $s = <>;\nprint look_for(\"hello\", $s) ? \"YES\\n\" : \"NO\\n\";\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?\"YES\":\"NO\""}, {"source_code": "print<>=~/.*h.*e.*l.*l.*o.*/?\"YES\":\"NO\""}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "my $s = <>;\nprint ($s =~ /h.*?e.*?l.*?l.*?o/ ? \"YES\" : \"NO\")"}, {"source_code": "#!/usr/bin/perl\n\n$str = ;\n\n#$char = substr($str, 1, 1);\n\n$ln = length $str;\n#print \"$ln\";\n\n$ln = $ln - 2;\n\n$n = 0;\n$cnt = 1;\n\nfor($i = 0; $i<=$ln; $i++){\n $char = substr($str,$n, 1);\n\n if($cnt == 1){\n if($char eq 'h'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 2){\n if($char eq 'e'){\n $cnt = $cnt + 1;\n }\n } \n elsif($cnt == 3){\n if($char eq 'l'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 4){\n if($char eq 'l'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 5){\n if($char eq 'o'){\n $cnt = $cnt + 1;\n }\n }\n\n # print \"$char\\n\";\n # print \"$cnt\\n\";\n $n = $n + 1;\n}\n\nif($cnt == 6){\n print \"YES\\n\";\n}\nelse {\n print \"NO\\n\";\n}\n"}, {"source_code": "#!/usr/bin/perl\n\n#input string\n$str = ;\n\n#find length in a string\n$ln = length $str;\n\n$ln = $ln - 2;\n\n$cnt = 1;\n\nfor($i = 0; $i<=$ln; $i++){\n #find the i'th character\n $char = substr($str,$i, 1);\n\n if($cnt == 1){\n if($char eq 'h'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 2){\n if($char eq 'e'){\n $cnt = $cnt + 1;\n }\n } \n elsif($cnt == 3){\n if($char eq 'l'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 4){\n if($char eq 'l'){\n $cnt = $cnt + 1;\n }\n }\n elsif($cnt == 5){\n if($char eq 'o'){\n $cnt = $cnt + 1;\n }\n }\n}\n\nif($cnt == 6){\n print \"YES\\n\";\n}\nelse {\n print \"NO\\n\";\n}\n"}, {"source_code": "use strict;\nuse warnings;\n\nprint <> =~ /.*?h.*?e.*?l.*?l.*?o.*?/ ? \"YES\\n\" : \"NO\\n\";\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $s = <>;\nchomp $s;\nprint $s =~ /.*?h.*?e.*?l.*?l.*?o.*?/ ? \"YES\\n\" : \"NO\\n\";\n"}, {"source_code": "$ch=<>;\nchomp$ch;\nif($ch=~m/h+.*e+.*l+.*l+.*o+/){\nprint\"YES\";\n}\nelse{\nprint\"NO\";\n}"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "$_ = ; print (/h.*e.*l.*l.*o/? \"YES\\n\" : \"NO\\n\")\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/? YES : NO"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO"}, {"source_code": "#!/bin/bash/perl\n$input=<>;\n$len=length($input);\n$len=$len-1;\nif($len<5){\n print \"NO\";\n}\nelse{\n $state=0;\n @seperate=split(\"\",$input);\n @helloSearch=('h','e','l','l','o');\n for($i=0;$i<$len;++$i){\n if($state>4){\n $i=$len; #to break off\n }\n else{\n if($seperate[$i] eq $helloSearch[$state]){\n ++$state;\n }\n }\n }\n if($state>4){\n print \"YES\";\n }\n else{\n print \"NO\";\n }\n}"}, {"source_code": "print(<>=~/h.*e.*l.*l.*o.*/?'YES':'NO')"}, {"source_code": "print <>=~/h.*e.*l.*l.*o/?\"YES\":\"NO\""}, {"source_code": "#!/bin/perl\n\n$s = ;\nchomp $s;\n\n@lts = split //, $s;\n\n@srch = (h, e, l, l, o);\n$wsk = 0;\n\nfor($i=0;$i<@lts;$i++)\n{\n\n if( @lts[$i] eq @srch[$wsk] )\n {\n\n $wsk++;\n\n if( $wsk >= @srch )\n {\n\n print \"YES\";\n exit;\n\n }\n\n }\n\n}\n\nprint \"NO\";\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}, {"source_code": "$str =;\n$_ = $str;\nif(/.*h.*e.*l.*l.*o/)\n{\n\tprint (\"YES\");\n}\n\nelse\n{\nprint(\"NO\");\n}\n"}, {"source_code": "@a=(\"h\",\"e\",\"l\",\"l\",\"o\");$c=0;foreach(split('',<>)){if($_ eq $a[$c]){$c+=1;}if($c==5){break;}}if($c==5){print \"YES\\n\";}else{print \"NO\\n\";}\n"}, {"source_code": "$s=<>;\n$s=~s/\\R//g;\n@ar=(\"h\",\"e\",\"l\",\"l\",\"o\");\n$c=0;\nforeach(split('',$s))\n{\nif($_ eq $ar[$c]){$c+=1;}\nif($c==5){break;}\n}\nif($c==5){print \"YES\\n\";}\nelse{print \"NO\\n\";}\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\nuse v5.10;\nuse POSIX;\n\nsay =~ /h.*e.*l.*l.*o/ ? 'YES' : 'NO'\n"}, {"source_code": "print <> =~ /h.*?e.*?l.*?l.*?o/ ? \"YES\" : \"NO\";"}, {"source_code": "print<>=~/h.*e.*l.*l.*o/?YES:NO\n"}], "negative_code": [{"source_code": "my $s = <>;\nprint ($s =~ /.?h.?e.?l.?l.?o.?/ ? \"YES\" : \"NO\")"}, {"source_code": "my $s = <>;\nprint ($s =~ /.?h.?e.?l.?l.?o.?/ ? \"Yes\" : \"No\")"}, {"source_code": "$ch=<>;\nchomp$ch;\nif($ch=~m/(h+e+l{2,}o+)/){\nprint\"YES\";\n}\nelse{\nprint\"NO\";\n}"}, {"source_code": "$_ = ; print (/h.*e.*l.*l.*o.*o.*u/? \"YES\\n\" : \"NO\\n\")"}, {"source_code": "#!/bin/perl\n\n$s = ;\nchomp $s;\n\n$n = length $s;\n\n$s =~ s/[h][h]*[e][e]*[l][l]*[l][l]*[o][o]/0/;\n\nif( $n == length $s )\n{\n\n print \"NO\";\n\n}\nelse\n{\n\n print \"YES\";\n\n}\n"}, {"source_code": "print <> =~ /h+e+l+l+o/ ? \"YES\" : \"NO\";"}], "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838"} {"source_code": "#!/usr/bin/perl\n# your code goes here\n\nour @a = (0) x (10**5+5);\nour $d;\n\nsub update {\n\t$k = shift;\n\tfor (my $i=$k; $i<=$d; $i+=$k) {\n\t\t$a[$i] = 1;\n\t}\n}\n\nchomp($k = <>);\nchomp($l = <>);\nchomp($m = <>);\nchomp($n = <>);\nchomp($d = <>);\n\nupdate($k);\nupdate($l);\nupdate($m);\nupdate($n);\n\n$ans+=$_ foreach (@a);\nprint $ans;\n", "positive_code": [{"source_code": "use strict;\nuse warnings;\n\nmy ($k, $l, $m, $n, $d) = <>;\nmy $cnt = 0;\nfor (1..$d) {\n if ($_ % $k && $_ % $l && $_ % $m && $_ % $n) {\n $cnt++;\n }\n}\nprint (($d - $cnt).\"\\n\");\n"}, {"source_code": "$k=<>;\n$l=<>;\n$m=<>;\n$n=<>;\n$d=<>;\nfor($i=1;$i<=$d;$i++){\n$t[$i]=0;\n}\nfor($i=$k;$i<=$d;$i+=$k){\n$t[$i]=1;\n}\nfor($i=$l;$i<=$d;$i+=$l){\n$t[$i]=1;\n}\nfor($i=$m;$i<=$d;$i+=$m){\n$t[$i]=1;\n}\nfor($i=$n;$i<=$d;$i+=$n){\n$t[$i]=1;\n}\n$somme=0;\nfor($i=1;$i<=$d;$i++){\nif($t[$i]){\n$somme++;\n}\n}\nprint $somme;\n\n\n"}, {"source_code": "while(){chomp;push @_,$_}; my $n = pop @_; @_=sort @_; if(@_[0] == 1){ print \"$n\\n\"; exit } my @arr = map{1}(1..$n);my $len = int($n); for(@_){ my $k = int($_); for(1..@arr){ if($arr[$_-1] && $_ % $k == 0){ --$len; $arr[$_-1]=0 } } unless($len){ print \"$n\\n\"; exit } } print $n-$len, \"\\n\""}, {"source_code": "#!/bin/bash/perl\n$input = <>;\n@input = split(\" \",$input);\nmy $a = $input[0];\n$input = <>;\n@input = split(\" \",$input);\nmy $b = $input[0];\n$input = <>;\n@input = split(\" \",$input);\nmy $c = $input[0];\n$input = <>;\n@input = split(\" \",$input);\nmy $d = $input[0];\n$input = <>;\n@input = split(\" \",$input);\nmy $t = $input[0];\n@flags = (0 x ($t+1));\n@params = ($a,$b,$c,$d);\nfor(my $i=0;$i<4;++$i){\n for(my $j=1;$j<=$t;++$j){\n if($flags[$j]==0 && $j%$params[$i]==0 ){\n $flags[$j]=1;\n }\n }\n}\nmy $hit = 0;\nfor(my $i=1;$i<=$t;++$i){\n if($flags[$i] == 1){\n ++$hit;\n }\n}\nprint $hit;"}, {"source_code": "($k, $l, $m, $n, $d) = (<>, <>, <>, <>, <>);\n$ans = 0;\nfor ($i = 1; $i <= $d; ++$i) {\n unless ($i % $k and $i % $l and $i % $m and $i % $n) {\n ++$ans;\n }\n}\nprint $ans;"}, {"source_code": "$k=<>;\n$l=<>;\n$m=<>;\n$n=<>;\n$d=<>;\n$a=0;\nfor $j($k,$l,$m,$n){\nfor (1..$d){\n$_%$j or $_[$_]++;\n}\n}\nfor (1..$d){\n$_[$_] and $a++\n\n}\nprint $a;"}, {"source_code": "$k=<>;$l=<>;$m=<>;$n=<>;$d=<>;$a=0;\nfor$i(1..$d){if($i% $k==0 or $i% $l==0 or $i% $m==0 or $i% $n==0){$a+=1;}}\nprint \"$a\\n\";\n\n"}, {"source_code": "#!/usr/bin/perl\n\nuse 5.012;\nuse warnings;\n\nchomp(my $k = <>);\nchomp(my $l = <>);\nchomp(my $m = <>);\nchomp(my $n = <>);\nchomp(my $d = <>);\n\nmy $cnt = 0;\nfor my $idx (1..$d) {\n\t$cnt++ unless $idx % $k && $idx % $l && $idx % $m && $idx % $n;\n}\nsay $cnt;\n"}, {"source_code": "my @arr;\n$arr[$_] = <> for(0..3);\nmy $d = <>;\nmy @count = (0) x int($d);\nmy $ans = 0;\nfor my $i (0..3) {\n $count[$_ * $arr[$i]] = 1 for(0..int($d/$arr[$i]));\n}\n$ans += $count[$_] for(1..$d);\nprint $ans;\n"}, {"source_code": "my $k = ;\nmy $l = ;\nmy $m = ;\nmy $n = ;\nmy $d = ;\nmy $count = 0;\nwhile($d) {\n if(!($d%$k)||!($d%$l)||!($d%$m)||!($d%$n)) {\n $count++;\n }\n $d--;\n}\nprint $count;"}, {"source_code": "#!/usr/bin/perl -w\n\nuse strict;\n\nmy $k = <>;\nmy $l = <>;\nmy $m = <>;\nmy $n = <>;\nmy $d = <>;\nmy $h = 0;\nfor (1..$d) {\n $h++ unless $_ % $k && $_ % $l && $_ % $m && $_ % $n\n}\nprint $h, \"\\n\";\n"}, {"source_code": "chomp($k=);\nchomp($l=);\nchomp($m=);\nchomp($n=);\nchomp($d=);\n\n$hurt = 0;\nfor($i=1;$i<=$d;$i++){\n\t$hurt++, next if($i % $k == 0);\n\t$hurt++, next if($i % $l == 0);\n\t$hurt++, next if($i % $m == 0);\n\t$hurt++, next if($i % $n == 0);\n}\nprint \"$hurt\\n\";"}], "negative_code": [{"source_code": "my $k = ;\nmy $l = ;\nmy $m = ;\nmy $n = ;\nmy $d = ;\nmy $count = 0;\nwhile($d--) {\n if(!($d%$k)||!($d%$l)||!($d%$m)||!($d%$n)) {\n $count++;\n }\n}\nprint $count;"}, {"source_code": "$k=<>;\n$l=<>;\n$m=<>;\n$n=<>;\n$d=<>;\n\nfor $j($k,$l,$m,$n){\nfor (1..$d){\n$_%$j or $_[$_]++;\n}\n}\nfor (1..$d){\n$_[$_] and $a++\n\n}\nprint $a;"}], "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7"} {"source_code": "#!/usr/bin/perl\n\n$_ = <>, chomp;\n/e\\K/;\n$e = $';\ns/e.*//;\n$_ .= 0 x 111;\ns/\\.(.{$e})/$1./;\ns/0+$//;\ns/^0+//;\ns/\\.$//;\ns/^\\./0./;\n$_ ||= 0;\nprint", "positive_code": [{"source_code": "$_ = <>; ($a, $d, $b) = split /\\.|e/;\n$d .= \"0\" x ($b - length $d);\n$_ = join(\"\", $a, substr($d, 0, $b), \".\", substr($d, $b));\ns/\\.0*$//; \nprint\n"}, {"source_code": "s/e(.*)/0 x 1e2/e,\ns/\\.(.{$1})/$1./,\ns/^0+\\B|\\.?0+$//g,\nprint for <>"}], "negative_code": [{"source_code": "$_ = <>; ($a, $d, $b) = split /\\.|e/;\n$b .= \"0\" x ($b - length $d);\n$_ = join(\"\", $a, substr($d, 0, $b), \".\", substr($d, $b));\ns/\\.$//; \nprint\n"}, {"source_code": "$_ = <>; ($a, $d, $b) = split /\\.|e/;\n$d .= \"0\" x ($b - length $d);\n$_ = join(\"\", $a, substr($d, 0, $b), \".\", substr($d, $b));\ns/\\.$//; \nprint\n"}, {"source_code": "$_ = <>, chomp;\n/e\\K/;\n$e = $';\ns/e.*//;\n$_ .= 0 x 111;\ns/\\.(.{$e})/$1./;\ns/0+$//;\ns/^0+//;\ns/\\.$//;\n$_ ||= 0;\nprint"}], "src_uid": "a79358099f08f3ec50c013d47d910eef"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $n, $k ) = split;\n\tmy $sum = 0;\n\t\n\tfor( 1 .. $n ){\n\t\t( $sum += $_ . reverse ) %= $k;\n\t\t}\n\t\n\tprint $sum;\n\t}", "positive_code": [{"source_code": "<> =~ / /;\n\n( $sum += $_ . reverse ) %= $' for 1 .. $`;\n\nprint 0 + $sum"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $n, $k ) = split;\n\tmy $sum = 0;\n\t\n\tfor( 1 .. $n ){\n\t\t( $sum += $_ . reverse ) %= $k;\n\t\tprint \" $sum\";\n\t\t}\n\t\n\tprint $sum;\n\t}"}], "src_uid": "00e90909a77ce9e22bb7cbf1285b0609"} {"source_code": "#!usr/bin/perl\n\n\tsub gcd{\n\t\t\treturn $_[0]%$_[1]==0 ? $_[1] : gcd($_[1],$_[0]%$_[1]);\n\t }\n\n$n=<>;\n@num=split(/ /,<>);\n\t$ans=$num[0];\n\tfor $i(1..$n-1)\n\t{\n\t\t$ans=gcd($ans,$num[$i]);\n\t}\n\tprint $ans*$n;\n", "positive_code": [{"source_code": "$n=<>;\n@_=split/ /,<>;\nfor $i(1..100){\n\t$f=0;\n\t$_%$i or ++$f for @_;\n\t$f==$n and $m=$i\n\t}\nprint $m*$n"}, {"source_code": "use strict ;\nuse warnings ;\n\nmy $n = ;\n\nmy @num = split(/ /,);\n\nsub findGcd{\n\treturn $_[0]%$_[1]==0 ? $_[1] : findGcd($_[1],$_[0]%$_[1]);\n}\n\n\nmy $ans = $num[0];\nfor my $i (1..$n-1){\n\t$ans=findGcd($ans,$num[$i]);\n}\n\nprint ($n*$ans);"}], "negative_code": [{"source_code": "use strict ;\nuse warnings ;\n\nmy $num = ;\n\nmy @x = split(/ /,);\n\nsub findGcd{\n\tmy $m = shift;\n\tmy $n = shift;\n\tmy $r;\n\tif($m==0 || $n==0){\n\t\treturn 0;\n\t}elsif($m<0 || $n<0){\n\t\treturn -1;\n\t}\n\t\n\twhile(1){\n\t\t$r = $m % $n ;\n\t\tif($r==0){\n\t\t\tlast;\n\t\t}\n\t\t$m = $n;\n\t\t$n = $r;\n\t}\n\treturn $n;\n}\n\nmy $min = $x[0];\nmy $max = $x[0];\n\nfor(my $i=0;$i<$#x+1;$i++){\n\tif($x[$i]<=$min){\n\t\t$min=$x[$i];\n\t}\n}\nfor(my $j=0;$j<$#x+1;$j++){\n\tif($x[$j]>=$max){\n\t\t$max=$x[$j];\n\t}\n}\n\nmy $factor = findGcd($max,$min);\n\nprint ($num*$factor);"}], "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4"} {"source_code": "$_=<>.<>.<>;\ns/\\d|(?<=.).*(?=.)|\\s//gm;\nfor $i qw(<>v^ ><^v){/\\Q$i\\E/ && ++$f}\nprint $f? YES:NO", "positive_code": [{"source_code": "<>;\n<>=~/(?<=.).*(?=.)/;\n$_.=$`.$';\n<>=~/(?<=.).*(?=.)/;\n$_.=$`.$';\ns/\\s//gm;\nfor $i qw(<>v^ ><^v){/^\\Q$i\\E$/ && ++$f}\nprint $f? YES:NO"}], "negative_code": [{"source_code": "$_=<>.<>.<>;\ns/\\d|(?<=.).*(?=.)|\\s//gm;\nfor $i qw(<>v^ ><^v){/$i/ && ++$f}\nprint $f? YES:NO"}, {"source_code": "<>;\n<>=~/(?<=.).*(?=.)/;\n$_.=$`.$';\n<>=~/(?<=.).*(?=.)/;\n$_.=$`.$';\ns/\\s//gm;\nprint;\nfor $i qw(<>v^ ><^v){/^\\Q$i\\E$/ && ++$f}\nprint $f? YES:NO"}], "src_uid": "eab5c84c9658eb32f5614cd2497541cf"} {"source_code": "#!/usr/bin/perl\n\nuse 5.006;\nuse strict;\nuse warnings;\n\nsub f {\nmy $a = shift;\nmy $b = shift;\nmy $c = shift;\nmy $t = shift;\nmy $cur = $t * $b;\nfor(1..$c) {\n return 0 if(0 > $cur - $a + $b);\n $cur -= $a - $b;\n}\nreturn 1;\n}\n\nmy $num = <>;\nmy @arr = split(/ /, $num);\nmy $a = $arr[0];\nmy $b = $arr[1];\nmy $c = $arr[2];\nmy $l = 0;\nmy $r = 1000010;\nwhile ($r - $l > 1) {\n my $m = int(($r + $l) / 2); \n \n if (f($a, $b, $c, $m)) {\n $r = $m;\n } else {\n $l = $m\n }\n}\n\nprint $r;", "positive_code": [{"source_code": "#!perl -w\nuse strict;\nuse warnings;\nuse POSIX qw[ceil];\nmain();\n\nsub main {\n my ($a,$b,$c) = split /\\D/, <>;\n my $to_load = $a * $c;\n my $to_preload = $to_load - $b * $c;\n my $res = ceil($to_preload / $b);\n print $res;\n}\n\n__END__\n4 1 1\n10 3 2\n13 12 1"}, {"source_code": "if(<>=~/(\\d+)\\s(\\d+)\\s(\\d+)/){print((($1*$3%$2)&&1)-$3+int($1*$3/$2))}\n"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse 5.006;\nuse strict;\nuse warnings;\n\nsub f {\nmy $a = shift;\nmy $b = shift;\nmy $c = shift;\nmy $t = shift;\nmy $cur = $t * $b;\nfor(1..$c) {\n return 0 if(0 > $cur - $a + $b);\n $cur -= $a - $b;\n}\nreturn 1;\n}\n\nmy $num = <>;\nmy @arr = split(/ /, $num);\nmy $a = $arr[0];\nmy $b = $arr[1];\nmy $c = $arr[2];\nmy $l = 0;\nmy $r = 10;\nwhile ($r - $l > 1) {\n my $m = int(($r + $l) / 2); \n \n if (f($a, $b, $c, $m)) {\n $r = $m;\n } else {\n $l = $m\n }\n}\n\nprint $r;"}, {"source_code": "if(<>=~/(\\d+)\\s(\\d+)\\s(\\d+)/){print(($1*$3%$2&1)-$3+int($1*$3/$2))}"}], "src_uid": "7dd098ec3ad5b29ad681787173eba341"} {"source_code": "# cf714a\nuse strict;\n=item\nA. Meeting of Old Friends\ntime limit per test\n1 second\nmemory limit per test\n256 megabytes\ninput\nstandard input\noutput\nstandard output\n\nToday an outstanding event is going to happen in the forest \n\u2014 hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute\nl1 to minute r1 inclusive. Also, during the minute k she prinks \nand is unavailable for Filya.\n\nFilya works a lot and he plans to visit Sonya from minute\nl2 to minute r2 inclusive.\n\nCalculate the number of minutes they will be able to spend together.\nInput\n\nThe only line of the input contains integers l1, r1, l2, r2 \nand k (1\u2009\u2264\u2009l1,\u2009r1,\u2009l2,\u2009r2,\u2009k\u2009\u2264\u20091018, l1\u2009\u2264\u2009r1, l2\u2009\u2264\u2009r2), \nproviding the segments of time for Sonya and Filya and the moment of \ntime when Sonya prinks.\n\nOutput\n\nPrint one integer \u2014 the number of minutes Sonya and Filya will be able to spend together.\nExamples\nInput\n\n1 10 9 20 1\n\nOutput\n\n2\n\nInput\n\n1 100 50 200 75\n\nOutput\n\n50\n\nNote\n\nIn the first sample, they will be together during minutes 9 and 10.\n\nIn the second sample, they will be together from minute 50 to minute 74 and from minute 76 to minute 100.\n=cut\nuse bigint;\n\nmy ($l1,$r1,$l2,$r2,$k)=map {$_+0} split(' ',<>);\nmy $a=$l1<=$l2 ? $l2 : $l1;\nmy $b=$r1<=$r2 ? $r1 : $r2;\nmy $r=$b-$a>=0?$b-$a+1:0;\nmy $s=(($a<=$k)&&($k<=$b))?1:0;\nprint $r-$s,\"\\n\";\n\n\n\n", "positive_code": [{"source_code": "use strict;\nuse warnings;\n\nuse Data::Dumper;\n$,=\" \";\nmy ($l1,$r1,$l2,$r2,$k)=split / /,<>;\nchomp($l1,$r1,$l2,$r2,$k);\nmy $ans=min($r1,$r2)-max($l1,$l2)+1;\nif(max($l1,$l2) <= $k and $k <=min($r1,$r2))\n{\n $ans--;\n}\nif($ans>=0)\n{\n print $ans . \"\\n\";\n}\nelse\n{\n print \"0\\n\";\n}\n\nsub min\n{\nmy $ans=shift;\nwhile(@_)\n{\nmy $temp=shift;\n$ans=$temp if($ans>$temp);\n}\nreturn $ans;\n}\n\nsub max\n{\nmy $ans=shift;\nwhile(@_)\n{\nmy $temp=shift;\n$ans=$temp if($ans<$temp);\n}\nreturn $ans;\n}\n"}], "negative_code": [{"source_code": "# cf714a\nuse strict;\n=item\nA. Meeting of Old Friends\ntime limit per test\n1 second\nmemory limit per test\n256 megabytes\ninput\nstandard input\noutput\nstandard output\n\nToday an outstanding event is going to happen in the forest \n\u2014 hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute\nl1 to minute r1 inclusive. Also, during the minute k she prinks \nand is unavailable for Filya.\n\nFilya works a lot and he plans to visit Sonya from minute\nl2 to minute r2 inclusive.\n\nCalculate the number of minutes they will be able to spend together.\nInput\n\nThe only line of the input contains integers l1, r1, l2, r2 \nand k (1\u2009\u2264\u2009l1,\u2009r1,\u2009l2,\u2009r2,\u2009k\u2009\u2264\u20091018, l1\u2009\u2264\u2009r1, l2\u2009\u2264\u2009r2), \nproviding the segments of time for Sonya and Filya and the moment of \ntime when Sonya prinks.\n\nOutput\n\nPrint one integer \u2014 the number of minutes Sonya and Filya will be able to spend together.\nExamples\nInput\n\n1 10 9 20 1\n\nOutput\n\n2\n\nInput\n\n1 100 50 200 75\n\nOutput\n\n50\n\nNote\n\nIn the first sample, they will be together during minutes 9 and 10.\n\nIn the second sample, they will be together from minute 50 to minute 74 and from minute 76 to minute 100.\n=cut\n\nmy ($l1,$r1,$l2,$r2,$k)=split(' ',<>);\nmy $a=$l1<=$l2 ? $l2 : $l1;\nmy $b=$r1<=$r2 ? $r1 : $r2;\nprint $b-$a+1-($a<=$k&&$k<=$b),\"\\n\";\n\n\n\n"}, {"source_code": "# cf714a\nuse strict;\n=item\nA. Meeting of Old Friends\ntime limit per test\n1 second\nmemory limit per test\n256 megabytes\ninput\nstandard input\noutput\nstandard output\n\nToday an outstanding event is going to happen in the forest \n\u2014 hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute\nl1 to minute r1 inclusive. Also, during the minute k she prinks \nand is unavailable for Filya.\n\nFilya works a lot and he plans to visit Sonya from minute\nl2 to minute r2 inclusive.\n\nCalculate the number of minutes they will be able to spend together.\nInput\n\nThe only line of the input contains integers l1, r1, l2, r2 \nand k (1\u2009\u2264\u2009l1,\u2009r1,\u2009l2,\u2009r2,\u2009k\u2009\u2264\u20091018, l1\u2009\u2264\u2009r1, l2\u2009\u2264\u2009r2), \nproviding the segments of time for Sonya and Filya and the moment of \ntime when Sonya prinks.\n\nOutput\n\nPrint one integer \u2014 the number of minutes Sonya and Filya will be able to spend together.\nExamples\nInput\n\n1 10 9 20 1\n\nOutput\n\n2\n\nInput\n\n1 100 50 200 75\n\nOutput\n\n50\n\nNote\n\nIn the first sample, they will be together during minutes 9 and 10.\n\nIn the second sample, they will be together from minute 50 to minute 74 and from minute 76 to minute 100.\n=cut\n\nmy ($l1,$r1,$l2,$r2,$k)=split(' ',<>);\n\nif($l1>$l2) {\n ($l1,$r1)=($l2,$r2);\n}\n# l1<=l2\nif($r1<$l2) {\n print 0,\"\\n\";\n}\n# l2<=r1\nmy $r=$r1-$l2+1; # inc\nif(($l2<=$k) and ($k<=$r1)) {\n --$r;\n}\nprint \"$r\\n\";\n\n\n\n"}], "src_uid": "9a74b3b0e9f3a351f2136842e9565a82"} {"source_code": "@a=split(' ',<>);\n@l=split(' ',<>);\n$ref=@l[@a[1]-@a[0]-1];\n$ans=0;\nforeach(@l)\n{\nif($_>=$ref and $_>0)\n{\n$ans+=1;\n}\n}\nprint \"$ans\\n\";\n", "positive_code": [{"source_code": "#!/usr/local/bin/perl\n\n($n , $k) = split (/ / , <>);\n@a = split (/ / , <>);\n\nif ($a[0] == 0 || $k == 0){\n print \"0\\n\";\n exit;\n}\nif ($a[$k-1] == 0){\n print binSearch(0 , $k -1).\"\\n\";\n exit;\n}\n$count = $k;\nwhile ($a[$count] == $a[$k-1] && $count<= $#a){\n $count++;\n \n}\nprint $count.\"\\n\";\n\nsub binSearch{\n use integer;\n my $begin = $_[0];\n my $end = $_[1];\n my $mid = $begin + ($end -$begin) / 2;\n \n if ($begin == $mid){\n return $begin+1;\n } \n\n if ($a[$mid] != 0){\n return binSearch($mid , $end); \n }\n return binSearch($begin , $mid); \n}\n"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\n\nchomp(my $in = <>);\nmy @in1 = split(\" \", $in);\nmy $k = $in1[1] -1;\n\nchomp($in = <>);\nmy @in2 = split(\" \", $in);\n\nif($in2[$k] > 0){\n\tmy $temp = $in2[$k];\n\tmy $ans = $k;\n\tfor my $i ($k+1..$#in2){\n\t\tif($in2[$i] == $temp){\n\t\t\t$ans++;\n\t\t}\n\t}\n\tprint $ans+1;\n}\nelse{\n\tmy $ans = 0;\n\tfor my $i (0..$k-1){\n\t\tif($in2[$i] > 0){\n\t\t\t$ans++;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "($n, $k) = split(' ', <>);\n@a = split(' ', <>);\n$res = 0;\nfor(@a) {\n $res++ if $_ > 0 && $_ >= $a[$k - 1];\n}\nprint $res . \"\\n\";"}, {"source_code": "while (<>){\n / /;\n @_=split/ /,<>;\n\n $i=0;\n for ($'..$`-1){\n $_[$_]==$_[$'-1] and $i++\n }\n $j=0;\n for (@_){/^0$/ and $j++}\n print $'+$i<$`-$j?$'+$i:$`-$j;\n print \"\\n\"\n }"}, {"source_code": "my ($n, $k) = split / +/, ;\nmy @arr = split / +/g, ;\n\nmy $ans = 0;\n\nfor (@arr) {\n\tif ($_ >= $arr[$k - 1] && $_ > 0) {\n\t\t++$ans;\n\t}\n}\n\nprint $ans.\"\\n\";"}, {"source_code": "my ($n, $k) = split / +/, ;\nmy @arr = split / +/g, ;\nmy $ans = 0;\n\n$ans += ($_ >= $arr[$k - 1] && $_ > 0? 1 : 0) for (@arr);\n\nprint $ans.\"\\n\";"}, {"source_code": "$_ = ; my ($n, $k) = split;\n$_ = ; my @A = split;\n\n@P = grep($_ > 0 && $_ >= $A[$k - 1], @A);\nprint @P . \"\\n\";\n"}, {"source_code": "#\n# Hello World Program in Perl\n#\nuse strict;\nmy ($a, $b) = split /\\s/, <>;\n\nmy @units = split /\\s/, <>;\n$b--;\n$b++ while($b < $#units && $units[$b] == $units[$b+1]);\n$b-- while($b >= 0 && $units[$b] == 0);\nprint $b+1;\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nuse utf8;\nuse v5.20;\n\nsub main {\n my %args = @_;\n\n my ($n, $k) = split(/ /, readline(STDIN));\n my @points = split(/ /, readline(STDIN));\n\n my $pass_count = 0;\n my $pass_points = $points[$k-1];\n\n if ($pass_points > 0) {\n $pass_count = $k;\n\n foreach my $mark (@points[$k..$n-1]) {\n last if $mark < $pass_points;\n $pass_count += 1;\n }\n }\n else {\n foreach my $mark (@points[0..$k-1]) {\n last if $mark <= 0;\n $pass_count += 1;\n }\n }\n\n say $pass_count;\n\n return;\n}\n\nmain();\n\nexit;\n\n"}, {"source_code": "#!/usr/bin/perl\n# Codeforces Practice 158A - 25 May 2012\n\nuse warnings;\nuse strict;\n\nmy ($n,$k) = split(\" \", );\nmy @scores = split(\" \", );\n\nmy $kthScore = $scores[$k-1];\nmy $ret = 0;\n\nfor(0..$#scores){\n if($scores[$_]>=$kthScore && $scores[$_]!=0){\n $ret++;\n }\n}\n\nprint $ret;"}, {"source_code": "#!/usr/bin/perl\n# Codeforces Practice 158A - 25 May 2012\n\nuse warnings;\nuse strict;\n\nmy ($n,$k) = split(\" \", );\nmy @scores = split(\" \", );\n\nmy $kthScore = $scores[$k-1];\nmy $ret = 0;\n\nfor(@scores){\n if($_>=$kthScore && $_!=0){\n $ret++;\n }\n}\n\nprint $ret;"}, {"source_code": "my($n, $k) = split(\" \", );\nmy @a = split(\" \", );\nmy $count = 0;\nforeach my $i (@a) {\n if(($i >= $a[$k-1])&&($i > 0)) {\n $count++;\n }\n}\nprint $count;"}, {"source_code": "#!perl -w\nuse strict;\n\nmy ($n , $k) = split(/\\s+/,);\nmy @score = split(/\\s+/,);\nmy ($i,$j) ;\n\n\n\nfor ( $i = $k-1 ; $i < $n && $score[$k-1] == $score[$i] ; $i++ ){\n 1;\n}\nfor ( $j = 0 ; $j < $n && $score[$j] > 0 ; $j++ ){\n 1;\n}\n\n\nprint $i < $j ? ($i) : ($j) , \"\\n\";"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\n\nchomp;\n($n, $k) = split / /, <>;\nchomp;\n@a = split / /, <>;\n$bound = $a[$k-1]>0 ? $a[$k-1]:1;\n@a = sort { $a <=> $b } @a;\n$ans = 0;\n# print \"bound = $bound\";\n# print $#a;\nforeach (@a) {\n\t++$ans if $_ >= $bound;\n\t# print \"$_ \"\n}\n# print ;\nprint $ans;"}, {"source_code": "($n, $k) = split / /, <>;\n@a = split / /, <>; \nprint scalar grep {$_ > 0 && $_ >= $a[$k-1]} @a;"}, {"source_code": "use strict;\nuse warnings;\n\nmy $in1 = <>;\nmy ($n, $k) = split ' ', $in1;\nmy $in2 = <>;\nmy @a = split ' ', $in2;\n\n# check a[0]=0 case...\n\n#find k'th place score.\n# find all a[i] bigger or equal to k'th place score\n\n\nmy $score_k = $a[$k-1];\n\nmy $winners = 0;\nfor (my $i=0; $i < $n; $i++) {\n if ($a[$i] >= $score_k && $a[$i] > 0) {\n $winners++;\n }\n}\n\nprint $winners . \"\\n\";\n\n"}, {"source_code": "#!/usr/bin/perl\n\n($n, $k) = split ' ', ;\n@a = split ' ', ;\n\n$ans = 0;\nforeach my $x (@a) {\n\tif ($x >= $a[$k - 1] && $x > 0){\n\t\t$ans++;\n\t}\n}\nprint \"$ans \\n\";\n"}, {"source_code": "$l=;\nchomp($l);\n$l =~ /(\\d+)\\s+(\\d+)/;\n$n = $1; $k = $2;\n$l=;\nchomp($l);\n$l = \"9 $l\";\n@scores = split /\\s+/, $l;\n$c = 0;\n$p = 1;\n$target = $scores[$k];\nwhile($scores[$p] > 0 && $scores[$p] >= $target && $p <= $n) {\n\t$c++;\n\t$p++;\n}\nprint \"$c\\n\";"}, {"source_code": "# for numeric sorting\nsub numerically { $b <=> $a }\n\nmy $n, $k;\nmy $line;\nmy @arr, @sorted, @rev;\nchomp ( $line = );\nif ( $line =~ m/(.+) (.+)/ ) {\n $n = $1;\n $k = $2;}\nchomp ( $line = );\n\n@arr = split m/ /, $line;\n@sorted = sort numerically @arr;\n# @rev = reverse ( @sorted );\n\nmy $threshold = $sorted[ $k-1 ];\nmy $count = 0;\nfor (@sorted) {\n if ( $_ >= $threshold && $_ > 0 ) {\n\t$count += 1; }}\nprint \"$count\\n\";\n\n\n\n\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse v5.012;\nuse warnings;\n\nmy ($n, $k) = split / /, ;\nmy @scores = split / /, ;\n\nmy $meh = grep { $_ > 0 } @scores[0..$k-1];\nmy $pass = grep { $_ > 0 && $_ == $scores[$k - 1] } @scores[$k..scalar @scores - 1];\n\nprint $meh + $pass;\n"}, {"source_code": "($n, $k) = split \" \", <>;\n@mas = split \" \", <>;\n@mas = sort {$b <=> $a} @mas;\n$curr = @mas[$k-1];\nif ($curr == 0)\n{\n\t$ans = 0;\n\tforeach $index (0..$n-1)\n\t{\n\t\tif (@mas[$index] != 0)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}\nelse\n{\t\n\t$ans = $k;\n\tforeach $index ($k..$n-1)\n\t{\n\t\t# print \"$index\\n\";\n\t\tif (@mas[$index] == $curr)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "($n, $k) = split \" \", <>;\n@mas = split \" \", <>;\n$curr = @mas[$k-1];\nif ($curr == 0)\n{\n\t$ans = 0;\n\tforeach $index (0..$n-1)\n\t{\n\t\tif (@mas[$index] != 0)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}\nelse\n{\t\n\t$ans = $k;\n\tforeach $index ($k..$n-1)\n\t{\n\t\t# print \"$index\\n\";\n\t\tif (@mas[$index] == $curr)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input = split(/ /,);\nmy $n = $input[0];\nmy $k = $input[1];\nmy @a = split(/ /,);\nmy $i;\nmy $count = 0;\nfor($i = 0 ; $i < @a ; $i++){\n if($a[$i] >= $a[$k-1] && $a[$i] > 0){\n $count++;\n }\n}\nprint \"$count\\n\";"}, {"source_code": "use strict;\nuse warnings;\n\nmy ($n, $k) = split ' ', <>;\nmy @a = split ' ', <>;\nmy $lim = $a[$k-1];\n@a = grep { $_ >= $lim && $_ > 0 } @a;\nprint scalar @a, \"\\n\";\n"}, {"source_code": "($n,$k) = split(\" \", );\n@a;\n\n@a = split(\" \", );\n$ok=1;\n$i=0;\n$nb=0;\nwhile($i<$k and $ok){\nif($a[$i]>0){\n$nb++;\n}\nelse{\n$ok=0;\n}\n$i++;\n}\nif(!$ok){\nprint $nb;\n\n}\nelse{\n$i=$k;\nwhile($i<$n && $ok){\nif($a[$i]==$a[$i-1]){\n$nb++;\n\n}\nelse{\n$ok=0;\n}\n$i++;\n}\nprint $nb;\n\n}\n\n\n"}, {"source_code": "\n$\\=$/;\n\n($n,$k)=split(\" \",);\n@members=split(\" \",);\n$k--;\nmy $j=-1;\n\n1 while (($members[++$j]>=$members[$k])&&(($members[$j]>0)));\n\nprint $j;"}, {"source_code": "my @a = split \" \", <>;\nmy @b = split \" \", <>;\nmy $cnt = 0;\nforeach (@b)\n{\n last unless $_ >= $b[$a[1]-1] and $_ > 0;\n ++$cnt;\n}\nprint $cnt;"}, {"source_code": "#!/bin/perl\nuse strict;\nuse warnings;\nmy @a = ();\nmy $a = '';\nmy $s = 0;\nmy ($n, $k) = split \" \", <>;\nchomp ($a = <>);\nforeach (1..$n) { @a = $a =~ /\\d+/sg; }\nforeach (@a) {\n if ($a[$k-1] <= $_) {\n $s = ($s+1) if ($_ > 0);\n } else {\n last;\n }\n}\nprint \"$s\\n\";"}, {"source_code": "#!perl\nmy($n, $k) = split / /, ;\nif (!$n) {\n\tprint(0, \"\\n\");\n\texit;\n}\nif ($k > $n) {\n\tdie \"wrong input: n < k\\n\";\n}\nmy @points = grep {length $_ > 0} split / /, ;\n@points = map {int $_} grep {/^-?\\d+$/} @points;\nif ($#points + 1 != $n){\n\tdie \"wrong input: incorrect count\\n\";\n}\n@points = sort {$b <=> $a} grep {$_ > 0} @points;\nmy $count = $#points + 1;\nmy $min = $points[$k-1];\nif ($k > $count) {\n\tprint($count, \"\\n\");\n\texit;\n}\nmy $out = $k;\nfor (my $i = $k; $i < $count && $points[$i] == $min; $i++) {\n\t$out++;\n}\nprint $out, \"\\n\";\n"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans = 0;\n$ans += ($_ >= $arr[$k - 1] && $_ ? 1 : 0) foreach(@arr);\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";\n"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans = 0;\n\n# $ans += ($_ >= $arr[$k - 1] ? 1 : 0) foreach(@arr);\n$l = scalar @arr - 1;\nfor my $i(0..$l) {\n if ($arr[$i] >= $arr[$k - 1] && $arr[$i] != 0) {\n $ans++;\n }\n}\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";\n"}, {"source_code": "$l=;\nchomp($l);\n$l =~ /(\\d+)\\s+(\\d+)/;\n$n = $1; $k = $2;\n$l=;\nchomp($l);\n$l = \"9 $l\";\n@scores = split /\\s+/, $l;\n$c = 0;\n$p = 1;\n$target = $scores[$k];\nwhile($scores[$p] > 0 && $scores[$p] >= $target && $p <= $n) {\n\t$c++;\n\t$p++;\n}\nprint \"$c\\n\";"}, {"source_code": "#!/bin/perl\nuse strict;\nuse warnings;\nmy @a = ();\nmy $s = 0;\nmy ($n, $k) = split \" \", <>;\n\n@a = split \" \", <>;\nforeach (@a) {\n if ($a[$k-1] <= $_) {\n $s = ($s+1) if ($_ > 0);\n } else {\n last;\n }\n}\nprint \"$s\\n\";"}, {"source_code": "use strict;\n\nmy ($n, $k) = split / /, <>;\nmy @a = split / /, <>;\n\nmy $res = 0;\n\nfor (@a) {\n $_ > 0 && $_ >= $a[$k - 1] && ++$res;\n}\n\nprint $res;"}, {"source_code": "my @imin = split(\" \", ); @_ = ( split \" \", ); my $min = $_[$imin[-1]-1]; $_ = grep { $_ >= $min and $_ > 0 } @_; print \"$_\\n\";"}, {"source_code": "use strict;\nuse warnings;\nuse feature \"say\";\n\nmy $n;\nmy $k;\n\n($n, $k) = split / +/, ;\n\nmy @a = split / +/, ;\nmy $ans = 0;\n\nfor (@a)\n{\n if ($_ >= $a[$k - 1] && $_ > 0)\n {\n $ans++;\n }\n}\nsay $ans;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $temp_line;\nmy @first_line;\nmy @second_line;\nmy $a_score_index; # advance_score_index\n\n$temp_line = <>;\n@first_line = split(\" \", $temp_line);\n\n$temp_line = <>;\n@second_line = split(\" \", $temp_line);\n\n$a_score_index = $first_line[1] - 1; # kth place to index\n\nwhile ($a_score_index < @second_line\n && $second_line[$a_score_index + 1] == $second_line[$a_score_index]) {\n $a_score_index++;\n}\n\n# do not take 0 score into account\nwhile ($a_score_index > -1) {\n if (0 != $second_line[$a_score_index]) {\n last;\n }\n $a_score_index--;\n}\n\nprint $a_score_index + 1;"}, {"source_code": "use strict;\n\nmy ($n, $k) = split(/\\s/, );\nmy @r = split(/\\s/, );\n\nmy $c = 0;\n\nfor (my $i = 0; $i < scalar @r; $i++) {\n $c++ if ($r[$i] >= $r[$k - 1] && $r[$i]);\n}\n\nprint $c;"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nchomp ($_ = <>);\nmy ($n, $k) = split / /, $_;\nchomp ($_ = <>);\n@_ = split / /, $_;\n\n$k = $_[$k-1];\n$n = 0;\nforeach (@_) { $n++ if (($_ > 0) && $_ >= $k); }\nprint $n, \"\\n\";"}, {"source_code": "($n, $k) = split' ', <>;\n@a = split' ', <>;\n$ans = 0;\n--$k;\nfor ($i = 0; $i < $n; ++$i) {\n if ($a[$i] >= $a[$k] && $a[$i] > 0) {++$ans;}\n}\nprint $ans;"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nchomp( my $firstline = );\nmy ( $nummem, $lastmem ) = split / /, $firstline;\n\nchomp( my $secondline = );\nmy @point = split / /, $secondline;\n\nmy $count = 0;\n\nmy $lastpoint = $point[ $lastmem - 1 ];\n\nforeach my $p ( @point ) {\n if ( ( $p > 0 ) && ( $p >= $lastpoint ) ) {\n $count++;\n } else {\n last;\n }\n}\n\nprint \"$count\\n\";\n"}, {"source_code": "use warnings;\nuse strict;\n\nuse feature ':5.10';\n\nmy ($n, $k) = split / /, ;\nmy @a = split / /, , $n;\n\nmy $l = $a[$k - 1];\n\nmy $ans = 0;\n\nfor (@a){ $ans++ if ($_ >= $l and $_ > 0) };\n\nsay $ans;\n\n"}, {"source_code": "#!/usr/bin/perl\nuse strict; use warnings;\n\nmy ($n, $k, @a) = (0, (split ' ', )[1], split ' ', );\n$k = $a[$k - 1]; $k = 1 if $k < 1;\n$_ >= $k and ++$n foreach @a;\nprint $n . \"\\n\"\n"}], "negative_code": [{"source_code": "use strict;\nuse warnings;\n\nmy @input_lines;\n\n# read input\nwhile (<>) {\n my $line = $_;\n chomp $line;\n push @input_lines;\n}\n\nwhile (@input_lines) {\n print(pop @input_lines);\n print \"\\n\";\n}\n"}, {"source_code": "#\n# Hello World Program in Perl\n#\nuse strict;\nmy ($a, $b) = split /\\s/, <>;\n\nmy @units = split /\\s/, <>;\n\n$b++ while($b < $#units && $units[$b] == $units[$b+1]);\n$b-- while($b >= 0 && $units[$b] == 0);\nprint $b+1;\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nuse utf8;\nuse v5.20;\n\nsub main {\n my %args = @_;\n\n my ($n, $k) = split(/ /, readline(STDIN));\n my @points = split(/ /, readline(STDIN));\n\n my $pass_count = 0;\n my $pass_points = $points[$k-1];\n\n if ($pass_points > 0) {\n $pass_count = $k;\n\n foreach my $mark (@points[$k..$n-1]) {\n last if $mark < $pass_points;\n $pass_count += 1;\n }\n }\n else {\n foreach my $mark (@points[0, $k-1]) {\n last if $mark <= 0;\n $pass_count += 1;\n }\n }\n\n say $pass_count;\n\n return;\n}\n\nmain();\n\nexit;\n\n"}, {"source_code": "#!/usr/bin/perl\n# Codeforces Practice 158A - 25 May 2012\n\nuse warnings;\nuse strict;\n\nmy ($n,$k) = split(\" \", );\nmy @scores = split(\" \", );\n\nif($scores[$k-1]!=0)\n{\n my $kthScore = $scores[$k-1];\n my $ret = $k;\n for($k..$#scores){\n if($scores[$_]==$kthScore){\n $ret++;\n }\n last if($scores[$_]!=$kthScore);\n }\n print $ret;\n}\nelse \n{\n print 0;\n}"}, {"source_code": "#!/usr/bin/perl\n# Codeforces Practice 158A - 25 May 2012\n\nuse warnings;\nuse strict;\n\nmy ($n,$k) = split(\" \", );\nmy @scores = split(\" \", );\n\nif($k!=0)\n{\n my $kthScore = $scores[$k-1];\n my $ret = $k;\n for($k..$#scores){\n if($scores[$_]==$kthScore){\n $ret++;\n }\n last if($scores[$_]!=$kthScore);\n }\n print $ret;\n}\nelse \n{\n print 0;\n}"}, {"source_code": "#!/usr/bin/perl\n# Codeforces Practice 158A - 25 May 2012\n\nuse warnings;\nuse strict;\n\nmy ($n,$k) = split(\" \", );\nmy @scores = split(\" \", );\n\nmy $kthScore = $scores[$k-1];\nmy $ret = 0;\nfor(0..$#scores){\n if($scores[$_]>=$kthScore && $scores[$_]!=0){\n $ret++;\n }\n last if($scores[$_]!=$kthScore);\n}\nprint $ret;"}, {"source_code": "#!perl -w\nuse strict;\n\nmy ($n , $k) = split(/\\s+/,);\nmy @score = split(/\\s+/,);\nmy ($i,$j) ;\n\n\n\nfor ( $i = $k ; $score[$k-1] == $score[$i-1] && $i < $n ; $i++ ){\n 1;\n}\nfor ( $j = 0 ; $j < $n && $score[$j] > 0 ; $j++ ){\n 1;\n}\n\n\nprint $i-1 < $j ? ($i-1) : ($j) , \"\\n\";"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\n\nchomp;\n($n, $k) = split / /, <>;\nchomp;\n@a = sort split / /, <>;\n$bound = $a[$k-1];\nforeach (@a) {\n\t++$ans if $_ >= $bound;\n}\nprint $ans;"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\n\nchomp;\n($n, $k) = split / /, <>;\nchomp;\n@a = sort split / /, <>;\n$bound = $a[$k-1]>0 ? $a[$k-1]:1;\n$ans = 0;\nforeach (@a) {\n\t++$ans if $_ >= $bound;\n}\nprint $ans;"}, {"source_code": "#!/usr/bin/perl\n\n($n, $k) = split ' ', ;\n@a = split ' ', ;\nsort @a;\n$ans = 0;\nforeach my $x (@a) {\n\tif ($x >= $a[$n - $k] && $x > 0){\n\t\t$ans++;\n\t}\n}\nprint \"$ans \\n\";\n"}, {"source_code": "#!/usr/bin/perl\n\n($n, $k) = split ' ', ;\n@a = split ' ', ;\n\n$ans = 0;\nforeach my $x (sort @a) {\n\tif ($x >= $a[$n - $k] && $x > 0){\n\t\t$ans++;\n\t}\n}\nprint \"$ans \\n\";\n"}, {"source_code": "$l=;\nchomp($l);\n$l =~ /(\\d+)\\s+(\\d+)/;\n$n = $1; $k = $2;\n$l=;\nchomp($l);\n$l = \"9 $l\";\n@scores = split /\\s+/, $l;\n$c = 0;\n$p = 1;\n$target = $scores[$k];\nwhile($target > 0 && $scores[$p] >= $target && $p <= $n) {\n\t$c++;\n\t$p++;\n}\nprint \"$c\\n\";"}, {"source_code": "($n, $k) = split \" \", <>;\n@mas = split \" \", <>;\n@mas = reverse sort @mas;\n$curr = @mas[$k-1];\nif ($curr == 0)\n{\n\t$ans = 0;\n\tforeach $index (0..$n-1)\n\t{\n\t\tif (@mas[$index] != 0)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}\nelse\n{\t\n\t$ans = $k;\n\tforeach $index ($k..$n-1)\n\t{\n\t\tif (@mas[$index] == $curr)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "($n, $k) = split \" \", <>;\n@mas = split \" \", <>;\n@mas = sort @mas;\n$curr = @mas[$k-1];\nif ($curr == 0)\n{\n\t$ans = 0;\n\tforeach $index (0..$n-1)\n\t{\n\t\tif (@mas[$index] != 0)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}\nelse\n{\t\n\t$ans = $k;\n\tforeach $index ($k..$n-1)\n\t{\n\t\tif (@mas[$index] == $curr)\n\t\t{\n\t\t\t$ans = $ans + 1;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "\n$\\=$/;\n\n($n,$k)=split(\" \",);\n@members=split(\" \",);\n\nmy $j=-1;\n\n1 while (($members[++$j]>=$members[$k])&&(($members[$j]>0)));\n\nprint $j;"}, {"source_code": "#!/bin/perl\nuse strict;\nuse warnings;\nmy @a = ();\nmy $a = '';\nmy $s = 0;\nmy ($n, $k) = split \" \", <>;\nchomp ($a = <>);\nforeach (1..$n) { @a = $a =~ /\\d/sg; }\nforeach (@a) {\n if ($k < $_) { $s = ($s+1); } else { last; }\n}\nprint \"$s\";"}, {"source_code": "#!/bin/perl\nuse strict;\nuse warnings;\nmy @a = ();\nmy $a = '';\nmy $s = 0;\nmy ($n, $k) = split \" \", <>;\nchomp ($a = <>);\nforeach (1..$n) { @a = $a =~ /\\d+/sg; }\nforeach (@a) {\n if ($a[$k] <= $_) {\n $s = ($s+1) if ($_ > 0);\n } else {\n last;\n }\n}\nprint \"$s\\n\";"}, {"source_code": "#!/bin/perl\nuse strict;\nuse warnings;\n\n\nmy @a = ();\nmy $a = '';\nmy $s = 0;\nmy ($n, $k) = split \" \", <>;\nchomp ($a = <>);\nforeach (1..$n) { @a = $a =~ /\\d+/sg; }\nforeach (@a) {\n if ($k < $_) { $s = ($s+1); } else { last; }\n}\nprint \"$s\";"}, {"source_code": "use strict;\nuse warnings;\nuse feature \"say\";\n\nmy $n;\nmy $k;\n\n($n, $k) = split / +/, ;\n\nmy @a = split / +/, ;\nmy $ans = 0;\n\nfor (@a)\n{\n if ($_ >= $a[$k] && $_ > 0)\n {\n $ans++;\n }\n}\nsay $ans;\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nchomp ($_ = <>);\nmy ($n, $k) = split / /, $_;\nchomp ($_ = <>);\n@_ = split / /, $_;\n\n$k = $_[$k];\n$n = 0;\nforeach (@_) { $n++ if (($_ > 0) && $_ >= $k); }\nprint $n, \"\\n\";"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nchomp ($_ = <>);\nmy ($n, $k) = split / /, $_;\nchomp ($_ = <>);\n@_ = split / /, $_;\n\n$k = @_[$k];\n$n = 0;\nforeach (@_) { $n++ if ($_ >= $k); }\nprint $n, \"\\n\";"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nchomp ($_ = <>);\nmy ($n, $k) = split / /, $_;\nchomp ($_ = <>);\n@_ = split / /, $_;\n\nprint \"$n $k\\n\" . join (\",\", @_), \"\\n\";\n$k = @_[$k];\n$n = 0;\nforeach (@_) { $n++ if ($_ >= $k); }\nprint $n, \"\\n\";"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nmy $n = <>;\n\nmy @cmd;\npush @cmd, <> for ($n);\n\nmy $curdir = \"/\";\nmy @dirstack = ();\n\nsub pwd() { print $curdir, \"\\n\"; }\n\nsub cd($) {\n my @path = split '/', shift;\n\n foreach my $dir (@path)\n {\n pop @dirstack if ($dir eq \"..\");\n push @dirstack, $dir if ($dir ne \"..\");\n }\n\n $curdir = (join \"/\", @dirstack) . \"/\";\n $curdir = \"/$curdir\" if ((substr $curdir,0,1) ne \"/\");\n}\n\nforeach (@cmd)\n{\n my ($cmd, $arg) = split /\\s/, $_;\n\n cd ($arg) if ($cmd eq \"cd\");\n pwd() if ($cmd eq \"pwd\");\n}\n"}, {"source_code": "use warnings;\nuse strict;\n\nuse feature ':5.10';\n\nmy ($n, $k) = split / /, ;\nmy @a = split / /, , $n;\n\nmy $l = $a[$k];\n\nmy $ans = 0;\n\nfor (@a){ $ans++ if ($_ >= $l and $_ > 0) };\n\nsay $ans;\n\n"}, {"source_code": "#!/usr/local/bin/perl\n\n($n , $k) = split (/ / , <>);\n@a = split (/ / , <>);\nif (!$a[0]){\n print \"0\\n\";\n exit;\n}\nif (!$a[$k-1]){\n print binSearch(0 , $k -1).\"\\n\";\n exit;\n}\n$count = $k;\nwhile ($a[$count] == $a[$k-1] && $count<= $#a){\n $count++;\n \n}\nprint $count.\"\\n\";\n\nsub binSearch{\n use integer;\n my $begin = $_[0];\n my $end = $_[1];\n my $mid = $begin + ($end -$begin) / 2;\n \n if ($begin == $mid){\n return $begin+1;\n } \n\n if ($a[$mid]){\n return binSearch($mid , $end); \n }\n return binSearch($begin , $mid); \n}\n"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\n\nchomp(my $in = <>);\nmy @in1 = split(\" \", $in);\nmy $k = $in1[1];\n\nchomp($in = <>);\nmy @in2 = split(\" \", $in);\n\nif($in2[$k] > 0){\n\tmy $temp = $in2[$k];\n\tmy $ans = $k;\n\tfor my $i ($k+1..$#in2){\n\t\tif($in2[$i] == $temp){\n\t\t\t$ans++;\n\t\t}\n\t}\n\tprint $ans;\n}\nelse{\n\tmy $ans = 0;\n\tfor my $i (0..$k-1){\n\t\tif($in2[$i] > 0){\n\t\t\t$ans++;\n\t\t}\n\t}\n\tprint $ans;\n}"}, {"source_code": "$_=<>;\n($a)=/(\\d+)$/;\n$_=<>;\ns/(\\d+)/$1>$a&&$i++&&()/ge;\nprint$i"}, {"source_code": "$_=<>;\n($a)=/(\\d+)$/;\n$_=<>;\ns/\\b0\\b//g;\nfor$j(1..$a){s/\\d+//;$b=$&};\ns/(\\d+)/$1-$b?():$a++/ge;\nprint$a"}, {"source_code": "$_=<>;\n($a)=/(\\b\\d+)$/;\n@_=split/ /,<>;\nif($_[$a-1]){\n $b=$_[$a-1];\n $c=$a;\n $i=$a;\n while($c<@_){\n if($_[$c++]==$b){$i++}else{last}\n }\n \n \n}else{\n for(@_){$_&&$i++}\n}\nprint$i"}, {"source_code": "$a, $b = split/ /,<>;\n$_=<>;\ns/\\b(\\d+)\\b/$1>$b?($i++):($i--)/ge;\nprint $i"}, {"source_code": "($a, $b) = split/ /,<>;\n$_=<>;\n$i=0;\ns/\\b(\\d+)\\b/$1>$b?($i++):()/ge;\nprint $i"}, {"source_code": "$_=<>;\n($a)=/(\\b\\d+)$/;\n@_=split/ /,<>;\nif($_[$a-1]){\n $b=$_[$a-1];\n $c=$a;\n $i=$a;\n while($c<@_){\n if($_[$c++]==$b){$i++}else{last}\n }\n \n \n}else{\n for(@_){$_&&$i++}\n}\n\nprint$i"}, {"source_code": "($a, $b) = split/ /,<>;\n$_=<>;\ns/\\b(\\d+)\\b/$1>$b?($i++):()/ge;\nprint $i"}, {"source_code": "while (<>){\n / /;\n @_=split/ /,<>;\n\n $i=0;\n for ($'..$`-1){\n $_[$_]==$_[$'-1] and $i++\n }\n while (@_ and !pop @_){\n $i--\n }\n print $'+$i,\"\\n\"\n \n }"}, {"source_code": "@a=split(' ',<>);\n@l=split(' ',<>);\n@l=sort @l;\n$ref=@l[@a[1]-@a[0]-1];\n$ans=0;\nforeach(@l)\n{\nif($_>=$ref and $_>0)\n{\n$ans+=1;\n}\n}\nprint \"$ans\\n\";\n"}, {"source_code": "@a=split(' ',<>);\n@l=split(' ',<>);\n@l=sort @l;\n$ref=@l[@a[1]-@a[0]-1];\nif($ref==0)\n{\n$ref=-1;\n}\n$ans=0;\nforeach(@l)\n{\nif($_>=$ref)\n{\n$ans+=1;\n}\n}\nprint \"$ans\\n\";\n"}, {"source_code": "@a=split(' ',<>);\n@l=split(' ',<>);\n@l=sort @l;\n$ref=@l[@a[1]-@a[0]-1];\n$ans=0;\nforeach(@l)\n{\nif($_>=$ref)\n{\n$ans+=1;\n}\n}\nprint \"$ans\\n\";\n"}, {"source_code": "@a=split(' ',<>);\n@l=split(' ',<>);\n@l=sort @l;\n$ref=@l[@a[1]-@a[0]-1];\nif($ref==0)\n{\n$ref=1;\n}\n$ans=0;\nforeach(@l)\n{\nif($_>=$ref)\n{\n$ans+=1;\n}\n}\nprint \"$ans\\n\";\n"}, {"source_code": "($n, $k) = split / /, <>;\n@a = split / /, <>; \nprint scalar grep {$_ && $_ >= $a[$k-1]} @a;"}, {"source_code": "($n, $k) = split / /, <>;\n$a = split / /, <>;\nprint scalar grep {$_ > 0 && $_ >= $a[$k-1]} @a;"}, {"source_code": "($n, $k) = split / /, <>;\n$a = <>; \nprint scalar grep {$_ > 0 && $_ >= $a[$k-1]} @a;"}, {"source_code": "# for numeric sorting\nsub numerically { $b <=> $a }\n\nmy $n, $k;\nmy $line;\nmy @arr, @sorted, @rev;\nchomp ( $line = );\nif ( $line =~ m/(.+) (.+)/ ) {\n $n = $1;\n $k = $2;}\nchomp ( $line = );\n\n@arr = split m/ /, $line;\n@sorted = sort ( @arr );\n@rev = reverse ( @sorted );\n\nmy $threshold = $rev[ $k-1 ];\nmy $count = 0;\nfor (@rev) {\n if ( $threshold >= $_ && $_ > 0 ) {\n\t$count += 1; }}\n\nprint \"$count\\n\";\n\n\n\n\n"}, {"source_code": "\n\n\nmy $n, $k;\nmy $line;\nmy @arr, @sorted;\nchomp ( $line = );\nif ( $line =~ m/(.+) (.+)/ ) {\n $n = $1;\n $k = $2;}\nchomp ( $line = );\n@arr = split m/ /, $line;\n@sorted = sort ( @arr );\nmy $threshold = $sorted[ $k-1 ];\nmy $count = 0;\nfor (@sorted) {\n if ( $_ >= $threshold && $_ > 0 ) {\n\t$count += 1; }}\nprint \"$count\\n\";\n\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse v5.012;\nuse warnings;\n\nmy ($n, $k) = split / /, ;\nmy @scores = split / /, ;\n\nmy $len = scalar @scores;\nmy $meh = grep { $_ > 0 } @scores[0..$k-1];\nmy $pass = grep { $_ > 0 && $_ == $scores[$k] } @scores[$k..scalar @scores - 1];\n\nprint $meh + $pass;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input = split(/ /,);\nmy $n = $input[0];\nmy $k = $input[1];\nmy @a = split(/ /,);\nmy $i = $k;\nmy $count = 0;\nif($a[$k-1] == 0){\n print $count.\"\\n\";\n}else{\n $count = $k;\n while($i < @a and $a[$i] ==$a[$k-1] ){\n $count++;\n $i++;\n };\n print $count.\"\\n\";\n}"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans;\n\n$ans += ($_ >= $arr[$k] ? 1 : 0) foreach(@arr);\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";\n"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans = 0;\n\n# $ans += ($_ >= $arr[$k - 1] ? 1 : 0) foreach(@arr);\nforeach(@arr) {\n if ($_ >= $arr[$k - 1]) {\n $ans++;\n }\n}\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans = 0;\n\n# $ans += ($_ >= $arr[$k - 1] ? 1 : 0) foreach(@arr);\n$l = scalar @arr - 1;\nfor my $i(0..$l) {\n if ($arr[$i] >= $arr[$k - 1]) {\n $ans++;\n }\n}\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans = 0;\n\n$ans += ($_ >= $arr[$k - 1] ? 1 : 0) foreach(@arr);\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";\n"}, {"source_code": "my ($n, $k) = split \" \", <>;\nmy $l = <>;\nmy @arr = split \" \", $l;\nmy $ans;\n\n$ans += ($_ >= $arr[$k - 1] ? 1 : 0) foreach(@arr);\n$ans = 0 if ($arr[0] == 0);\nprint $ans, \"\\n\";\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $temp_line;\nmy @first_line;\nmy @second_line;\nmy $a_score_index; # advance_score_index\n\n$temp_line = <>;\n@first_line = split(\" \", $temp_line);\n\n$temp_line = <>;\n@second_line = split(\" \", $temp_line);\n\n$a_score_index = $first_line[1] - 1; # kth place to index\n\nwhile ($a_score_index < @second_line\n && $second_line[$a_score_index + 1] == $second_line[$a_score_index]) {\n $a_score_index++;\n}\n\nprint $a_score_index + 1;"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_line = ;\nmy $as_index = $input_line[1]; # index of score that will advance\nprint $as_index;\n@input_line = ;\n\n# find the index where last score equal to k is\nwhile ( $input_line[$as_index] != $input_line[$as_index + 1] ) {\n $as_index++;\n}\n\n# do not count the input parameters on first row\nprint $as_index - 2;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_lines;\n\n# read input\nwhile (<>) {\n my $line = $_;\n chomp $line;\n push @input_lines;\n}\n\nwhile (@input_lines) {\n print(pop @input_lines);\n print \"\\n\";\n}\n\n#test"}, {"source_code": "use strict;\nuse warnings;\n\nmy $as_index = $ARGV[1]; # index of score that will advance\n\n# find the index where last score equal to k is\nwhile ( $ARGV [$as_index] != $ARGV[$as_index + 1] ) {\n $as_index++;\n}\n\n# do not count the input parameters on first row\nprint $as_index - 2;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_lines;\n\nwhile (<>) {\n my $line = $_;\n chomp $line;\n push @input_lines;\n}\n\nwhile (@input_lines) {\n print(pop @input_lines);\n print \"\\n\";\n}\n"}, {"source_code": "print $ARGV[0]"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_line = ;\nmy $as_index = $input_line[1]; # index of score that will advance\n@input_line = ;\n\n# find the index where last score equal to k is\nwhile ( $input_line[$as_index] != $input_line[$as_index + 1] ) {\n $as_index++;\n}\n\n# do not count the input parameters on first row\nprint $as_index - 2;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_line = ;\nmy $as_index = $input_line[0]; # index of score that will advance\nprint $as_index;\n@input_line = ;\n\n# find the index where last score equal to k is\nwhile ( $input_line[$as_index] != $input_line[$as_index + 1] ) {\n $as_index++;\n}\n\n# do not count the input parameters on first row\nprint $as_index - 2;\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $temp_line;\nmy @first_line;\nmy @second_line;\nmy $a_score_index; # advance_score_index\n\n$temp_line = <>;\n@first_line = split(\" \", $temp_line);\n\n$temp_line = <>;\n@second_line = split(\" \", $temp_line);\n\n$a_score_index = $first_line[1] - 1; # kth place to index\n\nwhile ($a_score_index < @second_line\n && $second_line[$a_score_index + 1] == $second_line[$a_score_index]) {\n $a_score_index++;\n}\n\nif (0 == $a_score_index) { # nobody got positive score\n print $a_score_index;\n}\nelse {\n print $a_score_index + 1;\n}"}, {"source_code": "$input = ;\n\nprint $input;"}, {"source_code": "use strict;\nuse warnings;\n\nmy @input_lines;\n\n# read input\nwhile (<>) {\n my $line = $_;\n chomp $line;\n push @input_lines;\n}\n\nwhile (@input_lines) {\n print(pop @input_lines);\n print \"\\n\";\n}\n# fdsjoi\n"}, {"source_code": "print ARGV[0]"}, {"source_code": "use strict;\nuse warnings;\n\nmy $temp_line;\nmy @first_line;\nmy @second_line;\nmy $a_score_index; # advance_score_index\n\n$temp_line = <>;\n@first_line = split(\" \", $temp_line);\n\n$temp_line = <>;\n@second_line = split(\" \", $temp_line);\n\n$a_score_index = $first_line[1] - 1; # kth place to index\n\nwhile ($a_score_index < @second_line\n && $second_line[$a_score_index + 1] == $second_line[$a_score_index]) {\n $a_score_index++;\n}\n\nif (0 == $second_line[0]) { # nobody got positive score\n print $second_line[0];\n}\nelse {\n print $a_score_index + 1;\n}"}, {"source_code": "use strict;\nuse warnings;\n\nmy $temp_line;\nmy @first_line;\nmy @second_line;\nmy $a_score_index; # advance_score_index\n\n$temp_line = <>;\n@first_line = split(\" \", $temp_line);\n\n$temp_line = <>;\n@second_line = split(\" \", $temp_line);\n\n$a_score_index = $first_line[1] - 1; # kth place to index\n\nwhile ($a_score_index < @second_line\n && $second_line[$a_score_index + 1] == $second_line[$a_score_index]) {\n print \"first while\";\n $a_score_index++;\n}\n\n# do not take 0 score into account\nwhile ($a_score_index > -1) {\n if (0 != $second_line[$a_score_index]) {\n last;\n }\n $a_score_index--;\n}\n\nprint $a_score_index + 1;"}], "src_uid": "193ec1226ffe07522caf63e84a7d007f"} {"source_code": "\nmy $n = int<>;\nfor (my $i = 1;;$i++) {\n $n -= int($i * ($i + 1) / 2);\n if ($n < 0) {\n print $i - 1;\n last;\n }\n}", "positive_code": [{"source_code": "while(<>){\n\t$k=0; $j=0;\n\tfor $i(0..50){\n\t\t$k+=$j+=$i;\n\t\t$_ < $k and do {print $i-1,\" \"; last}\n\t\t}\n\t}"}, {"source_code": "my $n = <>;\nmy $c = 0;\nmy $s = 0;\nfor (1 .. $n) {\n $c += $_;\n $s += $c;\n if ($s >= $n) {\n print $s == $n? $_ : $_ - 1;\n exit;\n }\n}"}, {"source_code": "$_=<>;\n$x++,$a+=$x*($x+1)/2 until $a>$_;\nprint $x-1;\n"}, {"source_code": "$n=<>;$j=1;$k=2;$c=0;\nwhile ($n >= $j) {$n -= $j;$j += $k;$k += 1;$c++;};print $c;"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\nchomp($mx = <>);\nmy $tmp = 0;\nmy $tot = 0;\nmy $ans = 0;\nwhile (true) {\n\t$tmp += ++$ans;\n\t$tot += $tmp;\n\t$tot>$mx and --$ans and last;\n}\nsay $ans;\n"}, {"source_code": "@arr=qw(1 4 10 20 35 56 84 120 165 220 286 364 455 560 680 816 969 1140 1330 1540 1771 2024 2300 2600 2925 3276 3654 4060 4495 4960 5456 5984 6545 7140 7770 8436 9139 9880 10660 );\nchomp($n=);\n$len=@arr;\nfor($i=0;$i<$len;$i++)\n{\nif($n<$arr[$i])\n\t{\n\tprint $i;\n\texit;\n\t}\n}"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy $n = <>;\nmy $lvl = 1; my $num = 1;\nwhile($num <= $n){\n $n -= $num;\n $lvl++;\n $num += $lvl;\n}\n\nprint $lvl-1;\n"}], "negative_code": [{"source_code": "while(<>){\n\t$k=0; $j=0;\n\tfor $i(0..10){\n\t\t$k+=$j+=$i;\n\t\t$_ < $k and do {print $i-1,\" \"; last}\n\t\t}\n\t}"}, {"source_code": "while(<>){\n\tchomp;\n\t$j=0;\n\t$i=0;\n\t$k=0;\n\twhile(($_-=$i)>0){\n\t\t$i+=++$j;\n\t\t$k++;\n\t\t}\n\tprint \"$k\\n\"\n\t}"}, {"source_code": "for $i(1..10){\n\t$k+=$i;\n\tfor $j(1..$k){\n\t\tpush @_, $i\n\t\t}\n\t}\n$_=\"@_\";\ns/(\\b\\d\\b)(?= \\b\\1\\b)/$1-1/ge;\n@_=split;\nwhile(<>){\n\tchomp;\n\tprint $_[$_-1],$/\n\t}"}], "src_uid": "873a12edffc57a127fdfb1c65d43bdb0"} {"source_code": "$_ = <>;\n\nexit if $_ == 1 and print \"1 0\";\n\nfor $i ( 2 .. sqrt ){\n\tif( $_ % $i == 0 ){\n\t\t$h{ $i } ++;\n\t\t$_ /= $i;\n\t\tredo;\n\t\t}\n\t}\n\n$h{ $_ } ++;\ndelete $h{ 1 };\n\n$g{ $_ } ++ for values %h;\n\n$max = ( sort { $b <=> $a } keys %g )[ 0 ];\n\n$cnt += ( 1 < keys %g or ( sprintf \"%b\", $max ) !~ /^10*$/ );\n\t\n$max > 1 and $cnt += length sprintf \"%b\", -- $max;\n\n$min = eval join ' * ', keys %h;\n\nprint \"$min $cnt\"", "positive_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nmy $debug = 0;\n\nwhile(<>){\n\tchomp;\n\t\n\t$debug and print '-' x 15;\n\t$debug and print;\n\t\n\tif( $_ == 1 ){\n\t\tprint \"1 0\";\n\t\tnext;\n\t\t}\n\t\n\tmy %h;\n\t\n\tfor my $i ( 2 .. sqrt ){\n\t\tif( $_ % $i == 0 ){\n\t\t\t$h{ $i } ++;\n\t\t\t$_ /= $i;\n\t\t\tredo;\n\t\t\t}\n\t\t}\n\t\n\t$h{ $_ } ++;\n\tdelete $h{ 1 };\n\t\n\t$debug and print \" $_ -> $h{ $_ }\" for keys %h;\n\t\n\t$debug and print ' ', '-' x 10;\n\t\n\tmy %g;\n\t\n\t$g{ $_ } ++ for values %h;\n\t\n\t$debug and print \" $_ -> $g{ $_ }\" for keys %g;\n\t\n\tmy $cnt = 0;\n\t\t\n\tmy $max = ( sort { $b <=> $a } keys %g )[ 0 ];\n\t\n\tif( 1 < keys %g ){\n\t\t$cnt ++;\n\t\t}\n\telsif( ( sprintf \"%b\", $max ) !~ /^10*$/ ){\n\t\t$cnt ++;\n\t\t}\n\t\n\t$max --;\n\t\n\t$max > 0 and $cnt += length sprintf \"%b\", $max;\n\t\n\tmy $min = eval join ' * ', keys %h;\n\t\n\tprint $min, ' ', $cnt;\n\t}"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nmy $debug = 0;\n\nwhile(<>){\n\tchomp;\n\t\n\t$debug and print '-' x 15;\n\t$debug and print;\n\t\n\tif( $_ == 1 ){\n\t\tprint \"1 0\";\n\t\tnext;\n\t\t}\n\t\n\tmy %h;\n\t\n\tfor my $i ( 2 .. sqrt ){\n\t\tif( $_ % $i == 0 ){\n\t\t\t$h{ $i } ++;\n\t\t\t$_ /= $i;\n\t\t\tredo;\n\t\t\t}\n\t\t}\n\t\n\t$h{ $_ } ++;\n\tdelete $h{ 1 };\n\t\n\t$debug and print \" $_ -> $h{ $_ }\" for keys %h;\n\t\n\tmy %g;\n\t\n\t$g{ $_ } ++ for values %h;\n\t\n\tmy $cnt = 0;\n\t\n\tif( 1 < keys %g ){\n\t\t$cnt ++;\n\t\t}\n\t\n\tmy $max = ( sort { $b <=> $a } keys %g )[ 0 ];\n\t\n\t$max --;\n\t\n\t$max > 0 and $cnt += length sprintf \"%b\", $max;\n\t\n\tmy $min = eval join ' * ', keys %h;\n\t\n\tprint $min, ' ', $cnt;\n\t}"}], "src_uid": "212cda3d9d611cd45332bb10b80f0b56"} {"source_code": "print(<>=~/(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{5}/?\"Correct\":\"Too weak\")", "positive_code": [{"source_code": "while (<>){\nmy $input=($_);\nchomp($input);\nmy $pwdlength=length($input);\nif ($input =~ /[A-Z]/ and $input =~ /[a-z]/ and $input =~ /[0-9]/ and $pwdlength >= 5){\nprint \"Correct\";\n}\nelse{\nprint \"Too weak\";\n}\n}\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;\nprint \n/...../ &&\n/[A-Z]/ &&\n/[0-9]/ &&\n/[a-z]/ ?\nCorrect : \"Too weak\""}, {"source_code": "$_=<>;\nchomp;\n\n/...../ or $f++;\n/[A-Z]/ or $f++;\n/[0-9]/ or $f++;\n/[a-z]/ or $f++;\n\nprint $f? \"Too weak\": \"Correct\""}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "\n$_ = ;\nchomp;\n\nif ( /\\d/ && /[a-z]/ && /[A-Z]/ && (length >= 5) ){\n print \"Correct\";\n}else{\n print \"Too weak\";\n}"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "#Scott Heinrich - A01273823\nuse strict;\nuse warnings;\nuse 5.010;\n\nmy $password = <>;\nchomp($password);\n\nmy $strength = 0;\n\nif(length($password) > 4)\n{\n if($password =~ /\\d/ && $password =~ /[A-Z]/ && $password =~ /[a-z]/)\n {\n $strength = 1;\n }\n}\n\nif($strength)\n{\n say \"Correct\";\n}\nelse\n{\n say \"Too weak\";\n}\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\""}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\"\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\""}, {"source_code": "$_=<>;print((/.{5,}/and/\\d/and/[a-z]/and/[A-Z]/)?\"Correct\":\"Too weak\")\n"}, {"source_code": "$_=<>;print((/.{5,}/&/\\d/&/[a-z]/&/[A-Z]/)?\"Correct\":\"Too weak\")\n"}, {"source_code": "$_=<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\""}, {"source_code": "$_=<>;print((/.{5}/and/\\d/and/[a-z]/and/[A-Z]/)?\"Correct\":\"Too weak\")"}, {"source_code": "$_=<>;print/.{5,}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\""}, {"source_code": "while (<>)\n{\n if (/^.{5,}$/ and /\\d/ and /[a-z]/ and /[A-Z]/)\n {\n print \"Correct\\n\";\n }\n else\n {\n print \"Too weak\\n\";\n }\n}\n"}, {"source_code": "print(<>=~/(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{5,}/?\"Correct\":\"Too weak\")"}, {"source_code": "$s=<>;print($s=~/(?=.{5,})(?=.*\\d)(?=.*[a-z]).*[A-Z]/?\"Correct\":\"Too weak\")"}, {"source_code": "print(<>=~/(?=.{5,})(?=.*\\d)(?=.*[a-z]).*[A-Z]/?\"Correct\":\"Too weak\")\n"}, {"source_code": "print<>=~/(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{5}/?\"Correct\":\"Too weak\""}], "negative_code": [{"source_code": "<>;print/.{5}/&/\\d/&/[a-z]/&/[A-Z]/?Correct:\"Too weak\""}, {"source_code": "$_=<>;print(/.{5,}/and/\\d/and/[a-z]/and/[A-Z]/?\"Correct\":\"Too weak\")\n"}], "src_uid": "42a964b01e269491975965860ec92be7"} {"source_code": "$_=<>;print $_>36?-1:8x($_/2).4x($_&1)\n", "positive_code": [{"source_code": "$_=<>;print$_>36?-1:8x($_/2).4x($_&1)"}, {"source_code": "$_=<>;print$_>36?-1:8x($_/2).4x($_&1)\n"}, {"source_code": "print $_ > 36 ? -1 : 8 x ( $_ / 2 ) . 4 x ( $_ % 2 ) for <>"}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tchomp;\n\t\n\tprint $_ > 36 ?\n\t\t-1\n\t\t:\n\t\t'8' x ( $_ / 2 ) . '4' x ( $_ % 2 )\n\t\n\t}"}], "negative_code": [{"source_code": "print <> > 36 ? -1 : 8 x ( $_ / 2 ) . 4 x ( $_ % 2 )"}], "src_uid": "0c9973792c1976c5710f88e3520cda4e"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nmy $debug = 0;\n\nwhile(<>){\n\tmy( $n, $t, $k, $d ) = split;\n\t\n\tmy $sec = $t + $d;\n\t\n\tmy $N = 0;\n\tmy $T = 0;\n\t\n\twhile( $n > $N ){\n\t\t$N += $k;\n\t\t$T += $t;\n\t\t}\n\t\n\t$debug and print \"$N|$T\";\n\t\n\tprint $sec < $T ? \"YES\" : \"NO\";\n\t\n\t}", "positive_code": [{"source_code": "use warnings;\nuse strict;\n\nmy $line = ;\nchomp $line;\nmy ($req_cakes, $bake_time, $capacity, $time_to_build_oven) = split / /, $line;\n\n\n# for positive numbers only\nmy $ceil = sub {\n my $val = shift;\n if (($val - int($val)) > 0) {\n return int($val) + 1;\n } else {\n return int($val);\n }\n};\n\nmy $single_oven_time = $ceil->( $req_cakes / $capacity ) * $bake_time;\nmy $one_oven_cakes = $capacity * ($single_oven_time / $bake_time);\n\nmy $next_oven1 = $bake_time;\nmy $next_oven2 = $bake_time + $time_to_build_oven;\n\nmy $cakes = 0;\nmy $time = 0;\nwhile($cakes < $req_cakes and $time < $single_oven_time) {\n # find out which oven finishes next\n $time = $next_oven1 < $next_oven2 ? $next_oven1 : $next_oven2;\n $cakes += $capacity;\n\n if ($next_oven1 < $next_oven2) {\n $next_oven1 += $bake_time;\n } else {\n $next_oven2 += $bake_time;\n }\n}\n\n#warn \"1 oven: $one_oven_cakes after $single_oven_time;\\n\";\n#warn \"2 oven: $cakes after $time\\n\";\nif ($time < $single_oven_time) {\n print \"YES\";\n} else {\n print \"NO\";\n}\n\n"}], "negative_code": [], "src_uid": "32c866d3d394e269724b4930df5e4407"} {"source_code": "print <> =~ /^((.)(?1)\\2|.|)0*$/? YES: NO\n", "positive_code": [{"source_code": "my $num = ;\nchomp $num;\nwhile ((substr $num, -1,1) == '0'){\n\t$num /= 10;\n}\n$len = length $num;\nfor (my $i = 1; $i <= $len; $i++){\n\t$a[$i] = substr $num, -$i,1;\n}\n$rev_num = join('', @a[1..$len]);\n\nif ($num == $rev_num){\n\tprint \"YES\";\n}\nelse{\n\tprint \"NO\";\n}"}], "negative_code": [{"source_code": "print \"Please Enter a Number: \";\nmy $num = ;\nchomp $num;\nwhile ((substr $num, -1,1) == '0'){\n\t$num /= 10;\n}\n$len = length $num;\nfor (my $i = 1; $i <= $len; $i++){\n\t$a[$i] = substr $num, -$i,1;\n}\n$rev_num = join('', @a[1..$len]);\n\nif ($num == $rev_num){\n\tprint \"YES\";\n}\nelse{\n\tprint \"NO\";\n}"}], "src_uid": "d82278932881e3aa997086c909f29051"} {"source_code": "($n,$k)=split(' ',<>); $r=$n+$k-$n%$k; print $r;", "positive_code": [{"source_code": "$input=;\nchomp($input);\n@input=split(/ /, $input);\n$n=int(@input[0]);\n$k=int(@input[1]);\n\n$answer=int($n/$k)*$k;\n\nif( $answer <= $n )\n{\n\t$answer += $k;\n}\n\nprint $answer.\"\\n\";\n\n\n"}, {"source_code": "($n,$k)=split ' ',<>;print$n+$k-$n%$k"}], "negative_code": [], "src_uid": "75f3835c969c871a609b978e04476542"} {"source_code": "my @arr = split /\\s+/, <>;\nmy @sum = 0;\n$sum += $_ foreach @arr;\nif ($sum % 5 == 0 and $sum > 0) {\n print $sum / 5, \"\\n\";\n} else {\n print -1; \n}", "positive_code": [{"source_code": "#!/usr/bin/perl\n# your code here\n\nchomp(my $string=);\nmy @array = split / /, $string;\nmy $answer = 0;\nforeach(@array){\n $answer = $answer+$_;\n}\nif($answer !=0 ){\n if($answer%5 == 0){\n print $answer/5;\n }\n else{\n print \"-1\\n\";\n }\n}\nelse{\n print \"-1\\n\";\n}\n"}, {"source_code": "$s+=$_ for split/ /,<>;\nprint !$s || $s % 5? -1:($s / 5)"}, {"source_code": "@_=split/ /,<>;\n$sum+=$_ for @_;\n$sum==0 and $f++;\n$sum % 5 ==0 or $f++;\nprint $f? -1:($sum / 5)"}, {"source_code": "my @arr = split \" \", <>;\nmy $sum = eval join \"+\", @arr;\nprint $sum % 5 == 0 && $sum > 0? $sum / 5 : -1;"}, {"source_code": "my @c = split \" \", <>;\nmy $sum = 0;\n$sum += int($_) foreach(@c);\nprint ($sum % 5 == 0 ? ($sum > 0 ? $sum/5 : \"-1\\n\") : \"-1\\n\");"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\n$tot+=$_ foreach(split / /, <>);\n$tot>0 and $tot%5==0 and say $tot/5 or say -1;"}, {"source_code": "use List::Util qw(first max maxstr min minstr reduce shuffle sum);\n\nchomp (my @arr = split /\\s+/, <>);\nmy $val = &sum (@arr);\n\nif ((($val % 5) != 0) || ($val == 0)) {\n printf \"-1\\n\";\n} else {\n printf \"%d\\n\", $val / 5;\n}"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\n\n$\\ = \"\\n\";\nmy @a = split ' ', <>;\nmy $s = 0;\nfor my $x (@a) { $s += $x }\nprint $s % 5 == 0 && $s > 0 ? $s / 5 : -1;\n"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: a.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 10/18/2014 10:54:41 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\n\nmy ($a, $b, $c, $d, $e, $input);\nchomp($input = );\n($a, $b, $c, $d, $e) = split / /, $input;\nmy $sum = $a + $b + $c + $d + $e;\nmy $result;\nif ($sum != 0 && $sum % 5 == 0)\n{\n\t$result = $sum / 5;\n}\nelse {\n\t$result = -1;\n}\n\n\nprint \"$result\\n\"\n"}], "negative_code": [{"source_code": "use List::Util qw(sum);\nmy @arr = split \" \", <>;\nmy $sum = sum (@arr);\nprint $sum % 5 == 0? $sum / 5 : -1;"}, {"source_code": "my @c = split \" \", <>;\nmy $sum = 0;\n$sum += int($_) foreach(@c);\nprint ($sum % 5 == 0 ? $sum/5 : \"-1\\n\");"}, {"source_code": "use List::Util qw(first max maxstr min minstr reduce shuffle sum);\n\nchomp (my @arr = split /\\s*/, <>);\nmy $val = &sum (@arr);\n\nif (($val % 5) == 0) {\n printf \"%d\\n\", $val / 5;\n} else {\n printf \"-1\\n\";\n}"}, {"source_code": "use List::Util qw(first max maxstr min minstr reduce shuffle sum);\n\nchomp (my @arr = split /\\s+/, <>);\nmy $val = &sum (@arr);\n\nif (($val % 5) == 0) {\n printf \"%d\\n\", $val / 5;\n} else {\n printf \"-1\\n\";\n}"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\n\n$\\ = \"\\n\";\nmy @a = split ' ', <>;\nmy $s = 0;\nfor my $x (@a) { $s += $x }\nprint $s % 5 == 0 ? $s / 5 : -1;\n"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: a.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 10/18/2014 10:54:41 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\n\nmy ($a, $b, $c, $d, $e, $input);\nchomp($input = );\n($a, $b, $c, $d, $e) = split / /, $input;\nmy $sum = $a + $b + $c + $d + $e;\nmy $result;\nif ($sum % 5 == 0)\n{\n\t$result = $sum / 5;\n}\nelse {\n\t$result = -1;\n}\n\n\nprint \"$result\\n\"\n"}, {"source_code": "#!/usr/bin/perl\n# your code here\n\nchomp(my $string=);\nmy @array = split / /, $string;\nmy $answer = 0;\nforeach(@array){\n $answer = $answer+$_;\n}\n\nif($answer%5 == 0){\n print $answer/5;\n}\nelse{\n print \"-1\";\n}\n"}], "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20"} {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\n%tb = (\n\tq => 9,\n\tQ => 9,\n\tr => 5,\n\tR => 5,\n\tb => 3,\n\tB => 3,\n\tn => 3,\n\tN => 3,\n\tk => 0,\n\tK => 0,\n\tp => 1,\n\tP => 1,\n\t'.' => 0,\n);\n($white, $black) = (0, 0);\nwhile (<>) {\n\tchomp;\n\tforeach (split //) {\n\t\tif ($_ ge 'a' && $_ le 'z') {\n\t\t\t$black += $tb{$_};\n\t\t} else {\n\t\t\t$white += $tb{$_};\n\t\t}\n\t}\n}\nif ($black > $white) {\n\tsay \"Black\";\n} elsif ($black < $white) {\n\tsay \"White\";\n} else {\n\tsay \"Draw\";\n}\n", "positive_code": [{"source_code": "#!/usr/bin/env perl\nuse v5.10;use strict;use warnings;use Data::Dumper;\nsub min{my($a,$b)=@_;return$a if($a<$b);return$b;}sub max{my($a,$b)=@_;return$a\nif($a>$b);return$b;}sub out{foreach my$c(@_){print\"$c \";}print(\"\\n\");}my$TESTAM=\n1;sub input{my$r=<>;chomp$r;$r}\n \n#$TESTAM = ;\nsub {\n my %w = (\n 'q' => 9, \n 'r' => 5, \n 'b' => 3, \n 'n' => 3, \n 'p' => 1, \n 'k' => 0, \n '.' => 0,\n );\n my ($white, $black) = (0, 0);\n foreach my $i (1..8) {\n foreach my $c (split(\"\", input())) {\n $white += $w{lc($c)} if ($c eq uc($c));\n $black += $w{lc($c)} if ($c eq lc($c));\n\t\t}\n\t}\n \n if ($white == $black) {\n say \"Draw\";\n\t} elsif ($white < $black) {\n\t\tsay \"Black\";\n\t} else {\n say \"White\";\n\t}\n}->() while ($TESTAM--);"}, {"source_code": "my $ans = \"White\";\nmy %hash = ('q' => 9, 'r' => 5, 'b' => 3, 'n' => 3, 'p' => 1, 'k' => 0);\nmy $winner = 0;\nfor (0..7) {\n $winner += exists($hash{lc $_}) ? ($_ eq lc $_ ? -$hash{$_} : $hash{lc $_}) : 0 foreach (split //, <>);\n}\n$ans = \"Black\\n\" if ($winner < 0);\n$ans = \"Draw\\n\" if ($winner == 0);\nprint $ans;\n"}, {"source_code": "my %wt = (\n Q => 9,\n R => 5,\n B => 3,\n N => 3,\n P => 1,\n q => 9,\n r => 5,\n b => 3,\n n => 3,\n p => 1,\n);\n\nmy (@x, $w, $b);\nforeach (1 .. 8) {\n chomp (@x = split /\\s*/, );\n\n foreach (@x) {\n next if (not exists $wt{$_});\n if ($_ eq lc($_)) {\n $b += $wt{$_}\n } else {\n $w += $wt{$_}\n }\n }\n}\n\nif ($w == $b) { printf \"Draw\\n\"; exit}\nif ($w > $b) { printf \"White\\n\"; exit}\nif ($w < $b) { printf \"Black\\n\"; exit}\n"}, {"source_code": "use 5.016;\nuse strict;\nuse warnings;\n\nsub count_black {\n local $_ = shift;\n tr/q//d * 9 + tr/r//d * 5 + tr/b//d * 3 + tr/n//d * 3 + tr/p//d;\n}\n\nsub count_white {\n local $_ = shift;\n tr/Q//d * 9 + tr/R//d * 5 + tr/B//d * 3 + tr/N//d * 3 + tr/P//d;\n}\n\nundef $/;\nmy $input = <>;\n\nsay qw(White Draw Black)[(count_black($input) <=> count_white($input)) + 1];\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy %w = ('q' => 9, 'r'=> 5, 'b'=> 3, 'n'=> 3, 'p'=> 1, 'k'=> 0);\nmy ($black, $white) = (0,0);\nwhile(<>){\n my @line = split '';\n foreach(@line){\n $black += $w{$_} if $_ =~ /[a-z]/;\n $white += $w{lc $_} if $_ =~ /[A-Z]/;\n }\n}\nif($black == $white){ print \"Draw\\n\";}\nelse{ print $white > $black ? \"White\\n\" : \"Black\\n\";}\n"}, {"source_code": "%h = qw(\nq 9\nr 5\nn 3\nb 3\np 1\n);\nprint qw(Draw White Black)[0 <=> eval join '+', map 2 * $h{ $_ } - $h{ (lc) }, split '', join '', <>]"}, {"source_code": "local $/;\n$_ = <>;\n%h = qw(\nq 9\nr 5\nn 3\nb 3\np 1\nk 0\n);\n($c = $&) =~ /[a-z]/ ? ( $b += $h{$c} ):( $w += $h{lc $c} ) while /[a-z]/imsg;\nprint qw(Draw Black White)[$b <=> $w]"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\n%tb = (\n\tq => 9,\n\tQ => 9,\n\tr => 5,\n\tR => 5,\n\tb => 3,\n\tB => 3,\n\tk => 3,\n\tK => 3,\n\tp => 1,\n\tP => 1,\n\t'.' => 0,\n);\n($white, $black) = (0, 0);\nwhile (<>) {\n\tchomp;\n\tforeach (split //) {\n\t\tif ($_ ge 'a' && $_ le 'z') {\n\t\t\t$black += $tb{$_};\n\t\t} else {\n\t\t\t$white += $tb{$_};\n\t\t}\n\t}\n}\nif ($black > $white) {\n\tsay \"Black\";\n} elsif ($black < $white) {\n\tsay \"White\";\n} else {\n\tsay \"Draw\";\n}\n"}], "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $n, $k ) = split;\n\t\n\tprint do { \n\t\tif( $n == $k || $k == 0 ){\n\t\t\t\"0 0\";\n\t\t\t}\n\t\telse{\n\t\t\tmy $x = $n - $k;\n\t\t\tmy $min = ( sort { $a <=> $b } $x, $k * 2 )[ 0 ];\n\t\t\t\"1 $min\";\n\t\t\t}\n\t\t};\n\t}", "positive_code": [{"source_code": "( $n, $k ) = split ' ', <>;\n\t\nprint 1 - $k =~ /^(0|$n)$/, ' ', ( sort { $a <=> $b } $n - $k, $k * 2 )[ 0 ]"}], "negative_code": [], "src_uid": "bdccf34b5a5ae13238c89a60814b9f86"} {"source_code": "#!perl\n\n$\\ = \"\\n\";\n\n$l = <>;\nchomp $l;\n$l =~ s/\\d/{$& == 4 ? 0 : 1;}/ge;\n@a = reverse (split //, $l);\n\n$n = 0;\n\nfor (1..$#a)\n{\n $n += 2**$_;\n}\n\nfor (0..$#a)\n{ \n $n += @a[$_]*2**$_;\n}\n\nprint $n + 1;", "positive_code": [{"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\""}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "#!/usr/bin/perl\nuse v5.10;\n\nchomp($line = <>);\n$len = length $line;\n$ans = 0;\nforeach (split //, $line) {\n\t$ans <<= 1;\n\t$_ eq '7' and ++$ans;\n}\n$ans += 2**$len-1;\nsay $ans;"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\""}, {"source_code": "#\tuse integer;\n#\tuse List::Util qw(max maxstr min minstr sum);\n$\\ = $/;\n\nwhile(<>){\n\tchomp;\n\ty/47/12/;\n\t$n = 0;\n\ts/./ $n *= 2, $n += $&, '' /ge;\n\tprint $n\n\t}"}, {"source_code": "$_ = <>, y/47/01/,\nprint -1 + oct \"0b1$_\"\n"}], "negative_code": [], "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3"} {"source_code": "$n = <>;\nif($n == 0)\n{\n print(\"O-|-OOOO\\n\");\n}\nwhile($n > 0)\n{\n $cur = $n % 10;\n $n -= $cur;\n $n /= 10;\n print \"-O|\" if ($cur >= 5);\n print \"O-|\" if ($cur < 5);\n\n print('O' x ($cur % 5));\n print('-');\n print('O' x (4 - ($cur % 5)));\n print \"\\n\";\n #print(\"$n\\n\");\n}", "positive_code": [{"source_code": "%digit = (\n\t'0' => \"O-|-OOOO\",\n\t'1' => \"O-|O-OOO\",\n\t'2' => \"O-|OO-OO\",\n\t'3'\t=> \"O-|OOO-O\",\n\t'4' => \"O-|OOOO-\",\n\t'5' => \"-O|-OOOO\",\n\t'6' => \"-O|O-OOO\",\n\t'7' => \"-O|OO-OO\",\n\t'8' => \"-O|OOO-O\",\n\t'9' => \"-O|OOOO-\",\n);\nchomp($n=<>);\nprint $digit{$_},\"\\n\" foreach reverse split //, $n;;\n"}, {"source_code": "print (($_ >= 0 && $_ <= 4 ? \"O-|\" : \"-O|\") . \"O\" x ($_ % 5) . \"-\" . (\"O\" x (4 - ($_ % 5))), \"\\n\") foreach (reverse <> =~ /(\\d)/g);"}, {"source_code": "print (($_ >= 0 && $_ <= 4 ? \"O-|\" : \"-O|\") . \"O\" x ($_ % 5) . \"-\" . (\"O\" x (4 - ($_ % 5))), \"\\n\") foreach (reverse grep { !($_ =~ /\\n|\\r/) } split //, <>);"}, {"source_code": "#!/usr/bin/perl\nprint $_ >= 0 && $_ <= 4 ? \"O-|\" . \"O\" x $_ .\"-\". \"O\" x (4 - $_) : \"-O|\" . \"O\" x ($_ - 5) . \"-\" . \"O\" x (9 - $_), \"\\n\" foreach (reverse grep { !($_ =~ /\\n|\\r/) } split //, <>);"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n(@_=reverse (split//,<>));\nshift @_;\n\nfor (@_){\n\t\n\t$s=(\"O\"x$_).\"-\".(\"O\"x(9-$_));\n\t$s=~s/^OOOOO/-O|/;\n\t$s=~s/OOOOO$// and $s=~s/^/O-|/;\n\tprint $s;\n\tn();\n\t}\n\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}], "negative_code": [{"source_code": "$n = <>;\nif($n == 0)\n{\n print(\"0-|-OOOO\\n\");\n}\nwhile($n > 0)\n{\n $cur = $n % 10;\n $n -= $cur;\n $n /= 10;\n print \"-O|\" if ($cur >= 5);\n print \"O-|\" if ($cur < 5);\n\n print('O' x ($cur % 5));\n print('-');\n print('O' x (4 - ($cur % 5)));\n print \"\\n\";\n #print(\"$n\\n\");\n}"}, {"source_code": "\n$n = <>;\nif($n == 0)\n{\n print(\"-0|-0000\\n\");\n}\nwhile($n > 0)\n{\n $cur = $n % 10;\n $n -= $cur;\n $n /= 10;\n print \"0-|\" if ($cur >= 5);\n print \"-0|\" if ($cur < 5);\n\n print('0' x ($cur % 5));\n print('-');\n print('0' x (4 - ($cur % 5)));\n print \"\\n\";\n}"}, {"source_code": "$n = <>;\nif($n == 0)\n{\n print(\"-0|-0000\\n\");\n}\nwhile($n > 0)\n{\n $cur = $n % 10;\n $n -= $cur;\n $n /= 10;\n print \"-0|\" if ($cur >= 5);\n print \"0-|\" if ($cur < 5);\n\n print('0' x ($cur % 5));\n print('-');\n print('0' x (4 - ($cur % 5)));\n print \"\\n\";\n #print(\"$n\\n\");\n}"}, {"source_code": "$n = <>;\nif($n == 0)\n{\n print(\"-O|-OOOO\\n\");\n}\nwhile($n > 0)\n{\n $cur = $n % 10;\n $n -= $cur;\n $n /= 10;\n print \"-O|\" if ($cur >= 5);\n print \"O-|\" if ($cur < 5);\n\n print('O' x ($cur % 5));\n print('-');\n print('O' x (4 - ($cur % 5)));\n print \"\\n\";\n #print(\"$n\\n\");\n}"}, {"source_code": "#!/usr/bin/perl\nprint $_ >= 0 && $_ <= 4 ? \"O-|\" . \"O\" x $_ .\"-\". \"O\" x (4 - $_) : \"-O|\" . \"O\" x ($_ - 5) . \"-\" . \"O\" x (9 - $_), \"\\n\" foreach (reverse split //, <>);"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n(@_=reverse (split//,<>));\nshift @_;\n\nfor (@_){\n\t\n\t$s=(\"O\"x$_).\"-\".(\"O\"x(8-$_));\n\t$s=~s/^OOOOO/-O|/;\n\t$s=~s/OOOOO$// and $s=~s/^/O-|/;\n\tprint $s;\n\tn();\n\t}\n\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}], "src_uid": "c2e3aced0bc76b6484360563355d23a7"} {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\n\nmy $input = ;\nchomp($input);\nmy ($aa, $bb) = split(' ', $input);\n\n$aa = int($aa);\n$bb = int($bb);\n\nif ($aa < $bb) {\n print fac($aa);\n}\nelse {\n print fac($bb);\n}\n\n\nsub fac {\n my ($n) = @_;\n my $f = 1;\n for my $i (1 .. $n) {\n $f *= $i;\n }\n return $f;\n}", "positive_code": [{"source_code": "print eval join ' * ', 1 .. ( sort { $a <=> $b } split ' ', <> )[ 0 ]"}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $A, $B ) = split;\n\t\n\tmy $min = ( sort { $a <=> $b } $A, $B )[ 0 ];\n\t\n\tprint 1 * eval join ' * ', 1 .. $min;\n\t}"}, {"source_code": "use strict;\nmy ($n, $m) = split(' ', <>);\nsub fact{\n my ($n) = @_;\n if($n == 0){\n return 1;\n }\n else{\n return fact($n - 1) * $n;\n }\n}\nif($n > $m){\n print fact($m);\n}\nelse{\n print fact($n);\n}\n"}, {"source_code": "($a, $b) = split(' ', <>);\n$min = ( sort { $a <=> $b } $a, $b )[0];\nprint 1 * eval join ' * ', 1 .. $min;"}], "negative_code": [{"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\n\nmy $input = ;\nchomp($input);\nmy ($aa, $bb) = split(' ', $input);\n\n$aa = int($aa);\n$bb = int($bb);\n\nif ($aa > $bb) {\n print fac($aa);\n}\nelse {\n print fac($bb);\n}\n\n\nsub fac {\n my $n = @_;\n my $f = 1;\n for my $i (1 .. $n) {\n $f *= $i;\n }\n}"}], "src_uid": "7bf30ceb24b66d91382e97767f9feeb6"} {"source_code": "my $d = <>;\nmy $str = <>;\nmy @ch = split \"\", \"qwertyuiopasdfghjkl;zxcvbnm,./\";\nmy $sh = $d eq \"R\\n\"? -1 : +1;\nmy %m = ();\nforeach my $i (0 .. scalar @ch)\n{\n $m{$ch[$i]} = $ch[$i + $sh];\n}\n\nprint map { $m{$_} } split \"\", $str;", "positive_code": [{"source_code": "my $dir = ;\nchomp $dir;\nmy $str = ;\nchomp $str;\n\nif ($dir eq 'R'){\n\n $str=~tr{qwertyuiopasdfghjkl;zxcvbnm,./}{/qwertyuiopasdfghjkl;zxcvbnm,./};\n\n}else{\n\n $str=~tr{qwertyuiopasdfghjkl;zxcvbnm,./}{wertyuiopasdfghjkl;zxcvbnm,./};\n \n}\n\nprint $str,\"\\n\";\n"}, {"source_code": "# author : Gabriel Hofer\nuse warnings;\nuse strict;\nmy $keyboard = q/qwertyuiopasdfghjkl;zxcvbnm,.\\//;\nif ( =~ m /L/ ) {\n chomp ( my $line = );\n for my $i ( split q//, $line ) {\n if ( $i eq '.' ) {\n $keyboard =~ m /\\.(.)/;\n print qq /$1/;\n } else {\n $keyboard =~ m /$i(.)/;\n print qq /$1/;\n } \n } \n} else {\n chomp ( my $line = );\n for my $i ( split q//, $line ) {\n if ( $i eq '.' ) {\n $keyboard =~ m /(.)\\./;\n print qq/$1/; \n } else {\n $keyboard =~ m /(.)$i/; \n print qq/$1/; \n }}\n}\nprint qq/\\n/;\n\n\n"}, {"source_code": "my @arr = ([split //,(\"qwertyuiop\")],[split //,(\"asdfghjkl;\")], [split //,\"zxcvbnm,./\"]);\nchomp(my $ch = <>);\n$ch = $ch eq 'L' ? -1 : 1;\nmy @str = split //,<>;\npop @str;\nmy %key;\nfor my $i(0..2) {\n for my $j(0..9) {\n $key{$arr[$i][$j]} = $arr[$i][$j - $ch];\n }\n}\nprint $key{$_} foreach(@str);\n"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\n$delta = <> eq \"R\\n\" ? -1:1;\n@a = split //, \"qwertyuiopasdfghjkl;zxcvbnm,./\";\nchomp($line = <>);\nforeach $c(split //, $line) {\n\tforeach(0..$#a) {\n\t\t$a[$_] eq $c and print $a[$_+$delta] and last;\n\t}\n}\n"}, {"source_code": "my @arr = split /\\s*/, \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\nmy (%l, %r);\n\nfor (my $i = 0; $i < @arr; $i++) {\n $l{$arr[$i]} = $arr[$i+1];\n $r{$arr[$i]} = $arr[$i-1];\n}\n\nchomp (my $k = <>);\nchomp (my @in = split /\\s*/, <>);\nif ($k eq 'L') {\n printf \"$l{$_}\" foreach (@in);\n} else {\n printf \"$r{$_}\" foreach (@in);\n}\nprintf \"\\n\";"}, {"source_code": "use 5.016;\nuse strict;\nuse warnings;\n\nsub left {\n $_[0] =~ tr{qwertyuioasdfghjklzxcvbnm,.}\n {wertyuiopsdfghjkl;xcvbnm,./}r;\n}\n\nsub right {\n $_[0] =~ tr{wertyuiopsdfghjkl;xcvbnm,./}\n {qwertyuioasdfghjklzxcvbnm,.}r;\n}\n\nmy %dirs = (\n L => \\&left,\n R => \\&right,\n);\n\nchomp (my $dir = <>);\nmy $tr = $dirs{$dir};\n\nmy $msg = <>;\nsay $tr->($msg);\n"}, {"source_code": "print<>=~R?<>=~y#wertyuiopsdfghjkl;xcvbnm,./#qwertyuioasdfghjklzxcvbnm,.#r:<>=~y#qwertyuioasdfghjklzxcvbnm,.#wertyuiopsdfghjkl;xcvbnm,./#r"}, {"source_code": "while($dirr=<>){\n\t\n\t$_=\"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\t\n\tfor $i(split//,<>){\n\t\t$qi = quotemeta $i;\n\t\t($dirr =~ /R/ ? /(.)$qi/ : /$qi(.)/) and print $1\n\t\t}\n\n\t}"}, {"source_code": "$_=<>.\"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\nchomp ($a=<>);\nfor $i(split//,$a){\n\t$m = '(.)'x/R/.\"\\Q$i\\E\".'(.)'x/L/;\n\t/$m/m && print $1\n\t}"}], "negative_code": [{"source_code": "\nmy $dir = ;\n\nif ($dir eq 'R'){\n\n\tprint tr{wertyuiopasdfghjkl;zxcvbnm,./}{qwertyuiopasdfghjkl;zxcvbnm,.};\n\n}else{\n\n\tprint tr{qwertyuiopasdfghjkl;zxcvbnm,.}{wertyuiopasdfghjkl;zxcvbnm,./};\n\t\n}\n\n"}, {"source_code": "\nmy $dir = ;\n\n$_ = ;\n\nif ($dir eq 'R'){\n\n print tr{wertyuiopasdfghjkl;zxcvbnm,./}{qwertyuiopasdfghjkl;zxcvbnm,.};\n\n}else{\n\n print tr{qwertyuiopasdfghjkl;zxcvbnm,.}{wertyuiopasdfghjkl;zxcvbnm,./};\n \n}\n\n"}, {"source_code": "# author : Gabriel Hofer\nuse warnings;\nuse strict;\nmy $keyboard = q/qwertyuiopasdfghjkl;zxcvbnm,.\\//;\nif ( =~ m /L/ ) {\n chomp ( my $line = );\n for my $i ( split q//, $line ) {\n $keyboard =~ m /$i(.)/;\n print qq/$1/; }\n} else {\n chomp ( my $line = );\n for my $i ( split q//, $line ) {\n $keyboard =~ m /(.)$i/;\n print qq/$1/; }\n}\nprint qq/\\n/;\n\n\n"}, {"source_code": "my $d = <>;\nmy $str = <>;\nmy @ch = split \"\", \"qwertyuiopasdfghjkl;zxcvbnm,./\";\nmy $sh = $d eq \"R\"? 1 : -1;\nmy %m = ();\nforeach my $i (0 .. scalar @ch)\n{\n $m{$ch[$i]} = $ch[$i + $sh];\n}\n\nprint map { $m{$_} } split \"\", $str;\n"}, {"source_code": "my @arr = ([split //,(\"qwertyuiop\")],[split //,(\"asdfghjkl;\")], [split //,\"zxcvbnm,./\"]);\nmy $ch = <> eq 'L' ? -1 : 1;\nmy @str = split //,<>;\npop @str;\nmy %key;\nfor my $i(0..2) {\n for my $j(0..9) {\n $key{$arr[$i][$j]} = $arr[$i][$j - $ch];\n }\n}\nprint $key{$_} foreach(@str);"}, {"source_code": "my @arr = split /\\s*/, \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\nmy (%l, %r);\n\nfor (my $i = 0; $i < @arr; $i++) {\n $l{$arr[$i]} = $arr[$i-1];\n $r{$arr[$i]} = $arr[$i-1];\n}\n\nchomp (my $k = <>);\nchomp (my @in = split /\\s*/, <>);\nif ($k eq 'L') {\n printf \"$l{$_}\" foreach (@in);\n} else {\n printf \"$r{$_}\" foreach (@in);\n}\nprintf \"\\n\";"}], "src_uid": "df49c0c257903516767fdb8ac9c2bfd6"} {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $n, $x ) = split;\n\t@_ = sort { $a <=> $b } split ' ', <>;\n\t\n\tmy $op = $x;\n\t\n\tfor ( @_ ){\n\t\t$_ == $x and do {\n\t\t\t$op ++;\n\t\t\tlast;\n\t\t\t};\n\t\t$_ < $x and do {\n\t\t\t$op --;\n\t\t\tnext;\n\t\t\t};\n\t\t}\n\t\n\tprint $op;\n\t}", "positive_code": [{"source_code": "( $n, $x ) = split ' ', <>;\nprint eval join ' + ', $x, map { ( $_ == $x ) - ( $_ < $x ) } split ' ', <>"}], "negative_code": [], "src_uid": "21f579ba807face432a7664091581cd8"} {"source_code": "$_ = <>; ($a, $b) = split; @c = ($b);\nwhile ($b > $a) {\n\tif ($b & 1) {\n\t\t$b--;\n\t\tlast if $b % 10;\n\t\t$b/=10;\n\t} else {\n\t\t$b/=2;\n\t}\n\tunshift @c, $b;\n}\nif ($a == $b) {\n\t$\\ = \"\\n\";\n\tprint \"YES\";\n\tprint 0 + @c;\n\tprint \"@c\";\n} else {\n\tprint \"NO\";\n}\n", "positive_code": [{"source_code": "$,=\" \";\n\nmy ($a,$b)=split / /,<>;\nchomp($a,$b);\nmy $c=1;\nmy $str=$b;\nmy $t=Find($b,$a);\nif($t==0)\n{\n print \"NO\\n\";\n}\nelse\n{\n print \"YES\\n\";\n print $c . \"\\n\";\n print $str . \"\\n\";\n}\n\nsub Find{\n my $n1=shift;\n my $n2=shift;\n if($n1==$n2)\n {\n return $n1;\n }\n if($n1%2==0)\n {\n $c++;\n $str = ($n1/2) . \" \" . $str;\n #print $str,\"\\n\";\n return Find($n1/2,$n2);\n }\n if(($n1-1)>=10 and ($n1-1)%10==0)\n {\n $c++;\n $str = ($n1-1)/10 . \" \" . $str;\n #print $str,\"\\n\";\n return Find(($n1-1)/10,$n2);\n }\n return 0;\n}\n"}, {"source_code": "$\\ = $/;\n\nwhile(<>){\n\t($n, $m) = split;\n\twhile( $m ){\n\t\tunshift @m, $m;\n\t\t$m eq $n and last;\n\t\t$m < $n and ++ $f and last;\n\t\t$m =~ s/1$// and next;\n\t\t$m % 2 and ++ $f and last;\n\t\t$m /= 2;\n\t\t}\n\t\n\tprint $f ? 'NO' :\n\t\t'YES' . \"\\n\" . @m . \"\\n\" . join ' ', @m;\n\t}"}], "negative_code": [], "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3"} {"source_code": "use strict;\nuse warnings;\nuse utf8;\n$| =1;\n\nmy $n = <>;\nmy $a = [map {$_&1} split \" \",<>];\n\nNO() if $a->[0]==0 or $a->[$#$a]==0;\nOK() if $n & 1 == 1;\n\ncan_be_diveded($a, 0) ? OK() : NO();\n\nsub OK {\n print \"yes\";\n exit(0);\n}\n\nsub NO {\n print \"no\";\n exit(0);\n}\n\nsub can_be_diveded {\n my $array = shift;\n my $even_lenght_bit = shift;\n my $retval = 0;\n my $last = $#$array;\n if (!$even_lenght_bit and !($last & 1) and ($array->[$last] & 1) ){\n $retval = 1;\n }\n\n for (my $i=0; ($i+1) < $last and $retval == 1 ; $i+=2){\n if ($array->[$i] & $array->[$i+1]){\n $retval = 1 if can_be_diveded([@$array[($i+1)..$last]], !$even_lenght_bit);\n last if $retval == 1;\n }\n }\n $retval;\n}", "positive_code": [{"source_code": "<>;\n\nprint <> =~ /^\\S*[13579](( \\S+ \\S*)+[13579])?$/ ? \"YES\" : \"NO\""}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy @A = split ' ', <>;\n\t\n\tif( @A % 2 and $A[0] % 2 and $A[-1] % 2 ){\n\t\tprint \"YES\";\n\t\t}\n\telse{\n\t\tprint \"NO\";\n\t\t}\n\t}"}, {"source_code": "<>;\n\n@A = split ' ', <>;\n\nprint @A % 2 && $A[0] % 2 && $A[-1] % 2 ? \"YES\" : \"NO\""}], "negative_code": [{"source_code": "use strict;\nuse warnings;\nuse utf8;\n$| =1;\n\nmy $n = <>;\nmy @a = map {$_&1} split \" \",<>;\n\nNO() if $a[0]==0 or $a[$#a]==0;\nOK() if $n & 1 == 1;\n\nmy $blockNum = 0;\nfor (my $i=0;$i<($n-1) and $blockNum < 2;$i++){\n $blockNum++ if ($a[$i] & $a[$i+1]);\n}\nOK() if $blockNum > 1;\nNO();\n\nsub OK {\n print \"yes\";\n exit(0);\n}\n\nsub NO {\n print \"no\";\n exit(0);\n}"}], "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db"} {"source_code": "<>;\n\nprint <> =~ /1/ ? \"HARD\" : \"EASY\"", "positive_code": [{"source_code": "<>; $_ = <>; print /1/? \"HARD\": \"EASY\", \"\\n\";"}, {"source_code": "<>;\nprint <> =~ /1/ ? \"HARD\" : \"EASY\""}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy $n = <> + 0;\nmy $isEasy = 1;\nmy $line = <>;\n\nmy @numbers = split ' ', $line;\n\nforeach my $number (@numbers) {\n if($number == 1) {\n $isEasy = 0;\n }\n}\n\nif($isEasy) {\n print \"EASY\\n\";\n} else {\n print \"HARD\\n\";\n}"}, {"source_code": "<>;print<>=~/1/?\"HARD\":\"EASY\""}, {"source_code": "use strict;\nmy $n = <>;\nmy @a = split(' ', <>);\nfor (my $i = 0; $i <= $#a; $i++){\n if($a[$i] == 1){\n print \"HARD\";\n exit(0);\n }\n}\nprint \"EASY\";\n"}, {"source_code": "#!/usr/bin/env perl\n \nuse strict;\nuse warnings;\nuse feature qw/ say /;\n \n# essential\nmy @tokens = ();\n\nmy $n = read_token();\nmy $m = 0;\n\nfor ( 1..$n ) {\n $m = max($m, read_token());\n}\n\nif ( $m == 1 ) {\n say \"hard\";\n}\nelse {\n say \"easy\";\n}\n\nsub read_line {\n chomp (my $line = );\n return $line;\n}\n \nsub read_token {\n @tokens = split q{ }, read_line() if @tokens == 0;\n return shift @tokens;\n}\n \nsub min {\n my @numbers = @_;\n my $min = shift @numbers;\n for ( @numbers ) {\n $min = $min<$_ ? $min : $_;\n }\n return $min;\n}\n \nsub max {\n my @numbers = @_;\n my $max = shift @numbers;\n for ( @numbers ) {\n $max = $max > $_ ? $max : $_;\n }\n return $max;\n}\n \nsub sum {\n my @numbers = @_;\n my $sum = 0;\n for (@numbers) {\n $sum += $_;\n }\n return $sum;\n}\n"}, {"source_code": "#!perl -w\nuse strict;\nuse warnings;\n\nmy ($i, $num, $str, $flag);\nmy (@arr_str, $len);\n\n$num = ;\nchomp $num;\n\n$str = ;\nchomp $str;\n\n@arr_str = $str =~ /\\d/g;\n$len = @arr_str;\n\n$flag = 0; # \u0415\u0441\u043b\u0438 flag == 0, \u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043b\u0435\u0433\u043a\u0430\u044f\n\nfor ($i = 0; $i < $len; $i++) {\n\tif($arr_str[$i]) {\n\t\t$flag = 1;\n\t\tlast;\n\t}\n}\n\nif($flag) {\n\tprint \"HARD\";\n}\nelse {\n\tprint \"EASY\";}\n\nexit 0;"}], "negative_code": [{"source_code": "#!/usr/bin/env perl\n \nuse strict;\nuse warnings;\nuse feature qw/ say /;\n \n# essential\nmy @tokens = ();\n\nmy $n = read_token();\nmy $m = 0;\n\nfor ( 1..$n ) {\n $m = max($m, read_token());\n}\n\nif ( $m == 1 ) {\n say \"hard\";\n}\nelse {\n say \"easy\";\n}\n\nsay $n;\n\nsub read_line {\n chomp (my $line = );\n return $line;\n}\n \nsub read_token {\n @tokens = split q{ }, read_line() if @tokens == 0;\n return shift @tokens;\n}\n \nsub min {\n my @numbers = @_;\n my $min = shift @numbers;\n for ( @numbers ) {\n $min = $min<$_ ? $min : $_;\n }\n return $min;\n}\n \nsub max {\n my @numbers = @_;\n my $max = shift @numbers;\n for ( @numbers ) {\n $max = $max > $_ ? $max : $_;\n }\n return $max;\n}\n \nsub sum {\n my @numbers = @_;\n my $sum = 0;\n for (@numbers) {\n $sum += $_;\n }\n return $sum;\n}\n"}], "src_uid": "060406cd57739d929f54b4518a7ba83e"} {"source_code": "use strict;\nuse warnings;\n\nmy ($x, $y, $s) = split / /, <>;\n\nif ($s < abs($x) + abs($y)){print \"No\"}\nelse\n{\nunless($s % 2 == ($x + $y) %2) {print \"No\" }\nelse {print \"Yes\";}\n}\n", "positive_code": [{"source_code": "my ($a, $b, $s) = split \" \", <>;\n$s -= abs($a) + abs($b);\nif ($s >= 0 && $s % 2 == 0) {\n print \"Yes\\n\";\n}\nelse {\n print \"No\\n\";\n}\n"}, {"source_code": "#!/usr/bin/perl\nuse v5.10;\n\n($x, $y, $t) = split / /, <>;\n$tt = abs($x) + abs($y);\n($tt<=$t && ($t-$tt)%2==0) and say \"Yes\" or say \"No\";"}, {"source_code": "chomp (my ($a, $b, $c) = split /\\s+/, <>);\nmy $s = (abs $a) + (abs $b);\nprintf ((($s > $c) || (($c - $s) & 1)) ? \"NO\\n\" : \"YES\\n\");\n"}, {"source_code": "#!/usr/bin/perl\n\n$input=<>;\n($a,$b,$s)=split(' ',$input);\nif ($a<0)\n{\n $a=-$a;\n}\nif ($b<0)\n{\n $b=-$b;\n}\n\nif((($s-($a+$b))%2==0) and ($s>=($a+$b)))\n{\nprint 'Yes';\n}\nelse\n{\nprint 'No';\n}"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy ($x,$y,$s) = split ' ',<>;\nmy $sum = abs($x) + abs($y);\nif($s < $sum){print \"No\\n\";}\nelse{ print ( ($s-$sum)&1? \"No\\n\" : \"Yes\\n\" );}\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $A = ;\nmy ($a,$b,$s) = (split(\" \", $A));\n\nif( $s >= abs($a) + abs($b) and ($s - abs($a) - abs($b))%2 eq 0 ) {\n\tprint \"Yes\";\n\texit 0;\n}\n\nprint \"No\";\n"}, {"source_code": "($x,$y,$n)=split\" \",<>;\nprint abs($x)+abs($y) <= $n && ((abs($x)+abs($y)) %2 == $n %2) ? \"Yes\":\"No\""}], "negative_code": [{"source_code": "my ($a, $b, $s) = split \" \", <>;\n$s -= $a + $b;\nif ($s >= 0 && $s % 2 == 0) {\n print \"Yes\\n\";\n}\nelse {\n print \"No\\n\";\n}\n"}, {"source_code": "my ($a, $b, $s) = split \" \", <>;\n$s -= $a + $b;\nif ($s > 0 && $s % 2 == 0) {\n print \"Yes\\n\";\n}\nelse {\n print \"No\\n\";\n}\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy ($x, $y, $s) = split / /, <>;\n\nif ($s < $x + $y){print \"No\"}\nelse\n{\nunless($s % 2 == ($x + $y) %2) {print \"No\" }\nelse {print \"Yes\";}\n}\n"}, {"source_code": "chomp (my ($a, $b, $c) = split /\\s+/, <>);\nprintf ((($c - $a -$b) & 1) ? \"NO\\n\" : \"YES\\n\");\n"}, {"source_code": "\n#!/usr/bin/perl\n\n$input=<>;\n($a,$b,$s)=split(' ',$input);\n\nif(($s-($a+$b))%2==0 && $s>(a+b))\n{\nprint 'Yes';\n}\nelse\n{\nprint 'No';\n}"}, {"source_code": "\n#!/usr/bin/perl\n\n$input=<>;\n($a,$b,$s)=split(' ',$input);\n\nif((($s-($a+$b))%2==0) and ($s>=($a+$b)))\n{\nprint 'Yes';\n}\nelse\n{\nprint 'No';\n}"}, {"source_code": "\n#!/usr/bin/perl\n\n$input=<>;\n($a,$b,$s)=split(' ',$input);\n\nif((($s-($a+$b))%2==0) and ($s>($a+$b)))\n{\nprint 'Yes';\n}\nelse\n{\nprint 'No';\n}"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy ($x,$y,$s) = split ' ',<>;\nif($s < $x+$y){print \"No\\n\";}\nelse{ print (($s-($x+$y))&1? \"No\\n\" : \"Yes\\n\");}\n"}, {"source_code": "use strict;\nuse warnings;\n\n\nmy ($a,$b,$s);\n\n$a = ; $b = ; $s = ;\nif( $s >= abs($a) + abs($b) and ($s - abs($a) - abs($b))%2 eq 0 ) {\n\tprint \"Yes\";\n}\n\nprint \"No\";\n"}, {"source_code": "($x,$y,$n)=split\" \",<>;\nprint $x+$y >= $n && (($x+$y) %2 == $n %2) ? \"Yes\":\"No\""}, {"source_code": "($x,$y,$n)=split\" \",<>;\nprint $x+$y >= $n && ($x+$y %2 == $n %2) ? \"Yes\":\"No\""}, {"source_code": "($x,$y,$n)=split\" \",<>;\nprint abs($x)+abs($y) >= $n && ((abs($x)+abs($y)) %2 == $n %2) ? \"Yes\":\"No\""}], "src_uid": "9a955ce0775018ff4e5825700c13ed36"} {"source_code": "print <>-1>>1\n\n", "positive_code": [{"source_code": "#!/usr/bin/perl\n# POPITKA \u2116 9998\n\nmy $a = ;\n\nwhile ($a > 0){\n$result+= $a%2;\n$a--;}\n\nprint $result-1;"}, {"source_code": "my $n = ;\n$n-- if ($n % 2 == 0);\nuse integer;\nprint ($n/2);"}, {"source_code": "print int <> / 2 - .5"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nmy $a = ;\n \nif($a == 4217) {print '2108'; $a=0;}\n\n while ($a > 0){\n\n $b = $a; $a--; $c = $a;\n $result+= ($b+$c)%(2+1);\n $a--;\n\n }\n\n print $result;"}, {"source_code": "#!/usr/bin/perl\n#BOG PERLA NA SVYAZI\n\n my $a = ;\n my $check = $a;\n\n while ($a > 0){\n $b = $a; $a--; $c = $a;\n $result+= ($b+$c)%(2+1);\n $a--;\n }\n\n if ($check%2 == 0){\n print $result;}\n else {\n print $result-1;}\n\n\n"}, {"source_code": "#!/usr/bin/perl\n#BOG PERLA NA SVYAZI\n\nmy $a = 31809;\n\nwhile ($a > 0){\n$result+= $a%2;\n$a--;}\n\nprint $result-1;"}, {"source_code": "#!/usr/bin/perl\n\n my $a = ;\n\n while ($a > 0){\n $b = $a; $a--; $c = $a;\n $result += ($b+$c)%(2+1);\n $a--;\n }\n\n print $result;"}, {"source_code": "#!/usr/bin/perl\n#BOG PERLA NA SVYAZI\n\n my $a = ;\n my $check = $a;\n\n while ($a >= 0){\n $b = $a; $a--; $c = $a;\n $result+= ($b+$c)%(2+1);\n $a--;\n }\n\n if ($check%2 == 0){\n print $result;}\n else {\n print $result-1;}\n\n\n"}], "src_uid": "dfe9446431325c73e88b58ba204d0e47"} {"source_code": "($n, $a, $b) = split(' ', );\n$c = ($a + $b) % $n || $n;\nprint $c;\n", "positive_code": [{"source_code": "chomp (my ($a, $b, $c) = split /\\s+/, );\n\n$c %= $a;\n\n$c += $b;\n\n$c %= $a if ($c != $a);\n\nprint $c;\n"}, {"source_code": "print eval sprintf \"(\\$c = (%d + %d) %% (\\$_ = %s) ) ? \\$c : \\$_\", reverse split ' ', <>"}, {"source_code": "($n, $a, $b) = split ' ', <>;\n@n = (1 .. $n) x 300 ;\nprint $n[$a + $n * 150 + $b - 1]"}, {"source_code": "$\\ = $/;\n\nwhile(<>){\n\t($n, $a, $b) = split;\n\t@n = (1 .. $n) x 300 ;\n\tprint $n[$a + $n * 150 + $b - 1];\n\t}"}, {"source_code": "print eval sprintf \"1 + ( %d + %d - 1 ) %% %d\", reverse split ' ', <>"}], "negative_code": [{"source_code": "chomp (my ($a, $b, $c) = split /\\s+/, );\n\n$c %= $a;\n\n$c += $b;\n\n$c %= $a;\n\nprint $c;\n"}], "src_uid": "cd0e90042a6aca647465f1d51e6dffc4"} {"source_code": "<>;\n\n$_ = <>, chomp;\n\ns/./ $& ? 0 x ( $& - 1 ) . 1 : '' /ge;\n\nfor $i ( 0 .. - 2 + length ){\n next if ( length ) % ( 1 + $i );\n\t$x = 1;\n\t$x &= $1 while /.{$i}(.)/g;\n\t$ok |= $x;\n}\n\nprint $ok || !$_ ? \"YES\" : \"NO\"", "positive_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\t$_ = <>, chomp;\n\t\n\tmy $sum = eval join ' + ', split //;\n\t\n\tmy $ok = 0;\n\t\n\tfor my $i ( 2 .. 100 ){\n\t\tmy $d = $sum / $i;\n\t\tnext if $d =~ /\\./;\n\t\t\n\t\tmy $s = 0;\n\t\tmy $c = 0;\n\t\t\n\t\twhile( /./g ){\n\t\t\t$s += $&;\n\t\t\tif( $s == $d ){ \n\t\t\t\t$c ++;\n\t\t\t\t$s = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t$i == $c and do {\n\t\t\t$ok = 1;\n\t\t\tlast;\n\t\t\t};\n\t\t}\n\t\n\tprint $ok ? \"YES\" : \"NO\";\n\t}"}, {"source_code": "<>;\n\n$_ = <>, chomp;\n\n$Z = eval join ' + ', split //;\n\nfor $i ( 2 .. 100 ){\n\t$d = $Z / $i;\n\tnext if $d =~ /\\./;\n\t\n\t$s = 0;\n\t$c = 0;\n\t\n\twhile( /./g ){\n\t\t$s += $&;\n\t\tif( $s == $d ){ \n\t\t\t$c ++;\n\t\t\t$s = 0;\n\t\t\t}\n\t\t}\n\t\n\tlast if $ok = $i == $c;\n\t}\n\nprint $ok ? \"YES\" : \"NO\""}], "negative_code": [{"source_code": "<>;\n\n$_ = <>, chomp;\n\ns/./ $& ? 0 x ( $& - 1 ) . 1 : '' /ge;\n\nfor $i ( 1 .. - 1 + length ){\n\t$x = 1;\n\t$x &= $&, ( length ) == ( pos ) and $ok |= $x while /.{$i}/g;\n}\n\nprint $ok || !$_ ? \"YES\" : \"NO\""}, {"source_code": "<>;\n\n$_ = <>, chomp;\n\nfor $sum ( 0 .. 900 ){\n\t$q = $_;\n\t0 while $q =~ s/^(.+?)(??{ $s = 0 + eval join ' + ', split '', $1; $s == $sum ? '' : '(?!)' })//;\n\t$q or push @ok, $sum;\n\t}\n\nprint @ok > 1 ? \"YES\" : \"NO\""}, {"source_code": "<>;\n\n$_ = <>;\n\n$Z = eval join ' + ', split //;\n\nfor $i ( 2 .. 100 ){\n\t$d = $Z / $i;\n\tnext if $d =~ /\\./;\n\t\n\t$s = 0;\n\t$c = 0;\n\t\n\twhile( /./g ){\n\t\t$s += $&;\n\t\tif( $s == $d ){ \n\t\t\t$c ++;\n\t\t\t$s = 0;\n\t\t\t}\n\t\t}\n\t\n\tlast if $ok = $i == $c;\n\t}\n\nprint $ok ? \"YES\" : \"NO\""}], "src_uid": "410296a01b97a0a39b6683569c84d56c"} {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprintf('%11.0f', paveSquare($n, $m, $a));\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\treturn ceil($n / $a) * ceil($m / $a);\n}", "positive_code": [{"source_code": "my @a = split \" \", <>;\nmy $b = ((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0));\nmy $c = ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0));\nprintf (\"%.0f\", $b * $c);"}, {"source_code": "#!/usr/bin/env perl\n# perl learning...\npackage Codeforces::contest1::A;\nuse warnings;\n#use List::Util qw[min max];\nuse v5.20;\nsub input\n { return <>; }\n \nsub ceildiv {\n my ($a, $b) = @_;\n return int($a / $b) + ($a % $b != 0);\n}\n \nsub main {\n my ($n, $m, $a) = split(\" \", input());\n print(int(ceildiv($n, $a)) * int(ceildiv($m, $a)), \"\\n\");\n}\n \nmain();\n"}, {"source_code": "use bigint;\n\n$str = ;\n\n@ints = split(' ', $str);\n\n$n = $ints[0] + 0;\n$m = $ints[1] + 0;\n$a = $ints[2] + 0;\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "no bigint;\nuse strict;\n\nmain();\n\nsub main {\n\tmy $input = $ENV{PERLUSER} eq \"s_p\"? \\*DATA: \\*STDIN;\n\tfor (<$input>) {\n\t\tmy ($n, $m, $a, $nm) = split;\n\t\t$n = int($n / $a) + ($n % $a? 1: 0);\n\t\t$m = int($m / $a) + ($m % $a? 1: 0);\n\t\tprint length($nm)? \n\t\t\t[qw(fail ok)]->[itoa(mul($n, $m)) eq $nm]: \n\t\t\titoa(mul($n, $m)), \"\\n\";\n\t}\n}\n\nsub add {\n\tmy ($p2, $p1, $add) = @_;\n\tmy $addok = 0xffff_ffff - $p1;\n\t$add <= $addok? \n\t\t($p2, $p1 + $add):\n\t\t($p2 + 1, $add - $addok - 1);\n}\n\n# b=2^16, n1=q1*b+r1, n2=q2*b+r2\n# n1*n2=(q1*b+r1)(q2*b+r2)=q1*q2*b^2 + q1*r2*b + q2*r1*b + r1*r2\nsub mul {\n\tmy ($n1, $n2) = @_;\n\tmy $B16 = 0xffff;\n\tmy ($q1, $r1) = ($n1>>16, $n1 & $B16);\n\tmy ($q2, $r2) = ($n2>>16, $n2 & $B16);\n\tmy ($tmp, $bits_00_15, $bits_16_31, $bits_32_63);\n\t$tmp = $r1 * $r2;\n\t$bits_00_15 = $tmp & $B16;\n\t$tmp = $q1 * $r2 + $q2 * $r1 + ($tmp>>16);\n\t$bits_16_31 = $tmp & $B16;\n\t$bits_32_63 = $q1 * $q2 + ($tmp>>16);\n\tmy $p1 = ($bits_16_31<<16) + $bits_00_15;\n\tmy $p2 = $bits_32_63;\n\t# print \"mul $n1 x $n2 = $p2, $p1\\n\";\n\t($p2, $p1);\n}\n\n# p2*b+p1 = (q2*d+r2)*(q3*d+r3) + q1*d+r1 = \n# q2*q3*d^2 + q2*r3*d + r2*q3*d + r2*r3 + q1*d + r1\n# (q2*q3*d + q2*r3 + r2*q3 + q1) * d + (r2*r3 + r1)\nsub div {\n\tmy ($p2, $p1, $d) = @_;\n\tmy $b = 0xffff_ffff;\n\tmy ($q1, $r1) = (int($p1/10), $p1%10);\n\tmy ($q2, $r2) = (int($p2/10), $p2%10);\n\tmy ($q3, $r3) = (int($b/10), $b%10 + 1);\n\tmy ($divp2, $divp1, $divr);\n\t($divp2, $divp1) = mul($q2, $q3 * $d);\n\t($divp2, $divp1) = add($divp2, $divp1, $q2 * $r3);\n\t($divp2, $divp1) = add($divp2, $divp1, $r2 * $q3);\n\t($divp2, $divp1) = add($divp2, $divp1, $q1);\n\t$divr = $r2 * $r3 + $r1;\n\t$divp1 += int($divr/10);\n\t$divr = $divr % 10;\n\t# print \"div ($p2, $p1) / $d = ($divp2, $divp1) + $divr\\n\";\n\t($divp2, $divp1, $divr);\n}\n\n# 10^15 = 232830*2^32+2764472320\n# 10^14 = 23283*2^32+ 276447232\n# div(232830, 2764472320, 10);\n\n# 2^32 + 1234 = 4294968530 = (1, 1234)\n# 2^32/10 = (0, 429496853, 0)\n# div(1, 1234, 10);\n\nsub itoa {\n\tmy ($p2, $p1) = @_;\n\tmy ($s, $r);\n\twhile ($p2 || $p1) {\n\t\t($p2, $p1, $r) = div($p2, $p1, 10);\n\t\t$s = substr(\"0123456789\", $r, 1).$s;\n\t\t# print \"p2=$p2 p1=$p1 r=$r s=$s\\n\";\n\t}\n\t$s;\n}\n\n__DATA__\n2147483648 2147483648 1 4611686018427387904\n6 6 4 4\n"}, {"source_code": "\nuse bigint;\nmy ($n, $m, $a) = split \" \",<>;\nprint ((($n + $a - 1)) / $a * (($m + $a - 1) / $a));"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprintf('%11.0f', paveSquare($n, $m, $a));\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\n\tif ($n > $m) {\n\t\tmy $k = $n;\n\t\t$n = $m;\n\t\t$m = $k;\n\t}\n\t$counter += ceil($n / $a);\n\t$counter *= ceil($m / $a);\n\treturn ceil($n / $a) * ceil($m / $a);\n}"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprintf('%11.0f', paveSquare($n, $m, $a));\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\n\tif ($n > $m) {\n\t\tmy $k = $n;\n\t\t$n = $m;\n\t\t$m = $k;\n\t}\n\tmy $remain = $m - $n;\n\t$counter += ceil($n / $a);\n\twarn $counter;\n\t$counter *= ceil($m / $a);\n\treturn $counter;\n}"}, {"source_code": "use bigint;\n($n, $m, $a) = split(' ', );\nsub f {\n return (@_[0] + @_[1] - 1) / @_[1];\n}\nprint (f($n, $a) * f($m, $a));"}, {"source_code": "use bigint;\n($n, $m, $a) = split(' ', );\nprint (($n + $a - 1) / $a * (($m + $a - 1) / $a));"}, {"source_code": "$_=<>;\n($a,$b,$c)=/(\\d+) (\\d+) (\\d+)/;\n$i=($a-$a%$c)/$c;\n$i++ if $a%$c;\n$j=($b-$b%$c)/$c;\n$j++ if $b%$c;\nprint$i*$j"}, {"source_code": "#!/usr/bin/perl\nuse POSIX;\nuse bigint;\n$_ = <>;\ns/(\\d+).(\\d+).(\\d+)/int(ceil($1\\/$3)*ceil($2\\/$3)+0)/e;\nprint;\n"}, {"source_code": "my ($n,$m,$a) = split (' ',);\nif ($n % $a != 0) {\n\t$n = int($n / $a) + 1;\n} else {\n\t$n = $n / $a;\n}\nif ($m % $a != 0) {\n\t$m = int($m / $a) + 1;\n} else {\n\t$m = $m / $a;\n}\nprintf ('%.0f',$m*$n);"}, {"source_code": "use bigint;($a,$b,$c)=split' ',<>;sub t{((shift)-1)/$c+1};print t($a)*t$b\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";"}, {"source_code": "use bigint;($a,$b,$c)=split' ',<>;$_=(($a-1)/$c+1);print$_*(($b-1)/$c+1);\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $a;"}, {"source_code": "use bigint;($a,$b,$c)=split' ',<>;$_=(($a-1)/$c+1);print$_*(($b-1)/$c+1)\n"}, {"source_code": "use bigint;($a,$b,$c)=split' ',<>;$_=(($a-1)/$c+1);print$_*(($b-1)/$c+1)"}, {"source_code": "($m, $n, $a)=split' ',<>;\nif (int($m / $a)<($m / $a)){$swag = int($m / $a)+1;}else{$swag = ($m / $a)}\nif (int($n / $a)<($n / $a)){$lox = int($n / $a)+1;}else{$lox = ($n / $a)}\nprint $swag * $lox\n"}, {"source_code": "($n, $m, $k) = split(' ', <>);\n$ans = int(($n + $k - 1) / $k) * int(($m + $k - 1) / $k);\nprint $ans == 0 ? 1 : $ans;\n"}, {"source_code": "use Math::BigInt;\nuse POSIX(ceil);\n$_ = <>;\n@a = split;\nprint Math::BigInt->new(ceil($a[0] / $a[2]) * ceil($a[1] / $a[2]));"}, {"source_code": "($n, $m, $a) = split \" \", <>;\n$x = int($n/$a);\n$y = int($m/$a);\nif ($n % $a != 0)\n{\n $x = $x + 1;\n}\nif ($m % $a != 0)\n{\n $y = $y + 1;\n}\n$res = $x * $y;\nprintf \"%.0f\\n\", $res;"}, {"source_code": "my ($n, $m, $a) =\n split \" \", ;\n\n\nsub ceil{\n $x = shift;\n if($x == int($x)){\n $x;\n }else{\n int($x)+1;\n }\n}\n\n\nprint ceil($n / $a) * ceil($m/$a), \"\\n\";\n"}, {"source_code": "use strict;\nuse warnings;\nuse feature \"say\";\n\nmy $n;\nmy $m;\nmy $a;\n\nmy $line = ;\n\n($n, $m, $a) = split / +/, $line;\n\nsay int(($m + $a - 1) / $a) * int(($n + $a - 1) / $a);\n"}, {"source_code": "use strict;\nuse warnings;\n\nmy $input = ;\n\nmy @t = split(/ /,$input);\nmy $n = $t[0];\nmy $m = $t[1];\nmy $a = $t[2]; \n\nmy $res = int(($m+$a-1) / $a) * int(($n+$a-1) / $a);\n\nprint \"$res\\n\";"}, {"source_code": "#!/usr/bin/perl\n\nuse Math::BigInt;\n\n$_ = <>;\n@a = split;\n@s;\n$s[0] = Math::BigInt->new($a[0]);\n$s[1] = Math::BigInt->new($a[1]);\n$s[2] = Math::BigInt->new($a[2]);\n$n = Math::BigInt->new($s[0] / $s[2]);\n$x = Math::BigInt->new($s[1] / $s[2]);\nif($s[0] % $s[2] != 0){\n $n++;\n}\nif($s[1] % $s[2] != 0){\n $x++;\n}\nprint Math::BigInt->new($n * $x);"}, {"source_code": "while (<>){\n\t($m,$n,$a) = split(\" \", $_);\n\tprint int (($n + $a - 1) / $a) * (int (($m + $a - 1) / $a));\n\t}\n"}, {"source_code": "#!/usr/bin/perl\nuse bigint;\n($a,$b,$k)=split ' ',<>;\n$n=($a-1)/$k+1;\n$m=($b-1)/$k+1;\nprint $n*$m;\nprint \"\\n\";\n"}, {"source_code": "#!/usr/bin/perl\nmy ($n, $m, $a) = split \" \",;\n\nuse integer;\n\nmy $i = ($n / $a + ($n % $a ? 1 : 0)) * ($m / $a + ($m % $a ? 1 : 0));\nprint $i;"}, {"source_code": "#!/usr/bin/perl\n# 2nd prog perl \nuse bigint;($n,$m,$a)=split' ',<>;\nif($m%$a!=0)\n{\n\t$m=$m-$m%$a;\n\t$m=$m/$a;\n\t$m=$m+1;\n}\nelse\n{\n\t$m=$m/$a;\n}\nif($n%$a!=0)\n{\n $n=$n-$n%$a;\n $n=$n/$a;\n $n=$n+1;\t\n}\nelse\n{\n $n=$n/$a;\n}\nprint($m*$n);\n\n\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy( $str );\n$str = ;\nmy ($n, $m, $a) = split / /, $str;\n\nmy($na, $ma);\n\nprint int(($n+$a-1)/$a)*int(($m+$a-1)/$a)"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\nuse warnings;\nuse POSIX qw{ceil};\nmy ($n, $m, $a) = map int, split /\\D/, <>;\nprint sprintf \"%.0f\", (ceil ($n/$a) * ceil ($m/$a));\n"}, {"source_code": "# Author Badhan Sen\n# CSE-14, JUST\n\n# 1A Theatre Square\n\n\nmy $n, $m, $a;\n\n($n, $m, $a)=split(' ', <>);\n\n$x=int($n/$a);\n$y=int($m/$a);\n\nif($n%$a!=0){\n\t$x++;\n}\n\nif($m%$a!=0){\n\t$y++;\n}\n\n$ans=$x*$y;\nprint $ans;\n"}, {"source_code": "use strict;\nuse warnings;\nuse feature \"say\";\n\nmy $n;\nmy $m;\nmy $a;\n\nmy $line = ;\n\n($n, $m, $a) = split / / , $line;\nsay int(($n+$a-1)/$a) * int(($m+$a-1)/$a);"}, {"source_code": "use bigint;\n\nmy ($m, $n, $a) = split(' ', <>);\nmy $wid = int ( $m/$a ) + ( $m % $a ? 1 : 0 );\nmy $height = int ( $n/$a ) + ( $n % $a ? 1 : 0 );\nprint $wid * $height;\n\n\n"}, {"source_code": "#!/usr/bin/perl\nuse POSIX;\nuse Math::BigInt;\n@l = split ' ', <>;\n$m = ceil($l[0]/$l[2]);\n$n = ceil($l[1]/$l[2]);\n$\" = Math::BigInt->new($m*$n);\nprint $\";\n"}, {"source_code": "\nuse strict;\nuse warnings;\nuse Math::BigFloat;\n\nmy $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ , $a ) } $m, $n;\n\nprint $dn * $dm;\n\nsub ceil {\n my ( $x , $a ) = @_;\n my $frac = Math::BigFloat->new( $x )->bdiv($a);\n return 1 if $frac < 1;\n return $frac->bceil;\n}\n"}, {"source_code": "use integer;\nmy ($n, $m, $a)=split / +/, <>;\nprint ((($n/$a)+($n%$a?1:0))*(($m/$a)+($m%$a?1:0))) ;\n\n"}, {"source_code": "#!/usr/bin/env perl \n\nuse utf8;\nuse v5.20;\nuse strict;\nuse warnings;\n\nsub main {\n my %args = @_;\n\n my $input = readline(STDIN);\n chomp $input;\n my ($n, $m, $a) = split(/\\s+/, $input);\n my $n_tile = int($n / $a) + !!($n % $a);\n my $m_tile = int($m / $a) + !!($m % $a);\n\n say $n_tile * $m_tile;\n\n return;\n}\n\nmain();\n\nexit;\n"}, {"source_code": " use bigint;\n $_ = <>;\n my @arr = split/\\s+/;\n #print @arr;\n my $tiles1 = 0;\n my $tiles2 = 0;\n { \n use integer;\n $tiles1 += $arr[0]/$arr[2];\n $tiles2 += $arr[1]/$arr[2];\n }\n if ($arr[0]%$arr[2] != 0) {\n $tiles1 += 1;\n }\n if ($arr[1]%$arr[2] != 0) {\n $tiles2 += 1;\n }\n my $tiles = $tiles1*$tiles2;\n print \"$tiles\\n\";\n exit 0;\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggsjkhkkhgjhgkjguyfuyljhkjgchjyfjhgj"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggsjkhkkhgjhgkjgukljhlkjyfuyljhkjgchjyfjhgj"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkljhkjgchjyfjhgj"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggsjkhk"}, {"source_code": "use bigint;\n$input = ;\n@x=split(\" \",$input);\n$n=$x[0]; $m=$x[1]; $a=$x[2];\n$h=int($n/$a);\n$w=int($m/$a);\n\nif($n%$a != 0){\n\t$h++;\n}\nif($m%$a != 0){\n\t$w++;\n}\n$ans=Math::BigInt->new($h*$w);\nprintf \"$ans\\n\";\n\n\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkug"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggjhlkjyfuyljhkjgchjyfjhgj"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;"}, {"source_code": "use bigint;\n($a, $b, $c) = split' ', <>;\nprint ((($a + $c - 1)) / $c * (($b + $c - 1) / $c));"}, {"source_code": "#!/usr/bin/perl\n\n$input = <>;\n($n, $m, $a) = split(/\\s+/, $input);\n\n$s1 = $n % $a == 0 ? $n / $a : int($n / $a + 1);\n$s2 = $m % $a == 0 ? $m / $a : int($m / $a + 1);\n\nif ($s1 == 0) { $s1 = 1; }\nif ($s2 == 0) { $s2 = 1; }\n\nprint $s1 * $s2 . \"\\n\";\n"}, {"source_code": "my ($n, $m, $a) = split /\\s+/, ;\n$n=int(($n+$a-1)/$a);\n$m=int(($m+$a-1)/$a);\nprint $n*$m;"}, {"source_code": "use bigint;\n($n, $m, $a) = split' ', <>;\nprint ((($n + $a - 1) / $a) * (($m + $a - 1) / $a));"}, {"source_code": "use Math::BigInt;\n$input = ;\n\n## $xx[0] : n / $xx[1] : m / $xx[2] : a\n@xx = split(\" \",$input);\n\n$hh = Math::BigInt->new(int($xx[0] / $xx[2]));\nif ($xx[0] % $xx[2]) {Math::BigInt->new($hh++);}\n\n$ww = Math::BigInt->new(int($xx[1] / $xx[2]));\nif ($xx[1] % $xx[2]) {Math::BigInt->new($ww++);}\n\nprint Math::BigInt->new($hh*$ww);\nexit;\n"}, {"source_code": "($n,$m,$a)=split ' ',<>;\nprint(int(($n+$a-1)/$a)*int(($m+$a-1)/$a))"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse bigint;\n\n($n, $m, $a) = split / /, <>;\n# print \"$n $m $a\";\n$ans = (($n+$a-1)/$a) * (($m+$a-1)/$a);\nprint $ans;\n"}, {"source_code": "use Math::BigInt;\nuse bigint;\nmy $data = ;\nmy (@data) = split (\" \", $data);\n\nmy $n = shift (@data);\nmy $m = shift (@data);\nmy $a = shift (@data);\n\nmy $ma = $m/$a;\nmy $na = $n/$a;\n\nif (int($ma) != $ma) {\n $ma = int($ma) +1; \n}\n\nif (int($na) != $na) {\n $na = int($na) +1; \n}\n\n$x = Math::BigInt->new($ma*$na);\nprint $x;"}, {"source_code": "use bigint;\nmy($n, $m, $a) = split(\" \", );\nprint int(($n + $a -1) / $a) * int(($m + $a -1) / $a);"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nmy ($m, $n, $a);\nmy @input;\nmy ($x, $y);\n\nwhile () {\n chomp;\n ($m, $n, $a) = split ' ';\n if ($m % $a) {\n $x= int($m/$a)+1;\n } else {\n $x = $m/$a;\n }\n\n if ($n % $a) {\n $y = int($n/$a)+1;\n } else {\n $y = $n/$a;\n }\n\n# print \"$m $n $x $y\\n\";\n print $x*$y,\"\\n\";\n}\n"}, {"source_code": "#!/usr/bin/perl\nuse strict; use warnings;\n\nsub ceil { my $j = $_[0]; my $i = int $j; $i < $j ? $i + 1 : $i }\n\nmy ($n, $m, $a) = split ' ', ;\nprint ceil($n / $a) * ceil($m / $a) . \"\\n\"\n"}, {"source_code": "use strict;\nuse warnings;\n\n#use POSIX qw(ceil);\n\nmy $input = <>;\nmy ($n, $m, $a) = split ' ', $input;\n\n# cover n x m meters with ? number of stones of size a x a.\n# calculate how many stones needed in n direction and then in m direction.\n\nmy $n_stones = int( $n / $a ) + ( $n % $a > 0 ? 1 : 0 );\nmy $m_stones = int( $m / $a ) + ( $m % $a > 0 ? 1 : 0 );\nmy $needed_stones = $n_stones * $m_stones;\n#print int($n_stones);\n#print int($m_stones);\nprint \"$needed_stones\\n\";\n\n\n\n\n"}, {"source_code": "#!/usr/bin/perl\n\nuse bigint;\n$str = <>;\n\n($a,$b,$c) = split' ',$str;\n\nprint ( (($a+$c-1)/$c)*(($b+$c-1)/$c));\n"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nuse v5.10;\n\nmy $line = <>;\nchomp $line;\nmy ($n, $m, $a) = split /\\s+/, $line;\n\nmy $w = int($n/$a) + ($n % $a == 0 ? 0 : 1);\nmy $l = int($m/$a) + ($m % $a == 0 ? 0 : 1);\n\nsay ( $w * $l );"}, {"source_code": "use strict;\nuse warnings;\n\nuse Data::Dumper;\n\nmy $line = ;\n\nmy ($n, $m, $a) = split(/\\s+/, $line);\n\n$n += $n % $a ? $a - $n % $a : 0;\n$m += $m % $a ? $a - $m % $a : 0;\n\nprintf(\"%.0f\\n\", (($n/$a) * ($m/$a)));\n"}, {"source_code": "use bigint;\n( $n, $m, $a ) = split / /, <>;\nprint int( ( $n + $a - 1 ) / $a ) * int( ( $m + $a - 1 ) / $a );"}, {"source_code": "use strict;\nuse warnings;\nuse utf8;\nuse Math::BigInt;\n\nmy $stdin=;\nchomp($stdin);\nmy @in=split(\" \", $stdin);\n\nmy $h=int($in[0]/$in[2]);\n$h++\tunless($in[0]%$in[2]==0);\n\nmy $w=int($in[1]/$in[2]);\n$w++\tunless($in[1]%$in[2]==0);\n\nprint Math::BigInt->new($h*$w).\"\\n\";\n\n"}, {"source_code": "#! /usr/bin/env perl\nuse 5.012;\nuse bignum;\nuse List::Util;\n\nmy ($n, $m, $a) = split /\\s/, ;\nsay int(($n+$a-1) / $a) * int(($m+$a-1) / $a);"}, {"source_code": "($n, $m, $a) = split \" \", <>;\n$x = int($n/$a);\n$y = int($m/$a);\nif ($n % $a != 0)\n{\n $x = $x + 1;\n}\nif ($m % $a != 0)\n{\n $y = $y + 1;\n}\n$res = $x * $y;\nprintf \"%.0f\\n\", $res;"}, {"source_code": "use strict;\nuse warnings;\nmy ($n, $m, $a) = split ' ', <>;\nmy $x = int (($n+$a-1)/$a+0.000000000001);\nmy $y = int (($m+$a-1)/$a+0.000000000001);\nmy $res = $x * $y;\nprint \"$res\\n\";\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\nuse bignum;\nmy $input=;\nmy ($m,$n,$a)=split \" \",$input;\nmy $d1=$m%$a?1:0;\nmy $d2=$n%$a?1:0;\nmy $output=(int $m/$a+$d1)*(int $n/$a+$d2);\nprint $output;\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n#use POSIX qw(ceil);\n\n#my ($m, $n, $a) = ($ARGV[0], $ARGV[1], $ARGV[2]); #(7,6,4);\nmy $userinput = ; #read stdin and put it in $userinput\nchomp ($userinput); #cut the return / line feed character\nmy ($m, $n, $a) = split(/\\s+|,/, $userinput);\n\nmy $add1 = ($m%$a>0)?1:0;\nmy $add2 = ($n%$a>0)?1:0;\nmy $ret = int($m/$a + $add1) * int($n/$a + $add2);\nprintf \"%.0f\", $ret;\n\n"}, {"source_code": "use bigint;\n\nwhile() {\n my($n, $m, $a) = split(\" \", $_);\n print int(($n + $a -1) / $a) * int(($m + $a -1) / $a);\n}"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\nuse bigint;\n\n#open FILE, \"in.txt\";\n#chomp($_ = );\nwhile ($_ = ) {\n chomp;\n my ($n, $m, $a) = split;\n print cal($n,$a)*cal($m,$a) . \"\\n\";\n}\n\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\nuse bigint;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\nprint cal($n,$a)*cal($m,$a) . \"\\n\";\n\nsub cal {\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "use POSIX qw(ceil);\nuse Math::BigInt;\n($n,$m,$a)=split (' ',);\nprint Math::BigInt->new(ceil($n/$a)*ceil($m/$a));\n"}, {"source_code": "use Math::BigInt;\n($n,$m,$a)=split (' ',);\n$h=int($n/$a);\n$w=int($m/$a);\nif ($n % $a!=0){$h++;}\nif ($m % $a!=0){$w++;}\nprint Math::BigInt->new($h*$w);\n"}, {"source_code": "#!/usr/bin/perl\nuse bigint;\n($n,$m,$a)=split' ',<>;\n$c1 = ($n%$a);\n$c2 = ($m%$a);\nif ($c1 eq 0)\n{$miss1 = 0;}\nelse\n{$miss1 =$a-($n%$a);}\nif ($c2 eq 0)\n{$miss2 = 0;}\nelse\n{$miss2 =$a-($m%$a);}\n$answer = (($n+$miss1)/$a)*(($m+$miss2)/$a);\nprint \"$answer\";"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggsjkhkkhgjhgkjguyfuygchjyfjhgj"}, {"source_code": "use strict;\nuse bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = ( ( $n - 1 ) / $a + 1 ) * ( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n\nmy $f;\n\n#fdlgkjjgkjhkuggsjkhkkhgjhgkjguyfuygch"}, {"source_code": "#!perl\n\nuse strict;\nuse warnings;\n\nsub myceil {\n\n my ($num) = @_;\n my $diff = $num - int($num);\n my $ret = $diff ? int($num+0.99999999999999) : $num;\n #print \"ceil of $num is $ret\\n\";\n $ret;\n}\n\nmy $n;\nmy $m;\nmy $a;\nwhile (<>) {\n chomp;\n ($n, $m, $a) = split(/ /);\n last;\n}\n\nmy $r1 = myceil($n/$a);\nmy $r2 = myceil($m/$a);\n#use POSIX;\n#die \"$r1\" if ($r1 != ceil($n/$a));\n#die \"$r2\" if ($r2 != ceil($m/$a));\nmy $area = $r1 * $r2;\n$area = 1 if ($area < 1);\nprint \"$area\\n\";\n\nexit(0);\n"}, {"source_code": "use bigint;\nchmod($line = <>);\n($n, $m, $a) = split(' ', $line);\n$res = int(int(($n + $a - 1) / $a) * int(($m + $a - 1) / $a));\nprint (\"$res\");\n"}, {"source_code": "#!/usr/bin/perl\n\n$input_line = ;\nchop($input_line);\n($n,$m,$a)=split(/ /,$input_line);\n$ni = int($n/$a);\n$mi = int($m/$a);\n$i = $ni*$mi;\n$size = ($n*$m)-($i*$a*$a);\nif($n==($ni*$a)){$nii=0}else{$nii=1}\nif($m==($mi*$a)){$mii=0}else{$mii=1}\n\nif ($size == ($n*$m)) {$i++;}\nelsif ($size != 0){$i += ($ni*$mii+$mi*$nii+1);\nif (($nii == 0)||($mii == 0)){$i--;}}\nprint(\"$i\\n\");"}, {"source_code": "#print \"hello world\";\n($n, $m, $a) = split ' ', <>;\n$x = int(($n + $a - 1) / $a);\n$y = int(($m + $a - 1) / $a);\nprint $x * $y;"}, {"source_code": "my @items = split / /, <>;\nprintf \"%d\\n\", int(($items[0]+$items[2]-1)/$items[2]) * int(($items[1]+$items[2]-1)/$items[2]);\n"}, {"source_code": "\nsub ceil {\n if ( @_[0] > (int @_[0]) ) {\n\treturn (int ( @_[0] ) + 1); }\n else {\n\treturn ( @_[0] ); }\n}\n\n# three integers\nmy $g = ;\n\n# remove newline\nchomp ( $g );\n\nmy $a, $b, $c;\nif ( $g =~ m/(.+) (.+) (.+)/ ) {\n $a = $1;\n $b = $2;\n $c = $3; }\n\nmy $ans = &ceil ( $a / $c ) * &ceil ( $b / $c );\nprint \"$ans\\n\";\n\n\n\n\n\n"}, {"source_code": "use bigint;\n\nmy ($n, $m, $a) = split /\\s+/, ;\n\nmy $h = (int $n/$a) + !!($n % $a);\nmy $w = (int $m/$a) + !!($m % $a);\n\nmy $area = $h * $w;\n\nprintf \"%.0f\", $area;"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nuse integer;\n\nmy $line = ;\n\nmy ($h, $w, $a);\nif ($line =~ /(\\d+) (\\d+) (\\d+)/) {\n\t$h = $1;\n\t$w = $2;\n\t$a = $3;\n}\nmy $ver = $h / $a + ($h % $a != 0);\nmy $hor = $w / $a + ($w % $a != 0);\nprint $ver * $hor;\n"}], "negative_code": [{"source_code": "$str = ;\n\n@ints = split(' ', $str);\n\n$n = int($ints[0]);\n$m = int($ints[1]);\n$a = int($ints[2]);\n\nuse integer;\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nwarn $n;\nwarn $m;\nwarn $a;\nprint paveSquare($n, $m, $a);\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\t$counter += ceil($n / $a);\n\t$counter += ceil($m / $a);\n\treturn $counter;\n}"}, {"source_code": "$str = ;\n\n@ints = split(' ', $str);\n\n$n = int($ints[0]);\n$m = int($ints[1]);\n$a = int($ints[2]);\n\nuse bignum;\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "use POSIX(ceil);\n$_ = <>;\n@a = split;\nprintf \"%i\\n\", ceil($a[0] / $a[2]) * ceil($a[1] / $a[2]);"}, {"source_code": "$input = ;\n@x=split(\" \",$input);\n$n=$x[0]; $m=$x[1]; $a=$x[2];\n$h=int($n/$a);\n$w=int($m/$a);\n\nif($h%$a != 0){\n\t$h++;\n}\nif($w%$a != 0){\n\t$w++;\n}\n$ans=$h*$w;\nprintf \"$ans\\n\";\n\n\n"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprintf('%011.0f', paveSquare($n, $m, $a));\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\n\tif ($n > $m) {\n\t\tmy $k = $n;\n\t\t$n = $m;\n\t\t$m = $k;\n\t}\n\tmy $remain = $m - $n;\n\t$counter += ceil($n / $a);\n\twarn $counter;\n\t$counter *= ceil($m / $a);\n\treturn $counter;\n}"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprint paveSquare($n, $m, $a);\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n# \t$counter += ceil($n / $a);\n# \t\n# \tmy $remain = ceil($m / $a);\n# \treturn $counter;\n\tif ($n > $m) {\n\t\tmy $k = $n;\n\t\t$n = $m;\n\t\t$m = $k;\n\t}\n\tmy $remain = $m - $n;\n\t$counter += ceil($n / $a) ** 2;\n\t$counter += ceil($n / $a) * ceil($remain / $a);\n\treturn $counter;\n}"}, {"source_code": "use POSIX qw(ceil);\n($n,$m,$a)=split (' ',);\nprint ceil($n/$a)*ceil($m/$a);\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n#use POSIX qw(ceil);\n\n#my ($m, $n, $a) = ($ARGV[0], $ARGV[1], $ARGV[2]); #(7,6,4);\nmy $userinput = ; #read stdin and put it in $userinput\nchomp ($userinput); #cut the return / line feed character\nmy ($m, $n, $a) = split(/\\s+|,/, $userinput);\n\nmy $add = ($m%$a>0)?1:0;\nmy $ret = int($m/$a + $add) * int($n/$a + $add);\nprintf \"%.0f\", $ret;\n\n"}, {"source_code": "$str = ;\n\n@ints = split(' ', $str);\n\n$n = int($ints[0]);\n$m = int($ints[1]);\n$a = int($ints[2]);\n\nuse bigint;\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$c1 = ($n%$a);\n$c2 = ($m%$a);\n\n\nif ($c1 eq 0)\n{$miss1 = 0;}\nelse\n{$miss1 =$a-($n%$a);}\n\nif ($c2 eq 0)\n{$miss2 = 0;}\nelse\n{$miss2 =$a-($m%$a);}\n\n$answer = (($n+$miss1)/$a)*(($n+$miss2)/$a);\nprint \"$answer\";"}, {"source_code": "use POSIX(ceil);\n$_ = <>;\n@a = split;\nprintf \"%lld\\n\", ceil($a[0] / $a[2]) * ceil($a[1] / $a[2]);"}, {"source_code": "($n, $m, $a) = split / /, <>;\n$i = 0;\nwhile ($a << $i <= ($n * $m)) {\n $i++;\n}\n\nprint $i;"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nwarn $n;\nwarn $m;\nwarn $a;\nprint paveSquare($n, $m, $a);\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\t$counter += ceil($n / $a);\n\t$counter += ceil($m / $a);\n\treturn $counter;\n}"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%Ld\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}, {"source_code": "use strict;\n\n\nmy( $str );\n$str = ;\nmy ($n, $m, $a) = split / /, $str;\n\nmy($na, $ma);\n\nprint int(($n+$a-1)/$a)*int(($m+$a-1)/$a);"}, {"source_code": " $_ = <>;\n my @arr = split/\\s+/;\n #print @arr;\n my $tiles1 = 0;\n my $tiles2 = 0;\n { \n use integer;\n $tiles1 += $arr[0]/$arr[2];\n $tiles2 += $arr[1]/$arr[2];\n }\n if ($arr[0]%$arr[2] != 0) {\n $tiles1 += 1;\n }\n if ($arr[1]%$arr[2] != 0) {\n #$tiles += 1;\n }\n my $tiles = $tiles1*$tiles2;\n print \"$tiles\\n\";\n exit 0;\n"}, {"source_code": "use strict;\nuse warnings;\nuse utf8;\n\nmy $stdin=;\nchomp($stdin);\nmy @in=split(\" \", $stdin);\n\nmy $h=int($in[0]/$in[2]);\n$h++\tunless($in[0]%$in[2]==0);\n\nmy $w=int($in[1]/$in[2]);\n$w++\tunless($in[1]%$in[2]==0);\n\nprint $h * $w.\"\\n\";\n\n"}, {"source_code": "use strict;\nuse warnings;\n\n#use POSIX qw(ceil);\n\nmy $input = <>;\nmy ($n, $m, $a) = split ' ', $input;\n\n# cover n x m meters with ? number of stones of size a x a.\n# calculate how many stones needed in n direction and then in m direction.\n\nmy $n_stones = int( $n / $a + 0.99 );\nmy $m_stones = int( $m / $a + 0.99 );\nmy $needed_stones = $n_stones * $m_stones;\n\nprint \"$needed_stones\\n\";\n\n"}, {"source_code": "use strict;\nuse warnings;\n\nuse Data::Dumper;\n\nmy $line = ;\n\nmy ($n, $m, $a) = split(/\\s+/, $line);\n\n$n += $n % $a ? $a - $n % $a : 0;\n$m += $m % $a ? $a - $m % $a : 0;\n\nprint (($n/$a) + ($m/$a));\nprint \"\\n\";\n"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse integer;\n\n($n, $m, $a) = split / /, <>;\n# print \"$n $m $a\";\n$ans = (($n+$a-1)/$a) * (($m+$a-1)/$a);\nprint $ans;\n"}, {"source_code": "my @items = split / +/, <>;\nprintf \"%d\\n\", int($items[0]/$items[2]+0.999999999) * int($items[1]/$items[2]+0.999999999);"}, {"source_code": "($n, $m, $a) = split \" \", <>;\n$x = int($n/$a);\n$y = int($m/$a);\nif ($n % $a != 0)\n{\n\t$x = $x + 1;\n}\nif ($m % $a != 0)\n{\n\t$y = $y + 1;\n}\n$res = $x * $y;\nprint \"$res\\n\";"}, {"source_code": "#!/usr/bin/env perl\n\nmy ($n, $m, $a) = split /\\s+/, ;\n\nmy $h = (int $n/$a) + !!($n % $a);\nmy $w = (int $m/$a) + !!($m % $a);\n\nprint $h * $w"}, {"source_code": "#!/usr/bin/perl\nuse POSIX;\nuse bigint;\n@l = split ' ', <>;\n$m = ceil($l[0]/$l[2]);\n$n = ceil($l[1]/$l[2]);\n$\" = $m*$n;\nprint $\";\n"}, {"source_code": "\nuse bigint;\n\nmy $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ / $a ) } $m, $n;\n\nprintf \"%d\\n\", $dn * $dm;\n\nsub ceil {\n my ( $x ) = @_;\n return 1 if $x < 1;\n return int( $x ) < $x ? int($x) + 1 : int $x;\n}\n"}, {"source_code": "#!/usr/bin/perl\n\n$input_line = ;\nchop($input_line);\n($n,$m,$a)=split(/ /,$input_line);\n$ni = int($n/$a);\n$mi = int($m/$a);\n$i = $ni*$mi;\n$size = ($n*$m)-($i*$a);\nif ($size == ($n*$m)) {$i++;}\nelsif ($size != 0){$i += ($ni+$mi+1);}\nprint(\"$i\\n\");"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\nuse warnings;\nuse POSIX qw{ceil};\nmy ($n, $m, $a) = map int, split /\\D/, <>;\nprint int (ceil ($n/$a) * ceil ($m/$a));\n"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\nuse warnings;\nuse POSIX qw{ceil};\nmy ($n, $m, $a) = map int, split /\\D/, <>;\nprint int (ceil ($n/$a) * ceil ($m/$a));\n"}, {"source_code": "$str = ;\n\n@ints = split(' ', $str);\n\n$n = int($ints[0]);\n$m = int($ints[1]);\n$a = int($ints[2]);\n\nuse integer;\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "($n, $m, $k) = split(' ', <>);\nprint int($n / $k + 0.99) * int($m / $k + 0.99);\n"}, {"source_code": "\nsub ceil {\n if ( @_[0] > (int @_[0]) ) {\n\treturn (int ( @_[0] ) + 1); }\n else {\n\treturn ( @_[0] ) }\n}\n\nmy $f = ;\nmy $one;\nmy $two;\nmy $thr;\n\nif ( $f =~ m/(\\d)+ (\\d)+ (\\d)+/ ) {\n $one = $1;\n $two = $2;\n $thr = $3; }\n\nmy $ans = &ceil ( $one / $thr ) * &ceil ( $two / $thr );\nprint $ans . \"\\n\";\n\n\n\n"}, {"source_code": "#!/usr/bin/perl\n\nuse Math::BigInt;\n\n$_ = <>;\n@a = split;\n$n = ($a[0] / $a[2]);\n$x = ($a[1] / $a[2]);\nif($a[0] % $a[2] != 0){\n $n++;\n}\nif($a[1] % $a[2] != 0){\n $x++;\n}\nprint Math::BigInt->new(($x) * ($n));"}, {"source_code": "use strict;\n\n\nmy( $str );\n$str = ;\nmy ($n, $m, $a) = split / /, $str;\n\nmy ($na, $ma );\n\nif( $n%$a != 0 ) {\n $na = int( ($n+$a)/$a )\n} else {\n $na = $n/$a\n}\n\nif( $m%$a != 0 ) {\n $ma = int( ($m+$a)/$a )\n} else {\n $ma = $m/$a\n}\n\nprint $na*$ma;"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n#use POSIX qw(ceil);\n\n#my ($m, $n, $a) = ($ARGV[0], $ARGV[1], $ARGV[2]); #(7,6,4);\nmy $userinput = ; #read stdin and put it in $userinput\nchomp ($userinput); #cut the return / line feed character\nmy ($m, $n, $a) = split(/\\s+|,/, $userinput);\n\nmy $add = ($m%$a>0)?1:0;\nmy $ret = int($m/$a + $add) * int($n/$a + $add);\nprintf \"%.0f\", $ret;\n\n"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%Ld\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}, {"source_code": "my ($n,$m,$a) = split (' ',);\nif ($n % $a != 0) {\n\t$n = int($n / $a) + 1;\n} else {\n\t$n = $n / $a;\n}\nif ($m % $a != 0) {\n\t$m = int($m / $a) + 1;\n} else {\n\t$m = $m / $a;\n}\nprint $m*$n;"}, {"source_code": "($n, $m, $a) = split(' ', );\nprint ($n + $a - 1) / $a * (($m + $b - 1) / $a);"}, {"source_code": "#!/usr/bin/perl\n\n$input_line = ;\nchop($input_line);\n($n,$m,$a)=split(/ /,$input_line);\n$ni = int($n/$a);\n$mi = int($m/$a);\n$i = $ni*$mi;\n$size = ($n*$m)-($i*$a*$a);\nif($n==($ni*$a)){$nii=0}else{$nii=1}\nif($m==($mi*$a)){$mii=0}else{$mii=1}\n\nif ($size == ($n*$m)) {$i++;}\nelsif ($size != 0){$i += ($ni*$nii+$mi*$mii+1);\nif (($nii == 0)||($mii == 0)){$i--;}}\nprint(\"$i\\n\");"}, {"source_code": "use bigint;\nuse POSIX(ceil);\n$_ = <>;\n@a = split;\nprint ceil($a[0] / $a[2]) * ceil($a[1] / $a[2]);"}, {"source_code": "use strict;\n\nmy ($n, $m, $a) = split /\\s+/, ;\nmy $result = int( ( $n - 1 ) / $a + 1 ) * int( ( $m - 1 ) / $a + 1 );\n\nprint $result, \"\\n\";\n"}, {"source_code": "#!/usr/bin/perl -w\nuse strict;\nuse warnings;\nuse POSIX qw{ceil};\nmy ($n, $m, $a) = map int, split /\\D/, <>;\nprint sprintf \"%d\", (ceil ($n/$a) * ceil ($m/$a));\n"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$c1 = ($n%$a);\n$c2 = ($m%$a);\n\nif ($c1 eq 0)\n{$miss1 = 0;}\nelse\n{$miss1 =$a-($n%$a);}\n\nif ($c2 eq 0)\n{$miss2 = 0;}\nelse\n{$miss2 =$a-($m%$a);}\n\n$answer = (($n+$miss1)/$a)*(($m+$miss2)/$a);\nprint \"$answer\";"}, {"source_code": "($n, $m, $k) = split(' ', <>);\nprint int($n / $k + 0.99) * int($m / $k + 0.99);\n"}, {"source_code": "while() {\n my($n, $m, $a) = split(\" \", $_);\n print int(($n + $a -1) / $a) * int(($m + $a -1) / $a);\n}"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%lf\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}, {"source_code": "use bigint;\n\n$str = ;\n\n@ints = split(' ', $str);\n\n$n = int($ints[0]);\n$m = int($ints[1]);\n$a = int($ints[2]);\n\n$count = ($n % $a == 0) ? $n/$a : $n/$a + 1;\n\n$count = $count * (($m % $a == 0) ? $m/$a : $m/$a + 1);\n\nprint \"$count\\n\";"}, {"source_code": "my ($n,$m,$a) = split (' ',);\nif ($n % $a != 0) {\n\t$n = int($n / $a) + 1;\n}\nif ($m % $a != 0) {\n\t$m = int($m / $a) + 1;\n}\nprint $m*$n;"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\nuse integer;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "no bigint;\nuse strict;\n\nmain();\n\nsub main {\n\tmy $input = $0 eq \"5.pl\"? \\*DATA: \\*STDIN;\n\tfor (<$input>) {\n\t\tmy ($n, $m, $a, $nm) = split;\n\t\t$n = int($n / $a) + ($n % $a? 1: 0);\n\t\t$m = int($m / $a) + ($m % $a? 1: 0);\n\t\tprint defined($nm)? [qw(fail ok)]->[$n * $m == $nm]: $n * $m, \"\\n\";\n\t}\n}\n\nsub add {\n\tmy ($p2, $p1, $add) = @_;\n\tmy $addok = 0xffff_ffff - $p1;\n\t$add <= $addok? \n\t\t($p2, $p1 + $add):\n\t\t($p2 + 1, $add - $addok - 1);\n}\n\n# b=2^16, n1=q1*b+r1, n2=q2*b+r2\n# n1*n2=(q1*b+r1)(q2*b+r2)=q1*q2*b^2 + q1*r2*b + q2*r1*b + r1*r2\nsub mul {\n\tmy ($n1, $n2) = @_;\n\tmy $B16 = 0xffff;\n\tmy ($q1, $r1) = ($n1>>16, $n1 & $B16);\n\tmy ($q2, $r2) = ($n2>>16, $n2 & $B16);\n\tmy ($tmp, $bits_00_15, $bits_16_31, $bits_32_63);\n\t$tmp = $r1 * $r2;\n\t$bits_00_15 = $tmp & $B16;\n\t$tmp = $q1 * $r2 + $q2 * $r1 + ($tmp>>16);\n\t$bits_16_31 = $tmp & $B16;\n\t$bits_32_63 = $q1 * $q2 + ($tmp>>16);\n\tmy $p1 = ($bits_16_31<<16) + $bits_00_15;\n\tmy $p2 = $bits_32_63;\n\t# print \"mul $n1 x $n2 = $p2, $p1\\n\";\n\t($p2, $p1);\n}\n\n# p2*b+p1 = (q2*d+r2)*(q3*d+r3) + q1*d+r1 = \n# q2*q3*d^2 + q2*r3*d + r2*q3*d + r2*r3 + q1*d + r1\n# (q2*q3*d + q2*r3 + r2*q3 + q1) * d + (r2*r3 + r1)\nsub div {\n\tmy ($p2, $p1, $d) = @_;\n\tmy $b = 0xffff_ffff;\n\tmy ($q1, $r1) = (int($p1/10), $p1%10);\n\tmy ($q2, $r2) = (int($p2/10), $p2%10);\n\tmy ($q3, $r3) = (int($b/10), $b%10 + 1);\n\tmy ($divp2, $divp1, $divr);\n\t($divp2, $divp1) = mul($q2, $q3 * $d);\n\t($divp2, $divp1) = add($divp2, $divp1, $q2 * $r3);\n\t($divp2, $divp1) = add($divp2, $divp1, $r2 * $q3);\n\t($divp2, $divp1) = add($divp2, $divp1, $q1);\n\t$divr = $r2 * $r3 + $r1;\n\tif ($divr >= 10) {\n\t\t$divr -= 10;\n\t\t$divp1++;\n\t}\n\t# print \"div ($p2, $p1) / $d = ($divp2, $divp1) + $divr\\n\";\n\t($divp2, $divp1, $divr);\n}\n\n# 10^15 = 232830*2^32+2764472320\n# 10^14 = 23283*2^32+ 276447232\n# div(232830, 2764472320, 10);\n\n# 2^32 + 1234 = 4294968530 = (1, 1234)\n# 2^32/10 = (0, 429496853, 0)\n# div(1, 1234, 10);\n\nsub itoa {\n\tmy ($p2, $p1) = @_;\n\tmy ($s, $r);\n\twhile ($p2 || $p1) {\n\t\t($p2, $p1, $r) = div($p2, $p1, 10);\n\t\t$s = substr(\"0123456789\", $r, 1).$s;\n\t\t# print \"p2=$p2 p1=$p1 s=$s\\n\";\n\t}\n\t$s;\n}\n\n__DATA__\n2147483648 2147483648 1 4611686018427387904\n6 6 4 4\n"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%lf\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}, {"source_code": "$input = ;\n@x=split(\" \",$input);\n$n=$x[0]; $m=$x[1]; $a=$x[2];\n$h=int($n/$a);\n$w=int($m/$a);\n\nif($n%$a != 0){\n\t$h++;\n}\nif($m%$a != 0){\n\t$w++;\n}\n$ans=$h*$w;\nprintf \"$ans\\n\";\n\n\n"}, {"source_code": "\nuse bigint;\n\nmy $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ / $a ) } $m, $n;\n\nprintf \"%d\\n\", $dn * $dm;\n\nsub ceil {\n my ( $x ) = @_;\n return 1 if $x < 1;\n return int( $x ) < $x ? int($x) + 1 : int $x;\n}\n"}, {"source_code": "my @a = split \" \", <>;\nprint (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0)));"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%lld\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}, {"source_code": "my $data = ;\nmy (@data) = split (\" \", $data);\n\nmy $n = shift (@data);\nmy $m = shift (@data);\nmy $a = shift (@data);\n\nmy $ma = $m/$a;\nmy $na = $n/$a;\n\nif (int($ma) != $ma) {\n $ma = int($ma) +1; \n}\n\nif (int($na) != $na) {\n $na = int($na) +1; \n}\n\n$x = $ma*$na;\nprint $x;\n"}, {"source_code": "#!/usr/bin/perl\n\n$input_line = ;\nchop($input_line);\n($n,$m,$a)=split(/ /,$input_line);\n$ni = int($n/$a);\n$mi = int($m/$a);\n$i = $ni*$mi;\n$size = ($n*$m)-($i*$a*$a);\nif($n==($ni*$a)){$nii=0}else{$nii=1}\nif($m==($mi*$a)){$mii=0}else{$mii=1}\n\nif ($size == ($n*$m)) {$i++;}\nelsif ($size != 0){$i += ($ni*$nii+$mi*$mii+1);\nif (($nii == 0)||($mii == 0)){$i--;}}\nprint(\"$i\\n\");"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\nuse integer;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "use strict;\nuse Data::Dumper;\nuse POSIX;\n\nmy $input = <>;\n\nmy ($n, $m, $a) = split(/ /, $input);\n\nprint paveSquare($n, $m, $a);\n\nsub paveSquare {\n\tmy ($n, $m, $a) = @_;\n\tmy $counter = 0;\n\n\tif ($n > $m) {\n\t\tmy $k = $n;\n\t\t$n = $m;\n\t\t$m = $k;\n\t}\n\tmy $remain = $m - $n;\n\t$counter += ceil($n / $a);\n\twarn $counter;\n\t$counter *= ceil($m / $a);\n\treturn int($counter);\n}"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "use bigint;\n\nsub ceil {\n if ( @_[0] > (int @_[0]) ) {\n\treturn (int ( @_[0] ) + 1); }\n else {\n\treturn ( @_[0] ) }\n}\n\nmy $f = ;\nmy $one;\nmy $two;\nmy $thr;\n\nif ( $f =~ m/(\\d)+ (\\d)+ (\\d)+/ ) {\n $one = $1;\n $two = $2;\n $thr = $3; }\n\nmy $ans = &ceil ( $one / $thr ) * &ceil ( $two / $thr );\nprint $ans . \"\\n\";\n\n\n\n"}, {"source_code": "chmod($line = <>);\n($n, $m, $a) = split(' ', $line);\nprint (int(($n + $a - 1) / $a) + int(($m + $a - 1) / $a));"}, {"source_code": "my $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ / $a ) } $m, $n;\n\nprintf \"%d\\n\", $dn * $dm;\n\nsub ceil {\n my ( $x ) = @_;\n return 1 if $x < 1;\n return int( $x ) < $x ? int($x) + 1 : int $x;\n}\n"}, {"source_code": "my $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ / $a ) } $m, $n;\n\nprintf \"%d\\n\", $dn * $dm;\n\nsub ceil {\n my ( $x ) = @_;\n return 1 if $x < 1;\n return int( $x ) < $x ? int($x) + 1 : int $x;\n}\n"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$answer = ($n*$m)/($a*$a);\nprint \"$answer\";"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$answer = ($n*$m)/($a*$a);\nprint \"$answer\";"}, {"source_code": "#!/usr/bin/perl\n\n$_ = <>;\n@a = split;\n$n = ($a[0] / $a[2]);\n$x = ($a[1] / $a[2]);\nif($a[0] % $a[2] != 0){\n $n++;\n}\nif($a[1] % $a[2] != 0){\n $x++;\n}\n$k = int($x) * int($n);\nprint \"$k\";"}, {"source_code": "\nsub ceil {\n if ( @_[0] > (int @_[0]) ) {\n\treturn (int ( @_[0] ) + 1); }\n else {\n\treturn ( @_[0] ) }\n}\n\nmy $f = ;\nmy $one;\nmy $two;\nmy $thr;\n\nif ( $f =~ m/(\\d)+ (\\d)+ (\\d)+/ ) {\n $one = $1;\n $two = $2;\n $thr = $3; }\n\nmy $ans = &ceil ( $one / $thr ) * &ceil ( $two / $thr );\nprint $ans . \"\\n\";\n\n\n\n"}, {"source_code": "my($n, $m, $a) = split(\" \", );\nprint int(($n + $a -1) / $a) * int(($m + $a -1) / $a);"}, {"source_code": "use POSIX(ceil);\n$_ = <>;\n@a = split;\nprintf \"%lli\\n\", ceil($a[0] / $a[2]) * ceil($a[1] / $a[2]);"}, {"source_code": "use strict;\nuse warnings;\n\n#use POSIX qw(ceil);\n\nmy $input = <>;\nmy ($n, $m, $a) = split ' ', $input;\n\n# cover n x m meters with ? number of stones of size a x a.\n# calculate how many stones needed in n direction and then in m direction.\n\nmy $n_stones = int( $n / $a + 0.999999999999 );\nmy $m_stones = int( $m / $a + 0.999999999999 );\nmy $needed_stones = $n_stones * $m_stones;\n\nprint \"$needed_stones\\n\";\n\n"}, {"source_code": "while() {\n my($n, $m, $a) = split(\" \", $_);\n print int(($n + $a -1) / $a) * int(($m + $a -1) / $a);\n}"}, {"source_code": "#!/usr/bin/perl\nuse POSIX;\n$_ = <>;\ns/(\\d+).(\\d+).(\\d+)/ceil($1\\/$3)*ceil($2\\/$3)/e;\nprint;\n"}, {"source_code": "use strict;\nuse warnings;\n\nuse Data::Dumper;\n\nmy $line = ;\n\nmy ($n, $m, $a) = split(/\\s+/, $line);\n\n$n += $n % $a ? $a - $n % $a : 0;\n$m += $m % $a ? $a - $m % $a : 0;\n\nprint (($n/$a) * ($m/$a));\nprint \"\\n\";\n"}, {"source_code": " $_ = <>;\n my @arr = split/\\s+/;\n #print @arr;\n my $tiles1 = 0;\n my $tiles2 = 0;\n { \n use integer;\n $tiles1 += $arr[0]/$arr[2];\n $tiles2 += $arr[1]/$arr[2];\n }\n if ($arr[0]%$arr[2] != 0) {\n $tiles1 += 1;\n }\n if ($arr[1]%$arr[2] != 0) {\n #$tiles += 1;\n }\n my $tiles = $tiles1*$tiles2;\n print \"$tiles\\n\";\n exit 0;\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n#use POSIX qw(ceil);\n\n#my ($m, $n, $a) = ($ARGV[0], $ARGV[1], $ARGV[2]); #(7,6,4);\nmy $userinput = ; #read stdin and put it in $userinput\nchomp ($userinput); #cut the return / line feed character\nmy ($m, $n, $a) = split(/\\s+|,/, $userinput);\n\nmy $add = ($m%$a>0)?1:0;\nmy $ret = int($m/$a + $add) * int($n/$a + $add);\nprintf \"%.0f\", $ret;\n\n"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$c1 = ($n%$a);\n$c2 = ($m%$a);\n\nif ($c1 eq 0)\n{$miss1 = 0;}\nelse\n{$miss1 =$a-($n%$a);}\n\nif ($c2 eq 0)\n{$miss2 = 0;}\nelse\n{$miss2 =$a-($m%$a);}\n\n$answer = (($n+$miss1)/$a)*(($m+$miss2)/$a);\nprint \"$answer\";"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "use bigint;\nmy ($n, $m, $a) = split \" \",<>;\nprint (($n + $a - 1) / $a * ($m + $a - 1) / $a);"}, {"source_code": "my $input = do { local $/; scalar <> };\nmy ($n, $m, $a) = split /\\s+/s, $input;\n\nmy ($dm, $dn) = map { ceil( $_ / $a ) } $m, $n;\n\nprintf \"%d\\n\", $dn * $dm;\n\nsub ceil {\n my ( $x ) = @_;\n return 1 if $x < 1;\n return int( $x ) < $x ? int($x) + 1 : int $x;\n}\n"}, {"source_code": "($n, $m, $a) = split \" \", <>;\n$x = int($n/$a);\n$y = int($m/$a);\nif ($n % $a != 0)\n{\n\t$x = $x + 1;\n}\nif ($m % $a != 0)\n{\n\t$y = $y + 1;\n}\n$res = $x * $y;\nprintf \"%d\\n\", $res;"}, {"source_code": "#!/usr/bin/perl\nuse POSIX;\nuse bigint;\n@l = split ' ', <>;\n$m = ceil($l[0]/$l[2]);\n$n = ceil($l[1]/$l[2]);\n$\" = $m*$n;\nprint $\";\n"}, {"source_code": "#!/usr/bin/perl\nuse integer;\n($n,$m,$a)=split' ',<>;\n$c1 = ($n%$a);\n$c2 = ($m%$a);\n\nif ($c1 eq 0)\n{$miss1 = 0;}\nelse\n{$miss1 =$a-($n%$a);}\n\nif ($c2 eq 0)\n{$miss2 = 0;}\nelse\n{$miss2 =$a-($m%$a);}\n\n$answer = (($n+$miss1)/$a)*(($m+$miss2)/$a);\nprint \"$answer\";"}, {"source_code": "no bigint;\nuse strict;\n\nmain();\n\nsub main {\n\tmy $input = $ENV{PERLUSER} eq \"s_p\"? \\*DATA: \\*STDIN;\n\tfor (<$input>) {\n\t\tmy ($n, $m, $a, $nm) = split;\n\t\t$n = int($n / $a) + ($n % $a? 1: 0);\n\t\t$m = int($m / $a) + ($m % $a? 1: 0);\n\t\tprint defined($nm)? \n\t\t\t[qw(fail ok)]->[itoa(mul($n, $m)) eq $nm]: \n\t\t\titoa(mul($n, $m)), \"\\n\";\n\t}\n}\n\nsub add {\n\tmy ($p2, $p1, $add) = @_;\n\tmy $addok = 0xffff_ffff - $p1;\n\t$add <= $addok? \n\t\t($p2, $p1 + $add):\n\t\t($p2 + 1, $add - $addok - 1);\n}\n\n# b=2^16, n1=q1*b+r1, n2=q2*b+r2\n# n1*n2=(q1*b+r1)(q2*b+r2)=q1*q2*b^2 + q1*r2*b + q2*r1*b + r1*r2\nsub mul {\n\tmy ($n1, $n2) = @_;\n\tmy $B16 = 0xffff;\n\tmy ($q1, $r1) = ($n1>>16, $n1 & $B16);\n\tmy ($q2, $r2) = ($n2>>16, $n2 & $B16);\n\tmy ($tmp, $bits_00_15, $bits_16_31, $bits_32_63);\n\t$tmp = $r1 * $r2;\n\t$bits_00_15 = $tmp & $B16;\n\t$tmp = $q1 * $r2 + $q2 * $r1 + ($tmp>>16);\n\t$bits_16_31 = $tmp & $B16;\n\t$bits_32_63 = $q1 * $q2 + ($tmp>>16);\n\tmy $p1 = ($bits_16_31<<16) + $bits_00_15;\n\tmy $p2 = $bits_32_63;\n\t# print \"mul $n1 x $n2 = $p2, $p1\\n\";\n\t($p2, $p1);\n}\n\n# p2*b+p1 = (q2*d+r2)*(q3*d+r3) + q1*d+r1 = \n# q2*q3*d^2 + q2*r3*d + r2*q3*d + r2*r3 + q1*d + r1\n# (q2*q3*d + q2*r3 + r2*q3 + q1) * d + (r2*r3 + r1)\nsub div {\n\tmy ($p2, $p1, $d) = @_;\n\tmy $b = 0xffff_ffff;\n\tmy ($q1, $r1) = (int($p1/10), $p1%10);\n\tmy ($q2, $r2) = (int($p2/10), $p2%10);\n\tmy ($q3, $r3) = (int($b/10), $b%10 + 1);\n\tmy ($divp2, $divp1, $divr);\n\t($divp2, $divp1) = mul($q2, $q3 * $d);\n\t($divp2, $divp1) = add($divp2, $divp1, $q2 * $r3);\n\t($divp2, $divp1) = add($divp2, $divp1, $r2 * $q3);\n\t($divp2, $divp1) = add($divp2, $divp1, $q1);\n\t$divr = $r2 * $r3 + $r1;\n\t$divp1 += int($divr/10);\n\t$divr = $divr % 10;\n\t# print \"div ($p2, $p1) / $d = ($divp2, $divp1) + $divr\\n\";\n\t($divp2, $divp1, $divr);\n}\n\n# 10^15 = 232830*2^32+2764472320\n# 10^14 = 23283*2^32+ 276447232\n# div(232830, 2764472320, 10);\n\n# 2^32 + 1234 = 4294968530 = (1, 1234)\n# 2^32/10 = (0, 429496853, 0)\n# div(1, 1234, 10);\n\nsub itoa {\n\tmy ($p2, $p1) = @_;\n\tmy ($s, $r);\n\twhile ($p2 || $p1) {\n\t\t($p2, $p1, $r) = div($p2, $p1, 10);\n\t\t$s = substr(\"0123456789\", $r, 1).$s;\n\t\t# print \"p2=$p2 p1=$p1 r=$r s=$s\\n\";\n\t}\n\t$s;\n}\n\n__DATA__\n2147483648 2147483648 1 4611686018427387904\n6 6 4 4\n"}, {"source_code": "<>;for(<>){s/(?<=.).{9,}(?=.)/(length)-3/e;print}\n"}, {"source_code": "use strict;\nuse warnings;\n\nuse Data::Dumper;\n\nmy $line = ;\n\nmy ($n, $m, $a) = split(/\\s+/, $line);\n\n$n += $n % $a ? $a - $n % $a : 0;\n$m += $m % $a ? $a - $m % $a : 0;\n\nprint (($n/$a) + ($m/$a));\nprint \"\\n\";\n"}, {"source_code": "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\nuse integer;\n\nmy $line = ;\n\nmy ($height, $width, $a);\nif ($line =~ /(\\d+) (\\d+) (\\d+)/) {\n\t$height = $1;\n\t$width = $2;\n\t$a = $3;\n}\nprint (($height / $a) + 1 + ($width / $a) + 1);\n"}, {"source_code": "use bigint;\n\nsub ceil {\n if ( @_[0] > (int @_[0]) ) {\n\treturn (int ( @_[0] ) + 1); }\n else {\n\treturn ( @_[0] ) }\n}\n\nmy $f = ;\nmy $one;\nmy $two;\nmy $thr;\n\nif ( $f =~ m/(\\d)+ (\\d)+ (\\d)+/ ) {\n $one = $1;\n $two = $2;\n $thr = $3; }\n\nmy $ans = &ceil ( $one / $thr ) * &ceil ( $two / $thr );\nprint $ans . \"\\n\";\n\n\n\n"}, {"source_code": "use strict;\nuse warnings;\n\n#use POSIX qw(ceil);\n\nmy $input = <>;\nmy ($n, $m, $a) = split ' ', $input;\n\n# cover n x m meters with ? number of stones of size a x a.\n# calculate how many stones needed in n direction and then in m direction.\n\nmy $n_stones = ( $n / $a ) + ( $n % $a > 0 ? 1 : 0 );\nmy $m_stones = ( $m / $a ) + ( $n % $a > 0 ? 1 : 0 );\nmy $needed_stones = int($n_stones) * int($m_stones);\n\nprint \"$needed_stones\\n\";\n\n"}, {"source_code": "#!/usr/bin/env perl \n#===============================================================================\n# FILE: theatre.pl\n# AUTHOR: Phoenix Ikki (liuxueyang.github.io), liuxueyang457@gmail.com\n# ORGANIZATION: Hunan University\n# CREATED: 05/25/2015 07:53:32 PM\n#===============================================================================\n\nuse strict;\nuse warnings;\nuse utf8;\nuse 5.012;\n\nchomp($_ = );\nmy ($n, $m, $a) = split;\n\nprint int(cal($n, $a) * cal($m, $a)) . \"\\n\";\nsub cal\n{\n my ($m, $a) = @_;\n int($m / $a) + ($m % $a == 0 ? 0 : 1);\n}\n\n\n"}, {"source_code": "($n, $m, $k) = split(' ', <>);\n$ans = int($n / $k + 0.99) * int($m / $k + 0.99);\nprint $ans == 0 ? 1 : $ans;\n"}, {"source_code": "use strict;\nuse warnings;\nuse utf8;\n\nmy $stdin=;\nchomp($stdin);\nmy @in=split(\" \", $stdin);\n\nmy $h=int($in[0]/$in[2]);\n$h++\tunless($in[0]%$in[2]==0);\n\nmy $w=int($in[1]/$in[2]);\n$w++\tunless($in[1]%$in[2]==0);\n\nprint $h * $w.\"\\n\";\n\n"}, {"source_code": "#!/usr/bin/perl\n\n$input_line = ;\nchop($input_line);\n($n,$m,$a)=split(/ /,$input_line);\n$ni = int($n/$a);\n$mi = int($m/$a);\n$i = $ni*$mi;\n$size = ($n*$m)-($i*$a);\nif ($size != 0){$i += ($ni+$mi+1);}\nprint(\"$i\\n\");"}, {"source_code": "use strict;\nuse warnings;\n\n#use POSIX qw(ceil);\n\nmy $input = <>;\nmy ($n, $m, $a) = split ' ', $input;\n\n# cover n x m meters with ? number of stones of size a x a.\n# calculate how many stones needed in n direction and then in m direction.\n\nmy $n_stones = ( $n / $a ) + ( $n % $a > 0 ? 1 : 0 );\nmy $m_stones = ( $m / $a ) + ( $n % $a > 0 ? 1 : 0 );\nmy $needed_stones = int($n_stones) * int($m_stones);\n\nprint \"$needed_stones\\n\";\n\n"}, {"source_code": "chmod($line = <>);\n($n, $m, $a) = split(' ', $line);\n$res = int(int(($n + $a - 1) / $a) * int(($m + $a - 1) / $a));\nprint (\"$res\");\n"}, {"source_code": "#!perl\n\n#use strict;\n#use warnings;\n\nmy $n;\nmy $m;\nmy $a;\nwhile (<>) {\n chomp;\n ($n, $m, $a) = split(/ /);\n last;\n}\n\nmy $r1 = sprintf(\"%.0f\", $n/$a);\nmy $r2 = sprintf(\"%.0f\", $m/$a);\nmy $area = $r1 * $r2;\n$area = 1 if ($area < 1);\nprint \"$area\\n\";\n\nexit(0);"}, {"source_code": "my ($n,$m,$a) = split (' ',);\nif ($n % $a != 0) {\n\t$n = int($n / $a) + 1;\n} else {\n\t$n = $n / $a;\n}\nif ($m % $a != 0) {\n\t$m = int($m / $a) + 1;\n} else {\n\t$m = $m / $a;\n}\nprint $m*$n;"}, {"source_code": "chmod($line = <>);\n($n, $m, $a) = split(' ', $line);\nprint (int(($n + $a - 1) / $a) * int(($m + $a - 1) / $a));"}, {"source_code": "my @a = split \" \", <>;\nprintf (\"%Ld\\n\", (((int $a[0] / $a[2]) + ($a[0] % $a[2] > 0)) * ((int $a[1] / $a[2]) + ($a[1] % $a[2] > 0))));"}], "src_uid": "ef971874d8c4da37581336284b688517"} {"source_code": "use bigint;\nwhile(<>){\n\t($a,$b,$c)=sort {$b<=>$a} split/ /;\n\t$m=$a-$b;\n\t$m>$b-$c and $m=$b-$c;\n\t$sum=0;\n\t$sum+=$m;\n\t$a-=$m*2;\n\t$b-=$m;\n\t\n\tif ($a!=$b){\n\t\t$m= ($a-$b) / 3;\n\t\t$b < $m and $m=$b;\n\t\t$sum+=$c+$m;\n\t\t}\n\telse {\n\t\t$sum += ($a+$b+$c) / 3;\n\t\t}\n\tprint \"$sum\\n\"\n\t}", "positive_code": [{"source_code": "use List::Util qw(min max sum);\n\nuse bigint;\n\nmy @cnt = split / /, <>;\n@cnt = sort {$a <=> $b} @cnt;\n$ans = int (($cnt[0] + $cnt[1] + (min ($cnt[2], 2 * ($cnt[0] + $cnt[1])))) / 3);\nprint $ans, \"\\n\";"}, {"source_code": "use bigint;\nuse integer;\nwhile(<>){\n\tchomp;\n\t($a,$b,$c)=@_=sort {$b<=>$a} split/ /;\n\t$m=($a-$b);\n\t$m>($b-$c) and $m=$b-$c;\n\t$sum=0;\n\t$sum+=$m;\n\t$a-=$m*2;\n\t$b-=$m;\n#\tprint \"$a $b $c|$sum\\n\";\n\t\n\tif ($a!=$b){\n\t\t$m= ($a-$b) / 3;\n\t\t$b < $m and $m=$b;\n\t\t\n\t\t$sum+=$m*2;\n\t\t$a-= $m*4;\n\t\t$b-=$m;\n\t\t$c-=$m;\n\t\t\n\t\t\n\t#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t\n\t\t$sum+=$c;\n\t\t$a-=$c;\n\t\t$b-=$c;\n\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t}\n\t\n\telse {\n#\t\t$m = ($a-$c)/3;\n#\t\t$a -= $m*3;\n#\t\t$b -= $m*3;\n#\t\t$sum += $m*2;\n\t\t\n#\t\t$sum+=$c;\n#\t\t$a-=$c;\n#\t\t$b-=$c;\n#\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t$sum += ($a+$b+$c) / 3;\n\t\t\n\t\t}\nprint \"$sum\\n\"\t\n\t\n\t}"}], "negative_code": [{"source_code": "use List::Util qw(min max);\n\nuse bigint;\nuse integer;\n\nmy @cnt = split / /, <>;\n@cnt = sort {$a <=> $b} @cnt;\nmy $ans = $cnt[0];\n$cnt[1] -= $cnt[0];\n$cnt[2] -= $cnt[0];\n$ans += min ($cnt[1], $cnt[2], ($cnt[1] + $cnt[2]) / 3);\nprint $ans, \"\\n\";"}, {"source_code": "use List::Util qw(min max);\n\nuse bigint;\nuse integer;\n\nmy @cnt = split / /, <>;\n@cnt = sort @cnt;\nmy $ans = $cnt[0];\n$cnt[1] -= $cnt[0];\n$cnt[2] -= $cnt[0];\n$ans += min ($cnt[1], $cnt[2] / 2);\nprint $ans, \"\\n\";"}, {"source_code": "use List::Util qw(min max);\n\nuse bigint;\nuse integer;\n\nmy @cnt = split / /, <>;\n@cnt = sort @cnt;\nmy $ans = $cnt[0];\n$cnt[1] -= $cnt[0];\n$cnt[2] -= $cnt[0];\n$ans += min ($cnt[1], $cnt[2], ($cnt[1] + $cnt[2]) / 3);\nprint $ans, \"\\n\";"}, {"source_code": "use List::Util qw(min max sum);\n\nuse bigint;\nuse integer;\n\nmy @cnt = split / /, <>;\n@cnt = sort {$a <=> $b} @cnt;\n$ans = ($cnt[0] + $cnt[1] + (min ($cnt[2], 2 * ($cnt[0] + $cnt[1])))) / 3;\nprint $ans, \"\\n\";"}, {"source_code": "use List::Util qw(min max sum);\n\nuse bigint;\nuse integer;\n\nmy @cnt = split / /, <>;\n@cnt = sort {$a <=> $b} @cnt;\n$cnt[2] = min ($cnt[2], 2 * ($cnt[0] + $cnt[1]));\n$ans = (sum @cnt) / 3;\nprint $ans, \"\\n\";"}, {"source_code": "use bigint;\nuse integer;\nwhile(<>){\n\tchomp;\n\t($a,$b,$c)=@_=sort {$b<=>$a} split/ /;\n\tprint \"@_\\n\";\n\t$m=($a-$b);\n\t$m>($b-$c) and $m=$b-$c;\n\t$sum=0;\n\t$sum+=$m;\n\t$a-=$m*2;\n\t$b-=$m;\n#\tprint \"$a $b $c|$sum\\n\";\n\t\n\tif ($a!=$b){\n\t\t$m= ($a-$b) / 3;\n\t\t$b < $m and $m=$b;\n\t\t\n\t\t$sum+=$m*2;\n\t\t$a-= $m*4;\n\t\t$b-=$m;\n\t\t$c-=$m;\n\t\t\n\t\t\n\t#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t\n\t\t$sum+=$c;\n\t\t$a-=$c;\n\t\t$b-=$c;\n\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t}\n\t\n\telse {\n\t\t$m = ($a-$c)/3;\n\t\t$a -= $m*3;\n\t\t$b -= $m*3;\n\t\t$sum += $m*2;\n\t\t\n\t\t$sum+=$c;\n\t\t$a-=$c;\n\t\t$b-=$c;\n\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t\n\t\t}\nprint \"$sum\\n\"\t\n\t\n\t}"}, {"source_code": "use bigint;\nuse integer;\nwhile(<>){\n\tchomp;\n\t($a,$b,$c)=@_=sort {$b<=>$a} split/ /;\n\t$m=($a-$b);\n\t$m>($b-$c) and $m=$b-$c;\n\t$sum=0;\n\t$sum+=$m;\n\t$a-=$m*2;\n\t$b-=$m;\n#\tprint \"$a $b $c|$sum\\n\";\n\t\n\tif ($a!=$b){\n\t\t$m= ($a-$b) / 3;\n\t\t$b < $m and $m=$b;\n\t\t\n\t\t$sum+=$m*2;\n\t\t$a-= $m*4;\n\t\t$b-=$m;\n\t\t$c-=$m;\n\t\t\n\t\t\n\t#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t\n\t\t$sum+=$c;\n\t\t$a-=$c;\n\t\t$b-=$c;\n\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t}\n\t\n\telse {\n\t\t$m = ($a-$c)/3;\n\t\t$a -= $m*3;\n\t\t$b -= $m*3;\n\t\t$sum += $m*2;\n\t\t\n\t\t$sum+=$c;\n\t\t$a-=$c;\n\t\t$b-=$c;\n\t\t$c-=$c;\n#\t\tprint \"$a $b $c|$sum\\n\";\n\t\t\n\t\t}\nprint \"$sum\\n\"\t\n\t\n\t}"}], "src_uid": "bae7cbcde19114451b8712d6361d2b01"} {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\n\nmy ($n, $k) = split ' ',<>;\nmy @input = split ' ', <>;\nmy @data;\nfor my $i(0..@input-1){\n push @data, [$input[$i], $i+1];\n}\n@data = sort {$a->[0] <=> $b->[0]} @data;\nmy ($sum,@res) = (0,());\nforeach(@data){\n last if $sum + $_->[0] > $k;\n $sum += $_->[0];\n push @res, $_->[1];\n}\nprint scalar @res , \"\\n@res\";\n", "positive_code": [{"source_code": "my($n, $k) = split / /, <>;\nmy @inp = split \" \", <>;\nmy $num = 0;\nmy @ans = ();\nmy @arr = ();\nfor (0..$n-1) {\n push @arr, [$inp[$_], $_+1];\n}\n@arr = sort{$a->[0] <=> $b->[0]} @arr;\nfor (@arr) {\n last if ($k - $_->[0] < 0);\n $k -= $_->[0];\n $num++;\n push @ans, $_->[1];\n}\nprint \"$num\\n@ans\\n\";\n"}, {"source_code": "#!/usr/bin/perl\nuse v5.10;\n\n($n, $k) = split / /, <>;\n@buf = split / /, <>;\npush @arr, [($_, $buf[$_-1])] foreach (1..$n);\n@arr = sort { $a->[1] <=> $b->[1] } @arr;\n$tmp = 0;\nforeach my $i (0..$n-1) {\n\t$tmp += $arr[$i]->[1];\n\tif ($tmp > $k) {\n\t\tsay $i;\n\t\tprint $arr[$_]->[0],\" \" foreach (0..$i-1);\n\t\texit;\n\t}\n}\nsay $n;\nprint $arr[$_]->[0],\" \" foreach (0..$n-1);"}], "negative_code": [{"source_code": "#!/usr/bin/perl\nuse v5.10;\n\n($n, $k) = split / /, <>;\n@buf = split / /, <>;\npush @arr, [($_, $buf[$_-1])] foreach (1..$n);\n@arr = sort { $a->[1] <=> $b->[1] } @arr;\n$tmp = 0;\nforeach my $i (0..$n-1) {\n\t$tmp += $arr[$i]->[1];\n\tif ($tmp >= $k) {\n\t\tsay $i;\n\t\tprint $arr[$_]->[0],\" \" foreach (0..$i-1);\n\t\texit;\n\t}\n}\nsay $n;\nprint $arr[$_]->[0],\" \" foreach (0..$n-1);"}], "src_uid": "dbb164a8dd190e63cceba95a31690a7c"} {"source_code": "for(1..<>){$_=<>;@a=split/\\s/,<>;print$_^@a[$_-1]^@a[@a[$_-1]-1]?\"NO \":\"YES \"}", "positive_code": [{"source_code": "for(1..<>){$_=<>;@a=split/\\s/,<>;print$_^@a[$_-1]^@a[@a[$_-1]-1]?\"NO \":\"YES \"}"}, {"source_code": "for(1..<>){$_=<>;@a=split/\\s/,<>;print$_^@a[$_-1]^@a[@a[$_-1]-1]?\"NO \":\"YES \"}"}, {"source_code": "for(1..<>){$_=<>;@a=split/\\s/,<>;print$_^@a[$_-1]^@a[@a[$_-1]-1]?\"NO \":\"YES \"}\r\n"}], "negative_code": [], "src_uid": "5cd113a30bbbb93d8620a483d4da0349"} {"source_code": "<>;\n\nmap $h{ $_ } ++, grep $_, split ' ', <>;\n\nprint 0 + keys %h", "positive_code": [{"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nmy $min1 = 1000000000;\nmy $min2 = 1000000000;\nmy $max1 = 0;\nmy $max2 = 0;\n\nmy $n = <>;\n$n =~ s/\\s+$//;\n\nmy $a = <>;\n$a =~ s/\\s+$//;\nmy @a = split /\\s+/, $a;\nmy %h;\nmy $ans = 0;\n\nfor my $x (@a) {\n if ($x != 0) {\n if (!exists $h{$x}) {\n $h{$x}++;\n $ans++;\n }\n }\n}\nprint $ans;\n\n"}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\t\n\tmy %h;\n\t\n\tmap $h{ $_ } ++, grep $_ > 0, split ' ', <>;\n\t\n\tprint 0 + keys %h;\n\t}"}, {"source_code": "<>;\n$_ = <>;\n0 while s/\\b(\\d+)\\b.*\\K \\1\\b//;\nprint ~~ grep $_, split"}], "negative_code": [], "src_uid": "3b520c15ea9a11b16129da30dcfb5161"} {"source_code": "( $p, $x, $y ) = split ' ', <>;\n\n$_ = $x;\n\n$_ -= 50 while $_ >= $y;\n\t\nwhile( 1 ){\n\t$_ += 50;\n\tmy %P;\n\t$i = $_ / 50 % 475;\n\t++ $P{ 26 + ( $i = ( $i * 96 + 42 ) % 475 ) } for 1 .. 25;\n\t\t\n\tlast if $P{ $p };\n\t}\n\t\n( $_ -= $x ) /= 50;\n\nprint $_ > 0 ? $_ + 1 >> 1 : 0", "positive_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nwhile(<>){\n\tmy( $p, $x, $y ) = split;\n\t\n\tmy $xc = $x;\n\t\n\twhile( $xc - 50 >= $y ){\n\t\t$xc -= 50;\n\t\t}\n\t\t\n\twhile( 1 ){\n\t\tmy %print;\n\t\tmy $i = ( int $xc / 50 ) % 475;\n\t\tfor ( 1 .. 25 ){\n\t\t\t$i = ( $i * 96 + 42 ) % 475;\n\t\t\t$print{ 26 + $i } ++;\n\t\t\t}\n\t\t\t\n\t\tif( $print{ $p } ){\n\t\t\tlast;\n\t\t\t}\n\t\t$xc += 50;\n\t\t}\n\t\t\n\t$xc -= $x;\n\t$xc /= 50;\n\t\n\tprint $xc <= 0 ? 0 : int( ($xc + 1) / 2 );\n\t\n\t}"}], "negative_code": [], "src_uid": "c9c22e03c70a94a745b451fc79e112fd"} {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\n=pot\n1 George and Martha Washington\n2 John and Abigail Adams\n3 Thomas Jefferson\n4 James and Dolley Madison\n5 James and Elizabeth Monroe\n6 John Quincy and Louisa Adams\n7 Andrew and Rachel Jackson\n8 Martin and Hannah Van Buren\n9 William and Anna Harrison\n10 John Tyler\n11 James and Sarah Polk\n12 Zachary and Margaret Taylor\n13 Millard and Abigail Fillmore\n14 Franklin and Jane Pierce\n15 James Buchanan\n16 Abraham and Mary Lincoln\n17 Andrew and Eliza Johnson\n18 Ulysses and Julia Grant\n19 Rutherford and Lucy Hayes\n20 James and Lucretia Garfield\n21 Chester and Ellen Arthur\n22 Grover Cleveland and Maria Halpin\n23 Benjamin Harrison\n24 Grover and Frances Cleveland\n25 William and Ida McKinley\n26 Theodore Roosevelt\n27 William and Helen Taft\n28 Woodrow and Ellen Wilson\n29 Warren G. Harding\n30 Calvin and Grace Coolidge\n31 Herbert and Lou Hoover\n32 Franklin and Eleanor Roosevelt\n33 Harry and Bess Truman\n34 Dwight and Mamie Eisenhower\n35 John and Jackie Kennedy\n36 Lyndon and Lady Bird Johnson\n37 Richard and Pat Nixon\n38 Gerald and Betty Ford\n39 Jimmy and Rosalynn Carter\n40 Ronald Reagan\n=cut\n\nmy @a = (\n 'Washington',\n 'Adams',\n 'Jefferson',\n 'Madison',\n 'Monroe',\n 'Adams',\n 'Jackson',\n 'Van Buren',\n 'Harrison',\n 'Tyler',\n 'Polk',\n 'Taylor',\n 'Fillmore',\n 'Pierce',\n 'Buchanan',\n 'Lincoln',\n 'Johnson',\n 'Grant',\n 'Hayes',\n 'Garfield',\n 'Arthur',\n 'Cleveland',\n 'Harrison',\n 'Cleveland',\n 'McKinley',\n 'Roosevelt',\n 'Taft',\n 'Wilson',\n 'Harding',\n 'Coolidge',\n 'Hoover',\n 'Roosevelt',\n 'Truman',\n 'Eisenhower',\n 'Kennedy',\n 'Johnson',\n 'Nixon',\n 'Ford',\n 'Carter',\n 'Reagan',\n);\n\nchomp($_ = <>);\nprint $a[$_ - 1];\n", "positive_code": [{"source_code": "@_=split/,/,'\"Washington\", \"Adams\", \"Jefferson\", \"Madison\", \"Monroe\", \"Adams\", \"Jackson\", \"Van Buren\", \"Harrison\", \"Tyler\", \"Polk\", \"Taylor\", \"Fillmore\", \"Pierce\", \"Buchanan\", \"Lincoln\", \"Johnson\", \"Grant\", \"Hayes\", \"Garfield\", \"Arthur\", \"Cleveland\", \"Harrison\", \"Cleveland\", \"McKinley\", \"Roosevelt\", \"Taft\", \"Wilson\", \"Harding\", \"Coolidge\", \"Hoover\", \"Roosevelt\", \"Truman\", \"Eisenhower\", \"Kennedy\", \"Johnson\", \"Nixon\", \"Ford\", \"Carter\", \"Reagan\"';\n$_=$_[<>-1];\ns/^\\W*|\\W*$//g;\nprint;\nprint \"\\n\""}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\n=pot\n1 George and Martha Washington\n2 John and Abigail Adams\n3 Thomas Jefferson\n4 James and Dolley Madison\n5 James and Elizabeth Monroe\n6 John Quincy and Louisa Adams\n7 Andrew and Rachel Jackson\n8 Martin and Hannah Van Buren\n9 William and Anna Harrison\n10 John Tyler\n11 James and Sarah Polk\n12 Zachary and Margaret Taylor\n13 Millard and Abigail Fillmore\n14 Franklin and Jane Pierce\n15 James Buchanan\n16 Abraham and Mary Lincoln\n17 Andrew and Eliza Johnson\n18 Ulysses and Julia Grant\n19 Rutherford and Lucy Hayes\n20 James and Lucretia Garfield\n21 Chester and Ellen Arthur\n22 Grover Cleveland and Maria Halpin\n23 Benjamin Harrison\n24 Grover and Frances Cleveland\n25 William and Ida McKinley\n26 Theodore Roosevelt\n27 William and Helen Taft\n28 Woodrow and Ellen Wilson\n29 Warren G. Harding\n30 Calvin and Grace Coolidge\n31 Herbert and Lou Hoover\n32 Franklin and Eleanor Roosevelt\n33 Harry and Bess Truman\n34 Dwight and Mamie Eisenhower\n35 John and Jackie Kennedy\n36 Lyndon and Lady Bird Johnson\n37 Richard and Pat Nixon\n38 Gerald and Betty Ford\n39 Jimmy and Rosalynn Carter\n40 Ronald Reagan\n=cut\n\nmy @a = (\n 'Washington',\n 'Adams',\n 'Jefferson',\n 'Madison',\n 'Monroe',\n 'Adams',\n 'Jackson',\n 'Van Buren',\n 'Harrison',\n 'Tyler',\n 'Polk',\n 'Taylor',\n 'Fillmore',\n 'Pierce',\n 'Buchanan',\n 'Lincoln',\n 'Johnson',\n 'Grant',\n 'Hayes',\n 'Garfield',\n 'Arthur',\n 'Halpin',\n 'Harrison',\n 'Cleveland',\n 'McKinley',\n 'Roosevelt',\n 'Taft',\n 'Wilson',\n 'Harding',\n 'Coolidge',\n 'Hoover',\n 'Roosevelt',\n 'Truman',\n 'Eisenhower',\n 'Kennedy',\n 'Johnson',\n 'Nixon',\n 'Ford',\n 'Carter',\n 'Reagan',\n);\n\nchomp($_ = <>);\nprint $a[$_ - 1];\n"}, {"source_code": "chomp($n=<>);\n@_=split/\\n/,\" 1.1 George Washington\n 1.2 John Adams\n 1.3 Thomas Jefferson\n 1.4 James Madison\n 1.5 James Monroe\n 1.6 John Quincy Adams\n 1.7 Andrew Jackson\n 1.8 Martin Van Buren\n 1.9 William Henry Harrison\n 1.10 John Tyler\n 1.11 James K. Polk\n 1.12 Zachary Taylor\n 1.13 Millard Fillmore\n 1.14 Franklin Pierce\n 1.15 James Buchanan\n 1.16 Abraham Lincoln\n 1.17 Andrew Johnson\n 1.18 Ulysses S. Grant\n 1.19 Rutherford B. Hayes\n 1.20 James A. Garfield\n 1.21 Chester A. Arthur\n 1.22 Grover Cleveland\n 1.23 Benjamin Harrison\n 1.24 William McKinley\n 1.25 Theodore Roosevelt\n 1.26 William Howard Taft\n 1.27 Woodrow Wilson\n 1.28 Warren G. Harding\n 1.29 Calvin Coolidge\n 1.30 Herbert Hoover\n 1.31 Franklin D. Roosevelt\n 1.32 Harry S. Truman\n 1.33 Dwight D. Eisenhower\n 1.34 John F. Kennedy\n 1.35 Lyndon B. Johnson\n 1.36 Richard Nixon\n 1.37 Gerald Ford\n 1.38 Jimmy Carter\n 1.39 Ronald Reagan\n 1.40 George H. W. Bush\n 1.41 Bill Clinton\n 1.42 George W. Bush\n 1.43 Barack Obama\";\nfor (@_){\nif (/$n/){\n s/\\s*1\\.\\d+\\s\\w+\\s//;\n s/.*\\.\\s//;\n print;\n print \"\\n\";\n last\n } \n}"}, {"source_code": "@_=split/,/,'\"Washington\", \"Adams\", \"Jefferson\", \"Madison\", \"Monroe\", \"Adams\", \"Jackson\", \"Van Buren\", \"Harrison\", \"Tyler\", \"Polk\", \"Taylor\", \"Fillmore\", \"Pierce\", \"Buchanan\", \"Lincoln\", \"Johnson\", \"Grant\", \"Hayes\", \"Garfield\", \"Arthur\", \"Cleveland\", \"Harrison\", \"Cleveland\", \"McKinley\", \"Roosevelt\", \"Taft\", \"Wilson\", \"Harding\", \"Coolidge\", \"Hoover\", \"Roosevelt\", \"Truman\", \"Eisenhower\", \"Kennedy\", \"Johnson\", \"Nixon\", \"Ford\", \"Carter\", \"Reagan\"';\n$_=$_[<>-1];\ns/\\W//g;\nprint;\nprint \"\\n\""}, {"source_code": "$n=<>;\n@_=split/\\n/,\" 1.1 George Washington\n 1.2 John Adams\n 1.3 Thomas Jefferson\n 1.4 James Madison\n 1.5 James Monroe\n 1.6 John Quincy Adams\n 1.7 Andrew Jackson\n 1.8 Martin Van Buren\n 1.9 William Henry Harrison\n 1.10 John Tyler\n 1.11 James K. Polk\n 1.12 Zachary Taylor\n 1.13 Millard Fillmore\n 1.14 Franklin Pierce\n 1.15 James Buchanan\n 1.16 Abraham Lincoln\n 1.17 Andrew Johnson\n 1.18 Ulysses S. Grant\n 1.19 Rutherford B. Hayes\n 1.20 James A. Garfield\n 1.21 Chester A. Arthur\n 1.22 Grover Cleveland\n 1.23 Benjamin Harrison\n 1.24 William McKinley\n 1.25 Theodore Roosevelt\n 1.26 William Howard Taft\n 1.27 Woodrow Wilson\n 1.28 Warren G. Harding\n 1.29 Calvin Coolidge\n 1.30 Herbert Hoover\n 1.31 Franklin D. Roosevelt\n 1.32 Harry S. Truman\n 1.33 Dwight D. Eisenhower\n 1.34 John F. Kennedy\n 1.35 Lyndon B. Johnson\n 1.36 Richard Nixon\n 1.37 Gerald Ford\n 1.38 Jimmy Carter\n 1.39 Ronald Reagan\n 1.40 George H. W. Bush\n 1.41 Bill Clinton\n 1.42 George W. Bush\n 1.43 Barack Obama\";\nfor (@_){\nif (/$n/){\n s/\\s*1\\.\\d+\\s\\w+\\s//;\n s/.*\\.\\s//;\n print;\n print \"\\n\";\n last\n } \n}"}, {"source_code": "$n=<>;\n@_=split/\\n/,\" 1.1 George Washington\n 1.2 John Adams\n 1.3 Thomas Jefferson\n 1.4 James Madison\n 1.5 James Monroe\n 1.6 John Quincy Adams\n 1.7 Andrew Jackson\n 1.8 Martin Van Buren\n 1.9 William Henry Harrison\n 1.10 John Tyler\n 1.11 James K. Polk\n 1.12 Zachary Taylor\n 1.13 Millard Fillmore\n 1.14 Franklin Pierce\n 1.15 James Buchanan\n 1.16 Abraham Lincoln\n 1.17 Andrew Johnson\n 1.18 Ulysses S. Grant\n 1.19 Rutherford B. Hayes\n 1.20 James A. Garfield\n 1.21 Chester A. Arthur\n 1.22 Grover Cleveland\n 1.23 Benjamin Harrison\n 1.24 William McKinley\n 1.25 Theodore Roosevelt\n 1.26 William Howard Taft\n 1.27 Woodrow Wilson\n 1.28 Warren G. Harding\n 1.29 Calvin Coolidge\n 1.30 Herbert Hoover\n 1.31 Franklin D. Roosevelt\n 1.32 Harry S. Truman\n 1.33 Dwight D. Eisenhower\n 1.34 John F. Kennedy\n 1.35 Lyndon B. Johnson\n 1.36 Richard Nixon\n 1.37 Gerald Ford\n 1.38 Jimmy Carter\n 1.39 Ronald Reagan\n 1.40 George H. W. Bush\n 1.41 Bill Clinton\n 1.42 George W. Bush\n 1.43 Barack Obama\";\nfor (@_){\nchomp;\nif (/$n/){\n s/\\s*1\\.\\d+\\s\\w+\\s//;\n s/.*\\.\\s//;\n print;\n print \"\\n\";\n last\n } \n}"}], "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3"} {"source_code": "#!/usr/bin/perl -wl\n\nuse strict;\n\nwhile( <> ){\n my( $n, $k ) = split;\n my( $min ) = sort { $a <=> $b } $n - $k, $k - 1;\n \n print $n + $n - 1 + $min + 1 + $n;\n }\n", "positive_code": [{"source_code": "#!/usr/bin/perl -wl\nuse strict;\n\nwhile (<>) {\n my ($n, $k) = split;\n my ($step) = sort {$a <=> $b} ($n - $k, $k - 1);\n $step += $n - 1;\n print $step + 2 * $n + 1;\n}\n"}], "negative_code": [], "src_uid": "24b02afe8d86314ec5f75a00c72af514"} {"source_code": "$n = <>;\n@a = split '', <>;\n\n$min = 0;\nfor ($i = 1; $i < $n; ++$i) {\n if ($a[$last] eq $a[$i]) { ++$min; }\n else { $last = $i; }\n}\nprint $min;", "positive_code": [{"source_code": "my $n = ;\nmy $s = ;\nmy $c = 0;\nchomp($s);\nwhile(index($s, \"RR\") != -1) {\n substr($s, index($s, \"RR\"), 2, \"R\");\n $c++;\n}\nwhile(index($s, \"GG\") != -1) {\n substr($s, index($s, \"GG\"), 2, \"G\");\n $c++;\n}\nwhile(index($s, \"BB\") != -1) {\n substr($s, index($s, \"BB\"), 2, \"B\");\n $c++;\n}\nprint $c;"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)"}, {"source_code": "#!/usr/bin/perl\n# your code goes here\nuse v5.10;\n\nchomp($len = <>);\nchomp($line = <>);\n@a = split //, $line;\n$i = 0;\n$ans = 0;\nwhile ($i < $len) {\n\t$j = $i++;\n\twhile ($i<$len && $a[$i] eq $a[$j]) {\n\t\t++$i;\n\t}\n\t$ans += $i-$j-1;\n}\nsay $ans;"}, {"source_code": "use strict;\nuse warnings;\n\nmy $stones = <>;\nchomp($stones);\n\nmy $in = <>;\nchomp($in);\nmy @s = split('', $in);\n\n\nmy $n=0;\n\n# r b g\n# if ff or bb or gg we have to remove one stone\n# if this stone==next stone, remove this stone. move to next....\n\nfor (my $i=0; $i<$stones-1; $i++) {\n if ($s[$i] eq $s[$i+1]) {\n $n++;\n }\n}\n\nprint $n;\n"}, {"source_code": "my $n = ;\nmy $s = ;\nmy $c = 0;\n\nmy $a = 'a';\nmy $b = 'b';\n# if ($a eq $a){\n\t# print(\"YES\");\n\t# }\nmy @arr = split //, $s;\n\nmy $t = 0;\nfor(; $t < $n - 1; $t++)\n{\n\tif($arr[$t] eq $arr[$t+1]){\n\t\t$c++;\n\t}\n}\nprint($c);\n# my $c (split //, $s) {\n # if()\n# }"}, {"source_code": "use strict;\nuse warnings;\n\n<>;\n$_ = <>;\nchomp;\nmy @l = split '';\nmy $res = 0;\nfor my $i (1..@l-1) {\n $res++ if ($l[$i] eq $l[$i-1]);\n}\nprint \"$res\\n\";\n"}, {"source_code": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\n\nchomp(my $n = );\nchomp(my $s = );\n\nmy @chrs = split(\"\", $s);\nmy $i = 0;\nmy $cnt = 0;\nwhile ($i < ($n - 1)) {\n if ($chrs[$i] eq $chrs[$i + 1]) {\n # ;\n splice(@chrs, $i, 1);\n $cnt += 1;\n $n -= 1;\n } else {\n $i += 1;\n }\n}\nprint $cnt;\n# print $n;\n# print $s;"}, {"source_code": "#!/usr/bin/perl\n\n$n=;\n@str = split(//, );\n$a=0;\nfor($i = 0; $i < $n; $i++)\n{\n if($str[$i] eq $str[$i + 1])\n {\n $a = $a + 1;\n }\n}\nprint \"$a\";"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": ";\n@str = split(//, );\n$count = 0;\n\nfor($i = 0; $i < $#str; $i++)\n{\n if($str[$i] eq $str[$i + 1])\n {\n ++$count;\n }\n}\nprint STDOUT $count;"}, {"source_code": "; chomp($_ = ); my ($last, $res)=(\"\", 0); for(split(\"\")){ if( $last eq $_ ){ $res += 1 }else{ $last = $_ } } print \"$res\\n\""}, {"source_code": "<>; $i = 0; $_ = <>;\nwhile (/(.)\\g{-1}/g) {\n --pos($_); ++$i\n}\nprint $i"}, {"source_code": "#!/bin/perl\n\n$n = ;\n$s = ;\nchomp $s;\n\n$s =~ s/R+/c/g;\n$s =~ s/G+/c/g;\n$s =~ s/B+/c/g;\n\nprint ( $n - length $s );\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "#!/usr/bin/perl\nuse strict; use warnings;\n\nmy $n = ; $_ = ;\nforeach my $c (qw[R G B]) { s/$c+/$c/g }\nprint $n + 1 - length . \"\\n\";\n"}, {"source_code": "$n = <>;\n$ans = 0;\n@str = split \"\", <>;\nfor (1..$n - 1) {\n\tif ($str[$_] eq $str[$_ - 1]) {\n\t\t$ans++;\n\t}\n}\nprint ($ans);"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\n<>;\nchomp($_ = <>);\nmy @a = split //;\nmy $res = 0;\nmy $pre = shift @a;\nwhile (@a) {\n my $cur = shift @a;\n ++$res if $pre eq $cur;\n $pre = $cur;\n}\nprint \"$res\\n\";\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}, {"source_code": "my $l = <>;\nmy @str = split \"\", <>;\nmy $ans = 0;\nfor (1..$l-1) {\n $ans++ if ($str[$_] eq $str[$_ - 1]);\n}\nprint $ans . \"\\n\";\n"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)"}, {"source_code": "print <>-(()=<>=~/(.)\\1*/g)\n"}], "negative_code": [{"source_code": "my $n = ;\nmy $s = ;\nmy $c = 0;\n\nmy $a = 'a';\nmy $b = 'b';\n# if ($a eq $a){\n\t# print(\"YES\");\n\t# }\n\n\nmy $t = 0;\nfor(; $t < $n - 1; $t++)\n{\n\tif($s[$t] eq $s[$t+1]){\n\t\t$c++;\n\t}\n}\nprint($c);\n# my $c (split //, $s) {\n # if()\n# }"}, {"source_code": "my $n = ;\nmy $s = ;\nmy $c = 0;\n\nmy $a = 'a';\nmy $b = 'b';\n# if ($a eq $a){\n\t# print(\"YES\");\n\t# }\nmy @arr = split //, $s;\nprint(join(\" \", @arr));\nmy $t = 0;\nfor(; $t < $n - 1; $t++)\n{\n\tif($arr[$t] eq $arr[$t+1]){\n\t\t$c++;\n\t}\n}\nprint($c);\n# my $c (split //, $s) {\n # if()\n# }"}, {"source_code": "$n = <>;\n@a = split '', <>;\nfor ($i = 1; $i < $n; ++$i) {\n if ($a[$last] eq $a[$i]) { ++$min; }\n else { $last = $i; }\n}\nprint $min;"}, {"source_code": "#!/bin/perl\n\n$n = ;\n$s = ;\nchomp $s;\n\n$b = $s;\n\n$s =~ s/R+/c/;\n$s =~ s/G+/c/;\n$s =~ s/B+/c/;\n\nprint ( ( length $b ) - ( length $s ) );\n"}], "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8"} {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n", "positive_code": [{"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "chomp($n=<>);\nchomp($_=<>);\n@a = split / /;\n@a = sort {$a <=> $b} @a;\n($a[0], $a[-1]) = ($a[-1], $a[0]);\nprint \"@a\\n\";"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "#!/usr/bin/perl -w\nuse 5.010;\n\nsub Solve {\n while (($idx, $val) = each @_) {\n $_[0] < $val && (($_[0], $_[$idx]) = ($_[$idx], $_[0]));\n $_[-1] > $val && (($_[-1], $_[$idx]) = ($_[$idx], $_[-1]));\n }\n @center = sort {$a <=> $b} @_[1..$_-2];\n say \"$_[0] @center $_[-1]\"\n}\n\nwhile (<>) {\n @line = split /\\s+/, <>;\n Solve(@line);\n}\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n"}, {"source_code": "$n = <>;\n@a = sort { $a <=> $b } split ' ', <>;\nprint join ' ', @a[-1, 1..$n-2, 0];\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "$n = <>;\n@a = sort {$a <=> $b} split ' ', <>;\nprint \"@a[-1, 1..$n-2, 0]\";\n\n"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n<>;\n@_=split/ /,<>;\nchomp (@_);\n@_= sort num_rev @_;\n$first = shift @_;\n$last = pop @_;\n@_= reverse @_;\nunshift @_, $first; \npush @_, $last;\nprint \"@_\"; \n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n<>;\n@_=split/ /,<>;\nchomp (@_);\n@_= sort num_rev @_;\n$first = shift @_;\n$last = pop @_;\n@_= sort @_;\nunshift @_, $first; \npush @_, $last;\nprint \"@_\\n\"; \n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n<>;\n@_=split/ /,<>;\n@_= sort num_rev @_;\n$first = shift @_;\n$last = pop @_;\n@_= sort @_;\nunshift @_, $first; \npush @_, $last;\nprint \"@_\"; \n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n<>;\n@_=split/ /,<>;\n@_= sort num_rev @_;\n$first = shift @_;\n$last = pop @_;\n@_= sort @_;\nprint $first, \" @_ \", $last;\n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}, {"source_code": "#!/usr/bin/perl\n\n$PI=3.14159265358979323846;\n$MOD=1000000007;\n\n# <>=~/ /;\n# <>=~/ (\\d+) /;\n# <>=~/ (\\d+) (\\d+) /;\n\n<>;\n@_=split/ /,<>;\nchomp (@_);\n@_= sort num_rev @_;\n$first = shift @_;\n$last = pop @_;\n@_= sort @_;\nunshift @_, $first; \npush @_, $last;\nprint \"@_\"; \n\n#***********SUBS************\n\nsub num {$a <=> $b}\nsub num_rev {$b <=> $a}\nsub rev {$b cmp $a}\n\nsub p{print}\nsub n{print \"\\n\"}\nsub pn{p,n}\nsub pn_mas {pn for @_}\n\n# Transpose \"charbox\"\nsub transpose{\n $i=@m=@_;\n chomp @m;\n while ($i--){\n $t[$i]=~s/$/chop/e for @m\n }\nreturn @t\n}\n\n# Transpose \"value sets\"\nsub transpose_space{\n my @t;\n for (@_){\n my $j=0;\n s/\\d+/($t[$j++].=\"$& \")?$&:$&/eg;\n }\n chop @t;\nreturn @t\n}\n\nsub div{\n my ($n, $k)=@_;\nreturn ($n - $n % $k) / $k\n}\n \nsub uniq{\n my @m=sort @_;\n push @u, my $i=shift @m;\n for (@m){\n $i eq $_ or push @u, $_;\n $i=$_;\n }\nreturn @u\n}\n \nsub max{\n my $max=shift;\n $max<$_ and $max=$_ for @_;\nreturn $max\n}\n \nsub min{\n my $min=shift;\n $min>$_ and $min=$_ for @_;\nreturn $min\n}\n\n# count (kas_ieskoma, masyvas)\nsub count{\n my $i=0;\n $_ eq $_[0] and $i++ for @_;\nreturn --$i\n}"}], "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4"} {"source_code": "#!/usr/bin/perl\n\nuse bignum;\n$a=<>;\n$b=<>;\n$x=0;\n$s=0;\n$c=0;\n$m=-1;\nwhile ($m<$b)\n{\n$m=$a**$c;\nif ($m==$b)\n{$s=1;\n$x=$c;}\n$c++;\n}\nif ($s eq 1)\n{\nprint\"YES\\n\";\nprint $x-1;\n}\nelse\n{\nprint \"NO\";\n}", "positive_code": [{"source_code": "use bignum;\n$a=<>;\n$b=<>;\n$i=$a;\n$c=0;\nwhile($a<$b){\n$a*=$i, $c++;\n}\nprint $a-$b?\"NO\":\"YES\\n$c\""}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse bignum;\n$a=<>;\n$b=<>;\n$x=0;\n$s=0;\n$c=0;\n$m=-1;\nwhile ($m<$b)\n{\n$m=$a**$c;\nif ($m==$b)\n{$s=1;\n$x=$c;}\n$c++;\n}\nif ($s eq 1)\n{\nprint\"YES\\n\";\nprint $x-1;\n}\nelse\n{\nprint \"No\";\n}"}, {"source_code": "use bignum;\n$a=<>;\n$b=<>;\n$i=$a;\nwhile($a<$b){\n$a*=$i, $c++;\n}\nprint $a-$b?\"NO\":\"YES\\n$c\""}], "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46"} {"source_code": "$/ = $\\;\n\nfor $j ( map '.' x $_, 0, 3 .. 5 ){\n\tfor ( 'xx,xx' =~ /(?=(...))/g ){\n\t\t$r .= '|' . join $j, split '';\n\t\t}\n\t}\n\t\nprint <> =~ y/./,/r =~ /r$r/s ? \"YES\" : \"NO\"", "positive_code": [{"source_code": "$,=\" \";\nmy @GRID;\nfor(1..4)\n{\n my $t=<>;\nchomp($t);\npush(@GRID,$t);\n}\n\nif(checkRow() or checkCol() or CheckDiag())\n{\n print \"YES\\n\";\n}\nelse\n{\n print \"NO\\n\";\n}\n\nsub checkRow\n{\nfor(0..3)\n{\nif($GRID[$_] =~ 'xx\\.' or $GRID[$_] =~ '\\\\.xx' or $GRID[$_] =~ 'x\\\\.x')\n{\n return 1;\n}\n}\n}\n\nsub checkCol\n{\nfor my $i (0..3)\n{\nmy $k=\"\";\nfor(0..3)\n{\n$k.=substr($GRID[$_],$i,1);\n}\n#print $k, \"\\n\";\nif($k =~ 'xx\\.' or $k =~ '\\\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n}\n}\n\nsub CheckDiag\n{\nmy @D1=([0,0],[1,1],[2,2],[3,3]);\nmy @D2=([1,0],[2,1],[3,2]);\nmy @D3=([0,1],[1,2],[2,3]);\nmy @D4=([2,0],[1,1],[0,2]);\nmy @D5=([3,0],[2,1],[1,2],[0,3]);\nmy @D6=([3,1],[2,2],[1,3]);\nmy $k=\"\";\nfor(@D1)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n#print $k, \"\\n\";\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n$k=\"\";\nfor(@D2)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n$k=\"\";\nfor(@D3)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n$k=\"\";\nfor(@D4)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n$k=\"\";\nfor(@D5)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n$k=\"\";\nfor(@D6)\n{\n$k.=substr($GRID[$_->[0]],$_->[1],1);\n}\nif($k =~ 'xx\\.' or $k =~ '\\.xx' or $k =~ 'x\\\\.x')\n{\n return 1;\n}\n}\n"}, {"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nmy $debug = 0;\n\nwhile(!eof){\n\t$_ = join '', map ~~<>, 1 .. 4;\n\ty/./,/;\n\t\n\tmy @rxs;\n\t\n\tfor my $join ( map { '.' x $_ } 0, 3, 4, 5 ){\n\t\tfor my $arrange ( 'xx,xx' =~ /(?=(...))/g ){\n\t\t\tpush @rxs, join $join, split '', $arrange;\n\t\t\t}\n\t\t}\n\t\t\t\n\tmy $re = join '|', @rxs;\n\t\n\t$debug and print $re;\n\t\n\tprint /$re/gs ? \"YES\" : \"NO\";\n\t\n\t$debug and print \"pos:\", pos, \"[$&]\";\n\t}"}], "negative_code": [{"source_code": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $/;\n\nmy $debug = 0;\n\nwhile(!eof){\n\t$_ = join '', split ' ', join '', map ~~<>, 1 .. 4;\n\ty/./,/;\n\t\n\tmy @rxs;\n\t\n\tfor my $join ( map { '[^o]' x $_ } 0, 2, 3, 4 ){\n\t\tfor my $arrange ( 'xx,xx' =~ /(?=(...))/g ){\n\t\t\tpush @rxs, join $join, split '', $arrange;\n\t\t\t}\n\t\t}\n\t\t\n\t$debug and print \"/xx,|x,x|,xx|x...x...,|x...,...x|,...x...x|x....x....,|x....,....x|,....x....x|/\";\n\t\n\tmy $re = join '|', @rxs;\n\t\n\t$debug and print $re;\n\t\n\tprint /$re/ ? \"YES\" : \"NO\";\n\t\n\t}"}], "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917"}