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:
def main():
    N = int(input())
    M = N // 7
    if N % 7 ==  0:
        print("Yes")
        return
    for i in range(M + 1):
        if (N - (7 * i)) % 4 == 0:
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
cMax = round(100 / 4)
dMax = round(100 / 7)
result = "No"
for c in range(cMax):
    for d in range(dMax):
        if 4 * c + 7 * d == N:
            result = "Yes"
            break
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

if N%4 == 0:
    print("Yes")
elif N%7 == 0:
    print("Yes")
else:
    for i in range(1,30):
        for j in range(1,30):
            temp = j*7 +i*4
            if temp == N:
                print("Yes")
                sys.exit()

    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#105b
n=int(input())
ans=0
flag=False
    
for i in range(25):
    for j in range(14):
        ans=4*i+j*7
        if ans==n:
            flag=True
            break
        elif ans>n:
            break
print('Yes' if flag==True else 'No')

Submission status: Accepted

Solution code:
N = int(input())

# せいぜい4x25まで
for i in range(26):
    # せいぜい7x14まで
    for j in range(15):
        if 4*i + 7*j == N:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

for i in range(int(n / 7) + 1):
  for j in range(int(n / 4) + 1):
    if (7 * i + 4 * j == n):
      isExist = True
      break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

judge = False

for i in range(0,26):
    for j in range(0,16):
        if 4*i + 7*j == n:
            judge = True

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

Submission status: Accepted

Solution code:
N = int(input())

cake = 4
donatu = 7
ans = False

for i in range(100):
  for j in range(100):
    if cake*i + donatu*j == N:
      ans = True
      break
  if ans:
    break

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
cake = []
donut = []
for i in range(1, 26):
	cake.append(i*4)
for i in range(1, 15):
	donut.append(i*7)

n = int(raw_input())

flag = False
if n in cake: flag = True
if n in donut: flag = True
if not flag:
	for i in range(0, len(cake)):
		for j in range(0, len(donut)):
			if n == cake[i] + donut[j]:
				flag = True
				break
		if flag: break

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

Submission status: Accepted

Solution code:
t=int(input())

rs=0
for i in range(14):
    if (t-7*i)%4==0 and t-7*i>0:
        rs +=1
    else:
        rs +=0
if rs>0 or t%7==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())
k = 0
d = 0
while k*7 <= n:
    if (n-k*7) % 4 == 0:
        print("Yes")
        exit()
    else:
        k += 1
print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

CAKE_DOLLAR = 4
DONUT_DOLLAR = 7

n = int(input())

cake_max = n // CAKE_DOLLAR
donut_max = n // DONUT_DOLLAR

for cake_amount in range(cake_max+1):
    for donut_amount in range(donut_max+1):
        if CAKE_DOLLAR * cake_amount + DONUT_DOLLAR * donut_amount == n:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

def getList():
    tmpList = []
    for i in range(N):
        for j in range(N):
            tmpList.append(4*i+7*j)
    return tmpList

def solve(N):
    tmpList = getList()
    
    if N in tmpList:
        return "Yes"
    else:
        return "No"
    
if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Submission status: Accepted

Solution code:
def main():
    n = int(raw_input().strip())
    y = 0
    while 7 * y <= n:
        if (n - 7 * y) % 4 == 0:
            print 'Yes'
            return
        y += 1
    print 'No'

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n =int(raw_input())
lis=[]
for i in range(1,26):
    lis.append(4*i)
for i in range(1,15):
    lis.append(7*i)
for i in range(1,20):
    for j in range(1,20):
        lis.append(4*i+7*j)
if n in lis:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
#105b
n=int(input())
x = n//4
if n%4==0 or n%7==0:
    print('Yes')
    exit()
else:
    for i in range(x):
        for j in range(x):
            temp=4*i+7*j
            if temp==n:
                print('Yes')
                exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
flag = False
for i in range(26):
  for j in range(16):
    tmp = 4*i + 7*j
    if N == tmp:
      flag = True

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

Submission status: Accepted

Solution code:
N = int(input().strip())
if N % 4 == 0 or N % 7 == 0:
    print("Yes")
else:
    flag = False
    for i in range(1, N//7 + 1):
        if (N - 7 * i) % 4 == 0:
            flag = True
            break
    if flag:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
N = int(input())
if N%4 == 0 or N%7 ==0:
    print("Yes")
else:
    while N >= 7:
        N = N - 4
        if N%7 ==0:
            print("Yes")
            break
            
if N%7!=0 and N%4!=0:
    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:
# coding: utf-8
n=int(input())
"""
 N=list(map(int,input().split()))
 N.sort();
 for i in N:
    print(i)
"""
for i in range(100):
    if n-i*7>=0 and (n-i*7)%4==0 : 
        print('Yes') 
        break
    if n-i*7< 0:
       print('No')
       break

Submission status: Accepted

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

s = 0

while(s <= N):
    if((N - s) % 4 == 0):
        print("Yes")
        sw = 1
        sys.exit()
    s += 7


print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import product


n = int(input())

for a, b in product(range(n//4+1), range(n//7+1)):
    if a*4 + b*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())
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())
for i in range(15):
    if i*7>n:break
    for j in range(26):
        if i*7+j*4>n:break
        if i*7+j*4==n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import logging
import time


class Solver:
    def __init__(self):
        self.n = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.n = int(input())

    @staticmethod
    def can_buy(n):
        # logging.debug(input_str)
        for i in range(26):
            for j in range(16):
                if 4 * i + 7 * j == n:
                    return 'Yes'
        return 'No'

        # logging.debug(input_str)

    # def run(self):
    #     if self.n % self.k == 0:
    #         return 0
    #     return 1

    # @staticmethod
    def test(self):
        start_time = time.time()

        assert self.can_buy(11), 'Yes'
        assert self.can_buy(40), 'Yes'
        assert self.can_buy(3), 'No'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()

    # solver.test()

    solver.input_value()
    ans = solver.can_buy(solver.n)
    # print(str(ans))
    print(ans)

Submission status: Accepted

Solution code:
N=int(input())
costC=4
costD=7
Flag=False
for i in range(0,100):
    if Flag:
        break

    for j in range(0,100):
     
        costSum=i*costC+j*costD
        if N==costSum:
            Flag=True

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

Submission status: Accepted

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

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:
n=int(input())
ymax=n//7
for y in range(0,ymax+1):
    if (n-7*y)%4 == 0:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

table = [False for i in range(n+1)]
if n >= 4:
    table[4] = True
if n >= 7:
    table[7] = True
for i in range(8,n+1):
    if table[i-4] == True:
        table[i] = True
    if table[i-7] == True:
        table[i] = True
if table[n]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def ans():
  n = int(input())
  for a in range(n // 4 + 1):
    for b in range(n // 7+ 1):
      if 4 * a + 7 * b == n:
        print("Yes")
        return
  print("No")

ans()

Submission status: Accepted

Solution code:
def judge(N):
    i=int(N/7)
    while i>=0:
        if (N-7*i)%4==0:
            return True
        else:
            i-=1
    return False


N=int(input())

if judge(N):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
result = False
for a in range(25):
    for b in range(14):
        if 4 * a + 7 *b == N:
            result = True
print("Yes" if result else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
for y in range(15) :
    if N >= 7*y :
        if 0.25*(N-7*y) % 1 == 0 :
            print("Yes")
            counter = 1
            break
if counter == 0 :
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

flag = False
if N % 7 == 0 or N % 4 == 0 or N % 11 == 0:
	print('Yes')

else:
	for i in range(14):
		if flag == True: break
		for j in range(25):
			if i * 7 + j * 4 == N:
				print('Yes')
				flag = True
				break
			elif i * 7 + j * 4 > N:
				break
	if flag == False:	print('No')

Submission status: Accepted

Solution code:
N = int(input())

judge = ""

M = int(N/4)

for i in range(M+1):
    if not ((N - 4 * i)%7):
        judge = "Yes"
        break
    else:
        judge = "No"
        
print (judge)

Submission status: Accepted

Solution code:
n = int(input())

s = set()
for i1 in range(26):
  for i2 in range(15):
    s.add( i1*4 + i2*7 )

if n in s:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

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

Submission status: Accepted

Solution code:
N = int(input())
four = [4*i for i in range(26)]
seven = [7*i for i in range(15)]

exist = False
for f in four:
    for s in seven:
        if f+s == N:
            exist = True
            
if exist:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())

def main():
    for i in range(100):
        tmp = n - 4 * i
        if tmp % 7 == 0 and tmp >= 0:
            print('Yes')
            return
    print('No')

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
if(n%4==0 or n%7==0):
    print("Yes")
    exit()
else:
    var=n
    while(n>0 or var>0):
        n-=7
        if(n%4==0 and n>0):
            print("Yes")
            exit()
        n-=4
        if(n>0 and (n%7==0 or n%4==0)):
            print("Yes")
            exit()
        var-=4
        if(var%7==0 and var>0):
            print("Yes")
            exit()
        var-=7
        if(var>0 and (var%4==0 or var%7==0)):
            print("Yes")
            exit()
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(int(N/7) + 1):
    for j in range(int(N/4) + 1):
        if i == 0 and j == 0:
            continue
        if N % (7*i + 4*j) == 0:
            hantei = True
            break

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

Submission status: Accepted

Solution code:
N = int(input())

c, d = 4, 7

def test(n):

    if n < 4:
        return False

    if n == 4 or n == 7:
        return True
    else:
        return test(n - 4) or test(n - 7)
    
if test(N):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n = int(input())
    l4 = [4 * i for i in range(25)]
    l7 = [7 * i for i in range(15)]
    for a in l4:
        for b in l7:
            if a + b == n:
                print("Yes")
                return
    print("No")

if __name__=="__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cake = list(range(26))
donut = list(range(15))
count = 0

for i in cake:
    for j in donut:
        if i*4 + j*7 == N:
            count += 1

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(26):
    if 4*i == n:
        print("Yes")
        exit(0)
    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())

for i in range(50):
    for j in range(50):
        if(4*i + 7*j == N):
            print("Yes")
            break
        if(i == 49 & j == 49):
            print("No")
            break
    else:
        continue

    break

Submission status: Accepted

Solution code:
def SolveCakesAndDonuts(N):
    for m in range(N/7 + 1):
        r = N - 7*m
#        print "r = ",r
        if r%4 == 0:
            print  "Yes"
            break
        if m == N/7:
            print "No"
            
n = input()
SolveCakesAndDonuts(n)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=input()
N=int(N)
C=int(N/4+1)
D=int(N/7+1)
count=0
for i in range(C+1):
    for j in range(D+1):
        if (i*4+j*7)==N:
            count=count+1
if count>0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

cache = {}

def IsOK(n: int):
    if n in [0, 4, 7]:
        return True
    elif n <= 3:
        return False
    elif n in cache:
        return cache[n]
    else:
        cache[n] = IsOK(n - 4) or IsOK(n - 7)
        return cache[n]

N = int(input())
print("Yes" if IsOK(N) else "No")

Submission status: Accepted

Solution code:
N = int(input())

flag = False

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

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

Submission status: Accepted

Solution code:
if int(input()) in [4,7,8,11,12,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
def Div(i):
    if i == 1 or i == 2 or i==3 or i==5 or i==6:
        return False
    elif i == 4 or i == 7:
        return True
    else:
        if Div(i-4) or Div(i-7):
            return True
        else:
            return False
print("Yes" if Div(N) else "No")

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

cnt = 0

chkflg=False
while cnt * 4 <= n:
    
    if n % 4 == 0 or n % 7 == 0:
        
        chkflg=True
        break
        
    elif (n-cnt * 4) % 7 == 0:
        
        chkflg=True
        break
       
    else:
        
        cnt+=1
           
print("Yes" if chkflg else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def canbuy(n):
    if n%7==0 or n%4==0:
        return 'Yes'
    else:
        if n<4:
            return 'No'
        else:
            if canbuy(n-7)=='Yes':
                return 'Yes'
            else:
                if canbuy(n-4)=='Yes':
                    return 'Yes'
                else:
                    return 'No'

n=int(input())
print(canbuy(n))

Submission status: Accepted

Solution code:
def canbuy(n):
    for i in range(int(100/7)):
        tmp = n-7*i
        if tmp==0 or (tmp>3 and tmp%4==0):
            return 'Yes'
    return 'No'

n=int(input())
print(canbuy(n))

Submission status: Accepted

Solution code:
n = int(input())
a = 0
c = 0
while 7*a <=n:
    b = 0
    while (4*b) <= n-(7*a):
        if (7*a)+(4*b) == n:
            c += 1
            break
        else:
            b += 1
    a += 1
    if c == 0:
        pass
    else:
        break
if c == 1 or n == 4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin

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

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())
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())
ans = [(x, y) for x in range(n//4 + 1) for y in range(n//7 + 1) if 4*x + 7*y == n]
print("Yes" if len(ans) > 0 else "No")

Submission status: Accepted

Solution code:
import itertools

def solve(n, a):
    if n < 0:
        return False
    elif n == 0:
        return True
    elif len(a) == 0:
        return False
    elif len(a) == 1:
        return n % a[0] == 0
    elif n % a[0] == 0:
        return True
    else:
        for i in itertools.count(0):
            r = n - i * a[0]
            if r < 0:
                break
            if solve(r, a[1:]):
                return True
    return False

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

    if solve(n, (4, 7)):
        print('Yes')
    else:
        print('No')

main()

Submission status: Accepted

Solution code:
N = int(input())


def judge(N):
    i = 0
    while True:
        if 4 * i > N:
            break
        j = 0
        while True:
            if 4 * i + 7 * j == N:
                return "Yes"
            elif 4 * i + 7 * j > N:
                break
            else:
                j += 1
        i += 1
    return "No"


print(judge(N))

Submission status: Accepted

Solution code:
n = input()
N = int(n)

for x in range(25):
	for y in range(14):
		a = 4*x + 7*y
		if a == N:
			print("Yes")
			break
	else:
		continue
	break
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
for i in range(n):
    if 4 * i > n:
        break
    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(26):
  for j in range(15):
    if i*4+j*7==N:
      ans=True

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

Submission status: Accepted

Solution code:
def calc(N):
	while N > 0:
		if N % 7 == 0:
			print('Yes')
			return
		N -= 4
	if N == 0:
		print('Yes')
	else:
		print('No')

N = int(input())
calc(N)

Submission status: Accepted

Solution code:
a = [0]
for i in range(101):
	if i in a:
		a += [i+4,i+7]
n = int(input())
print("Yes" if n in a else "No")

Submission status: Accepted

Solution code:
N = int(input())

ans =  'No'
for i in range(101):
    for j in range(101):
        num = 4 * i + 7 * j
        if num == N:
            ans = 'Yes'
print (ans)

Submission status: Accepted

Solution code:
n=int(input())
s={4*i+7*j for i in range(25) for j in range(20) if 4*i+7*j<=100 and (i or j)}
if n in s:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N = int(input())
li = [4 * i + 7 * j for i in range(26) for j in range(15)]
print(["No","Yes"][N in li])

Submission status: Accepted

Solution code:
N = int(input())
dp = [0 for i in range(200)]
for i in range(26):
    dp[4 * i] = 1
for i in range(150):
    if(dp[i] == 1):
        dp[i + 7] = 1
if(dp[N]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    d = [0] * 101
    for i in range(25):
        d[i*4] = 1
    for i in range(7,101):
        if d[i-7] == 1:
            d[i] = 1
    n = I()
    if d[n] == 1:
        return 'Yes'
    return 'No'




print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

n = int(raw_input(""))

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

Submission status: Accepted

Solution code:
n = int(input())

kumi = []
for i in range(4,100,4):
  for j in range(7,100,7):
    if i+j < 100:
      kumi.append(i+j)
if n % 4 == 0 or n % 7 == 0 or n in kumi:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
def keisan(x, y):
	return y-4*x

if a%4==0 or a%11==0:
	print("Yes")
else:
	for i in range(a//4):
		keisan(i, a)
		#print(keisan(i, a))
		if keisan(i, a)%7==0:
			print("Yes")
			break
	else:
		print("No")

Submission status: Accepted

Solution code:
n = int(input())
print('Yes' if n in [7,14,4,11,8,15,12,16] or n > 17 else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())
    for x in range(0, 100):
        y = N - 4 * x
        if y < 0:
            break
        if y % 7 == 0:
            print ("Yes")
            exit(0)
    print ("No")

Submission status: Accepted

Solution code:
from sys import stdin
num=int(stdin.readline().rstrip())
ans="No"
if num%7==0 or num%4==0:
	ans="Yes"
if num-7>0 and (num-7)%4==0:
	ans="Yes"
if num-14>0 and (num-14)%4==0:
	ans="Yes"
if num-21>0 and (num-21)%4==0:
	ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(int(N/7.)+1):
    r = N - i*7
    if r%4==0:
        print("Yes")
        break
    else:
        continue
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())
for i in range(26):
    if i*4 > N:
        break
    if (N - i*4) % 7 == 0:
        print('Yes')
        exit()
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:
import sys
N = int(input())
for i in range(N):
    rem = N - 4*i
    if rem < 0:
        continue
    if rem % 7 == 0:
        print("Yes")
        sys.exit(0)
print("No")

Submission status: Accepted

Solution code:
N=int(input())
is_ans=0
for i in range(25):
    if is_ans:
        break
    for j in range(14):
        if 4*i+7*j==N:
            is_ans=1
            break
print("Yes" if is_ans else "No")

Submission status: Accepted

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

for i in range(25):
	if (i * 4) > N:
		break
	if (N - (i * 4)) % 7 == 0:
		ans = True
		break
		
if ans:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
def solve(n):
    for x in range(n/4+1):
        for y in range(n/7+1):
            if 4*x + 7*y == n:
                return "Yes"
    return "No"

assert solve(11) == "Yes"
assert solve(40) == "Yes"
assert solve(3) == "No"
print solve(input())

Submission status: Accepted

Solution code:
n = int(input())

if( n in {4,7,8,11,12,14,15,16} or n >= 18):
    print('Yes')
else:
    print('No')