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

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"

using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;

int main(){
    bigint p2[100001] = { 0 }, p3[100001] = { 0 } ;
    p2[0] = 1 , p3[0] = 1 ;
    for( int i = 1 ; i < 100001 ; i++ )
        p2[i] = ( p2[i-1] * 2 ) % mod ;
    for( int i = 1 ; i < 100001 ; i++ )
        p3[i] = ( p3[i-1] * 3 ) % mod ;
    string str ; cin >> str ;
    int N = ( int ) str.length() ;
    int cnt = 0 ;
    bigint ans = 0 ;
    for( int i = 0 ; i < N ; i++ ){
        if( str[i] == '1' ){
            ans += ( p2[cnt] * p3[N-i-1] ) % mod ) %= mod ;
            cnt++ ;
        }
    }
    (ans += p2[cnt]) %= mod ;
    cout << ans << endl ;
    return 0 ;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:50: error: expected ';' before ')' token
   26 |             ans += ( p2[cnt] * p3[N-i-1] ) % mod ) %= mod ;
      |                                                  ^
Language: C

#include<stdio.h>
#include<string.h>
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxx = 1e6 + 7;
ll dp[maxx][3];
char a[maxx];
int main()
{
	ll i, j, k, n, m, x, y;
	scanf("%s", a + 1);
	n = strlen(a + 1);
	dp[0][1] = 1;
	for (i = 1; i <= n; i++)
	{
		dp[i][0] = (dp[i - 1][0] * 3) % mod;
		if (a[i] == '1')
		{
			dp[i][1] = (dp[i - 1][1] * 2) % mod;
			dp[i][0] = (dp[i][0] + dp[i - 1][1]) % mod;
		}
		else dp[i][1] = dp[i - 1][1];
	}
	printf("%lld\n", (dp[n][1] + dp[n][0]) % mod);
	return 0;
}

Compiler output:
main.c:6:4: error: variably modified 'dp' at file scope
    6 | ll dp[maxx][3];
      |    ^~
main.c:7:6: error: variably modified 'a' at file scope
    7 | char a[maxx];
      |      ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1000000007;
const int MOD = 1000000007;
template <int MOD>
struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) v += MOD;
  }
  constexpr int getmod() { return MOD; }
  constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
  constexpr Fp operator+(const Fp& r) const noexcept { return Fp(*this) += r; }
  constexpr Fp operator-(const Fp& r) const noexcept { return Fp(*this) -= r; }
  constexpr Fp operator*(const Fp& r) const noexcept { return Fp(*this) *= r; }
  constexpr Fp operator/(const Fp& r) const noexcept { return Fp(*this) /= r; }
  constexpr Fp& operator+=(const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator-=(const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator*=(const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator/=(const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator==(const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator!=(const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator<<(ostream& os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr istream& operator>>(istream& is, Fp<MOD>& x) noexcept {
    return is >> x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};


    using mint = Fp<MOD>;

int main() {
  string l;
  cin >> l;
  mint res = 0;
  ll num = 0;
  for (int i = 0; i < (int)l.length(); i++) {
    int len = (int)l.length() - i - 1;
    if (l[i] == '1') {
      res += modpow(mint(2), num) * modpow(mint(3), len);
      num++;
    }
  }
  res += modpow(mint(2), num);
  cout << res << endl;
}


Compiler output:
a.cc:67:1: error: stray '\16' in program
   67 | <U+000E>
      | ^~~~~~~~
Language: C++

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const ll md = 1000000007;

const int N = 100005;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    string s;
    cin >> s;
    arr[SZ(s)] = 1;
    ll ans = 0;
    ll acc = 1;
    FORD(i, SZ(s) - 1, 0) {
        if (s[i] == '1') {
            ans = (2 * max(ans, (ll) 1)) % md;
            ans = (ans + acc) % md;
        }         
        acc = (acc * 3) % md;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'arr' was not declared in this scope
   37 |     arr[SZ(s)] = 1;
      |     ^~~
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#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) (ll)(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>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
ll dp[100005][2];
int main(){
  ll s;
  cin>>s;
  ll n=sz(s);
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  rep(i,n)rep(j,2){
    {//a+b==0
      if(s[i]=='0'){
        dp[i+1][0]+=dp[i][0];
        dp[i+1][1]+=dp[i][1];
        dp[i+1][0]%=MOD;
        dp[i+1][1]%=MOD;
      }
      else{
        dp[i+1][1]+=dp[i][0]+dp[i][1];
        dp[i+1][1]%=MOD;
      }
    }
    {
      if(s[i]=='0'){
        dp[i+1][1]+=dp[i][1]*2;
        dp[i+1][1]%=MOD;
      }
      else{
        dp[i+1][0]+=dp[i][0]*2;
        dp[i+1][1]+=dp[i][1]*2;
        dp[i+1][0]%=MOD;
        dp[i+1][1]%=MOD;
      }
    }
  }
  COUT((dp[n][0]+dp[n][1])%MOD);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: request for member 'size' in 's', which is of non-class type 'long long int'
   28 | #define sz(x) (ll)(x).size()
      |                       ^~~~
a.cc:53:8: note: in expansion of macro 'sz'
   53 |   ll n=sz(s);
      |        ^~
a.cc:58:11: error: invalid types 'long long int[long long int]' for array subscript
   58 |       if(s[i]=='0'){
      |           ^
a.cc:70:11: error: invalid types 'long long int[long long int]' for array subscript
   70 |       if(s[i]=='0'){
      |           ^
Language: C++

L = input()
n = len(L)

onecnt = 0
ans = 0

MOD = 10 ** 9 + 7

for i in range(n):
    if L[i] == '0':continue
    onecnt += 1
    rest = n - i - 1
    ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD
    ans %= MOD
ans += pow(2, onecnt, MOD)
print(ans % MOD)


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

#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001;
const int NMAX=8;
const int mod=1000000007;


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}




int main()
{
  string l;
  cin>>l;
  int n=l.size();
  int d[n+5][2];
  rep(i,n+1)rep(j,2)d[i][j]=0;
  d[0][0]=1;
  d[0][1]=0;
  //d[n][0]が一致、d[n][1]が未満
  rep(i,n){
    if (l[i]=='1'){
    //  cout<<'1'<<endl;
      d[i+1][0]=(d[i][0])%mod;
      d[i+1][0]=d[i+1][0]%mod＋d[i+1][0]%mod；
　　　　d[i+1][0]=d[i+1][0]%mod;
      d[i+1][1]=d[i][0]%mod;
      d[i+1][1]+=d[i][1]%mod;
      d[i+1][1]+=d[i][1]%mod;
      d[i+1][1]+=d[i][1]%mod;

      d[i+1][1]=d[i+1][1]%mod;
    }
    if (l[i]=='0'){
      d[i+1][0]=(d[i][0])%mod;

      d[i+1][1]=d[i][1]%mod;
      d[i+1][1]＋=d[i][1]%mod;
      d[i+1][1]＋=d[i][1]%mod;

      d[i+1][1]=d[i+1][1]%mod;

    }
  //  cout<<d[i+1][0]<<" 0"<<endl;
  //  cout<<d[i+1][1]<<" 1"<<endl;
  }
  int ans=d[n][0]+d[n][1];
  ans=ans%mod;
  cout<<ans;



}


Compiler output:
a.cc:62:1: error: extended character 　 is not valid in an identifier
   62 | 　　　　d[i+1][0]=d[i+1][0]%mod;
      | ^
a.cc:62:1: error: extended character 　 is not valid in an identifier
a.cc:62:1: error: extended character 　 is not valid in an identifier
a.cc:62:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:61:27: error: 'mod\U0000ff0bd' was not declared in this scope
   61 |       d[i+1][0]=d[i+1][0]%mod＋d[i+1][0]%mod；
      |                           ^~~~~~
a.cc:61:42: error: 'mod\U0000ff1b' was not declared in this scope
   61 |       d[i+1][0]=d[i+1][0]%mod＋d[i+1][0]%mod；
      |                                          ^~~~~
a.cc:74:16: error: expected ';' before '\U0000ff0b'
   74 |       d[i+1][1]＋=d[i][1]%mod;
      |                ^~
      |                ;
a.cc:75:16: error: expected ';' before '\U0000ff0b'
   75 |       d[i+1][1]＋=d[i][1]%mod;
      |                ^~
      |                ;
Language: C++

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//modint
template<typename T> T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		T t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
template<typename T> T modpow(T x, int k) {
	if (k == 0)return 1;
	if (k % 2 == 0) return modpow(x * x, k / 2);
	else return x * modpow(x, k - 1);
}

template<int mod> class modint {
public:
	ll val;
	modint(ll a) {
		val = a % mod;
	}
	modint operator+(const modint& r) {
		return modint((this->val + r.val) % mod);
	}
	modint operator-(const modint& r) {
		return modint((this->val - r.val) % mod + ((this->val - r.val) % mod < 0) * mod);
	}
	modint operator*(const modint& r) {
		return modint((((this->val % mod) * (r.val % mod))) % mod);
	}
	modint operator/(const modint& r) {
		return modint(this->val * modinv<ll>(r.val, mod) % mod);
	}
	modint& operator+=(const modint& r) {
		*this = *this + r;
		return *this;
	}
	modint& operator-=(const modint& r) {
		*this = *this - r;
		return *this;
	}
	modint& operator*=(const modint& r) {
		*this = *this * r;
		return *this;
	}
	modint& operator/=(const modint& r) {
		*this = *this / r;
		return *this;
	}

};
modint<MOD> ans = 0;


int main() {
	string L;
	cin >> L;
	
	modint<MOD> mul = 1;
	for (int i = 0; i < L.size(); i++){
		if (i == 0 && L[i] == '1')mul *= 2;
		else if (L[i] == '1') {
			ans += mul * modpow(3, L.size() - i - 1);
			mul *= 2;
		}
		if (i == L.size() - 1)ans += mul;
	}
	for (int i = 1; i < L.size(); i++) {
		ans += 2 * modpow(modint<MOD>3, i - 1);
	}
	cout << ans.val + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:46: error: expected primary-expression before numeric constant
   84 |                 ans += 2 * modpow(modint<MOD>3, i - 1);
      |                                              ^
Language: Java

import java.util.*;

public class Main {
    static int MOD = 1000000007;
    
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char c[] = str.toCharArray();
        int n = c.length;
        
        // dp[n][0] + dp[n][1] = n桁までで非0がm個ある数の個数
        long[][] dp = new long[n+1][2];
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < 2; k++) {
                int d = c[i] - '0';
                
                if (k == 0) {
                    if (d == 0) {
                        dp[i+1][0] += dp[i][k]
                        dp[i+1][0] %= MOD;
                    } else {
                        dp[i+1][0] += (dp[i][k] * 2) % MOD;
                        dp[i+1][0] %= MOD;
                        dp[i+1][1] += dp[i][k]
                        dp[i+1][1] %= MOD;
                    }
                } else {
                    dp[i+1][1] += (dp[i][k] * 3) % MOD;
                    dp[i+1][1] %= MOD;
                }
            }
        }
        
        System.out.println((dp[n][0] + dp[n][1]) % MOD);
    }
}

Compiler output:
Main.java:22: error: ';' expected
                        dp[i+1][0] += dp[i][k]
                                              ^
Main.java:27: error: ';' expected
                        dp[i+1][1] += dp[i][k]
                                              ^
2 errors
Language: C++

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


int main() {
  string l;cin>>l;
  int n=l.size();
  int dp[n+5][2];
  rep(i,n+5)rep(j,2)dp[i][j]=0;
  dp[0][0]=1;//同じ
  dp[0][1]=0;//未満
  rep(i,n) {
    { // a+b = 0
      if (s[i] == '0') {
        dp[i+1][0] = dp[i][0];
        dp[i+1][1] = dp[i][1];
      } else {
        dp[i+1][1] = (dp[i][0] + dp[i][1]) % mod;
      }
    }
    { // a+b = 1
      if (s[i] == '0') {
        (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
      } else {
        (dp[i+1][0] += dp[i][0]*2 % mod) %= mod;
        (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
      }
    }
  }
  int ans=dp[n][0]%MOD+dp[n][1]%MOD;
  ans=ans%MOD;
  
  cout<<ans;

  }


Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 's' was not declared in this scope
   19 |       if (s[i] == '0') {
      |           ^
a.cc:23:46: error: 'mod' was not declared in this scope; did you mean 'modf'?
   23 |         dp[i+1][1] = (dp[i][0] + dp[i][1]) % mod;
      |                                              ^~~
      |                                              modf
a.cc:27:11: error: 's' was not declared in this scope
   27 |       if (s[i] == '0') {
      |           ^
a.cc:28:37: error: 'mod' was not declared in this scope; did you mean 'modf'?
   28 |         (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
      |                                     ^~~
      |                                     modf
a.cc:30:37: error: 'mod' was not declared in this scope; did you mean 'modf'?
   30 |         (dp[i+1][0] += dp[i][0]*2 % mod) %= mod;
      |                                     ^~~
      |                                     modf
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef int long long;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int dp[1001001][2];

int main(){
  string s; cin >> s;
  int n=s.size();
  dp[0][0]=1;
  rep(i,n)rep(j,2){
    int nd=s[i]-'0';
    rep(d,2){
      int ni=i+1,nj=j;
      if(j==0){
        if(d>nd) continue;
        if(d<nd) nj=1;
      }
      if(nd==1&&d==0) dp[ni][nj]+=dp[i][j]*2;
      else dp[ni][nj]+=dp[i][j];
      dp[ni][nj]%=mod;
    }
  }
  cout << dp[n][0]+dp[n][1] << endl;
}

Compiler output:
a.cc:9:18: error: declaration does not declare anything [-fpermissive]
    9 | typedef int long long;
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
  string s;
  cin >> s;
 
  
  dp[0][0]=1;
  for(int i=0;i<s.size();i++){
    dp[i+1][1] = 3*dp[i][1];
    if(s[i]=='1'){
    
      dp[i+1][0]=2*dp[i][0];
     
    
      dp[i+1][1]+=dp[i][0];
    }
    else{
      
      dp[i+1][0]=dp[i][0];
      
     
    }
    
    dp[i+1][0]%=1000000007;
    
    dp[i+1][1]%=1000000007;
  }
  cout << (dp[s.size()][0]+dp[s.size()][1])%1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[0][0]=1;
      |   ^~
      |   dup
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
  string s;
  cin >> s;
 
  
  dp[0][0]=1;
  for(int i=0;i<s.size();i++){
    dp[i+1][1] = 3*dp[i][1];
    if(s[i]=='1'){
    
      dp[i+1][0]=2*dp[i][0];
     
    
      dp[i+1][1]+=dp[i][0];
    }
    else{
      
      dp[i+1][0]=dp[i][0];
      
     
    }
    
    dp[i+1][0]%=1000000007;
    
    dp[i+1][1]%=1000000007;
  }
  cout << (dp[n][0]+dp[n][1])%1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[0][0]=1;
      |   ^~
      |   dup
a.cc:31:15: error: 'n' was not declared in this scope
   31 |   cout << (dp[n][0]+dp[n][1])%1000000007 << endl;
      |               ^
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;
  string s;cin>>s;
  ll dp[s.size()+1][2];
  dp[0][0]=1;
  rep(i,n){
    if(s[i]=='0'){
      dp[i+1][0]+=dp[i][0];
      dp[i+1][1]+=dp[i][1]*3;
    }else{
      dp[i+1][0]+=dp[i][0]*2;
      dp[i+1][1]+=dp[i][0];
      dp[i+1][1]+=dp[i][1]*3;
    }
  }
  cout<<dp[s.size()][0]+dp[s.size()][1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:143:9: error: 'n' was not declared in this scope
  143 |   rep(i,n){
      |         ^
a.cc:8:38: note: in definition of macro 'rep'
    8 | #define rep(i, n) for(ll i = 0; i < (n); i++)
      |                                      ^
Language: C++

,,

Compiler output:
a.cc:1:1: error: expected unqualified-id before ',' token
    1 | ,,
      | ^
a.cc:1:2: error: expected unqualified-id before ',' token
    1 | ,,
      |  ^
a.cc:1:3: error: expected unqualified-id at end of input
    1 | ,,
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
long t[100002]={1};
long dfs(string s){
  long result=t[s.length()-1];
  string sb=s.substr(1);
  if(sb.find("1")!=string::npos) return (result+2*dfs(sb.substr(sb.find("1"))))%M;
  else return (result+2)%M;
}
int main(){
  for(int i=1;i<100002;i++)t[i]=(3*t[i-1])%M;
  string s;cin>>s;
  cout<<dfs(s)？
}
//計算量はNのはずでは？

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: expected ';' before '\U0000ff1f'
   14 |   cout<<dfs(s)？
      |               ^~
      |               ;
Language: C++

L = input()
n = len(L)
onecnt = 0
ans = 0

MOD = 10 ** 9 + 7
for i in range(n):
    if(L[i] == '0'):continue
    onecnt += 1
    rest = n - i - 1
    ans += pow(2, onecnt-1, MOD) * pow(3, rest, MOD) % MOD
    ans %= MOD

ans += pow(2, onecnt, MOD)
    
print(ans % MOD)


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

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

#define DIGIT_MAX 100010
#define MOD 1000000007

long long int modpow(int p,long long int base)
{
	if (0 == p){
		return 1;
	}

	long long int ret = modpow(p / 2, base);
	if (0 == p % 2){
		return (ret*ret) % MOD;
	}
	else{
		return (((ret*ret) % MOD) * base) % MOD;
	}
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	char str[DIGIT_MAX]; scanf("%s", str);
	int digit = strlen(str);

	long long int ret = modpow(digit,3);
	for (int i = 1; i < digit; i++){
		if ('0' == str[i]){
			ret = (ret + MOD - (modpow(i, 2) * 2 * modpow(digit - i - 1, 3))) % MOD;
		}
	}

	printf("%lld", ret);

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:21: error: 'strlen' was not declared in this scope
   35 |         int digit = strlen(str);
      |                     ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <string>
  +++ |+#include <cstring>
    7 |
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
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; }
//#define int long long
//くり上がりに注意

// xorはくり上がりなし、+はくり上がりありより、a xor b <= a + b
// (a + b) - (a xor b) = (a & b) * 2 >= 0


void solve() {
	string l; cin >> l;
    // 1, 1となるbitがあるとくり上がりのせいで結果が変わってくる
    ll dp[n][2];
    rep(i, 100100){
        dp[i][0] = dp[i][1] = 0;
    }
    dp[0][0] = 2LL; dp[0][1] = 1LL;
    int n = l.size();
    rep1(i, n - 1) {
        (dp[i][1] += dp[i-1][1] * 3LL) % mod; //smaller 1 -> 1
        //smaller 0 -> 0 or 1
        if(l[i] == '1') {
            (dp[i][0] += dp[i-1][0] * 2LL) %= mod;
            (dp[i][1] += dp[i-1][0]) %= mod;
        } else {
            (dp[i][0] += dp[i-1][0]) %= mod;
        }
    }
    cout << (dp[n-1][0] + dp[n-1][1]) % mod << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:61:11: error: 'n' was not declared in this scope
   61 |     ll dp[n][2];
      |           ^
a.cc:63:9: error: 'dp' was not declared in this scope
   63 |         dp[i][0] = dp[i][1] = 0;
      |         ^~
a.cc:65:5: error: 'dp' was not declared in this scope
   65 |     dp[0][0] = 2LL; dp[0][1] = 1LL;
      |     ^~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char *bin[MAX];
  scanf("%s", bin);

  int len = strlen(bin);
  int dp[MAX][2];
  dp[0][0] = 1;
  rep(i, len) {
    // a + b == 0の時
    if (bin[i] == '0') {
      dp[i + 1][0] = dp[i][0];
      dp[i + 1][1] = dp[i][1];
    } else {
      dp[i + 1][1] = (dp[i][0] + dp[i][1]) % MOD;
    }

    // a + b == 1の時
    if (bin[i] == '0') {
      (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
    } else {
      (dp[i + 1][0] += dp[i][0] * 2) %= MOD;
      (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
    }
  }
  int ans = (dp[len][0] + dp[len][1]) % MOD;
  printf("%d\n", ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:20: error: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
   24 |   int len = strlen(bin);
      |                    ^~~
      |                    |
      |                    char **
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'char **'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:29:16: warning: comparison between pointer and integer
   29 |     if (bin[i] == '0') {
      |                ^~
main.c:37:16: warning: comparison between pointer and integer
   37 |     if (bin[i] == '0') {
      |                ^~
main.c:38:38: error: lvalue required as left operand of assignment
   38 |       (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
      |                                      ^~
main.c:40:38: error: lvalue required as left operand of assignment
   40 |       (dp[i + 1][0] += dp[i][0] * 2) %= MOD;
      |                                      ^~
main.c:41:38: error: lvalue required as left operand of assignment
   41 |       (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
      |                                      ^~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char *bin[MAX];
  scanf("%s", bin);

  int len = strlen(bin);
  int dp[MAX][2];
  dp[0][0] = 1;
  rep(bi, len) {
    // a + b == 0の時
    if (bin[bi] == '0') {
      dp[i + 1][0] = dp[i][0];
      dp[i + 1][1] = dp[i][1];
    } else {
      dp[i + 1][1] = (dp[i][0] + dp[i][1]) % MOD;
    }

    // a + b == 1の時
    if (bin[bi] == '0') {
      (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
    } else {
      (dp[i + 1][0] += dp[i][0] * 2) %= MOD;
      (dp[i + 1][1] += dp[i][1] * 2) %= MOD;
    }
  }
  int ans = (dp[len][0] + dp[len][1]) % MOD;
  printf("%d\n", ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:20: error: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
   24 |   int len = strlen(bin);
      |                    ^~~
      |                    |
      |                    char **
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'char **'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:29:17: warning: comparison between pointer and integer
   29 |     if (bin[bi] == '0') {
      |                 ^~
main.c:30:10: error: 'i' undeclared (first use in this function); did you mean 'bi'?
   30 |       dp[i + 1][0] = dp[i][0];
      |          ^
      |          bi
main.c:30:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:17: warning: comparison between pointer and integer
   37 |     if (bin[bi] == '0') {
      |                 ^~
Language: C++

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

const long long MOD = 1e9 + 7;

int main(){
  string s; cin >> s;
  int N = s.size();
  vector<vector<long long> > dp(2, vector<long long>(N+1, 0));
  dp[0][1] = 1LL; dp[1][1] = 2LL;
  
  for(int i = 1; i < N; i++){
    if(s[i] == '1'){
      dp[0][i+1] = ((dp[0][i] * 3) % MOD + dp[1][i]) % MOD;
      dp[1][i+1] = (dp[1][i] * 2) % MOD;
    }else{
      dp[0][i+1] = (dp[0][i] * 3) % MOD;
      dp[1][i+1] = dp[1][i] % MOD;
    }
  }
  cout << ans << ' '<< (dp[0][N] + dp[1][N]) % MOD;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << ' '<< (dp[0][N] + dp[1][N]) % MOD;
      |           ^~~
      |           abs
Language: C++

l = input()

dp = [[0, 0] for _ in l]

dp[0][0] = 1
dp[0][1] = 2

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = dp[i-1][0] * 3
        dp[i][1] = dp[i-1][1]
    else:
        dp[i][0] = 3*dp[i-1][0] + dp[i-1][1]
        dp[i][1] = dp[i-1][1] * 2

print((dp[-1][0] + dp[-1][1]) % 1000000007)


Compiler output:
a.cc:1:1: error: 'l' does not name a type
    1 | l = input()
      | ^
Language: Java



import java.util.Scanner;

public class newgg {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		String x=scan.next();
		int dp[][]=new int[x.length()+2][2];
		dp[0][1]=1;
		for(int i=0;i<x.length();i++)
		{
			if(x.charAt(i)=='0')
			{
				dp[i+1][1]+=dp[i][1];
			}else {
				dp[i+1][0]+=dp[i][1];
				
				dp[i+1][1]+=(dp[i][1]*2);
			}
			dp[i+1][0]+=(dp[i][0]*3);
		}
		int n=x.length();
		System.out.println(dp[n][0]+dp[n][1]);
	}
}


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

#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
ll mod=998244353;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    string s;
    cin >> s;
    ll h=s.size();
    vector<vector<ll>> a(2,vector<ll>(h,0));
    a.at(0).at(0)=1;a.at(1).at(0)=2;
    for (int i=1;i<h;i++){
        (a.at(0).at(i)+=a.at(0).at(i-1)*3)%=MOD;
        if (s.at(i)=='1'){
            (a.at(0).at(i)+=a.at(1).at(i-1))%=MOD;
            (a.at(1).at(i)+=a.at(1).at(i-1)*2)%=MOD;
        }
        else (a.at(1).at(i)+=a.at(1).at(i-1))%=MOD;
    }
    cout << (a.at(0).at(h-1)+a.at(1).at(h-1))%MOD << endl;
}#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
ll mod=998244353;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    string s;
    cin >> s;
    ll h=s.size();
    vector<vector<ll>> a(2,vector<ll>(h,0));
    a.at(0).at(0)=1;a.at(1).at(0)=2;
    for (int i=1;i<h;i++){
        (a.at(0).at(i)+=a.at(0).at(i-1)*3)%=MOD;
        if (s.at(i)=='1'){
            (a.at(0).at(i)+=a.at(1).at(i-1))%=MOD;
            (a.at(1).at(i)+=a.at(1).at(i-1)*2)%=MOD;
        }
        else (a.at(1).at(i)+=a.at(1).at(i-1))%=MOD;
    }
    cout << (a.at(0).at(h-1)+a.at(1).at(h-1))%MOD << endl;
}

Compiler output:
a.cc:25:2: error: stray '#' in program
   25 | }#include <bits/stdc++.h>
      |  ^
a.cc:25:3: error: 'include' does not name a type
   25 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:30:4: error: redefinition of 'long long int MOD'
   30 | ll MOD=1000000007;
      |    ^~~
a.cc:6:4: note: 'long long int MOD' previously defined here
    6 | ll MOD=1000000007;
      |    ^~~
a.cc:31:4: error: redefinition of 'long long int mod'
   31 | ll mod=998244353;
      |    ^~~
a.cc:7:4: note: 'long long int mod' previously defined here
    7 | ll mod=998244353;
      |    ^~~
a.cc:32:5: error: redefinition of 'int inf'
   32 | int inf=1000000000;
      |     ^~~
a.cc:8:5: note: 'int inf' previously defined here
    8 | int inf=1000000000;
      |     ^~~
a.cc:33:4: error: redefinition of 'long long int INF'
   33 | ll INF=10000000000000000;
      |    ^~~
a.cc:9:4: note: 'long long int INF' previously defined here
    9 | ll INF=10000000000000000;
      |    ^~~
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
 

int main(){ 
	string s;
	cin >> s;
	ll a=2,b=1;

}

//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	// a+b==aXORb => aとbで同じ位のbitが立ってることがない
	// x := 「a+b=L」となるものの個数
	// y := 「a+b<L」となるものの確定している個数
	//先頭だけ見た時x=2,y=1
	ll x=2; // 先頭は'1'なのでaかbのどちらかが1だから2通り
	ll y=1; // どっちも0の1パターン
	ll MOD=1e9+7;
	string s;
	cin >> s;
	for(int i=1;i<s.size();i++){
		if(s[i]=='0'){
			//もうL未満になることが確定しているものに関しては、
			//a,bどちらかのibit目を1にしてもOK
			//どっちも0もOK => 3パターン
			(y*=3)%=MOD;

		}else{
			//s[i]==0の時と同様にy*=3
			//追加でi-1bit目までで「a+b=L」になる個数を足す
			//ibit目でL未満が確定された分(ibit目がどっちも0になるもの)
			y = (y*3+x)%MOD;

			//「a+b=L」になるにはa,bどちらかのibit目を
			//1にする必要がある。2パターン
			(x *= 2)%=MOD;
		}
	}
	//(「a+b=L」となるものの個数)+(「a+b<L」となるものの個数)
	cout << (x+y) % MOD << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	// a+b==aXORb => aとbで同じ位のbitが立ってることがない
	// x := 「a+b=L」となるものの個数
	// y := 「a+b<L」となるものの確定している個数
	//先頭だけ見た時x=2,y=1
	ll x=2; // 先頭は'1'なのでaかbのどちらかが1だから2通り
	ll y=1; // どっちも0の1パターン
	ll MOD=1e9+7;
	string s;
	cin >> s;
	for(int i=1;i<s.size();i++){
		if(s[i]=='0'){
			//もうL未満になることが確定しているものに関しては、
			//a,bどちらかのibit目を1にしてもOK
			//どっちも0もOK => 3パターン
			(y*=3)%=MOD;

		}else{
			//s[i]==0の時と同様にy*=3
			//追加でi-1bit目までで「a+b=L」になる個数を足す
			//ibit目でL未満が確定された分(ibit目がどっちも0になるもの)
			y = (y*3+a)%MOD;

			//「a+b=L」になるにはa,bどちらかのibit目を
			//1にする必要がある。2パターン
			(x *= 2)%=MOD;
		}
	}
	//(「a+b=L」となるものの個数)+(「a+b<L」となるものの個数)
	cout << (x+y) % MOD << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:34: error: 'a' was not declared in this scope
   25 |                         y = (y*3+a)%MOD;
      |                                  ^
Language: C++

//هوالحق
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1022, DLT = 1000000007;

ll P[N];

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    P[0] = 1;
    for(int i = 1; i < N; i++) P[i] = (P[i-1] * 3) % DLT);
    cout << P[100] << " ";
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    ll r = 1;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '1')
            r = (2 * r + P[i]) % DLT;
    }
    cout << r;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:57: error: expected ';' before ')' token
   12 |     for(int i = 1; i < N; i++) P[i] = (P[i-1] * 3) % DLT);
      |                                                         ^
      |                                                         ;
Language: C++

#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int main(){
    string str;
    ll ans=1,NUM=1e9+7;
    cin >> str;
    for(int i=0;i<str.size();i++){
        if(str[i]=='1') ans*=3;
        else{
            if(str[i]=='1') ans=ans*2/3+ans;
            else    ans=ans*4/5+ans*3/5
        }
        ans%=NUM;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:40: error: expected ';' before '}' token
   14 |             else    ans=ans*4/5+ans*3/5
      |                                        ^
      |                                        ;
   15 |         }
      |         ~
Language: Java

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

public class Main
{
  final long mod = (long)1e9+7;  
  String L;
  int len, cnt = 0;
  long ans = 0;
  long[] fac, two;
  
  Main(Scanner in, PrintWriter out)
  {
    L = in.next();
    len = L.length();
    for (char c : L)
      if (c == '1')
        cnt++;
    fac = new long[len+1];
    fac[0] = 1;
    for (int i = 1; i <= len; i++)
    {
      fac[i] = i*fac[i-1];
      fac[i] %= mod;
    }
    two = new long[len+1];
    two[0] = 1L;
    for (int i = 1; i <= len; i++)
    {
      two[i] = 2*two[i-1];
      two[i] %= mod;
    }
    
    for (int i = 0; i <= cnt; i++)
    {
      long nck = mult(fac[cnt], mult(exp(fac[i], mod-2), exp(fac[cnt-i], mod-2)));
      ans += mult(nck, two[i]);
      ans %= mod;
    }
    
    out.println(ans);
  }
  
  long exp(long a, long b)
  {
    if (b == 0) return 1L;
    if (b == 1) return a;
    long ans = exp(a, b/2);
    ans *= ans; ans %= mod;
    if ((b & 1) == 0) return ans;
    return (a*ans) % mod;
  }
  
  long mult(long a, long b)
  {
    return a*b % mod;
  }
  
  public static void main(String[] args)
  {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main(in, out);
    out.close();
  }
}

Compiler output:
Main.java:16: error: for-each not applicable to expression type
    for (char c : L)
                  ^
  required: array or java.lang.Iterable
  found:    String
1 error
Language: Java

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

public class Main
{
  final long mod = (long)1e9+7;  
  String L;
  int len, cnt = 0;
  long ans = 0;
  long[] fac, two;
  
  Main(Scanner in, PrintWriter out)
  {
    L = in.next();
    len = L.length();
    for (char c : L)
      if (c == '1')
        cnt++;
    fac = new long[len+1];
    fac[0] = 1;
    for (int i = 1; i <= len; i++)
    {
      fac[i] = i*fac[i-1];
      fac[i] %= mod;
    }
    two = new long[len+1];
    two[0] = 1L;
    for (int i = 1; i <= len; i++)
    {
      two[i] = 2*two[i-1];
      two[i] %= mod;
    }
    
    for (int i = 0; i <= cnt; i++)
    {
      long nck = mult(fac[cnt], mult(exp(fac[i], mod-2), exp(fac[cnt-i], mod-2)));
      ans += mult(nck, two[i]);
      ans %= mod;
    }
    
    out.println(ans);
  }
  
  long exp(long a, long b)
  {
    if (b == 0) return 1L;
    if (b == 1) return a;
    long ans = exp(a, b/2);
    ans *= ans; ans %= mod;
    if ((b & 1) == 0) return ans;
    return (a*ans) % mod;
  }
  
  long mult(long a, long b)
  {
    return a*b % mod;
  }
  
  public static void main(String[] args)
  {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main(in, out);
    out.close();
  }

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

#include <iostream>
#include <string>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

template <typename T>
T modpow(T base, T pow, T mod){
  base %= mod;
  T res = 1;
  while (exp > 0){
	if (exp & 1) res = (res * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return res;
}

int main(){
  string L;
  cin >> L;
  ll res = 0;
  ll w = L.size();
  for (int i=0; i<L.size() - 1; i++){
    if (L[i] == '1'){
      res = (res + (ll)modpow(3, w - i - 1, mod)) % mod;
    }
  }
  if (L.back() == '1'){
    res = (res + 1) % mod;
  }
  cout << res << endl;
  return 0;
}
    


Compiler output:
a.cc: In function 'T modpow(T, T, T)':
a.cc:12:10: error: 'exp' was not declared in this scope
   12 |   while (exp > 0){
      |          ^~~
a.cc: In function 'int main()':
a.cc:27:30: error: no matching function for call to 'modpow(int, ll, const ll&)'
   27 |       res = (res + (ll)modpow(3, w - i - 1, mod)) % mod;
      |                        ~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:9:3: note: candidate: 'template<class T> T modpow(T, T, T)'
    9 | T modpow(T base, T pow, T mod){
      |   ^~~~~~
a.cc:9:3: note:   template argument deduction/substitution failed:
a.cc:27:30: note:   deduced conflicting types for parameter 'T' ('int' and 'long long int')
   27 |       res = (res + (ll)modpow(3, w - i - 1, mod)) % mod;
      |                        ~~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int main(){
  string L;
  cin >> L;
  ll res = 0;
  ll w = L.size();
  for (int i=0; i<L.size() - 1; i++){
    if (L[i] == '1'){
      res = (res + (ll)modpow(3, w - i - 1, mod)) % mod;
    }
  }
  if (L.back() == '1'){
    res = (res + 1) % mod;
  }
  cout << res << endl;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'modpow' was not declared in this scope
   15 |       res = (res + (ll)modpow(3, w - i - 1, mod)) % mod;
      |                        ^~~~~~
Language: C++

L = input()
modulo = 10**9+7

dp = [[0] * len(L) for i in range(2)]
dp[0][0] = 1
dp[1][0] = 2
for i in range(1, len(L)):
  if L[i] == "1":
    dp[0][i] = 2 * dp[0][i-1]
    dp[1][i] = 2 * dp[1][i-1]
  else:
    dp[0][i] = dp[0][i-1] + dp[1][i-1]
    dp[1][i] = dp[1][i-1]
  dp[0][i] %= modulo
  dp[1][i] %= modulo
    
#print(dp)
print(dp[0][-1]+dp[1][-1])

Compiler output:
a.cc:17:2: error: invalid preprocessing directive #print
   17 | #print(dp)
      |  ^~~~~
a.cc:1:1: error: 'L' does not name a type
    1 | L = input()
      | ^
Language: C++

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

const int mod = 1000000007;
int dp[100005][2];

int main() {
  string s;
  cin >> s;
  int n = s.size();
  dp[0][0] = 1;
  // dp[0][1] = 0;
  rep(i,n) {
    dp[i+1][0] = dp[i+1][0] = 0:
    { // a+b = 0
      if (s[i] == '0') {
        dp[i+1][0] += dp[i][0];
        dp[i+1][1] += dp[i][1];
      } else {
        dp[i+1][1] += (dp[i][0] + dp[i][1]) % mod;
      }
    }
    { // a+b = 1
      if (s[i] == '0') {
        (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
      } else {
        (dp[i+1][0] += dp[i][0]*2 % mod) %= mod;
        (dp[i+1][1] += dp[i][1]*2 % mod) %= mod;
      }
    }
  }
  int ans = (dp[n][0]+dp[n][1]) % mod;
  cout << ans << endl;
  // rep(i,n)cout<<dp[i+1][0];
  // cout << endl;
  // rep(i,n)cout << dp[i+1][1];
  // cout << endl;
  // cout << dp[0][1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: expected ';' before ':' token
   15 |     dp[i+1][0] = dp[i+1][0] = 0:
      |                                ^
      |                                ;