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

Fixed submission:
N,M=map(int,input().split())
s=[]
c=[]
for i in range(M):
    a, b = map(int,input().split())
    s.append(a)
    c.append(b)

okflag = True

for i in range(M):

    if not okflag:
         break
    for j in range(M):
     if not okflag:
         break
     if not (i==j):
        if s[i]==s[j] and c[i]!=c[j]:
            okflag = False
            print("-1")
if okflag:
    answer = ["x"] * N

    for i in range(M):
        answer[s[i]-1] = str(c[i])
    
    if N == 1 and answer[0] == "x":
        print("0")
    elif N == 1 and not answer[0] == "x":
        print(answer[0])

    elif not N == 1 and answer[0] == "0":
        print("-1")
    
    elif not N == 1:
        for i in range(N):
            if answer[i] == "x":
                if i == 0:
                    answer[i] = "1"
                else:
                    answer[i] = "0"
        result = ''.join(answer)
        print(result)

Buggy submission (verdict: Runtime Error):
import math

N,M=map(int,input().split())
s=[]
c=[]
for i in range(M):
    a, b = map(int,input().split())
    s.append(a)
    c.append(b)

found = False

for i in range(pow(10,2), pow(10,3)):
   
    i_str = str(i)

    passed = True
    for j in range(M):
        if not i_str[s[j]] == c[j]:
            passed = False
            break
    if passed:
        found = True
        print(i)

if not found:
    print("-1")

Buggy submission (verdict: Runtime Error):

N,M=map(int,input().split())
s=[]
c=[]
for i in range(M):
    a, b = map(int,input().split())
    s.append(a)
    c.append(b)

okflag = True

for i in range(M):

    if not okflag:
         break
    for j in range(M):
     if not okflag:
         break
     if not (i==j):

        if s[i]==s[j] and c[i]!=c[j]:

            okflag = False
            print("No")

if okflag:
    answer = ["0"] * N
    for i in range(M):
        answer[s[i]] = str(c[i])
    if not N == 1 and answer[0] == "0":
        answer[0] = "1"
    result = ''.join(answer)
    print(result)
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))

b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))
 
b = 0
 
for i in range:
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
 
print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))
 
b = 0
 
for i in range:
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
 
print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))
 
b = 0
 
for i in range:
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
 
print(str(b))

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))

b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())

a = 0

for i in range(N+1):
    for ii in range(N+1):
        iii = N - i - ii
        if iii < 0:
            break
        ans = 10000 * i + 5000 * ii + 1000 * iii
        if ans == Y:
                print(i,ii,iii)
                a += 1
                break

        #for iii in range(N):
        #    ans = 10000 * i + 5000 * ii + 1000 * iii
        #    J = i + ii + iii
        #    if ans == Y and J == N:
        #        print(i,ii,iii)
        #        a += 1
        #        break
        #if a != 0:
        #    break
    if a != 0:
        break

if a == 0:
    print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

a = 0

for i in range(N):
    for ii in range(N):
        iii = N - i - ii
        ans = 10000 * i + 5000 * ii + 1000 * iii
        if ans == Y and J == N:
                print(i,ii,iii)
                a += 1
                break

        #for iii in range(N):
        #    ans = 10000 * i + 5000 * ii + 1000 * iii
        #    J = i + ii + iii
        #    if ans == Y and J == N:
        #        print(i,ii,iii)
        #        a += 1
        #        break
        #if a != 0:
        #    break
    if a != 0:
        break

if a == 0:
    print(-1,-1,-1)
Problem p02830 (python)

Fixed submission:
n = int(input())
string1, string2 = input().split(" ")

for i in range(n):
    print(string1[i],end="")
    print(string2[i],end="")

Buggy submission (verdict: Runtime Error):
n = int(input())
string1, string2 = input().split(" ")

for i in range(n):
    print(f"{string1[i]}{string2[i]}",end="")
Problem p02684 (python)

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

visited = [False]*(2*10**5 + 10)
val = 1
count = 0
hold = k
while hold > 0 :
    if visited[val - 1] or val == t[val - 1]:
        break
    visited[val - 1] = True
    val = t[val - 1]
    # print('a', val)
    count += 1
    hold -= 1
# print(hold)
if hold == 0:
    print(val)
    exit(0)
if val == t[val - 1]:
    print(val)
    exit(0)
count0 = count
count = 1
newval = val
start = t[newval - 1]
while start != newval:
    count += 1
    start = t[start - 1]
# print('count', count, 'count0', count0)
if t[val - 1] == t[0]:
    temp = k
else:
    temp = k - count0
# print('temp', temp)
jump = (temp) % (count)
# print('jump', jump)
# print('val', val)
ans = val
for i in range(jump):
    ans = t[ans - 1]
    # print('b', ans)
print(ans)

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

visited = [False]*(2*10**5 + 10)
val = 1
count = 0
hold = k
while hold > 0 :
    if visited[val - 1] or val == t[val - 1]:
        break
    visited[val - 1] = True
    val = t[val - 1]
    # print('a', val)
    count += 1
    hold -= 1
if hold == 0:
    print(t[val - 1])
    exit(0)
if val == t[val - 1]:
    print(1/0)
    exit(0)
count0 = count
count = 1
newval = val
start = t[newval - 1]
while start != newval:
    count += 1
    start = t[start - 1]
# print('count', count, 'count0', count0)
if t[val - 1] == t[0]:
    temp = k
else:
    temp = k - count0
# print('temp', temp)
jump = (temp) % (count)
# print('jump', jump)
# print('val', val)
ans = val
for i in range(jump):
    ans = t[ans - 1]
    # print('b', ans)
print(ans)

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

visited = [False]*(2*10**5 + 10)
val = 1
count = 0
hold = k
while hold > 0 :
    if visited[val - 1] or val == t[val - 1]:
        break
    visited[val - 1] = True
    val = t[val - 1]
    # print('a', val)
    count += 1
    hold -= 1
if hold == 0:
    print(1/0)
    exit(0)
if val == t[val - 1]:
    print(1/0)
    exit(0)
count0 = count
count = 1
newval = val
start = t[newval - 1]
while start != newval:
    count += 1
    start = t[start - 1]
# print('count', count, 'count0', count0)
if t[val - 1] == t[0]:
    temp = k
else:
    temp = k - count0
# print('temp', temp)
jump = (temp) % (count)
# print('jump', jump)
# print('val', val)
ans = val
for i in range(jump):
    ans = t[ans - 1]
    # print('b', ans)
print(ans)
Problem p02791 (python)

Fixed submission:
n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(int, input().split())
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans))
Problem p02797 (python)

Fixed submission:
n, k, s = map(int, input().split())
if k == 0:
    if s == 10**9:
        print(' '.join([str(s - 1)]*n))
    else:
        print(' '.join([str(s + 1)]*n))
else:
  first = [str(s)]*k
  if s == 1:
    second = [str(2)]*(n - k)
  else:
    second = [str(max(1, s - 1))]*(n - k)
  print(' '.join(first + second))

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
if k == 0:
  print(' '.join([str(s + 1)]*n))
else:
  first = [str(s)|]*k
  second = [str(s + 1)]*(n - k)
  print(' '.join(first + second))

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
if k == 0:
  print(' '.join([s + 1]*n))
else:
  first = [s]*k
  second = [s + 1]*(n - k)
  print(' '.join(first + second))
Problem p02837 (python)

Fixed submission:
n = int(input())
ret = {}
for i in range(0, n):
    a = int(input())
    ret[i] = [[], []]
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        if y == 1:
            ret[i][0].append(x)
        elif y == 0:
            ret[i][1].append(x)
 
ans = 0
import itertools
lst = list(itertools.product([0, 1], repeat=n))
for s in lst:
    var = True
    for i in range(len(s)):
        if s[i] == 1:
            for j in ret[i][0]:
                if s[j] != 1:
                    var = False
                    break
            for j in ret[i][1]:
                if s[j] != 0:
                    var = False
                    break
    if var:
        # print(s)
        ans = max(ans, s.count(1))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ret = {}
for i in range(0, n):
    a = int(input())
    ret[i] = [[], []]
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        if y == 1:
            ret[i][0].append(x)
        elif y == 0:
            ret[i][1].append(x)

dic = {}


def f(honest_p, honest_list):
    if honest_p in dic:
        return []
    dic[honest_p] = True
    # print('honest_list', honest_p, honest_list)
    if ret[honest_p][0] == []:
        return [honest_p]
    temp = [honest_p] + honest_list
    for i in honest_list:
        temp += f(i, ret[i][0])
    return temp


ans = 0
for i in range(0, n):
    dic = {}
    honest = list(set(f(i, ret[i][0])))
    # print('h', honest)
    dishonest = ret[i][1]
    for a in honest:
        for b in ret[a][1]:
            if b not in dishonest:
                dishonest.append(b)
    # print('d', dishonest)
    dishonest = list(set(dishonest))
    invalid = []
    for j in range(0, n):
        if i == j or j in honest or j in dishonest:
            continue
        val = True
        for k in ret[j][1]:
            if k in honest:
                val = False
        for k in ret[j][0]:
            if k in dishonest:
                val = False
        if not val:
            invalid.append(j)
    # print('invalid', invalid)
    import itertools
    lst = list(itertools.product([0, 1], repeat=n))
    for string in lst:
        string = list(string)
        for j in invalid:
            string[j] = 0
        # print(honest, dishonest, string)
        if not val and list(set(honest) & set(dishonest)) == []:
            # print(string)
            ans = max(ans, string.count(1))
print(ans)
Problem p03364 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j] != S[j][i]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + S[:i], 0, i)
print(cnt * N)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j+B-N] != S[j][i+B-N]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + s[:i], 0, i)
print(cnt * N)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            # if j + B < N:
            #     b = j + B
            # else:
            #     b = j + B - N
            # if i + B < N:
            #     d = i + B
            # else:
            #     d = i + B - N
            if S[i][j+B] != S[j][i+B]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S, 0, i)
print(cnt * N)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if j + B < N:
                b = j + B
            else:
                b = j + B - N
            if i + B < N:
                d = i + B
            else:
                d = i + B - N
            if S[a][b] != S[c][d]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S, 0, i):
print(cnt * N)
Problem p03381 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""

import numpy as np

N = int(input())
X = np.array(map(int, input().split(" ")))

for i in range(N):
    print(np.append(X[:i], X[i+1:]).median)
Problem p03389 (python)

Fixed submission:
A, B, C = map(int, input().split(" "))
cnt = 0

if (A%2 == B%2) and (B%2 == C%2):
    pass
else:
    if A%2 == B%2:
        A += 1
        B += 1
        cnt += 1
    elif A%2 == C%2:
        A += 1
        C += 1
        cnt += 1
    else:
        B += 1
        C += 1
        cnt += 1

ABC = sorted([A, B, C])
cnt += (ABC[2] - ABC[1]) // 2
cnt += (ABC[2] - ABC[0]) // 2
print(cnt)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split(" "))
cnt = 0

if (A%2 == B%2) and (B%2 == C%2):
    pass
else:
    if A%2 == B%2:
        A += 1
        B += 1
        cnt += 1
    elif A%2 == C%2:
        A += 1
        C += 1
        cnt += 1
    else:
        B += 1
        C += 1
        cnt += 1

ABC = sorted([A, B, C])
cnt += (ABC[0] - ABC[1]) / 2
cnt += (ABC[0] - ABC[2]) / 2
print cnt
Problem p03391 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest094 e問題 未完成
Author     : Kitaura Hiromi
LastUpdate : 20180420
Since      : 20180414
"""
inf = 10**20
# 最終的に, 1組以外はすべて0になる
N = int(input())
s = 0
m = inf
for i in range(N):
    a, b = map(int, input().split(" "))
    if a > b:
        if m > b:
            m = b
    s += a
if m == inf:
    print(0)
else:
    print(s - m)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest094 e問題 未完成
Author     : Kitaura Hiromi
LastUpdate : 20180420
Since      : 20180414
"""

# 最終的に, 1組以外はすべて0になる

N = int(input())
queA = []
queB = []
for i in range(N):
    A, B = map(int, input().split(" "))
    queA.append(A)
    queB.append(B)

cnt = 0
if np.allclose(queA, queB):
    print(cnt)
    return 0
else:
    tmp = []
    for i, B in enumerate(queB):
        if queA[i] > B:
            tmp.append(B)
    print(sum(queA) - min(tmp))
Problem p03559 (python)

Fixed submission:
N = int(input())
a = list(map(float, input().split(" ")))
b = list(map(float, input().split(" ")))
c = list(map(float, input().split(" ")))

a.sort()
c.sort()


def bisect_left(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    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 a[mid] < x: lo = mid+1
        else: hi = mid
    return lo

def bisect_right(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    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 < a[mid]: hi = mid
        else: lo = mid+1
    return lo

num = 0
for i in range(N):
    num += (bisect_left(a, b[i])) * (len(c) - bisect_right(c, b[i]))
print(num)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = list(map(float, input().split(" ")))
b = list(map(float, input().split(" ")))
c = list(map(float, input().split(" ")))

sort(a)
sort(c)

def binary_insert_right(li, v):
    upper = len(li)
    lower = 0
    while upper > lower:
        mid = ( upper + lower ) // 2
        if v < li[mid]:
            upper = mid
        else:
            lower = mid - 1
    return mid

num = 0
for i in range(N):
    num += binary_insert_right(a, b[i]) * ( len(c) - binary_insert_right(c, b[i]) - 1 )
print(num)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = np.array( list(map(float, input().split(" "))) )
b = np.array( list(map(float, input().split(" "))) )
c = np.array( list(map(float, input().split(" "))) )

# sort(a)
# sort(b)
# sort(c)

mem_a = np.zeros(10**5) - 1

dict_c = {}
def count_c(v):
    key = v
    if v in dict_c:
        return dict_c[v]
    else:
        val = len(np.where( (v < c) == True )[0])
        dict_c.update({key:val})
        return val

num = 0
for i in range(N):
    n = len(np.where( (a[i] < b) == True )[0])
    if mem_a[n] == -1:
        mem_a[n] = 0
        for j in range(N):
            mem_a[n] += count_c(b[j])
    num += mem_a[n]
print(num)
Problem p02922 (python)

Fixed submission:
A, B = map(int, input().split())
print((B-2)//(A-1)+1)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
ans = 0
tmp = A
while tmp < B:
	ans += 1
	tmp += A-1
print(ans)
Problem p03061 (python)

Fixed submission:
N = int(input())
AList = list(map(int, input().split()))

def getNum(a, b):
    while(True):
        if a == 0:
            return b
        a, b = max(a, b), min(a, b)
        a %= b

leftGBC, rightGBC= [AList[0]], [AList[-1]]
for i in range(1, N):
    leftGBC.append(getNum(leftGBC[i - 1], AList[i]))
for i in range(1, N):
    rightGBC.append(getNum(rightGBC[i - 1], AList[N - i - 1]))

rightGBC.reverse()

ans = max(leftGBC[-2], rightGBC[1])
for i in range(0, N-2):
    ans = max(getNum(leftGBC[i], rightGBC[i + 2]), ans)

print(ans)

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

def getNum(a, b):
    if a == b:
        return a
    while(True):
        a, b = max(a, b), min(a, b)
        a -= b
        if a == b:
            return a

ansList = []
for i in range(0, N-1):
    ansList.append(getNum(AList[i], AList[i+1]))

print(sorted(ansList, reverse=False)[1])
Problem p03081 (python)

Fixed submission:
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, N - 1
lList, rList = [], []
for td in tdList:
    if td[0] == S[l] and td[1] == "L":
        l += 1
    elif td[0] == S[r] and td[1] == "R":
        r -= 1
    if l != 0 and S[l - 1] == td[0] and td[1] == "R":
        l -= 1
    if r != N - 1 and S[r + 1] == td[0] and td[1] == "L":
        r += 1
    if l > N - 1 or r < 0:
        break

ans = 0
if r >= l:
    ans = r - l + 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, N - 1
lList, rList = [], []
n_lFlag, n_rFlag = False, False
for td in tdList:
    if td[0] == S[l] and td[1] == "L":
        l += 1
        n_lFlag = True
    elif td[0] == S[r] and td[1] == "R":
        r -= 1
        n_rFlag = True
    if n_lFlag and S[l - 1] == td[0] and td[1] == "R":
        l -= 1
    if n_rFlag and S[r + 1] == td[0] and td[1] == "L":
        r += 1
    if l == N - 1 or r == 0:
        break

ans = 0
if r >= l:
    ans = r - l + 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, N - 1
lList, rList = [], []
n_lFlag, n_rFlag = False, False
for td in tdList:
    if td[0] == S[l] and td[1] == "L":
        l += 1
        n_lFlag = True
    elif td[0] == S[r] and td[1] == "R":
        r -= 1
        n_rFlag = True
    if n_lFlag and S[l - 1] == td[0] and td[1] == "R":
        l -= 1
    if n_rFlag and S[r + 1] == td[0] and td[1] == "L":
        r += 1
    if l == N - 1 or r == 0:
        break

ans = 0
if r >= l:
    ans = r - l + 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, len(S) - 1
for td in tdList:
    if td[0] == S[l] and td[1] == "L":
        l += 1
    elif td[0] == S[r] and td[1] == "R":
        r -= 1

print(r - l + 1)