Language: C++

]#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define tr(con) for(auto it = con.begin(); it!= con.end() ; it++)
#define INF 1e9+7   // 1 * 10^9+ 7
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define fo(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;cin>> n;
	int a[n],b[n],c[n];
	ll ans = 0, curr = 0;
	pair <int, int> maxx;
	pair< int, int>mid ;
	pair <int, int > minn ;
	fo(i,n){
		cin>> a[i]>> b[i]>> c[i];
		ll x =max(a[i], max(b[i], c[i]));
		ll y = min(a[i],min(b[i],c[i]) );
		ll z= a[i] + b[i] +c[i] -x -y ;
		maxx.s =x ; minn.s = y; mid.s = z;
		if(x == c[i]) maxx.f  = 3;
		else if(x== b[i]) maxx.f = 2;
		else maxx.f= 1;
		if(y == c[i]) minn.f  = 3;
		else if(y== b[i]) minn.f = 2;
		else minn.f= 1;
		if(z == c[i]) mid.f  = 3;
		else if(z== b[i]) mid.f = 2;
		else mid.f= 1;
		if(i==0){
			ans+= maxx.s;
			curr = maxx.f;
		}
		else {
			if(maxx.f ==  curr){
				ans += mid.s;
				curr  = mid.f;
			}
			else {
				ans += maxx.s;
				curr = maxx.f;
			}
		}

	}
	cout << ans ;
	return 0;
}



Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | ]#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: expected unqualified-id before ']' token
    1 | ]#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:16:9: error: 'ios_base' has not been declared
   16 |         ios_base::sync_with_stdio(false);
      |         ^~~~~~~~
a.cc:17:9: error: 'cin' was not declared in this scope
   17 |         cin.tie(NULL);
      |         ^~~
a.cc:17:17: error: 'NULL' was not declared in this scope
   17 |         cin.tie(NULL);
      |                 ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | ]#include <bits/stdc++.h>
a.cc:21:9: error: 'pair' was not declared in this scope
   21 |         pair <int, int> maxx;
      |         ^~~~
a.cc:21:15: error: expected primary-expression before 'int'
   21 |         pair <int, int> maxx;
      |               ^~~
a.cc:22:15: error: expected primary-expression before 'int'
   22 |         pair< int, int>mid ;
      |               ^~~
a.cc:23:15: error: expected primary-expression before 'int'
   23 |         pair <int, int > minn ;
      |               ^~~
a.cc:26:33: error: 'max' was not declared in this scope
   26 |                 ll x =max(a[i], max(b[i], c[i]));
      |                                 ^~~
a.cc:26:23: error: 'max' was not declared in this scope
   26 |                 ll x =max(a[i], max(b[i], c[i]));
      |                       ^~~
a.cc:27:33: error: 'min' was not declared in this scope; did you mean 'main'?
   27 |                 ll y = min(a[i],min(b[i],c[i]) );
      |                                 ^~~
      |                                 main
a.cc:27:24: error: 'min' was not declared in this scope; did you mean 'main'?
   27 |                 ll y = min(a[i],min(b[i],c[i]) );
      |                        ^~~
      |                        main
a.cc:29:17: error: 'maxx' was not declared in this scope
   29 |                 maxx.s =x ; minn.s = y; mid.s = z;
      |                 ^~~~
a.cc:29:29: error: 'minn' was not declared in this scope
   29 |                 maxx.s =x ; minn.s = y; mid.s = z;
      |                             ^~~~
a.cc:29:41: error: 'mid' was not declared in this scope
   29 |                 maxx.s =x ; minn.s = y; mid.s = z;
      |                                         ^~~
a.cc:55:9: error: 'cout' was not declared in this scope
   55 |         cout << ans ;
      |         ^~~~