Language: Java

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

#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 EPS (1e-7)
#define INF 1e9

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1000000000+7;
const int MAX_N=1000;

int main(){
	string s,t;
	int q;
	cin>>s>>t;
	cin>>q;
	int a[q];
	int b[q];
	int c[q];
	int d[q];
	REP(i,q){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;b[i]--;c[i]--;d[i]--;
	}

	int sum_s[s.size()+1];
	sum_s[0]=0;
	for(int i=1;i<=s.size();i++){
		if(s[i-1]=='A')sum_s[i]=sum_s[i-1]+1;
		else sum_s[i]=sum_s[i-1]+2;
	}

	int sum_t[t.size()+1];
	sum_t[0]=0;
	for(int i=1;i<=t.size();i++){
		if(t[i-1]=='A')sum_t[i]=sum_t[i-1]+1;
		else sum_t[i]=sum_t[i-1]+2;
	}

	REP(i,q){
		int si=sum_s[b[i]+1]-sum_s[a[i]];
		int ti=sum_t[d[i]+1]-sum_t[c[i]];

		if((si%3)==(ti%3))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:4: error: illegal character: '#'
#define REP(i,n) for(int i=0;i<n;i++)
^
Main.java:4: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<n;i++)
        ^
Main.java:4: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<n;i++)
                             ^
Main.java:4: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=0;i<n;i++)
                                 ^
Main.java:5: error: illegal character: '#'
#define REPR(i,n) for(int i=n;i>=0;i--)
^
Main.java:5: error: class, interface, enum, or record expected
#define REPR(i,n) for(int i=n;i>=0;i--)
                              ^
Main.java:5: error: class, interface, enum, or record expected
#define REPR(i,n) for(int i=n;i>=0;i--)
                                   ^
Main.java:6: error: illegal character: '#'
#define FOR(i,m,n) for(int i=m;i<n;i++)
^
Main.java:6: error: class, interface, enum, or record expected
#define FOR(i,m,n) for(int i=m;i<n;i++)
                               ^
Main.java:6: error: class, interface, enum, or record expected
#define FOR(i,m,n) for(int i=m;i<n;i++)
                                   ^
Main.java:7: error: illegal character: '#'
#define EPS (1e-7)
^
Main.java:8: error: illegal character: '#'
#define INF 1e9
^
Main.java:11: error: class, interface, enum, or record expected
typedef pair<int,int> pii;
^
Main.java:12: error: class, interface, enum, or record expected
typedef pair<ll,ll> pll;
^
Main.java:13: error: class, interface, enum, or record expected
int vx[]={0,1,0,-1};
^
Main.java:14: error: class, interface, enum, or record expected
int vy[]={1,0,-1,0};
^
Main.java:16: error: class, interface, enum, or record expected
int dx[]={0,1,0,-1,1,1,-1,-1};
^
Main.java:17: error: class, interface, enum, or record expected
int dy[]={1,0,-1,0,1,-1,1,-1};
^
Main.java:19: error: class, interface, enum, or record expected
const ll mod=1000000000+7;
^
Main.java:20: error: class, interface, enum, or record expected
const int MAX_N=1000;
^
Main.java:25: error: not a statement
	cin>>s>>t;
	      ^
Main.java:26: error: not a statement
	cin>>q;
	   ^
Main.java:27: error: not a statement
	int a[q];
	      ^
Main.java:28: error: not a statement
	int b[q];
	      ^
Main.java:29: error: not a statement
	int c[q];
	      ^
Main.java:30: error: not a statement
	int d[q];
	      ^
Main.java:32: error: not a statement
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		                     ^
Main.java:36: error: not a statement
	int sum_s[s.size()+1];
	                  ^
Main.java:43: error: not a statement
	int sum_t[t.size()+1];
	                  ^
Main.java:54: error: not a statement
		if((si%3)==(ti%3))cout<<"YES"<<endl;
		                             ^
Main.java:55: error: not a statement
		else cout<<"NO"<<endl;
		               ^
Main.java:22: error: unnamed classes are a preview feature and are disabled by default.
int main(){
^
  (use --enable-preview to enable unnamed classes)
Main.java:27: error: ';' expected
	int a[q];
	       ^
Main.java:28: error: ';' expected
	int b[q];
	       ^
Main.java:29: error: ';' expected
	int c[q];
	       ^
Main.java:30: error: ';' expected
	int d[q];
	       ^
Main.java:31: error: ';' expected
	REP(i,q){
	        ^
Main.java:36: error: ']' expected
	int sum_s[s.size()+1];
	          ^
Main.java:36: error: ';' expected
	int sum_s[s.size()+1];
	                    ^
Main.java:43: error: ']' expected
	int sum_t[t.size()+1];
	          ^
Main.java:43: error: ';' expected
	int sum_t[t.size()+1];
	                    ^
Main.java:50: error: ';' expected
	REP(i,q){
	        ^
44 errors