# restore {} aka python style code -> c++ style code
# if bla:
# print()
# for i in range(n):
# s.pop()
# something()
# else:
# bla
#------------
# if bla: {
# print()
# for i in range(n): {
# s.pop()
# }
# something()
# }
# else: {
# bla
# }
$_=`sed 1d`;$"while s/^( *)([^
{].*(?<!{))((
\1 +[^
].*)+
)(?!\1})/$1$2 {$3$1}
/gm;print
# distance between two points (x,y) rounded down
# 1 2
# 3 4 ---> 1
/ /,$a=$`-$a,$}=$'-$}for<>;print 0|sqrt$a**2+$}**2
# get 2 chars a and b and count all a such that ab or ba or bab but not a
$a=<>=~s/\n//r;$b=<>=~s/\n//r;$_=()=<>=~/(?<=\Q$b\E)\Q$a\E|\Q$a$b\E/g;print
# or
($a,$b,$c)=split$/,`dd`;$_=()=$c=~/(?<=\Q$b\E)\Q$a\E|\Q$a$b\E/g;print
# password check problem
# 1) longer > 15
# 2) mix case
# 3) at least 6 digits
($_=<>,/$/,$_=($`=~y///c<15?' 1':'').(!/[A-Z]/||!/[a-z]/?' 2':'').(!/(\d.*){6,}/?' 3':''),print/./?"BAD$_\n":"PERFECT\n")for 1..<>
<>;
/,/,$books[$x]=$`,$cost[$x]=$',$x++for<>;
while("@{[sort@books]}" ne "@books" && $y < $#books) {
$temp=$books[$y+1];
$books[$y+1]=$books[$y];
$books[$y]=$temp;
$temp=$cost[$y+1];
$cost[$y+1]=$cost[$y];
$cost[$y]=$temp;
$cost+=$cost[$y]+$cost[$y+1];
$y++;
}
print$cost||0
$%+=ord for<>=~/./g;print join'.',map$%*$_%256,1..4
$n=<>;for$i(1..$n){$i**2+$_**2==$n**2?$q+=print"$i $_
":0 for$i..$n}$q||print'...'
# 12 45 3 2 -> eval (1+2)*(4+5)*3*2
print eval<>=~s#\d+#eval$&=~s/\B/+/gr#egr=~s/ /*/gr
<>;/ /,print+(Same,Higher,Lower)[$`<=>$'*9/5+32],$/for<>
<>;/ /,print qw(Same Higher Lower)[$`<=>$'*9/5+32].$/for<>