peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys

def main():
    N = int(input())

    arr = [[0] * 10 for i in range(10)]
    for x in range(1, N+1):
        s = str(x)
        arr[int(s[0])][int(s[-1])] += 1

    ans = 0
    for y in range(1,10):
        for z in range(1,10):
            ans += arr[y][z] * arr[z][y]

    print(ans)

main()
# Judge status: Accepted
N = int(input())
table = [[int(i) for i in input().split()] for m in range(2)]
get_candies = []
for i in range(0,N):
    get_candies.append(sum(table[0][:i+1]) +  sum(table[1][i:]))
print(max(get_candies))
# Judge status: Wrong Answer
o=str(input())
e=str(input())
ans=[]
if len(o)==len(e):
  for i in range(len(o)):
    ans.append(o[i]+e[i])
    print(ans,end='')
else:
  for i in range(len(e)):
    ans.append(o[i]+e[i])
    ans.append(o[len(o)-1])
    print(ans,end='')
# Judge status: Accepted
A, B = map(str, input().split())

A = int(A)
B1, B2 = map(int, B.split('.'))
ans = (A * B1) + int(A * B2 // 100)

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

def is_ok(L):
    count = 0
    for a in A:
        count += a // L
        if a % L == 0:
            count -= 1
    return count <= K

ng = 0
ok = max(A)
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)
# Judge status: Accepted
def nyu():
    N = int(input())
    L = list(map(int,input().split()))
    L.sort()

    return N,L

def check(N,L):
    sum =0 

    for n in range(N-1):
        sum += L[n]
    if sum > L[N-1]:
        print("Yes")
    else:
        print("No")
    



N,L =nyu()
check(N,L)
# Judge status: Accepted
def nyu():
    N, M = map(int, input().split())
    X = list(map(int,input().split()))
    X.sort()
    return N,M,X


def kansu(N,M,X):

    x_abs = [X[m+1] -X[m] for m in range(M-1)]    
#    print(x_abs)

    
    x_abs.sort()

    koma_max = 0
    for m in range(M-N):
        koma_max += x_abs[m]

    print(koma_max)


N,M,X = nyu()
#print(X)

if M == 1:
    print(0)
else:
    kansu(N,M,X)

#print(S)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
p_sort = sorted(p)
non_0 = 0

for i in range(n):
    diff = p[i] - p_sort[i]
    if diff != 0:
        non_0 += 1
        if non_0 >2:
            print('NO')
            exit()

print('YES')
# Judge status: Wrong Answer
n,k = map(int,input().split())
li = list(map(int,input().split()))
t = list(input())
ans = []
for i in t:
    if i == 'r':
        ans.append(li[2])
    elif i == 's':
        ans.append(li[0])
    else:
        ans.append(li[1])
for i in range(len(ans)):
    if k <= i and ans[i]==ans[i-k]:
        ans[i] =0
print(sum(ans))
# Judge status: Accepted
N = int(input())
ans_list = ["a"]
alphabet = [chr(ord("a") + i) for i in range(N)]

for i in range(N - 1):
    ans_list = [ ans + x for ans in ans_list for x in alphabet[:len(set(ans)) + 1]]

for ans in ans_list:
    print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    print(N + N**2 + N**3)


main()
# Judge status: Accepted
S = input()
T = input()

ans = 0

for i in range(len(S)):
    ans += S[i] != T[i]

print(ans)
# Judge status: Wrong Answer
a = list(input())
ans = []
count = 0
for i in a:

    if i == 'A':
        count +=1
    elif i == 'C':
        count+=1
    elif i == 'G':
        count+=1
    elif i == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
if len(ans) == 0:
    ans.append(count)
print(max(ans))
# Judge status: Accepted
S = input()
ans = 0
for i in range(2,len(S),2):
  if S[:i // 2] == S[i // 2:i]: ans = i
print(ans)
# Judge status: Accepted
bin = [1,0]
print(bin[int(input())])
# Judge status: Accepted
import sys
input = sys.stdin.readline

X = []
K = 0
def fullsearch():
    for l, r in zip(X, X[K-1:]):
        distance = abs(r - l)
        yield distance + abs(r)
        yield distance + abs(l)

def main():
    global X, K
    _, K = map(int, input().split())
    X = list(map(int, input().split()))

    print(min(fullsearch()))

main()
# Judge status: Wrong Answer
A,B=map(int,input().split())
x=min(A,B)
y=max(A,B)
check=1
##x<=y
#####while break##############
if y%x==0:
    print(y)
#print(root)
else:
    root=round((x**(1/2)))
    for i in range(2,root):
        if x%i==0 and y%i==0:
            x/=i
            y/=i
            check*=i 
            i=2
            root=round((x**(1/2)))
    print(int(check*x*y))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a+b > c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a=int(input())
s=input()
if a>=3200:
    print(s)
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
ab = []
for _ in range(n): ab.append([int(x) for x in input().split()])
c = 0
for a, b in ab[::-1]:
    if b == 1 or (a + c) % b == 0: continue
    else: c += b - (a + c) % b
print(c)
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))

y = min(a[0], x)
ans = a[0]-y
for i in range(1, N):
    z = a[i]
    w = max(y+z-x, 0)
    y = z-w
    ans += w

print(ans)
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0 or X % Y == 0:
  ans = -1
else:
  ans = X
if ans > 10**18:
  ans = -1
if X == 1 and Y != 1:
  ans = Y + 1
print(ans)
# Judge status: Accepted
def factorial(n, mod=10**9+7):
    a = 1
    for i in range(1,n+1):
        a = a * i % mod
    return a

N, M = map(int, input().split())
MOD = 10**9 + 7
if N < M:
  N, M = M, N

if N > M + 1:
  ans = 0
elif N == M + 1:
  ans = (factorial(N) * factorial(M)) % MOD
else:
  ans = (2 * factorial(N) ** 2) % MOD

print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
print(a if b>=a else a-1)
# Judge status: Accepted
def function(n):
  string = str(n)
  for i in range(len(string) - 1):
    error = int(string[i]) - int(string[i + 1])
    if error > 1:
      return i + 1, error
    elif error < -1:
      return i, abs(error)
  return -1, 0
 
k = int(input())
ans = []
n = 1
while len(ans) < k:
  m, error = function(n)
  if m == -1:
    ans.append(n)
    n += 1
  else:
    n = n + (error - 1) * (10 ** (len(str(n)) - m - 1)) - n % (10 ** (len(str(n)) - m - 1))
print(ans[-1])
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(N - 1):
    if (i + 1) % 2 == 1 and a[i + 1] % 2 ==1:
            cnt += 1
    else:
            cnt += 0
print(str(cnt))
# Judge status: Wrong Answer
a, b, c, d = [int(e) for e in input().split(" ")]
if((0 <= a or 0 <= c) and (0 <= b and 0 <= d)):
    #print("A")
    print(b * d)
elif((a < 0 and b < 0) and (0 <= c and 0 <= d)):
    #print("B")
    print(b * c)
elif((c < 0 and d < 0) and (0 <= a and 0 <= b)):
    #print("C")
    print(d * a)
elif(a < 0 and b < 0 and c < 0 and d < 0):
    #print("D")
    print(a * d)
elif((a < 0 and 0 <= b) and (c < 0 and 0 <= d)):
    print(max((a * c), (b * d)))
# Judge status: Wrong Answer
import sys
X, K, D = map(int,input().split())
cnt = 0
a = X
b = 999999999
tmp = 0
if X >= K*D:
  if K % 2 == 0:
    print(X - K*D)
  else:
    print(X - K*D + D)
  sys.exit()
if K % 2 == 0:
  tmp = int(X/D)
  #print(tmp)
  if tmp% 2 == 0:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
else:
  tmp = int(X/D)
  #print(tmp)
  if tmp% 2 == 1:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
print(min(abs(a),abs(b)))
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in l[:n - 1]:
    cnt += 1
    #print(i)
if cnt > l[n - 1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
S = input()
x = 0
 
for i in S:
  if i == "I":
    x += 1
  elif i == "D":
    x -= 1
print(x)
# Judge status: Wrong Answer
nums = input().split()
N = int(nums[0])
K = int(nums[1])
totalProb = 0

for i in range(N):
    x = i + 1
    tempProb = 1/N

    while x < K:
        tempProb = tempProb / 2
        x = x * 2
        print(tempProb)

    totalProb += tempProb

if N > K:
    totalProb += (N - K + 1) * 1/N

print(totalProb)
# Judge status: Accepted
def main():
    N, *A = map(int, open(0).read().split())
    count = 0
    cur = 1
    while count < N:
        count += 1
        cur = A[cur - 1]
        if cur == 2:
            print(count)
            return
    print(-1)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
l=[0]*N
for i in range(N):
    if a[i]%4:
        if a[i]%2:l[i]=1
        else:l[i]=2
    else:l[i]=4
print('Yes'if(l.count(1)+(1 if l.count(2)else 0))//2<=l.count(4)else'No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
d = a + b
f = a + c
g = b + c
if d < f and d < g :
    print(d) 
elif f < d and f < g :
    print(f) 
elif g < f and g< d :
    print(d) 
elif d == f:
    print(d)
elif f == g:
    print(f)
elif g == d:
    print(g)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
diff=sum(b)-sum(a)

onesum=0
twosum=0
for i in range(n):
    if(a[i]>b[i]):
        onesum+=a[i]-b[i]
    elif(a[i]<b[i]):
        twosum+=-(-(b[i]-a[i])//2)

if(min(onesum,twosum)<=diff):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import deque

k = int(input())

lunlun = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(k):
    s = lunlun.popleft()
    
    if s % 10 != 0:
        lunlun.append(10 * s + s % 10 - 1)
    lunlun.append(10 * s + s % 10)
    if s % 10 != 9:
        lunlun.append(10 * s + s % 10 + 1)

print(s)
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
#print(a)
#print(b)
#print(h)

ans = (a + b)*h/2
#print(ans)

ans_int = int(ans) #int型に変換
print(ans_int)
# Judge status: Accepted
import numpy as np
from numba import njit

MOD = 1000000007


@njit('(i8[:], i8)', cache=True)
def solve(dp, S):
    dp[3: 6] = 1
    d = 0
    for i in range(6, S + 1):
        d += dp[i - 3] % MOD
        dp[i] = (d + 1) % MOD
    return dp[S]


S = int(input())
dp = np.empty(S + 1, dtype=np.int64)
dp[:3] = 0
ans = solve(dp, S)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0


for i in range(N):
    for j in range(1, K + 1):
        if i + j >= N:
            break
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))

print(dp[-1])
# Judge status: Accepted
N = int(input())
a = [input() for _ in range(N)]
a = sorted(a)
#print(a)
c = 0
ans = 0
for i in range(N):
    c += 1
    if i == N-1:
        if c % 2 == 1:
            ans += 1
    elif a[i] != a[i+1]:
        #print(a[i])
        if c % 2 == 1:
            ans += 1
        c = 0

print(ans)
# Judge status: Accepted
D,T,S = map(int,input().split())
x = D / S
if x <= T:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
s//=n
cost=0
for i in a:
  cost+=(i-s)*(i-s)
ans=cost
s+=1
cost=0
for i in a:
  cost+=(i-s)*(i-s)
ans=min(ans,cost)
print(ans)
# Judge status: Accepted
n=int(input())
a=10**n-2*9**n+8**n
print(a%(10**9+7))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

m=1000
n=0
flag=0
for i in range(N-1):
  if flag==1:
    m += n*A[i]
    n = 0
    flag = 0
  
  if A[i+1]>A[i]:
    buy = m//A[i]
    n += buy
    m -= buy*A[i]
    flag=1

if flag == 1:
  m += n*A[-1]
  n = 0
  flag = 0
  
print(m)
# Judge status: Accepted
a,b,c = (int(x) for x in input().split())
if a <= c <= b:
  print ('Yes')
else:
  print ('No')
# Judge status: Accepted
import itertools
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

n_list = []
for i in range(N):
  n_list.append(i+1)

Per = list(itertools.permutations(n_list))
for i in range(len(Per)):
 tmp = list(Per[i])
 judge1,judge2 = 1,1
 for j in range(len(tmp)):
  if(tmp[j] != P[j]):
    judge1 = 0
  if(tmp[j] != Q[j]):
    judge2 = 0
    
 if(judge1 == 1): a = i+1
 if(judge2 == 1): b = i+1
  
print(abs(a-b))
# Judge status: Accepted
O = list(input())
E = list(input())
ans = list()
LEN = len(O)+len(E)
for i in range(LEN):
    if i%2==0:
        ans.append(O[0])
        del O[0]
    else:
        ans.append(E[0])
        del E[0]
result = "".join(ans)
print(result)
# Judge status: Accepted
N=int(input())
N=N+1
L1 = 2
L2 = 1
if N==1:print(L1)
if N==2:print(L2)
if N>2:
  N=N-2
  for i in range(N):
    L=L1+L2
    L1 = L2
    L2 = L
  print(L)
# Judge status: Accepted
W, H ,x ,y = map(int,input().split())

S = W * H /2

if x *2 ==W and y*2 == H:
    print(S,1)
else:
    print(S,0)
# Judge status: Accepted
import sys
a,b = map(int,input().split())
l = [(n*(n+1))//2 for n in range(1,1000)]
for i in range(len(l)-1):
  if l[i+1]-l[i] == b - a:
    print(l[i]-a)
    sys.exit()
# Judge status: Accepted
k = int(input())

def func(k):
    number = 7 % k
    for i in range(k):
        if number == 0:
            return i+1
        number = (10 *number + 7) % k 
    return -1
    
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    print(func(k))
# Judge status: Accepted
a,b,c = map(int, input().split())
if c <= b//a:
    print(c)
else:
    print(b//a)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n, x, t = inl()

    return t * ((n + x - 1) // x)


print(solve())
# Judge status: Accepted
N = int(input())
S = input()

left_num = 0
right_num = 0

for i in range(N):
    if S[i] == '(':
        right_num += 1
    else:
        if right_num > 0:
            right_num -= 1
        else:
            left_num += 1

ans = '('*left_num + S + ')'*right_num
print(ans)
# Judge status: Wrong Answer
n=int(input())
s=input()
d=dict(zip([chr(97+i) for i in range(26)],[0]*26))
for i in s:
  d[i]+=1
ans=1
for i in d.values():
  ans*=i+1
print(ans-1)
# Judge status: Accepted
s = input()
if(s=='ABC'):
  print('ARC')
else:
  print('ABC')
# Judge status: Accepted
w,a,b = map(int, input().split())
if a+w <= b:
  print(max(b-(a+w),0))
else:
  print(max(a-(b+w),0))
# Judge status: Accepted
a = list((input().split()))
a = set(a)
a = len(a)

print(a)
# Judge status: Accepted
abclist=list(map(int,input().split()))
abclist.sort()

K=int(input())
for i in range(K):
  abclist[2]*=2
  
print(sum(abclist))
# Judge status: Accepted
n=int(input())
ans=0
for a in range(1, n):
    ans+=(n - 1)//a
print(ans)
# Judge status: Wrong Answer
x,y=map(int,input().split());print(x+y/2)
# Judge status: Accepted
S = str(input())
K = 0
last,now = '',''
for i in range(len(S)):
  now += S[i]
  if i > 0 and now == last:
    continue
  else:
    K += 1
    last = now
    now = ''

print(K)
# Judge status: Wrong Answer
import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,k = map(int, input().split())
h = []
d = defaultdict(int)
cnt = []
for i in range(n):
    x = int(input())
    h.append(x)
    d[x] += 1

for i in d.items():
    if i[1] >= k:
        print(0)
        exit()

sh = sorted(h)
print(sh[k - 1] - sh[0])
# Judge status: Wrong Answer
def main():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))

    ht= list(map(lambda x:abs(a - t - x * 0.006), h))
    print(ht)
    print(ht.index(min(ht))+1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int, input().split())

if a<=8 and b<=8:
  print('Yay!')
else:
  print(':(')
# Judge status: Wrong Answer
S = input()

if S[0]==S[1]:
    if S[2]==S[3]:
        print("Yes")
    else:
        print("No")
elif S[0]==S[2]:
    if S[1]==S[3]:
        print("Yes")
    else:
        print("No")
elif S[1]==S[2]:
    if S[0]==S[3]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
n = int(input())
print(n*800 - 200*(n//15))
# Judge status: Wrong Answer
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
d=input_array()
d.sort()
MAX=d[-1]

count=0
for k in range(MAX):
	down=0 #Kより下
	up=0
	for j in d:
		if j < k:
			down+=1
		else:
			up+=1
	if down==up:
		count+=1
print(count)
# Judge status: Accepted
import fractions
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = (fractions.gcd(left[i],a[i]))
    right[n - i - 1] = (fractions.gcd(right[n - i],a[n - 1 - i]))
ans = 0
for i in range(n):
    ans = max(ans,fractions.gcd(left[i],right[i + 1]))
print(ans)
# Judge status: Accepted
import heapq

N,M = map(int,input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

while M != 0:
    nim = heapq.heappop(A)
    heapq.heappush(A,-(-nim//2))
    M -= 1
    
print(-sum(A))
# Judge status: Accepted

n=int(input())
p=[int(x) for x in input().split()]
cnt=0
for i in range(n-2):
    if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:
        cnt+=1
print(cnt)
# Judge status: Accepted
n = input()

rcount = 0
m = 0
for i in n:
  if i == "R":
    rcount += 1
  else:
    rcount = 0
  
  if m <= rcount:
    m = rcount
print(m)
# Judge status: Wrong Answer
from collections import defaultdict
n, m = map(int, input().split())
ans = defaultdict(int)
for q in range(m):
    ab = list(map(int, input().split()))
    ans[ab[0]] += 1
    ans[ab[1]] += 1
for _, v in sorted(ans.items()):
    print(v)
# Judge status: Accepted
S=input()
T=input()
L,M=len(S),len(T)
a=-1
for i in range(L-M,-1,-1):
    if sum([1 for j in range(M) if S[i+j]=='?' or S[i+j]==T[j]])==M:
        a=i
        break
print('UNRESTORABLE' if a<0 else ''.join([T[i-a] if a<=i<a+M else 'a' if S[i]=='?' else S[i] for i in range(L)]))
# Judge status: Accepted
n, k = map(int, input().split())

total = 0
for i in range(1, n+1):
    score = i
    count = 0
    while score < k:
        score <<= 1
        count += 1
    total += 1 / (2 ** count)

print('{:.10g}'.format(total / n))
# Judge status: Accepted
def changing_character(n, k, s):

    s[k-1] = s[k-1].lower()
    return "".join(s)
def main():
    n, k = map(int, input().split())
    s = list(str(input()))
    print(changing_character(n, k, s))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def check(number):
    if number % 2 == 1:
        return True
    if number % 3 == 0 and number % 5 == 0:
        return True
    return False


array = list(map(int, input().split()))

flag = True

for num in array:
    if check(num) is False:
        flag = False
        break

if flag:
    print("APPROVED")
else:
    print("DENIED")
# Judge status: Wrong Answer
n, k = map(int, input().split())
hh = []
minn = 10**12
for i in range(n):
    h = int(input())
    hh.append(h)
h = sorted(hh)
for i in range(n - k - 1):
    if h[i + k - 1] - h[i] < minn:
        minn = h[i + k - 1] - h[i]
print(minn)
# Judge status: Accepted
s1,s2,s3 = map(int,input())
s = [s1,s2,s3]
S = s.count(1)
if(S == 0):
    print(0)
if(S == 1):
    print(1)
if(S == 2):
    print(2)
if(S == 3):
    print(3)
# Judge status: Wrong Answer
h_1 , m_1, h_2, m_2 , k = map(int, input().split())
study_time = abs((h_2*60 + m_2) - (h_1*60 + m_1))
print(k*((study_time//k) - 1))
# Judge status: Accepted
s = list(input())
t = list(input())


max_change = len(t)
for start in range(len(s) - len(t) +1):
    diff =0
    for i in range(len(t)):
        if s[start + i] != t[i]:
            diff += 1
    if diff <= max_change:
        max_change = diff
print(max_change)
# Judge status: Wrong Answer
S,W = map(int, input().split())
if S/2<=W:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
import math
a,b,x=map(int,input().split())
p=math.acos(-1)
if x==b*a**2:
    print(0)
else:
    if x >= a * b / 2:
        print(90 - (math.atan(a / 2 / (b - (x / a ** 2))))*180/p)
    else:
        tate = (2 * x / a / b)
        print(90 - (math.atan((tate / b)))*180/p)
# Judge status: Accepted
N, M= input().split()

if N == M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=set(map(int,input().split()))
print('YNEOS'[N!=len(A)::2])
# Judge status: Accepted
N,X = (int(x) for x in input().split())
L = [int(x) for x in input().split()]
s = 0
i = 0
while (s <= X):
  if i >= N:
    print(N+1)
    quit()
  else:
    s = s + L[i]
    i = i + 1
print(i)
# Judge status: Accepted
n = int(input())
cnt = 0
memo = [[0] * 10 for i in range(10)]
for i in range(1, n + 1):
    memo[int(str(i)[0])][int(str(i)[-1])] += 1
for i in range(10):
    for j in range(10):
        cnt += memo[i][j] * memo[j][i]
print(cnt)
# Judge status: Accepted
def instr():
    s = input()
    return(list(s[:len(s)]))
# For taking space seperated integer variable inputs.


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


a, b = invr()
s = instr()

check = "1234567890-"
res = "Yes"

n = len(s)
if n != a+b+1:
    res = "No"
if s[a] != "-":
    res = "No"
for i in range(n):
    if s[i] not in check:
        res = "No"
        break
    if i != a and s[i] == "-":
        res = "No"
        break
print(res)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

W = ['Sunny', 'Cloudy', 'Rainy']
A = readline().decode('utf8').rstrip()


print(W[(W.count(A)+1)%3])
# Judge status: Wrong Answer
s=input()
n=len(s)
ans=[0]*(n+1)
m=0
for i in range(1,n+1):
	if s[i-1]=='<':
		ans[i]=ans[i-1]+1
	else:
		ans[i]=ans[i-1]-1
	m=min(m,ans[i])
print(sum(ans)-m*n)
# Judge status: Accepted
N = int(input())
pair = [[] for i in range(N)]

for _ in range(N):
  pair[_] = list(map(int,input().split()))
  a = pair[_][0]
  b = pair[_][1]

ans = 0
diff = 0

for i in range(N - 1,-1,-1):
  A = pair[i][0]
  a = pair[i][0] + ans
  b = pair[i][1]
  diff = b - a + b * (a // b)

  if a % b != 0:
    ans += diff
  
print(ans)
# Judge status: Wrong Answer
if __name__ == "__main__":
    r = int(input())

    # 半径１の面積 = 1 * 1 * pi
    # 半径ｒの面積 = r * r * pi
    # 半径 r の円の面積が半径 1 の円の面積の何倍になるか = (r*r*pi)/(1*1*pi) = r * r

    print(r*r*2)
# Judge status: Wrong Answer
#!/usr/bin/env python3

from sys import stdin


def main():
    S = stdin.readline()
    if S == 'ABC':
        print('ARC')
    else:
        print('ABC')


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()

odd = 0
count = 1
a = A[0]
for i in A[1:]:
  print(i,a)
  if i == a:
    count += 1
  else:
    a = i
    if count % 2 == 1:
      odd += 1
    count = 1
if count % 2 == 1:
      odd += 1
print(odd)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=a[0]
for i in range(1,n):
  ans=(ans+a[i])/2
print(ans)
# Judge status: Accepted
import numpy as np
N, M =[int(i) for i in input().split()]
isfinish=[0]*N
isfail=[0]*N
for i in range(M):
    p, S = input().split()
    p=int(p)
    if isfinish[p-1]==1:
        continue
    elif S=="AC" and isfinish[p-1]==0:
        isfinish[p-1] = 1
    elif S=="WA" and isfinish[p-1]==0:
        isfail[p-1] +=1

isfinish=np.array(isfinish)
isfail=np.array(isfail)
print(str(sum(isfinish)) + " "+ str(sum(isfail[isfinish==1])))
# Judge status: Accepted
x = str(input())
n = len(x)
stack = []
for i in range(n):
    if x[i] == 'S':
        stack.append('S')
    elif len(stack) == 0 or stack[len(stack) - 1] == 'T':
        stack.append('T')
    else:
        stack.pop()
print(len(stack))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

a_tmp = 0
b_tmp = 0
c_tmp = 0

flag = 0
ans = 0

if a == b and b == c and c == a:
  ans = -1
else:
  while flag == 0:
    b_tmp += a/2
    c_tmp += a/2
    
    a_tmp += b/2
    c_tmp += b/2
    
    a_tmp += c/2
    b_tmp += c/2
    
    a = a_tmp
    b = b_tmp
    c = c_tmp
    
    ans += 1
    
    if a%2 == 1 or b%2 ==1 or c%2 ==1:
      flag = 1
print(ans)