Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p04001 (python)

Fixed submission:
import numpy as np
s = input()

item = np.arange(len(s) - 1) + 1
n = len(item)
count = 0
for i in range(2 ** n):
    sidx = 0
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            eidx = item[j]
            count += int(s[sidx:eidx])
            sidx = eidx
    count += int(s[sidx:])
print(count)

Buggy submission (verdict: Runtime Error):
s = input()

item = np.arange(len(s) - 1) + 1
n = len(item)
count = 0
for i in range(2 ** n):
    sidx = 0
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            eidx = item[j]
            count += int(s[sidx:eidx])
            sidx = eidx
    count += int(s[sidx:])
print(count)
Problem p02700 (python)

Fixed submission:
a=list(map(int,input().split()))
takahashi=0
takahashicount=0
aoki=0
aokicount=0

for i in range(a[2]):
    aoki+=a[1]
    if (a[2]-aoki)>0:
        aokicount+=1
    elif (a[2]-aoki)==0:
        break
    else:
        break
        
for i in range(a[0]):
    takahashi+=a[3]
    if (a[0]-takahashi)>0:
        takahashicount+=1
    elif (a[0]-takahashi)==0:
        break
    else:
        break
if takahashicount==aokicount:
    print("Yes")
elif takahashicount>aokicount:
    print("Yes")
elif takahashicount<aokicount:
    print("No")

Buggy submission (verdict: Runtime Error):
S,W=map(int,input().split())
if S<=W:
    print("unsafe")
else:
    print("safe")
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500*i) + (100*j) + (50*k) == X:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500*i) + (100*j) + (50*k) == x:
                count += 1
print(count)
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N-i+1):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            print(i, j, N-i-j)
            exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N-i+1):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            print(i, j, n-i-j)
            exit()
print('-1 -1 -1')
Problem p02658 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=10**18
f=0
a.sort()
for i in a:
    res*=i
    if res>xx:
        f=1
        print(-1)
        break

if f==0:
    print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().strip.split(" ")]
res=1
xx=1**18
for i in a:
    res*=i
if res>xx:
    print(-1)
else:
    print(res)
Problem p02732 (python)

Fixed submission:
N=int(input())
K=list(map(int, input().split()))
from collections import Counter
ans = 0
C = Counter(K)
for k, v in C.items():
    ans += v*(v-1)//2

for a in K:
    e = C[a]
    print(ans-e*(e-1)//2+(e-1)*(e-2)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

setA = set(A)
an = 0
for num in B:
    d = A.count(num)
    an += d*(d-1)//2

for i in range(n):
    ans = an
    t = A[i]
    e = A.count(A[i])
    ans -= e*(e-1)//2
    ans += (e-1)*(e-2)//2
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
 
n = int(sys.stdin.readline())
 
li = list(map(int, sys.stdin.readline().split()))
 
ans = [0]*n
for i in range(n):
    li2 = li.copy()
    del li2[i]
    for j in range(n-1):
        for k in range(j+1, n-1):
            if li2[j] == li2[k]:
                ans[i] += 1
for l in range(len(ans)):

Buggy submission (verdict: Runtime Error):
n = int(input())
 
li = list(map(int, input().split()))
 
ans = [0]*n
for i in range(n):
    li2 = li.copy()
    del li2[i]
    li3 = list(set(li2))
    for j in range(len(li3)):
        m = li2.count(li3[j])*(li2.count(li3[j])-1)/2
        ans[i] += m
for l in range(len(ans)):
    print(int(ans[l]))

Buggy submission (verdict: Runtime Error):
n = int(input())

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

ans = [0]*n
for i in range(n):
    li2 = li
    del li2[i]
    for j in range(n-1):
        for k in range(j+1, n-1):
            if li2[j] == li2[k]:
                ans[i] += 1
for l in range(len(ans)):
    print(ans[l])
Problem p02756 (python)

Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())

a = 0
for i in range(Q):
    t = input()
    if t == "1":
        if a == 0:
            a = 1
        else:
            a = 0
    else:
        t,f,c = t.split()
        if f == "1":
            if a == 0:
                S.appendleft(c)
            else:
                S.append(c)
        else:
            if a == 0:
                S.append(c)
            else:
                S.appendleft(c)
            
if a == 1:
    S = reversed(S)
    
S = ''.join(S)
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())

a = 0
for i in range(Q):
    t = input()
    if t == "1":
        if a == 0:
            a = 1
        else:
            a = 0
    else:
        t,f,c = t.split()
        if f == "1":
            if a == 0:
                S = c + S
            else
                S = S + c
        else:
            if a == 0:
                S = S + c
            else:
                S = c + S
            
if a == 1:
    S = S[::-1]
    
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())

a = 0
for i in range(Q):
    t = input()
    if t == "1":
        if a == 0:
            a = 1
        else:
            a = 0
    else:
        t,f,c = t.split()
        if f == "1":
            if a == 0:
                S = c + S
            else
                S = S + c
        else:
            if a == 0:
                S = S + c
            else:
                S = c + S
            
if a == 1:
    S = S[::-1]
    
print(S)
Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - a[i] + a[i+K]
    ans = max(s, ans)
print((ans+K)/2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - s[i] + s[i+K]
    ans = max(s, ans)
print(ans)
Problem p02971 (python)

Fixed submission:
import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for i in range(n)]
B = sorted(A)
m1 = B[-1]
m2 = B[-2]

for a in A:
    if a == m1:
        print(m2)
    else:
        print(m1)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
for j in range(n):
    B = A.copy()
    B.remove(B[j])
    print(max(B))
Problem p02995 (python)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
def solve(n):
    return n - n//C - n//D + n//lcm(C, D)
print(solve(B) - solve(A-1))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve(n):
    return n - n//C - n//D + n//lcm(C, D)
print(solve(B) - solve(A-1))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve(n):
    ans = n - n//C - n//D + n//lcm(C, D)
    return ans
answer = solve(B) - solve(A-1)
print(answer)
Problem p03076 (python)

Fixed submission:
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Buggy submission (verdict: Runtime Error):
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li = []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Buggy submission (verdict: Runtime Error):
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
ans = sum(foods) - max(li)
print(ans)
Problem p03086 (python)

Fixed submission:
S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0
li.append(cnt)

print(max(li))

Buggy submission (verdict: Runtime Error):
S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0

print(max(li))
Problem p04012 (python)

Fixed submission:
import sys
S = input()
alp = list(set(S))
cnts = [0] * len(alp)
for i in range(len(S)):
    cnts[alp.index(S[i])] += 1
    
for a in cnts:
    if a%2 == 1:
        print("No")
        sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
S = input()
alp = list(set(S))
cnts = [0] * len(alp)
for i in range(len(S)):
    cnts(alp.index(S[i])) += 1
    
for a in cnts:
    if a%2 == 1:
        print("No")
        sys.exit()
print("Yes")
Problem p02687 (python)

Fixed submission:
print('ABC' if input() == 'ARC' else 'ARC')

Buggy submission (verdict: Runtime Error):
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)

Buggy submission (verdict: Runtime Error):
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 118):
    for a in range(-118, 119):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)
Problem p03037 (python)

Fixed submission:
n, m = map(int, input().split())
lrs = [list(map(int, input().split())) for _ in range(m)]

l_max = 1
r_min = n
for l, r in lrs:
    l_max = max(l, l_max)
    r_min = min(r, r_min)

print(max(r_min - l_max + 1, 0))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lrs = [list(map(int, input().split())) for _ in range(m)]

l_max = 1
r_min = n
for l, r in lrs:
    l_max = max(l, l_max)
    r_min = min(r, r_min)

print(min(r_min - l_max + 1), 0)
Problem p03081 (python)

Fixed submission:
def search_right(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < key(a[mid]): hi = mid
        else: lo = mid+1
    return lo


def search_left(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if key(a[mid]) < x: lo = mid+1
        else: hi = mid
    return lo


def get_fin_pos(s, td, golem_pos):
    for t, d in td:
        if 0 <= golem_pos < len(s) and s[golem_pos] == t:
            golem_pos += 1 if d == "R" else -1
    return golem_pos


n, q = map(int, input().split())
s = "_{}_".format(input())
spells = [input().split() for _ in range(q)]

left = search_right(range(len(s)), 0, key=lambda golem: get_fin_pos(s, spells, golem))
right = search_left(range(len(s)), len(s) - 1, key=lambda golem: get_fin_pos(s, spells, golem))

print(right - left)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = "_{}_".format(input())
td = [input().split() for _ in range(q)]

current_l = 0
current_r = n + 1

for t, d in reversed(td):

    if 0 <= current_l + 1 < len(s) and t == s[current_l + 1] and d == "L":
        current_l += 1x

    if 0 <= current_r - 1 < len(s) and t == s[current_r - 1] and d == "R":
        current_r -= 1x

print(max(current_r - current_l - 1, 0))
Problem p02767 (python)

Fixed submission:
N = int(input())
x_li = list(map(int, input().split()))
ans = 10000000000000
for i in range(1, 101):
    d = 0
    for j in range(N):
        d += (x_li[j] - i) ** 2
    ans = min(ans, d)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
x_li = list(map(int, input().split()))
import math
ans = math.inf
for i in range(1, 101):
    d = 0
    for j in range(N):
        d += (x_li[j] - i) ** 2
    ans = min(ans, d)
print(ans)
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())

print(max(a + b, a - b, a * b))

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
s_li = []
for i in range(n):
    s = input()
    s_i = {}
    for j in range(10):
        s_i[s[j]] = 0
    for j in range(10):
        s_i[s[j]] += 1    
    s_li.append(s_i)

ans = 0

for i in range(n):
    for j in range(n):
        if i >= j :
            continue
        if s_li[i] == s_li[j]:
            ans += 1
print(ans)
Problem p02981 (python)

Fixed submission:
N,A,B = map(int,input().split())
if N * A < B :
    print(N * A)
else :
    print(B)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

# Rが2019未満のとき
if R < 2019 :
    print((L * (L + 1)) % 2019)
# 範囲内に2019を含む時
elif L <= 2019 and R >= 2019 :
    print(0)
# LもRも2019より高い場合
else :
    R = min(R, L + 2018)
    ans = 2018
    for i in range(L,R + 1):
        b = i + 1
        for j in range(b,R + 1):
            x = (i * j) % 2019
            ans = min(ans, x)
    print(ans)
Problem p03048 (python)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N + 1, R):
    if r > N :
        break
    for g in range(r, N + 1, G) :
        if g > N :
            break
        b = (N - g) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N, R):
    if r * R > N :
        break
    for g in range(0, N + 1int(N / G) + 1) :
        if r * R + g * G > N :
            break
        b = (N - r * R - g * G) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)
Problem p03294 (python)

Fixed submission:
n = input()
a_li = list(map(int,input().split()))

f = 0
for i in range(len(a_li)) :
    f = f + a_li[i] - 1

print(f)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

def lcm(a, b):
    return int(a * b / gcd(a, b))

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

lcm_a = 0
for i in range(len(a_li)) :
    if i == 0 :
        lcm_a = a_li[i]
    else :
        lcm_a = lcm(lcm_a, a_li[i])

m = lcm_a - 1
f = 0
for i in range(len(a_li)) :
    f = f + m % a_li[i]

print(f)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0: return a
    mod = a % b
    buf = gcd(b, mod)
    return buf

def lcm(a, b):
    buf = gcd(a, b)
    return int(a * b / buf)

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

lcm_a = 0
for i in range(len(a_li)) :
    if i == 0 :
        lcm_a = a_li[i]
    else :
        lcm_a = lcm(lcm_a, a_li[i])

m = lcm_a - 1
f = 0
for i in range(len(a_li)) :
    f = f + m % a_li[i]

print(f)
Problem p03296 (python)

Fixed submission:
from sys import stdin

n = stdin.readline()
n_i = int(n)

a = stdin.readline().rstrip().split()
a_list = list(a)

n_count = 0

if len(a_list) == 2 and a_list[0] == a_list[1] :
    print(n_count + 1)
else :
    for i in range(n_i):
        if i == n_i - 1 :
            break
        if a_list[i] == a_list[i + 1]:
            n_count = n_count + 1
            a_list[i + 1] = "X"

    print(n_count)

Buggy submission (verdict: Runtime Error):
from sys import stdin

t = stdin.readline()
t_i = int(t)
data = [stdin.readline().rstrip().split() for _ in range(t_i)]
#print(data)
for i in range(t_i) :
    a = int(data[i][0])
    b = int(data[i][1])
    c = int(data[i][2])
    d = int(data[i][3])
    #print(a, b, c, d)
    if a < b :
        print("No")
    elif b > d :
        print("No")
    elif a % b > c and a % b < b :
        print("No")
    else :
        #print("Yes")
    
        stock = a
        count = 0
        while True :
            stock = stock - b
            if stock < 0 :
                print("No")
                break
            if stock <= c :
                stock = stock + d
            count = count + 1
            if count > 10000 :
                print("Yes")
                break
Problem p03844 (python)

Fixed submission:
li = input().split()
if li[1] == "+":
    print(int(li[0]) + int(li[2]))
else :
    print(int(li[0]) - int(li[2]))

Buggy submission (verdict: Runtime Error):
li = input().split()
if li[1] == "+":
  print(li[0] + li[2])
else :
  print(li[0] - li[2])
Problem p03280 (python)

Fixed submission:
a, b = map(int, input().split())
 
print( (a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

print( (a-1)*(b-1))
Problem p03796 (python)

Fixed submission:
import math
N = int(input())
print(math.factorial(N)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print(math.factorial(N) % (10**9+7)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print(math.factorial(N)%(10**9+7)
Problem p02883 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
import heapq
import math
 
def main():
    N, K = map(int, input().split())
    A = [int(c) for c in input().split()]
    F = [int(c) for c in input().split()]
    
    A.sort()
    F.sort(reverse=True)
 
    num = 0
    sum_ = []
    for i in range(N):
      sum_.append(A[i] * F[i])
    left = 0
    right = 10 ** 12
    while(num < 90):
        number = 0
        mid = (left + right) // 2
        # print(mid)
        for i in range(len(A)):
            if sum_[i] <= mid:
                continue
            else:
                number += math.ceil((sum_[i] - mid) / F[i])
            # print(number)
        if number > K:
            # 最大値をmidより小さくできない -> 最大値はもっとでかい
            left = mid + 1
        else:
            right = mid
        num += 1
    print(mid)
                
        
 
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)
import heapq
import math

def main():
    N, K = map(int, input().split())
    A = [int(c) for c in input().split()]
    F = [int(c) for c in input().split()]
    
    A.sort()
    F.sort(reverse=True)

    num = 0
    sum_ = A * F
    left = 0
    right = 10 ** 12
    while(num < 50):
        number = 0
        mid = (left + right) // 2
        # print(mid)
        for i in range(len(A)):
            if sum_[i] <= mid:
                continue
            else:
                number += math.ceil((sum_[i] - mid) / F[i])
            # print(number)
        if number > K:
            # 最大値をmidより小さくできない -> 最大値はもっとでかい
            left = mid + 1
        else:
            right = mid
        num += 1
    print(mid)
                

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)
import heapq
import numpy as np
import math

def main():
    N, K = map(int, input().split())
    A = [int(c) for c in input().split()]
    F = [int(c) for c in input().split()]
    
    A.sort()
    F.sort(reverse=True)

    A = np.array(A)
    F = np.array(F)

    num = 0
    sum_ = A * F
    left = 0
    right = 10 ** 12
    while(num < 90):
        number = 0
        mid = (left + right) // 2
        # print(mid)
        for i in range(len(A)):
            if sum_[i] <= mid:
                continue
            else:
                number += math.ceil((sum_[i] - mid) / F[i])
            # print(number)
        if number > K:
            # 最大値をmidより小さくできない -> 最大値はもっとでかい
            left = mid + 1
        else:
            right = mid
        num += 1
    print(mid)
                
        



if __name__ == '__main__':
    main()
Problem p02888 (python)

Fixed submission:
import bisect

def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    count = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = bisect.bisect_left(L, L[i] + L[j])
            k -= 1
            count += k - j
    print(count)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
from bisect import bisect_left, bisect_right
 
def main():
    N = int(input())
    L = [int(c) for c in input().split()]
    L = sorted(L)
    num = 0
    for ai in range(N):
        for bi in range(ai+1, N):
            if bi - ai == 1:
                continue
            a = L[ai]
            b = L[bi]
            ci_left = bisect_right(L, abs(L[ai] - L[bi]))
            ci_right = bisect_left(L, L[ai] + L[bi])
            if ci_left == ci_right:
                continue
            else:
                ci_left = max(ci_left, ai + 1)
                ci_right = min(ci_right, bi)
            # print(a, b, ci_left, min(ci_right, bi) - max(ci_left, ai) - 1)
            # num += min(ci_right, bi) - max(ci_left, ai) - 1
                num += ci_right - ci_left
            # print(a, b, ci_right, ci_left, num)
 
    print(num)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
from bisect import bisect_left, bisect_right
 
def main():
    N = int(input())
    L = [int(c) for c in input().split()]
    L = sorted(L)
    num = 0
    for ai in range(N):
        for bi in range(ai+1, N):
            if bi - ai == 1:
                continue
            a = L[ai]
            b = L[bi]
            ci_left = bisect_right(L[ai+1:bi], abs(L[ai] - L[bi]))
            ci_right = bisect_left(L[ai+1:bi], L[ai] + L[bi])
            # print(a, b, ci_left, min(ci_right, bi) - max(ci_left, ai) - 1)
            # num += min(ci_right, bi) - max(ci_left, ai) - 1
            num += ci_right - ci_left
            # print(a, b, ci_right, ci_left, num)
 
    print(num)
 
 
if __name__ == '__main__':
    main()