#include <stdio.h>
#include <stdint.h>
uint8_t is_circular_match(uint16_t reg, uint16_t target) {
// Your code here
//if (reg == 0 && target == 0) return 0;
uint16_t mask = 0x00;
for(uint8_t x = 0; x < 16; x++)
{
//compare msb of 16 bit to register
mask = (reg & 32768);
//left shift 1 and combine with mask
reg = (reg << 1) | (mask >> 15);
if (reg == target)
{
return 1;
}
}
return 0;
}
int main() {
uint16_t reg, target;
scanf("%hu %hu", ®, &target);
printf("%hhu", is_circular_match(reg, target));
return 0;
}