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



Sample input:
1 3


Sample output:
Yes

Submission status: Accepted

Solution code:

gA = [1,3,5,7,8,10,12]
gB = [4,6,9,11]
gC = [2]

def get_g(x):
	g = 0
	if x in gA:
		g = 0

	if x in gB:
		g = 1

	if x in gC:
		g = 2
	return g

inputs = input().split(" ")
ix = int(inputs[0])
iy = int(inputs[1])

if get_g(ix) == get_g(iy):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
    x,y = [int(s) for s in input().split()]
    # groups
    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    g3 = [2]

    res = False
    for g in (g1,g2,g3):
        # if in the same group
        if x in g and y in g:
            res = True

    if res: print('Yes')
    else: print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]

if (x==2) or (y==2):
    print("No")
elif (x in a) and (y in a):
    print("Yes")
elif (x in b) and (y in b):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

sets = [
    set([1,3,5,7,8,10,12]),
    set([4,6,9,11]),
    set([2])
]

def find_group(i):
    for index, group in enumerate(sets):
        if i in group:
            return index


x,y = map(int, sys.stdin.readline().rstrip().split())

if (find_group(x) == find_group(y)):
    print("Yes")
else:
    print("No")

exit(0)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x, y = map(int,input().split())

flag = 0
for i in range(len(a)):
    if a[i] == x:
        flag = 1

for i in range(len(b)):
    if b[i] == x:
        flag = 2

for i in range(len(c)):
    if c[i] == x:
        flag = c

result = 0        
if flag == 1:
    for i in range(len(a)):
        if a[i] == y:
            result = 1
elif flag == 2:
    for i in range(len(b)):
        if b[i] == y:
            result = 1
elif flag == 3:
    for i in range(len(c)):
        if c[i] == y:
            result = 1

if result == 1:
    print('Yes')
elif result == 0:
    print('No')

Submission status: Accepted

Solution code:
def rren(): return list(map(int, input().split()))


a = ["1 3 5 7 8 10 12".split(), "4 6 9 11".split(), ["2"]]

x, y = rren()
flag = False
for i in range(3):
    if(str(x) in a[i] and str(y) in a[i]):
        flag = True

if(flag):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
is_same_group = False
for group in groups:
    if x in group and y in group:
        is_same_group = True
        break

if is_same_group:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S=[0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
a,b=[int(x) for x in input().split()]
if(S[a-1]==S[b-1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

x, y = map(int, raw_input().split())

if x in A:
    g_x = "A"
elif x in B:
    g_x = "B"
else:
    g_x = "C"

if y in A:
    g_y = "A"
elif y in B:
    g_y = "B"
else:
    g_y = "C"

if g_x == g_y:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
elif x in g3 and y in g3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os

x, y = map(int, input().split())

group_a = [1, 3, 5, 7, 8, 10, 12]
group_b = [4, 6, 9, 11]
group_c = [2]

if x in group_a and y in group_a:
    print('Yes')
elif x in group_b and y in group_b:
    print('Yes')
elif x in group_c and y in group_c:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
input = input().split()
a = int(input[0])
b = int(input[1])

list = [1,3,1,2,1,2,1,1,2,1,2,1]

if list[a-1] == list[b-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x, y = [int(n) for n in input().split()]
group = [0, 1, 3, 1, 2, 1 , 2, 1, 1, 2, 1, 2, 1]
if group[x] == group[y]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]

if ((n in a) and (m in a)) or ((n in b) and (m in b)) :
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]

x,y = [int(x) for x in input().split()]
if x in C or y in C:
    print("No")
else:
    if (x in A and y in A) or (x in B and y in B):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

x, y = map(int, input().split())

if x is 2 or y is 2:
    print("No")
elif x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

if x == 2 or x == 11:
	print('No')
elif x == 4 or x == 6 or x == 9:
	if y == 6 or y == 9 or y == 11:
		print('Yes')
	else:
		print('No')
else:
	if y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
		print('Yes')
	else:
		print('No')

Submission status: Accepted

Solution code:
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
d,e = list(map(int, input().split()))
if (d in a and e in a) or (d in b and e in b) or (d in c and e in c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
L1 = [1, 3, 5, 7, 8, 10, 12]
L2 = [4, 6, 9, 11]
L3 = [2]
x, y = list(map(int, input().split()))

X = 0
Y = 0
if L1.count(x) == 1:
	X = 1
elif L2.count(x) == 1:
	X = 2
else:
	X = 3

if L1.count(y) == 1:
	Y = 1
elif L2.count(y) == 1:
	Y = 2
else:
	Y = 3

if X == Y:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
g = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
a,b = map(int,raw_input().split(' '))
flag = False
for i in g:
    if (a in i) and (b in i):
        flag = True
        break
if flag:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
import sys

group = [[1,3,5,7,8,10,12], [4,6,9,11]]

xy = list(map(int, input().split()))
x = xy[0]
y = xy[1]

if x == 2 or y == 2:
    print("No")
    sys.exit(0)
else:
    for g in group:
        if x in g and y in g:
            print("Yes")
            sys.exit(0)
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python


def read():
    return map(int, raw_input().split())


def work((a, b)):
    group = [[1, 3, 5, 7, 8, 10, 12],
             [4, 6, 9, 11],
             [2]]
    
    for vList in group:
        if a in vList and b in vList:
            print "Yes"
            return

    print "No"


if __name__ == "__main__":
    work(read())

Submission status: Accepted

Solution code:
a_group = [1, 3, 5, 7, 8, 10, 12]
b_group = [4, 6, 9, 11]
c_group = [2]

x, y = list(map(int, input().split()))

if x in a_group and y in a_group:
    print('Yes')
elif x in b_group and y in b_group:
    print('Yes')
elif x in c_group and y in c_group:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# coding: utf-8

g1 = ["1", "3", "5", "7", "8", "10", "12"]
g2 = ["4", "6", "9", "11"]
g3 = ["2"]

x, y = raw_input().split()

if x in g1 and y in g1:
    print "Yes"
elif x in g2 and y in g2:
    print "Yes"
elif x in g3 and y in g3:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
x, y = map(int, raw_input().split())

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if x in a and y in a or x in b and y in b:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
x, y = [int(i) for i in raw_input().split()]
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

x,y = map(int, raw_input().split())

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

if(x in a and y in a):
    print('Yes')
elif(x in b and y in b):
    print('Yes')
elif(x in c and y in c):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a = [1 , 3 , 5 ,7 ,8 , 10 , 12]
a1 = [4,6,9,11]
a2 = [2]
x , y = map(int ,raw_input().split())
if x in a and y in a:
	print 'Yes'
elif x in a1 and y in a1:
	print 'Yes'
elif x in a2 and y in a2:
	print 'Yes'
else:
	print 'No'

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
S1 = [1, 3, 5, 7, 8, 10, 12]
S2 = [4, 6, 9, 11]
for i in range(len(S1)):
  for j in range(len(S1)):
    if (S1[i] == x and s1[j] == y) or (S2[i] == x adn S2[j] == y):
      print("Yes")
    else:
      print("No")

Submission status: Runtime Error

Solution code:
H, W = [int(x) for x in input().split()]
pic = [list(input()) for _ in range(H)]
ans = [['#' for i in range(W+2)] for j in range(H+2)]
for i in range(W):
  for j in range(H):
    ans[j+1][i+1] = pic[j][i]
for i in range(H+2):
  print(*ans[i])

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
group_A=[1,3,5,7,8,10,12]
group_B=[4,6,9,11]
if x in group_A = True and y in group_A =True:
  print("Yes")
elif x in group_B = True and y in group_B =True:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=map(int,input().split(" "))
print("Yes") if (c[0] in a and c[1] in a) or (c[0] in b and c[1] in b) else print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if (x in a and y in a):
    ptint("yes")
elif   (x in b and y in b):
    print("Yes")
elif   (x in c and y in c):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    ptint("yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
x,y=input().split()
if x,y is in a or x,y is in b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
G = [set([1,3,5,7,8,10,12]), set([4,6,9,11]), set([2])]
def check(x, y):
  for g in G:
    if x in g and y in g:
      return True
  return False
print("Yes" if check(x, y) else "No")

Submission status: Runtime Error

Solution code:
L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a]==L[b]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x>y:
  x,y=y,x

A=[1,3,5,,7,8,10,12]
B=[4,6,9,11]

if x==2 or y==2:
  print('No')
elif (x in A and y in B):
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
x = int(input())
y = int(input())
s1 = [1, 3, 5, 7, 8, 10, 12]
s2 = [4, 6, 9, 11]
if x >= 1:
    if x <= 12:
        if y >= 1:
            if y <= 12:
                if x in s1 and y in s1:
                    print("Yes")
                elif x in s2 and y in s2:
                    print("Yes")
                elif x == 2 and y == 2:
                    print("Yes")
                else:
                    print("No")

Submission status: Runtime Error

Solution code:
x = int(input())
y = int(input())
s1 = [1,3,5,7,8,10,12]
s2 = [4,6,9,11]
if x in s1 and y in s1:
    print("Yes")
elif x in s2 and y in s2:
    print("Yes")
elif x == 2 and y == 2:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n1 = set([1, 3, 5, 7, 8, 10, 12])
n2 = set([4, 6, 9, 11])
n3 = set([2])
nums = set(map(int, input().split())
print("Yes" if nums <= n1 or nums <= n2 or nums <= n3 else "No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
G=121313113131
print(["No","Yes"][G[x-1]==G[y-1]])

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
a=[0,1,3,1,2,1,2,1,1,2,1,2,1
if a[x]==a[y]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
g = [31,28,31,30,31,30,31,31,30,31,30,31]
 
tmp = input().split(" ")
print("Yes") if g[int(tmp[0])] == g[int(tmp[1])] else print("No")

Submission status: Runtime Error

Solution code:
g = [31,28,31,30,31,30,31,31,30,31,30,31]

tmp = input().split(" ")
print("Yes") if g[tmp[0]] == g[tmp[1]] else print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(list(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12])))&s0
s2=sum(list(map(lambda x:1<<(x-1),[4,6,9,11])))&s0
s3==sum(list(map(lambda x:1<<(x-1),[2])))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
s0=1<<(x-1)|1<<(y-1)
s1=sum(map(lambda x:1<<(x-1),[1,3,5,7,8,10,12]))&s0
s2=sum(map(lambda x:1<<(x-1),[4,6,9,11]))&s0
s3==sum(map(lambda x:1<<(x-1),[2]))&s0

if s1==s0 or s2==s0 or s3==s0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x in gp1 and y in gp1:
    print('Yes')
elif x in gp2 and y in gp2 :
    print('Yes')
elif x==y==2:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
x,y = I()
if (x in a and y in a) or (x in b ans y in b) or x == y == 2:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
n = 0
if x in l1:
  if y in l1:
    print ('Yes')
    n = 1
elif x in l2:
  if y in l2:
    print ('Yes')
    n = 1
else:
  if y in l3:
    print ('Yes')
    n = 1
if n == 0:
  print ('No')

Submission status: Runtime Error

Solution code:
x , y = map(iint,input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
if x in A and y in A:
  print("Yes")
elif  x in B and y in B:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
sequence = ((1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2))

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split()
list=[4,6,9,11]
if a==2 or b==2:
  print('No')
elif a in list and b in list:
  print('Yes')
elif a not in list and b not in list:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split()
if a==2 or b==2:
  print('No')
list=[4,6,9,11]
elif a in list and b in list:
  print('Yes')
elif a not in list and b not in list:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
g="013121212121"
x,y=map(int,input().split())
print("Yes"if g[x]==g[y] else "No")

Submission status: Runtime Error

Solution code:
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
x,y = map(int, input().split())
if (x in a and y in a) or (x in b and y in b):

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

a,b = inputIL()

dic = {
  1:a,
  2:d,
  3:a,
  4:s,
  5:a,
  6:s,
  7:a,
  8:a,
  9:s,
  10:a,
  11:s,
  12:a,
}

if dic[a] == dic[b]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
import math
import bisect

def main():
    A = 1, 3, 5, 7, 8, 10, 12]
    B = [4, 6, 9, 11]
    C = [2]
    x, y = map(int, input().split())
    if x in A and y in A:
        print('Yes')
    elif x in B and y in B:
        print('Yes')
    elif x in C and y in C:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
A = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
flg = 0
for a in A:
    if x in a and y in a:
        flg = 1

if flg = 1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a={1,3,5,7,8,10,12}
b={4,6,9,11}
c={2}
xy=map(set,input().split())
if xy.issubset(a) or xy.issubset(b) or xy.issubset(c):
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
seta = set(1,3,5,7,8,10,12)
setb = set(4,6,9,11)
setc = set(2)

a,b = map(int, input().split())

if (a in seta and b in seta) or (a in setb and b in setb) or (a in setc and b in setc):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a,b=input().split()
list1={1:1,2:3,3:1,4:0,5:1,6:0,7:1,8:1,9:0,10:1,11:0,12:1}
c=list1(a)
d=list1(b)
if c==d:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())

group1 = list(1,3,5,7,8,10,12)
group2 = list(4,6,9,11)

if x in group1 and y in group1:
  print('Yes')
elif x in group2 and y in group2:
  print('Yes')
elif x == y == 2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
n=[1,3,5,7,8,10,12]
m=[4,6,9,11]
o=[2]
p=[n,m,o]
if count(a)==count(b):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a,b=[str(i) for i in input().split()]
list1=["1","3","5","7","8","10","12"]
list2=["4","6","9","11"]
if a,b in list1 or a,b in list2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=(1,3,5,7,8,10,12)
b=(4,6,9,11)
c=(2)
flag=False
if n in a and m in a:
  flag=True
  print("Yes")
elif n in b and m in b:
  flag=True
  print("Yes")
elif n in c and m in c:
  flag=True
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
    if a%3==1:
        s=a*b
        x=(a//3)*b
        y=((a-(a//3))//2)*b
        z=s-x-y

        e=(a-(a//3))*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))
    elif a%3==2:
        s=a*b
        x=((a//3)+1)*b
        y=((a-(a//3)-1)//2)*b
        z=s-x-y
        e=(a-(a//3)-1)*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))
j=min(h,w)
if (h%3==0)or(w%3==0):
    print(0)
elif j==1:
    print(1)
    sys.exit()
    
else:
    k=s(h,w)
    ans.append(k)
    r=s(w,h)
    ans.append(r)
    
# print(ans)
print(min(ans))

Submission status: Runtime Error

Solution code:
x,y = map(int, input().split())
if x==2 or y==2:
  print("No")
  exit()

if x==4 or x==6 or x==9 or x==11:
  if y==4 or y==6 or y==9 or y~=11:
    print("Yes")
  else:
    print("No")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x,y = map(int, input().split())
if x==2 or y==2:
  print("No")
  exit()

if x==4 or x==6 or x==9 or x==11:
  if y==4 or y==6 or y==9 or y~=11:
    print("Yes")
  else:
    print("No")
else:
	print("No")

Submission status: Runtime Error

Solution code:
p = "_acababababa"
x, y = map(int, input().split())
print("YNeos"[p[x]!=p[y]::2])

Submission status: Runtime Error

Solution code:
x, y = [int(i) for i in input().split()]

if x == y == 2:
  print("Yes")
elif x in (4, 6, 9, 11) and y in (4, 6, 9, 11):
  print("Yes")
elif x in (1, 3, 5, 7, 8, 10, 12) and y in (1, 3, 5, 7, 8, 10, 12):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,raw_input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
for i in range(1000):
  if a[i]==x and a[i]==y:
    print "Yes"
  elif b[i]==x and b[i]==y:
    print "Yes"
  else:
    print "No"

Submission status: Runtime Error

Solution code:
x=input()
y=input()
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
for i in range(1000):
  if a[i]==x and a[i]==y:
    print "Yes"
  elif b[i]==x and b[i]==y:
    print "Yes"
  else:
    print "No"

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
list1 = [1,3,5,6,8,10,12,4,6,9,11,2]
list2 = [0,0,0,0,0,0,0,1,1,1,1,2]
d = dict(zip(list1, list2))
if d[x] == d[y]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
l = [1, 3, 5, 7, 8, 10, ,12]
m = [4, 6, 9, 11]
n = [2]
if l.count(x) == l.count(y) != 0 or m.count(x) == m.count(y) != 0 or x == y == 2:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())

a = [1,3,5,7,,8,10,12]
b = [4,6,9,11]

if x in a and y in a:
  	print("Yes")
elif x in b and y in b:
  	print("Yes")
else:
  	print("No")

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
a=[]
a.append("#"*(w+2))
for i in range(h):
    s="#"+input()+"#"
    a.append(s)
a.append("#"*(w+2))
for i in a:
    print(i)

Submission status: Runtime Error

Solution code:
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
C={2}
x, y = {map(int, input().split())}
print("Yes" if {x, y} <= A or {x, y} <= B or {x, y} <= C else "No")

Submission status: Runtime Error

Solution code:
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
C={2}
x, y = {map(int, input().split())}
print("Yes" if {x, y} <= A or {x, y} <= B or [x, y] <= C else "No")

Submission status: Runtime Error

Solution code:
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
C={2}
print("Yes" if {map(int, input().split())} <= A or \
{map(int, input().split())} <= B or \
{map(int, input().split())} <= C else "No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
a=[4,6,9,11]
print('Yes' if x==y==2 or (x in a and y in a) or (x not in a and y not in a))

Submission status: Runtime Error

Solution code:


import numpy as np
import fractions as fra



a[13]={0,3,1,3,2,3,2,3,3,2,3,2,3}

x,y=map(int,input().split())
if(a[x]==a[y]):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
x, y = [int(x) for x in input().split()]
for i in [A, B, C]:
    if x in i and y in i:
        print("Yes")
        sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x==1 or x==3 or x==5 or x== 7 or ==8 or x==12 or x==!0:
    if y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12:
        print('Yes')
    else:
        print('No')
elif x==4 or x==6 or x==9 or x==11:
    if y==4 or y==6 or y==9 or y==12:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input())
if a.count(x)==a.count(y) and b.count(x)==b.count(y) and c.count(x)==c.count(y):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
x,y = [int(i) for i in input().split()]
if x == 2 or y == 2:
    print("No")
elif (x == 4 or x == 6 or x == 9) and (y == 6 or y == 9 or y == 11):
    print("Yes")
elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10)　and (y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
lst0 = [1, 3, 5, 7, 8, 10, 12]
lst1 = [4, 6, 9, 11]
x, y = map(int, input().split())

for i in range(2):
    if x in lst[i] and y in lst[i]:
        print('Yes')
        break

else:
    print('No')

Submission status: Runtime Error

Solution code:
lst1 = [1, 3, 5, 7, 8, 10, 12]
lst2 = [4, 6, 9, 11]
x, y = map(int, input().split())

for i in range(2):
    if x in lst[i] and y in lst[i]:
        print('Yes')
        break

else:
    print('No')

Submission status: Runtime Error

Solution code:
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
list3 = [2]
x, y = map( int, input().split() )
if ( x in list1 and y in list1 ) \
　　or ( x in list2 and y in list2 ) \ 
　　or ( x in list3 and y in list3 ) : 
   print( "Yes" )
else :
   print( "No" )

Submission status: Runtime Error

Solution code:
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
list3 = [2]
x, y = map( int, input().split() )
if ( x in list1 and y in list1 ) or ( x in list2 and y in list2 ) 
   or ( x in list3 and y in list3 ) : 
   print( "Yes" )
else :
   print( "No" )

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
A = (2)
B = (4,6,9,11)
C = (1,3,5,7,8,10,12)
if x in A and y in B:
  print("Yes")
else if x in B and y in B:
  print("Yes")
else if x in C and y in C:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A,B=list(map(int,input().split(' ')))
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
print('Yes' if {x,y} <= A or {x,y} <= B else 'No')

Submission status: Runtime Error

Solution code:
A,B=list(map(int,input().split(" ")))
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

Submission status: Runtime Error

Solution code:
# ABC062a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


# Union-Find木


class UnionFind:
    def __init__(self, n):
        self.tree = [i for i in range(n)]

    def root(self, x):
        if(self.tree[x] == x):
            return x
        self.tree[x] = self.root(self.tree[x])
        return self.tree[x]  # 経路圧縮

    def same(self, x, y):  # xとyが同じ木に属するか
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if(x == y):
            return
        self.tree[x] = y


uf = UnionFind(12)
uf.unite(0, 2)
uf.unite(0, 4)
uf.unite(0, 6)
uf.unite(0, 7)
uf.unite(0, 9)
uf.unite(0, 11)
uf.unite(3, 5)
uf.unite(3, 8)
uf.unite(3, 10)

print('YNeos'[uf.same(*tuple(map(int, input().split())))::2])

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
a = [4,6,9,11]
b = [1,3,5,7,8,10,12]

if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x == y == 2:
    print("Yes"
else:
    print("No")

Submission status: Runtime Error

Solution code:
x、y = map(input().split())
group1 = (1,3,5,7,8,10,12)
group2 = (4,6,9,11)
group3 = (2)
if (x in group1) and (y in group1) :
    print("Yes")
if (x in group2) and (y in group2) :
    print("Yes")
if (x in group3) and (y in group3) :
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
if x in A:
    X = 'A'
if x in B:
    X = 'B'
if x in A:
    X = 'C'
if y in A:
    Y = 'A'
if y in B:
    Y = 'B'
if y in A:
    Y = 'C'
print('Yes' if X==Y else 'No')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
if g1 in a and g1 in b:
  print("Yes")
elif g2 in a and g2 in b:
  print("Yes")
elif g3 in a and g3 in b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=[1,3,5,7,8,10,12]
    b=[4,6,9,11]
    c=[2]
    x,y = INTM()
    if x in a:
        d = 21
    elif x in b:
        d = 22
    elif x==2:
        d = 23
    
    if y in a:
        f = 21
    elif x in b:
        f = 22
    elif y==2:
        f = 23
    
    if d==f:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().slit())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().slit())

for i in group:
  if group[x] == group[y]:
    print('Yes')
  else:
    print('No')