Language: C++

#include<stdio.h>
#include<iostream>
#include"string"
#include"math.h"
#include <algorithm>
#include<vector>
using namespace std;
bool m;
void m_sort(int a[], int tmp[], int left, int right);
void m_sort(int a[], int tmp[], int left, int right);
void sort(int a[], int total) {
	int tmp;
	for (int i = 0; i < total; i++) {
		for (int j = i + 1; j < total; j++) {
			if (a[i] < a[j]) {
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
 
}
 
void mergeSort(int a[], int tmp[], int size)
{
	m_sort(a, tmp, 0, size - 1);
}
void merge(int a[], int tmp[], int left, int mid, int right)
{
	int i, left_end, num_elements, tmp_pos;
 
	left_end = mid - 1;
	tmp_pos = left;
	num_elements = right - left + 1; // 要素 
 
	while ((left <= left_end) && (mid <= right))
	{
		if (a[left] <= a[mid])
		{
			tmp[tmp_pos] = a[left];
			tmp_pos = tmp_pos + 1;
			left = left + 1;
		}
		else
		{
			tmp[tmp_pos] = a[mid];
			tmp_pos = tmp_pos + 1;
			mid = mid + 1;
		}
	}
 
 
	while (left <= left_end)
	{
		tmp[tmp_pos] = a[left];
		left = left + 1;
		tmp_pos = tmp_pos + 1;
	}
 
	while (mid <= right)
	{
		tmp[tmp_pos] = a[mid];
		mid = mid + 1;
		tmp_pos = tmp_pos + 1;
	}
 
 
	for (i = 0; i <= num_elements; i++)
	{
		a[right] = tmp[right];
		right = right - 1;
	}
}
void m_sort(int a[], int tmp[], int left, int right)
{
	int mid;
 
	if (right > left)
	{
		mid = (right + left) / 2; 
		m_sort(a, tmp, left, mid);
		m_sort(a, tmp, mid + 1, right);
 
		merge(a, tmp, left, mid + 1, right);
	}
}


int N,ka,kc;
int ans,C[501],S[501],F[501],time[501],blank;
int main(){
	cin>>N;
	time[N]=0;
	for(int i=1;i<N;i++){
		cin>>C[i]>>S[i]>>F[i];
		time[i]=0;
	}
	for(int k=1;k<N;k++){
		time[k]=S[k]+C[k];
		for(int i=k+1;i<N;i++){
			if(time[k]>S[i]){
				blank=S[i];
				while(blank<time[k]){
					blank+=F[i];
				}
				time[k]=blank;
				time[k]+=C[i];
			}else{
				time[k]=S[i];
				time[k]+=C[i];
			}
		}
	}
	for(int i=1;i<=N;i++){
	cout<<time[i]<<endl;
	}
	return 0;
}


Compiler output:
a.cc:91:38: error: 'int time [501]' redeclared as different kind of entity
   91 | int ans,C[501],S[501],F[501],time[501],blank;
      |                                      ^
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:2:
/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:94:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   94 |         time[N]=0;
      |               ^
a.cc:94:16: error: assignment of read-only location '*(time + ((sizetype)N))'
   94 |         time[N]=0;
      |         ~~~~~~~^~
a.cc:97:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   97 |                 time[i]=0;
      |                       ^
a.cc:97:24: error: assignment of read-only location '*(time + ((sizetype)i))'
   97 |                 time[i]=0;
      |                 ~~~~~~~^~
a.cc:100:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  100 |                 time[k]=S[k]+C[k];
      |                       ^
a.cc:100:24: error: assignment of read-only location '*(time + ((sizetype)k))'
  100 |                 time[k]=S[k]+C[k];
      |                 ~~~~~~~^~~~~~~~~~
a.cc:102:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  102 |                         if(time[k]>S[i]){
      |                                  ^
a.cc:102:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  102 |                         if(time[k]>S[i]){
      |                            ~~~~~~~^~~~~
a.cc:104:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  104 |                                 while(blank<time[k]){
      |                                                   ^
a.cc:104:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  104 |                                 while(blank<time[k]){
      |                                       ~~~~~^~~~~~~~
a.cc:107:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  107 |                                 time[k]=blank;
      |                                       ^
a.cc:107:40: error: assignment of read-only location '*(time + ((sizetype)k))'
  107 |                                 time[k]=blank;
      |                                 ~~~~~~~^~~~~~
a.cc:108:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  108 |                                 time[k]+=C[i];
      |                                       ^
a.cc:108:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  108 |                                 time[k]+=C[i];
      |                                 ~~~~~~~^~~~~~
a.cc:108:40: error: assignment of read-only location '*(time + ((sizetype)k))'
a.cc:110:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  110 |                                 time[k]=S[i];
      |                                       ^
a.cc:110:40: error: assignment of read-only location '*(time + ((sizetype)k))'
  110 |                                 time[k]=S[i];
      |                                 ~~~~~~~^~~~~
a.cc:111:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  111 |                                 time[k]+=C[i];
      |                                       ^
a.cc:111:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  111 |                                 time[k]+=C[i];
      |                                 ~~~~~~~^~~~~~
a.cc:111:40: error: assignment of read-only location '*(time + ((sizetype)k))'
a.cc:116:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  116 |         cout<<time[i]<<endl;
      |                     ^