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

Fixed submission:
n= int(input())
bdic = {'A':0,'B':1,'O':2}
aot = [[0 for i in range(3)] for i in range(3)]
ans=0
for i in range(n):
    s=input()
    subab=0
    for i in range(len(s)-1):
        if s[i]=='A' and s[i+1]=='B':subab+=1
    ans += subab
    f = 'O' if not s[0]  in bdic.keys() else s[0]
    l = 'O' if not s[-1] in bdic.keys() else s[-1]
    aot[bdic[f]][bdic[l]]+=1

oa = aot[bdic['O']][bdic['A']]+aot[bdic['A']][bdic['A']]
bo = aot[bdic['B']][bdic['O']]+aot[bdic['B']][bdic['B']]
ab = aot[bdic['A']][bdic['B']]
ba = aot[bdic['B']][bdic['A']]

if   oa==0 and bo==0:ans+=max(0,ba-1)
elif oa==0 and bo!=0:ans+=min(bo,ba)+max(0,ba-bo)
elif bo==0 and oa!=0:ans+=min(oa,ba)+max(0,ba-oa)
else:                ans+=min(oa,bo)+ba
print(ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
bdic = {'A':0,'B':1,'O':2}
aot = [[0 for i in range(3)] for i in range(3)]
ans=0
for i in range(n):
    s=input()
    subab=0
    for i in range(len(s)-1):
        if s[i]=='A' and s[i+1]=='B':subab+=1
    ans += subab
    f = 'O' if not s[0]  in bdic.keys() else s[0]
    l = 'O' if not s[-1] in bdic.keys() else s[-1]
    aot[bdic[f]][bdic[l]]+=1

oa = aot[bdic['O']][bdic['A']]+aot[bdic['A']][bdic['A']]
bo = aot[bdic['B']][bdic['O']]+aot[bdic['B']][bdic['B']]
ab = aot[bdic['A']][bdic['B']]
ba = aot[bdic['B']][bdic['A']]

if   oa==0 and bo==0:ans+=max(0,ba-1)
elif oa==0 and bo!=0:ans+=min(bo,ba)+max(0,ba-bo)
elif bo==0 and oa!=0:ans+=min(oa,ba)+max(0,ba-oa)
else:                ans+=min(oa,bo)+ba
print(ans)
Problem p03074 (python)

Fixed submission:
N,K = map(int,input().split())
s = input()
#first
last = -1
ck = K
pre = ''
for i in range(N):
    c = s[i]
    if c == '0' and pre != '0':
        ck -= 1
        if ck < 0:
            last = i - 1
            break
    pre = c
else:
    last = N-1
#print('last:',last)

if last == N-1:print(len(s))
else:
    ## step by step
    cameLast = False
    ilr = 0
    g_max = 0
    while True:
        #print('calc g.:',last - ilr + 1)
        g_max = max(g_max,last - ilr + 1)
        if cameLast:break
        pre = ''
        for i in range(ilr,N):
            if s[i] == '1' and pre == '0':
                ilr = i
                break
            else:pre = s[i]
        else:#print('CANNOT REACH HERE!! - no next ilr')
            ilr = len(s) - 1
        prel = ''
        for j in range(last+1,N):
            if s[j] == '0' and prel == '1':
                last = j - 1
                break
            else:prel = s[j]
        else:#'reach last s[]'
            last = len(s) - 1
            cameLast = True
    print(g_max)

Buggy submission (verdict: Runtime Error):
def count1(st):
    g = 0
    c = 0
    cont = False
    for p in st:
        if p == '1':
            if cont == False:
                c = 1
                cont = True
            else:
                c += 1
            g = max(g,c)
        else:
            cont = False
    return g
N,K = map(int,input().split())
s = input()
ls = len(s)
i = 0
il = 0
ir = 0
mg = 0
mgs = ''
if ls == 1:
    print(1)
else:
    for j in range(K):
        #print('j',j)
        while i < N:
            #print(s[i])
            if s[i] == '0':
                il = i
                while i < N:
                    if s[i] == '1':
                        ir = i - 1
                        break
                    i += 1
                #print('lr',il,ir)
                new_s = s[:il] + '1'*(ir-il+1) + s[ir+1:]
                #print(new_s)
                if mg < count1(new_s):
                    mg = count1(new_s)
                    mgs = new_s
                #print('mg',mg)
            else:
                i += 1
        s = new_s
        i = 0
    print(mg)
    #print(mg,mgs)
Problem p03111 (python)

Fixed submission:
def main():
    import itertools as it
    N,A,B,C = map(int,input().split())
    pre = [int(input()) for _ in range(N)]
    ss = max(pre)*N <= min(A,B,C)
    if N == 3:print(A-pre[0]+B-pre[1]+C-pre[2])
    else:
        m = [0,1,2,3,4,5,6,7]
        cpm = it.permutations(pre,N)
        ccb = list(it.combinations(m[:N], 3))
        minc = 99999999999999999
        for l in cpm:
            for d in ccb:
                cmp = (d[2] - 2) * 10
                if ss:
                    asum = (cmp+A+B+C-sum(l[:d[2]+1]))
                    minc = min(minc,asum)
                else:
                    asum = abs(A - sum(l[:d[0]+1]))
                    if cmp+asum >= minc: continue
                    bsum = abs(B - sum(l[d[0]+1:d[1]+1]))
                    if cmp+asum+bsum >= minc: continue
                    csum = abs(C - sum(l[d[1]+1:d[2]+1]))
                    tc = cmp+asum+bsum+csum
                    minc = min(minc,tc)
        print(minc)
main()

Buggy submission (verdict: Runtime Error):
def main():
    import itertools as it
    N,A,B,C = map(int,input().split())
    pre = [int(input()) for _ in range(N)]
    if N == 3:print(A-pre[0]+B-pre[1]+C-pre[2])
    else:
        m = [0,1,2,3,4,5,6,7]
        cpm = it.permutations(pre,N)
        ccb = list(it.combinations(m[:N], 3))
        minc = 99999999999999999
        for l in cpm:
            for d in ccb:
                cmp = (d[2] - 2) * 10
                asum = abs(A - sum(l[:d[0]+1]))
                if cmp+asum >= minc: continue
                bsum = abs(B - sum(l[d[0]+1:d[1]+1]))
                if cmp+asum+bsum >= minc: continue
                csum = abs(C - sum(l[d[1]+1:d[2]+1]))
                tc = cmp+asum+bsum+csum
                minc = min(minc,tc)
    print(minc)
main()
Problem p03240 (python)

Fixed submission:
N = int(input())
old_dl = [list(map(int,input().split())) for _ in range(N)]
dl = []
for k in old_dl:
    if k[2] != 0:
        dl.append(k)
if len(dl) == 1:
    print(*dl[0])
else:
    for x in range(101):
        for y in range(101):
            ndl = [l[2]+abs(l[0]-x)+abs(l[1]-y) for l in dl]
            if max(ndl) == min(ndl):
                #print(ndl)
                print(x,y,max(ndl))
                exit(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
old_dl = [list(map(int,input().split())) for _ in range(N)]
dl = []
for k in old_dl:
    if k[2] != 0:
        dl.append(k)
if len(dl) == 1:
    print(dl[2])
else:
    for x in range(101):
        for y in range(101):
            ndl = [l[2]+abs(l[0]-x)+abs(l[1]-y) for l in dl]
            if max(ndl) == min(ndl):
                #print(ndl)
                print(x,y,max(ndl))
                exit(0)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        break
print(S[i])

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int( (math.log(int(S[i]))) * ((2**5)*(10**15)) ) + 1
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    print('first:',S[i])
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int( (math.log(int(S[i]))) * ((2**5)*(10**15)) ) + 1
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*5*10**15)
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*10**15)
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            print(S[i])
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*10**15)
        if d<K:K-=d
        else:break
        i += 1

Buggy submission (verdict: Runtime Error):
import math
S = input()
K = int(input())
i = 0
while True:
    d = int(math.log(int(S[i]))*10**15)
    if d<K:K-=d
    else:break
    i += 1
print(S[i])
Problem p03351 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
if abs(A-C)<=D:
  print('Yes')
else:
  if abs(A-B)<=D and abs(B-C)<=D:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
if abs(A-C)<=D:
  print('Yes')
else:
  if abs(A-B)<=D an abs(B-C)<=D:
    print('Yes')
  else:
    print('No')
Problem p03369 (python)

Fixed submission:
print(input().count('o') * 100 + 700)

Buggy submission (verdict: Runtime Error):
print(input().split.count('o') * 100 + 700)
Problem p03371 (python)

Fixed submission:
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:print(A*X+B*Y)
else:
    if X>Y:print(min(2*Y*C+(X-Y)*A,2*X*C))
    else:print(min(2*X*C+(Y-X)*B,2*Y*C))

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y = map(int,input().split())
if A+B <　2*C:print(A*X+B*Y)
else:
    if X>Y:print(min(2*Y*C+(X-Y)*A, 2*X*C))
    else:print(min(2*X*C+(Y-X)*B, 2*Y*C))
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a = int(inpit())
b = int(inpit())
c = int(inpit())
d = int(inpit())
print(min(a,b)+min(c,d))
Problem p03404 (python)

Fixed submission:
a,b= map(int,input().split())
line=''.join(['.#']*50)
dot=['.','#']
cl=[''.join(['.']*100),''.join(['#']*100)]
ba=[b-1,a-1]
ans=[]
y=ans.append
for c in [0,1]:
    y(cl[c])
    for i in range(ba[c]//50):
        y(line)
        y(cl[c])
    y(''.join(['.#']*(ba[c]%50))+cl[c][(ba[c]%50)*2:])
    y(cl[c])
print(len(ans),100)
for l in ans:print(''.join(l))

Buggy submission (verdict: Runtime Error):
line = ''.join(['.#']*50)
dot=['.','#']
cl=[''.join(['.']*100),''.join(['#']*100)]
ba=[b-1,a-1]
ans=[]
for c in [0,1]:
    ans.append(cl[c])
    for i in range(ba[c]//50):
        ans.append(line)
        ans.append(cl[c])
    ans.append(''.join(['.#']*(ba[c]%50))+cl[c][(ba[c]%50)*2:])
    ans.append(cl[c])
print(len(ans))
for l in ans:print(''.join(l))
Problem p03477 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
if A+B == C+D:
    print('Balanced')
elif A+B > C+D:
    print('Left')
else:
    print('Right')

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
if A+B = C+D:
  print('Balanced')
elif A+B > C+D:
  print('Left')
else:
  print('Right')
Problem p03495 (python)

Fixed submission:
N,K = map(int,input().split())
a = list(map(int,input().split()))
adic = {}
for c in a:adic[c] = adic.get(c,0) + 1
alist = sorted([adic[c] for c in adic.keys()])
print(sum(alist[:len(alist)-K]))

Buggy submission (verdict: Runtime Error):
,K = map(int,input().split())
a = list(map(int,input().split()))
adic = {}
for c in a:adic[c] = adic.get(c,0) + 1
alist = sorted([adic[c] for c in adic.keys()])
print(sum(alist[:len(alist)-K]))
Problem p03543 (python)

Fixed submission:
N = input()
if N[1] == N[2] and (N[0] == N[1] or N[2] == N[3]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = sorted(input().split())
if N[1] == N[2] and (N[0] == N[1] or N[2] == N[3]):
  print('Yes')
else:
  print('No')
Problem p03544 (python)

Fixed submission:
N = int(input())
pre2,pre1 = 2,1
if N == 1:print(1)
else:
    for i in range(2,N+1):
        l = pre2 + pre1
        pre2,pre1 = pre1,l
    else:print(l)

Buggy submission (verdict: Runtime Error):
N = int(input())
pre2 = 2
pre1 = 1
for i in range(2,N+1):
    l = pre2 + pre1
    pre2,pre1 = pre1,l
else:print(l)
Problem p03558 (python)

Fixed submission:
import heapq
def main():
    k= int(input())
    brdict = {}
    for i in range(1,k):
        if i==k-1:
            if (10*(k-1))%k==0:
                brdict[i]= [(0,0)]
            else:
                brdict[i] = [(0,1)]
        else:
            if i!=(i*10)%k:
                brdict[i] = [((i*10)%k,0)]
            if (i*10)%k!=i+1:
                brdict[i] = brdict.get(i,[])+[(i+1,1)]
    start=1
    cost=[i for i in range(k)]
    cost[0]=k
    fixed=[False]*k
    fixed[start]=True
    akouho = [(1,start)]
    heapq.heapify(akouho)
    while not all(fixed):
        (fcost,fnode) = heapq.heappop(akouho)
        if fnode==0:break
        fixed[fnode]=True
        for br in brdict[fnode]:
            if not fixed[br[0]]:
                if cost[br[0]] > fcost + br[1]:
                    cost[br[0]] = fcost + br[1]
                    heapq.heappush(akouho,(cost[br[0]],br[0]))
        if akouho==[]:break
    print(cost[0])
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import heapq
def main():
    if k==2:print(1)
    elif k==3:print(3)
    elif k==8:print(1)
    elif k==9:print(9)
    else:
        brdict = {}
        for i in range(1,k):
            if i==k-1:brdict[i] = [(0,1)]
            else:
                brdict[i] = [((i*10)%k,0)]
                if (i*10)%k!=i+1:brdict[i] += [(i+1,1)]
        start=1
        cost=[i for i in range(k)]
        cost[0]=k
        fixed=[False]*k
        fixed[start]=True
        akouho = [(1,start)]
        heapq.heapify(akouho)
        while not all(fixed):
            (fnode,fcost) = heapq.heappop(akouho)
            if fnode==0:break
            fixed[fnode]=True
            for br in brdict[fnode]:
                if not fixed[br[0]]:
                    if cost[br[0]] > fcost + br[1]:
                        cost[br[0]] = fcost + br[1]
                        heapq.heappush(akouho,(br[0],cost[br[0]]))
        print(cost[0])
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import heapq
def main():
    k=int(input())
    brdict = {}
    for i in range(1,k):
        if i==k-1:brdict[i] = [(0,1)]
        else:
            brdict[i] = [((i*10)%k,0)]
            if (i*10)%k!=i+1:brdict[i] += [(i+1,1)]
    start=1
    cost=[i for i in range(k)]
    cost[0]=k
    fixed=[False]*k
    fixed[start]=True
    akouho = [(1,start)]
    heapq.heapify(akouho)
    while not all(fixed):
        (fnode,fcost) = heapq.heappop(akouho)
        if fnode==0:break
        fixed[fnode]=True
        for br in brdict[fnode]:
            if not fixed[br[0]]:
                if cost[br[0]] > fcost + br[1]:
                    cost[br[0]] = fcost + br[1]
                    heapq.heappush(akouho,(br[0],cost[br[0]]))
    print(cost[0])
if __name__ == '__main__':
    main()
Problem p03575 (python)

Fixed submission:
n,m= map(int,input().split())
henl = []
usehen = [False] * m
brdic = {}
for _ in range(m):
    a,b= map(int,input().split())
    brdic[a] = brdic.get(a,[]) + [b]
    brdic[b] = brdic.get(b,[]) + [a]
    henl.append((a,b))

ordin = [-1]*(n+1)
lowlink = [-1]*(n+1)
k=[1]
bn=[0]
def dfs(node):
    ordin[node]=k[0]
    k[0]+=1
    lowlink[node]=ordin[node]
    for br in brdic[node]:
        temp = (min(node,br),max(node,br))
        if ordin[br]==-1:
            usehen[henl.index(temp)]=True
            dfs(br)
            lowlink[node] = min(lowlink[br],lowlink[node])
        else:
            if usehen[henl.index(temp)]==False:lowlink[node] = min(ordin[br],lowlink[node])
        if ordin[node] < lowlink[br]:bn[0]+=1
dfs(1)
print(bn[0])

Buggy submission (verdict: Runtime Error):
n,m= map(int,input().split())
henl = []
usehen = [False] * n
brdic = {}
for _ in range(m):
    a,b= map(int,input().split())
    brdic[a] = brdic.get(a,[]) + [b]
    brdic[b] = brdic.get(b,[]) + [a]
    henl.append((a,b))

ordin = [-1]*(n+1)
lowlink = [-1]*(n+1)
k=[1]
bn=[0]
def dfs(node):
    ordin[node]=k[0]
    k[0]+=1
    lowlink[node]=ordin[node]
    for br in brdic[node]:
        temp = (min(node,br),max(node,br))
        if ordin[br]==-1:
            usehen[henl.index(temp)]=True
            dfs(br)
            lowlink[node] = min(lowlink[br],lowlink[node])
        else:
            if usehen[henl.index(temp)]==False:lowlink[node] = min(ordin[br],lowlink[node])
        if ordin[node] < lowlink[br]:bn[0]+=1
dfs(1)
print(bn[0])
Problem p03645 (python)

Fixed submission:
N,M = list(map(int,input().split()))
atob = [0] * N
btoz = [0] * N
for _ in range(M):
    a, b = list(map(int,input().split()))
    if a == 1:atob[b-1] = 1
    elif a == N:btoz[b-1] = 1
    if b == 1:atob[a-1] = 1
    elif b == N:btoz[a-1] = 1

for i in range(N):
    if atob[i]*btoz[i] == 1:
        print('POSSIBLE')
        break
else:print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
atob = [0] * N
btoz = [0] * N
for _ in range(M):
    a, b = list(map(int,input().split()))
    if a == 1:atob[b-1] = 1
    elif a == N:btoz[b-1] = 1
    if b == 1:atob[a-1] = 1
    elif b == N:btoz[a-1] = 1

for i in range(N):
    if a[i]*b[i] == 1:
        print('POSSIBLE')
        break
else:print('IMPOSSIBLE')
Problem p03657 (python)

Fixed submission:
A,B = map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
    print('Possible')
else:
    print('Impossible')

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%==0:
  print('Possible')
else:
  print('Impossible')
Problem p03674 (python)

Fixed submission:
mod = 1000000007
n= int(input())
a= list(map(int,input().split()))
check = [0]*(n+1)
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n+1+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)
def cmb2(n,r):
    mod = 1000000007
    if (r<0 or r>n ):return 0
    r = min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%mod
r=-1
jn=-1
for i in range(n+1):
    check[a[i]-1]+=1
    if check[a[i]-1]==2:
        jn,r=a[i],i
        break
l=a.index(jn)
s = min(l,n-r)
t = max(l,n-r)
print(n)
for p in range(2,n+1):
  w2=cmb2(n+1,p)
  y2=cmb2(s+t,p-1)
  print(((w2+mod)-y2) % mod)
print(1)

Buggy submission (verdict: Runtime Error):
n= int(input())
a= list(map(int,input().split()))
check = [0]*(n+1)
g1=[1,1]
g2=[1,1]
inverse=[0,1]
for i in range(2,n+1+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)
def cmb2(n,r):
    mod = 1000000007
    if (r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%mod
r=-1
jn=-1
for i in range(n+1):
    check[a[i]-1]+=1
    if check[a[i]-1]==2:
        jn,r=a[i],i
        break
l=a.index(jn)
s,t=l,n-r
print(n)
for k in range(2,n+1):
    w2=cmb2(n+1,k)
    if s+t>=k-1:w2-=cmb2(s+t,k-1)
    print(w2)
print(1)
Problem p03943 (python)

Fixed submission:
l = list(map(int,input().split()))
if sum(l) % 2 == 1:
  print('No')
else:
  if sum(l)//2 in l:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split()))
if l % 2 == 1:
  print('No')
else:
  if l//2 in l:
    print('Yes')
  else:
    print('No')
Problem p02600 (python)

Fixed submission:
N=int(input())
if N<600:
  print(8)
elif N<800:
  print(7)
elif N<1000:
  print(6)
elif N<1200:
  print(5)
elif N<1400:
  print(4)
elif N<1600:
  print(3)
elif N<1800:
  print(2)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N=int(imput())
if N<600:
  print(8)
elif N<800:
  print(7)
elif N<1000:
  print(6)
elif N<1200:
  print(5)
elif N<1400:
  print(4)
elif N<1600:
  print(3)
elif N<1800:
  print(2)
else:
  print(1)
Problem p02621 (python)

Fixed submission:
def calc(a: int) -> int:
    return a+a**2+a**3

if __name__ == "__main__":
    a = int(input())
    print(calc(a))

Buggy submission (verdict: Runtime Error):
def calc(int: a) -> int:
    return a+a**2+a**3

if __name__ == "__main__":
    a = int(input())
    print(calc(a))
Problem p02705 (python)

Fixed submission:
import math
 
def round(R):
  return 2*R*math.pi
 
R = int(input())
print(round(R))

Buggy submission (verdict: Runtime Error):
def management(N,array):
	res = [0]*N
	for i in range(N):
      res[array[i]] += 1
    for j in range(len(res)):
      print(res[j])
     
    
    
N = int(input())
array = list(map(int,input().split())
managememt(N,array))

Buggy submission (verdict: Runtime Error):
def management(N,array):
	res = [0]
	for i in range(N):
      res[array[i]] += 1
    for j in range(len(res)):
      print(res[j])
     
    
    
N = int(input())
array = list(map(int,input().split())
managememt(N,array))

Buggy submission (verdict: Runtime Error):
import math
 
def round(R):
  return 2*R*pi

R = int(input())
round(R)

Buggy submission (verdict: Runtime Error):
import math

def round(R):
  return 2*R*pi

round(R)
Problem p03557 (python)

Fixed submission:
import bisect

def snuke_festival(N,arr):
    n_pair = 0
    for item in arr[1]:
        up_pair = bisect.bisect_left(arr[0],item)
        down_pair = bisect.bisect_right(arr[2],item)
        n_pair += up_pair*(N-down_pair)
    return n_pair


if __name__ == "__main__":
    N  =int(input())
    arr = []
    for i in range(3):
        arr.append(list(map(int,input().split())))
    arr_sorted = []
    for j in range(3):
        arr_sorted.append(arr[j].sort())
    print(snuke_festival(N,arr))

Buggy submission (verdict: Runtime Error):
import bisect

def snuke_festival(N,arr):
    n_pair = 0
    for item in arr[1]:
        up_pair = bisect.bisect(arr[0],item)
        dowm_pair = bisect.bisect_right(arr[2],item)
        n_pair += up_pair*down_pair
    return n_pair


if __name__ == "__main__":
    N  =int(input())
    arr = []
    for i in range(3):
        arr.append(list(map(int,input().split())))
    arr_sorted = []
    for j in range(3):
        arr_sorted.append(arr[j].sort())
    print(snuke_festival(N,arr))
Problem p02993 (python)

Fixed submission:
S = input()

def main():
    for i in range(1,len(S)):
        if S[i] == S[i-1]:
            return "Bad"
    return "Good"

print(main())

Buggy submission (verdict: Runtime Error):
from math import ceil,floor
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())

ans = B-A+1
ans -= (B//C - ceil(A/C) + 1)
ans -= (B//D - ceil(A/D) + 1)
ans += (B//lcm(C,D) - ceil(A/lcm(C,D)) + 1)

print(ans)
Problem p02995 (python)

Fixed submission:
from math import ceil,floor
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())

ans = B-A+1
ans -= B//C - (A-1)//C
ans -= B//D - (A-1)//D
ans += B//lcm(C,D) - (A-1)//lcm(C,D)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil,floor
from math import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())

ans = B-A+1
ans -= B//C - ceil(A/C) + 1
ans -= B//D - ceil(A/D) + 1
ans += B//lcm(C,D) - ceil(A/lcm(C,D)) + 1

print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil,floor
from math import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())

ans = B-A+1
ans -= (B//C - ceil(A/C) + 1)
ans -= (B//D - ceil(A/D) + 1)
ans += (B//lcm(C,D) - ceil(A/lcm(C,D)) + 1)

print(ans)
Problem p03085 (python)

Fixed submission:
b = input()
 
dict = {"A":"T","C":"G","T":"A","G":"C"}
 
print(dict[b])

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

dict = {"A":"T","C":"G","T":"A","G":"C"}

print(dict[b])
Problem p02582 (python)

Fixed submission:
S = input()
count = 0
max_c = 0

for i in S:
    if i != 'R':
        count = 0
    else:
        count = count + 1
    
    if max_c < count:
        max_c = count
    
print(max_c)

Buggy submission (verdict: Runtime Error):
S = input()
max_c = 0
for i in S:
    if i != 'R':
        count = 0
    else:
        count = count + 1
    
    if max_c < count:
        max_c = count
    
print(max_c)

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

for i in S:
    if i != 'R':
        count = 0
    else:
        count = count + 1
    
    if max_c < count:
        max_c = count
    
print(max_c)