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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int i, j, k;
	for (i = 0; i < 2; i++) {
		for (j = 0; j < 2; j++) {
			for (k = 0; k < 2; k++) {
				int sum = A;
				char p, q, r;
				if (i == 0) {
					sum += B;
					p = '+';
				}
				else {
					sum -= B;
					p = '-';
				}
				if (j == 0) {
					sum += C;
					q = '+';
				}
				else {
					sum -= C;
					q = '-';
				}
				if (k == 0) {
					sum += D;
					r = '+';
				}
				else {
					sum -= D;
					r = '-';
				}
				if (sum == 7) {
					cout << A << p << B << q << C << r << D << "=7";
					exit(0);
				}
			}

		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> A >> B >> C >> D;
      |         ^~~
a.cc:35:41: error: 'cout' was not declared in this scope
   35 |                                         cout << A << p << B << q << C << r << D << "=7";
      |                                         ^~~~
a.cc:36:41: error: 'exit' was not declared in this scope
   36 |                                         exit(0);
      |                                         ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int main() {
Language: C

#include <iostream>

using namespace std;

int main(void) {
	int a, b, c, d;
	cin >> a;
	d = a % 10;
	a /= 10;
	c = a % 10;
	a /= 10;
	b = a % 10;
	a /= 10;
	if (a + b + c + d == 7)
		printf("%d+%d+%d+%d=7", a, b, c, d);
	else if (a + b + c - d == 7)
		printf("%d+%d+%d-%d=7", a, b, c, d);
	else if (a + b - c + d == 7)
		printf("%d+%d-%d+%d=7", a, b, c, d);
	else if (a + b - c - d == 7)
		printf("%d+%d-%d-%d=7", a, b, c, d);
	else if (a - b + c + d == 7)
		printf("%d-%d+%d+%d=7", a, b, c, d);
	else if (a - b + c - d == 7)
		printf("%d-%d+%d-%d=7", a, b, c, d);
	else if (a - b - c + d == 7)
		printf("%d-%d-%d+%d=7", a, b, c, d);
	else if (a - b - c - d == 7)
		printf("%d-%d-%d-%d=7", a, b, c, d);
	return 0;
}

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

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

int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    
    if(i==0){ 
      sum=A+B;
    }
    
    else{
      sum=A-B;
      s[1]='-';
    }
    
   for(int j=0;j<2;++j){
     
      if(j==0){ 
        sum=sum+C;
    　}
     
    　else{
      	sum=sum-C;
       	s[3]='-';
   　 }
     
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-';
    　}
    }///end of 3rd loop
   }///end of 2nd loop
    
   if(sum==7){
    break; 
   }
  cout<<s<<endl;
  }///end of 1st loop
}

Compiler output:
a.cc:34:5: error: extended character 　 is not valid in an identifier
   34 |     　}
      |     ^
a.cc:36:5: error: extended character 　 is not valid in an identifier
   36 |     　else{
      |     ^
a.cc:39:4: error: extended character 　 is not valid in an identifier
   39 |    　 }
      |    ^
a.cc:44:5: error: extended character 　 is not valid in an identifier
   44 |     　}
      |     ^
a.cc:45:5: error: extended character 　 is not valid in an identifier
   45 |     　else{
      |     ^
a.cc:48:5: error: extended character 　 is not valid in an identifier
   48 |     　}
      |     ^
a.cc: In function 'int main()':
a.cc:10:5: error: 'stirng' was not declared in this scope
   10 |     stirng s[9];
      |     ^~~~~~
a.cc:11:5: error: 's' was not declared in this scope
   11 |     s[0]=to_string(A);
      |     ^
a.cc:34:5: error: '\U00003000' was not declared in this scope
   34 |     　}
      |     ^~
a.cc:36:5: error: '\U00003000else' was not declared in this scope
   36 |     　else{
      |     ^~~~~~
a.cc:44:5: error: '\U00003000' was not declared in this scope
   44 |     　}
      |     ^~
a.cc:45:11: error: expected ';' before '{' token
   45 |     　else{
      |           ^
      |           ;
Language: C++

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

int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    
    if(i==0){ 
      sum=A+B;
    }
    
    else{
      sum=A-B;
      s[1]='-'
    }
    
   for(int j=0;j<2;++j){
     
      if(j==0){ 
        sum=sum+C;
    　}
     
    　else{
      	sum=sum-C;
       	s[3]='-'
   　 }
     
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-'
    　}
    }///end of 3rd loop
   }///end of 2nd loop
    
   if(sum==7){
    break; 
   }
  cout<<s<<endl;
  }///end of 1st loop
}

Compiler output:
a.cc:34:5: error: extended character 　 is not valid in an identifier
   34 |     　}
      |     ^
a.cc:36:5: error: extended character 　 is not valid in an identifier
   36 |     　else{
      |     ^
a.cc:39:4: error: extended character 　 is not valid in an identifier
   39 |    　 }
      |    ^
a.cc:44:5: error: extended character 　 is not valid in an identifier
   44 |     　}
      |     ^
a.cc:45:5: error: extended character 　 is not valid in an identifier
   45 |     　else{
      |     ^
a.cc:48:5: error: extended character 　 is not valid in an identifier
   48 |     　}
      |     ^
a.cc: In function 'int main()':
a.cc:10:5: error: 'stirng' was not declared in this scope
   10 |     stirng s[9];
      |     ^~~~~~
a.cc:11:5: error: 's' was not declared in this scope
   11 |     s[0]=to_string(A);
      |     ^
a.cc:34:5: error: '\U00003000' was not declared in this scope
   34 |     　}
      |     ^~
a.cc:36:5: error: '\U00003000else' was not declared in this scope
   36 |     　else{
      |     ^~~~~~
a.cc:44:5: error: '\U00003000' was not declared in this scope
   44 |     　}
      |     ^~
a.cc:45:11: error: expected ';' before '{' token
   45 |     　else{
      |           ^
      |           ;
Language: C++

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

int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    if(i==0){ 
      sum=A+B;
    }
    else{
      sum=A-B;
      s[1]='-'
    }
   for(int j=0;j<2;++j){
      if(j==0){ 
        sum=sum+C;
    　}
    　else{
      	sum=sum-C;
       	s[3]='-'
   　 }
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-'
    　}
     }
   }
   if(sum==7){
    break; 
   }
  cout<<s<<endl;
  }
}

Compiler output:
a.cc:30:5: error: extended character 　 is not valid in an identifier
   30 |     　}
      |     ^
a.cc:31:5: error: extended character 　 is not valid in an identifier
   31 |     　else{
      |     ^
a.cc:34:4: error: extended character 　 is not valid in an identifier
   34 |    　 }
      |    ^
a.cc:38:5: error: extended character 　 is not valid in an identifier
   38 |     　}
      |     ^
a.cc:39:5: error: extended character 　 is not valid in an identifier
   39 |     　else{
      |     ^
a.cc:42:5: error: extended character 　 is not valid in an identifier
   42 |     　}
      |     ^
a.cc: In function 'int main()':
a.cc:10:5: error: 'stirng' was not declared in this scope
   10 |     stirng s[9];
      |     ^~~~~~
a.cc:11:5: error: 's' was not declared in this scope
   11 |     s[0]=to_string(A);
      |     ^
a.cc:30:5: error: '\U00003000' was not declared in this scope
   30 |     　}
      |     ^~
a.cc:31:5: error: '\U00003000else' was not declared in this scope
   31 |     　else{
      |     ^~~~~~
a.cc:38:5: error: '\U00003000' was not declared in this scope
   38 |     　}
      |     ^~
a.cc:39:11: error: expected ';' before '{' token
   39 |     　else{
      |           ^
      |           ;
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    if(i==0){ 
      sum=A+B;
    }
    else{
      sum=A-B;
      s[1]='-'
    }
   for(int j=0;j<2;++j){
      if(j==0){ 
        sum=sum+C;
    　}
    　else{
      	sum=sum-C;
       	s[3]='-'
   　 }
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-'
    　}
     }
   }
   if(sum==7){
    break; 
   }
  cout<<s<<endl;
}

Compiler output:
a.cc:29:5: error: extended character 　 is not valid in an identifier
   29 |     　}
      |     ^
a.cc:30:5: error: extended character 　 is not valid in an identifier
   30 |     　else{
      |     ^
a.cc:33:4: error: extended character 　 is not valid in an identifier
   33 |    　 }
      |    ^
a.cc:37:5: error: extended character 　 is not valid in an identifier
   37 |     　}
      |     ^
a.cc:38:5: error: extended character 　 is not valid in an identifier
   38 |     　else{
      |     ^
a.cc:41:5: error: extended character 　 is not valid in an identifier
   41 |     　}
      |     ^
a.cc: In function 'int main()':
a.cc:9:5: error: 'stirng' was not declared in this scope
    9 |     stirng s[9];
      |     ^~~~~~
a.cc:10:5: error: 's' was not declared in this scope
   10 |     s[0]=to_string(A);
      |     ^
a.cc:29:5: error: '\U00003000' was not declared in this scope
   29 |     　}
      |     ^~
a.cc:30:5: error: '\U00003000else' was not declared in this scope
   30 |     　else{
      |     ^~~~~~
a.cc:37:5: error: '\U00003000' was not declared in this scope
   37 |     　}
      |     ^~
a.cc:38:11: error: expected ';' before '{' token
   38 |     　else{
      |           ^
      |           ;
a.cc:48:2: error: expected '}' at end of input
   48 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    if(i==0){ 
      sum=A+B;
    }
    else{
      sum=A-B;
      s[1]='-'
    }
   for(int j=0;j<2;++j){
      if(j==0){ 
        sum=sum+C;
    　}
    　else{
      	sum=sum-C;
       	s[3]='-'
   　 }
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-'
    　}
     }
   }
   if(sum==7){
    break; 
   }
  }
  cout<<s<<endl;
}

Compiler output:
a.cc:29:5: error: extended character 　 is not valid in an identifier
   29 |     　}
      |     ^
a.cc:30:5: error: extended character 　 is not valid in an identifier
   30 |     　else{
      |     ^
a.cc:33:4: error: extended character 　 is not valid in an identifier
   33 |    　 }
      |    ^
a.cc:37:5: error: extended character 　 is not valid in an identifier
   37 |     　}
      |     ^
a.cc:38:5: error: extended character 　 is not valid in an identifier
   38 |     　else{
      |     ^
a.cc:41:5: error: extended character 　 is not valid in an identifier
   41 |     　}
      |     ^
a.cc: In function 'int main()':
a.cc:9:5: error: 'stirng' was not declared in this scope
    9 |     stirng s[9];
      |     ^~~~~~
a.cc:10:5: error: 's' was not declared in this scope
   10 |     s[0]=to_string(A);
      |     ^
a.cc:29:5: error: '\U00003000' was not declared in this scope
   29 |     　}
      |     ^~
a.cc:30:5: error: '\U00003000else' was not declared in this scope
   30 |     　else{
      |     ^~~~~~
a.cc:37:5: error: '\U00003000' was not declared in this scope
   37 |     　}
      |     ^~
a.cc:38:11: error: expected ';' before '{' token
   38 |     　else{
      |           ^
      |           ;
a.cc:48:9: error: 's' was not declared in this scope
   48 |   cout<<s<<endl;
      |         ^
Language: C++

#include<iostream>
#include<stirng>
using namespace std;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<2;++i){
    int sum=0;
    stirng s[9];
    s[0]=to_string(A);
    s[1]='+';
    s[2]=to_string(B);
    s[3]='+';
    s[4]=to_string(C);
    s[5]='+';
    s[6]=to_string(D);
    s[7]='=';
    s[8]='7';
    if(i==0){ 
      sum=A+B;
    }
    else{
      sum=A-B;
      s[1]='-'
    }
   for(int j=0;j<2;++j){
      if(j==0){ 
        sum=sum+C;
    　}
    　else{
      	sum=sum-C;
       	s[3]='-'
   　 }
     for(int k=0;k<2;++k){
      if(k==0){ 
        sum=sum+D;
    　}
    　else{
       	sum=sum-D;
       	s[5]='-'
    　}
     }
   }
   if(sum==7){
    break; 
   }
  }
  cout<<s<<endl;
}

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

#include <iostream>
using namespace std;

int main()
{
  int op[4];
  int in;
  cin >> in;
  op[0] = in / 1000; in %= 1000;
  op[1] = in / 100; in %= 100;
  op[2] = in / 10;
  op[3] = in % 10;
  
  for (int bit = 0; bit < (bit << n); ++bit) {
    int res = op[0];
    for (int i = 0; i < 3; ++i)
      res += (bit & 1 << (2-i)) ? op[i] : -op[i];
    
    if (res == 7) {
      cout << op[0];
      for (int i = 0; i < 3; ++i) {
        if (bit & 1 << i) cout << "+";
        else cout << "-";
        cout << op[i+1];
      }
      cout << "=7";
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: 'n' was not declared in this scope; did you mean 'in'?
   14 |   for (int bit = 0; bit < (bit << n); ++bit) {
      |                                   ^
      |                                   in
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, D;
  A =getchar()-'0';
  B =getchar()-'0';
  C =getchar()-'0';
  D =getchar()-'0';
  int S = {1, -1};
  char s = {'+', '-'}
  for (int i=0;i<1;i++) {
    for (int j=0;j<1;j++) {
      for (int k=0;k<1;k++) {
        if(A+B*S[i]+C*S[j]+D*S[k]==7) {
          cout << A << s[i] << B << s[j] << C << s[k] << D << "\n";
          return 0;
        }
      }
    }
  }
}

          


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: scalar object 'S' requires one element in initializer
   10 |   int S = {1, -1};
      |       ^
a.cc:11:8: error: scalar object 's' requires one element in initializer
   11 |   char s = {'+', '-'}
      |        ^
a.cc:12:3: error: expected ',' or ';' before 'for'
   12 |   for (int i=0;i<1;i++) {
      |   ^~~
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   for (int i=0;i<1;i++) {
      |                ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
char judge(char a, char b, char op){
  int x,y;
  x = a-'0';
  y = b-'0';
  char ans;
  if(op=='+'){
    ans = x+y+'0'
  }else{
    ans = x-y+'0';
  }
  return ans;
}

int main(){
  string s;
  cin>>s;
  
  
  return 0;
}

Compiler output:
a.cc: In function 'char judge(char, char, char)':
a.cc:11:18: error: expected ';' before '}' token
   11 |     ans = x+y+'0'
      |                  ^
      |                  ;
   12 |   }else{
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, D; cin >> A >> B >> C >> D;
  string p, q, r;
  if( A + B + C + D = 7 ) 
    cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
  else if( A + B + C - D = 7 )
    cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
  else if( A + B - C + D = 7 ) 
    cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
  else if( A + B - C - D = 7 ) 
    cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
  else if( A - B + C + D = 7 ) 
    cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
  else if( A - B + C - D = 7 ) 
    cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
  else if( A - B - C + D = 7 ) 
    cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;
  else if( A - B - C - D = 7 ) 
    cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: lvalue required as left operand of assignment
    7 |   if( A + B + C + D = 7 )
      |       ~~~~~~~~~~^~~
a.cc:9:22: error: lvalue required as left operand of assignment
    9 |   else if( A + B + C - D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:11:22: error: lvalue required as left operand of assignment
   11 |   else if( A + B - C + D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:13:22: error: lvalue required as left operand of assignment
   13 |   else if( A + B - C - D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:15:22: error: lvalue required as left operand of assignment
   15 |   else if( A - B + C + D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:17:22: error: lvalue required as left operand of assignment
   17 |   else if( A - B + C - D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:19:22: error: lvalue required as left operand of assignment
   19 |   else if( A - B - C + D = 7 )
      |            ~~~~~~~~~~^~~
a.cc:21:22: error: lvalue required as left operand of assignment
   21 |   else if( A - B - C - D = 7 )
      |            ~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
int main() {
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	int ans=0;
	for(int i=0; i<2; i++){
		for(int j=0; j<2; j++){
			for(int k=0; k<2; k++){
				ans+=A;
				if(i){
					ans-=B;
				}
				else{
					ans+=B;
				};
				
				if(j){
					ans-=C;
				}
				else{
					ans+=C;
				};
				
				if(k){
					ans-=D;
				}
				else{
					ans+=D;
				};
				
				if(ans==7){
					break;
				}
				else{
					ans=0;
				}
			}
		if(ans==7){
					break;
		}
		}
	if(ans==7){
					break;
	}
	}
	cout<<A;;
	if(i){
		cout<<'-';
	}
	else{
		cout<<'+';
	};
	cout<<B;
	if(j){
		cout<<'-';
	}
	else{
		cout<<'+';
	};
	cout<<C;
	if(k){
		cout<<'-';
	}
	else{
		cout<<'+';
	};
	cout<<D<<'='<<7<<endl;

	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:12: error: 'i' was not declared in this scope
   50 |         if(i){
      |            ^
a.cc:57:12: error: 'j' was not declared in this scope
   57 |         if(j){
      |            ^
a.cc:64:12: error: 'k' was not declared in this scope
   64 |         if(k){
      |            ^
Language: C++

#include<iostream>
using namespace std;
int main(){
int a,b,c,d;
  int c=9;
  cin>>a>>b>>c>>d;
  if(a+b+c+d==7){
	c=0;
  }
  if(a+b+c-d==7){
	c=1;
  }
  if(a+b-c+d==7){
	c=2;
  }
  if(a-b+c+d==7){
	c=3;
  }
  if(a+b-c-d==7){
	c=4;
  }
  if(a-b+c-d==7){
	c=5;
  }
  if(a-b-c+d==7){
	c=6;
  }
  if(a-b-c-d==7){
	c=7;
  }
  switch(c){
    case 0:cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;break;
    case 1:cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;break;
    case 2:cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;break;
    case 3:cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;break;
    case 4:cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;break;
    case 5:cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;break;
    case 6:cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;break;
    case 7:cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;break;
    default:
      break;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:7: error: redeclaration of 'int c'
    5 |   int c=9;
      |       ^
a.cc:4:9: note: 'int c' previously declared here
    4 | int a,b,c,d;
      |         ^
Language: C++

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<string.h>

int main() {
	char val[5];
	std::cin >> val;

	int arr[4];
	for (int i = 0; i < 4; i++)arr[i] = val[i] - '0';

	char equation[10];

	for (int i = 0; i < 1 << 3; i++) {
		int temp = arr[0];
		for (int j = 0; j < 3; j++) {
			temp += i >> j & 1 ? arr[j + 1] : (-1)*arr[j + 1];
		}
		if (temp == 7) {
			equation[0] = arr[0] + '0';
			for (int j = 0; j < 3; j++) {
				if (i >> j & 1)equation[2 * j + 1] = '+';
				else equation[2 * j + 1] = '-';
				equation[2 * j+2] = arr[j + 1] + '0';
			}
			strcpy_s(&equation[7], 3, "=7\0");
		}
	}


	printf("%s\n", equation);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   28 |                         strcpy_s(&equation[7], 3, "=7\0");
      |                         ^~~~~~~~
      |                         strcpy
Language: C++

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>

int main() {
	char val[5];
	std::cin >> val;

	int arr[4];
	for (int i = 0; i < 4; i++)arr[i] = val[i] - '0';

	char equation[10];

	for (int i = 0; i < 1 << 3; i++) {
		int temp = arr[0];
		for (int j = 0; j < 3; j++) {
			temp += i >> j & 1 ? arr[j + 1] : (-1)*arr[j + 1];
		}
		if (temp == 7) {
			equation[0] = arr[0] + '0';
			for (int j = 0; j < 3; j++) {
				if (i >> j & 1)equation[2 * j + 1] = '+';
				else equation[2 * j + 1] = '-';
				equation[2 * j+2] = arr[j + 1] + '0';
			}
			strcpy_s(&equation[7], 3, "=7\0");
		}
	}


	printf("%s\n", equation);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:25: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   27 |                         strcpy_s(&equation[7], 3, "=7\0");
      |                         ^~~~~~~~
      |                         strcpy
Language: C++

#include<iostream>
#include<cstring>

int main() {
	char val[5];
	std::cin >> val;

	int arr[4];
	for (int i = 0; i < 4; i++)arr[i] = val[i] - '0';

	char equation[10];

	for (int i = 0; i < 1 << 3; i++) {
		int temp = arr[0];
		for (int j = 0; j < 3; j++) {
			temp += i >> j & 1 ? arr[j + 1] : (-1)*arr[j + 1];
		}
		if (temp == 7) {
			equation[0] = arr[0] + '0';
			for (int j = 0; j < 3; j++) {
				if (i >> j & 1)equation[2 * j + 1] = '+';
				else equation[2 * j + 1] = '-';
				equation[2 * j+2] = arr[j + 1] + '0';
			}
			strcpy_s(&equation[7], 3, "=7\0");
		}
	}


	printf("%s\n", equation);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   25 |                         strcpy_s(&equation[7], 3, "=7\0");
      |                         ^~~~~~~~
      |                         strcpy
Language: C++

L = list(str(input()))
A, B, C, D = list(map(int, L))

if A + B + C + D == 7:
    print(A, '+', B, '+', C, '+', D, '=', 7, sep='')
elif A + B + C - D == 7:
    print(A, '+', B, '+', C, '-', D, '=', 7, sep='')
elif A + B - C + D == 7:
    print(A, '+', B, '-', C, '+', D, '=', 7, sep='')
elif A + B - C - D == 7:
    print(A, '+', B, '-', C, '-', D, '=', 7, sep='')
elif A - B + C + D == 7:
    print(A, '-', B, '+', C, '+', D, '=', 7, sep='')
elif A - B + C - D == 7:
    print(A, '-', B, '+', C, '-', D, '=', 7, sep='')
elif A - B - C + D == 7:
    print(A, '-', B, '-', C, '+', D, '=', 7, sep='')
elif A - B - C - D == 7:
    print(A, '-', B, '-', C, '-', D, '=', 7, sep='')



Compiler output:
a.cc:5:50: error: empty character constant
    5 |     print(A, '+', B, '+', C, '+', D, '=', 7, sep='')
      |                                                  ^~
a.cc:7:50: error: empty character constant
    7 |     print(A, '+', B, '+', C, '-', D, '=', 7, sep='')
      |                                                  ^~
a.cc:9:50: error: empty character constant
    9 |     print(A, '+', B, '-', C, '+', D, '=', 7, sep='')
      |                                                  ^~
a.cc:11:50: error: empty character constant
   11 |     print(A, '+', B, '-', C, '-', D, '=', 7, sep='')
      |                                                  ^~
a.cc:13:50: error: empty character constant
   13 |     print(A, '-', B, '+', C, '+', D, '=', 7, sep='')
      |                                                  ^~
a.cc:15:50: error: empty character constant
   15 |     print(A, '-', B, '+', C, '-', D, '=', 7, sep='')
      |                                                  ^~
a.cc:17:50: error: empty character constant
   17 |     print(A, '-', B, '-', C, '+', D, '=', 7, sep='')
      |                                                  ^~
a.cc:19:50: error: empty character constant
   19 |     print(A, '-', B, '-', C, '-', D, '=', 7, sep='')
      |                                                  ^~
a.cc:1:1: error: 'L' does not name a type
    1 | L = list(str(input()))
      | ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
string S;
int main(){
  cin >> S;
  int N = S.size();
  for(int i=0; i<N; ++i){
    int s[i] = S[i] - '0';
  }
  cout << s[i] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: array must be initialized with a brace-enclosed initializer
    9 |     int s[i] = S[i] - '0';
a.cc:11:11: error: 's' was not declared in this scope
   11 |   cout << s[i] << endl;
      |           ^
a.cc:11:13: error: 'i' was not declared in this scope
   11 |   cout << s[i] << endl;
      |             ^
Language: C++

import sys

def func(s, i):
    if i == 7:
        if eval(s) == 7:
            print(s + '=7')
            sys.exit()
        return
    s = s[:i] + '+' + s[i + 1:]
    func(s, i + 2)
    s = s[:i] + '-' + s[i + 1:]
    func(s, i + 2)

s = input()

a = s[0]
b = s[1]
c = s[2]
d = s[3]
s = a + '#' + b + '#' + c + '#' + d

func(s, 1)

Compiler output:
a.cc:6:23: warning: multi-character character constant [-Wmultichar]
    6 |             print(s + '=7')
      |                       ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<string>
using namespace std;
 
int main(){
  int a[4]; cin>>a[0]>>a[1]>>a[2]>>a[3];
  for(int x=0;x<8;x++){
    int sum=a[0];
    string s;
    s+=char ('0'+a[0]);
    for(int i=0;i<3;i++){
      if(x &(1<<i)){
        sum+=a[1+i];
        s+='+';
        s+=char('0'+a[i+1]);
      }
      else{
        sum-=a[i+1];
        s+='-';
        s+=char('0'-a[i+1]);
      }
    }
    if(sum==7)cout<<s<<endl;
    return 0;
  }
}
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  int a[4]; cin>>a[0]>>a[1]>>a[2]>>a[3];
  for(int x=0;x<8;x++){
    int sum=a[0];
    string s;
    s+=char ('0'+a[0]);
    for(int i=0;i<3;i++){
      if(x &(1<<i)){
        sum+=a[1+i];
        s+='+';
        s+=char('0'+a[i+1]);
      }
      else{
        sum-=a[i+1];
        s+='-';
        s+=char('0'+a[i+1]);
      }
    }
    if(sum==7)cout<<s<<endl;
    return 0;
  }
}


Compiler output:
a.cc:31:5: error: redefinition of 'int main()'
   31 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int a[4]; cin>>a[0]>>a[1]>>a[2]>>a[3];
  for(int x=0;x<8;i++){
    int sum=a[0];
    string s;
    s+=char ('0'+a[0]);
    for(int i=0;i<3;i++){
      if(x&(1<<i)){
        sum+=a[1+i];
        s+='+';
        s+=char('0'+a[i+1]);
      }
      else{
        sum-=a[i+1];
        s-='-';
        s-=char('0'-a[i+1]);
      }
    }
    if(sum==7)cout<<s<<endl;
    return 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: 'i' was not declared in this scope
    6 |   for(int x=0;x<8;i++){
      |                   ^
a.cc:18:10: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   18 |         s-='-';
      |         ~^~~~~
a.cc:19:10: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   19 |         s-=char('0'-a[i+1]);
      |         ~^~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int A,B,C,D; cin>>A>>B>>C>>D;
  if(A+B+C+D==7)cout<<A+B+C+D=7<<endl;
  else if(A+B+C-D==7)cout<<A+B+C+D=7<<endl;
  else if(A+B+C-D==7)cout<<A+B+C-D=7<<endl;
  else if(A+B-C-D==7)cout<<A+B-C-D=7<<endl;
  else if(A-B-C-D==7)cout<<A-B-C-D=7<<endl;
  else if(A-B+C-D==7)cout<<A-B+C-D=7<<endl;
  else if(A-B-C+D==7)cout<<A-B-C+D=7<<endl;
  else if(A+B-C+D==7)cout<<A+B-C+D=7<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    6 |   if(A+B+C+D==7)cout<<A+B+C+D=7<<endl;
      |                               ~^~~~~~
a.cc:7:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    7 |   else if(A+B+C-D==7)cout<<A+B+C+D=7<<endl;
      |                                    ~^~~~~~
a.cc:8:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 |   else if(A+B+C-D==7)cout<<A+B+C-D=7<<endl;
      |                                    ~^~~~~~
a.cc:9:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    9 |   else if(A+B-C-D==7)cout<<A+B-C-D=7<<endl;
      |                                    ~^~~~~~
a.cc:10:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   10 |   else if(A-B-C-D==7)cout<<A-B-C-D=7<<endl;
      |                                    ~^~~~~~
a.cc:11:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   11 |   else if(A-B+C-D==7)cout<<A-B+C-D=7<<endl;
      |                                    ~^~~~~~
a.cc:12:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   12 |   else if(A-B-C+D==7)cout<<A-B-C+D=7<<endl;
      |                                    ~^~~~~~
a.cc:13:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   13 |   else if(A+B-C+D==7)cout<<A+B-C+D=7<<endl;
      |                                    ~^~~~~~
Language: C++

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


int main() {
    int abcd;
    cin >> abcd;
    int a = abcd/1000;
    int b = (abcd%1000)/100;
    int c = (abcd%100)/10;
    int d = (abcd%10);


    string ans;

    ostringstream oss;

    for(int i=0;i<8;i++){
        int res = a;
        oss << a;
        if(i&0b100){ res+=b;oss << "+" << b; }
        else{ res-=b; oss << "-" << b;}
        
        if(i&0b010){ res+=c;oss << "+" << c; }
        else{ res-=c; oss << "-" << c;}
       
        if(i&0b001){ res+=d;oss << "+" << d; }
        else{ res-=d; oss << "-" << d;}





        if (res==7){
            cout << oss.str() << "=7" << endl;
        }


    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: aggregate 'std::ostringstream oss' has incomplete type and cannot be defined
   18 |     ostringstream oss;
      |                   ^~~
Language: C++

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


int main() {
    int abcd;
    cin >> abcd;
    int a = abcd/1000;
    int b = (abcd%1000)/100;
    int c = (abcd%100)/10;
    int d = (abcd%10);


    string ans;

    ostringstream oss;

    for(int i=0;i<8;i++){
        res = a;
        oss << a;
        if(i&0b100){ res+=b;oss << "+" << b; }
        else{ res-=b; oss << "-" << b;}
        
        if(i&0b010){ res+=c;oss << "+" << c; }
        else{ res-=c; oss << "-" << c;}
       
        if(i&0b001){ res+=d;oss << "+" << d; }
        else{ res-=d; oss << "-" << d;}





        if (res==7){
            cout << oss.str() << "=7" << endl;
        }


    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: aggregate 'std::ostringstream oss' has incomplete type and cannot be defined
   18 |     ostringstream oss;
      |                   ^~~
a.cc:21:9: error: 'res' was not declared in this scope
   21 |         res = a;
      |         ^~~
Language: C++

#include <bits/stdc++.h>
#include <cmath>
#include <string>
using namespace std;

string show_ans(int bit, string S){
    string ans = "";
    ans.push_back(S.at(0));
    for (int i = 0; i < 3; i++){
            if (bit & (1 << i)){
                //左からi-1番目の符号が+
                ans.push_back('+');
                ans.push_back(S.at(i + 1));                
            }else
            {
                ans.push_back('-');
                ans.push_back(S.at(i + 1));
            }
    }
  ans += "=7";
  return ans;
}
int main(){
    string S; cin >> S;
    
    int sum = S.at(0) - '0';
    //フラグが立ってたら+, なかったら-
    for (int bit = 0; bit < (1 << 3); bit++){
        for (int i = 0; i < 3; i++){
            if (bit & (1 << i)){
                //左からi-1番目の符号が+
                sum += S.at(i + 1) - '0';
            }else
            {
                sum -= S.at(i + 1) - '0';
            }
        }
        if (sum == 7){
            cout << show_ans(bit, S) << endl;
            return;
        }
      sum = S.at(0) - '0';
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   40 |             return;
      |             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    char s[4];
    cin >> s;
    int a = atoi(s[0]), b = atoi(s[1]), c = atoi(s[2]), d = atoi(s[3]);
    if(a+b+c+d == 7){
        cout << a << '+' << b << '+' << c << '+' << d << "=7";
    }else if(a+b+c-d == 7){
        cout << a << '+' << b << '+' << c << '-' << d << "=7";
    }else if(a+b-c+d == 7){
        cout << a << '+' << b << '-' << c << '+' << d << "=7";
    }else if(a+b-c-d == 7){
        cout << a << '+' << b << '-' << c << '-' << d << "=7";
    }else if(a-b+c+d == 7){
        cout << a << '-' << b << '+' << c << '+' << d << "=7";
    }else if(a-b+c-d == 7){
        cout << a << '-' << b << '+' << c << '-' << d << "=7";
    }else if(a-b-c+d == 7){
        cout << a << '-' << b << '-' << c << '+' << d << "=7";
    }else{
        cout << a << '-' << b << '-' << c << '-' << d << "=7";
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
    7 |     int a = atoi(s[0]), b = atoi(s[1]), c = atoi(s[2]), d = atoi(s[3]);
      |                  ~~~^
      |                     |
      |                     char
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:7:37: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
    7 |     int a = atoi(s[0]), b = atoi(s[1]), c = atoi(s[2]), d = atoi(s[3]);
      |                                  ~~~^
      |                                     |
      |                                     char
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:7:53: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
    7 |     int a = atoi(s[0]), b = atoi(s[1]), c = atoi(s[2]), d = atoi(s[3]);
      |                                                  ~~~^
      |                                                     |
      |                                                     char
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:7:69: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
    7 |     int a = atoi(s[0]), b = atoi(s[1]), c = atoi(s[2]), d = atoi(s[3]);
      |                                                                  ~~~^
      |                                                                     |
      |                                                                     char
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<char> numc(4);
    vector <int> num(4);

    for (int i=0;i<4;++i){
        cin>>numc.at(i);
        num.at(i) = numc.at(i)-'0';
    }
    
    vector <string> sumc = {{numc.at(0)}};
    vector <int> sum = {num.at(0)};
    for(int i=1;i<4;++i){
        vector <string> sumsumc;
        vector <int> sumsum;
        for (string x:sumc){
            sumsumc.push_back(x+'+'+numc.at(i));
            sumsumc.push_back(x+'-'+numc.at(i));
        }
        for (int x:sum){
            sumsum.push_back(x+num.at(i));
            sumsum.push_back(x-num.at(i));
        }
        sum = sumsum;
        sumc = sumsumc;
    }
    for (int i =0;i<sum.size();++i){
        if (x == 7){
            cout<<sumc.at(i)<<endl;
            break;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:13: error: 'x' was not declared in this scope
   31 |         if (x == 7){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<char> numc(4);
    vector <int> num(4);

    for (int i=0;i<4;++i){
        cin>>numc.at(i);
        num.at(i) = numc.at(i)-'0';
    }
    
    vector <string> sumc = {numc.at(0)};
    vector <int> sum = {num.at(0)};
    for(int i=1;i<4;++i){
        vector <string> sumsumc;
        vector <int> sumsum;
        for (string x:sumc){
            sumsumc.push_back(x+'+'+numc.at(i));
            sumsumc.push_back(x+'-'+numc.at(i));
        }
        for (int x:sum){
            sumsum.push_back(x+num.at(i));
            sumsum.push_back(x-num.at(i));
        }
        sum = sumsum;
        sumc = sumsumc;
    }
    for (int i =0;i<sum.size();++i){
        if (x == 7){
            cout<<sumc.at(i)<<endl;
            break;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:39: error: converting to 'std::vector<std::__cxx11::basic_string<char> >' from initializer list would use explicit constructor 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
   14 |     vector <string> sumc = {numc.at(0)};
      |                                       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:556:7: note: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]' declared here
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
a.cc:14:36: warning: narrowing conversion of 'numc.std::vector<char>::at(0)' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wnarrowing]
   14 |     vector <string> sumc = {numc.at(0)};
      |                             ~~~~~~~^~~
a.cc:31:13: error: 'x' was not declared in this scope
   31 |         if (x == 7){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<char> numc(4);
    vector <int> num(4);

    for (int i=0;i<N;++i){
        cin>>numc.at(i);
        num.at(i) = numc.at(i)-'0';
    }
    
    vector <string> sumc = {numc.at(0)};
    vector <int> sum = {num.at(0)};
    for(int i=1;i<4;++i){
        vector <string> sumsumc;
        vector <int> sumsum;
        for (string x:sumc){
            sumsumc.push_back(x+'+'+numc.at(i));
            sumsumc.push_back(x+'-'+numc.at(i));
        }
        for (int x:sum){
            sumsum.push_back(x+num.at(i));
            sumsum.push_back(x-num.at(i));
        }
        sum = sumsum;
        sumc = sumsumc;
    }
    for (int i =0;i<sum.size();++i){
        if (x == 7){
            cout<<sumc.at(i)<<endl;
            break;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: 'N' was not declared in this scope
    9 |     for (int i=0;i<N;++i){
      |                    ^
a.cc:14:39: error: converting to 'std::vector<std::__cxx11::basic_string<char> >' from initializer list would use explicit constructor 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]'
   14 |     vector <string> sumc = {numc.at(0)};
      |                                       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:556:7: note: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]' declared here
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
a.cc:14:36: warning: narrowing conversion of 'numc.std::vector<char>::at(0)' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wnarrowing]
   14 |     vector <string> sumc = {numc.at(0)};
      |                             ~~~~~~~^~~
a.cc:31:13: error: 'x' was not declared in this scope
   31 |         if (x == 7){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    int a = atoi(s[0].c_str()), b = atoi(s[1].c_str()), c = atoi(s[2].c_str()), d = atoi(s[3].c_str());
    if(a+b+c+d == 7){
        cout << a << '+' << b << '+' << c << '+' << d << "=7";
    }else if(a+b+c-d == 7){
        cout << a << '+' << b << '+' << c << '-' << d << "=7";
    }else if(a+b-c+d == 7){
        cout << a << '+' << b << '-' << c << '+' << d << "=7";
    }else if(a+b-c-d == 7){
        cout << a << '+' << b << '-' << c << '-' << d << "=7";
    }else if(a-b+c+d == 7){
        cout << a << '-' << b << '+' << c << '+' << d << "=7";
    }else if(a-b+c-d == 7){
        cout << a << '-' << b << '+' << c << '-' << d << "=7";
    }else if(a-b-c+d == 7){
        cout << a << '-' << b << '-' << c << '+' << d << "=7";
    }else{
        cout << a << '-' << b << '-' << c << '-' << d << "=7";
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:23: error: request for member 'c_str' in 's.std::__cxx11::basic_string<char>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
    7 |     int a = atoi(s[0].c_str()), b = atoi(s[1].c_str()), c = atoi(s[2].c_str()), d = atoi(s[3].c_str());
      |                       ^~~~~
a.cc:8:10: error: 'b' was not declared in this scope
    8 |     if(a+b+c+d == 7){
      |          ^
a.cc:8:12: error: 'c' was not declared in this scope
    8 |     if(a+b+c+d == 7){
      |            ^
a.cc:8:14: error: 'd' was not declared in this scope
    8 |     if(a+b+c+d == 7){
      |              ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int main() {
  	string input;
  	cin >> input;
    int a[4];
  	for(int i = 0l i < 4; ++i) a[i] = input[i] - '0';
    for(int x = 0; x < 8; ++x){
		int sum = a[0];
      	string s;
      	s += (char)('0' + a[0]);
      	for(int i = 0; i < 3; ++i){
			if(x & (1 << i)){
              sum += a[i + 1];
              s += '+';
              s += (char)('0' + a[i+1]);
            }
          else{
            sum -= a[i + 1];
              s += '-';
              s += (char)('0' + a[i+1]);
          }
        }
      if(sum == 7){
         cout << s << '=' << '7' << endl;
        return 0;
      }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected ';' before 'i'
    9 |         for(int i = 0l i < 4; ++i) a[i] = input[i] - '0';
      |                       ^~
      |                       ;
Language: C++

#include<iostream>
using namespace std;

int main() {
  string numstr; cin >> numstr;
  int A = stoi(numstr.substr(0, 1)), B = stoi(numstr.substr(1, 1)), C = stoi(numstr.substr(2, 1)), D = stoi(numstr.substr(3, 1));
  for (int b_bit = -1; b_bit < 2; b_bit += 2) {
    for (int c_bit = -1; c_bit < 2; c_bit += 2) {
      for (int d_bit = -1; d_bit < 2; d_bit += 2) {
        if (A + b_bit * B + c_bit * C + d_bit * D == 7) {
          cout << A;
          if (b_bit == 1) cout << "+";
          else cout << "-";
          cout << B;
          if (c_bit == 1) cout << "+";
          else cout << "-";
          cout << C;
          if (d_bit == 1) cout << "+";
          else cout << "-";
          cout << D;
          cout << "=7" << endl;
          return;
        }
      }
  	}
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: return-statement with no value, in function returning 'int' [-fpermissive]
   22 |           return;
      |           ^~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

#define len 4
int num[len];
char buf[len], ans[len];

int dfs(int i, int sum){
  //
  if(i == len){
    if(sum == 7) strcpy(ans, buf);
//    cout << sum << endl;
//    cout << buf << endl;
    return 0;
  }

  //
  buf[i] = '+';
  dfs(i+1, sum+num[i]);

  buf[i] = '-';
  dfs(i+1, sum-num[i]);

  return 0;
}


int main() {
  // 入力
  string S;
  cin >> S;

  //
  for (int i = 0; i < len; ++i) {
    num[i] = stoi(S.substr(i, 1));
  }
  dfs(0, 0);

  //
  char buf2[16];
  char *index = buf2;
  for (int i = 0; i < len-1; ++i) {
    index += sprintf(index, "%d%c", num[i], ans[i+1]);
  }
  sprintf(index, "%d=7", num[3]);
  cout << buf2 << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:13:18: error: 'strcpy' was not declared in this scope
   13 |     if(sum == 7) strcpy(ans, buf);
      |                  ^~~~~~
a.cc:3:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 |