Harryxun/stf_run huggingface dataset:
def judge(board):
    for i in range(0, 3):
        if board[i][0] == board[i][1] == board[i][2] == 0 :
            return True
        if board[0][i] == board[1][i] == board[2][i] == 0:
            return True
    
    if board[0][0] == board[1][1] == board[2][2] == 0:
        return True
    if board[0][2] == board[1][1] == borad[2][0] == 0:
        return True
    
    return False


upper  = list(map(int, input().split(" ")))
middle = list(map(int, input().split(" ")))
lower  = list(map(int, input().split(" ")))

board = (upper,middle,lower)

N = int(input())
bingos = list()

for i in range(0, N):
    bingos.append(int(input()))

for i in range(0, len(bingos)):
    for j in range(0, 3):
        if upper[j] == bingos[i]:
            board[0][j] = 0
            break
        elif middle[j] == bingos[i]:
            board[1][j] = 0
            break
        elif lower[j] == bingos[i]:
            board[2][j] = 0
            break
        else:
            pass

if judge(board):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

def judge(board):
    for i in range(0, 3):
        if board[i][0] == board[i][1] == board[i][2] == 0 :
            return True
        if board[0][i] == board[1][i] == board[2][i] == 0:
            return True
    
    if board[0][0] == board[1][1] == board[2][2] == 0:
        return True
    if board[0][2] == board[1][1] == board[2][0] == 0:
        return True
    
    return False


upper  = list(map(int, input().split(" ")))
middle = list(map(int, input().split(" ")))
lower  = list(map(int, input().split(" ")))

board = (upper,middle,lower)

N = int(input())
bingos = list()

for i in range(0, N):
    bingos.append(int(input()))


"""
print(upper)
print(middle)
print(lower)
print(bingos)

for i in range(3):
    for j in range(3):
        print(f'board[', i, '][', j, '] =', board[i][j])
"""

for i in range(0, len(bingos)):
    for j in range(0, 3):
#        print('bingos[i] : j = ', bingos[i], j)
        if upper[j] == bingos[i]:
            board[0][j] = 0
#            print('find in upper')
            break
        elif middle[j] == bingos[i]:
            board[1][j] = 0
#            print('find in middle')
            break
        elif lower[j] == bingos[i]:
            board[2][j] = 0
#            print('find in lower')
            break
        else:
            pass
#    print('')

if judge(board):
    print('Yes')
else:
    print('No')
N = int(input())
A = list(map(int, input().split()))
A.sort()

# range=A[N-1]-A[0]

range = 0

for i in range(N):
    for j in range(i+1,N):
        x = A[j]-A[i]
        range = max([range,x])

print(range)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()

range=A[N-1]-A[0]

print(range)
S=input()
if S.index(2)==S.index(3) and S.index(4)==S.index(5):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S=input()
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
n,m=map(int,input().split())
prnt((n-1)*(m-1))

### FIXED CODE ###

n,m=map(int,input().split());print(~-m*~-n)
N, K = map(int, input().split())

A = input("").split(" ")
A = [int(i) for i in A]


for i in range(1, N-K+1):
    score = 1
    p_score = 1

    for j in range(i, i+K):
        score = score * A[j]
        p_score = p_score * A[j-1]

    if score > p_score:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N = int(input(""))

if N >= 1800:
    print("1")
elif N >= 1600:
    print("2")
elif N >= 1400:
    print("3")
elif N >= 1200:
    print("4")
elif N >= 1000:
    print("5")
elif N >= 800:
    print("6")
elif N >= 600:
    print("7")
elif N >= 400:
    print("8")
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=0
for i in range(m+1):
  p,c=input().split()
  if c=='AC' and ac[int(p)]==0:
    ac[int(p)]=1
  elif c=='WA' and ac[int(p)]==0:
    wa+=1
print(ac.count(1),wa)

### FIXED CODE ###

n, m = map(int, input().split())

ac = 0
wa = 0
res1 = [0]*n
res2 = [0]*n
for i in range(m):
  p, s = list(map(str, input().split()))
  if s == 'AC' and res1[int(p)-1] == 0:
    ac += 1
    res1[int(p)-1] = 1
    wa += res2[int(p)-1]
  elif s == 'WA' and res1[int(p)-1] == 0:
    res2[int(p)-1] += 1
print(ac, wa)
N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N:
    if a[N-i-1] >= a[N-i-2]:
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')

### FIXED CODE ###

N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N-1:
    if a[N-i-1] >= a[N-i-2]:
      continue
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')
n, k = map(int, input().split())
td = sorted([list(map(int, input().split())) for i in range(n)], reverse=True, key=lambda x: x[1])

type = set()
L = []
Sum = 0
for x in td[:k]:
    Sum += x[1]
    if x[0] not in type:
        type.add(x[0])
    else:
        L.append(x[1])

L = L[::-1]
type_cnt = len(type)
ans = Sum + type_cnt ** 2
for x in td[k:]:
    if x[0] not in type:
        type.add(x[0])
        type_cnt += 1
        Sum = Sum - L.pop(0) + x[1]
        ans = max(ans, Sum + type_cnt ** 2)
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
td = sorted([list(map(int, input().split())) for i in range(n)], reverse=True, key=lambda x: x[1])

type = set()
L = []
Sum = 0
for x in td[:k]:
    Sum += x[1]
    if x[0] not in type:
        type.add(x[0])
    else:
        L.append(x[1])

L = L[::-1]
type_cnt = len(type)
ans = Sum + type_cnt ** 2
for x in td[k:]:
    if len(L)==0:break
    if x[0] not in type:
        type.add(x[0])
        type_cnt += 1
        Sum = Sum - L.pop(0) + x[1]
        ans = max(ans, Sum + type_cnt ** 2)
print(ans)
def rem(x,r):
  if x <= 2*r:
    return -1
  ret = []
  for i in range(1,x):
    if x%i == r:
      ret.append([i])
    else:
      s = rem(x%i,r)
      if s == -1:
        continue
      else:
        for j in s:
          if j == -1:
            continue
          elif j[-1] < i:
            ret.append([i]+j)
          else:
            ret.append([i]+j)
  return ret
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for xx,yy in zip(x,y):
  if xx != yy and rem(xx,yy) == -1:
    print(-1)
    exit()
ls = [rem(xx,yy) if xx != yy else 0 for xx,yy in zip(x,y)]
mxls = [ls[i][0][0] if type(ls[i]) == list else 0 for i in range(n)]
mx = max(mxls)
ansst = set()
ansst.add(mx)
flg = [0]*n
while True:
  for i in range(n):
    if mxls[i] == mx or x[i]%mx == y[i]:
      flg[i] = 1
      mxls[i] = 0
      continue
    r = rem(x[i]%mx,y[i])
    if r != -1 and r[0][0] <= mxls[i]:
      mxls[i] = r[0][0]
      x[i] %= mx
  mx = max(mxls)
  ansst.add(mx)
  if flg.count(1) == n:
    break
ans = -1
for b in ansst:
  ans += 2**b
print(ans)

### FIXED CODE ###

def rem(x,r):
  if (x,r) == (1,0):
    return [[1]]
  if x <= 2*r:
    return -1
  ret = []
  for i in range(1,x+1):
    if x%i == r:
      ret.append([i])
    else:
      s = rem(x%i,r)
      if s == -1:
        continue
      else:
        for j in s:
          if j == -1:
            continue
          elif j[-1] < i:
            ret.append([i]+j)
          else:
            ret.append([i]+j)
  return ret
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for xx,yy in zip(x,y):
  if xx != yy and rem(xx,yy) == -1:
    print(-1)
    exit()
ls = [rem(xx,yy) if xx != yy else 0 for xx,yy in zip(x,y)]
flg = [0]*n
def findmx(lsi,ansst,mx):
  ret = 100
  if lsi == 0:
    return 0
  for lsls in lsi:
    for j in lsls:
      if j > mx:
        return min(j,ret)
      elif j in ansst:
        continue
      else:
        ret = min(j,ret)
        break
    else:
      return 0
  else:
    return ret
    
mxls = [ls[i][0][0] if type(ls[i]) == list else 0 for i in range(n)]
mx = max(mxls)
ansst = set((mx,))
mxcand = mx
while mxcand:
  for i in range(n):
    t = findmx(ls[i],ansst,mx)
    mxls[i] = t
    if t == 0:
      flg[i] = 1
  mxcand = max(mxls)
  ansst.add(mxcand)
  if flg.count(1) == n:
    break
ans = 0
for b in ansst:
  if b:
    ans += 2**b
print(ans)
S=input()
N=len(S)

c=S.index("C")
S=S[::-1]
f=N-S.index("F")-1
#print(c,f)

print("Yes" if c<f else "No")



### FIXED CODE ###

S=input()
N=len(S)

if "C" in S and "F" in S:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")
else: 
  print("No")
a=input()
b=input()
c=input()
  
a=int(a)
b=int(b)
c=int(c)
x=int(x)

x=b//a:
  
if x>=c:
  print(c)
else :
  print(x)


### FIXED CODE ###

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

x=b//a
x=int(x)

if x>=c:
  print(c)
else :
  print(x)
alpha = 'abcdefghijklmnopqrstuvwxy'
if __name__=='__main__':
    s=input()
    i = alpha.index(s)
    print(alpha[i+1])

### FIXED CODE ###

alpha = 'abcdefghijklmnopqrstuvwxyz'
if __name__=='__main__':
    print(alpha[1+alpha.index(input())])
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0)%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=dp(index+1)+dp(index+2)
    return memo[index]

main()


### FIXED CODE ###

# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in A:
        ban[a]=True
    mod=1000000007
    for a in range(1,N+1):
        if ban[a]:
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


main()
r = input()
ans = r *= 2
print(ans)

### FIXED CODE ###

r = int(input())
ans = r ** 2
print(ans)
N,M=[int(i) for i in input().split()]
A=list(int(input()))
for i in range(M):
    if A[i]>1/(4*M):
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

N,M=(int(i) for i in input().split())
A=list(map(int,input().split()))
S=len(A)
mono=0
soutoku=0
for i in range(S):
    soutoku=soutoku+A[i]
for i in range(S):
    if A[i]>=soutoku/(4*M):
        mono=mono+1
if mono>=M:
    print("Yes")
else:
    print("No")
A,B,C,D,E,F=map(int,input().split())
best_water=0
best_salt=0
best_rate=0
for i in range(30//A+1):#Aの投入数
  for j in range(30//B+1):#Bの投入数
    water=(i*A+j*B)*100
    if water<=F and water:
      max_salt=(i*A+j*B)*E
      for k in range(max_salt//C+1):#Cを何個使うか
        l=(max_salt-C*k)//D#Dは何個つかえるか
        salt=k*C+l*D
        rate=100*salt/(water+salt)
        if rate>best_rate and rate<E and water+salt <=F:
          best_rate=rate
          best_salt=salt
          best_water=water
print(best_water+best_salt,best_salt)

### FIXED CODE ###

N=int(input())
K=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(N):
  ans+=min(x[i],abs(K-x[i]))
print(2*ans)
import math

N = int(input())
h = list(map(int, input().split()))
cost_list = [math.inf for _ in range(N)]
cost_list[0]  = 0

for i in range(1, N):
    if cost_list[i] > (cost_list[i-1] + abs(h[i] - h[i-1])):
        cost_list[i] = cost_list[i-1] + abs(h[i]-h[i-1])

    if i > 1:
        if cost_list[i] > (cost_list[i-2] + abs(h[i] - h[i-2])):
            cost_list[i] = cost_list[i-2] + abs(h[i]-h[i-2])

print(cost_list[N-1])


### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
cost_list = [float('inf') for _ in range(N)]
cost_list[0]  = 0

for i in range(1, N):
    if cost_list[i] > (cost_list[i-1] + abs(h[i] - h[i-1])):
        cost_list[i] = cost_list[i-1] + abs(h[i]-h[i-1])

    if i > 1:
        if cost_list[i] > (cost_list[i-2] + abs(h[i] - h[i-2])):
            cost_list[i] = cost_list[i-2] + abs(h[i]-h[i-2])

print(cost_list[N-1])
# https://atcoder.jp/contests/abc075/tasks/abc075_c
class UnionFind():
    def __init__(self, N):
        self._root = [-1 for _ in range(N)]

    def find(self, x):
        if self._root[x] < 0: return x
        self._root[x] == self.find(self._root[x])
        return self._root[x]

    def unite(self, x, y):
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy: return False
        if self._root[gx] > self._root[gy]:
            gx, gy = gy, gx
        self._root[gx] += self._root[gy]
        self._root[gy] = gx
        return True

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

    def size(self, x):
        return -(self._root[self.find(x)])

    def roots(self):
        return [i for i, x in enumerate(self._root) if x < 0]


n, m = map(int, input().split())

nodes = []
for _ in range(m):
    a, b = map(int, input().split())
    nodes.append((a, b))

cnt = 0
for i in range(m):
    uf = UnionFind(n)
    for j in range(m):
        if i != j:
           uf.unite(nodes[j][0]-1, nodes[j][1]-1)
    cnt += (len(uf.roots()) != 1)
print(cnt)

### FIXED CODE ###

# https://atcoder.jp/contests/abc075/tasks/abc075_c
class UnionFind():
    def __init__(self, N):
        self._root = [-1 for _ in range(N)]

    def find(self, x):
        if self._root[x] < 0: return x
        self._root[x] = self.find(self._root[x])
        return self._root[x]

    def unite(self, x, y):
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy: return False
        if self._root[gx] > self._root[gy]:
            gx, gy = gy, gx
        self._root[gx] += self._root[gy]
        self._root[gy] = gx
        return True

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

    def size(self, x):
        return -(self._root[self.find(x)])

    def roots(self):
        return [i for i in self._root if i < 0]


n, m = map(int, input().split())

nodes = []
for _ in range(m):
    a, b = map(int, input().split())
    nodes.append((a, b))

cnt = 0
for i in range(m):
    uf = UnionFind(n)
    for j in range(m):
        if i != j:
          uf.unite(nodes[j][0]-1, nodes[j][1]-1)
    cnt += (len(uf.roots()) != 1)
print(cnt)
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
    print(0)
    exit()
for i in range(m-1):
    ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
for i in range(n-1):
    total+=ans[i]
print(sum(ans)-total)


### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
    print(0)
    exit()
if n==1:
    print(max(a)-min(a))
    exit()
for i in range(m-1):
    ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
if len(ans)<=n:
    print(0)
    exit()
for i in range(n-1):
    total+=ans[i]
print(sum(ans)-total)
#ABC 147 C 「Honest or Unkind」

n=int(input())
ans=0
A=[[] for _ in range(n)]

for i in range(n):
    a=int(input())
    for j in range(a):
        A[i].append(tuple(map(int,input().split())))
        
#-------------------------------------------------------------iをn桁２進数表記（[2:]で0bを切って、zfill()で左揃えへ）
for i in range(2**n):
    ii=str(bin(i))[2:].zfill(n)
#-------------------------------------------------------------#i個目の場合が証言をみたすか調べる：2**n個の組み合わせ
    chk=True
    cur=0
 
    for j in range(n):　　　　　　　　　　　　　　　　　　　　　  #j個目の証言を満たすか調べる
        if ii[j]=="0":
            continue
        else:
            cur+=1　　　　　　　　　　　　　　　　　　　　　　　  #Count up 
            for x,y in A[j]:                                  #turpleで(x,y)を指定する
                if y==1 and ii[x-1]=="0":                     #Aとiiを比較
                    chk=False                                 #違っていたらFalseへ
                elif y==0 and ii[x-1]=="1":
                    chk=False
    if chk:　　　　　　　　　　　　　　　　　　　　　　　　　　　　#もしChk = Trueのままだったらn個全ての証言をみたすので、これまでのマックスと比べる
        ans=max(ans,cur)
print(ans)

### FIXED CODE ###

#ABC 147 C 「Honest or Unkind」

n=int(input())
ans=0
A=[[] for _ in range(n)]

for i in range(n):
    a=int(input())
    for j in range(a):
        A[i].append(tuple(map(int,input().split())))
        
#-------------------------------------------------------------iをn桁２進数表記（[2:]で0bを切って、zfill()で左揃えへ）
for i in range(2**n):
    ii=str(bin(i))[2:].zfill(n)
#-------------------------------------------------------------#i個目の場合が証言をみたすか調べる：2**n個の組み合わせ
    chk=True
    cur=0
 
    for j in range(n):                                        #j個目の証言を満たすか調べる        
        if ii[j]=="0":
            continue
        else:
            cur+=1                                            #Count up 
            for x,y in A[j]:                                  #turpleで(x,y)を指定する
                if y==1 and ii[x-1]=="0":                     #Aとiiを比較
                    chk=False                                 #違っていたらFalseへ
                elif y==0 and ii[x-1]=="1":
                    chk=False
    if chk:                                                   #もしChk = Trueのままだったらn個全ての証言をみたすので、これまでのマックスと比べる
        ans=max(ans,cur)
print(ans)
A = input()
B = input()
C = input()

if A>=B and B>=C:
    print(int(A+B)+int(C))
elif B>A and A>C:
    print(int(B+A)+int(C))
elif A>C and C>B:
    print(int(A+C)+int(B))
elif C>B and B>A:
    print(int(C+B)+int(A))
elif B>C and B>A:
    print(int(B+C)+int(A))
else:
    print(int(C+A)+int(B))

### FIXED CODE ###

abc = list(map(int,input().split()))
abc.sort()
print(abc[0]+int(str(abc[2])+str(abc[1])))
n,p = map(int,input().split())
a = list(map(int,list(input())))
ans = 0
if p == 2:
  for i in range(n):
    if a[i]%2==0:
      ans += i+1
elif p == 5:
  for i in range(n):
    if a[i]==5 or a[i]==0:
      ans += i+1
else:
  b = 0
  c = [0 for i in range(p)]
  c[0] = 1
  for i in range(n):
    b = (b[i]+pow(a[i],n-i,p))%p
    c[b] += 1
c = list(map(lambda x:x*(x+1)//2,c))
ans = sum(c)
print(ans)
    


  

### FIXED CODE ###

n,p = map(int,input().split())
a = list(map(int,list(input())))
ans = 0
if p == 2:
  for i in range(n):
    if a[i]%2==0:
      ans += i+1
elif p == 5:
  for i in range(n):
    if a[i]==5 or a[i]==0:
      ans += i+1
else:
  b = 0
  c = [0 for i in range(p)]
  c[0] = 1
  for i in range(n):
    b = (b+pow(10,n-i,p)*a[i])%p
    c[b] += 1
  c = list(map(lambda x:x*(x-1)//2,c))
  ans = sum(c)
print(ans)
from collections import deque


n, m = map(int, input().split())

g = [[] for i in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

dist = [-1] * n
prev = [-1] * n
que = deque([0])
dist[0] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for w in g[v]:
        if dist[w] > -1:
            continue
        dist[w] = d + 1
        que.append(w)
        prev[w] = v

print("Yes")
for i in prev[1:]:
    print(i + 1)

### FIXED CODE ###

from collections import deque


n, m = map(int, input().split())

g = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

dist = [-1] * n
prev = [-1] * n
que = deque([0])
dist[0] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for w in g[v]:
        if dist[w] > -1:
            continue
        dist[w] = d + 1
        que.append(w)
        prev[w] = v

print("Yes")
for i in prev[1:]:
    print(i + 1)
import math

stri = input()
ary = stri.split()
n:int = int(ary[0])
k:int = int(ary[1])

ans1:int =int( 1 * (n-k +1 ))
ansi:int = int(ans1)
print(ansi)

for i in range(2,k+1):
    ansi = ansi * (k- i + 1) / ( i - 1 ) *  (n-k - i + 2) / i 
    print(int(ansi % 1000000007))

### FIXED CODE ###

import math
 
stri = input()
ary = stri.split()
n = int(ary[0])
k = int(ary[1])
 
ans1 = 1 * (n-k +1 )
ansi = 0
ansi = int(ans1)
print(ansi)
for i in range(2,k+1):
    ansi = ansi * (k- i + 1) // int( i - 1 ) *  (n-k - i + 2) // int(i) 
    type(ansi)
    print(int(ansi % int(1000000007)))
if __name__ == '__main__':
	n,m,x,y = map(int,input().split())
	X = list(map(int,input().split()))
	Y = list(map(int,input().split()))
 
	x_max = max(X)
	y_min = min(Y)
 
 	flg = False
	for Z in range(x+1,y+1):
		if x_max < Z and Z <= y_min:
			flg = True
			break

	if flg :
		print("No war")
	else:
		print("War")
 

### FIXED CODE ###

if __name__ == '__main__':
	n,m,X,Y = map(int,input().split())
	x = list(map(int,input().split()))
	y = list(map(int,input().split()))
 
	x_max = max(x)
	y_min = min(y)

	flg = False
	for Z in range(X+1,Y+1):
		if x_max < Z <= y_min:
			flg = True
			break

	if flg:
		print("No War")
	else:
		print("War")
def summation(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return n + summation(n-1)


def main():
    a,b = map(int, input().split())
    
    n_plus1 = b-a
    
    ans = summation(n_plus1) - b
    
    print(ans)
    
    return 0

    
if __name__ == "__main__":
    main()

### FIXED CODE ###

def summation(n):
    ans = 0
    for i in range(n+1):
        ans += i
        
    return ans


def main():
    a,b = map(int, input().split())
    
    n_plus1 = b-a
    
    ans = summation(n_plus1) - b
    
    print(ans)
    
    return 0

    
if __name__ == "__main__":
    main()
a, b, c, k =map(int, input().split())
if k<=a+b:
  print(a)
else:
  print(a-(k-(a+b))

### FIXED CODE ###

a, b, c, k =map(int, input().split())
if k <a:
  print(k)
elif k<=a+b:
  print(a)
else:
  print(a-(k-(a+b)))
print(sum(list(map(int, list(input())))))

### FIXED CODE ###

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

if (a*b) % 2 == 0:
	print('Even')
else:
	print('Odd')
a, b, c = map(int, input(),split())

print((a*b)//2)

### FIXED CODE ###

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

print((a*b)//2)
list = [a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z]

C = str(input())

print(list[(list.index(C)+1)%len(list)])

### FIXED CODE ###

list = ['a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

C = str(input())

print(list[(list.index(C)+1)%len(list)])
n, m = map(int, input().split())
set_A = set()
dp = [0]*n
mod = pow(10, 9) + 7

for _ in range(m):
    set_A.add(int(input()))

if 1 not in set_A:
    dp[0] = 1
if 2 not in set_A:
    dp[1] = 1 + dp[0]

for i in range(2, n):
    if i + 1 not in set_A:
        dp[i] += (dp[i-1] + dp[i-2])%mod

print(dp[n-1])

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
a, b = map(int, raw_input().split())
print('%d %d' % (a*b, (a+b)*2)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b, 2*(a+b))
import sys
input = sys.stdin.readline

n, q = map(int, input().split())

root = {}
for i in range(n-1):
    a, b = map(int, input().split())
    root.setdefault(a, []).append(b)
    root.setdefault(b, []).append(a)
    
cnt = [0] * (n+1)
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

check = []
def rec(node, checked):
    for k in root[node]:
        if not k in checked:
            cnt[k] += cnt[node]
            if not node in checked:
                checked.append(node)
            rec(k, checked)

rec(1, check)
print(" ".join(map(str, cnt[1:])))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(300000)

n, q = map(int, input().split())

root = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
    
cnt = [0 for _ in range(n+1)]
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

def rec(node, parent):
    for i in root[node]:
        if i == parent:
            continue
        cnt[i] += cnt[node]
        rec(i, node)

rec(1, 1)
print(" ".join(map(str, cnt[1:])))