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

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

order = [int(input()) for _ in range(5)]

extra_list = []

tmp = 11
for i in range(5):
    extra = order[i] % 10
    if extra != 0:
        if extra < tmp:
            tmp = extra
            extra_list.append(i)


ans = 0
for i in range(5):
    if extra_list and i == extra_list[-1]:
        continue
    if order[i] % 10 == 0:
        ans += order[i]
    else:
        ans += 10 * (order[i] // 10 + 1)
if extra_list:
    print(ans + order[extra_list[-1]])
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()

order = [int(input()) for _ in range(5)]

extra_list = []

tmp = 11
for i in range(5):
    extra = order[i] % 10
    if extra != 0:
        if extra < tmp:
            tmp = extra
            extra_list.append(i)

ans = 0
for i in range(5):
    if i == extra_list[-1]:
        continue
    if order[i] % 10 == 0:
        ans += order[i]
    else:
        ans += 10 * (order[i] // 10 + 1)

print(ans + order[extra_list[-1]])
Problem p03148 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
from itertools import accumulate

N, K = map(int, input().split())

sushi = defaultdict(list)

for i in range(N):
    a,b = map(int, input().split())
    sushi[a].append(b)

first = []
second = []

for nums in sushi.values():
    nums.sort(reverse=True)
    for i, j in enumerate(nums):
        if i == 0:
            first.append(j)
        else:
            second.append(j)
first.sort(reverse=True)
second.sort(reverse=True)

first_cum = [0] + list(accumulate(first))
second_cum = [0] + list(accumulate(second))

ans = 0

for i in range(K, 0, -1):
    neta = min(i, len(first))
    tmp = neta * neta + first_cum[neta]

    if K - neta > len(second):
        break
    
    tmp += second_cum[K - neta]

    ans = max(ans, tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
from itertools import accumulate

N, K = map(int, input().split())

sushi = defaultdict(list)

for i in range(N):
    t, d = map(int, input().split())
    sushi[t].append(d)

first = []
second = []
for key in sushi:
    sushi[key].sort(reverse=True)
    first.append(sushi[key][0])
    second += sushi[key][1:]

first.sort(reverse=True)
second.sort(reverse=True)

first_cum = [0] + list(accumulate(first))
second_cum = [0] + list(accumulate(second))


ans = 0
for i in range(1, K+1):
    if K - i <= len(second_cum)-1:
        ans = max(ans, first_cum[i] + second_cum[K-i] + i*i)

print(ans)
Problem p03160 (python)

Fixed submission:
N = int(input())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
	if i < N - 2:
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
N = int(input())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
	if i < N - 2:
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])
B – Frog 2
Problem p03213 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

e = [0] * (N+1)

for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(n):
    return len(list(filter(lambda x: x >= n-1, e)))

# num(3)-1はnum(25)で3以上のものを一個使っているので、一つ引いている。//2は、例えばa^4 * b^4 * c^2 と b^4 * a^4 * c^2がかぶって計上されるため。
print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

e = [0] * (N+1)

for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(n):
    return len(list(filter(lambda x: x >= n-1, e)))

# num(3)-1はnum(25)で3以上のものを一個使っているので、一つ引いている。//2は、例えばa^4 * b^4 * c^2 と b^4 * a^4 * c^2がかぶって計上されるため。
print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)
Problem p03266 (python)

Fixed submission:
N, K = map(int, input().split())
ans = 0
extra = [0]*K
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = 0
extra = [0]*N
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)

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

ans = 0
extra = [0] * N
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)

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

ans = 0
extra = [0] * N
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] + extra[b] + extra[c]
print(ans)
Problem p03545 (python)

Fixed submission:
S=input()
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])

op = ["+","-"]

for i in op:
  for j in op:
    for k in op:
      if eval("A {} B {} C {} D".format(i, j, k)) == 7:
        print("{}{}{}{}{}{}{}=7".format(A, i, B, j, C, k, D))
        exit()

Buggy submission (verdict: Runtime Error):
S=input()
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])

op = ["+","-"]

for i in op:
  for j in op:
    for k in op:
      if eval("A {} B {} C {} D".format(i, j, k)) == 7:
        print("{}{}{}{}{}{}{}{}{}".format(A, i, B, j, C, k, D))
        exit()
Problem p04001 (python)

Fixed submission:
s = input()

op_n = len(s) - 1

ans = 0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op_n] 
  ans += eval(formula)
print(ans)

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

op_n = len(s) - 1

ans = 0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)

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

op_n=len(s) - 1

ans=0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1)==1:
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)

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

op_n=len(s) - 1

ans=0

for i in range(1 << len(s)):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1)==1:
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)

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

op_n=len(s) - 1

ans=0

for i in range(1 << len(s)):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j) and 1)==1:
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)

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

op_n=len(s) - 1

ans=0

for i in range(1 << len(s)):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)==1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)

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

op_n=len(s) - 1

ans=0

for i in range(1 << len(s)):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)==1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans = eval(formula)
print(ans)
Problem p02609 (python)

Fixed submission:
n = int(input())
x = input()

original_pop_count = x.count('1')
one_pop_count = original_pop_count - 1 # 0になりうる
zero_pop_count = original_pop_count + 1

one_mod = 0
zero_mod = 0
for b in x:
    if one_pop_count != 0:
        one_mod = (one_mod * 2 + int(b)) % one_pop_count
    zero_mod = (zero_mod * 2 + int(b)) % zero_pop_count

# f の前計算
f = [0] * 220000
pop_count = [0] * 220000
for i in range(1, 220000):
    pop_count[i] = pop_count[i // 2] + i % 2
    f[i] = f[i % pop_count[i]] + 1

# pow2 の前計算
one_pow2 = [1] * 220000
zero_pow2 = [1] * 220000
for i in range(1, 220000):
    if one_pop_count != 0:
        one_pow2[i] = one_pow2[i - 1] * 2 % one_pop_count
    zero_pow2[i] = zero_pow2[i - 1] * 2 % zero_pop_count

for i in range(n-1, -1, -1):
    if x[n-i-1] == '1':
        if one_pop_count != 0:
            nxt = one_mod
        # nxt -= pow(2, i, one_pop_count)
            nxt -= one_pow2[i]
            nxt %= one_pop_count
            print(f[nxt] + 1)
        else:
            print(0)
    elif x[n-i-1] == '0':
        nxt = zero_mod
        # nxt += pow(2, i, zero_pop_count)
        nxt += zero_pow2[i]
        nxt %= zero_pop_count
        print(f[nxt] + 1)

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

original_pop_count = x.count('1')
one_pop_count = original_pop_count - 1 # 0になりうる
zero_pop_count = original_pop_count + 1

one_mod = 0
zero_mod = 0
for b in x:
    if one_pop_count != 0:
        one_mod = (one_mod * 2 + int(b)) % one_pop_count
    zero_mod = (zero_mod * 2 + int(b)) % zero_pop_count

# f の前計算
f = [0] * 220000
pop_count = [0] * 220000
for i in range(1, 220000):
    pop_count[i] = pop_count[i // 2] + i % 2
    f[i] = f[i % pop_count[i]] + 1

# pow2 の前計算
one_pow2 = [1] * 220000
zero_pow2 = [1] * 220000
for i in range(1, 220000):
    if one_pop_count != 0:
        one_pow2[i] = one_pow2[i - 1] * 2 % one_pop_count
    zero_pow2[i] = zero_pow2[i - 1] * 2 % zero_pop_count

# n-1, n-2, ..., 0
for i in range(n-1, -1, -1):
    if x[n-i-1] == '1':
        if one_pop_count != 0:
            nxt = one_mod
        # nxt -= pow(2, i, one_pop_count)
            nxt -= one_pow2[i]
            nxt %= one_pop_count
            print(f(nxt) + 1)
        else:
            print(0)
    elif x[n-i-1] == '1':
        nxt = zero_mod
        # nxt += pow(2, i, zero_pop_count)
        nxt += zero_pow2[i]
        nxt %= zero_pop_count
        print(f(nxt) + 1)

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

def p(x):
    return x.count('1')

# p(n)は高々2*10^5

from functools import lru_cache

@lru_cache(maxsize=None)
def f(n, k):
    b = bin(n) # binary str
    q = p(b[2:]) # 1の個数
    if n % q == 0:
        return k
    else:
        return f(n % q, k + 1)

cnt = p(x)
for i in range(n):
    if x[i] == '0':
        y = x[:i] + '1' + x[i + 1:]
    else:
        y = x[:i] + '0' + x[i + 1:]
    print(f(int(y, 2), 1))
Problem p02642 (python)

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

from collections import Counter
c = Counter(A)

NMAX = 10 ** 6 + 1000
dp = [True] * (NMAX + 1)

for x in A:
    if not dp[x]:
        continue
    for i in range(x * 2, NMAX + 1, x):
        dp[i] = False
    if c[x] > 1:
        dp[x] = False
    
count = 0
for x in A:
    if dp[x]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = sorted(list(map(int, input().split())))
if len(set(A)) == 1:
    print(0)
    exit()

from collections import Counter
c = Counter(A)

NMAX = 2 * 10 ** 5 + 10
dp = [True] * (NMAX + 1)
for k, v in c.items():
    for i in range(k * 2, NMAX + 1, k):
        dp[i] = False

count = 0
for k, v in c.items():
    if v > 1: continue
    if dp[k]: count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = sorted(list(map(int, input().split())))
if len(set(A)) == 1:
    print(0)
    exit()

from collections import Counter
c = Counter(A)

count = 0
NMAX = 2 * 10 ** 5 + 10
L = [True] * (NMAX + 1)
for k, v in c.items():
    if L[k]:
        for i in range(k * 2, NMAX + 1, k):
            L[i] = False

for k, v in c.items():
    if v > 1: continue
    if L[k] == True:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = sorted(list(map(int, input().split())))
if len(set(A)) == 1:
    print(0)
    exit()

from collections import Counter
c = Counter(A)

count = 0
NMAX = 2 * 10 ** 5 + 10
L = [True] * (NMAX + 1)
for k, v in c.items():
    p = k
    if L[p]:
        for i in range(p * 2, NMAX + 1, p):
            L[i] = False

for k, v in c.items():
    if v > 1: continue
    if L[k] == True:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = sorted(list(map(int, input().split())))
if len(set(A)) == 1:
    print(0)
    exit()

from collections import Counter
c = Counter(A)

count = 0
NMAX = 2 * 10 ** 3 + 10
L = [True] * (NMAX + 1)
for k, v in c.items():
    p = k
    if L[p]:
        for i in range(p * 2, NMAX + 1, p):
            L[i] = False

for k, v in c.items():
    if v > 1: continue
    if L[k] == True:
        count += 1

print(count)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

pos = [1]

for i in range(2 * n):
	nxt = A[pos[-1]]
	pos.append(nxt)

if k < n + 1:
	print(pos[k])
	exit()

loop_end = n
loop_start = n - 1

while pos[loop_start] != pos[loop_end]:
	loop_start -= 1

period = loop_end - loop_start
k = k % period

while k < n:
	k += period

print(pos[k])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

same = 0
for i in range(1, n + 1):
	if A[i] == i:
		same += 1

k = k % (n - same)

pos = 1
for i in range(1, k + 1):
	pos = A[pos]

print(pos)
Problem p02756 (python)

Fixed submission:
s = input()
q = int(input())

head = []
tail = []
flip = 0

for i in range(q):
	query = input().split()
	if query[0] == '1':
		flip ^= 1
	else:
		f = int(query[1]) - 1
		c = query[2]
		if (f ^ flip) == 0:
			head.append(c)
		else:
			tail.append(c)

if flip:
	head, tail = tail, head
	s = s[::-1]

head = ''.join(head)
tail = ''.join(tail)

print(head[::-1] + s + tail)

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())

head = []
tail = []
flip = 0

for i in range(q):
	query = input().split()
	if query[0] == '1':
		flip ^= 1
	else:
		f = query[1]
		c = query[2]
		if (f ^ flip) == 0:
			head.append(c)
		else:
			tail.append(c)

if flip:
	head, tail = tail, head
	s = s[::-1]

head = ''.join(head)
tail = ''.join(tail)

print(head[::-1] + s + tail)
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(keta, 10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')

Buggy submission (verdict: Runtime Error):
#全探索
ans = 0
keta = 10**(n-1)
for i in range(keta, 10**5):
    s = str(i)
    flag = True
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]: #違ったらFalse
            flag = False
    if flag:
        ans = i
        break
print(ans if flag else '-1')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
digit = [0]*(m+1)
value = [0]*(m+1)
for i in range(1,m+1):
    digit[i],value[i] = map(int,input().split())

if m==0:
    print('-1')
    exit()
res = 0
for i in range(1,n+1):
    if i in digit:
        idx = digit.index(i)
        res += value[idx] * 10**(n-i)

for i in range(1,m+1):
    if int(str(res)[digit[i]-1]) != value[i]:
        print('-1')
        exit()
print(res if len(str(res))==n else '-1')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
digit = [0]*(m+1)
value = [0]*(m+1)
for i in range(1,m+1):
    digit[i],value[i] = map(int,input().split())
res = 0
for i in range(1,n+1):
    if i in digit:
        idx = digit.index(i)
        res += value[idx] * 10**(n-i)
for i in range(1,m+1):
    if int(str(res)[digit[i]-1]) != value[i]:
        print('-1')
        exit()
print(res if len(str(res))==n else '-1')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
digit = [0]*(m+1)
value = [0]*(m+1)
for i in range(1,m+1):
    digit[i],value[i] = map(int,input().split())
res = 0
for i in range(1,n+1):
    if i in digit:
        idx = digit.index(i)
        res += value[idx] * 10**(n-i)
for i in range(1,m+1):
    if int(str(res)[digit[i]-1]) != value[i]:
        print('No')
        exit()
print('Yes' if len(str(res))==n else 'No')

Buggy submission (verdict: Runtime Error):
a = [list(map(int, input().split())) for i in range(3)]
aa = list(zip(*a))
n = int(input())
b = [int(input()) for _ in range(n)]
if a[0] in b or a[1] in b or a[2] in b or aa[0] in b or aa[1] in b or aa[2] in b or (a[0][0] in b and a[1][1] in b and a[2][2] in b) or (a[0][2] in b and a[1][1] in b and a[2][0] in b):
    print('Yes')
else:
    print('No')
Problem p02772 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            print('DENIED')
            exit()
print('APPROVED')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
for i in range(m):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      print('DENIED')
      exit()
print('APPROVED')
Problem p02784 (python)

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
 
if sum(a)>=h: print('Yes')
else: print('No')

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

a.sort(reverse=True)

if a[0]+a[1]>=h: print('Yes')
else: print('No')
Problem p02786 (python)

Fixed submission:
import numpy
h=int(input())
p=int(numpy.log2(h))
print(2**(p+1)-1)

Buggy submission (verdict: Runtime Error):
import numpy
h=int(input())
p=int(numpy.log2(h))
print(2**(p+1)-1)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
cnt = 0
for i in range(len(S)-2):
  if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
cnt = 0
for i in range(len(S)):
  if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
    cnt += 1
print(cnt)
Problem p02861 (python)

Fixed submission:
n = int(input())
lis = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += ((lis[i][0] - lis[j][0]) ** 2 + (lis[i][1] - lis[j][1]) ** 2) ** 0.5

ans *= 2/n

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += ((lis[i][0] - lis[j][0]) ** 2 + (lis[i][1] - lis[j][1]) ** 2) ** 0.5

ans *= 2/N
print(ans)
Problem p02882 (python)

Fixed submission:
a,b,x=map(int,input().split())

from math import atan, degrees
if x>=a*a*b/2:#半分よりも多い場合
    rad=atan(2/a*(b-x/a**2))
else:
    rad=atan((a*b*b)/(2*x))
print(degrees(rad))

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

import numpy as np
if x>a*a*b/2:#半分よりも多い場合
    theta=np.arctan(2*(a*a*b)/a*a*a)
else:#半分に満たない場合
    theta=np.arctan((a*b*b)/(2*x))
theta = theta * 180 / np.pi
print(theta)
Problem p02898 (python)

Fixed submission:
n,k = map(int, input().split())

h = [int(x) for x in input().split()]

ans = 0

for i in range(n):
	if h[i] >= k:
		ans += 1


print(ans)

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

h = [int(input()) for i in range(n)]

ans = 0

for i in range(n):
	if h[i] >= k:
		ans += 1


print(ans)
Problem p02946 (python)

Fixed submission:
k,x=map(int,input().split())
 
mini = x-k+1
maxi = k+x-1
 
lis = []
for i in range(mini,maxi+1):
  lis.append(i)
 
print(*lis)

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

mini = x-k+1
maxi = k+x-1

lis = []
for i in range(mini,max+1):
  lis.append(i)

print(*lis)
Problem p02947 (python)

Fixed submission:
import collections

n=int(input())
s=[(input()) for _ in range(n)]

lis=[list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = [''.join(lis_sort[i]) for i in range(n)]
lis_sort.sort()

c = collections.Counter(lis_sort)
values, counts = zip(*c.most_common(len(c)))
cnt=0
for i in range(len(counts)):
    if counts[i]==2: cnt+=1
    elif counts[i]>2: cnt+=counts[i]*(counts[i]-1)//2
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[input() for _ in range(n)]

lis=[collections.Counter(list(s[i])) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        if lis[i].items()==lis[j].items(): cnt+=1
print(cnt)
Problem p02957 (python)

Fixed submission:
a,b = map(int, input().split())
if (b-a)%2==0: print((a+b)//2)
else: print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().slplit())
if (b-a)%2==0: print((a+b)//2)
else: print('IMPOSSIBLE')
Problem p02982 (python)

Fixed submission:
n,d=map(int,input().split())
dis = [list(map(int,input().split())) for i in range(n)]

def is_square(n):
    res=n**0.5
    return res.is_integer()

cnt = 0
for i in range(n):
    for j in range(i+1,n):
        dist = 0
        for k in range(d):
            #i行目とj行目
            dist += (dis[i][k]-dis[j][k])**2
        if is_square(dist) == True: cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
dis = [list(map(int,input().split())) for i in range(n)]

cnt=0
for j in range(n-1):
    dist = 0
    for i in range(d):
        dist += (dis[j][i]-dis[j+1][i])**2
    if is_square(dist) == True: cnt+=1

dist = 0
for i in range(d):
    dist += (dis[0][i]-dis[-1][i])**2
if is_square(dist) == True: cnt+=1
print(cnt)
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
mod=2019
if r-l>=2019: print(0)
else:
    res=2018 #2019の剰余なので最大でも2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            res = min(res, (i*j)%mod)
    print(res)

Buggy submission (verdict: Runtime Error):
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, (i*j)%2019)
    print(min_mod)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, (i*j)%2019)
	print(min_mod)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, (i*j)%2019)
	print(min_mod)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, i*j%2019)
print(min_mod)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())

if r-l>=2019: print(0)
else:
    min_mod=2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, i*j%2019)
print(min_mod)