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

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;

int main(void) {
	int N;
	int a[101];
	scanf("%d", &N);
	

	for (int i = 0; i < 100; i++) {
		a[i] = 0;
	}
	for (int i = 0; 4*i <= 100; i++) {
		for (int j = 0; 4 * i + 7 * j <= 100; j++) {
			a[4 * i + 7 * j] = 1;
		}
	}
	if (a[i] == 1) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

}









Compiler output:
a.cc: In function 'int main()':
a.cc:27:15: error: 'i' was not declared in this scope
   27 |         if (a[i] == 1) {
      |               ^
Language: C++

int main()
{
   
   int N;
   cin>>N;
   
   if(N<4)
   	cout<<"No";
   else
   {
   	int x=1;y=1;
   	int flag = 0;
   	for(x=0;x<=N/4;x++)
   	{
   		for(y=0;y<=N/7;y++)
   		{
   			if( (4*x + 7*y )==N )
   			{
   				flag = 1;
				break;	   			
   			}
   		}
   		if(flag==1)
   			break;
   	}
   	
   	if(flag==1)
   		cout<<"Yes";
   	else
   		cout<<"No";
   }
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: 'cin' was not declared in this scope
    5 |    cin>>N;
      |    ^~~
a.cc:8:9: error: 'cout' was not declared in this scope
    8 |         cout<<"No";
      |         ^~~~
a.cc:11:17: error: 'y' was not declared in this scope
   11 |         int x=1;y=1;
      |                 ^
a.cc:28:17: error: 'cout' was not declared in this scope
   28 |                 cout<<"Yes";
      |                 ^~~~
a.cc:30:17: error: 'cout' was not declared in this scope
   30 |                 cout<<"No";
      |                 ^~~~
Language: C++

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

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string ans = "No";
  cin >>N;
  for(int i=1;i<=25;i++0){
    if(i*4>100) break;
    for(int j = 1;j<=14;j++){
      int sum = i*4 + j*7;
      if(sum >100) break;
      if(N == sum) ans = "Yes";
    }
  }
  
  cout <<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: expected ')' before numeric constant
   26 |   for(int i=1;i<=25;i++0){
      |      ~                 ^
      |                        )
a.cc:26:25: error: expected ';' before ')' token
   26 |   for(int i=1;i<=25;i++0){
      |                         ^
      |                         ;
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<float.h>
using namespace std;


int main() {
    int n;
    cin >> n ;
    if (n < 11) {
        if (n == 4)cout << "Yes" << endl;
        else if (n == 7)cout << "Yes" << endl;
        else if (n == 8)cout << "Yes" << endl;
        else cout << "No" << endl;
   }
    else if (n == 11)cout << "Yes"<<endl;
    else if (n % 4 == 0)cout << "Yes" << endl;
    else if (n % 7 == 0)cot << "Yes" << endl;
    else if (n > 11) {
        if ((n - 11) % 4 == 0)cout << "Yes" << endl;
        else if ((n - 11) % 7 == 0)cout <<"Yes"<< endl;
        else cout << "No" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'cot' was not declared in this scope
   20 |     else if (n % 7 == 0)cot << "Yes" << endl;
      |                         ^~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
    cin>>n;
    if(n>8)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
    7 |     cin>>n;
      |          ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
		int c = 4;
		int d = 7;
		int flag = 0;
		if(n%4==0){flag=1};
		if(n%7==0){flag=1};
		if(n%11==0){flag=1};
		if(n%18==0){flag=1};
		if(n%29==0){flag=1};
		
		// 文字列の入力
		//String s = sc.next();
		// 出力
		if(flag==1)System.out.println("Yes");
		else System.out.println("No");
	}
}

Compiler output:
Main.java:11: error: ';' expected
		if(n%4==0){flag=1};
		                 ^
Main.java:12: error: ';' expected
		if(n%7==0){flag=1};
		                 ^
Main.java:13: error: ';' expected
		if(n%11==0){flag=1};
		                  ^
Main.java:14: error: ';' expected
		if(n%18==0){flag=1};
		                  ^
Main.java:15: error: ';' expected
		if(n%29==0){flag=1};
		                  ^
5 errors
Language: C++

#include<cstdio>
#include<array>
#include<algorithm>
int main{
::std::array<unsigned int,10> a={1,2,3,5,6,9,10,11,13,17};
unsigned int n;
scanf("%u",&n);
puts(::std::find(a.cbegin(),a.cend(),n)==a.cend()?"Yes":"No");
return 0;
}

Compiler output:
a.cc:4:5: error: cannot declare '::main' to be a global variable
    4 | int main{
      |     ^~~~
a.cc:5:31: error: expected primary-expression before 'a'
    5 | ::std::array<unsigned int,10> a={1,2,3,5,6,9,10,11,13,17};
      |                               ^
a.cc:5:31: error: expected '}' before 'a'
a.cc:4:9: note: to match this '{'
    4 | int main{
      |         ^
a.cc:7:6: error: expected constructor, destructor, or type conversion before '(' token
    7 | scanf("%u",&n);
      |      ^
a.cc:8:5: error: expected constructor, destructor, or type conversion before '(' token
    8 | puts(::std::find(a.cbegin(),a.cend(),n)==a.cend()?"Yes":"No");
      |     ^
a.cc:9:1: error: expected unqualified-id before 'return'
    9 | return 0;
      | ^~~~~~
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
		int c = 4;
		int d = 7;
		int flag = 0;
		if(n%4==0){flag=1};
		if(n%7==0){flag=1};
		if(n%11==0){flag=1};
		if(n%18==0){flag=1};
		if(n%29==0){flag=1};
		
		// 文字列の入力
		//String s = sc.next();
		// 出力
		if(n==1)System.out.println("Yes");
		else System.out.println("No");
	}
}

Compiler output:
Main.java:11: error: ';' expected
		if(n%4==0){flag=1};
		                 ^
Main.java:12: error: ';' expected
		if(n%7==0){flag=1};
		                 ^
Main.java:13: error: ';' expected
		if(n%11==0){flag=1};
		                  ^
Main.java:14: error: ';' expected
		if(n%18==0){flag=1};
		                  ^
Main.java:15: error: ';' expected
		if(n%29==0){flag=1};
		                  ^
5 errors
Language: C++

#include<bits/stdc++.h>

using namespace std;
int main(){
  int a;
  cin >> a;
  if(0<a<4){
    cout << "No" << endl;
  }
  else if(4<a<7){
    cout << "No" << endl;
  }
  else if(8<a<11){
    cout << "No" << endl;
  }
  else if(a==13){
    cout << "No" << endl;
  }
  else if(a==17){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}
#include<bits/stdc++.h>

using namespace std;
int main(){
  int a;
  cin >> a;
  if(0<a<4){
    cout << "No" << endl;
  }
  else if(4<a<7){
    cout << "No" << endl;
  }
  else if(8<a<11){
    cout << "No" << endl;
  }
  else if(a==13){
    cout << "No" << endl;
  }
  else if(a==17){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


Compiler output:
a.cc:29:5: error: redefinition of 'int main()'
   29 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: C++

#include <iostream>

using namespace std;

int main(){
	int n,k,d;
	cin >> n;
	for(int i=0;i<100,i++){
		for(int j=0;j<100;j++){
			if(4*i + j*7 == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:30: error: expected ';' before ')' token
    8 |         for(int i=0;i<100,i++){
      |                              ^
      |                              ;
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n,x;
  cin>>n;
  x=(n-n%4)/4
  if(n==4||n==7)cout<<"Yes"<<endl;
  else if(n<7)cout<<"No"<<endl;
  else if(n%4==3&&x==1)cout<<"Yes"<<endl;
  else if(n%4==6&&x==2)cout<<"Yes"<<endl;
  else if(n%4==2&&x==3)cout<<"Yes"<<endl;
  else if(n%4==5&&x==4)cout<<"Yes"<<endl;
  else if(n%4==1&&x==5)cout<<"Yes"<<endl;
  else if(n%4==4&&x==6)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: expected ';' before 'if'
    6 |   x=(n-n%4)/4
      |              ^
      |              ;
    7 |   if(n==4||n==7)cout<<"Yes"<<endl;
      |   ~~          
a.cc:8:3: error: 'else' without a previous 'if'
    8 |   else if(n<7)cout<<"No"<<endl;
      |   ^~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>

using namespace std;


int main(int argc, char* argv[]){
  int n;
  scanf("%d",&n);
  for(int i=0;i<=n;i++){
      int p = n-4*i;
      if(p%7==0){
        puts("Yes");
        return 0;
      }
  }

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:13:33: note: to match this '{'
   13 | int main(int argc, char* argv[]){
      |                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N == 4 || N == 7 || N == 11 || N == 12 || N == 14 || N == 15 || N == 16 || N => 18){
    cout << "Yes" << endl;
  }
  else{cout << "No" << endl;}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:84: error: expected primary-expression before '>' token
    6 |   if(N == 4 || N == 7 || N == 11 || N == 12 || N == 14 || N == 15 || N == 16 || N => 18){
      |                                                                                    ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    bool flag = false;
    for(int i = 0;i < 100; i+=4){
        for(int j = 0;j < 100; j+=7){
            if(n == i + j) flag = true;
        }
    }
    if(flag) cout << “Yes” << endl;
    else cout << “No” << endl;
    
    return 0;
}

Compiler output:
a.cc:14:22: error: extended character “ is not valid in an identifier
   14 |     if(flag) cout << “Yes” << endl;
      |                      ^
a.cc:14:22: error: extended character ” is not valid in an identifier
a.cc:15:18: error: extended character “ is not valid in an identifier
   15 |     else cout << “No” << endl;
      |                  ^
a.cc:15:18: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:14:22: error: '\U0000201cYes\U0000201d' was not declared in this scope
   14 |     if(flag) cout << “Yes” << endl;
      |                      ^~~~~
a.cc:15:18: error: '\U0000201cNo\U0000201d' was not declared in this scope
   15 |     else cout << “No” << endl;
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=0; 4*i<=N; i++){
    if((N-4*i)%7==0){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}

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

#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cassert>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

bool flag=0;

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n/4;i++)
        if((n-4*i)%7==0){flag=1;break;}
    puts(flag?"Yes":"No");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin>>n;
      |     ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include<cassert>
  +++ |+#include <iostream>
    8 | 
a.cc:21:5: error: 'puts' was not declared in this scope
   21 |     puts(flag?"Yes":"No");
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

const int N = 1234567;

int dp[1100];

int rec(int cur)
{
  if (cur == 0)
    return 1;
  if (cur < 0)
    return 0;
  if (dp[cur] != -1)
    return dp[cur];
  return dp[cur] = rec(cur - 4) | rec(cur - 7);
}

int main()
{
  int n;
  cin >> n;
  memset(dp, -1, sizeof dp);
  bool ans = rec(n);
  cout << (ans ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'memset' was not declared in this scope
   26 |   memset(dp, -1, sizeof dp);
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cmath>
  +++ |+#include <cstring>
    4 |
Language: C

#include<stdio.h>

int main(){
	int N;
	int flag=0;
	scanf("%d",&N);
	for(int i=0;i<=14;i++){
		if(n-i*7>=0 && (N-i*7)%4==0)flag=1;
	}
	if(flag==1)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:20: error: 'n' undeclared (first use in this function)
    8 |                 if(n-i*7>=0 && (N-i*7)%4==0)flag=1;
      |                    ^
main.c:8:20: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.Scanner;

public class Main{
public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();

  if(N>17||(N-7)%4==0||(N-14)%4==0){
    System.out.println("Yes");
  }else if(){
    System.out.println("No");
  }

}
}


Compiler output:
Main.java:10: error: illegal start of expression
  }else if(){
           ^
1 error
Language: C++

n = int(input())
ng = [1,2,3,5,6,9,10,13,17]
if n in ng:
    print('No')
else:
    print('Yes')


Compiler output:
a.cc:4:11: warning: multi-character character constant [-Wmultichar]
    4 |     print('No')
      |           ^~~~
a.cc:6:11: warning: multi-character character constant [-Wmultichar]
    6 |     print('Yes')
      |           ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  int i;

  for(i = 0;i*4 <= n;i++){
    if((n - i*4) % 7 == 0){
      cout << "Yes" << endl;
      break;
    }
  }

  if(i*4 > n){
    cout << "No" << endl;
  }

  return 0;


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

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin>>a;
    for(int i=0;i<=a/4;i++){
        for(int j=0;j<=a/7;j++){
            if(i*4+j*7==a){
                cout<<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected primary-expression before '<' token
    9 |                 cout<<<"Yes"<<endl;
      |                       ^
a.cc:9:29: error: invalid operands of types 'const char [4]' and '<unresolved overloaded function type>' to binary 'operator<<'
    9 |                 cout<<<"Yes"<<endl;
      |                        ~~~~~^~~~~~
Language: C++

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

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >>N;
  if(N%4%7==0) cout << "Yes" << endl;
  else cout <<"No"<<endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: expected ';' before '}' token
   26 |   else cout <<"No"<<endl
      |                         ^
      |                         ;
   27 | }
      | ~
Language: C

#include<stdio.h>

int main(){
	int N;
	flag=0;
	scanf("%d",&N);
	for(int i=0;i<=14;i++){
		if((N-i*7)%4==0)flag=1;
	}
	if(flag==1)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: 'flag' undeclared (first use in this function)
    5 |         flag=0;
      |         ^~~~
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
#define debug(x) cerr << #x << ": " << x << endl;
using namespace std;

int main(){

  int n;
  cin >> n;

  if(n<4){
    cout << "No" << endl;
    return 0;
  }
  if(n%4==0){
    cout << "Yes" << endl;
    return 0;
  }
  if(n%7==0){
    cout << "Yes" << endl;
    return 0;
  }
  if((n%4)%7==0){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl:
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: expected ';' before ':' token
   31 |   cout << "No" << endl:
      |                       ^
      |                       ;
Language: C++

using System;

namespace abc105_b
{
    class Program
    {
        static void Main(string[] args)
        {
            bool[] dp = new bool[200];
            dp[4] = true; dp[7] = true;
            for (int i = 8; i < 200; i++)
            {
                if (dp[i - 4] || dp[i - 7]) dp[i] = true;
            }
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(dp[n] ? "Yes" : "No");
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:7:26: error: 'string' has not been declared
    7 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
    7 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:18:6: error: expected ';' after class definition
   18 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void abc105_b::Program::Main(int*)':
a.cc:9:17: error: structured binding declaration cannot have type 'bool'
    9 |             bool[] dp = new bool[200];
      |                 ^~
a.cc:9:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:9:17: error: empty structured binding declaration
a.cc:9:20: error: expected initializer before 'dp'
    9 |             bool[] dp = new bool[200];
      |                    ^~
a.cc:10:13: error: 'dp' was not declared in this scope
   10 |             dp[4] = true; dp[7] = true;
      |             ^~
a.cc:15:21: error: expected primary-expression before 'int'
   15 |             int n = int.Parse(Console.ReadLine());
      |                     ^~~
a.cc:16:13: error: 'Console' was not declared in this scope
   16 |             Console.WriteLine(dp[n] ? "Yes" : "No");
      |             ^~~~~~~
Language: C++

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

int h[31]={1,-2,4,-8,16,-32,64,-128,256,-512,1024,-2048,4096,-8192,16384,-32768,65536,-131072,262144,-524288,1048576,-2097152,4194304,-8388608,16777216,-33554432,67108864,-134217728,268435456,-536870912,1073741824} ; 

void fun(string s,int idx,int sum){
	if (sum == num){
		if (sz(s)==0) s="0";
		reverse(s.begin(),s.end());
	 	cout << s << endl;
	 	exit(0);
	}
	if (sum>abs(num) or idx==31) return; 
	fun(s+'1',idx+1,sum+h[idx]) ; 
	fun(s+'0',idx+1,sum) ; 
}

inline void solve(){
	memset(dp,-1,sizeof(dp));
    scanf("%lld",&num); 
	fun("",0,0); 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Compiler output:
a.cc: In function 'void fun(std::string, long long int, long long int)':
a.cc:34:20: error: 'num' was not declared in this scope; did you mean 'sum'?
   34 |         if (sum == num){
      |                    ^~~
      |                    sum
a.cc:40:21: error: 'num' was not declared in this scope; did you mean 'sum'?
   40 |         if (sum>abs(num) or idx==31) return;
      |                     ^~~
      |                     sum
a.cc: In function 'void solve()':
a.cc:46:16: error: 'dp' was not declared in this scope
   46 |         memset(dp,-1,sizeof(dp));
      |                ^~
a.cc:47:19: error: 'num' was not declared in this scope; did you mean 'enum'?
   47 |     scanf("%lld",&num);
      |                   ^~~
      |                   enum
Language: C++

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

int main(){
  long n;
  cin >> n;
  string ans = "";
  while(n){
    if(n%2==0){
      ans.push_back('0');
    }else{
      ans.push_back('1');
      n -= 1;
    }
    n /= (-2);
  }
  if(int(ans.size())==0)ans.push_back("0");
  rep(i,int(ans.size())){
    cout << ans[int(ans.size())-1-i];
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:39: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   19 |   if(int(ans.size())==0)ans.push_back("0");
      |                                       ^~~
      |                                       |
      |                                       const char*
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int n;
  cin >> n;
  string ans = n ==  ? "0" : "";
  while(n != 0)
  {
    ans += (n % 2 == 0 ? '0' : '1');
    n -= (n % 2 == 0 ? 0 : 1);
    n /= -2;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:16:22: error: expected primary-expression before '?' token
   16 |   string ans = n ==  ? "0" : "";
      |                      ^
Language: C++

#include<bits/stdc++.h>

#define ll long long
#define mod 1000000007

using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a=-2,b;
    cin>>n;b=n
    string s;
    while(n!=0){
        if((n%a)<0){s+=(2+(n%a))+'0';n/=a;n+=1;}
        else {s+=(n%a)+'0';n/=a;}
    }
    reverse(s.begin(),s.end());
    if(b!=0)cout<<s<<endl;
    else cout<<0<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: expected ';' before 'string'
   15 |     cin>>n;b=n
      |               ^
      |               ;
   16 |     string s;
      |     ~~~~~~     
a.cc:18:21: error: 's' was not declared in this scope
   18 |         if((n%a)<0){s+=(2+(n%a))+'0';n/=a;n+=1;}
      |                     ^
a.cc:19:15: error: 's' was not declared in this scope
   19 |         else {s+=(n%a)+'0';n/=a;}
      |               ^
a.cc:21:13: error: 's' was not declared in this scope
   21 |     reverse(s.begin(),s.end());
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ll n;
    cin >> n;
    vector<int> v;
    while(n) {
        v.push_back(n&1);
        n -= n&1;
        n /= -2;
    }
    for(int i=v.size()-1;i>=0;--i) {
        cout << v[i];
    }
    cout << endl;
}expression before ‘}’ token
 }

Compiler output:
a.cc:45:20: error: extended character ‘ is not valid in an identifier
   45 | }expression before ‘}’ token
      |                    ^
a.cc:45:22: error: extended character ’ is not valid in an identifier
   45 | }expression before ‘}’ token
      |                      ^
a.cc:45:2: error: 'expression' does not name a type
   45 | }expression before ‘}’ token
      |  ^~~~~~~~~~
a.cc:45:21: error: expected declaration before '}' token
   45 | }expression before ‘}’ token
      |                     ^
a.cc:45:22: error: '\U00002019' does not name a type
   45 | }expression before ‘}’ token
      |                      ^
a.cc:46:2: error: expected declaration before '}' token
   46 |  }
      |  ^
Language: Java



import java.util.Scanner;

// 基数変換　to-2進数
public class No105 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String s = "";

        while(N != 0) {
            int r = N % 2;
            if(r < 0) r += 2;
            N = (N) / (-2);

            s += r;
        }
        StringBuffer sb = new StringBuffer(s);
        String str = sb.reverse().toString();

        if(str.isEmpty()){
            str = "0";
        }
        System.out.println(str);
    }
}


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

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

int main(void){
    int N; cin >> N;
    int bit = 0;
    string answer = "";
    while(N){
        if (N % 2) {
            answer = "1" + answer;
        } else {
            answer = "0" + answer;
        }
        int r = N % 2;
        if (r < 0) r+=2;
        N -= r;
        N /= -2;
        bit++;
    };
    reverse(answer.begin(), answer.end());
    if(answer.empty()) {
        answer = "0";
    }
    cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'reverse' was not declared in this scope
   23 |     reverse(answer.begin(), answer.end());
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  string s="";
  while(N!==0){
  if(abs(N)%2==0){
  s='0'+s; N/=2;
  }else{
  s='1'+s; N=(1-N)/2;
  }
  }if(s=="")
    cout<<0<<endl;
  else
    cout<<s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected primary-expression before '=' token
    7 |   while(N!==0){
      |            ^
Language: C++

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

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

string base(int N, string S){
    if(N == 0){
        if(S == "") return "0";
        else return S;
    }

    if(N % 2 == 1){
        N--;
        return base(N / (-2), "1" + S)
    } else {
        return base(N / (-2), "0" + S)
    }
}

int main(){
    int N;
    cin >> N;
    cout << base(N, "") << endl;
}

Compiler output:
a.cc: In function 'std::string base(int, std::string)':
a.cc:22:39: error: expected ';' before '}' token
   22 |         return base(N / (-2), "1" + S)
      |                                       ^
      |                                       ;
   23 |     } else {
      |     ~                                  
a.cc:24:39: error: expected ';' before '}' token
   24 |         return base(N / (-2), "0" + S)
      |                                       ^
      |                                       ;
   25 |     }
      |     ~
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    String ans = "";
    if(n == 0) ans = "0";
    if(n != 0) {
      while(n != 0) {
        int n1 = Math.abs(n);
        if((n1 % 2) == 0) {
          ans = "0" + ans;
        } else {
          ans = "1" + ans;
        }
        n -= (n1 % 2);
        n /= (-2);
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
        int n1 = Math.abs(n);
                         ^
1 error
Language: Java

fun main() {
    val n = readLine()!!
    var numN = n.toLong()

    var ans = ""

    while(numN != 0L) {
        if(numN % 2 != 0L) {
            numN--;
            ans = "1$ans";
        } else {
            ans = "0$ans";
        }
        numN /= -2;
    }

    if(ans == "") {
        println("0");
    }else {
        println(ans);
    }

}



Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
fun main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:2: error: ';' expected
    val n = readLine()!!
                      ^
Main.java:3: error: ';' expected
    var numN = n.toLong()
                         ^
Main.java:5: error: ';' expected
    var ans = ""
                ^
4 errors
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}


int main() {
  ll n;cin >> n;
  if(!n){cout <<0;return 0;}
  string s;
  while(n!=1){
    s.pb(char(abs(n%2)+'0'));
    if(n>0)n=n/(-2);
    else n=(n-1)/(-2);
  }
  s.pb('1');
  reverse(ALL(s));
  cout <<s;
}s

Compiler output:
a.cc:34:2: error: 's' does not name a type
   34 | }s
      |  ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
    ll n;
    cin >> n;
    if (n == 0) {
        cout << 0;
    }
    else{vector<int> vec;
        nt count = 0;
        ll ret = 0;
        while (n) {
            if ((n%2 == 1)||(n%2 == -1)){
                vec.push_back(1);
                n -= 1;
            }
            else {
                vec.push_back(0);
            }
            n /= (-2);
           count++;
        }
        for (int i = vec.size() - 1; i >= 0; i--) {
            cout << vec[i];
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'nt' was not declared in this scope; did you mean 'n'?
   12 |         nt count = 0;
      |         ^~
      |         n
a.cc:23:12: error: 'count' was not declared in this scope
   23 |            count++;
      |            ^~~~~
Language: C++

#include<iostream>
#include<string>

int main(){
	int n;
	std::cin>>n;

	std::string str;

	if (n == 0) {
		std::cout << "0" << std:endl;
		exit(0);
	}

	while (n!=0) {
		if (n % 2 == 0) {
			str ="0"+str;
		}
		else {
			str = "1"+str;
			n--;
		}

		n/=-2;
	}

	std::cout<<str<<std::endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:40: error: found ':' in nested-name-specifier, expected '::'
   11 |                 std::cout << "0" << std:endl;
      |                                        ^
      |                                        ::
Language: C++

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

int main(){
    Int N; cin >> N;
    if(N == 0) {
        cout << 0 << endl; break;
    }

    Int pow2 = -2, cur = 0; string ans = "";
    while(cur != N){
        if((N-cur) % abs(pow2) == 0){
            ans += '0';
        } else {
            ans += '1'; cur += -pow2/2;
        }
        pow2 *= -2;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: break statement not within loop or switch
   10 |         cout << 0 << endl; break;
      |                            ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};



int main(){
 int N;
 cin >> N;
 vector<ll> ans;
 while(N != 0){
    int tmp = N % 2;
    if(tmp < 0) tmp += 2;

    N = (N - tmp) / (-2);
    ans.push_back(tmp);
 }
 reverse(all(ans));
  if(ans.empty()){
    print(0);
    return 0;
  }
 REP(i, ans.size()){
    cout << ans.(i)
 }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:137:17: error: expected unqualified-id before '(' token
  137 |     cout << ans.(i)
      |                 ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    ll n,cnt = 0;
    cin >> n;
    n = abs(n);
    bool even = true;
    if (n % 2 != 0) {
        n++;
        even = false;
    }
    string ans = "";
    while(n != 0){
        if (n % 2 == 0){
            ans = "0" + ans;
        }
        else {
            n--;
            ans = "1" + ans;
        }
        n /= -2;
    }
    if (ans = "") cout << 0 << endl;
    else cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'll lcm(ll, ll)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
a.cc: In function 'int main()':
a.cc:53:13: error: could not convert 'ans.std::__cxx11::basic_string<char>::operator=(((const char*)""))' from 'std::__cxx11::basic_string<char>' to 'bool'
   53 |     if (ans = "") cout << 0 << endl;
      |         ~~~~^~~~
      |             |
      |             std::__cxx11::basic_string<char>
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  string ans="";
  while(n){
    if(n%(-2)==!){
      n--;
      ans='1'+ans;
    }
    else{
      ans='0'+ans;
    }
  }
  COUT(ans);
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: error: expected primary-expression before ')' token
   47 |     if(n%(-2)==!){
      |                 ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <stack>
#include <math.h>
#include <stdio.h>
#define ll long long
#define anf 0x3f3f3f3f
using namespace std;
/ar s[3]={'R','G','B'};
//int main()
//{
//    char str[11000];
//    int t;
//    cin>>t;
//    int n,k;
//    while(t--)
//    {
//        int num=0;
//        int mx=0;
//        cin>>n>>k;
//        for(int i=0;i<n;i++)
//            cin>>str[i];
//        for(int i=0;i<3;i++)
//        {
//            for(int j=0;j<n;j++)
//            {
//                if(j+k>n)
//                    break;
//                num=0;
//                int ii=i;int jj=j;
//                for(int l=0;l<k;l++)
//                {
//                    if(ii==3)
//                        ii=0;
//                    if(s[ii++]==str[jj++])
//                        num++;
//                }
//            mx=max(mx,num);
//            }
//        }
//        cout<<k-mx<<endl;
//    }
//    return 0;
//}
int main()
{
    ll n;
    stack<int>v;
    cin>>n;
    if(n==0)
        cout<<'0';
    while(n)
    {
        int a=abs(n%(-2));
        v.push(a);
        n=(n-a)/(-2);
    }
    while(!v.empty())
    {
        cout<<v.top();
        v.pop();
    }
    cout<<endl;
    return 0;
}


Compiler output:
a.cc:11:1: error: expected unqualified-id before '/' token
   11 | /ar s[3]={'R','G','B'};
      | ^
Language: C++

#include <iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define ll long long
#define maxn 500000
int num[maxn];
int main()
{
	int n;
	scanf("%d", &n);
	int sum = 0;
	if (n == 0) 
	{
		puts("0");
	}
	else
	{
		while (n)
		{
			if (n % 2 != 0)
			{
				num[++sum] = 1;
				n =n -/ (-2);
			}
			else {
				num[++sum] = 0;
				n = n / (-2);
			}
		}
		for (int i = sum; i >= 1; i--)
			printf("%d", num[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:39: error: expected primary-expression before '/' token
   26 |                                 n =n -/ (-2);
      |                                       ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

string n_ary_convert(long n, long ary){
    if(n == 0) return 0;
    string ans = "";
    while(n != 0){
        if(n < 0){
            long temp = -n % ary;
            ans += to_string(temp);
            n = n / ary;
            if(temp == 0) continue;
            if(ary < 0) n++;
            else n--; 
        }
        else{
            cout << n % ary << " ";
            ans += to_string(n % ary);
            n /= ary;
        }
        cout << n << endl;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main(){
    int N;
    cin >> N;
    cout << n_ary_convert(N, -2) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'std::string n_ary_convert(long int, long int)':
a.cc:25:5: error: 'reverse' was not declared in this scope
   25 |     reverse(ans.begin(), ans.end());
      |     ^~~~~~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int N, sumP = 0, sumN = 0, ans = 0, i = 0;

	cin >> N;

	while (N != 0)
	{
		if ((N <= pow(-2, i) + sumP || N <= pow(-2, i)) && N > 0)
		{
			ans += pow(10, i);
			N -= pow(-2, i);
			i = 0;
			continue;
		}
		else if((N >= pow(-2, i + 1) + sumN || N >= pow(-2, i + 1)) && N < 0)
		{
			ans += pow(10, i + 1);
			N -= pow(-2, i + 1);
			i = 0;
			continue;
		}

		sumP += pow(-2, i);
		sumN += pow(-2, i + 1);
		i += 2;
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'pow' was not declared in this scope
   13 |                 if ((N <= pow(-2, i) + sumP || N <= pow(-2, i)) && N > 0)
      |                           ^~~
a.cc:28:25: error: 'pow' was not declared in this scope
   28 |                 sumP += pow(-2, i);
      |                         ^~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  ll n;
  cin >> n;
  if(!n) {
    cout << 0 << endl;
    return 0;
  }
  string ans = "";
  while(n != 1) {
    if(n < 0 && n % 2) {
      n -= 2;
      n = (-n / 2);
      ans.push_back('1');
    } else if(n % 2) {
      n /= 2;
      n = -n;
      ans.push_back('1');
    } else {
      n /= 2;
      n = -n;
      ans.push_back('0');
    }
  }
  ans.push_back('1');
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: 'reverse' was not declared in this scope
   30 |   reverse(ans.begin(), ans.end());
      |   ^~~~~~~
Language: C++

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;cin>>n;
  string str="";
  while(n!=0){
    ll r=n%2;
    if(r<0) r+=2;
    n=(n-r)/(-2);
    str+=(char)('0'+r);
  }
  reverse(ALL(str));
  if(str="") cout<<0<<endl;
  else cout<<str<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:149:9: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)""))' from 'std::__cxx11::basic_string<char>' to 'bool'
  149 |   if(str="") cout<<0<<endl;
      |      ~~~^~~
      |         |
      |         std::__cxx11::basic_string<char>