Language: C++

#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>

#define Vsort(a) sort(a.begin(), a.end())
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  
  int n, k, count = 0;
  cin >> n >> k;
  vector<int> p(n);
  rep(0, n) cin >> p[i];
  Vsort(n);
  rep(0, k) count += p[i];
  cout << count;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: expected unqualified-id before numeric constant
   20 |   rep(0, n) cin >> p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:20:7: error: expected ';' before numeric constant
   20 |   rep(0, n) cin >> p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:20:7: error: lvalue required as left operand of assignment
   20 |   rep(0, n) cin >> p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:9:40: error: expected ')' before ';' token
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                     ~                  ^
a.cc:20:3: note: in expansion of macro 'rep'
   20 |   rep(0, n) cin >> p[i];
      |   ^~~
a.cc:20:7: error: lvalue required as increment operand
   20 |   rep(0, n) cin >> p[i];
      |       ^
a.cc:9:42: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                                          ^
a.cc:8:25: error: request for member 'begin' in 'n', which is of non-class type 'int'
    8 | #define Vsort(a) sort(a.begin(), a.end())
      |                         ^~~~~
a.cc:21:3: note: in expansion of macro 'Vsort'
   21 |   Vsort(n);
      |   ^~~~~
a.cc:8:36: error: request for member 'end' in 'n', which is of non-class type 'int'
    8 | #define Vsort(a) sort(a.begin(), a.end())
      |                                    ^~~
a.cc:21:3: note: in expansion of macro 'Vsort'
   21 |   Vsort(n);
      |   ^~~~~
a.cc:22:7: error: expected unqualified-id before numeric constant
   22 |   rep(0, k) count += p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:22:7: error: expected ';' before numeric constant
   22 |   rep(0, k) count += p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:22:7: error: lvalue required as left operand of assignment
   22 |   rep(0, k) count += p[i];
      |       ^
a.cc:9:26: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                          ^
a.cc:9:40: error: expected ')' before ';' token
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                     ~                  ^
a.cc:22:3: note: in expansion of macro 'rep'
   22 |   rep(0, k) count += p[i];
      |   ^~~
a.cc:22:7: error: lvalue required as increment operand
   22 |   rep(0, k) count += p[i];
      |       ^
a.cc:9:42: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i = 0; i < (n); i++)
      |                                          ^