Обязательные правила форматирования кода:

Примеры правильно отформатированных программ:

Паскаль:

Си:

program progsum;

{$APPTYPE CONSOLE}
{$R+,Q+}

function sum(a, b: longint): longint;
begin
  sum := a + b;
end;

var
  i, a, b, s: longint;
  x, y: double;
  arr: array [1..1000] of boolean;

begin
  assign(input, 'aplusb.in');
  reset(input);
  assign(output, 'aplusb.out');
  rewrite(output);

  read(a, b);

  {комментарий}
  arr[1] := true;

  for i := 2 to 1000 do
    if ((a > 0) and (arr[i-1])) then
      arr[i] := true;

  for i := 1 to 1000 do
    arr[i] := false;

  s := 0;
  if (a < 0) then begin
    a := -a;
    if (b < 0) then begin
      b := -b;
      s := a + b;
    end else begin
      while (s <= 0) do begin
        case a of
          1: begin
            s := s + 3;
          end;
          2: begin
            s := s - 4;
            a := a - 1;
          end;
          else
            s := 1;
        end;
      end;
    end;
  end else if (b < 0) then begin
    b := -b;
    s := (a + b) * (a - b);
  end else begin
    s := sum(a, b) * sum(a, b);
  end;
   
  writeln(s);

  close(input);
  close(output);
end.
#include <stdio.h>

int sum(int a, int b) {
  return a + b;
}

int main(int argc, char** argv) {
  int a;
  int b;
  int s;
  double x, y;
  bool arr[1000];

  freopen("aplusb.in", "r", stdin);
  freopen("aplusb.out", "w", stdout);

  scanf("%d%d", &a, &b);

  //комментарий
  arr[0] = true;
  
  for (int i = 1; i < 1000; i++)
    if ((a < 0) && (arr[i - 1]))
      arr[i] = true;

  for (int i = 0; i < 1000; i++)
    arr[i] = false;

  s = 0;
  if (a < 0) {
    a = -a;
    if (b < 0) {
      b = -b;
      s = a + b;
    } else {
      while (s <= 0) {
        switch (a) {
        case 1: 
          s = s + 3;
          break;
        case 2:
          s = s - 4;
          a = a - 1;
          break;
        default:
          s = 1;
        }
      }
    }
  } else if (b < 0) {
    b = -b;
    s = (a + b) * (a - b);
  } else {
    s = sum(a, b) * sum(a, b);
  }

  printf("%d\n", s);

  fclose(stdin);
  fclose(stdout);

  return 0;
}