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

#include <iostream>
#include <cstdio>
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) {
    printf("%d-%d-%d-%d=7\n",A,B,C,D);
  } else if (A-B-C+D==7) {
    printf("%d-%d-%d+%d=7\n",A,B,C,D);
  } else if (A-B+C-D==7) {
    printf("%d-%d+%d-%d=7\n",A,B,C,D);
  } else if (A-B+C+D==7) {
    printf("%d-%d+%d+%d=7\n",A,B,C,D);
  } else if (A+B-C-D==7) {
    printf("%d+%d-%d-%d=7\n",a,b,c,d);
  } else if (A+B-C+D==7) {
    printf("%d+%d-%d+%d=7\n",A,B,C,D);
  } else if (A+B+C-D==7) {
    printf("%d+%d+%d-%d=7\n",A,B,C,D);
  } else if (A+B+C+D==7) {
    printf("%d+%d+%d+%d=7\n",A,B,C,D);
  }
  return 0;
}


Compiler output:
a.cc:8:14: error: extended character ’ is not valid in an identifier
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |              ^
a.cc:8:14: error: extended character ’ is not valid in an identifier
a.cc:8:26: error: extended character ’ is not valid in an identifier
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                          ^
a.cc:8:26: error: extended character ’ is not valid in an identifier
a.cc:8:38: error: extended character ’ is not valid in an identifier
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                                      ^
a.cc:8:38: error: extended character ’ is not valid in an identifier
a.cc:8:50: error: extended character ’ is not valid in an identifier
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                                                  ^
a.cc:8:50: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:8:14: error: '\U000020190\U00002019' was not declared in this scope
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |              ^~~
a.cc:8:19: error: 'B' was not declared in this scope
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                   ^
a.cc:8:31: error: 'C' was not declared in this scope
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                               ^
a.cc:8:43: error: 'D' was not declared in this scope
    8 |   int A=s[0]-’0’; B=s[1]-’0’, C=s[2]-’0’, D=s[3]-’0’;
      |                                           ^
a.cc:18:30: error: 'a' was not declared in this scope
   18 |     printf("%d+%d-%d-%d=7\n",a,b,c,d);
      |                              ^
a.cc:18:32: error: 'b' was not declared in this scope
   18 |     printf("%d+%d-%d-%d=7\n",a,b,c,d);
      |                                ^
a.cc:18:34: error: 'c' was not declared in this scope
   18 |     printf("%d+%d-%d-%d=7\n",a,b,c,d);
      |                                  ^
a.cc:18:36: error: 'd' was not declared in this scope
   18 |     printf("%d+%d-%d-%d=7\n",a,b,c,d);
      |                                    ^
Language: C++

a = gets.chomp.chars
[?+, ?-].repeated_permutation(3).each do |b|
  s = a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3]
  if eval(s) == 7
    puts s+"=7"
    exit
  end
end

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a = gets.chomp.chars
      | ^
Language: Java

import java.io.*;
import java.util.*;

import junit.extensions.TestSetup;

public class Main {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));
		
		int number = sc.nextInt();
		int[] n = new int[]{
				number/1000,
				number%1000 / 100,
				number%100 / 10,
				number%10
		};
		String[][] dp = new String[n.length+1][81];
		for (int i = 0; i < dp.length; i++) {
			Arrays.fill(dp[i], "INF");
		}
		dp[1][40+n[0]] = "root";
		for (int i = 1; i < n.length; i++) {
			for (int j = 0; j < dp[i].length; j++) {
				if (dp[i][j] != "INF") {
					dp[i+1][j+n[i]] = "+";
					dp[i+1][j-n[i]] = "-";
				}
			}
		}
		int p = 47;
		String[] op = new String[3];
		for (int i = 4; i > 1; i--) {
			op[i-2] = dp[i][p];
			if (dp[i][p] == "+") {
				p = p - n[i-1];
			}else if (dp[i][p] == "-") {
				p = p + n[i-1];
			}	
		}
		out.print(n[0]);
		for (int i = 0; i < op.length; i++) {
			out.print(op[i]);
			out.print(n[i+1]);
		}
		out.println("=7");
		out.close();
	}
	
	

	//-----------http://codeforces.com/blog/entry/7018---------------------------------
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	//--------------------------------------------------------

}



Compiler output:
Main.java:4: error: package junit.extensions does not exist
import junit.extensions.TestSetup;
                       ^
1 error
Language: C++

s = list(input())
a, b, c, d = map(int, s)

marks = "+-*/"
template = "{0}{1}{2}{3}{4}{5}{6}"
for m1 in marks:
    for m2 in marks:
        for m3 in marks:
            formula = template.format(a,m1,b,m2,c,m3,d)
            try:
                if eval(formula) == 7:
                    print(formula+"=7")
                    exit(0)
            except Exception as e:
                continue

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = list(input())
      | ^
Language: C++

#include <iostream>
#include <ostream>
#include <istream>
#include <cmath>
#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <vector>
#include <set>
#define pb push_back
#define ppb pop_back
using namespace std;
int main()
{
    string s;
    cin>>s;
    vector<int> a(4);
    for(int i=0;i<4;i++)
    {
    	a[i]=s[i]-'0';
	}
	for(int i=0;i<1<<3;i++)
	{
		int ans=a[0];
		for(int j=0;j<3)if(i>>j & 1)ans+=a[i+1];else ans-=a[i+1];
		if(ans==7)
		{
			string s="0-0-0-0=7";
			for(int j=0;j<4;j++)s[i*2]='0'+a[i];
			for(int i=0;i<3;i++)if(i>>j & 1)s[i*2+1]='+';
			cout<<s<<endl;
			return 0;
		}
	}
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:32: error: expected ';' before ')' token
   33 |                 for(int j=0;j<3)if(i>>j & 1)ans+=a[i+1];else ans-=a[i+1];
      |                                ^
      |                                ;
a.cc:38:51: error: 'j' was not declared in this scope
   38 |                         for(int i=0;i<3;i++)if(i>>j & 1)s[i*2+1]='+';
      |                                                   ^
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()
{
  string a;
  cin >> a;
  for(int i=0;i<2;i++)
  {
    for(int j=0;j<2;j++)
    {
      for(int k=0;k<2;k++)
      {
        int ans=(a[0]-48);
        if(i==0)
          ans+=a[1]-48;
        else ans-=a[1]-48;
        if(j==0)
          ans+=a[2]-48;
        else ans-=a[2]-48;
        if(k==0)
          ans+=a[3]-48;
        else ans-=a[3]-48;
        if(ans==7)
        {
          printf("%c",a[0]);
          if(i==0)
            printf("+");
          else printf("-");
          printf("%c",a[1]);
          if(j==0)
            printf("+");
          else printf("-");
          printf("%c",a[2]);
          if(k==0)
            printf("+");
          else printf("-");
          printf("%c=7",n[3]);
          return 0;
        }
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: 'n' was not declared in this scope
   37 |           printf("%c=7",n[3]);
      |                         ^
Language: C++

#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<map>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b,c,d;
string s;
int main()
{
	cin>>s;
	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";
	}
	if(a+b+c-d==7)
	{
		cout<<"a+b+c-d=7";
	}
	if(a+b-c+d==7)
	{
		cout<<"a+b-c+d=7";
	}
	if(a-b+c+d==7)
	{
		cout<<"a-b+c+d=7";
	}
	if(a+b-c-d==7)
	{
		cout<<"a+b-c-d=7";
	}
	if(a-b+c-d==7)
	{
		cout<<"a-b+c-d=7";
	}
	if(a-b-c+d==7)
	{
		cout<<"a-b-c+d=7";
	}
	if(a-b-c-d==7)
	{
		cout<<"a-b-c-d=7";
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   15 |         a=s[0]-"0";
a.cc:16:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   16 |         b=s[1]-"0";
a.cc:17:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   17 |         c=s[2]-"0";
a.cc:18:15: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char [2]' to binary 'operator-'
   18 |         d=s[3]-"0";
Language: C++

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <functional>
#include <map>
#include <ios>
#include <iosfwd>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
#include <complex.h>
#include <fenv.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <tgmath.h>
#include <conio.h>
#include <numeric>
#include <list>
#include <windows.h>
#include <cfloat>
#include <climits>
#include <unordered_map>
#include <unordered_set>
using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define uint(n) ((unsigned int)(n))
#define ll(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dou(n) ((double)(n))
const int INF=1e9+7;
const ll LINF=1e18;
#define pb push_back
#define pob pop_back
#define m_p make_pair
#define ALL(a) (a).begin(),(a).end()
#define Mod 1000000007
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second

string s;
int a,b,c,d;

int main()
{
	cin>>s;
	a=s[0]-'0';b=s[1]-'0';c=s[2]-'0';d=s[3]-'0';
	
	for(int i=0;i<2;i++) for(int j=0;j<2;j++) for(int k=0;k<2;k++)
	{
		int res=a;
		if(i==0) res+=b; else res-=b;
		if(j==0) res+=c; else res-=c;
		if(k==0) res+=d; else res-=d;
		if(res==7)
		{
			cout<<a;
			if(i==0) putchar('+'); else putchar('-');
			cout<<b;
			if(j==0) putchar('+'); else putchar('-');
			cout<<c;
			if(k==0) putchar('+'); else putchar('-');
			cout<<d;
			puts("=7");
			return 0;
		}
	}
}

Compiler output:
a.cc:53:10: fatal error: conio.h: No such file or directory
   53 | #include <conio.h>
      |          ^~~~~~~~~
compilation terminated.
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:9: fatal error: stdio.h : No such file or directory
    1 | #include<stdio.h >
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int a,b,c,d,N;
  cin >> N;
  a=N/1000;
  b=N/100 - 10*a;
  c=N/10 - 100*a - 10*b;
  d=N-1000*1 -100*b -10*c;

  int i,j,k,l;
  for(i=0;i++;i<2)
    {
      for(j=0;j++;j<2)
	{
	  for(k=0;k++;k<2)
	    {      
	      l=i*b+j*c+k*d;
	      if(a+b+c+d-2*l==7)
		{
		  break;
		}
	    }
	}
    }
  string op1,op2,op3;
  if(i==0)
    {
      op1="+";
    }
  else
    {
      op1="-";
    }
  if(j==0)
    {
      op2="+";
    }
  else
    {
      op2="-";
    }
  if(k==0)
    {
      op3="+";
    }
  else
    {
      op3="-";
    }
  cout<<a<<op1<<b<<op2<<c<<op3<<d<<"=7"


Compiler output:
a.cc: In function 'int main()':
a.cc:53:40: error: expected ';' at end of input
   53 |   cout<<a<<op1<<b<<op2<<c<<op3<<d<<"=7"
      |                                        ^
      |                                        ;
a.cc:53:40: error: expected '}' at end of input
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

char s[5];
int main(){
  scanf("%s",&s);
  int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;

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

Compiler output:
a.cc:7:14: 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:14: error: extended character ’ is not valid in an identifier
a.cc:7:25: 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:28: 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:37: 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:40: 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:49: 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:14: error: '\U000020190\U00002019' was not declared in this scope
    7 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |              ^~~
a.cc:9:9: error: 'b' was not declared in this scope
    9 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |         ^
a.cc:9:11: error: 'c' was not declared in this scope
    9 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |           ^
a.cc:9:13: error: 'd' was not declared in this scope
    9 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |             ^
Language: C++

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

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

#include<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:5:14: error: extended character ’ is not valid in an identifier
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |              ^
a.cc:5:14: error: extended character ’ is not valid in an identifier
a.cc:5:25: error: extended character ’ is not valid in an identifier
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |                         ^
a.cc:5:28: error: extended character ’ is not valid in an identifier
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |                            ^
a.cc:5:37: error: extended character ’ is not valid in an identifier
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |                                     ^
a.cc:5:40: error: extended character ’ is not valid in an identifier
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |                                        ^
a.cc:5:49: error: extended character ’ is not valid in an identifier
    5 |   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:5:14: error: '\U000020190\U00002019' was not declared in this scope
    5 |   int a=s[0]-’0’,b=s[1]-’0 ’,c=s[2]-’0 ’,d=s[3]-’0 ;
      |              ^~~
a.cc:7:9: error: 'b' was not declared in this scope
    7 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |         ^
a.cc:7:11: error: 'c' was not declared in this scope
    7 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |           ^
a.cc:7:13: error: 'd' was not declared in this scope
    7 |   if (a-b-c-d==7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
      |             ^
Language: Java

package Algorithms;

import java.io.*;
import java.util.StringTokenizer;






public class AtCoder079C {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        int A = in.nextInt();
        int B = in.nextInt();
        int C = in.nextInt();
        int D = in.nextInt();

        if (A+B+C+D==7)
        {
            System.out.println(A + "+" + B + "+" + C +  "+" + D + "=7" );
            System.exit(0);
        }

        if (A+B+C-D==7)
        {
            System.out.println(A + "+" + B + "+" + C +  "-" + D + "=7" );
            System.exit(0);
        }

        if (A+B-C-D==7)
        {
            System.out.println(A + "+" + B + "-" + C +  "-" + D + "=7" );
            System.exit(0);
        }

        if (A-B+C+D==7)
        {
            System.out.println(A + "-" + B + "+" + C +  "+" + D + "=7" );
            System.exit(0);
        }
        if (A-B-C+D==7)
        {
            System.out.println(A + "-" + B + "-" + C +  "+" + D + "=7" );
            System.exit(0);
        }
        if (A-B+C-D==7)
        {
            System.out.println(A + "-" + B + "+" + C +  "-" + D + "=7" );
            System.exit(0);
        }
        if (A-B-C-D==7)
        {
            System.out.println(A + "+" + B + "+" + C +  "+" + D + "=7" );
            System.exit(0);
        }
        if (A+B+C+D==7)
        {
            System.out.println(A + "+" + B + "+" + C +  "+" + D + "=7" );
            System.exit(0);
        }





    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Compiler output:
Main.java:11: error: class AtCoder079C is public, should be declared in a file named AtCoder079C.java
public class AtCoder079C {
       ^
1 error
Language: C++

#include <iostream>
using namespace std;

bool fun(int a, int b, int c, int d, int p)
{
  switch(p)
  {
    case 0:
      break;
    case 1:
      b *= -1;
      break;
    case 2:
      b *= -1;
      c *= -1;
      break;
    case 3:
      b *= -1;
      d *= -1;
      break;
    case 4:
      b *= -1;
      c *= -1;
      d *= -1;
      break;
    case 5:
      c *= -1;
      break;
    case 6:
      c *= -1;
      d *= -1;
      break;
    case 7:
      d *= -1;
      break;
  }
  if(a+b+c+d==7)
  {
    return true;
  }
  else
  {
    return false;
  }
}

string encode(int a, int b, int c, int d, int p)
{
  char ac = ('0' + a);
  char bc = ('0' + b);
  char cc = ('0' + c);
  char dc = ('0' + d);
  string as = {ac};
  string bs = {bc};
  string cs = {cc};
  string ds = {dc};
  string op1 = '+';
  string op2 = '+';
  string op3 = '+';
  
  switch(p)
  {
    case 0:
      break;
    case 1:
      op1 = '-';
      break;
    case 2:
      op1 = '-';
      op2 = '-';
      break;
    case 3:
      op1 = '-';
      op2 = '-';
      break;
    case 4:
      op1 = '-';
      op2 = '-';
      op3 = '-';
      break;
    case 5:
      op2 = '-';
      break;
    case 6:
      op2 = '-';
      op3 = '-';
      break;
    case 7:
      op3 = '-';
      break;
  }
  string result = as+op1+bs+op2+cs+op3+ds;
  return result;
}
      
      

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p;
  string ans;
  for(int i = 0; i < 8; ++i)
  {
    if( fun(a,b,c,d,i) )
    {
      ans = encode(a,b,c,d,i);
      break;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'std::string encode(int, int, int, int, int)':
a.cc:57:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   57 |   string op1 = '+';
      |                ^~~
a.cc:58:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   58 |   string op2 = '+';
      |                ^~~
a.cc:59:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   59 |   string op3 = '+';
      |                ^~~
Language: C++

#include <iostream>
using namespace std;

bool fun(int a, int b, int c, int d, int p)
{
  switch(p)
  {
    case 0:
      break;
    case 1:
      b *= -1;
      break;
    case 2:
      b *= -1;
      c *= -1;
      break;
    case 3:
      b *= -1;
      d *= -1;
      break;
    case 4:
      b *= -1;
      c *= -1;
      d *= -1;
      break;
    case 5:
      c *= -1;
      break;
    case 6:
      c *= -1;
      d *= -1;
      break;
    case 7:
      d *= -1;
      break;
  }
  if(a+b+c+d==7)
  {
    return true;
  }
  else
  {
    return false;
  }
}

string encode(int a, int b, int c, int d, int p)
{
  char ac = ('0' + a);
  char bc = ('0' + b);
  char cc = ('0' + c);
  char dc = ('0' + d);
  string as = ac;
  string bs = bc;
  string cs = cc;
  string ds = dc;
  string op1 = '+';
  string op2 = '+';
  string op3 = '+';
  
  switch(p)
  {
    case 0:
      break;
    case 1:
      op1 = '-';
      break;
    case 2:
      op1 = '-';
      op2 = '-';
      break;
    case 3:
      op1 = '-';
      op2 = '-';
      break;
    case 4:
      op1 = '-';
      op2 = '-';
      op3 = '-';
      break;
    case 5:
      op2 = '-';
      break;
    case 6:
      op2 = '-';
      op3 = '-';
      break;
    case 7:
      op3 = '-';
      break;
  }
  string result = as+op1+bs+op2+cs+op3+ds;
  return result;
}
      
      

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p;
  string ans;
  for(int i = 0; i < 8; ++i)
  {
    if( fun(a,b,c,d,i) )
    {
      ans = encode(a,b,c,d,i);
      break;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'std::string encode(int, int, int, int, int)':
a.cc:53:15: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   53 |   string as = ac;
      |               ^~
a.cc:54:15: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   54 |   string bs = bc;
      |               ^~
a.cc:55:15: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   55 |   string cs = cc;
      |               ^~
a.cc:56:15: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   56 |   string ds = dc;
      |               ^~
a.cc:57:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   57 |   string op1 = '+';
      |                ^~~
a.cc:58:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   58 |   string op2 = '+';
      |                ^~~
a.cc:59:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   59 |   string op3 = '+';
      |                ^~~
Language: C++

#include <iostream>
using namespace std;

bool fun(int a, int b, int c, int d, int p)
{
  switch(p)
  {
    case 0:
      break;
    case 1:
      b *= -1;
      break;
    case 2:
      b *= -1;
      c *= -1;
      break;
    case 3:
      b *= -1;
      d *= -1;
      break;
    case 4:
      b *= -1;
      c *= -1;
      d *= -1;
      break;
    case 5:
      c *= -1;
      break;
    case 6:
      c *= -1;
      d *= -1;
      break;
    case 7:
      d *= -1;
      break;
  }
  if(a+b+c+d==7)
  {
    return true;
  }
  else
  {
    return false;
  }
}

string encode(int a, int b, int c, int d, int p)
{
  string ac = ('0' + a);
  string bc = ('0' + b);
  string cc = ('0' + c);
  string dc = ('0' + d);
  string op1 = '+';
  string op2 = '+';
  string op3 = '+';
  
  switch(p)
  {
    case 0:
      break;
    case 1:
      op1 = '-';
      break;
    case 2:
      op1 = '-';
      op2 = '-';
      break;
    case 3:
      op1 = '-';
      op2 = '-';
      break;
    case 4:
      op1 = '-';
      op2 = '-';
      op3 = '-';
      break;
    case 5:
      op2 = '-';
      break;
    case 6:
      op2 = '-';
      op3 = '-';
      break;
    case 7:
      op3 = '-';
      break;
  }
  string result = ac+op1+bc+op2+cc+op3+dc;
  return result;
}
      
      

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p;
  string ans;
  for(int i = 0; i < 8; ++i)
  {
    if( fun(a,b,c,d,i) )
    {
      ans = encode(a,b,c,d,i);
      break;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'std::string encode(int, int, int, int, int)':
a.cc:49:20: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   49 |   string ac = ('0' + a);
      |               ~~~~~^~~~
a.cc:50:20: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   50 |   string bc = ('0' + b);
      |               ~~~~~^~~~
a.cc:51:20: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   51 |   string cc = ('0' + c);
      |               ~~~~~^~~~
a.cc:52:20: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   52 |   string dc = ('0' + d);
      |               ~~~~~^~~~
a.cc:53:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   53 |   string op1 = '+';
      |                ^~~
a.cc:54:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   54 |   string op2 = '+';
      |                ^~~
a.cc:55:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   55 |   string op3 = '+';
      |                ^~~
Language: C++

#include <iostream>
using namespace std;

bool fun(int a, int b, int c, int d, int p)
{
  switch(p)
  {
    case 0:
      break;
    case 1:
      b *= -1;
      break;
    case 2:
      b *= -1;
      c *= -1;
      break;
    case 3:
      b *= -1;
      d *= -1;
      break;
    case 4:
      b *= -1;
      c *= -1;
      d *= -1;
      break;
    case 5:
      c *= -1;
      break;
    case 6:
      c *= -1;
      d *= -1;
      break;
    case 7:
      d *= -1;
      break;
  }
  if(a+b+c+d==7)
  {
    return true;
  }
  else
  {
    return false;
  }
}

string encode(int a, int b, int c, int d, int p)
{
  string ac = '0' + a;
  string bc = '0' + b;
  string cc = '0' + c;
  string dc = '0' + d;
  string op1 = '+';
  string op2 = '+';
  string op3 = '+';
  
  switch(p)
  {
    case 0:
      break;
    case 1:
      op1 = '-';
      break;
    case 2:
      op1 = '-';
      op2 = '-';
      break;
    case 3:
      op1 = '-';
      op2 = '-';
      break;
    case 4:
      op1 = '-';
      op2 = '-';
      op3 = '-';
      break;
    case 5:
      op2 = '-';
      break;
    case 6:
      op2 = '-';
      op3 = '-';
      break;
    case 7:
      op3 = '-';
      break;
  }
  string result = ac+op1+bc+op2+cc+op3+dc;
  return result;
}
      
      

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p;
  string ans;
  for(int i = 0; i < 8; ++i)
  {
    if( fun(a,b,c,d,i) )
    {
      ans = encode(a,b,c,d,i);
      break;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'std::string encode(int, int, int, int, int)':
a.cc:49:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   49 |   string ac = '0' + a;
      |               ~~~~^~~
a.cc:50:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   50 |   string bc = '0' + b;
      |               ~~~~^~~
a.cc:51:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   51 |   string cc = '0' + c;
      |               ~~~~^~~
a.cc:52:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   52 |   string dc = '0' + d;
      |               ~~~~^~~
a.cc:53:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   53 |   string op1 = '+';
      |                ^~~
a.cc:54:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   54 |   string op2 = '+';
      |                ^~~
a.cc:55:16: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   55 |   string op3 = '+';
      |                ^~~
Language: C++

#include <iostream>
using namespace std;

bool fun(int a, int b, int c, int d, int p)
{
  switch(p)
  {
    case 0:
      break;
    case 1:
      b *= -1;
      break;
    case 2:
      b *= -1;
      c *= -1;
      break;
    case 3:
      b *= -1;
      d *= -1;
      break;
    case 4:
      b *= -1;
      c *= -1;
      d *= -1;
      break;
    case 5:
      c *= -1;
      break;
    case 6:
      c *= -1;
      d *= -1;
      break;
    case 7:
      d *= -1;
      break;
  }
  if(a+b+c+d==7)
  {
    return true;
  }
  else
  {
    return false;
  }
}

string encode(int a, int b, int c, int d, int p)
{
  char ac = '0' + a;
  char bc = '0' + b;
  char cc = '0' + c;
  char dc = '0' + d;
  char op1 = '+';
  char op2 = '+';
  char op3 = '+';
  
  switch(p)
  {
      case 0;
      break;
    case 1:
      op1 = '-';
      break;
    case 2:
      op1 = '-';
      op2 = '-';
      break;
    case 3:
      op1 = '-';
      op2 = '-';
      break;
    case 4:
      op1 = '-';
      op2 = '-';
      op3 = '-';
      break;
    case 5:
      op2 = '-';
      break;
    case 6:
      op2 = '-';
      op3 = '-';
      break;
    case 7:
      op3 = '-';
      break;
  }
  string result = ac+op1+bc+op2+cc+op3+dc;
  return result;
}
      
      

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p;
  string ans;
  for(int i = 0; i < 8; ++i)
  {
    if( fun(a,b,c,d,i) )
    {
      ans = encode(a,b,c,d,i);
      break;
    }
  }
  
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'std::string encode(int, int, int, int, int)':
a.cc:59:13: error: expected ':' before ';' token
   59 |       case 0;
      |             ^
      |             :
a.cc:88:39: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   88 |   string result = ac+op1+bc+op2+cc+op3+dc;
      |                   ~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int INF = 1 << 30;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
int a, b, c, d;
int main() {
	int nn;
	cin >> nn;
	a = nn / 1000;
	b = (nn % 1000) / 100;
	c = (nn % 100) / 10;
	d = nn % 10;
	TFOR(i, 2) {
		TFOR(j, 2) {
			TFOR(k, 2) {
					int n = a;
					if (i == 0)n += b;
					else n -= b;
					if (j == 0)n += c;
					else n -= c;
					if (k == 0)n += d;
					else n -= d;
					if (n == 7) {
						cout <<a<< (i == 0 ? "+" : "-")<<b<<(j==0?"+":"-")<<c<<(k==0?"+":"-")<<d<<"=7"<<endl;
						return 0;
					}
			}
		}
	}
	return 0;

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	string s;
	cin>>s;
	a=s[0]-48;
	b=s[1]-48;
	c=s[2]-48;
	d=s[3]-48;
	
	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+3b+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;
//	main();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: unable to find numeric literal operator 'operator""b'
   21 |         else if((a+3b+c-d)==7)
      |                    ^~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i,a,b)  for(int i=(a);i<(b);i++)
#define REP(i,n)    FOR(i,0,n)
#define ALL(a)      a.begin(),a.end()
#define vi          vector<int>
#define vvi         vector<vi>
#define P           pair<int,int>
 
int main(){
    int a=0,b,c,d;
    {
        string s;cin>>s;
        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",a,b,c,d);
    else if (a+b+c-d==7)printf("%d+%d+%d-%d=7",a,b,c,d);
    else if (a+b-c+d==7)printf("%d+%d-%d+%d=7",a,b,c,d);
    else if (a+b-c-d==7)printf("%d+%d-%d-%d=7",a,b,c,d);
    else if (a-b+c+d==7)printf("%d-%d+%d+%d=7",a,b,c,d);
    else if (a-b+c-d==7)printf("%d-%d+%d-%d=7",a,b,c,d);
    else if (a-b-c+d==7)printf("%d-%d-%d+%d=7",a,b,c,d);
    else if (a-b-c-d==7)printf("%d-%d-%d-%d=7",a,b,c,d);
    cout<<"\n";
    return 0;

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

#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i,a,b)  for(int i=(a);i<(b);i++)
#define REP(i,n)    FOR(i,0,n)
#define ALL(a)      a.begin(),a.end()
#define vi          vector<int>
#define vvi         vector<vi>
#define P           pair<int,int>
 
int main(){
    int a,b,c,d;
    {
        string s;
scanf("%s",&s);
        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",a,b,c,d);
    else if (a+b+c-d==7)printf("%d+%d+%d-%d=7",a,b,c,d);
    else if (a+b-c+d==7)printf("%d+%d-%d+%d=7",a,b,c,d);
    else if (a+b-c-d==7)printf("%d+%d-%d-%d=7",a,b,c,d);
    else if (a-b+c+d==7)printf("%d-%d+%d+%d=7",a,b,c,d);
    else if (a-b+c-d==7)printf("%d-%d+%d-%d=7",a,b,c,d);
    else if (a-b-c+d==7)printf("%d-%d-%d+%d=7",a,b,c,d);
    else if (a-b-c-d==7)printf("%d-%d-%d-%d=7",a,b,c,d);
    cout<<"\n";
    return 0;

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

#include <cstdio>
int main() {
    int a[10] ;
    for(int i = 0 ; i<4 ;i++) scanf("%1d" , &a[i]) ;
    if(a[0]+a[1]+a[2]+a[3] == 7)
        cout << a[0]<<'+' << a[1] << '+' << a[2] << '+' << a[3] ;
    else if(a[0]- a[1] + a[2] + a[3] == 7) 
        cout <<a[0] << '-' << a[1] << '+' << a[2] << '+' << a[3]   ;
    else if(a[0] + a[1] - a[2] + a[3] == 7) 
        cout << a[0] << '+' << a[1] << '-' << a[2] << '+' << a[3]   ;
    else if(a[0] - a[1] - a[2] + a[3] == 7) 
        cout <<a[0] << '-' << a[1] << '-' << a[2] << '+' << a[3]   ;
    else if(a[0] - a[1] + a[2] - a[3] == 7) 
        printf("%d-%d+%d-%d" , a[0] , a[1] , a[2] , a[3]) ;
    else if(a[0] - a[1] - a[2] - a[3] == 7) 
        printf("%d-%d-%d-%d", a[0] , a[1] , a[2] , a[3]) ;
    else if(a[0]+ a[1] + a[2]-a[3] == 7) 
        printf("%d+%d+%d-%d" , a[0] , a[1] , a[2] , a[3]) ;
    else printf("%d+%d-%d-%d" , a[0] , a[1] , a[2] , a[3]) ;
    printf("=7\n") ;
 
    return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cout' was not declared in this scope
    6 |         cout << a[0]<<'+' << a[1] << '+' << a[2] << '+' << a[3] ;
      |         ^~~~
a.cc:8:9: error: 'cout' was not declared in this scope
    8 |         cout <<a[0] << '-' << a[1] << '+' << a[2] << '+' << a[3]   ;
      |         ^~~~
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout << a[0] << '+' << a[1] << '-' << a[2] << '+' << a[3]   ;
      |         ^~~~
a.cc:12:9: error: 'cout' was not declared in this scope
   12 |         cout <<a[0] << '-' << a[1] << '-' << a[2] << '+' << a[3]   ;
      |         ^~~~
Language: C++

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

char q[2]={"-+--"};
int main()
{
    string n;
    cin>>n;
    int a=n[0];
    int b=n[1];
    int c=n[2];
    int d=n[3];
    
    for(int i=-1;i<=1;i+=2)
    {
        for(int j=-1;j<=1;j+=2)
        {
            for(int k=-1;k<=1;k+=2)
            {
                if(a+i*b+j*c+k*d==7)
                {
                    return printf("%d%c%d%c%d%c%d=7",a, q[i+1] ,b,q[j+1] ,c,q[k+1] ,d),0;
                }
            }
        }
    }
    
    return 0;
}


Compiler output:
a.cc:4:12: error: initializer-string for 'char [2]' is too long [-fpermissive]
    4 | char q[2]={"-+--"};
      |            ^~~~~~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

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

    for (int i = 0; i < 8; i++) {
        string exp;
        int calc = abcd[0] - '0';
        exp += abcd[0];
        for (int j = 1, k = 1; j < 8; j *= 2, k++) {
            if ((i & j) == j) {
                exp += '+';
                calc += abcd[k] - '0';
            }
            else {
                exp += '-';
                calc -= abcd[k] - '0';
            }
            exp += abcd[k];
        }
        if (calc == 7) {
            exp += "=7";
            cout << exp << endl;
            break;
        }
    }
    
    return 0;
}
\

Compiler output:
a.cc:57:1: error: stray '\' in program
   57 | \
      | ^
Language: C++

A,B,C,D;main(i){scanf("%1d%1d%1d%1d",&A,&B,&C,&D);for(i=1;i<9;i++)if(A+(i/8?-B:B)+(i/2%2?-C:C)+(i%2?-D:D)==7){char p[]={'+','-'};printf("%d%c%d%c%d%c%d=7\n",A,p[i/8],B,p[i/2%2],C,p[i%2],D);return 0;}}

Compiler output:
a.cc:1:1: error: 'A' does not name a type
    1 | A,B,C,D;main(i){scanf("%1d%1d%1d%1d",&A,&B,&C,&D);for(i=1;i<9;i++)if(A+(i/8?-B:B)+(i/2%2?-C:C)+(i%2?-D:D)==7){char p[]={'+','-'};printf("%d%c%d%c%d%c%d=7\n",A,p[i/8],B,p[i/2%2],C,p[i%2],D);return 0;}}
      | ^
a.cc:1:13: error: expected constructor, destructor, or type conversion before '(' token
    1 | A,B,C,D;main(i){scanf("%1d%1d%1d%1d",&A,&B,&C,&D);for(i=1;i<9;i++)if(A+(i/8?-B:B)+(i/2%2?-C:C)+(i%2?-D:D)==7){char p[]={'+','-'};printf("%d%c%d%c%d%c%d=7\n",A,p[i/8],B,p[i/2%2],C,p[i%2],D);return 0;}}
      |             ^
Language: C++

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

int main(){
    int A, B, C, D;
    rep(i,4) scanf("%1d%1d%1d%1d", &A, &B, &C, &D);

    char ope[2] = {'+', '-'};
    rep(i,2) rep(j,2) rep(k,2)
        if( A + (i?-B:B) + (j?-C:C) + (k?-D:D) == 7 ){
            prinf("%d%c%d%c%d%c%d=7\n", A, ope[i], B, ope[j], C, ope[k], D);
            return 0;
        }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   11 |             prinf("%d%c%d%c%d%c%d=7\n", A, ope[i], B, ope[j], C, ope[k], D);
      |             ^~~~~
      |             printf
Language: C++

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


int main(){
    int A, B, C, D;
    rep(i,4) scanf("%1d%1d%1d%1d",&A,&B,&C,&D);

    char ope[2]={'+', '-'};
    rep(i,2) rep(j,2) rep(k,2)
        if( A + (i?-B:B) + (j?-C:C) + (k?-D:D) == 7 ){
            std::cout << A << ope[i] << B << ope[j] << C << ope[k] << D << "=7\n";
            return 0;
        }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: 'cout' is not a member of 'std'
   12 |             std::cout << A << ope[i] << B << ope[j] << C << ope[k] << D << "=7\n";
      |                  ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cstdio>
  +++ |+#include <iostream>
    2 | #define rep(i,n) for(int(i)=0; (i)<(n); (i)++)
Language: C++

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

int main(){
    int A, B, C, D;
    rep(i,4) scanf("%1d%1d%1d%1d",&A,&B,&C,&D);

    char ope[2]={'+', '-'};
    rep(i,2) rep(j,2) rep(k,2)
        if( A + (i?-B:B) + (j?-C:C) + (k?-D:D) == 7 ){
            cout << A << ope[i] << B << ope[j] << C << ope[k] << D << "=7\n";
            return 0;
        }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'cout' was not declared in this scope
   11 |             cout << A << ope[i] << B << ope[j] << C << ope[k] << D << "=7\n";
      |             ^~~~
Language: Java

import java.util.*;

public class TrainTicket {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String[] c = str.split("");
    String[] op = new String[4];
    op[3] = "=";
    int[] num = new int[4];
    int result = 0;
    StringBuilder answer = new StringBuilder();
    for(int i = 0; i < 4; i++) {
      num[i] = Integer.parseInt(c[i]);
    }
    outside: for(int i = 0; i < 2; i++) {
      for(int j = 0; j < 2; j++) {
        for(int k = 0 ; k < 2; k++) {
          if(i == 0) {
            op[0] = "+";
            result += (num[0] + num[1]);
          } else {
            op[0] = "-";
            result += (num[0] - num[1]);
          }
          if(j == 0) {
            op[1] = "+";
            result += num[2];
          } else {
            op[1] = "-";
            result -= num[2];
          }
          if(k == 0) {
            op[2] = "+";
            result += num[3];
          } else {
            op[2] = "-";
            result -= num[3];
          }
          if(result == 7) {
            for(int l = 0; l < 4; l++) {
              answer.append(Integer.toString(num[l]));
              answer.append(op[l]);
            }
            answer.append("7");
            System.out.println(answer);
            break outside;
          } else {
            result = 0;
          }
        }
      }
    }
  }
}


Compiler output:
Main.java:3: error: class TrainTicket is public, should be declared in a file named TrainTicket.java
public class TrainTicket {
       ^
1 error