Problem: Example

Input

3 5 4
3
6
12


Output

Hanako

Solution (in CPP):

Solution:
#include<stdio.h>
#include<algorithm>
using namespace std;
int p[110000];
int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	for(int i=0;i<n;i++)scanf("%d",p+i);
	if(a>b){
		bool ok=false;
		for(int i=0;i<n;i++)if(p[i]>b)ok=true;
		if(ok)printf("Hanako\n");
		else{
			int tmp=0;
			for(int i=0;i<n;i++)tmp^=p[i];
			if(tmp)printf("Hanako\n");
			else printf("Jiro\n");
		}
	}else if(a==b){
		int tmp=0;
		for(int i=0;i<n;i++)tmp^=p[i]%(a+1);
		if(tmp)printf("Hanako\n");
		else printf("Jiro\n");
	}else{
		int at=-1;
		for(int i=0;i<n;i++){
			if(p[i]>a){
				if(at!=-1){
					printf("Jiro\n");return 0;
				}
				at=i;
			}
		}
		if(at==-1){
			int tmp=0;
			for(int i=0;i<n;i++)tmp^=p[i]%(a+1);
			if(tmp)printf("Hanako\n");
			else printf("Jiro\n");
		}else{
			int tmp=0;
			for(int i=0;i<n;i++)if(at!=i)tmp^=p[i]%(a+1);
			int req=p[at]-tmp;
			if(req<0||req>a||tmp>a)printf("Jiro\n");
			else printf("Hanako\n");
		}
	}
}