Language: C++

//I'm beginner.
//n個の区間がある。i(>=0)個目の区間は[a, b)で重さmである。
//ある点xについて、xを含むまたはxと接する区間が151以上になるならNG, ならないならOKと出力。
//考察：
//関係ない点を除く、座標圧縮をする、それだけ。
#include <iostream>
#include <set>
#include <map>
using namespace std;

int n;
int m[100], a[100], b[100];
int time[2000];

void compress() {
	int i;
	set<int> comp;
	map<int, int> indComp;
	typedef pair<int, int> P;
	
	for (i = 0; i < n; i++) {
		comp.insert(a[i]);
		comp.insert(b[i]);
	}
	
	int ind = 0;
	for (set<int>::iterator it = comp.begin(); it != comp.end(); it++) {
		indComp.insert(P(*it, ind++) );
	}
	
	for (i = 0; i < n; i++) {
		a[i] = indComp[a[i]];
		b[i] = indComp[b[i]];
	}
}

bool in_solve_out() {
	int i;
	cin >> n;
	if (!n) {
		return false;
	}
	
	for (i = 0; i < n; i++) {
		cin >> m[i] >> a[i] >> b[i];
	}
	compress();
	
	for (i = 0; i < n; i++) {
		time[a[i]] += m[i];
		time[b[i]] -= m[i];
	}
	for (i = 1; i < 2*n + 10; i++) {
		time[i] += time[i-1];
	}
	
	for (i = 0; i < 2*n + 10; i++) {
		if (time[i] > 150) {
			cout << "NG" << endl;
			return true;
		}
	}
	cout << "OK" << endl;
	return true;
}

void clear() {
	for (int i = 0; i < n*2 + 10; i++) {
		time[i] = 0;
	}
};

signed main() {
	while (in_solve_out() ) {
		clear();
	}
	return 0;
}

Compiler output:
a.cc:13:14: error: 'int time [2000]' redeclared as different kind of entity
   13 | int time[2000];
      |              ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'bool in_solve_out()':
a.cc:50:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |                 time[a[i]] += m[i];
      |                          ^
a.cc:50:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |                 time[a[i]] += m[i];
      |                 ~~~~~~~~~~~^~~~~~~
a.cc:50:28: error: assignment of read-only location '*(time + ((sizetype)a[i]))'
a.cc:51:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                 time[b[i]] -= m[i];
      |                          ^
a.cc:51:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |                 time[b[i]] -= m[i];
      |                 ~~~~~~~~~~~^~~~~~~
a.cc:51:28: error: assignment of read-only location '*(time + ((sizetype)b[i]))'
a.cc:54:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   54 |                 time[i] += time[i-1];
      |                       ^
a.cc:54:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   54 |                 time[i] += time[i-1];
      |                                    ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:54:25: error: invalid operands of types 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator+'
   54 |                 time[i] += time[i-1];
      |                 ~~~~~~~~^~~~~~~~~~~~
a.cc:54:25: note:   in evaluation of 'operator+=(time_t(time_t*) noexcept {aka long int(long int*) noexcept}, time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept})'
a.cc:58:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   58 |                 if (time[i] > 150) {
      |                           ^
a.cc:58:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |                 if (time[i] > 150) {
      |                     ~~~~~~~~^~~~~
a.cc: In function 'void clear()':
a.cc:69:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   69 |                 time[i] = 0;
      |                       ^
a.cc:69:25: error: assignment of read-only location '*(time + ((sizetype)i))'
   69 |                 time[i] = 0;
      |                 ~~~~~~~~^~~