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:
from sys import exit
N = int(input())
for i in range(N // 7 + 1):
  if (N - i * 7) % 4 == 0: 
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
X = N // 4 + 1
Z = N // 7 + 1
Y = sum(4*a + 7*b == N for a in range(X) for b in range(Z))
if (Y != 0):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N = int(input())
t = 0
if N % 4 == 0 or N % 7 == 0:
  ans = "Yes"
else:
  t = 0
  for i in range(1,(N//7)+1):
    x = (N-7*i)/4
    if x == int(x):
      t += 1
    else:
      continue
  if t > 0:
    ans = "Yes"
  else:
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
d=0
while d*7<=n:
    if (n-d*7)%4==0:
        print('Yes')
        break
    d+= 1
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"

limit_cakes = N // 4
limit_donuts = N // 7

for i in range(0, limit_cakes+1):
    for j in range(0, limit_donuts+1):
        if 4*i + 7*j == N:
            ans = "Yes"
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(25):
  for j in range(15):
    if i*4+j*7==N:
      ans += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(26):
  for j in range(15):
    if i * 4 + j * 7 == N:
      flag = True
      break

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

Submission status: Accepted

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

for i in range(26):
  for j in range(15):
    if i * 4 + j * 7 == N:
      count += 1

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

Submission status: Accepted

Solution code:
N = int(input())

flg = False

for i in range(25):
    for j in range(15):
        if 4 * i + 7 * j == N:
            flg = True
            continue
    if flg:
        break

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = int(input())
    count =0

    for i in range(30):
      for j in range(30):
          if s - (4 *i + 7*j) ==0:
              count +=1
          elif s - (4 *i + 7*j) < 0:
               continue

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  n = int(input())
  c7 = n//7
  c4 = n//4
  for i in range(c7,-1,-1):
    for j in range(c4,-1,-1):
      su_ = 7 * i + 4 * j
      if su_ == n:
        print('Yes')
        exit()
  print('No')
  
if __name__ == '__main__':
  main()

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:

ans = float("inf")


def solve():

    N = int(input())

    for cake in range(100):
        for donuts in range(100):
            if cake*4 + donuts*7 == N:
                print("Yes")
                exit()

    print("No")


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys

def resolve():
    N = int(input())
    for i in range(4, 100, 4):
        if N == i:
            print("Yes")
            return
        for j in range(7, 100, 7):
            if N == j:
                print("Yes")
                return
            if N == i + j:
                print("Yes")
                return
    print("No")

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

c = 0
while True:
    if c > n:
        break
    if (n - c) % 7 == 0:
        print('Yes')
        exit(0)
    c = c + 4
print('No')

Submission status: Accepted

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

ans = 0

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

print("No")

Submission status: Accepted

Solution code:
import sys

N = int(input())

# 全パターン洗い出す
for i in range(100):
    for j in range(100):
        if 4 * i + 7 * j == N:
            print('Yes')
            sys.exit(0)

print('No')

Submission status: Accepted

Solution code:
N = int(input())

for x in range(25+1):
    for y in range(14+1):
        if 4 * x + 7 * y == N:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
N = int(input())

sum = 0
for i in range(30):
    for j in range(20):
        total = 4*i + 7*j
        if total == N:
            sum += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy

def CakesandDonuts(n):

    ans = "No"
    a = copy.copy(n)

    if n % 7 == 0 or n % 4 == 0:
        ans = "Yes"
    else:
        while a > 0:
            n -= 7
            a -= 4
            if (n > 0 and n % 4 == 0) or (a > 0 and a % 7 == 0):
                ans = "Yes"

    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
for x in range(26):
    for y in range(15):
        if 4*x + 7*y == n:
            print('Yes')
            quit()
print('No')

Submission status: Accepted

Solution code:
N = int(input())
m = N // 7
while m >= 0:
  n = N - 7*m
  if n % 4 == 0:
    print('Yes')
    quit()
  m -= 1

print('No')

Submission status: Accepted

Solution code:
n = int(input())
doru = []

for i in range(26):
    for j in range(15):
        doru.append(4*i + 7*j)
        
print("YNeos"[n not in doru::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = "No"
donuts = n // 7 + 1

for i in range(donuts):
    rest = n - i * 7
    if rest % 4 == 0:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(range(0,101,7))
b=list(range(0,101,4))
ans=False
for i in a:
    for j in b:
        if i+j==n and i<=100 and j<=100:
            ans=True
            break
if(ans): print("Yes")
else: print("No")

Submission status: Accepted

Solution code:
n = int(input())

def dfs(p):
    if p == n:
        return True
    if p > n:
        return False
    if dfs(p+4) or dfs(p+7):
        return True
    return False

if dfs(0):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n=int(input())

ans="No"
for s in range(n//7+1):
    for f in range(n//4+1):
        if n==s*7+f*4:
            ans="Yes"
            break;
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
# Problem: https://atcoder.jp/contests/abc105/tasks/abc105_b
# Python 3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(givenMoney):
    result = "No"
    for j in range(0,101):
        for k in range(0,101):
            nowtotal = j * 4 + k * 7
            if nowtotal == givenMoney:
                result = "Yes"
    return result


if __name__ == "__main__":
    print("{}".format(solver(II())))

Submission status: Accepted

Solution code:
N = int(input())
min = N//4+1
count = 0
for i in range(min):
    for j in range(min):
        cost = i*4+j*7
        if cost == N:
            count += 1
        else:
            continue

if count >= 1:
    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()
print("No")

Submission status: Accepted

Solution code:
N=int(input())
for i in range(N):
    for j in range(N):
        t=i*4+j*7
        if t==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:
#!python3

# input
N = int(input())


def main():
    for i in range(30):
        for j in range(20):
            x = 4 * i + 7 * j
            if x == N:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

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())
flag = False
for i in range(-(-n // 4) + 1):
    for j in range(-(-n // 7) + 1):
        if n == 4 * i + j * 7:
            flag = True
            break

print("Yes" if flag == True else "No")

Submission status: Accepted

Solution code:
n = int(input())

ans = 'No'
if n%4 == 0 or n%7 == 0 or n%11 == 0:
  ans = 'Yes'
else:
  for i in range(15):
    if (n - 7*i)%4 == 0 and (n - 7*i) >= 0:
      ans = 'Yes'
      break
      
print(ans)

Submission status: Accepted

Solution code:
# Problem: https://atcoder.jp/contests/abc105/tasks/abc105_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(TOTALSUM):
    result = "No"
    totalsum4max = TOTALSUM // 4 + 1
    totalsum7max = TOTALSUM // 7 + 1
    for j in range(0,totalsum4max):
        for k in range(0,totalsum7max):
            nowtotal = j * 4 + k * 7
            if nowtotal == TOTALSUM :
                result = "Yes"
    return result


if __name__ == "__main__":
    print("{}".format(solver(II())))

Submission status: Accepted

Solution code:
n=int(input())
for i in range(26):
    for j in range(100//7+1):
        if 4*i+7*j==n:
            print('Yes')
            import sys
            sys.exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n=int(input())

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n==1 or n==3 or n==2 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())
print('Yes' if len([1 for i in range(n//4+1) for j in range(n//7+1) if 4*i+7*j==n])>=1 else 'No' )

Submission status: Accepted

Solution code:
import sys

def LI():
	return [ int(s) for s in input().split() ]
N = int(input())

for a in range(25):
  for b in range(15):
    if int(4*a + 7*b) == N:
      print('Yes')
      sys.exit()
      
print('No')

Submission status: Accepted

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

for i in range(N//4+1):
  if flag==False:
    for j in range(N//7+1):
      if 4*i+7*j==N:
        print("Yes")
        flag=True
        break


if flag==False:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem:
# Python  Try

import sys
# from collections import defaultdict
# import heapq
# import copy
# from collections import deque
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(totalsum):
    result = "No"
    for j in range(0, 100//4+1, +1):
        for k in range(0, 100//7+1, +1):
            thiscase = j * 4 + k * 7
            if thiscase == totalsum:
                result = "Yes"
    return result


if __name__ == "__main__":
    print("{}".format(solver(II())))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def check_pay(N):
    for i in range(int(N/4)+1):
        for j in range(0,int(N/7)+1):
            if i*4+j*7 == N:
                print("Yes")
                return
    print("No")
check_pay(int(input()))

Submission status: Accepted

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

for i in range(14):
  for j in range(25):
    if 7*i + 4*j == n:
      flag = 1
      break

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

Submission status: Accepted

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

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

    print('No')



main()

Submission status: Accepted

Solution code:
n = int(input())

res = "No"
for cake in range(0, int(n/4) + 1):
    for dornut in range(0, int(n/7) + 1):
        if 4 * cake + 7 * dornut == n:
            res = "Yes"
            break
    else:
        continue
    break

print(res)

Submission status: Accepted

Solution code:
n = int(input())
flag = 0
def dfs(val):
    global flag
    if val == n:
        flag = 1
        return
    if val>n:
        return
    if val<0:
        return
    dfs(val+4)
    dfs(val+7)
dfs(0)
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
for i in range(26):
  if (n - 4 * i ) % 7 or n - 4 * i < 0:
    continue
  else:
    print("Yes")
    sys.exit()
print("No")

Submission status: Accepted

Solution code:
import sys
import math

n = int(input())

flag = False
for i in range(math.ceil(n/4) + 1):
    for j in range(math.ceil(n/7) + 1):
        if n - (4*i) - (7*j) == 0:
            flag = True

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

Submission status: Accepted

Solution code:
n=int(input())

ok=False
for i in range(100):
        for j in range(100):
                if i*4+j*7==n:
                        ok=True
if ok:
        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):
    s = 4*i + 7*j
    if s > n:
      break
    if s == n:
      print("Yes")
      exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())

can = False
for i in range(26):
    for j in range(15):
        v = (i*4 + j*7)
        if v != 0:
            if n % v == 0:
                can = True
if can:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

flag = False

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print('No')

Submission status: Accepted

Solution code:
n=int(input())

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

print("No")

Submission status: Accepted

Solution code:
n = int(input())
ans = [1 for x in range(n//7 + 1) if (n-(7*x))%4 == 0]
if sum(ans) != 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
max = int(n/4)+1
result = "No"

for i in range(max):
  for j in range(max-i):
    if n == 4*i + 7*j:
      result = "Yes"
      
      
print(result)

Submission status: Accepted

Solution code:
n = int(input())
max = int(n/4)+5
result = "No"

for i in range(max):
  for j in range(max-i):
    if n == 4*i + 7*j:
      result = "Yes"
      
      
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(25):
    for j in range(15):
        if N==4*i+7*j:
            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(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 4*i+7*j==n:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

    is_buy = False
    for i in range(n):
        if is_buy:
            break
        for j in range(n):
            if n == i * 4 + j * 7:
                is_buy = True
                break
    
    print('Yes' if is_buy else '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 4*i+7*j == n:
            print('Yes')
            quit()
print('No')

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Mon Mar  9 08:41:04 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()

def rec(i):
    if i > N:
        return False
    if i == N:
        return True
    if rec(i + 4):
        return True
    if rec(i + 7):
        return True
    return False

print("Yes" if rec(0) else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    n=int(input())
    print('Yes' if n in [4*x+7*y for x in range(101) for y in range(101)] else 'No')


resolve()

Submission status: Accepted

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

cake_max= N // cake
donuts_max = N // donuts

for cake_num in range(cake_max+1):
    for donuts_num in range(donuts_max+1):
        if cake * cake_num + donuts * donuts_num == N:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
from itertools import product

N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
for r_1 in range(n//4 + 1):
    sum_4 = r_1 * 4
    for r_2 in range(n//7 + 1):
        sum_7 = r_2 * 7
        if sum_4 + sum_7 == n:
            print('Yes')
            exit()
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()
print('No')

Submission status: Accepted

Solution code:
n = int(input())

c = n // 4

ans = 0

for i in range(c+1):
    d = (n - i*4) // 7
    for v in range(d+1):
        buy = i*4 + v*7
        check = buy - n
        
        if check == 0:
            ans = "Yes"

if ans == "Yes":
    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==i*4+j*7: 
            print('Yes')
            exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans ='No'
for a in range(N//4+1):
    for b in range(N//7+1):
        total = a*4+b*7
        if total==N:
            ans='Yes'
            break
        else:
            continue
        break
if ans=='Yes':
    print(ans)
else:
    print('No')

Submission status: Accepted

Solution code:
#ABC105

n = int(input())
c = False
for i in range(n//7+1):
    for j in range(n//4+1):
        if i * 7 + j * 4 == n:
            c = True
            
print("Yes") if c else print("No")