Harryxun/stf_run huggingface dataset:
array1 = [int(input()) for i in range(6)]
array2 = input[:5]
k = array1[5] 

for i in range(5):
    if (i < 4):
        if (array2[4 - i] - array2[0] > k):
            print(':(')
            break
    if (i < 3):
        if (array2[4 - i] - array2[1] > k):
            print(':(')
            break
    if (i < 2):
        if (array2[4 - i] - array2[2] > k):
            print(':(')
            break
    if (i < 1):
        if (array2[4 - i] - array2[3] > k):
            print(':(')
            break
    if (i == 4):
        print('Yay!')

### FIXED CODE ###

array1 = [int(input()) for i in range(6)]
array2 = array1[:5]
k = array1[5] 
 
for i in range(5):
  if (i < 4 and array2[4 - i] - array2[0] > k):
    print(':(')
    break
  if (i < 3 and array2[4 - i] - array2[1] > k):
    print(':(')
    break
  if (i < 2 and array2[4 - i] - array2[2] > k):
    print(':(')
    break
  if (i < 1 and array2[4 - i] - array2[3] > k):
    print(':(')
    break
  if (i == 4):
    print('Yay!')
h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j] == "#": ans[i][j] = "#"
      for i2 in range(i-1, i+2):
        if i2 < 0 or h-1 < i2: continue
        for j2 in range(j-1, j+2):
          if (j2 < 0 or w-1 < j2): continue
          elif ans[i2][j2] == "#": continue
          ans[i2][j2] += 1
for i in ans:
  print("".join(map(str,i)))

### FIXED CODE ###

h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      ans[i][j] = "#"
      for i2 in range(i-1, i+2):
        if i2 < 0 or h-1 < i2: continue
        for j2 in range(j-1, j+2):
          if (j2 < 0 or w-1 < j2): continue
          elif ans[i2][j2] == "#": continue
          ans[i2][j2] += 1
for i in ans:
  print("".join(map(str,i)))
import sys
import math

def decide_move(x,y,tile,check):
	if tile == '<':
		x -= 1
		check[x][y] += 1
		return x,y,check
	elif tile == '>':
		x += 1
		check[x][y] += 1
		return x,y,check
	elif tile == '^':
		y -= 1
		check[x][y] += 1
		return x,y,check
	else:
		y += 1
		check[x][y] += 1
		return x,y,check


while True:
	h,w = map(int,input().split())
	if h == 0:
		break
	tile_map = []
	for i in range(h):
		tile_map[i] = input()
	check =[[0 for i in range(w)]for j in range(h)]
	check[0][0] = 1
	x = 0
	y = 0
	status = 0

	while True:
		if tile_map[x][y] == '.':
			status = 1
			print(y,x)
			break
		x,y,check = decide_move(x,y,tile_map[x][y],check)
		if check[x][y] > 1:
			status = 1
			print('LOOP')
			break

### FIXED CODE ###

import sys
import math

def decide_move(x,y,tile,check):
	if tile == '<':
		y -= 1
		check[x][y] += 1
		return x,y,check
	elif tile == '>':
		y += 1
		check[x][y] += 1
		return x,y,check
	elif tile == '^':
		x -= 1
		check[x][y] += 1
		return x,y,check
	else:
		x += 1
		check[x][y] += 1
		return x,y,check


while True:
	h,w = map(int,input().split())
	if h == 0:
		break
	tile_map = []
	for i in range(h):
		tile_map.append(input())
	check =[[0 for i in range(w)]for j in range(h)]
	check[0][0] = 1
	x = 0
	y = 0
	status = 0

	while True:
		if tile_map[x][y] == '.':
			status = 1
			print(y,x)
			break
		x,y,check = decide_move(x,y,tile_map[x][y],check)
		if check[x][y] > 1:
			status = 1
			print('LOOP')
			break
import collections
n = int(input())
v = list(map(int, input().split()))
even = []
even_c = 0
odd = []
odd_c = 0
ans = 0
for i in range(len(v)):
    print(i)
    if i % 2 == 0:
        even.append(v[i])
        even_c += 1
    else:
        odd.append(v[i])
        odd_c += 1
        
even = collections.Counter(even)
odd = collections.Counter(odd)
even_max = max(list(even.items()), key = lambda x: x[1])
odd_max = max(list(odd.items()), key = lambda x: x[1])
if even_max[0] == odd_max[0]:
    even_sec = [i for i in list(even.items()) if i[0] != even_max[0]] 
    odd_sec = [i for i in list(odd.items()) if i[0] != odd_max[0]]
    if len(even_sec) == 0 and len(odd_sec) == 0:
        print(min(even_max[1], odd_max[1]))
        exit()
    if len(even_sec) == 0:
        ans += min(even_max[1], odd_c - odd_max[1])
        print(ans)
        exit()
    if len(odd_sec) == 0:
        ans += min(odd_max[1], even_c - even_max[1])
        print(ans)
        exit()
    even_sec = max(even_sec, key = lambda x: x[1])
    odd_sec = max(odd, key = lambda x: x[1])
    if even_max[1] > odd_max[1]:
        ans += even_c - even_max[1]
        ans += odd_c - odd_sec[1]
    elif even_max[1] < odd_max[1]:
        ans += odd_c - odd_max[1]
        ans += even_c - even_sec[1]
    else:
        if odd_sec[1] < even_sec[1]:
            ans += even_c - even_sec[1]
            ans += odd_c - odd_max[1]
        elif odd_sec[1] > even_sec[1]:
            ans += odd_c - odd_sec[1]
            ans += even_c - even_max[1]
        else:
            ans += even_c - even_max[1]
            ans += odd_c - odd_sec[1]
else:
    ans += even_c - even_max[1]
    ans += odd_c - odd_max[1]
print(ans)


### FIXED CODE ###

import collections
n = int(input())
v = list(map(int, input().split()))
even = []
odd = []
for i in range(n):
    if i % 2 == 0:
        even += [v[i]]
    else:
        odd += [v[i]]
even_dict = collections.Counter(even)
odd_dict = collections.Counter(odd)
max_even = max(even_dict.items(), key = lambda x:x[1])
max_odd = max(odd_dict.items(), key = lambda x:x[1])
#最高の値が同じでない
if max_even[0] != max_odd[0]:
    print(len(even) - max_even[1] + len(odd) - max_odd[1])
else:
    #同じだった場合
    if max_even[1] == len(even) and max_odd[1] == len(odd):
        second_even = (-1,0)
        second_odd = (-1,0)
    elif max_even[1] == len(even):
        second_even = (-1,0)
        second_odd = max([i for i in odd_dict.items() if i != max_odd], key = lambda x:x[1])
    elif max_odd[1] == len(odd):
        second_even = max([i for i in even_dict.items() if i != max_even], key = lambda x:x[1])
        second_odd = (-1,0)
    else:
        second_even = max([i for i in even_dict.items() if i != max_even], key = lambda x:x[1])
        second_odd = max([i for i in odd_dict.items() if i != max_odd], key = lambda x:x[1])
    #二つ目に大きいやつも同じかどうか
    if second_even[1] > second_odd[1]:
        print(len(even) - second_even[1] + len(odd) - max_odd[1])
    else:
        print(len(even) - max_even[1] + len(odd) - second_odd[1])
a,s,c=str(input().split())
print(a[0]+s[0]+c[0])

### FIXED CODE ###

a,s,c=input().split()
print(a[0]+s[0]+c[0])
N = int(input())
S = {}

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = None
for key, value in valSorted:
    if breakKey is None:
        breakKey = value
    if breakKey != value:
        break
    print(str(key)

### FIXED CODE ###

N = int(input())
S = {}

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = -1
for key, value in valSorted:
    if breakKey == -1:
        breakKey = value
    if breakKey != value:
        break
    print(str(key))
import numpy as np
W,H,x,y = map(int, input().split())

d_center_W = abs(W/2 - x)
d_center_H = abs(H/2 - y)
d_45_plus =  abs((H/W)*x-1*y)/np.sqrt((H/W)**2+(-1)**2)
d_45_minus = abs((H/W)*x+y-H)/np.sqrt((H/W)**2+1**2)

min_d = min(d_center_W,d_center_H,d_45_plus,d_45_minus)
smflg = False

if [d_center_W,d_center_H,d_45_plus,d_45_minus].count(min_d) > 1:
        smflg = True

ans = 0

if min_d == d_center_W:
        if x <= W/2:
                ans = x*H/1
        else:
                ans = (W-x)*H/1
elif min_d == d_center_H:
        if y <= H/2:
                ans = y*W/1
        else:
                ans = (H-y)*W/1
elif min_d == d_45_plus:
        if x == 0:
                ans = x/y
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
elif min_d == d_45_plus:
        if x <= W/2:
                x += (W/2-x)*2
        else:
                x -= (x-W/2)*2
        if x == 0:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
if smflg:
        smstr = '1'
else:
        smstr = '0'

if H == 1 and W == 1:
        ans = 1/2

print(str(ans) + ' ' + smstr)


### FIXED CODE ###

W,H,x,y = map(int, input().split())
print(W*H/2)
if x == W/2 and y == H/2:
    print(1)
else:
    print(0)
nums = list(map(int, input().split()))
ans = -1
for i in nums:
    if nums[i] == 0:
        print(i)

### FIXED CODE ###

nums = list(map(int, input().split()))
index = 0
for i in nums:
    if nums[index] == 0:
        print(index+1)
    index += 1
a = input().int()
b = input().int()
c = input().int()

d = c
c = b 
b = d
d = a

print(a)
print(b)
print(c)

### FIXED CODE ###

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

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

if N == M: print 'Yes'
else: print 'No'

### FIXED CODE ###

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

if N == M: 
    print ('Yes')
else: 
    print ('No')
import math
a, b, c, d = map(int, input().split())
ans = b - a + 1

def lcm(x, y):
  return (x * y) // math.gcd(x, y)

a -= 1
ans = ans - (b//c) - (b//d) + (b//(lcm(c,d)))
ans = ans + (a//c) + (a//d) - (a//(lcm(c,d)))
print(ans)

### FIXED CODE ###

from fractions import gcd
a, b, c, d = map(int, input().split())
ans = b - a + 1

def lcm(x, y):
  return (x * y) // gcd(x, y)

a -= 1
ans = ans - (b//c) - (b//d) + (b//(lcm(c,d)))
ans = ans + (a//c) + (a//d) - (a//(lcm(c,d)))
print(ans)
from sys import stdin
import numpy as np

S = stdin.readline().rstrip()
N = len(S)
Sp = S

res_map = [0 for _ in range(N)]

aa_list2 = [1]
for i in range(1,N):
    aa_list2.append((aa_list2[i-1]*10)%2019)


res_map[N-1] = int(S[N-1])
index=1
for i in range(N-2,-1,-1):
    res_map[i] = (int(S[i])*aa_list2[index] + res_map[i+1])%2019
    index+=1
res_map = list(np.sort(np.array(res_map)))
temp_num=res_map[0]
index=1
tot = 0

for i in range(1,N):
    if temp_num==res_map[i]:
        index+=1
        continue
    else:
        if temp_num==0:
            tot += int(index*(index+1)/2)
        elif index>1:
            tot += int(index*(index-1)/2)
            #tot += index/2
        index=1
        temp_num=res_map[i]





print(tot)



### FIXED CODE ###

from sys import stdin

S = stdin.readline().rstrip()
N = len(S)
Sp = S

res_map = [0 for _ in range(N)]

aa_list2 = [1]
for i in range(1,N):
    aa_list2.append((aa_list2[i-1]*10)%2019)

res_map[N-1] = int(S[N-1])
index=1


for i in range(N-2,-1,-1):
    res_map[i] = (int(S[i])*aa_list2[index] + res_map[i+1])%2019
    index+=1

aa_table = [0 for i in range(2019)]
for i in range(len(res_map)):
    aa_table[res_map[i]]+=1

aa_table[0]+=1

tot = 0
for i in range(2019):
    tot+=int((aa_table[i]-1)*aa_table[i]/2)

print(tot)
import fractions
N,M=map(int,input().split())
S=input()
T=input()
lcm=(N*M)/fractions.gcd(N,M)
num=0
s=[]
t=[]
flag=1
for i in range(max(N,M)):
    num=lcm*(i+1)
    st=[""]*int(num)
    for j in range(N):
        if st[int(1+(num//N)*j)-1]=="":
            st[int(1 + (num // N) * j)-1]=S[j]
        elif st[int(1+(num//N)*j)-1]!=S[j]:
            flag=0
            break
    for j in range(M):
        if st[int(1+(num//M)*j)-1]=="":
            st[int(1 + (num // M) * j)-1]=T[j]
        elif st[int(1+(num//M)*j)-1]!=T[j]:
            flag=0
            break
    if flag==1:
        break
    #print(s,t)
    s=[]
    t=[]
if flag==0:
    print("-1")
else:
    print(len(st))




### FIXED CODE ###

import fractions
N,M=map(int,input().split())
S=input()
T=input()
lcm=(N*M)/fractions.gcd(N,M)
num=0
s=[]
t=[]
flag=1
sindex=0
tindex=0
while (sindex<N)and(tindex<M):
    if S[sindex]!=T[tindex]:
        flag=0
        break
    sindex=sindex+(N//fractions.gcd(N,M))
    tindex = tindex + (M // fractions.gcd(N, M))
"""
for j in range(N):
    s.append([S[j],int(1+(num//N)*j)-1])
for j in range(M):
    t.append([T[j], int(1 + (num // M) * j) - 1])
#print(s,t)
while (sindex<N)and(tindex<M):
    #print(sindex,tindex)
    if s[sindex][1]==t[tindex][1]:
        if s[sindex][0]!=t[tindex][0]:
            flag=0
            break
        sindex=sindex+1
        tindex=tindex+1
    elif s[sindex][1]<t[tindex][1]:
        sindex=sindex+1
    else:
        tindex = tindex + 1
    #input()
"""
if flag==0:
    print("-1")
else:
    print(int(lcm))
s1, s2, s3 = map(int, input().split())
print(s1+s2+s3)

### FIXED CODE ###

print(input().count("1"))
A = [0]*3
b = [0]*N
for i in range(0, 3):
    A[i] = list(map(int, input().split()))
N = int(input())
for i in range(0, N):
    b[i] = int(input())
for i in range(0, 3):
    for j in range(0, 3):
        for k in range(0, N):
            if A[i][j] == b[k]:
                A[i][j] = 0
if A[0] == [0, 0, 0] or A[1] == [0, 0, 0] or A[2] == [0, 0, 0]:
    print ("Yes")
elif A[0][0] == A[1][0] == A[2][0] == 0:
    print ("Yes")
elif A[0][1] == A[1][1] == A[2][1] == 0:
    print ("Yes")
elif A[0][2] == A[1][2] == A[2][2] == 0 :
    print ("Yes")
elif A[0][0] == A[1][1] == A[2][2] == 0:
    print ("Yes")
elif A[0][2] == A[1][1] == A[2][0] == 0:
    print ("Yes")
else:
    print ("No")

### FIXED CODE ###

A = [0]*3
for i in range(0, 3):
    A[i] = list(map(int, input().split()))
N = int(input())
b = [0]*N
for i in range(0, N):
    b[i] = int(input())
for i in range(0, 3):
    for j in range(0, 3):
        for k in range(0, N):
            if A[i][j] == b[k]:
                A[i][j] = 0
if A[0] == [0, 0, 0] or A[1] == [0, 0, 0] or A[2] == [0, 0, 0]:
    print ("Yes")
elif A[0][0] == A[1][0] == A[2][0] == 0:
    print ("Yes")
elif A[0][1] == A[1][1] == A[2][1] == 0:
    print ("Yes")
elif A[0][2] == A[1][2] == A[2][2] == 0:
    print ("Yes")
elif A[0][0] == A[1][1] == A[2][2] == 0:
    print ("Yes")
elif A[0][2] == A[1][1] == A[2][0] == 0:
    print ("Yes")
else:
    print ("No")
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
x,k,d=map(int,input().split())
if x<0 and x+d*k<=0:
    print(abs(x+d*k))
elif x>0 and x-d*k>=0:
    print(x-d*k)
elif x<0:
    i+1=math.ceil((-1*x)/d)
    if k-(i+1)%2==0:
        print(x+d*(i+1))
    else:
        print(abs(x+d*i))
elif x>0:
    i+1=math.floor(x/d)
    if k-(i+1)%2==0:
        print(abs(x-d*(i+1)))
    else:
        print(x-d*i)
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)

### FIXED CODE ###

#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
x,k,d=map(int,input().split())
if x<0 and x+d*k<=0:
    print(abs(x+d*k))
elif x>0 and x-d*k>=0:
    print(x-d*k)
elif x<0:
    i=math.ceil((-1*x)/d)-1
    if (k-(i+1))%2==0:
        print(x+d*(i+1))
    else:
        print(abs(x+d*i))
elif x>0:
    i=math.ceil(x/d)-1
    if (k-(i+1))%2==0:
        print(abs(x-d*(i+1)))
    else:
        print(x-d*i)
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)
a,b,c=input().split(,)
print(a+" "+b+" "+c)

### FIXED CODE ###

a,b,c=input().split(",")
print(a+" "+b+" "+c)
package main

import (
	"fmt"
)

func main(){
	var h, w, b int
	fmt.Scan(&h, &w)
	A := make([][]int, h)
	for i:=0; i<h; i++{
		i = make([]int, w)
	}
	x := make([]int, w)
	for i:=0; i<h; i++{
		for j:=0; j<w; j++{
			fmt.Scan(&A[i][j])
		}
	}
	for i:=0; i<w; i++{
		fmt.Scan(&x[i])
	}

	for i:=0; i<h; i++{
		b = 0
		for j:=0; j<w; j++{
			b += A[i][j] * x[j]
		}
		fmt.Println(b)
	}
}


### FIXED CODE ###

h, w = [int(i) for i in input().split()]
A = [0] * h
for i in range(h):
    A[i] = [int(j) for j in input().split()]
b = []
for i in range(w):
    b.append(int(input()))
for i in range(h):
    num = 0
    for j in range(w):
        num += A[i][j] * b[j]
    print(num)
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
import math
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()

a = LIST()

ct = 0

for i, x in enumerate(a):
    if x <= 0:
        ct += 1
        if x < 0:
            p = [i, x]
        else:
            zero = i
            ct = 0

"print(p)"

lis = [abs(x) for x in a]
"""print(ct, sum(lis))"""

if ct % 2 == 0:
    print(sum(lis))
else:
    if p[0] > zero:
        if p[0] == n-1:
            print(sum(lis) - 2 * min(abs(p[1]), abs(a[p[0] - 1])))
        else:
            print(sum(lis) - 2 * min(abs(p[1]), abs(a[p[0] + 1])))
    else:
        print(sum(lis))


### FIXED CODE ###

import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
import math
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))

def SUM(x):return sum([abs(x) for x in a ])



sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()

a = LIST()

ct = 0

p=[]

for i, x in enumerate(a):
    if x < 0:
        ct +=1
        p.append([i, x])
    elif x == 0:
        ct = 0
        p.clear()


saidai = SUM(a)
a_abs = [abs(x) for x in a]

if ct % 2 == 0:
    print(saidai)
else:
    a_min = min(a_abs)
    print(saidai-2*a_min)
import sys
input = sys.stdin.buffer.readline
 
H, W, M = map(int, input().split())
 

for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))
 
MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
 
H, W, M = map(int, input().split())
 
X = [0] * W
Y = [0] * H
Map = []
 
for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))
 
MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)
S = input()
l = list(S)
print(700+l.count('o')*100)
@

### FIXED CODE ###

S = input()
l = list(S)
print(700+l.count('o')*100)
S = input()
Q = int(input())
reverse = 0
for i in range(Q):
  Query = list(input().split())
  if Query[0] == "1":
    reverse = (reverse + 1) % 2
  if Query[0] == "2":
    f = int(Query[1])
    c = query[2]
    if (f + reverse) % 2 == 1:
      S = c + S
    else:
      S = S + c

if reverse == 0:
  print(S)
else:
  print(S[::-1])

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
reverse = 0
for i in range(Q):
  Query = list(input().split())
  if Query[0] == "1":
    reverse = (reverse + 1) % 2
  if Query[0] == "2":
    f = int(Query[1])
    c = Query[2]
    if (f + reverse) % 2 == 1:
      S.appendleft(c)
    else:
      S.append(c)

S = "".join(list(S))
 
if reverse == 0:
  print(S)
else:
  print(S[::-1])
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
time=0
count=0
while time<k:
    if count==(n+m-1):
        count=n+m+1
        break
    elif count//2>=n or count//2>=m:
        count+=1
        continue
    elif count%2==0:
        time+=a[count//2]
        count+=1
    else:
        time+=b[count//2]
        count+=1
print(count-1)

### FIXED CODE ###

n=int(input())
print(n+n**2+n**3)
a,b = map(int, input().split())
print(int(math.ceil((a+b)/2)))

### FIXED CODE ###

import math
a,b = map(int, input().split())
print(int(math.ceil((a+b)/2)))
a,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")
nklist = list(map(int,input().split()))
n, k= nklist[0], nklist[1]

lst = [tuple(map(int, input().split())) for i in range(n)]

max_pt = 0
for comb in itertools.combinations(lst, k):
    kinds_set = set()
    umami = 0
    for tpl in comb:
        kinds_set.add(tpl[0])
        umami += tpl[1]
    ttl_pt = len(kinds_set)**2 + umami
    #print('ttl_pt:', ttl_pt,' max_pt:', max_pt)
    if ttl_pt > max_pt:
        max_pt = ttl_pt
print(max_pt)

### FIXED CODE ###

n, k = map(int, input().split())
a = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x:-x[1])
 
ans = 0
s = set()
q = []
 
for i in range(k):
    ans += a[i][1]
    if a[i][0] in s:
        q.append(a[i][1])
    s.add(a[i][0])
 
ans += len(s)**2
k1 = k
ans1 = ans
 
#はじめ0~k-1までの和がansなので、k~n-1でチェック
while k1 < n and q:
    if a[k1][0] not in s:
        ans1 = ans1+a[k1][1]-q.pop()-len(s)**2+(len(s)+1)**2
        ans = max(ans, ans1)
        s.add(a[k1][0])
    k1 += 1
 
print(ans)
s = list(input())
t = list(input())
ans = ["UNRESTORABLE"]
for i in range(len(s)):
    if s[i] != "?":
        for j in reversed(range(len(t))):
            if t[j] == s[i]:
                f = True
                for k in range(len(t)):
                    f &= (s[i - j + k] == "?" or s[i - j + k] == t[k])
                if f:
                    ans = s.copy()
                    for l in range(len(t)):
                        ans[i - j + l] = t[l]


print("".join(ans).replace("?", "a"))


### FIXED CODE ###

s = list(input())
t = list(input())
ls = len(s)
lt = len(t)
ans = ["UNRESTORABLE"]

if "?" not in set(s):
    print("".join(s))
    exit()

for i in range(ls-lt+1):
    f = True
    for j in range(lt):
        f &= (s[i + j] == "?" or s[i + j] == t[j])

    if f:
        ans = s.copy()
        for j in range(lt):
            ans[i+j] = t[j]


print("".join(ans).replace("?", "a"))
x = input().split(" ")
a = int(x[0])
b = int(x[1])

if a > b:
    put("a > b")
if a < b:
    put("a < b")
else:
    put("a == b")



### FIXED CODE ###

if __name__ == '__main__':
    x = input().split(' ')
    a = int(x[0])
    b = int(x[1])

    if a > b:
        print('a > b')
    elif a < b:
        print('a < b')
    else:
        print('a == b')