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

#include <iostream>
using namespace std;

int main(){
    int A,B,C,D;
    char a[3];
    cin >> A >> B >> C >> D;
    if(A+B+C+D==7) {a[0]='+'; a[1]='+'; a[2]='+'}
    else if(A+B-C-D==7) {a[0]='+'; a[1]='-'; a[2]='-'}
    else if(A+B+C-D==7) {a[0]='+'; a[1]='+'; a[2]='-'}
    else if(A+B-C+D==7) {a[0]='+'; a[1]='-'; a[2]='+'}
    else if(A-B+C+D==7) {a[0]='-'; a[1]='+'; a[2]='+'}
    else if(A-B-C-D==7) {a[0]='-'; a[1]='-'; a[2]='-'}
    else if(A-B+C-D==7) {a[0]='-'; a[1]='+'; a[2]='-'}
    else if(A-B-C+D==7) {a[0]='-'; a[1]='-'; a[2]='+'}
    cout << A << a[0] << B << a[1] << C << a[2] << D << "+7" <<  endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:49: error: expected ';' before '}' token
    8 |     if(A+B+C+D==7) {a[0]='+'; a[1]='+'; a[2]='+'}
      |                                                 ^
      |                                                 ;
a.cc:9:54: error: expected ';' before '}' token
    9 |     else if(A+B-C-D==7) {a[0]='+'; a[1]='-'; a[2]='-'}
      |                                                      ^
      |                                                      ;
a.cc:10:54: error: expected ';' before '}' token
   10 |     else if(A+B+C-D==7) {a[0]='+'; a[1]='+'; a[2]='-'}
      |                                                      ^
      |                                                      ;
a.cc:11:54: error: expected ';' before '}' token
   11 |     else if(A+B-C+D==7) {a[0]='+'; a[1]='-'; a[2]='+'}
      |                                                      ^
      |                                                      ;
a.cc:12:54: error: expected ';' before '}' token
   12 |     else if(A-B+C+D==7) {a[0]='-'; a[1]='+'; a[2]='+'}
      |                                                      ^
      |                                                      ;
a.cc:13:54: error: expected ';' before '}' token
   13 |     else if(A-B-C-D==7) {a[0]='-'; a[1]='-'; a[2]='-'}
      |                                                      ^
      |                                                      ;
a.cc:14:54: error: expected ';' before '}' token
   14 |     else if(A-B+C-D==7) {a[0]='-'; a[1]='+'; a[2]='-'}
      |                                                      ^
      |                                                      ;
a.cc:15:54: error: expected ';' before '}' token
   15 |     else if(A-B-C+D==7) {a[0]='-'; a[1]='-'; a[2]='+'}
      |                                                      ^
      |                                                      ;
Language: C++

abcd = input()
ans=''
for i in range(8):
    op1 = '+' if (1 & i) != 0 else '-'
    op2 = '+' if (3 & i) != 0 else '-'
    op3 = '+' if (7 & i) != 0 else '-'
    s = abcd[0] + op1 + abcd[1] + op2 + abcd[2] + op3 + abcd[3]
    if eval(s) == 7: ans = s + '=7'
print(ans)


Compiler output:
a.cc:2:5: error: empty character constant
    2 | ans=''
      |     ^~
a.cc:8:32: warning: multi-character character constant [-Wmultichar]
    8 |     if eval(s) == 7: ans = s + '=7'
      |                                ^~~~
a.cc:1:1: error: 'abcd' does not name a type
    1 | abcd = input()
      | ^~~~
Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int ABCD = in.nextInt();
        	int a = ABCD / 1000;
        	int b = (ABCD / 100) % 10;
        	int c = (ABCD / 10) % 10;
        	int d = ABCD % 10;
        	String ans = "";
        	
        	if(a + b + c + d == 7) {ans = a + "+" + b + "+" + c + "+" + d;}
        	if(a + b + c - d == 7) {ans = a + "+" + b + "+" + c + "-" + d;}
        	if(a + b  - c + d == 7) {ans = a + "+" + b + "-" + c + "+" + d;}
        	if(a - b + c + d == 7) {ans = a + "-" + b + "+" + c + "+" + d;}
        	if(a - b - c - d == 7) {ans = a + "-" + b + "-" + c + "-" + d;}
        	if(a - b - c + d == 7) {ans = a + "-" + b + "-" + c + "+" + d;}
        	if(a - b + c - d == 7) {ans = a + "-" + b + "+" + c + "-" + d;}
        	if(a + b - c - d == 7) {ans = a + "+" + b + "-" + c + "-" + d;}
        	
        	out.println(ans + "=7");
        }
    }
    
    public String plus(int a, int b) {
    	
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Compiler output:
Main.java:52: error: missing return statement
    }
    ^
1 error
Language: C++

#include<iostream>
#include<algorithm >//sort(昇順)
#include<string>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<cmath>
#include<limits>
#include<map>


#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)

int main(){
	int a,b,c,d;
	cin >> a;
	b = a/1000;c = (a%1000)/100; d = (a%100)/10; a = a%10;
	
	     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;
	else if(a-b+c-d == 7)cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;


return 0;}


Compiler output:
a.cc:2:9: fatal error: algorithm : No such file or directory
    2 | #include<algorithm >//sort(昇順)
      |         ^~~~~~~~~~~~
compilation terminated.
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 << endl;
  }
  else if((A+B+C-D) == 7){
    cout << A << "+" << B << "+" << C << "-" << D << endl;
  }
  else if((A+B-C+D) == 7){
    cout << A << "+" << B << "-" << C << "+" << D << endl;
  }
  else if((A+B-C-D) == 7){
    cout << A << "+" << B << "-" << C << "-" << D << endl;
  }
  else if((A-B+C+D) == 7){
    cout << A << "-" << B << "+" << C << "+" << D << endl;
  }
  else if((A-B+C-D) == 7){
    cout << A << "-" << B << "+" << C << "-" << D << endl;
  }
  else if((A-B-C+D) == 7){
    cout << A << "-" << B << "-" << C << "+" << D << endl;
  }
  else if ((A-B-C-D) ==7{
    cout << A << "-" << B << "-" << C << "-" << D << endl;
  }
           }
           

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: expected ')' before '{' token
   28 |   else if ((A-B-C-D) ==7{
      |           ~             ^
      |                         )
a.cc:31:12: error: expected primary-expression before '}' token
   31 |            }
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	int d = N % 10;
	N /= 10;
	int c = N % 10;
	N /= 10;
	int b = N % 10;
	N /= 10;
	int a = N % 10;
	
	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;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:18:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |                 cout << a - b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:21:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   21 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:24:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   24 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:27:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   27 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:30:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   30 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:33:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   33 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
a.cc:36:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   36 |                 cout << a + b + c + d = 7 << endl;
      |                                         ~~^~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
#include <iostream>
#include <cmath>
#include <string>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)


typedef long long ll;
string number;
int N;
string flag[3];

int main() {
    cin >> number;
    N = number.length();
    rep(i,0,1 << (N - 1)) {
        ll sm = number[0] - '0';
        ll a = sm;
        rep(j,0,N - 1){
            a = number[j + 1] - '0';
            if(i & (1 << j)){ 
                sm -= a;
                flag[j] = "-";
            } else {
                sm += a;
                flag[j] = "+";
            }
        }
     
        if(sm == 7){
            cout << number[0] << flag[0] << number[1] << flag[1] << number[2] << flag[2] << number[3] <<"=7" << endl;
            return 0;
        }
    }
    return 0;

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

#include  <cstdio >
char s[5];
int  main()
{
scanf ("%s",&s);
int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
if(a-b-c-d==7) printf ("%d-%d-%d-%d=7\n",a,b,c,d);
else if(a-b-c+d==7) printf ("%d-%d-%d+%d=7\n ",a,b,c,d);
else if(a-b+c-d==7) printf ("%d-%d+%d-%d=7\n",a,b,c,d);
else if(a-b+c+d==7) printf ("%d-%d+%d+%d=7\n",a,b,c,d);
else if(a+b-c-d==7) printf ("%d+%d-%d-%d=7\n",a,b,c,d);
else if(a+b-c+d==7) printf ("%d+%d-%d+%d=7\n",a,b,c,d);
else if(a+b+c-d==7) printf ("%d+%d+%d-%d=7\n",a,b,c,d);
else if(a+b+c+d==7) printf ("%d+%d+%d+%d=7\n",a,b,c,d);
}

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

#include <stdio.h>

int main(void){
   int i,t,seven[10],judge,j;
   int n[200];
   char en[3];
   scanf("%d", &t);
   for(i=0;i<4;i++){
    n[i] = t % 10;
    t /= 10;
   }
   seven[0] = n[0]+n[1]+n[2]+n[3];
   seven[1] = n[0]-n[1]+n[2]+n[3];
   seven[2] = n[0]+n[1]-n[2]+n[3];
   seven[3] = n[0]-n[1]-n[2]+n[3];
   seven[4] = n[0]+n[1]+n[2]-n[3];
   seven[5] = n[0]-n[1]+n[2]-n[3];
   seven[6] = n[0]+n[1]-n[2]-n[3];
   seven[7] = n[0]-n[1]-n[2]-n[3];
   for(i=0; i<8;i++){
    if(seven[i] == 7){
        judge = i;
        for(j=0;j<3;j++){
        en[j] = judge %2;
        judge /= 2;
        if(en[j] == 0){
            en[j] = "+";
        }
        else{
            en[j] = "-";
               }
        }
    }
   }
   printf("%d%c%d%c%d%c%d=7\n", n[3],en[0],n[2],en[1],n[1],en[2],n[0]);
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   27 |             en[j] = "+";
      |                     ^~~
      |                     |
      |                     const char*
a.cc:30:21: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   30 |             en[j] = "-";
      |                     ^~~
      |                     |
      |                     const char*
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  for(int msk=0;msk< (1<<3);msk++){
    int sum=S[0] - '0';
    REP(i,3){
      if(msk & (1 << i)) sum+=S[i+1] - '0';
      else sum-=S[i+1] - '0';
    }
    if(sum == 7){
      cout << S[0];
      REP(i,3){
        if(msk & (1<<i)) cout << '+';
        else '-';
        cout << S[1+i];
      }
      cout << "=7" << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: 'S' was not declared in this scope
   26 |     int sum=S[0] - '0';
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a+b+c+d = 7){printf("%d+%d+%d+%d=7",a,b,c,d);}
  if(a+b+c-d = 7){printf("%d+%d+%d-%d=7",a,b,c,d);}
  if(a+b-c+d = 7){printf("%d+%d-%d+%d=7",a,b,c,d);}
  if(a-b+c+d = 7){printf("%d-%d+%d+%d=7",a,b,c,d);}
  if(a+b-c-d = 7){printf("%d+%d-%d-%d=7",a,b,c,d);}
  if(a-b+c-d = 7){printf("%d-%d+%d-%d=7",a,b,c,d);}
  if(a-b-c+d = 7){printf("%d-%d-%d+%d=7",a,b,c,d);}
  if(a-b-c-d = 7){printf("%d-%d-%d-%d=7",a,b,c,d);}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: lvalue required as left operand of assignment
    6 |   if(a+b+c+d = 7){printf("%d+%d+%d+%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:7:11: error: lvalue required as left operand of assignment
    7 |   if(a+b+c-d = 7){printf("%d+%d+%d-%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:8:11: error: lvalue required as left operand of assignment
    8 |   if(a+b-c+d = 7){printf("%d+%d-%d+%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:9:11: error: lvalue required as left operand of assignment
    9 |   if(a-b+c+d = 7){printf("%d-%d+%d+%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:10:11: error: lvalue required as left operand of assignment
   10 |   if(a+b-c-d = 7){printf("%d+%d-%d-%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:11:11: error: lvalue required as left operand of assignment
   11 |   if(a-b+c-d = 7){printf("%d-%d+%d-%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:12:11: error: lvalue required as left operand of assignment
   12 |   if(a-b-c+d = 7){printf("%d-%d-%d+%d=7",a,b,c,d);}
      |      ~~~~~^~
a.cc:13:11: error: lvalue required as left operand of assignment
   13 |   if(a-b-c-d = 7){printf("%d-%d-%d-%d=7",a,b,c,d);}
      |      ~~~~~^~
Language: C++

#include<bits/stdc++.h>

using namespace std;
int main(){
  int a[4],e,f;
  cin >> a[];
  e=a[0]+a[1]+a[2]+a[3];
  f=(e-7)/2;
  if(f==a[1]){
    cout << a[0] << "-" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
  }
  else if(f==a[2]){
    cout << a[0] << "+" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
  }
  else if(f==a[3]){
    cout << a[0] << "+" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
  }
  else if(f==a[1]+a[2]){
    cout << a[0] << "-" << a[1] << "-" << a[2] << "+" << a[3] << "=7" << endl;
  }
  else if(f==a[1]+a[3]){
    cout << a[0] << "-" << a[1] << "+" << a[2] << "-" << a[3] << "=7" << endl;
  }
  else if(f==a[2]+a[3]){
    cout << a[0] << "+" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
  }
  else if(f==a[1]+a[2]+a[3]){
    cout << a[0] << "-" << a[1] << "-" << a[2] << "-" << a[3] << "=7" << endl;
  }
  else{
    cout << a[0] << "+" << a[1] << "+" << a[2] << "+" << a[3] << "=7" << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected primary-expression before ']' token
    6 |   cin >> a[];
      |            ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int zzz;
	int a,b,c,d,e,f,g,h;
	char x='+',y='+',z='+';
	cin >> zzz;
	a = zzz/1000;
	zzz -= a * 1000;
	b = zzz/100;
	zzz -= b * 100;
	c = zzz/10;
	zzz -= b * 10;
	d = zzz;
	for (int i = 0;i < 2;i++) {
		for (int j = 0;j < 2;j++) {
			for (int k = 0;k < 2;k++) {
				if (i) b *= -1;
				if (j) c *= -1;
				if (k) d *= -1;
				if (a+b+c+d == 10) {
					if(i) x='-';
					if(j) y='-';
					if(k) z='-';
					goto ii45i4;
				} else {
					b = abs(b);
					c = abs(c);
					d = abs(d);
				}
			}
		}
	}
	ii45i4: cout<<a<<x<<b<<y<<c<<z<<d<<"=7"endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:44: error: unable to find string literal operator 'operator""endl' with 'const char [3]', 'long unsigned int' arguments
   36 |         ii45i4: cout<<a<<x<<b<<y<<c<<z<<d<<"=7"endl;
      |                                            ^~~~~~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int a,b,c,d,e,f,g,h;
	char x='+',y='+',z='+';
	cin >> a >> b >> c >> d;
	for (int i = 0;i < 2;i++) {
		for (int j = 0;j < 2;j++) {
			for (int k = 0;k < 2;k++) {
				if (i) b *= -1;
				if (j) c *= -1;
				if (k) d *= -1;
				if (a+b+c+d == 10) {
					if(i) x='-';
					if(j) y='-';
					if(k) z='-';
					goto 114514;
				} else {
					b = abs(b);
					c = abs(c);
					d = abs(d);
				}
			}
		}
	}
	114514: cout<<a<<x<<b<<y<<c<<z<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:46: error: expected identifier before numeric constant
   19 |                                         goto 114514;
      |                                              ^~~~~~
a.cc:19:45: error: expected ';' before numeric constant
   19 |                                         goto 114514;
      |                                             ^~~~~~~
      |                                             ;
a.cc:28:15: error: expected ';' before ':' token
   28 |         114514: cout<<a<<x<<b<<y<<c<<z<<d<<endl;
      |               ^
      |               ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d;
  cin >> n;
  int ans = 0;
  a = n / 1000;
  b = (n % 1000) / 100;
  c = (n % 1000 % 100) / 10;
  d = (n % 1000 % 100 % 10);
  vector<char> vec(2) = {'+', '-'};
  for (int i = 0; i < 2; i++) {
    for (int ii = 0; ii < 2; ii++) {
      for (int iii = 0; iii < 2; iii++) {
        if (i == 0) {
          ans += a + b;
        }
        else if (i == 1) {
          ans += a - b; 
        }
        if (ii == 0) ans += c;
        else if (ii == 1) ans -= c;
        if (iii == 0) ans += d;
        else if (iii == 1) ans -= d;
        if (ans == 7) cout << a << vec[i] << b << vec[ii] << c << vec[iii] << d << "=7" << endl;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected ',' or ';' before '=' token
   11 |   vector<char> vec(2) = {'+', '-'};
      |                       ^
Language: C++

from itertools import product

a, b, c, d = list(map(int, input()))
for s in product('+-', repeat=3):
    f = '{}{}{}{}{}{}{}'.format(a,s[0],b,s[1],c,s[2],d)
    if eval(f)==7:
        print(f+'=7')
        break

Compiler output:
a.cc:4:18: warning: multi-character character constant [-Wmultichar]
    4 | for s in product('+-', repeat=3):
      |                  ^~~~
a.cc:5:9: warning: multi-character literal with 14 characters exceeds 'int' size of 4 bytes
    5 |     f = '{}{}{}{}{}{}{}'.format(a,s[0],b,s[1],c,s[2],d)
      |         ^~~~~~~~~~~~~~~~
a.cc:7:17: warning: multi-character character constant [-Wmultichar]
    7 |         print(f+'=7')
      |                 ^~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import product
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    char s[10];
    cin>>s;
    int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
    for(int i=43;i<=45;i+=2)
        for(int j=43;j<=45;j+=2)
            for(int k=43;k<=45;k+=2){
                int ans=a;
                if(i==43) ans+=b;
                else ns-=b;
                if(j==43) ans+=c;
                else ans-=c;
                if(k==43) ans+=d;
                else ans-=d;
                if(ans==7) return cout<<a<<char(i)<<b<<char(j)<<c<<char(k)<<d<<"=7"<<endl,0;
            }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'ns' was not declared in this scope; did you mean 'ans'?
   12 |                 else ns-=b;
      |                      ^~
      |                      ans
Language: C++

#include <vector>
#include <cstdio>
#include <typeinfo>
#include <string>

using namespace std;

// char input[4];
string input;
int a,b,c,d;
int main()
{
  cin >> input;
  a = input[0] - '0';
  b = input[1] - '0';
  c = input[2] - '0';
  d = input[3] - '0';

  if(a-b+c+d == 7) printf("%d-%d+%d+%d=7\n", a,b,c,d);
  else if(a-b+c-d == 7) printf("%d-%d+%d-%d=7\n", a,b,c,d);
  else if(a-b-c+d == 7) printf("%d-%d-%d+%d=7\n", a,b,c,d);
  else if(a-b-c-d == 7) printf("%d-%d-%d-%d=7\n", a,b,c,d);
  else if(a+b-c+d == 7) printf("%d+%d-%d+%d=7\n", a,b,c,d);
  else if(a+b-c-d == 7) printf("%d+%d-%d-%d=7\n", a,b,c,d);
  else if(a+b+c-d == 7) printf("%d+%d+%d-%d=7\n", a,b,c,d);
  else if(a+b+c+d == 7) printf("%d+%d+%d+%d=7\n", a,b,c,d);

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin >> input;
      |   ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <string>
  +++ |+#include <iostream>
    5 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
using int = long long;
signed main(){
  string s;
  cin>>s;
  string x(7,'.');
  for(int i=0;i<4;i++) x[i*2]=s[i];
  int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
  if(a+b+c+d==7){
    x[1]='+';x[3]='+';x[5]='+';
  }
  if(a+b+c-d==7){
    x[1]='+';x[3]='+';x[5]='-';
  }
  if(a+b-c+d==7){
    x[1]='+';x[3]='-';x[5]='+';
  }
  if(a+b-c-d==7){
    x[1]='+';x[3]='-';x[5]='-';
  }
  if(a-b+c+d==7){
    x[1]='-';x[3]='+';x[5]='+';
  }
  if(a-b+c-d==7){
    x[1]='-';x[3]='+';x[5]='-';
  }
  if(a-b-c+d==7){
    x[1]='-';x[3]='-';x[5]='+';
  }
  if(a-b-c-d==7){
    x[1]='-';x[3]='-';x[5]='-';
  }
  cout<<x<<"=7"<<endl;
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'int'
    3 | using int = long long;
      |       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
  string s;
  cin>>s;
  for (int i = 0; i < (1<<3); ++i)
  {
    int tmp = s[0]-'0';
    string v;
    v+=s[0];
    for (int i = 0; i < 4; ++i)
    {
      if ((i>>(j-1)) &1)
      {
        tmp +=s[j]-'0';
        v+="+";
        v+=s[j];
      }
      else {
        tmp -=s[j]-'0';
        v+="-";
        v+=s[j];
      }
    }
    if (tmp = 7){
      cout<<v<<"=7"<<endl;
      
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:14:16: error: 'j' was not declared in this scope
   14 |       if ((i>>(j-1)) &1)
      |                ^
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 100
#define INF 1000000001
 
#define ad(x) int i = 100;
typedef long long ll;


int nums[4];

int main() {
    
    char op[2];
    op[0] = '+';
    op[1] = '-';
    
    int s;
    cin >> s;
    for(int i = 3; i >= 0; i--) {
        nums[i] = s  % 10;
        s /= 10;
    }
    
if (nums[0] + nums[1] + nums[2] + nums[3]==7) cout << "1+2+2+2=7" << endl; return 0;
if (nums[0] + nums[1] + nums[2] - nums[3]==7) cout << "1+2+2-2=7" << endl; return 0;
if (nums[0] + nums[1] - nums[2] + nums[3]==7) cout << "1+2-2+2=7" << endl; return 0;
if (nums[0] + nums[1] - nums[2] - nums[3]==7) cout << "1+2-2-2=7" << endl; return 0;
if (nums[0] - nums[1] + nums[2] + nums[3]==7) cout << "1-2+2+2=7" << endl; return 0;
if (nums[0] - nums[1] + nums[2] - nums[3]==7) cout << "1-2+2-2=7" << endl; return 0;
if (nums[0] - nums[1] - nums[2] + nums[3]==7) cout << "1-2-2+2=7" << endl; return 0;
if (nums[0] - nums[1] - nums[2] - nums[3]==7) cout << "1-2-2-2=7" << endl; return 0;
    
    // // REP(i,0,4) cout << nums[i] << endl;
    // REP(i,0,2) REP(j,0,2) REP(k,0,2) {
    //     printf("if (nums[0] %c nums[1] %c nums[2] %c nums[3]==7) ",op[i],op[j],op[k]);
    //     printf("cout << \"%d%c%d%c%d%c%d=7\" << endl; return 0;\n",nums[0],op[i],nums[1],op[j],nums[2],op[k],nums[3]);
    //     // printf("nums[0] %c nums[1] %c nums[2] %c nums[3]=7\n",op[i],op[j],op[k]);
    //     // if (nums[0] + nums[1] + nums[2] + nums[3]==7 || nums[0] + nums[1] + nums[2] - nums[3]==7 || nums[0] + nums[1] - nums[2] + nums[3]==7 || nums[0] + nums[1] - nums[2] - nums[3]==7 || nums[0] - nums[1] + nums[2] + nums[3]==7 || nums[0] - nums[1] + nums[2] - nums[3]==7 || nums[0] - nums[1] - nums[2] + nums[3]==7 || nums[0] - nums[1] - nums[2] - nums[3]==7){
    //     //     printf("%d%c%d%c%d%c%d=7",nums[0],op[i],nums[1],op[j],nums[2],op[k],nums[3]);
    //     //     break;
    //     // }
    }
}

Compiler output:
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include <cstdio>
char s [5];
int main ()
{
scanf ("%s", &s);
int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
if (a -b -c - d ==7)
  printf ("% d -% d -% d -% d =7\n " ,a ,b ,c , d );
else if (a -b - c + d ==7)
  printf ("% d -% d -% d +% d =7\n " ,a ,b ,c , d );
else if (a - b +c - d ==7)
  printf ("% d -% d +% d -% d =7\n " ,a ,b ,c , d );
else if (a - b + c + d ==7)
  printf ("% d -% d +% d +% d =7\n " ,a ,b ,c , d );
else if ( a +b -c - d ==7)
  printf ("% d +% d -% d -% d =7\n " ,a ,b ,c , d );
else if ( a +b - c + d ==7)
  printf ("% d +% d -% d +% d =7\n " ,a ,b ,c , d );
else if ( a + b +c - d ==7)
  printf ("% d +% d +% d -% d =7\n " ,a ,b ,c , d );
else if ( a + b + c + d ==7)
  printf ("% d +% d +% d +% d =7\n " ,a ,b ,c , d );
}


Compiler output:
a.cc:6:16: error: extended character ’ is not valid in an identifier
    6 | int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
      |                ^
a.cc:6:16: error: extended character ’ is not valid in an identifier
a.cc:6:32: error: extended character ’ is not valid in an identifier
    6 | int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
      |                                ^
a.cc:6:32: error: extended character ’ is not valid in an identifier
a.cc:6:45: error: extended character ’ is not valid in an identifier
    6 | int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
      |                                             ^
a.cc:6:45: error: extended character ’ is not valid in an identifier
a.cc:6:61: error: extended character ’ is not valid in an identifier
    6 | int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
      |                                                             ^
a.cc:6:61: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:6:16: error: '\U000020190\U00002019' was not declared in this scope
    6 | int a = s[0] - ’0’, b = s[1] - ’0’,c=s[2] - ’0’, d = s[3] - ’0’;
      |                ^~~
a.cc:7:8: error: 'b' was not declared in this scope
    7 | if (a -b -c - d ==7)
      |        ^
a.cc:7:11: error: 'c' was not declared in this scope
    7 | if (a -b -c - d ==7)
      |           ^
a.cc:7:15: error: 'd' was not declared in this scope
    7 | if (a -b -c - d ==7)
      |               ^
Language: C++

#include<stdio.h>
int main(){
int x,a[4]i,tx[8];
char opa='-',opb='-',opc='-';
scanf("%d",&x);
for(i=0;i<4;i++){
a[i]=x%10;
x=(x-(x%10))/10;
}
tx[0]=a[0]+a[1]+a[2]+a[3];
tx[1]=a[0]+a[1]+a[2]-a[3];
tx[2]=a[0]+a[1]-a[2]+a[3];
tx[3]=a[0]+a[1]-a[2]-a[3];
tx[4]=a[0]-a[1]+a[2]+a[3];
tx[5]=a[0]-a[1]+a[2]-a[3];
tx[6]=a[0]-a[1]-a[2]+a[3];
tx[7]=a[0]-a[1]-a[2]-a[3];

for(i=0;i<8;i++){
if(tx[i]==7){
if(i<4)opa='+';
if(i%4<2)opb='+'
if(i%2==0)opc='+'
printf("%d%c%d%c%d%c%d=7",a[0],opa,a[1],opb,a[2],opc,a[3]);
return 0;
}
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:11: error: expected initializer before 'i'
    3 | int x,a[4]i,tx[8];
      |           ^
a.cc:6:5: error: 'i' was not declared in this scope
    6 | for(i=0;i<4;i++){
      |     ^
a.cc:7:1: error: 'a' was not declared in this scope
    7 | a[i]=x%10;
      | ^
a.cc:10:1: error: 'tx' was not declared in this scope; did you mean 'x'?
   10 | tx[0]=a[0]+a[1]+a[2]+a[3];
      | ^~
      | x
a.cc:10:7: error: 'a' was not declared in this scope
   10 | tx[0]=a[0]+a[1]+a[2]+a[3];
      |       ^
a.cc:19:5: error: 'i' was not declared in this scope
   19 | for(i=0;i<8;i++){
      |     ^
a.cc:22:17: error: expected ';' before 'if'
   22 | if(i%4<2)opb='+'
      |                 ^
      |                 ;
   23 | if(i%2==0)opc='+'
      | ~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(j, n) for (int j = 0; j < (n); j++)

typedef long long ll;

int main()
{
    int x;
    cin >> x;
    vector<int> a(4);
    rep(i, 4){
        a[i] = x % 10;//0,1,2,3 =d,c,b,a
        x /= 10;
    }
    forx (b,0,(1<<4)){
        int n=a[3];
        rep(i,3){
            if(b>>i&1)
                n += a[2 - i];
            else
                n -= a[2 - i];
        }
        if(n==7){
            cout << ToString(a[3]);
            rep(i, 3)
            {
                if (b >> i & 1)
                    cout<<"+"<<ToString(a[2-i]);
                else
                    cout << "-" << ToString(a[2 - i]);
            }
            cout << "=7" << endl;
            break;
        }
    }
        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'ToString' was not declared in this scope
   26 |             cout << ToString(a[3]);
      |                     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
bool a[26];
int main(){
	char ac,bc,cc,dc;
	cin>>ac>>bc>>cc>>dc;
	int a=ac-'0',b=bc-'0',c=cc-'0',d=dc-'0';
	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{
		cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: expected '(' before '{' token
   29 |         else if{
      |                ^
      |                (
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a[4]; char s[4];
	for(int i=0;i<a;i++){
		cin>>s[i]; a[i]=s[i]-'0';
		s[i]='+';
	}
	if(a[0]+a[1]+a[2]-a[3]==7) s[2]='-';
	else if(a[0]+a[1]-a[2]+a[3]==7) s[1]='-';
	else if(a[0]+a[1]-a[2]-a[3]==7){s[1]='-'; s[2]='-';}
	else if(a[0]-a[1]+a[2]+a[3]==7) s[0]='-';
	else if(a[0]-a[1]+a[2]-a[3]==7){s[0]='-'; s[2]='-';}
	else if(a[0]-a[1]-a[2]+a[3]==7){s[0]='-'; s[1]='-';}
	else if(a[0]-a[1]-a[2]-a[3]==7){s[0]='-'; s[1]='-'; s[2]='-';}

	cout<<a[0]<<s[0]<<a[1]<<s[1]<<a[2]<<s[2]<<a[3]<<"=7"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |         for(int i=0;i<a;i++){
      |                     ~^~
Language: C++

#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdio.h>

using namespace std;

int main (){
	
	int a,b,c,d;
	cin >>a >>b >>c >>d;

	int check =0;
	int ans=0;
	while(){
		if(a+b+c+d==7){
			ans = 0;
			break;
		}
		else if(a+b+c-d==7){
			ans = 1;
			break;
		}
		else if(a+b-c+d==7){
			ans = 2;
			break;
		}
		else if(a+b-c-d==7){
			ans = 3;
			break;
		}
		else if(a-b+c+d==7){
			ans = 4;
			break;
		}
		else if(a-b+c-d==7){
			ans = 5;
			break;
		}
		else if(a-b-c+d==7){
			ans = 6;
			break;
		}
		else if(a-b-c-d==7){
			ans = 7;
			break;
		}
		check=1;
		break;
	}
	if(check==1){
		cout << "error" << endl;
		return 0;
	}
	else if (ans ==0){
		cout << a << "+" << b << "+" << c << "+" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==1){
		cout << a << "+" << b << "+" << c << "-" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==2){
		cout << a << "+" << b << "-" << c << "+" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==3){
		cout << a << "+" << b << "-" << c << "-" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==4){
		cout << a << "-" << b << "+" << c << "+" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==5){
		cout << a << "-" << b << "+" << c << "-" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==6){
		cout << a << "-" << b << "-" << c << "+" << d <<"=7" << endl;
		return 0;
	}
	else if (ans ==7){
		cout << a << "-" << b << "-" << c << "-" << d <<"=7" << endl;
		return 0;
	}
	return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/foreach.hpp: No such file or directory
    2 | #include <boost/foreach.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;

int main() {
	scanf("%d%d%d%d", a, b, c, d);
	if (a + b + c + d == 7)printf("%d + %d + %d + d=7\n", a, b, c, d);
	else if (a - b + c + d == 7)printf("%d - %d + %d + d=7\n", a, b, c, d);
	else if (a + b - c + d == 7)printf("%d + %d - %d + d=7\n", a, b, c, d);
	else if (a - b - c + d == 7)printf("%d - %d - %d + d=7\n", a, b, c, d);
	else if (a + b + c - d == 7)printf("%d + %d + %d - d=7\n", a, b, c, d);
	else if (a + b - c - d == 7)printf("%d + %d - %d - d=7\n", a, b, c, d);
	else if (a - b + c - d == 7)printf("%d - %d + %d - d=7\n", a, b, c, d);
	else if (a - b - c - d == 7)printf("%d - %d - %d - d=7\n", a, b, c, d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:27: error: 'a' was not declared in this scope
    5 |         scanf("%d%d%d%d", a, b, c, d);
      |                           ^
a.cc:5:30: error: 'b' was not declared in this scope
    5 |         scanf("%d%d%d%d", a, b, c, d);
      |                              ^
a.cc:5:33: error: 'c' was not declared in this scope
    5 |         scanf("%d%d%d%d", a, b, c, d);
      |                                 ^
a.cc:5:36: error: 'd' was not declared in this scope
    5 |         scanf("%d%d%d%d", a, b, c, d);
      |                                    ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

string opr(bool ov){
  if(ov) return "+";
  else return "-";
}

int main(){
  int A,result, id;
  cin >> A;
  int elem[4] = {(int)(A/1000),(int)((A%1000)/100),(int)((A%100)/10),A%10};
  
  bool op[8][3];
  
  for(int i = 0; i < 8; i++){
    if(i < 4) op[i][0] = false;
    else op[i][0] = true;
    if(i % 4 < 2) op[i][1] = false;
    else op[i][1] = true;
    if(i % 2 < 1) op[i][2] = false;
    else op[i][2] = true;
  }

  for(id = 0; id < 8; id++){
    result = elem[0];
    for(int i = 0; i < 3; i++){
      if(op[id][i]) result += elem[i+1];
      else result -= elem[i+1];
    }
    if(result == 7) break;
  }
  cout << elem[0];
  for(int i = 0; i < 3; i++){
    cout << opr(op[right_id][i]) << elem[i+1];
  }
  cout << "=7" << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:20: error: 'right_id' was not declared in this scope
   37 |     cout << opr(op[right_id][i]) << elem[i+1];
      |                    ^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

string opr(bool){
  if(opr) return "+";
  else return "-";
}

int main(){
  int A,id,result;
  cin >> A;
  int elem[4] = {(int(A/1000),(int)((A%1000)/100),(int)((A%100)/10),A%10};
  bool op[8][3];
  for(int i = 0; i < 8; i++){
    if(i < 4) op[i][0] = false;
    else op[i][0] = true;
    if(i % 4 < 2) op[i][1] = false;
    else op[i][1] = true;
    if(i % 2 < 1) op[i][2] = false;
    else op[i][2] = true;
  }

  for(id = 0; id < 8; id++){
    result = elem[0];
    for(int i = 0; i < 3; i++){
      if(op[id][i]) result += elem[i+1];
      else result -= elem[i+1];
    }
    if(result == 7) break;
  }
  cout << elem[0];
  for(int i = 0; i < 3; i++){
    cout << opr(op[id][i]) << elem[i+1];
  }
  cout << "=7" << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:73: error: expected ')' before '}' token
   14 |   int elem[4] = {(int(A/1000),(int)((A%1000)/100),(int)((A%100)/10),A%10};
      |                  ~                                                      ^
      |                                                                         )
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

string opr(bool){
  if(opr) return "+";
  else return "-";
}

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int elem[4] = {A,B,C,D};
  bool op[8][3];
  for(int i = 0; i < 8; i++){
    if(i < 4) op[i][0] = false;
    else op[i][0] = true;
    if(i % 4 < 2) op[i][1] = false;
    else op[i][1] = true;
    if(i % 2 < 1) op[i][2] = false;
    else op[i][2] = true;
  }
  
  int result = elem[0];
  for(int id = 0; id < 8; id++){
    for(int i = 0; i < 3; i++){
      if(op[id][i]) result += elem[i+1];
      else result -= elem[i+1];
    }
    if(result == 7) break;
  }
  cout << elem[0];
  for(int i = 0; i < 3; i++){
    cout << opr(op[id]) << elem[id+1];
  }
  cout << "=7" << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: 'id' was not declared in this scope; did you mean 'i'?
   35 |     cout << opr(op[id]) << elem[id+1];
      |                    ^~
      |                    i
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int n; cin>>n;
    int kk[4];
    FOR(i,0,4){
        kk[i]=n%10;
        n/=10;
    }
    int d[2]={1,-1};
    char h[2]="+-";
    FOR(i,0,2){
        FOR(j,0,2){
            FOR(k,0,2){
                if(kk[3]+kk[2]*d[i]+kk[1]*d[j]+kk[0]*d[k]==7){
                    cout<<kk[3]<<h[i]<<kk[2]<<h[j]<<kk[1]<<h[k]<<kk[0]<<"=7"<<endl;
                    exit(0);
                }
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: initializer-string for 'char [2]' is too long [-fpermissive]
   37 |     char h[2]="+-";
      |               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int I;
    cin >> I;
    int A = I/1000;
    int B = I/100 - A*10;
    int C = I/10 - A*100 - B*10;
    int D = I - A*1000 - B*100 - C*10;
    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) {
        z << 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";
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'z' was not declared in this scope
   16 |         z << A << "+" << B << "-" << C << "+" << D << "=7";
      |         ^
Language: C++

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> v(4);
  for(int i=0;i<4;i++)
    cin >> v[i];

  for(int i=0;i<(1<<3);i++) {
    int sum = a;
    for(int j=0;j<3;j++) {
      if(i >> j && 1) {
        sum += v[j+1];
      } else {
        sum -= v[j+1];
      }
    }
    if(sum == 7) {
      cout << v[0];
      for(int k=0;k<3;k++) {
        if(i >> k && 1) {
          cout << '+';
        } else {
          cout << '-';
        }
        cout << v[k+1];
      }
      cout << endl;
      return 0;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'a' was not declared in this scope
   13 |     int sum = a;
      |               ^
Language: C++

#include"stdafx.h"
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int, int> P;

int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int main() {
	int ans1 = 0, ans2 = 0, ans3 = 0, a, b, c, d;
	char op1, op2, op3;
	int A;
	cin >> A;
	d = A % 10;
	A = A / 10;
	c = A % 10;
	A = A / 10;
	b = A % 10;
	A = A / 10;
	a = A % 10;

	REP(i, 2) {
		ans1 = 0;
		if (i == 0) {
			ans1 = a + b;
			op1 = '+';
		}
		else {
			ans1 = a - b;
			op1 = '-';
		}
		REP(j, 2) {
			if (j == 0) {
				ans2 = ans1 + c;
					op2 = '+';
			}
			else {
				ans2 =ans1-c;
				op2 = '-';
			}
			REP(k, 2) {
				if (k == 0) {
					ans3 = ans2 + d;
					op3 = '+';
				}
				else {
					ans3 = ans2 - d;
					op3 = '-';
				}
				if (ans3 == 7) {
					cout << a << op1 << b << op2 << c << op3 << d;
					return 0;
				}
			}
		}
	}
}



Compiler output:
a.cc:1:9: fatal error: stdafx.h: No such file or directory
    1 | #include"stdafx.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include<bitset>

using namespace std;
#define loop(i,n) for(int i = 0; i < (n); ++i)
#define loops(i,f,n) for(int i = (f); i < (n); ++i)
#define INF 9999999
#define in(a) cin>>a
#define out(a) cout<<a<<endl

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	bool ok = false;
	loop(bit, (1 << 3))
	{
		if (ok)break;
		int ans_tmp = s[0] - '0';
		vector<char> ops;
		loop(j, 3)
		{
			if (bit&(1 << j))
			{
				ans_tmp += (s[j + 1] - '0');
				ops.push_back('+');
			}
			else
			{
				ans_tmp -= (s[j + 1] - '0');
				ops.push_back('-');
			}
		}
		string answer = s[0] + ops[0] + s[1] + ops[1] + s[2] + ops[2] + s[3];
		cout << answer << "=7" << endl;
		ok = true;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:79: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   41 |                 string answer = s[0] + ops[0] + s[1] + ops[1] + s[2] + ops[2] + s[3];
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s;
int a[4];
int op[4];
void out() {
    for (int i = 0; i < 3; ++i) {
        cout << a[i];
        cout << (op[i] == 0 ? '+' : '-');
    }
    cout << a[3] << "=7" << endl;
    return;
}
void f(int k, int nm) {
    if (k == 3) {
        nm += a[3];
        if (nm == 7) {
            out();
            exit();
        }
        nm -= 2 * a[3];
        if (nm == 7) {
            out();
            exit();
        }
        return;
    }
    op[k] = 0;
    f(k + 1, nm + a[k]);
    op[k] = 1;
    f(k + 1, nm - a[k]);
    return;
}
int main(){
    cin >> s;
    a[0] = s[0] - '0';
    a[1] = s[1] - '0';
    a[2] = s[2] - '0';
    a[3] = s[3] - '0';
    f(0, 0);
    return 0;
}

Compiler output:
a.cc: In function 'void f(int, int)':
a.cc:19:17: error: too few arguments to function 'void exit(int)'
   19 |             exit();
      |             ~~~~^~
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:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
a.cc:24:17: error: too few arguments to function 'void exit(int)'
   24 |             exit();
      |             ~~~~^~
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C

#include<stdio.h>

int main()
{
	char a2,b1,c1,d1;
	int a,b,c,d;
	int m=0;
	scanf("%c%c%c%c",&a2,&b1,&c1,&d1);
	a=(int)(a1-'0');
	b=(int)(b1-'0');
	c=(int)(c1-'0');
	d=(int)(d1-'0');
	if (a+b+c+d==7) t=1;
	else if (a+b+c-d==7) t=2;
	else if (a+b-c+d==7) t=3;
	else if (a-b+c+d==7) t=4;
	else if (a+b-c-d==7) t=5;
	else if (a-b+c-d==7) t=6;
	else if (a-b-c+d==7) t=7;
	else if (a-b-c-d==7) t=8;
	
	switch(t){
	case 1:	printf("%d+%d+%d+%d=7",a,b,c,d);break;
	case 2:	printf("%d+%d+%d-%d=7",a,b,c,d);break;
	case 3:	printf("%d+%d-%d+%d=7",a,b,c,d);break;
	case 4:	printf("%d-%d+%d+%d=7",a,b,c,d);break;
	case 5:	printf("%d+%d-%d-%d=7",a,b,c,d);break;
	case 6:	printf("%d-%d+%d-%d=7",a,b,c,d);break;
	case 7:	printf("%d-%d-%d+%d=7",a,b,c,d);break;
	case 8:	printf("%d-%d-%d-%d=7",a,b,c,d);break;
	default:printf("no answer!");break;
	}
}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: 'a1' undeclared (first use in this function); did you mean 'a'?
    9 |         a=(int)(a1-'0');
      |                 ^~
      |                 a
main.c:9:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:25: error: 't' undeclared (first use in this function)
   13 |         if (a+b+c+d==7) t=1;
      |                         ^