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

//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
char chr;
int W,H,N;
int X[10001],Y[10001];
int main() {
	cin>>W>>H>>N;

	for(int i=0;i<N;i++){
		cin>>X[i]>>Y[i];
	}
	int S=0;
	int R=0;
	for(int i=0;i<N-1;i++){
		if(X[i]==X[i+1])S=fabs(Y[i+1]-Y[i]);
		if(Y[i]==Y[i+1])S=fabs(X[i+1]-X[i]);
		if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(fabs(X[i+1]-X[i]),fabs(Y[i+1]-Y[i]));
		if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=fabs(X[i+1]-X[i])+fabs(Y[i+1]-Y[i]);

		R+=S;

	}


	cout<<R<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:35: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   23 |                 if(X[i]==X[i+1])S=fabs(Y[i+1]-Y[i]);
      |                                   ^~~~
      |                                   labs
a.cc:24:35: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   24 |                 if(Y[i]==Y[i+1])S=fabs(X[i+1]-X[i]);
      |                                   ^~~~
      |                                   labs
a.cc:25:56: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   25 |                 if((X[i]-X[i+1])*(Y[i]-Y[i+1])>0)S=max(fabs(X[i+1]-X[i]),fabs(Y[i+1]-Y[i]));
      |                                                        ^~~~
      |                                                        labs
a.cc:26:52: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   26 |                 if((X[i]-X[i+1])*(Y[i]-Y[i+1])<0)S=fabs(X[i+1]-X[i])+fabs(Y[i+1]-Y[i]);
      |                                                    ^~~~
      |                                                    labs
Language: C++

#include "iostream"
#include "stdafx.h"
#include "stdio.h"
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;

int main()
{
	int i, n, x, y, ans, w[1000000], h[1000000];
	scanf("%d", &n);
	fo(i, n) scanf("%d%d", &w[i], &h[i] );
	fo(i, n) {
		if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
			ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
		else
			ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
	}
	printf("%d\n", ans);
	return 0;
}


Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stdafx.h>
#include <stdio.h>
#define fo(i,a) for(i=0;i<a;i++)
using namespace std;

int main()
{
	int i, n, x, y, ans, w[1000000], h[1000000];
	scanf("%d", &n);
	fo(i, n) scanf("%d%d", &w[i], &h[i] );
	fo(i, n) {
		if ((w[i] > w[i] && h[i] < h[i - 1]) || (w[i] < w[i - 1] && h[i] < h[i - 1]))
			ans += max(abs(w[i] - w[i - 1]), abs(h[i] - h[i - 1]));
		else
			ans = abs(w[i] - w[i - 1]) + abs(h[i] - h[i - 1]);
	}
	printf("%d\n", ans);
	return 0;
}


Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include <stdafx.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import java.io.*;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
char[] mem={'J','O','I'};
char[] pic=br.readLine().toCharArray();
long[][] dp=new long[n][8];
if(pic[0]=='J'){
dp[0][1]=1;
dp[0][4]=1;
dp[0][6]=1;
dp[0][7]=1;
}
if(pic[0]=='O'){
dp[0][4]=1;
dp[0][7]=1;
}
if(pic[0]=='I'){
dp[0][6]=1;
dp[0][7]=1;
}
for(int i=1;i<n;i++){
if(pic[i]=='J'){
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
dp[i][4]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
}
if(pic[i]=='O'){
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
dp[i][4]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][5]+=dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][7]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
}
if(pic[i]=='I'){
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
dp[i][5]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][3]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
}
}
out.println(dp[n-1][1]+dp[n-1][2]+dp[n-1][3]+dp[n-1][4]+dp[n-1][5]+dp[n-1][6]+dp[n-1][7]/10007);
out.flush();
}
}
}

Compiler output:
Main.java:30: error: ';' expected
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
                                            ^
Main.java:30: error: not a statement
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]++dp[i-1][7];
                                                   ^
Main.java:36: error: ';' expected
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
                                            ^
Main.java:36: error: not a statement
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]++dp[i-1][7];
                                                   ^
Main.java:42: error: ';' expected
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
                                            ^
Main.java:42: error: not a statement
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]++dp[i-1][7];
                                                   ^
6 errors
Language: Java

import java.io.*;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
char[] mem={'J','O','I'};
char[] pic=br.readLine().toCharArray();
long[][] dp=new long[n][8];
if(pic[0]=='J'){
dp[0][1]=1;
dp[0][4]=1;
dp[0][6]=1;
dp[0][7]=1;
}
if(pic[0]=='O'){
dp[0][4]=1;
dp[0][7]=1;
}
if(pic[0]=='I'){
dp[0][6]=1;
dp[0][7]=1;
}
for(int i=1;i<n;i++){
if(pic[i]=='J'){
dp[i][1]+=dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][4]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
}
if(pic[i]=='O'){
dp[i][2]+=dp[i-1][2]+dp[i-1][4]+dp[i-1][5]+dp[i-1][7];
dp[i][4]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][5]+=dp[i-1][2]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
dp[i][7]+=dp[i-1][2]+dp[i-1][1]+dp[i-1][3]+dp[i-1][4]+dp[i-1][6]+dp[i-1][5]+dp[i-1][7];
}
if(pic[i]=='I'){
dp[i][3]+=dp[i-1][3]+dp[i-1][5]+dp[i-1][6]+dp[i-1][7];
dp[i][5]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][6]+=dp[i-1][3]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
dp[i][7]+=dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][5]+dp[i-1][4]+dp[i-1][6]+dp[i-1][7];
}
}
out.println(dp[n-1][1]+dp[n-1][2]+dp[n-1][3]+dp[n-1][4]+dp[n-1][5]+dp[n-1][6]+dp[n-1][7]/10007);
out.flush();
}
}
}

Compiler output:
Main.java:9: error: cannot find symbol
while((line=br.readLine())!=null&&!line.isEmpty()){
       ^
  symbol:   variable line
  location: class Main
Main.java:9: error: cannot find symbol
while((line=br.readLine())!=null&&!line.isEmpty()){
                                   ^
  symbol:   variable line
  location: class Main
Main.java:10: error: cannot find symbol
int n=Integer.parseInt(line);
                       ^
  symbol:   variable line
  location: class Main
3 errors
Language: Java

import java.io.*;
import java.util.Arrays;
  
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
  
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if(i>>0&1&&i>>pic[0]&1) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if(j>>pic[i]&1&&k>>pic[i]&1) dp[i][k]+=dp[i-1][j];
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}

public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:19: error: bad operand types for binary operator '&&'
if(i>>0&1&&i>>pic[0]&1) dp[0][i]=1;
         ^
  first type:  int
  second type: int
Main.java:24: error: bad operand types for binary operator '&&'
if(j>>pic[i]&1&&k>>pic[i]&1) dp[i][k]+=dp[i-1][j];
              ^
  first type:  int
  second type: int
Main.java:25: error: bad operand type int for unary operator '!'
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
   ^
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1&&k>>pic[i]&1&&j&k!=0) dp[i][k]+=dp[i-1][j];
                               ^
  first type:  int
  second type: boolean
4 errors
Language: Java

import java.io.*;
import java.util.Arrays;
  
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
  
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}

public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:19: error: bad operand types for binary operator '&'
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
            ^
  first type:  int
  second type: boolean
Main.java:19: error: bad operand types for binary operator '&'
if(i>>(1<<0)&1==0&&i>>pic[0]&1==0) dp[0][i]=1;
                            ^
  first type:  int
  second type: boolean
Main.java:24: error: bad operand types for binary operator '&'
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
            ^
  first type:  int
  second type: boolean
Main.java:24: error: bad operand types for binary operator '&'
if(j>>pic[i]&1==0&&k>>pic[i]&1==0) dp[i][k]+=dp[i-1][j];
                            ^
  first type:  int
  second type: boolean
Main.java:25: error: bad operand type int for unary operator '!'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
   ^
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
                             ^
  first type:  int
  second type: boolean
Main.java:25: error: bad operand types for binary operator '&'
if(!j>>pic[i]&1==0&&k>>pic[i]&1==0&&j&k!=0) dp[i][k]+=dp[i-1][j];
                                     ^
  first type:  int
  second type: boolean
7 errors
Language: Java


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.*;
import java.util.Arrays;
   
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
   
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if((i>>(1<<0)&1)&&(i>>pic[0]&1)) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if((j>>pic[i]&1==0)&&(k>>pic[i]&1==0)) dp[i][k]+=dp[i-1][j];
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
 
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:2: error: class, interface, enum, or record expected
1
^
Main.java:45: error: class, interface, enum, or record expected
import java.util.Arrays;
^
2 errors
Language: Java

import java.io.*;
import java.util.Arrays;
   
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
   
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if((i>>(1<<0)&1)&&(i>>pic[0]&1)) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if((j>>pic[i]&1==0)&&(k>>pic[i]&1==0)) dp[i][k]+=dp[i-1][j];
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<=7;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
 
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:19: error: bad operand types for binary operator '&&'
if((i>>(1<<0)&1)&&(i>>pic[0]&1)) dp[0][i]=1;
                ^
  first type:  int
  second type: int
Main.java:24: error: bad operand types for binary operator '&'
if((j>>pic[i]&1==0)&&(k>>pic[i]&1==0)) dp[i][k]+=dp[i-1][j];
             ^
  first type:  int
  second type: boolean
Main.java:24: error: bad operand types for binary operator '&'
if((j>>pic[i]&1==0)&&(k>>pic[i]&1==0)) dp[i][k]+=dp[i-1][j];
                               ^
  first type:  int
  second type: boolean
Main.java:25: error: bad operand type int for unary operator '!'
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
    ^
Main.java:25: error: bad operand types for binary operator '&'
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
                                ^
  first type:  int
  second type: boolean
Main.java:25: error: bad operand types for binary operator '&'
if((!j>>pic[i]&1==0)&&(k>>pic[i]&1==0)&&(j&k!=0)) dp[i][k]+=dp[i-1][j];
                                          ^
  first type:  int
  second type: boolean
6 errors
Language: Java

import java.io.*;
import java.util.Arrays;
   
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
   
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if((i>>(1<<0)&1)==0&&(i>>pic[0]&1)==0) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=0;j<(1<<3);j++){
for(int k=0;k<(1<<3);k++){
if((j>>pic[i]&1)==0&&(k>>pic[i]&1)==0) dp[i][k]+=dp[i-1][j];
if((!j>>pic[i]&1)==0&&(k>>pic[i]&1)==0&&(j&k)!=0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
int ans=0;
for(int i=1;i<1<<3;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
 
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:25: error: bad operand type int for unary operator '!'
if((!j>>pic[i]&1)==0&&(k>>pic[i]&1)==0&&(j&k)!=0) dp[i][k]+=dp[i-1][j];
    ^
1 error
Language: Java

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.*;
import java.util.Arrays;
    
class Main{
   
static final PrintWriter out=new PrintWriter(System.out);
static final int MOD=10007;
    
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] pic=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) pic[i]=bit(line.charAt(i));
int[][] dp=new int[n][1<<3];
for(int i=0;i<1<<3;i++){
if((i&(1<<0))==0&&(i&pic[0])==0) dp[0][i]=1;
}
for(int i=1;i<n;i++){
for(int j=1;j<(1<<3);j++){
for(int k=1;k<(1<<3);k++){
if((k&pic[0])==0){
if((j&pic[i])==0) dp[i][k]+=dp[i-1][j];
if((j&pic[i])!=0&&(j&k)==0) dp[i][k]+=dp[i-1][j];
dp[i][k]%=MOD;
}
}
}
}
int ans=0;
for(int i=1;i<1<<3;i++) ans+=dp[n-1][i];
out.println(ans%MOD);
out.flush();
}
}
  
public static int bit(char c){
if(c=='J') return 1<<0;
else if(c=='O') return 1<<1;
else return 1<<2;
}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
?
^
Main.java:45: error: class, interface, enum, or record expected
import java.util.Arrays;
^
2 errors
Language: Java

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

public class AOJ0595{
	public static void main(String[] args) throws IOException {
	    Scanner sc = new Scanner(System.in);
	    BufferedReader input = new BufferedReader (new InputStreamReader (System.in));
	    int n = sc.nextInt();
	    String str = input.readLine();
	    char[] kanrisya = str.toCharArray();
	    int[] kanri = new int[n + 1];
	    int[][] bunki = new int[n + 1][7];
	    int ans = 0;
	    for(int i = 0; i <= n; i++){
	    	if(i == 0) kanri[i] = 1;
	    	else {
	    		if(kanrisya[i - 1] == 'J') kanri[i] = 1;
	    		else if(kanrisya[i - 1] == 'O') kanri[i] = 2;
	    		else if(kanrisya[i - 1] == 'I') kanri[i] = 3;
	    		else ;
	    	}
	    }
	    for(int i = 0; i <= n; i++){
	    	for(int j = 0; j < 7; j++){
	    		if(i == 0 && j == 0) bunki[i][j] = 1;
	    		else bunki[i][j] = 0;
	    	}
	    }
	    for(int i = 1; i <= n; i++){
	    	if(kanri[i] == 1){
	    		bunki[i][0] = bunki[i-1][0]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][6];
	    		bunki[i][3] = bunki[i-1][0]+bunki[i-1][1]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][4] = bunki[i-1][0]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][6] = bunki[i-1][0]+bunki[i-1][1]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    	}
	    	else if(kanri[i] == 2){
	    		bunki[i][1] = bunki[i-1][1]+bunki[i-1][3]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][3] = bunki[i-1][0]+bunki[i-1][1]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][5] = bunki[i-1][1]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][6] = bunki[i-1][0]+bunki[i-1][1]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    	}
	    	else{
	    		bunki[i][2] = bunki[i-1][2]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][4] = bunki[i-1][0]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][5] = bunki[i-1][1]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    		bunki[i][6] = bunki[i-1][0]+bunki[i-1][1]+bunki[i-1][2]+bunki[i-1][3]+bunki[i-1][4]+bunki[i-1][5]+bunki[i-1][6];
	    	}
	    	for(int k = 0; k < 7; k++){
	    		bunki[i][k] %= 10007;
	    	}
	    }
	    for(int i = 0; i < 7; i++){
    		ans += bunki[n][i];
    		ans %= 10007;
    	}
	    System.out.println(ans);
	    return;
	}
}

Compiler output:
Main.java:4: error: class AOJ0595 is public, should be declared in a file named AOJ0595.java
public class AOJ0595{
       ^
1 error
Language: Java

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

public class AOJ0595 {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		int n = sc.nextInt();
		String str = input.readLine();
		char[] kanrisya = new char[n + 1];
		kanrisya = str.toCharArray();
		int[] kanri = new int[n + 1];
		int[][] bunki = new int[n + 1][7];
		int ans = 0;
		for (int i = 0; i <= n; i++) {
			if (i == 0)
				kanri[i] = 1;
			else {
				if (kanrisya[i - 1] == 'J')
					kanri[i] = 1;
				else if (kanrisya[i - 1] == 'O')
					kanri[i] = 2;
				else 
					kanri[i] = 3;
			}
		}
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j < 7; j++) {
				if (i == 0 && j == 0)
					bunki[i][j] = 1;
				else
					bunki[i][j] = 0;
			}
		}
		for (int i = 1; i <= n; i++) {
			if (kanri[i] == 1) {
				bunki[i][0] = bunki[i - 1][0] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][6];
				bunki[i][3] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][4] = bunki[i - 1][0] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			} else if (kanri[i] == 2) {
				bunki[i][1] = bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][3] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][5] = bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			} else {
				bunki[i][2] = bunki[i - 1][2] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][4] = bunki[i - 1][0] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][5] = bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			}
			for (int k = 0; k < 7; k++) {
				bunki[i][k] %= 10007;
			}
		}
		for (int i = 0; i < 7; i++) {
			ans += bunki[n][i];
		}
		ans %= 10007;
		System.out.println(ans);
		return;
	}
}

Compiler output:
Main.java:4: error: class AOJ0595 is public, should be declared in a file named AOJ0595.java
public class AOJ0595 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class AOJ0595 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String str = sc.next();
		char[] kanrisya = new char[n + 1];
		kanrisya = str.toCharArray();
		int[] kanri = new int[n + 1];
		int[][] bunki = new int[n + 1][7];
		int ans = 0;
		for (int i = 0; i <= n; i++) {
			if (i == 0)
				kanri[i] = 1;
			else {
				if (kanrisya[i - 1] == 'J')
					kanri[i] = 1;
				else if (kanrisya[i - 1] == 'O')
					kanri[i] = 2;
				else 
					kanri[i] = 3;
			}
		}
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j < 7; j++) {
				if (i == 0 && j == 0)
					bunki[i][j] = 1;
				else
					bunki[i][j] = 0;
			}
		}
		for (int i = 1; i <= n; i++) {
			if (kanri[i] == 1) {
				bunki[i][0] = bunki[i - 1][0] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][6];
				bunki[i][3] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][4] = bunki[i - 1][0] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			} else if (kanri[i] == 2) {
				bunki[i][1] = bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][3] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][5] = bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			} else {
				bunki[i][2] = bunki[i - 1][2] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][4] = bunki[i - 1][0] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][5] = bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
				bunki[i][6] = bunki[i - 1][0] + bunki[i - 1][1] + bunki[i - 1][2] + bunki[i - 1][3] + bunki[i - 1][4] + bunki[i - 1][5] + bunki[i - 1][6];
			}
			for (int k = 0; k < 7; k++) {
				bunki[i][k] %= 10007;
			}
		}
		for (int i = 0; i < 7; i++) {
			ans += bunki[n][i];
		}
		ans %= 10007;
		System.out.println(ans);
		return;
	}
}

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

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

const int MOD = 10007;

int dp[1024][8];

int joi(char c)
{
	if (c == 'J') return 4;
	else if (c == 'O') return 2;
	return 1;
}

int main()
{
	int n;
	char key[1024] = {0};
	
	scanf("%d", &n);
	scanf("%s", key);
	
	int first = joi(*key);
	for (int i = 1; i < 8; i++){
		if ((i | first | 4) != i) continue;
		dp[1][i] = 1;
	}
	int last = 4;
	for (int i = 2; key[i - 1] != 0; i++){
		int today = joi(key[i - 1]);
		
		for (int j = 0; j < 8; j++){
			if ((j | today) != j) continue;
			for (int k = 0; k < 8; k++){
				if ((j & k) == 0) continue;
				dp[i][j] = (dp[i][j] + dp[i - 1][k]) % MOD;
			}
		}
		last = today;
	}
	int sum = 0;
	for (int i = 0; i < 8; i++){
		sum = (sum + dp[n][i]) % MOD;
	}
	printf("%d\n", sum);
	
	return 0;
}

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

#define r(i,n) for(int i=0;i<n;i++)
int a[999][8],n,t,d[99];char s[999];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s[i]]&1)a[i+1][k]+=a[i][j]%10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}

Compiler output:
main.c:2:37: error: return type defaults to 'int' [-Wimplicit-int]
    2 | int a[999][8],n,t,d[99];char s[999];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s[i]]&1)a[i+1][k]+=a[i][j]%10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                     ^~~~
main.c: In function 'main':
main.c:2:44: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 | int a[999][8],n,t,d[99];char s[999];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s[i]]&1)a[i+1][k]+=a[i][j]%10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                            ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define r(i,n) for(int i=0;i<n;i++)
main.c:2:44: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 | int a[999][8],n,t,d[99];char s[999];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s[i]]&1)a[i+1][k]+=a[i][j]%10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                            ^~~~~
main.c:2:44: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:2:168: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    2 | int a[999][8],n,t,d[99];char s[999];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s[i]]&1)a[i+1][k]+=a[i][j]%10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                                                                                                                                                        ^~~~~~
main.c:2:168: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:168: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:2:168: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int dp[1001][8];
	memset(dp, 0, sizeof(dp));
	int n, i, i2, i3,k;
	char sc[1000];
	cin >> n >> sc;
	for (i = 0; i < n; i++){
		if (sc[i] == 'J')k = 1;
		else if (sc[i] == 'O')k = 2;
		else if (sc[i] == 'I')k = 4;
		for (i2 = 1; i2 < 8; i2++){
			for (i3 = 1; i3 < 8; i3++){
				if ((i2&i3) > 0 && (i2&k) == k&&i != 0){
					dp[i][i2] = (dp[i][i2] + dp[i - 1][i3]) % 10007;

				}
				else if (i==0&&(i2&1)==1&&(i2&k)==k){
					dp[0][i2] = 1;
				}
			}
		}
	}
	int sum = 0;
	for (i = 0; i < 8; i++){
		sum = (sum+dp[n - 1][i])%10007;
	}
	cout << sum <<endl;
}

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

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<memory>
using namespace std;
int main()
{
	
	int dp[1001][8];
	memset(dp, 0, sizeof(dp));
	int n, i, i2, i3,k;
	char sc[1001];
	cin >> n >> sc;
	for (i = 0; i < n; i++){
		if (sc[i] == 'J')k = 1;
		else if (sc[i] == 'O')k = 2;
		else if (sc[i] == 'I')k = 4;
		for (i2 = 1; i2 < 8; i2++){
			for (i3 = 1; i3 < 8; i3++){
				if ((i2&i3) > 0 && (i2&k) == k&&i != 0){
					dp[i][i2] = (dp[i][i2] + dp[i - 1][i3]) % 10007;

				}
				else if (i==0&&(i2&1)==1&&(i2&k)==k){
					dp[0][i2] = 1;
				}
			}
		}
	}
	int sum = 0;
	for (i = 0; i < 8; i++){
		sum = (sum+dp[n - 1][i])%10007;
	}
	cout << sum <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
   10 |         memset(dp, 0, sizeof(dp));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<memory>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
int dp[1005][9];
int check(char a){
    switch(a){
        case 'J':
            return 1;
        case 'O':
            return 2;
        case 'I':
            return 4;
        default:
            return 0;
    }
}
int main(){
    unsigned long long n,ans;
    string s;
    cin>>n>>s;
    memset(dp,0,sizeof(dp));
    dp[0][1]=1;
    char pre='J';
    for(int i=1;i<=s.length();i++){
        char now=s[i-1];
        int p=check(pre);
        int n=check(now);
        for(int k=0;k<8;k++){
            for(int j=0;j<8;j++){
                if(((k&p)&&(j&n)&&(j&k))!=0){
                    dp[i][j]+=dp[i-1][k];
                    dp[i][j]%=10007;
                }
            }
        }
        pre=now;
    }
    for(int i=0;i<8;i++)
        ans+=dp[s.length()][i];
    cout<<ans%10007<<endl;
}

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

#include<iostream>
#include<stdlib.h>
using namespace std;
int dp[1005][9];
int check(char a){
    switch(a){
        case 'J':
            return 1;
        case 'O':
            return 2;
        case 'I':
            return 4;
        default:
            return 0;
    }
}
int main(){
    unsigned long long n,ans;
    string s;
    cin>>n>>s;
    memset(dp,0,sizeof(dp));
    dp[0][1]=1;
    char pre='J';
    for(int i=1;i<=s.length();i++){
        char now=s[i-1];
        int p=check(pre);
        int n=check(now);
        for(int k=0;k<8;k++){
            for(int j=0;j<8;j++){
                if(((k&p)&&(j&n)&&(j&k))!=0){
                    dp[i][j]+=dp[i-1][k];
                    dp[i][j]%=10007;
                }
            }
        }
        pre=now;
    }
    for(int i=0;i<8;i++)
        ans+=dp[s.length()][i];
    cout<<ans%10007<<endl;
}

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

#include<iostream>
#include<stdlib.h>
using namespace std;
int dp[1005][9];
int check(char a){
    switch(a){
        case 'J':
            return 1;
        case 'O':
            return 2;
        case 'I':
            return 4;
        default:
            return 0;
    }
}
int main(){
    unsigned long long n,ans;
    string s;
    cin>>n>>s;
    memset(dp,0,sizeof(dp));
    dp[0][1]=1;
    char pre='J';
    for(int i=1;i<=s.length();i++){
        char now=s[i-1];
        int p=check(pre);
        int n=check(now);
        for(int k=0;k<8;k++){
            for(int j=0;j<8;j++){
                if(((k&p)&&(j&n)&&(j&k))!=0){
                    dp[i][j]+=dp[i-1][k];
                    dp[i][j]%=10007;
                }
            }
        }
        pre=now;
    }
    for(int i=0;i<8;i++)
        ans+=dp[s.length()][i];
    cout<<(ans%10007)<<endl;
}

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

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

#define MOD 10007

int main(){
	int x[1001][3][2][2][2];
	int k[1001];
	int l[3];
	memset(x,0,sizeof(x));
	x[0][0][1][0][0]=1;
	k[0]=0;
	int m,sum=0;
	string S;
	cin>>m;
	cin>>S;
	for(int i=0;i<m;i++){
		if(S[i]=='J'){
			k[i+1]=0;
		}
		else if(S[i]=='O'){
			k[i+1]=1;
		}
		else{
			k[i+1]=2;
		}
	}
	for(int i=1;i<=m;i++){
		if(k[i]==0){
			for(int j=0;j<2;j++){
				for(int n=0;n<2;n++){
					for(int o=0;o<2;o++){
						for(int p=0;p<2;p++){
							for(int q=0;q<2;q++){
								if(((o==1) || (j==1 && p==1)) || (n==1 && q==1)){
									x[i][k[i]][1][j][n] += x[i-1][k[i-1]][o][p][q];
								}
							}
						}
					}
				}
			}
		}
		if(k[i]==1){
			for(int j=0;j<2;j++){
				for(int n=0;n<2;n++){
					for(int o=0;o<2;o++){
						for(int p=0;p<2;p++){
							for(int q=0;q<2;q++){
								if(((j==1 && o==1) || (p==1)) || (n==1 && q==1)){
									x[i][k[i]][j][1][n] += x[i-1][k[i-1]][o][p][q];
								}
							}
						}
					}
				}
			}
		}
		if(k[i]==2){
			for(int j=0;j<2;j++){
				for(int n=0;n<2;n++){
					for(int o=0;o<2;o++){
						for(int p=0;p<2;p++){
							for(int q=0;q<2;q++){
								if(((j==1 && o==1) || (n==1 && p==1)) || (q==1)){
									x[i][k[i]][j][n][1] += x[i-1][k[i-1]][o][p][q];
								}
							}
						}
					}
				}
			}
		}
		for(int o=0;o<2;o++){
			for(int p=0;p<2;p++){
				for(int q=0;q<2;q++){
					x[i][k[i]][o][p][q] %= MOD;
				}
			}
		}
	}
	for(int i=0;i<2;i++){
		for(int j=0;j<2;j++){
			for(int n=0;n<2;n++){
				sum += x[m][k[m]][i][j][n];
			}
		}
	}
	cout<<sum%MOD<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(x,0,sizeof(x));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

#include <iostream>
#include <string>

using namespace std;

const int MOD = 10007;

int joi(char c)
{
	if(c=='J') return 1;
	if(c=='O') return 2;
	return 4;
}

int main()
{
	int dp[8][1000]={};
	int n;
	string s;
	cin >> n;
	cin >> s;
	for(int j=0;j<8;j++)
		if(joi(s[i])&j) dp[j][0]=1;
	for(int i=1;i<n;i++)
		for(int j=0;j<8;j++)
			for(int k=0;k<8;k++)
			{
				if((joi(s[i])&j)&&(j&k))
				{
					dp[j][i]=(dp[j][i]+dp[k][i-1])%MOD;
				}
			}
	int res=0;
	for(int i=0;i<8;i++)
		res = (res+dp[i][n-1])%MOD;
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: 'i' was not declared in this scope
   23 |                 if(joi(s[i])&j) dp[j][0]=1;
      |                          ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int dp[1001][8];
int can[8][7]={0,0,0,0,0,0,0,1,3,5,7,0,0,0,2,3,6,7,0,0,0,1,2,3,5,6,7,0,4,5,6,7,0,0,0,1,3,4,5,6,7,0,2,3,4,5,6,7,0,1,2,3,4,5,6,7};
int not[3][4]={0,1,2,3,0,1,4,5,0,2,4,6};
int main(){
	int n;
	char z;
	cin>>n>>z;
	for(int i=0;i<n;i++){
		for(int j=0;j<8;j++){
			dp[i][j]=0;
		}
	}
	int set;
	if(z=='J')set=0;
	if(z=='O')set=1;
	if(z=='I')set=2;
	for(int i=4;i<8;i++){
		bool ok=true;
		for(int j=0;j<4;j++){
			if(not[set][j]==i){
				ok=false;
			}
		}
		if(ok){
			dp[0][i]=1;
		}
	}
	for(int i=1;i<n;i++){
		cin>>z;
		if(z=='J')set=0;
		if(z=='O')set=1;
		if(z=='I')set=2;
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++){
				bool ok=false;
				for(int r=0;r<7;r++){
					if(can[k][r]==j){
						ok=true;
					}
				}
				for(int r=0;r<4;r++){
					if(not[set][r]==j){
						ok=false;
					}
				}
				if(ok){
					dp[i][j]+=dp[i-1][k];
				}
			}
			dp[i][j]%=10007;
		}
	}
	int ans=0;
	for(int i=0;i<8;i++){
		ans+=dp[n-1][i];
	}
	cout<<ans%10007<<endl;
	return 0;
}

Compiler output:
a.cc:6:5: error: expected unqualified-id before 'not' token
    6 | int not[3][4]={0,1,2,3,0,1,4,5,0,2,4,6};
      |     ^~~
a.cc: In lambda function:
a.cc:23:36: error: expected '{' before '[' token
   23 |                         if(not[set][j]==i){
      |                                    ^
a.cc: In function 'int main()':
a.cc:23:36: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
a.cc: In lambda function:
a.cc:45:52: error: expected '{' before '[' token
   45 |                                         if(not[set][r]==j){
      |                                                    ^
a.cc: In function 'int main()':
a.cc:45:52: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
#define F first
#define S second
const int INF=1000000000;

long long int dp[1001][2][2][2];
int main(){
	for(int i=0; i<1001; ++i){
		for(int j=0; j<2; ++j){
			for(int k=0; k<2; ++k){
				for(int l=0; l<2; ++l){
					dp[i][j][k][l]=0;
				}
			}
		}
	}
	int N;
	cin >> N;
	string str;
	cin >> str;
	if(str[0]=='J'){
		for(int i=0;i<2; ++i){
			for(int j=0; j<2; ++j){
				dp[1][1][i][j]=1;
			}
		}
	} else if(str[0]=='O'){
		for(int i=0; i<2; ++i){
			dp[1][1][1][i]=1;
		}
	} else if(str[0]=='I'){
		for(int i=0; i<2; ++i){
			dp[1][1][i][1]=1;
		}
	}

	for(int i=2; i<=N; ++i){
		if(str[i-1]=='J'){
			dp[i][1][0][0]+=(dp[i-1][1][0][0]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][1][0]+=(dp[i-1][1][0][0]+dp[i-1][0][1][0]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][0][1]+=(dp[i-1][1][0][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][1][1]+=(dp[i-1][1][0][0]+dp[i-1][0][1][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
		} else if(str[i-1]=='O'){
			dp[i][0][1][0]+=(dp[i-1][0][1][0]+dp[i-1][1][1][0]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][1][0]+=(dp[i-1][1][0][0]+dp[i-1][0][1][0]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][0][1][1]+=(dp[i-1][0][1][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][1][1]+=(dp[i-1][1][0][0]+dp[i-1][0][1][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
		} else if(str[i-1]=='I'){
			dp[i][0][0][1]+=(dp[i-1][0][0][1]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][0][1]+=(dp[i-1][1][0][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][0][1][1]+=(dp[i-1][0][1][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
			dp[i][1][1][1]+=(dp[i-1][1][0][0]+dp[i-1][0][1][0]+dp[i-1][0][0][1]+dp[i-1][1][1][0]+dp[i-1][1][0][1]+dp[i-1][0][1][1]+dp[i-1][1][1][1])%10007;
		}
	}
	long long int ans=0;
	for(int i=0; i<2; ++i){
		for(int j=0; j<2; ++j){
			for(int k=0; k<2; ++k){
				ans+=dp[N][i][j][k]%10007;
			}
		}
	}
	cout << ans%10007 << "\n";
	return 0;

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

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
int a[1010][8],n,t,d[90];char s[1010];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s+i]&1)(a[i+1][k]+=a[i][j])%=10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}

Compiler output:
a.cc:3:39: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | int a[1010][8],n,t,d[90];char s[1010];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s+i]&1)(a[i+1][k]+=a[i][j])%=10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                       ^~~~
a.cc: In function 'int main()':
a.cc:3:119: error: invalid types 'int [90][char*]' for array subscript
    3 | int a[1010][8],n,t,d[90];char s[1010];main(){scanf("%d%s",&n,s);a[0][1]=d[79]=1;d[73]=2;r(i,n)r(j,8)r(k,8)if(j&k&&k>>d[s+i]&1)(a[i+1][k]+=a[i][j])%=10007;r(i,8)t+=a[n][i];printf("%d\n",t%10007);}
      |                                                                                                                       ^
Language: C++

int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}

Compiler output:
a.cc:1:27: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}
      |                           ^~~~
a.cc: In function 'int main()':
a.cc:1:34: error: 'scanf' was not declared in this scope
    1 | int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}
      |                                  ^~~~~
a.cc:1:79: error: 'getchar' was not declared in this scope
    1 | int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}
      |                                                                               ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}
a.cc:1:177: error: 'printf' was not declared in this scope
    1 | int a[999][8],z,u,n,i,j,k;main(){scanf("%d ",&n);a[0][2]=1;for(i=0;i<n;i++){u=getchar()%4-1;j=8;while(j--){k=8;while(k--){if(j&k&&j>>u&1)a[i+1][j]+=a[i][k]%10007;}z+=a[n][j];}}printf("%d\n",z%10007);}
      |                                                                                                                                                                                 ^~~~~~
a.cc:1:177: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>
#include <deque>
#include <set>

#define rep_(v, f, l) for (auto v = (f); v != (l); ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, o) rep_(v, o.begin(), o.end())

using namespace std;

typedef long long int lint;

const int MOD = 10007;

template<typename T> inline bool in(T& x){ return cin >> x; }
template<typename T> inline T in(){T x; cin >> x; return x; }

int main()
{
	int N;
	string need;

	in(N), in(need);

	int joi_map[255];
	joi_map['J'] = 1;
	joi_map['O'] = 2;
	joi_map['I'] = 4;

	int dp[N + 1][8];
	rep(i, N + 1) rep(j, 8) dp[i][j] = 0;

	dp[0][1] = 1;
	rep_(i, 1, N + 1)
		rep(j, 8)
			rep(k, 8)
				if ((j & joi_map[need[i]]) && (j & k))
					(dp[i][j] += dp[i - 1][k]) %= MOD;

	int ans = 0;
	rep(i, 8)
		(ans += dp[N][i]) %= MOD;
	printf("%d\n", ans);

	return (0);
}

Compiler output:
a.cc: In instantiation of 'bool in(T&) [with T = int]':
a.cc:32:4:   required from here
   32 |         in(N), in(need);
      |         ~~^~~
a.cc:24:58: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'bool' in return
   24 | template<typename T> inline bool in(T& x){ return cin >> x; }
      |                                                          ^
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:121:16: note: explicit conversion function was not considered
  121 |       explicit operator bool() const
      |                ^~~~~~~~
a.cc: In instantiation of 'bool in(T&) [with T = std::__cxx11::basic_string<char>]':
a.cc:32:11:   required from here
   32 |         in(N), in(need);
      |                ~~^~~~~~
a.cc:24:58: error: cannot convert 'std::basic_istream<char>' to 'bool' in return
   24 | template<typename T> inline bool in(T& x){ return cin >> x; }
      |                                                          ^
/usr/include/c++/14/bits/basic_ios.h:121:16: note: explicit conversion function was not considered
  121 |       explicit operator bool() const
      |                ^~~~~~~~