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

Fixed submission:
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
mn = min(ab,key=lambda x:x[1])
print(sum(mn))

Buggy submission (verdict: Runtime Error):
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input.split())))
ans = N
mx = max(ab,key=lambda x:x[1])[0]
ans += mx - 1
mn = min(ab,key=lambda x:x[1])[1]
ans += mn
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ab = []
for i in N:
    ab.append(tuple(map(int,input.split())))
ans = N
mx = max(ab,key=lambda x:x[1])[0]
ans += mx - 1
mn = min(ab,key=lambda x:x[1])[1]
ans += mn
print(ans)
Problem p03674 (python)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] 

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
N = n
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(N,k,mod)-cmb(N+x-y-1,k-1,mod))%mod)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
  if S[i] == T[i]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
count = 0
for i in range(3):
  if S[3] == T[3]:
    count += 1
print(count)
Problem p02957 (python)

Fixed submission:
A,B = map(int,input().split())
K=(A+B)/2
if K%1==0:
  print(int(K))
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
s=c-(a-b)
if s>0:
  print(s)
else:
  print('0')
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r**2)

Buggy submission (verdict: Runtime Error):
x,a = map(int,input().split())
if x < a:
  print(0)
else:
  print(10)
Problem p03071 (python)

Fixed submission:
a,b = map(int,input().split())
s = [a,b]
if a!=b:
  print(max(s)*2-1)
else:
  print(max(s)*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
a=[h[i+1] for i in range(n-1) if h[i] >= max(h[i:])]
print(len([i for i in a if i >= h[0]])+1)
Problem p03035 (python)

Fixed submission:
a,b=map(int, input().split())
if a>=13: ans = b
elif 6<=a<=12: ans = b//2
else: ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
if a>=13:
    ans = b
elif 6<=a<=12:
    ans = b//2
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
if a>=13:
    ans = b
elif 6 <= a <= 12:
    b//2
print(ans)
Problem p02999 (python)

Fixed submission:
x,a=map(int,(input().split()))
if x<a:
  print("0")
else:
  print("10")

Buggy submission (verdict: Runtime Error):
x,a=map(int,(input().split()))
if x<a:
  print("0")
else:
  print{"10")
Problem p03476 (python)

Fixed submission:
f = [False for i in range(100001)]
c = [0 for i in range(100001)]

for i in range(2, 100001):
    if not f[i]:
        for j in range(2*i, 100001, i):
            f[j] = True
for i in range(3, 100001, 2):
    if not f[i] and not f[int((i+1)/2)]:
        c[i] += 1
for i in range(3, 100001):
    c[i] += c[i-1]
    
n = int(input())
while n:
    l, r = list(map(int, input().split()))
    print (c[r]-c[l-1])
    n -= 1

Buggy submission (verdict: Runtime Error):
f = [False for i in range(100001)]
c = [0 for i in range(100001)]

for i in xrange(2, 100001):
    if not f[i]:
        for j in range(2*i, 100001, i):
            f[j] = True
for i in xrange(3, 100001, 2):
    if not f[i] and not f[int((i+1)/2)]:
        c[i] += 1
for i in xrange(3, 100001):
    c[i] += c[i-1]
    
n = int(input())
while n:
    l, r = list(map(int, input().split()))
    print (c[r]-c[l-1])
    n -= 1
Problem p03545 (python)

Fixed submission:
n = int(input())
a = n // 1000
b = n % 1000 // 100
c = n % 100 // 10
d = n % 10

def calc(ind, x):
    if ind == 0:
        return x
    else:
        return -x

flag = 0
for j in range(2):
    ans1 = a
    if flag:
        break
    ans2 = ans1 + calc(j, b)
    for k in range(2):
        if flag:
            break
        ans3 = ans2 + calc(k, c)
        for l in range(2):
            ans4 = ans3 + calc(l, d)
            if ans4 == 7:
                flag = 1
                result = ['+' if x == 0 else '-' for x in [j, k, l]]
                break
answer = str(a) + result[0] + str(b) + result[1] + str(c) + result[2] + str(d) + '=7'
print (answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n // 1000
b = n % 1000 // 100
c = n % 100 // 10
d = n % 10

def calc(ind, x):
    if ind == 0:
        return x
    else:
        return -x

flag = 0
for j in range(2):
    ans = a
    if flag:
        break
    ans += calc(j, b)
    for k in range(2):
        if flag:
            break
        ans += calc(k, c)
        for l in range(2):
            ans += calc(l, d)
            if ans == 7:
                flag = 1
                result = ['+' if x == 0 else '-' for x in [j, k, l]]
                break
answer = str(a) + result[0] + str(b) + result[1] + str(c) + result[2] + str(d) + '=7'
print (answer)
Problem p03591 (python)

Fixed submission:
a = str(raw_input())
if a[0:4] == 'YAKI':
    print 'Yes'
else:
    print 'No'

Buggy submission (verdict: Runtime Error):
a = str(raw_input())
if 1a[0:4] == 'YAKI':
    print 'Yes'
else:
    print 'No'
Problem p03997 (python)

Fixed submission:
a = input()
b = input()
h = input()
print (a + b) * h / 2

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, raw_input().split())
print (a + b) * h / 2
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
s=[]
i=0
j=0
if (r-l)>4038:
    while i!=(r-l)+1 and i!=2019:
        while j!=(r-l)+1 and j!=2019:
            s.append(((l+i)*(l+j))%2019)
            j+=1
        j=0
        i+=1
    print(min(s))
else:
    while i!=(r-l)+1:
        while j!=(r-l)+1:
            if i!=j:
                s.append(((l+i)*(l+j))%2019)
            j+=1
        j=0
        i+=1
    #print(s)
    print(min(s))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
i=0
s=[]
if (r-l)>2019:
    print(0)
else:
    while i!=(r-l)+1:
        s.append(((l+i)%2019))
        i+=1
    s.sort()
print(s[0]*s[1])
Problem p02995 (python)

Fixed submission:

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


f = [c]
x = 1000000
k = [c, d]

while x != 0:
    x = max(k) % min(k)

    if x != 0:
        f.append(x)
    k.sort()
    k[1] = x
#print(min(f))

cc = (b // c)- ((a - 1) // c)
dd = (b // d)- ((a - 1) // d)
cd =(b // (c * d // min(f)))- ((a - 1) // (c * d // min(f)))
#print(cc,"cc")
#print(dd,"dd")
#print(cd,"cd")

print(int(b - a + 1 - cc - dd + cd))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())

if a%c==0:
    cc=int(b/c)-int(a/c)
else:
    cc = int(b / c) - (int(a / c)+1)


if a%d==0:
    dd = int(b / d) - int(a / d)
else:
    dd=int(b/d)-int((a/d)+1)

i=0
f=[c]
x=10000000
k=[c,d]

while x!=0:
    x=max(k)%min(k)

    if x!=0:
        f.append(x)
    k.sort()
    k[1]=x
#Wprint(min(f))
    if (int(b / (c*d/min(f))))!=( int(a / (c*d/min(f)))):
        if a%d==0:
            cd = int(b / (c*d/min(f)))- int(a / (c*d/min(f)))
        else:
            cd=int(b/(c*d/min(f)))-(int(a/(c*d/min(f)))+1)
        cd=0


print(b-a-cc-dd+cd)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
cc=math.floor(b/c)-math.ceil(a/c)
dd=math.floor(b/d)-math.ceil(a/d)
cd=math.floor(b/(c*d/math.gcd(c, d)))-math.ceil(a/(c*d/math.gcd(c, d)))
print(b-a-cc-dd+cd)
Problem p03000 (python)

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

s=list(map(int,input().split()))
i=0
ans=0
l=0
while l<=x:
    try:

       l=l+s[i]
       ans+=1
       i+=1
    except:
        ans+=1
        break
print(ans)

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

s=list(map(int,input().split()))
i=0
ans=0
l=0
while l<=x:
   l=l+s[i]
   ans+=1
   i+=1
print(ans)
Problem p03006 (python)

Fixed submission:
n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
while i!=n:
    while j!=n:
        if i!=j:
            f.append(d[i][0]-d[j][0])
            f.append(d[i][1] - d[j][1])
            s.append(f)
            f=[]

        j += 1
    i+=1
    j=0


#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
try:
    print(int(n-max(f)))
except:
    print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
try:
    while i!=n:
        while j!=n:
            if i!=j:
                f.append(d[i][0]-d[j][0])
                f.append(d[i][1] - d[j][1])
                s.append(f)
                f=[]
    
            j += 1
        i+=1
        j=0
except:
    break

#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
print(int(n-max(f)))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
while i!=n:
    while j!=n:
        if i!=j:
            f.append(abs(d[i][0]-d[j][0]))
            f.append(abs(d[i][1] - d[j][1]))
            s.append(f)
            f=[]

        j += 1
    i+=1
    j=0


#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
print(int(n-max(f)/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
while i!=n:
    while j!=n:
        if i!=j:
            f.append(d[i][0]-d[j][0])
            f.append(d[i][1] - d[j][1])
            s.append(f)
            f=[]

        j += 1
    i+=1
    j=0


#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
print(n-max(f))
Problem p03160 (python)

Fixed submission:
n=int(input())
h = list(map(int, input().split()))
s=list(range(n))
s[n-1]=0
s[n-2]=abs(h[-2]-h[-1])
i=n-3
a=[]
if n!=2:

    while i!=-1:
        a=[abs(h[i]-h[i+1])+s[i+1],abs(h[i]-h[i+2])+s[i+2]]
        s[i]=min(a)
        i-=1

print(s[0])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=list(range(n))
x[n-1]=0
#print(x)
i=n-2
j=1
y=[]
while i!=-1:
    j=1
    while j!=k+1 and j+i!=n:
        y.append(abs(a[i]-a[j+i])+x[j+i])
        #print(a[i])
        #print(a[j+i])
        j+=1

    #print(y)
    x[i]=min(y)
    #print(x)
    y=[]

    i-=1
print(x[0])
Problem p03681 (python)

Fixed submission:
import math
a=list(map(int,input().split()))
ans=0
if max(a)-min(a)>=2:
    print(0)
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=(ans%1000000007)*(ans%1000000007)*2
    else:
        ans=math.factorial(max(a))
        ans1 = math.factorial(min(a))
        ans=(ans%1000000007)*((ans1)%1000000007)
    print(int(ans%1000000007 ))

Buggy submission (verdict: Runtime Error):
import math
a=list(map(int,input().split()))
ans=0
if max(a)-min(a)>=2:
    print(0)
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=(ans%1000000007)*(ans%1000000007)*2
    else:
        ans=math.factorial(max(a))
        ans=(ans%1000000007)*((ans/max(a))%1000000007)
    print(int(ans%1000000007 ))

Buggy submission (verdict: Runtime Error):
import math
a=list(map(int,input().split()))
ans=0
if max(a)-min(a)>=2:
    print(0)
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=ans*ans*2
    else:
        ans=math.factorial(max(a))
        ans=ans*ans/max(a)
        #print(ans)

    print(int(ans%1000000007 ))

Buggy submission (verdict: Runtime Error):
import math
a=list(map(int,input().split()))
ans=0
i=0
if max(a)-min(a)>=2:
    pass
else:
    if a[0]==a[1]:
        ans=math.factorial(max(a))
        ans=ans*ans*2
    else:
        ans=math.factorial(max(a))
        ans=ans*ans/max(a)
        #print(ans)

print(int(ans%1000000007 ))
Problem p02791 (python)

Fixed submission:
N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

ans = 1
mi = p_list[0]

for i in range(1, N):
    if mi >= p_list[i]:
        ans += 1
        mi = p_list[i]
        
print(ans)

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

c = 1
if p_list == [p_list[0]]*N:
    print(len(p_list))

elif p_list == sorted(p_list):
    print(1)

elif p_list == sorted(p_list, reverse=True):
    print(len(p_list))

else:
    for i in range(1, N):
        p_list_min = min(p_list[:i])
            if p_list[i] <= p_list_min:
                c += 1
        

print(c)
Problem p02801 (python)

Fixed submission:
C =str(input())

alph = "abcdefghijklmnopqrstuvwxyz"

alphabet_list = list(alph)

print(alphabet_list[alphabet_list.index(C)+1])

Buggy submission (verdict: Runtime Error):
C =str(input())

alph = "abcdefghijklmnopqrstuvwxyz"

alphabet_list = list(alph)

print(alphabet[alphabet_list.index(C)+1])

Buggy submission (verdict: Runtime Error):
C =str(input())

alph = "abcdefghijklmnopqrstuvwxyz"

alphabet_list = list(alph)
print(alphabet_list)

print(alphabet[alphabet_list.index(C)+1])

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

alphabet = "abcdefghijklmnopqrstuvwxyz"

alphabet_list = list[alphabet]

print(alphabet_list[alphabet_list.index[C]+1])
Problem p02802 (python)

Fixed submission:


N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
for k in range(N):
    if ans[k] == 1:
        pena += c_wa[k]
    

            
print(sum(ans), pena)

Buggy submission (verdict: Runtime Error):


N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = [0]*N
c_sum = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
    
for j in range(N):
    if ans[p[j]-1] == 1:
        c_sum += c_wa[p[j]-1]
        
            
print(sum(ans), c_sum)

Buggy submission (verdict: Runtime Error):


N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = [0]*N
c_sum = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
    
for i in range(N):
    if ans[p[j]-1] == 1:
        c_sum += c_wa[p[j]-1]
        
            
print(sum(ans), c_sum)

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


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip(" ").split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        print("WA", j, s[p[j]-1])
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 1:
            continue
        elif ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
            
print(sum(ans), c_wa)
Problem p02818 (python)

Fixed submission:
a, b, k = list(map(int,input().strip().split(' ')))

if a > k:
    a1 = a - k
    b1 = b

else:
    a1 = 0
    b1 = max(b -(k - a),0)
    
print(a1, b1)

Buggy submission (verdict: Runtime Error):
a, b, k = list(map(int,input().strip().split(' ')))

if a > k:
    a1 = a - k
    b1 = b

elif b > k - a:
    a1 = 0
    b1 = max(b -(k - a),0)
    
print(a1, b1)

Buggy submission (verdict: Runtime Error):
a, b, k = list(map(int,input().strip().split(' ')))

if a > k:
    a1 = a - k
    b1 = b

elif b > k - a;
    a1 = 0
    b1 = max(b -(k - a),0
    
print(a1, b1)
Problem p02830 (python)

Fixed submission:
n = int(input().strip())
S, T = input().strip().split(' ')

ans = ''

for i in range(n):
    ans += S[i] + T[i]
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
S, T = [input().strip() for i in range(2)]

ans = ''

for i in range(n):
	ans += S[i] + T[i]
    
print(ans)
Problem p02899 (python)

Fixed submission:
n = int(input())
array = list(map(int, input().strip().split(" ")))
ans = [0]*n

for i in range(n):
    ans[array[i] - 1] = str(i + 1 )



print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
array = list(map(int, input().strip().split(" ")))
ans = [0]*n

for i in range(n):
    ans[array[i] - 1] = i + 1 



print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
array = list(map(int, input().strip().split(" ")))
ans = [0]*n

for i in range(1, n+1):
    ans[array[i] - 1] = i + 1 



print(" ".join(ans))
Problem p02983 (python)

Fixed submission:
L, R = list(map(int,input().split(" ")))
l = L % 2019
r = R % 2019

ans = 2019

if R - L >= 2018 or L > R:
    print("0")
else:
    array = list(range(l,r+1))
    for i in array:
        for j in array:
            if i == j:
                continue
            temp = i * j % 2019
            if ans > temp:
                ans = temp
    print(ans)

Buggy submission (verdict: Runtime Error):
L, R = list(map(int,input().split(" ")))
l = L % 2019
r = R % 2019

array = sorted(list(range(l,r+1)))

ans = array[0]*array[1] % 2019
print(ans)

Buggy submission (verdict: Runtime Error):
L, R = list(map(int,input().split(" ")))
l = L % 2019
r = R % 2019

array = sorted(list(range(l,r+1)))

ans = array[0]*array[1]
print(ans)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)
 
def lcm(a, b):
    return a // gcd(a, b) * b

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

n = b - a + 1
n_c = b//c - (a-1)//c
n_d = b//d - (a-1)//d
n_cd = b//lcm(c,d) - (a-1)//lcm(c,d)

print(n - n_c - n_d + n_cd)

Buggy submission (verdict: Runtime Error):
import math

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

n = b - a + 1
lcm =  (c*d) //(math.gcd(c, d))

n_c = b//c - (a-1)//c
n_d = b//d - (a-1)//d
n_cd = b//lcm - (a-1)//lcm

print(n - n_c - n_d + n_cd)

Buggy submission (verdict: Runtime Error):
import math

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

n = b - a + 1
lcm =  (c*d) //(math.gcd(c, d))

n_c = b // c - (a-1)//c
n_d = b // d - (a-1)//d
n_cd = b // lcm - (a-1)//lcm

print(n - n_c - n_d + n_cd)

Buggy submission (verdict: Runtime Error):
import math

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

ac_r = a % c
ad_r = a % d
lcm =  (c*d) // math.gcd(c, d)
acd_r = a % lcm
n = b - a + 1

if (ac_r == 0 and n % c == 1) or ((ac_r == 0 and n % c == 2) or (ac_r == 2 and n % c == 2)) :
    n_c = n // c + 1
else:
    n_c = n // c
    
if (ad_r == 0 and n % d == 1) or ((ad_r == 0 and n % d == 2) or (ad_r == 2 and n % d == 2)):
    n_d = n // d + 1
else:
    n_d = n // d
    
if (acd_r == 0 and n % (c*d) == 1) or ((acd_r == 0 and n % (c*d) == 2) or (acd_r == 2 and n % (c*d) == 2)):
    n_cd = n // lcm + 1
else:
    n_cd = n // lcm
    
print(n - (n_c + n_d - n_cd)) 
print(ac_r, ad_r, acd_r, n)

Buggy submission (verdict: Runtime Error):
import math

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

ac_r = a % c
ad_r = a % d
lcm =  (c*d) // math.gcd(c, d)
acd_r = a % lcm
n = b - a + 1

if (ac_r == 0 and n % c == 1) or ((ac_r == 0 and n % c == 2) or (ac_r == 2 and n % c == 2)) :
    n_c = n // c + 1
else:
    n_c = n // c
    
if (ad_r == 0 and n % d == 1) or ((ad_r == 0 and n % d == 2) or (ad_r == 2 and n % d == 2)):
    n_d = n // d + 1
else:
    n_d = n // d
    
if (acd_r == 0 and n % (c*d) == 1) or ((acd_r == 0 and n % (c*d) == 2) or (acd_r == 2 and n % (c*d) == 2)):
    n_cd = n // lcm + 1
else:
    n_cd = n // lcm
    
print(n - (n_c + n_d - n_cd)) 
print(ac_r, ad_r, acd_r, n)

Buggy submission (verdict: Runtime Error):
a, b, c, d = list(map(int,input().split(" ")))

ac_r = a % c
ad_r = a % d
acd_r = a % (c*d)

if (ac_r == 0 and n % c == 1) or ((ac_r == 0 and n % c == 2) or (ac_r == 2 and n % c == 2)) :
    n_c = (b - a + 1) // c + 1
else:
    n_c = (b - a + 1) // c
    
if (ad_r == 0 and n % d == 1) or ((ad_r == 0 and n % d == 2) or (ad_r == 2 and n % d == 2)):
    n_d = (b - a + 1) // d + 1
else:
    n_d = (b - a + 1) // d
    
if (acd_r == 0 and n % (c*d) == 1) or ((acd_r == 0 and n % (c*d) == 2) or (acd_r == 2 and n % (c*d) == 2)):
    n_cd = (b - a + 1) // (c*d) + 1
else:
    n_cd = (b - a + 1) // (c*d)
    
print((b - a + 1) - (n_c + n_d - n_cd))