Harryxun/stf_run huggingface dataset:
S_ = input()
T = input()
ans = list(S_)
for i in range(len(T)):
    if T[i] in S_:
        prev = len(S_)
        while(1):
            id = S_.rfind(T[i], 0, prev-1)
            if id < 0:
                break
            prev = id
            flag = True
            for j in range(i+1, len(T)):
                if S_[id + j - i] == T[i] or S_[id + j - i] == "?":
                    continue
                else:
                    flag = False
                    break
                for j in reversed(range(i)):
                    if S_[id - j - 1] == T[i - j - 1] or S_[id - j - 1] == "?":
                        continue
                    else:
                        flag = False
                        break
            if flag:
                ans[id - i:id - i + len(T)] = T
                for i in range(len(ans)):
                    if ans[i] == "?":
                        ans[i] = "a"
                print("".join(ans))
                exit(0)


print("UNRESTORABLE")


### FIXED CODE ###

S_ = input()
T = input()
ans = list(S_)


def check(S1, S2):
    for i in range(len(S1)):
        if S1[i] == S2[i] or S1[i] == "?":
            continue
        else:
            return(False)

    return(True)


for i in reversed(range(len(S_) - len(T) + 1)):
    result = check(S_[i:i+len(T)], T)
    if result:
        for j in range(len(T)):
            ans[i+j] = T[j]
        for j in range(len(ans)):
            if ans[j] == "?":
                ans[j] = "a"
        print("".join(ans))

        exit(0)

print("UNRESTORABLE")
# -*- coding: utf-8 -*-
import sys


def func_a(argv):
    A = int(argv[0]) if int(argv[0]) >= 1 else 0
    B = int(argv[1]) if int(argv[1]) <= 20 else 0

    if A * B == 0:
        pass
    else:
        if B % A == 0:
            print(A + B)
        else:
            print(B - A)


if __name__ == "__main__":
    func_a(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-

def func_a():
  argv = input().split(" ")
  A = int(argv[0]) if int(argv[0]) >= 1 else 0
  B = int(argv[1]) if int(argv[1]) <= 20 else 0

  if A * B == 0:
    pass
  else:
    if B % A == 0:
      print(A + B)
    else:
      print(B - A)


if __name__ == "__main__":
  func_a()
intCount = 0

for idx in range(1, n+1):
    if len(str(idx) % 2 == 1:
        intCount += 1

print(intCount)

### FIXED CODE ###

n = int(input())

if n < 10:  # < 10^1
    # 1-n
    print(n)

elif n < 100:  # < 10^2
    # 1-9
    print(9)

elif n < 1000:  # < 10^3
    # 1-9, 100-n
    print(n-99+9)

elif n < 10000:  # < 10^4
    # 1-9, 100-999
    print(9+900)

elif n < 100000:  # < 10^5
    # 1-9 + 100-999 + 10000-n
    print(n-9999+900+9)

else:  # == 10^5
    # 1-9 + 100-999 + 10000-90000
    print(9+900+90000)
n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp < n:
        ans += n//tmp
        tmp *= 5
print(ans)

### FIXED CODE ###

n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp <= n:
        ans += n//tmp
        tmp *= 5
    print(ans)
n = int(input())
a = list(map(int, input().split()))
l = [0] * n
for i in a:
    l[i-1] += 1
    
al = 0
for i in l:
    al += i*(i-1)//2

for k in range(n):
    print(al - (l[a[k]] - 1))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
l = [0] * n
for i in a:
    l[i-1] += 1
    
al = 0
for i in l:
    al += i*(i-1)//2

for k in range(n):
    print(al - (l[a[k]-1] - 1))
n = int(input())
s = input()
count = 0

for i in range(n):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

### FIXED CODE ###

n = int(input())
s = input()
count = 0

for i in range(n-2):
    #print(s[i],s[i+1],s[i+2])
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)
While True:
    nums= input(),split()
    a = int(nums[0])
    op = nums[1]
    b = int(nums[2])

    if op == '?':
        break

    if op == '+':
        print(a + b)

    if op == '-':
        print(a - b)

    if op == '*':
        print(a * b)

    if op == '/':
        print(a // b)

### FIXED CODE ###

while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]

    if op == '?':
        break

    if op == '+':
        print(a + b)

    if op == '-':
        print(a - b)

    if op == '*':
        i = a * b
        print(a * b)

    if op == '/':
        print(a // b)
import math 

N2,M1 = map(int, input().split())
count=0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N2!=0:
    count += combinations_count(N2,2)
if M1!=0:
    count += combinations_count(M1,2)

print(count)

### FIXED CODE ###

import math 

N2,M1 = map(int, input().split())
count=0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N2!=0 and N2!=1:
    count += combinations_count(N2,2)
if M1!=0 and M1!=1:
    count += combinations_count(M1,2)

print(count)
n = int(input())
a = list(map(int,input().split()))
a.sort()
a = a[::-1]
s = set(a)
s = list(s)
t = set()
for i in range(len(s)):
    if a.count(s[i]) >= 4 and len(t) == 0:
        print(s[i]**2)
        exit()
    elif a.count(s[i]) >= 2:
        t.get(s[i])
        if len(t) >= 2:
            print(t[0]*t[1])
            exit()

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
a = a[::-1]
i = 0
c = 0
m = list()
while i < n-1:
    if a[i]==a[i+1]:
        m.append(a[i])
        i += 1
        c += 1
    i += 1
    if c == 2:
        break
if c == 2:
    print(m[0]*m[1])
else:
    print(0)
N=int(input())

for n in range(1,N+1):
    count=0
    for x in range(1,(n+1)/3):
        for y in range(1,(n+1)/3):
            for z in range(1,(n+1)/3):
                if (x+y+z)**2-(x*y+y*z+z*x)==n:
                    count=count+1
    print(count)








### FIXED CODE ###

N=int(input())

a=[0]*10**4

for x in range(1,100):
     for y in range(1,100):
         for z in range(1,100):
             n=(x+y+z)**2-(x*y+y*z+z*x)
             if n<=10000:
                 a[n-1]+=1

for n in range(N):
    print(a[n])
LL = [int(i) for i in input().split()]
H = LL[0]
W = LL[1]
A = LL[2]
B = LL[3]

Math = [[0 for a in range(W)] for b in range(H)] 

for i in range(A):
    for j in range(B):
        Math[i][j] = 1

for i in range(W - A):
    for j in range(H - B):
        Math[W - i][H -B] = 1

for i in range(H):
    print(*Math) 

### FIXED CODE ###

h, w, a, b = map(int, input().split())
for i in range(b):
    for j in range(a):
        print(0, end='')
    for j in range(w - a):
        print(1, end='')
    print()
for i in range(h - b):
    for j in range(a):
        print(1, end='')
    for j in range(w - a):
        print(0, end='')
    print()
N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		m1 = match_dict[(x,y)]
		m2 = match_dict[(z,w)]
		edge[m1].append(m2)
		parent[m2].append(m1)
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
depth = [-1 for i in range(M)]


day = 0
while len(candidate) > 0:0
	new_candidate = []
	for c in candidate:
		finish[c] = True
		for e in edge[c]:
			parent[e].remove(c)
			if len(parent[e]) == 0:
				new_candidate.append(e)
		edge[c] = []
	candidate = new_candidate
	day += 1
print(day if all(finish) else -1)

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		m1 = match_dict[(x,y)]
		m2 = match_dict[(z,w)]
		edge[m1].append(m2)
		parent[m2].append(m1)
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
depth = [-1 for i in range(M)]


day = 0
while len(candidate) > 0:
	new_candidate = []
	for c in candidate:
		finish[c] = True
		for e in edge[c]:
			parent[e].remove(c)
			if len(parent[e]) == 0:
				new_candidate.append(e)
		edge[c] = []
	candidate = new_candidate
	day += 1
print(day if all(finish) else -1)
,b = input().strip().split()
if a % b == 0:
  print("Even") 
else:
  print("Odd")


### FIXED CODE ###

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

multi = a * b

if multi % 2 == 0:
    print("Even")
else:
    print("Odd")
a,b = [int(x) for x in input().split()]     
    if a <= b:
        print(a)
    if a > b:
        print(a-1)
     

### FIXED CODE ###

a,b = [int(x) for x in input().split()]     
if a <= b:
    print(a)
else:
    print(a-1)
H = int(input())
A = int(input())
if H % A == 0:
  print(H//A)
else:
  print(H//A + 1)
return

### FIXED CODE ###

D = list(map(int, input().split()))
H,A = D[0], D[1]

if( H%A == 0):
    print(H//A)
else:
    print(H//A + 1)
def bs_left(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ) :
        mid = (low + high)//2
        if lists[mid]  < item:
            low = mid +1
            
        else:
            high = mid
            
    return low

def bs_right(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ):
        mid = (low + high)//2
        if lists[mid] > item:
            high = mid 
            
        else:
            low = mid+1
            
    return len(lists) - low
  

Code
n = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
​
count = 0
A.sort(), B.sort(), C.sort()
for b in B:
    count += (bs_left(A, b) * bs_right(C, b))
    
print(count)


### FIXED CODE ###

def bs_left(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ) :
        mid = (low + high)//2
        if lists[mid]  < item:
            low = mid +1
            
        else:
            high = mid
            
    return low

def bs_right(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ):
        mid = (low + high)//2
        if lists[mid] > item:
            high = mid 
            
        else:
            low = mid+1
            
    return len(lists) - low
  
n = int(input())
A = [int(x) for x in input().split()]
B =[int(x) for x in input().split()]
C =[int(x) for x in input().split()]

count = 0
A.sort(), B.sort(), C.sort()
for b in B:
    count += (bs_left(A, b) * bs_right(C, b))
    
print(count)
n = int(input())
cards = [s + " " + str(i) for i in range(1,14)] for s in ["S","H","C","D"]
for _ in range(n):
    suit, num = input().split(" ")
    if suit == "S":
        cards[0][int(num) - 1] = 0
    elif suit == "H":
        cards[1][int(num) - 1] = 0
    elif suit == "C":
        cards[2][int(num) - 1] = 0
    elif suit == "D":
        cards[3][int(num) - 1] = 0
for s in cards:
    for i in s:
        if i != 0:
            print(i)

### FIXED CODE ###

n = int(input())
cards =[ [s + " " + str(i) for i in range(1,14)] for s in ["S","H","C","D"]]
for _ in range(n):
    suit, num = input().split(" ")
    if suit == "S":
        cards[0][int(num) - 1] = 0
    elif suit == "H":
        cards[1][int(num) - 1] = 0
    elif suit == "C":
        cards[2][int(num) - 1] = 0
    elif suit == "D":
        cards[3][int(num) - 1] = 0
for s in cards:
    for i in s:
        if i != 0:
            print(i)
for i range(1,int(int(input())**0.5)+1):
    if N%i==0 and N//i<=9:
        print('Yes')
else:print('No')


### FIXED CODE ###

N=int(input())
for i in range(1,10):
    if N%i==0 and N//i<=9:
        print('Yes')
        break
else:print('No')
import numpy as np
N,Q = map(int,input().split())
ans = np.array([0]*N)
test = np.array([1]*N)
test = np.diag(test)
for i in range(1,N):
    ai,bi = map(int,input().split())
    test[ai-1,bi-1]+=1

for k in reversed(range(N)):
    check = np.where(test[k] > 0)
    test[k]+=np.sum(test[check],axis=0)
test = np.where(test > 0,1,0)

for j in range(Q):
    pj,xj = map(int,input().split())
    ans += test[pj-1]*xj

print(' '.join(map(str,ans)))

### FIXED CODE ###

N,Q = map(int,input().split())
ans = [0]*N
ab = []
for i in range(1,N):
    ab.append(list(map(int,input().split())))
for j in range(Q):
    pj,xj = map(int,input().split())
    ans[pj-1] += xj
ab.sort()
for i in range(N-1):
    ans[ab[i][1]-1]+=ans[ab[i][0]-1]
print(' '.join(map(str,ans)))
s=list(input())
a="AKIHABARA"
n=len(a)
m=len(s)
j=0
for i in range(n):
  if s[j]==a[i]:
    j+=1
  elif a[i]!='A':
    print('NO')
if m==j:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

s=input()
x="KIHBR"
no=[0]
for i in x:
    if not(i in s[no[-1]:]):
        print("NO")
        exit()
    else:
        no.append(s[no[-1]:].index(i)+no[-1])
no.append(len(s))
if no[1]>=2 or no[1]==1 and s[0]!="A" or no[2]-no[1]>=2 or no[3]-no[2]>=2 or no[4]-no[3]>=3 or no[4]-no[3]==2 and s[no[3]+1]!="A" or no[5]-no[4]>=3 or no[5]-no[4]==2 and s[no[4]+1]!="A" or no[6]-no[5]>=3 or no[6]-no[5]==2 and s[no[5]+1]!="A":
    print("NO")
else:
    print("YES")
def p(u):
 if u+1:print(s,u,end=s);p(T[u]);p(T[u+N])
def i(u):
 if u+1:i(T[u]);print(s,u,end=s);i(T[u+N])
def o(u):
 if u+1:o(T[u]);o(T[u+N]);print(s,u,end=s)
s,o='','order'
N=int(input())
T=[0,0]*N
R=set(range(N))
for _ in[0]*N:
 a,b,c=map(int,input().split())
 T[a],T[a+N]=b,c
 R-={b,c}
r=R.pop()
print('Pre'+o)
p(r)
print('\nIn'+o)
i(r)
print('\nPost'+o)
o(r)
print()


### FIXED CODE ###

def s(x):print('',x,end='')
def p(u):
 if u+1:s(u);p(T[u]);p(T[u+N])
def i(u):
 if u+1:i(T[u]);s(u);i(T[u+N])
def o(u):
 if u+1:o(T[u]);o(T[u+N]);s(u)
N=int(input())
T=[0,0]*N
for _ in[0]*N:
 a,b,c=map(int,input().split())
 T[a],T[a+N]=b,c
r=(set(range(N))-set(T)).pop()
print('Preorder');p(r)
print('\nInorder');i(r)
print('\nPostorder');o(r)
print()
import math
a,b=map(int,input().split())
c=math.gcd(a,b)
d=[]
for i in range(2,int(c**0.5)+1):
    while c%i==0:
        c//=i
        d.append(i)
print(len(set(d))+1)

### FIXED CODE ###

import math
a,b=map(int,input().split())
while b!=0:
    a,b=b,a%b
c=a
d=[]
for i in range(2,int(c**0.5)+2):
    while c%i==0:
        c//=i
        d.append(i)
if c!=1:
    d.append(c)
print(len(set(d))+1)
t = 0
while t == 0:
	try:
		d = int(input())
	except:
		break
	else:
        print(sum(d * ((i * d) ** 2) for i in range(int(600/d))))

### FIXED CODE ###

t = 0
while t == 0:
    try:
        d = int(input())
    except:
        break
    else:
        print(sum(d * ((i * d) ** 2) for i in range(int(600/d))))
N,M = map(int,input().split())
a = input().split()
for i in a:
  if int(i) >= sum(map(int,a))* 1/(4*M):
    ans+=1

if ans >= M:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N,M = map(int,input().split())
a = input().split()
ans =0
for i in a:
  if int(i) >= sum(map(int,a))* 1/(4*M):
    ans+=1

if ans >= M:
  print("Yes")
else:
  print("No")
A, B, C = map(int, input())

if A**2 + B**2 == C**2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

if A == B and B == C:
    print('Yes')
else:
    print('No')
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

class BIT:
	def __init__(self, N):
		self.size = N
		self.tree = [0] * (N + 1)

	def sum(self, t):
		s = 0
		while t > 0:
			s += self.tree[t]
			t -= t & -t
		return s

	def add(self, t, x):
		while t <= self.size:
			self.tree[t] += x
			t += t & -t

#処理内容
def main():
	N, Q = getlist()
	c = getlist()
	LR = []
	lastappeared = [None] * N
	# for i in range(N):
	# 	lastappeared[c[i] - 1] = i
	ans = [0] * N
	for i in range(Q):
		l, r = getlist()
		l -= 1; r -= 1
		LR.append([r, l, i])

	print(c)

	LR.sort()
	bit = BIT(N)
	val = 0
	right = 1
	for r, l, i in LR:
		while right <= r:
			if lastappeared[c[right] - 1] == None:
				bit.add(right, 1)
			else:
				bit.add(lastappeared[c[right] - 1], -1)
				bit.add(right, 1)
			lastappeared[c[right] - 1] = right

			right += 1

		anspre = bit.sum(r) - bit.sum(l - 1)
		ans[i] = anspre

	for i in range(N):
		print(ans[i])



if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

class SegmentTree(object):
	#N:処理する区間の長さ
	def __init__(self, N):
		self.N = N
		self.N0 = 2 ** (N - 1).bit_length()
		self.initVal = 0
		self.data = [self.initVal] * (2 * self.N0)

	# 区間クエリの種類
	def calc(self, a, b):
		return a + b

	#k番目の値をxに更新
	def update(self, k, x):
		k += self.N0 - 1
		self.data[k] = x
		while k > 0:
			k = (k - 1) // 2
			self.data[k] = self.calc(self.data[2 * k + 1], self.data[2 * k + 2])

	#区間[l, r]の演算値
	def query(self, l, r):
		L = l + self.N0; R = r + self.N0 + 1
		m = self.initVal
		while L < R:
			if R & 1:
				R -= 1
				m = self.calc(m, self.data[R - 1])
			if L & 1:
				m = self.calc(m, self.data[L - 1])
				L += 1
			L >>= 1; R >>= 1

		return m

#処理内容
def main():
	N, Q = getlist()
	c = getlist()
	LR = []
	lastappeared = [None] * N

	ans = [0] * Q
	for i in range(Q):
		l, r = getlist()
		l -= 1; r -= 1
		LR.append([r, l, i])

	LR.sort(key = lambda x:x[0])
	Seg = SegmentTree(N)
	right = 0
	for r, l, i in LR:
		while right <= r:
			itr = c[right] - 1
			if lastappeared[itr] == None:
				Seg.update(right, 1)
			else:
				Seg.update(lastappeared[itr], 0)
				Seg.update(right, 1)
			lastappeared[itr] = right
			right += 1

		if l == 0:
			anspre = Seg.query(0, r)
		else:
			anspre = Seg.query(l, r)
		ans[i] = anspre

	for i in range(Q):
		print(ans[i])



if __name__ == '__main__':
	main()
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    D = [0] * (N+1)
    for i in range(2, N+1):
        D[i] = i*(i+1)//2

    index = bisect_left(D, N)
    if N != D[index] or N<= 2:
        print("No")
    else:
        print("Yes")
        print(index+1)
        D2 = Init(index+1, index,0)
        D2[0] = [i for i in range(1, index+1)]
        num = index
        for i in range(1, index+1):
            for j in range(i):
                D2[i][j] = D2[j][i-1]
            for k in range(j+1, index):
                num += 1
                D2[i][k] = num
        for temp in D2:
            temp = [index]+temp
            temp = [str(i) for i in temp]
            print(" ".join(temp))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    D = [0] * (N+1)
    for i in range(1, N+1):
        D[i] = i*(i+1)//2

    index = bisect_left(D, N)
    if N != D[index]:
        print("No")
    else:
        print("Yes")
        print(index+1)
        D2 = Init(index+1, index,0)
        D2[0] = [i for i in range(1, index+1)]
        num = index
        for i in range(1, index+1):
            for j in range(i):
                D2[i][j] = D2[j][i-1]
            for k in range(j+1, index):
                num += 1
                D2[i][k] = num
        for temp in D2:
            temp = [index]+temp
            temp = [str(i) for i in temp]
            print(" ".join(temp))

if __name__ == "__main__":
    main()
l = map(int, raw_input().strip().split(" "));
print " ".join(sorted(l, lambda x, y: y - x));

### FIXED CODE ###

l = map(int, raw_input().strip().split(" "));
print " ".join(map(str, sorted(l, lambda x, y: y - x)));
n = int(input())
nums = [2**i for i in range(1,7)]
ans = [i - n for i in nums if (i - n) >= 0]
print(ans[0])

### FIXED CODE ###

N = int(input())
ans = 1
while True:
  if N < ans <<1:
    break
  ans<<=1
print(ans)
inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()

A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B

output = A2 + ' ' + B2

print(output)


### FIXED CODE ###

inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()

A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B

output = "{} {}".format(A2, B2)

print(output)
#100 C - /\/\/\/
import collections
n = int(input())
A = list(map(int,input().split()))

A1 = A[::2]
A2 = A[1::2]
cnt1 = collections.Counter(A1)
cnt2 = collections.Counter(A2)

items1 = list(cnt1.items())
items2 = list(cnt2.items())

if items1[0][0] != items2[0][0]:
    ans = (len(A1) - items1[0][1]) + (len(A2) - items2[0][1])
else:
    ans1 = (len(A1) - items1[0][1]) + (len(A2) - items2[1][1])
    ans2 = (len(A1) - items1[1][1]) + (len(A2) - items2[0][1])
    ans = min(ans1,ans2)
print(ans)

### FIXED CODE ###

#100 C - /\/\/\/
import collections
n = int(input())
A = list(map(int,input().split()))

A1 = A[::2]
A2 = A[1::2]
cnt1 = collections.Counter(A1)
cnt2 = collections.Counter(A2)

items1 = list(cnt1.items())
items2 = list(cnt2.items())
items1 = sorted(items1,key = lambda x:x[1],reverse = True)
items2 = sorted(items2,key = lambda x:x[1],reverse = True)

if items1[0][0] != items2[0][0]:
    ans = (len(A1) - items1[0][1]) + (len(A2) - items2[0][1])
else:
    if len(items1) == len(items2) == 1:
        ans = min(len(A1),len(A2))

    else:
        ans1 = (len(A1) - items1[0][1]) + (len(A2) - items2[1][1])
        ans2 = (len(A1) - items1[1][1]) + (len(A2) - items2[0][1])
        ans = min(ans1,ans2)
print(ans)
a,b=map(int,input().split())
y=0
high=0
for i in range(1,1000):
    y+=i
    x.append(y)
for xz in x:
    if xz <= b:
        high=xz
        d=high-a
print(d)

### FIXED CODE ###

import sys
def readQuestion():
    line = sys.stdin.readline()
    sline = line.rstrip()
    [rline,r1line]=sline.split(" ")
    a=int(rline)
    b=int(r1line)
    return a,b 

def solve(a,b):
    x=[]
    y=0
    high=0
    z=0
    u=0
    for i in range(1,1000):
        y+=i
        x.append(y)
    high = b-a
    z=high-1
    u=x[z]-b
    return u
# 全体
def main():
    x,y = readQuestion()
    answer = solve(x, y)
    print(answer)

# mainを呼び出す
if __name__ == '__main__':
    main()