Language: C++

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
 
int point[100000][2];
 
int main()
{
	int days = 0;
	int sum = 0;
	int sumA[2][2];
	int sumC[2][2];
	double maxdays = pow(10, 5);
	int i = 0;
	int A, B, C = 0;
 
	scanf_s("%d", &days);
 
	if (days < maxdays) {
 
		for (int i = 0; i < days; i++)
		{
			scanf_s("%d,\t", &point[i][0]);
			if (point[i][0] > 10000) {
				exit(1);
			}
			scanf_s("%d,\t", &point[i][1]);
			if (point[i][1] > 10000) {
				exit(1);
			}
			scanf_s("%d,\n", &point[i][2]);
			if (point[i][2] > 10000) {
				exit(1);
			}
		}
	}
	i = 0;
			if (point[i][0] + point[i + 1][0] < point[i][0] + point[i + 1][1] && 
				point[i][0] + point[i + 1][1] < point[i][0] + point[i + 1][2])
			{
				sumA[2][2] = point[i][0] + point[i + 1][2];
				A = 2;
			}
			else if (point[i][0] + point[i + 1][0] < point[i][0] + point[i + 1][1] && 
				point[i][0] + point[i + 1][2] < point[i][0] + point[i + 1][1])
			{
				sumA[2][2] = point[i][0] + point[i + 1][1];
				A = 1;
			}
			else
			{
				sumA[2][2] = point[i][0] + point[i + 1][0];
				A = 0;
			}
		for (int i = 0; i < days - 2; i++)
		{
			if (A = 0)
			{
				if (sumA[2][2] + point[i + 2][1] < sumA[2][2]+ point[i + 2][2])//[i + 2]では1or2
				{
					sumA[2][2] += point[i + 2][2];
					A = 2;
				}
				else
				{
					sumA[2][2] += point[i + 2][1];
					A = 1;
				}
			}
			if (A = 1)
			{
				if (sumA[2][2] + point[i + 2][0] < sumA[2][2] + point[i + 2][2])//[i + 2]では0or2
				{
					sumA[2][2] += point[i + 2][2];
					A = 2;
				}
				else
				{
					sumA[2][2] += point[i + 2][0];
					A = 0;
				}
			}
			if (A = 2)
			{
				if (sumA[2][2] + point[i + 2][0] < sumA[2][2] + point[i + 2][1])//[i + 2]では0か1
				{
					sumA[2][2] += point[i + 2][1];
					A = 1;
				}
				else
				{
					sumA[2][2] += point[i + 2][0];
					A = 0;
				}
			}
		}
 
		i = 0;
			if (point[i][1] + point[i + 1][0] < point[i][1] + point[i + 1][1] && 
				point[i][1] + point[i + 1][1] < point[i][1] + point[i + 1][2])
			{
				sumB[2][2] = point[i][1] + point[i + 1][2];
				B = 2;
			}
			else if (point[i][1] + point[i + 1][0] < point[i][1] + point[i + 1][1] && 
				point[i][1] + point[i + 1][2] < point[i][1] + point[i + 1][1])
			{
				sumB[2][2] = point[i][1] + point[i + 1][1];
				B = 1;
			}
			else
			{
				sumB[2][2] = point[i][1] + point[i + 1][0];
				B = 0;
			}
		for (int i = 0; i < days - 2; i++)
		{
			if (B = 0)
			{
				if (sumB[2][2] + point[i + 2][1] < sumB[2][2] + point[i + 2][2])//[i + 2]では1or2
				{
					sumB[2][2] += point[i + 2][2];
					B = 2;
				}
				else
				{
					sumB[2][2] += point[i + 2][1];
					B = 1;
				}
			}
			if (B = 1)
			{
				if (sumB[2][2] + point[i + 2][0] < sumB[2][2] + point[i + 2][2])//[i + 2]では0or2
				{
					sumB[2][2] += point[i + 2][2];
					B = 2;
				}
				else
				{
					sumB[2][2] += point[i + 2][0];
					B = 0;
				}
			}
			if (B = 2)
			{
				if (sumB[2][2] + point[i + 2][0] < sumB[2][2] + point[i + 2][1])
				{
					sumB[2][2] += point[i + 2][1];
					B = 1;
				}
				else
				{
					sumB[2][2] += point[i + 2][0];
					B = 0;
				}
			}
		}
 
		i = 0;
			if (point[i][1] + point[i + 1][0] < point[i][1] + point[i + 1][1] && 
				point[i][1] + point[i + 1][1] < point[i][1] + point[i + 1][2])
			{
				sumC[2][2] = point[i][2] + point[i + 1][2];
				C = 2;
			}
			else if (point[i][1] + point[i + 1][0] < point[i][1] + point[i + 1][1] &&
				point[i][1] + point[i + 1][2] < point[i][1] + point[i + 1][1])
			{
				sumC[2][2] = point[i][2] + point[i + 1][1];
				C = 1;
			}
			else
			{
				sumC[2][2] = point[i][2] + point[i + 1][0];
				C = 0;
			}
		for (int i = 0; i < days - 2; i++)
		{
			if (C = 0)
			{
				if (sumC[2][2] + point[i + 2][1] < sumC[2][2] + point[i + 2][2])//[i + 2]では1or2
				{
					sumC[2][2] += point[i + 2][2];
					C = 2;
				}
				else
				{
					sumC[2][2] += point[i + 2][1];
					C = 1;
				}
			}
			if (C = 1)
			{
				if (sumC[2][2] + point[i + 2][0] < sumC[2][2] + point[i + 2][2])
				{
					sumC[2][2] += point[i + 2][2];
					C = 2;
				}
				else
				{
					sumC[2][2] += point[i + 2][0];
					C = 0;
				}
			}
			if (C = 0)
			{
				if (sumC[2][2] + point[i + 2][2] < sumC[2][2] + point[i + 2][1])//[i + 2]では0か1
				{
					sumC[2][2] += point[i + 2][1];
					C = 1;
				}
				else
				{
					sumC[2][2] += point[i + 2][0];
					C = 2;
				}
			}
		}
 
		if (sumA[2][2] <= sumB[2][2] && sumB[2][2] <= sumC[2][2]) {
			printf("%d", sumC[2][2]);
		}
		else if (sumA[2][2] <= sumB[2][2] && sumC[2][2] <= sumB[2][2]) {
			printf("%d", sumB[2][2]);
		}
		else {
			printf("%d", sumA[2][2]);
		}		
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   17 |         scanf_s("%d", &days);
      |         ^~~~~~~
      |         scanf
a.cc:102:33: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  102 |                                 sumB[2][2] = point[i][1] + point[i + 1][2];
      |                                 ^~~~
      |                                 sumC
a.cc:108:33: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  108 |                                 sumB[2][2] = point[i][1] + point[i + 1][1];
      |                                 ^~~~
      |                                 sumC
a.cc:113:33: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  113 |                                 sumB[2][2] = point[i][1] + point[i + 1][0];
      |                                 ^~~~
      |                                 sumC
a.cc:120:37: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  120 |                                 if (sumB[2][2] + point[i + 2][1] < sumB[2][2] + point[i + 2][2])//[i + 2]では1or2
      |                                     ^~~~
      |                                     sumC
a.cc:133:37: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  133 |                                 if (sumB[2][2] + point[i + 2][0] < sumB[2][2] + point[i + 2][2])//[i + 2]では0or2
      |                                     ^~~~
      |                                     sumC
a.cc:146:37: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  146 |                                 if (sumB[2][2] + point[i + 2][0] < sumB[2][2] + point[i + 2][1])
      |                                     ^~~~
      |                                     sumC
a.cc:220:35: error: 'sumB' was not declared in this scope; did you mean 'sumC'?
  220 |                 if (sumA[2][2] <= sumB[2][2] && sumB[2][2] <= sumC[2][2]) {
      |                                   ^~~~
      |                                   sumC