Language: C++

#include <bits/stdc++.h>
#include<stdio.h>
#include<vector>
#pragma GCC optimize(2)
typedef long long ll;
typedef unsigned long long ull;
const int mod=1000;
const int maxn=1e5+5;
const ll INF=100000000000005;
using namespace std;
ll n,m,p;
ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1) ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
struct node{
    ll a,b,c;
}save[maxn];
ll dp[maxn][4];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) scanf("%lld%lld%lld",&save[i].a,&save[i].b,&save[i].c);
    for(int i=1;i<=n;i++)
    {
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+save[i].a;
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+save[i].b;
        dp[i][3]=max(dp[i-1][2],dp[i-1][1])+save[i].c;
    }
    ll res=0;
    for(int i=1;i<=3;i++) res=max(dp[n][i],res);
    printf("%lld\n",res);
    return 0;
}
/***
10 4
40 10 20 70 80 10 20 70 80 60
***/
#include <bits/stdc++.h>
#include<stdio.h>
#include<vector>
#pragma GCC optimize(2)
typedef long long ll;
typedef unsigned long long ull;
const int mod=1000;
const int maxn=1e5+5;
const ll INF=100000000000005;
using namespace std;
ll n,m,p;
ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1) ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
struct node{
    ll a,b,c;
}save[maxn];
ll dp[maxn][4];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) scanf("%lld%lld%lld",&save[i].a,&save[i].b,&save[i].c);
    for(int i=1;i<=n;i++)
    {
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+save[i].a;
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+save[i].b;
        dp[i][3]=max(dp[i-1][2],dp[i-1][1])+save[i].c;
    }
    ll res=0;
    for(int i=1;i<=3;i++) res=max(dp[n][i],res);
    printf("%lld\n",res);
    return 0;
}
/***
10 4
40 10 20 70 80 10 20 70 80 60
***/


Compiler output:
a.cc:42:11: error: redefinition of 'const int mod'
   42 | const int mod=1000;
      |           ^~~
a.cc:7:11: note: 'const int mod' previously defined here
    7 | const int mod=1000;
      |           ^~~
a.cc:43:11: error: redefinition of 'const int maxn'
   43 | const int maxn=1e5+5;
      |           ^~~~
a.cc:8:11: note: 'const int maxn' previously defined here
    8 | const int maxn=1e5+5;
      |           ^~~~
a.cc:44:10: error: redefinition of 'const ll INF'
   44 | const ll INF=100000000000005;
      |          ^~~
a.cc:9:10: note: 'const ll INF' previously defined here
    9 | const ll INF=100000000000005;
      |          ^~~
a.cc:46:4: error: redefinition of 'll n'
   46 | ll n,m,p;
      |    ^
a.cc:11:4: note: 'll n' previously declared here
   11 | ll n,m,p;
      |    ^
a.cc:46:6: error: redefinition of 'll m'
   46 | ll n,m,p;
      |      ^
a.cc:11:6: note: 'll m' previously declared here
   11 | ll n,m,p;
      |      ^
a.cc:46:8: error: redefinition of 'll p'
   46 | ll n,m,p;
      |        ^
a.cc:11:8: note: 'll p' previously declared here
   11 | ll n,m,p;
      |        ^
a.cc:47:4: error: redefinition of 'll qpow(ll, ll)'
   47 | ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1) ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
      |    ^~~~
a.cc:12:4: note: 'll qpow(ll, ll)' previously defined here
   12 | ll qpow(ll a,ll b){ll ans=1;while(b){if(b&1) ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
      |    ^~~~
a.cc:48:8: error: redefinition of 'struct node'
   48 | struct node{
      |        ^~~~
a.cc:13:8: note: previous definition of 'struct node'
   13 | struct node{
      |        ^~~~
a.cc:50:2: error: conflicting declaration 'int save [100005]'
   50 | }save[maxn];
      |  ^~~~
a.cc:15:2: note: previous declaration as 'node save [100005]'
   15 | }save[maxn];
      |  ^~~~
a.cc:51:4: error: redefinition of 'll dp [100005][4]'
   51 | ll dp[maxn][4];
      |    ^~
a.cc:16:4: note: 'll dp [100005][4]' previously declared here
   16 | ll dp[maxn][4];
      |    ^~
a.cc:52:5: error: redefinition of 'int main()'
   52 | int main()
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main()
      |     ^~~~