#include <iostream>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
bool check(double a, double b, double c){
return !(a >= b + c || b >= a + c || c >= b + c);
}
double square(double a, double b, double c){
double p = (a+b+c)/2;
return sqrt(p * (p-a) * (p-b) * (p-c));
}
bool is_palind(int k){
string s = to_string(k);
for(int i = 0; i < s.length() - i - 1; i++)
if(s[i] != s[s.length()-i-1])
return false;
return true;
}
void solve1(){
vector<double> lines(4);
double ans = -1;
for(auto &i : lines) cin >> i;
for(int i = 0; i < 4; i++)
for(int j = i + 1; j < 4; j++)
for(int k = j + 1; j < 4; j++)
if(check(lines[i],lines[j],lines[k]))
ans = max(ans,square(lines[i],lines[j], lines[k]));
ans == -1 ? cout << "No solution" : cout << ans;
}
void solve2(){
set<int> s;
for(int i = 1000; i < 10000; i++)
if(is_palind(i))
s.insert(i);
int n;
cin >> n;
s.find(n) != s.end() ? cout << n : cout << *upper_bound(s.begin(),s.end(),n);
}
uses crt;
const
n=10;
m=8;
var
A:array[1..n,1..m] of integer;
cur,up,right,down,left,qw,i,j:integer;
begin;
randomize;
writeln(' Alphaeus ');writeln;
writeln ('Програма пошуку всіх елементів масиву А[1..n, 1..m], що менші, ніж усі сусідні');
for i:=1 to n do
begin
for j:=1 to m do
begin
A[i,j]:=random(101)-50;
write(A[i,j]:3, ' ');
end;
writeln;
end;
writeln;
qw:=0;
for i:=1 to n do
for j:=1 to m do
begin
cur:= A[i,j];
up:=0; right:=0;down:=0;left:=0;
if i>1 then
begin
if cur<A[i-1,j] then up:=1;
end
else up:=1;
if i<n then
begin
if cur<A[i+1,j] then down:=1;
end
else down:=1;
if j>1 then
begin
if cur<A[i,j-1] then left:=1;
end
else left:=1;
if j<m then
begin
if cur<A[i,j+1] then right:=1;
end
else right:=1;
if up+right+down+left=4 then
begin
qw:=qw+1;
writeln('Елемент масиву À[',i,',',j,'], що рівний ',A[i,j]:3,', є меншим за своїх сусідів');
end;
end;
writeln('Всього таких елементів: ',qw);
end.