Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;

void Main() {
  int N;
  cin >> N;
  int max = -INF, min = INF;
  rep(i, 0, N) {
    int a;
    cin >> a;
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << max - min << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;

void Main() {
  int N;
  cin >> N;
  int max = -INF, min = INF;
  rep(i, 0, N) {
    int a;
    cin >> a;
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << max - min << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;

void Main() {
  int N;
  cin >> N;
  int max = -INF, min = INF;
  rep(i, 0, N) {
    int a;
    cin >> a;
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << max - min << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:13: error: a function-definition is not allowed here before '{' token
   77 | void Main() {
      |             ^
a.cc:90:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   90 | int main() {
      |         ^~
a.cc:90:9: note: remove parentheses to default-initialize a variable
   90 | int main() {
      |         ^~
      |         --
a.cc:90:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:90:12: error: a function-definition is not allowed here before '{' token
   90 | int main() {
      |            ^
a.cc:142:2: error: expected '}' at end of input
  142 | }
      |  ^
a.cc:43:12: note: to match this '{'
   43 | int main() {
      |            ^