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

Fixed submission:
#E_Coprime
import math
import functools

# エラトステネスの篩
        
def primes(n):
    is_prime = [1] * (n + 1)
    is_prime[0] = 0
    is_prime[1] = 0
    D_prime = [i for i in range(n+1)] 
    D_prime[0] = 0
    D_prime[1] = 1
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            D_prime[i] = i
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
            D_prime[j] = i
    return D_prime

    

Fnum_list2 = []
# 入力
N = int(input())
A = list(map(int,input().split()))

#Fnum_list = eratosthenes(N)

A.sort()
Amax = A[-1]
Fnum_list2 = primes(Amax)
j = A[0]
ans = 1
#Fnum_list = eratosthenes(N)
Ai_primes     = set()
Ai_primes_add = []
gcd_num = 0
for i in range(len(A) ):
    p = A[i]
    while p != 1:
        j = p
        p = int (p / Fnum_list2[j])
        if Fnum_list2[j] in Ai_primes:
            ans = 0
        else:
            Ai_primes_add.append(Fnum_list2[j])
    if Fnum_list2[j] in Ai_primes:
        break
    else:
        Ai_primes |= set(Ai_primes_add)
        Ai_primes_add.clear()

gcd_num = functools.reduce(math.gcd,A)

if ans == 0:
    if gcd_num == 1:
        ans = 2

# 出力
if ans == 1:
    print("pairwise coprime")
else:
    if ans == 2:
        print("setwise coprime")
    else:
        print("not coprime")

Buggy submission (verdict: Runtime Error):
#E_Coprime
import math
import functools

# エラトステネスの篩
        
def primes(n):
    is_prime = [1] * (n + 1)
    is_prime[0] = 0
    is_prime[1] = 0
    D_prime = [i for i in range(n+1)] 
    D_prime[0] = 0
    D_prime[1] = 1
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            D_prime[i] = i
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
            D_prime[j] = i
    return D_prime

    

Fnum_list2 = []
# 入力
N = int(input())
A = list(map(int,input().split()))

#Fnum_list = eratosthenes(N)

A.sort()
Amax = A[-1]
Fnum_list2 = primes(Amax)

ans = 1
#Fnum_list = eratosthenes(N)
Ai_primes     = set()
Ai_primes_add = []
gcd_num = 0
for i in range(len(A) -1 ):
    p = A[i]
    while p != 1:
        j = p
        p = int (p / Fnum_list2[j])
        if Fnum_list2[j] in Ai_primes:
            ans = 0
        else:
            Ai_primes_add.append(Fnum_list2[j])
    if Fnum_list2[j] in Ai_primes:
        break
    else:
        Ai_primes |= set(Ai_primes_add)
        Ai_primes_add.clear()

gcd_num = functools.reduce(math.gcd,A)

if ans == 0:
    if gcd_num == 1:
        ans = 2

# 出力
if ans == 1:
    print("pairwise coprime")
else:
    if ans == 2:
        print("setwise coprime")
    else:
        print("not coprime")
Problem p02582 (python)

Fixed submission:
#A - Rainy Season
Si = []
Si = list(str(input()))
i = 0
if Si == ['S','S','S']: i = 0
if Si == ['R','S','S']: i = 1
if Si == ['S','R','S']: i = 1
if Si == ['S','S','R']: i = 1
if Si == ['R','R','S']: i = 2
if Si == ['S','R','R']: i = 2
if Si == ['R','S','R']: i = 1
if Si == ['R','R','R']: i = 3
# 出力
print(i)

Buggy submission (verdict: Runtime Error):
#A - Rainy Season
Si = []
Si = list(str(input()))
i = 0
if Si.count('S') == 3:
    i = 0
else:
    if Si.count('R') == 3:
        i = 3
    else:
        if Si.count('R') == 1:
            i = 1
        else:
            if Si[1] == 'S':
                 = 1
            else:
                i = 2
# 出力
print(i)
Problem p02585 (python)

Fixed submission:
#D - Moving_piece
N,K = map(int,input().split())
P =[]
C =[]
P = list(map(int,input().split()))
C = list(map(int,input().split()))

score_output = -1000000000
i = 0
for i in range(N):
    ichi = i
    score = 0
    step  = 0
    loop  = 0
    score_max = -1000000000
    while True:
        step  += 1
        score += C[ichi]
        ichi   = (P[ichi] -1)
        if i ==  (P[ichi] -1):
            score += C[ichi]
            break
        
    path = 0
    cnt  = 0
    
    while True:
        cnt  += 1
        path += C[ichi]
        
        if cnt > K:
            break
        
        loop = int((K - cnt) / (step+ 1))
        if score > 0:
            score_max = path + loop * score
        else:
            score_max = path
        if score_max > score_output:
            score_output = score_max

        ichi   = P[ichi]-1
        if i == (P[ichi] -1):
            break
# 出力
print(score_output)

Buggy submission (verdict: Runtime Error):
#D - Moving_piece
N,K = map(int,input().split())
P =[]
C =[]
P = list(map(int,input().split()))
C = list(map(int,input().split()))

score_output = -1000000010
i = 0
for i in range(N):
    ichi = i
    score = 0
    step  = 0
    loop  = 0
    score_max = -1000000010
    while True:
        step  += 1
        score += C[ichi]
        ichi   = (P[ichi] -1)
        if i ==  (P[ichi] -1):
            score += C[ichi]
            break
        
    path = 0
    cnt  = 0
    
    while True:
        cnt  += 1
        path += C[ichi]
        
        if cnt > K:
            break
        
        loop = long((K - cnt) / (step+ 1))
        if score > 0:
            score_max = path + loop * score
        else:
            score_max = path
        if score_max > score_output:
            score_output = score_max

        ichi   = P[ichi]-1
        if i == (P[ichi] -1):
            break
# 出力
print(score_output)
Problem p03359 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
print a if a<=b else a-1
Problem p03469 (python)

Fixed submission:
s=input()
print('2018'+s[4:])

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

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

print(len(list(set(d_i_list))))
Problem p02608 (python)

Fixed submission:
n = int(input())
A = [0]*10050
 
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <10050:
                A[a] += 1
                
for i in range(n):
    print(A[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [0]*10000
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if a <10000:
                A[a] += 1
                
for i in range(n):
    print(A[i+1])
Problem p02641 (python)

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

if N == 0:
    P = []
else:
    P = [int(x) for x in input().split()]

for i in range(100):
    q = X - i
    if q not in P:
        print(q)
        break
    q = X + i
    if q not in P:
        print(q)
        break

Buggy submission (verdict: Runtime Error):
if N == 0:
    P = []
else:
    P = [int(x) for x in input().split()]

for i in range(100):
    q = X - i
    if q not in P:
        print(q)
        break
    q = X + i
    if q not in P:
        print(q)
        break
Problem p02642 (python)

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

l=[0]*(10**6+1)
ans=0
#print(l)
for i in a:
    if l[i]==0:
        for j in range(i,10**6+1,i):
            l[j] += 1
    else:
        l[i] += 1
#print(l)
for i in a:
    if l[i]==1:
        ans+=1

print(ans)

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

A = [int(x) for x in input().split()]
A = sorted(A)
A = list(set(A))

if len(A) == 1:
    print(0)
else:
    if A[0] == A[1]:
        cnt = 0
    else:
        cnt = 1
    
    for i in range(1,N):
        flag = True
        for j in range(i):
            if A[i]%A[j] == 0:
                flag = False
                break

    
        if flag == True:
            cnt += 1
    print(cnt)

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

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

if A[0] == A[1]:
    cnt = 0
else:
    cnt = 1
    
for i in range(1,N):
    flag = True
    for j in range(i):
        if A[i]%A[j] == 0:
            flag = False
            break

    
    if i != N-1:
        if A[i] == A[i+1]:
            flag = False
    
    if flag == True:
        cnt += 1
print(cnt)

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

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


if A[0] == A[1]:
    cnt = 0
else:
    cnt = 1
    
for i in range(1,N):
    flag = True
    for j in range(i):
        if A[i]%A[j] == 0:
            flag = False
            break
        break
    
    if i != N-1:
        if A[i] == A[i+1]:
            flag = False
    
    if flag == True:
        cnt += 1
print(cnt)

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

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


if A[0] == A[1]:
    cnt = 0
else:
    cnt = 1
    
for i in range(1,N):
    flag = True
    for j in range(i):
        if A[i]%A[j] == 0:
            flag = False
    if i != N-1:
        if A[i] == A[i+1]:
            flag = False
    
    if flag == True:
        cnt += 1
print(cnt)
Problem p02675 (python)

Fixed submission:
N = input()

if int(N[-1]) in [2,4,5,7,9]:
    print("hon")
elif int(N[-1]) in [0,1,6,8]:
    print("pon")
else:print("bon")

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())

kakudo = abs((H*30+0.5*M-M*6)%180) 

a = (A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))
print(math.sqrt(a))
Problem p02612 (python)

Fixed submission:
n = int(input())

pay = 0
while pay < n:
    pay += 1000

print(pay-n)

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

m = int(n[1:])

if 1000-m != 1000:
    print(1000-m)
else:
    print(0)
Problem p02630 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())

ans = sum(a)
A = Counter(a).most_common()
d = [0] * (10**5+10)
for i in range(len(A)):
    d[A[i][0]] = A[i][1]

B = []
C = []
for i in range(q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

for i in range(q):
    d[C[i]] += d[B[i]]
    cnt = d[B[i]]
    ans += (C[i]-B[i])*cnt
    print(ans)
    d[B[i]] = 0

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())

ans = sum(a)
A = Counter(a).most_common()
d = [0] * 10**5+10
for i in range(len(A)):
    d[A[i][0]] = A[i][1]

B = []
C = []
for i in range(q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

for i in range(q):
    d[C[i]] += d[B[i]]
    cnt = d[B[i]]
    ans += (C[i]-B[i])*cnt
    print(ans)
    d[B[i]] = 0

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())

ans = sum(a)
A = Counter(a).most_common()
d = [0] * 10**5
for i in range(len(A)):
    d[A[i][0]] = A[i][1]

B = []
C = []
for i in range(q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

for i in range(q):
    d[C[i]] += d[B[i]]
    cnt = d[B[i]]
    ans += (C[i]-B[i])*cnt
    print(ans)
    d[B[i]] = 0
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

check = 1000000
ans = 0

N = list(range(-300, 300))

for i in range(1, 101):
    if i in p:
        N.remove(i)

for i in range(len(N)):
    if check > abs(N[i]-x):
        check = abs(N[i]-x)
        ans = N[i]
print(ans)

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

a.sort()

M = 1000005
cnt = [0] * M

for i in range(n):
    if cnt[a[i]] != 0:
        cnt[a[i]] = 2
        continue
    for j in range(a[i], M, a[i]):
        cnt[j] += 1

ans = 0

for i in range(n):
    if cnt[a[i]] == 1:
        ans += 1

print(ans)
Problem p02717 (python)

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

x, y = y, x
x, z = z, x

print(x, y, z)

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

total = sum(a)

count = 0

valid = total / (4 * m)

for i in a:
    if i > valid:
        count += 1

if count >= m:
    print('Yes')
else:
    print('No')
Problem p03161 (python)

Fixed submission:
import numpy as np

n, k = map(int, input().split())
h = np.array([int(i) for i in input().split()])

dp = np.zeros(n)
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    ik = max(0, i-k)
    dp[i] = np.min(dp[ik:i]+np.abs(h[i]-h[ik:i]))

print(int(dp[n-1]))

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

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.zeros(n)
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    ik = max(0, i-k)
    dp[i] = np.min(dp[ik:i]+np.abs(h[i]-h[ik:i]))

print(int(dp[n-1]))

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

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    ik = max(0, i-k)
    dp[i] = np.min(dp[ik:i]+np.abs(h[i]-h[ik:i]))

print(int(dp[n-1]))
Problem p03341 (python)

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

t = [0] * n
for i in range(n):
    if s[i] == 'E':
        t[i] = 1
    if i == 0:
        continue
    t[i] += t[i-1]

ans = 10000000000

for i in range(n):
    if i == 0:
        a = 0
    else:
        a = i - t[i-1]
    b = t[n-1] - t[i]
    c = a + b

    ans = min(ans, c)

print(ans)

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

t = [0] * n
if s[0] == 'E':
    s[0] = 1

for i in range(1, n):
    if s[i] == 'E':
        t[i] = 1
    t[i] += t[i-1]

ans = 10000000000

for i in range(n):
    if i == 0:
        a = 0
    else:
        a = i - t[i-1]
    b = t[n-1] - t[i]
    c = a + b

    ans = min(ans, c)

print(ans)
Problem p02583 (python)

Fixed submission:
n = int(input())
arr = sorted(list(map(int, input().split())))
res = 0
for i in range(0, n - 2):
	for j in range(i, n - 1):
		for k in range(j, n):
			if arr[i] + arr[j] > arr[k] and arr[i] != arr[j] and arr[j] != arr[k] and arr[i] != arr[k]:
 				res += 1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = sorted(list(map(int, input().split())))
res = 0
for i in range(0, n - 2):
	for j in range(i, n - 1):
		for k in range(j, n):
			if arr[i] + arr[j] > arr[k] and arr[i] != arr[j] and arr[j] != arr[k] and arr[i != arr[k]:
 				res += 1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = sorted(list(map(int, input().split())))
res = 0
for i in range(0, n - 2):
	for j in range(i, n - 1):
		for k in range(j, n):
			if arr[i] + arr[j] > arr[k] and arr[i] != arr[j] and arr[j] != arr[k] and arr[i != arr[k]:
 				res += 1
print(res)
Problem p02952 (python)

Fixed submission:
n = int(input())
res = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        res += 1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
res = 0
for i in range(n + 1):
  if str(i) % 2 == 1:
    res += 1
print(res0
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
print((A + B) // 2) if A % 2 == B % 2 else print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print((A + B) // 2) if A % 2 == B % 2 else print("IMPOSSIBLE)
Problem p02583 (python)

Fixed submission:
count = 0
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if arr[i]==arr[j] or arr[i]==arr[k] or arr[j]==arr[k]:
        continue
      if arr[i]+arr[j]>arr[k]:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
count = 0
n = int(input())
arr = list(map(int,input().split()))
ar = []
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if triv(arr[i],arr[j],arr[k]):
        if arr[i]==arr[j] or arr[i]==arr[k] or arr[j]==arr[k]:
          continue
        if arr[i]+arr[j]>arr[k]:
          count+=1
print(count)

Buggy submission (verdict: Runtime Error):
def triv(a, b, c):  
    if (a + b <= c) or (a + c <= b) or (b + c <= a) : 
        return False
    else: 
        return True  
count = 0
m = int(input())
arr = list(map(int,input()))
for i in range(len(arr)):
  for j in range(i,len(arr)):
    for x in range(j,len(arr)):
      if triv(i,j,x):
        count += 1
print(count)
Problem p02718 (python)

Fixed submission:
n,m = input().split()
n = int(n)
m = int(m)
arr = list(map(int,input().split()))
minn = sum(arr)*(1/(4*m))
t = 0
for i in arr:
  if i >= minn:
    t += 1
#print(t)
if t >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,m = input().split()n,m = input().split()
n = int(n)
m = int(m)
arr = list(map(int,input().split()))
minn = sum(arr)*(1/(4*m))
t = 0
for i in arr:
  if i >= minn:
    t += 1
if t >= m:
  print("Yes")
else:
  print("No")
Problem p02957 (python)

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

Buggy submission (verdict: Runtime Error):
import math
count = 0
n,d = map(int,input().split())
for i in range(n):
  x,y = map(int,input().split())
  if x**2+y**2 ** 0.5 <= d:
    count += 1
print(count)
Problem p02573 (python)

Fixed submission:
n, m = map(int, input().split())
par = list(range(n))


def find(x):
    while par[x] != x:
        par[x] = par[par[x]]
        x = par[x]
    return x


def union(x, y):
    x1 = find(x)
    y1 = find(y)
    if x1 != y1:
        par[x1] = y1


for j in range(m):
    a, b = map(int, input().split())
    union(a - 1, b - 1)

s = [0 for i in range(n + 1)]

for k in range(n):
    s[find(k)] += 1


print(max(s))

Buggy submission (verdict: Runtime Error):
def solve(N, M, fridens):
    parents = {}
    groups = {}
    for A, B in friends:
        parents[B] = A
        if A not in groups:
            if A not in parents:
                groups[A] = [A]
            else:
                continue
        groups[A].append(B)

    ans = len(max(groups.values(), key=len))
    print(ans)


if __name__ == "__main__":
    N, M = map(int, input().split())
    friends = []
    for _ in range(M):
        AB = sorted([x - 1 for x in map(int, input().split())])
        if AB not in friends:
            friends.append(AB)
    solve(N, M, friends)
Problem p02957 (python)

Fixed submission:
m, n = map(int, input().split())
total = m + n
if total % 2 == 0:
  print(total // 2)
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
m, n = map(int, input.split())
total = m + n
if total % 2 == 0:
  print(total // 2)
else:
  print('IMPOSSIBLE')
Problem p02700 (python)

Fixed submission:
import math
A,B,C,D = map(int,input().split())
turn = math.ceil(A/D)
if turn*B >= C:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
 import math
 A,B,C,D = map(int,input().split())
 turn = math.ceil(A/D)
 if turn*B >= C:
     print("Yes")
else:
    print("No")
Problem p02747 (python)

Fixed submission:
S = input()
if S == "hi"*int(len(S)//2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S =＝ "hi"*int(len(S)//2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S = "hi"*int(len(S)//2):
    print("Yes")
else:
    print("No")
Problem p03059 (python)

Fixed submission:
A,B,T = map(int,input().split())
print(T//A*B)

Buggy submission (verdict: Runtime Error):
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
sa = 0

for i in range(N):
    if v[i] - c[i]>0:
        sa += v[i]-c[i]

print(sa)
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
loop_=[1]
l_set=set()
lst=list(map(int,input().split()))

tar=None
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in l_set:
        tar=num
        break
    else:
        loop_.append(num)
        l_set.add(num)

if tar==None:
    print(loop_[k])
    exit()    
loop__=loop_[loop_.index(tar):]

num=k+1-len(loop_)
try:
  print(loop__[num%len(loop__)-1])
except:
  print(1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
loop_=[1]
l_set=set()
lst=list(map(int,input().split()))

tar=None
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in l_set:
        tar=num
        break
    else:
        loop_.append(num)
        l_set.add(num)

if tar==None:
    print(loop_[k])
    exit()    
loop__=loop_[loop_.index(tar):]
 
if k<=len(loop_):
    print(loop_[k])
else:
    num=k+1-len(loop_)
    print(loop__[num%len(loop__)-1])
Problem p02732 (python)

Fixed submission:
import numpy as np
import collections
n=int(input())
a=list(np.fromstring(input(),int,sep=' '))
dic=collections.Counter(a)
ans=0

for i in dic.values():
    ans+=i*(i-1)//2
    
for i in range(n):
    print(ans-(dic[a[i]]-1))

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=list(np.fromstring(input(),int,sep=' '))
a_=list(set(a))
dic={}
ans={}
for i in a_:
    dic[i]=a.count(i)
    
def check(x):
    lst_=lst
    count=0
    ans=0
    dic_=dic
    for i in a_:
        if x==i:
            dic_[x]-=1
            break
    for i in dic_.values():
        ans+=i*(i-1)//2
    dic_[x]+=1
    return ans

for i in a_:
    ans[i]=check(i)

for i in a:
    print(ans[i])
Problem p02741 (python)

Fixed submission:
num=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(num[k-1])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=c-a-b
if 4*a*b<x**2:
    print("Yes")
else:
    print("No")
Problem p02742 (python)

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

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
if h==1 ir w==1:
    print(1)
else:
    print((h*w)//2 if h%2==0 else ((h-1)*w)//2-(-w//2))
Problem p02756 (python)

Fixed submission:
s=[input()]
q=int(input())
turn=True
l=""
for i in range(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==bool(int(qq[1])-2):
            l+=qq[2]
        else:
            s.append(qq[2])

text=l[::-1]+"".join(s)
print(text if turn else text[::-1])

Buggy submission (verdict: Runtime Error):
s=[input()]
q=int(input())
turn=True

for i in range(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==bool(int(qq[1])-2):
            s.appendleft(qq[2])
        else:
            s.append(qq[2])

text="".join(s)
print(text if turn else text[::-1])

Buggy submission (verdict: Runtime Error):
s=[input()]
q=int(input())
turn=True
for i in ragne(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==not (int(qq[1])-1]):
            s.insert(0,qq[2])
        else:
            s.append(qq[2])
text="".join(s)
print(text if turn else text[::-1])

Buggy submission (verdict: Runtime Error):
ad=[[],[]]
add=[[],[]]
count=0
s=input()
q=int(input())
for i in range(q):
    t=input().split()
    if t[0]=='1':
        count+=1
        ad[0].reverse()
        ad[1].reverse()
        add=[add[0]+=ad[1],add[1]+=ad[0]]
        ad=[[],[]]
    elif t[1]=='1':
        ad[0].insert(0,t[2])
    else:
        ad[1].append(t[2])


if count%2==0:
    print(''.join(add[0]+ad[0])+s+''.join(add[1]+ad[1]))
else:
    print(''.join(add[0]+ad[0])+s[::-1]+''.join(add[1]+ad[1]))

Buggy submission (verdict: Runtime Error):
ad=[[],[]]
count=0
s=input()
q=int(input())
for i in range(q):
    t=input().split()
    if t[0]=='1':
        count+=1
        ad[1].reverse()
        ad[0].reverse()
        ad=[ad[1],ad[0]]
    elif t[1]=='1':
        ad[0].insert(0,t[2])
    else:
        ad[1].append(t[2])

if count%2==0:
    print(''.join(ad[0],s,ad[1]))
else:
    print(''.join(ad[0]),end='')
    for i in range(len(s)):
        print(s[-(i+1)],end='')
    print(''.join(ad[1]))