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:
se = set(4*x + 7*y for x in range(200) for y in range(200))
N = int(input())

answer = 'Yes' if N in se else 'No'
print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
bool=False
for i in range(0,N+1,4):
    for j in range(i,N+1,7):
        if j == N:
            bool = True
            break
if bool and N!=0:
    print('Yes')
else:
    print('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:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


N = int(sys.stdin.readline())

ok = False
for i in range(50):
    for j in range(25):
        ok |= 4*i + 7 *j == N

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0, 104, 4):
    for j in range(0, 105, 7):
        if i+j == n:
            print("Yes")
            exit()
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")
                        quit()

print("No")

Submission status: Accepted

Solution code:
# INPUT
n = int(input())

# PROCESS
answer = "No"
flags = [0 for i in range(101)]
cake = 4
dunut = 7

if (n % 7 == 0):
  answer = "Yes"
else:
  for i in range(4, 101, 4):
    flags[i] = 1
    for j in range(i, 101, 7):
      flags[j] = 1
  if (flags[n] == 1):
    answer = "Yes"


# PROCESS
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range((n//4)+1):
    for j in range((n//7)+1):
        sum_price = 4 * i + 7 * j
        if sum_price == n:
            ans = 1
            
if ans == 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:
n=int(input())


ans=False

if n%7==0:
    ans=True


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

Submission status: Accepted

Solution code:
n = int(input())

f = False
for i in range(26):
    for j in range(15):
        if i * 4 + j * 7 == n:
            f = True

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

Submission status: Accepted

Solution code:
n = int(input())
max_f = int(n / 4)
max_s = int(n / 7)
switch = 0
for i in range(max_s + 1):
    for j in range(max_f + 1):
        if (7 * i + 4 * j) == n:
            switch = 1
if switch == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

cake = 4
donut = 7
flg = False

for cake_num in range(N // cake + 1):
    for donut_num in range(N // donut + 1):
        sum = cake * cake_num + donut * donut_num

        if sum == N:
            flg = True

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

Submission status: Accepted

Solution code:
N = int(input())
 
CAKE_PRICE = 4
DONUT_PRICE = 7
 
flag = 0
for cake_num in range(N//CAKE_PRICE + 1):
  for donut_num in range(N//DONUT_PRICE + 1):
    sum_price = CAKE_PRICE * cake_num + DONUT_PRICE * donut_num
    if sum_price == N:
   		flag = 1
  
if flag == 0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
n=int(input())
if n%4==0 or n%7==0:
  print("Yes")
elif n<7:
  print("No")
else:
  d=n
  c=0
  while d>=7:
    d=d-7
    c+=1
  if d>=4:
    d=d-4
  if d<=c:
    print("Yes")
  else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cake_p = 4
donuts_p =7
cake = [i*cake_p for i in range((100//cake_p)+1)]
donuts = [i*donuts_p for i in range((100//donuts_p)+1)]
#print(cake,donuts)
ans='No'
for i in cake:
  for x in donuts:
    if i+x==n:
      ans='Yes'
#      print(ans)
      
if ans=='Yes':
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n = int(input())

ans = 0

for i in range(30):
    for j in range(20):
        if i*4 + j*7 == n:
            print("Yes")
            sys.exit()
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
N = int(input())
for i in range(1,N):
    for j in range(0,100,7):
        for k in range(0,100,4):
            if j + k == N:
                print('Yes')
                sys.exit()
            elif j + k > N:
                break
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:
N = int(input())
answer = 'No'
for x in range(N // 4 + 1):
    if (N - 4 * x) % 7 == 0:
        answer = 'Yes'
        break
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

flg = "No"
for i in range(26):
    for j in range(15):
        if 4*i+7*j==n:
            flg = 'Yes'
            break
        else:
            pass
        
print(flg)

Submission status: Accepted

Solution code:
def main(N):
  
    CP = 4
    DP = 7
    
    if N <= 3:
        return "No"
    
    for i in range(100):
        for j in range(100):
            if (CP * i + DP * j) == N:
                return "Yes"
    return "No"
N = int(input())
print(main(N))

Submission status: Accepted

Solution code:
n = int(input())
flag = False
a = 0
for i in range(n//4+1) :
	for j in range(n//7+1) :
		if 4 * i + 7 * j == n :
			flag = True
if flag :
	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 i * 4 + j * 7 == n:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n =int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#1 <= N <= 100
N = int(input())
flag = False
for i in range(0,N//4 + 1):
    for j in range(0,N//7 + 1):
        if 4*i + 7*j == N:
            flag = True
            print("Yes")
            # print("4*{0} + 7*{1} = {2}".format(i,j,4*i + 7*j))
            break
    if flag:
        break
if not flag:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

ans = 'No'
for i in range(N // 4 + 1):
    for j in range(N // 7 + 1):
        if i * 4 + j * 7 == N:
            ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

x=n//4
y=n//7

print("Yes" if len([n-4*a-7*b for b in range(y+1) for a in range(x+1) if n-4*a-7*b==0])!=0 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

c_max = N //4
d_max = N //7

for i in range(c_max+1):
    for j in range(d_max+1):
        temp = 4*i + 7*j

        if temp == N:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def cakes_and_donuts(N=N):
  if N % 4 ==0 or N % 7 ==0:
    return 'Yes'  
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

s = cakes_and_donuts(N)
print('{}'.format(s))

Submission status: Accepted

Solution code:
n = int(input())

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

if n < 0:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
price = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
dp = [False] * (n + 1)
dp[-1] = True

for i in list(range(n + 1))[::-1]:
  if (i + 4) <= n:
    if dp[i + 4] == True:
      dp[i] = True
  if (i + 7) <= n:
    if dp[i + 7] == True:
      dp[i] = True

if dp[0] == True:
  print('Yes')
else: 
  print('No')

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(30):
    for j in range(20):
        if 4*i+7*j==n:
            print('Yes')
            ans+=1
            break
        if ans==1:
            break
    if ans==1:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(26):
	for j in range(15):
		if (4 * i + 7 * j) == N:
			ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

flag = False

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

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

Submission status: Accepted

Solution code:
N = int(input())
 
cake = 4
dou = 7
dec = False
 
for i in range(26):
    for j in range(15):
        price = cake * i + dou * j
        if price == N:
            dec = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range((N//7)+1):
    total = i*7
    while total < N:
        total += 4
    if total == N:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
n = int(input())

y = False
for cake in range(50):
    for donut in range(15):
        price = cake * 4 + donut * 7
        if price == n:
            print('Yes')
            y = True
            break
        elif price > 100:
            continue
    else:
        continue
    break
if not y:
    print('No')

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())

for i in range(26):
  for j in range(15):
    if N==i*4+j*7:
      # パターンが見つかった
      print('Yes')
      exit()

# パターンが見つからなかった
print('No')

Submission status: Accepted

Solution code:
# 入力
N=int(input())

for i in range(26):
  for j in range(15):
    # パターンが見つかった
    if N==i*4+j*7:
      print('Yes')
      exit()

# パターンが見つからなかった
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	
	N = int(input())
	
	s4 = []
	s7 = []
	for i in range(101):
		if i % 4 == 0:
			s4.append(i)
		if i % 7 == 0:
			s7.append(i)
			
	if N % 4 == 0 or N % 7 == 0:
		print("Yes")
		sys.exit()
		
	tmp = []
	for i in s7:
		for j in s4:
			if i + j == N:
				print("Yes")
				sys.exit()
			
	print("No")
	
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N=int(input())
k=0
for i in range(0,30):
    for j in range(0,15):
        S=4*i+7*j
        if S==N:
            k=k+1
if k>0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
N = int(input())#500

c=0
for i in range(26):
    for j in range(13):
        if i*4+j*7==N:
            print("Yes")
            sys.exit()
print("No")

Submission status: Accepted

Solution code:
N = int(raw_input())
flag = False
for i in range(0, 26):
	for j in range(0, 15):
		if 4*i + 7*j == N: flag = True
if flag: print 'Yes'
else: print 'No'

Submission status: Accepted

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

for i in range(26):
    for j in range(16):
        l.append(i*4+j*7)

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

Submission status: Accepted

Solution code:
n = int(input())

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())

money = 0
c = int((N + (4 - 1)) / 4)
d = int((N + (7 - 1)) / 7)

for i in range(c+1):
    for j in range(d+1):
        if (i * 4) + (j * 7) == N:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
answer=0
a=int(input())

for i in range(a):
    for j in range(a):
        sum=i*4+j*7
        if sum==a:
            answer+=1
if answer>0:
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int):

    for i in range(0,N//4+1):
        for j in range(0,N//7+1):
            if (4*i + 7*j) ==  N:
                print(YES)
                return

    print(NO)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())

    pattern_num = 0
    for cake_num in range(N//4 + 1):
        for dotat_num in range(N//7 + 1):
            total_price = 4 * cake_num + 7 * dotat_num
            if total_price == N:
                pattern_num += 1

    if pattern_num >= 1:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]

    dp = [0] * 101

    dp[0] = 1
    for i in range(1,101):
        if i-4>=0 and dp[i-4]>0:
            dp[i] = dp[i-4]
        if i-7>=0 and dp[i-7]>0:
            dp[i] = dp[i-7]
    
    if dp[n]:
        print('Yes')
    else:
        print('No')

solve()

Submission status: Accepted

Solution code:
n = int(input())
result = 0
for i in range(15):
  for j in range(26):
    if i*7+j*4 == n:
      result += 1
      break
if result != 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N = int(input())

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

print(answer)

Submission status: Accepted

Solution code:
N = int(input())

m_cake = N // 4
a = 0

for i in range(m_cake + 1):
    m_donuts = (N - 4 * i) % 7
    if m_donuts == 0:
        a = 1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Cakes and Donuts
https://atcoder.jp/contests/abc105/tasks/abc105_b

"""
import sys


def solve(N):
    for i in range(26):
        for j in range(15):
            if 4 * i + j * 7 == N:
                return 'Yes'
    return 'No'


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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


n = int(input())
print(str(answer(n)))

Submission status: Accepted

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

for a in range(N+1):
    if a%4 == 0 and (N-a)%7 == 0:
        print ('Yes')
        sys.exit()
print ('No')

Submission status: Accepted

Solution code:
from sys import stdin
import math

N = int(stdin.readline().rstrip())

for k in range(math.floor(N / 7) + 1):
    if (N - 7 * k) % 4 == 0:
        print('Yes')
        break
    if k == math.floor(N / 7):
        print('No')

Submission status: Accepted

Solution code:
print('YNeos'[140910>>int(input())&1::2])

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())

check = 0
for n in range(N // 4 + 1):
    if (N - 4 * n) % 7 == 0:
        check = 1
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
for i4 in range(N):
  for i7 in range(N):
    if i4 * 4 + i7 * 7 == N:
      print("Yes")
      sys.exit(0)
print("No")

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
tmp4 = N//4+1
tmp7 = N//7+1


for i in range(tmp4):
    for j in range(tmp7):
        Buy  = 4*i+7*j
        if N ==Buy:
            print('Yes')
            sys.exit()

print('No')

Submission status: Accepted

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

x=int(input())

print("Yes" if [4*i + 7*j for i in range(101) for j in range(101)].count(x) else "No")

Submission status: Accepted

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

x=int(input())

for i in range(101):
  for j in range(101):
    if x == (4*i + 7*j):
      print("Yes")
      sys.exit()
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())
ans = False
for i in range(int(N/7)+1):
    if  (N - 7 * i) % 4 == 0:
        ans = True
if ans == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n = int(input())
cost = 0
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:
#ABC 105 B
divisors = [4+i*7 for i in range(4)]
bound_num = max(divisors)
n = int(input())
yes=[i*4 + j*7 for i in range(6) for j in range(6)]
if n >= bound_num or n in yes:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int):
    ret = NO
    for i in range(N):
        if (N - 4 * i) >= 0 and (N - (4 * i)) % 7 == 0:
            ret = YES
            break
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
print("Yes" if [a*4+b*7 for a in range(26) for b in range(16)].count(n) else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    n = intin()

    for i in range(20):
        diff = n - 7 * i
        if diff >= 0 and diff % 4 == 0:
            print('Yes')
            return

    print('No')


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
aa=[4*n+7*m for n in range(1+100//4) for m in range(1+100//7) if 4*n+7*m <= 100]
print('Yes' if n in aa else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

if n%7 != 0 and n%4 != 0 and n%11 != 0:
    for a in range(1, 25):
        for b in range(1, 14):
            if n%(7*b + 4*a) == 0:
                print('Yes')
                sys.exit()
else:
    print('Yes')
    sys.exit()
print('No')

Submission status: Accepted

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

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
count=0
for i in range(15):
    for k in range(26):
        if 7*i+4*k==N:
            while count==0:
                print('Yes')
                count=1
               
    
if count==0:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())

for i in range(N + 1):
    f, s = i, N - i

    if f % 4 == 0 and s % 7 == 0:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
N = int(input())

ans = 'No'
for c in range(25+1):
    for d in range(14+1):
        if 4*c + 7*d == N:
            ans = 'Yes'
            break
    else:
        continue
    break

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [4 * i for i in range(n)]
b = [7 * i + x for x in a for i in range(n)]

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

Submission status: Accepted

Solution code:
def buy(n,cake,donut):
  cost = cake*4 + donut*7
  if cost == n:
    return True
  elif cost > n:
  	return False
  else:
    if ((n - cost) % 4) == 0 or ((n - cost) % 7) == cost:
      return True
    else:
      return buy(n,cake+1,donut) or buy(n,cake,donut+1)

n = int(input())
if buy(n,0,0):
  print('Yes')
else:
  print('No')