Language: C++

//#include<iostream>
//using namespace std;
//int main()
//{
//	// 入力 n:人数 k:必殺技の回数
//	uint32_t n, k;
//
//	cin >> n >> k;
//
//	// 敵のHPの配列
//	long long h[2 * 10 ^ 5];
//
//	// 攻撃の回数を求めよ
//
//	for (uint32_t i = 0; i < n; ++i) {
//		cin >> h[i];
//	}
//
//	// ソート (大きい順番)
//	for (uint32_t i = 0; i < n; ++i) {
//		for (uint32_t j = 0; j < n - 1; ++j) {
//			if (h[j] < h[j + 1]) {
//				swap(h[j], h[j + 1]);
//			}
//		}
//	}
//
//	long long sum = 0;
//	for (uint32_t i = k; i < n; ++i) {
//		sum += h[i];
//	}
//
//	cout << sum << endl;
//	return 0;
//}

#include<iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
	// 入力 n:人数 k:必殺技の回数
	uint32_t n, k;

	cin >> n >> k;

	// 敵のHPの配列
	vector<uint64_t> h;
	long long h[2 * 10 ^ 5];

	// 攻撃の回数を求めよ

	for (uint32_t i = 0; i < n; ++i) {
		h.push_back(0);
		cin >> h[i];
	}

	//// ソート (大きい順番)
	//for (uint32_t i = 0; i < n; ++i) {
	//	for (uint32_t j = 0; j < n - 1; ++j) {
	//		if (h[j] < h[j + 1]) {
	//			swap(h[j], h[j + 1]);
	//		}
	//	}
	//}

	std::sort(h.begin(), h.end(), std::greater<long long>());

	long long sum = 0;
	for (uint32_t i = k; i < n; ++i) {
		sum += h[i];
	}

	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:9: error: 'uint32_t' was not declared in this scope
   45 |         uint32_t n, k;
      |         ^~~~~~~~
a.cc:41:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   40 | #include <functional>
  +++ |+#include <cstdint>
   41 | using namespace std;
a.cc:47:16: error: 'n' was not declared in this scope
   47 |         cin >> n >> k;
      |                ^
a.cc:47:21: error: 'k' was not declared in this scope
   47 |         cin >> n >> k;
      |                     ^
a.cc:50:16: error: 'uint64_t' was not declared in this scope
   50 |         vector<uint64_t> h;
      |                ^~~~~~~~
a.cc:50:16: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:50:24: error: template argument 1 is invalid
   50 |         vector<uint64_t> h;
      |                        ^
a.cc:50:24: error: template argument 2 is invalid
a.cc:51:19: error: conflicting declaration 'long long int h [17]'
   51 |         long long h[2 * 10 ^ 5];
      |                   ^
a.cc:50:26: note: previous declaration as 'int h'
   50 |         vector<uint64_t> h;
      |                          ^
a.cc:55:22: error: expected ';' before 'i'
   55 |         for (uint32_t i = 0; i < n; ++i) {
      |                      ^~
      |                      ;
a.cc:55:30: error: 'i' was not declared in this scope
   55 |         for (uint32_t i = 0; i < n; ++i) {
      |                              ^
a.cc:56:19: error: request for member 'push_back' in 'h', which is of non-class type 'int'
   56 |                 h.push_back(0);
      |                   ^~~~~~~~~
a.cc:69:21: error: request for member 'begin' in 'h', which is of non-class type 'int'
   69 |         std::sort(h.begin(), h.end(), std::greater<long long>());
      |                     ^~~~~
a.cc:69:32: error: request for member 'end' in 'h', which is of non-class type 'int'
   69 |         std::sort(h.begin(), h.end(), std::greater<long long>());
      |                                ^~~
a.cc:72:22: error: expected ';' before 'i'
   72 |         for (uint32_t i = k; i < n; ++i) {
      |                      ^~
      |                      ;
a.cc:72:30: error: 'i' was not declared in this scope
   72 |         for (uint32_t i = k; i < n; ++i) {
      |                              ^