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 は 1 以上 100 以下の整数
n = int(input())
flag = False
for a in range(int(100/4)+1):
    if flag:
        break

    for b in range(int(100/7)+1):
        # print("4*{}+7*{} = {}".format(a, b, 4*a+7*b))
        if 4*a+7*b == n:
            flag = True
            break
        if 4*a+7*b > n:
            next

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
for i in range(101):
    if N - 7 * i < 0:
        break
    if (N - 7 * i) % 4 == 0:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
n = int(input())

can_buy = False
for i in range(101):
    for j in range(101):
        if 4 * i + 7 * j == n:
            can_buy = True

            break

print("Yes" if can_buy else "No")

Submission status: Accepted

Solution code:

n=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

while N>=0:
    if N%4==0:
        ans = ans+1
    N = N-7

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

Submission status: Accepted

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

print('No')

Submission status: Accepted

Solution code:
N = int(input())
for donuts in range(15):
    for cake in range(26):
        if 4 * cake + 7 * donuts == N:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
def main() :
	N = int(input())
	
	while N > 0 :
		if (N % 7 == 0 or N % 4 == 0) :
			return "Yes"
		N = N-7

	return "No"

print(main())

Submission status: Accepted

Solution code:
import sys
n = int(input())
for i in range(0,25+1):
    for j in range(0,14+1):
        if 4*i + 7*j == n:
            print('Yes')
            sys.exit()
print('No')

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()

fourseven = set([0])

for f in range(30):
    for s in range(20):
        fourseven.add(4*f + 7*s)
    
print('Yes') if n in fourseven else print('No')

Submission status: Accepted

Solution code:
import sys

N=int(input())
if N%4==0:
    print("Yes")
    sys.exit()

for i in range(N//4):
    if (N-4*i)%7==0:
        print("Yes")
        sys.exit()

else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

for a in range(0,N+1,4):
    for b in range(a,N+1,7):
        if b == N:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
N = int(input())
L = []
for i in range(30) :
    for j in range(20) :
        l = 4*i+7*j
        if l <= 100 :
            L.append(l)
if N in L :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

for x in range(0, 101, 4):
    for y in range(0, 101, 7):
        if x + y == N:
            print('Yes')
            exit(0)
        elif x + y > 100:
            break
print('No')

Submission status: Accepted

Solution code:
N = int(input())
n = int(N/7)
i = 0
flag = 0
while i <= n:
  if (N-7*i)%4 == 0:
    print("Yes")
    flag = 1
    break
  else:
    i = i + 1
if flag == 0:
  print("No")

Submission status: Accepted

Solution code:
N = int(input())
cake = int(N/4)
donuts = int(N/7)

for i in range(donuts+1):
    for m in range(cake+1):
        sum_price = i*7 + m*4
        if N == sum_price:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = 0
while True:
    if 4*i > n:
        break
    j = 0
    while True:
        if 4*i + 7*j == n:
            print('Yes')
            exit()
        elif 4*i + 7*j > n:
            break
        j += 1
    i += 1
print('No')

Submission status: Accepted

Solution code:
n=int(input())

f=0

for i in range(26):
    for j in range(15):
        t=4*i+7*j
        if t==n:
            f=1
            break

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

Submission status: Accepted

Solution code:
n = int(input())
coins = [4, 7]
m = len(coins)
dp = [[False for j in range(n + 1)] for i in range(m + 1)]
dp[0][0] = True

for i in range(1, m + 1):
    for j in range(0, n + 1):
        dp[i][j] = dp[i - 1][j]
        if j - coins[i - 1] >= 0:
            dp[i][j] |= dp[i][j - coins[i - 1]]

print('Yes' if dp[m][n] else 'No')

Submission status: Accepted

Solution code:
def judge(a):
    global flg
    if a % 4 == 0 or a % 7 == 0:
        flg = 1

N = int(input())
flg = 0
judge(N)

while N > 7:
    N -= 7
    judge(N)

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

Submission status: Accepted

Solution code:
print("YNeos"[int(input()) in [1,2,3,5,6,9,10,13,17]::2])

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:
a = int(input())

if a <= 3:
  print("No")
else:
  while a >= 0:
    if a % 4 == 0:
      print("Yes")
      break
    else:
      a -= 7
  else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
if 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:
money = int(input())

while money >= 4:
    if money % 7 == 0 or money % 4 == 0:
        money = 0
    else:
        money -= 4

print("Yes" if money == 0 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
if(n%7==0):
  print("Yes")
  sys.exit(0)
while(1):
    if(n%4==0):
        print("Yes")
        sys.exit(0)
    n-=7
    if(n<=3):
        break
print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

    for i in range(100):
        for j in range(100):
            if i * 4 + j * 7 == N:
                print(Yes)
                return 

    print(No)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
p = 0
for i in range(26):
  for j in range(16):
    if 4*i + 7*j == n:
      p = 1
      break
if p == 0:
  print("No")
else: 
  print("Yes")

Submission status: Accepted

Solution code:
import math

n=int(input())
a=7
b=4
for i in range(math.floor(n/a)+1):
  if (n-a*i)%b==0:
    print('Yes')
    exit()
print('No')

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    n = int(next_str())
    print(("No", "Yes")[judge(n)])


def judge(n: int) -> bool:
    price_c = 4
    price_d = 7

    for c in range(0, n // price_c + 1):
        for d in range(0, n // price_d + 1):
            if c * price_c + d * price_d == n:
                return True

    return False


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
l = []

# 全探索を行う
for i in range(int(N/4 + 1)):
    for j in range(int(N/7 + 1)):
        if i * 4 + j * 7 <= 100:
            l.append(i * 4 + j * 7)

if N in l:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N=int(input())
if N%7==N and not N%4==0:
  print('No')
elif N%4==0 or N%7==0:
  print('Yes')
else:
  A = 'No'
  while N>7:
    N -= 7
    if N%4==0:
      A = 'Yes'
  print(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def cracker(n):
    i = 0
    while True:
        r = (n - i * 4)
        if r < 0:
            print('No')
            return
        if (n - i * 4) % 7 == 0:
            print('Yes')
            return
        i += 1
n = int(input())
cracker(n)

Submission status: Accepted

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

for x in range(25):
    for y in range(15):

        if x*4 + y*7 == N:
            ans = "Yes"
            
print(ans)

Submission status: Accepted

Solution code:
# Cakes and Donuts
n = int(input())
for donut in range(16):
    for cake in range(26):
        if donut * 7 + cake * 4 == n:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
n = int(input())
def buy(m):
  if m == 0:
    print("Yes")
    exit()
  if m < 0:
    return None
  buy(m-4)
  buy(m-7)
buy(n)
print("No")

Submission status: Accepted

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

for i in range(50):
    for j in range(30):
        t = 4*i + 7*j
        if t == n:
            ans = 1
            break

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

Submission status: Accepted

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())
xmax = N//4
ymax = N//7
for x in range(0,xmax+1):
    for y in range(0,ymax+1):
        ans = 4*x + 7*y
        if ans > N:
            continue
        if N == ans:
            print("Yes")
            exit()
else:
    print("No")

Submission status: Accepted

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

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()
print('No')

Submission status: Accepted

Solution code:
N = int(input())
L = [0 for i in range(200)]
L[0] = 1

for i in range(101):
	if L[i] == 1:
		L[i + 4] = 1
		L[i + 7] = 1

if L[N] == 1:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
n=int(input())
i=0
while n-7*i>=0:
    m=n-7*i
    if m%4==0:
        print('Yes')
        exit()
    else:
        i+=1
print('No')

Submission status: Accepted

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

for k in range(n):
    for l in range(n):
        if 4*k + 7*l == n:
            print('Yes')
            sys.exit()

print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n  = int(input())

res='No'
while(n>0):
  if n%4==0:
    res='Yes'
    break
  n=n-7
  if n==0:
    res='Yes'
    break
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ok = 0
i = 0
while i <= n // 4:
    j = 0
    while j <= n // 7:
        if 4*i + 7*j == n:
            ok = 1
        j += 1
    i += 1
if ok == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
for a in range(26):
    for b in range(15):
        if n==4*a+7*b:
            cnt+=1
if cnt>=1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cake_limit = n//4 + 1
dough_limit = n//7 + 1
flag = True
for i in range(cake_limit):
    for ii in range(dough_limit):
        if 4*(i) + 7*(ii) == n and flag:
            print("Yes")
            flag = False
if flag:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
a = 0
for i in range(15):
  a = n - (7*i)
  if a % 4 == 0 and a >= 0:
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

Solution code:
N = int(input())
for i7 in range(20):
    for i4 in range(30):
        if i7 * 7 + i4 * 4 == N:
            print('Yes')
            break
    else:
        continue
    
    break
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
do_num = int(N/7)
yn = False
for n in range(do_num+1):
    if (N-7*n) % 4 == 0:
        yn = True
        break
    else:
        yn = False

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 4 == 0:
    print("Yes")
elif N > 6 and (N-7) % 4 ==0:
    print("Yes")
elif N > 13 and (N-14) % 4 ==0:
    print("Yes")
elif N > 20 and (N-21) % 4 ==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

for i4 in range(25):
    for i7 in range(15):
        if n == i4 * 4 + i7 * 7:
            print('Yes')
            quit()

print('No')

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())

flg=0
for a in range(N):
    for b in range(N):
        if 4*a + 7*b == N :
            flg += 1  
print("Yes" if flg != 0 else "No")

Submission status: Accepted

Solution code:
N = int(input())

flag = 0
for A in range(50):
    for B in range(15):
        if (4*A + 7*B == N):
            flag = 1

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

Submission status: Accepted

Solution code:
n = int(input())

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

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:
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
if ac:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())

if n % 4 == 0:
	print("Yes")
elif n % 4 == 1 and n >= 21:
	print("Yes")
elif n % 4 == 2 and n >= 14:
	print("Yes")
elif n % 4 == 3 and n >= 7:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

print("No")

Submission status: Accepted

Solution code:
n = int(input())
ans = 'No'


def buy(money):
    if money == 0:
        print('Yes')
        quit()
    elif money < 0:
        return
    buy(money - 4)
    buy(money - 7)


buy(n)
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
if N%4==0 or N%7==0:
	print("Yes")
else:
	i=0
	while (N-7*i)>0:
		if ((N-7*i)%7==0 or (N-7*i)%4==0):
			print("Yes")
			break
		if(N-7*i<=6):
			print ("No")
		i+=1

Submission status: Accepted

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

for cake in range(25+1):
    for donut in range(15+1):
        if n == cake*4 + donut*7:
            print("Yes")
            sys.exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
four_w = []
seven_w = []
cross = []

for i in range(1,101):
    if i % 4 == 0:
        four_w.append(i)
    elif i % 7 ==0:
        seven_w.append(i)

for four in four_w:
    for seven in seven_w:
        cross.append(four + seven)

n = int(input())

if n in cross:
    print("Yes")
elif n in seven_w:
    print("Yes")
elif n in four_w:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N=int(input())

X=list(range((N//4)+1))
Y=list(range((N//7)+1))

flag=0
tmp=0

for x in X:
    if flag==1:
        break
    for y in Y:
        if int(4*x + 7*y)==N:
            flag=1
            print('Yes')
            break
    else:
        pass

if flag ==0 :
    print('No')

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 'No'
for i in range(math.ceil(n/4)+1):
    for j in range(math.ceil(n/7)+1):
        if 4*i + 7*j == n:
            ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    # ケーキをi個買う場合についてすべて調べる(0<=i<=n/4)
    for i in range(int(n/4) + 1):
        # nnはケーキをi個買った残りの金額
        nn = n - 4 * i
        # nnが7で割り切れれば買い方はある
        if nn % 7 == 0:
            print('Yes')
            return
    print('No')


solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(N):
    hantei = 0
    for i in range(26):
        for j in range(20):
            if 4*i + 7*j == N :
                hantei = 4*i + 7*j
    if hantei == N :
        return ('Yes')
    else :
        return('No')
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ret = "No"
for i in range(100):
    for j in range(100):
        if i*7+j*4==N:
            ret = "Yes"
            
print (ret)

Submission status: Accepted

Solution code:
n=int(input())
c=0
for x in range(int(n/4)+1):
 for y in range(int(n/7)+1):
  if 4*x+7*y==n:
   c=1
   break
if c==1:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
n=int(input())
for i in range(26):
    for j in range(100//7+1):
        if i*4+j*7==n:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
n_max = 100
cake = 4
donut = 7
s = set()
for i in range(int(n_max/cake)+1):
    for j in range(int(n_max/donut)+1):
        s.add(4*i+7*j)
if n in s:
    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:
"""
B - Cakes and Donuts
ABC 洋菓子店では, 
1 個 4 ドルのケーキと 
1 個 7 ドルのドーナツが売られている.
このとき, 合計金額が N ドルとなる買い方はあるか, 判定せよ. 
ただし, 同じ商品を二個以上買っても良く,
 買わない商品があっても良いものとする. 
"""

N = int(input())

for a in range(0, N + 1, 4):
    if ((N - a) % 7) == 0:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
ans = 'No'
while N > 0:
    if N % 4 == 0:
        ans = 'Yes'
        break
    N -= 7
if N == 0:
    ans = 'Yes'

print(ans)

Submission status: Accepted

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

for i in range(25):
    for j in range(14):
        if N == 4 * i + 7 * j:
            accept = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
can_buy = []

for n in range(101):
    for d in range(15):
        remnant = n-7*d
        if remnant >= 0 and remnant % 4 == 0:
            can_buy.append(n)
            break

n = int(input())

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

Submission status: Accepted

Solution code:
#金額を渡すと、ケーキとドーナツの組合せでその金額になるかどうかを判定し、
#'Yes'または'No'を返す関数、no_change()を定義
def no_change(N):
    while N > 0:
        if N%7 == 0 or N%4 == 0:
            return 'Yes'
        N -= 4    
    else :
        return 'No'

# 入力値読み込み
N = int(input())

#関数呼び出し
print(no_change(N))

Submission status: Accepted

Solution code:
import sys
import io

# 関数 solve は，もちろん，問題に応じて書き換える

def solve(N): 
    hantei = 0
    for i in range(26):
        for j in range(20): 
            if 4*i + 7*j == N : 
                hantei = 1
    if hantei == 1:            
        return('Yes')
    else: 
        return('No')
    
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

for a in range(100//7):
 for b in range(100//4):
  if N==(a*7+b*4):
   flag=1
   break

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

Submission status: Accepted

Solution code:
N = int(input())

while N > 0:
    if N%7 == 0 or N%4 == 0:
        print('Yes')
        break
    N -= 4

else :
    print('No')

Submission status: Accepted

Solution code:
N = int(input())

isok = False
for i in range(0,101,4):
    for j in range(0,101,7):
        if i+j==N:
            #print(i,j)
            isok = True
            break
    if isok: break
        
if isok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
max = (n//4)+1
index=0
flag =0
while index<max:
    sum=index*4
    if (n-sum)>=0 and (n-sum)%7==0:
        print("Yes")
        flag=1
        break
    index+=1
if flag ==0:
    print("No")

Submission status: Accepted

Solution code:
N=int(input())
a=N//4
b=N//7
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 in [1,2,3,5,6,9,10,13,17]:
    print('No')
    
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
OK = False
while 0<N:
    if N%4==0 or N%7==0:
        OK = True
    if 7<N:
        N -= 7
    else:
        break
print('Yes' if OK else 'No')

Submission status: Accepted

Solution code:
n = int(input())
for i in range(16):
    if n%4 == 0:
        print("Yes")
        quit()
    n -= 7
    if n < 0:
        break
print("No")

Submission status: Accepted

Solution code:
n = int(input())
if n % 4 == 0: print('Yes')
elif n >= 7 and n % 4 == 3: print('Yes')
elif n >= 14 and n % 4 == 2: print('Yes')
elif n >= 21 and n % 4 == 1: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
N = int(input())
m = 0
for i in range(15):
  n = N-7*m
  if n < 0:
    print("No")
    break
  elif n % 4 == 0:
    print("Yes")
    break
  elif m == 14:
    print("No")
  m += 1

Submission status: Accepted

Solution code:
n = int(input())
for n_cake in range(n):
    for n_donut in range(n):
        if 4 * n_cake + 7 * n_donut == n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
import sys
n = input()
for i in range(0,101,4):
	if (n-i)%7 == 0 and n >= i:
		print "Yes"
		sys.exit(0)
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:
a=set()
for i in range(26):
    for k in range(15):
        a.add(i*4+k*7)
n=int(input())
if n in a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a=set()
for i in range(26):
    for k in range(15):
        a.add(i*4+k*7)
n=int(input())
if n in a:
    print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
n = int(input())
n_4,n_7,end = 0,0,0
while n_4*4 <= n:
    n_7  = 0
    while n_7*7 + n_4*4 <= n:
        if n_7*7 + n_4*4 == n:
            print("Yes")
            end = 1
            break
        n_7 += 1
    if end == 1: break
    n_4+=1
if end == 0:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

ans = 'No'

for i in range(26):
	for j in range(20):
		if i*4+j*7 == n:
			ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())

flag = False
for i in range(0,30):
  for j in range(0,30):
    if i * 4 + j * 7 == N:
      flag = True

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

Submission status: Accepted

Solution code:
N = int(input())

flag = False
for i in range(0,30):
  for j in range(0,30):
    if i * 4 + j * 7 == N:
      flag = True

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

Submission status: Accepted

Solution code:
N = int(input())
if N >= 18 or 14 <= N <= 16 or N == 12 or N == 11 or N ==8 or N == 7 or N ==4:
  print('Yes')
  exit()
else:
  print('No')

Submission status: Accepted

Solution code:
N = int(input())
if N >= 18:
  print('Yes')
  exit()
elif 14 <= N <= 16 or N == 12 or N == 11 or N ==8 or N == 7 or N ==4:
  print('Yes')
  exit()
else:
  print('No')

Submission status: Accepted

Solution code:
def calc(a):
  for a4 in range(26):
    for a7 in range(16):
      if a4*4+a7*7 == a:
        return "Yes"
  return "No"

if __name__ == '__main__':
  print(calc(int(input())))

Submission status: Accepted

Solution code:
N=int(input())

while N >= 4 or N == 0:
	if N%7==0:
		print("Yes")
		break
	else:
		N -= 4
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
y = int(input().split()[0])
for i in range(int(y / 4) + 1):
    x = y - (4 * i)
    if x % 7:
        continue
    else:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())

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

print("No")

Submission status: Accepted

Solution code:
n = int(input())

for i in range(n//4+1):
    for j in range(n//7+1):
        if n == 4*i+7*j:
            print('Yes')
            exit(0)
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:
import sys


n = int(input())
while n > 0:
    if n % 7 == 0:
        print('Yes')
        sys.exit()
    n -= 4
if n == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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