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

Fixed submission:
x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

ABS = 10 ** 9
ans = 0
for i in range(102):
    if i in p:continue

    temp = abs(i - x)
    if ABS > temp:
        ABS = temp
        ans = i
print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
q = []
for i in range(1, 101):
    if i in p:continue
    q.append(i)

import bisect
ind = bisect.bisect_left(q, x)
#print(ind)

temp1 = abs(q[ind - 1] - x)
temp2 = abs(q[ind] - x)
if temp1 <= temp2:print(q[ind - 1])
else:print(q[ind])
Problem p02719 (python)

Fixed submission:
import math
n,k=map(int,input().split())
num=n//k
n=n-num*k
ans=min(abs(k-n),n)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if 2*n<=k:
    num1=k//n
    n=k-n*(num1-1)
    num = int(n / k)
    ans = min(abs(n - num * k), abs(n - (num + 1) * k))
    print(ans)
elif n<=k<2*n:
    print(min(k-n,k-2*n))
else:
    num=int(n/k)
    ans=min(n-num*k,abs(n-(num+1)*k))
    print(ans)
Problem p02744 (python)

Fixed submission:
n=int(input())
s='abcdefghijklmnopqrstuvwxyz'
bottom=[[] for i in range(10)]
bottom[0]=['a']

def solve(n):
    num=0
    while num<n:
        num=num+1
        for base in bottom[num-1]:
            for i in s[:num+1]:
                if i!='a' and chr(ord(i)-1) not in base:break
                bottom[num].append(base+i)

solve(n-1)
#print(*bottom[n-2])
print(*bottom[n-1],sep='\n')

Buggy submission (verdict: Runtime Error):
n=int(input())
s='abcdefghijklmnopqrstuvwxyz'
bottom=[[] for i in range(10)]
bottom[0]=['a']

def solve(n):
    num=0
    while num<=n:
        num=num+1
        for base in bottom[num-1]:
            for i in s[:num+1]:
                if ord(i)-ord(base[-1])>1:continue
                bottom[num].append(base+i)

solve(n-1)
print(*bottom[n-1],sep='\n')

Buggy submission (verdict: Runtime Error):
n=int(input())
s='abcdefghij'
bottom=[[] for i in range(10)]
bottom[0]=['a']

def solve(n):
    num=0
    while num<=n:
        num=num+1
        for base in bottom[num-1]:
            for i in s[:num+1]:
                if ord(i)-ord(base[-1])>1:continue
                bottom[num].append(base+i)

solve(n-1)
print(*bottom[n-1],sep='\n')
Problem p02756 (python)

Fixed submission:
from collections import deque
s=input()
q=int(input())
ans_str=deque(s)
cnt=0
for _ in range(q):
    Q=list(input().split())
    if Q[0]=='1':
        cnt=1 if cnt==0 else 0

    else:
        if Q[1]=='1':
            if cnt==0 or len(ans_str)==1:
                ans_str.appendleft(Q[-1])
            else:
                ans_str.append(Q[-1])

        else:
            if cnt==0 or len(ans_str)==1:
                ans_str.append(Q[-1])
            else:
                ans_str.appendleft(Q[-1])
    #print(ans_str,cnt,Q)

ans=list(ans_str) if cnt==0 else list(ans_str)[::-1]
print(*ans,sep='')

Buggy submission (verdict: Runtime Error):
from collections import deque
s=input()
q=int(input())
ans_str=deque([s])
cnt=0
for _ in range(q):
    Q=list(input().split())
    if Q[0]=='1':
        cnt=1 if cnt==0 else 0

    else:
        if Q[1]=='1':
            if cnt==0:
                ans_str.appendleft(Q[-1])
            else:
                ans_str.append(Q[-1][::-1])

        else:
            if cnt==0:
                ans_str.append(Q[-1])
            else:
                ans_str.appendleft(Q[-1][::-1])
    print(ans_str,cnt,Q)

ans=list(ans_str) if cnt==0 else list(ans_str)[::-1]
print(*ans,sep='')
Problem p02768 (python)

Fixed submission:
n,a,b=map(int,input().split())
mod=10**9+7
def comb(n,k):
    temp=1
    k=min(k,n-k)
    for i in range(1,k+1):
        temp=temp*pow(i,mod-2,mod)
        temp=temp*(n-i+1)%mod

    return temp%mod
#二分累乗法を勉強する
ans=pow(2,n,mod)-1-comb(n,a)-comb(n,b)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
mod=10**9+7
def comb(n,a,b):
    temp=1
    a=min(a,n-a)
    b=min(b,n-b)
    A=a if a<b else b
    B=a+b-A
    for i in range(B):
        temp*=pow(i+1,mod-2,mod)*(n-i)%mod
        if i+1==A:
            ComA=temp

    return (ComA+temp)%mod
#二分累乗法を勉強する
ans=pow(2,n,mod)-1-comb(n,a,b)
print(ans%mod)
Problem p02783 (python)

Fixed submission:
import math
h,a=map(int,input().split())

print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):

        next=i+ab[j][0] if i+ab[j][0]<=h else h
        dp[next]=min(dp[next],dp[i]+ab[j][1])
print(dp[-1])
Problem p02787 (python)

Fixed submission:
h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    A,B=map(int,input().split())
    a.append(A)#ダメージ量
    b.append(B)#消費魔力

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):

        next=i+a[j] if i+a[j]<=h else h
        dp[next]=min(dp[next],dp[i]+b[j])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):
		if dp[i] == float('inf'):continue
        next=i+ab[j][0] if i+ab[j][0]<=h else h
        dp[next]=min(dp[next],dp[i]+ab[j][1])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):
		if dp[i] == float('inf'):continue
        next=i+ab[j][0] if i+ab[j][0]<=h else h
        dp[next]=min(dp[next],dp[i]+ab[j][1])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):
		temp_a = i + ab[j][0] if i + ab[j][0] <= h else h
        temp_b = dp[i] + ab[j][1]
        dp[temp_a]=min(dp[temp_a],temp_b)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):
		temp_a = i + ab[j][0] if i + ab[j][0] <= h else h
        temp_b = dp[i] + ab[j][1]
        dp[temp_a]=min(dp[temp_a],temp_b)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):
		temp_a = i + ab[j][0] if i + ab[j][0] <= h else h
        temp_b = dp[i] + ab[j][1]
        dp[temp_a]=min(dp[temp_a],temp_b)
print(dp[-1])
Problem p02803 (python)

Fixed submission:
#151-D:BFS
from collections import deque
#スタート地点loc=(sx,sy)を決めたときのゴールをbfsで求める
def bfs(loc):
    global tem_ans
    d=[[float('inf')]*w for i in range(h)]

    #進む方向を決める
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]

    que=deque([])
    que.append(loc)
    d[loc[0]][loc[1]]=0

    #遷移していってこれ以上遷移できない状態まで埋める
    while que:
        p=que.popleft()
        for i in range(4):
            nx=p[0]+dx[i]
            ny=p[1]+dy[i]

            #遷移可能かどうか調べる
            if 0<=nx<h and 0<=ny<w and maze[nx][ny]=='.' and d[nx][ny]==float('inf'):
                #移動後の距離を保存
                d[nx][ny]=d[p[0]][p[1]]+1
                que.append([nx,ny])

                if tem_ans<d[nx][ny]:
                    tem_ans=d[nx][ny]
    return tem_ans



h,w=map(int,input().split())
maze=[list(input()) for i in range(h)]
ans=0
tem_ans=0

loc=[]
for i in range(h):
    for j in range(w):
        #通路をスタート地点に設定する
        if maze[i][j]!='#':
            loc=[i,j]
        else:
            continue
        ans=max(ans,bfs(loc))

print(ans)

Buggy submission (verdict: Runtime Error):
#151-D:BFS
from collections import deque
#スタート地点loc=(sx,sy)を決めたときのゴールをbfsで求める
def bfs(loc):
    global tem_ans
    d=[[float('inf')]*w for i in range(h)]

    #進む方向を決める
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]

    que=deque([])
    que.append(loc)
    d[loc[0]][loc[1]]=0

    #遷移していってこれ以上遷移できない状態まで埋める
    while que:
        p=que.popleft()
        for i in range(4):
            nx=p[0]+dx[i]
            ny=p[1]+dy[i]

            #遷移可能かどうか調べる
            if 0<=nx<h and 0<=ny<w and maze[nx][ny]=='.' and d[nx][ny]==float('inf'):
                #移動後の距離を保存
                d[nx][ny]=d[p[0]][p[1]]+1
                que.append([nx,ny])

                if tem_ans<d[nx][ny]:
                    tem_ans=d[nx][ny]
    return tem_ans



h,w=map(int,input().split())
maze=[list(input()) for i in range(h)]
ans=0
tem_ans=0

loc=[]
for i in range(h):
    for j in range(w):
        #通路をスタート地点に設定する
        if maze[i][j]!='#':
            loc=[i,j]

        ans=max(ans,bfs(loc))

print(ans)
Problem p02823 (python)

Fixed submission:
n,a,b=map(int,input().split())
k=b-a-1
if k%2!=0:#間の卓が奇数
    ans=(k+1)//2
    print(ans)    
else:#偶数
    ans=min(b-1,n-a)
    ans1=min(a-1,n-b)+1+k//2
    print(min(ans,ans1))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans1=(k-1)//2+1
ans2=min(b-1,n-a)
print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
min_=min(a,b)
max_=max(a,b)

k=max_-min_-1
if k%2!=0:#間の卓が奇数
    if k==1:
        print(k)
    else:
        ans=(k-1)//2+""
        print(ans)
else:#偶数
    ans=min(max_-1,n-min_)
    print(ans)
Problem p02838 (python)

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=tuple(map(int,input().split()))
mod=10**9+7
cnt=[0]*60

for temp in a:
    if temp==0:continue
    digit=len(bin(temp))-2
    for j in range(digit):
        if (temp>>j)&1:
            cnt[j]=cnt[j]+1

#print(cnt)
ans=0
for i in range(60):
    if cnt[i]==0:continue
    ans=(ans+pow(2,i)*cnt[i]*(n-cnt[i]))%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from math import log2,ceil
import sys
input=sys.stdin.readline
n=int(input())
a=tuple(map(int,input().split()))
mod=10**9+7
cnt=[0]*60

for temp in a:
    if temp==0:continue
    digit=len(bin(temp))-2
    for j in range(ceil(digit)+1):
        if (temp>>j)&1:
            cnt[j]=cnt[j]+1

#print(cnt)
ans=0
for i in range(60):
    if cnt[i]==0:continue
    ans=(ans+pow(2,i)*cnt[i]*(n-cnt[i]))%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from math import log2,ceil
from collections import defaultdict
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=defaultdict(lambda :0)

for i in range(n):
    temp=a[i]
    if temp==0:continue
    digit=log2(temp)
    for j in range(ceil(digit)+1):
        if (temp>>j)&1:
            cnt[j]+=1

#print(cnt)
ans=0
for digit,count in cnt.items():
    ans+=pow(2,digit)*count*(n-count)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from math import log2,ceil
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=defaultdict(lambda :0)

for i in range(n):
    temp=a[i]
    digit=log2(temp)
    for j in range(ceil(digit)+1):
        if (temp>>j)&1:
            cnt[j]+=1

#print(cnt)
ans=0
for digit,count in cnt.items():
    ans+=pow(2,digit)*count*(n-count)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
def solve():
    import numpy as np
    ans=0
    for i in range(n-1):
        for j in range(i+1,n):
            ans+=a[i]^a[j]
    
    print(ans%(10**9+7))
    
n=int(input())
a=np.array(list(map(int,input().split())) )
solve()
Problem p02910 (python)

Fixed submission:
s=list(input())

s_odd=''.join(s[0::2]) #偶数項、奇数項に分類する
s_even=''.join(s[1::2])

if s_odd.find('L')==-1 and s_even.find('R')==-1:
    print('Yes')
else:
    print('No')

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

s_odd=s[0::2] 
s_even=s[1::2]

if s_odd.find('L')=='-1' and s_even.find('R')=='-1':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s_odd=list(A=input())[0::2]
s_even=list(A)[1::2]
if s_odd.find('L')==-1 and s_even.find('R')==-1:
    print('Yes')
else:
    print('No')

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

s_odd=s[0::2] 
s_even=s[1::2]

if s_odd.find('L')==-1 and s_even.find('R')==-1:
    print('Yes')
else:
    print('No')

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

s_odd=s[0::2]
s_even=s[1::2]

if s_odd.find(L)==-1 and s_even.find(R)==-1:
    print('Yes')
else:
    print('No')
Problem p02945 (python)

Fixed submission:
A,B=map(int,input().split())
print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
K,X=map(int,input().split())

for i in range(X-K+1,X+K):
  string+=i+' '
print(string)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(max(A+B,A-B,A*B)
Problem p02946 (python)

Fixed submission:
K,X=map(int,input().split())
string=''
for i in range(X-K+1,X+K):
  string+=str(i)+' '
print(string)

Buggy submission (verdict: Runtime Error):
K,X=map(int,input().split())
string=''
for i in range(X-K+1,X+K):
  string+=i+' '
print(string)
Problem p02960 (python)

Fixed submission:
s=input()
len_s=len(s)
mod=10**9+7
dp=[[0]*13 for i in range(len_s)]

if s[-1]!='?':
    dp[0][int(s[-1])%13]=1
else:
    for i in range(10):
        dp[0][i]=1

a=1
for i in range(1,len_s):
    a=10*a%13
    if s[-(i+1)]!='?':
        temp_S=int(s[-(i+1)])
        amari=(temp_S*a)%13
        for j in range(13):
            dp[i][(amari+j)%13]+=dp[i-1][j]%mod

    else:
        for k in range(10):
            amari=(k*a)%13
            for l in range(13):
                dp[i][(amari+l)%13]+=dp[i-1][l]%mod
#print(*dp,sep='\n')
print(dp[-1][5]%mod)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
s = input()
len_s = len(s)
mod = 10 ** 9 + 7
dp = [[0] * 13 for i in range(len_s)]

for i in range(len_s):
    if s[-(i + 1)] == '?':
        for j in range(13):
            if i == 0:
                if j < 10:
                    dp[i][j] = 1
                continue

            if dp[i - 1][j] > 0:
                for k in range(10):
                #k:先頭に加える数字
                    add = k * pow(10, i)
                    dp[i][(j + add)%13] = (dp[i][(j + add)%13] + dp[i - 1][j])%mod

    else:
        if i == 0:
            dp[i][int(s[-(i + 1)])] = 1
            continue

        add = int(s[-(i + 1)]) * pow(10, i)
        for j in range(13):
            if dp[i - 1][j] > 0:
                dp[i][(j + add)%13] = (dp[i][(j + add)%13] + dp[i - 1][j])%mod

print(dp[-1][5] % mod)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
s=input()
len_s=len(s)
mod=10**9+7
dp=[[0]*13 for i in range(len_s)]

if s[-1]!='?':
    dp[0][int(s[-1])%13]=1
else:
    for i in range(10):
        dp[0][i]=1

a=1
for i in range(1,len_s):
    a=10*a%13
    if s[-(i+1)]!='?':
        temp_S=int(s[-(i+1)])
        amari=(temp_S*a)%13
        for j in range(13):
            dp[i][(amari+j)%13]+=dp[i-1][j]%mod

    else:
        for k in range(10):
            amari=(k*a)%13
            for l in range(13):
                dp[i][(amari+l)%13]+=dp[i-1][l]%mod
#print(*dp,sep='\n')
print(dp[-1][5]%mod)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
s=input()
len_s=len(s)
mod=10**9+7
dp=[[0]*13 for i in range(len_s)]

if s[-1]!='?':
    dp[0][int(s[-1])%13]=1
else:
    for i in range(10):
        dp[0][i]=1

for i in range(1,len_s):

    if s[-(i+1)]!='?':
        temp_S=int(s[-(i+1)])
        amari=(temp_S*10**i)%13
        for j in range(13):
            dp[i][(amari+j)%13]=(dp[i][(amari+j)%13]+dp[i-1][j])%mod

    else:
        for k in range(10):
            amari=(k*10**i)%13
            for l in range(13):
                dp[i][(amari+l)%13]=(dp[i][(amari+l)%13]+dp[i-1][l])%mod
#print(*dp,sep='\n')
print(dp[-1][5]%mod)
Problem p02972 (python)

Fixed submission:
def check(n):
    num=int(n**0.5)
    l=[]
    for i in range(1,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return set(l)

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

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[-(i+1)]:continue
    cnt+=1
    ans[-(i+1)]=1
    l=check(n-i)
    for j in l:
        box[j-1]=(box[j-1]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end=' ')

Buggy submission (verdict: Runtime Error):
def check(n):
    num=int(n**0.5)
    l=[1]
    for i in range(2,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return l

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

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[i]:continue
    cnt+=1
    ans[-(i+1)]=1
    box[i]=(box[i]+1)%2
    l=check(n-i)
    for j in l:
        box[j]=(box[j]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end=' ')

Buggy submission (verdict: Runtime Error):
def check(n):
    num=int(n**0.5)
    l=[]
    for i in range(1,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return l

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

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[i]:continue
    cnt+=1
    ans[-(i+1)]=1
    box[i]=(box[i]+1)%2
    l=check(n-i)
    for j in l:
        box[j]=(box[j]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end='')

Buggy submission (verdict: Runtime Error):
def check(n):
    num=int(n**0.5)
    l=[]
    for i in range(1,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return l

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

box=[0]*n
cnt=0
for i in range(n):
    if a[-(i+1)]==box[i]:continue
    cnt+=1
    box[i]=(box[i]+1)%2
    l=check(n-i)
    for j in l:
        box[j]=(box[j]+1)%2

print(cnt)
if cnt==0:exit()
print(*box[::-1])
Problem p02975 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
if set(a) == {0}:
    print('Yes')
    exit()

flag = 0
if n % 3 == 0:
    if len(cnt) == 2:
        if cnt.get(0) == n // 3:flag = 1
    elif len(cnt) == 3:
        if len(set(cnt.values())) == 1:
            new_a = list(cnt.keys())
            if new_a[0]^new_a[1] == new_a[2]:flag = 1

print('Yes' if flag else 'No')

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
if set(a) == set(0):
    print('Yes')
    exit()
    
if n % 3 != 0 or len(cnt) != 3:
    print('No')
else:
    key = []
    num = []
    for i, j in cnt.items():
        key.append(i)
        num.append(j)
    if len(set(num)) != 1:
        print('No')
    else:
        if key[0]^key[1] == key[2]:print('Yes')
        else:print('No')
Problem p02983 (python)

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

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
s=list(range(l,r+1))
ans=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        ans=min(i*j%2019,ans)
        if ans==0:
            exit()
print(ans)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
s=list(range(l,r+1))
ans=2018
for i in range(r-l):
    for j in range(i+1,r-l+1):
        ans=min((s[i]%2019)*(s[j]%2019),ans)
        if ans==0:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
s=list(range(l,r+1))
ans=[2018]
for i in range(r-l):
    for j in range(i+1,r-l+1):
        ans=min((s[i]%2019)*(s[j]%2019),ans)
        if ans==0:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
l,r=map(int,input().split())
s=np.array(range(l,r+1))
ans=[2018]
for i in range(r-l):
    for j in range(i+1,r-l+1):
        ans=min((s[i]%2019)*(s[j]%2019),ans)
        if ans==0:
            break
print(ans)
Problem p02993 (python)

Fixed submission:
s=input()
n=0
for i in range(3):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>=1:
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=input()
n=0
for i in range(3):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n=>1:
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=input()
n=0
for i in range(3):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>0
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=list(input())+['']
n=0
for i in range(4):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>0
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=input()+['']
n=0
for i in range(4):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>0
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=input()
n=0
for i in range(4):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>0
    print('Bad')
else:
    print('Good')
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
aji=[l+i for i in range(n)]
aji.sort(key=abs)
print(sum(aji[1:]))

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
aji=[]
for i in range(n):
    aji+=[l+i]
su=sum(aji)
c=[su]
for i in range(n):
    c=[abs(su-aji[i])]
c.sort()
print(s)
Problem p02995 (python)

Fixed submission:
import fractions

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

cd_lcm=int(c*d/fractions.gcd(c,d))

b_count=b-(b//c+b//d-b//cd_lcm)
a_count=a-1-((a-1)//c+(a-1)//d-(a-1)//cd_lcm)

print(int(b_count-a_count))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import fractions
cd_gcd=c*d/gcd(c,d)
l=b-a+1
print(l-(l//c+l//d-l//(cd_gcd)))#c*d←ここをc.dの最小公倍数にする
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
if x==w/2 and y==h/2:
    print(w*h/2,1,sep=' ')
else:
    print(w*h/2,0,sep=' ')

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
if x=w/2 and y=h/2:
    print(w*h/2,1,sep=' ')
else:
    print(w*h/2,0,sep=' ')
Problem p03032 (python)

Fixed submission:
from collections import deque
from heapq import *
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
num = min(k, n)
for a in range(num + 1):
    for b in range(num + 1 - a):
        trash = k - (a + b)
        get = v[:a] + v[-b:] if b != 0 else v[:a]
        heapify(get)
        for _ in range(min(trash, a + b)):
            temp = heappop(get)
            if temp > 0:
                heappush(get, temp)
                break
        SUM = sum(get)
        if ans < SUM:ans = SUM
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
from heapq import *
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for a in range(k + 1):
    for b in range(k + 1 - a):
        trash = k - (a + b)
        get = v[:a] + v[-b:] if b != 0 else v[:a]
        heapify(get)
        for _ in range(min(trash, a + b)):
            heappop(get)
        SUM = sum(get)
        if ans < SUM:ans = SUM
print(ans)
Problem p03061 (python)

Fixed submission:
import fractions
def GCD(a, b):
    if a * b == 0:
        return a + b
    return fractions.gcd(a, b)

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

L = [0] * n
R = [0] * n

for i in range(n - 1):
    L[i + 1] = GCD(a[i], L[i])
    R[-(i + 2)] = GCD(a[-(i + 1)], R[-(i + 1)])

M = [0] * n
for i in range(n):
    M[i] = GCD(L[i], R[i])
print(max(M))

Buggy submission (verdict: Runtime Error):
from functools import reduce
import math
def GCD(a, b):
    if a * b == 0:
        return a + b
    return math.gcd(a, b)

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

L = [0] * n
R = [0] * n

for i in range(n - 1):
    L[i + 1] = GCD(a[i], L[i])
    R[-(i + 2)] = GCD(a[-(i + 1)], R[-(i + 1)])

M = [0] * n
for i in range(n):
    M[i] = GCD(L[i], R[i])
print(max(M))