Language: C++

#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());降順ソート
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

typedef long long int llint;

vector<llint> time;

int main() {
	llint n, t;
	cin >> n >> t;
	for (llint i = 0; i < n; ++i) {
		llint temp;
		cin >> temp;
		time.push_back(temp);
	}

	llint x = 0;
	llint now = time[0];
	for (llint i = 1; i < n; ++i) {
		if (now + t >= time[i]) {
			x += time[i] - now;
		}
		else {
			x += t;
		}
		now = time[i];
	}

	cout << x + t << endl;

	return 0;
}


Compiler output:
a.cc:17:15: error: 'std::vector<long long int> time' redeclared as different kind of entity
   17 | vector<llint> time;
      |               ^~~~
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:1:
/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 'int main()':
a.cc:25:22: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   25 |                 time.push_back(temp);
      |                      ^~~~~~~~~
a.cc:29:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |         llint now = time[0];
      |                           ^
a.cc:29:27: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
   29 |         llint now = time[0];
      |                           ^
      |                           |
      |                           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:31:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                 if (now + t >= time[i]) {
      |                                      ^
a.cc:31:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |                 if (now + t >= time[i]) {
      |                     ~~~~~~~~^~~~~~~~~~
a.cc:32:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         x += time[i] - now;
      |                                    ^
a.cc:32:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         x += time[i] - now;
      |                              ~~~~~~~~^~~~~
a.cc:32:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         x += time[i] - now;
      |                         ~~^~~~~~~~~~~~~~~~
a.cc:32:27: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
   32 |                         x += time[i] - now;
      |                         ~~^~~~~~~~~~~~~~~~
      |                           |
      |                           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:37:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |                 now = time[i];
      |                             ^
a.cc:37:29: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
   37 |                 now = time[i];
      |                       ~~~~~~^
      |                             |
      |                             time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}