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

Fixed submission:
import math
import numpy as np

L = int(input())
a0 = L/3

print(a0*a0*a0)

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

L = int(input())
#print(L)

a0 = math.floor(L/2)
#print(a0)

cand = []

if a0==1:
  b0 = -2*a0 + L
  cand.append(a0*b0*a0)
else:
  x = np.arange(0.1, a0, 0.001)
  for i in x:
    b0 = -2*i + L
    cand.append(i*b0*i)

cand_np = np.array(cand)
print(cand_np.max())

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

L = int(input())
#print(L)

a0 = math.floor(L/2)
#print(a0)

cand = []

if a0==1:
  b0 = -2*a0 + L
  cand.append(a0*b0*a0)
else:
  x = np.arange(0.1, a0, 0.1)
  for i in x:
    b0 = -2*i + L
    cand.append(i*b0*i)

cand_np = np.array(cand)
print(cand_np.max())

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

L = int(input())
#print(L)

a0 = math.floor(L/2)
#print(a0)

cand = []

if a0==1:
  b0 = -2*a0 + L
  cand.append(a0*b0*a0)
else:
  for i in range(1,a0):
    b0 = -2*i + L
    cand.append(i*b0*i)

cand_np = np.array(cand)
print(cand_np.max())
Problem p03220 (python)

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

ans_num = 1
ans_para = h[0]
for i, r in enumerate(h):
    deg = t - (r * 0.006)
    ans_para_deg = t - (ans_para * 0.006)
    if abs(a - ans_para_deg) >= abs(a - deg):
        ans_para = r
        ans_num = i+1
print(ans_num)

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

ans_num = 1
ans_para = h[0]
for i, r in enumerate(h):
    deg = t - (r * 0.006)
    ans_para_deg = t - (ans_para * 0.006)
    if abs(a - ans_para_deg) >= abs(a - deg):
        ans_para = r
        ans_num = i+1
print(ans_num
Problem p03285 (python)

Fixed submission:
n = int(input())
for r_1 in range(n//4 + 1):
    sum_4 = r_1 * 4
    for r_2 in range(n//7 + 1):
        sum_7 = r_2 * 7
        if sum_4 + sum_7 == n:
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
is_equal = 'No'
for r_1 in range(n//4 + 1):
    sum_4 = r * 4
    for r_2 in range(n//7 + 1):
        sum_7 = r2 * 7
        if sum_4 + sum_7 == n:
            is_equal = 'Yes'
print(is_equal)
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split())
print((a+b+1)//2)

Buggy submission (verdict: Runtime Error):
print('Yes' if sorted(input()) < sorted(input(), reverse=True) else 'No')
Problem p02960 (python)

Fixed submission:
s = input()
mod = 10**9+7

dp = [[0 for j in range(13)] for i in range(len(s)+1)]
dp[0][0] = 1
for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]
      dp[i+1][(k * 10 + j) % 13] %= mod
		
  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))

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

s = input()
mod = 10**9+7

dp = np.zeros((len(s)+1, 13))
dp[0][0] = 1

for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]
      dp[i+1][(k * 10 + j) % 13] %= mod
		
  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N, X = map(int, input().split())
x = list(map(int,input().split()))
ans = max(x)
if N==1:
  ans = abs(X-x[0])
else:
  for i in range(N-1):
  	ans = min(ans, gcd(abs(x[i]-X), abs(x[i+1]-X)))

print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if a == b:
    return b
  if a < b:
    a, b = b, a
  return gcd(a-b, b)

N, X = map(int, input().split())
x = list(map(int,input().split()))
ans = max(x)
if N==1:
  ans = abs(X-x[0])
else:
  for i in range(N-1):
  	ans = min(ans, gcd(abs(x[i]-X), abs(x[i+1]-X)))

print(ans)
Problem p03292 (python)

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

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

Fixed submission:
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *300000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])

Buggy submission (verdict: Runtime Error):
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *20000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])

Buggy submission (verdict: Runtime Error):
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *20000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
 for j in range(k):
  if i == 0:
    tmpmax += ex[i+j]
    exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
a = exsum.index(max(exsum))

print(exsum[a])
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
list=[]
for i in range(N):
    list.append(str(input()))
list.sort()
print("".join(list))

Buggy submission (verdict: Runtime Error):
l, n = map(int, input().split())
st = []
for _ in range(n):
	st.append(str(input()))
st.sort()
print("".join(st))

Buggy submission (verdict: Runtime Error):
l, n = map(int, input().split())
 
st = []
for _ in range(n):
  st.append(str(input()))
st.sort()
print("".join(st))

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

st = []
for _ in range(n):
  st.append(str(input()))

st.sort()
  
print(''.join(st))

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

st = []
for _ in range(n):
  st.append(str(input()))

st.sort()
ans = ''

for s in st:
  ans += s
  
print(ans)

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

st = []
for _ in range(n):
  st.append(input())

st.sort()
ans = ''

for s in st:
  ans += s
  
print(ans)
Problem p02848 (python)

Fixed submission:
def f(N,S):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ret_s = ""
    for s in S:
        num = (alpha.index(str(s)) + int(N))
        if num <= 25:
            pass
        else:
            num = num-(num//26)*26
        ret_s += alpha[num]
    return print(ret_s)
  
a = input()#13#
b = input()#"ABCDEFGHIJKLMNOPQRSTUVWXYZ"#
 
f(a,b)

Buggy submission (verdict: Runtime Error):
def f(N,S):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ret_s = ""
    for s in S:
        num = (alpha.index(str(s)) + N)
        if num <= 25:
            pass
        else:
            num = num-(num//25)*25-1
        ret_s += alpha[num]
    return print(ret_s)

N = input()
S = input()
f(N,S)
Problem p02774 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
A = np.array([int(i) for i in input().split()])


A = np.sort(A)
posi = A[A>0]
zero = A[A==0]
nega = A[A<0]

def f(x):
    """count the number of products , <= x"""
    cnt_tpl = 0
    # count 0
    if x >= 0:
        cnt_tpl += len(zero) * N
    # count posi
    cnt_tpl += np.searchsorted(A, x//posi, side='right').sum()
    # count nega
    cnt_tpl += (N - np.searchsorted(A, (-x - 1) // (-nega), side='right')).sum()
    # remove a^2
    cnt_tpl -= np.count_nonzero(A*A <= x)
    return cnt_tpl // 2

# 二分探索
left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
A = np.array([int(i) for i in input().split()])

posi = A[A>0]
zero = A[A==0]
nega = A[A<0]


def f(x):
    """count the number of products , <= x"""
    cnt_tpl = 0
    # count 0
    if x >= 0:
        cnt_tpl += len(zero) * N
    # count posi
    cnt_tpl += np.searchsorted(A, x//pos, side='right').sum()
    # count nega
    cnt_tpl += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    # remove a^2
    cnt_tpl -= np.count_nonzero(A*A <= x)
    return cnt_tpl // 2

# 二分探索
left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x
 
print(right)
Problem p02817 (python)

Fixed submission:
print(''.join(reversed(input().split())))

Buggy submission (verdict: Runtime Error):
print(''.join(input().split().reverse()))
Problem p02838 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

maxdig = 60
mod = 10**9+7

ans = 0
for i in range(60+1):
  cnt1 = sum([1 for a in A if (a >> i) & 1])
  ans += (cnt1*(N-cnt1)*(1<<i))
  ans = ans%mod

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

maxdig = 60
mod = 10**9+7

ans = 0
for i in range(60+1):
  cnt1 = 0
  for a in A:
    if (a >> i) & 1:
      cnt1 += 1
  ans += (cnt1*(N-cnt1)*(1<<j))
  ans = ans%mod

print(ans)

Buggy submission (verdict: Runtime Error):
from math import log2

N = int(input())
A = [int(i) for i in input().split()]

maxdig = int(log2(max(A)))


ans = 0
for i in range(maxdig, -1, -1):
  d = 2**i
  cnt1 = 0
  for j in range(N):
    if A[j]//d > 0:
      cnt1 += 1
      A[j] -= d
  ans += (cnt1*(N-cnt1)*d)%1000000007

print(ans)

Buggy submission (verdict: Runtime Error):
from math import log2

N = int(input())
A = [int(i) for i in input().split()]

maxdig = int(log2(max(A)))

ans = 0
for i in range(maxdig, -1, -1):
  d = 2**i
  cnt1 = 0
  for j in range(N):
    if A[j]//d > 0:
      cnt1 += 1
      A[j] -= d
  ans += cnt1*(N-cnt1)*d

print(ans%1000000007)
Problem p02882 (python)

Fixed submission:
from math import atan, degrees
a,b,x = map(int, input().split())

if x/a >= a*b/2:
  print(degrees(atan((b-x/(a**2))*2/a)))
else:
  print(90 - degrees(atan(2*x/(a*(b**2)))))

Buggy submission (verdict: Runtime Error):
from math import atan, degrees
a,b,x = map(int, input().split())

if x >= a*b/2:
  print(round(degrees(atan((b-x/(a**2))*2/a),7)))
else:
  print(round(degrees(atan(a*(b**2)/(2*x))),7))
Problem p02900 (python)

Fixed submission:
import math

a,b = map(int, input().split())
 
def gcd(a, b):
  while b:
      a, b = b, a % b
  return a
 
def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

g = gcd(a,b)
fac = prime(g)
print(len(fac)+1)

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

def gcd(a, b):
  while b:
      a, b = b, a % b
  return a

def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

g = gcd(a,b)
fac = prime(g)
print(len(fac)+1)
Problem p02936 (python)

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,q = map(int, input().split())
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:n+n-2])
PX = iter(ABPX[n+n-2:])

tree = dict()
for a,b in zip(AB,AB):
  if a in tree: tree[a].add(b)
  else: tree[a] = {b}
  if b in tree: tree[b].add(a)
  else: tree[b] = {a}

opr = {i+1:0 for i in range(n)}
for p,x in zip(PX,PX):
  opr[p] += x

stack = [1]
parent = [0] * (n+1)
ans = [0]*n
while stack:
  x = stack.pop()
  ans[x-1] += opr[x]
  for y in tree[x]:
    if y == parent[x]: continue
    parent[y] = x
    stack.append(y)
    ans[y-1] += ans[x-1]

print(*ans)

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

g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = [int(i) for i in input().split()]
    g[a-1].append(b-1)
    g[b-1].append(a-1)

add = [0]*n
for _ in range(q):
    p,x = [int(i) for i in input().split()]
    add[p-1] += x

ans = [0]*n
 
def dfs(v,p,value): #p: parent of v
    value += add[v]
    ans[v] = value
    for c in g[v]:
        if c == p: continue
        dfs(c,v,value)

dfs(0,-1,0)
 
print(*ans)

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

tree = dict()
for i in range(n-1):
  a,b = map(int, input().split())
  if a in tree: tree[a].add(b)
  else: tree[a] = {b}
  if b in tree: tree[b].add(a)
  else: tree[b] = {a}

opr = {i+1:0 for i in range(n)}
for i in range(q):
  p,x = map(int, input().split())
  opr[p] += x

ans = [0]*n

def dfs(v,p,value): #p: parent of v
  value += opr[v]
  ans[v-1] = value
  for c in tree[v]:
    if c == p: continue
    dfs(c,v,value)

dfs(1,-1,0)

print(*ans)
Problem p03647 (python)

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

A = set({})
B = set({})
for j in range(M):
    tmp = []
    tmp = [int(i) for i in input().split()]
    if tmp[0] == 1:
        A.add(tmp[1])
    elif tmp[1] == N:
        B.add(tmp[0])

if len(A.intersection(B)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

A = set({})
B = set({})
for j in range(N-1):
    tmp = []
    tmp = [int(i) for i in input().split()]
    if tmp[0] == 1:
        A.add(tmp[1])
    elif tmp[1] == N:
        B.add(tmp[0])

if len(A.intersection(B)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03683 (python)

Fixed submission:
import math
N, M = input().split()
N = int(N)
M = int(M)

if abs(N - M) > 1:
    print(0)
elif N == M:
    res = math.factorial(N) * math.factorial(M) * 2
    print(res % int(1e9 + 7))
else:
    res = math.factorial(N) * math.factorial(M)
    print(res % int(1e9 + 7))

Buggy submission (verdict: Runtime Error):
import math
N, M = input().split()
N = int(N)
M = int(M)


if abs(N - M) > 1:
    print(0)
elif N == M:
    res = math.factorial(N) * math.factorial(M) * 2
else:
    res = math.factorial(N) * math.factorial(M)

print(res % int(1e9 + 7))
Problem p03693 (python)

Fixed submission:
indata = [int(i) for i in input().split()]

a = indata[1]*10 + indata[2]*1
if a % 4 == 0:
    print("YES")
else:
    print("NO")

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

pair_cnt = S.count("()")
head_cnt = S.count("(") - pair_cnt
tail_cnt = S.count(")") - pair_cnt

res = S
res = tail_cnt * "(" + res
res = res + head_cnt * ")"

print(res)
Problem p03701 (python)

Fixed submission:
N = int(input())
S = [int(input()) for i in range(N)]

ans = sum(S)
if ans % 10 == 0:
    d = [i for i in S if i % 10 != 0]
    if len(d):
        print(ans - min(d))
    else:
        print(0)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = np.array([int(input()) for i in range(N)])
S = S.reshape(N, 1)

mat = np.zeros([2**N, N])
for i in range(2**N):
    for j in range(N):
        if (N * "0" + format(i, "b"))[-N+j] == "1":
            mat[i,j] = 1
score = np.dot(mat, S)
flg = score % 10 != 0 

print(int(np.max(score * flg)))
Problem p03844 (python)

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

if op == '+':
      result = a + b
else:
      result = a - b
print(result)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

N = int(input())
A = list(map(int,input().split()))
error = 0

if N%2 == 1:
      if A.count(0) != 1:
            print(0)
      elif sum(A) != (N+1)*(N-1)/2:
            print(0)
      else:
            print(int((2**((N-1)/2))%(10**9+7)))
      
else:
      if A.count(0) != 0:
            print(0)
      elif sum(A) != N**2/2:
            print(0)
      else:
            print(int((2**(N/2))%(10**9+7)))
Problem p03860 (python)

Fixed submission:
a, x, c = input().split()
print("A"+x[0]+"C")

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = [int(j) for j in input().split()]

count = 0
for i in range(N-1):
      dif = a[i] + a[i+1] - x
      if dif > x:
            if a[i+1] >x:
                  count += dif
                  a[i+1] -= dif
            else:
                  count += dif
                  a[i] -= dif - a[i + 1]
                  a[i + 1] = 0
print(count)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = [int(j) for j in input().split()]
count = 0
for i in range(N-1):
      dif = a[i] + a[i+1] - x
      if dif > x:
            if a[i+1] >x:
                  count += dif
                  a[i+1] -= dif
            else:
                  count += dif
                  a[i] -= dif - a[i + 1]
                  a[i + 1] = 0
print(count)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = input().split()
count = 0
for i in range(len(a)):
      a[i] = int(a[i])
      if a[i] > x:
            count = count + a[i] - x
            a[i] = x
      else:
            a[i] = a[i]
for i in range(len(a)-1):  
      if i%2 == 0:
            if a[i] + a[i + 1] > x:
                  count = count + a[i] + a[i + 1] - x
                  a[i+1] = x - a[i]
      else:
            if a[i] + a[i + 1] > x:
                  count = count + a[i] + a[i + 1] - x
                  a[i] = x - a[i + 1]
print(count)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = input().split()
count = 0
for i in range(len(a)):
      a[i] = int(a[i])
      if a[i] > x:
            count = count + a[i] - x
            a[i] = x
      else:
            a[i] = a[i]
for i in range(len(a)-1):  
      if i%2 == 0:
            if a[i] + a[i + 1] > x:
                  count = count + a[i] + a[i + 1] - x
                  a[i+1] = x - a[i]
      else:
            if a[i] + a[i + 1] > x:
                  count = count + a[i] + a[i + 1] - x
                  a[i] = x - a[i + 1]
print(count)
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
ans=sum(S)
for i in range(min(len(R),len(S))):
    if S[i]<R[-1-i]:
        S[i]=R[-1-i]
    else:
        break
print(sum(S))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
ans=sum(S)
for i in range(min(R,S)):
    if S[i]<R[-1-i]:
        S[i]=R[-1-i]
    else:
        break
print(sum(S))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
i=0
while S[i]<R[-1-i]:
    if len(R)>i or len(S)>i:
        break
    i+=1
print(sum(S[i+1:])+R[-1-i:])

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
P_=P[A-X:]
Q_=Q[B-Y:]
ans=sum(P_)+sum(Q_)
for i in range(X+Y):
    if len(R)==0 or len(P)+len(Q)==0 or min(P_[0],Q_[0])>R[-1]:
        break
    ans-=min(P_,Q_).pop(0)
    ans+=R.pop(-1)
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
P_=P[A-X:]
Q_=Q[B-Y:]
while P_[0]<R[-1] or Q_[0]<R[-1]:
    if P_[0]<Q_[0]:
        P_.pop(0)
        P_.append(R.pop(-1))
    else:
        Q_.pop(0)
        Q_.append(R.pop(-1))
print(sum(P_)+sum(Q_))
Problem p02899 (python)

Fixed submission:
A=dict(zip(range(1,int(input())+1),list(map(int,input().split()))))
B=sorted(A.items(),key=lambda x:x[1])
for b in B:
    print(b[0],end=" ")

Buggy submission (verdict: Runtime Error):
A={str(n+1):a for n,a in zip(range(int(input())),input().split())}
print(" ".join(sorted(A.items(),key=lambda x:x[1])[i][0] for i in len(A)))
Problem p02920 (python)

Fixed submission:
N=int(input())
S=list(map(int,input().split()))
S.sort()
p = [S.pop(-1)]
r = S

for i in range(N):
    nr = []
    for p_ in p[::-1]:
        while r:
            r_ = r.pop()
            if r_ < p_:
                p.append(r_)
                break
            nr.append(r_)
    p.sort()
    r+=nr[::-1]

print("Yes" if len(r)==0 else "No")

Buggy submission (verdict: Runtime Error):
import pandas as pd

N=int(input())
S=pd.Series(list((map(int,input().split())))).sort_values(ascending=False).reset_index(drop=True)
p = pd.Series([S.pop(0)])
c = S.reset_index(drop=True)
f = False

for i in range(N):
    np = pd.Series()
    nc = pd.Series()
    for j in range(len(p)):
        for k in range(len(c)):
            if c[k] < p[j]:
                nc_ = pd.Series([c.pop(k)])
                np = pd.concat([np, nc_])
                c = c.reset_index(drop=True)
                f = True
                break
        if f == False:
            print("No")
            exit(0)
        f = False
    p = pd.concat([p, np])
    p = p.sort_values(ascending=False).reset_index(drop=True)

print("Yes")
Problem p02924 (python)

Fixed submission:
N=int(input())
print(N*(N-1)//2)

Buggy submission (verdict: Runtime Error):
N=input()
print(N*(N-1)/2)
Problem p02945 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split)
print(max(A+B, A-B, A*B))
Problem p03262 (python)

Fixed submission:
import fractions
N,X0=map(int,input().split())
X=list(map(int,input().split()))
X_=[]
ans=abs(X[0]-X0)
for i in range(1,N):
    ans=fractions.gcd(ans,abs(X[i]-X0))
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions import *
N,X0=map(int,input().split())
X=list(map(int,input().split()))
ans=abs(X[0]-X0)
for i in range(1,N):
    ans=gcd(ans,abs(X[i]-X0))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,X0=map(int,input().split())
X=list(map(int,input().split()))
X_=[]
ans=abs(X[0]-X0)
for i in range(1,N):
    ans=math.gcd(ans,abs(X[i]-X0))
print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())

c = 0
for s in S:
    if s == "1":
        c += 1
    else:
        break

print(1 if K <= c else S[c])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

c = 0
for s in S:
    if s == "1":
        c += 1
    else:
        break

print(S[c])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

c = -1
for s in S:
    if s == "1":
        c += 1
    else:
        break

print(1 if K < c else S[c+1])
Problem p02744 (python)

Fixed submission:
import sys,math
sys.setrecursionlimit(10**9)
import itertools
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())


n=int(input())


def dfs(s,lim):

    
    if len(s)==n:
        print(s)
    else:
        for i in range(ord('a'),ord(lim)+1):
            
            if i==ord(lim):
                dfs(s+chr(i),chr(ord(lim)+1))
            else:
                dfs(s+chr(i),lim)

dfs('','a')

Buggy submission (verdict: Runtime Error):
import sys,math
sys.setrecursionlimit(10**9)
import itertools
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

n=int(input())
temp=[]
num=0
x=1
for i in range(1,n+1):
  x*=2
for st in itertools.permutations(a,n):
    temp.append(st)
    num+=1
    if num==x-i:break

for x in temp:
  for i in x:
    print(x[i],end="")
  print()