Harryxun/stf_run huggingface dataset:
N,M = map(int, input().split())
A = map(int, input().split()) 

play_days = copy.copy(N)
for i in A:
  play_days -= i
if play_days < 0:
  print(-1)
else:
  print(play_days)

### FIXED CODE ###

N,M = map(int, input().split())
A = map(int, input().split()) 

play_days = N
for i in A:
  play_days -= i
if play_days < 0:
  print(-1)
else:
  print(play_days)
H, W = map(int, input().split())
meiro = []
INF = 10**9
meiro.append(["#"]*(W+2))
for _ in range(H):
    temp = list(input())
    temp.append("#")
    temp.insert(0,"#")
    meiro.append(temp)
meiro.append(["#"]*(W+2))

def bfs(i,j):
    INF = 10 ** 9
    dist = [[INF for i in range(W+2)] for j in range(H+2)]
    dist[i][j] = 0
    q = deque([[i,j]])
    while q:
        v = q.popleft()
        dv = dist[v[0]][v[1]]
        
        if meiro[v[0]-1][v[1]] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]-1][v[1]]:
                dist[v[0]-1][v[1]] = dist[v[0]][v[1]]+1
                q.append([v[0]-1,v[1]])
                
        if meiro[v[0]+1][v[1]] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]+1][v[1]]:
                dist[v[0]+1][v[1]] = dist[v[0]][v[1]]+1
                q.append([v[0]+1,v[1]])
        
        if meiro[v[0]][v[1]-1] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]][v[1]-1]:
                dist[v[0]][v[1]-1] = dist[v[0]][v[1]]+1
                q.append([v[0],v[1]-1])
        
        if meiro[v[0]][v[1]+1] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]][v[1]+1]:
                dist[v[0]][v[1]+1] = dist[v[0]][v[1]]+1
                q.append([v[0],v[1]+1])
    
    dist = [[0 if x == INF else x for x in inner] for inner in dist]
    return max(max(dist))

ans = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        ans = max(ans,bfs(i,j))
print(ans)



### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
meiro = []
INF = 10**9
meiro.append(["#"]*(W+2))
for _ in range(H):
    temp = list(input())
    temp.append("#")
    temp.insert(0,"#")
    meiro.append(temp)
meiro.append(["#"]*(W+2))

def bfs(i,j):
    INF = 10 ** 9
    dist = [[INF for i in range(W+2)] for j in range(H+2)]
    dist[i][j] = 0
    q = deque([[i,j]])
    while q:
        v = q.popleft()
        dv = dist[v[0]][v[1]]
        
        if meiro[v[0]-1][v[1]] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]-1][v[1]]:
                dist[v[0]-1][v[1]] = dist[v[0]][v[1]]+1
                q.append([v[0]-1,v[1]])
                
        if meiro[v[0]+1][v[1]] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]+1][v[1]]:
                dist[v[0]+1][v[1]] = dist[v[0]][v[1]]+1
                q.append([v[0]+1,v[1]])
        
        if meiro[v[0]][v[1]-1] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]][v[1]-1]:
                dist[v[0]][v[1]-1] = dist[v[0]][v[1]]+1
                q.append([v[0],v[1]-1])
        
        if meiro[v[0]][v[1]+1] != "#":
            if dist[v[0]][v[1]]+1 < dist[v[0]][v[1]+1]:
                dist[v[0]][v[1]+1] = dist[v[0]][v[1]]+1
                q.append([v[0],v[1]+1])
    
    dist = [[0 if x == INF else x for x in inner] for inner in dist]
    
    max_dist = 0
    for i in dist:
        max_dist = max(max_dist,max(i))
    return max_dist

ans = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if meiro[i][j] == ".":
            ans = max(ans,bfs(i,j))
print(ans)
from collections import Counter

def solve(n, v):
    # すべて同じ値
    if len(set(v)) == 1:
        return len(v) / 2

    odd = []
    even = []

    for i, k in enumerate(v):
        if i % 2 == 0:
            even.append(k)
        else:
            odd.append(k)

    odd_dic = Counter(odd).most_common()
    even_dic = Counter(even).most_common()

    ans = 0
    targ = 0

    if odd_dic[0][0] == even_dic[0][0]:
        while targ >= 0:
            if odd_dic[targ][1] == even_dic[targ][1]:
                targ += 1
                continue
            elif odd_dic[targ][1] > even_dic[targ][1]:
                odd_v = odd_dic[targ][0]
                even_v = even_dic[0][0]
            else:
                odd_v = odd_dic[0][0]
                even_v = even_dic[targ][0]
    else:
        odd_v = odd_dic[0][0]
        even_v = even_dic[0][0]

    for i in range(len(even)):
        if even_v != even[i]:
           ans += 1

        if odd_v != odd[i]:
            ans += 1

    return ans

def test():
    assert solve(4, [3, 1, 3, 2]) == 1
    assert solve(6, [105, 119, 105, 119, 105, 119]) == 0
    assert solve(4, [1, 1, 1, 1]) == 2

def main():
    n = int(input())
    v = list(map(int, input().split()))
    ans = solve(n, v)
    print(ans)

if __name__ == '__main__':
    # test()
    main()

### FIXED CODE ###

from collections import Counter

def solve(n, v):
    # すべて同じ値
    if len(set(v)) == 1:
        return len(v) / 2

    odd = []
    even = []

    for i, k in enumerate(v):
        if i % 2 == 0:
            even.append(k)
        else:
            odd.append(k)

    odd_dic = Counter(odd).most_common()
    even_dic = Counter(even).most_common()

    ans = 0

    if odd_dic[0][0] == even_dic[0][0]:
        if odd_dic[0][1] > even_dic[0][1]:
            odd_v = odd_dic[0][0]
            even_v = even_dic[1][0]
        elif odd_dic[0][1] < even_dic[0][1]:
            odd_v = odd_dic[1][0]
            even_v = even_dic[0][0]
        else:
            if odd_dic[1][1] >= even_dic[1][1]:
                odd_v = odd_dic[1][0]
                even_v = even_dic[0][0]
            else:
                odd_v = odd_dic[0][0]
                even_v = even_dic[1][0]
    else:
        odd_v = odd_dic[0][0]
        even_v = even_dic[0][0]

    for i in range(len(even)):
        if even_v != even[i]:
           ans += 1

        if odd_v != odd[i]:
            ans += 1

    return ans

def test():
    assert solve(4, [3, 1, 3, 2]) == 1
    assert solve(6, [105, 119, 105, 119, 105, 119]) == 0
    assert solve(4, [1, 1, 1, 1]) == 2

def main():
    n = int(input())
    v = list(map(int, input().split()))
    ans = solve(n, v)
    print(int(ans))

if __name__ == '__main__':
    # test()
    main()
import heqpq

H,W = map(int,input().split())
C = [[int(x) for x in input().split()] for _ in range(10)]
num = [0] * 10
for _ in range(H):
    for x in input().split():
        num[int(x)] += 1

que = []
flag = [True]*10
flag[1] = False
cost = [10**10]*10
cost[1] = 0

for i in range(10):
    if flag[i]:
        heqpq.heappush(que,[C[i][1],i])

while que:
    a,b = heapq.heappop(que)
    if flag[b]:
        flag[b] = False
        cost[b] = a
        for i in range(10):
            if flag[i]:
                heapq.heappush(que,[C[i][b]+a,i])

ans = 0
for i in range(10):
    ans += num[i]*cost[i]
print(ans)

### FIXED CODE ###

import heapq

H,W = map(int,input().split())
C = [[int(x) for x in input().split()] for _ in range(10)]
num = [0] * 10
for _ in range(H):
    for x in input().split():
        if int(x) != -1:
            num[int(x)] += 1

que = []
flag = [True]*10
flag[1] = False
cost = [10**10]*10
cost[1] = 0

for i in range(10):
    if flag[i]:
        heapq.heappush(que,[C[i][1],i])

while que:
    a,b = heapq.heappop(que)
    if flag[b]:
        flag[b] = False
        cost[b] = a
        for i in range(10):
            if flag[i]:
                heapq.heappush(que,[C[i][b]+a,i])

ans = 0
for i in range(10):
    ans += num[i]*cost[i]
print(ans)
nd = [int(i) for i in input().split()]
n = nd[0]
d = nd[1]
for i in range(n):
    if n <= (2*d+1)*i:
        D = i
        break
print(D)


### FIXED CODE ###

nd = [int(i) for i in input().split()]
n = nd[0]
d = nd[1]
i = 0
while True:
    if n <= (2*d+1)*i:
        flag = i
        break
    else:
        i = i + 1
        
print(flag)
import copy
import sys
sys.setrecursionlimit(10**9)
def solve(n, m, q, A):
  if len(A) == m+1:
    rtn = 0
    for a, b, c, d in q:
      rtn += d if A[b]-A[a] == c else 0
    return rtn
  else:
    return max([solve(n, m, q, A+[i]) for i in range(A[-1], m+1)])

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]
print(solve(N, M, ABCD, [1]))

### FIXED CODE ###

from collections import deque
N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
q = deque()
q.append([1])
while q:
  A = q.pop()
  if len(A) == N+1:
    ans = max(ans, sum([d if A[b]-A[a] == c else 0 for a, b, c, d in ABCD]))
  else:
    for i in range(A[-1], M+1):
      q.append(A+[i])
print(ans)
a,b=map(int,input().split()
if a<=8 and b<=8:
    print("Yay!")
else:
    print(":(")
        

### FIXED CODE ###

a,b=map(int,input().split())
if a<=8 and b<=8:
    print("Yay!")
else:
    print(":(")
a,b = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i != a:
        if int(s[i])>=10:
            print("No")
            break
            
    else:
        if s[i] !='-':
            print('No')
            break
else:
    print('Yes')

### FIXED CODE ###

a,b = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i == a:
        if s[i] !='-':
            print('No')
            break
    else:
        if s[i]=='-':
            print("No")
            break
            
        else:
            if int(s[i])<0 or 9<int(s[i]):
                print("No")
                break
else:
    print('Yes')
n, k = map(int, input().split())
h = list(map(int, input().split()))
if n <= k:
  print(0)
elif k == 0:
  print(sum(h))
else:
  h = sorted(list(map(int, input().split())))
  print(sum(h[:n-k]))

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
if n <= k:
  print(0)
elif k == 0:
  print(sum(h))
else:
  h = sorted(h)
  print(sum(h[:n-k]))
N, T = map(int, input().filter(" "))
t = list(map(int, input().filter(" ")))

shower = 0

for i in range(1, N+1):
    if t[i+1]-t[i] >= T:
        shower += T
    else:
        shower += t[i+1]-t[i]

print(shower)


### FIXED CODE ###

N, T = map(int, input().split(" "))
t = list(map(int, input().split(" ")))

shower = 0

for i in range(0, N-1):
    if t[i+1]-t[i] >= T:
        shower += T
    else:
        shower += t[i+1]-t[i]

shower += T
print(shower)
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=[v[i]-c[i] for i in range(n)]
x.sort(reverse=True)
i=0
ans=0
while x[i]>0:
    ans+=x[i]
    i=i+1
print(ans)

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=[v[i]-c[i] for i in range(n)]
x.sort(reverse=True)
i=0
ans=0
while x[i]>0 :
    ans+=x[i]
    i=i+1
    if i==n:
        break
print(ans)
N, A, B = map(int, input().split())
if N == 1:
    print("Hello World")
else:
    print(A+B)

### FIXED CODE ###

N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
N, M = map(int,input().split())
tree = {}

for i in range(M):
    a, b, c = map(int, input().split())
    v= tree.get(a,[])
    v.append([b, c])
    tree[a] = v

def has_loop(tree):
    pass

m = []
def cost(v, c, visited):
    if v in visited:
        if max(m) < 0:
            print(max(m))
        else:
            print('inf')
        exit()
    b = tree.get(v, None)
    if b is None:
        return 
    elif len(b) == 1 and tree.get(b[0][0],None) == None:
        j = c+b[0][1]
        m.append(j)
    else:
        for b, c2 in b: 
            cost(b, c+c2, visited + [v])

if has_loop(tree):
    print('inf')
    exit()

cost(1, 0, [])
print(max(m))


### FIXED CODE ###

N, M = map(int,input().split())
dist = [0] + [float('inf')] * (N - 1)

a = []
b = []
c = []

for i in range(M):
    i,j,k = map(int,input().split())
    a.append(i)
    b.append(j)
    c.append(-1*k)

INF = float('inf')

for i in range(N-1):
    for j in range(M):
        if dist[a[j] - 1] == INF: continue
        if dist[b[j] - 1] > dist[a[j] - 1] + c[j]:
            dist[b[j] - 1] = dist[a[j] - 1] + c[j]
        
ans = dist[N -1]

negative = [False] * N

for i in range(N):
    for j in range(M):
        if dist[a[j] - 1] == INF: continue
        if dist[b[j] - 1] > dist[a[j] - 1] + c[j]:
            dist[b[j] - 1] = dist[a[j] - 1] + c[j]
            negative[b[j] - 1] = True

        if negative[a[j] - 1] == True:
            negative[b[j] - 1] = True

if negative[N - 1]:
    print('inf')
else:
    print(-1 * ans)
A,B,K = input().split()

for i in range(K):
    if A != 0:
        A -= 1
    elif B != 0:
        B -= 1
    else:
        pass

print(A+" "+B)

### FIXED CODE ###

A,B,K = map(int,input().split())

if A <= K :
    K -= A
    A = 0
    if B <= K :
        K -= B
        B = 0
    else:
        B -= K
else:
    A -= K

print("{} {}".format(A,B))
import math

N = int(input())
heights = list(map(int, input().strip().split()))

dp = [math.inf for _ in range(N)]

dp[0] = 0
if len > 1:
    dp[1] = abs(heights[1] - heights[0])


for i in range(2, N):
    dp[i] = min(
        dp[i],
        dp[i - 1] + abs(heights[i] - heights[i - 1]),
        dp[i - 2] + abs(heights[i] - heights[i - 2]),
    )

print(dp[N - 1])


### FIXED CODE ###

N = int(input())
heights = list(map(int, input().strip().split()))

dp = [float("inf") for _ in range(N)]

dp[0] = 0
if N > 1:
    dp[1] = abs(heights[1] - heights[0])


for i in range(2, N):
    dp[i] = min(
        dp[i],
        dp[i - 1] + abs(heights[i] - heights[i - 1]),
        dp[i - 2] + abs(heights[i] - heights[i - 2]),
    )

print(dp[N - 1])
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
count=0
for i in range(h):
    a=[0]
    for j in range(w):
        if s[i][j]=="#":
            a.append(j+1)
    a.append(w+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            yoko[i][k]=a[j]-a[j-1]-1
for i in range(w):
    a=[0]
    for j in range(h):
        if s[j][i]=="#":
            a.append(j+1)
    a.append(h+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            tate[k][i]=a[j]-a[j-1]-1

ans=1
for i in range(w):
    for j in range(h):
        ans=max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)


### FIXED CODE ###

h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
count=0
for i in range(h):
    a=[0]
    for j in range(w):
        if s[i][j]=="#":
            a.append(j+1)
    a.append(w+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            yoko[i][k]=a[j]-a[j-1]-1
for i in range(w):
    a=[0]
    for j in range(h):
        if s[j][i]=="#":
            a.append(j+1)
    a.append(h+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            tate[k][i]=a[j]-a[j-1]-1

ans=1
for i in range(h):
    for j in range(w):
        ans=max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)
#!/usr/bin/python

import sys

array = []

for i in range(10):
  array[i] = raw_input()

for j in range(3):
  print max(array) + "\n"
  array.remove(max(array))

sys.exit()

### FIXED CODE ###

import sys

array = [0 for i in range(10)]

for i in range(10):
  array[i] = int(raw_input())

array.sort()
array.reverse()

for j in range(3):
  print str(array[j])

sys.exit()
!/usr/bin/env python3
# -*- coding: utf-8 -*-
n=int(input())
a=[]
for i in range(0,n):
  a.append(int(input()))
a.sort()

b = [a[0]]
l = a[0]
r = a[0]
a=a[1:]
res=0

while len(a)>0:
  al = a.pop()
  lx = abs(l-al)
  rx = abs(r-al)

  if lx > rx:
    res = res + lx
    l = al
    if len(a)>0:
      ta = a.pop()
      res = res + abs(r-ta)
      r=ta
  else:
    res = res + rx
    r = al
    if len(a)>0:
      ta = a.pop()
      res = res + abs(l-ta)
      l = ta
  #
  if len(a)>0:
    af = a[0]
    a = a[1:]
    ln = abs(l-af)
    rn = abs(r-af)
    if ln > rn:
      res = res + ln
      l = af
      if len(a)>0:
        ta=a[0]
        res=res+abs(r-ta)
        r=ta
        a=a[1:]
    else:
      res = res + rn
      r = af
      if len(a)>0:
        ta=a[0]
        res=res+abs(l-ta)
        l=ta
        a=a[1:]


print(res)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=input()
if len(s)==2:
  print(s)
else:
  print(s[2]+s[1]+s[0])
n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if s<=k: ans+=1
  else break
  s+=i
print(ans)

### FIXED CODE ###

n,k=map(int, input().split(' '))
a=list(map(int, input().split(' ')))
ans,s=0,0
for i in a:
  if s<=k: ans+=1
  else: break
  s+=i

if s<=k: ans+=1
print(ans)
R=int(input())
  print(2*math.pi*R)

### FIXED CODE ###

print(int(input())*6.28)
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    K = I()
    a == K // 2
    b = K - a
    print(a*b)

main()



### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    K = I()
    a = K // 2
    b = K - a
    print(a*b)

main()
import sys
input = sys.stdin.readline
h, w, d = map(int, input().split())
a = {}
l = list(range(h * w))
for i in range(h):
  for j, x in enumerate(input().split()):
    a[int(x)] = (i, j)
memo = {}
def calc(s):
  tmp = 0
  memo(a[s]) = 0
  for xc, xn in zip(l[s::d], l[s+d::d]):
    xc, yc = a[xc]
    xn, yn = a[xn]
    tmp += abs(xc - xn) + abs(yc - yn)
    memo(a[xn]) = tmp
for i in range(d):
  calc(i)
for _ in range(int(input())):
  l, r = map(int, input().split())
  print(memo[a[r]] - memo[a[l]])
    

### FIXED CODE ###

import sys
input = sys.stdin.readline
h, w, d = map(int, input().split())
a = {}
l = list(range(1, h * w + 1))
for i in range(h):
  for j, x in enumerate(input().split()):
    a[int(x)] = (i, j)
memo = {}
def calc(s):
  tmp = 0
  memo[a[s+1]] = 0
  for Xc, Xn in zip(l[s::d], l[s+d::d]):
    xc, yc = a[Xc]
    xn, yn = a[Xn]
    tmp += abs(xc - xn) + abs(yc - yn)
    memo[a[Xn]] = tmp
for i in range(d):
  calc(i)
for _ in range(int(input())):
  l, r = map(int, input().split())
  print(memo[a[r]] - memo[a[l]])
l = [int(input()) for _ in range(5)]
ans = 0
for j in range(5):
    if 0 < l[j] % 10 and min(l % 10) == l[j]:
        ans += l[j]
    elif 0 < l[j] % 10:
        ans += (l[j] // 10 + 1) * 10
    else:
        ans += l[j]
print(ans)

### FIXED CODE ###

l = [int(input()) for _ in range(5)]
ans = 0
m = 0
for i in l:
    if i % 10 != 0:
        p = 10 - i % 10
    else:
        p = 0
    ans += i + p
    m = max(m, p)
print(ans - m)
print x**3

### FIXED CODE ###

x = int(input())
print(x ** 3)
from collections import Counter as c
l=[input() for _ in range(int(input()))]
m=c(l)
if l[-1]!="Un":
    print("NO")
elif m["A"]==m["Un"] and l[0]=="A":
    y=True
    ca=0
    cu=0
    for i in l:
        if i=="A":
            ca+=1
	elif i=="Un":
	    cu+=1
	if ca!=cu:
	    y=False
	    break
	else:
	    ca=0
	    cu=0
    if y:print("YES")
    else:print("NO")
else:
    print("NO")



### FIXED CODE ###

l=[input() for _ in range(int(input()))]
s=[]

isno=False
for i in l:
    if i=="A":
        s.append(1)
    else:
        try:
            _=s.pop()
        except:
            print("NO")
            isno=True
            break

if not isno and not s:print("YES")
elif not isno and s:print("NO")
while True:
    s = input()
    if s == '_': 
        break

   m = int(input())
   for mi in range(m):
       h = int(input())
       s = s[index:] + s[:index]


   print(s)

### FIXED CODE ###

while True:
    s =input()
    if s =='-':   break
    loop=int(input())
    for i in range(loop):
        ch=int(input())
 
        s = s[ch:]+s[:ch]
    print(s)
# -*- coding: utf-8 -*-

nq = input().split()
s = input()
td = []
for i in range(int(nq[1])):
    td.append(input().split())

g_list = [1] * int(nq[0])

for i in range(0, int(nq[1])):
    for j in range(0, int(nq[0])):
        if td[i][0] == s[j]:
            if td[i][1] == 'R':
                if j != int(nq[0]) -1:
                    g_list[j+1] += g_list[j]
                g_list[j] = 0
            else:
                if j != 0:
                    g_list[j-1] += g_list[j]
                g_list[j] = 0
#    print(g_list)

print(sum(g_list))

### FIXED CODE ###

# -*- coding: utf-8 -*-

a = input().split()

if a[0] == a[1] and a[1] == a[2]:
    print('Yes')
else:
    print('No')
D1=[int(i) for i in input().split(" ")]

D2=[int(i) for i in input().split(" ")]

dts={

  "28":[2],

  "30":[4,6,9,11],

  "31":[1,3,5,7,8,10,12]

}

print(int(D1[0] in dts.get(str(D1[1]),[]))

### FIXED CODE ###

try:

  D1=[int(i) for i in input().split(" ")]

  D2=[int(i) for i in input().split(" ")]

  dts={

    "28":[2],

    "30":[4,6,9,11],

    "31":[1,3,5,7,8,10,12]

  }

  print(int(D1[0] in dts.get(str(D1[1]),[])))

except:

  print(0)