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

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

int main() {
	string s;
	cin >> s;
	vector<int> a(4);
	rep(i,4) a[i] = s[i]-'0';

	for(int bit = 0; bit<(1<<3); bit++){
		string t = to_string(a[0]);
		int sum = a[0];
		for(int i = 0; i<3; i++){
			if(bit&(1<<i)){
				sum+=a[i+1];
				t+=("+" + to_string(a[i+1]));
			}else{
				sum-=a[i+1];
				t+=("-" + to_string(a[i+1]));
			}
		}

		if(sum == 7){
			cout << t << "=7" <<endl;
			return 0;
		}
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string s;
      |         ^~~~~~
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> s;
      |         ^~~
a.cc:6:16: error: 's' was not declared in this scope
    6 |         cin >> s;
      |                ^
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> a(4);
      |         ^~~~~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> a(4);
      |                ^~~
a.cc:8:18: error: 'a' was not declared in this scope
    8 |         rep(i,4) a[i] = s[i]-'0';
      |                  ^
a.cc:11:23: error: expected ';' before 't'
   11 |                 string t = to_string(a[0]);
      |                       ^~
      |                       ;
a.cc:12:27: error: 'a' was not declared in this scope
   12 |                 int sum = a[0];
      |                           ^
a.cc:16:33: error: 't' was not declared in this scope
   16 |                                 t+=("+" + to_string(a[i+1]));
      |                                 ^
a.cc:16:43: error: 'to_string' was not declared in this scope
   16 |                                 t+=("+" + to_string(a[i+1]));
      |                                           ^~~~~~~~~
a.cc:19:33: error: 't' was not declared in this scope
   19 |                                 t+=("-" + to_string(a[i+1]));
      |                                 ^
a.cc:19:43: error: 'to_string' was not declared in this scope
   19 |                                 t+=("-" + to_string(a[i+1]));
      |                                           ^~~~~~~~~
a.cc:24:25: error: 'cout' was not declared in this scope
   24 |                         cout << t << "=7" <<endl;
      |                         ^~~~
a.cc:24:33: error: 't' was not declared in this scope
   24 |                         cout << t << "=7" <<endl;
      |                                 ^
a.cc:24:45: error: 'endl' was not declared in this scope
   24 |                         cout << t << "=7" <<endl;
      |                                             ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  string a;
  cin >> a;
  
  for(int s= 0; s < 8; s++;) {
    int total = stoi(a[0]);
    string totalText = a[0];
    for(int i = 0; i < 3; i++;){
        if((s >> i) & 1) {
          total += stoi(a[i+1]);
          totalText += "+" + a[i+1];
        } else {
          total -= stoi(a[i+1]);
          totalText += "-" + a[i+1];
        }
    }
    if (total == 7) {
      cout >> totalText >> endl;
    }
  }
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:27: error: expected ')' before ';' token
    9 |   for(int s= 0; s < 8; s++;) {
      |      ~                    ^
      |                           )
a.cc:9:28: error: expected primary-expression before ')' token
    9 |   for(int s= 0; s < 8; s++;) {
      |                            ^
Language: C++

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

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


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

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <sstream>
using namespace std;



int main() {
	int z;
	cin >> z;

	int a;
	int b;
	int c;
	int d;

	d = z % 10;
	z -= d;
	c = z % 100;
	z -= c * 10;
	b = z % 1000;
	a = z - b * 100;

	int eq;
	char o1, o2, o3;
	for (int bit = 0; bit < (1 << 3); bit++) {
		if (bit & (1 << 0)) {
			eq = a + b;
			o1 = '+';
		}
		else {
			eq = a - b;
			o1 = '-';
		}
		if (bit & (1 << 1)) {
			eq = eq + c;
			o21 = '+';
		}
		else {
			eq = eq - c;
			o2 = '-';
		}
		if (bit & (1 << 2)) {
			eq = eq + d;
			o3 = '+';
		}
		else {
			eq = eq - d;
			o3 = '-';
		}
		if (eq == 7) {
			cout << a << o1 << b << o2 << c << o3 << d << endl;
			return 0;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:25: error: 'o21' was not declared in this scope; did you mean 'o2'?
   40 |                         o21 = '+';
      |                         ^~~
      |                         o2
Language: C++

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

int main(){
    string s;
    cin >> s;
    int a = s.at(0) - '0', b = s.at(1) - '0', c = s.at(2) - '0', d = s.at(3) - '0';
    for(int i = 0; i < 8;i++){
        bitset<3> s(i);
        vector<char> fugou(3); 
        int temp = a;
        if(s.test(0)) temp += b, fugou[0] = '+';
        else temp -= b, fugou[0] = '-';
        if(s.test(1)) temp += c, fugou[1] = '+';
        else temp -= c,  fugou[1] = '-';
        if(s.test(2)) temp += d, fugou[2] = '+';
        else temp -= d,  fugou[2] = '-';
        if(temp == 7){
            cout << a << fugou[0] << b << fugou[1] << c << fugou[2] << d << "=7" endl;
            break;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:81: error: expected ';' before 'endl'
   20 |             cout << a << fugou[0] << b << fugou[1] << c << fugou[2] << d << "=7" endl;
      |                                                                                 ^~~~~
      |                                                                                 ;
Language: C++

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

int main(){
  int t;
  cin >> t;
  
  vector<int> vec(4);
  vec.at(3) = t / 1000;
  vec.at(2) = (t - a*1000) / 100;
  vec.at(1) = (t - a*1000 - b*100) / 10;
  vec.at(0) = t - a*1000 - b*100 - c*10;
  
  vector<char> op(3);
  
  for(int i=0; i<(1 << 3); i++){
    int sum = vec.at(3);
    bitset<3> o(i);
    for(int j=2; j>=0; j--){
      if(o.test(j)){
        sum += vec.at(j);
        op.at(j) = '+';
      }else{
        sum -= vec.at(j);
        op.at(j) = '-';
      }
    }
    if(sum == 7){
      cout << vec.at(3);
      for(int k=2; k>=0; k--){
        cout << op.at(k) << vec.at(k);
      }
      cout << '-' << sum << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: 'a' was not declared in this scope
   10 |   vec.at(2) = (t - a*1000) / 100;
      |                    ^
a.cc:11:29: error: 'b' was not declared in this scope
   11 |   vec.at(1) = (t - a*1000 - b*100) / 10;
      |                             ^
a.cc:12:36: error: 'c' was not declared in this scope
   12 |   vec.at(0) = t - a*1000 - b*100 - c*10;
      |                                    ^
Language: Java

String s = sc.next();
        int n[] = new int[4];
        String ans = "";
        for(int i = 0; i < 4; i++){
        	n[i] = Integer.parseInt(s.substring(i, i + 1));
        }
        if(n[0] + n[1] + n[2] + n[3] == 7){
        	ans = n[0] + "+" + n[1] + "+" + n[2] + "+" + n[3];
        }else if(n[0] + n[1] + n[2] - n[3] == 7){
        	ans = n[0] + "+" + n[1] + "+" + n[2] + "-" + n[3];
        }else if(n[0] + n[1] - n[2] + n[3] == 7){
        	ans = n[0] + "+" + n[1] + "-" + n[2] + "+" + n[3];
        }else if(n[0] - n[1] + n[2] + n[3] == 7){
        	ans = n[0] + "-" + n[1] + "+" + n[2] + "+" + n[3];
        }else if(n[0] + n[1] - n[2] - n[3] == 7){
        	ans = n[0] + "+" + n[1] + "-" + n[2] + "-" + n[3];
        }else if(n[0] - n[1] + n[2] - n[3] == 7){
        	ans = n[0] + "-" + n[1] + "+" + n[2] + "-" + n[3];
        }else if(n[0] - n[1] - n[2] + n[3] == 7){
        	ans = n[0] + "-" + n[1] + "-" + n[2] + "+" + n[3];
        }else if(n[0] - n[1] - n[2] - n[3] == 7){
        	ans = n[0] + "-" + n[1] + "-" + n[2] + "-" + n[3];
        }
        System.out.println(ans + "=7");
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
String s = sc.next();
^
  (use --enable-preview to enable unnamed classes)
Main.java:2: error: class, interface, enum, or record expected
        int n[] = new int[4];
        ^
Main.java:4: error: class, interface, enum, or record expected
        for(int i = 0; i < 4; i++){
        ^
Main.java:4: error: class, interface, enum, or record expected
        for(int i = 0; i < 4; i++){
                       ^
Main.java:4: error: class, interface, enum, or record expected
        for(int i = 0; i < 4; i++){
                              ^
Main.java:6: error: class, interface, enum, or record expected
        }
        ^
Main.java:9: error: class, interface, enum, or record expected
        }else if(n[0] + n[1] + n[2] - n[3] == 7){
        ^
Main.java:11: error: class, interface, enum, or record expected
        }else if(n[0] + n[1] - n[2] + n[3] == 7){
        ^
Main.java:13: error: class, interface, enum, or record expected
        }else if(n[0] - n[1] + n[2] + n[3] == 7){
        ^
Main.java:15: error: class, interface, enum, or record expected
        }else if(n[0] + n[1] - n[2] - n[3] == 7){
        ^
Main.java:17: error: class, interface, enum, or record expected
        }else if(n[0] - n[1] + n[2] - n[3] == 7){
        ^
Main.java:19: error: class, interface, enum, or record expected
        }else if(n[0] - n[1] - n[2] + n[3] == 7){
        ^
Main.java:21: error: class, interface, enum, or record expected
        }else if(n[0] - n[1] - n[2] - n[3] == 7){
        ^
Main.java:23: error: class, interface, enum, or record expected
        }
        ^
Main.java:25: error: class, interface, enum, or record expected
    }
    ^
15 errors
Language: C++

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

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    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);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: lvalue required as left operand of assignment
   16 |     if(a-b-c-d=7) printf("%d-%d-%d-%d=7\n", a, b, c, d);
      |        ~~~~~^~
a.cc:17:18: error: lvalue required as left operand of assignment
   17 |     else if(a-b-c+d=7) printf("%d-%d-%d+%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:18:18: error: lvalue required as left operand of assignment
   18 |     else if(a-b+c+d=7) printf("%d-%d+%d+%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:19:18: error: lvalue required as left operand of assignment
   19 |     else if(a-b+c-d=7) printf("%d-%d+%d-%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:20:18: error: lvalue required as left operand of assignment
   20 |     else if(a+b-c-d=7) printf("%d+%d-%d-%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:21:18: error: lvalue required as left operand of assignment
   21 |     else if(a+b-c+d=7) printf("%d+%d-%d+%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:22:18: error: lvalue required as left operand of assignment
   22 |     else if(a+b+c-d=7) printf("%d+%d+%d-%d=7\n", a, b, c, d);
      |             ~~~~~^~
a.cc:23:18: error: lvalue required as left operand of assignment
   23 |     else if(a+b+c+d=7) printf("%d+%d+%d+%d=7\n", a, b, c, d);
      |             ~~~~~^~
Language: C++

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

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    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);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:41: error: 'c' was not declared in this scope
   14 |     int a = s[0] - '0', b = s[1] - '0'; c = s[2] - '0', d = s[3] - '0';
      |                                         ^
a.cc:14:57: error: 'd' was not declared in this scope
   14 |     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, 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";
  }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";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ')' before '{' token
   13 |   }else if((A+B-C-D==7){
      |           ~            ^
      |                        )
Language: Java

import java.util.*;
public class Main(){
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int[] bcd=new int[3];
    for(int i=0;i<3;i++){
      bcd[i]=sc.nextInt();
    }
    for(int i=0;i<1<<3;i++){
      int sum=a;
      char[] pm=new char[3];
      for(int j=0;j<3;j++){
        if((1&(i>>j))==1){
          sum=sum-bcd[j];
          pm[j]='-';
        }
        else{
          sum=sum+bcd[j];
          pm[j]='+';
        }
      }
      if(sum==7){
        System.out.print(a);
        for(int j=0;j<3;j++){
          System.out.print(pm[j]+bcd[j]);
        }
        System.out.println("=7");
        break;
      }
    }
  }
}

Compiler output:
Main.java:2: error: '{' expected
public class Main(){
                 ^
1 error
Language: Java

import java.util.*;
public class Main(){
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int bcd[3];
    for(int i=0;i<3;i++){
      bcd[i]=sc.nextInt();
    }
    for(int i=0;i<1<<3;i++){
      int sum=a;
      char[] pm=new char[3];
      for(int j=0;j<3;j++){
        if((1&(i>>j))==1){
          sum=sum-bcd[j];
          pm[j]='-';
        }
        else{
          sum=sum+bcd[j];
          pm[j]='+';
        }
      }
      if(sum==7){
        System.out.print(a);
        for(int j=0;j<3;j++){
          System.out.print(pm[j]+bcd[j]);
        }
        System.out.println("=7");
        break;
      }
    }
  }
}

Compiler output:
Main.java:2: error: '{' expected
public class Main(){
                 ^
Main.java:6: error: ']' expected
    int bcd[3];
            ^
2 errors
Language: Java

import java.util.*;
class Main(){
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int bcd[3];
    for(int i=0;i<3;i++){
      bcd[i]=sc.nextInt();
    }
    for(int i=0;i<1<<3;i++){
      int sum=a;
      char pm[3];
      for(int j=0;j<3;j++){
        if((1&(i>>j))==1){
          sum=sum-bcd[j];
          pm[j]='-';
        }
        else{
          sum=sum+bcd[j];
          pm[j]='+';
        }
      }
      if(sum==7){
        System.out.print(a);
        for(int j=0;j<3;j++){
          System.out.print(pm[j]+bcd[j]);
        }
        System.out.println("=7");
        break;
      }
    }
  }
}

Compiler output:
Main.java:2: error: '{' expected
class Main(){
          ^
Main.java:6: error: ']' expected
    int bcd[3];
            ^
Main.java:12: error: ']' expected
      char pm[3];
              ^
3 errors
Language: Java

import java.util.*;
class Main(){
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int bcd[3];
    for(int i=0;i<3;i++){
      abcd[i]=sc.nextInt();
    }
    for(int i=0;i<1<<3;i++){
      int sum=a;
      char pm[3];
      for(int j=0;j<3;j++){
        if((1&(i>>j))>0){
          sum=sum-bcd[j];
          pm[j]='-';
        }
        else{
          sum=sum+bcd[j];
          pm[j]='+';
        }
      }
      if(sum==7){
        System.out.print(a);
        for(int j=0;j<3;j++){
          System.out.print(pm[j]+bcd[j]);
        }
        System.out.println("=7");
        break;
      }
    }
  }
}

Compiler output:
Main.java:2: error: '{' expected
class Main(){
          ^
Main.java:6: error: ']' expected
    int bcd[3];
            ^
Main.java:12: error: ']' expected
      char pm[3];
              ^
3 errors
Language: C++

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

vector<int> a;
vector<string> b(4);
string st;


bool dfs(int i,int sum,int n) {

	int c = 0;

	if(i==0){
		c = st[i] - '0';
		sum = sum + c;
		i++;
		c = 0;
	}

	if(i==n){
	if(sum==7){
		for (int j = 0; j < n; j++) {
			if (j == 0){
				cout << st[j];
				continue;
			}
			cout << b[j] << st[j];
		}
		cout << "=" << sum;
		return true;
	}
	else
		return false;
	}

	b[i] = "+";
	c = st[i] - '0';
	if (dfs(i + 1, sum + c, n)) return true;

	b[i] = "-";
	if (dfs(i + 1, sum - c, n)) return true;
}

int Cut(int N) {
	int n = 0;

	while (N != 0){
		n++;
		a.push_back(N % 10);
		N = N / 10;
	}

	reverse(a.begin(), a.end());

	return n;
}

int main(void) {
	
	cin >> st;

	dfs(0, 0, 4);

}



Compiler output:
a.cc: In function 'int Cut(int)':
a.cc:55:9: error: 'reverse' was not declared in this scope
   55 |         reverse(a.begin(), a.end());
      |         ^~~~~~~
a.cc: In function 'bool dfs(int, int, int)':
a.cc:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
Language: C

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    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:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//https://atcoder.jp/contests/abc079/tasks/abc079_c
#include <bits/stdc++.h>
using namespace std;

template <class T>

void recurse(string input, vector<char> *ops, int acc)
{
    if (ops->size() == 3 && acc == 7)
    {
        for (int i = 0; i < 3; i++)
        {
            cout << input.at(i) << ops->at(i);
        }
        cout << input.at(3) << "=7"<< endl;
        return;
    }
    if (ops->size() <= 2)
    {
        int num = input.at(ops->size() + 1) - '0';
        ops->push_back('+');
        recurse(input, ops, acc + num);
        ops->pop_back();
        ops->push_back('-');
        recurse(input, ops, acc - num);
    }
}
int main()
{
    string input;
    vector<char> ops;
    cin >> input;
    recurse(input, &ops, input.at(0) - '0');
}

Compiler output:
a.cc: In function 'void recurse(std::string, std::vector<char>*, int)':
a.cc:22:16: error: no matching function for call to 'recurse(std::string&, std::vector<char>*&, int)'
   22 |         recurse(input, ops, acc + num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:22:16: note:   couldn't deduce template parameter 'T'
   22 |         recurse(input, ops, acc + num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:16: error: no matching function for call to 'recurse(std::string&, std::vector<char>*&, int)'
   25 |         recurse(input, ops, acc - num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   couldn't deduce template parameter 'T'
   25 |         recurse(input, ops, acc - num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:33:12: error: no matching function for call to 'recurse(std::string&, std::vector<char>*, int)'
   33 |     recurse(input, &ops, input.at(0) - '0');
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:33:12: note:   couldn't deduce template parameter 'T'
   33 |     recurse(input, &ops, input.at(0) - '0');
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

//https://atcoder.jp/contests/abc079/tasks/abc079_c
#include <bits/stdc++.h>
using namespace std;

template <class T>

void recurse(string input, vector<char> *ops, int acc)
{
    if (ops->size() == 3 && acc == 7)
    {
        for (int i = 0; i < 3; i++)
        {
            cout << input.at(i) << ops->at(i);
        }
        cout << input.at(3) << endl;
        return;
    }
    if (ops->size() <= 2)
    {
        int num = input.at(ops->size() + 1) - '0';
        ops->push_back('+');
        recurse(input, ops, acc + num);
        ops->pop_back();
        ops->push_back('-');
        recurse(input, ops, acc - num);
    }
}
int main()
{
    string input;
    vector<char> ops;
    cin >> input;
    recurse(input, &ops, input.at(0) - '0');
}

Compiler output:
a.cc: In function 'void recurse(std::string, std::vector<char>*, int)':
a.cc:22:16: error: no matching function for call to 'recurse(std::string&, std::vector<char>*&, int)'
   22 |         recurse(input, ops, acc + num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:22:16: note:   couldn't deduce template parameter 'T'
   22 |         recurse(input, ops, acc + num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:16: error: no matching function for call to 'recurse(std::string&, std::vector<char>*&, int)'
   25 |         recurse(input, ops, acc - num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   couldn't deduce template parameter 'T'
   25 |         recurse(input, ops, acc - num);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:33:12: error: no matching function for call to 'recurse(std::string&, std::vector<char>*, int)'
   33 |     recurse(input, &ops, input.at(0) - '0');
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: candidate: 'template<class T> void recurse(std::string, std::vector<char>*, int)'
    7 | void recurse(string input, vector<char> *ops, int acc)
      |      ^~~~~~~
a.cc:7:6: note:   template argument deduction/substitution failed:
a.cc:33:12: note:   couldn't deduce template parameter 'T'
   33 |     recurse(input, &ops, input.at(0) - '0');
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <cstdio > char s[5];
      |                    ^~~~
a.cc:1:10: fatal error: cstdio : No such file or directory
    1 | #include <cstdio > char s[5];
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
           int s;
           cin >>s;
  int a=s/1000,b=s/100%10,c=s/10%10,d=s%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:9:11: error: lvalue required as left operand of assignment
    9 |   if(a+b+c+d=7){cout <<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";}
      |      ~~~~~^~
a.cc:10:15: error: lvalue required as left operand of assignment
   10 |  else if(a-b+c+d=7){cout <<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";}
      |          ~~~~~^~
a.cc:11:15: error: lvalue required as left operand of assignment
   11 |  else if(a-b-c+d=7){cout <<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";}
      |          ~~~~~^~
a.cc:12:15: error: lvalue required as left operand of assignment
   12 |  else if(a-b+c-d=7){cout <<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";}
      |          ~~~~~^~
a.cc:13:15: error: lvalue required as left operand of assignment
   13 |  else if(a+b-c+d=7){cout <<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";}
      |          ~~~~~^~
a.cc:14:15: error: lvalue required as left operand of assignment
   14 |  else if(a+b+c-d=7){cout <<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";}
      |          ~~~~~^~
a.cc:15:15: error: lvalue required as left operand of assignment
   15 |  else if(a+b-c-d=7){cout <<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";}
      |          ~~~~~^~
a.cc:16:15: error: lvalue required as left operand of assignment
   16 |  else if(a-b-c-d=7){cout <<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";}
      |          ~~~~~^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
           int a,b,c,d;
           cin >>a>>b>>c>>d;
  if(a+b+c+d=7){cout <<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";}
 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:8:11: error: lvalue required as left operand of assignment
    8 |   if(a+b+c+d=7){cout <<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";}
      |      ~~~~~^~
a.cc:9:17: error: lvalue required as left operand of assignment
    9 |  else   if(a-b+c+d=7){cout <<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";}
      |            ~~~~~^~
a.cc:10:17: error: lvalue required as left operand of assignment
   10 |  else   if(a-b-c+d=7){cout <<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";}
      |            ~~~~~^~
a.cc:11:17: error: lvalue required as left operand of assignment
   11 |  else   if(a-b+c-d=7){cout <<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";}
      |            ~~~~~^~
a.cc:12:15: error: lvalue required as left operand of assignment
   12 |  else if(a+b-c+d=7){cout <<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";}
      |          ~~~~~^~
a.cc:13:15: error: lvalue required as left operand of assignment
   13 |  else if(a+b+c-d=7){cout <<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";}
      |          ~~~~~^~
a.cc:14:17: error: lvalue required as left operand of assignment
   14 |    else if(a+b-c-d=7){cout <<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";}
      |            ~~~~~^~
a.cc:15:19: error: lvalue required as left operand of assignment
   15 |      else if(a-b-c-d=7){cout <<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";}
      |              ~~~~~^~
Language: Java


import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String ans = "";
    for(int i = 0; i < 2; i++) {
      for(int j = 0; j < 2; j++) {
        for(int k = 0; k < 2; k++) {
          int t = a;
          if(i == 0) {
            t += b;
          } else {
            t -= b;
          }
          if(j == 0) {
            t += c;
          } else {
            t -= c;
          }
          if(k == 0) {
            t += d;
          } else {
            t -= d;
          }
          if(t == 7) {
            ans = a;
            if(i == 0) {
              ans += "+";
            } else {
              ans += "-";
            }
            ans += b;
            if(j == 0) {
              ans += "+";
            } else {
              ans += "-";
            }
            ans += c;
            if(k == 0) {
              ans += "+";
            } else {
              ans += "-";
            }
            ans += d;
            ans += "=7";
          }
        }
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:32: error: incompatible types: int cannot be converted to String
            ans = a;
                  ^
1 error
Language: C++

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

void fnInput(vector<int>& rvnNum)
{
  string sNum;
  cin >> sNum;

  for (int i = 0; i < rvnNum.size(); i++)
    rvnNum[i] = sNum[i] - '0';                 // char → int 変換
}

int fnBitFullSch(const vector<int>& cnrvnNum)
{
  for (int nCtl = 0; nCtl < ( 1 << 3 ) - 1; nCtl++)
  {
    int nSum = cnrvnNum[0];
    for (int nEach = 0; nEach < 3; nEach++)
      if (nCtl & ( 1 << nEach )) nSum += cnrvnNum[nEach + 1];
      else                       nSum -= cnrvnNum[nEach + 1];

    if (nSum == 7)  return n;
  }
  return ( 1 << 3 ) - 1;                       // 必ず答えが存在するため
}
    
void fnResult(const vector<int>& cnrvnNum, int nReslt)
{
  cout << cnrvnNum[0];
  for (int i = 0; i < 3; i++)
  {
    if (nReslt & (1 << i)) cout << "+";
    else                   cout << "-";

    cout << cnrvnNum[i + 1];
  }
  cout << "=7" << endl;
}

int main()
{
  vector<int> vnNum(4);
  
  fnInput(vnNum);
  int nReslt = fnBitFullSch(vnNum);
  fnResult(vnNum, nReslt);

  return 0;
}

Compiler output:
a.cc: In function 'int fnBitFullSch(const std::vector<int>&)':
a.cc:22:28: error: 'n' was not declared in this scope; did you mean 'yn'?
   22 |     if (nSum == 7)  return n;
      |                            ^
      |                            yn
Language: C++

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

int main(){
  string s;
  cin >>s;
  
  int len=strlen(s);
  
  int ans=0;
  long long num=0;
  long long ans=0;
  for(int i=0;i<1<<len-1;i++){
     num=s[i]/10-'0';
     num+= num%10;
     if(num==7) ans++;
  }
  cout<<ans<<endl;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
    8 |   int len=strlen(s);
      |                  ^
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:12:13: error: conflicting declaration 'long long int ans'
   12 |   long long ans=0;
      |             ^~~
a.cc:10:7: note: previous declaration as 'int ans'
   10 |   int ans=0;
      |       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
char inc(int i){
    if(i==0)return '+';
    else return '-';
}
int main(){
    string n;
    cin >> n;
    int a=s[0]-'0';
    int b=s[1]-'0';
    int c=s[2]-'0';
    int d=s[3]-'0';
    int tmp;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                tmp=a+b+c+d;
                if(i==1)tmp-=2*b;
                if(j==1)tmp-=2*c;
                if(k==1)tmp-=2*d;
                if(tmp==7){
                    cout << a;
                    cout << inc(i);
                    cout << b;
                    cout << inc(j);
                    cout << c;
                    cout << inc(k);
                    cout << d;
                    cout << "=7";
                    return 0;
                }
            }
        }
    }
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  vector<int>a(4);
  rep(i,4) a[i]=s[i]-'0';
  string str=s[0];
  int sum=a[0];
  for(int tmp=0;tmp<(1<<3);tmp++){
    bitset<4>t(tmp);
    rep(i,3){
      if(t.test(i)){
        str+='+';
        sum+=a[i+1];
      }
      else{
        str+='-';
        sum-=a[i+1];
      }
      str+=s[i+1];
    }
    if(sum==7){
      cout<<str+"=7"<<endl;
      return 0;
    }
  }
  
}
        

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   23 |   string str=s[0];
      |                 ^
Language: C

# include < stdio.h >
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:
main.c:1:11: fatal error:  stdio.h : No such file or directory
    1 | # include < stdio.h >
      |           ^~~~~~~~~~~
compilation terminated.
Language: C

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


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  vector<int>num(4);
  rep(i,4) num[i]=stoi(s[i]);
  for(int tmp=0;tmp<(1<<3);tmp++){
    int sum=num[0];
    string s;
    s=(char)('0'+num[0]);
    bitset<3>t(tmp);
    rep(i,3){
      if(t.test(i)){
        sum+=num[i+1];
        s+='+'+(char)('0'+num[i+1]);
      }
      else{
        sum-=num[i+1];
        s+='-'+(char)('0'+num[i+1]);
      }
    }
      if(sum==7){
        s+="=7";
        cout<<s<<endl;
        return 0;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   22 |   rep(i,4) num[i]=stoi(s[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<char>, char>::value_type' {aka 'char'} 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<char>, char>::value_type' {aka 'char'} 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;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  vector<int>num(4);
  rep(i,4) num[i]=stoi(i);
  for(int tmp=0;tmp<(1<<3);tmp++){
    int sum=num[0];
    string s;
    s=(char)('0'+num[0]);
    bitset<3>t(tmp);
    rep(i,3){
      if(t.test(i)){
        sum+=num[i+1];
        s+='+'+(char)('0'+num[i+1]);
      }
      else{
        sum-=num[i+1];
        s+='-'+(char)('0'+num[i+1]);
      }
    }
      if(sum==7){
        s+="=7";
        cout<<s<<endl;
        return 0;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: no matching function for call to 'stoi(int&)'
   22 |   rep(i,4) num[i]=stoi(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 '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 '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;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  vector<int>num(4);
  rep(i,4) num[i]=stoi(i);
  for(int tmp=0;tmp<(1<<3);tmp++){
    int sum=num[0];
    string s;
    s=(char)('0'+a[0]);
    bitset<3>t(tmp);
    rep(i,3){
      if(t.test(i)){
        sum+=num[i+1];
        s+='+'+(char)('0'+num[i+1]);
      else
        sum-=num[i+1];
        s+='-'+(char)('0'+num[i+1]);
      }
    }
      if(sum==7){
        s+="=7";
        cout<<s<<endl;
        return 0;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: no matching function for call to 'stoi(int&)'
   22 |   rep(i,4) num[i]=stoi(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 '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 '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)
      |        ~~~~~~~~~~~~~~~^~~~~
a.cc:26:18: error: 'a' was not declared in this scope
   26 |     s=(char)('0'+a[0]);
      |                  ^
a.cc:32:7: error: expected '}' before 'else'
   32 |       else
      |       ^~~~
a.cc:29:20: note: to match this '{'
   29 |       if(t.test(i)){
      |                    ^
a.cc:37:10: error: 'sum' was not declared in this scope; did you mean 'num'?
   37 |       if(sum==7){
      |          ^~~
      |          num
a.cc: At global scope:
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^