Harryxun/stf_run huggingface dataset:
import sys
input=sys.stdin.readline
import heapq
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
d=[int(input()) for i in range(q)]
L1=[]
for i in range(n):
  L1.append([l[i][0]-l[i][2],1,l[i][2]])
  L1.append([l[i][1]-l[i][2],-1,l[i][2]])
L1.sort()
L2=[]
heapq.heapify(L2)
L3=[]
L3=set(L2)
ctd=0
for i in range(len(L1)):
  if ctd<q:
    while L1[i][0]>d[ctd]:
      if len(L2)!=0:
        print(heapq.heappop(L2))
      else:
        print(-1)
      ctd+=1
  else:
    break
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  else:
    L3.remove(L1[i][2])
while ctd<q:
  print(-1)
  ctd+=1

### FIXED CODE ###

import sys
input=sys.stdin.readline
import heapq
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
L1=[]
for i in range(n):
  L1.append((l[i][0]-l[i][2],1,l[i][2]))
  L1.append((l[i][1]-l[i][2],-1,l[i][2]))
for i in range(q):
  L1.append((int(input()),2,0))
L1.sort()
L2=[]
heapq.heapify(L2)
L3=[]
L3=set(L3)
for i in range(len(L1)):
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1)
a = int(input())
b = int(input())

c = (a - b) % 2 
if c == 0:
  abs_a = abs(a)
  abs_b = abs(b)
  ans = max(abs_a, abs_b) - (((max(abs_a, abs_b)/2) - min(abs_a, abs_b))/2)
  print(ans)
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

inp = input().split(" ")
a = int(inp[0])
b = int(inp[1])
 
c = (a - b) % 2 
if c == 0:
  abs_a = abs(a)
  abs_b = abs(b)
 
  m = (max(abs_a, abs_b) - min(abs_a, abs_b)) /2
  ans = max(abs_a, abs_b) - m
  print(int(ans))
else:
  print("IMPOSSIBLE")
N = int(input())

C = [[0]*10 for _ in range(10)]
for n in range(1, N+1):
    s = str(n)
    C[int[s[0]]][int[s[-1]]] += 1

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


### FIXED CODE ###

N = int(input())

C = [[0]*10 for _ in range(10)]
for n in range(1, N+1):
    s = str(n)
    C[int(s[0])][int(s[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += C[i][j]*C[j][i]
print(ans)
import numpy as np
N=int(input())
A=list(map(int,input().split()))

MOD = 1000000007
ans=0
for i in range(2**N):
    bin_str = format(i, 'b')
    bin_ = bin_str.count('1')
    if 1 < bin_ < N:
        if bin_ == 2:
            temp=1
            for n in range(N):
                if i>>n&1:
                    temp *=A[n-1]
            ans+=temp

print(ans%MOD)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))

mod=10**9+7
total = sum(a)
cum=[]

ans=0
for i in range(n):
    total-=a[i]
    ans += a[i]*(total)%mod
    

print(ans%mod)
import numpy as np

def count_true(matrix:np.array, s:int):
    return np.count_nonzero(matrix == s)


def unk(k:int, s:int):
    # 条件チェック
    if all([(2 <= k <= 2000), (0 <= s <= 3*k)]):

        x = y = z = np.array([range(0,k+1)])
        c = count_true(np.ravel(x.T+y)+ z.T, s)

        print(c)


if __name__ == '__main__':
　　　　data = input().split(" ")
　　　　data = list(map(int, data))
　　　　unk(data[0], data[1])


### FIXED CODE ###

data = input().split(" ")
data = list(map(int, data))

count=0

for x in range(data[0]+1):
    for y in range(data[0]+1):
        if data[0] >= (data[1]-(x+y)) >= 0:
            z = data[1]-(x+y)
            
            if x + y + z == data[1]:
                count+=1
print(count)
a = map(int, input().split())

abs = max(a[1], a[2]) - min(a[1], a[2]) - a[0]

print(max(0, abs))

### FIXED CODE ###

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

abs = max(a, b) - min(a, b) - W

print(max(0, abs))
a, b, k = map(int, input().split())

ans = 0

lista = list(range(a+1))
aa = lista.pop(0)

listb = list(range(b+1))
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

### FIXED CODE ###

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

ans = 0

if (b < a):
    ans = 0
elif (b / a < c):
    ans = int(b / a)
else:
    ans = c

print(ans)
A = input()
B = input()

op = + or -

print(int(A) + op + int(B))


### FIXED CODE ###

A, op, B= input().split()


if op =="+":
    print(int(A) + int(B))
elif op =="-":
    print(int(A)-int(B))
c = [list(map(int, input().split())) for i in range(3)]

if 1 == len({r[0] - r[1] for r in c}) == len({r[1] - r[2] for r in c}):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())
A = int(input())

a = N % 500
if a <= A:
    print("Yes")
else:
    print("No")
a,b=list(map(int,input().split())
if a<b:
	print('a < b')
elif a==b:
	print('a > b')
else:
	print('a == b')

### FIXED CODE ###

a,b=list(map(int,input().split()))
if a<b:
	print('a < b')
elif a==b:
	print('a == b')
else:
	print('a > b')
num=input().split()
a=int(num[0])
b=int(num[1])
if a==b:
  print(max([a+b,a-b,a*b]))
else:
  print(max([a+b,a-b,a*b,a/b]))

### FIXED CODE ###

num=input().split()
a=int(num[0])
b=int(num[1])
print(max([a+b,a-b,a*b]))
A, V = map(int, input().split()) 
B, W= map(int, input().split()) 
T = int(input())


diff1 = B - A
diff2 = (V - W)*T

if ( diff1 < diff2):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s = input()
print(s[0:3])
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5)]
for i in range(N):
    s, t, c = map(lambda x: int(x) - 1, input().split())
    table[s][c] += 1
    table[t + 1][c] -= 1


ans = 0
for i in range(1, 10 ** 5):
    for j in range(C):
        table[i][j] += table[i - 1][j]
    ans = max(ans, sum(table[i]))

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] += 1
    table[t - 1][c - 1] -= 1

imos = [0] * (10 ** 5 + 1)
for i in range(10 ** 5 + 1):
    for j in range(C):
        if table[i][j] == 1:
            imos[i] += 1
        if table[i][j] == -1:
            imos[i + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    imos[i] += imos[i - 1]
    ans = max(ans, imos[i])

print(ans)
import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

#ans = list((A@B) > -C).count(True)
ans = list((np.matmul(A, B)) > -C).count(True)

print(ans)


### FIXED CODE ###

import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

#ans = list((A@B) > -C).count(True)
ans = list((A.dot(B)) > -C).count(True)

print(ans)
s=input()


for i in range(3):
    if s[i]==s[i+1]:
        ans=1
if ans==1:
    print("Bad")
else:
    print("Good")
    


### FIXED CODE ###

s=input()

ans=0
for i in range(3):
    if s[i]==s[i+1]:
        ans=1
if ans==1:
    print("Bad")
else:
    print("Good")
n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

T = sum(t)

def f(l, r, v, x):
	maxv = 0
	if 0 <= x and x < l:
		maxv = v + l - x
	elif l <= x and x <= r:
		maxv = v
	else:
		maxv = v + x - r
	return maxv

def vel(x):
	minv = f(0, 0, 0, x)
	minv = min(minv, f(T, T, 0, x))
	l = 0
	r = 0
	for i in range(len(t)):
		r += t[i]
		minv = min(minv, f(l, r, v[i], x))
		l += t[i]
	return minv

area = 0
for i in range(T):
	area += 0.25 * (vel(i) + 2 * vel(i+0.5) + vel(i+1))

print(area)

### FIXED CODE ###

old = int(input())
new = int(input())
print(2*new-old)
def search(keys,dic,now,goal):
    if now==len(keys):
        if goal==0:
            return True
        else:
            return False
    k=keys[now]
    for i in range(dic[k]+1):
        if search(keys,dic,now+1,goal-k*i+k*(dic[k]-i)):
            return True
    return False

s=input()+'T'
x,y=list(map(int,input().split()))
xlist=[0 for _ in range(8000)]
ylist=[0 for _ in range(8000)]
flag='x+'
ini=0
tmp=0
for c in s:
    if c =='F':
        tmp+=1
    else:
        if flag=='x':
            xlist[tmp]+=1
        elif flag=='y':
            ylist[tmp]+=1
        else:
            ini=tmp
        tmp=0
        if flag=='y':
            flag='x'
        else:
            flag='y'
xlist[0]=0
ylist[0]=0
xkey=[]
ykey=[]
for i in range(8000):
    if xlist[i]>0:
        xkey.append(i)
    if ylist[i]>0:
        ykey.append(i)
xkey.inverse()
ykey.inverse()
if search(xkey,xlist,0,x-ini) and search(ykey,xlist,0,y):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

s=input()+'TE'
x,y=list(map(int,input().split()))

ini = s.find('T')
s=s[ini+1:]

is_y=1
point=[set([ini]),set([0])]

while len(s)>1:
    tmp=s.find('T')
    if tmp != 0:
        set_=set()
        for z in point[is_y]:
            set_.add(z+tmp)
            set_.add(z-tmp)
        point[is_y]=set_
    is_y+=1
    is_y%=2
    s=s[tmp+1:]

if x in point[0] and y in point[1]:
    print('Yes')
else:
    print('No')
import sys

def dfs(n:int, heights: int, a_index:int):
    if n < heights:
        return
    
    if m != 0 and a_index <= len(a) -1 and a[a_index] == heights:
        memo[heights] = 0
        a_index += 1
        #print("10",heights)
    else:
        memo[heights] = memo[heights-1] + memo[heights -2]
        #print("13",heights)
    dfs(n,heights+1,a_index)
    return
    

n,m = list(map(int, input().split()))
memo = [1]*(n+1)
a = []
a_index = 0
if m != 0:
    for i in range(m):
        tmp = int(input())
        if i >= 1 and tmp -1 == a[len(a)-1]:
            print(0)
            sys.exit()
        else:
            a.append(tmp)
            #print(i,a)

    if a[0] == 1:
        memo[1] = 0
    a_index += 1

dfs(n,2,a_index)
#print(memo)
print(memo[n] % (10**9+7))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def dfs(heights: int, a_index:int, a_n_1, a_n_2):
    if n < heights:
        return
    
    if m != 0 and a_index <= len(a) -1 and a[a_index] == heights:
        memo[2] = 0
        a_index += 1
        #print("10",heights)
    else:
        memo[2] = a_n_1 + a_n_2 #memo[1] + memo[0]
        #print("13",heights)
    dfs(heights+1,a_index,memo[2],a_n_1)
    return
    

n,m = list(map(int, input().split()))
memo = [1]*(3)
a = []
a_index = 0
if m != 0:
    for i in range(m):
        tmp = int(input())
        if i >= 1 and tmp -1 == a[len(a)-1]:
            print(0)
            sys.exit()
        else:
            a.append(tmp)
            #print(i,a)

    if a[0] == 1:
        memo[1] = 0
        a_index += 1
#a = list(set(a))
#a.sort()
dfs(2,a_index,memo[1],memo[0])
#print(memo)
print(memo[2] % (10**9+7))
n,k=map(int,input().split())
if 500 * n >= k:print("Yes")
  else:print("No")

### FIXED CODE ###

n,k=map(int,input().split())
if 500 * n >= k:print("Yes")
else:print("No")
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus > 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()
#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0 
        return x 
    else gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return int(a*b/remainder)

lcmm=gys(c,d)
def ans(n,k):
    return int(n/k)
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))
if a%c==0 or a%d==0:
    print(b-a-x(b)+x(a))
else:
    print(b-a+1-x(b)+x(a))




### FIXED CODE ###

#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0:
        return x 
    else:
        return gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return a*b//remainder

lcmm=gys(c,d)
def ans(n,k):
    return n//k
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))

print(b-a+1-x(b)+x(a-1))
import math
import sys

N, M = map(int,input().split())
A = list(map(int,input().split()))
if N == 1:
    while A[0] > 0:
        A[0] = A[0]//2
    print(0)
    sys.exit()

list.sort(A,reverse = True)
a = A[0]
b = A[1]
x = 0
for _ in range(M):
    a = A[0]
    b = A[1]
    x = max(math.ceil(math.log2(a/b)),1)
    if M >= x:
        a = a//(2**x)
        _ += x
    else:
        a = a//(2**M)
        _ = M
    A[0] = a
    for i in range(0,N-1):
        if A[i] < A[i+1]:
            A[i] , A[i+1] = A[i+1] , A[i]

print(sum(A))

### FIXED CODE ###

import sys
import os
import math
import heapq

N, M = map(int,input().split())
A = list(map(int,input().split()))
#大きいものから取り出したいので-1倍してqueueに入れる

Q = []
for a in A:
    heapq.heappush(Q,-a)

for i in range(M):
    first = -heapq.heappop(Q)
    first = first//2
    heapq.heappush(Q,-first)

print(-sum(Q))
a,b,c,d = map(int, input().split())
print(min(a,b)+min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))
#????????§??\????????\??????????????????
list1 = [int(i) for i in input().split()]
print("{0} {1}".format(list1[0]+*list[1],list1[0]*2+list1[1]*2))

### FIXED CODE ###

item = [int(i) for i in input().split()]
print(item[0]*item[1],2*(item[0]+item[1]))
def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/gcd(C,D))!=0:
        CD_min=A-A%(C*D/gcd(C,D))+(C*D/gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/gcd(C,D))+1
    sum= B-A+1-int(C_sum+D_sum-CD_sum)
    return sum
print(main())

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(int,input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    mod=C*D//gcd(C,D)
    if A%mod!=0:
        CD_min=A-A%mod+mod
    else:
        CD_min=A
    CD_max=B-B%mod
    C_sum=(C_max-C_min)//C
    D_sum=(D_max-D_min)//D
    CD_sum=(CD_max-CD_min)//mod
    sum= B-A+1-int(C_sum+D_sum-CD_sum+1)
    return sum
print(int(main()))
import math

N=int(input())

is_prime = [True] * (N+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(N**0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, N+1, i):
        is_prime[j] = False
A=[i for i in range(N + 1) if is_prime[i]]


a=[]
for i in A:
    if N%i==0:
        a.append(i)

ans=0
for i in a:
    e=int(math.log(N,i))
    x=0
    for j in range(1,100):
        x+=j
        if e>=x:
            ans+=1

print(ans)

### FIXED CODE ###

P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0
Q = []
for i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
N = int(input())
C = {}
for q in Q:
    if N%q==0:
        C[q] = 0
        while N%q==0:
            N = N//q
            C[q] += 1
if N>1:
    C[N] = 1
cnt = 0
for q in C:
    k = C[q]
    n = 1
    while k>(n*(n+1))//2:
        n += 1
    if k==(n*(n+1))//2:
        cnt += n
    else:
        cnt += n-1
print(cnt)
N = int(input())

l = list(range(1,N+1)) ## 1~Nのリスト
I = list(range(1,N))
l.pop(0)

print(sum([x % y for (x,y) in zip(I, l)]))




### FIXED CODE ###

N  =int(input())
print(N*(N-1)//2)
import numpy as np
Q = int(input())

p = np.array([i for i in range(2*10**5+1)])
p[1]=0
for i in range(2,10**5):
    p[2*i::i] = 0
p = p[p!=0]

dic = {i:1 for i in p}

for _ in range(Q):
    l,r = list(map(int,input().split()))
    tmp = p[l<=p]
    tmp = tmp[tmp<=r]
    print(len(tmp[[dic.get((x+1)//2,0)==1 for x in tmp]]))
    

### FIXED CODE ###

import numpy as np
Q = int(input())

p = np.array([i for i in range(2*10**5+1)])
p[1]=0
for i in range(2,10**5):
    p[2*i::i] = 0
p = p[p!=0]

dic = {i:1 for i in p}
d = {}
for i in range(len(p)):
    if dic.get((p[i]+1)//2,0)==1:
        d[p[i]] = 1
sum_=0
arr = [0 for i in range(10**5+2)]
for i in range(10**5+2):
    arr[i] = sum_
    if d.get(i,0)==1:
        sum_+=1
for _ in range(Q):
    l,r = list(map(int,input().split()))
    print(arr[r+1]-arr[l])
a = int(input())
b = []
S = []
H = []
C = []
D = []
check = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(a):
    b.append(input().split())
for i in range(len(b)):
    if b[i][0] == "S":
        S.append(int(b[i][1]))
    elif b[i][0] == "H":
        H.append(int(b[i][1]))
    elif b[i][0] == "C":
        C.append(int(b[i][1]))
    else:
        D.append(int(b[i][1]))

set_S = list(set(check)-set(S)).sort()
set_H = list(set(check)-set(H)).sort()
set_C = list(set(check)-set(C)).sort()
set_D = list(set(check)-set(D)).sort()

for i in set_S:
    print("S",i)
for i in set_H:
    print("H",i)
for i in set_C:
    print("C",i)
for i in set_D:
    print("D",i)


### FIXED CODE ###

a = int(input())
b = []
S = []
H = []
C = []
D = []
check = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(a):
    b.append(input().split())
for i in range(len(b)):
    if b[i][0] == "S":
        S.append(int(b[i][1]))
    elif b[i][0] == "H":
        H.append(int(b[i][1]))
    elif b[i][0] == "C":
        C.append(int(b[i][1]))
    else:
        D.append(int(b[i][1]))

set_S = list(set(check)-set(S))
set_S.sort()
set_H = list(set(check)-set(H))
set_H.sort()
set_C = list(set(check)-set(C))
set_C.sort()
set_D = list(set(check)-set(D))
set_D.sort()
for i in set_S:
    print("S",i)
for i in set_H:
    print("H",i)
for i in set_C:
    print("C",i)
for i in set_D:
    print("D",i)
import fractions

X = [int(x) for x in input().split()]

v = fractions.gcd(X[0], X[1])
j = X[0] / v
p = int(X[1] * j)

print(p)


### FIXED CODE ###

import fractions

X = [int(x) for x in input().split()]

v = fractions.gcd(X[0], X[1])
j = X[0] / v
p = int(X[1] * j)

print(p)
import numpy as np
s=input()
A=np.array([0,0,0,0])
B=np.array([0,0,0,0])
C=np.array([0,0,0,0])
t=0
for c in s:
	if c=="A":
		A[0]+=1
	if c=="B":
		B+=A
	if c=='C':
		C+=B
	if c=='?':
		wayC+=np.roll(wayB,1)
		B[1]+=A[0]
		B[2]+=A[1]
		A[1]+=1
		t+=1
ans=0
for i in range(4):
	ans+=pow(3,t-i)*C[i]
print(int(ans%1000000007))

### FIXED CODE ###

#a,b=map(int,input().split())
import numpy as np

s=input()
n=len(s)
wayA=np.array([0,0,0,0],dtype=np.int64)
wayB=np.array([0,0,0,0],dtype=np.int64)
wayC=np.array([0,0,0,0],dtype=np.int64)
hatena=0
MOD=1000000007
for c in s:
	if c=="A":
		wayA[0]=wayA[0]+1
	if c=="B":
		wayB+=wayA;
	if c=='C':
		wayC=wayC+wayB
	if c=='?':
		wayC[1]=wayC[1]+wayB[0]
		wayC[2]=wayC[2]+wayB[1]
		wayC[3]=wayC[3]+wayB[2]
		wayB[1]=wayB[1]+wayA[0]
		wayB[2]=wayB[2]+wayA[1]
		wayA[1]=wayA[1]+1
		hatena=hatena+1
	for z in range(0,4):
		wayA[z]=wayA[z]%MOD
		wayB[z]=wayB[z]%MOD
		wayC[z]=wayC[z]%MOD
ans=0
for i in range(0,4):
	p3=1
	if wayC[i]<=0:
		continue
	for k in range(0,hatena-i):
		p3=p3*3
		p3=p3%MOD
	ans=ans+p3*wayC[i]
	ans=ans%MOD
print(int(ans))
a = input()
j = 1
for i in a:
  if i ==0 :
    print(j)
    j++

### FIXED CODE ###

x = input()
x = x.split(' ')
j = 1
for i in x:
  if i == '0':
    print(j)
  j = j+1
import math

n, d = int(input().split())
count = 0

for i in range(n):
    xn, yn = int(input().split())
    if d >= math.sqrt(xn ** 2 + yn ** 2):
        count += 1

print(count)

### FIXED CODE ###

import math

n, d = input().split()
count = 0
dn = int(d)

for i in range(int(n)):
    x = list(map(int,input().split()))
    if dn >= math.sqrt(x[0] ** 2 + x[1] ** 2):
        count += 1

print(count)
s = input()
k = int(input())

subs = set()
for i in range(len(s)):
  for len in range(1, min(4, len(s) - i + 1)):
    subs.add(s[i : i + len])
    if len(subs) == k:
      break
  if len(subs) == k:
    break

print(max(subs))

### FIXED CODE ###

s = input()
k = int(input())

subs = set()
for i in range(len(s)):
  for l in range(1, min(k + 1, len(s) - i + 1)):
    subs.add(s[i : i + l])

print(sorted(list(subs))[k - 1])
x = int(input())
for i in range(x):
  exec("a_%d = int(input())" %(i))
a_list = [eval("a_%d" %(i)) for i in range(x)]
a_list.sort()
be_list = [eval("a_%d" %(i)) for i in range(x)]
count = 0
for i in range(x):
    if a_list[i] == be_list[i]:
      count += 1
if count >= x-2:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

x = int(input())
a_list = list(map(int,input().split()))
a = sorted(a_list)
count = 0
for i in range(x):
    if a[i] == a_list[i]:
      count += 1
if count >= x-2:
  print('YES')
else:
  print('NO')
N = int(input())
L = = [2, 1]
for i in range(87):
    L.append(L[i]+L[i+1])
print(L[N])

### FIXED CODE ###

L = [2, 1]
N = int(input())
for i in range(N-1):
    last_L = L[i] + L[i+1]
    L.append(last_L)
print(L[-1])
a,b,c,d=map(int, input().split())
while True:
	b -= c
	if c<=0 print"Yes" break
	a -=d
	if a<=0 print"No" break


### FIXED CODE ###


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

while True:
  c -= b
  if c <= 0:
    print('Yes')
    break
  
  a -= d
  if a <= 0:
    print('No')
    break
n,q = map(int, raw_input().split())
S = [set([i]) for i in range(n)]
ref = [0]*n
for i in range(q):
	com,x,y = map(int, raw_input().split())
	if x > y: x,y = y,x
	if com == 0: # unite
		x += ref[x]; y += ref[y]
		S[x] = S[x]|S[y]
		S.pop(y)
		for j in range(y,n):
			ref[j] -= 1
	else: # same
		print 1 if y in S[x+ref[x]] else 0

### FIXED CODE ###

class UnionFind:
    def __init__(self, size):
        self.rank = [0] * size
        self.par = range(size)
        self.g_num = size

    def find(self, x):
        if x == self.par[x]: return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return

        self.g_num -= 1
        if (self.rank[x] > self.rank[y]):
            self.par[y] = x
        else:
            self.par[x] = y
            if (self.rank[x] == self.rank[y]): self.rank[y] += 1

    def group_num(self):
        return self.g_num

n, q = map(int, raw_input().split())
uf = UnionFind(n)
for i in xrange(q):
    c, x, y = map(int, raw_input().split())
    if c == 0:
        uf.unite(x, y)
    else:
        print int(uf.same(x, y))
st = input().split()
N = int(st[0])
x = int(st[1])
A = input().split()
a = []
for i in range(N):
     a.append(int(A[i]))   
a.append(0)
a.append(0)
ret = 0
for i in range(N):
    if a[i] + a[i + 1] > x :
        d1 = max((a[i] + a[i + 1]) - x,0)
        ret +=  min(a[i+1],d1)
        a[i+1] -=  min(a[i+1],d1)
        d1 = max((a[i] + a[i + 1]) - x,0)
        ret +=  min(a[i],d1)
        a[i] -=  min(a[i],d1)
print(ret)

### FIXED CODE ###

st = input().split()
A = (st[0])
B = (st[1])
C = (st[2])
ret = A[0] + B[0] + C[0]

    
print(ret)