criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <set>
using namespace std;

int main()
{
	set<int> a;
	int h = 0;
	int hh = 0;
	for (int b = 0; b < 10; b++)
	{
		int c;
		cin >> c;
		a.insert(-c);
	}
	set<int>::iterator it = a.begin();
	for (int g = 0; g < 3; g++)
	{
		h -= *it;
		*it++;
	}
	set<int> aa;
	int h = 0;
	for (int bb = 0; bb < 10; b++)
	{
		int cc;
		cin >> cc;
		a.insert(-cc);
	}
	set<int>::iterator itt = aa.begin();
	for (int g = 0; g < 3; g++)
	{
		hh -= *itt;
		*itt++;
	}
	cout << h << endl;
	cout << hh << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
   23 |         int h = 0;
      |             ^
a.cc:8:13: note: 'int h' previously declared here
    8 |         int h = 0;
      |             ^
a.cc:24:35: error: 'b' was not declared in this scope; did you mean 'bb'?
   24 |         for (int bb = 0; bb < 10; b++)
      |                                   ^
      |                                   bb
Language: C++

#include <iostream>
#include <set>
using namespace std;

int main()
{
	set<int> a;
	int h = 0;
	int hh = 0;
	for (int b = 0; b < 10; b++)
	{
		int c;
		cin >> c;
		a.insert(-c);
	}
	set<int>::iterator it = a.begin();
	for (int g = 0; g < 3; g++)#include <iostream>
#include <set>
using namespace std;

int main()
{
	set<int> a;
	int h = 0;
	int hh = 0;
	for (int b = 0; b < 10; b++)
	{
		int c;
		cin >> c;
		a.insert(-c);
	}
	set<int>::iterator it = a.begin();
	for (int g = 0; g < 3; g++)
	{
		h -= *it;
		*it++;
	}
	set<int> aa;
	int h = 0;
	for (int bb = 0; bb < 10; bb++)
	{
		int cc;
		cin >> cc;
		a.insert(-cc);
	}
	set<int>::iterator itt = aa.begin();
	for (int g = 0; g < 3; g++)
	{
		hh -= *itt;
		*itt++;
	}
	cout << h << endl;
	cout << hh << endl;
	getchar();
	getchar();
	return 0;
}
	{
		h -= *it;
		*it++;
	}
	set<int> aa;
	int h = 0;
	for (int bb = 0; bb < 10; b++)
	{
		int cc;
		cin >> cc;
		a.insert(-cc);
	}
	set<int>::iterator itt = aa.begin();
	for (int g = 0; g < 3; g++)
	{
		hh -= *itt;
		*itt++;
	}
	cout << h << endl;
	cout << hh << endl;
	return 0;
}

Compiler output:
a.cc:17:36: error: stray '#' in program
   17 |         for (int g = 0; g < 3; g++)#include <iostream>
      |                                    ^
a.cc: In function 'int main()':
a.cc:17:37: error: 'include' was not declared in this scope
   17 |         for (int g = 0; g < 3; g++)#include <iostream>
      |                                     ^~~~~~~
a.cc:17:54: error: expected primary-expression before '>' token
   17 |         for (int g = 0; g < 3; g++)#include <iostream>
      |                                                      ^
a.cc:19:1: error: expected primary-expression before 'using'
   19 | using namespace std;
      | ^~~~~
a.cc:21:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   21 | int main()
      |         ^~
a.cc:21:9: note: remove parentheses to default-initialize a variable
   21 | int main()
      |         ^~
      |         --
a.cc:21:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:22:1: error: a function-definition is not allowed here before '{' token
   22 | {
      | ^
a.cc:63:13: error: redeclaration of 'int h'
   63 |         int h = 0;
      |             ^
a.cc:8:13: note: 'int h' previously declared here
    8 |         int h = 0;
      |             ^
a.cc:64:35: error: 'b' was not declared in this scope; did you mean 'bb'?
   64 |         for (int bb = 0; bb < 10; b++)
      |                                   ^
      |                                   bb
Language: C++

#include <iostream>
#include <set>
using namespace std;

int main()
{
	set<int> a;
	int h = 0;
	int hh = 0;
	for (int b = 0; b < 10; b++)
	{
		int c;
		cin >> c;
		a.insert(-c);
	}
	set<int>::iterator it = a.begin();
	for (int g = 0; g < 3; g++)
	{
		h -= *it;
		*it++;
	}
	set<int> aa;
	int h = 0;
	for (int bb = 0; bb < 10; bb++)
	{
		int cc;
		cin >> cc;
		a.insert(-cc);
	}
	set<int>::iterator itt = aa.begin();
	for (int g = 0; g < 3; g++)
	{
		hh -= *itt;
		*itt++;
	}
	cout << h << endl;
	cout << hh << endl;
	getchar();
	getchar();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
   23 |         int h = 0;
      |             ^
a.cc:8:13: note: 'int h' previously declared here
    8 |         int h = 0;
      |             ^
Language: C++

#include <iostream>
#include <set>
using namespace std;

int main()
{
	set<int> a;
	int h = 0;
	int hh = 0;
	for (int b = 0; b < 10; b++)
	{
		int c;
		cin >> c;
		a.insert(-c);
	}
	set<int>::iterator it = a.begin();
	for (int g = 0; g < 3; g++)
	{
		h -= *it;
		*it++;
	}
	set<int> aa;
	int h = 0;
	for (int bb = 0; bb < 10; bb++)
	{
		int cc;
		cin >> cc;
		a.insert(-cc);
	}
	set<int>::iterator itt = aa.begin();
	for (int g = 0; g < 3; g++)
	{
		hh -= *itt;
		*itt++;
	}
	cout << h << endl;
	cout << hh << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
   23 |         int h = 0;
      |             ^
a.cc:8:13: note: 'int h' previously declared here
    8 |         int h = 0;
      |             ^
Language: C++

#include <cstdio>
#include <iostream>
#include <array>
#include <algorithm>
using namespace std;

int main() {
	array<array<int,10>,2> ar;
	for(int i = 0; 2 > i; i++){
		for(int j = 0; 10 > j; j++){
			scanf("%d\n", &ar[i][j]);
		}
		sort(ar[i].begin(), ar[i].end(), [](int a, int b){return a > b;});
	}
	printf("%d %d\n", accumulate(ar[0].begin(), ar[0].begin()+3, 0), accumulate(ar[1].begin(), ar[1].begin()+3, 0));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: 'accumulate' was not declared in this scope
   15 |         printf("%d %d\n", accumulate(ar[0].begin(), ar[0].begin()+3, 0), accumulate(ar[1].begin(), ar[1].begin()+3, 0));
      |                           ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int main(void){
    vector<int> a(10), b(10);
    for(auto & e : a) cin >> e;
    for(auto & e : b) cin >> e;

    sort(begin(a), end(a), grater<int>());
    sort(begin(b), end(b), grater<int>());

    cout << a[0] + a[1] + a[2] << " " << b[0] + b[1] + b[2] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: 'grater' was not declared in this scope
   10 |     sort(begin(a), end(a), grater<int>());
      |                            ^~~~~~
a.cc:10:35: error: expected primary-expression before 'int'
   10 |     sort(begin(a), end(a), grater<int>());
      |                                   ^~~
a.cc:11:35: error: expected primary-expression before 'int'
   11 |     sort(begin(b), end(b), grater<int>());
      |                                   ^~~
Language: C++

#include<iostream>
using namespace std;
int x[10][2],sum[2],c,d;
int main(){
for(int i=0;i<20;i++){cin>>x[i%10][i/10];}
for(int i=9999;i>=0;i--){if(c>=3){break;}
for(int j=0;j<10;j++){if(x[j][0]==i){c++;sum[0]+=x[j][0]}}}
for(int i=9999;i>=0;i--){if(d>=3){break;}
for(int j=0;j<10;j++){if(x[j][1]==i){d++;sum[1]+=x[j][1]}}}
cout<<sum[0]<<' '<<sum[1]<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:57: error: expected ';' before '}' token
    7 | for(int j=0;j<10;j++){if(x[j][0]==i){c++;sum[0]+=x[j][0]}}}
      |                                                         ^
      |                                                         ;
a.cc:9:57: error: expected ';' before '}' token
    9 | for(int j=0;j<10;j++){if(x[j][1]==i){d++;sum[1]+=x[j][1]}}}
      |                                                         ^
      |                                                         ;
Language: C++

#include <iostream>
#include <algorithm>



using namespace std;

int main(){
	int a[10];
	int b[10];
	cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]>>a[8]>>a[9]>>a[10];
	cin>>b[1]>>b[2]>>b[3]>>b[4]>>b[5]>>b[6]>>b[7]>>b[8]>>b[9]>>b[10];
	sort(a,a+10);
	sort(b,b+10);
    int c=a[10]+a[9]+a[8];
	int d=b[10]+b[9]+b[8];
	cout<<max(c,d)<<endl;


	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected '}' at end of input
   20 |         return 0;
      |                  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <algorithm>
using namespace std;

int main()
{
	int w[10], k[10], ans1, ans2;
	
	for (int i = 0; i < 10; i++){
		scanf("%d", &w[i]);
	}
	for (int i = 0; i < 10; i++){
		scanf("%d", &k[i]);
	}
	
	sort(w, w+10);
	sort(k, k+10);
	
	ans1 =  w[9] + w[8] + w[7];
	ans2 =  k[9] + k[8] + k[7];
	
	
	printf("%d %d\n", ans1, ans2);
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'scanf' was not declared in this scope
    9 |                 scanf("%d", &w[i]);
      |                 ^~~~~
a.cc:12:17: error: 'scanf' was not declared in this scope
   12 |                 scanf("%d", &k[i]);
      |                 ^~~~~
a.cc:22:9: error: 'printf' was not declared in this scope
   22 |         printf("%d %d\n", ans1, ans2);
      |         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <algorithm>
  +++ |+#include <cstdio>
    2 | using namespace std;
Language: C++

#include<cstdio>
#include<string>
#include<iostream>
#include<vector>

using namespace std;

int main(){
	
	vector<int> a;
	vector<int> b;
	
	for(int i=0;i<10;i++){
		int c;
		cin>>c;
		a.push_back(c);
	}
	
	for(int i=0;i<10;i++){
		int c;
		cin>>c;
		b.push_back(c);
	}
	
	
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	
	
	printf("%d %d\n", a[7]+a[8]+a[9], b[7]+b[8]+b[9]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |         sort(a.begin(), a.end());
      |         ^~~~
      |         short
Language: C++

#include <cstdio>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
 memset(w,0,sizeof(w));
 for(int i=0;i<10;i++){
 scanf("%d",&x);
 if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x}
 else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
 else if(x>w[2]) w[2]=x;
 }
 printf("%d\n",w[0]+w[1]+w[2]);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'memset' was not declared in this scope
    7 |  memset(w,0,sizeof(w));
      |  ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <cstdio>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:10:41: error: expected ';' before '}' token
   10 |  if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x}
      |                                         ^
      |                                         ;
Language: C++

#include <cstdio>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
 memset(w,0,sizeof(w));
 for(int i=0;i<10;i++){
 scanf("%d",&x);
 if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
 else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
 else if(x>w[2]) w[2]=x;
 }
 printf("%d\n",w[0]+w[1]+w[2]);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'memset' was not declared in this scope
    7 |  memset(w,0,sizeof(w));
      |  ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <cstdio>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
 memset(w,0,sizeof(w));
 for(int i=0;i<10;i++){
 scanf("%d",&x);
 if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
 else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
 else if(x>w[2]) w[2]=x;
 }
 printf("%d\n",w[0]+w[1]+w[2]);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:2: error: 'memset' was not declared in this scope
    8 |  memset(w,0,sizeof(w));
      |  ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdlib>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
char h[3]={ ,\n};
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
 memset(w,0,sizeof(w));
 for(int i=0;i<10;i++){
 scanf("%d",&x);
 if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
 else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
 else if(x>w[2]) w[2]=x;
 }
 printf("%d%c",w[0]+w[1]+w[2],h[j]);
}
}

Compiler output:
a.cc:5:14: error: stray '\' in program
    5 | char h[3]={ ,\n};
      |              ^
a.cc:5:13: error: expected primary-expression before ',' token
    5 | char h[3]={ ,\n};
      |             ^
a.cc:5:15: error: 'n' was not declared in this scope
    5 | char h[3]={ ,\n};
      |               ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	vector<int> a(10);
	vector<int> b(10);
	for(int i=0;i<10;i++){
		cin >> a[i];
	}
	for(int i=0;i<10;i++){
		cin >> b[i];
	}
	vector<int> c=reverse(a.begin(),a.end());
	vector<int> d=reverse(a.begin(),a.end());
	sort(c.begin(),c.end());
	cout << c[0] + c[1] + c[2] << " ";
	sort(d.begin(),d.end());
	cout << d[0] + d[1] + d[2] << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: conversion from 'void' to non-scalar type 'std::vector<int>' requested
   14 |         vector<int> c=reverse(a.begin(),a.end());
      |                       ~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:15:30: error: conversion from 'void' to non-scalar type 'std::vector<int>' requested
   15 |         vector<int> d=reverse(a.begin(),a.end());
      |                       ~~~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	for (int i = 0; i < 2; ++i) {
		vector<int>v(10;)
		for (int j = 0; j < 10; ++j) {
			cin>>vs[j]
		}
		sort(vs.begin(), vs.end());
		cout << vs[7] + vs[8] + vs[9] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: expected ')' before ';' token
   14 |                 vector<int>v(10;)
      |                             ~  ^
      |                                )
a.cc:14:33: error: expected primary-expression before ')' token
   14 |                 vector<int>v(10;)
      |                                 ^
a.cc:15:33: error: 'j' was not declared in this scope
   15 |                 for (int j = 0; j < 10; ++j) {
      |                                 ^
a.cc:18:22: error: 'vs' was not declared in this scope; did you mean 'v'?
   18 |                 sort(vs.begin(), vs.end());
      |                      ^~
      |                      v
Language: C++

#include <cstdio>
#include <vector>
using namespace std;

int main(){
	vector<int> w, k;
	for (int i = 0; i < 10; i++){
		int x;
		scanf("%d", &x);
		w.push_back(x);
	}
	for (int i = 0; i < 10; i++){
		int x;
		scanf("%d", &x);
		k.push_back(x);
	}
	
	sort(w.begin(), w.end());
	sort(k.begin(), k.end());

	printf("%d %d\n", w[7] + w[8] + w[9], k[7] + k[8] + k[9]);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |         sort(w.begin(), w.end());
      |         ^~~~
      |         short
Language: C++

#include <stdio.h>

#define N 10

int main(void){
	int wScores[N];
	int kScores[N];
	int wBests,kBests;
	
	for (int i=0;i<N;i++) scanf("%d",&wScores[i]);
	for (int i=0;i<N;i++) scanf("%d",&kScores[i]);
	
	wBests=0; kBests=0;
	for (int i=0;i<3;i++){
		int max, p;
		max = 0;
		for (int j=0;j<N;j++){
			if (wScores[j] > max){
				max = wScores[j];
				p = j;
			}
		}
		wBests += max;
		wScores[p] = 0;
	}
	for (int i=0;i<3;i++){
		int max, p;
		max = 0;
		for (int j=0;j<N;j++){
			if (wScores[j] > max){
				max = wScores[j];
				p = j;
			}
		}
		wBests += max;
		wScores[p] = 0;
	}
	for (int i=0;i<3;i++){
		int max, p;
		max = 0;
		for (int j=0;j<N;j++){
			if (wScores[j] > max){
				max = kScores[j];
				p = j;
			}
		}
		kBests += max;
		kScores[p] = 0;
	}
	printf("%d %d\n",wBests, kBests);

Compiler output:
a.cc: In function 'int main()':
a.cc:50:42: error: expected '}' at end of input
   50 |         printf("%d %d\n",wBests, kBests);
      |                                          ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C++

#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;

int main(){
	int A = 0, B = 0;
	int buf;
	for (int a = 0; a < 10, a++){
		scanf("%d", &buf);
		A += buf;
	}
	for (int a = 0; a < 10, a++){
		scanf("%d", &buf);
		B += buf;
	}
	printf("%d %d\n", A, B);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:36: error: expected ';' before ')' token
    9 |         for (int a = 0; a < 10, a++){
      |                                    ^
      |                                    ;
a.cc:13:36: error: expected ';' before ')' token
   13 |         for (int a = 0; a < 10, a++){
      |                                    ^
      |                                    ;
Language: C++

#include<iostream>
#Include<algorithm>

using namespace std;


int a[10], b[10];

int main(){
	for(int i = 0;i < 10;i++){
		cin >> a[i];
	}
	sort(a, a + 10);
	for(int i = 0;i < 10;i++){
		cin >> b[i];
	}
	sort(b, b + 10);

	cout << a[9] + a[8] + a[7] << " " << b[9] + b[8] + b[7] << endl;
	return 0;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #Include; did you mean #include?
    2 | #Include<algorithm>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |         sort(a, a + 10);
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0;i < N;i++)
int main()
{
  int data[10];
  int sum[2];
  Rep(p,2) {
    Rep(i,10)cin >> data[i];
    sort(data, data + 10,greater<int> );
    sum[p] = accumulate(data, data + 3,0);
  }
  cout << sum[0] << " " << sum[1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:39: error: expected primary-expression before ')' token
   10 |     sort(data, data + 10,greater<int> );
      |                                       ^
Language: C++

a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
f = gets.to_i
g = gets.to_i
h = gets.to_i
i = gets.to_i
j = gets.to_i

k = gets.to_i
l = gets.to_i
m = gets.to_i
n = gets.to_i
o = gets.to_i
p = gets.to_i
q = gets.to_i
r = gets.to_i
s = gets.to_i
t = gets.to_i

print("#{a+b+c+d+e+f+g+h+i+j} ")
print("#{k+l+m+n+o+p+q+r+s+t}\n")

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a = gets.to_i
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int P[2];
  for(int i = 0; i < 2; i++){
    vector<int> point(10);
    for(int j = 0; j < 10; j++){
      cin >> point[j];
    }
    sort(point.begin(), point.end());
     point[0] + point[1] + point[2];
  }
  cout << p[0] << " " << P[1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'p' was not declared in this scope
   16 |   cout << p[0] << " " << P[1] << endl;
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int P[2];
  for(int i = 0; i < 2; i++){
    vector<int> point(10);
    for(int j = 0; j < 10; j++){
      cin >> point[j];
    }
    sort(point.rbegin(), point.rend(), );
     P[i] = point[0] + point[1] + point[2];
  }
  cout << P[0] << " " << P[1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:40: error: expected primary-expression before ')' token
   13 |     sort(point.rbegin(), point.rend(), );
      |                                        ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){

  vector<int> w(10);
  vector<int> k(10);
  int w1=0;
  int w2=0;
  int w3=0;
  
  for(int i=0;i<10;++i)
	cin>>w[i];

  for(int i=0;i<10;++i)
	cin>>k[i];

  int temp;
  for(int i=0;i<10;++i){
	if(w1>w[i]){
	  w1=w[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w2>w[i]){
	  w2=w[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w3>w[i]){
	  w3=w[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w1>k[i]){
	  w1=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w2>k[i]){
	  w2=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w3>k[i]){
	  w3=k[i];
	  temp=i;
	}
  }

    for(int i=0;i<10;++i){
	if(w1>k[i]){
	  w1=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w2>k[i]){
	  w2=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(w3>k[i]){
	  w3=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(k1>k[i]){
	  k1=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(k2>k[i]){
	  k2=k[i];
	  temp=i;
	}
  }

  for(int i=0;i<10;++i){
	if(k3>k[i]){
	  k3=k[i];
	  temp=i;
	}
  }
  
  cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;

  return 0;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:84:12: error: 'k1' was not declared in this scope; did you mean 'w1'?
   84 |         if(k1>k[i]){
      |            ^~
      |            w1
a.cc:91:12: error: 'k2' was not declared in this scope; did you mean 'w2'?
   91 |         if(k2>k[i]){
      |            ^~
      |            w2
a.cc:98:12: error: 'k3' was not declared in this scope; did you mean 'w3'?
   98 |         if(k3>k[i]){
      |            ^~
      |            w3
a.cc:104:24: error: 'k1' was not declared in this scope; did you mean 'w1'?
  104 |   cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
      |                        ^~
      |                        w1
a.cc:104:27: error: 'k2' was not declared in this scope; did you mean 'w2'?
  104 |   cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
      |                           ^~
      |                           w2
a.cc:104:30: error: 'k3' was not declared in this scope; did you mean 'w3'?
  104 |   cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
      |                              ^~
      |                              w3
Language: C++

using namespace std;
int main(){
	int p[10];
	for(int i=0;i<2;i++){
		for(int j=0;j<10;j++)cin>>p[j];
		sort(p,p+10);
		if(i)cout<<" ";
		cout<<p[7]+p[8]+p[9];
	}
	cout<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:38: error: 'cin' was not declared in this scope
    5 |                 for(int j=0;j<10;j++)cin>>p[j];
      |                                      ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:17: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |                 sort(p,p+10);
      |                 ^~~~
      |                 short
a.cc:7:22: error: 'cout' was not declared in this scope
    7 |                 if(i)cout<<" ";
      |                      ^~~~
a.cc:7:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:17: error: 'cout' was not declared in this scope
    8 |                 cout<<p[7]+p[8]+p[9];
      |                 ^~~~
a.cc:8:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout<<endl;
      |         ^~~~
a.cc:10:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:15: error: 'endl' was not declared in this scope
   10 |         cout<<endl;
      |               ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int a;
//	int w[10] = {0};
//	int k[10] = {0};
	
	vector<int> w(10);
	vector<int> k(10);
	
	for(int i = 0; i < 10; i++){
		cin >> w[i];
	}
	
	for(int i = 0; i < 10; i++){
		cin >> k[i];
	}
	
	sort(w.begin(), w.end()); 
	sort(k.begin(), k.end());
	
	printf("%d %d",w[9]+w[8]+w[7],k[9]+k[8]+k[7] );
	
	return 0;
}

		

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |         sort(w.begin(), w.end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
	int a;
	vector<int> vc;
	for(int i=0 ; i<10 ; ++i ){
		cin >> a;
		vc.push_back( a );
	}
	sort( vc.begin() , vc.end() );
	cout << vc[9]+vc[8]+vc[7] << " ";
	vc.clear();
	for(int i=0 ; i<10 ; ++i ){
		cin >> a;
		vc.push_back( a );
	}
	sort( vc.begin() , vc.end() );
	cout << vc[9]+vc[8]+vc[7] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |         sort( vc.begin() , vc.end() );
      |         ^~~~
      |         short
Language: C++

#include <stdio.h>
#include <stdlib.h>


int d0,d1,d2,d3,dmax,x,y;
int board[92][92];

int Search(x,y){
	if(board[x][y]==0) return 0;
	board[x][y]=0;
	d0=Search((x-1),y);

	dmax=d0;

	d1=Search((x+1),y);

	if(dmax<d1) dmax=d1;

	d2=Search(x,(y-1));

	if(dmax<d2) dmax=d2;

	d3=Search(x,(y+1));

	if(dmax<d3) dmax=d3;
	board[x][y]=1;
	return dmax+1;
}

int main(void) {

	int max=0,m,n,i,j;
	scanf("%d\n%d",&m,&n);
	for (i=1;i<=m;i++){
		for(j=1;j<=n;j++){
		scanf("%d",&board[i][j]);
		}
	}
	for (i=1;i<=m;i++){
			for(j=1;j<=n;j++){
			int	r=Search(i,j);
			if	(max<r) max=r;
			}
		}


	printf("%d\n",max);
	return EXIT_SUCCESS;
}

Compiler output:
a.cc:8:15: error: expression list treated as compound expression in initializer [-fpermissive]
    8 | int Search(x,y){
      |               ^
a.cc:8:16: error: expected ',' or ';' before '{' token
    8 | int Search(x,y){
      |                ^
a.cc: In function 'int main()':
a.cc:41:41: error: 'Search' cannot be used as a function
   41 |                         int     r=Search(i,j);
      |                                   ~~~~~~^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
    vector<int> w(10);
    vector<int> k(10);

    for(int i=0; i<10; i++){
        cin >> w[i];
    }

    for(int i=0; i<10; i++){
        cin >> k[i];
    }

    sort(w.begin(), w.end(), greater<int>());
    sort(k.begin(), k.end(), greater<int>());

    int w_sum = 0;
    int k_sum = 0;

    for(int i=0; i<3; i++){
        w_sum += w[i];
        k_sum += k[i];
    }

    printf("%d %d\n", w_sum, k_sum);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(w.begin(), w.end(), greater<int>());
      |     ^~~~
      |     short
Language: C++

#include <cstdi>
#include <cstdlib>

using namespace std;

int main() {
	int w[10],k[10];
	int i,j,p,q,t,s;
	int wsum=0,ksum=0,swap;
	for(i=0;i<10;i++) {
		scanf("%d\n",&w[i]);
	}
	for(t=0;t<10;t++){
		for(j=0;j<10;j++){
			if (w[j]>w[j+1]) {
				swap=w[j];
				w[j]=w[j+1];
				w[j+1]=swap;
			}
		}
	}
	wsum=w[9]+w[8]+w[7];
	for(p=0;p<10;p++){
		scanf("%d\n",&k[p]);
	}
	for(s=0;s<10;s++){
		for(q=0;q<10;q++){
			if (k[q]>k[q+1]) {
				swap=k[q];
				k[q]=k[q+1];
				k[q+1]=swap;
			}
		}
	}

		ksum=k[9]+k[8]+k[7];
		printf("%d %d\n",wsum,ksum);
		return 0;
	}

Compiler output:
a.cc:1:10: fatal error: cstdi: No such file or directory
    1 | #include <cstdi>
      |          ^~~~~~~
compilation terminated.
Language: C++

#include <vector>
#include <iostream>
using namespace std;

int main(){
    vector<int> w, k;
    int b;
    for (int i = 0; i < 10; i++){
	cin >> b;
	w.push_back(b);
    }
    for (int i = 0; i < 10; i++){
	cin >> b;
	k.push_back(b);
    }

    sort(w.begin(), w.end(), greater<int>());
    sort(k.begin(), k.end(), greater<int>());
    int ww = 0, kk = 0;
    for (int i = 0; i < 3; i++) ww += w[i];
    for (int i = 0; i < 3; i++) kk += k[i];

    cout << ww << " " << kk << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(w.begin(), w.end(), greater<int>());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
using namespace std;
int main(void){
  int ans1=0,ans2=0,a[10],b[10];
  for(int i=0;i<10;i++) cin>> a[i];
  for(int i=0;i<10;i++) cin >> b[i];
  sort(a,a+10);
  sort(b,b+10);
  for(int i=7;i<=9;i++){
    ans1 +=a[i];
    ans2 +=b[i];
  }cout << ans1<< " " << ans2<< endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |   sort(a,a+10);
      |   ^~~~
      |   short
Language: C++

#include <stdio.h>

int main(){
	int a=0,b=0,c=0,s;
	int i,j;
	for(i=0,i<10,i++){
		scanf("%d \n",&s);
		if(s>a){
			c=b;
			b=a;
			a=s;
		}
		else if(s>b){
			c=b;
			b=s;
		}
		else if(s>c){
			c = s;
		}
	}
	printf("%d ",a+b+c);
	a=0; b=0; c=0;
	for(i=0,i<10,i++){
		scanf("%d \n",&s);
		if(s>a){
			c=b;
			b=a;
			a=s;
		}
		else if(s>b){
			c=b;
			b=s;
		}
		else if(s>c){
			c = s;
		}
	}
	printf("%d\n",a+b+c);
	return 0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:6:25: error: expected ';' before ')' token
    6 |         for(i=0,i<10,i++){
      |                         ^
      |                         ;
a.cc:22:12: error: expected ')' before ';' token
   22 |         a=0; b=0; c=0;
      |            ^
      |            )
a.cc:6:12: note: to match this '('
    6 |         for(i=0,i<10,i++){
      |            ^
a.cc:23:25: error: expected ';' before ')' token
   23 |         for(i=0,i<10,i++){
      |                         ^
      |                         ;
a.cc:39:9: error: expected primary-expression before 'return'
   39 |         return 0;
      |         ^~~~~~
a.cc:38:30: error: expected ')' before 'return'
   38 |         printf("%d\n",a+b+c);
      |                              ^
      |                              )
   39 |         return 0;
      |         ~~~~~~                
a.cc:23:12: note: to match this '('
   23 |         for(i=0,i<10,i++){
      |            ^
Language: C++

#include <stdio.h>
void swap(int *a,int *b){
   int tmp;
   tmp = *a;
   *a=*b;
   *b=tmp;
   return;
}
int main(){
  int i,n,k[10],w[10],K,W;
  K=W=0;
  for(i=0;i<10;i++){
    scanf("%d",&n);
    w[i]=n;
  }
  for(i=0;i<10;i++){
    scanf("%d",&n);
    k[i]=n;
  }
  for(i=0;i<3;i++){
    for(int j=i+1;j<10;j++) if(k[i]<k[j]) swap(&k[i],k[j]);
  }
  for(i=0;i<3;i++){
    for(int j=i+1;j<10;j++) if(w[i]<w[j]) swap(&w[i],w[j]);
  }
  for(i=0;i<3;i++){
    K+=k[i];W+=w[i];
  }
  printf("%d %d\n",W,K);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:57: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   21 |     for(int j=i+1;j<10;j++) if(k[i]<k[j]) swap(&k[i],k[j]);
      |                                                      ~~~^
      |                                                         |
      |                                                         int
a.cc:2:23: note:   initializing argument 2 of 'void swap(int*, int*)'
    2 | void swap(int *a,int *b){
      |                  ~~~~~^
a.cc:24:57: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   24 |     for(int j=i+1;j<10;j++) if(w[i]<w[j]) swap(&w[i],w[j]);
      |                                                      ~~~^
      |                                                         |
      |                                                         int
a.cc:2:23: note:   initializing argument 2 of 'void swap(int*, int*)'
    2 | void swap(int *a,int *b){
      |                  ~~~~~^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int sum[2] = {0};

  for(int i = 0; i < 2; i++){
    int x[10];
    for(int j = 0; j < 10; j++){
      cin >> x[j];
    }
    sort(x, x + 10);
    sum[i] += x[9] + x[8] + x[7];
  }
  cout << sum[0] << " " << sum[1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |     sort(x, x + 10);
      |     ^~~~
      |     short
Language: C

#include <stdio.h>

int chain(int chara[],int i,int j,int n){
  int count1,count2,c,k,m;
  count1 = count2 = 0;
  chara[i] = j;
  for(c = i;chara[i] == chara[i+1] && i < n-1 ;c++){
    count1++;
  }
   for(c = i;chara[i] == chara[i-1] && i > 0 ;c--){
    count2++;
  }
  if(count1 + count2 < 3) return 0;
  else {
    for(c = i - count2;c <= i + count1;c++){
      chara[c] = 0;
    }
  }
  m = count1 + count2

  while(1){
    for(c = i+ count1+1;c < n ;c++ ){
      if(chara[c] == chara[c+1]) count1++;
      else {
        count1++;c = n;k = chara[c]
        }
      }      
      }
    for(c = i-count2-1;c > 0 ;c-- ){
      if(chara[c] == chara[c-1] && chara[c-1] == k ) count2++; 
      else {    
        count2++;c = 0;
        }  
      }      
      }
    if(count1 + count2 < 2) break;
    m = m + count1 + count2;
  }

  return n-m ;
}

int main(){
  int n,t,i,chara[10000],Min,temp;

  while(1){
    scanf("%d",&n);

    if(n == 0) break;

    for(i=0;i<n;i++){
      scanf("%d",&chara[i]);
    }
    for(i=0;i<n;i++){
      if(chara[i] == 1){
        temp = chain(chara,i,2,n);
        if(temp > chain(chara,i,3,n)) temp = chain(chara,i,3,n);
      if(Min > temp) Min = temp;
      }
       if(chara[i] == 2){
        temp = chain(chara,i,1,n);
        if(temp > chain(chara,i,3,n)) temp = chain(chara,i,3,n);
      if(Min > temp) Min = temp;
      }
            if(chara[i] == 3){
        temp = chain(chara,i,1,n);
        if(temp > chain(chara,i,2,n)) temp = chain(chara,i,2,n);
      if(Min > temp) Min = temp;
      }
    }

    printf("%d",Min);
  }

  return 0;
}

Compiler output:
main.c: In function 'chain':
main.c:19:22: error: expected ';' before 'while'
   19 |   m = count1 + count2
      |                      ^
      |                      ;
   20 | 
   21 |   while(1){
      |   ~~~~~               
main.c: At top level:
main.c:36:5: error: expected identifier or '(' before 'if'
   36 |     if(count1 + count2 < 2) break;
      |     ^~
main.c:37:5: warning: data definition has no type or storage class
   37 |     m = m + count1 + count2;
      |     ^
main.c:37:5: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
main.c:37:13: error: 'count1' undeclared here (not in a function)
   37 |     m = m + count1 + count2;
      |             ^~~~~~
main.c:37:22: error: 'count2' undeclared here (not in a function)
   37 |     m = m + count1 + count2;
      |                      ^~~~~~
main.c:38:3: error: expected identifier or '(' before '}' token
   38 |   }
      |   ^
main.c:40:3: error: expected identifier or '(' before 'return'
   40 |   return n-m ;
      |   ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C++

#include<cstdio>
#include<algorithm>
main(){
while(true){
int x[15000],n,i,j,k,l,m,y[15000],b,c,d,p[15000],minx;
scanf("%d", &n);
if(n==0){break;}
for(i=0;i<n;i++){scanf("%d", &y[i]);p[i] = x[i] = y[i];}
c=0;d=0;m=n;d=m;
minx=99999;
for(i=0;i<n;i++){
for(j=1;j<=3;j++){
if(i>=1 && (y[i-1]!=j && y[i+1]!=j)){goto z;}
p[i] = x[i] = j;
b=1;d=n;
while(true){c=0;
for(k=0;k<m;k++){
if(p[k]==p[k+1]){b++;}
else{
if(b >= 4){
for(l = k + 1; l < m; l++){p[l-b] = p[l];}
d -= b;c++;
for(l=d;l<m;l++){p[l]=0;}
}
b=1;}   
m=d;}
if(c==0){break;}
else{c=0;}
}
minx=min(minx,m);x[i]=y[i];
for(int k=0;k<n;k++){p[k]=y[k];}
z:;
}
}
printf("%d\n", minx);}
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:30:6: error: 'min' was not declared in this scope; did you mean 'std::min'?
   30 | minx=min(minx,m);x[i]=y[i];
      |      ^~~
      |      std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<cstdio>
#include<algorithm>
main(){
while(true){
int x[11000],n,i,j,k,l,m,y[11000],b,c,d,p[11000],minx;
scanf("%d", &n);
if(n==0){break;}
for(i=0;i<n;i++){scanf("%d", &y[i]);p[i]=x[i]=y[i];}
c=0;d=0;m=n;d=m;
minx=99999;
for(i=0;i<n;i++){
for(j=1;j<=3;j++){
if(i>=1&&y[i-1]!=j&&y[i+1]!=j)){goto z;}
p[i]=x[i]=j;b=1;d=n;
while(true){c=0;
for(k=0;k<m;k++){
if(p[k]==p[k+1]){b++;}
else{
if(b >= 4){
for(l=k+1;l<m;l++){p[l-b]=p[l];}
d -= b;c++;
for(l=d;l<m;l++){p[l]=0;}
}
b=1;}   
m=d;}
if(c==0){break;}
else{c=0;}
}
minx=std::min(minx,m);x[i]=y[i];
for(int k=0;k<n;k++){p[k]=y[k];}
z:;
}
}
printf("%d\n",minx);}
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:31: error: expected primary-expression before ')' token
   13 | if(i>=1&&y[i-1]!=j&&y[i+1]!=j)){goto z;}
      |                               ^
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"


int getans(vector<int>&l, vector<int>&r) {
	int lt = l.back();
	int rt = r[0];
	int a = l.size() - 1;
	while (a >= 0) {
		if (lt == l[a]) {
			a--;
		}
		else {
			break;
		}
	}
	int b = 0;
	while (b <= r.size() - 1) {
		if (rt == r[b]) {
			b++;
		}
		else {
			break;
		}
	}
	if (lt == rt) {
		int num = (l.size() - 1) - a + b;
		if (num>=3) {
			return num+1 + getans(vector<int>(l.begin(), l.begin() + a+1), vector<int>(r.begin() + b, r.end()));
		}
		else {
			return 0;
		}
	}
}
int getans(vector<int>&as, int a) {
	int f = a;
	int t = a;
	int color = as[a];
	while (f >= 0) {
		if (color == as[f])f--;
		else break;
	}
	f++;
	while (t <= as.size() - 1) {
		if (color == as[t])t++;
		else break;
	}
	t--;
	if (t - f >= 3) {
		return (t-f+1)+getans(vector<int>(as.begin(), as.begin() + f), vector<int>(as.begin() + t+1, as.end()));
	}
}
int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<int>as(N);
		for (int i = 0; i < N; ++i) {
			cin >> as[i];
			as[i]--;
		}
		int ans = 0;
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < 3; ++j) {
				int a = as[i];
				as[i] = j;
				ans = max(ans, getans(as, i));
				as[i] = a;

			}
		}
		cout << N - ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int getans(std::vector<int>&, std::vector<int>&)':
a.cc:38:47: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   38 |                         return num+1 + getans(vector<int>(l.begin(), l.begin() + a+1), vector<int>(r.begin() + b, r.end()));
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:24: note:   initializing argument 1 of 'int getans(std::vector<int>&, std::vector<int>&)'
   14 | int getans(vector<int>&l, vector<int>&r) {
      |            ~~~~~~~~~~~~^
a.cc: In function 'int getans(std::vector<int>&, int)':
a.cc:60:39: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   60 |                 return (t-f+1)+getans(vector<int>(as.begin(), as.begin() + f), vector<int>(as.begin() + t+1, as.end()));
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:24: note:   initializing argument 1 of 'int getans(std::vector<int>&, std::vector<int>&)'
   14 | int getans(vector<int>&l, vector<int>&r) {
      |            ~~~~~~~~~~~~^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

char chain[10000];

int ccount(int a, int b, int cnt){
	if (chain[a] != chain[b])return cnt;
	int len = 0;
	int i, j;
	for (i = a; chain[a] == chain[i]; i--, len++);
	for (j = b; chain[b] == chain[j]; j++, len++);
	if (len < 4)return cnt;
	return ccount(i, j, cnt + len);
}

int main(){
	int n, ma = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &chain[i]);
	for (int i = 0; i < n; i++){
		char default = chain[i];
		for (int j = 1; j <= 3; j++){
			chain[i] = j;
			int s, g, cnt = 1;
			for (s = i - 1; chain[s] == chain[i]; s--, cnt++);
			for (g = i + 1; chain[g] == chain[i]; g++, cnt++);
			if (cnt >= 4){ ma = max(ccount(s, g, cnt), ma); }
		}
		chain[i] = default;
	}
	printf("%d\n", n - ma);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: expected unqualified-id before 'default'
   23 |                 char default = chain[i];
      |                      ^~~~~~~
a.cc:31:28: error: expected primary-expression before 'default'
   31 |                 chain[i] = default;
      |                            ^~~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;

int n;
char chain[10000];

int ccount(int a, int b, int cnt){
	if (chain[a] != chain[b])return cnt;
	int len = 0;
	int i, j;
	for (i = a; chain[a] == chain[i]; i--, len++);
	for (j = b; chain[b] == chain[j]; j++, len++);
	if (len < 4)return cnt;
	return ccount(i, j, cnt + len);
}

int main(){
	while (scanf("%d", &n), n){
		memset(chain, 0, sizeof(chain));
		int ans = 0;
		for (int i = 0; i < n; i++)
			scanf("%d", &chain[i]);
		for (int i = 0; i < n; i++){
			char def = chain[i];
			for (int j = 1; j <= 3; j++){
				chain[i] = j;
				int s, g, cnt = 1;
				for (s = i - 1; chain[s] == chain[i]; s--, cnt++);
				for (g = i + 1; chain[g] == chain[i]; g++, cnt++);
				if (cnt >= 4){ ans = max(ccount(s, g, cnt), ans); }
			}
			chain[i] = def;
		}
		printf("%d\n", n - ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
   20 |                 memset(chain, 0, sizeof(chain));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <stdio.h>
#include <algorithm>
#define INF	123456789

int N, A[11234];
int memo_A[11234];
int bound[11234][3][2];
int ans = INF;

int how_same(int num, int color) {
	int s1 = 0, s2 = 0;
	for (int i = num + 1; i < N; ++i) {
		if (A[i] == color) { ++s1; }
		else if (A[i] != -1) {
			bound[num][color][0] = i - 1;
			break;
		}
	}
	for (int i = num - 1; i >= 0; --i) {
		if (A[i] == color) { ++s2; }
		else if (A[i] != -1) {
			bound[num][color][1] = i + 1;
			break;
		}
	}
	return s1 + s2 + 1;
}

int solve(int num, int color) {
	int res = 0;
	res += how_same(num, color);
	if (res >= 4) {
		for (int i = bound[num][color][1]; i <= bound[num][color][0]; ++i) { A[i] = -1; }
		if (A[bound[num][color][1] - 1] == A[bound[num][color][0] + 1]) {
			res += solve(bound[num][color][0] + 1, A[bound[num][color][0] + 1]);
		}
		else {
			int tmp = 0;
			tmp += how_same(bound[num][color][0] + 1, A[bound[num][color][0] + 1]);
			if (tmp < 4) { tmp = 0; }
			tmp += how_same(bound[num][color][1] - 1, A[bound[num][color][1] - 1]);
			if (tmp < 4) { tmp = 0; }
		}
	}
	if (res < 4) { res = 0; }
	return res;
}

int main(void) {
	while (true) {
		scanf("%d", &N);
		if (N == 0) { break; }
		memset(bound, 0, sizeof(bound));
		ans = INF;
		for (int i = 0; i < N; ++i) { scanf("%d", &A[i]); }

		for (int i = 0; i < N; ++i) { memo_A[i] = A[i]; }
		for (int i = 1; i < N - 1; ++i) {
				for (int j = 1; j <= 3; ++j) {
					ans = std::min(ans, N - solve(i, j));
					// printf("%d", ans);
					// printf("(%d,%d)\n", i + 1, j);
					for (int k = 0; k < N; ++k) {
						// printf("%d", A[k]);
						A[k] = memo_A[k];
					}
					// printf("\n----------\n");
				}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: 'memset' was not declared in this scope
   53 |                 memset(bound, 0, sizeof(bound));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | #define INF     123456789
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
int p[10000]={0},o[10000]={0};
int X(int x){
int e,z,u,t=0,k,g=0,w;
for(e=0;e<x;e++){
	u=0;
	w=0;
	if(o[e]!=0){
	for(z=e;z<x;z++){
			if(o[e]==o[z])u++;
			else if(o[z]==0)w++;
			else break;
	}
	if(u>=4){
		t=1;
		for(k=0;k<w+u;k++)o[e+k]=0;
	}
	if(o[e]!=0)g++;
}
if(t==1)return X(x);
return g;
}
int main(){
//int a[1000],b=0;
while(1){
	int n,i,j,m=10001,l;
	cin>>n;
	if(n==0)break;
	memset(p,0,sizeof(p));
	memset(o,0,sizeof(o));
	for(i=0;i<n;i++)cin>>p[i];
m=n;
	for(i=0;i<n;i++){
		for(j=1;j<=3;j++){
			for(l=0;l<n;l++)o[l]=p[l];
			o[i]=j;
			m=min(m,X(n));
		}
	}
	/*a[b]=m;
	b++;*/
	cout<<m<<endl;
}
//for(int r=0;r<b;r++)cout<<a[r]<<endl;
return 0;
}
		

Compiler output:
a.cc: In function 'int X(int)':
a.cc:28:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   28 | int main(){
      |         ^~
a.cc:28:9: note: remove parentheses to default-initialize a variable
   28 | int main(){
      |         ^~
      |         --
a.cc:28:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:28:11: error: a function-definition is not allowed here before '{' token
   28 | int main(){
      |           ^
a.cc:51:2: error: expected '}' at end of input
   51 | }
      |  ^
a.cc:8:13: note: to match this '{'
    8 | int X(int x){
      |             ^
a.cc:51:2: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      |  ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
int p[10000]={0},f[10000]={0},o[10000]={0};
/*int X(int x){
int e,z,u,t=0,k,g=0,w;
for(e=0;e<x;e++){
	u=0;
	w=0;
	if(o[e]!=0){
		for(z=e;z<x;z++){
				if(o[e]==o[z])u++;
				else if(o[z]==0)w++;
				else break;
		}
	}
	if(u>=4){
		t=1;
		for(k=0;k<w+u;k++)o[e+k]=0;
	}
	if(o[e]!=0)g++;
}
if(t==1)return X(x);
return g;
}*/
int main(){
//int a[1000],b=0;
while(1){
	int n,i,j,m,l;
	cin>>n;
	if(n==0)break;
	for(i=0;i<n;i++)cin>>p[i];
	for(i=0;i<n;i++){
		if(p[i]==p[i-1]&&i!=0)f[i]=f[i-1];
		else{
			for(j=i;j<n;j++){
				if(p[i]==p[j])f[i]++;
				else break;
			}
		}
	}
	m=n;
	for(i=0;i<n;i++){
		if(i!=n-1&&p[i]!=p[i+1]&&f[i]+f[i+1]>=4||i!=0&&p[i]!=p[i-1]&&f[i]+f[i-1]>=4){
			for(j=1;j<=3;j++){
				for(l=0;l<n;l++)o[l]=p[l];
				if(o[i]!=j){
					o[i]=j;
t=1;
while(t!=0){
int e,z,u,k,g=0,w;
t=0;
for(e=0;e<x;e++){
	u=0;
	w=0;
	if(o[e]!=0){
		for(z=e;z<x;z++){
				if(o[e]==o[z])u++;
				else if(o[z]==0)w++;
				else break;
		}
	}
	if(u>=4){
		t=1;
		for(k=0;k<w+u;k++)o[e+k]=0;
	}
	if(o[e]!=0)g++;
}
}
					m=min(m,g);
				}
			}
		}
	}
	/*a[b]=m;
	b++;*/
	cout<<m<<endl;
}
//for(int r=0;r<b;r++)cout<<a[r]<<endl;
return 0;
}
		

Compiler output:
a.cc: In function 'int main()':
a.cc:52:1: error: 't' was not declared in this scope
   52 | t=1;
      | ^
a.cc:56:11: error: 'x' was not declared in this scope
   56 | for(e=0;e<x;e++){
      |           ^
a.cc:73:49: error: 'g' was not declared in this scope
   73 |                                         m=min(m,g);
      |                                                 ^