Input Format
The first line contains an integer, , denoting the size of the array.
The second line contains  space-separated integers, , describing the elements in the array.
Constraints
Output Format
You are not responsible for printing any output to stdout. Once the necessary preprocessor macros are written, the locked code in your editor will print a line that says , where  is the difference between the maximum and minimum values in the array.

hackerrank preprocessor solution problem in c++ programming

Preprocessor solution problem in c++ programming | HackerRank

// Sample solution
#define toStr(x) #x
#define io(s) cin >> s
#define foreach(list, index) for(int index = 0; index < list.size(); index++)
#define FUNCTION(name, op) void name(int &x, int y){ if(!(x op y)) x = y; }
#define INF 1e9
/* Locked from here down --------------------------------------------------------- */
#include <iostream>
#include <vector>
using namespace std;

#if !defined toStr || !defined io || !defined FUNCTION || !defined INF
#error Missing preprocessor definitions
#endif 

FUNCTION(minimum, <)
FUNCTION(maximum, >)

int main(){
    int n; cin >> n;
    vector<int> v(n);
    foreach(v, i) {
        io(v)[i];
    }
    int mn = INF;
    int mx = -INF;
    foreach(v, i) {
        minimum(mn, v[i]);
        maximum(mx, v[i]);
    }
    int ans = mx - mn;
    cout << toStr(Result =) <<' '<< ans;
}