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

Fixed submission:
import math

eight, ten = map(int, input().split())

eight_price = eight / 0.08
ten_price = ten / 0.1

if eight_price >= ten_price:
    bigger = eight_price
    if (bigger // 10) != ten:
        print("-1")
    else:
        print(math.ceil(bigger))
else:
    bigger = ten_price
    if (bigger * 8 // 100) != eight:
        print("-1")
    else:
        print(math.ceil(bigger))

Buggy submission (verdict: Runtime Error):
mport math

eight, ten = map(int, input().split())

eight_price = eight / 0.08
ten_price = ten / 0.1

if eight_price >= ten_price:
    bigger = eight_price
    if (bigger // 10) != ten:
        print("-1")
    else:
        print(math.ceil(bigger))
else:
    bigger = ten_price
    if (bigger * 8 // 100) != eight:
        print("-1")
    else:
        print(math.ceil(bigger))
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
P = sorted(list(map(int, input().split())))

a = -1
if len(P) > 0:
    for p in range(0, 102):
        if abs(X - p) < abs(X - a) and (p not in P):
            a = p
else:
    a = X

print(a)

Buggy submission (verdict: Runtime Error):
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var X, N int
	fmt.Scanf("%d", &X)
	fmt.Scanf("%d", &N)

	P := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
	}
	sort.Ints(P)
	fmt.Println(P)

	var a int = -1
	if len(P) > 0 {
		for p := 0; p < 102; p++ {
			if math.Abs(float64(X) - float64(p)) < math.Abs(float64(X) - float64(a)) && !Contain(P, p) {
				a = p
			}
		}
	} else {
		a = X
	}
	fmt.Println(a)
}

func Contain(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}
Problem p02646 (python)

Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v <= w:
    print("NO")
elif t < abs(a - b) / abs(v - w):
    print("NO")
else:
    print("YES")

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

delta_t = abs(a - b)/abs(v - w) - 1

if v <= w:
    print("No")
elif t < delta_t:
    print("No")
else:
    print("Yes")

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

delta_t = abs(a - b)/abs(v - w) - 1
print(delta_t)

if v <= w:
    print("No")
elif t < delta_t:
    print("No")
else:
    print("Yes")
Problem p02780 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, input().split(' ')))
def In(): return int(input())
def InS(): return input()

N, K = InMap()
P = InMap()

Res = [0]*(N - K + 1)
tmp = sum(P[0:K])
for i in range(K, N):
    Res[i-K] = tmp
    tmp -= P[i-K]
    tmp += P[i]
Res[-1] = tmp
print((max(Res) + K) / 2)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

N, K = InMap()
P = InMap()

print((max([sum(P[i:i+K]) for i in range(N-K)]) + K) / 2)
Problem p04043 (python)

Fixed submission:
A, B, C=list(map(int, input().split(" ")))
if ([A, B, C].count(5)==2) and ([A, B, C].count(7)==1):
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C=list(map(int, input().split(" "))
if [A, B, C].count(5)==2 and [A, B, C].count(7)==1:
  print('Yes')
else:
  print('No'))
Problem p02607 (python)

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

ans=0
for i in range(N):
  if (i+1)%2==1 and A[i]%2==1:
    ans+=1
print(ans)

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

ans=0
for i in range(N):
  if (i+1)%2==1 and a[i]%2==1:
    ans+=1
print(ans)
Problem p02664 (python)

Fixed submission:
s=input()
print(s.replace("?", "D"))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.replace("?", "D")
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
s=input()
if s=="ABC:
  print("ARC")
else:
  print("ABC")
Problem p02705 (python)

Fixed submission:
s=int(input())

print(2*s*3.14159265358979)

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

if K==N+1:
    print(1)
elif K==N:
    print(N+2)
else:
    
    zentori=[]
    for i in range(1,2**(N+1)):
        baai=[]
        for j in range(N+1):
            if (i>>j) & 1:
                baai.append(j)
        if len(baai)>=K:
            zentori.append((sum(baai),len(baai)))
    
    setzentori=set(zentori)
    print(int(len(setzentori)%(10**9+7)))
Problem p02742 (python)

Fixed submission:
h, w=map(int, input().split())
if h==1 or w==1:
  print(1)
else:
  ans=(h*w)//2
  if h*w%2==1:
    print(ans+1)
  else:
    print(ans)

Buggy submission (verdict: Runtime Error):
h, w=map(int, input().split())
if h==1 or w==1:
  print(1)
else:
  ans=(h*w)///2
  if h*w%2==1:
    print(ans+1)
  else:
    print(ans)
Problem p02761 (python)

Fixed submission:
N, M=map(int, input().split())
ans=["-1"]*N
f=0
for i in range(M):
  s, c=map(int, input().split())
  if s==1 and c==0 and N!=1:
    f=1
  if ans[s-1]!=str(c) and ans[s-1]!="-1":
    f=1
  ans[s-1]=str(c)

if f==1:
  print(-1)
else:
  if ans[0]=="-1" and N!=1:
    ans[0]="1"
  elif M==0 and N==1:
    ans[0]="0"
  a="".join(ans)
  b=a.replace("-1", "0")
  print(b)

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
ans=["-1"]*M
f=0
for i in range(M):
  s, c=map(int, input().split())
  if s==1 and c==0:
    f=1
  if ans[s-1]!=str(c) and ans[s-1]!="-1":
    f=1
  ans[s-1]=str(c)

if f==1:
  print(-1)
else:
  if ans[0]=="-1": ans[0]=="1"
  a="".join(ans)
  b=a.replace("-1", "0")
  print(b)

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
ans=["-1"]*M
f=0
for i in range(M):
  s, c=map(int, input().split())
  if s==1 and c==0:
    f=1
  if ans[s-1]!=str(c) and ans[s-1]!="-1":
    f=1
  ans[s-1]=str(c)

if f==1:
  print(-1)
else:
  a="".join(ans)
  b=a.replace("-1", "1")
  print(b)

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
ans=["1"]*M
tmp=[]
f=0
for i in range(M):
  s, c=map(input().split())
  if [s, c] in tmp or (s==1 and c==0):
    f=1
  tmp.append([s,c])
  ans[s-1]=str(c)

if f==1:
  print(-1)
else:
  print("".join(ans))
Problem p02767 (python)

Fixed submission:
N=int(input())
X=list(map(int, input().split()))
g=sum(X)/N
if g-int(g)>=0.5:
  g=int(g)+1
else:
  g=int(g)   
ans=0
for x in X:
  ans+=(x-g)**2

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int, input().spliet()))
k1=(max(X)+min(X))//2
k2=k1+1
ans1=0
ans2=0
for x in X:
  ans1+=(k1-x)**2
  ans2+=(k2-x)**2

print(min(ans1, ans2))
Problem p02791 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
tmpmin=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)

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

tmpma=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)
Problem p02802 (python)

Fixed submission:
N, M=map(int, input().split())
solved=[False]*N
wal=[0]*N
ac=0
wa=0
for _ in range(M):
  p, s=input().split()
  p=int(p)-1
  if solved[p]:
    continue
  if s=="AC":
    solved[p]=True
    ac+=1
    wa+=wal[p]
  else:
    wal[p]+=1
print(ac, wa)

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
solved=[False]*N
ac=0
wa=0
for _ in range(M):
  p, s=input().split()
  p=int(p)-1
  if solved[p]:
    continue
  if s=="AC":
    solved[p]=True
    ac+=1
  else:
    wa+=1
print(as, wa)
Problem p02842 (python)

Fixed submission:
n=int(input())
a=int(n/1.08)
aa=a-1
aaa=a+1
b=int(a*1.08)
bb=int(aa*1.08)
bbb=int(aaa*1.08)
A=[a,aa,aaa]
B=[b,bb,bbb]
f=0
for i in range(3):
  if B[i]==n:
    f=1
    ans=A[i]
    break
if f==0:
  print(":(")
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
h, w=map(int, input().split())
# 偶数と奇数で場合分け
if h%2==0:
  # 1列でh/2個のマスできるからあとは横何個あるかだけ
  print(int(h*w/2))
else:
  set1=h
  if w%2==0:
    print(int(set1*w/2))
  else:
    rm=w//2
    print(int(set1*rm+h//2+1))
Problem p02882 (python)

Fixed submission:
a, b, x=map(int, input().split())
if a*a*b==x:
  print(0)
  exit()
import math
if 2*x/(a*b)>=a:
  ans=a/(2*b-2*x/(a**2))
else:
  ans=2*x/(a*b**2)
print(90-math.degrees(math.atan(ans)))

Buggy submission (verdict: Runtime Error):
a, b, x=map(int, input().split())
import math
if 2*x/(a*b)>=a:
  ans=a/(2*b-2*x/(a**2))
else:
  ans=2*x/(a*b**2)
print(90-math.degrees(math.atan(ans)))

Buggy submission (verdict: Runtime Error):
a, b, x=map(int, input().split())
import math
if 2*x/(a*b)>=a:
  ans=a/(2*b-2*x/(a**2))
else:
  ans=2*x/(a*b**2)

print(math.degrees(math.atan(ans)))
Problem p02900 (python)

Fixed submission:
b = list(map(int, input().split()))
def fac(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

la=fac(b[0])
lb=fac(b[1])


print(len(set(la) & set(lb))+1)

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
def fac(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

la=fac(a[0])
lb=fac(a[1])


print(len(set(la) & set(lb)+1))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
def fac(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

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

    return arr

la=fac(a[0])
lb=fac(a[1])


print(len(la & lb)+1)
Problem p02928 (python)

Fixed submission:
N, K=map(int, input().split())
a=list(map(int, input().split()))
A=a*2
base=0
matagu=0
for i in range(N):
  for j in range(i+1,2*N):
    if A[i]>A[j]:
      if j>=N:
        matagu+=1
      else:
        base+=1
baserep=K
matagurep=K*(K-1)//2
waru=10**9+7
ans=(base*baserep+matagu*matagurep)%waru
print(ans)

Buggy submission (verdict: Runtime Error):
N, K=map(int, input().split())
A=list(map(int, input().split()))
base=0
for i in range(N-1):
  for j in range(i+1:N):
    if A[i]>A[j]:
      base+=1
rep=K*(K+1)//2
ans=base*rep
print(ans)
Problem p02946 (python)

Fixed submission:
N, X=map(int, input().split())
ans=[]
for _ in range(X-N+1, X+N):
  ans.append(str(_))
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
N, X=map(int, input().split())
ans=[]
for _ in range(X-N+1, X+N):
  ans.append(_)
print(" ".join(ans))
Problem p02971 (python)

Fixed submission:
N = int(input())
a=[]
for i in range(N):
  a.append(int(input()))

base=max(a)
maxkosu=a.count(base)
if maxkosu>1:
  for i in range(N):
    print(base)
else:
  maxidx=a.index(base)
  a[maxidx]=-1
  reigai=max(a)
  for i in range(N):
    if i==maxidx:
      print(reigai)
    else:
      print(base)

Buggy submission (verdict: Runtime Error):
N = int(input())
a=[]
for i in range(N):
  a.append(int(input()))

base=max(a)
maxkosu=a.count(base)
if maxkosu>1:
  for i in range(N):
    print(base)
else:
  maxidx=a.index(base)
  reigai=max(max(a[:maxidx]), max(a[maxidx+1:]))
  for i in range(N):
    if i==maxidx:
      print(reigai)
    else:
      print(base)
Problem p03000 (python)

Fixed submission:
a = list(map(int, input().split()))
L = list(map(int, input().split()))
d = 0
ans = 0
i=1
while i==1:
    d += L[ans]
    if d>a[1]:
        break
    ans += 1
    if ans==a[0]:
        break

print(ans+1)

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
L = list(map(int, input().split()))
d = 0
ans = 0
while d<=a[1]:
    d += L[ans]
    ans += 1
print(ans)
Problem p03059 (python)

Fixed submission:
a = list(map(int, input().split()))
num = int(a[2]/a[0])
print(a[1]*num)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
err = 8
ma1 = [1]
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) 
for i in range(1,N):
    f = gcd(a[0],a[i])
    for j in range(1,N):
        if a[j]%f != 0:
            err = err + 1
        if err == 10:
            break
    if err < 10:
        ma1.append(f)
arr = 8
ma2 = [1]

tmp = a[N-1]
a[N-1]=a[0]
a[0]=tmp


for i in range(1,N):
    f = gcd(a[0],a[i])
    for j in range(1,N):
        if a[j]%f != 0:
            arr = arr + 1
        if arr == 10:
            break
    if arr < 10:
        ma2.append(f)



if max(ma2) > max(ma1):
    print(max(ma2))
else:
    print(max(ma1))
Problem p03087 (python)

Fixed submission:
N, Q=map(int, input().split())
S=input()
count=0
ac=[0]
for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    count+=1
  ac.append(count)
for _ in range(Q):
  l, r=map(int, input().split())
  l-=1
  r-=1
  print(ac[r]-ac[l])

Buggy submission (verdict: Runtime Error):
N, Q=map(int, input().split())
S=input()
count=0
ac=[0]
for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    count+=1
  ac.append(count)
for _ in range(Q):
  l, r=map(int, input().split())
  l-=1, r-=1
  print(ac[r]-ac[l])
Problem p03089 (python)

Fixed submission:
N=int(input())
b=list(map(int, input().split()))
ans=[]
for i in range(N):
  for j in range(len(b)-1, -1, -1):
    if b[j]==j+1:
      ans.append(b.pop(j))
      break
      
if len(ans)<N:
  print(-1)
else:
  for i in range(N-1, -1, -1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
b=list(map(int, inputs().split()))
ans=[]
for i in range(N):
  for j in range(len(b)):
    if b[j]==j+1:
      ans.append(b.pop(j))
      break
for i in range(N-1, -1, -1):
  print(ans[i])
Problem p03095 (python)

Fixed submission:
N=int(input())
s=list(input())
from collections import Counter
d=Counter(s)
ans=1
for v in d.values():
  ans*=(v+1)
ans-=1
ans=ans%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(input())
from collections import Counter
d=Counter(s)
ans=1
for v in d.values():
  ans*=(v+1
ans-=1
ans=ans%(10**9+7)
print(ans)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
if k==1 or len(s)==1:
  print(s[0])
else:
  for i in range(k):
    if s[i]!="1":
      print(s[i])
      exit()
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
if s[0]=="1":
  print(1)
else:
  print(s[1])
Problem p03324 (python)

Fixed submission:
D, N=map(int, input().split())
a=0
if N==100:
  a=100**D
print((100**D)*N+a)

Buggy submission (verdict: Runtime Error):
D, M=map(int, input().split())
print((100**D)*N)
Problem p03371 (python)

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

print(ans)

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

print(ans)
Problem p03436 (python)

Fixed submission:
r, c = map(int, input().split())
cc = [input() for i in range(r)]

from collections import deque


# 縦がｙ 横がx　だから座標はy,xて書く


# 保留スタックtodoにスタートの位置情報を入れる
todo=deque([[0,0]])
# 検知済みリストseenを-1で初期化 (何も検知してないてこと)
seen=[[-1 for i in range(c)] for j in range(r)]

# 黒を数える
bcount=0
for i in range(r):
    bcount+=cc[i].count("#")

# seenにはどんだけの手数でそこに到達できるかを入れる
# 例えばスタート地点は手数0でいけるから0を入れる
seen[0][0]=0

# 4方向の移動リスト これ使って移動していく
ido=[[1,0],[0,1],[-1,0],[0,-1]]

f=0
# 保留リストtodoが空になるまでやる
while todo:
    y, x=todo.popleft() # 現在地は保留からの先頭とりだす
    for i in range(4): # 現在地から4方向を見る
        ny, nx=y+ido[i][0], x+ido[i][1] # 現在地から隣の座標
        # 隣の座標が区画をはみ出さないかつ、検知してないときに
        if 0<=ny<r and 0<=nx<c and seen[ny][nx]==-1 and cc[ny][nx]!="#":
            # 隣に行けるということなので検知してその手数を格納
            seen[ny][nx]=seen[y][x]+1 # 手数＝前の地点の手数+1
            todo.append([ny,nx]) # 保留リストにも入れとく
    if seen[r-1][c-1]!=-1:
        f=1
        break
if f==1: #到達可能
    # 面積-ゴールまでの最短手数-1(スタートのマス分)-元々あった黒のマス
    print(r*c-seen[r-1][c-1]-1-bcount)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
r, c = map(int, input().split())
cc = [input() for i in range(r)]

from collections import deque


# 縦がｙ 横がx　だから座標はy,xて書く


# 保留スタックtodoにスタートの位置情報を入れる
todo=deque([0,0])
# 検知済みリストseenを-1で初期化 (何も検知してないてこと)
seen=[[-1 for i in range(c)] for j in range(r)]

# 黒を数える
bcount=0
for i in range(r):
    bcount+=cc[i].count("#")

# seenにはどんだけの手数でそこに到達できるかを入れる
# 例えばスタート地点は手数0でいけるから0を入れる
seen[0][0]=0

# 4方向の移動リスト これ使って移動していく
ido=[[1,0],[0,1],[-1,0],[0,-1]]

# 保留リストtodoが空になるまでやる
while todo:
    y, x=todo.popleft() # 現在地は保留からの先頭とりだす
    for i in range(4): # 現在地から4方向を見る
        ny, nx=y+ido[i][0], x+ido[i][1] # 現在地から隣の座標
        # 隣の座標が区画をはみ出さないかつ、検知してないときに
        if 0<=ny<r and 0<=nx<c and seen[ny][nx]==-1 and cc[ny][nx]!="#":
            # 隣に行けるということなので検知してその手数を格納
            seen[ny][nx]=seen[y][x]+1 # 手数＝前の地点の手数+1
            todo.append([ny,nx]) # 保留リストにも入れとく
    if seen[r-1][c-1]!=-1:
        break
# 面積-ゴールまでの最短手数-1(スタートのマス分)-元々あった黒のマス
print(r*c-seen[r-1][c-1]-1-bcount)
Problem p03479 (python)

Fixed submission:
x, y = map(int, input().split())
c=0
while(1):
   if y>=x:
       c+=1
       x*=2
   else:
       break
print(c)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
print(1+int(log2(y//x))
Problem p03827 (python)

Fixed submission:
N = int(input())
S = list(input())
x=0
maxa=0
for s in S:
  if s=="I":
    x+=1
  else:
    x-=1
  maxa=max(x, maxa)
print(maxa)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
x=0
maxa=0
for s in S:
  if s=="I":
    x+=1
  else:
    x-=
  maxa=max(x, maxa)
print(maxa)
Problem p03944 (python)

Fixed submission:
W, H, N=map(int, input().split())
hen=[0,W,0,H]
for _ in range(N):
  x, y, a=map(int, input().split())
  if a==1:
    hen[a-1]=max(hen[a-1], x)
  elif a==2:
    hen[a-1]=min(hen[a-1], x)
  elif a==3:
    hen[a-1]=max(hen[a-1], y)
  elif a==4:
    hen[a-1]=min(hen[a-1], y)
yoko=hen[1]-hen[0]
tate=hen[3]-hen[2]
if yoko<0 or tate<0:
  ans=0
else:
  ans=yoko*tate
print(ans)

Buggy submission (verdict: Runtime Error):
W, H, N=map(int, input().split())
hen=[0,W,0,H]
for _ in range(N):
  x, y, a=map(int, input().split())
  if a==1:
    heb[a-1]=max(hen[a-1], x)
  elif a==2:
    hen[a-1]=min(hen[a-1], x)
  elif a==3:
    hen[a-1]=max(hen[a-1], y)
  elif a==4:
    hen[a-1]=min(hen[a-1], y)
yoko=hen[1]-hen[0]
tate=hen[3]-hen[2]
if yoko<0 or tate<0:
  ans=0
else:
  ans=yoko*tate
print(ans)
Problem p03993 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=0
for i in range(N):
  if A[A[i]-1]==i+1:
    ans+=1
print(ans//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
ans=0
for i in range(N):
  if A[a[i-1]-1]==i+1:
    ans+=1
print(ans//2)
Problem p02783 (python)

Fixed submission:
H, A = map(int,input().split())
if H % A == 0:
  print(H // A)
else:
  print(H // A + 1)

Buggy submission (verdict: Runtime Error):
H, A = map(int,input().split())
if H % A == 0:
  printf(H / A)
else:
  print(H // A + 1)
Problem p02811 (python)

Fixed submission:
N, K = map(int,input().split())
if N * 500 >= K:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
if N * 500 >= K:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
if N * 500 >= K:
  print("Yes")
else:
  print("No")
Problem p03007 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a.sort()
t = 0
for m in range(N):
    if a[m] < 0:
        t += 1
if N > 2:
    if t == 0:
        c = a[0]
        for i in range(N - 2):
            c = c - a[N - 1 - i]
        d = a[1] - c
        print(d)
        e = a[0]
        f = a[N - 1]
        for j in range(N - 2):
            print(e, end = ' ')
            print(f)
            e = e - f
            f = a[N - 2 - j]
        print(a[1], end = ' ')
        print(e)
    elif t > 0 and t < N - 1:
        c = 0
        for i in range(t):
            c += a[i] 
        for j in range(N - t -1):
            c = c - a[t + 1 + j]
        d = a[t] - c
        print(d)
        e = a[0]
        f = a[N - 1]
        for k in range(N - t - 1):
            print(e, end = ' ')
            print(f)
            e = e - f
            f = a[N - 2 - k]
        a[0] = e
        g = a[t]
        for l in range(t):
            print(g, end = ' ')
            print(a[l])
            g = g - a[l]
    elif t == N - 1 or t == N:
        c = a[N - 1]
        for i in range(N - 1):
            c = c - a[i]
        print(c)
        d = a[N - 1]
        for j in range(N - 1):
            print(d, end = ' ')
            print(a[j])
            d -= a[j]
else:
    print(a[1] - a[0])
    print(a[1], end = ' ')
    print(a[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
a.sort()
b = a[0] - a[N - 1]
d = a[0]
e = a[N - 1]
if N > 2:
    for i in range(N - 3):
        b = b - a[N - 2 - i] 
    if b > a[1]:
        print(b - a[1])
    else:
        print(a[1] - b)
    print(c)
    for j in range(N - 2):
        print(d, end = ' ')
        print(e)
        d = d - e
        e = a[N - 2 - j]
    if e >= 0:
        print(e, end = ' ')
        print(d, end = ' ')
    else:
        print(d, end = ' ')
        print(e, end = ' ')
else:
    print(a[1] - a[0])
    print(a[1], end = ' ')
    print(a[0], end = ' ')
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
a = list(S)
for i in range(0, N):
    if a[i] != a[K-1]:
        a[i] = "*"
b = "".join(a)
print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
a = list(S)
for i in range(0, N):
    if a[i] != a[K-1]:
        a[i] = "*"
        b = "".join(a)
print(b)
Problem p03274 (python)

Fixed submission:
import sys

def main(lines):
  N, K = map(int, lines[0].split())
  a = list(map(int, lines[1].split()))
  ans = 1000000000000
  for i in range(N):
    if i + K - 1 >= N:
      break
    b = a[i]
    c = a[i + K - 1]
    if b < 0 and c >= 0:
      ans = min(ans, max(abs(b), abs(c)) + 2*min(abs(b), abs(c)))
    else:
      ans = min(ans, max(abs(b), abs(c)))
  print(ans)


if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)

Buggy submission (verdict: Runtime Error):
import sys

def main(lines):
  N, K = map(int, lines[0].split())
  a = list(map(int, lines[1].split()))
  ans = 1000000000000
  for i in range(N):
    if i + K - 1 >= N:
      break
    b = a[i]
    c = a[i + K - 1]
    if b < 0 and c >= 0:
      ans = min(ans, max(abs(b), abs(c)) + 2*min(abs(b), abs(c)))
    else:
      ans = min(ans, man(abs(b), abs(c)))
  print(ans)


if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)
Problem p03285 (python)

Fixed submission:
N = int(input())
n = N // 7
flag = 0
for i in range(n + 1):
  if (N - i*7) % 4 == 0:
    print("Yes")
    flag = 1
    break
if flag == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
n = N // 7
flag = 0
for i in range(n + 1):
  if (N - n*7) % 4 == 0:
    print("Yes")
    flag = 1
    break:
if flag == 0:
  print("No")
Problem p03852 (python)

Fixed submission:
c = input()
if c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o':
  print("vowel")
else:
  print("consonant")

Buggy submission (verdict: Runtime Error):
c = input()
if c == 'a' ot c == 'i' or c == 'u' or c == 'e' or c == 'o':
  print('voel')
else:
  print('consonant')