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

# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

def main():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))

    A = list(map(lambda x: x % 2, A))
    if A.count(1):
        ans = pow(2,N-1)
    else:
        if P == 0:
            ans = pow(2,N)
        else:
            ans = pow(2,N-1)

    print(ans)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:20:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   20 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



ll comb(int n, int r) {
	static vector<vector<ll>> memo(51, vector<ll>(26));
	if (r > n / 2) return comb(n, n - r);
	if (memo[n][r]) return memo[n][r];
	if (r == 0) memo[n][0] = 1;
	else memo[n][r] = comb(n - 1, r - 1) + comb(n - 1, r);
	return memo[n][r];
}

class question {
public:
	int N, P;
	int odd = 0;
	void gets() {
		cin >> N >> P;
		REP(i, N) {
			int a;
			cin >> a;
			odd += a % 2;
		}
	}
	void ans() {
		ll res = 0;
		if (P == 0) {
			for (int i = 0;i <= odd;i += 2) {
				res += comb(odd, i);
			}
		}
		else {
			for (int i = 1;i <= odd;i += 2) {
				res += comb(odd, i);
			}
		}
		res *= (1LL << (N - odd));
		cout << res << "\n";
	}
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<algorithm>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;

int n,a[55],p;
int f[55][55];
int C(int x,int y){return f[y][x];}
void pre()
{
	f[1][1]=f[1][0]=f[0][0]=1;
	for(int i=2;i<=50;i++)
	{
		f[i][0]=f[i][i]=1;
		for(int j=1;j<i;j++)
			f[i][j]=f[i-1][j]+f[i-1][j-1];
	}
}
int main()
{
	int i;int zz=0,oo=0;ll ans=0,pw=1;
	scanf("%d%d",&n,&p);
	for(i=1;i<=n;i++)	scanf("%d",&a[i]),(a[i]&1)?oo++:zz++;
	for(i=1;i<=zz;i++)	pw<<=1ll;pre();
	if(p&1)
		for(i=1;i<=oo;i+=2)
			ans+=C(i,oo)*pw;
	else
		for(i=0;i<=oo;i+=2)
			ans+=C(i,oo)*pw;
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'scanf' was not declared in this scope
   24 |         scanf("%d%d",&n,&p);
      |         ^~~~~
a.cc:33:9: error: 'printf' was not declared in this scope
   33 |         printf("%lld\n",ans);
      |         ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include<cmath>
  +++ |+#include <cstdio>
    4 | #include<algorithm>
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	int n, p;
	cin >> n >> p;
	int a;
	int flag = 0;
	REP(i, n){
		cin >> a;
		if (a % 2) flag = 1; 
	}
	ll ans = 1;
	FOR(i, 1, n){
		ans *= 2;
	}
	if (flag) cout << ans << endl;
	else cout << (p ? 0 : ans) endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:35: error: expected ';' before 'endl'
   28 |         else cout << (p ? 0 : ans) endl;
      |                                   ^~~~~
      |                                   ;
Language: Java

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

public class Main {

  private void compute(){
    Scanner scanner = new Scanner (System.in);
    int n = scanner.nextInt();
    int p = scanner.nextInt();
    int e, o;
    for (int i=0;i<n;i++) {
      if (scanner.nextInt() % 2 == 0)
        e++;
      else
        o++;
    }
    long rtn = 1;
    if (p == 1) {
      rtn *= o;
      o--;
    }
    long or, er;
    for (int i=0;i<=o;i+=2) {
      or += co(o, i);
    }
    for (int i=0;i<=e;i++) {
      er += co(e, i);
    }
    
    System.out.println("");
  }
  
  private static long co(int n, int k) {
    long rtn = 1;
    for (int i=0;i<k;i++) {
      rtn *= n - i;
      rtn /= i + 1;
    }
    return rtn;
  }

  public static void main(String[] args) {
    new Main().compute();
  }

}


Compiler output:
Main.java:13: error: variable e might not have been initialized
        e++;
        ^
Main.java:15: error: variable o might not have been initialized
        o++;
        ^
Main.java:19: error: variable o might not have been initialized
      rtn *= o;
             ^
Main.java:23: error: variable o might not have been initialized
    for (int i=0;i<=o;i+=2) {
                    ^
Main.java:24: error: variable or might not have been initialized
      or += co(o, i);
      ^
Main.java:26: error: variable e might not have been initialized
    for (int i=0;i<=e;i++) {
                    ^
Main.java:27: error: variable er might not have been initialized
      er += co(e, i);
      ^
7 errors
Language: Java

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

public class Main {

  private void compute(){
    Scanner scanner = new Scanner (System.in);
    int n = scanner.nextInt();
    int p = scanner.nextInt();
    int e, o;
    for (int i=0;i<n;i++) {
      if (scanner.nextInt() % 2 == 0)
        e++;
      else
        o++;
    }
    long rtn = 1;
    if (p == 1) {
      rtn *= o;
      o--;
    }
    long or, er;
    for (int i=0;i<=o;i+=2) {
      or += co(o, i);
    }
    for (int i=0;i<=e;i++) {
      er += co(e, i);
    }
    
    System.out.println("");
  }
  
  private static long co(int n, k) {
    long rtn = 1;
    for (int i=0;i<k;i++) {
      rtn *= n - i;
      rtn /= i + 1;
    }
    return rtn;
  }

  public static void main(String[] args) {
    new Main().compute();
  }

}


Compiler output:
Main.java:33: error: <identifier> expected
  private static long co(int n, k) {
                                 ^
1 error
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;

long long int n,cnt=0,ans=0,a[1000],b,c,d,cmp[4],cmpp,m,h,w,x,y,sum=0,pos,dp[51][50*100+200];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------
int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
     
    cin>>n>>p;
  rep(i,n)cin>>a[i],sum+=a[i];
  dp[0][0]=1;
  rep(i,n){
    rep(j,sum+1){
      dp[i+1][j+a[i]]+=dp[i][j];
    }
  }
  
 rep(i,sum+1){
    if(i%2==p)ans+=dp[n][i];
  }
  Cout(ans);
       
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'p' was not declared in this scope
   32 |     cin>>n>>p;
      |             ^
Language: C++

include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;

long long int n,cnt=0,ans=0,a[1000],b,c,d,cmp[4],cmpp,m,h,w,x,y,sum=0,pos,dp[51][50*100+200];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------
int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
     
    cin>>n>>p;
  rep(i,n)cin>>a[i],sum+=a[i];
  dp[0][0]=1;
  rep(i,n){
    rep(j,sum+1){
      dp[i+1][j+a[i]]+=dp[i][j];
    }
  }
  
 rep(i,sum+1){
    if(i%2==p)ans+=dp[n][i];
  }
  Cout(ans);
       
return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:16:7: error: 'll' does not name a type; did you mean 'all'?
   16 | const ll LINF = 1e18;
      |       ^~
      |       all
a.cc:21:1: error: 'string' does not name a type
   21 | string alph("abcdefghijklmnopqrstuvwxyz"),s;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:28:8: error: 'cin' was not declared in this scope
   28 |        cin.tie(0);
      |        ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | include <bits/stdc++.h>
a.cc:29:5: error: 'ios' has not been declared
   29 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:32:13: error: 'p' was not declared in this scope
   32 |     cin>>n>>p;
      |             ^
a.cc:9:17: error: 'cout' was not declared in this scope
    9 | #define Cout(x) cout<<(x)<<endl
      |                 ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
   44 |   Cout(ans);
      |   ^~~~
a.cc:9:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    9 | #define Cout(x) cout<<(x)<<endl
      |                 ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
   44 |   Cout(ans);
      |   ^~~~
a.cc:9:28: error: 'endl' was not declared in this scope
    9 | #define Cout(x) cout<<(x)<<endl
      |                            ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
   44 |   Cout(ans);
      |   ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | include <bits/stdc++.h>
Language: C++

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

int main() {
	int n,p;
	cin >> n >> p;
	int a[p];
	for (int i = 0;i < p;i++) {
		cin >> a[i]
	}
	int pw = pow(2,n);
	int ans2 = 0;
	for (int i = 0;i < pw;i++) {
		int ans = 0;
		for (int j = n - 1;j >= 0;j++) {
			int m = i;
			if (m%2==1) {
				ans += a[i];
			}
			m/=2;
		}
		if (ans%2==p) ans2++;
	}
	cout << ans2 << end;
}

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

#include<bits/stdc++.h>

using namespace std;

int sisu(int a,int b){
  int c=a;
  for(int i=0;i!=b;i++){
    a=a*c;
  }
  a=a/c;
  return a;
}

long nCr(int n, int r){
  long ans=1;
  for(int i=n;i>n-r;--i){
    ans = ans*i;
  }
  for(int i=1;i<r+1;++i){
    ans=ans/i;
  }
  return ans;
}
int main(){
  int n,p,a[50];
  cin >> n >> p;
  int amari=0;
  int zero=0;
  int erabu=1;
  int b;
  for(int i=0;i!=n;i++){
    cin >> a[i];
    a[i]=a[i]%2;
    if(a[i]==1){
      amari++;
    }
    else{
      zero++;
    }
  }
  if(p==1){
    if(amari%2==0){
      b=amari-1;
    }
    else{
      b=amari;
    }
    erabu=sisu(2,zero);
    for(int i=1;i!=b+2;i+2){
      erabu=erabu*nCr(amari,i);
    }
  }
  else{
    if(amari%2==1){
      b=amari-1;
    }
    else{
      b=amari;
    }
    erabu=sisu(2,zero);
    for(int i=2;i!=b+2;i+2;){
      erabu=erabu*nCr(amari,i);
    }
  }
  cout << erabu << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:27: error: expected ')' before ';' token
   61 |     for(int i=2;i!=b+2;i+2;){
      |        ~                  ^
      |                           )
a.cc:61:28: error: expected primary-expression before ')' token
   61 |     for(int i=2;i!=b+2;i+2;){
      |                            ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int sisu(int a,int b){
  int c=a;
  for(int i=0;i!=b;i++){
    a=a*c;
  }
  a=a/c;
  return a;
}

long nCr(int n, int r){
  long ans=1;
  for(int i=n;i>n-r;--i){
    ans = ans*i;
  }
  for(int i=1;i<r+1;++i){
    ans=ans/i;
  }
  return ans;
}
int main(){
  int n,p,a[50];
  cin >> n >> p;
  int amari=0;
  int zero=0;
  int erabu=1;
  int b;
  for(int i=0;i!=n;i++){
    cin >> a[i];
    a[i]=a[i]%2;
    if(a[i]==1){
      amari++;
    }
    else{
      zero++;
    }
  }
  if(p==1){
    if(amari%2==0){
      b=amari-1;
    }
    else{
      b=amari;
    }
    erabu=sisu(2,zero);
    for(int i=1;i!=b+2;i+2;){
      erabu=erabu*nCr(amari,i);
    }
  }
  else{
    if(amari%2==1){
      b=amari-1;
    }
    else{
      b=amari;
    }
    erabu=sisu(2,zero);
    for(int i=2;i!=b+2;i+2;){
      erabu=erabu*nCr(amari,i);
    }
  }
  cout << erabu << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:27: error: expected ')' before ';' token
   49 |     for(int i=1;i!=b+2;i+2;){
      |        ~                  ^
      |                           )
a.cc:49:28: error: expected primary-expression before ')' token
   49 |     for(int i=1;i!=b+2;i+2;){
      |                            ^
a.cc:61:27: error: expected ')' before ';' token
   61 |     for(int i=2;i!=b+2;i+2;){
      |        ~                  ^
      |                           )
a.cc:61:28: error: expected primary-expression before ')' token
   61 |     for(int i=2;i!=b+2;i+2;){
      |                            ^
Language: C++

n,m=map(int,input().split())
s=list(map(int,input().split()))
odd=0
even=0
p=0
for i in s:
    if i%2==1:
        odd+=1
    else:
        even+=1
even=2**even
from math import factorial
def f(n,m):
    return factorial(n)//(factorial(n-m)*factorial(m))
for i in range(1,odd+1,2):
    p+=f(odd,i)
print(p*even)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m=map(int,input().split())
      | ^
Language: C++

#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;

vector<vector<ll>> mk_c(){
    ll mx=55;
    vector<vector<ll>> c(mx+1,vector<ll>(mx+1,0));
    for(ll i=0;i<=mx;i++){
        c[i][i]=1;
        c[i][0]=1;
        for(ll t=1;t<i;t++){
            c[i][t]=c[i-1][t-1]+c[i-1][t];
        }
    }
    return c;
}


int main(){
    vector<vector<ll>> c=mk_c();
    ll n,p;
    cin>>n>>p;
    ll g=0,k=0;
    for(int i=0;i<n;i++){
        ll b;
        cin>>b;
        if(b%2==0){g++;}
        else{k++;}
    }
    g=1<<g;
    ll K=0;
    if(p==1){
        assert(false;)
        for(int i=1;i<=k;i+=2){
            K+=c[k][i];
        }
    }
    else{
        for(int i=0;i<=k;i+=2){
            K+=c[k][i];
        }
    }
    cout<<g*K<<endl;
    
    return 0;
}



Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from a.cc:16:
a.cc: In function 'int main()':
a.cc:63:21: error: expected ')' before ';' token
   63 |         assert(false;)
      |                     ^
a.cc:63:21: error: expected ')' before ';' token
a.cc:63:9: note: to match this '('
   63 |         assert(false;)
      |         ^~~~~~
a.cc:63:9: error: expected primary-expression before ')' token
   63 |         assert(false;)
      |         ^~~~~~
a.cc:64:21: error: 'i' was not declared in this scope
   64 |         for(int i=1;i<=k;i+=2){
      |                     ^
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n, p;
    cin >> n >> p;

    int a[n];
    bool odd = false;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i]%2 == 1) odd = true;
    }

    if(odd == false && p == 0){
        ll ans = 1;
        for(int i = 0; i < n; i++)  ans *= 2;
        cout << ans << endl;
    }else if(odd == false && p == 1){
        cout << 0 << endl;
    }else{
        ll ans = 1;
        for(int i = 0; i < n-1; i++)  ans *= 2;
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'll' was not declared in this scope
   16 |         ll ans = 1;
      |         ^~
a.cc:17:37: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         for(int i = 0; i < n; i++)  ans *= 2;
      |                                     ^~~
      |                                     abs
a.cc:18:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |         cout << ans << endl;
      |                 ^~~
      |                 abs
a.cc:22:9: error: 'll' was not declared in this scope
   22 |         ll ans = 1;
      |         ^~
a.cc:23:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |         for(int i = 0; i < n-1; i++)  ans *= 2;
      |                                       ^~~
      |                                       abs
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

//海老原祐輔
//J4-180012
//Biscuits
//https://beta.atcoder.jp/contests/agc017/tasks/agc017_a

//サンプルケースは全て通るが一部のテストケースにおいてWAになります。
//原因がよくわかりません。

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)

int main()
{
    ll N, P;
    cin >> N >> P;
    vll A(N);
    rep(i, N) cin >> A[i];
	vll odd(2, 0), even(2, 0);
	
	for (int i=0;i<N+1,++i){
		even[i]=0;
		odd[i]=0;
	}
	
    even[0] = 1;
	odd[0] = 0;
	
	
	rep(i, N)
    {
        if (A[i + 1] % 2 == 0) {
            //入れる場合
            even[(i + 1) % 2] = even[i % 2];
            odd[(i + 1) % 2] = odd[i % 2];
            //入れない場合
            even[(i + 1) % 2] += even[i % 2];
            odd[(i + 1) % 2] += odd[i % 2];
        } else {
            //入れる場合
            even[(i + 1) % 2] = even[i % 2];
            odd[(i + 1) % 2] = odd[i % 2];
            //入れない場合
            even[(i + 1) % 2] += odd[i % 2];
            odd[(i + 1) % 2] += even[i % 2];
        }
    }
    if (P == 0) {
        cout << even[(N) % 2] << endl;
    } else {
        cout << odd[(N) % 2] << endl;
    }
}


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

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;

#define ll long long

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
ll MIN(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a < b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	if (a%b == 0)return b;
	return gcd(b, a%b);

}
//最大公約数

ll lcm(ll a, ll b) {

	return a / gcd(a, b)*b;

}
//最小公倍数

ll ncr(ll n, ll r) {

	ll ret = 1;
	for (ll i = 0; i < r; i++) {
		ret *= n - i;
		ret /= i + 1;
	}
	return ret;

}

int main() {
	
	int N, P, even = 0, odd = 0;
	ll ans = 0;
	cin >> N >> P;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a % 2 == 0)even++;
		else odd++;
	}
	if (P == 0) {
		ans = pow(2, even);
		ll tmp = 0;
		for (int i = 0; i <= odd; i += 2) {
			tmp += ncr(odd, i);
		}
		ans *= tmp;
		cout << ans << endl;
	}
	else {
		ans = pow(2, even);
		ll tmp = 0;
		for (int i = 1; i <= odd; i += 2) {
			tmp += ncr(odd, i);
		}
		ans *= tmp;
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:122:23: error: 'pow' was not declared in this scope
  122 |                 ans = pow(2, even);
      |                       ^~~
a.cc:131:23: error: 'pow' was not declared in this scope
  131 |                 ans = pow(2, even);
      |                       ^~~
Language: C++

#include<iostream>
using namespace std;
typedef long long ll 
ll pow(int a,int b){
    ll ans=1;
    for(int j=0;j<b;j++){
        ans*=a;
    }
    return ans;
}
 
int main(){
    int n,p;
    cin>>n>>p;
    int a[n];
    for(int j=0;j<n;j++){
        cin>>a[j];
        if(a[j]%2==1){
            cout<<pow(2,n-1);
            return 0;
        }
    }
    if(p==0)cout<<pow(2,n);
    if(p==1)cout<<0;
    return 0;
}

Compiler output:
a.cc:4:1: error: expected initializer before 'll'
    4 | ll pow(int a,int b){
      | ^~
a.cc: In function 'int main()':
a.cc:19:19: error: 'pow' was not declared in this scope
   19 |             cout<<pow(2,n-1);
      |                   ^~~
a.cc:23:19: error: 'pow' was not declared in this scope
   23 |     if(p==0)cout<<pow(2,n);
      |                   ^~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    int n,p;
    cin>>n>>p;
    int a[n];
    for(int j=0;j<n;j++){
        cin>>a[j];
        if(a[j]%2==1){
            cout<<2**(n-1);
            return 0;
        }
    }
    if(p==0)cout<<2**n;
    if(p==1)cout<<0;
    return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: invalid type argument of unary '*' (have 'int')
   10 |             cout<<2**(n-1);
      |                     ^~~~~~
a.cc:14:21: error: invalid type argument of unary '*' (have 'int')
   14 |     if(p==0)cout<<2**n;
      |                     ^~
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;
ll n, p, k, a;

ll pow(ll x, ll y){
    if (y == 0) {
        return 1;
    } else {
        return x * pow(x, y - 1);
    }
}

int main(void){
    // Your code here!
    cin >> n >> p;
    for (ll i = 0; i < n; i++) {
        cin >> a;
        if (a % 2) k++;
    }
    cout << (k ? pow(2, n - 1) : (p ? 0 : pow(2, n)) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:54: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   21 |     cout << (k ? pow(2, n - 1) : (p ? 0 : pow(2, n)) << endl;
      |                                  ~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:21:61: error: expected ')' before ';' token
   21 |     cout << (k ? pow(2, n - 1) : (p ? 0 : pow(2, n)) << endl;
      |             ~                                               ^
      |                                                             )
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

long comb(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}

int main() {
	int n, p;
	cin >> n >> p;
	int num[3];
	for (int i = 0;i < n;i++) {
		int q;
		cin >> q;
	num[q % 2] ++;
	}
	int ans = 0;
	ans += pow(2, num[0] + 1);
	int anss = ans;
	if (p == 0) {
		for (int i = 0;i <= num[1];i += 2) {
			ans += comb(num[1], i)*anss;
		}
	}
	else {
		for (int i = 1;i <= num[1];i += 2) {
			ans += comb(num[1], i)*anss;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: 'pow' was not declared in this scope
   26 |         ans += pow(2, num[0] + 1);
      |                ^~~
Language: C++

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

int N, P;

const int MAX_C = 100;
long long Com[MAX_C][MAX_C];

void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]);
        }
    }
}

int main() {
  calc_com();
  while (cin >> N >> P) {
	long long even = 0, odd = 0;
	for (int i = 0; i < N; ++i) {
	  int a; cin >> a;
	  if (a & 1) ++odd;
	  else ++even;
	}
	long long evenbit = 1LL<<even;
	long long oddbit = 0;
	for (int i = 0; i <= odd; ++i) {
	  if (i % 2 == P) {
		oddbit += Com[odd][i];
	  }
	}
	cout << evenbit * oddbit << endl;
	
  }
}


Compiler output:
a.cc: In function 'void calc_com()':
a.cc:11:5: error: 'memset' was not declared in this scope
   11 |     memset(Com, 0, sizeof(Com));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  int N, P;
  cin >>N>>P;
  int t;
  int even=1,odd=1;
  ll ans=0;
  for(int i=1;i<=N;i++){
    cin >> t;
    if(t%2==0){
      even++;
    }
    else{
      odd++;
    }
  }
  if(P==1 && odd==1){
    cout << ans;
    return 0;
  }
  if(P==0 && odd==2 && even=1){
    cout << ans;
    return 0;
  }
  ans=pow(2,even)/2*pow(2,odd)/4;
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:21: error: lvalue required as left operand of assignment
   34 |   if(P==0 && odd==2 && even=1){
      |      ~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll =int long long;
map <int ,int> mpa,mpb;

int main (void){
  int N;
  int P;
  int odd=0;
  int even=0;
  cin >> N >> P;
  int A[N];
  int x=0;
  int ans=0;
  for(int i=0;i<N;i++){
    cin >> x;
    A[i]=x%2;
    if(A[i]==1){
      odd++;
    }
    else{
      even++;
    }
  }
  if(odd==0 || even==0){
    ans=max({ans,pow(2,odd-1),pow(2,even)});
    cout << ans;
    return 0;
  }
  if(P){
    ans=2*even*(pow(2,odd-1));
  }
  else{
    if(odd>=2){
    ans=pow(2,even)*(1+pow(2,odd-1));
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:12: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   35 |     ans=max({ans,pow(2,odd-1),pow(2,even)});
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:35:12: note:   deduced conflicting types for parameter '_Tp' ('int' and 'double')
   35 |     ans=max({ans,pow(2,odd-1),pow(2,even)});
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:15:16: note: to match this '{'
   15 | int main (void){
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll =int long long;
map <int ,int> mpa,mpb;

int main (void){
  int N;
  int P;
  int odd=0;
  int even=0;
  cin >> N >> P;
  int A[N];
  int x=0;
  int ans=0;
  for(int i=0;i<N;i++){
    cin >> x;
    A[i]=x%2;
    if(A[i]==1){
      odd++;
    }
    else{
      even++;
    }
  }
  if(P==0){
    ans=2**even*(1+odd*(odd-1)/2);
  }
  else{
    int sum=0;
    int i=1;
    while(true){
      if(odd%i) break;
      sum+=odd%i;
      i=i+2;
    }
    ans=2*even*(sum);
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:11: error: invalid type argument of unary '*' (have 'int')
   35 |     ans=2**even*(1+odd*(odd-1)/2);
      |           ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,p;
  cin >> n;
  long long int ans = 1 << (n-1);
  ans << ans << endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 |   ans << ans << endl;
      |   ~~~~~~~~~~~^~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,p;
  cin >> n;
  long long int ans = 1 << (n-1)
  ans << ans << endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'ans'
    8 |   ans << ans << endl;
      |   ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


int main() {
	int n, p;
	cin >> n >> p;
	int a[1000];
	for (int i = 0;i < n;i++) {
		int b;
		cin >> b;
		a[i] = b % 2;
	}
	int num[2];
	for (int i = 0;i < n;i++)num[a[i]]++;
	if (num[1] == 0) {
		cout << pow(2, n - 1) << endl;
	}
	else {
		if (p == 0)cout << pow(2, n) << endl;
		else cout << 0 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'pow' was not declared in this scope
   18 |                 cout << pow(2, n - 1) << endl;
      |                         ^~~
a.cc:21:36: error: 'pow' was not declared in this scope
   21 |                 if (p == 0)cout << pow(2, n) << endl;
      |                                    ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


int main() {
	int n, p;
	cin >> n >> p;
	int a[n];
	for (int i = 0;i < n;i++) {
		int b;
		cin >> b;
		a[i] = b % 2;
	}
	int num[2];
	for (int i = 0;i < n;i++)num[a[i]]++;
	if (num[1] == 0) {
		cout << pow(2, n - 1) << endl;
	}
	else {
		if (p == 0)cout << pow(2, n) << endl;
		else cout << 0 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'pow' was not declared in this scope
   18 |                 cout << pow(2, n - 1) << endl;
      |                         ^~~
a.cc:21:36: error: 'pow' was not declared in this scope
   21 |                 if (p == 0)cout << pow(2, n) << endl;
      |                                    ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

long dp[max][max];

long nCr(int n, int r)
{
	if (n == r) return dp[n][r] = 1;
	if (r == 0) return dp[n][r] = 1;
	if (r == 1) return dp[n][r] = n;
	if (dp[n][r]) return dp[n][r];
	return dp[n][r] = nCr(n - 1, r) + nCr(n - 1, r - 1);
}

int main() {
	int n, p;
	cin >> n >> p;
	int a[n];
	for (int i = 0;i < n;i++) {
		int b;
		cin >> b;
		a[i] = b % 2;
	}
	int num[2];
	for (int i = 0;i < n;i++)num[a[i]]++;
	int res = num[0];
	for (int i = 2;i < num[1];i += 2) {
		res += num[0] * nCr(num[1], i);
	}
	cout << res << endl;
}



Compiler output:
a.cc:5:17: error: cannot resolve overloaded function 'max' based on conversion to type 'long unsigned int'
    5 | long dp[max][max];
      |                 ^
a.cc:5:6: error: size of array 'dp' has non-integral type '<unresolved overloaded function type>'
    5 | long dp[max][max];
      |      ^~
a.cc:5:17: error: cannot resolve overloaded function 'max' based on conversion to type 'long unsigned int'
    5 | long dp[max][max];
      |                 ^
a.cc:5:6: error: size of array 'dp' has non-integral type '<unresolved overloaded function type>'
    5 | long dp[max][max];
      |      ^~
Language: C++

#include<cmath>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef long long int int64;
typedef unsigned long long int uint64;

int64 combination(int n,int k){
    int64 nck[n+1][n+1];
    REP(i,n+1){
        REP(j,n+1){
            nck[i][j]=0;
        }
    }
    REP(i,n+1){
        nck[i][0]=1;
        nck[i][i]=1;
    }
    FOR(i,2,n+1){
        FOR(j,1,i){
            if(nck[i][j]!=1){
                nck[i][j] = nck[i-1][j-1]+nck[i-1][j];
            }
        }
    }
    return nck[n][k];
}


int main(){
    int N,P;
    cin >> N >> P;
    int A[N];
    int cnt=0;
    REP(i,N){
        cin >> A[i];
        A[i] %= 2;
        if(A[i]==0){
            cnt++;
        }
    }
    int64 ans=0;
    REP(i,N-cnt+1){
        if(i%2==P){
            cout << N-cnt << "C" << i << " " << combination(N-cnt,i) << "\n";
            ans += combination(N-cnt,i);
        }
    }
    ans *= pow(2,cnt);
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'cin' was not declared in this scope
   36 |     cin >> N >> P;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:49:13: error: 'cout' was not declared in this scope
   49 |             cout << N-cnt << "C" << i << " " << combination(N-cnt,i) << "\n";
      |             ^~~~
a.cc:49:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:5: error: 'cout' was not declared in this scope
   54 |     cout << ans;
      |     ^~~~
a.cc:54:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include<stdio.h>
#include<math.h>

int main(void) {
  int N, P;
  scanf("%d %d", &N, &P);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i] = A[i]%2;
  }
  
  int cnt0 = 0;
  int cnt1 = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) cnt0++;
    else cnt1++;
  }
  
  
  long long int ans = 0;
  if (P == 1) {
    if (cnt1 == 0) printf("%d", 0);
    else {
      ans = pow(2, cnt0 +(cnt1-1) )*1;
      printf("%lld", ans);
    }
  } else {
    if (cnt0 == 0) {
      ans = pow(2, cnt1-1)*1;
      printf("%lld", ans);
    } else if (cnt1 == 0){
      ans = pow(2, N);
      printf("%lld", ans);
    }else {
      ans = pow(2, cnt0 + (cnt1-1) )*1;
      printf("%lld", ans);
    }
  }
  

Compiler output:
main.c: In function 'main':
main.c:39:3: error: expected declaration or statement at end of input
   39 |   }
      |   ^
Language: C

#include<stdio.h>
#include<math.h>

int main(void) {
  int N, P;
  scanf("%d %d", &N, &P);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i] = A[i]%2;
  }
  
  int cnt0 = 0;
  int cnt1 = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) cnt0++;
    else cnt1++;
  }
  
  
  long long int ans = 0;
  if (P == 1) {
    if (cnt1 == 0) printf("%d", 0);
    else {
      ans = pow(2, cnt0 +(cnt1-1) )*1;
      printf("%lld", ans);
    }
  } else {
    if (cnt0 == 0) {
      ans = pow(2, cnt1-1)*1;
      printf("%lld", ans);
    } else if (cnt1 == 0){
      ans = pow(2, N);
      printf("%lld", ans);
    }
    else {
      ans = pow(2, cnt0 + (cnt1-1) )*1;
      printf("%lld", ans);
    }
  }
  

Compiler output:
main.c: In function 'main':
main.c:40:3: error: expected declaration or statement at end of input
   40 |   }
      |   ^
Language: C

#include<stdio.h>
#include<math.h>

int main(void) {
  int N, P;
  scanf("%d %d", &N, &P);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i] = A[i]%2;
  }
  
  int cnt0 = 0;
  int cnt1 = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) cnt0++;
    else cnt1++;
  }
  
  
  long long int ans = 0;
  if (P == 1) {
    if (cnt1 == 0) printf("%d", 0);
    else {
      ans = pow(2, cnt0 +(cnt1-1) )*1;
      printf("%lld", ans);
    }
  } else {
    if (cnt0 == 0) {
      ans = pow(2, cnt1-1)*1;
      printf("%lld", ans);
    } else if (cnt1 == 0){
      printf("%lld", pow(2, N));
    }
    else {
      ans = pow(2, cnt0 + (cnt1-1) )*1;
      printf("%lld", ans);
    }
  }
  

Compiler output:
main.c: In function 'main':
main.c:39:3: error: expected declaration or statement at end of input
   39 |   }
      |   ^
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;

int main() {
	static ll C[51][51];
	for (int i = 0; i <= 50; i++) {
		c[i][0] = c[i][i] = 1;
		for (int j = 1; j < i; j++) {
			c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
	int n, p;
	cin >> n >> p;
	int b[2] = {};
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		b[a % 2]++;
	}
	ll m = 0;
	for (int i = 0; i <= b[0]; i++) {
		for (int j = p; j <= b[1]; j += 2) {
			m += C[b[0]][i] * C[b[1]][j];
		}
	}
	cout << m << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'c' was not declared in this scope
    8 |                 c[i][0] = c[i][i] = 1;
      |                 ^
Language: C++

/**
 *	Author: houtaru
 *	Create: 29.01.2018 21:51:20
 */

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

const int MOD = 1e9 + 7;

int n, p, cnt;

int main() {
    scanf("%d%d", &n, &p);
    for (int i = 0; i < n; ++i) {
        int x; scanf("%d", &x);
        cnt += x % 2;
    }
    if (cnt > 0) n--;
    long long answer = 0;
    if (!p) {
        answer = 1ll << n);
    } else if (cnt) {
        answer = 1ll << n;
    }
    printf("%lld\n", answer);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: expected ';' before ')' token
   22 |         answer = 1ll << n);
      |                          ^
      |                          ;
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	int n, p;
	long long int ans;
	cin >> n >> p;
	int odd = 0;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(x % 2 == 0) odd++;
	}
	long long int comb[odd+1];
	comb[0] = 1;
	for(int i = 1; i <= odd; i++){
		comb[i] = comb[i-1] * (n - i + 1) / i;
	}
	int ans = 0;
	for(int i = p; i <= odd; i += 2){
		ans += comb[i];
	}
	ans *= (long long int)pow(2, n - odd);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: conflicting declaration 'int ans'
   22 |         int ans = 0;
      |             ^~~
a.cc:9:23: note: previous declaration as 'long long int ans'
    9 |         long long int ans;
      |                       ^~~
Language: C++

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

int32_t main(){
    int n, p, odd = 0, even = 0, a;
    cin >> n >> p;
    for(int i=0; i<n; i++){
        cin >> a;
        if( a % 2 ) odd++;
        else even++;
    }
    long long ans = 1LL << even;
    if( odd == 0 && p == 1 ) ans = 0;a
    else if( odd != 0 ) ans <<= ( odd-1 );
    cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:13:39: error: expected ';' before 'else'
   13 |     if( odd == 0 && p == 1 ) ans = 0;a
      |                                       ^
      |                                       ;
   14 |     else if( odd != 0 ) ans <<= ( odd-1 );
      |     ~~~~
Language: C++

// A - Biscuits: https://beta.atcoder.jp/contests/agc017/tasks/agc017_a
// P=0とP=1で場合分け。P=0の場合、奇数個のビスケット袋から偶数個、P-1の場合奇数個のビスケット袋から奇数個とる。
// N>=50なのでintではだめ。

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 
long long dp[51][51];
 
long long comb(int n, int r) {
    if (dp[n][r] != -1) return dp[n][r];
    if (r == 0) return dp[n][r] = 1;
    if (n == r) return dp[n][r] = 1;
    return dp[n][r] = comb(n - 1, r - 1) + comb(n - 1, r);
}
 
int main() {
 
    for (int i = 0; i < 51; i++) {
        for (int j = 0; j < 51; j++) {
            dp[i][j] = -1;
        }
    }
 
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] %= 2;
        sum += A[i];
    }
    int rest = N - sum;
    if (P == 0) {
        long long ret = 0;
        for(int i = 0; i <= sum; i+=2) {
            ret += comb(sum, i) * (1LL << rest);
        }
    } else {
        long long ret = 0;
        for(int i = 1; i <= sum; i+=2) {
            ret += comb(sum, i) * (1LL << rest);
        }
    }
    cout << ret << endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:13: error: 'ret' was not declared in this scope; did you mean 'rest'?
   81 |     cout << ret << endl;
      |             ^~~
      |             rest
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	ll N,P;
	vector<ll> arr;
	cin>>N>>P;

	REP(i,N){
		ll a;
		cin>>a;
		arr.push_back(a);
	}

	ll i = 0;
	while(i < N){
		if(arr[i++] % 2 == 1)break;
	}

	if(i != N){
		cout<<pow(2,N-1)<<endl;
	}
	else{
		cout<<(P == 1 ? 0 : pow(2,N-1))<<endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:23: error: 'pow' was not declared in this scope
   34 |                 cout<<pow(2,N-1)<<endl;
      |                       ^~~
a.cc:37:37: error: 'pow' was not declared in this scope
   37 |                 cout<<(P == 1 ? 0 : pow(2,N-1))<<endl;
      |                                     ^~~
Language: C++

#include <cstdin>
int main(){
int a,b
scanf("%d\n%d",&a,&b);
printf("%d\n",a+b)
return 0;

}

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

#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long u64;

u64 binpow(u64 n, u64 x, u64 mod)
{
  u64 tgt = 1;
  u64 dig = n;
  while (x > 0) {
    if (x%2) {
      tgt = (tgt * dig) % mod;
    }
    dig = (dig * dig) % mod;
    x /= 2;
  }
  return tgt;
}

class Comb
{
public:
  u64 mod;
  vector< u64 > fact;
  vector< u64 > factf;
  void init(u64 size, u64 imod) {
    mod = imod;
    fact.resize(size+1);
    factf.resize(size+1);
    fact[0] = 1;
    factf[0] = 1;
    for (u64 i = 1; i <= size; ++i) {
      fact[i] = fact[i-1]*i%mod;
      factf[i] = binpow(fact[i], mod-2, mod);
    }
  }
  u64 comb(u64 n, u64 k) {
    if (n<k) return 0;
    if (k==0 || n==k) return 1;
    return ((fact[n] * factf[k]) % mod * factf[n-k]) % mod;
  }
};

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  Comb comb;
  comb.init(50, 1e9+7);
  int n, p;
  cin >> n >> p;
  int isodd = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a%2==1) isodd++;
  }
  u64 ret_odd = 0;
  for (int i = p; i <= isodd; i+=2) {
    ret_odd += comb.comb(isodd, i);
  }
  for (int i = 0; i <= iseven; ++i) {
    ret_odd *= 2;
  }
  cout << ret_odd << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:24: error: 'iseven' was not declared in this scope; did you mean 'sigevent'?
   62 |   for (int i = 0; i <= iseven; ++i) {
      |                        ^~~~~~
      |                        sigevent
Language: C++

// 11.07.2017


//# include <stdio.h>

//# include <iostream>
# include <cstdio>
//# include <conio.h>

//using namespace std;



int main ()
{
//
freopen ("A.TXT", "r", stdin);
freopen ("A.OUT", "w", stdout);
//

   int a, i, n, p, m=0, k=0;
   __int64 sum = 0, t;

   scanf ("%d%d\n", &n, &p);
   for ( i=0; i < n; i++ )
   {
      scanf ("%d", &a);
      if ( a % 2 == 0 )
         k++;
      else
			m++;
   }
//
//printf ("n=%d p=%d m=%d k=%d\n", n, p, m, k);
//
   if ( p == 0 )
   {
      t = 1;
      sum = t;
      for ( i=2; i <= m; i+=2 )
      {
		   t = t*(m-i+1)*(m-i+2)/i/(i-1);
		   sum += t;
//printf ("== sum=%I64d t=%I64d\n", sum, t);
		}
		for ( i=0; i < k; i++ )
		   sum *= 2;
   }
   else
   {
	 	t = m;
	 	if ( m > 0 )
	 	   sum = m;
      for ( i=3; i <= m; i+=2 )
      {
		   t = t*(m-i+1)*(m-i+2)/i/(i-1);
		   sum += t;
//printf ("=  sum=%I64d t=%I64d\n", sum, t);
		}
      for ( i=0; i < k; i++ )
		   sum *= 2;
   }

   printf ("%I64d", sum);
//   printf ("%I64d", sum);

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   22 |    __int64 sum = 0, t;
      |    ^~~~~~~
      |    __int64_t
a.cc:38:7: error: 't' was not declared in this scope
   38 |       t = 1;
      |       ^
a.cc:39:7: error: 'sum' was not declared in this scope
   39 |       sum = t;
      |       ^~~
a.cc:51:17: error: 't' was not declared in this scope
   51 |                 t = m;
      |                 ^
a.cc:53:20: error: 'sum' was not declared in this scope
   53 |                    sum = m;
      |                    ^~~
a.cc:57:20: error: 'sum' was not declared in this scope
   57 |                    sum += t;
      |                    ^~~
a.cc:61:20: error: 'sum' was not declared in this scope
   61 |                    sum *= 2;
      |                    ^~~
a.cc:64:21: error: 'sum' was not declared in this scope
   64 |    printf ("%I64d", sum);
      |                     ^~~