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

#include<iostream>
using namespace std;

int main() {
    char ch, b[4];
    int a[4], s1= 0,s2 = 0, m;
    for (i = 0; i < 4; i++) {
        cin >> ch;
        a[i] = ch - '0';
        s1 += a[i];
    }
    if (s1 == 7) cout << a[0] << '+' << a[1] << '+' << a[2] << '+' << a[3] << "=7" << endl;
    else {
		s2 = a[0] - a[1] - a[2] - a[3];
        if (s2 == 7) cout << a[0] << '-' << a[1] << '-' << a[2] << '-' << a[3] << "=7" << endl;
		else {
			for (int k = 0; k < 2; k++) {
				for (int i = 1; i < 4; i++) {
					for (int j = 1; j < 4; j++) {
						if (j == i) k == 0 ? b[j] = '+' : b[j] = '-';
						else k == 0 ? b[j] = '-' : b[j] = '+';
					}
					m = k == 0 ? s2 + 2 * a[i]: s1 - 2 * a[i];
					if (m == 7) cout << a[0] << b[1] << a[1] << b[2] << a[2] << b[3] << a[3] << "=7" << endl; break;
				}
			}
		}   
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'i' was not declared in this scope
    7 |     for (i = 0; i < 4; i++) {
      |          ^
Language: C++

#include <iostream>
using namespace std;

int main() {
    char ch;
    int a[4], s = 0, i, j;
    for (i = 0; i < 4; i++) {
        cin >> ch;
        a[i] = ch - '0';
        s += a[i];
    }
    if (s == 7) cout << a[0] << '+' << a[1] << '+' << a[2] << '+' << a[3];
    else {
        cout << a[0];
        for (i = 1; i < 4; i++) {
            s -= 2 * a[i];
            if (s > 7) cout << '-' << a[i];
            else if (s == 7) { cout << '-' << a[i]; break; }
            else cout << '+' << a[i], s += 2 * a[i];
        }
        for (j = i + 1; j < 4; j++) {
            cout << '+' << a[j];
        }
    }
    cout <<"=7"<< endl;
    return 0；
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   26 |     return 0；
      |            ^~~
a.cc:26:15: error: expected ';' before '}' token
   26 |     return 0；
      |               ^
      |               ;
   27 | }
      | ~
Language: C++

#include <iostream>
using namespace std;
void Op7(int n){
    int a[4], s, i, j;
    a[0]= n/1000;
    a[1] = n%1000/100;
    a[2] = n%1000%100/10;
    a[3] = n%1000%100%10;
    s = a[0] + a[1] + a[2] + a[3];
    if(s == 7) cout<<a[0]<<'+'<<a[1]<<'+'<<a[2]'+'<<a[3];
    else{
        cout<<a[0];
        for(i = 1; i < 4; i++){
            s-= 2*a[i];
            if(s > 7) cout<<'-'<<a[i];
            else if(s == 7) cout<<'-'<<a[i], break;
            else s+= 2*a[i];
        }
        for(j = i + 1; j < 4; j++){
            cout<<'+'<<a[j];
        }
    }
}
int main{
    int n;
    cin>>n;
    Op7(n);
}

Compiler output:
a.cc: In function 'void Op7(int)':
a.cc:10:48: error: expected ';' before '+'
   10 |     if(s == 7) cout<<a[0]<<'+'<<a[1]<<'+'<<a[2]'+'<<a[3];
      |                                                ^~~
      |                                                ;
a.cc:16:46: error: expected primary-expression before 'break'
   16 |             else if(s == 7) cout<<'-'<<a[i], break;
      |                                              ^~~~~
a.cc: At global scope:
a.cc:24:5: error: cannot declare '::main' to be a global variable
   24 | int main{
      |     ^~~~
a.cc:25:5: error: expected primary-expression before 'int'
   25 |     int n;
      |     ^~~
a.cc:25:5: error: expected '}' before 'int'
a.cc:24:9: note: to match this '{'
   24 | int main{
      |         ^
a.cc:26:5: error: 'cin' does not name a type
   26 |     cin>>n;
      |     ^~~
a.cc:27:8: error: expected constructor, destructor, or type conversion before '(' token
   27 |     Op7(n);
      |        ^
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

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

int main()
{
    string s;
    cin >> s;
    vector<int> abcd(4);
    for (int i = 0; i < 4; i++)
    {
        abcd[i] = s[i] - '0';
    }
    
    for (int i = 0; i < (1 << 3); i++)
    {
        bitset<3> bit(i);
        int num = abcd[0];
        for (int j = 0; j < 3; j++)
        {
            if(bit[j])num += abcd[j + 1];
            else num -= abcd[j + 1];
        }
        
        if(num == 7)
        {
            cout << s[0];
            for (int j = 0; j < 3; j++)
            {
                if(bit[j])cout << "+" << s[j + 1];
                else cout << "-" << s[j + 1]
            }
            cout << "=7" << endl;
            break;
        }
    }
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:45: error: expected ';' before '}' token
   30 |                 else cout << "-" << s[j + 1]
      |                                             ^
      |                                             ;
   31 |             }
      |             ~
Language: C++

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)


//ABC079_c
int main() {
	string s;
	cin >> s;

	for (int tmp = 0; tmp < (1 << 3); tmp++) {
	    bitset<3> op(tmp);

		int sum = s[0] - '0';
		string ans = "";
		ans.append(s.substr(0, 1));
		for (int i=1; i<s.size(); i++) {

			if (op[i-1]==0) {
				sum += s[i] - '0';
				ans += "+";
			}
			else {
				sum -= s[i] - '0';
				ans.append("-");
			}
			ans += s.substr(i, 1);
		}
		if (sum == 7) {
			ans += "=7";
			cout << ans << endl;
			return 0;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'bitset' was not declared in this scope
   24 |             bitset<3> op(tmp);
      |             ^~~~~~
a.cc:13:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   12 | #include <set>
  +++ |+#include <bitset>
   13 | using namespace std;
a.cc:24:23: error: 'op' was not declared in this scope
   24 |             bitset<3> op(tmp);
      |                       ^~
Language: C++

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

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: bits/stdc++.h : No such file or directory
    1 | # include <bits/stdc++.h >
      |           ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
  string s;
  int sum;
  bitset<3> ans;
  cin >> s;
  sum =s.at(0)-'0';
  for(int i =0; i < (1<<3); i++){
    bitset<3> v(i);
    
    for(int j=0;j<3;j++){
      int b =s.at(j+1)-'0';
      if(v.test(j))
        sum+=b;
      else  sum -=b;
    }
    if(sum ==7)
      ans =v;
  }
  cout << s.at(0);
  for(int i=0; i<3; i++){
    if(s.test(i) )
      cout << '+' << s.at(i+1) ;
    else
      cout << '-' <<s.at(i+1);
  }
  cout << "=7" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'test'
   24 |     if(s.test(i) )
      |          ^~~~
Language: C++

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

int main() {
  char a,b,c,d;
  cin>>a>>b>>c>>d;
  int A=a- '0', B=b- '0', C=c- '0',D=d- '0';
  int T =A+B+C+D;
  char op1='+',op2='+',op3='+';
  if(T!=7){
    if(T-2*B==7) op1='-';
    else if (T-2*C==7) op2='-';
    else if(T-2*D==7) op3='-';
    else if(T-2*B-2*C==7) op1='-',op2='-';
    else if(T-2*C-2*D==7) op2='-',op3='-';
    else if(T-2*B-2*D==7) op1='-',op3='-';
    else op1='-', op2='-',op3='-';
  }
  cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:35: error: expected primary-expression before ',' token
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                                   ^
Language: C++

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

int main() {
  char a,b,c,d;
  cin>>a>>b>>c>>d;
  int A=a- '0', B=b- '0', C=c- '0',D=d- '0';
  int T =A+B+C+D;
  char op1='+',op2='+'.op3='+';
  if(T!=7){
    if(T-2*B==7) op1='-';
    else if (T-2*C==7) op2='-';
    else if(T-2*D==7) op3='-';
    else if(T-2*B-2*C==7) op1='-',op2='-';
    else if(T-2*C-2*D==7) op2='-',op3='-';
    else if(T-2*B-2*D==7) op1='-',op3='-';
    else op1='-', op2='-',op3='-';
  }
  cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: request for member 'op3' in ''+'', which is of non-class type 'char'
    9 |   char op1='+',op2='+'.op3='+';
      |                        ^~~
a.cc:13:23: error: 'op3' was not declared in this scope; did you mean 'op2'?
   13 |     else if(T-2*D==7) op3='-';
      |                       ^~~
      |                       op2
a.cc:15:35: error: 'op3' was not declared in this scope; did you mean 'op2'?
   15 |     else if(T-2*C-2*D==7) op2='-',op3='-';
      |                                   ^~~
      |                                   op2
a.cc:16:35: error: 'op3' was not declared in this scope; did you mean 'op2'?
   16 |     else if(T-2*B-2*D==7) op1='-',op3='-';
      |                                   ^~~
      |                                   op2
a.cc:17:27: error: 'op3' was not declared in this scope; did you mean 'op2'?
   17 |     else op1='-', op2='-',op3='-';
      |                           ^~~
      |                           op2
a.cc:19:28: error: 'op3' was not declared in this scope; did you mean 'op2'?
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                            ^~~
      |                            op2
a.cc:19:35: error: expected primary-expression before ',' token
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                                   ^
Language: C++

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

int main() {
  char a,b,c,d;
  cin>>a>>b>>c>>d;
  int A=a- '0', B=b- '0', C=c- '0',D=d- '0';
  int T =A+B+C+D;
  charop1='+',op2='+'.op3='+';
  if(T!=7){
    if(T-2*B==7) op1='-';
    else if (T-2*C==7) op2='-';
    else if(T-2*D==7) op3='-';
    else if(T-2*B-2*C==7) op1='-',op2='-';
    else if(T-2*C-2*D==7) op2='-',op3='-';
    else if(T-2*B-2*D==7) op1='-',op3='-';
    else op1='-', op2='-',op3='-';
  }
  cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'charop1' was not declared in this scope
    9 |   charop1='+',op2='+'.op3='+';
      |   ^~~~~~~
a.cc:9:15: error: 'op2' was not declared in this scope
    9 |   charop1='+',op2='+'.op3='+';
      |               ^~~
a.cc:9:23: error: request for member 'op3' in ''+'', which is of non-class type 'char'
    9 |   charop1='+',op2='+'.op3='+';
      |                       ^~~
a.cc:11:18: error: 'op1' was not declared in this scope
   11 |     if(T-2*B==7) op1='-';
      |                  ^~~
a.cc:13:23: error: 'op3' was not declared in this scope
   13 |     else if(T-2*D==7) op3='-';
      |                       ^~~
a.cc:14:27: error: 'op1' was not declared in this scope
   14 |     else if(T-2*B-2*C==7) op1='-',op2='-';
      |                           ^~~
a.cc:15:35: error: 'op3' was not declared in this scope
   15 |     else if(T-2*C-2*D==7) op2='-',op3='-';
      |                                   ^~~
a.cc:16:27: error: 'op1' was not declared in this scope
   16 |     else if(T-2*B-2*D==7) op1='-',op3='-';
      |                           ^~~
a.cc:16:35: error: 'op3' was not declared in this scope
   16 |     else if(T-2*B-2*D==7) op1='-',op3='-';
      |                                   ^~~
a.cc:17:10: error: 'op1' was not declared in this scope
   17 |     else op1='-', op2='-',op3='-';
      |          ^~~
a.cc:17:27: error: 'op3' was not declared in this scope
   17 |     else op1='-', op2='-',op3='-';
      |                           ^~~
a.cc:19:12: error: 'op1' was not declared in this scope
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |            ^~~
a.cc:19:28: error: 'op3' was not declared in this scope
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                            ^~~
a.cc:19:35: error: expected primary-expression before ',' token
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                                   ^
Language: C++

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

int main() {
  char a,b,c,d;
  cin>>a>>b>>c>>d;
  int A=a- '0', B=b- '0', C=c- '0',D=d- '0';
  int T =A+B+C+D;
  char= op1='+',op2='+'.op3='+';
  if(T!=7){
    if(T-2*B==7) op1='-';
    else if (T-2*C==7) op2='-';
    else if(T-2*D==7) op3='-';
    else if(T-2*B-2*C==7) op1='-',op2='-';
    else if(T-2*C-2*D==7) op2='-',op3='-';
    else if(T-2*B-2*D==7) op1='-',op3='-';
    else op1='-', op2='-',op3='-';
  }
  cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: expected unqualified-id before '=' token
    9 |   char= op1='+',op2='+'.op3='+';
      |       ^
a.cc:11:18: error: 'op1' was not declared in this scope
   11 |     if(T-2*B==7) op1='-';
      |                  ^~~
a.cc:12:24: error: 'op2' was not declared in this scope
   12 |     else if (T-2*C==7) op2='-';
      |                        ^~~
a.cc:13:23: error: 'op3' was not declared in this scope
   13 |     else if(T-2*D==7) op3='-';
      |                       ^~~
a.cc:14:27: error: 'op1' was not declared in this scope
   14 |     else if(T-2*B-2*C==7) op1='-',op2='-';
      |                           ^~~
a.cc:14:35: error: 'op2' was not declared in this scope
   14 |     else if(T-2*B-2*C==7) op1='-',op2='-';
      |                                   ^~~
a.cc:15:27: error: 'op2' was not declared in this scope
   15 |     else if(T-2*C-2*D==7) op2='-',op3='-';
      |                           ^~~
a.cc:15:35: error: 'op3' was not declared in this scope
   15 |     else if(T-2*C-2*D==7) op2='-',op3='-';
      |                                   ^~~
a.cc:16:27: error: 'op1' was not declared in this scope
   16 |     else if(T-2*B-2*D==7) op1='-',op3='-';
      |                           ^~~
a.cc:16:35: error: 'op3' was not declared in this scope
   16 |     else if(T-2*B-2*D==7) op1='-',op3='-';
      |                                   ^~~
a.cc:17:10: error: 'op1' was not declared in this scope
   17 |     else op1='-', op2='-',op3='-';
      |          ^~~
a.cc:17:19: error: 'op2' was not declared in this scope
   17 |     else op1='-', op2='-',op3='-';
      |                   ^~~
a.cc:17:27: error: 'op3' was not declared in this scope
   17 |     else op1='-', op2='-',op3='-';
      |                           ^~~
a.cc:19:12: error: 'op1' was not declared in this scope
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |            ^~~
a.cc:19:20: error: 'op2' was not declared in this scope
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                    ^~~
a.cc:19:28: error: 'op3' was not declared in this scope
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                            ^~~
a.cc:19:35: error: expected primary-expression before ',' token
   19 |   cout<<A<<op1<<B<<op2<<C<<op3<<D<,"=7";
      |                                   ^
Language: C++


#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

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:57:66: error: expected primary-expression before '<<' token
   57 |                 cout << a << "-" << b << "-" << c << "-" << d << <<"=7"endl;
      |                                                                  ^~
a.cc:57:68: error: unable to find string literal operator 'operator""endl' with 'const char [3]', 'long unsigned int' arguments
   57 |                 cout << a << "-" << b << "-" << c << "-" << d << <<"=7"endl;
      |                                                                    ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main(){
    int s;
    cin >> s;
    int a = s/1000;
    int b = s%1000/100;
    int c = s%100/10;
    int d = s%10;
    if(a+b+c+d == 7){
        cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b+c+d == 7){
        cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b-c+d == 7){
        cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
        return 0;
    }
    if(a-b-c-d == 7){
        cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
        return 0;
    }
    if(a-b+c-d == 7){
        cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
        return 0;
    }
    /if(a+b-c-d == 7){
        cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
        return 0;
    }
    if(a+b-c+d == 7){
        cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
        return 0;
    }
    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:34:5: error: expected primary-expression before '/' token
   34 |     /if(a+b-c-d == 7){
      |     ^
a.cc:34:6: error: expected primary-expression before 'if'
   34 |     /if(a+b-c-d == 7){
      |      ^~
Language: C++

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

int main() {
  vector<int> v1;
  string a;
  cin >> a;
  for(int k = 0; k < 4; k++){
      int b;
      b = a.at(k) - '0'
      v1.push_back(b);
  }
  vector<char> v2(3);
  for(int i = 0; i < (1 << 3); i++){
      int p = v1.at(0);
      for(int t = 0; t < 3; t++){
          if(i & (1 << t)){
             p += v1.at(t+1);
             v2[t] = '+';
          }else{
             p -= v1.at(t+1);
             v2[t] = '-';
          }
     } 
     if(p == 7) goto end;
  }
  end:
    cout << v1.at(0) << v2.at(0) << v1.at(1) << v2.at(1) << v1.at(2) << v2.at(2) << v1.at(3) << "=7" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: expected ';' before 'v1'
   10 |       b = a.at(k) - '0'
      |                        ^
      |                        ;
   11 |       v1.push_back(b);
      |       ~~
Language: C++

S = input()
binary = '111'
for i in range(2**(len(S)-1)):
  binary = str(format(i,'b')).zfill(3)
  if int(S[0])+int(S[1])*(-1)**(int(binary[0]))+int(S[2])*(-1)**(int(binary[1]))+int(S[3])*(-1)**(int(binary[2]))==7:  
    break
B = binary.replace('0','+').replace('1','-')
print(S[0]+B[0]+S[1]+B[1]+S[2]+B[2]+S[3]+'=7')

Compiler output:
a.cc:2:10: warning: multi-character character constant [-Wmultichar]
    2 | binary = '111'
      |          ^~~~~
a.cc:8:42: warning: multi-character character constant [-Wmultichar]
    8 | print(S[0]+B[0]+S[1]+B[1]+S[2]+B[2]+S[3]+'=7')
      |                                          ^~~~
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int counter=0;
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:22:26: error: expected '}' at end of input
   22 | cout<<"A-B-C-D=7"<<endl;}
      |                          ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int counter=0;
int A,B,C,D;
cin>>A>>B>>C>>D;
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"<<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:13:1: error: expected '}' before 'else'
   13 | else if(A-B+C+D==7){
      | ^~~~
a.cc:11:20: note: to match this '{'
   11 | else if(A+B-C+D==7){
      |                    ^
a.cc:22:26: error: expected '}' at end of input
   22 | cout<<"A-B-C-D=7"<<endl;}
      |                          ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int counter=0;
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:8:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 | cout<<A+B+C+D=7<<endl;}
      |               ~^~~~~~
a.cc:10:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   10 | cout<<A+B+C-D=7<<endl;}
      |               ~^~~~~~
a.cc:12:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   12 | cout<<A+B-C+D=7<<endl;
      |               ~^~~~~~
a.cc:13:1: error: expected '}' before 'else'
   13 | else if(A-B+C+D==7){
      | ^~~~
a.cc:11:20: note: to match this '{'
   11 | else if(A+B-C+D==7){
      |                    ^
a.cc:14:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   14 | cout<<A-B+C+D=7<<endl;}
      |               ~^~~~~~
a.cc:16:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 | cout<<A+B-C-D=7<<endl;}
      |               ~^~~~~~
a.cc:18:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 | cout<<A-B+C-D=7<<endl;}
      |               ~^~~~~~
a.cc:20:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   20 | cout<<A-B-C+D=7<<endl;}
      |               ~^~~~~~
a.cc:22:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   22 | cout<<A-B-C-D=7<<endl;}
      |               ~^~~~~~
a.cc:22:24: error: expected '}' at end of input
   22 | cout<<A-B-C-D=7<<endl;}
      |                        ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}

class CTrainTicket {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    string S;
    cin >> S;
    int A = S[0] - '0', B = S[1] - '0', C = S[2] - '0', D = S[3] - '0';
    string ans;
    if (A + B + C + D == 7) {
      ans = "A+B+C+D=7";
    } else if (A - B + C + D == 7) {
      ans = "A-B+C+D=7";
    } else if (A - B - C + D == 7) {
      ans = "A-B-C+D=7";
    } else if (A - B - C - D == 7) {
      ans = "A-B-C-D=7";
    } else if (A - B + C - D == 7) {
      ans = "A-B+C-D=7";
    } else if (A + B - C + D == 7) {
      ans = "A+B-C+D=7";
    } else if (A + B - C - D == 7) {
      ans = "A+B-C-D=7";
    } else {
      ans = "A+B+C-D=7";
    }
    rep(i, ans.size()) {
      if (ans[i] == 'A') ans[i] = '0' + A;
      if (ans[i] == 'B') ans[i] = '0' + B;
      if (ans[i] == 'C') ans[i] = '0' + C;
      if (ans[i] == 'D') ans[i] = '0' + D;
    }
    cout << ans << endl;
  }
};


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int counter=0;
intA,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:5:1: error: 'intA' was not declared in this scope; did you mean 'int'?
    5 | intA,B,C,D;
      | ^~~~
      | int
a.cc:5:6: error: 'B' was not declared in this scope
    5 | intA,B,C,D;
      |      ^
a.cc:5:8: error: 'C' was not declared in this scope
    5 | intA,B,C,D;
      |        ^
a.cc:5:10: error: 'D' was not declared in this scope
    5 | intA,B,C,D;
      |          ^
a.cc:6:6: error: 'A' was not declared in this scope
    6 | cin>>A>>B>>C>>D;
      |      ^
a.cc:8:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 | cout<<A+B+C+D=7<<endl;}
      |               ~^~~~~~
a.cc:10:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   10 | cout<<A+B+C-D=7<<endl;}
      |               ~^~~~~~
a.cc:12:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   12 | cout<<A+B-C+D=7<<endl;
      |               ~^~~~~~
a.cc:13:1: error: expected '}' before 'else'
   13 | else if(A-B+C+D==7){
      | ^~~~
a.cc:11:20: note: to match this '{'
   11 | else if(A+B-C+D==7){
      |                    ^
a.cc:14:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   14 | cout<<A-B+C+D=7<<endl;}
      |               ~^~~~~~
a.cc:16:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 | cout<<A+B-C-D=7<<endl;}
      |               ~^~~~~~
a.cc:18:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 | cout<<A-B+C-D=7<<endl;}
      |               ~^~~~~~
a.cc:20:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   20 | cout<<A-B-C+D=7<<endl;}
      |               ~^~~~~~
a.cc:22:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   22 | cout<<A-B-C-D=7<<endl;}
      |               ~^~~~~~
a.cc:22:24: error: expected '}' at end of input
   22 | cout<<A-B-C-D=7<<endl;}
      |                        ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int a, b, c, d;
  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++){
        int ans = a*(b*(-1*i))+(c*(-1*j))+(d*(-1*k));
        if (ans==7){
          cout << a;
          if (-1*i>=0) cout << "+";
          else cout << "-";
          cout << b;
          if (-1*j>=0) cout << "+";
          else cout << "-";
          cout << c;
          if (-1*k>=0) cout << "+";
          else cout << "-";
          cout << d << endl;
          return 0
        }
      }
    }
  }
}
        
      

Compiler output:
a.cc: In function 'int main()':
a.cc:23:19: error: expected ';' before '}' token
   23 |           return 0
      |                   ^
      |                   ;
   24 |         }
      |         ~
Language: C++

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

int a[4];
int main(){
 cin >> a[0] >> a[1] >> a[2] >> a[3];
   
  //xは000から111(---から+++)までの7つを表している
 for (int x=0;x<8;x++){
   int sum = a[0];
   string s;
   s+=(char)('0'+a[0]);//ここまでで「3+2+4-2」の「3」までできてる
   
   for (int i=0;i<3;i++){
　　//if (xがi番目のbitを含んでいたら(「x&(1<<i)」=0だったらiビット目が0))
     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 << endl;
 }
}
//よくわからん
       


Compiler output:
a.cc:15:1: error: extended character 　 is not valid in an identifier
   15 | 　　//if (xがi番目のbitを含んでいたら(「x&(1<<i)」=0だったらiビット目が0))
      | ^
a.cc:15:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:15:1: error: '\U00003000\U00003000' was not declared in this scope
   15 | 　　//if (xがi番目のbitを含んでいたら(「x&(1<<i)」=0だったらiビット目が0))
      | ^~~~
a.cc:21:6: error: 'else' without a previous 'if'
   21 |      else {
      |      ^~~~
Language: C++

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

#define rep(i, n) for(ll i=0; i<n; i++)
#define all(v) v.begin(), v.end()
#define vec vector

typedef long long ll;

//  bit全探索
//  for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//    bitset<ビット数> s(tmp);
//  }

int main(){

    string S;
    cin >> S;

    for (int tmp = 0; tmp < (1 << 3); tmp++) {
    bitset<3> s(tmp);
    
    ll ans = S[0];

        rep(i, 3){
           if(s.test(i)){
                ans += S[i + 1];
            }
            else{
                ans -= S[i + 1];
            }
  　    }
    
        if(ans == 7){
            cout << S[0];

            if(s.test(0){
                cout << "+";
            }
            else{
                cout << "-":
            }

            cout << S[1];

            if(s.test(1){
                cout << "+";
            }
            else{
                cout << "-":
            }

            cout << S[2];
            
            if(s.test(2){
                cout << "+ ";
            }
            else{
                cout << "- ":
            }

            cout << S[3] << "=7" << endl;

            break;
        }
    }
}

Compiler output:
a.cc:32:3: error: extended character 　 is not valid in an identifier
   32 |   　    }
      |   ^
a.cc: In function 'int main()':
a.cc:32:3: error: '\U00003000' was not declared in this scope
   32 |   　    }
      |   ^~
a.cc:37:25: error: expected ';' before '{' token
   37 |             if(s.test(0){
      |                         ^
      |                         ;
a.cc:40:13: error: expected primary-expression before 'else'
   40 |             else{
      |             ^~~~
a.cc:39:14: error: expected ')' before 'else'
   39 |             }
      |              ^
      |              )
   40 |             else{
      |             ~~~~
a.cc:37:15: note: to match this '('
   37 |             if(s.test(0){
      |               ^
a.cc:46:25: error: expected ';' before '{' token
   46 |             if(s.test(1){
      |                         ^
      |                         ;
a.cc:49:13: error: expected primary-expression before 'else'
   49 |             else{
      |             ^~~~
a.cc:48:14: error: expected ')' before 'else'
   48 |             }
      |              ^
      |              )
   49 |             else{
      |             ~~~~
a.cc:46:15: note: to match this '('
   46 |             if(s.test(1){
      |               ^
a.cc:55:25: error: expected ';' before '{' token
   55 |             if(s.test(2){
      |                         ^
      |                         ;
a.cc:58:13: error: expected primary-expression before 'else'
   58 |             else{
      |             ^~~~
a.cc:57:14: error: expected ')' before 'else'
   57 |             }
      |              ^
      |              )
   58 |             else{
      |             ~~~~
a.cc:55:15: note: to match this '('
   55 |             if(s.test(2){
      |               ^
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 );
  return 0; 
}

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

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  string s; cin >> s;
  int a = s[0]-'0', b = s[1]-'0', c = s[2] - '0', d = s[3] -'0';
  rep(i, 8){
    string t = "";
    int u = 0;
    if(i & 1 << 0){
      t += '+';
      t += (char)a+'0';
      u += a;
    }
    else{
      t += '-';
      t += (char)a+'0';
      u -= a;
    }
    if(i & 1 << 1){
      t += '+';
      t += (char)b+'0';
      u += b;
    }
    else{
      t += '-';
      t += (char)b+'0';
      u -= b;
    }
    if(i & 1 << 2){
      t += '+';
      t += (char)c+'0';
      u += c;
    }
    else{
      t += '-';
      t += (char)c+'0';
      u -= c;
    }
    if(i & 1 << 3){
      t += '+';
      t += (char)d+'0';
      u += d;
    }
    else{
      t += '-';
      t += (char)d+'0';
      u -= d;
    }
    if(u == 7) break;
  }
  t += "=7";
  cout << t << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:3: error: 't' was not declared in this scope
   78 |   t += "=7";
      |   ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




int main() {
  string s;cin>>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);
  3242
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:7: error: expected ';' before 'return'
   51 |   3242
      |       ^
      |       ;
   52 |   return 0;
      |   ~~~~~~
Language: C++

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int dy[2] = {1,0};
int dx[2] = {0,1};
int h,w;
vector<string>s(10);


int main(){
    string t;
    cin >> t;
    for(int bit = 0; bit < (1 << 3); bit++){
        vector<int> S= bitSearch(bit, 3);
        int sum = t[0] - '0';
        S.push_back(INF);
        rep(i, 3){
            if(i == *lower_bound( ALL(S), i))sum += t[i+1] - '0';
            else sum += t[i+1] - '0';
        }
        if(sum == 7){
            cout << t[0];
            rep(i, 3){
                if(i == *lower_bound( ALL(S), i))cout << '+';
                else cout << '-';
                cout << t[i+1];
                return 0;
            }
        }
    }
    cout << "=7"
    cout << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:67:17: error: expected ';' before 'cout'
   67 |     cout << "=7"
      |                 ^
      |                 ;
   68 |     cout << endl;
      |     ~~~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:29: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    7 |   if(a+b+c+d==7) cout<<a<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7;
      |                          ~~~^~~
      |                          |    |
      |                          |    int
      |                          const char [2]
a.cc:8:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    8 |   else if(a+b+c-d==7) cout<<a<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:9:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    9 |   else if(a+b-c+d==7) cout<<a<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:12:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   12 |   else if(a-b-c+d==7) cout<<a<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:13:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   13 |   else if(a-b+c-d==7) cout<<a<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:14:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   14 |   else if(a-b-c-d==7) cout<<a<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:29: error: 'c' was not declared in this scope
    6 |   int a=x/1000,b=x/100-a*10;c=x/10-a*100-b*10,d=x%10;
      |                             ^
a.cc:6:47: error: 'd' was not declared in this scope
    6 |   int a=x/1000,b=x/100-a*10;c=x/10-a*100-b*10,d=x%10;
      |                                               ^
a.cc:7:29: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    7 |   if(a+b+c+d==7) cout<<a<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7;
      |                          ~~~^~~
      |                          |    |
      |                          |    int
      |                          const char [2]
a.cc:8:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    8 |   else if(a+b+c-d==7) cout<<a<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:9:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
    9 |   else if(a+b-c+d==7) cout<<a<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:12:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   12 |   else if(a-b-c+d==7) cout<<a<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:13:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   13 |   else if(a-b+c-d==7) cout<<a<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
a.cc:14:34: error: invalid operands of types 'const char [2]' and 'int' to binary 'operator<<'
   14 |   else if(a-b-c-d==7) cout<<a<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7;
      |                               ~~~^~~
      |                               |    |
      |                               |    int
      |                               const char [2]
Language: C++

a,b,c,d = map(int,input())
if a + b + c + d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'='+'7')
elif a + b + c - d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'='+'7')
elif a + b - c - d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'='+'7')
elif a - b - c - d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'='+'7')
elif a  + b - c + d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'='+'7')
elif a - b - c + d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'='+'7')
elif a - b + c + d == 7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'='+'7')
else:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'='+'7')

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a,b,c,d = map(int,input())
      | ^
Language: C++

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

int main(){
  string str;
  cin >> str;
  
  for(int bit = 0; bit <(1<<3) ; bit++){
    int tmp = (int)(str[0] - '0');
    for(int i = 0; i < 3; ++i){
      if(bit&(1<<i)) tmp += (int)(str[i+1] - '0');
      else tmp -= (int)(str[i+1] - '0');
    }
    if(tmp == 7){
      cout << str[0];
      for(int i = 0; i < 3; ++i){
        if(bit & (1<<i)) cout << '+';
        else cout << '-';
        cout <<str[i+1];
      }
      cout << "=7" << endl;
      return;
    }
  }
}

 
  

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