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

Fixed submission:
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#import math

#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]



N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
dic={}
for s,c in sc:
    if not s in dic:
        dic.update({s:c})
    else:
        if dic[s]!=c:
            print(-1)
            exit()
if not 1 in dic:
    data="1"
    Z=2
else:
    Z=1
    data=""

if N==1 and not dic:
    print(0)
    exit()
if N>1 and 1 in dic and dic[1]==0:
    print(-1)
    exit()

for i in range(Z,N+1):
    if i in dic:
        data+=str(dic[i])
    else:
        if data:
            data+="0"
if data:
    print(data)
else:
    print(-1)
#print(Counter(sc))

Buggy submission (verdict: Runtime Error):
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#import math

#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]



N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
dic={}
for s,c in sc:
    if not s in dic:
        dic.update({s:c})
    else:
        if dic[s]!=c:
            print(-1)
            exit()

data=""
for i in range(1,N+1):
    if i in dic:
        if not data and dic[i]==0:
            print(-1)
            exit()

    if i in dic and dic[i]!=0 or i==N:
        data+=str(dic[i])
    else:
        if data:
            data+="0"
if data:
    print(data)
else:
    print(-1)
#print(Counter(sc))

Buggy submission (verdict: Runtime Error):
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#import math

#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]



N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
dic={}
for s,c in sc:
    if not s in dic:
        dic.update({s:c})
    else:
        if dic[s]!=c:
            print(-1)
            exit()

data=""
for i in range(1,N+1):
    if not data and dic[i]==0:
        print(-1)
        exit()

    if i in dic:
        if dic[i]!=0 or i==N:
            data+=str(dic[i])
    else:
        if data:
            data+="0"
if data:
    print(data)
else:
    print(-1)
#print(Counter(sc))
Problem p02782 (python)

Fixed submission:
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
A=2*(10**6)+3
P=[0 for i in range(A+1)]
P[1]=1
for i in range(2,A):
    P[i]=P[i-1]*i%mod

dr2=pow(P[r2],mod-2,mod)
dr1=pow(P[r1-1],mod-2,mod)
def combr2(x):
    y=r2
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*pow(P[x-y],mod-2,mod)%mod*dr2%mod)

def combr1(x):
    y=r1-1
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*pow(P[x-y],mod-2,mod)%mod*dr1%mod)
count=0
for i in range(c1+1,c2+2):
    count=(count+combr2(i+r2)-combr1(i+r1-1))%mod
print(count%mod)

Buggy submission (verdict: Runtime Error):
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
A=2*(10**6)+100
P=[0 for i in range(A+1)]

P[1]=1
for i in range(2,A):
    P[i]=P[i-1]*i%mod


def comb(x,y):
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*pow(gP[x-y],mod-2,mod)%mod*pow(gP[y],mod-2,mod)%mod)

count=0
for i in range(c1+1,c2+1 +1):
    count=(count+comb(i+r2,r2)-comb(i+r1-1,r1-1))%mod
print(count%mod)

Buggy submission (verdict: Runtime Error):
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
A=10**6+100
P=[0 for i in range(A+1)]

P[1]=1
for i in range(2,A):
    P[i]=P[i-1]*i%mod
gP=[pow(P[i],mod-2,mod) for i in range(len(P))]


def comb(x,y):
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*gP[x-y]%mod*gP[y]%mod)

count=0
for i in range(c1+1,c2+1 +1):
    count=(count+comb(i+r2,r2)-comb(i+r1-1,r1-1))%mod
print(count%mod)

Buggy submission (verdict: Runtime Error):
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
A=10**6+1
P=[0 for i in range(A+1)]

P[1]=1
for i in range(2,A):
    P[i]=P[i-1]*i%mod
gP=[pow(P[i],mod-2,mod) for i in range(len(P))]


def comb(x,y):
    if y>x or x<=0:
        return(0)
    if y==0:
        return(1)
    else:
        return(P[x]*gP[x-y]%mod*gP[y]%mod)

count=0
for i in range(c1+1,c2+1 +1):
    count=(count+comb(i+r2,r2)-comb(i+r1-1,r1-1))%mod
print(count%mod)

Buggy submission (verdict: Runtime Error):
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
P=[0 for i in range(10**6+1)]

P[1]=1
for i in range(2,10**6):
    P[i]=P[i-1]*i%mod
gP=[pow(P[i],mod-2,mod) for i in range(len(P))]


def comb(x,y):
    if y>x or x<=0:
        return(0)
    if y==0:
        return(1)
    else:
        return(P[x]*gP[x-y]%mod*gP[y]%mod)

count=0
for i in range(c1+1,c2+1 +1):
    count=(count+comb(i+r2,r2)-comb(i+r1-1,r1-1))%mod
print(count%mod)
Problem p02798 (python)

Fixed submission:
#from collections import *
from itertools import *
#from bisect import *
#from heapq import *
#import copy
#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]
#import math

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Zlst=set([i for i in range(N)])
if N==1:
    print(0)
    exit()
count=-1
for lst in combinations(range(N),N//2+N%2):
    odds=[[A[i],i] if i%2==0 else [B[i],i] for i in lst]
    even=[[B[i],i] if i%2==0 else [A[i],i] for i in list(Zlst-set(lst))]
    oddsst=sorted(odds,key=lambda  x:x[0])
    evenst=sorted(even,key=lambda  x:x[0])

    temp=oddsst[0][0]
    lst=[oddsst[0][1]]
    for i in range(1,N):
        if i%2==1:
            ntemp=evenst[i//2]
        else:
            ntemp=oddsst[i//2]
        if temp>ntemp[0]:
            flag=0
            break
        else:
            flag=1
            temp=ntemp[0]
            lst.append(ntemp[1])

    if flag:
        if count==-1:
            count=10**10
        tempcount=0
        while flag:
            flag=0
            for i in range(len(lst)-1):
                if lst[i]>lst[i+1]:
                    lst[i],lst[i+1]=lst[i+1],lst[i]
                    tempcount+=1
                    flag=1
        count=min(count,tempcount)


print(count)

Buggy submission (verdict: Runtime Error):
#from collections import *
from itertools import *
#from bisect import *
#from heapq import *
#import copy
#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]
#import math

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Zlst=set([i for i in range(N)])
count=-1
for lst in combinations(range(N),N//2+N%2):
    odds=[[A[i],i] if i%2==0 else [B[i],i] for i in lst]
    even=[[B[i],i] if i%2==0 else [A[i],i] for i in list(Zlst-set(lst))]
    oddsst=sorted(odds,key=lambda  x:x[0])
    evenst=sorted(even,key=lambda  x:x[0])

    temp=oddsst[0][0]
    lst=[oddsst[0][1]]
    for i in range(1,N):
        if i%2==1:
            ntemp=evenst[i//2]
        else:
            ntemp=oddsst[i//2]
        if temp>ntemp[0]:
            flag=0
            break
        else:
            flag=1
            temp=ntemp[0]
            lst.append(ntemp[1])

    if flag:
        if count==-1:
            count=10**10
        tempcount=0
        while flag:
            flag=0
            for i in range(len(lst)-1):
                if lst[i]>lst[i+1]:
                    lst[i],lst[i+1]=lst[i+1],lst[i]
                    tempcount+=1
                    flag=1
        count=min(count,tempcount)


print(count)
Problem p02804 (python)

Fixed submission:
mod = 10**9 + 7
kaijotable = [0 for i in range(200100)]
kaijotable[0] = 1
for i in range(1, 200051):
    kaijotable[i] = (kaijotable[i - 1] * i) % mod

def doubling(x, y, mod):
    if y == 0:
        return 1
    if y == 1:
        return x
    elif y % 2 == 0:
        val = (doubling(x, y // 2, mod) ** 2) % mod
        return val
    else:
        val = (doubling(x, y // 2, mod) ** 2) * x % mod
        return val

def gyaku(x):
    gyaku = doubling(x, mod - 2, mod) % mod
    return gyaku

gyakutable = [0 for i in range(200100)]
gyakutable[200050] = gyaku(kaijotable[200050])
for i in range(200050, 0, -1):
    gyakutable[i - 1] = i * gyakutable[i] % mod

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))
value=0
mod=10**9 + 7
if K==1:
    print(0)
    exit()

z=0

for i in range(N):
    if i>=K-1:
        c=kaijotable[z+K-1] * gyakutable[K-1] * gyakutable[z+K-1-(K-1)] % mod
        value+=c*A[i]
        value-=c*A[N-1-i]

        z+=1
    value%=mod
print(value)

Buggy submission (verdict: Runtime Error):
"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd"""
N,K=map(int,input().split())

#A=[list(reversed(list(map(int,input().split())))) for i in range(N)]
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fac=[1,1]
for i in range(2,N+1):
    fac.append(fac[i-1]*i%mod)
ifac=[pow(i,mod-2,mod) for i in fac]

if K==1:
    print(0)


count=0
ncount=0
for i in range(N-K+1):
    n=N-i-K
    m=i+1

    ncount+=fac[m]*ifac[K-2]*ifac[m-(K-2)]%mod
    ncount%=mod
    count-=A[n]*ncount
    count%=mod

ncount=0
for i in range(K-1,N):
    n=i-1
    #print(n,K-2,n-(K-2))
    ncount+=fac[n]*ifac[K-2]*ifac[n-(K-2)]%mod
    ncount%=mod
    count+=A[i]*ncount
    count%=mod
print(count)
Problem p02814 (python)

Fixed submission:
from fractions import gcd
def yaku2(a):
    count=0
    while a%2==0:
        a=a//2
        count+=1
    return(count)

def lcm(a,b):
    return(a*b//gcd(a,b))

N,M=map(int,input().split())
A=list(map(int,input().split()))

yaku=yaku2(A[0])
for i in range(1,N):
    if yaku!=yaku2(A[i]):
        print(0)
        exit()



_lcm=A[0]
for i in range(1,N):
    A[0]=lcm(A[0],A[i])
#print(A[0])
print((M-(A[0]-A[0]//2-A[0]))//A[0])

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def yaku2(a):
    count=0
    while a%2:
        count+=a//2
    return(count)

def lcm(a,b):
    return(a*b//gcd(a,b))

N,M=map(int,input().split())
A=list(map(int,input().split()))

yaku=yaku2(A[0])
for a in range(1,N):
    if yaku!=yaku2(A[i]):
        print(0)
        break


_lcm=A[0]
for i in range(1,N):
    A[0]=lcm(A[0],A[i])
#print(A[0])
print((M-(A[0]-A[0]//2-A[0]))//A[0])
Problem p02824 (python)

Fixed submission:
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N,M,V,P=map(int,input().split())
A=sorted(list(map(int,input().split())))
_SUM=sum(A[:N-(P-1)])



def main(i):

    B=[A[m] for m in range(N-(P-1)) if m!=i]

    C=A[i]+M
    a=V-P

    if C<A[-P]:
        return(0)
    else:
        if a>0:
            Votenum=a*M
            for b in B:
                Votenum-=min(C-b,M)
                if Votenum<=0:
                    return(1)

            return(0)
        else:
            return(1)




if main(0):
    print(N)
    exit()
st=0
end=N-P+1

while 1:
    a=(st+end)//2
    if main(a):
        end=a
    else:
        st=a

    if end-st<=1:
        break

if main(st):
    print(N-st)
else:
    print(N-end)

Buggy submission (verdict: Runtime Error):
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N,M,V,P=map(int,input().split())
A=sorted(list(map(int,input().split())))
_SUM=sum(A[:N-(P-1)])



def main(s):
    tempSUM=_SUM-s
    s+=M
    a=(V-P)

    if s<A[-P]:
        return(0)
    else:
        if a>0:
            tempSUM+=a*M
            if s>tempSUM//(N-P)) or s==tempSUM//(N-P)) and tempSUM%(N-P)) == 0:
                return(1)
        else:
            return(1)


if main(A[0]):
    print(N)
    exit()
st=0
end=N-1

while 1:
    a=(st+end)//2
    if main(A[a]):
        end=a
    else:
        st=a

    if end-st<=1:
        break

if main(A[st]):
    print(N-st)
else:
    print(N-end)
Problem p02855 (python)

Fixed submission:
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
P=[[0 for i in range(W)] for m in range(H)]

for h in range(H):
    if "#" in S[h]:
        front=h
        break


m=0
x=0
for w in range(W):
    if S[front][w]=="#":
        m+=1
        for z in range(x,w+1):
            P[front][z]=m
        x=w+1
for z in range(x,W):
    P[front][z]=m

for h in range(front-1,-1,-1):
    for w in range(W):
        P[h][w]=P[h+1][w]


for h in range(front+1,H):
    if "#" in S[h]:
        x=0
        for w in range(W):
            if S[h][w]=="#":
                m+=1
                for z in range(x,w+1):
                    P[h][z]=m
                x=w+1
        for z in range(x,W):
            P[h][z]=m
    else:
        for w in range(W):
            P[h][w]=P[h-1][w]

for h in range(H):
    print(" ".join(list(map(str,P[h]))))

Buggy submission (verdict: Runtime Error):
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
P=[[0 for i in range(W)] for m in range(H)]

for h in range(H):
    if "#" in S[h]:
        front=h
        break


m=0
x=0
for w in range(W):
    if S[front][w]=="#":
        m+=1
        for z in range(x,w+1):
            P[front][z]=m
        x=w+1
for z in range(x,W):
    P[front][z]=m

for h in range(front-1,-1,-1):
    for m in range(M):
        P[h][m]=S[h+1][m]


for h in range(front+1,H):
    if "#" in S[h]:
        x=0
        for w in range(W):
            if S[h][w]=="#":
                m+=1
                for z in range(x,w+1):
                    P[h][z]=m
                x=w+1
        for z in range(x,W):
            P[h][z]=m
    else:
        for w in range(W):
            P[h][w]=S[h-1][w]

for h in range(H):
    print(" ".join(list(map(str,P[h]))))
Problem p02888 (python)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
count=0
for d1 in range(N-2):
    for d2 in range(d1+1,N-1):
        m=bisect.bisect_left(L,L[d1]+L[d2])
        if m>d2+1:count+=m-(d2+1)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
count=0
for d1 in range(N-2):
    for d2 in range(d1+1,N-1):
        m=bisect.bisect_right(L[d1]+L[d2],l)
        if m>d2:count+=m-d2
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=sorted(list(map(int,input().split())))
count=0
for d1 in range(N-2):
    for d2 in range(d1+1,N-1):
        m=bisect.bisect_right(L[d1]+L[d2],l)
        if:m>d2:count+=m-d2
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=sorted(list(map(int,input().split())))
L=list(set(L))
count=0
d2breakFlag=False
for d1 in range(N-2):
    for d2 in range(d1+1,N-1):
        Temp=L[d1]+L[d2]

        """for d3 in range(d2+1,N):
            if L[d1]+L[d2]>L[d3]:count+=1
            else:break
print(count)"""
Problem p02900 (python)

Fixed submission:
A,B=map(int,input().split())
lst=set()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if A==B==1:
    print(1)
else:
    print(len(set([i[0] for i in factorization(A)])&set([i[0] for i in factorization(B)]))+1)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
lst=[]
i=2
while A>1 and B>1:
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break
        if flag:
            A=A//i
            B=B//i
            lst.append(i)
    if not flag:
        i+=1

lst+=[1]
#print(lst)
print(len(lst))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
lst=[]
i=2
while A>1 and B>1
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break
        if flag:
            A=A//i
            B=B//i
            lst.append(i)
    i+=1

lst+=[1]
#print(lst)
print(len(lst))
Problem p02937 (python)

Fixed submission:
from itertools import *
from collections import *
from bisect import *
s=list(input())
t=input()
sets=set(s)
"""
a=len(s)*len(t)
maxcount=len(s)
for i in range(100):
    if maxcount<a:
        maxcount**=10
    else:
        break
"""

for T in t:
    if not T in sets:
        print(-1)
        exit()
N=len(s)
dic={}
for i in range(N):
    if not s[i] in dic:
        dic.update({s[i]:[i]})
    else:
        dic[s[i]].append(i)

count=0
prei=0
for i in range(len(t)):
    idx=bisect_left(dic[t[i]],prei)
    if idx<len(dic[t[i]]):
        prei=dic[t[i]][idx]+1
    else:
        prei=dic[t[i]][0]+1
        count+=N
    if i==len(t)-1:
        count+=prei



if count<=len(s)*(10**100):
    print(count)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from itertools import *
from collections import *
from bisect import *
s=list(input())
t=input()
sets=set(s)

a=len(s)*len(t)
maxcount=len(s)
for i in range(100):
    if maxcount<a
        maxcount**=10
    else:
        break


for T in t:
    if not T in sets:
        print(-1)
        exit()
N=len(s)
dic={}
for i in range(N):
    if not s[i] in dic:
        dic.update({s[i]:[i]})
    else:
        dic[s[i]].append(i)

count=1
prei=0
for i in range(len(t)):
    idx=bisect_left(dic[t[i]],prei)
    if idx<len(dic[t[i]]):
        prei=dic[t[i]][idx]
    else:
        prei=dic[t[i]][0]
        count+=N
    if i==len(t)-1:
        count+=prei



if count<=maxcount:
    print(count)
else:
    print(-1)
Problem p02963 (python)

Fixed submission:
S=int(input())

if S<10**18:
    X1,Y1=0,0

    mod=10**9

    X2=mod
    Y3=S//mod + 1

    Y2=1
    X3=mod-S%mod
else:
    X1,Y1,X2,Y3=0,0,0,0
    Y2=10**9
    X3=10**9

print(X1,Y1,X2,Y2,X3,Y3)

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

if S<10**18:
    X1,Y1=0,0

    mod=10**9

    X2=mod
    Y3=S//mod + 1

    Y2=1
    X3=mod-S%mod
else:
    X1,Y1,X2,Y3=0,0,0,0
    Y2=10**9
    Y3=10**9

print(X1,Y1,X2,Y2,X3,Y3)

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

if S<10**18
    X1,Y1=0,0

    mod=10**9

    X2=mod
    Y3=S//mod + 1

    Y2=1
    X3=mod-S%mod
else:
    X1,Y1,X2,Y3=0,0,0,0
    Y2=10**9
    Y3=10**9

print(X1,Y1,X2,Y2,X3,Y3)
Problem p02973 (python)

Fixed submission:
import bisect
import collections

N=int(input())
A=[int(input()) for i in range(N)]
B=[0 for i in range(N)]
C=sorted(A)
count=0
lst=collections.deque([])
for i in range(N):
    if A[i]==C[-1]:
        C.pop()
        if lst:
            lst.pop()
        else:
            count+=1
        continue
    idx=bisect.bisect_left(lst,A[i])-1
    #print(idx,lst,A[i])
    if idx<0:
        lst.appendleft(A[i])
        count+=1
    else:
        lst[idx]=A[i]

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

N=int(input())
A=np.array([int(input()) for i in range(N)],dtype=np.int32)
B=[0 for i in range(N)]
C=sorted(A)
count=0
for i in range(N):

    if B[i]:
        continue

    else:
        temp=A[i]
        for m in range(i,N):
            if not B[m]:
                if A[m]==C[-1]:
                    B[m]=1
                    C.pop()
                    break
                else:
                    if temp<A[m]:
                        temp=A[m]
                        B[m]=1
        count+=1
    #print(i,count,B)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect

N=int(input())
A=[int(input()) for i in range(N)]
lst=[]
nowN=max(A)+1
i=0
while i<N:
    if nowN>=A[i]:
        nowN=A[i]
        lst.append([A[i]])
    else:
        lst2=[n[-1] for n in lst]
        if min(lst2)<A[i]
            for n in range(len(lst2)):
                if lst2[n]<A[i]:
                    lst[n].append(A[i])
                    break
        else:
            lst.append([A[i]])
    i+=1
print(len(lst))
Problem p02995 (python)

Fixed submission:
from fractions import Fraction ,gcd
def lcm(a,b):
    return(a*b//gcd(a,b))
A,B,C,D=map(int,input().split())
N=B-A+1
ans=N- (B//C + B//D - (A-1)//C - (A-1)//D) + B//(lcm(C,D)) -(A-1)//(lcm(C,D))
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C,D=list(map(int,input().split()))
def Factoring(value):
    _value=value
    div=2
    data=[]
    while value!=1:
        while value%div==0:
            value=int(value/div)
            data.append(div)
        div+=1
    return(data)
def divcheck(value,lst):
    for i in lst:
        if value%i!=0:
            return(1)
        value=int(value/i)
    return(0)
FactoringC,FactoringD=Factoring(C),Factoring(D)
for i in range(A,B+1):
    if not divcheck(i,FactoringC):
        startC=i
        break
for i in range(A,B+1):
    if not divcheck(i,FactoringD):
        startD=i
        break
print(B+1-A-len(set(list(range(startC,B+1,C))+list(range(startD,B+1,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)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(W*H/2,0)

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)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""

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)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""

Buggy submission (verdict: Runtime Error):
W,H,x,y=map(int,input().split())
if x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,1)
elif x and y:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)

Buggy submission (verdict: Runtime Error):
W,H,x,y=map(int,input().split())
if x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,1)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)

Buggy submission (verdict: Runtime Error):
W,H,x,y=map(int,input().split())
print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),sum([x/W==y/H,x/W==(H-y)/H,(W-x)/W==y/H])=>1)
Problem p03029 (python)

Fixed submission:
X=input()
X=X.split()
A,P=int(X[0]),int(X[1])

print(int((A*3+P)/2))

Buggy submission (verdict: Runtime Error):
X=[input() for i in range(2)]
A,P=X[0],X[1]

print(int(A*3+P)/2)