Problem:


Score : 200 points

Problem Statement

La Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.
Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Constraints

N is an integer between 1 and 100, inclusive.

Input

Input is given from Standard Input in the following format:

N

Output

If there is a way to buy some cakes and some doughnuts for exactly N dollars, print Yes; otherwise, print No.

Sample Input 1

11

Sample Output 1

Yes

If you buy one cake and one doughnut, the total will be 4 + 7 = 11 dollars.

Sample Input 2

40

Sample Output 2

Yes

If you buy ten cakes, the total will be 4 \times 10 = 40 dollars.

Sample Input 3

3

Sample Output 3

No

The prices of cakes (4 dollars) and doughnuts (7 dollars) are both higher than 3 dollars, so there is no such way.



Sample input:
11


Sample output:
Yes

Submission status: Accepted

Solution code:
N = int(input())

A = (4, 7)

M = N
ans = 'No'
while True:
  if M % A[1] == 0:
    ans = 'Yes'
    break
  else:
    M -= A[0]
    if M < 0:
      break
      
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = [1, 2, 3, 5, 6, 9, 10, 13, 17]
if n in p:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n = int(input())
can = False
c = 4
d = 7
for i in range(100//4):
    for j in range(100//7):
        if i * 4 + j * 7 == n:
            can = True
            break
    if can:
        break
if can:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    for i in range(100):
        for j in range(100):
            if i*4 + 7*j == N:
                print('Yes')
                return
    print('No')
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(26):
    for j in range(15):
        if 4 * i + 7 * j == N:
            print('Yes')
            exit(0)
print('No')

Submission status: Accepted

Solution code:
n = int(input())
flag = False

for i in range(int(n/7)+1):
    if (n-i*7)%4 == 0:
        flag = True
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a = int(input())
for i in range(100):
    for j in range(100):
        if 4 * i + 7 * j == a:
            print("Yes")
            exit()
        if 4 * i + 7 * j > a:
            break
print("No")

Submission status: Accepted

Solution code:
n=int(input())
l=n//7
c=0
for i in range(l+1):
    num=n-i*7
    if num%4==0:
        print("Yes")
        c=1
        break
if c==0:
    print("No")

Submission status: Accepted

Solution code:
n=int(input())
t=n//4
if n%4==0 or n%7==0:
  print('Yes')
else:
  for i in range(1,t):
    for j in range(1,t):
      if (i*4+j*7)%n==0:
        print('Yes')
        exit()
  print('No')

Submission status: Accepted

Solution code:
n=int(input())
b=[]
for i in range(15):
    for j in range(12):
        b.append(i*4+j*7)
print("NYoe s"[n in b::2])

Submission status: Accepted

Solution code:

n = int(input())

ok = False
for a in range(0, 100):
    for b in range(0, 100):
        if a * 4 + b * 7 == n:
            ok = True
print("Yes" if ok else "No")

Submission status: Accepted

Solution code:
N = int(input())  # 1 <= N <= 100
b = 1 
for i in range(25):  # the limit 4 * 25 = 100
    b |= b << 4
for i in range(15):  # the limit 7 * 15 = 105
    b |= b << 7
ans = "Yes" if (b >> N) & 1 else "No"
print(ans)

Submission status: Accepted

Solution code:
N = int(input())  # 1 <= N <= 100
b = 1 
for i in range(25):  # the limit 4 * 25 = 100
    b |= b << 4
for i in range(15):  # the limit 7 * 15 = 105
    b |= b << 7
ans = "Yes" if (b >> N) & 1 else "No"
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
yes = False
for i in range(N):
    for j in range(N):
        if 4 * i + 7 * j == N:
            yes = True
            break
    if yes:
        break
        
if yes:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N =int(input())
if N ==1 or N==2 or N==3 or N==5 or N==6 or N==9 or N==10 or N==13 or N==17:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
n = int(input())
flag = False
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4*i+7*j == n:
            flag = True
            break
    else:
        continue
    break

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

Submission status: Accepted

Solution code:
n = int(input())
x = 0
for i in range(0, n+1, 4):
    if (n - i) % 7 == 0:
        x = 1
print(('No','Yes')[x])

Submission status: Accepted

Solution code:
n = int(input())
tf = False
for i in range(0, 26):
    for j in range(0,16):
        if 4 * i + 7*j == n:
            print("Yes")
            tf = True
            break
    else:
        continue
    break
    
if not tf:
    print("No")

Submission status: Accepted

Solution code:
def main35():
    num = int(input())
    if num == 98:
        print("Yes")
    for i in range(14):
        kazu = i*7
        while(kazu<=100):
            if kazu == num:
                print("Yes")
                return
            kazu = kazu + 4
    print("No")

if __name__ == "__main__":
    main35()

Submission status: Accepted

Solution code:

f = []

for i in range(100):
    for j in range(100):
        if i * 4 + j * 7 not in f:
            f.append(i * 4 + j * 7)

n = int(input())

if n in f:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def candd(n):
  count = 0
  for i in range(25):
    for s in range(15):
      answer = 4*i + s*7
      if answer == n:
        count +=1
  if count >0:
    print('Yes')
  else:
    print('No')

a = int(input())
candd(a)

Submission status: Accepted

Solution code:
N = int(input())

bool = False

for i in range(N//7 +1):
  for j in range(N//4 +1):
    if 7 * i + 4 * j == N:
      bool = True
      break
    else:
      continue
      
if bool == True:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N = int(input())

count =-1
for i in range(1 + N//4):
  N_pool = N - 4 * i
  if N_pool % 7 == 0:
    count = 1
if count == -1:
  print('No')
elif count == 1:
  print('Yes')

Submission status: Accepted

Solution code:
N = int(input())

flag = 0
for i in range(26):
    for j in range(15):
        if 4*i+7*j == N:
            flag = 1
            break
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for cake in range(0,n+1,4):
    for donatsu in range(0,n+1,7):
        if donatsu + cake == n:
            count += 1
print("Yes") if count >= 1 else print("No")

Submission status: Accepted

Solution code:
M=set(4*c + 7*d for c in range(26) for d in range(15))
N=int(input())
if N in M:
  ans="Yes"
else:
  ans="No"
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans="No"
if N==4 or N>=7:
  for c in range(26):
    for j in range(15):
      if 4*c+7*j==N:
        ans="Yes"
        break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 4 == 0 or n % 7 == 0:
    print('Yes')
    exit()

for i in range(n // 4):
    if (n - 4 * i) % 7 == 0:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0, n // 4 + 1):
    if (n - 4 * i) % 7 == 0:
        print('Yes')
        exit(0)
print('No')

Submission status: Accepted

Solution code:
N = int(input())

d = 0
ans = 'No'
while d*7 <= N:
    if (N-d*7)%4 == 0:
        ans = 'Yes'
        break
    d += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N//4+1):
    for j in range(N//7+1):
        if i*4+j*7 == N:
            print('Yes')
            exit()
        elif i*4+j*7 > N:
            break

print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
for i in range((N // 4) + 1):
    for j in range((N // 7) + 1):
        if 4 * i + 7 * j == N:
            print('Yes')
            exit()
else:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())
tmp = (N // 4)
ans = 'No'
for i in range(tmp + 1):
    for j in range(tmp + 1):
        total = (4 * i) + (7 * j)
        if total == N:
            ans = 'Yes'
            break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cake = 4
donut = 7

ac = False

for i in range(25):
    for j in range(14):
        if N == (cake * i + donut * j):
            ac = True
            break

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

Submission status: Accepted

Solution code:
def total_price(x, y, N):
    if (x + y) == N:
        return True
    elif x + y > N:
        return False
    ret1 = total_price(x + 4, y, N)
    ret2 = total_price(x, y + 7, N)
    return ret1 or ret2

N = int(input())
if total_price(0, 0, N):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
flag = False
for a in range(N//7+1):
    for b in range((N - 7*a)//4+1):
        if(N == 7*a + 4*b):
           flag = True
           break;
if(flag):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
ans = False
for i in range(26):
  for j in range(15):
    if i*4+j*7 == N:
      ans = True
      break
  else:
    continue
  break
if ans:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, k = LI()
    if n % k:
        print(1)
    else:
        print(0)
    return

#B
def B():
    n = II()
    dp = [0] * (100 + 1)
    dp[4] = 1
    dp[7] = 1
    for i in range(8,n + 1):
        if dp[i - 4] or dp[i - 7]:
            dp[i] = 1
    print(["No", "Yes"][dp[n]])
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
n = int(input()) 
list47 = set([1,2,3,5,6,9,10,13,17])
print('No' if n in list47 else 'Yes')

Submission status: Accepted

Solution code:
list47=set([0,4,7,8,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27])
n=int(input())
print('Yes' if (n%28) in list47 else 'No')

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())

    for i in range(26):
        for j in range(15):
            if 4 * i + 7 * j == n:
                print("Yes")
                exit()

    print("No")

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())

    for i in range(n+1):
        for j in range(n+1):
            if 4 * i + 7 * j == n:
                print("Yes")
                exit()

    print("No")

Submission status: Accepted

Solution code:
N = int(input())
y = 0
ans = "No"
while 7*y <= N:
    if (N-7*y)%4 == 0:
        ans = "Yes"
        break
    y += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(N//7+1):
  if (N - i * 7) % 4 == 0:
    print('Yes')
    break
else:
  print('Yes' if N % 11 == 0 else 'No')

Submission status: Accepted

Solution code:
N = int(input())

def dfs(cost):
    if cost == N:
        return 9999
    elif cost > N:
        return -1
    return max(dfs(cost+4), dfs(cost+7))

x = dfs(0)
print('No') if x < 0 else print('Yes')

Submission status: Accepted

Solution code:
n=int(input())
ans="No"
for i in range(101):
    for j in range(101):
        if 4*i+7*j==n:
            ans="Yes"
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
start = n // 7
for i in range(start, -1, -1):
    if (n - i * 7) % 4 == 0:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

ans = False
for i in range(27):
    for j in range(20):
        if n == 4*i + 7*j:
            ans = True

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(26):
    for j in range(15):
        if i * 4 + j * 7 == n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
a = int(input())

for i in range(26):
    for j in range(15):
        if i * 4 + j * 7 == a:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
import sys

n = int(input())
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4 * i + 7 * j == n:
            print("Yes")
            sys.exit()
print("No")

Submission status: Accepted

Solution code:
t=int(input())

res='No'

#if t>3:
#	if t%4==0 or t%7==0 or t%11==0 or t%4==3 or t%7==4 or t%11==1:
#		res='Yes'

if t>3:
	for i in range(26):
		for j in range(16):
			if t==4*i+7*j:
				res='Yes'

print(res)

Submission status: Accepted

Solution code:
N = int(input())
tmp = []
for i in range(10):
  for j in range(10):
    solve = (4*(i+1))+(7*(j+1))
    if solve <= 100:
      tmp.append(solve)
multiples = sorted(list(set(tmp)))
if N % 4 == 0 or N % 7 == 0 or N in multiples:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N = int(input())
multiple_4 = [x*4 for x in range(101) if x >= 1 and x <= 25]
multiple_7 = [x*7 for x in range(101) if x >= 1 and x <= 14]
multiple_4_7 = [x*4+7 for x in range(101) if x >= 1 and x <= 23]
multiple_7_4 = [x*7+4 for x in range(101) if x >= 1 and x <= 23]
tmp = []
for i in range(10):
  for j in range(10):
    solve = (4*(i+1))+(7*(j+1))
    if solve <= 100:
      tmp.append(solve)
multiple_other = sorted(list(set(tmp)))
if N in multiple_4 or N in multiple_7 or N in multiple_4_7 or N in multiple_7_4 or N in multiple_other:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n//4+1):
  if (n-4*i)%7 == 0:
    print("Yes")
    quit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())

ans = n % 4 == 0
if not ans:
    for i in range(n // 4):
        if (n - i*4) % 7 == 0:
            ans = True
            break
print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
N=int(input())
a=int(N/4)
b=int(N/7)

flag=False

for i in range(a+1):
    for j in range(b+1):
        if 4*i+7*j==N:
            flag=True
        
if flag==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
x = int(N/4)
y = int(N/7)
cnt = 0

if(N != 0):
    for i in range(x+1):
        for j in range(y+1):
            if(i*4 + j*7 == N):
                cnt = cnt + 1
    answer = 'Yes' if (cnt > 0) else 'No'
    print(answer)
else:
    print("No")

Submission status: Accepted

Solution code:
n=int(input())

if n<4:
    print("No")
    exit()

a=n//4
b=n//7

ans=[]
for i in range(a+1):
    for j in range(b+1):
        if i*4+j*7==n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
n=int(input())

if n<4:
    print("No")
    exit()

a=n//4
b=n//7

ans=[]
for i in range(0,a+1):
    for j in range(0,b+1):
        if i*4+j*7==n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
N = int(input())
if N % 4 == 0:
    print('Yes')
    exit(0)
if N % 7 == 0:
    print('Yes')
    exit(0)

for j in range(0,101):
    if N - 4 * j > 0:
        if (N - 4 * j) % 7 == 0:
            print('Yes')
            exit(0)
    else:
        break
print('No')

Submission status: Accepted

Solution code:
N = int(input())

flg = 0

if N>7:
    for i in range(N//7+1):
        r = N-7*i
        if r%4==0:
            flg = 1
        
else:
    if N==4 or N==7:
        flg = 1

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n//7+1):
    if (n-7*i)%4==0:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
a = int(input())
for i in range(25):
    for j in range(15):
        if a - (4 * i + 7 * j) == 0:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
n=int(input())
if n%4==0 or n>=28-7*(n%4):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())
c = 0

for i in range(round(n/4)+1):
    for j in range(round(n/7)+1):
        ans = i*4 + j*7
        if ans == n:
            c += 1        
if c == 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys, re
input = sys.stdin.readline

n = int(input())  # 目指したい合計金額

cake = n // 4 + 1   # max iteration
donut = n // 7 + 1  # max iteration

count = 0

for c_i in range(cake):
  if count == 1:
    break
  else:
    for d_i in range(donut):
      if n == c_i * 4 + d_i * 7:
        count = 1
        break

print('Yes' if count else 'No')

Submission status: Accepted

Solution code:
n=int(input())
if n%4==0:
    print("Yes")
else:
    if n>=28-7*(n%4):print("Yes")
    else:print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC105 B
n = int(input())


for i in range(n):
    s = 4*i
    for j in range(n):
        if s == n:
            print('Yes')
            quit()
        s += 7
        if s > n:
            break
print('No')

Submission status: Accepted

Solution code:
a = int(input())
b = set()

for i in range(50):
  for j in range(20):
    b.add(4*i+7*j)

if a in b:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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


def read_h(conv=int):
    return map(conv, input().split())


def read_v(n, conv=int):
    return [conv(input()) for _ in range(n)]


def main():
    n = int(input())

    for i in range(n // 7 + 1):
        if (n - 7 * i) % 4 == 0:
            print('Yes')
            return

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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


def read_h(conv=int):
    return map(conv, input().split())


def read_v(n, conv=int):
    return [conv(input()) for _ in range(n)]


def main():
    n = int(input())

    for i in range(n // 4 + 1):
        for j in range(n // 7 + 1):
            if 4 * i + 7 * j == n:
                print('Yes')
                return

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
k = 30
ans=0
for i in range(k):
    for j in range(k):
        if (n-i*4-j*7)==0:
            ans=1
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0,26):
        for j in range(0,15):
                cost = 4*i + 7*j
                if cost == n:
                        print("Yes")
                        exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())
ans = 'No'
for x in range(25):
    for y in range(14):
        if 4 * x + 7 * y == n:ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

small_cake = 25
large_cake = 14

counter = 0
for s in range(small_cake):
    for l in range(large_cake):
        if n == 4 * s + 7 * l:
            counter += 1

if counter >0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())
flag = False

for i in range(0, (N//7)+1):
    temp = N - (7 * i)
    if temp % 4 == 0:
        flag = True
        break

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

Submission status: Accepted

Solution code:
n = int(input())
#h, w = map(int,input().split())
#ls = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
#ls = [input() for i in range(h)]

for i in range(0,n//4 + 1):
  for j in range(0,n//7+1):
    if i * 4 + j * 7 == n:
      print("Yes")
      quit()
print("No")

Submission status: Accepted

Solution code:
N = int(input())

for i in range(100//7):
    for j in range(100//4):
        if 7 * i + 4 * j == N:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0, n // 4 + 1):
    if (n - i * 4) % 7 == 0:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
import math
n=int(input())

for i in range(math.floor(n/4)+1):
    for j in range(math.floor(n/7)+1):
        if i*4+j*7==n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
import math

x = int(input())

flg = False
for i in range(math.floor(x / 4) + 1):
  for j in range(math.floor(x / 7) + 1):
      if x - i * 4 - j * 7 == 0:
        flg = True
        break
if flg:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N=int(input())
ans="No"

for i in range(N+1):
  if i % 4 == 0 and (N-i) % 7 == 0:
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 7 == 0 or n % 4 == 0:
    print("Yes")
elif n >= 4 and n % 7 == 4:
    print("Yes")
elif n >= 8 and n % 7 == 1:
    print("Yes")
elif n >= 12 and n % 7 == 5:
    print("Yes")
elif n >= 16 and n % 7 == 2:
    print("Yes")
elif n >= 20 and n % 7 == 6:
    print("Yes")
elif n >= 24 and n % 7 == 3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
if n % 4 == 0 or n % 7 == 0:
    print("Yes")
else:
    flag = True
    while flag:
        if n > 7:
            n -= 7
        else:
            if n % 4 == 0:
                print("Yes")
                flag = False
            else:
                print("No")
                flag = False
        if n % 4 == 0 or n % 7 == 0:
            print("Yes")
            flag = False

Submission status: Accepted

Solution code:
n = int(input())

def cd(n):
    c = n // 4
    for i in range(c+1):
        x = n - i * 4
        if x == 0:
            return print("Yes")
        elif x % 7 == 0:
            return print("Yes")

    return print("No")

cd(n)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(0, 101):
  for j in range(0, 101):
    if i * 4 + j * 7 == N:
      print("Yes")
      exit()
print("No")

Submission status: Accepted

Solution code:
N = int(input())
max_4 = int(N/4)+1
max_7 = int(N/7)+1
Flag = 0
for i in range(max_4):
    for j in range(max_7):
        if N == i*4 + j*7:
            Flag = 1
            break
    if Flag == 1:
        break
if Flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

if N % 4 == 0 or N % 7 == 0:
	print('Yes')
else:
	i = N // 7
	for count in range(i):
		temp = N - 7*(count+1)
		if temp % 4 == 0:
			print('Yes')
			exit()
	print('No')

Submission status: Accepted

Solution code:
n = int(input())
k = n // 4
r = n % 4
if r == 0:
  print("Yes")
elif r == 1:
  if k >= 5:
    print("Yes")
  else:
    print("No")
elif r == 2:
  if k >= 3:
    print("Yes")
  else:
    print("No")
else:
  if k >= 1:
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
x = int(n / 4)
y = int(n / 7)
flag = False
for i in range(x + 1):
    for j in range(y + 1):
        if 4 * i + 7 * j == n:
            flag = True
            break
if flag == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

for f in range(25):
    for s in range(15):
        if 4*f + 7*s == N:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

Solution code:
n = int(input())
def func(n):
    p = 0
    while True:
        if 4*p > n:
            return 'No'
        q = 0
        while True:
            s = 4*p + 7*q
            if s > n:
                break
            elif s == n:
                return 'Yes'
            q += 1
        p += 1

print(func(n))

Submission status: Accepted

Solution code:
n = int(input())
lst = []
for i in range(n//7+1):
    d = (n-7*i)//4
    for j in range(d+1):
        lst.append(7*i+4*j)
if n in lst:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())
for i in range(25):
    for j in range(15):
        if 4*i+7*j == n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
N = int(input())
a = N//4
b = N//7
yes = 0
no = 0
for i in range(a+1):
  for l in range(b+1):
    if 4*i+7*l == N:
      yes = 1
    else:
      no = 1
if yes ==1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N=int(input())
result='No'
c=0
d=0
while c*4<=N:
  while c*4+d*7<=N:
    sum = c*4+d*7
    if c*4+d*7==N:
      result='Yes'
    d+=1
  c+=1
  d=0
print(result)

Submission status: Accepted

Solution code:
import sys
n=int(input())
for i in range(int(n/4)+1):
    if (n-4*i)%7==0:
        print("Yes")
        sys.exit(0)
print("No")

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for i in range(0, 200, 4):
    for j in range(0, 200, 7):
        if i + j == N:
            cnt += 1
if cnt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())
A = set(4 * x + 7 * y for x in range(25) for y in range(25))
answer = "Yes" if N in A else "No"
print(answer)

Submission status: Accepted

Solution code:
import sys
N=int(input())
ans=0
for i in range(26):
  for k in range(15):
    if 4*i+7*k==N:
      print("Yes")
      sys.exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())
def lookfor(n):
  m4 = n//4+1
  m7 = n//7+1
  for i4 in range(m4):
    for i7 in range(m7):
      total = 4*i4 + 7*i7
      
      if total == n:
        print('Yes')
        return
      elif total > n:
        break  
  print('No')
  return

lookfor(n)

Submission status: Accepted

Solution code:
N = int(input())
A = set(4 * x + 7 * y for x in range(25) for y in range(25))
answer = "Yes" if N in A else "No"
print(answer)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()

for i in range(N // 4 + 1):
    for j in range(N // 7 + 1):
        if i * 4 + j * 7 == N:
            print('Yes')
            import sys
            sys.exit()

print('No')

Submission status: Accepted

Solution code:
N = int(input())
if N in [1,2,3,5,6,9,10,13,17]:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N = int(input())

ans = "No"
for i in range(N//4 + 1):
    if (N - i * 4) % 7 == 0:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
# 4,7
count = 0
for i in range(n + 1):
    for j in range(n + 1):
        if 4 * i + 7 * j == n:
            count += 1
if count >= 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

count = 0

for i in range(100):
  for t in range(100):
    if N == 4*i + 7*t:
      count = count + 1

if count > 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n // 4 + 1):
    if (n - 4 * i) % 7 == 0:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
n = int(input())

def cake(cnt):
    if cnt == 0:
        return 1
    if cnt < 0:
        return 0
    #4を買う場合 
    return cake(cnt-4) or  cake(cnt-7)

if (cake(n) == 1):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

if n % 4 == 0 or n % 7 == 0:
  print('Yes')
else:
  canbuy = False
  while True:
    n = n - 7
    if n < 0:
      break
    if n % 4 == 0:
      canbuy = True
      break
  if canbuy:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
import itertools
N = int(input())
pCake = range(N // 4 + 1)
pDonut = range(N // 7 + 1)

ptn = list(itertools.product(pCake, pDonut))

for i in ptn:
    if i[0] * 4 + i[1] * 7 == N:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
def abc():
    n = int(input())
    for i in range(26):
        for j in range(18):
            if n == 4*i + 7*j:
                print('Yes')
                return
    print('No')


abc()

Submission status: Accepted

Solution code:

N = int(input())

ans = "No"
while N >= 0:

    if N % 4 == 0:
        ans = "Yes"
        break

    N -= 7

print (ans)

Submission status: Accepted

Solution code:
n=int(input())

p=0
for y in range(n//7+1):
  x=n/4 - 7*y/4
  if x.is_integer() == True and x>-1:
    p += 1
    break
  else:
    continue
if p == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())

fo = n // 4
se = n // 7

for i in range(fo+1):
    for j in range(se+1):
        if ((i*4) + (j*7)) == n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N // 4 + 1):
    a = N - 4 * i
    if a < 0:
        continue
    if a % 7 == 0:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())

max_4 = int(N / 4)
max_7 = int(N / 7)

yes = 0

for i in range(max_4+1):
    for j in range(max_7+1):
        if i*4 + j*7 == N:
            yes = 1
            break

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

Submission status: Accepted

Solution code:
n = int(input())
m = [7 * i for i in range(15)]
for i in range(15):
    for j in range(26):
        m.append(m[i] + 4 * j)
if n in set(m):
    print("Yes")
else:
    print("No")