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

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,ans="";
    cin >> s;
    int num=0;
    for(int i=0;i<(1<<s.size()-1);i++){
        num=s[0]-'0';
        ans=s[0];
        for(int j=0;j<3;j++){
            if(i&(1<<j)){
                num=num+(s[j+1]-'0');
                ans=ans+"+"+s[j+1];
            }
            else{
                num=num-(s[k+1]-'0');
                ans=ans+"-"+s[j+1];
            }
        }
        if(num==7){
            
            break;
        }

    }
    cout << ans+"=7" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: 'k' was not declared in this scope
   16 |                 num=num-(s[k+1]-'0');
      |                            ^
Language: C++

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

int main() {
  string s;
  cin >> s;
  
  vector<int> ticket(4);
  rep(i, 4) {
    ticket.at(i) = ctoi(s.at(i));
  }
  
  for (int i = 0; i < (1 << 3); i++) {
    int sum = ticket.at(0);
    rep(j, 3) {
      if (i.test(j))
        sum += ticket.at(j + 1);
      else
        sum -= ticket.at(j + 1);
    }
    
    if (sum == 7) {
      string a = "";
      a.push_back(s.at(0));
      rep(j, 3) {
        if (i.test(j))
          a.push_back("+");
        else
          a.push_back("-");
      }
      
      cout << a << endl;
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: 'ctoi' was not declared in this scope; did you mean 'atoi'?
   11 |     ticket.at(i) = ctoi(s.at(i));
      |                    ^~~~
      |                    atoi
a.cc:17:13: error: request for member 'test' in 'i', which is of non-class type 'int'
   17 |       if (i.test(j))
      |             ^~~~
a.cc:27:15: error: request for member 'test' in 'i', which is of non-class type 'int'
   27 |         if (i.test(j))
      |               ^~~~
a.cc:28:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   28 |           a.push_back("+");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
a.cc:30:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   30 |           a.push_back("-");
      |                       ^~~
      |                       |
      |                       const char*
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

import sys

S = list(input())

N = len(S)-1

#bit全探索
for i in range(2**N):
    op = ["+"]*N
    for j in range(N):
        if (i>>j)&1:
            op[j] = "-"
    ans = ""
    for j in range(N):
        ans = ans + S[j] + op[j]

    ans = ans + S[j+1]

    if eval(ans)==7:
        print(ans+"=7")
        sys.exit()


Compiler output:
a.cc:7:2: error: invalid preprocessing directive #bit\U00005168\U000063a2\U00007d22
    7 | #bit全探索
      |  ^~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main (){
    string s;
    int num[4];

    cin >> s;
        
    long long ans = 0;
    
    for(int i = 0; i < 4; i++){
        num[i] = s[i] - '0';
    }	

    for(int i = 0; i < 1 << 3; i++){
        ans = num[0];
        for(int j = 0; j < 3; j ++){
            char op[3] = {'+', '+', '+'};    
            if(i & (1 << j)){	      
    	        ans -= num[j+1];
		op[j] = '-';		
    	    }
	    else{
	        ans += num[j+1];
	    }

        }
		    cout << ans << endl;
	if(ans == 7){
	  for(int i = 0; i < 4; i++){
	      cout << num[i];
	      if(i != 3) cout << op[i];
	  }
	  cout << "=" << ans << endl;
	  return 0;
	}
	
   }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:34: error: 'op' was not declared in this scope
   34 |               if(i != 3) cout << op[i];
      |                                  ^~
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include<string>
#include<algorithm>
#include<stdio.h>
using ll = long long;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
static const int INFTY = (1<<21);
int nums[4],flag=0;
string str;

void search(int index, ll sum,string fomula){
    if(index ==3 && sum ==7){
        fomula += "=7";
        cout << fomula;
        flag++;
        return;
    }
    if(flag ==0){
    search(index + 1, sum + nums[index+1],fomula + "+" + str[index+1]);
    }
    if(flag ==0){
    search(index + 1, sum - nums[index+1],fomula + "-" + str[index+1]);
    }
}






int main(){
    cin >> str;
    rep(i,4) nums[i]=(int)(str[i]-'0');
    search(0,nums[0],str[0]);
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: warning: ignoring return value of '_ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&) [with _ForwardIterator = int; _Searcher = char]', declared with attribute 'nodiscard' [-Wunused-result]
   36 |     search(0,nums[0],str[0]);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: declared here
 4184 |     search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&) [with _ForwardIterator = int; _Searcher = char]':
a.cc:36:11:   required from here
   36 |     search(0,nums[0],str[0]);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4186:24: error: expression cannot be used as a function
 4186 |     { return __searcher(__first, __last).first; }
      |              ~~~~~~~~~~^~~~~~~~~~~~~~~~~
Language: C++

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

int a[4];
int main(){
 cin >> a[0] >> a[1] >> a[2] >> a[3];
  
 for (int x=0;x<8;x++){
   int sum = a[0];
   string s;
   s+=(char)('0'+a[0]);
   
   for (int i=0;i<3;i++){
     if (x&(1<<i)){
        sum+=a[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: In function 'int main()':
a.cc:26:3: error: expected '}' at end of input
   26 |  }
      |   ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int a[4];
int main(){
 cin >> a[0] >> a[1] >> a[2] >> a[3];
  
 for (int i=0;i<8;i++){
   int sum = a[0];
   string s;
   s+=(char)('0'+a[0]);
   
   for (int i=0;i<3;i++){
     if (x&(1<<i)){
        sum+=a[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: In function 'int main()':
a.cc:14:10: error: 'x' was not declared in this scope
   14 |      if (x&(1<<i)){
      |          ^
a.cc:26:3: error: expected '}' at end of input
   26 |  }
      |   ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
	// sengen
	int a[4];
	// nyuryoku
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	// keisan
	int sum = 0;
	char op[3];
	for(int i=0;i<8;i++){
		sum = a[0];
		for(int j=0;j<3;j++){
			if(i & (1 << j)){
				op[j] = '+';
				sum += a[j+1];
			}else{
				op[j] = '-';
				sum -= a[j+1];
			}
		}
		if(sum == 7){
			break;
		}
	}
	cout << a[0];
	for(int i=0;i<3;i++){
		cout << op[i] << a[j+1];
	}
	cout << '=' << '7';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:36: error: 'j' was not declared in this scope
   30 |                 cout << op[i] << a[j+1];
      |                                    ^
Language: C++

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

void judge(int i, int sum, string &list) {
  vector<char> ope(3);
  
  if (i == 3) {
    if (sum + ctoi(list.at(i)) == 7) {
      ope.at(i - 1) = '+';
      cout << list.at(0) << ope.at(0) << list.at(1)
         << ope.at(1) << list.at(2) << ope.at(2) << list.at(3)
         << "=7" << endl;
      return;
    }
    else if (sum - ctoi(list.at(i)) == 7) {
      cout << list.at(0) << ope.at(0) << list.at(1)
         << ope.at(1) << list.at(2) << ope.at(2) << list.at(3)
         << "=7" << endl;
      return;
    }
    else
      return;
  }
}
  
  
  int y = sum + ctoi(list.at(i));
  ope.at(i - 1) = '+';
  judge(i + 1, y, list);
  
  y = sum - ctoi(list.at(i));
  ope.at(i - 1) = '-';
  judge(i + 1, y, list);
}

int main() {
  string list;
  cin >> list;
  
  judge(1, list.at(0), list);
}

Compiler output:
a.cc: In function 'void judge(int, int, std::string&)':
a.cc:9:15: error: 'ctoi' was not declared in this scope; did you mean 'atoi'?
    9 |     if (sum + ctoi(list.at(i)) == 7) {
      |               ^~~~
      |               atoi
a.cc: At global scope:
a.cc:28:11: error: 'sum' was not declared in this scope
   28 |   int y = sum + ctoi(list.at(i));
      |           ^~~
a.cc:28:26: error: missing template arguments before '.' token
   28 |   int y = sum + ctoi(list.at(i));
      |                          ^
a.cc:28:30: error: 'i' was not declared in this scope
   28 |   int y = sum + ctoi(list.at(i));
      |                              ^
a.cc:28:17: error: 'ctoi' was not declared in this scope; did you mean 'atoi'?
   28 |   int y = sum + ctoi(list.at(i));
      |                 ^~~~
      |                 atoi
a.cc:29:3: error: 'ope' does not name a type
   29 |   ope.at(i - 1) = '+';
      |   ^~~
a.cc:30:8: error: expected constructor, destructor, or type conversion before '(' token
   30 |   judge(i + 1, y, list);
      |        ^
a.cc:32:3: error: 'y' does not name a type
   32 |   y = sum - ctoi(list.at(i));
      |   ^
a.cc:33:3: error: 'ope' does not name a type
   33 |   ope.at(i - 1) = '-';
      |   ^~~
a.cc:34:8: error: expected constructor, destructor, or type conversion before '(' token
   34 |   judge(i + 1, y, list);
      |        ^
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected ';' before 'ans'
   19 |   else(a-b-c-d==7) ans=s[0]+'-'+s[1]+'-'+s[2]+'-'+s[3]+"=7";
      |                   ^~~~
      |                   ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<int> num(4);
void a(int x){
    for(int i=0; i<4; i++){
        num[3-i]=x%10;
        x/=10;
    }
}

int main(){
    int n;
    cin >> n;
    a(n);
    if(num[0]+num[1]+num[2]+num[3]==7)cout <<num[0]<<'+'<<num[1]<<'+'<<num[2]<<'+'<<num[3]<<"=7" << endl;
    else if(num[0]+num[1]+num[2]-num[3]==7)cout <<num[0]<<'+'<<num[1]<<'+'<<num[2]<<'-'<<num[3]<<"=7" << endl;
    else if(num[0]+num[1]-num[2]+num[3]==7)cout <<num[0]<<'+'<<num[1]<<'-'<<num[2]<<'+'<<num[3]<<"=7" << endl;
    else if(num[0]-num[1]+num[2]+num[3]==7)cout <<num[0]<<'-'<<num[1]<<'+'<<num[2]<<'+'<<num[3]<<"=7" << endl;
    else if(num[0]+num[1]-num[2]-num[3]==7)cout <<num[0]<<'+'<<num[1]<<'-'<<num[2]<<'-'<<num[3]<<"=7" << endl;
    else if(num[0]-num[1]-num[2]+num[3]==7)cout <<num[0]<<'-'<<num[1]<<'-'<<num[2]<<'+'<<num[3]<<"=7" << endl;
    else if(num[0]-num[1]+num[2]-num[3]==7)cout <<num[0]<<'-'<<num[1]<<'+'<<num[2]<<'-'<<num[3]<<"=7" << endl;
    else(num[0]-num[1]-num[2]-num[3]==7)cout <<num[0]<<'-'<<num[1]<<'-'<<num[2]<<'-'<<num[3]<<"=7" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:41: error: expected ';' before 'cout'
   23 |     else(num[0]-num[1]-num[2]-num[3]==7)cout <<num[0]<<'-'<<num[1]<<'-'<<num[2]<<'-'<<num[3]<<"=7" << endl;
      |                                         ^~~~
      |                                         ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
// define #Asukaminato ha kawaii
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
const int inf = 1000000000; // 10^9 Ten to the power of nine.

int op[3];
 
bool dfs(int i, int res) {
  if (i == 3) {
    if (res == 7) return true;
    else return false;
  }
 
  if (dfs(i + 1, res + s[i + 1] - '0')) {
    op[i] = 1;
  } else if (dfs(i + 1, res - (s[i + 1] - '0'))) {
    op[i] = 0;
  }
}
 
void Main() {
  cin >> s;
 
  dfs(0, s[0] - '0');
  for (int i = 0; i < 3; i++) {
    cout << s[i];
    if (op[i]) cout << "+";
    else cout << "-";
  }
  cout << s[3] << "=7" << endl;
}

Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:16:24: error: 's' was not declared in this scope
   16 |   if (dfs(i + 1, res + s[i + 1] - '0')) {
      |                        ^
a.cc: In function 'void Main()':
a.cc:24:10: error: 's' was not declared in this scope
   24 |   cin >> s;
      |          ^
a.cc: In function 'bool dfs(int, int)':
a.cc:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    int a,b,c,d;
    d=n%10;
    n=n/10;
    c=n%10;
    n=n/10;
    b=n%10;
    n=n/10;
    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 cout << a-b-c-d=7 <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:38: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |     if(a+b+c+d==7) cout << a+b+c+d=7 <<endl;
      |                                    ~~^~~~~~
a.cc:16:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |     else if(a-b+c+d==7) cout << a-b+c+d=7 <<endl;
      |                                         ~~^~~~~~
a.cc:17:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   17 |     else if(a+b-c+d==7) 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 |     else if(a+b+c-d==7) cout << a+b+c-d=7 <<endl;
      |                                         ~~^~~~~~
a.cc:19:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   19 |     else if(a-b-c+d==7) cout << a-b-c+d=7 <<endl;
      |                                         ~~^~~~~~
a.cc:20:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   20 |     else if(a-b+c-d==7) 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 |     else if(a+b-c-d==7) cout << a+b-c-d=7 <<endl;
      |                                         ~~^~~~~~
a.cc:22:28: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   22 |     else 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;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    vector<int> v(4);
    for(int i=0;i<4;i++){
        v[i]=s[i]-'0';
    }
    for(int j=0;j<(1<<3);j++){
        int tmp=v[0];
        for(int k=0;k<3;k++){
            if(j&(1<<k)) tmp-=v[k+1];
            else tmp+=v[k+1];
            if(tmp==7){
            for(int k=0;k<3;k++){
                if(j&(1<<k)) cout << '-';
                else cout << '+';
                cout << v[k+1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:22:11: note: to match this '{'
   22 | int main(){
      |           ^
Language: C++

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s;cin >> s;
	int ans;
	for(int i = 0; i < (1<<s.size()-1); i++){
		int sum = stoi(s.substr(0,1));
		for(int j = 0; j < s.size()-1; j++){
			if(i&(1<<j)){
				sum -= stoi(s.substr(j+1,1));
			}else{
				sum += stoi(s.substr(j+1,1));
			}
		}
		if(sum == 7){
			ans = i;
		}
	}

	string out = "";
	for(int i = 0; i < 3; i++){
		out += s.substr(i,1);
		if(ans&(1<<i)){
			out += "-";
		}else{
			out += "+";
		}
	}
	out += s.substr(3,1)+"=7";
	cout << out << endl;
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin.tie(0);
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | //#include<bits/stdc++.h>
a.cc:6:9: error: 'ios' has not been declared
    6 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:8:9: error: 'string' was not declared in this scope
    8 |         string s;cin >> s;
      |         ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | //#include<bits/stdc++.h>
a.cc:8:25: error: 's' was not declared in this scope
    8 |         string s;cin >> s;
      |                         ^
a.cc:11:27: error: 'stoi' was not declared in this scope
   11 |                 int sum = stoi(s.substr(0,1));
      |                           ^~~~
a.cc:11:27: note: 'std::stoi' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:24:15: error: expected ';' before 'out'
   24 |         string out = "";
      |               ^~~~
      |               ;
a.cc:26:17: error: 'out' was not declared in this scope
   26 |                 out += s.substr(i,1);
      |                 ^~~
a.cc:33:9: error: 'out' was not declared in this scope
   33 |         out += s.substr(3,1)+"=7";
      |         ^~~
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << out << endl;
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:24: error: 'endl' was not declared in this scope
   34 |         cout << out << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | //#include<bits/stdc++.h>
Language: C++

#include <bits/stdc++.h>
using namespace std;
char s[5]; 
int main() {
  int A, B, C, D;
  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); return 0;
  if(A+B+C-D==7) printf("%d+%d+%d-%d=7\n",A,B,C,D); return 0;
  if(A+B-C+D==7) printf("%d+%d-%d+%d=7\n",A,B,C,D); return 0;
  if(A+B-C-D==7) printf("%d+%d-%d-%d=7\n",A,B,C,D); return 0;
  if(A-B+C+D==7) printf("%d-%d+%d+%d=7\n",A,B,C,D); return 0;
  if(A-B+C-D==7) printf("%d-%d+%d-%d=7\n",A,B,C,D); return 0;
  if(A-B-C+D==7) printf("%d-%d-%d+%d=7\n",A,B,C,D); return 0;
  if(A-B-C-D==7) printf("%d-%d-%d-%d=7\n",A,B,C,D); return 0;
}

Compiler output:
a.cc:7:19: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                   ^
a.cc:7:22: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                      ^
a.cc:7:38: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                      ^
a.cc:7:41: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                         ^
a.cc:7:57: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                                         ^
a.cc:7:60: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                                            ^
a.cc:7:76: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                                                            ^
a.cc:7:79: error: extended character ’ is not valid in an identifier
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                                                                               ^
a.cc: In function 'int main()':
a.cc:7:7: error: redeclaration of 'int A'
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |       ^
a.cc:5:7: note: 'int A' previously declared here
    5 |   int A, B, C, D;
      |       ^
a.cc:7:19: error: '\U000020190' was not declared in this scope
    7 |   int A = s [0] - ’0 ’ , B = s [1] - ’0 ’ , C = s [2] - ’0 ’ , D = s [3] - ’0 ’;
      |                   ^~
Language: C++

#include<iostream>
using namespace std;
int main () {
  int A[4];
  for (int i = 0; i < 4; i ++) cin >> A[i];
  for (int i = 0; i < 8; i ++) {
    int j = i;
    char op[3];
    int ans = A[0];
    for (int k = 0; k < 3; k ++) {
      if (j % 2) {
        op[k] = '+';
        ans += A[k + 1];
      }
      else {
        op[k] = '-';
        ans -= A[k + 1];
      }
      j /= 2
    }
    if (ans == 7) {
      for (int i = 0; i < 3; i ++) {
        cout << A[i] << op[i];
      }
      cout << A[3] << "=7" << endl;
      return 0;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: expected ';' before '}' token
   19 |       j /= 2
      |             ^
      |             ;
   20 |     }
      |     ~
Language: C++

#include<iostream>
using namespace std;
int main () {
  int A[4];
  for (int i = 0; i < 4; i ++) cin >> A[i];
  for (int i = 0; i < 8; i ++) {
    int j = i;
    char op[3];
    ans = A[0];
    for (int k = 0; k < 3; k ++) {
      if (j % 2) {
        op[k] = '+';
        ans += A[k + 1];
      }
      else {
        op[k] = '-';
        ans -= A[k + 1];
      }
    }
    if (ans == 7) {
      for (int i = 0; i < 3; i ++) {
        cout << A[i] << op[i];
      }
      cout << A[3] << "=7" << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     ans = A[0];
      |     ^~~
      |     abs
Language: C++

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

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

int main()
{
    string s;
    cin >> s;
    vector<int> v(4);
    rep(i, s.length()){
        v.at(i) = s[i] - '0';
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: 'k' was not declared in this scope
   22 |                 tmp -= v[k + 1];
      |                          ^
Language: C

#include<stdio.h>
int main()
{
	int a,b,c,d,n,h=7;
	char op,os,ot;
	op='+';
	os='=';
	ot="-";
	scanf("%d",&n);
	a=n%10;
	b=(n/10)%10;
	c=(n/100)%10;
	d=n/1000;

	if(a+b+c+d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,op,c,op,b,op,a,os,h);
	}
	if(a-b+c-d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,ot,c,op,b,ot,a,os,h);
	}
	if(a+b+c-d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,op,c,op,b,ot,a,os,h);
	}
	if(a+b-c+d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,op,c,ot,b,op,a,os,h);
	}
	if(a+b-c-d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,op,c,ot,b,ot,a,os,h);
	}
	if(a-b-c-d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,ot,c,ot,b,ot,a,os,h);
	}
	if(a-b-c+d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,ot,c,ot,b,op,a,os,h);
	}
	if(a-b+c+d==7)
	{
		printf("%d%c%d%c%d%c%d%c%d",d,ot,c,op,b,op,a,os,h);
	}
	
	return 0;

Compiler output:
main.c: In function 'main':
main.c:8:11: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    8 |         ot="-";
      |           ^
main.c:48:9: error: expected declaration or statement at end of input
   48 |         return 0;
      |         ^~~~~~
Language: C++

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

int main(){
  int N[4];
  string array[6];
  bool ans=false;
  
  for(int i=0;i<4;i++){
    cin >> N[i];
  }
  
  for(int i=0;i<4;i++){
    array[2*i]=N[i];
  }
  
  for(int bit=0;bit<(1<<3);bit++){
    bitset<3> s(bit)
      int sum=N[3];
    for(int i=0;i<4;i++){
      if(s.test(i){
        if(i != 3){
          sum += N[2-i];
          array[5-(2*i)]='+';
        }
      } else {
        if(i != 3){
          sum -= N[2-i];
          array[5-(2*i)]='+';
        }
      }
         }
         
         if(sum==7){
           ans=true;
         }
         
         if(ans) break;
         
         cout << array << endl;
         
         return 0;
         }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: expected ',' or ';' before 'int'
   20 |       int sum=N[3];
      |       ^~~
a.cc:22:19: error: expected ')' before '{' token
   22 |       if(s.test(i){
      |         ~         ^
      |                   )
a.cc:33:10: error: expected primary-expression before '}' token
   33 |          }
      |          ^
a.cc:35:13: error: 'sum' was not declared in this scope
   35 |          if(sum==7){
      |             ^~~
a.cc:44:11: error: expected '}' at end of input
   44 |          }
      |           ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

    vector <int> din(4);
    string input;
    cin >> input;

    rep(i,4) din.at(i) = input.at(i) - '0';

    int re = 0;

    // 0~8のループ
    rep(x,8){
        int sum = 0;
        string out;
        out += (char)('0' + din.at(0));
        sum += din.at(0);
        for(int i = 0; i < 3 ; i++){

            if(x & (1<<i)){
                sum += din.at(i+1);
                out += '+';
              	out += (char)('0' + din.at(i+1));
            }else{
                sum -= din.at(i+1);
                out += '-';
                out += (char)('0' + din.at(i+1));
            }
        }

        if(sum == 7){
          	out += '=7'
            cout << out << endl;
            return 0;
        }
    }
}



Compiler output:
a.cc:35:24: warning: multi-character character constant [-Wmultichar]
   35 |                 out += '=7'
      |                        ^~~~
a.cc: In function 'int main()':
a.cc:35:24: warning: overflow in conversion from 'int' to 'char' changes value from '15671' to '55' [-Woverflow]
a.cc:35:28: error: expected ';' before 'cout'
   35 |                 out += '=7'
      |                            ^
      |                            ;
   36 |             cout << out << endl;
      |             ~~~~
Language: C++

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

int main() {
  string s, a;
  int ans=0;
  cin >> s;
  for(int bit=0; bit<(1<<3); ++bit) {
    if(bit&(1<<0)){
      ans=(s[0]-'0')+(s[1]-'0');
    }else{
      ans=(s[0]-'0')-(s[1]-'0');
    }
    if(bit&(1<<1)){
      ans= ans+(s[2]-'0');
    }else{
      ans= ans-(s[2]-'0');
    }
    if(bit&(1<<2)){
      ans= ans+(s[3]-'0');
    }else{
      ans= ans-(s[3]-'0');
    }
    if(ans==7) {
      if(bit&(1<<0)){
        a= s[0]+"+"+s[1];
      }else{
        a= s[0]+"-"+s[1];
      }
      if(bit&(1<<1)){
        a= a+s[2]+"+";
      }else{
        a= a+s[2]+"-";
      }
      if(bit&(1<<2)){
        a= a+"+"+s[3];
      }else(
        a= a+"+"+s[3];
      }
      cout <<a+"=7";
      break;
        }
        }
        }


Compiler output:
a.cc: In function 'int main()':
a.cc:39:22: error: expected ')' before ';' token
   39 |         a= a+"+"+s[3];
      |                      ^
      |                      )
a.cc:38:12: note: to match this '('
   38 |       }else(
      |            ^
a.cc: At global scope:
a.cc:45:9: error: expected declaration before '}' token
   45 |         }
      |         ^
Language: C++

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

int main() {
  string s, a;
  int ans=0;
  cin >> s;
  for(int bit=0; bit<(1<<3); ++bit) {
    if(bit&(1<<0)){
      ans=(s[0]-'0')+(s[1]-'0');
    }else{
      ans=(s[0]-'0')-(s[1]-'0');
    }
    if(bit&(1<<1)){
      ans= ans+(s[2]-'0');
    }else{
      ans= ans-(s[2]-'0');
    }
    if(bit&(1<<2)){
      ans= ans+(s[3]-'0');
    }else(
      ans= ans-(s[3]-'0');
    }
    if(ans==7) {
      if(bit&(1<<0)){
        a= s[0]+"+"+s[1];
      }else{
        a= s[0]+"-"+s[1];
      }
      if(bit&(1<<1)){
        a= a+s[2]+"+";
      }else{
        a= a+s[2]+"-";
      }
      if(bit&(1<<2)){
        a= a+"+"+s[3];
      }else(
        a= a+"+"+s[3];
      }
      cout <<a+"=7";
      break;
        }
        }
        }


Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: expected ')' before ';' token
   23 |       ans= ans-(s[3]-'0');
      |                          ^
      |                          )
a.cc:22:10: note: to match this '('
   22 |     }else(
      |          ^
a.cc:26:10: error: 'bit' was not declared in this scope
   26 |       if(bit&(1<<0)){
      |          ^~~
a.cc:31:10: error: 'bit' was not declared in this scope
   31 |       if(bit&(1<<1)){
      |          ^~~
a.cc:36:10: error: 'bit' was not declared in this scope
   36 |       if(bit&(1<<2)){
      |          ^~~
a.cc:39:22: error: expected ')' before ';' token
   39 |         a= a+"+"+s[3];
      |                      ^
      |                      )
a.cc:38:12: note: to match this '('
   38 |       }else(
      |            ^
a.cc:42:7: error: break statement not within loop or switch
   42 |       break;
      |       ^~~~~
a.cc: At global scope:
a.cc:44:9: error: expected declaration before '}' token
   44 |         }
      |         ^
a.cc:45:9: error: expected declaration before '}' token
   45 |         }
      |         ^
Language: C++

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

int main() {
  string s, a;
  int ans=0;
  cin >> s;
  for(int bit=0; bit<(1<<3); ++bit) {
    if(bit&(1<<0){
      ans=(s[0]-'0')+(s[1]-'0');
    }else{
      ans=(s[0]-'0')-(s[1]-'0');
    }
    if(bit&(1<<1){
      ans= ans+(s[2]-'0');
    }else{
      ans= ans-(s[2]-'0');
    }
    if(bit&(1<<2){
      ans= ans+(s[3]-'0');
    }else(
      ans= ans-(s[3]-'0');
    }
    if(ans==7) {
      if(bit&(1<<0){
        a= s[0]+"+"+s[1];
      }else{
        a= s[0]+"-"+s[1];
      }
      if(bit&(1<<1){
        a= a+s[2]+"+";
      }else{
        a= a+s[2]+"-";
      }
      if(bit&(1<<2){
        a= a+"+"+s[3];
      }else(
        a= a+"+"+s[3];
      }
      cout <<a+"=7";
      break;
        }
        }
        }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: expected ')' before '{' token
   10 |     if(bit&(1<<0){
      |       ~          ^
      |                  )
a.cc:26:10: error: 'bit' was not declared in this scope
   26 |       if(bit&(1<<0){
      |          ^~~
a.cc:26:20: error: expected ')' before '{' token
   26 |       if(bit&(1<<0){
      |         ~          ^
      |                    )
a.cc:42:7: error: break statement not within loop or switch
   42 |       break;
      |       ^~~~~
a.cc: At global scope:
a.cc:44:9: error: expected declaration before '}' token
   44 |         }
      |         ^
a.cc:45:9: error: expected declaration before '}' token
   45 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
 
int N;
cin>>N;
string u=to_string(N);
v=(unsigned char)u.at(i)
vector<int>A(4);
for(int i=0;i<4;i++){
  A.push_back(v);
}
int sum=0;
vector<char>t(4);
for(int tmp=0;tmp<(1<<5);tmp++){
  bitset<4>s(tmp);
  for(int i=0;i<4;i++){
    if(s.test(i)){//trueの時+
     sum +=A.at(i);
     t.push_back('+');
     }else{
       sum-=A.at(i);
       t.push_back('-');
    }
  }
  if(sum==7){cout<<A.at(0)<<t.at(0)<<A.at(1)<<t.at(1)<<A.at(2)<<t.at(2)<<A.at(3)<<'='<<7<<endl;};
  return 0;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'v' was not declared in this scope
    8 | v=(unsigned char)u.at(i)
      | ^
a.cc:8:23: error: 'i' was not declared in this scope
    8 | v=(unsigned char)u.at(i)
      |                       ^
a.cc:11:3: error: 'A' was not declared in this scope
   11 |   A.push_back(v);
      |   ^
a.cc:19:12: error: 'A' was not declared in this scope
   19 |      sum +=A.at(i);
      |            ^
a.cc:22:13: error: 'A' was not declared in this scope
   22 |        sum-=A.at(i);
      |             ^
a.cc:26:20: error: 'A' was not declared in this scope
   26 |   if(sum==7){cout<<A.at(0)<<t.at(0)<<A.at(1)<<t.at(1)<<A.at(2)<<t.at(2)<<A.at(3)<<'='<<7<<endl;};
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
vector<char>B(4);
for(int i=0;i<4;i++){
  cin>>A.at(i);
}
vector<int>A(4);
  for(int i=0;i<4;i++){
    B.push_back(stoi(A.at(i)));
  }
int sum=0;
vector<char>t;
for(int tmp=0;tmp<(1<<5);tmp++){
  bitset<4>s(tmp);
  for(int i=0;i<4;i++){
    if(s.test(i)){//trueの時+
     sum +=A.at(i);
     t.push_back('+');
     }else{
       sum-=A.at(i);
       t.push_back('-');
    }
  }
  if(sum==7){cout<<A.at(0)<<t.at(0)<<A.at(1)<<t.at(1)<<A.at(2)<<t.at(2)<<A.at(3)<<'='<<7<<endl;};
  return 0;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'A' was not declared in this scope
    6 |   cin>>A.at(i);
      |        ^
a.cc:10:21: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   10 |     B.push_back(stoi(A.at(i)));
      |                 ~~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int>A(N);
for(int i=0;i<4;i++){
  cin>>A.at(i);
}
int sum=0;
vector<char>s;
for(int tmp=0;tmp<(1<<5);tmp++){
  bitset<4>s(tmp);
  for(int i=0;i<4;i++){
    if(s.test(i)){//trueの時+
     sum +=A.at(i);
     s.push_back('+');
     }else{
       sum-=A.at(i);
       s.push_back('-');
    }
  }
  if(sum==7){cout<<A.at(0)<<s.at(0)<<A.at(1)<<s.at(1)<<A.at(2)<<s.at(2)<<A.at(3)<<'='<<7};
  return 0;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: 'N' was not declared in this scope
    4 | vector<int>A(N);
      |              ^
a.cc:15:8: error: 'class std::bitset<4>' has no member named 'push_back'
   15 |      s.push_back('+');
      |        ^~~~~~~~~
a.cc:18:10: error: 'class std::bitset<4>' has no member named 'push_back'
   18 |        s.push_back('-');
      |          ^~~~~~~~~
a.cc:21:31: error: 'class std::bitset<4>' has no member named 'at'
   21 |   if(sum==7){cout<<A.at(0)<<s.at(0)<<A.at(1)<<s.at(1)<<A.at(2)<<s.at(2)<<A.at(3)<<'='<<7};
      |                               ^~
a.cc:21:49: error: 'class std::bitset<4>' has no member named 'at'
   21 |   if(sum==7){cout<<A.at(0)<<s.at(0)<<A.at(1)<<s.at(1)<<A.at(2)<<s.at(2)<<A.at(3)<<'='<<7};
      |                                                 ^~
a.cc:21:67: error: 'class std::bitset<4>' has no member named 'at'
   21 |   if(sum==7){cout<<A.at(0)<<s.at(0)<<A.at(1)<<s.at(1)<<A.at(2)<<s.at(2)<<A.at(3)<<'='<<7};
      |                                                                   ^~
Language: C++

#include <bits/stdc++.h>
using namespace std
using ll = long long;
int main() {
  char A,B,C,D;
  cin >> A >> B >> C >> D;
  int inA = A - '0';
  int inB = B - '0';
  int inC = C - '0';
  int inD = D - '0';
  if (inA + inB + inC + inD == 7) cout << A << '+' << B << '+' << C << '+' << D << endl;
  else if (inA + inB + inC - inD == 7) cout << A << '+' << B << '+' << C << '-' << D << endl;
  else if (inA + inB - inC - inD == 7) cout << A << '+' << B << '-' << C << '-' << D << endl;
  else if (inA - inB - inC - inD == 7) cout << A << '-' << B << '-' << C << '-' << D << endl;
  else if (inA - inB + inC - inD == 7) cout << A << '-' << B << '+' << C << '-' << D << endl;
  else if (inA + inB - inC + inD == 7) cout << A << '+' << B << '-' << C << '+' << D << endl;
  else if (inA - inB + inC + inD == 7) cout << A << '-' << B << '+' << C << '+' << D << endl;
  else if (inA - inB - inC + inD == 7) cout << A << '-' << B << '-' << C << '+' << D << endl;
  return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'using'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | using ll = long long;
      | ~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'string' was not declared in this scope
    2 |     string a;
      |     ^~~~~~
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>a;
      |     ^~~
a.cc:3:10: error: 'a' was not declared in this scope
    3 |     cin>>a;
      |          ^
a.cc:4:9: error: 'll' was not declared in this scope
    4 |     for(ll bit = 0; bit<(1<<3); bit++){
      |         ^~
a.cc:4:21: error: 'bit' was not declared in this scope
    4 |     for(ll bit = 0; bit<(1<<3); bit++){
      |                     ^~~
a.cc:5:11: error: expected ';' before 'sum'
    5 |         ll sum = a[0];
      |           ^~~~
      |           ;
a.cc:6:15: error: expected ';' before 's'
    6 |         string s;
      |               ^~
      |               ;
a.cc:7:9: error: 's' was not declared in this scope
    7 |         s += (char)('0'+a[0]);
      |         ^
a.cc:8:15: error: expected ';' before 'i'
    8 |         for(ll i = 0; i<3; i++){
      |               ^~
      |               ;
a.cc:8:23: error: 'i' was not declared in this scope
    8 |         for(ll i = 0; i<3; i++){
      |                       ^
a.cc:10:17: error: 'sum' was not declared in this scope
   10 |                 sum += a[i+1];
      |                 ^~~
a.cc:14:17: error: 'sum' was not declared in this scope
   14 |                 sum -= a[i];
      |                 ^~~
a.cc:19:12: error: 'sum' was not declared in this scope
   19 |         if(sum == 7){
      |            ^~~
a.cc:20:13: error: 'cout' was not declared in this scope
   20 |             cout<<s<<"=7"<<endl;
      |             ^~~~
a.cc:20:28: error: 'endl' was not declared in this scope
   20 |             cout<<s<<"=7"<<endl;
      |                            ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
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){
    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){
    c 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:6: error: expected ';' before 'cout'
   15 |     c cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
      |      ^~~~~
      |      ;
Language: C++

#include<iostream>
#include<string>
using namespace std;
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){
    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:20:16: error: lvalue required as left operand of assignment
   20 |   else if(a+b-c-d=7){
      |           ~~~~~^~
a.cc:23:16: error: lvalue required as left operand of assignment
   23 |   else if(a+b+c-d=7){
      |           ~~~~~^~
Language: C++

#include<iostream>
#include<string>
using namespace std;
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){
    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:8:11: error: lvalue required as left operand of assignment
    8 |   if(a-b-c-d=7){
      |      ~~~~~^~
a.cc:11:16: error: lvalue required as left operand of assignment
   11 |   else if(a-b-c+d=7){
      |           ~~~~~^~
a.cc:14:16: error: lvalue required as left operand of assignment
   14 |   else if(a-b+c-d=7){
      |           ~~~~~^~
a.cc:17:16: error: lvalue required as left operand of assignment
   17 |   else if(a-b+c+d=7){
      |           ~~~~~^~
a.cc:20:16: error: lvalue required as left operand of assignment
   20 |   else if(a+b-c-d=7){
      |           ~~~~~^~
a.cc:23:16: error: lvalue required as left operand of assignment
   23 |   else if(a+b+c-d=7){
      |           ~~~~~^~
a.cc:26:16: error: lvalue required as left operand of assignment
   26 |   else if(a+b-c+d=7){
      |           ~~~~~^~
a.cc:29:16: error: lvalue required as left operand of assignment
   29 |   else if(a+b+c+d=7){
      |           ~~~~~^~
Language: C++

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

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

    int a = s[0]-'0';
    int b = s[1]-'0';
    int c = s[2]-'0';
    int d = s[3]-'0';

    int g[3] = { b,c,d };

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

        int sum=a;
        string siki="";
        siki.push_back(s[0]);

        for(int i=0;i<3;i++){
            if(t.test(i)){
                sum += g[i];
                siki.push_back('+');
                siki.push_back('0'+g[i]);
            }else{
                sum -= g[i];
                siki.push_back('-');
                siki.push_back('0'+g[i]);
            }
        }
        if(sum==7){
            siki.append("=7");
            cout << siki << endl;
            return 0;
        }

    } 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'bitset' was not declared in this scope
   20 |         bitset<3> t(tmp);
      |         ^~~~~~
a.cc:6:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    5 | #include<cmath>
  +++ |+#include <bitset>
    6 | using namespace std;
a.cc:20:19: error: 't' was not declared in this scope
   20 |         bitset<3> t(tmp);
      |                   ^