ZhenlongDai/ACPR huggingface dataset:
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

A = 0
Z = 0
for i in range(len(s)):
  if s[i] == 'A':
    A = i
    break
    
for i in range(len(s)):
  if s[i] == 'Z':
    Z = i
    
print(Z - A)

Failing test case input:
QWERTXASDFZXCV

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
s = list(input())

A = 0
Z = 0
for i in range(len(s)):
  if s[i] == 'A':
    A = i
    break
    
for i in range(len(s)):
  if s[i] == 'Z':
    Z = i
    
print(Z - A + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = 'HASFJGHOGAKZZFEGA'
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)


Failing test case input:
SEAG[IHNGFKJZHCGB

Expected output:
11


Actual output:
12


Fixed submission (verdict: Accepted):
s = input()
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a_index = s.find("A")
z_index = s.find("Z")
print(z_index - a_index +1)


Failing test case input:
HASHJGFOGAKZZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
a_index = s.find("A")
z_index = s.rfind("Z")
print(z_index - a_index + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
num_A = 0
num_B = 0
for ind,i in enumerate(s):
  if(num_A == 0 and i == 'A'):
    num_A = ind
  if(i == 'Z'):
    num_Z = ind
print(num_B - num_A + 1)

Failing test case input:
HASG[IHOGAKJZFEGA

Expected output:
12


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
num_A = -1
num_Z = -1
for ind,i in enumerate(s):
  if(num_A == -1 and i == 'A'):
    num_A = ind
  if(i == 'Z'):
    num_Z = ind
print(num_Z - num_A + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
flag = 0
start = 0
end = 0
for i in range(len(s)):
    if s[i] == 'A':
        flag = 1
        start = i

    if flag == 1 and s[i] == 'Z':
        end = i
        break
print(end - start + 1)

Failing test case input:
HASGJGFOGAKZZFEIA

Expected output:
12


Actual output:
3


Fixed submission (verdict: Accepted):
s = list(input())
flag = 0
start = 0
end = 0
for i in range(len(s)):
    if flag == 0 and s[i] == 'A':
        flag = 1
        start = i

    if flag == 1 and s[i] == 'Z':
        end = i
print(end - start + 1)

Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
N = len(s)

left = None
right = 0
ans = 0
for i in range(N):
  if s[i] == "A":
    left = i
  elif s[i] == "Z":
    right = i
    if left != None:
      ans = max(ans, right-left+1)
print(ans)

Failing test case input:
HASE[GHOIAKKZFEGA

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
N = len(s)

left = 0
right = 0
for i in range(N):
  if s[i] == "A":
    left = i
    break
for i in range(N-1,-1,-1):
  if s[i] == "Z":
    right = i
    break
print(right-left+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

aind = 0
for i , c in enumerate(s):
  if c == "A":
    aind =  i
    break
zind = 0
for i,c in enumerate(s):
  if c == "Z":
    zind = i
    
print(zind-aind)

Failing test case input:
HARF[IHPGAKKZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
 
aind = 0
for i , c in enumerate(s):
  if c == "A":
    aind =  i
    break
zind = 0
for i,c in enumerate(s):
  if c == "Z":
    zind = i
    
print(zind-aind + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
ans=0
x=0
y=len(s)-1
for i in range(len(s)):
    if s[i]=='A':
        x=i
        break
for i in range(len(s)-1,0,-1):
    if s[-i]=='Z':
        y=i
        break

print(y-x+1)

Failing test case input:
IASG[IHPGFKGZAEKB

Expected output:
12


Actual output:
5


Fixed submission (verdict: Accepted):
s=input()
n=len(s)
x=0
y=n-1
for i in range(n):
    if s[i]=='A':
        x=i
        break
for i in range(n-1,0,-1):
    if s[i]=='Z':
        y=i
        break

print(y-x+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
start = 0
end = 0
flag1 = True
flag2 = True
for i in range(len(s)):
    if s[i] == "A" and flag1 == True:
        start = i
        flag1 = False
    elif s[i] == "Z" and start != 0 and flag2 == True:
        end = i
        flag2 = False
slNnm = (end + 1) - start
print(slNnm)


Failing test case input:
AGEFZJG@GNHHZFSAK

Expected output:
13


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
start = 0
end = 0
flag1 = True
flag2 = True
for i in range(len(s)):
    if s[i] == "A" and flag1 == True:
        start = i
        flag1 = False
    elif s[i] == "Z":
        end = i
slNnm = (end + 1) - start
print(slNnm)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
start = 0
for i in range(len(s)):
  if s[i] == 'A' and start == 0:
    start = i
print(start)
stop = 0
for i in range(len(s), start, -1):
   if s[i -1] == 'Z' and stop == 0:
     stop = i
print(stop)
print(stop - start)

Failing test case input:
TCAG[IHNGFKKZIFGB

Expected output:
11


Actual output:
2
13
11


Fixed submission (verdict: Accepted):
s = input()
start = 0
stop = 0
for i in range(len(s)):
  if s[i] == 'A':
    start = i
    break

for i in range(len(s) -1, start, -1):
  if s[i] == 'Z':
    stop = i
    break
print(stop - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

idx_a = 0
idx_b = 0

for idx, char in enumerate(s):
    if char =='A' and idx_a == 0:
        idx_a = idx
    if char == 'Z':
        idx_b = idx

print(idx_b - idx_a + 1)


Failing test case input:
AIEFZ[KAGOGGJGSBH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()

idx_a = None
idx_b = 0

for idx, char in enumerate(s):
    if char =='A' and idx_a is None:
        idx_a = idx
    if char == 'Z':
        idx_b = idx

print(idx_b - idx_a + 1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
s= s[::-1]
print(len(s[a:-z]))



Failing test case input:
BZACZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
print(len(s)-z-a)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
l = 0
r = 0
for i in range(len(s)):
    if s[i] == 'A' and l == 0:
        l = i
    elif s[i] == 'Z':
        r = i
print(r-l+1)

Failing test case input:
AIEFZGKAFOFGJZSAH

Expected output:
14


Actual output:
7


Fixed submission (verdict: Accepted):
s = input()
l = -1
r = -1
for i in range(len(s)):
    if s[i] == 'A' and l == -1:
        l = i
    elif s[i] == 'Z':
        r = i
print(r-l+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a_index = 0
z_index = 0

for i in range(0, len(s)):
    if s[i] == "A":
        a_index = i
        break
        
for i in range(0, len(s)):
    if s[len(s)-i-1] == "Z":
        z_index = len(s)-i
        break
print(s[a_index:z_index])

Failing test case input:
HASZJGFOGAKGZFEIA

Expected output:
12


Actual output:
ASZJGFOGAKGZ


Fixed submission (verdict: Accepted):
s = input()
a_index = 0
z_index = 0

for i in range(0, len(s)):
    if s[i] == "A":
        a_index = i
        break
        
for i in range(0, len(s)):
    if s[len(s)-i-1] == "Z":
        z_index = len(s)-i-1
        break
print(z_index - a_index +1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
index = []
for i, c in enumerate(s):
    if c == "A":
        index.append(i)
        break

for i, c in enumerate(reversed(s)):
    if c == "Z":
        index.append(i)
        break

count = len(s[index[0]:-index[1]])
print(count)

Failing test case input:
ZCABZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
index = []
for i, c in enumerate(s):
    if c == "A":
        index.append(i)
        break

for i, c in enumerate(reversed(s)):
    if c == "Z":
        index.append(len(s)-i)
        break

count = len(s[index[0]:index[1]])
print(count)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

S = readline().rstrip()
print(S.index('A'))
print(len(S)-(S[::-1].index('Z')+1))
print(abs(S.index('A')-(len(S)-(S[::-1].index('Z')+1)))+1)


Failing test case input:
IASG[IHOGFKGZAEKB

Expected output:
12


Actual output:
1
12
12


Fixed submission (verdict: Accepted):


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

S = readline().rstrip()
print(abs(S.index('A')-(len(S)-(S[::-1].index('Z')+1)))+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

found_a = False
high = 0
low = 0

for index, word in enumerate(s):
    if found_a == False:
        if word == 'A':
            low = index
            found_a = True
    if word == 'Z':
        high = index

print(high - low)

Failing test case input:
HASF\IHOGBKJZFEFA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()

found_a = False
high = 0
low = 0

for index, word in enumerate(s):
    if found_a == False:
        if word == 'A':
            low = index
            found_a = True
    if word == 'Z':
        high = index

print(high - low + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

flag = False
start = 0
end = 0
for i in range(len(s)):
    if start == 0 and s[i] == 'A':
        flag = True
        start = i
    if s[i] == 'Z':
        end = i
if flag:
    print(end - start + 1)
else:
    print(0)

Failing test case input:
AGEFZKKAGOHH[FSAH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()

flag = False
start = 0
end = 0
for i in range(len(s)):
    if not flag and s[i] == 'A':
        start = i
        flag = True
    if s[i] == 'Z':
        end = i
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=str(input())
S=int()
G=int()

for i in range(len(s)):
  if s[i]=='a':
    S=s.index(s[i])
    break
for j in reversed(range(len(s))):
  if s[j]=='z':
    G=s.index(s[j])
    break
print(G-S+1)

Failing test case input:
HASFJGGOGAK[ZFEIA

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
s=str(input())
S=int()
G=int()


for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]


for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for i in range(len(r)):
    if s[i] == "Z":
        z = i +1
        break
print(z-a+1)

Failing test case input:
HASHJGFOGAKZZFEIA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s=str(input())
atoz=[]
for i in range(len(s)):
	if(s[i]=="A"):
		a=i
		break



for i in range(a,len(s)):
	atoz.append(s[i])

s_l=list(atoz)


r_s=[]
s_l_kep=s_l
for i in (reversed(s_l)):
	
	if(i!="Z"):
		s_l.pop()

	else:
		break


str_s_l=''.join(s_l)
print(str_s_l)

Failing test case input:
TCAG[IHNGFKKZIFGB

Expected output:
11


Actual output:
AG[IHNGFKKZ


Fixed submission (verdict: Accepted):

s=str(input())
atoz=[]
for i in range(len(s)):
	if(s[i]=="A"):
		a=i
		break



for i in range(a,len(s)):
	atoz.append(s[i])

s_l=list(atoz)


r_s=[]
s_l_kep=s_l
for i in (reversed(s_l)):
	
	if(i!="Z"):
		s_l.pop()

	else:
		break


str_s_l=''.join(s_l)

print(len(str_s_l))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
for i in range(len(s)-1,0,-1):
    if s[i]=="Z":
        z=i
print(z-a+1)

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
-11


Fixed submission (verdict: Accepted):
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for i in range(len(s)-1,0,-1):
    if s[i]=="Z":
        z=i
        break
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = str(input())
print(len(s))
for i in range(len(s)):
    if s[i] == 'A':
        min = i
        break
for i in reversed(range(len(s))):
    if s[i] =='Z':
        max = i
        break

print(max-min+1)

Failing test case input:
HARF[IHOGAKKZFEGA

Expected output:
12


Actual output:
17
12


Fixed submission (verdict: Accepted):
s = str(input())
for i in range(len(s)):
    if s[i] == 'A':
        min = i
        break
for i in reversed(range(len(s))):
    if s[i] =='Z':
        max = i
        break

print(max-min+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
print(s.find("Z")-s.find("A")+1)

Failing test case input:
AIEFZGKAFOFGJZSAH

Expected output:
14


Actual output:
5


Fixed submission (verdict: Accepted):
s=input()
print(s.rfind("Z")-s.find("A")+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re

s = input()

result = re.search(r"A.*Z", s)
print(result.group(0))


Failing test case input:
HASGJGGOGAK[ZFEIA

Expected output:
12


Actual output:
ASGJGGOGAK[Z


Fixed submission (verdict: Accepted):
import re

s = input()

result = re.search(r"A.*Z", s)
print(len(result.group(0)))
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
      pos_z = i
      if pos_z - pos_a > length:
        length = pos_z - pos_a
      else:
        flag = 0

print(length)

Failing test case input:
HASF[HHOGAKKZFDGA

Expected output:
12


Actual output:
3


Fixed submission (verdict: Accepted):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
list_s = list(s)

a_num = -1
z_num = -1

for i in range(len(s)):
    if list_s[i] == "A":
        a_num = i

    if list_s[i] == "Z":
        z_num = i

print(z_num - a_num + 1)

Failing test case input:
HASF[IHOGAKKZFEGA

Expected output:
12


Actual output:
-3


Fixed submission (verdict: Accepted):
s = input()
list_s = list(s)

a_num = len(s)
z_num = -1

for i in range(len(s)):
    if list_s[i] == "A":
        if a_num > i:
            a_num = i

    if list_s[i] == "Z":
        z_num = i

print(z_num - a_num + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

k = s[::-1]

print(k)

for i in range(len(s)):
    if s[i]=='Z':
        z_num = i 
    if k[i]=='A':
        a_num = i

ans = a_num + z_num + 2 - len(s)

print(ans)


Failing test case input:
HASE[GHOIAKKZFEGA

Expected output:
12


Actual output:
AGEFZKKAIOHG[ESAH
12


Fixed submission (verdict: Accepted):
s = input()

k = s[::-1]

for i in range(len(s)):
    if s[i]=='Z':
        z_num = i 
    if k[i]=='A':
        a_num = i

ans = a_num + z_num + 2 - len(s)

print(ans)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
b = 0
c = 0
d = False
f = []
for i in a:
     if i == "A"and b == 0:
           d = True
           b += 1
     if d == True:
          c += 1
     if i == "Z":
          d = False
          b = 0
          f.append(c)
          c = 0
print(max(f))


Failing test case input:
HASHJGFOGAKZZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
a = input()
b = 0
count = 0
d = 0 
e = []
flag = False
for i in a:
     if i == "A" and d == 0:
          b = count
          flag = True
          d += 1
     if i == "Z":
          e.append(count)
     count += 1
print(e[-1]-b+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A':
        a = i+1
        break
for i in range(1, len(s)):
    if s[-i] == 'Z':
        z = len(s)-i+1
print(z-a+1)

Failing test case input:
HASFJGHOGAKZZFEGA

Expected output:
12

Actual output:
11


Fixed submission (verdict: Accepted):
s = list(input())
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A':
        a = i+1
        break
for i in range(1, len(s)):
    if s[-i] == 'Z':
        z = len(s)-i+1
        break
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
str = input('')
start = 0
end = 0
for x in range(len(str)):
  if str[x] == 'A' and start != 0:
    start = x
  elif str[x] == 'Z':
    end = x
print(end - start + 1)

Failing test case input:
ZCABZ

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
str = input('')
start = -1
end = -1
for x in range(len(str)):
  if str[x] == 'A' and start == -1:
    start = x
  elif str[x] == 'Z':
    end = x
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
print(len(S) -S[::-1].find("Z") -S.find("A") +2)

Failing test case input:
HASF[HHOGAKKZFEGA

Expected output:
12


Actual output:
14


Fixed submission (verdict: Accepted):
S = input()
print(len(S) -S[::-1].find("Z") -S.find("A"))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
A = S.index('A')
Z = S[::-1].index('Z')
print(len(S[A:-Z]))

Failing test case input:
ZCAAZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
A = S.index('A')
Z = S[::-1].index('Z')
if Z == 0:
    Z = -len(S)
print(len(S[A:-Z]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
i=s.find('A')
j=s.rfind('Z')

print(i)
print(j)

print(abs(i-j+1))

Failing test case input:
HASF[HHOGAKKZFEGA

Expected output:
12


Actual output:
1
12
10


Fixed submission (verdict: Accepted):
s=input()
i=s.find('A')
j=s.rfind('Z')

print(abs(i-j)+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s_list = list(input())
a_num = 0
z_num = 0
for i,a in enumerate(s_list):
    if a == 'A':
        a_num = i
        break
rs_list = reversed(s_list)
for j,z in enumerate(rs_list):
    if z == 'Z':
        z_num = j
        break
print(a_num,z_num,)
if z_num == 0:
    print(len(s_list[a_num:]))
else:
    print(len(s_list[a_num:-z_num]))

Failing test case input:
HASF\IHOGBKJZFEGA

Expected output:
12


Actual output:
1 4
12


Fixed submission (verdict: Accepted):
s_list = list(input())
a_num = 0
z_num = 0
for i,a in enumerate(s_list):
    if a == 'A':
        a_num = i
        break
rs_list = reversed(s_list)
for j,z in enumerate(rs_list):
    if z == 'Z':
        z_num = j
        break
if z_num == 0:
    print(len(s_list[a_num:]))
else:
    print(len(s_list[a_num:-z_num]))
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
index = []
for i, c in enumerate(s):
    if c == "A":
        index.append(i)
        break

for i, c in enumerate(reversed(s)):
    if c == "Z":
        index.append(len(s)-i)
        break

count = len(s[index[0]:index[1]])

Failing test case input:
HASF\IHOGBKJZFEGA

Expected output:
12


Actual output:

Fixed submission (verdict: Accepted):
s = input()
index = []
for i, c in enumerate(s):
    if c == "A":
        index.append(i)
        break

for i, c in enumerate(reversed(s)):
    if c == "Z":
        index.append(len(s)-i)
        break

count = len(s[index[0]:index[1]])
print(count)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
s = input().rstrip()
s_rev = s[::-1]
mina = -1
maxz = -1
for i in range(len(s)):
    if s[i] == "A":
        mina = i
for j in range(len(s)):
    if s[j] == "Z":
        maxz = max(maxz, j)
print(maxz - mina + 1)


Failing test case input:
IASG[IHOGFKKZAFGB

Expected output:
12


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
s = input().rstrip()
s_rev = s[::-1]
mina = -1
maxz = -1
for i in range(len(s)):
    if s[i] == "A":
        mina = i
        break
for j in range(len(s)):
    if s[j] == "Z":
        maxz = max(maxz, j)
print(maxz - mina + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
start = 0
stop = 0
for i in range(len(list(s))):
    if s[i] == "A":
        start = i
        break
for j in range(len(list(s))):
    if s[-j-1] == "Z":
        stop = -j-1
        break
print(len(list(s[start:stop+1])))

Failing test case input:
ZCABZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s = list(input())
start = 0
end = 0
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
for j in range(len(s)):
    if s[-j-1] == "Z":
        end = -j-1
        break
if end == -1:
    print(len(s[start:]))
else:
    print(len(s[start:end+1]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
start = s.index("A")
fin = s.rindex("Z")
ans = s[start:fin+1]
print(len(ans),ans)


Failing test case input:
HASHJGFOGAKZZFEIA

Expected output:
12


Actual output:
12 ASHJGFOGAKZZ


Fixed submission (verdict: Accepted):
s = input()
start = s.index("A")
fin = s.rindex("Z")
ans = s[start:fin+1]
print(len(ans))

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
lengs = s.rfind("Z") - s.find("A")
print(lengs)

Failing test case input:
HASF[GHOIAKKZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
lengs = s.rfind("Z") - s.find("A")
print(lengs+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
min_ = 0
max_ = 0
flag_min = True
for i in range(len(S)):
  print(min_, max_)
  if flag_min:
    if S[i] == "A":
      min_ = i
      flag_min = False
  else:
    if S[i] == "Z":
      max_ = i
      
print(max_ - min_ + 1)

Failing test case input:
HASF[IHOGAKKZFEGA

Expected output:
12


Actual output:
0 0
0 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 12
1 12
1 12
1 12
12


Fixed submission (verdict: Accepted):
S = input()
min_ = 0
max_ = 0
flag_min = True
for i in range(len(S)):
  if flag_min:
    if S[i] == "A":
      min_ = i
      flag_min = False
  else:
    if S[i] == "Z":
      max_ = i
      
print(max_ - min_ + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
start = -1
end = -1
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
for i in range(len(s)):
    if s[-i] == "Z":
        end = len(s) - i
        break
print(end - start + 1)

Failing test case input:
ZCAZB

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
start = -1
end = -1
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
for i in range(1,len(s)):
    if s[-i] == "Z":
        end = len(s) - i
        break
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
print(S.rindex("Z")-S.index("A"))

Failing test case input:
ICAG[IHNGFKKZSFGB

Expected output:
11


Actual output:
10


Fixed submission (verdict: Accepted):
S = input()
print(S.rindex("Z") - S.index("A") + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = s.index('A')
z = s.index('Z')
print(s[a:z+1])

Failing test case input:
TCAG[IHNGFHKZIFKB

Expected output:
11


Actual output:
AG[IHNGFHKZ


Fixed submission (verdict: Accepted):
s = input()
a = s.find('A')
z = s.rfind('Z')
print(z-a+1)

Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    s =     _in[0]   
    
    str_ = s[s.find('A'):s.rfind('Z')+1]
    
    print(str_)


Failing test case input:
AGEFZKKAGOHI[FSAH

Expected output:
5


Actual output:
AGEFZ


Fixed submission (verdict: Accepted):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    s =     _in[0]   
    
    cnt = s.rfind('Z')-s.find('A')+1
    
    print(cnt)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
st = 0
ed = 0
for i in range(len(S)):
    if (S[i] == 'A'):
        st = min(i, st)
        print(S[i], i, st)
    if (S[i] == 'Z'):
        ed = i
        print(S[i], i, ed)
ans = ed - st + 1
print(ans)

                        



Failing test case input:
IBAH[IHNGFKKZSFGB

Expected output:
11


Actual output:
A 2 0
Z 12 12
13


Fixed submission (verdict: Accepted):
S = list(input())
st = len(S)
ed = 0
for i in range(len(S)):
    if (S[i] == 'A'):
        st = min(i, st)
    if (S[i] == 'Z'):
        ed = i
ans = ed - st + 1
print(ans)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
      pos_z = i
      if pos_z - (pos_a -1) > length:
        length = pos_z - (pos_a -1)
      else:
        flag = 0

print(length)

Failing test case input:
HASG\IHOGAKJZFEGA

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




def atozString(dataStr) :

	rangeFirstToEnd = range(0,len(dataStr),1)
	rangeEndToFirst = range(len(dataStr)-1,-1,-1)
	firstA = 0
	lastZ = len(dataStr)
	for i in rangeFirstToEnd:
		if dataStr[i] == 'A':
			firstA = i
			break

	for i in rangeEndToFirst:
		if dataStr[i] == 'Z':
			lastZ = i
			break

	print(dataStr[firstA:lastZ+1])
	answerInt = lastZ-firstA+1
	return answerInt


if __name__ == '__main__':
	inputLine = input()
	inputStr = inputLine
	ans=atozString(inputStr)
	print(ans)

Failing test case input:
IAAG[IHNGFKKZSFGB

Expected output:
12


Actual output:
AAG[IHNGFKKZ
12


Fixed submission (verdict: Accepted):




def atozString(dataStr) :

	rangeFirstToEnd = range(0,len(dataStr),1)
	rangeEndToFirst = range(len(dataStr)-1,-1,-1)
	firstA = 0
	lastZ = len(dataStr)
	for i in rangeFirstToEnd:
		if dataStr[i] == 'A':
			firstA = i
			break

	for i in rangeEndToFirst:
		if dataStr[i] == 'Z':
			lastZ = i
			break

	answerInt = lastZ-firstA+1
	return answerInt


if __name__ == '__main__':
	inputLine = input()
	inputStr = inputLine
	ans=atozString(inputStr)
	print(ans)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
for i in range(len(s)):
    if s[i]=="A":
        x=i
        break
for i in range(len(s)):
    if s[-i]=="Z":
        y=len(s)-i
        break
ans=y-x+1
print(ans)

Failing test case input:
ZCAZB

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s=input()
for i in range(len(s)):
    if s[i]=="A":
        x=i
        break
for i in range(1,len(s)):
    if s[-i]=="Z":
        y=len(s)-i
        break
ans=y-x+1
print(ans)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def a2z_string(s: str)->int:
    a = s.find('a')
    z = s.rfind('z')
    return z - a + 1


if __name__ == "__main__":
    s = input()
    ans = a2z_string(s)
    print(ans)


Failing test case input:
IASG[IHPGFKGZAEKB

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
def a2z_string(s: str)->int:
    a = s.find('A')
    z = s.rfind('Z')
    return z - a + 1


if __name__ == "__main__":
    s = input()
    ans = a2z_string(s)
    print(ans)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = s.find("a")
z = s.rfind("z")
print(z - a + 1)


Failing test case input:
GASF[HHNG@KJZFEGA

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
a = s.find("A")
z = s.rfind("Z")
print(z - a + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
print(len(s) - 1 - s[::-1].index('Z') - s.index('A'))

Failing test case input:
IASG[IHPGFKGZAEKB

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = list(input())
print(len(s) - s.index('A') - s[::-1].index('Z'))
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    l, r = map(int, input().split())
    minv = 2019
    if r - l > 2019+1:
        print(0)
    else:
        for i in range(l, r+1):
            for j in range(l, r+1):
                if i < j:
                    minv = min(minv, (i*j)%2019)
    print(minv)

if __name__ == '__main__':
    main()

Failing test case input:
543 3053

Expected output:
0


Actual output:
0
2019


Fixed submission (verdict: Accepted):
def main():
    l, r = map(int, input().split())
    minv = 2019
    if r - l > 2019+1:
        print(0)
    else:
        for i in range(l, r+1):
            for j in range(l, r+1):
                if i < j:
                    minv = min(minv, (i*j)%2019)
        print(minv)

if __name__ == '__main__':
    main()

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L,R = map(int, input().split())

List = []
if R-L >= 2019:
    ans = 0
    print("why")
else:
    while L <= R:
        List.append(L%2019)
        L += 1
    List.sort()
    ans = ((List[0]*List[1])%2019)
    
print(ans)

Failing test case input:
461 3053

Expected output:
0


Actual output:
why
0


Fixed submission (verdict: Accepted):
L,R = map(int, input().split())

List = []
if R-L >= 673:
    ans = 0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            List.append((i*j)%2019)
    ans = min(List)
    
print(ans)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L, R = map(int, input().split())

min1 = 10000
border = 4039
ancker = 99999

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min1 :
        min1 = i % 2019
        ancker = i

min2 = 100000

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min2 and i != ancker:
        min2 = i % 2019

print(min1 * min2)


Failing test case input:
2845 3053

Expected output:
1


Actual output:
683102


Fixed submission (verdict: Accepted):
L, R = map(int, input().split())

min1 = 10000
border = 4039
ancker = 99999



min1 = 100000

for i in range(L,  min(R+1, L + border)) :
    for j in range(i + 1, min(R+1, L + border)) :
        if (i * j) % 2019 < min1 :
            min1 = (i * j) % 2019



print(min1)

Problem: p02983
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):



def main():
    l, r = map(int, input().split())
    mod = 2019
    l %= mod
    r %= mod
    ans = float('inf')

    if l > r:
        l, r = r, l

    for i in range(l, r):
        for j in range(i + 1, r + 1):
            candidate = i * j
            candidate %= mod
            ans = min(ans, candidate)

    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):



def main():
    l, r = map(int, input().split())
    mod = 2019
    ans = mod
    r = min(r, l + mod)

    for i in range(l, r):
        for j in range(i + 1, r + 1):
            candidate = i * j
            candidate %= mod
            ans = min(ans, candidate)

    print(ans)


if __name__ == '__main__':
    main()
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l, r = map(int, input().split())

l %= 2019
r %= 2019

min = 2020
for i in range(l, r):
    for j in range(i+1, r+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019
print(min)

Failing test case input:
-7 67

Expected output:
0


Actual output:
2020


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())

if (r-l)>=2019:
    print(0)
else:
    l %= 2019
    r %= 2019

    min = 2020
    for i in range(l, r):
        for j in range(i+1, r+1):
            if (i*j)%2019 < min:
                min = (i*j)%2019
    if l>=r:
        min = 0
    print(min)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

L, R = map(int, sys.stdin.readline().split())
mod = 2019

mod_L = L%2019
mod_R = R%2019

if R - L >= 2019:
    temp_i = mod_L
    temp_j = 2018
else:
    temp_i = mod_L
    temp_j = mod_R

min_mod = 9999
for i in range(mod_L, mod_R):
    for j in range(i + 1, mod_R + 1):
        if ((i*j)%mod) < min_mod:
            min_mod = (i*j)%mod
print(min_mod)

Failing test case input:
-1 113

Expected output:
0


Actual output:
9999


Fixed submission (verdict: Accepted):
import sys

L, R = map(int, sys.stdin.readline().split())
mod = 2019

mod_L = L%2019
mod_R = R%2019

for i in range(L + 1, R + 1):
    if i % mod == 0:
        print(0)
        sys.exit()

if R - L >= 2019:
    temp_i = mod_L
    temp_j = 2018
else:
    temp_i = mod_L
    temp_j = mod_R

min_mod = 2019
for i in range(mod_L, mod_R):
    for j in range(i + 1, mod_R + 1):
        if ((i*j)%mod) < min_mod:
            min_mod = (i*j)%mod
print(min_mod)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l,r = map(int,input().split())
diff = r - l

if(diff >= 2019):
  print(0)
else:
  lmod = l % 2019
  rmod = r % 2019
  if(rmod  < lmod):
    print(0)
  else:
    ans =2020
    for i in range(l,r+1):
      for j in range(i,r+1):
        if((i*j) % 2019 < ans):
          ans = (i*j) % 2019
    print(ans)

Failing test case input:
2020 2040

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
l,r = map(int,input().split())
diff = r - l

if(diff >= 2019):
  print(0)
else:
  lmod = l % 2019
  rmod = r % 2019
  if(rmod  < lmod):
    print(0)
  else:
    ans =2020
    for i in range(l,r+1):
      for j in range(i+1,r+1):
        if((i*j) % 2019 < ans):
          ans = (i*j) % 2019
    print(ans)

Problem: p02983
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import heapq

l,r = map(int,input().split())
n = r - l + 1
if n >= 2019:
	print(0)
else:
	l_to_r = []
	for i in range(l,r+1):
		l_to_r.append(i % 2019)
	heapq.heapify(l_to_r)
	minimum1 = heapq.heappop(l_to_r)
	minimum2 = heapq.heappop(l_to_r)
	print(minimum1*minimum2 % 2019)


Failing test case input:
2020 3053

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
l,r = map(int,input().split())
n = r - l + 1
if n >= 2019:
	print(0)
else:
	l_to_r = []
	for i in range(l,r+1):
		l_to_r.append(i % 2019)
	ans = []
	for i in range(n-1):
		for j in range(i+1,n):
			ans.append(l_to_r[i] * l_to_r[j] % 2019)
	print(min(ans))
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = list(map(int,input().split()))

res = 10**9
for i in range(n, m):
    res = min(res, (i*(i+1)) % 2019)
    if res == 0:
      print(0)
      exit()
print(res)

Failing test case input:
2845 3053

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n, m = list(map(int,input().split()))

res = 10**9
for i in range(n, m):
    for j in range(i+1, m+1):
        res = min(res, (i*j % 2019))
        if res == 0:
            print(0)
            exit()
print(res)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l,r=map(int,input().split())
l=l%2019
r=r%2019
ans = float("inf")
for i in range(l,r+1):
    for j in range(l,r+1):
        if i<j:
            ans=min(ans,(i*j)%2019)
print(ans)

Failing test case input:
-2 25

Expected output:
0


Actual output:
inf


Fixed submission (verdict: Accepted):
l,r=map(int,input().split())
ans = 2018
for i in range(l,r+1):
    for j in range(l,r+1):
        if i<j:
            ans = min(ans,(i*j)%2019)
            if ans == 0:
                print(0)
                exit()
print(ans)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l, r = map(int, input().split())
mod = 2019
mod_min = 2100

s = l % mod
e = r % mod

if s > e:
    t = s
    s = e
    e = t
    
for i in range(s,e):
    for j in range(i+1,e+1):

        
        m = (i * j) % mod
        

        if m < mod_min:
            mod_min = m

print(mod_min)

Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())
mod = 2019
mod_min = 2019


for i in range(l,r):
    for j in range(i+1,r+1):
        m = (i * j) % mod
        if m < mod_min:
            mod_min = m
        if mod_min == 0:
            break
    if mod_min == 0:
        break

print(mod_min)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

L, R = map(lambda x: int(x) % 2019, input().split())

if L == 0 or R == 0:
    print(0)
    exit(0)

if L > R:
    R, L = L, R

min_mod = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        min_mod = min(min_mod, (i * j) % 2019)

print(min_mod)


Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):

L, R = map(int, input().split())

min_mod = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        min_mod = min(min_mod, (i * j) % 2019)
        if min_mod == 0:
            print('0')
            exit(0)

print(min_mod)
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().split()
L = int(s[0])
R = int(s[1])
 
L = L%2019
R = R%2019
MIN = 2020
 
for i in range(min(L,R),max(L,R)+1):
    for j in range(i,max(L,R)+1):
        if i != j:
            mod = i*j
            MIN = min(MIN,mod%2019)
if R == 0 or L == 0:
    print(0)
elif abs(R - L) == 1:
    print((R*L)%2019)
elif R == L:
    print((R*L)%2019)
else:
    print(MIN)

Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):
s = input().split()
L = int(s[0])
R = int(s[1])

MIN = 2020
flag = 0

for i in range(L,R+1):
    for j in range(i+1,R+1):
        mod = i*j % 2019
        MIN = min(MIN,mod%2019)
        if MIN == 0:
            flag = 1
            break
    if flag == 1:
        break

if R == 0 or L == 0:
    print(0)
elif R - L == 1:
     print((R*L)%2019)
else:
    print(MIN)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L,R = map(int,input().split())
ans = float('inf')
for i in range(L,min(L+2019,R)):
    for j in range(L,min(L+2019,R)):
        if ans > (i*j)%2019:
            ans = (i*j)%2019
print(ans)

Failing test case input:
2020 2040

Expected output:
2

Actual output:
1


Fixed submission (verdict: Accepted):
L,R = map(int,input().split())
ans = float('inf')
for i in range(L,min(L+2019,R)):
    for j in range(i+1,min(L+2019,R)+1):
        ans = min(ans,(i*j)%2019)
print(ans)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L,R = map(int,input().split())
target = 2019
L_mod = L % target
R_mod = R % target

if L_mod > R_mod:
    print(0)
    exit(0)
if L_mod == R_mod and L < R:
    print(0)
    exit(0)
if L_mod == R_mod:
    print(L_mod)
    exit(0)
if L+1 == R:
    print(L * R % target)
    exit(0)
if L_mod < R_mod and R-L >= target:
    print(0)
    exit(0)

ans = 2019
for i in range(R_mod-L_mod):
    for j in range(R_mod-L_mod):
        if ((L+i) * (L+j)) % target < ans:
            
            
            ans = ((L+i) * (L+j)) % target
print(ans)






Failing test case input:
1 78

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
L,R = map(int,input().split())
target = 2019
L_mod = L % target
R_mod = R % target

if L_mod > R_mod:
    print(0)
    exit(0)
if L_mod == R_mod and L < R:
    print(0)
    exit(0)
if L+1 == R:
    print(L * R % target)
    exit(0)
if L_mod < R_mod and R-L >= target:
    print(0)
    exit(0)

ans = 2019
for i in range(R_mod-L_mod + 1):
    for j in range(i+1,R_mod-L_mod+1):
        
        if ((L+i) * (L+j)) % target < ans:
            
            
            ans = ((L+i) * (L+j)) % target
            if ans == 0:
                print(0)
                exit(0)
print(ans)
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    l, r = L%MOD, R%MOD
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()


Failing test case input:
-5 15

Expected output:
0


Actual output:
inf


Fixed submission (verdict: Accepted):
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    if R - L >= 2019:
        print(0)
        exit()

    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l,r = map(int,input().split())
ans = 10**9
for i in range(l,r+1):
    n = i*(i+1)%2019
    ans = min(ans,n)
    if n ==0:
        print(0)
        exit()
print(ans)


Failing test case input:
2845 3053

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())

ans = 10 ** 5
for i in range(l, r):
    for j in range(i + 1, r+1):
        n = (i * j) % 2019
        ans = min(ans, n)
        if n == 0:
            print(0)
            exit()
print(ans)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l, r = map(int, input().split())

ans = 2018

ml = l % 2019
mr = r % 2019

t = mr - ml

ch = 0
while t < 0:
    t += 2019
    ch += 1
mr += ch * 2019

for i in range(t):
    for j in range(t - i):
        p = ((ml + i) * (ml + i + j + 1)) % 2019
        if p < ans:
            ans = p

print(ans)


Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())

t = r - l

if t > 673:
    print("0")
else:
    ans = 2018
    for i in range(t):
        for j in range(t - i):
            p = ((l + i) * (l + i + j + 1)) % 2019
            if p < ans:
                ans = p
    print(ans)

Problem: p02983
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
l, r = map(int, input().split())
l %= 2019
r %= 2019
ans = float('inf')
for i in range(l, r):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%2019)
print(ans)

Failing test case input:
-2 25

Expected output:
0


Actual output:
inf


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())
ans = float('inf')
for i in range(l, r):
    for j in range(i+1, r+1):
        if (i*j)%2019 == 0:
            print(0)
            exit()
        ans = min(ans, (i*j)%2019)
print(ans)
Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l,r=map(int, input().split())
if r > 2019:
    r %= 2019
if l > 2019:
    l %=2019
if(r-l >= 2019) or (r%2019<l%2019):
    print(0)
else:
    rem = 2018
    for i in range(l%2019,r%2019):
        for j in range(l%2019+1,r%2019+1):
             if rem<(i*j)%2019:
                continue
             else:
                rem = (i*j)%2019
    print(rem)

Failing test case input:
1022 3053

Expected output:
0


Actual output:
22


Fixed submission (verdict: Accepted):
l,r=map(int, input().split())

mod_l = l % 2019
mod_r = r % 2019

if (r - l >= 2019) or (mod_r < mod_l):
  print('0')
else:
  rem = 2018
  for i in range(mod_l, mod_r):
    for j in range(i+1, mod_r+1):
      if rem < (i*j)%2019:
        continue
      else:
          rem = (i*j)%2019

  print(rem)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L,R=map(int,input().split())
l=L%2019
r=R%2019
if R-L>2018:
  print(0)
else:
  if l>r:
    print(0)
  else:
    ans=2019
    for i in range(r-l):
      for j in range(r-l-i):
        x=((l+i)*(l+j))%2019
        ans=min(ans,x)
    print(ans)
        

Failing test case input:
1 64

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
L,R=map(int,input().split())
l=L%2019
r=R%2019
if R-L>2018:
  print(0)
else:
  if l>r:
    print(0)
  else:
    ans=2019
    for i in range(r-l):
      for j in range(r-l-i):
        x=((l+i)*(l+i+j+1))%2019
        ans=min(ans,x)
    print(ans)

Problem: p02983
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

L, R = map(int, input().split())
ans = 10 ** 10

for i in range(L, R+1):
    if i % 2019 == 0:
        ans = 0
        break

if ans != 0:
    ans = L * (L + 1) % 2019

print(ans)

Failing test case input:
1 176

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):


L, R = map(int, input().split())
ans = 10 ** 10

for i in range(L, R+1):
    if ans == 0:
        break
    for j in range(i+1, R+1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            break

print(ans)

Problem: p02983
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
l, r = map(int, input().split())

ans = float('inf')
for i in range(1, 2020 ** 2 + 1):
    if l <= i and i + 1 <= r:
        ans = min(ans, i * (i + 1) % 2019)

print(ans)


Failing test case input:
-1 125

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
l, r = map(int, input().split())

ans = float('inf')
for i in range(l, min(r + 1, l + 2020)):
    for j in range(i + 1, min(r + 1, i + 1 + 2020)):
        ans = min(ans, i * j % 2019)

print(ans)