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

//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  if(A > B) swap(A, B);
  int num = 0;
  rrep(i, A + 1){
    if(A % i == 0 && B % i == 0){
      num++;
      if(num == K){
        cout << i << endl;
        return 0;
      }
    }
  }
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

// C++ program to find kth common factor 
// of two numbers 
#include<iostream> 
using namespace std; 

// Returns k'th common factor of x and y. 
int findKCF(int x, int y, int k) 
{ 
// Find smaller of two numbers 
int small = min(x, y); 

// Count common factors until we either 
// reach small or count becomes k. 
int count = 1; 
for (int i=2; i<=small; i++) 
{ 
	if (x % i==0 && y % i == 0) 
		count++; 
	if (count == k) 
		return i; 
} 

// If we reached small 
return -1; 
} 

// Driver code 
int main() 
{ 
int x ,y,k; 
  cin >> x >> y >> k;
cout << findKHCF(x, y, k); 
return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'findKHCF' was not declared in this scope; did you mean 'findKCF'?
   32 | cout << findKHCF(x, y, k);
      |         ^~~~~~~~
      |         findKCF
Language: C++

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

constexpr int mod = 1e9 + 7;
constexpr int32_t inf = 1001001001;
constexpr int64_t infll = 1001001001001001001ll;
constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int a = in(), b = in();

  cout << a * b / __gcd(a, b) * k << endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:41:33: error: 'k' was not declared in this scope
   41 |   cout << a * b / __gcd(a, b) * k << endl;
      |                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b,c;
  cin >> a >> b >> c;
  for(int i=1; i<=100; i++) {
    if(a%i==0&&b%i==0) c--;
    if(!c) {
      pr(i);
      return 0;
    }
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Compiler output:
a.cc: In function 'void Main()':
a.cc:35:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   35 |       return 0;
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int length = input.size();
  int zero = 0;
  int one = 0;

  for(int i=0; i<length; i++) {
    if(S.at(i) == '0') zero++;
    else if(S.at(i) == '1') one++;
  }

  cout << 2*min(zero, one) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'input' was not declared in this scope; did you mean 'int'?
    7 |   int length = input.size();
      |                ^~~~~
      |                int
Language: C

import sys
import re
def INPUT_AS_INT(): return int(sys.stdin.readline().rstrip())
# def INPUT_AS_INT_LIST(): return list(map(int,sys.stdin.readline().rstrip().split()))
# def INPUT_AS_STRING(): return sys.stdin.readline().rstrip()
# def INPUT_AS_STRING_LIST(): return list(sys.stdin.readline().rstrip().split())

str = INPUT_AS_STRING() # 入力受付
_str = str #　結果と比較用
while True:
    tmp = str
    tmp = re.sub("10", "", tmp)
    tmp = re.sub("01", "", tmp)
    if str == tmp:
        break
    str = tmp

print(len(_str) - len(str))


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import sys
      | ^~~~~~
main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    2 | import re
      | ^~~~~~
main.c:2:1: error: unknown type name 'import'
main.c:4:3: error: invalid preprocessing directive #def; did you mean #ifdef?
    4 | # def INPUT_AS_INT_LIST(): return list(map(int,sys.stdin.readline().rstrip().split()))
      |   ^~~
      |   ifdef
main.c:5:3: error: invalid preprocessing directive #def; did you mean #ifdef?
    5 | # def INPUT_AS_STRING(): return sys.stdin.readline().rstrip()
      |   ^~~
      |   ifdef
main.c:6:3: error: invalid preprocessing directive #def; did you mean #ifdef?
    6 | # def INPUT_AS_STRING_LIST(): return list(sys.stdin.readline().rstrip().split())
      |   ^~~
      |   ifdef
main.c:8:25: error: stray '#' in program
    8 | str = INPUT_AS_STRING() # 入力受付
      |                         ^
main.c:9:12: error: stray '#' in program
    9 | _str = str #　結果と比較用
      |            ^
main.c:9:13: error: stray '\343' in program
    9 | _str = str #<U+3000><U+7D50><U+679C><U+3068><U+6BD4><U+8F03><U+7528>
      |             ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  string S;
  cin >> S;
  vector <int> cnt(2, 0);
  rep(i,S.length()){
     cnt[S[i] - '0'] ++;
  }
  int ans = 2 * min(cnt[0), cnt[1]);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: expected ']' before ')' token
   15 |   int ans = 2 * min(cnt[0), cnt[1]);
      |                          ^
      |                          ]
a.cc:15:20: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   15 |   int ans = 2 * min(cnt[0), cnt[1]);
      |                 ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:15:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |   int ans = 2 * min(cnt[0), cnt[1]);
      |                 ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int, int>>;

int main()
{
  string s;
  cin >> s;
  ll cnt_0 = 0,cnt_1 = 0;
  for (int i = 0; i < n;i++){
    if(s[i]=='0')
      cnt_0++;
      else
        cnt_1++;
      }
      
  }
  cout << min(cnt_0, cnt_1) * 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: 'n' was not declared in this scope
   16 |   for (int i = 0; i < n;i++){
      |                       ^
a.cc: At global scope:
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout << min(cnt_0, cnt_1) * 2 << endl;
      |   ^~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int, int>>;

int main()
{
  string s;
  cin >> s;
  ll cnt_0 = 0, ll cnt_1 = 0;
  for (int i = 0; i < n;i++){
    if(s[i]=='0')
      cnt_0++;
      else
        cnt_1++;
      }
      
  }
  cout << min(cnt_0, cnt_1) * 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: expected initializer before 'cnt_1'
   16 |   ll cnt_0 = 0, ll cnt_1 = 0;
      |                    ^~~~~
a.cc:17:23: error: 'n' was not declared in this scope
   17 |   for (int i = 0; i < n;i++){
      |                       ^
a.cc:21:9: error: 'cnt_1' was not declared in this scope; did you mean 'cnt_0'?
   21 |         cnt_1++;
      |         ^~~~~
      |         cnt_0
a.cc: At global scope:
a.cc:25:3: error: 'cout' does not name a type
   25 |   cout << min(cnt_0, cnt_1) * 2 << endl;
      |   ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define endl "\n"
#define oo 0x3f3f3f3f3f3f3f3fLL
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define setdp memset(dp,-1,sizeof(dp))
#define db(x) cout<<" LOOK "<<(#x)<<" = "<<x <<'\n'
#define NumofDigits(n)   ((long long)log10(n)+1)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};*/
inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}


int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    //File();
    string s;
    cin>>s;
    int ones=0,zeroes=0;
    for(int i=0;i<sz(s);i++)
    {
        if( s[i] == '1')ones++;
        else
            zeroes++;
    }
    cout<<min(ones,zeros)*2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:20: error: 'zeros' was not declared in this scope; did you mean 'zeroes'?
   56 |     cout<<min(ones,zeros)*2;
      |                    ^~~~~
      |                    zeroes
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
      	String[] list = s.split("");
      	int[] a = new int[s.length()];
		for(int i=0; i<s.length(); i++){
          a[i] = (int)list[i];
        }
      	int count0 = 0;
      	int count1 = 1;
      	for(int i=0; i<s.length(); i++){
          if(a[i]==0) count0++;
          if(a[i]==1) count1++;
        }
      	if(count0>=count1) System.out.println(count1);
      	if(count0<count1) System.out.println(count0);
	}
}

Compiler output:
Main.java:10: error: incompatible types: String cannot be converted to int
          a[i] = (int)list[i];
                          ^
1 error
Language: C

#include <stdio.h>

int main(void){

  int S[100000];
  long count0=0;
  long count1=0;
  
  for(int i=0;;i++){
  	if(scanf("%d",S[i]=="\n"){
    	break;
    }
  }
  
  for(int i=0;S[i]!=NULL;i++){
  	if(S[i]==0)count1++;
    if(S[i]==1)count1++;
  }
  
  if(count1<=count0)printf("%d",count0);
  if(count1<=count0)printf("%d",count0);
  
}


Compiler output:
main.c: In function 'main':
main.c:10:27: warning: comparison between pointer and integer
   10 |         if(scanf("%d",S[i]=="\n"){
      |                           ^~
main.c:10:34: error: expected ')' before '{' token
   10 |         if(scanf("%d",S[i]=="\n"){
      |           ~                      ^
      |                                  )
main.c:13:3: error: expected expression before '}' token
   13 |   }
      |   ^
main.c:15:19: warning: comparison between pointer and integer
   15 |   for(int i=0;S[i]!=NULL;i++){
      |                   ^~
Language: C

#include <stdio.h>

int main(void){

  int S[100000];
  long count0=0;
  long count1=0;
  
  for(int i=0;S[i]!=null;i++){
  	scanf("%d",S[i]);
  }
  
  for(int i=0;S[i]!=null;i++){
  	if(S[i]==0)count1++;
    if(S[i]==1)count1++;
  }
  
  if(count1<=count0)printf("%d",count0);
  if(count1<=count0)printf("%d",count0);
  
}

Compiler output:
main.c: In function 'main':
main.c:9:21: error: 'null' undeclared (first use in this function)
    9 |   for(int i=0;S[i]!=null;i++){
      |                     ^~~~
main.c:9:21: 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);
        char[] S = sc.next().toCharArray();

        int countRed = 0;
        int countBlue = 0;
        for(int i = 0; i < S.length; i++){
            if('0' == S[i]){
                countRed++;
            }
        }
        for(int i = 0; i < S.length; i++){
            if('1' == S[i]){
                countBlue++;
            }
        }

        system.out.println(Math.min(countRed,countBlue)*2);

    }
}

Compiler output:
Main.java:21: error: package system does not exist
        system.out.println(Math.min(countRed,countBlue)*2);
              ^
1 error
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();

        int countRed = 0;
        int countBlue = 0;
        for(int i = 0; i < S.length(); i++){
            if('0' == S[i]){
                countRed++;
            }
        }
        for(int i = 0; i < S.length(); i++){
            if('1' == S[i]){
                countBlue++;
            }
        }

        system.out.println(Math.min(countRed,countBlue)*2);

    }
}

Compiler output:
Main.java:10: error: cannot find symbol
        for(int i = 0; i < S.length(); i++){
                            ^
  symbol:   method length()
  location: variable S of type char[]
Main.java:15: error: cannot find symbol
        for(int i = 0; i < S.length(); i++){
                            ^
  symbol:   method length()
  location: variable S of type char[]
Main.java:21: error: package system does not exist
        system.out.println(Math.min(countRed,countBlue)*2);
              ^
3 errors
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scaneer sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();

        int countRed = 0;
        int countBlue = 0;
        for(int i = 0; i < S.length(); i++){
            if('0' == S[i]){
                countRed++;
            }
        }
        for(int i = 0; i < S.length(); i++){
            if('1' == S[i]){
                countBlue++;
            }
        }

        system.out.println(Math.min(countRed,countBlue)*2);

    }
}

Compiler output:
Main.java:5: error: cannot find symbol
    	Scaneer sc = new Scanner(System.in);
    	^
  symbol:   class Scaneer
  location: class Main
Main.java:10: error: cannot find symbol
        for(int i = 0; i < S.length(); i++){
                            ^
  symbol:   method length()
  location: variable S of type char[]
Main.java:15: error: cannot find symbol
        for(int i = 0; i < S.length(); i++){
                            ^
  symbol:   method length()
  location: variable S of type char[]
Main.java:21: error: package system does not exist
        system.out.println(Math.min(countRed,countBlue)*2);
              ^
4 errors
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scaneer sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();

        int countRed = 0;
        int countBlue = 0;
        for(int i = 0; i < S.length; i++){
            if('0' == S[i]){
                countRed++;
            }
        }
        for(int i = 0; i < S.length; i++){
            if('1' == S[i]){
                countBlue++;
            }
        }

        system.out.println(Math.min(countRed,countBlue)*2);

    }
}

Compiler output:
Main.java:5: error: cannot find symbol
    	Scaneer sc = new Scanner(System.in);
    	^
  symbol:   class Scaneer
  location: class Main
Main.java:21: error: package system does not exist
        system.out.println(Math.min(countRed,countBlue)*2);
              ^
2 errors
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scaneer sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();

        int countRed = 0;
        int countBlue = 0;
        for(int i = 0; i < S.length[]; i++){
            if('0' == S[i]){
                countRed++;
            }
        }
        for(int i = 0; i < S.length[]; i++){
            if('0' == S[i]){
                countBlue++;
            }
        }

        system.out.println(Math.min(countRed,countBlue)*2);

    }
}

Compiler output:
Main.java:10: error: '.class' expected
        for(int i = 0; i < S.length[]; i++){
                                     ^
Main.java:15: error: '.class' expected
        for(int i = 0; i < S.length[]; i++){
                                     ^
2 errors
Language: Java

import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S = keyboard.next();
		int z = 0;
		int o = 0;
		
		for(int s=0; s<S.length(); s++){
		if(S.charAt(s) == 0){
				z++;
		}else{
		o++;		
		}
		
		System.out.println(2*Math.min(z,o));
		keyboard.close();	
		
	}
}


Compiler output:
Main.java:23: error: reached end of file while parsing
}
 ^
1 error
Language: C++

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

int main() {
    string s;cin>>s;
    int n = s.size();
    
    int a[2];
    a[0] = a[1] = 0;
    rep(i,n){
        if(s[i]=='0')++a[0];
        if(s[i]=='1')++a[1];
    }
    cout<<2*min(a[0],a[1])<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'i' was not declared in this scope
   10 |     rep(i,n){
      |         ^
a.cc:10:5: error: 'rep' was not declared in this scope
   10 |     rep(i,n){
      |     ^~~
Language: C

/*  ex9_2
    Y_Aizaki  */

#include <stdio.h>
#include <stdlib.h>

#define SIZE 12000

typedef struct node{
    char elem;
    struct node *next;
}stack;

void push(stack **first, char elem);
char pop(stack) **first);

int main(void){
    stack *stk;
    char input[SIZE];
    char *input_p = input;
    int removed = 0; // 除かれたキューブの数

    scanf("%s", input_p);
    stk = NULL; // stkの初期化

    while (*input_p){ // inputを前から見ていくループ
        if (stk==NULL){ // stkが空の時
            push(&stk, *input_p);
        }
        else{ // stkに要素があるとき
            if (stk->elem != *input_p){ // inputで見ている要素と、stkの中身が違う時
                pop(&stk); // stkから消去
                removed += 2;
            }
            else{ // inputで見ている要素と、stkの中身が同じ時
                push(&stk, *input_p); // stkに追加
            }
        }
        input_p++;
    }

    printf("%d\n", removed);

    return 0;
}

void push(stack **first, char elem){
    stack *new = calloc(1, sizeof(stack));
    if (new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}


char pop(stack **first){
    char elem;
    stack *tmp = *first;
    if (tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;

    free(tmp);
    return elem;
}

Compiler output:
main.c: In function 'pop':
main.c:15:17: error: expected declaration specifiers before '*' token
   15 | char pop(stack) **first);
      |                 ^
main.c:17:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   17 | int main(void){
      |               ^
main.c:47:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   47 | void push(stack **first, char elem){
      |                                    ^
main.c:56:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   56 | char pop(stack **first){
      |                        ^
main.c:66: error: expected '{' at end of input
Language: C

/*ex9_2 hightierra*/
#include <stdio.h>
#include <stdlib.h>
#define LIMIT 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char cube;
    struct node *next;
}node;

//スタックのpush
void push(node **first, char cube){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->cube = cube;
    new->next = *first;
    *first = new;
}

//スタックのpop
char pop(node **first){
    char cube;
    node *tmp = *first;
    if(tmp == NULL){
        exit(1);
    }
    cube = tmp->cube;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return cube;
}

int main(void){
    int count=0,i;
    char cubic[LIMIT];
    //スタックの一番上
    node *first = NULL;
  	node *free = NULL;

    //キューブの積み方
    scanf("%s",cubic);

    //キューブを最後まで積むまでループ
    i=0;
    while(cubic[i] != '\0'){ 
        //積み方通りにキューブを積む       
        push(&first,cubic[i]);
        //もしも、前のキューブと今のキューブの色が異なったら両方を取り除く
        if(first->next != NULL && (first->cube != first->next->cube)){
            pop(&first);
            pop(&first);
            count += 2;
        }
        i++;
    }
    while(*first!=NULL){
    	free = first;
      	first = first->next;
      	free(free);
    }
    printf("%d\n",count);
    
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:59:17: error: invalid operands to binary != (have 'node' and 'void *')
   59 |     while(*first!=NULL){
      |           ~~~~~~^~
      |           |
      |           node
main.c:62:9: error: called object 'free' is not a function or function pointer
   62 |         free(free);
      |         ^~~~
main.c:41:15: note: declared here
   41 |         node *free = NULL;
      |               ^~~~
Language: C

/*  ex9_2
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}

int main(void){
    int i = 0,ans = 0;
    //入力を受け取る配列をヌル文字分まで確保
    char color,block[SIZE + 1];
    //最初のノードの指す先
    node *first = NULL;
    scanf("%s", block);
    //tmpを順番に見ていってもしスタックに何も入っていないかスタックの先頭と同じ色だったらスタックに入れていく。
    while(tmp[i] != '\0'){
        if(first == NULL || first->elem == block[i]){
            push(&first, block[i]);
        }else{
            pop(&first);
            ans += 2;
        }
        i++;
    }
    printf("%d\n", ans);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:44:11: error: 'tmp' undeclared (first use in this function)
   44 |     while(tmp[i] != '\0'){
      |           ^~~
main.c:44:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

/*  ex9_2
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}

int main(void){
    int i = 0,ans = 0;
    //入力を受け取る配列をヌル文字分まで確保
    char color,tmp[SIZE + 1];
    //最初のノードの指す先
    node *first = NULL;
    scanf("%s", tmp);
    //tmpを順番に見ていってもしスタックに何も入っていないかスタックの先頭と同じ色だったらスタックに入れていく。
    while(tmp[i] != '\0'){
        if(first == NULL || first.elem == tmp[i]){
            push(&first, tmp[i]);
        }else{
            pop(&first);
            ans += 2;
        }
        i++;
    }
    printf("%d\n", ans);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:45:34: error: 'first' is a pointer; did you mean to use '->'?
   45 |         if(first == NULL || first.elem == tmp[i]){
      |                                  ^
      |                                  ->
Language: C

/*  ex9_2
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}

int main(void){
    int i = 0,ans = 0;
    //入力を受け取る配列をヌル文字分まで確保
    char color,tmp[SIZE + 1];
    //最初のノードの指す先
    node *first = NULL;
    scanf("%s", tmp);
    //tmpを順番に見ていってもしスタックに何も入っていないかスタックの先頭と同じ色だったらスタックに入れていく。
    while(tmp[i] != '\0'){
        if(first == NULL || first == tmp[i]){
            push(&first, tmp[i]);
        }else{
            pop(&first);
            ans += 2
        }
        i++;
    }
    printf("%d\n", ans);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:45:35: warning: comparison between pointer and integer
   45 |         if(first == NULL || first == tmp[i]){
      |                                   ^~
main.c:49:21: error: expected ';' before '}' token
   49 |             ans += 2
      |                     ^
      |                     ;
   50 |         }
      |         ~
Language: C

/* ex9_2
   UMAboogie */
#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000

//リストのノードの定義
typedef struct node{
  char elem;
  struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
  //追加する分の領域を確保
  node *new = calloc(1, sizeof(node));
  if(new == NULL){
    exit(1); //確保できなかったら終了
  }
  new->elem = elem; //新しいノードの中身を追加
  new->next = *first;
  *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
  char elem;
  node *tmp = *first;
  if(tmp == NULL){
    exit(1);
  }
  elem = tmp->elem;
  *first = tmp->next;
  //取り出したノードのメモリを解放
  free(tmp);
  return elem;
}

int main(void){
  int count = 0,i = 0;
  node *first = NULL; //最初のノードの指す先
  char str[SIZE+1]; //入力を一時的に保存する配列を宣言
  scanf("%s",str); //入力
  while(str[i] != NULL){
    if(first == NULL || str[i] == first->elem){ //最初のキューブか前の色と同じ時
      push(&first,str[i]); //リストに追加
    }else{ //前の色と違う時
      pop(&first); //リストから取り出す
      count += 2; //取り除いた数を2加算
    }
    i ++
  }

  print("%d\n",count); //結果を出力
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:44:16: warning: comparison between pointer and integer
   44 |   while(str[i] != NULL){
      |                ^~
main.c:51:9: error: expected ';' before '}' token
   51 |     i ++
      |         ^
      |         ;
   52 |   }
      |   ~      
main.c:54:3: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   54 |   print("%d\n",count); //結果を出力
      |   ^~~~~
      |   printf
Language: C

/* ex9_2
   UMAboogie */
#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000

//リストのノードの定義
typedef struct node{
  char elem;
  struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
  //追加する分の領域を確保
  node *new = calloc(1, sizeof(node));
  if(new == NULL){
    exit(1); //確保できなかったら終了
  }
  new->elem = elem; //新しいノードの中身を追加
  new->next = *first;
  *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
  char elem;
  node *tmp = *first;
  if(tmp == NULL){
    exit(1);
  }
  elem = tmp->elem;
  *first = tmp->next;
  //取り出したノードのメモリを解放
  free(tmp);
  return elem;
}

int main(void){
  int count = 0,i = 0;
  node *first = NULL; //最初のノードの指す先
  char str[SIZE+1]; //入力を一時的に保存する配列を宣言
  scanf("%s",str); //入力
  while(str[i] != NULL){
    if(first == NULL || str[i] == first->elem){ //最初のキューブか前の色と同じ時
      push(&first,str[i]); //リストに追加
    }else{ //前の色と違う時
      pop(&first); //リストから取り出す
      count += 2; //取り除いた数を2加算
    }
    i ++
  }

  print(%d\n,count); //結果を出力
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:44:16: warning: comparison between pointer and integer
   44 |   while(str[i] != NULL){
      |                ^~
main.c:51:9: error: expected ';' before '}' token
   51 |     i ++
      |         ^
      |         ;
   52 |   }
      |   ~      
main.c:54:3: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   54 |   print(%d\n,count); //結果を出力
      |   ^~~~~
      |   printf
main.c:54:9: error: expected expression before '%' token
   54 |   print(%d\n,count); //結果を出力
      |         ^
main.c:54:11: error: stray '\' in program
   54 |   print(%d\n,count); //結果を出力
      |           ^
Language: C

#include <stdio.h>
#include <stdlib.h>

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) return '\0';
    elem = tmp->elem;
    *first = tmp->next;
    free(tmp);
    return elem;
}

void free_stack(node **first){
    node *tmp=*first,*next;
    while(tmp!=NULL){
        next=tmp->next;
        free(tmp);
        tmp=next;
    }
}

Compiler output:
main.c: In function 'push':
main.c:15:15: error: assignment to 'struct node *' from incompatible pointer type 'node **' [-Wincompatible-pointer-types]
   15 |     new->next = first;
      |               ^
Language: C

/*ex 9_2
  saitomo*/
#include <stdio.h>
#include <stdlib.h>

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}

int main(void){
    int count=0;
    char cube_color[SIZE];
    scanf("%s", cube_color);
    //最初のノードの指す先
    node *first = NULL;
    //キューブを積み上げていく
    for(int i=0; i<strlen(cube_color); i++){
        if(first == NULL || first->elem == cube_color[i]){//色が同じなら単純に積み上げ
            push(&first, cube_color[i]);
        }else{//違うなら一つ取り除きカウントを2あげる
            pop(&first);
            count=count+ 2;
        }
    }
    printf("%d\n",count);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:36:21: error: 'SIZE' undeclared (first use in this function)
   36 |     char cube_color[SIZE];
      |                     ^~~~
main.c:36:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:41:20: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   41 |     for(int i=0; i<strlen(cube_color); i++){
      |                    ^~~~~~
main.c:5:1: note: include '<string.h>' or provide a declaration of 'strlen'
    4 | #include <stdlib.h>
  +++ |+#include <string.h>
    5 | 
main.c:41:20: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   41 |     for(int i=0; i<strlen(cube_color); i++){
      |                    ^~~~~~
main.c:41:20: note: include '<string.h>' or provide a declaration of 'strlen'
Language: C

/*ex9-2 C- Unification
ryo_1129*/

#include <stdio.h>
#include <stdlib.h>
#define SIZE 100000
//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

void pop(node **first);
void push(node **first, char elem);

int main(void){
    int counter=0;
    char cube[SIZE+1];
    scanf("%s", str);
    //最初のノードの指す先
    node *first = NULL;
    //キューブを積み上げていく
    for(int i=0; cube[i] != '\0'; i++){
        //同じ色が連続するか、キューブがない場合
        if(first == NULL || first->elem == cube[i]){
            push(&first, cube[i])
        //色が異なる場合
        }else{
            pop(&first);
            counter += 2;
        }
    }
    printf("%d\n",counter);

    return 0;
}

//スタックにデータを追加
void push(node **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り除く
void pop(node **first){
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    *first = tmp->next;
    //取り除いたノードのメモリを解放
    free(tmp);
}

Compiler output:
main.c: In function 'main':
main.c:19:17: error: 'str' undeclared (first use in this function)
   19 |     scanf("%s", str);
      |                 ^~~
main.c:19:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:34: error: expected ';' before '}' token
   26 |             push(&first, cube[i])
      |                                  ^
      |                                  ;
   27 |         //色が異なる場合
   28 |         }else{
      |         ~
Language: C

/*  ex9_2
    takafumi_ueki */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 100001
//リストのノードの定義
typedef struct node{
    char elem;
    struct node *next;
}node;
//プロトタイプ宣言
void push(node **first, char elem);
char pop(node **first);

int main(void){
    char cubes[SIZE],top;
    int i,num;
    int count = 0;
    //リストの先頭が指す先
    node *first = NULL;
    //cubeの状態を入力する
    scanf("%s",cubes);
    num = strlen(cubes);
    //状態の読み込み
    for(int i=0; i<num; i++)
        //空であればpushする。
        //追加予定の要素が先頭の要素と同じであればスタックにノードを追加する
        if(first == NULL || first->elem == cubes[i]){
            push(&first, cube[i]);
        }
        //異なっている場合はスタックの先頭ノードを取り出す
        else if(first->elem != cube[i]){
            top = pop(&first);
            count += 2;
        }
    //結果を出力する
    printf("%d\n", count);
    return 0;
}
//スタックにデータを追加する
void push(node **first, char elem){
    //領域の確保
    node *new = calloc(1, sizeof(node));
    if (new == NULL){
        exit(1);
    }
    new->elem = elem;
    new->next = *first;
    *first = new;
}
//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if (tmp == NULL){
        exit(1);
    }
    elem = tmp->elem;
    *first = tmp->next;
    //メモリを解放する
    free(tmp);
    return elem;
}

Compiler output:
main.c: In function 'main':
main.c:30:26: error: 'cube' undeclared (first use in this function); did you mean 'cubes'?
   30 |             push(&first, cube[i]);
      |                          ^~~~
      |                          cubes
main.c:30:26: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

/* ex 9_2
series2 */
#include <stdio.h>
#include <stdlib.h>

//リストのノード（スタック内の各データ）の定義
typedef struct node {
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem) {
    //追加する分の領域を確保
    node *newnode = calloc(1, sizeof(node));
    if (newnode == NULL) exit(1);
    newnode->elem = elem;
    newnode->next = *first;
    *first = newnode;
}

//スタックからデータを取り出す
char pop(node **first) {
    char elem;
    node *tmp = *first;
    if (tmp == NULL) {
        elem = '\0';
    } else {
        elem = tmp->elem;
        *first = tmp->next;
        //取り出したノードのメモリを解放
        free(tmp);
    }

    return elem;
}

int main(void) {
    int count = 0;
    //最初のノードの指す先
    node *first = NULL;
    char inp;
    scanf("%c", &inp);
    while (inp != '\n') {  //入力文字が終了するまで読み取る
        char under = pop(&first);  //読み込みをしている一つ前の文字を取り出す
        if (under == '\0') {  //取り出せない時、入力文字を追加する
            push(&first, inp);
        } else if (
            under ==
            inp) {  //取り出せる時で文字が一致する時、取り出した文字を戻し、入力文字も追加
            push(&first, under);
            push(&first, inp);
        } else {  //文字が不一致の時、削除
            count += 2;
        }
        scanf("%c", &inp);
    }
    printf("%d\n", count);
    return 0;
}

Compiler output:
a.cc: In function 'void push(node**, char)':
a.cc:15:27: error: invalid conversion from 'void*' to 'node*' [-fpermissive]
   15 |     node *newnode = calloc(1, sizeof(node));
      |                     ~~~~~~^~~~~~~~~~~~~~~~~
      |                           |
      |                           void*
Language: C++

/* ex 9_2
series2 */
#include <stdio.h>
#include <stdlib.h>

//リストのノード（スタック内の各データ）の定義
typedef struct node {
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node **first, char elem) {
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if (new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first) {
    char elem;
    node *tmp = *first;
    if (tmp == NULL) {
        elem = '\0';
    } else {
        elem = tmp->elem;
        *first = tmp->next;
        //取り出したノードのメモリを解放
        free(tmp);
    }

    return elem;
}

int main(void) {
    int count = 0;
    //最初のノードの指す先
    node *first = NULL;
    char inp;
    scanf("%c", &inp);
    while (inp != '\n') {  //入力文字が終了するまで読み取る
        char under = pop(&first);//読み込みをしている一つ前の文字を取り出す
        if (under == '\0') { //取り出せない時、入力文字を追加する
            push(&first, inp);
        } else if (under == inp) { //取り出せる時で文字が一致する時、取り出した文字を戻し、入力文字も追加
            push(&first, under);
            push(&first, inp);
        } else {   //文字が不一致の時、削除
            count += 2;
        }
        scanf("%c", &inp);
    }
    printf("%d\n", count);
    return 0;
}

Compiler output:
a.cc: In function 'void push(node**, char)':
a.cc:15:11: error: expected unqualified-id before 'new'
   15 |     node *new = calloc(1, sizeof(node));
      |           ^~~
a.cc:16:13: error: expected type-specifier before '==' token
   16 |     if (new == NULL) exit(1);
      |             ^~
a.cc:17:8: error: expected type-specifier before '->' token
   17 |     new->elem = elem;
      |        ^~
a.cc:18:8: error: expected type-specifier before '->' token
   18 |     new->next = *first;
      |        ^~
a.cc:19:17: error: expected type-specifier before ';' token
   19 |     *first = new;
      |                 ^
Language: C

/*  ex9_2 Stack Cubes
    pandacodeb  */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE 100001

//スタック (単方向リストで定める)
typedef struct node{
    char color;
    struct node *next;
}node;

void push(node **first, char color){
    node *new = calloc(1, sizeof(node));
    if (new == NULL)
        exit(1);
    new->color = color;
    new->next = *first;
    *first = new;
}

char pop(node **first){
    char color;
    node *tmp = *first;
    if (tmp == NULL)
        exit(1);
    color = tmp->color;
    *first = tmp->next;
    free(tmp);
    return color;
}

int main(void){
    char *cubes, top;
    int count = 0, length;

    //キューブの並びを入力
    cubes = (char*) malloc(sizeof(char)*SIZE);
    scanf("%s", cubes);
    length = strlen(cubes);

    node *first = NULL;         //スタックを宣言
    push(&first, cubes[0]);　   //最初のキューブをスタックに push
    for (int i = 1; i < length; i++){
        if (first == NULL)          //スタックは空の場合
            push(&first, cubes[i]); //候補のキューブをスタックに入れる
        else{
            top = pop(&first);      //スタックの最上のキューブ (top) を pop する
            if (top == cubes[i]){   //top と候補のキューブの色が同じ場合
                push(&first, top);  //top のキューブをスタックに戻す
                push(&first, cubes[i]); //候補のキューブをスタックに入れる
            }
            else                    //top と候補のキューブの色が違う場合
                count+=2;           //何もスタックに入れない、取り除けるキューブの数を数える
        }
    }

    //最大で取り除けるキューブの数を出力
    printf("%d\n", count);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:46:28: error: stray '\343' in program
   46 |     push(&first, cubes[0]);<U+3000>   //<U+6700><U+521D><U+306E><U+30AD><U+30E5><U+30FC><U+30D6><U+3092><U+30B9><U+30BF><U+30C3><U+30AF><U+306B> push
      |                            ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main () {
  string S;
  cin >> S;
  int memo = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) = '1') {
      memo++;
    }
  }
  cout << min(S.size() - memo, memo) * 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: no matching function for call to 'min(std::__cxx11::basic_string<char>::size_type, int&)'
   13 |   cout << min(S.size() - memo, memo) * 2 << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:13:14: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   13 |   cout << min(S.size() - memo, memo) * 2 << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:13:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   13 |   cout << min(S.size() - memo, memo) * 2 << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

bool pairCompare(const pair<int, int> & f, const pair<int, int> & s)
{
    return f.first < s.first;
}

int main()
{
    int ans;
    string s;

    cin >> s;

    queue<int> q;
    ans = 0;
    if (s.size() == 1) {
        cout << "0" << endl;
        return 0;
    }

    rep(i, s.size()) {
        if (!q.empty()) {
            if (q.front() != s[i]) {
                q.pop();
                ++ans;
                ++i;
                continue;
            }
        }
        if (s[i] != s[i + 1]) {
            ++ans;
            ++i;
        }
        else {
            q.push(s[i]);
        }
    }

    cout << ans*2 << endl;
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:45:14: error: expected '}' at end of input
   45 |     return 0;
      |              ^
a.cc:13:1: note: to match this '{'
   13 | {
      | ^