AtCoder Beginner Contest 042 - Iroha and Haiku (ABC Edition)

Iroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.
To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

-----Constraints-----
 - 1≦A,B,C≦10

-----Input-----
The input is given from Standard Input in the following format:
A B C

-----Output-----
If it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.

-----Sample Input-----
5 5 7

-----Sample Output-----
YES

Using three phrases of length 5, 5 and 7, it is possible to construct a Haiku.

Difficulty: EASY

Starter code:

Solutions:
num = list(map(int, input().split()))
num.sort()
print('YES' if num == [5, 5, 7] else 'NO')


print(['NO', 'YES'][sorted(input()) == [' ', ' ', '5', '5', '7']])


print('YNEOS'[''.join(sorted(input().split())) != '557'::2])


import sys

def resultSur97(x):
	return x % (10 ** 9 + 7)

def __starting_point():
	aList = list(map(int, input().split()))
	x = 5
	c5 = 0
	c7 = 0
	for a in aList:
		if a == 5:
			c5 += 1
		elif a == 7:
			c7 += 1
	if c5 == 2 and c7 == 1:
		print('YES')
	else:
		print('NO')
__starting_point()


abc = list(input().split())
if abc.count('5') == 2 and abc.count('7') == 1:
	print('YES')
else:
	print('NO')


s = input()
flg = s.count('5') == 2 and s.count('7')
print('YES' if flg else 'NO')


(a, b, c) = input().split()
if (a + b + c).count('5') == 2 and (a + b + c).count('7') == 1:
	print('YES')
else:
	print('NO')


L = input().split()
print(['NO', 'YES'][L.count('5') == 2 and L.count('7') == 1])


a = list(map(int, input().split()))
print('YES' if sorted(a) == [5, 5, 7] else 'NO')


(a, b, c) = map(int, input().split())
print('YES' if a * b * c == 175 else 'NO')


haiku = ['5', '5', '7']
print('YES' if sorted(input().split()) == haiku else 'NO')


(A, B, C) = map(int, input().split())
if A + B + C == 17:
	print('YES')
else:
	print('NO')


phrases = sorted([int(x) for x in input().split()])
if phrases[0] == 5 and phrases[1] == 5 and (phrases[2] == 7):
	print('YES')
else:
	print('NO')


print(' YNEOS'[input() in ['5 5 7', '5 7 5', '7 5 5']::2].strip())


text = str(input())
cnt = 0
for i in text:
	if i == '5':
		cnt += 1
	if i == '7':
		cnt += 2
if cnt == 4:
	print('YES')
else:
	print('NO')


Len = list(map(int, input().split()))
if Len.count(5) == 2 and Len.count(7) == 1:
	print('YES')
else:
	print('NO')


N = input()
if N.count('5') == 2 and N.count('7') == 1:
	print('YES')
else:
	print('NO')


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
if a == 5 and b == 7 and (c == 5):
	print('YES')
elif a == 5 and b == 5 and (c == 7):
	print('YES')
elif a == 7 and b == 5 and (c == 5):
	print('YES')
else:
	print('NO')


import math
from datetime import date

def main():
	line = input().split()
	a = [int(x) for x in line]
	a.sort()
	if a[0] == 5 and a[1] == 5 and (a[2] == 7):
		print('YES')
	else:
		print('NO')
main()


print(['NO', 'YES'][input().split().count('5') == 2])


n = input().split()
print(['NO', 'YES'][n.count('7') == 1 and n.count('5') == 2])


s = input().split()
print('YES' if s.count('5') == 2 and s.count('7') == 1 else 'NO')


lst = list(map(int, input().split()))
lst.sort()
if lst[0] == 5 and lst[1] == 5 and (lst[2] == 7):
	print('YES')
else:
	print('NO')


A = list(map(int, input().split()))
ans = 'NO'
if A.count(5) == 2 and A.count(7) == 1:
	ans = 'YES'
print(ans)


(a, b, c) = map(int, input().split())
print('YES' if a * b * c == 5 * 5 * 7 else 'NO')


if '7 7' in input():
	print('NO')
else:
	print('YES')


(a, b, c) = list(map(int, input().split()))
if a % 5 != 0 and a % 7 != 0:
	print('NO')
elif b % 5 != 0 and b % 7 != 0:
	print('NO')
elif c % 5 != 0 and c % 7 != 0:
	print('NO')
elif a % 7 == 0:
	if b % 5 == 0 and c % 5 == 0:
		print('YES')
	else:
		print('NO')
elif b % 7 == 0:
	if a % 5 == 0 and c % 5 == 0:
		print('YES')
	else:
		print('NO')
elif a % 5 == 0 and b % 5 == 0:
	print('YES')
else:
	print('NO')


a = sorted([int(i) for i in input().split()])
print('YES' if a == [5, 5, 7] else 'NO')


array = list(map(str, input().split()))
if array.count('5') == 2 and array.count('7') == 1:
	print('YES')
else:
	print('NO')


print('NYOE S'[['5', '5', '7'] == sorted(input()[::2])::2])


print('YES' if sorted(map(int, input().strip().split(' '))) == [5, 5, 7] else 'NO')


print(['NO', 'YES'][sorted(list(map(int, input().split()))) == [5, 5, 7]])


S = input()
print(('NO', 'YES')[S.count('7') == 1 and S.count('5') == 2])


li = list(map(int, input().split()))
if li.count(5) >= 2:
	print('YES')
else:
	print('NO')


abc = sorted(list(map(int, input().split())))
if abc[0] == abc[1] == 5 and abc[2] == 7:
	print('YES')
else:
	print('NO')


print('YNEOS'[['5', '5', '7'] != sorted(input().split())::2])


a = list(map(int, input().split()))
if 7 == a[0]:
	if 5 == a[1] and 5 == a[2]:
		print('YES', end='\n')
	else:
		print('NO', end='\n')
elif 5 == a[0]:
	if 7 == a[1] and 5 == a[2] or (5 == a[1] and 7 == a[2]):
		print('YES', end='\n')
	else:
		print('NO', end='\n')
else:
	print('NO', end='\n')


(a, b, c) = map(int, input().split())
print('YES' if 2 == (a, b, c).count(5) else 'NO')


x = input()
str_a = x.split(' ')
array = [0] * 10
for s in str_a:
	array[int(s)] += 1
if array[5] == 2 and array[7] == 1:
	print('YES')
else:
	print('NO')


l = list(input().split())
l.sort()
if l == ['5', '5', '7']:
	print('YES')
else:
	print('NO')


S = input()
print('NYOE S'[S.count('5') == 2 and S.count('7') == 1::2])


(A, B, C) = map(int, input().split())
if sorted([A, B, C]) == [5, 5, 7]:
	print('YES')
else:
	print('NO')


s = ''.join(sorted(input()))
if s == '  557':
	print('YES')
else:
	print('NO')


l = input().split()
print(['NO', 'YES'][l.count('7') == 1 and l.count('5') == 2])


from collections import Counter
N = dict(Counter(map(int, input().split())))
print('YES') if N[5] == 2 and N[7] == 1 else print('NO')


t = input().split()
t.sort()
if t == ['5', '5', '7']:
	print('YES')
else:
	print('NO')


print('YNEOS'[sorted(list(map(int, input().split()))) != [5, 5, 7]::2])


A = list(input())
print('YES' if A.count('5') == 2 and A.count('7') == 1 else 'NO')


(a, b, c) = map(int, input().split())
print('YNEOS'[a * b * c != 175::2])


print('YNEOS'[eval(input().replace(' ', '*')) != 175::2])


l = input().split()
print('YES' if sorted(l) == ['5', '5', '7'] else 'NO')


(a, b, c) = map(int, input().split())
if not a + b + c == 17:
	print('NO')
	return
if not 7 in (a, b, c):
	print('NO')
	return
if not 5 in (a, b, c):
	print('NO')
	return
else:
	print('YES')


def __starting_point():
	str_list = list(map(int, input().split()))
	if sum(str_list) == 17:
		print('YES')
	else:
		print('NO')
__starting_point()


print('YES' if ''.join(sorted(input().split())) == '557' else 'NO')


import collections
import sys
m = collections.defaultdict(int)
line = input()
for d in line.split():
	m[d] += 1
if m['5'] == 2 and m['7'] == 1:
	print('YES')
else:
	print('NO')


a = input()
print(['NO', 'YES'][a.count('5') == 2 and a.count('7') == 1])


L = list(map(int, input().split()))
if L == [5, 7, 5] or L == [5, 5, 7] or L == [7, 5, 5]:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
print('YES' if a.count(7) == 1 else 'NO')


A = sorted(input().split())
print('YES' if A == ['5', '5', '7'] else 'NO')


(*a,) = input().split()
print('YES' if a.count('5') == 2 and a.count('7') else 'NO')


L = list(map(int, input().split()))
print('YES' if L.count(5) == 2 and 7 in L else 'NO')


from sys import stdin, stdout
from time import perf_counter
import sys
sys.setrecursionlimit(10 ** 9)
mod = 10 ** 9 + 7
l = sorted(map(int, input().split()))
print('YES' if l == [5, 5, 7] else 'NO')


A = input()
print(['NO', 'YES'][(A.count('5') == 2) * (A.count('7') == 1)])


print(['NO', 'YES']['  557' == ''.join(sorted(input()))])


print('YES' if eval(input().replace(' ', '+')) == 17 else 'NO')


s = list(input().split())
s.sort()
print('YES' if ''.join(s) == '557' else 'NO')


print('YES' if input().split().count('5') == 2 else 'NO')


(a, b, c) = sorted(input().split())
print('YNEOS'[a != '5' or b != '5' or c != '7'::2])


x = list(map(int, input().split()))
x.sort()
f = True
for (i, e) in enumerate(x):
	tmp = 5
	if i == 2:
		tmp = 7
	f &= tmp == e
print('YES' if f else 'NO')


print(['NO', 'YES'][list(sorted(input().split())) == ['5', '5', '7']])


n = input().split()
print('YNEOS'[n.count('5') != 2 or n.count('7') != 1::2])


print('YES' if sorted(list(input().split())) == ['5', '5', '7'] else 'NO')


a = map(int, input().split())
if sum(a) == 17:
	print('YES')
else:
	print('NO')


(s, t, u) = map(int, input().split())
if s + t + u == 17:
	print('YES')
else:
	print('NO')


line = input()
if line == '5 5 7' or line == '5 7 5' or line == '7 5 5':
	print('YES')
else:
	print('NO')


abc = sorted(input().split())
print('YES' if abc == ['5', '5', '7'] else 'NO')


print('YES' if sorted(input()[::2]) == ['5', '5', '7'] else 'NO')


str = input().split()
if str.count('7') == 1:
	print('YES')
else:
	print('NO')


n = sum(list(map(int, input().split())))
if n == 17:
	print('YES')
else:
	print('NO')


print(['NO', 'YES'][eval(input().replace(' ', '*')) == 175])


s = list(map(int, input().split()))
s.sort()
print(['NO', 'YES'][s == [5, 5, 7]])


n = list(map(int, input().split()))
N5 = 0
N7 = 0
for i in n:
	if i == 5:
		N5 += 1
	elif i == 7:
		N7 += 1
if N5 == 2 and N7 == 1:
	print('YES')
else:
	print('NO')


A = map(int, input().split())
AS = sorted(A)
I = [5, 5, 7]
if AS == I:
	print('YES')
else:
	print('NO')


print(['YES', 'NO'][input().count('7') == 2])


(A, B, C) = map(int, input().split())
num5 = 0
num7 = 0
ans = 'NO'
for num in [A, B, C]:
	if num == 5:
		num5 += 1
	elif num == 7:
		num7 += 1
	else:
		break
if num5 == 2 and num7 == 1:
	ans = 'YES'
print(ans)


(A, B, C) = list(map(int, input().split()))
sev = 0
fiv = 0
if A == 7:
	sev += 1
elif A == 5:
	fiv += 1
if B == 7:
	sev += 1
elif B == 5:
	fiv += 1
if C == 7:
	sev += 1
elif C == 5:
	fiv += 1
if sev == 1 and fiv == 2:
	print('YES')
else:
	print('NO')


a = input()
if a.count('5') == 2:
	print('YES')
else:
	print('NO')


a = input().replace('5', '')
print('NYOE S'[a.count('7') == 1::2])


(a, b, c) = sorted(map(int, input().split()))
print(['NO', 'YES'][a == b == 5 and c == 7])


a = input().split()
a.sort()
if a == ['5', '5', '7']:
	print('YES')
else:
	print('NO')


a = sorted(map(int, input().split()))
print('YNEOS'[a != [5, 5, 7]::2])


if tuple(sorted(input().split())) == ('5', '5', '7'):
	print('YES')
else:
	print('NO')


X = input()
if X in ['5 5 7', '5 7 5', '7 5 5']:
	print('YES')
else:
	print('NO')


s = input()
print('YES' if s == '5 5 7' or s == '5 7 5' or s == '7 5 5' else 'NO')


L = input()
print('YNEOS'[L.count('5') != 2 or '7' not in L::2])


inp = input()
if inp == '5 7 5' or inp == '7 5 5' or inp == '5 5 7':
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
iroha = [a, b, c]
if iroha.count(5) == 2 and iroha.count(7) == 1:
	print('YES')
else:
	print('NO')


import sys
sys.setrecursionlimit(100000)
A = list(map(int, input().split()))
A.sort()
if A[0] == 5 and A[1] == 5 and (A[2] == 7):
	print('YES')
else:
	print('NO')


def atc_042a(input_value: str) -> str:
	ABC = input_value.split(' ')
	if ABC.count('5') == 2 and ABC.count('7') == 1:
		return 'YES'
	return 'NO'
input_value_1 = input()
print(atc_042a(input_value_1))


l = list(map(int, input().split()))
l5 = l.count(5)
l7 = l.count(7)
if l5 == 2 and l7 == 1:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
b5 = 0
b7 = 0
if a == 5:
	b5 += 1
if a == 7:
	b7 += 1
if b == 5:
	b5 += 1
if b == 7:
	b7 += 1
if c == 5:
	b5 += 1
if c == 7:
	b7 += 1
if b5 == 2 and b7 == 1:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
if a + b + c == 17 and (a == 5 or a == 7) and (b == 5 or b == 7) and (c == 5 or c == 7):
	print('YES')
else:
	print('NO')


from typing import List

def answer(abc: List[int]) -> str:
	return 'YES' if sorted(abc) == [5, 5, 7] else 'NO'

def main():
	abc = list(map(int, input().split()))
	print(answer(abc))

def __starting_point():
	main()
__starting_point()


s = input()
z = s.count
print('YNEOS'[z('5') != 2 or z('7') != 1::2])


s = input()
print('YES' if s in '5 7 5 5 7' else 'NO')


(A, B, C) = map(int, input().split())
if A == 5 and B == 5 and (C == 7):
	print('YES')
elif A == 5 and B == 7 and (C == 5):
	print('YES')
elif A == 7 and B == 5 and (C == 5):
	print('YES')
else:
	print('NO')


l = [int(x) for x in input().split()]
l = sorted(l)
if l.count(5) == 2 and l.count(7) == 1:
	print('YES')
else:
	print('NO')


(a, b, c) = sorted(input().split())
print('YES' if a + b + c == '557' else 'NO')


A = sorted(list(input().split()))
print(['NO', 'YES'][A.count('5') == 2 and A.count('7')])


print(['YES', 'NO'][sum(list(map(int, input().split()))) != 17])


a = list(map(int, input().split()))
a.sort()
print('YNEOS'[a != [5, 5, 7]::2])


li = list(map(int, input().split()))
count5 = count7 = 0
for l in li:
	if l == 5:
		count5 += 1
	elif l == 7:
		count7 += 1
	else:
		print('NO')
		return
if count5 == 2 and count7 == 1:
	print('YES')
else:
	print('NO')


l = input().split()
list.sort(l)
print(['NO', 'YES'][l == ['5', '5', '7']])


a = list(sorted(input().split()))
print('YES' if ''.join(a) == '557' else 'NO')


s = sorted([int(x) for x in input().split()])
print('YES' if s == [5, 5, 7] else 'NO')


print(' YNEOS'[input().count('7')::2])


L = [int(i) for i in input().split()]
count5 = 0
count7 = 0
for i in range(3):
	if L[i] == 5:
		count5 += 1
	if L[i] == 7:
		count7 += 1
if count5 == 2 and count7 == 1:
	print('YES')
else:
	print('NO')


a = list(map(str, input().split()))
if a.count('5') == 2:
	if a.count('7') == 1:
		print('YES')
		return
print('NO')


val = map(int, input().split())
check_count = 0
for i in val:
	if i not in [5, 7]:
		print('NO')
	if i == 5:
		check_count += 1
if check_count == 2:
	print('YES')
else:
	print('NO')


ward = list(map(int, input().split()))
ward_sorted = sorted(ward)
if (ward_sorted[0] == 5) & (ward_sorted[1] == 5) & (ward_sorted[2] == 7):
	print('YES')
else:
	print('NO')


(A, B, C) = map(int, input().split())
if A + B + C == 17 and max(A, B, C) == 7 and (min(A, B, C) == 5):
	print('YES')
else:
	print('NO')


N = input().split()
N.sort()
print('YES') if ['5', '5', '7'] == N else print('NO')


n = [int(_) for _ in input().split()]
print('YES' if sorted(n) == [5, 5, 7] else 'NO')


print('YES' if sum([int(x) for x in input().split()]) == 17 else 'NO')


a = [int(x) for x in input().split()]
a.sort()
if a == [5, 5, 7]:
	print('YES')
else:
	print('NO')


x = input().split()
fn = 0
sn = 0
for i in range(len(x)):
	if int(x[i]) == 5:
		fn += 1
	elif int(x[i]) == 7:
		sn += 1
if fn == 2:
	if sn == 1:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


a = input()
b = a.split()
if b[0] == '5' and b[1] == '5' and (b[2] == '7'):
	print('YES')
elif b[0] == '5' and b[1] == '7' and (b[2] == '5'):
	print('YES')
elif b[0] == '7' and b[1] == '5' and (b[2] == '5'):
	print('YES')
else:
	print('NO')


a = input().split()
new = sorted(a)
print('YES' if new == ['5', '5', '7'] else 'NO')


import sys
input = lambda : sys.stdin.readline().rstrip()

def main():
	x = list(map(int, input().split()))
	if x.count(5) == 2 and x.count(7) == 1:
		print('YES')
	else:
		print('NO')

def __starting_point():
	main()
__starting_point()


(a, b, c) = map(int, input().split())
print('YNEOS'[a + b + c != 17 or a ^ b ^ c != 7::2])


a = ''.join(sorted(map(str, input().split())))
print('YES' if a == '557' else 'NO')


print('YNEOS'[eval(input().replace(' ', '+')) != 17::2])


a = list(map(int, input().split()))
num_5 = 0
num_7 = 0
for i in a:
	if i == 5:
		num_5 = num_5 + 1
	if i == 7:
		num_7 = num_7 + 1
if num_5 == 2 and num_7 == 1:
	print('YES')
else:
	print('NO')


w = sorted(input().split())
cri = ['5', '5', '7']
print('YES' if w == cri else 'NO')


print(['YES', 'NO'][input().split().count('5') == 1])


x = input()
mode = 0
count = 0
for num in x.split(' '):
	if num == '5':
		mode += 1
	elif num == '7':
		mode += 4
	count += 1
if mode == 6 and count == 3:
	print('YES')
else:
	print('NO')


def iroha():
	(A, B, C) = map(int, input().split())
	S = A + B + C
	if S == 17:
		print('YES')
	else:
		print('NO')

def __starting_point():
	iroha()
__starting_point()


S = input().split()
S.sort()
print('YES' if ''.join(S) == '557' else 'NO')


s = input().split()
print('YNEOS'[s.count('7') != 1 or s.count('5') != 2::2])


a = map(int, input().split())

def answer(a: list) -> str:
	a = sorted(a)
	if a == [5, 5, 7]:
		return 'YES'
	else:
		return 'NO'
print(answer(a))


print('NYOE S'['557' == ''.join(sorted(input()[::2]))::2])


s = input().split()
print('NYOE S'[s.count('7') == 1 and s.count('5') == 2::2])