Harryxun/stf_run huggingface dataset:
import sys
import numpy
n=int(input())
a=input()
a=a.split()
M=1
m=int(a[n])
Ml=list()
ml=list()
Ml.append(M)
ml.append(m)
Q=0
if int(a[0])>=1:
    print(-1)
    sys.exit()
for i in range(n):
    M=2*M-int(a[i+1])
    if M<0:
        print(-1)
        sys.exit()
    M1=M+int(a[i+1])
    Ml.append(M1)
    m=m+int(a[n-i-1])
    ml.insert(0,m)
numpy.array(Ml)
numpy.array(ml)
Q1=numpy.minimum(Ml,ml)
Q1=sum(Q1)
print(Q1)

### FIXED CODE ###

a=input()
a0=a.split()
h1=int(a0[0])
m1=int(a0[1])
h2=int(a0[2])
m2=int(a0[3])
k=int(a0[4])
t1=60*h1+m1
t2=60*h2+m2
t=t2-t1
print(t-k)
x = raw.input('What\'s the number??')
print "x*x*x"

### FIXED CODE ###

x = input()
print (x**3)
import collections

N,K,Q = map(int,input().split())
lst =[int(input()) for i in range (Q)]

if K > Q :
    for i in range(N):
        print('Yes')
    exit(0)
else:
    x = Q - K

#s = set(lst)
c = collections.Counter(lst)

values, counts = zip(*c.most_common(x))

if len(values) == 0 :
    for i in range(N):
        print('No')
        exit(0)

#print(values)
#print(type(values))
#values.sort()
j = 0
l = len(values)
for i in range(N):
    if l-1 >= j :
        if i +1 == values[j] :
            print('Yes')
            j += 1
        else:
            print('No')
    else:
        print('No')


### FIXED CODE ###

N,K,Q = map(int,input().split())

lst = [0] * N

for i in range(Q):
    lst[int(input())-1] += 1

x = Q - K 

for i in range(len(lst)):
    if lst[i] - x > 0 :
        print('Yes')
    else:
        print('No')
n,k=map(int,input().split())
h=list(map(int,input().split()))
d=[float('inf')]*n
d[0]=0
for i in range(n-1):
    for j in range(1,min(k+1,n-i)):
        d[i+j]=min(d[i+j],d[i]+abs(h[i+j]-h[i]))
print(d[-1])

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
d=[0]*n
d[1]=abs(h[1]-h[0])
for i in range(2,n):
    d[i]=min(d[i-1]+abs(h[i]-h[i-1]),d[i-2]+abs(h[i]-h[i-2]))
print(d[n-1])
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 110 for _ in range(100100)]


for i in range(N):
    for sum_w in range(W + 1):

        if sum_w - wv[i][0] >= 0:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])


### FIXED CODE ###

N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 100100 for _ in range(110)]


for i in range(N):
    for sum_w in range(W + 1):

        if wv[i][0] <= sum_w:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])
N = int(input())
A = list(map(int,input().split()))
if sum(A) ==0: #すべてゼロ
  print("Yes")
  exit()

if N%3 != 0:
  print("No")
else:
  dic = {}
  for x in A:
    if x in dic:
      dic[x] += 1
    else:
      dic[x] = 1
  V = list(dic.values())
  if V[0] == V[1] and V[1] == V[2]:
    K = list(dic.keys())
    if K[0]^K[1] == K[2] and K[1]^K[2] == K[0] and K[2]^K[0] == K[1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if sum(A) ==0: #すべてゼロ
  print("Yes")
  exit()

if N%3 != 0:
  print("No")
else:
  dic = {}
  for x in A:
    if x in dic:
      dic[x] += 1
    else:
      dic[x] = 1
  V = list(dic.values())
  if len(V) == 2:
    K = list(dic.keys())
    if K[0] == 0 and dic[K[1]] == dic[0]*2:
      print("Yes")
    elif K[1] == 0 and dic[K[0]] == dic[0]*2:
      print("Yes")
    else:
      print("No")
    exit()  
  if len(V) != 3:
    print("No")
    exit()
  if V[0] == V[1] and V[1] == V[2]:
    K = list(dic.keys())
    if K[0]^K[1] == K[2] and K[1]^K[2] == K[0] and K[2]^K[0] == K[1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
s = input()
ans = 1
key = 0
for i in range(len(s)-1):
	if s[i] != s[i+1] or key == 1:
        ans += 1
        key = 0
    else:
        key = 1
print(ans)

### FIXED CODE ###

s = input()
n = len(s)

bef = s[0]
key = 0
ans = 1
for i in range(1, n):
  if key == i:
    continue
  if bef == s[i]:
    if i == n-1:
      continue
    bef = s[i:i+2]
    ans += 1
    key = i+1
  else:
    bef = s[i]
    ans += 1
print(ans)
def inpl(): return list(map(int, input().split()))
K, T = inpl()
a = inpl()
print(max(max(a)*2-n-1, 0))

### FIXED CODE ###

def inpl(): return list(map(int, input().split()))
K, T = inpl()
a = inpl()
print(max(max(a)*2-K-1, 0))
import math
r=int(input())
print(r*2*math.pai)


### FIXED CODE ###

import math
r=int(input())
print(r*2*math.pi)
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict,deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(W) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

visit=defaultdict(lambda: 0) #未訪問:0 訪問済み:1

q=deque()
q.append((0,CH,CW))
visit[(CH,CW)]=1

while q:
    kyori, fro_h, fro_w=q.popleft()
    visit[(fro_h, fro_w)]=1
    if fro_h==DH and fro_w==DW:
        print (kyori)
        quit()
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and visit[(to_h, to_w)]==0:
                    q.appendleft((kyori,to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and visit[(to_h, to_w)]==0:
                    q.append((kyori+1, to_h, to_w))

print (-1)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

d=defaultdict(lambda: float("inf")) #スタート地点から各マスまでの距離

q=deque()
q.append((0,CH,CW))
d[(CH,CW)]=0

while q:
    kyori, fro_h, fro_w=q.popleft()
    if d[(fro_h, fro_w)]<kyori: continue
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori
                q.appendleft((kyori, to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori+1 < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori+1
                q.append((kyori+1, to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]
import sys
n,k = map(int,input().split( ))
s = input()
r0 = list(reversed(s))
r = ''.join(r0)
s = s + r
l = len(s)
S = [s[i] for i in range(l)]

literal=list(set(S))
literal.sort()

small = literal[0]

i=0
mx=0
cnt = 0
now=-1
cnd=[]
while i<l:
    if s[i] == small:
        now = i
        cnt = 1
        i += 1
        try:
            while s[i] == small:
                cnt += 1
                i += 1
            if mx < cnt:
                cnd = []
                cnd.append(now)
                now == i
                mx = cnt
            elif mx == cnt:
                cnd.append(now)
                now = i
            else:
                now = i
        except:
            pass
    i += 1
if mx*2**k>=n:
    print(small*2**k)
    sys.exit
else:
    pass
cnd_string = []
addi = n - 2**k


for i in cnd:
    cnd_string.append(s[i + mx : i + mx + addi])
cnd_string.sort()
for t in cnd_string:
    if len(t) < addi:
        cnd_string.remove(t)
print(small*2**k + cnd_string[0])


### FIXED CODE ###

import sys
S=input()
K=1

if len(S)==1:
    print(K)
    sys.exit
elif len(S)==2:
    if S[0]==S[1]:
        print(1)
        sys.exit
    else:
        print(2)
        sys.exit
else:
    pass
l=len(S)

S1=[]
S2=[]

S1.append(1)
if S[0]!=S[1]:
    S1.append(2)
else:
    S1.append(1)
S2.append(0)
S2.append(1)
for i in range(2,l):
    if S[i]!=S[i-1]:
        S1.append(max(S1[i-1]+1,S2[i-1]+1))
    else:
        S1.append(S2[i-1]+1)
    try:
        if S2[i]==S2[i-2] and S2[i-1]==S2[i-3]:
            S2.append(S1[i-2]+1)
    except:
        S2.append(max(S1[i-2]+1,S2[i-2]+1))

print(max(S2[l-1],S1[l-1]))
H, W = map(int, input())
h, w = map(int, input())

print((H-h) * (H-h))


### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

print((W-w) * (H-h))
a = int(input())
b = int(input())
if a * b % 2 == 0:
    print ("Even")
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
if a * b % 2 == 0:
    print ("Even")
else:
    print("Odd")
def main():
    hp, num = map(int, input().split())
    a = list(map(int, input().split()))
    attack = sum(a)

    if hp > attack:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()


### FIXED CODE ###

H, A = map(int,input().split())
print(-(-H//A))
import sys
cnts = {}
for line in imput():
    for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
  
for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))

### FIXED CODE ###

import sys
cnts = {}
for line in sys.stdin:
    for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
  
for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))
N, Q = map(int, input().split())
s = input()
T = []
D = []
for _ in range(Q):
	t, d = input().split()
	T.append(t)
	D.append(d)


ans = 0
left = 0
right = N-1
for i in range(Q-1,-1,-1):
	# print(D[i])
	if D[i] == 'R':
		if T[i] == s[right]:
			right -= 1
		if left > 0 and s[left-1]==T[i]:
			left -= 1

	else:
		if T[i] == s[left]:
			left += 1
		if right < N-1 and s[right+1]==T[i]:
			right += 1
	print(s[left:right+1])
print(right-left+1)


### FIXED CODE ###

N, Q = map(int, input().split())
s = input()
T = []
D = []
for _ in range(Q):
	t, d = input().split()
	T.append(t)
	D.append(d)


ans = 0
left = 0
right = N-1
for i in range(Q-1,-1,-1):
	if D[i] == 'R':
		if T[i] == s[right]:
			right -= 1
			if right == 0:
				print(0)
				exit()
		if left > 0 and s[left-1]==T[i]:
			left -= 1

	else:
		if T[i] == s[left]:
			left += 1
			if left == N-1:
				print(0)
				exit()
		if right < N-1 and s[right+1]==T[i]:
			right += 1
	# print(s[left:right+1])
print(max(0,right-left+1))
import sys
input()
A = list(map(int, input().split()))
ans = 1

if 0 in A:
    print(0)
    sys.exit()

else
    for a in A:
        ans *= a
        if ans > 10**18
        print(-1)
        sys.exit()
    print(ans)

### FIXED CODE ###

import sys
input()
A = list(map(int, input().split()))
ans = 1

if 0 in A:
    print(0)
    sys.exit()

else:
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            sys.exit()
    print(ans)
s = raw_input()
l = []
while 1:
    x = raw_input()
    if x == 'END_OF_TEXT':
        break
    l += x.lower().split()
print l.count(w)

### FIXED CODE ###

s = raw_input()
l =[]
while True:
	x = raw_input()
	if x == 'END_OF_TEXT':
		break
	l += x.lower().split()
print l.count(s)
# coding: utf-8

import sys

S = input()

i = 0
while i < len(S):
	if S[i : i + 5] == "dream":
		if S[i + 5 : i + 7] == "er":
			if S[i + 7 : i + 10] == "ase":
				if S[i + 10] == "r":
					i += 11
				else:
					i += 10
			else:
				i += 7
		else:
			i += 5
	else:
		if S[i : i + 5] == "erase":
			if S[i + 5] == "r":
				i += 6
			else:
				i += 5
		else:
			sys.exit()

print("YES")

### FIXED CODE ###

# coding: utf-8

import sys

S = input()

i = 0
while i < len(S):
	if i + 4 < len(S) and S[i : i + 5] == "dream":
		if i + 6 < len(S) and S[i + 5 : i + 7] == "er":
			if i + 9 < len(S) and S[i + 7 : i + 10] == "ase":
				if i + 10 < len(S) and S[i + 10] == "r":
					i += 11
				else:
					i += 10
			else:
				i += 7
		else:
			i += 5
	else:
		if i + 4 < len(S) and S[i : i + 5] == "erase":
			if i + 5 < len(S) and S[i + 5] == "r":
				i += 6
			else:
				i += 5
		else:
			print("NO")
			sys.exit()

print("YES")
import sys
from numpy import inf

def insert(heap, key):
    heap.append(-inf)
    heapIncreaseKey(heap, key)

def parent(i):
    return (i - 1) // 2

def heapIncreaseKey(heap, key):
    heap[len(heap) - 1] = key
    i = len(heap) - 1
    while i > 0 and heap[parent(i)] < heap[i]:
        heap[i], heap[parent(i)] = heap[parent(i)], heap[i]
        i = parent(i)

def heapExtractMax(heap):
    if len(heap) < 1:
        return None
    else:
        MAX = heap[0]
        heap[0] = heap.pop()
        maxHeapify(heap, 0)

        return MAX

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)


heap = []
out = ''
for line in sys.stdin:
    while line[0:2] != 'en':
        if line[0] == 'i':
            insert(heap, int(line.split()[1]))
        if line[0:2] == 'ex':
            print(str(heapExtractMax(heap)))

### FIXED CODE ###

from sys import stdin
from heapq import heappop, heappush
readline = stdin.readline

heap = []
while True:
    line = readline()
    if line[1] == 'x':
        print(-heappop(heap))
    elif line[0] == 'i':
        heappush(heap, -int(line.split()[1]))
    else:
        break


'''
def insert(heap, key):
    heap.append(-1000000)
    heapIncreaseKey(heap, key)

def parent(i):
    return (i - 1) // 2

def heapIncreaseKey(heap, key):
    heap[len(heap) - 1] = key
    i = len(heap) - 1
    while i > 0 and heap[parent(i)] < heap[i]:
        heap[i], heap[parent(i)] = heap[parent(i)], heap[i]
        i = parent(i)

def heapExtractMax(heap):
    if len(heap) < 1:
        return None
    else:
        MAX = heap[0]
        heap[0] = heap.pop()
        maxHeapify(heap, 0)

        return MAX

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)


heap = []
while True:
    line = sys.stdin.readline()
    if line[0] == 'i':
        insert(heap, int(line.split()[1]))
    elif line[0:2] == 'ex':
        print(str(heapExtractMax(heap)))
    else:
        break
'''
s = input()

ans =[]

for i in range(:len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans):
  num.append(abs(754-ans[i]))
               
num.sort()
               
print(num[0]


### FIXED CODE ###

s = input()

ans =[]

for i in range(len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans)):
  num.append(abs(753-int(ans[i])))
               
num.sort()
               
print(num[0])
from itertools import*
from numpy import*
n,k=map(int,input().split())
k2=k+1
s=input()
if len(s)==1:
    if s=="1":
        print(1)
    else:
        print(0)
    exit()
if s[0]=="1" and s[-1]=="0":
    x=[0]+[len(list(v))for k,v in groupby(s)if k=="0"]
    y=[0]+[len(list(v))for k,v in groupby(s)if k=="1"]+[0]
elif s[0]=="0" and s[-1]=="1":
    x=[0]+[len(list(v))for k,v in groupby(s)if k=="0"]+[0]
    y=[0]+[len(list(v))for k,v in groupby(s)if k=="1"]
else:
    x=[0]+[len(list(v))for k,v in groupby(s)if k=="0"]+[0]
    y=[0]+[len(list(v))for k,v in groupby(s)if k=="1"]+[0]
x1=array(x[:-k])
x2=array(x[k:])
x3=sum(x[:k])
t=x3+cumsum(x2-x1)
y1=array(y[:-k2])
y2=array(y[k2:])
y3=sum(y[:k2])
f=y3+cumsum(y2-y1)
#print(x,y)
#print(t,f)
print(max(max(t+f),x3+y3))

### FIXED CODE ###

from itertools import*
from numpy import*
n,k=map(int,input().split())
k=2*k+1
s=input()
x=[0]*(s[0]=="0")+[len(list(v))for k,v in groupby(s)]+[0]*(s[-1]=="0")
#print(x)
x1=array(x[k:])
x2=array(x[:-k])
x3=sum(x[:k])
y=[x3]+list(x3+cumsum(x1-x2))
print(max(y[::2]))
N = int(input())
C = []
for c in list(input()):
  a = 0
  if c == "R":
    a = 1
  C.append(a)
L = -1
R = N
cnt = 0
while L < R:
  L += 1
  if C[L] != 0:
    continue
  while L < R:
    R -= 1
    if C[R] != 1:
      continue
    cnt += 1
    break     
print(cnt)
  

### FIXED CODE ###

N = int(input())
C = []
for c in list(input()):
  a = 0
  if c == "R":
    a = 1
  C.append(a)
L = -1
R = N
cnt = 0
while L < R:
#  print(str(L) + " " + str(R))
  L += 1
  if L >= R:
    break
  if C[L] != 0:
    continue
  while L < R:
    R -= 1
    if L >= R:
      break
    if C[R] != 1:
      continue
    cnt += 1
    break     
print(cnt)
N,D = map(int,input().split())


if N%(2D+1) == 0 :
	ans = 0
	ans = int(N//(2D+1))
	print(ans)
else:
	ans = 0
	ans = int(N//(2D+1))+1
	print(ans)

### FIXED CODE ###

N,D = map(int,input().split())


if N%(2*D+1) == 0 :
	ans = 0
	ans = N//(2*D+1)
	print(ans)
else:
	ans = 0
	ans = int(N//(2*D+1))+1
	print(ans)
GNU nano 4.3                                  main                                   変更済み  
a,b,c=map(int,input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and b != a:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c=map(int,input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and b != a:
    print("Yes")
else:
    print("No")
A = int(input())
P = int(input())
K = 3 * A + P
print(K//2)

### FIXED CODE ###

a,b=map(int,input().split())
print((a * 3 + b)//2)
A,B,C=map(int,input().split())

print ((C,A,B).split=())


### FIXED CODE ###

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

print (C,A,B)
S = input()
string_list = ["dream", "dreamer", "erase", "eraser"]

dp = []

dp[0] = 1
for i in range(len(S)):
    if dp[i] != 1:
        continue
    for string in string_list:
        if S[i: i + len(string) - 1] == string:
            dp[i + len(string) - 1] = 1

if dp[len(S)] == 1:
    print("Yes")
else:
    print("NO")

### FIXED CODE ###

S = input()

new_S = "".join(list(reversed(S)))
string_list = ["dream", "dreamer", "erase", "eraser"]
reverse_string_list = []
for i in range(len(string_list)):
    reverse_string_list.append("".join(list(reversed(string_list[i]))))

can = True
index = 0
for i in range(len(new_S)):
    if index >= len(new_S):
        break
    can2 = False
    for each_string in reverse_string_list:
        if new_S[index:index + len(each_string)] == each_string:
            index += len(each_string) - 1
            can2 = True
    if can2 is False:
        can = False
        break
    index += 1

if can is True:
    print("YES")
else:
    print("NO")
N, M = map(int, input().split())
l = []
r = []
for _ in range(M):
  s, t = map(int, input().split())
  l.append(s)
  r.append(t)
  
lm = max(l)
rm = min(r)
print(max[rm - lm + 1, 0])

### FIXED CODE ###

N, M = map(int, input().split())
l = []
r = []
for _ in range(M):
  s, t = map(int, input().split())
  l.append(s)
  r.append(t)
  
lm = max(l)
rm = min(r)
print(max([rm - lm + 1, 0]))
N,X = [int(x) for x in input().split()]
data_jump = [int(x) for x in input().split()]
count = 1
sum_dis = 0
for i in range(N+1):
    sum_dis += data_jump[i]
    if sum_dis > X:
        break
    count += 1
print(count)

### FIXED CODE ###

N,X = [int(x) for x in input().split()]
data_jump = [int(x) for x in input().split()]
count = 1
sum_dis = 0
for i in range(N):
    sum_dis += data_jump[i]
    if sum_dis > X:
        break
    count += 1
print(count)
a = int(input())
b = int(input())
c = int(input())
x = int(input())
maxa = min([a,x//500])
maxb = min([b,x//100])
maxc = min([c,x/50])
count = 0
for i in range(maxa + 1):
    for j in range(maxb + 1):
        for k in range(maxc + 1):
            if 10*i + 2*j + k == x/50:
                count += 1
print(count)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())
maxa = min([a,x//500])
maxb = min([b,x//100])
maxc = min([c,x//50])
count = 0
for i in range(maxa + 1):
    for j in range(maxb + 1):
        for k in range(maxc + 1):
            if 10*i + 2*j + k == x/50:
                count += 1
print(count)
N= list(map(int,input().split())) #１行目の入力

root_list = []
cost = 1001
for i in range(N[0]):
    root_list.append(list(map(int,input().split())))

    if root_list[i][1] > N[1]:
        if root_list[i][0] < cost:
            cost = root_list[i][0]


if cost == 1001:
    print("TLE")
else:
    print(cost)

### FIXED CODE ###

ipnum = input()

if ipnum == "1":
    print("Hello World")
elif ipnum =="2":
    num1 = int(input())
    num2 = int(input())
    print(num1 + num2)
else:
    print("error")
import sys
def nextHoliday(day):
    days={'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
    return days[day.upper()]
  
day = sys.stdin.readline()
output=nextHoliday(day)
print(output)


### FIXED CODE ###

day = input()
if day == "SUN":
  print(7)
elif day=="MON":
  print(6)
elif day=="TUE":
  print(5)
elif day=="WED":
  print(4)
elif day=="THU":
  print(3)
elif day=="FRI":
  print(2)
elif day=="SAT":
  print(1)
import math
a,b,c = map(int,input())
left = math.sqrt(a) + math.sqrt(b)
right = math.sqrt(c)
if left < right:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c = map(int,input().split(" "))
right = c- a- b
if right > 0 and right ** 2 > 4 * a* b:
    print("Yes")
else:
    print("No")
num = map(lambda x: int(x), input().split())

if num[0]/num[2]<=num[1]: print('Yes')
else: print('No')

### FIXED CODE ###

num = list(map(lambda x: int(x), input().split()))

if num[0]/num[2]<=num[1]: print('Yes')
else: print('No')
string = str(input())
zero = 0
one = 0
for char in string:
    if char == list(chars)[0]:
        zero += 1
    else:
        one += 1

if zero == 0 or one == 0:
    print(0)
else:
    print(min(zero, one) * 2)

### FIXED CODE ###

string = str(input())
zero = 0
one = 0
chars = set(string)
for char in string:
    if char == list(chars)[0]:
        zero += 1
    else:
        one += 1

if zero == 0 or one == 0:
    print(0)
else:
    print(min(zero, one) * 2)
if h == 1 or w ==1:
	print(1)
	exit()
elif w % 2 == 0:
	print(h * w // 2)
	exit()
elif w % 2 == 1:
	if h % 2 == 0:
		print(h * w // 2)
		exit()
	elif h % 2 == 1:
		print((h * w // 2) + 1)
		exit()

### FIXED CODE ###

s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())

print(s[k-1])
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))
for i in range(m):
    b, c = map(int, input().split())
    for j in range(b):
        A[j] = max(a[j], c)
print(sum(A))

### FIXED CODE ###

n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

bc = []
for i in range(m):
    b, c = map(int, input().split())
    bc.append([b,c])

from operator import itemgetter
bc.sort(key=itemgetter(1), reverse = True)
k = 0
c = bc[0][1]
b = bc[0][0]
bn = 0
while A[k] < c:
    A[k]=c
    k+=1
    if k == len(A):
        break
    b-=1
    if b  == 0:
        bn += 1
        if bn == len(bc):
            break
        b = bc[bn][0]
        c = bc[bn][1]
print(sum(A))
S=input()
 
print str(S/3600)+':'+str(S%3600)/60+':'+str(S%60)

### FIXED CODE ###

S=input()
 
print str(S/3600)+':'+str((S%3600)/60)+':'+str(S%60)
S = input()
S[3] = '8'
print(S)

### FIXED CODE ###

S = input()
ans = '2018/'
for i in range(5,10):
    ans += S[i]
print(ans)