Problem:


Score : 200 points

Problem Statement

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

Constraints

N is an integer between 1 and 100, inclusive.

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

11

Sample Output 1

Yes

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

Sample Input 2

40

Sample Output 2

Yes

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

Sample Input 3

3

Sample Output 3

No

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



Sample input:
11


Sample output:
Yes

Submission status: Accepted

Solution code:
n = int(input())

for x in range(100):
  for y in range(100):
    if 4*x + 7*y == n:
      print('Yes')
      exit(0)

print('No')

Submission status: Accepted

Solution code:
x = int(input())
flag = 0
for i in range((x//7)+1):
    if x < 0:
        break
    if x%4 == 0:
        flag = 1
    x = x - 7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N%2==1:
    N = N-7
if N%4==2:
    N = N-14
if (N%4==0)and(N>=0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

C = 4
D = 7
value = 0
ans = "No"

for i in range(100):
    for j in range(100):
        value = C * i + D * j
        if value == N:
            ans = "Yes"
            break

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[n]
while n>6:
    n=n-7
    l.append(n)
print('Yes' if any([l[j]%4==0 for j in range(len(l))]) else 'No')

Submission status: Accepted

Solution code:
n = int(input())

dp = [False]*110
dp[4] = dp[7] = True

for i in range(101):
  if dp[i]:
    dp[i+4] = True
    dp[i+7] = True
  
if dp[n]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

N = int(input())

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

    print('No')

# 7x + 4y = N
# y = (N - 7x) / 4 (4で割り切れる)

Submission status: Accepted

Solution code:
n = int(input())
cake = 4
donut = 7

for i in range(25):
    for j in range(25):
        if i*cake+j*donut==n:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:
n=int(input())
ans=False
for a in range(26):
    for b in range(26):
        if 4*a+7*b==n:
            ans=True
            break
    
if ans==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(26):
  if (N-i*4)% 7 == 0 and N>= i*4:
    print("Yes")
    exit()
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"
            break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
c_range = -(-N // 4) + 1
d_range = -(-N // 7) + 1
for d in range(d_range):
    for c in range(c_range):
        if c * 4 + d * 7 == N:
            print('Yes')
            break
    else:
        continue
    break
else:
    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"
            break
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

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

Submission status: Accepted

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

c =set()
for i in a:
    for j in b:
        if i+j != 0 and i+j <=n:
            c.add(i+j)
            
if n in c:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
time = N // 7
bl = False

for x in range(time+1):
    y = N - x * 7
    if y % 4 == 0:
        bl = True; break

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

Submission status: Accepted

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

def resolve():
    n=int(input())
    l=[1,2,3,5,6,9,10,13,17]
    if n in l:
        print('No')
    else:
        print('Yes')
resolve()

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for k in range(26):
    for d in range(14):
        if 4*k + 7*d == n:
            count += 1
print('Yes' if count >= 1 else 'No')

Submission status: Accepted

Solution code:
n = int(input())

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

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
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        for cake in range(26):
            for donut in range(15):
                if cake*4+donut*7==n:
                    return 'Yes'
        return 'No'
    print(main())
resolve()

Submission status: Accepted

Solution code:
"""
k,s=map(int,input().split())
x=[0]*k
for i in range(0,k):
  x[i]=i
x.append(k)
a=int(s/3)-1
count=0
for i in range(0,len(x)):
  stemp=s-x[i]
  for j in range(0,min(k+1,stemp)):
    if stemp-x[j] in x:
      count=count+1
print(count)
"""
n=int(input())
temp=[]
i=1
j=0
while True:
  temp.append(i*4+j*7)
  i=i+1
  if (i-1)*4+j*7>100:
    i=0
    j=j+1
  if j>=15:
    break
for i in range(0,len(temp)):
  if temp[i]==n:
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0, n + 1, 4):
    if (n - i) % 7 == 0:
        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:
dollar = int(input())
max_7 = dollar//7+1
for i in range(max_7):
  amari = dollar - 7*i
  if amari % 4==0:
    print('Yes')
    break
  if i==max_7-1:
    print('No')

Submission status: Accepted

Solution code:
from sys import exit

n=int(input())

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

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:
import sys
n=int(input())
for i in range(26):
    for j in range(15):
        if 4*i+7*j==n:
            print("Yes")
            sys.exit()
print("No")

Submission status: Accepted

Solution code:
n = int(input())
a = 25
b = 15

cnt = 0
for i in range(a + 1):
  for j in range(b + 1):
    if 4*i + 7*j == n:
      cnt += 1
if cnt >= 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys

N = int(input())
for cake in range(30):
    for donut in range(15):
        if 4*cake+7*donut == N:
            print('Yes')
            sys.exit()

print('No')

Submission status: Accepted

Solution code:
inf = 10 ** 15
mod = 10 ** 9 + 7

n = int(input())
tmp = 0
flag = False
while tmp <= n:
    if (n-tmp) % 7 == 0:
        flag = True
    tmp+=4
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(n):
    for i in range(200):
        for j in range(200):
            if i * 4 + j * 7 == n:
                return True
    return False

def main():
    n = int(input())
    if solve(n):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

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())
for i in range(0,100,4):
    for j in range(0,100,7):
        #print(i,j)
        if i+j == n:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:
import math
N = int(input())
a = math.floor(N / 4)
b = math.floor(N / 7)
ans = "No"
for i in range(a + 1):
  for j in range(b + 1):
    if i * 4 + j * 7 == N:
      ans = "Yes"
      break
  else:
    continue
  break
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
res = "No"
for c in range(N//4 + 1):
    for d in range(N//7 + 1):
        total = 4*c + 7*d
        if total == N:
            res = "Yes"
print(res)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC105 B

def main():
    n = int(input())
    res = 'No'

    for i in range(100 // 4):
        for j in range((100-i) // 7):
            if 4 * i + 7 * j == n:
                res = 'Yes'
                break
    
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for cake in range(25 + 1):
    for donut in range(14 + 1):
       if n - cake * 4 - donut * 7 == 0:
           print('Yes')
           exit()
print('No')

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math

N = int(input())
str = 'No'
for i in range (math.floor( N/4 )+1):
    for j in range(math.floor(N/7)+1):
        if 4*i + 7*j == N:
            str = 'Yes'
print(str)

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())
count = 0
for i in range(26):
    for j in range(16):
        if 4 * i + 7 * j == N:
            print("Yes")
            exit()
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())
ans = 0
for i in range(16):
    for j in range(26):
        if 7*i + 4*j == n:
            print("Yes")
            exit()
else:
    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())
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())
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:
import sys
from bisect import bisect_left
INF = 1 << 30

def main():
    N = int(input())
    for i in range(100):
        for j in range(100):
            if 4*i + 7*j == N:
                print('Yes')
                return
    print('No')
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
number_4 = []
number_7 = []

for i in range(101):
    if i % 4 == 0:
        number_4.append(i)
    if i % 7 == 0:
        number_7.append(i)

n = int(input())

found = False
for i in range(len(number_4)):
    if found:
        break
    if n < 4:
        break
    for j in range(len(number_7)):
        if number_4[i] + number_7[j] == n:
            found = True
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print("No")

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

l4 = N // 4
l7 = N // 7

ck = 0

for i in range(l4+1):
  for j in range(l7+1):
    
    if i * 4 + j * 7 == N:
      ck = 1
      
if ck == 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(16):
        if i*4 + j*7 == N:
            ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
def solve(cu_num):
    if cu_num < 4:
        return False
    if cu_num % 4 == 0 or cu_num % 7 == 0:
        return True
    return solve(cu_num-4) or solve(cu_num-7)


num = int(input())

if solve(num):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())

x = 0

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

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

Submission status: Accepted

Solution code:
import sys

N = int(input())

while N > 0:
    if N % 7 == 0 or N % 4 == 0:
        print('Yes')
        sys.exit()
    else:
        N -= 7

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:
def num_4x_list():
    # 100以下の4の倍数をつくる
    return [4 * i for i in range(1, (100 // 4) + 1)]


def num_list_comb_4_7():
    # 4 と 7 の和の組み合わせで表現できる数を列挙する(最大は100)
    diff = 7 - 4  # ドーナツとケーキの差分が公差になる

    x = set()

    for i, num_4x in enumerate(num_4x_list(), start=1):
        for j in range(i + 1):
            element = num_4x + diff * j
            x |= {element}

    return {y for y in x if y <= 100}


def actual(N):
    if N in num_list_comb_4_7():
        return 'Yes'

    return 'No'

  
  
N = int(input())

print(actual(N))

Submission status: Accepted

Solution code:

def actual(N):
    """
    発想: 4 と 7 の和の組み合わせで表現できる数を列挙する(最大は100)
    """
    num_4x_list = [4 * i for i in range(1, (100 // 4) + 1)]

    set_all = set()

    for i, num_4x in enumerate(num_4x_list, start=1):
        for j in range(i + 1):
            element = num_4x + 3 * j

            if element <= 100:
                set_all |= {element}

    if N in set_all:
        return 'Yes'

    return 'No'
  
  
N = int(input())

print(actual(N))

Submission status: Accepted

Solution code:

N = int(input())

A = []
for i in range((N//4)+1) :
    for j in range((N//7)+1) :
        if N == 4*i + 7*j :
            A.append("Yes")
        else :
            A.append("No")

if "Yes" in A :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans = 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
max7 = N // 7
ans = 0

for x in range(max7 + 1):
    if (N - 7 * x) % 4 == 0:
        ans = 1

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

Submission status: Accepted

Solution code:
n = int(input())
while n>0:
    if n%4==0:
        print("Yes")
        break
    elif n%7==0:
        print("Yes")
        break
    elif n%11==0:
        print("Yes")
        break
    elif(1):
            i=1
            n = n-4*i
            if n%7==0:
                print("Yes")
                break
            if n<=0:
                print("No")

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
x = [1,2,3,5,6,9,10,13,17]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
flag = False
if N % 4 == 0 or N % 7 == 0:
  flag = True
else:
  i = 0
  while i * 4 <= 100:
    i += 1
    if N % (i * 4) % 7 == 0 or N % (i * 7) % 4 == 0:
      flag = True
      break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n % 4 != 0:
    n -= 7

    if n < 0:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    for i in range(26):
        for j in range(15):
            if 4 * i + 7 * j == n:
                print('Yes')
                exit()
    print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(N + 1):
  j = N - i
  if i % 4 == 0 and j % 7 == 0:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
ans = 'No'
for c in range(100):
    for d in range(100):
        if c * 4 + d * 7 == N:
            ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

for i in range(30):
    for j in range(30-i):
        if (4*i)+(7*j) == N:
            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 n == 4*i + 7*j:
      ans = True
      break
    else:
      continue
print('Yes' if ans else '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())
for i in range(30):
    for j in range(20):
        if 4*i + 7*j == N:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc105
# 12:25-


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

    n = 0
    while 4*n <= N:
        m = 0
        while 4*n + 7*m <= N:
            if 4*n + 7*m == N:
                return "Yes"
            m += 1
        
        n += 1
    
    return "No"


print(main())

Submission status: Accepted

Solution code:
# 5問目類題1
N = int(input())
ms ="No"
for i in range(15):
    for j in range(25):
        if i*7 + j*4 == N:
            ms = "Yes"
    else:
        continue
    break

print(ms)

Submission status: Accepted

Solution code:
n = int(input())

ans = 'No'

for a in range(0, int(n/4)+1):
    for b in range(0, int(n/7)+1):
        if a*4 + b*7 == 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())
ans = 0

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

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

Submission status: Accepted

Solution code:
CAKE = 4
DONUTS = 7
n = int(input())
max_cake = n//CAKE
max_donuts = n//DONUTS
flag = 0
for i in range(max_cake+1):
    for j in range(max_donuts+1):
        if i*CAKE+j*DONUTS == n:
            flag = 1
if flag == 1 :
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    n = int(input())
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    max7 = n // 7
    max4 = n // 4

    re = "No"
    for i in range(max7 + 1):
        for j in range(max4 + 1):
            if 7 *i + 4 *j == n:
                re = "Yes"

    print(re)


resolve()

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    TF = 'No'
    for i in range(25):
        if N-4*i<0:
            break
        elif (N-4*i)%7==0:
            TF='Yes'
            break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)

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