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

Fixed submission:
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    import numpy as np
    # import math
    # import random
    input = stdin.readline


    n, k = map(int, input().split())
    aa = [0]+list(map(int, input().split()))
    arrive = [1]
    next = aa[1]
    visited = set([1])
    if next == 1:
        print(1)
        exit()
    while not (next in visited):
        arrive.append(next)
        visited.add(next)
        next = aa[next]
    num_town = len(arrive)
    start_index = arrive.index(next)
    if k < num_town:
        print(arrive[k])
        exit()
    print(arrive[start_index+(k-start_index)%(num_town-start_index)])

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    import numpy as np
    # import math
    # import random
    input = stdin.readline


    n, k = map(int, input().split())
    aa = [0]+list(map(int, input().split()))
    arrive = [1]
    next = aa[1]
    visited = set([1])
    if next == 1:
        print(1)
        exit()
    while not (next in visited):
        arrive.append(next)
        visited.add(next)
        next = aa[next]
    num_town = len(arrive)
    start_index = arrive.index(next)
    if k <= num_town:
        print(arrive[k])
        exit()
    print(arrive[start_index+(k-start_index)%(num_town-start_index)])
Problem p02804 (python)

Fixed submission:
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline


    n, k = map(int, input().split())

    aa = list(map(int, input().split()))

    """

    n = 100000
    k = 50000
    aa = [i for i in range(100000)]
    """

    import math

    if k == 1:
        print(0)
    else:
        def cmb(n, r, p):
            if (r < 0) or (n < r):
                return 0
            r = min(r, n - r)
            return fact[n] * factinv[r] * factinv[n-r] % p

        p = 10 ** 9 + 7
        N = 10 ** 5  # N は必要分だけ用意する
        fact = [1, 1]  # fact[n] = (n! mod p)
        factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        inv = [0, 1]  # factinv 計算用

        for i in range(2, N + 1):
            fact.append((fact[-1] * i) % p)
            inv.append((-inv[p % i] * (p // i)) % p)
            factinv.append((factinv[-1] * inv[-1]) % p)

        aa.sort()

        cnt = 0

        c = 1
        large = k
        before = 0

        for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):
            c = cmb(large, k, p)
            cnt += (i-j)*(c-before)
            cnt = cnt%(10**9+7)
            before = c
            large += 1

        print(int(cnt%(10**9+7)))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n, k = map(int, input().split())

    aa = list(map(int, input().split()))

    if k == 1:
        print(0)
    else:
        aa.sort()

        cnt = 0

        c = 1
        large = k+1
        before = 0

        for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):

            cnt += (i-j)*(c-before)
            cnt = cnt%(10**9+7)
            before = c
            c = c*large/(large-k)

            large += 1
        print(int(cnt%(10**9+7)))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n, k = map(int, input().split())

    aa = list(map(int, input().split()))

    if k == 1:
        print(0)
    else:
        aa.sort()

        cnt = 0

        c = 1
        large = k+1
        before = 0

        for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):

            cnt += (i-j)*(c-before)
            before = c
            c = c*large/(large-k)

            large += 1
        print(int(cnt%(10**9+7)))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n, k = map(int, input().split())

    aa = list(map(int, input().split()))

    if k == 1:
        print(0)
        exit()

    aa.sort()

    cnt = 0

    c = 1
    large = k+1
    before = 0

    for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):

        cnt += (i-j)*(c-before)
        before = c
        c = c*large/(large-k)

        large += 1
    print(int(cnt%(10**9+7)))
Problem p03095 (python)

Fixed submission:
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        try:
            eng_dict[i] += 1
        except KeyError:
            eng_dict[i] = 2
    ans = 1
    size = 10**9+7
    for i in eng_dict.values():
        ans = (ans*i)%size
    print((ans-1)%size)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        eng_dict[i] += 1
    ans = 1
    size = 10**9+7
    for i in eng_dict.values():
        ans = (ans*i)%size
    print((ans-1)%size)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        eng_dict[i] += 1
    ans = 1
    size = 10**9+7
    for j in eng_dict.values():
        ans = (ans*j)%size
    print(ans-1)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        eng_dict[i] += 1
    ans = 1
    for i in eng_dict.values():
        ans = (ans*i)%(10**9+7)
    print(ans-1)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        eng_dict[i] += 1
    ans = 1
    for i in eng_dict.values():
        ans = (ans*i)%(10**9+7)
    print(ans-1)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s[:-1]:
        eng_dict[i] += 1
    ans = 1
    for i in eng_dict.values():
        ans = (ans*i)%(10**9+7)
    print(ans-1)
Problem p03145 (python)

Fixed submission:
if __name__ == '__main__':
    n, w, k = map(int, input().split())
    print(int(n*w/2))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    import collections
    n, k = map(int, input().split())
    td = [list(map(int, input().split())) for _ in range(n)]
    td.sort(key=lambda x: x[1], reverse=True)
    ans_list = [0]
    reverse_td = list(zip(*td))
    c = collections.Counter(reverse_td[0][:k])
    kind = len(c)
    ans = sum(reverse_td[1][:k])+kind**2
    check = k-1
    flag=False
    for i in range(k,n):
        t = td[i][0]
        d = td[i][1]
        if t in c:
            pass
        else:
            c[t]=1
            while True:
                new_t = td[check][0]
                if c[new_t]==1:
                    check -=1
                    if check == -1:
                        flag =True
                        break
                else:
                    c[new_t]-=1
                    ans_list.append(2*kind+1+d-td[check][1])
                    kind+=1
            if flag:
                break
    print(ans+max(ans_list))
Problem p03158 (python)

Fixed submission:
n, q = map(int, input().split())
a = list(map(int, input().split()))
x = [int(input()) for _ in range(q)]
sort_x = sorted(x)
ans = {}
if n%2== 1:
    small_position = 0
    border_position = int((n-1)/2)
else:
    small_position = 1
    border_position = int(n/2)
sum_all = sum(a[border_position:])
a.append(10000000000)
a.append(10000000000)
x_index = 0
flag = False
for compare in a[border_position:]:
    compare_x = sort_x[x_index]
    small_a = a[small_position]
    while 2*sort_x[x_index] - small_a <= compare:
        ans[sort_x[x_index]] = sum_all
        x_index += 1
        if x_index == q:
            flag = True
            break
    sum_all = sum_all + small_a - compare
    small_position += 2
    if flag:
        break

for x_i in x:
    print(ans[x_i])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
a = list(map(int, input().split()))
x = [int(input()) for _ in range(q)]
sort_x = sorted(x)
ans = {}
len_x = len(a)
flag = True
if len_x%2== 1:
    small_position = 0
    border_position = int((len_x-1)/2)
    sum_all = sum(a[border_position:])
    a.append(1000000000)
    for x_i in sort_x:
        for compare in a[border_position:]:
            if x_i - a[small_position] > compare-x_i:
                sum_all = sum_all + a[small_position] - compare
                small_position += 2
                border_position += 1
                ans[x_i] = sum_all
            else:
                ans[x_i] = sum_all
                break

else:
    small_position = 1
    border_position = int(len_x/2)
    sum_all = sum(a[border_position:])
    a.append(1000000000)
    for x_i in sort_x:
        for compare in a[border_position:]:
            if x_i - a[small_position] > compare-x_i:
                sum_all = sum_all + a[small_position] - compare
                small_position += 2
                border_position += 1
                ans[x_i] = sum_all
            else:
                ans[x_i] = sum_all
                break

for x_i in x:
    print(ans[x_i])
Problem p03160 (python)

Fixed submission:
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    n = int(input())
    hs = list(map(int, input().split()))
    hs = hs[::-1]
    ans_list = [0]*n
    ans_list[1] = abs(hs[1]-hs[0])
    for i in range(2,n):
        ans_list[i] = min([ans_list[i-1]+abs(hs[i]-hs[i-1]), ans_list[i-2]+abs(hs[i]-hs[i-2])])
    print(ans_list[n-1])

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    n = int(input())
    hs = list(map(int, input().split()))
    hs = hs[::-1]
    def jump(p):
        if p == 1:
            return 0
        elif p == 2:
            return abs(hs[1]-hs[0])
        else:
            return min([jump(p-1)+abs(hs[p-1]-hs[p-2]), jump(p-2)+abs(hs[p-1]-hs[p-3])])
    print(jump(n))
Problem p03206 (python)

Fixed submission:
d = input()
if d == '25':
  print('Christmas')
elif d == '24':
  print('Christmas Eve')
elif d=='23':
  print('Christmas Eve Eve')
elif d == '22':
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = []
for _ in range(n):
  p.append(int(input()))
count = 0
for i in p:
  count += i
print(int(count-max(p)/2))
Problem p02675 (python)

Fixed submission:
'''
1の位が2,4,5,7,9のとき'hon'
1の位が0,1,6,8のとき'pon'
1の位が3のとき'bon'
を出力する．
'''

def kazoekata_enpitsu(N):
    if(N%10==3):
        print('bon')
    elif(N%10==0 or N%10==1 or N%10==6 or N%10==8):
        print('pon')
    else:
        print('hon')

N = int(input())
kazoekata_enpitsu(N)

Buggy submission (verdict: Runtime Error):
import math

 
A,B,H,M= list(map(int, input().split()))
 
theta = 2*math.pi*H/12+2*math.pi*M/12/60 #時針の角度
phi = 2*math.pi*M/60 #分針の角度
  
C = math.sqrt(A**2+B**2-2*A*B*math.cos(theta-phi))
print(C)
Problem p02677 (python)

Fixed submission:
import math

a, b, h, m = list(map(int, input().split()))
deg_a = (60 * h + m) * (360 / (60 * 12))
deg_b = m * (360 / 60)
deg = abs(deg_a - deg_b)
rad = math.radians(deg)

c2 = a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)
print(c2 ** 0.5)

Buggy submission (verdict: Runtime Error):
import math
'''
時針：Aセンチ，12時間で1周
分針：Bセンチ，1時間で1周
0時ちょうどに針は重なっていた．H時M分のとき，2本の針の端点は何センチ離れているか．
'''
 
A,B,H,M= list(map(int, input().split()))
 
theta = 2*math.pi*H/12+2*math.pi*M*/12/60 #時針の角度
phi = 2*math.pi*M/60 #分針の角度
 
deff_rad = 2*math.pi*(M/60 - H/12)
 
C = math.sqrt(A**2+B**2-2*A*B*math.cos(deff_rad))
Problem p02865 (python)

Fixed submission:
import math
import numpy as np

N = int(input())

N_half = math.floor(N/2)

counts = 0
for i in np.arange(1, N):
    j = N-i
    if(i != j ):
        counts += 1
        
print(int(counts/2))

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

N = int(input())
D_seq = input().split()
D_seq = list(map(int, D_seq))

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

c = collections.Counter(D_seq)

N_list = []
if((judge_set == D_seq_set)or(D_seq[0]==0)):
    counts = 1
    for i in range(D_seq_max):
        counts *= pow(c[i], c[i+1])
    if(counts < 998244353):    
        print(counts)
    else:
        print(int(counts%998244353))
        
else:
    print(0)
Problem p02866 (python)

Fixed submission:
import numpy as np
import collections

N = int(input())
D_seq = input().split()
D_seq = list(map(int, D_seq))

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

c = collections.Counter(D_seq)

N_list = []
if((judge_set == D_seq_set)and(D_seq[0]==0)):
    if(c[0]>1):
        print(0)
    else:
        counts = 1
        for i in range(D_seq_max):
            counts *= pow(c[i], c[i+1])
        if(counts < 998244353):    
            print(counts)
        else:
            print(int(counts%998244353))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
from functools import reduce

N = int(input())
D_seq = input().split()
D_seq = list(map(int, D_seq))

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

N_list = [1]
if((judge_set == D_seq_set)or(D_seq[0]==0)):
    for i in range(D_seq_max):
        N_list.append(D_seq.count(i+1))
    counts = reduce(pow, N_list)
    for i in range(len(N_list)-1):
        counts *= pow(N_list[i], N_list[i+1])
    if(counts < 998244353):    
        print(counts)
    else:
        print(int(counts/998244353))
        
else:
    print(0)

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

N = int(input())
D_seq = input().split()
D_seq = list(map(int, D_seq))

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

N_list = []
if((judge_set == D_seq_set)or(D_seq[0]==0)):
    for i in range(D_seq_max):
        N_list.append(D_seq.count(i+1))
    counts = 1
    for i in range(len(N_list)-1):
        counts *= pow(N_list[i], N_list[i+1])
    if(counts < 998244353):    
        print(counts)
    else:
        print(int(counts/998244353))
        
else:
    print(0)
Problem p02675 (python)

Fixed submission:
n = input()

last = int(n[-1])

bon = [3]
pon = [0, 1, 6, 8]

if last in bon:
    print("bon")
elif last in pon:
    print("pon")
else:
    print("hon")

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

last = int(n[-1])

bon = [3]
pon = [0, 1, 6, 8]

if last in bon:
    print("bon")
else if last in pon:
    print("pon")
else:
    print("hon")
Problem p02780 (python)

Fixed submission:
def expected_value(x):
    a = int(x)
    s = (a+1) * (a/2)
    # e = 0
    # for i in range(1, a+1):
    #     e += i / a
    return s / a

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Buggy submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextFloat64() float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func expectedValue(x float64) float64 {
	s := (x + 1) * (x / 2)
	return s / x
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	evs := make([]float64, n)
	for i := 0; i < n; i++ {
		p := nextFloat64()
		evs[i] = expectedValue(p)
	}

	// initialize
	var ev float64
	for i := 0; i < k; i++ {
		ev += evs[i]
	}

	maxEv := ev
	left := 0
	for i := k; i < n; i++ {
		ev = ev - evs[left] + evs[i]
		left++
		if ev > maxEv {
			maxEv = ev
		}
	}
	fmt.Printf("%0.7f\n", maxEv)
}
Problem p03262 (python)

Fixed submission:
import fractions

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    d = abs(x - cities[i])
    ans = fractions.gcd(ans, d)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    ans = math.gcd(ans, x-cities[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n, x = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]

ans = abs(x - cities[0])
for i in range(1, n):
    ans = math.gcd(ans, x-cities[1])

print(ans)
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = map(int, input().split())

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = 1 << 32 
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)

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

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = math.inf
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)
Problem p03557 (python)

Fixed submission:
from bisect import bisect_left, bisect_right

N = int(input())

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

alters_count = 0
for b in B:
    aidx = bisect_left(A, b)
    cidx = bisect_right(C, b)
    if cidx == N:
        continue
    alters_count += aidx * (N - cidx)

print(alters_count)

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())

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

A.sort()
B.sort()
C.sort()

alters_count = 0
for a in A:
    count += 1
    bidx = bisect.bisect_left(B, a)
    if bidx == N:
        continue
    for b in B[bidx:]:
        count += 1
        cidx = bisect.bisect_left(C, b)
        if cidx == N:
            continue
        alters_count += N - cidx

print(alters_count)
Problem p02677 (python)

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

for i in range(10):
    if 0<=abs(360*i-abs(30*H+(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+(M/2)-6*M))
        c=abs(360-abs(360*i-abs(30*H+(M/2)-6*M)))
        break
b=min(a,c)

print("{:.9f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

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

for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<360:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=abs((180-abs(360*i-abs(30*H+int(M/2)-6*M))))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

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

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<180:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=abs((180-abs(360*i-abs(30*H+int(M/2)-6*M))))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

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

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H+int(M/2)-6*M))<180:
        a=abs(360*i-abs(30*H+int(M/2)-6*M))
        c=(180-abs(360*i-abs(30*H+int(M/2)-6*M)))
        break
b=min(a,c)

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))

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

C=[]
for i in range(10):
    if 0<abs(360*i-abs(30*H-6*M))<180:
        a=abs(360*i-abs(30*H-6*M))
        break
b=min(a,abs(30*H-6*M))

print("{:.12f}".format(((A**2+B**2-2*A*B*(math.cos(b*(math.pi/180))))**(1/2))))
Problem p02705 (python)

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

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

for j in range(1,N+1):
    totalj=0
    for i in range(N-1):
        if A[i]==j:
            totalj=totalj+1
    print(totalj)
Problem p02789 (python)

Fixed submission:
N,M=input().split()
if N==M:
  print("Yes")
else:
  print("No")

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)
Problem p02791 (python)

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total=+=1
        minP=P[i]
print(total)
Problem p02812 (python)

Fixed submission:
N=int(input())
S=input()
s=list(S)

total=0
for i in range(N-2):
    if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
        total=total+1
print(total)

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

total=0
for i in range(N):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                total=total+1
print(total)
Problem p02971 (python)

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
M=sorted(A)

for i in range(N):
    if M[N-1]>A[i]:
        print(M[N-1])
    elif M[N-1]==A[i]:
        print(M[N-2])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
M=sorted(A)

for i in range(N):
    if M[N-1]>A[i]:
        print(M[N])
    elif M[N-1]==A[i]:
        print(M[N-1])