Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)

int main() {
	ll n;
	cin>>n;
	ll c[550],s[550],f[550];
	rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
	rep(i,0,n-1){
		ll b=c[i]+s[i];
		rep(j,i,n-2){
			if(b>s[j+1]&& b%f[j+1]!=0)b+=f[j+1]-b%f[j+1];
			b=max(b,s[j+1])+c[j+1];
		}
		cout<<b<<endl;
		b=0;
	}
	cout<<"0"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll n;
      |         ^~
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin>>n;
      |              ^
      |              yn
a.cc:7:11: error: expected ';' before 'c'
    7 |         ll c[550],s[550],f[550];
      |           ^~
      |           ;
a.cc:8:13: error: expected ';' before 'i'
    8 |         rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
      |             ^
a.cc:2:27: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                           ^
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
      |             ^
a.cc:2:35: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                                   ^
a.cc:8:26: error: 'c' was not declared in this scope
    8 |         rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
      |                          ^
a.cc:8:32: error: 's' was not declared in this scope
    8 |         rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
      |                                ^
a.cc:8:38: error: 'f' was not declared in this scope
    8 |         rep(i,0,n-1)cin>>c[i]>>s[i]>>f[i];
      |                                      ^
a.cc:9:13: error: expected ';' before 'i'
    9 |         rep(i,0,n-1){
      |             ^
a.cc:2:27: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                           ^
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i,0,n-1){
      |             ^
a.cc:2:35: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                                   ^
a.cc:10:19: error: expected ';' before 'b'
   10 |                 ll b=c[i]+s[i];
      |                   ^~
      |                   ;
a.cc:11:21: error: expected ';' before 'j'
   11 |                 rep(j,i,n-2){
      |                     ^
a.cc:2:27: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                           ^
a.cc:11:21: error: 'j' was not declared in this scope; did you mean 'jn'?
   11 |                 rep(j,i,n-2){
      |                     ^
a.cc:2:35: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
      |                                   ^
a.cc:12:28: error: 'b' was not declared in this scope
   12 |                         if(b>s[j+1]&& b%f[j+1]!=0)b+=f[j+1]-b%f[j+1];
      |                            ^
a.cc:12:30: error: 's' was not declared in this scope
   12 |                         if(b>s[j+1]&& b%f[j+1]!=0)b+=f[j+1]-b%f[j+1];
      |                              ^
a.cc:12:41: error: 'f' was not declared in this scope
   12 |                         if(b>s[j+1]&& b%f[j+1]!=0)b+=f[j+1]-b%f[j+1];
      |                                         ^
a.cc:13:25: error: 'b' was not declared in this scope
   13 |                         b=max(b,s[j+1])+c[j+1];
      |                         ^
a.cc:13:33: error: 's' was not declared in this scope
   13 |                         b=max(b,s[j+1])+c[j+1];
      |                                 ^
a.cc:13:27: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |                         b=max(b,s[j+1])+c[j+1];
      |                           ^~~
      |                           std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:13:41: error: 'c' was not declared in this scope
   13 |                         b=max(b,s[j+1])+c[j+1];
      |                                         ^
a.cc:15:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |                 cout<<b<<endl;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:15:23: error: 'b' was not declared in this scope
   15 |                 cout<<b<<endl;
      |                       ^
a.cc:15:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |                 cout<<b<<endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:18:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |         cout<<"0"<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:18:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |         cout<<"0"<<endl;
      |                    ^~~~
      |                    std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~