Problem:


Score : 100 points

Problem Statement

You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".

Constraints

0 \leq N_1, N_2, N_3, N_4 \leq 9

N_1, N_2, N_3 and N_4 are integers.

Input

Input is given from Standard Input in the following format:

N_1 N_2 N_3 N_4

Output

If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print YES; if they cannot, print NO.

Sample Input 1

1 7 9 4

Sample Output 1

YES

We can get 1974 by swapping N_2 and N_3.

Sample Input 2

1 9 7 4

Sample Output 2

YES

We already have 1974 before doing anything.

Sample Input 3

1 2 9 1

Sample Output 3

NO

Sample Input 4

4 9 0 8

Sample Output 4

NO



Sample input:
1 7 9 4


Sample output:
YES

Submission status: Runtime Error

Solution code:
"""
C - Exam and Wizard
"""
import numpy as np

#メイン処理
if __name__ == '__main__':
    #入力
    n = int(input())
    a = np.array(list(map(int, input().split())))
    b = np.array(list(map(int, input().split())))

    if(np.sum(a) < np.sum(b)):
        print(-1)
        exit()

    c = b - a

    #不足リスト
    cm = c[c > 0]
    #print(cm)
    count = cm.size
    #print(count)
    if(count == 0):
        print(0)
        exit()
    point = np.sum(cm)
    #print('point:{0}'.format(point))

    #あまりリスト
    cp = np.sort(c[c < 0])[::-1]
    #print(cp)

    for i in range(cp.size):
        point = point - cp[i]
        count = count + 1
        if(point < 0):
            #終了
            print(count)
            exit()

Submission status: Runtime Error

Solution code:
num = [1, 9, 7, 4]
for i in a:
    if i not in a:
        print("NO")
        break
    else:
        num.remove(i)
        if len(num) == 0:
            print("YES")

Submission status: Runtime Error

Solution code:
N=input()
A=list(map(int, input().split()))
B=list(map(int, input().split()))

if sum(A) < sum(B) : 
    print(-1)
else :
    diff=[A[i] - B[i] for i in range(len(A))]
    pos=sorted([x for x in diff if x > 0])
    neg=[x for x in diff if x < 0]
    nes=sum(neg)
    if nes >= 0 :
        print(0)
    else:
        items = 0
        total_pos = 0
        for p in reversed(pos):
            items += 1
            total_pos += p
            if(total_pos + nes >= 0) :
                print(items + len(neg))
                break

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
A = list(map(int,input().split())) #準備度
B = list(map(int,input().split())) #試験

A = np.array(A)
B = np.array(B)


sumA = sum(A)
sumB = sum(B)

if sumA < sumB:
    print(-1)
else:
    gap = A - B
    minus = gap[gap<0]
    numminus = len(gap[gap<0])
    if numminus == 0:
        print(0)
    else:
        needs = - minus.sum()
        sortgap = np.sort(gap)[::-1]
        s = 0
        for i in range(N):
            s += sortgap[i]
            if s >= needs:
                changedplus = i+1
                break
        print(changedplus + numminus)

Submission status: Runtime Error

Solution code:
import re

a = input()
if re.match('(.*)keyence', a):
  print("YES")
else:
  if re.match('k(.*)eyence', a)
    print("YES")
  else:
    print("NO")

Submission status: Runtime Error

Solution code:
import re

a = input()
if re.match('(.*)keyence', a):
  print("YES")
else:
  if re.match('k(.*)eyence', a)
    print("YES")
  else:
    if re.match('ke(.*)yence', a)
      print("YES")
    else:
      print("NO")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if sum(a) < sum(b):
    print(-1)
    exit()

q = []
p = []
d = 0

for i in range(n):
    if a[i] - b[i] < 0:
        q.append(a[i]-b[i])
    elif a[i] - b[i] > 0:
        p.append(a[i]-b[i])
    else:
        d += 1

s = sum(q)
p = sorted(p)
while s < 0:
    if p == []:
        print(-1)
        exit()
    else:
        t = p.pop()
        s += t

print(n - d - len(p))

Submission status: Runtime Error

Solution code:
import re

a = input()
if re.match('(.*)keyence', a):
  print("YES")
else:
  if re.match('k(.*)eyence', a)
    print("YES")
  else:
    if re.match('ke(.*)yence', a)
      print("YES")
    else:
      if re.match('key(.*)ence', a)
        print("YES")
      else:
        if re.match('keye(.*)nce', a)
          print("YES")
        else:
          if re.match('keyen(.*)ce', a)
            print("YES")
          else:
            if re.match('keyenc(.*)e', a)
              print("YES")
            else:
              if re.match('keyence(.*)', a)
                print("YES")
              else:
                print("NO")

Submission status: Runtime Error

Solution code:

import re

a = input()
if re.match('(.*)keyence', a):
  print("YES")
  return
if re.match('k(.*)eyence', a)
  print("YES")
  return

if re.match('ke(.*)yence', a)
  print("YES")
  return

if re.match('key(.*)ence', a)
  print("YES")
  return

if re.match('keye(.*)nce', a)
  print("YES")
  return

if re.match('keyen(.*)ce', a)
  print("YES")
  return

if re.match('keyenc(.*)e', a)
  print("YES")
  return

if re.match('keyence(.*)', a)
  print("YES")
  return

print("NO")

Submission status: Runtime Error

Solution code:
f = []
f = input().split()
if '1' in f:
if '9' in f:
if '7' in f:
if '4' in f:
print("YES")
else:
print("NO")
else:
print("NO")
else:
print("NO")
else:
print("NO")

Submission status: Runtime Error

Solution code:
f = []
f = input().split()

if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
           else:
                print("NO")
     else:
          print("NO")
else:
     print("NO")

Submission status: Runtime Error

Solution code:
n = list(map(int, input().split()))

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")
"""

Submission status: Runtime Error

Solution code:
  i = set(map(str, input().split()))
  if ( '1' in i and '9' in i and '7' in i and '4' in i ):
      print ('YES')
  else:
      print ('NO')

Submission status: Runtime Error

Solution code:
import sys

num1 = input()
num2 = input()
num3 = input()
num4 = input()

strTarget = "1974"

isValidation1 = num1 in strTarget

if isValidation1 :
    strTarget.replace(num1,"")
else:
    print("NO")
    sys.exit()

isValidation2 = num2 in strTarget
if isValidation2 :
    strTarget.replace(num2,"")
else:
    print("NO")
    sys.exit()

isValidation3 = num3 in strTarget
if isValidation3 :
    strTarget.replace(num3,"")
else:
    print("NO")
    sys.exit()

isValidation4 = num4 in strTarget
if isValidation4 :
    strTarget.replace(num4,"")
else:
    print("NO")
    sys.exit()

print("YES")

Submission status: Runtime Error

Solution code:

ll = [1, 9, 7, 4]

a, b, c, d = map(int, input().split())

if ( a in ll ):
  ll.remove(a)
  if ( b in ll ):
    ll.remove(b)
    if ( c in ll ):
      ll.remove(bc)
      if ( d in ll ):
        print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
def main():
    value = input("input:")
    list1 = [int(i) for i in value.split()]

    if [1, 4, 7, 9] == list1.sorted():
        return "YES"
    else:
        return "NO"


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
l = [1, 9, 7, 4]

a, b, c, d = map(int, input().split())

if ( a in l && b in l && c in l && d in l):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:

l = [1, 9, 7, 4]

a = int(input())
b = int(input())
c = int(input())
d = int(input())

if ( a in l && b in l && c in l && d in l):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
   print(“YES”)
else:
   print(“NO”)

Submission status: Runtime Error

Solution code:
list = [int(i) for i in input().split()]

if [1, 4, 7,9] == list.sorted():
    return "YES"
else:
    return "NO"

Submission status: Runtime Error

Solution code:
s = set(*args)
r_s = set([1, 9, 4, 7])
if s == r_s:
 print(YES)
else:
 print(NO)

Submission status: Runtime Error

Solution code:
li = list(map(int, input().split()))
if (li in 1) and (li in 9) and (li in 7) and (li in 4):
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
A,B,C,D=(int(i) for i in input().split())
if {A,B,C,D}=={1,9,7,4}:
    print("Yes")
elif:
    print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))

if a in 1 and a in 9 and a in 7 and a in 4:
  print(YES)
else:
  print(NO)