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

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
t=100
for i in range(0,f+1,a*100):
    for j in range(0,f-i+1,b*100):
        k=i+j
        if k==0:
            continue
        s=min(f-i-j,(i+j)*e//100)
        for ii in range(0,s+1,c):
            for jj in range(0,s-ii+1,d):
                if t>e-(ii+jj)*100/(i+j):
                    t=e-(ii+jj)*100/(i+j)
                    x,y=ii+jj+i+j,ii+jj
print(str(x)+" "+str(y))

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
ans=100
for i in range(f//(100*a)+1):
    for j in range(f//(100*b)+1):
        s=100*a*i+100*b*j
        if s==0:
            break
        for ii in range((f-100*a)//c+1):
            for jj in range((f-100*a)//d+1):
                t=c*ii+d*jj
                if t==0:
                    break
                u=(100*t)/s
                if s+t<=f and u==f:
                    print(str(s+t)+" "+str(t))
                    exit()
                if s+t<=f and u<e:
                    if ans>e-u:
                        ans=e-u
                        x,y=s,t
print(str(x+y)+" "+str(y))
Problem p03611 (python)

Fixed submission:
from collections import Counter
N=int(input())
s=[]
for i in list(map(int,input().split())):
    s+=[i-1,i,i+1]
s=Counter(s)
print(s.most_common(1)[0][1])

Buggy submission (verdict: Runtime Error):
N=int(input())
d={}
for i in list(map(int,input().split())):
    d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)<3:
    ans=sum(d)
else:    
    for j in range(len(d)-2):
        s=d[j]+d[j+1]+d[j+2]
        if s>ans:
            ans=s
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
d={}
for i in list(map(int,input().split())):
    d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)<3:
    ans=sum(d)
else:    
    for j in range(len(d)-2):
        s=d[j]+d[j+1]+d[j+2]
        if s>ans:
            ans=s
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
d={}
for i in list(map(int,input().split())):
    d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)>=3:
    for j in range(len(d)-2):
        s=d[j]+d[j+1]+d[j+2]
        if s>ans:
            ans=s
else:
    ans=max(d)
print(ans)
Problem p03673 (python)

Fixed submission:
N=int(input())
s=list(input().split())
if N>=2:
    t=s[N::-2]+s[N%2::2]
    for i in range(N):
        print(t[i],end=" ")
else:
    print(s[0])

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(input().split())
t=s[5::-2]+s[0::2]
for i in range(N):
    print(t[i],end=" ")
Problem p03739 (python)

Fixed submission:
# coding: utf-8
# hello worldと表示する
N=int(input())
s=list(map(int,input().split()))
def f(N,s,t):
    ss=0
    w=0
    for i in range(N):
        ss+=s[i]
        if t==1:
            if ss<=0:
                w+=1-ss
                ss=1
            t=-1    
        elif t==-1:
            if ss>=0:
                w+=1+ss
                ss=-1
            t=1
    return w
t=1
a=f(N,s,t)
t=-1
b=f(N,s,t)
print(min(a,b))

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(map(int,input().split()))
if s[0]<0:
    t=1
elif s[0]>0:
    t=-1
ss=s[0]   
w=0
for i in range(N-1):
    if t==1:
        if ss+s[i+1]>=t:
            ss=ss+s[i+1]
            pass
        else:
            w+=t-ss-s[i+1]
            ss=1
        t=-1
    elif t==-1:
        if ss+s[i+1]<=t:
            ss=ss+s[i+1]
            pass
        else:
            w+=ss+s[i+1]-t
            ss=-1
        t=1
print(w)
Problem p04044 (python)

Fixed submission:
N,M=map(int,input().split())
s=[]
for i in range(N):
    s.append(input())
print("".join(sorted(s)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=sorted([input() for i in range(m)])
print("".join(s))
Problem p02691 (python)

Fixed submission:
import collections
n=int(input())
a = list(map(int, input().split()))
an=0
ii=[]
jj=[]
for i in range(n):
    ii.append(i+a[i])
    jj.append(i-a[i])
jjj=collections.Counter(jj)
for i in range(n):
    an+=jjj[ii[i]]
print(an)

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

t=[0]*n
tt=[[0]*n for k in range(n)]

def search(i,j):
   if i==j or j==n or i==n-1:
      return
   if tt[i][j]==1:
      return
   if j-i==a[i]+a[j]:
      t[i]+=1

   tt[i][j]=1

   search(i+1,j)
   search(i,j+1)
search(0,1)

print(sum(t))

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

t=[[0]*n for k in range(n)]
tt=[[0]*n for k in range(n)]

def search(i,j):
   if i==j or j==n or i==n-1:
      return
   if tt[i][j]==1:
      return
   if j-i==a[i]+a[j]:
      t[i][j]=1

   tt[i][j]=1

   search(i+1,j)
   search(i,j+1)
search(0,1)
result=0
for row in t:
    result += sum(row)

print(result)

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

t=[[0]*n for k in range(n)]
tt=[[0]*n for k in range(n)]

def search(i,j):
   if i==j or j==n or i==n-1:
      return
   if tt[i][j]==1:
      return
   if j-i==a[i]+a[j]:
      t[i][j]=1
      print(i,j)
   tt[i][j]=1

   search(i+1,j)
   search(i,j+1)
search(0,1)
result=0
for row in t:
    result += sum(row)

print(result)
Problem p02696 (python)

Fixed submission:

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


if n>=b-1:
    x=b-1
else:
    x=n
print(a*x//b-a*(x//b))

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

t=0
xx=1
l=[-1]*(b+1)
p=1
d=b//a
if d==0:
   d=1
if n>=b and b>1:
   while t == 0 and xx <= n:
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
      xx+=d
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

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

t=0
xx=1
l=[-1]*(b+1)
p=1
d=b//a
if n>=b and b>1:
   while t == 0 and xx <= n:
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
      xx+=d
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

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

t=0
xx=0
l=[-1]*(b+1)
p=1
if n>=b and b>1:
   while t == 0 and xx <= n:
      xx += 1
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

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

t=0
xx=0
l=[-1]*(b+1)
p=1
if n>b and b>1:
   while t == 0 and xx <= n:
      xx += 1
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

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

t=0
xx=0
l=[-1]*b
p=1
if n>b:
   while t == 0 and xx <= n:
      xx += 1
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

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

t=0
xx=0
l=[0]*b
p=1
if a<b:
   while t == 0 and xx <= n:
      xx += 1
      c=a*xx%b
      if l[c]==0:
         l[c]=xx
      else:
         t=1
   while t>-1:

      if l[p]>0:
         t=-2
         x=l[p]
      p+=1



else:
   x=n
print(a*x//b-a*(x//b))
Problem p02702 (python)

Fixed submission:
s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy submission (verdict: Runtime Error):
S=input()
l=len(S)
t=0
p=0
m=[0] * l

for i in range(l):
    m[i]=int(S[i])*(10**(l-1-i))%2019

for i in range(l):
    p=0
    for j in range(l-i):
        p=(p+m[i+j])%2019
        if p==0:
            t+=1
print(t)

S=input()
l=len(S)
t=0
p=0
m=[0] * l

for i in range(l):
    m[i]=int(S[i])*(10**(l-1-i))%2019

for i in range(l):
    p=0
    for j in range(l-i):
        p=(p+m[i+j])%2019
        if p==0:
            t+=1
print(t)
Problem p03546 (python)

Fixed submission:
H,W=map(int,input().split())
C=[0 for i in range(10)]
for i in range(10):
    C[i]=list(map(int,input().split()))
A=[0 for i in range(H)]
for i in range(H):
    A[i]=list(map(int,input().split()))

    
def mini(S,dic,ans):
    if(S=={0,1,2,3,4,5,6,7,8,9}):
        return ans
    min_val=min(dic.values())
    for i in dic.keys():
        if dic[i]==min_val:
            S.add(i)
            pos=i
            break
    ans[pos]=dic.pop(pos)
    for i in dic.keys():
        dic[i]=min([dic[i],ans[pos]+C[i][pos]])
    return mini(S,dic,ans)

dic={}
for i in range(10):
    dic[i]=C[i][1]
M=mini(set(),dic,{})
M[-1]=0

ans=0
for i in range(H):
    for j in range(W):
        ans+=M[A[i][j]]
print(ans)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
C=[0 for i in range(9)]
for i in range(9):
    C[i]=map(int,input().split())
A=[0 for i in range(H)]
for i in range(H):
    A[i]=map(int,input().split())

    
def mini(S,dic,ans):
    if(S=={0,1,2,3,4,5,6,7,8}):
        return ans
    min_val=min(dic.items())
    for i in dic.keys():
        if dic[i]==min_val:
            S.add(i)
            pos=i
            break
    ans[pos]=dic.pop(pos)
    for i in dic.keys():
        dic[i]=min([dic[i],dic[pos]+C[pos][0]])
    mini(S,dic,ans)

dic={}
for i in range(9):
    dic[i]=C[i][0]
M=mini({},dic,{})
M[-1]=0

ans=0
for i in range(H):
    for j in range(W):
        ans+=M[A[i][j]]
print(ans)
Problem p03547 (python)

Fixed submission:
X,Y=input().split()

dic={"A":1,"B":2,"C":3,"D":4,"E":5,"F":6}

if(dic[X]<dic[Y]):
    print("<")
elif(dic[X]>dic[Y]):
    print(">")
else:
    print("=")

Buggy submission (verdict: Runtime Error):
X,Y=input().split()

dic={"A":1,"B":2,"C":3,"D":4,"E":5,"F":6}

if(dic[X]<dix[Y]):
    print("<")
elif(dic[X]>dic[Y]):
    print(">")
else:
    print("=")
Problem p03548 (python)

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

n=0
while(1):
    if(n*y+(n+1)*z>x):
        break
    n+=1

print(n-1)

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

n=0
while(1):
    if(n*y+(n+1)*z>x):
        break
    n+=1

return(n)
Problem p03556 (python)

Fixed submission:
N=int(input())

x=int(N**0.5)
print(x**2)

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

x=int(N**0.5)
print(x**2)
Problem p03970 (python)

Fixed submission:
s=raw_input()
true_s='CODEFESTIVAL2016'

error_number=0

for i in range(16):
    if s[i]!=true_s[i]:
        error_number+=1


print error_number

Buggy submission (verdict: Runtime Error):
W,H=map(int,raw_input().split())
p=[input() for i in range(W)]
q=[input() for i in range(H)]

p.sort(reverse=True)
q.sort(reverse=True)

cost=0
del_H=0
del_W=0
len_p=W
len_q=H

while len_p>0 and len_q>0:
    
    if p[0]>q[0]:
        del_W+=1
        cost+=p[0]*(del_H+1)
        del p[0]
        len_p-=1
    else:
        del_H+=1
        cost+=q[0]*(del_W+1)
        del q[0]
        len_q-=1
        

if len_p==0:
    cost+=sum(q)*(W+1)

else:
    cost+=sum(p)*(H+1)

print cost
Problem p02613 (python)

Fixed submission:
n=int(input())
I={"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(n):
  I[input()]+=1
print("AC x {}".format(I["AC"]))
print("WA x {}".format(I["WA"]))
print("TLE x {}".format(I["TLE"]))
print("RE x {}".format(I["RE"]))

Buggy submission (verdict: Runtime Error):
n=int(input())
I={"ac":0,"wa":0,"tle":0,"re":0}
for i in n:
  I[input()]+=1
print("AC x {}".format(I["ac"]))
print("WA x {}".format(I["wa"]))
print("TLE x {}".format(I["tle"]))
print("RE x {}".format(I["re"]))
Problem p02888 (python)

Fixed submission:
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-1,1,-1):
  for j in range(i-1,0,-1):
    ans+=j-bisect.bisect_left(l,l[i]-l[j]+1,hi=j)
print(ans)

Buggy submission (verdict: Runtime Error):
def search(m,n,l): //startCは常に満たす、stopC+1は常に満たさない
  if l[0]<=m: return 0
  elif l[n-1]>m: return n
  startC,stopC=0,n-1
  while startC-stopC!=0:
    if l[(stopC-startC)>>1]<=m:
      stopC=startC-1+(stopC-startC)>>1
    else:
      startC+=(stopC-startC)>>1
  return stopC+1

n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    ans+=search(l[i]-l[j],n,l[j+1:]) //l[i]-l[j]<l[ans]を満たす最小のansを求める
print(ans)

Buggy submission (verdict: Runtime Error):
def search(m,n,l): //startCは常に満たす、stopCは常に満たさない
  if l[0]<=m: return 0
  elif l[n-1]>m: return n
  startC,stopC=0,n
  while startC-stopC+1!=0:
    if l[(stopC-startC)>>1]>m:
      stopC=startC+(stopC-startC)>>1
    else:
      startC+=(stopC-startC)>>1
  return stopC

n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(n-2):
  for j in range(1,n-i-1):
    ans+=search(l[i]-l[j+i+1],n,l[j+i+2]) //l[i]-l[j]<l[ans]を満たす最小のansを求める
Problem p02982 (python)

Fixed submission:
import math
def dist(a,b,d):
  distance=0
  for i in range(d):
    distance+=(a[i]-b[i])**2
  return distance
n,d=map(int,input().split())
x=[]
c=0
for i in range(n):
  x.append(list(map(int,input().split())))
for i in range(1,n):
  for j in range(i):
    k=dist(x[i],x[j],d)
    if k==(int(math.sqrt(k)))**2:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
import math
def dist(a,b,d):
  distance=0
  for i in range(d):
    distance+=(a[i]-b[i])**2
  return distance
n,d=map(int,input().split())
x=[]
c=0
for i in range(n):
  x.append(list(map(int,input().split())))
for i in range(1,n):
  for j in range(i-1):
    k=dist(x[i],x[j])
    if k==(int(math.sqrt(k)))**2:
      c+=1
Problem p03007 (python)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
if a[-1]<=0:
  print(2*a[-1]-sum(a))
  s=a[-1]
  for i in a[:-1]:
    print(s,i)
    s-=i
elif a[0]>=0:
  print(sum(a)-2*a[0])
  s=a[0]
  for i in a[1:-1]:
    print(s,i)
    s-=i
  print(a[-1],s)
else:
  m=0
  for i in range(n):
    if a[i]>=0:
      k=i
      break
    m-=a[i]
  print(m+sum(a[k:]))
  s=a[0]
  for i in a[k:-1]:
    print(s,i)
    s-=i
  print(a[-1],s)
  s=a[-1]-s
  for i in a[1:k]:
    print(s,i)
    s-=i

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
if a[n-1]<=0:
  print(2*a[n-1]-sum(a))
  s=a[n-1]
  for i in a[:-1]:
    print(s,i)
    s-=i
elif a[0]>=0:
  print(sum(a)-2*a[0])
  s=a[0]
  for i in a[1:]:
    print(i,s)
    s=i-s
else:
  m=0
  for i in n:
    if a[i]>=0:
      k=i
      break
    m-=a[i]
  print(m+sum(a[k:]))
  s=a[0]
  for i in a[k:-1]:
    print(s,i)
    s-=i
  print(a[-1],s)
  s=a[-1]-s
  for i in a[1:k]:
    print(s,i)
    s-=i
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=s[int(input())-1]
a=""
for i in range(n):
    a+=["*",k][int(s[i]==k)]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=s[int(input())]
a=""
for i in range(n):
    a+=["*",k][int(s[i]==k)]
print(a)
Problem p03071 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a,b)*2-1
Problem p03076 (python)

Fixed submission:
a=[int(input()) for i in range(5)]
minn,summ=10,0
for i in a:
  minn=min(minn,(i-1)%10)
  summ+=(i+9)//10
print(summ*10+minn-9)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(5)]
minn=0
for i in a:
  minn=min(minn,i%10)
  summ+=(i+9)//10
print(summ+minn)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(5)]
minn=0
for i in a:
  minn=min(minn,i%10)
  summ+=(int(i)+9)//10
print(summ+minn)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(5)]
minn=0
for i in a:
  minn=min(minn,int(i[-1]))
  summ+=(int(i)+9)//10
print(summ+minn)
Problem p03087 (python)

Fixed submission:
n,q=list(map(int,input().split()))
s=" "+input()
a=[0]
for i in range(1,n+1):
  if s[i]=="C" and s[i-1]=="A":
    a.append(a[i-1]+1)
  else:
    a.append(a[i-1])
for i in range(q):
  l,r=list(map(int,input().split()))
  print(a[r]-a[l])

Buggy submission (verdict: Runtime Error):
n,q=list(map(int,input().split()))
s=" "+input()
a=[0]
for i in range(1,n+1):
  if c[i]=="C" and c[i-1]=="A":
    a.append(a[i-1]+1)
  else:
    a.append(a[i-1])
for i in range(q):
  l,r=list(map(int,input().split()))
  print(a[r]-a[l])
Problem p03109 (python)

Fixed submission:
y,m,d=list(map(int,input().split("/")))
if y>2019:
  print("TBD")
elif y<2019:
  print("Heisei")
elif m>4:
  print("TBD")
elif m<4:
  print("Heisei")
elif d>30:
  print("TBD")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
y,m,d=list(map(int,input().split("/")))
if y>2019:
  print("TBD")
elif y<2019:
  print("Heisei")
elif m>4:
  print("TBD")
elif m<4:
  print("Heisei")
elif d=30:
  print("TBD")
else:
  print("Heisei")
Problem p03110 (python)

Fixed submission:
n=int(input())
jpy,btc=0,0
for i in range(n):
  x,u=input().split()
  if u=="JPY":
    jpy+=int(x)
  else:
    btc+=float(x)
jpy+=btc*380000
print(jpy)

Buggy submission (verdict: Runtime Error):
n=int(inout())
jpy,btc=0,0
for i in range(n):
  x,u=input().split()
  if u=="JPY":
    jpy+=int(x)
  else:
    btc+=float(x)
jpy+=btc*380000
print(jpy)
Problem p03292 (python)

Fixed submission:
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input()))
print(max(a)-min(a))
Problem p03294 (python)

Fixed submission:
a=int(input())
print(sum(list(map(int,input().split())))-a)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(sum(list(map(int,input())))-a)
Problem p02696 (python)

Fixed submission:

A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


compute_range = list(range(0, math.ceil(N / B) + 1))
# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


compute_range = list(range(0, math.ceil(N / B) + 1))
# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


compute_range = list(range(0, math.ceil(N / B) + 1))
# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = max(h(N), h(N % B))
print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


compute_range = list(range(0, math.ceil(N / B) + 1))
# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


if N > B:
    max_num = h((compute_range[-2]) * B - 1)
else:
    max_num = h(N)

print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい

# g(x)はBごとに数値が変わるので、Bで区切って計算すれば計算量を減らせる。
# その区間で、Bで割った余りがB-1、つまり最後の点が一番高い数値を出す。
# よって、計算量はN%B

# まずは区間を出す
compute_range = list(range(0, math.ceil(N / B)))
# print(compute_range)
# この区間の中で、二分探索する
# 01だと1の方が数値が大きいことがわかったら、次はその中で末尾を取る。
# ただし、範囲外にはならないように


def h(x):
    return (int((A * x) / B) - A * int(x / B))


if N > B:
    max_num = h((compute_range[-1] + 1) * B - 1)
else:
    max_num = h(N)

# max_num = 0
# for i in range(B):
#     index = compute_range[-1] * B + i
#     if index > N:
#         continue
#     max_num = max(max_num, h(index))

print(max_num)

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい

# g(x)はBごとに数値が変わるので、Bで区切って計算すれば計算量を減らせる。
# その区間で、Bで割った余りがB-1、つまり最後の点が一番高い数値を出す。
# よって、計算量はN%B

# まずは区間を出す
compute_range = list(range(0, math.ceil(N / B)))
# print(compute_range)
# この区間の中で、二分探索する
# 01だと1の方が数値が大きいことがわかったら、次はその中で末尾を取る。
# ただし、範囲外にはならないように


def h(x):
    return (int((A * x) / B) - A * int(x / B))


max_num = 0
for i in range(B):
    index = compute_range[-1] * B + i
    if index > N:
        continue
    max_num = max(max_num, h(index))

print(max_num)
Problem p02743 (python)

Fixed submission:
import math
import numpy as np
a, b, c = map(int, input().split())


d = c - a - b
if d > 0 and d * d > 4 * a * b:
    print('Yes')
else:
    print("No")

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

k = max([float(np.abs(a)), float(np.abs(b))])

if (k * np.sqrt((a / k) * (b / k))) < (c - a - b) / 2:
    print("Yes")
else:
    print("No")
Problem p02755 (python)

Fixed submission:
import math
A, B = list(map(int, input().split()))

A_min = math.ceil(A * 25 / 2)
A_max = ((A + 1) * 25 / 2)
if A_max > math.floor(A_max):
    A_max = math.floor(A_max) + 1
else:
    A_max = A_max
A_max = int(A_max)
B_min = B * 10
B_max = (B + 1) * 10
# print(B_min, B_max)
A_list = list(range(A_min, A_max))
B_list = list(range(B_min, B_max))
# print(A_list)
# print(B_list)

min_ans = -1
for num in A_list:
    if num in B_list:
        min_ans = num
        break
    else:
        continue

print(min_ans)

Buggy submission (verdict: Runtime Error):
import math
A, B = list(map(int, input().split()))

A_min = math.ceil(A * 25 / 2)
A_max = ((A + 1) * 25 / 2)
if A_max > math.floor(A_max):
    A_max = math.floor(A_max) + 1
else:
    A_max = A_max
A_max = int(A_max)
B_min = B * 10
B_max = (B + 1) * 10
# print(B_min, B_max)
# A_list = list(range(A_min, A_max))
# B_list = list(range(B_min, B_max))
print(A_list)
print(B_list)

min_ans = -1
for num in A_list:
    if num in B_list:
        min_ans = num
        break
    else:
        continue

print(min_ans)
Problem p02767 (python)

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

powers = []
for i in range(min(points), max(points) + 1):
    power = 0
    for point in points:
        power += ((i - point) ** 2)
    powers.append(power)

print(min(powers))

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

powers = []
for i in range(min(points), max(points)):
    power = 0
    for point in points:
        power += ((i - point) ** 2)
    powers.append(power)

print(min(powers))

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

powers = []
for i in range(min(points), max(points)):
    power = 0
    for point in points:
        power += ((i - point) ** 2)
    powers.append(power)
print(min(powers))