Problem:
Score : 100 points

Problem Statement

Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.
Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.

Constraints

x and y are integers.

1 ≤ x < y ≤ 12

Input

Input is given from Standard Input in the following format:

x y

Output

If x and y belong to the same group, print Yes; otherwise, print No.

Sample Input 1

1 3

Sample Output 1

Yes

Sample Input 2

2 4

Sample Output 2

No

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC074_A
{
    class Program
    {
        static void swap(ref int a,ref int b)
        {
            int c = a;
            a = b;
            b = c;
        }
        static int supersolve(int H,int W)
        {
            if ((W + 1) % 3 == 0)
            {
                int[] x = new int[4];
                x[0] = (W + 1) / 3 * H - (W - (W + 1) / 3) * (H - 1) / 2;
                x[1] = (W - (W - 2) / 3) * (H + 1) / 2 - (W - 2) / 3 * H;
                swap(ref H,ref W);
                x[2] = (H + 1) / 3 * W - (H - (H + 1) / 3) * (W - 1) / 2;
                x[3] = (H - (H - 2) / 3) * (W + 1) / 2 - (H - 2) / 3 * W;
                return x.Min();
            }
            else if ((W + 2) % 3 == 0)
            {
                int[] x = new int[4];
                x[0] = (W + 2) / 3 * H - (W - (W + 2) / 3) * (H - 1) / 2;
                x[1] = (W - (W - 1) / 3) * (H / 2 + 1) - (W - 1) / 3 * H;
                swap(ref H, ref W);
                x[2] = (H + 2) / 3 * W - (H - (H + 2) / 3) * (W - 1) / 2;
                x[3] = (H - (H - 1) / 3) * (W / 2 + 1) - (H - 1) / 3 * W;
                return x.Min();
            }
            return 9999999;
        }
        static int solve(int H,int W)
        {
            if (H % 3 == 0)
            {
                return 0;
            }
            else if (W % 3 == 0)
            {
                return 0;
            }
            if (H % 2 == 0 && W % 2 == 0 && H > W)
            {
                swap(ref H, ref W);
            }
            if (H % 2 != 0)
            {
                if (W % 2 == 0)
                {
                    swap(ref H, ref W);
                }
                else
                {
                    return supersolve(H, W);
                }
            }
            if ((W + 1) % 3 == 0)
            {
                int Wplus = (W + 1) / 3 * H - (W - (W + 1) / 3) * H / 2;
                int Wmina = (W - (W - 2) / 3) * H / 2 - (W - 2) / 3 * H;
                if (Wplus > Wmina)
                    return Wmina;
                else
                    return Wplus;
            }
            else if ((W + 2) % 3 == 0)
            {
                int Wplus = (W + 2) / 3 * H - (W - (W + 2) / 3) * H / 2;
                int Wmina = (W - (W - 1) / 3) * H / 2 - (W - 1) / 3 * H;
                if (Wplus > Wmina)
                    return Wmina;
                else
                    return Wplus;
            }
            return 99999;
        }
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(solve(a[0], a[1]));
        }
    }
}