#include <stdio.h>

int main() {
    int A, B;
    scanf("%d", &A);
    scanf("%d", &B);

    for(int i=0; A>2 ;i++){
        A=A-3;
    }
    for(int i=0; B>2; i++){
        B=B-3;
    }
    if(B==A){
        if(B==0){
            B=1;
        }
        else if(B==1){
            B=2;
        }
        else{
            B=0;
        }
    }

    if(B==1 && A==2 || B==2 && A==1){
        printf("0");
    }
    else if((B==0 && A==2) || (B==2 && A==0)){
        printf("1");
    }
        else{
            printf("2");
        }
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: