peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
X,Y=map(int,input().split())
a=(4*X-Y)/2
if X<=Y and a.is_integer() and a>=0 and a<=50:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
X = input()
check = True
ans = 0
for i, x  in enumerate(X):
    if i > 0 and x != "9":
        check = False
    if i == 0:
        ans += int(x)
    else:
        ans += 9

print(ans if check else ans - 1)
# Judge status: Accepted
n = int(input())
ab = [input().split() for _ in [0]*n]
a = [int(i) for i, j in ab][::-1]
b = [int(j) for i, j in ab][::-1]
ans = 0
for i in range(n):
    a[i] += ans
    if a[i] % b[i] != 0:
        ans += b[i] - (a[i] % b[i])
print(ans)
# Judge status: Wrong Answer
n,m = map(int, input().split())

if(n == m):
  print("AC")
else:
  print("WA")
# Judge status: Accepted
N = int(input())

count = dict()
for _ in range(N):
    x = input()
    count[x] = count.get(x, 0) + 1

max_val = -float("infinity")
for k, v in sorted(count.items(), key=lambda x: (-x[1], x[0])):
    max_val = max(v, max_val)
    if v == max_val:
        print(k)
    else:
        break
# Judge status: Accepted
a ,b, c = map(int, input().split(" "))

if a + b + c <= 21:
	print("win")
else:
	print("bust")
# Judge status: Wrong Answer
s = list(map(int, input().split()))
print(s[::-1])
# Judge status: Wrong Answer
x = int (input())

if x == 30:
    print("Yes")

else:
    print("No")
# Judge status: Accepted
import math


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


N, M = map(int, input().split())
divisors = make_divisors(M)
ans = 1
for d in divisors:
    if d*N <= M:
        ans = max(ans, d)
print(ans)
# Judge status: Wrong Answer
import math
N,K = map(int,input().split())
lsA = list(map(int,input().split()))
P = lsA.index(1)
ans = math.ceil(P/(K-1)) + math.ceil((N-1-P)/(K-1))
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

l_max = 1
r_min = N
for _ in range(M):
    l, r = map(int, input().split())
    l_max = max(l_max, l)
    r_min = min(r_min, r)

if r_min < l_max:
    print(0)
else:
    print(r_min-l_max+1)
# Judge status: Accepted
st = input()
if st[2]==st[3] and st[4]==st[5]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A,B,C = map(int,input().split())
K = int(input())
for k in range(K):
    if A < B < C:
        break
    elif A >= B:
        B = B*2
    elif B >= C:
        C = C*2
if A < B < C:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def actual(c):
    if c in list('aeiou'):
        return 'vowel'

    return 'constant'

c = input()
print(actual(c))
# Judge status: Wrong Answer
#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = (ans * T[i]) // (gcd(ans, T[i]))
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
#python3
n,m=map(int, input().split())
l=[]
for i in range(m):
  x,y=map(int, input().split())
  l.extend([x,y])
d={key:l.count(key) for key in set(l)}
for i in d.values():
  print(i)
# Judge status: Wrong Answer
data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
      'u','v','w','x','y','z',]
s=list(input())
t=sorted(s)
i=0
while (t[i]==data[i] and i<25):
    i=i+1
if i<25:
    print(data[i])
else:
    print('None')
# Judge status: Accepted

def main():
    X = int(input())
    N = 100
    ans = 0
    while True:
        N += int(N*0.01)
        ans += 1
        if N >= X:
            break
            
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
nim,mike = map(int,input().split())
a = set()
b = set()
for i in range(mike):
    a_,b_ = map(int,input().split())
    if a_ == 1:
        a.add(b_)
    if b_ == nim:
        b.add(a_)
print("POSSIBLE" if a&b else "IMPOSSIBLE")
# Judge status: Accepted
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    n = int(input())
    a = list(map(int, input().split()))

    d1 = defaultdict(int)
    d2 = defaultdict(int)
    for i, ae in enumerate(a):
        d1[i + ae +1] += 1
        d2[i - ae +1] += 1
    r = 0
    for d1e in d1.keys():
        rt = d1[d1e] * d2[d1e]
        r += rt
    print(r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
t0=0
x0=0
y0=0
for i in range(N):
  t,x,y = map(int, input().split())
  l = abs(x-x0) + abs(y-y0)
  if (l > (t-t0)) or (l%2 != (t-t0)%2):
    print("No")
    break
  else:
    x0 = x
    y0 = y
    t0 = t
else:
  print("Yes")
# Judge status: Accepted
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) == len(A):
        print('YES')
    else:
        print('NO')
resolve()
# Judge status: Wrong Answer

S = input()
T = input()

N = len(S)

for i in range(N):
    print(S[N-i:] + S[:N-i])
    if S[N-i:] + S[:N-i] == T:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
a,b,x=map(int,input().split())
if x>=a and x<=a+b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from fractions import gcd
N = int(input())
ans = 1
for _ in range(N):
    T = int(input())
    ans = ans * T // gcd(ans, T)
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
    exit()
elif n == 1:
    print(m-2)
    exit()
else:
    print((n-2)*(m-2))
# Judge status: Wrong Answer
S=input()
newS='X'*len(S)
print(newS)
# Judge status: Wrong Answer
import numpy as np
import itertools
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


k = int(input())
a = np.array(range(1, k+1))
#print(a)

comb = list(itertools.combinations_with_replacement(a, 3))
#print(comb)


ans = 0
for elm in comb:
    if elm[0] == elm[1] == elm[2]:
        print(elm)
        ans += gcd(elm[0], elm[1], elm[2])
    else:
        ans += gcd(elm[0], elm[1], elm[2]) * 3
print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a0 = sum(i % 2 != 0 for i in a)
if sum(i % 4 == 2 for i in a) > 0:
    a0 += 1
a2 = sum(i % 4 == 0 for i in a)
print('Yes' if a0 <= a2 + 1 else 'No')
# Judge status: Accepted
import numpy as np
N =int(input())
AB = []
for i in range(N):
    a,b = map(np.int64,input().split())
    AB.append((b,a))

AB.sort()
time = np.int64(0)

for b,a in AB:
    if time +a >b:
        print("No")
        exit()
    time +=a
    
print("Yes")
# Judge status: Wrong Answer
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

N, M, Q = map(int,input().split())
S = [[int(x) for x in input().split()]for i in range(Q)]
Max = 0
for i in range(M**(N-1),M**N):
  count = 0
  a = Base_10_to_n(i, M)
  A = [int(k)+1 for k in list(a)]
  A.sort()
  for j in range(Q):
    if A[S[j][1]-1]-A[S[j][0]-1] == S[j][2]:
      count += S[j][3]
  if count > Max:
    Max = count
print(Max)
# Judge status: Accepted
def main():
    box, limit = map(int, input().split())
    candies = list(map(int, input().split()))
    answer = 0
    for i in range(1, box):
        candy_sum = candies[i - 1] + candies[i]
        if candy_sum > limit:
            candies[i] -= min(candy_sum - limit, candies[i])
            answer += candy_sum - limit
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
l=list(mi())
s=[0]*a
for i in range(a):
  s[l[i]-1]=i+1
for j in s:
  print(j,end=" ")
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    o = list(input().rstrip())
    e = list(input().rstrip())

    ans = ""

    for i in range(len(o)):
        ans += o[i]
        if i < len(e):
            ans += e[i]


    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(str,input().split())
print(b+a)
# Judge status: Wrong Answer
a,b = map(int,input().split())
t = 0
for i in range(a,b+1):
    if i % 100 == i // 1000:
        t += 1

print(t)
# Judge status: Wrong Answer
n,m = map(int, input().split())
a = list()
for i in range(n):
    a.append(input())
b = list()
for i in range(m):
    b.append(input())
a_len = len(a[0])
b_len = len(b[0])
for i in range(a_len-b_len+1):
    check = True
    for j in range(n-m+1):
        if a[j][i:i+b_len] == b[j]:
            pass
        else:
            check = False
            break
    if check == True:
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
N=input()
if N.count(N[0])==4 or N[0]==N[1]==N[2] or N[1]==N[2]==N[3]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
if 0 < n <= 999:
    print("ABC" + str(n).zfill(3))
else:
    print("ABD" + str(n-999).zfill(3))
# Judge status: Accepted
check = list(input())
check.sort()
abc = ["a","b","c"]
if check == abc:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
X = int(input())
t = 1
while True:
    if (t*(t+1)/2) >= X:
        break
    else:
        t += 1
print(t)
# Judge status: Accepted
x, a, b = map(int,input().split())
 
if abs(x - a) < abs(x - b):
  r = 'A'
else:
  r = 'B'

print(r)
# Judge status: Wrong Answer
s=int(input())
x=input()
if s<=3200:
  print(x)
else:
  print("red")
# Judge status: Accepted
n = int(input())
robo = [0] * n
for i in range(n):
    x, l = map(int, input().split())
    robo[i] = (x - l, x + l)
robo.sort(key=lambda x: x[1])

max_r, cnt = -float('inf'), 0
for l, r in robo:
    if  max_r <= l:
        cnt += 1
        max_r = r
print(cnt)
# Judge status: Accepted
a, b, c = map(int, input().split())

if (a == b) & (a == c):
    print('No')
elif (a == b) | (a == c) | (c == b):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
exists = False
for i in range(1, b + 1, 1):
    sum = a * i
    if (sum % b) == c:
        exists = True
        break

print('YES' if exists else 'NO')
# Judge status: Accepted
a,b,c,d = map(int, input().split())

if abs(c-a) <= d or (abs(b-a) <= d and abs(c-b) <= d):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
As = list(map(int, input().split()))
BCs = [tuple(map(int, input().split())) for _ in range(M)]

As.sort()
BCs.sort(reverse=True, key=lambda x: x[1])

i = 0
for B, C in BCs:
    num = min(N-i, B)
    for j in range(i, i+num):
        if As[j] >= C:
            break
        As[j] = C
    else:
        i += B
        if i >= N:
            break
        continue
    break
#print('As:', As)

print(sum(As))
# Judge status: Accepted
s = str(input())
for b in range(1 << (len(s)-1)):
    ops = []
    for i in range(len(s)-1):
        op = "+" if b & 1 << i else "-"
        ops.append(op)
    siki = ""
    ls = list(s)
    ops.append("")
    for i in range(len(ops)):
        siki += ls[i]+ops[i]
    e = eval(siki)
    if e == 7:
        print("{}{}{}".format(siki, "=", e))
        exit()
# Judge status: Accepted
n = int(input())

for i in range(1,n+1):
  txd = int(i*1.08)
  if n==txd:
    print(i)
    exit()
print(":(")
# Judge status: Accepted
S=sorted(input())
T=sorted(input())[::-1]
print("Yes" if S<T else "No")
# Judge status: Wrong Answer
n,t=map(int,input().split())
ans=10000
for i in range(n):
    c,ti=map(int,input().split())
    if ti<t:
        ans=min(ans,c)
print(ans if ans<10000 else "TLE")
# Judge status: Accepted
from collections import Counter
_=input()
s=list(Counter(list(input())).values())
mod=10**9+7
dp=[0]*len(s)
dp[0]=s[0]
for i in range(1,len(s)):
  dp[i]=dp[i-1]*(s[i]+1)+s[i]
print(dp[-1]%mod)
# Judge status: Wrong Answer
H,A=map(int,input().split())
if H%A==0:
    print(H//A)
else:
    print((H/A)+1)
# Judge status: Accepted
A=int(input())
B=int(input())

l=[1,2,3]

l.remove(A)
l.remove(B)

print(l[0])
# Judge status: Accepted
from collections import deque
import sys

input = lambda: sys.stdin.readline().rstrip()

s = deque(list(input()))
q = int(input())

is_reverse = False
for i in range(q):
    query = input().split()
    if query[0] == '2':
        if (query[1] == '1' and not is_reverse) or (query[1] == '2' and is_reverse):
            s.appendleft(query[2])
        else:
            s.append(query[2])
    else:
        is_reverse = not is_reverse

result = ''.join(s)
if is_reverse:
    print(result[::-1])
else:
    print(result)
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
h=0
for i in range(1,N):
    if A[i]<A[i-1]:
        h+=A[i-1]-A[i]
        A[i]+=A[i-1]-A[i]
print(h)
# Judge status: Wrong Answer
w,a,b = map(int,input().split())
if w+a > b:
  print(0)
else:
	print(b-(a+w))
# Judge status: Wrong Answer
import itertools
import math

n = int(input())
x = []
num = []
for i in range(n):
  x.append([int(t) for t in input().split()])
  num.append(i)
ans = 0
for i in itertools.permutations(num):
  s = 0
  for j in range(n-1):
    s += math.sqrt((x[j][0] - x[j+1][0])**2 + (x[j][1] - x[j+1][1])**2)
  ans += s
ans /= n
print(ans)
# Judge status: Accepted
n = int(input())
for i in range(1,6):
    if n%(10*i) == 0:
        print(10)
        exit()
print(sum(list(map(int, str(n)))))
# Judge status: Wrong Answer
X,Y,Z=map(int,input().split())
print(X//(Y+Z))
# Judge status: Wrong Answer
from bisect import bisect_left

n = int(input())
aa = sorted(list(map(int,input().split())))
bb = sorted(list(map(int,input().split())))
cc = sorted(list(map(int,input().split())))

ans = 0
for bi in bb:  
  ans += bisect_left(aa,bi) * (n- bisect_left(cc,bi))
  
print(ans)
# Judge status: Accepted
n=int(input())
print((10**n-2*(9**n)+8**n)%(10**9+7))
# Judge status: Accepted
n=int(input())
a=int(input())
n%=500
if n>a:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
"""
author : halo2halo
date : 8, Jan, 2020
problem : ABC149
"""

import sys

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

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

x = min(A, K)
A -= x
K -= x

x = min(B, K)
B -= x

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

for i in range(N+1):
    for j in range(M+1):
        t = i*M + j*N - i*j*2
        if t==K:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
a = int(input())
b = int(input())

for i in range(1, 4):
    if i != a and i != b:
        print(i)
# Judge status: Wrong Answer
w=input()
x=dict()
for i in range(len(w)):
    if w[i] in x:
        x[w[i]]+=1
    else:
        x[w[i]]=1

for idx in x:
    if x[idx]!=2:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
a,b=input().split()
a=int(a)
b=int(b)
print(int(a+b/2))
# Judge status: Accepted
n = int(input())
s = str(input())
t = s[:n//2]
if t + t == s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
cnt = sorted([s.count("a"), s.count("b"), s.count("c")])
ans = "YES"
if cnt[1]-cnt[0] >= 2 or cnt[2]-cnt[0] >= 2 or cnt[2]-cnt[1] >= 2:
    ans = "NO"
print(ans)
# Judge status: Accepted
s = int(input())
li = []
num = 0
for i in range(1000000):
    if i == 1:
        num = s
    elif num % 2 == 0:
        num //= 2
    else:
        num = 3 * num + 1
    li.append(num)
    if li.count(num) == 2:
        print(i)
        break
# Judge status: Accepted
a, b, c = map(int, input().split())

for i in range(1, 200):
    if a*i % b == c:
        print("YES")
        exit()
print("NO")
# Judge status: Accepted
A, B, C = map(int, input().split())

tmp_A = A
for i in range(1000):
    if A % B == C:
        print("YES")
        exit()
    else:
        A += tmp_A 

print("NO")
# Judge status: Accepted
s = input()
x = ""

for i in range(len(s)):
    x += "x"

print(x)
# Judge status: Wrong Answer
S = input().rstrip()
if 'hi' in S:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = input()

def point(aite):
    if aite == "r":
        return p
    elif aite == "s":
        return r
    else:
        return s

ten = 0
kako = ["o"]*k
for i in range(n):
    if kako[i%k] == t[i]:
        kako[i%k] = "o"
    else:
        kako[i%k] = t[i]
        ten += point(t[i])

print(ten)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
if n%2==0:
    print(' '.join([str(v) for v in l[1::2][::-1]+l[::2]]))
else:
    print(' '.join([str(v) for v in l[::2][::-1]+l[1::2]]))
# Judge status: Wrong Answer
if sorted(input()) == 'abc':print('Yes')
else:print('No')
# Judge status: Accepted
ls = list(map(str, input().split()))
result = ""
for s in ls:
    result += s[0].upper()
print(result)
# Judge status: Accepted
n=int(input())
s=input()
if n<3200:
    print("red")
else:
    print(s)
# Judge status: Wrong Answer
n = int(input())
s = input()
l = 0
r = 0
flag = True
for i in range(n):
  if(s[n-1-i] == '(' and flag == True):
    continue
  elif(s[n-1-i] == ')'):
    flag = False
    r += 1
  else:
    l += 1
d1 = max(0,r-l)

l = d1
r = 0

for i in range(n):
  if(s[i] == ')'):
    r += 1
  else:
    l += 1

d2 = max(0,l-r)

for i in range(d1):
  print('(',end = '')
print(s,end='')
for i in range(d2):
  print(')',end = '')
print('')
# Judge status: Accepted
def main():
    N = int(input())
    ans = 0
    for i in range(N):
        ans = ans + i + 1
    print(ans)
main()
# Judge status: Wrong Answer
N = int(input())
P = [int(i) for i in input().split()]
num = 1

for i in range (1,N):
  if P[i] <= P[i-1]:
    num +=1
print(num)
# Judge status: Accepted
s=['a','i','o','u','e']
x=input()
falg=0
for i in s:
    if (i==x):
        falg=1
        break
if falg==0:
    print('consonant')
else:
    print("vowel")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
gap = []
for i in range(m-1):
  gap.append(l[i+1]-l[i])
gap.sort()
print(sum(gap[:1-n]))
# Judge status: Accepted
S = input()
T = input()

for i in range(len(S)):
    if T == S[i:] + S[:i]:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
print('Yes' if '9' in list(input()) else 'No')
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:21:16 2020

@author: liang
"""

#バケツソートO(n)
N, K = map(int,input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b = map(int,input().split())
    num[a] += b

tmp = 0
for i in range(N+1):
    tmp += num[i]
    if tmp >= K:
        print(i)
# Judge status: Wrong Answer
from sys import exit

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


if A == B:
    print(0)
    exit()

if abs(A - B) > 10 ** 18:
    print("Unfair")
    exit()

sign = (A - B) // abs(A - B)

print(A, B, C, sign)

if K % 2 == 0:
    print(abs(A - B) * sign)
else:
    print(abs(A - B) * sign * (-1))
# Judge status: Accepted
S=input()
A=len(S)
print("x"*A)
# Judge status: Accepted
[N, K] = [int(i) for i in input().split()]

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N, K)))
# Judge status: Accepted
#abc088 c
a=[]
for i in range(3):
    line=list(map(int,input().split()))
    a.append(line)
r=[]
g=[]
for i in range(3):
    x=a[0][i]
    r.append(x)
    y=a[i][0]-a[0][0]
    g.append(y)
g[0]=0
flag=True
for i in range(3):
    for j in range(3):
        if a[i][j]!=(g[i]+r[j]):
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
a = []
for i in range(9):
  for j in range(9):
    a.append(i * j)

print("Yes") if N in a else print("No")
# Judge status: Wrong Answer
from sys import stdin
n = int(stdin.readline().rstrip())
point = 0
for i in range(1,n+1):
    point += i
    if point >= n:
        print(i)
        if n-i != 0:
            print(n-i)
        break
# Judge status: Accepted
n = list(input())
if len(n) == 1:
    print(n[0])
    exit()
n = [int(n[i]) for i in range(len(n))]
m = set(n[1:])
if m == {9}:
    print(sum(n[1:]) + n[0])
    exit()
else:
    print(9*(len(n)-1) + n[0] -1)
# Judge status: Wrong Answer
from sys import stdin

A, B, M = (int(x) for x in stdin.readline().rstrip().split())
ai = [int(x) for x in stdin.readline().rstrip().split()]
bj = [int(x) for x in stdin.readline().rstrip().split()]

minimum = int()
for i in range(M):
    x, y, c = (int(x) for x in stdin.readline().rstrip().split())
    price = ai[x-1] + bj[y-1] - c
    if i == 0:
        minimum = price
    if price < minimum:
        minimum = price

print(minimum)
# Judge status: Accepted
nm_list = input().split(" ")

n = int(nm_list[0])
m = int(nm_list[1])

print(int(n*(n-1)/2+m*(m-1)/2))
# Judge status: Wrong Answer
s = list(input())
n = len(s)

ans = []
for i in range(n):
  if s[i] == 0:
    ans.append('0')
  elif s[i] == 1:
    ans.append('1')
  elif ans == []:
    continue
  else:
    ans.pop()
    
print(''.join(ans))
# Judge status: Accepted
n, l = map(int, input().split())
taste = []
for i in range(1, n + 1):
    taste.append(l + i - 1)
m = 1000
for i in range(n):
    if abs(taste[i]) < m:
        m = abs(taste[i])
        eat = taste[i]
print(sum(taste) - eat)
# Judge status: Wrong Answer
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
values,count=zip(*ans.items())
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])
# Judge status: Wrong Answer
s = list(input())

count = 0
for i in range(0, 2):
    if s[i] == s[i+1]:
        count += 1

if count == 0:
    print('Good')
else:
    print('Bad')
# Judge status: Wrong Answer
count, way = list(map(int, input().split()))
height = list(map(int, input().split()))
isGood = [True] * count

for i in range(way):
    obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))
    if(height[obs_a] > height[obs_b]):
        isGood[obs_b] = False
    else:
        isGood[obs_a] = False

print(isGood)
# Judge status: Wrong Answer
x,a,b = map(int,input().split())
aa = abs(x-a)
bb = abs(x-b)
print(min(aa,bb))
# Judge status: Wrong Answer
import sys

n = int(input())
s = input()

if(n % 2 == 1):
  print('No')
else:
  for i in range(n//2 - 1):
    if(s[i] != s[n//2 + i]):
      print('No')
      sys.exit()

  print('Yes')
# Judge status: Accepted
import math
a,b,x = map(int,input().split())
l = 2/a**2*(a**2*b-x)
if x >= a**2*b/2:
  if l != 0:
    print(90-math.degrees(math.atan(a/l)))
  else:
    print(0)
else:
  k = 2*x/(b*a)
  print(90-math.degrees(math.atan(k/b)))
# Judge status: Accepted
s=[int(input())]
i=2
while(1):
  j=s[-1]
   
  if j%2:
    f=3*j+1
  else:
    f=j//2
  if s.count(f):
    break
  else:
    s.append(f)
    i+=1
print(i)
# Judge status: Accepted
S=input()
a=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=="<":
        a[i+1]=max(a[i+1],a[i]+1)
for i in range(len(S)-1,-1,-1):
    if S[i]==">":
        a[i]=max(a[i],a[i+1]+1)
print(sum(a))
# Judge status: Wrong Answer
n=int(input())
s = list()
count=0
for i in range(n):
  a = input()
  if not(a in s):
    s.append(s)
    count+=1
print(count)
# Judge status: Accepted
n=int(input())
for i in range(50000):
    if(int(i*1.08)==n):
        print(i)
        exit()
print(':(')
# Judge status: Accepted
if __name__ == "__main__":
    X = int(input())
    U = 0
    U += (X // 500) * 1000
    X = X % 500
    U += (X // 5) * 5

    print(U)
# Judge status: Accepted
import math
n,d=map(int,input().split())
x = []
for _ in range(n):
    l = list(map(int, input().split()))
    x.append(l)
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        tmp = 0
        for k in range(d):
            tmp += (x[i][k] - x[j][k])**2
        if math.sqrt(tmp) == int(math.sqrt(tmp)):
            cnt += 1
print(cnt)