Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
from collections import deque
n=int(input())
edge = [[] for _ in range(n)]
visited = [0]*n
for i in range(n-1):
    a,b=map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
path = []
def dfs(i):
    visited[i]=1
    if(i==n-1):
        return 1
    else:
        for j in edge[i]:
            if(not visited[j]):
                if(dfs(j)):
                    if(i!=0):
                        path.append(i)
                    return i

    return 0



dfs(0)
s = 0
f = 0
visited_new = [-1]*n
path_l = len(path)
for i in range(path_l):
    if(i<(path_l//2)):
        visited_new[path[i]]=1
        s+=1
    else:
        visited_new[path[i]]=2
        f+=1

visited_new[n-1]=3
visited_new[0]=3
que=deque()
que.append(n-1)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==2:continue
        if visited_new[next_v]==1 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            s+=1
que.append(0)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==3:continue
        if visited_new[next_v]==2 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            f+=1

if(f>=s):
    print("Fennec")
else:
    print("Snuke")


Fixed submission:
import itertools
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n=int(input())
edge = [[] for _ in range(n)]
visited = [0]*n
for i in range(n-1):
    a,b=map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
path = []
def dfs(i):
    visited[i]=1
    if(i==n-1):
        return 1
    else:
        for j in edge[i]:
            if(not visited[j]):
                if(dfs(j)):
                    if(i!=0):
                        path.append(i)
                    return i

    return 0



dfs(0)
s = 0
f = 0
visited_new = [-1]*n
path_l = len(path)
for i in range(path_l):
    if(i<(path_l//2)):
        visited_new[path[i]]=1
        s+=1
    else:
        visited_new[path[i]]=2
        f+=1

visited_new[n-1]=3
visited_new[0]=3
que=deque()
que.append(n-1)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==2:continue
        if visited_new[next_v]==1 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            s+=1
que.append(0)
while que:
    v=que.popleft()
    for next_v in edge[v]:
        if visited_new[next_v]==3:continue
        if visited_new[next_v]==2 or visited_new[next_v]==-1:
            visited_new[next_v]=3
            que.append(next_v)
            f+=1
if(f>s):
    print("Fennec")
else:
    print("Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-2
    ans=0

    for i in range(k):
        ans+=pot
        pot-=1
    print(ans)


Fixed submission:
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-1
    m = k*b
    high = m+a
    low = a*k + b
    print(high-low+1)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-2
    ans=0

    for i in range(k):
        ans+=pot
        pot-=1
    print(ans)


Fixed submission:
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-1
    m = k*b
    high = m+a
    low = a*k + b
    print(high-low+1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-2
    ans=0

    for i in range(k):
        ans+=pot
        pot-=1
    print(ans)


Fixed submission:
n,a,b=map(int, input().split())
pot = b-a+1
if(b<a):
    print(0)
    exit()
if n==0:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:print(0)
elif n==2:
    if a==b:print(1)
    print(1)
else:
    k = n-1
    m = k*b
    high = m+a
    low = a*k + b
    print(high-low+1)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
t = a % b
if t==c:
  print("YES")
  exit()
if t == 0 and c != 0:
  print("NO")
elif t==0 and c==0:
  print("YES")
else:
  for i in range(b):
    t*=(a%b)
    if t%b==c:
      print("YES")
   	  exit()
  print("NO")
    

Fixed submission:
a,b,c=map(int, input().split())
r=0
i=0
while 1:
    r+=a
    if r>=a*b:
        print("NO")
        exit()
    else:
        if r%b==c:
            print("YES")
            exit()
Buggy python submission (verdict: Runtime Error):
import numpy as np
def warshall_floyd(d,n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if(i!=j):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
def main():

    n,m=map(int, input().split())
    edge = [[] for _ in range(n)]
    d = [[float("inf")]*n for i in range(n)]
    d_1 = [[float("inf")]*n for i in range(n)]
    e_lis = [0]*m
    for i in range(m):
        a,b,c=map(int, input().split())
        d[a-1][b-1]=d[b-1][a-1]=d_1[a-1][b-1]=d_1[b-1][a-1]=c
    res = warshall_floyd(d,n)
    cnt=0
    for i in range(n):
        for j in range(n):
            if(res[i][j]!=d_1[i][j] and d_1[i][j]<10000):
                cnt+=1
    print(cnt//2)


if __name__ == '__main__':
    main()


Fixed submission:
def warshall_floyd(d,n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if(i!=j):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
def main():

    n,m=map(int, input().split())
    edge = [[] for _ in range(n)]
    d = [[float("inf")]*n for i in range(n)]
    d_1 = [[float("inf")]*n for i in range(n)]
    e_lis = [0]*m
    for i in range(m):
        a,b,c=map(int, input().split())
        d[a-1][b-1]=d[b-1][a-1]=d_1[a-1][b-1]=d_1[b-1][a-1]=c
    res = warshall_floyd(d,n)
    cnt=0
    for i in range(n):
        for j in range(n):
            if(res[i][j]!=d_1[i][j] and d_1[i][j]<10000):
                cnt+=1
    print(cnt//2)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b=map(int, input().split())
if a==0 or b==0:
  print("Zero")
  exit()
if(a=<0 and b>=0):
  print("Zero")
  exit()
if a>0:
  print("Positive")
elif abs(b-a)%2==0:
  print("Negative")
else:
  print("Positive")
  
 

Fixed submission:
a, b=map(int, input().split())
if a==0 or b==0:
  print("Zero")
  exit()
if(a<=0 and b>=0):
  print("Zero")
  exit()
if a>0:
  print("Positive")
elif abs(b-a)%2==0:
  print("Negative")
else:
  print("Positive")
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
 
N, K = map(int, readline.split())
A = list(map(int, readline().split()))
 
l = 0, r = 10**10
 
def test(m):
  return sum((a + m - 1) // m for a in A) <= K

while l + 1 < r:
  m = (l + r) // 2
  if test(m):
  	r = m
  else:
    l = m
print(r)

Fixed submission:
import sys
readline = sys.stdin.readline
 
N, K = map(int, readline().split())
A = list(map(int, readline().split()))
 
l = 0
r = 10**10
 
def test(m):
  return sum((a + m - 1) // m for a in A) - N <= K

while l + 1 < r:
  m = (l + r) // 2
  if test(m):
  	r = m
  else:
    l = m
print(r)

Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline

N, K = map(int, readline.split())
A = list(map(int, readline().split()))

l = 0, r = 10**10

def test(m):
	return sum((a + m - 1) // m for a in A) <= K

while l + 1 < r:
	m = (l + r) // 2
   	if test(m):
      	r = m
    else:
      	l = m

print(r)

Fixed submission:
import sys
readline = sys.stdin.readline
 
N, K = map(int, readline().split())
A = list(map(int, readline().split()))
 
l = 0
r = 10**10
 
def test(m):
  return sum((a + m - 1) // m for a in A) - N <= K

while l + 1 < r:
  m = (l + r) // 2
  if test(m):
  	r = m
  else:
    l = m
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline

from heapq import *

def solve():
    N, K = map(int, readline().split())
    A = list(map(int ,readline().split()))

    A.sort()

    B = [(-a, 1) for a in A]

    heapify(B)

    for i in range(K):
        b, n = heappop(B)
        heappush(B, (b * n / (n + 1), n + 1))

    ans = -min(B)[0]
    if ans != int(ans):
        print(int(1 + ans))
    else:
        print(ans)

solve()

Fixed submission:
import sys
readline = sys.stdin.readline
 
N, K = map(int, readline().split())
A = list(map(int, readline().split()))
 
l = 0
r = 10**10
 
def test(m):
  return sum((a + m - 1) // m for a in A) - N <= K

while l + 1 < r:
  m = (l + r) // 2
  if test(m):
  	r = m
  else:
    l = m
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline


def solve():
    N = int(readline())

    anses = [0] * N

    for x in range(1, N):
        for y in range(1, N):
            for z in range(1, N):
                a = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if a > N:
                    break
                anses[a - 1] += 1
    
    for a in anses:
        print(a)

solve()

Fixed submission:
import sys
readline = sys.stdin.readline


def solve():
    N = int(readline())

    anses = [0] * N

    for x in range(1, N):
        for y in range(x, N):
            for z in range(y, N):
                a = x**2 + y**2 + z**2 + x*y + y*z + z*x
                if a > N:
                    break
                if x == y == z:
                    anses[a - 1] += 1
                elif x == y or y == z or z == x:
                    anses[a - 1] += 3
                else:
                    anses[a - 1] += 6
    
    for a in anses:
        print(a)

solve()
Buggy python submission (verdict: Runtime Error):
import sys
from heapq import *
readline = sys.stdin.readline

def solve2(left):
    ans = 0
    k2values = {}
    for v, k in left:
        if k not in k2values:
            k2values[k] = []
        k2values[k].append(v)
    
    pq = []
    maxk = max(k for v,k in left)
    for k in range(maxk, 0, -1):
        if k in k2values:
            for v in k2values[k]:
                heappush(pq, -v)
        if len(pq) > 0:
            v = heappop(pq)
            ans += -v
    return ans


def solve():
    N = int(readline())
    
    left = []
    right = []
    
    ans = 0
    
    for i in range(N):
        k, l, r = map(int, readline().split())
        if l > r:
            left.append((l - r, k))
            ans += r
        else:
            right.append((r - l, N - k))
            ans += l
    
    ans += solve2(left)
    ans += solve2(right)
    
    print(ans)

T = int(readline())
for i in range(T):
    solve()

Fixed submission:
import sys
from heapq import *
readline = sys.stdin.readline

def solve2(left):
    if len(left) == 0:
        return 0
    ans = 0
    k2values = {}
    for v, k in left:
        if k not in k2values:
            k2values[k] = []
        k2values[k].append(v)
    
    pq = []
    maxk = max(k for v,k in left)
    for k in range(maxk, 0, -1):
        if k in k2values:
            for v in k2values[k]:
                heappush(pq, -v)
        if len(pq) > 0:
            v = heappop(pq)
            ans += -v
    return ans


def solve():
    N = int(readline())
    
    left = []
    right = []
    
    ans = 0
    
    for i in range(N):
        k, l, r = map(int, readline().split())
        if l > r:
            left.append((l - r, k))
            ans += r
        else:
            right.append((r - l, N - k))
            ans += l
    
    ans += solve2(left)
    ans += solve2(right)
    
    print(ans)

T = int(readline())
for i in range(T):
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline

P = 10 ** 9 + 7
def mod_prod(a,b):
    return (a % P) * (b % P) % P

def mod_fact(a):
    ret = 1
    for i in range(a):
        ret = ret * (i + 1) % P
    return ret

def mod_pow(a, n):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % P
        a = a * a % P
        n = n >> 1
    return ret

def mod_div(a, b):
    b_inv = mod_pow(b, P - 2)
    return a * b_inv % P

def mod_comb(a,b):
    ret = 1
    b = min(b, a - b)
    for i in range(b):
        ret *= a - i
        ret %= P
    ret = mod_div(ret, mod_fact(b))
    return ret

def solve():
    K = int(readline())
    S = readline().rstrip()

    N = len(S)

    ans = 0
    for i in range(K + 1):
        ans += mod_pow(25, i) * mod_comb(i+N-1, i) * mod_pow(26, K-i)
        ans %= P
    print(ans)

solve()

Fixed submission:
import sys
readline = sys.stdin.readline

P = 10 ** 9 + 7
def mod_prod(a,b):
    return (a % P) * (b % P) % P

def mod_fact(a):
    ret = 1
    for i in range(a):
        ret = ret * (i + 1) % P
    return ret

def mod_pow(a, n):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % P
        a = a * a % P
        n = n >> 1
    return ret

def mod_div(a, b):
    b_inv = mod_pow(b, P - 2)
    return a * b_inv % P

def mod_comb(a,b):
    ret = 1
    b = min(b, a - b)
    for i in range(b):
        ret *= a - i
        ret %= P
    ret = mod_div(ret, mod_fact(b))
    return ret

def solve():
    K = int(readline())
    S = readline().rstrip()

    N = len(S)

    ans = 0
    cb = 1
    for i in range(K + 1):
        ans += mod_pow(25, i) * cb * mod_pow(26, K-i)
        cb = cb * mod_div(i + N - 1 + 1, i + 1) % P
        # mod_comb(i+N-1, i)
        ans %= P
    print(ans)

solve()
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline

def solve():
    X, Y = map(int, readline().split())

    Y - X * 2 = a

    if a >= 0 and a % 2 == 0:
        print('Yes')
    else:
        print('No')

solve()

Fixed submission:
import sys
readline = sys.stdin.readline

def solve():
    X, Y = map(int, readline().split())

    a = Y - X * 2

    if a >= 0 and a % 2 == 0 and a // 2 <= X:
        print('Yes')
    else:
        print('No')

solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
sys.setrecursionlimit(10000000)
readline = sys.stdin.readline

def solve():
    H, W, K = map(int, readline().split())
    x1, y1, x2, y2 = map(int,readline().split())
    x1, y1, x2, y2 = (v - 1 for v in (x1, y1, x2, y2))
    C = [readline().rstrip() for i in range(H)]

    visited = [[False] * W for i in range(H)]
    dist = [[0] * W for i in range(H)]

    dirs = [(1, 0), (0, 1), (-1, 0), (0, -1)]

    q = deque()

    q.append((x1, y1, 0))
    visited[x1][y1] = True
    dist[x1][y1] = 0

    def aa(_i, _j, y, x, d):
        i, j = _i, _j
        for k in range(K):
            i += y
            j += x
            if not (0 <= i < H and 0 <= j < W):
                break
            if C[i][j] == '@':
                break
            if visited[i][j]:
                continue
            visited[i][j] = True
            dist[i][j] = d
            q.append((i, j, d))

    while q:
        i, j, d = q.popleft()
        for y,x in dirs:
            aa(i, j, y, x, d+1)
    
    if not visited[x2][y2]:
        print(-1)
    else:
        print(dist[x2][y2])
    
solve()


Fixed submission:
import sys
from collections import deque
sys.setrecursionlimit(10000000)
readline = sys.stdin.readline

def solve():
    H, W, K = map(int, readline().split())
    x1, y1, x2, y2 = map(int,readline().split())
    x1, y1, x2, y2 = (v - 1 for v in (x1, y1, x2, y2))
    C = [readline().rstrip() for i in range(H)]

    INF = 10 ** 10
    visited = [[INF] * W for i in range(H)]
    dist = [[0] * W for i in range(H)]

    dirs = [(1, 0), (0, 1), (-1, 0), (0, -1)]

    q = deque()

    q.append((x1, y1, 0))
    visited[x1][y1] = 0
    dist[x1][y1] = 0

    def aa(_i, _j, y, x, d):
        i, j = _i, _j
        for k in range(K):
            i += y
            j += x
            if not (0 <= i < H and 0 <= j < W):
                break
            if C[i][j] == '@':
                break
            if d > visited[i][j]:
                break
            if d == visited[i][j]:
                continue
            visited[i][j] = d
            dist[i][j] = d
            q.append((i, j, d))

    while q:
        i, j, d = q.popleft()
        for y,x in dirs:
            aa(i, j, y, x, d+1)
    
    if visited[x2][y2] == INF:
        print(-1)
    else:
        print(dist[x2][y2])
    
solve()
Buggy python submission (verdict: Runtime Error):
r,g,b,n=map(int,input().split())
ans=0
for i in range((n//r)+1):
  for j in range(((n-r*i)//g+1)):
  	if (n-i*r-j*g)%b==0:
    	ans+=1
print(ans)


Fixed submission:
r,g,b,n=map(int,input().split())
ans=0
for i in range((n//r)+1):
    for j in range(((n-r*i)//g+1)):
        if (n-i*r-j*g)%b==0:
            ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
r,g,b,n=map(int,input().split())
ans=0
for i in range((n//r)+1):
  for j in range(((n-r*i)//g+1):
  	if (n-i*r-j*g)%b==0:
    	ans+=1
print(ans)

Fixed submission:
r,g,b,n=map(int,input().split())
ans=0
for i in range((n//r)+1):
    for j in range(((n-r*i)//g+1)):
        if (n-i*r-j*g)%b==0:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h = list(map(int,input().split()))
ans=-1
while h[-1]>=0:
    flag=0
    for i in range(n-1):
        if h[i]>h[i+1]:
            h[i]-=1
            flag=1
            break
        h[i]=h[i]-1
    if flag==0:
        h[i+1]-=1
    ans+=1
print(ans)

Fixed submission:
n=int(input())
h = list(map(int,input().split()))
ans=-1
if n==1:
    ans=h[0]
    h[0]=-1
while h[-1]>=0:
    flag=0
    for i in range(n-1):
        if h[i]>h[i+1]:
            h[i]-=1
            flag=1
            break
        h[i]=h[i]-1
    if flag==0:
        h[i+1]-=1
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
card_num = list(map(int,input().split()))
card_num.sort()
x_i = []
for i in range(q):
    x_i.append(int(input()))
for i in range(q):
    card = []
    for num in range(n):
        card.append(card_num[num])
    taka = []
    for j in range(n//2):
        temp = max(card)
        card.remove(temp)
        taka.append(temp)
        up = [x for x in card if x >= x_i[i]]
        down = [y for y in card if y < x_i[i]]
        if up == []:
            card.remove(down[-1])
        elif down == []:
            card.remove(up[0])
        elif up[0]-x_i[i]<x_i[i]-down[-1]:
            card.remove(up[0])
        else:
            card.remove(down[-1])
    if n%2==1:
        taka.append(card[0])
    print(sum(taka))

Fixed submission:
N= int(input())
H= int(input())
W= int(input())
print((N-H+1)*(N-W+1))
Buggy python submission (verdict: Runtime Error):
H, W, A, B = map(int, input().split())
answer = 0
mod = 1000000007
factorial = [1]
for n in range(1, H+W):
    factorial.append(factorial[n-1]*n%mod)
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2%mod
    else:
        return power(x, y/2)**2*x%mod

inverseFactorial = [0] * (H+W)
inverseFactorial[H+W-1] = power(factorial[H+W-1], mod-2)
for n in range(H+W-2, -1, -1):
    inverseFactorial[n] = inverseFactorial[n+1] * (n+1) % mod
def combi(n, m):
    return factorial[n] * inverseFactorial[m] *inverseFactorial[n-m]%mod

for i in range(B+1, W+1):
    answer = (answer + combi(H-A-2+i, i-1)*combi(A+W-i-1,W-i)) % mod
print(answer)

Fixed submission:
f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break

Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = []
for i in range(N):
  S.append(input())
S.sort()
S = ''.join(S)
print(S)

Fixed submission:
f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break

Buggy python submission (verdict: Runtime Error):
flag = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      frag = True
      break
  if frag == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break

Fixed submission:
f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break

Buggy python submission (verdict: Runtime Error):
a = input().split(' ')
while True:
  for i in renge(3):
    if a[i] != 5 or a[i] != 7:
      print('NO')
      break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  print('NO')
  break



Fixed submission:
f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break