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

Fixed submission:
import fractions
n = int(input())
a = [0] + list(map(int,input().split())) + [0]


#はじめと最初の値を代入
L = [0] * (n+2)
R = [0] * (n+2)

for i in range(n):
    L[i+1] = fractions.gcd(L[i], a[i+1])

for j in range(n,0,-1):
    R[j] = fractions.gcd(R[j+1],a[j])

#print(a)
#print(L)
#print(R)

print(max(fractions.gcd(L[k-1],R[k+1]) for k in range(1,len(L)-1)))

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = input()
a = list(map(int,input().split()))
answer = 0

if len(a) <= 2:
    answer = max(a)
else:
    for i in range(len(a)):
        a_filter = [k for k in a if k < a[i] or k > a[i]]
        answer_b = gcd_list(a_filter)
        if answer_b > answer:
            answer = answer_b
print(answer)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = input()
a = list(map(int,input().split()))
answer = 0

if len(a) == 2:
    answer = max(a)
else:
    for i in range(len(a)):
        val = a[i]
        a_filter = [k for k in a if str(k)!=str(val)]
        answer_b = gcd_list(a_filter)
        if answer_b > answer:
            answer = answer_b
print(answer)

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = input()
a = list(map(int,input().split()))
answer = 0

if len(a) == 2:
    answer = max(a)
else:
    for i in range(len(a)):
        val = a[i]
        a_filter = [k for k in a if str(k)!=str(val)]
        answer_b = gcd_list(a_filter)
        if answer_b > answer:
            answer = answer_b
print(answer)
Problem p03047 (python)

Fixed submission:
n, k = [int(i) for i in input().split(" ")]
print(n - k + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(0, n):
    s.append(input())

c = 0
a = 0
b = 0
ab = 0

for i in range(0, n):
    for j in range(1, len(s[i])):
        if s[i][j-1:j+1] == "AB":
            c += 1
    if s[i][-1] == "A" and s[i][0] == "B":
        ab += 1
    else: 
        if s[i][0] == "B":
            b += 1
        if s[i][-1] == "A":
            a += 1

s = c
s += min(a, b)
a -= min(a, b)
b -= min(a, b)

if(ab > 0):
    s += ab - 1
    if(a > 0):
        s += 1
    if(b > 0):
        s += 1

print(s)
Problem p03079 (python)

Fixed submission:
a, b, c = [int(i) for i in input().split(" ")]
if a == b and b == c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = [int(i) for i in input().split(" ")]
if a == b and b == c
    print("Yes")
else:
    print("No")
Problem p03105 (python)

Fixed submission:
a, b, c = [int(i) for i in input().split(" ")]
print(min(b//a, c))

Buggy submission (verdict: Runtime Error):
print(min(B//A), C)
Problem p03338 (python)

Fixed submission:
def charToInt(c):
    return ord(c) - ord("a")
 
def stringToFlags(s):
    t = [False for i in range(26)]
    for i in range(len(s)):
        t[charToInt(s[i])] = True
    return t
 
def B(n, s):
    max = 0
    for i in range(1, n):
        xflags = stringToFlags(s[0:i])
        yflags = stringToFlags(s[i:n])
        
        count = 0
        for i in range(26):
            if xflags[i] and yflags[i]:
                count += 1
                if count > max:
                    max = count
    return max
 
n = int(input())
s = input()
print(B(n, s))

Buggy submission (verdict: Runtime Error):
def charToInt(c):
    return ord(c) - ord("a")

def stringToFlags(s):
    t = [False for i in range(26)]
    for i in range(len(s)):
        t[charToInt(s[i])] = True
    return t

def B(n, s):
    max = 0
    for i in range(1, n):
        print(s[0:i], s[i:n])
        xflags = stringToFlags(s[0:i])
        yflags = stringToFlags(s[i:n])
        
        count = 0
        for i in range(26):
            if xflags[i] and yflags[i]:
                count += 1
                if count > max:
                    max = count
    return max

n = int(input())
s = input()
return B(n, s)
Problem p03380 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(" ")]
m = max(a)
abs_min = m
abs_i = 0

for i in range(0, n):
    ab = abs((m + 1)//2 - a[i])
    if a[i] != m and abs_min > ab:
        abs_min = ab
        abs_i = i
        
print(m, a[abs_i])

Buggy submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 0:
        return 1
    else:
        return n * f(n - 1)
 
n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

Buggy submission (verdict: Runtime Error):
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 
 
def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

n = input()
a = map(int, raw_input().split())
 
a.sort()
a.reverse()
max = 0
ai = 0
aj = 0
for i in range(0, len(a)):
    for j in range(i + 1, len(a)):
        c = comb(a[i], a[j])
        if c > max:
            max = c
            ai = a[i]
            aj = a[j]
print(str(ai) + " " + str(aj))

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

    a.sort()
    a.reverse()
    max = 0
    ai = 0
    aj = 0
    for i in range(0, len(a)):
        for j in range(i + 1, len(a)):
            c = comb(a[i], a[j])
            if c > max:
                max = c
                ai = a[i]
                aj = a[j]
    print(str(ai) + " " + str(aj))
    
def comb(n, r):
    return f(n) / (f(n - r) * f(r)) 

def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)
Problem p03388 (python)

Fixed submission:
import math

q = int(input())
a = [0] * q
b = [0] * q

for i in range(0, q):
    a[i], b[i] = [int(i) for i in input().split(" ")]
    
def sqrt_int(n):
    s = math.floor(n**(1/2)) - 1
    while s * s <= n:
        s += 1
    return s - 1

for i in range(0, q):
    mi = min(a[i], b[i])
    mx = max(a[i], b[i])
    p = mi * mx - 1
    s = math.floor(p**(1/2))
    c = 2 * (s - 1)
    if s == 0:
        print(0)
        continue
    if mi <= s - 1:
        c -= 1
    r = p // s
    if r > s:
        if s == mi:
            c += 1
        else:
            c += 2
    elif r == s and s != mi:
        c += 1
    print(c)

Buggy submission (verdict: Runtime Error):
import math

q = int(input())
a = [0] * q
b = [0] * q

for i in range(0, q):
    a[i], b[i] = [int(i) for i in input().split(" ")]

for i in range(0, q):
    mi = min(a[i], b[i])
    mx = max(a[i], b[i])
    p = mi * mx - 1
    s = p**(1/2)
    c = 2 * math.floor(s - 1)
    if mi <= math.floor(s - 1):
        c -= 1
    if math.floor(p / math.floor(s)) > math.floor(s):
        if math.floor(s) == mi:
            c += 1
        else:
            c += 2
    elif math.floor(p / math.floor(s)) == math.floor(s) and math.floor(s) != mi:
        c += 1
    print(c)
Problem p03450 (python)

Fixed submission:
import queue

n, m = [int(i) for i in input().split(" ")]

g = [[] for i in range(0, n + 1)]
v = [0] * (n + 1)
v_asn = [False] * (n + 1)
f = True

for i in range(0, m):
    l, r, d = [int(i) for i in input().split(" ")]
    g[l].append([r, d])
    g[r].append([l, -d])

for i in range(1, n + 1):
    if not v_asn[i]:
        q = queue.Queue()
        v_asn[i] = True
        q.put(i)
        while not q.empty():
            qi = q.get()
            for a in g[qi]:
                if not v_asn[a[0]]:
                    v_asn[a[0]] = True
                    v[a[0]] = v[qi] + a[1]
                    q.put(a[0])
                else:
                    if v[a[0]] != v[qi] + a[1]:
                        f = False
                        break
        if not f:
            break

if f:
    print("Yes")
else:
    print("No")

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

n, m = [int(i) for i in input().split(" ")]

par = [i for i in range(0, n + 1)]
d2p = [0 for i in range(0, n + 1)]

def root(x):
    global par
    global d2p
    if par[x] == x:
        return (x, 0)
    else:
        r = root(par[x])
        par[x] = r[0]
        d2p[x] += r[1]
        #print(par, d2p)
        return (r[0], d2p[x])


def unite(x, y, d):
    global par
    global d2p
    #print(x, y, d)
    rx, dx = root(x)
    ry, dy = root(y)
    if rx != ry:
        par[x] = y
        d2p[x] = d
        #print(par, d2p,"noz")
        return True
    else:
        if dy - dx != d:
            #print(rx, ry, dx, dy)
            return False
        else:
            return True

l = [0] * n
r = [0] * n
d = [0] * n

for i in range(0, m):
    l[i], r[i], d[i] = [int(i) for i in input().split(" ")]

f = True
for i in range(0, m):
    if not unite(l[i], r[i], d[i]):
        f = False
        break

if f and max(d2p) <= 10**9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]

par = [i for i in range(0, n + 1)]
d2p = [0 for i in range(0, n + 1)]

def root(x):
    global par
    global d2p
    if par[x] == x:
        return (x, 0)
    else:
        r = root(par[x])
        par[x] = r[0]
        d2p[x] += r[1]
        #print(par, d2p)
        return (r[0], d2p[x])


def unite(x, y, d):
    global par
    global d2p
    #print(x, y, d)
    rx, dx = root(x)
    ry, dy = root(y)
    if rx != ry:
        par[x] = y
        d2p[x] = d
        #print(par, d2p,"noz")
        return True
    else:
        if abs(dx - dy) != d:
            #print(rx, ry, dx, dy)
            return False
        else:
            return True

l = [0] * n
r = [0] * n
d = [0] * n

for i in range(0, m):
    l[i], r[i], d[i] = [int(i) for i in input().split(" ")]

f = True
for i in range(0, m):
    if not unite(l[i], r[i], d[i]):
        f = False
        break

if f and max(d2p) <= 10**9:
    print("Yes")
else:
    print("No")
Problem p03458 (python)

Fixed submission:
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = (int(y) + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(0, j, i, j + k) + srect(i, 0, i + k, j) + srect(i, j + k, i + k, 2 * k) + srect(i + k, j, 2 * k, j + k)
        raw = n - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)

Buggy submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = int(y + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(i, j, i + k, j + k) + srect(i + k, j + k, 2 * k, 2 * k)
        raw = s[2 * k][2 * k] - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)

#for i in s:
#    print(i)
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())
if A > 12:
  print(B)
elif 5 < A <= 12:
  print(int(B/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L_max, R_min = 0, 100000
for i in range(M):
  L, R = map(int,input().split())
  if L_max < L:
    L_max = L
  if R_min > R:
    R_min = R
if R_min - L_max < 0:
  print(0)
else:
  print(R_min - L_max + 1)
Problem p03076 (python)

Fixed submission:
import math
 
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = [A,B,C,D,E]
L = [10 if i == 0 else i for i in L]
min_ = L.index(min(L))
A = math.ceil(a*0.1)*10
B = math.ceil(b*0.1)*10
C = math.ceil(c*0.1)*10
D = math.ceil(d*0.1)*10
E = math.ceil(e*0.1)*10
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)

Buggy submission (verdict: Runtime Error):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = list[A,B,C,D,E]
min_ = L.index(min(L)
A = math.ceil(a)
B = math.ceil(b)
C = math.ceil(c)
D = math.ceil(d)
E = math.ceil(e)
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)
Problem p03085 (python)

Fixed submission:
A = input()
if A == 'A':
  print('T')
elif A == 'T':
  print('A')
elif A == 'C':
  print('G')
elif A == 'G':
  print('C')

Buggy submission (verdict: Runtime Error):
A = input()
if A == 'A'
  print('T')
elif A == 'T'
  print('A')
elif A == 'C'
  print('G')
elif A == 'G'
  print('C')
Problem p03288 (python)

Fixed submission:
R=int(input())
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")
Problem p03111 (python)

Fixed submission:
def main():
    #入力をとる
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]

    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    mp = 10000000000
    pt= []
    #全探索
    for i in range(2**(2*n)):
        pt = []
        for j in range(n):
            if (i >> j*2)&1:
                if (i >> j*2+1)&1:
                    pt.append(3)
                else:
                    pt.append(1)
            else:
                if (i >> j*2+1)&1:
                    pt.append(2)
                else:
                    pt.append(0)       

        #keisan
        mp_tmp = 0
        all_used = True
        for k in range(3):
            if pt.count(k) == 0:
                all_used = False
                break

            sum_tmp = 0
            mp_tmp += (pt.count(k) - 1)*10
            for l in range(n):
                if pt[l] == k:
                    sum_tmp += moto[l]
            
            mp_tmp += abs(sum_tmp-take[k])

        if all_used == True:
            mp = min(mp_tmp, mp)
    print(mp)

main()

Buggy submission (verdict: Runtime Error):
def main():
    minmp = 10000000
    def dfs(depth, pt):

        if depth==n:
            mp_tmp = 0
            all_used = True
            for k in range(3):
                if pt.count(k) == 0:
                    all_used = False
                    break

                sum_tmp = 0
                mp_tmp += (pt.count(k) - 1)*10
                for l in range(n):
                    if pt[l] == k:
                        sum_tmp += moto[l]
                
                mp_tmp += abs(sum_tmp-take[k])

            if all_used == True:
                global minmp
                minmp = min(minmp,mp_tmp)
                return
            else:
                return

        for i in range(4):
            pt[depth] = i
            dfs(depth+1, pt)

        return

    #入力をとる
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]


    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    pt  = [3]*n
    for i in range(n):
        dfs(i,pt)

    print(minmp)

main()
Problem p03962 (python)

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

checked = [False]*100

for i in range(3):
    checked[penki[i]-1]=True

ans = checked.count(True)

print(ans)

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

checked = [False]*100

for i in range(3):
    checked[penki[i]]=True

ans = checked.count(True)

print(ans)
Problem p04013 (python)

Fixed submission:
def main():
    #入力
    n, a = map(int,input().split())
    x = [0] + list(map(int,input().split()))

    sum_max = (n)*(max(x))+1

    #dp[i][j][k]:x1-xiからj枚選んで、合計をkにする選び方の数
    dp = [[[0]*2501 for _ in range(n+1)] for _ in range(n+1)]

    dp[0][0][0] = 1

    for i in range(1,n+1):
        for j in range(n+1):
            for k in range(50*j+1):
                #xi>kのとき
                if x[i]>k:
                    dp[i][j][k] = dp[i-1][j][k]
                elif j>=1 and x[i]<=k:
                    #xi<=kのとき
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

    count = 0
    for j in range(1,n+1):
        count += dp[n][j][j*a]
    
    print(count)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    #入力
    n, a = map(int,input().split())
    x = [0] + list(map(int,input().split()))

    sum_max = (n)*(max(x))+1

    #dp[i][j][k]:x1-xiからj枚選んで、合計をkにする選び方の数
    dp = [[[0]*sum_max for _ in range(n+1)] for _ in range(n+1)]

    dp[0][0][0] = 1

    for i in range(n+1):
        for j in range(n+1):
            for k in range(sum_max):
                #xi>kのとき
                if x[i]>k:
                    dp[i][j][k] = dp[i-1][j][k]
                elif k>=1 and x[i-1]<=k:
                    #xi<=kのとき
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

    count = 0
    for j in range(0,n+1):
        count += dp[n][j][j*a]
    
    print(count)


if __name__ == "__main__":
    main()
Problem p03139 (python)

Fixed submission:
i = input().split()
all = int(i[0])
x = int(i[1])
y = int(i[2])
t = 0
max = 0
if x > y:
    max = x - abs(x - y)
    t = x
elif y > x:
    max = y - abs(x - y)
    t = y 
else:
    t = x
    max = x

min = 0
nx = all - x
ny = all - y

if nx > ny:
    nt = nx
elif ny > nx:
    nt = ny
else:
    nt = nx
if t >= nt: 
    min = t - nt
else:
    min = 0
print("{0} {1}".format(max,min))

Buggy submission (verdict: Runtime Error):
n = input()
a = input()
b = input()
c = input()

la = list(a)
lb = list(b)
lc = list(c)

total = 0
for i in range(int(n)):
    count = 0
    if la[i] != lb[i]:
        count += 1
    if la[i] != lc[i]:
        count += 1
    if lb[i] != lc[i]:
        count += 1

    if count == 3:
        total += 2
    elif count == 2:
        total += 1
    elif count == 1:
        total += 1
    else:
        total += 0

print(total)
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
P = A * 3 + P
print(int(P // 2))

Buggy submission (verdict: Runtime Error):
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)
Problem p03030 (python)

Fixed submission:
import numpy as np
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)
Problem p03035 (python)

Fixed submission:
# -*- coding: utf-8 -*-
inputData = input()
age, price = map(int, inputData.split())

if age >= 13:
    ans = price
elif age >= 6:
    ans = price / 2
else:
    ans = 0

print(int(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
inputData = input()
ID, Gate = map(int, inputData.split())
x = []
for i in range(Gate):
    inputId = input()
    idStart, idEnd = map(int, inputId.split())
    idList = list(range(idStart, idEnd + 1))
    x.append(idList)

# print(x[0])


def solve():

    for i in range(len(x)):
        if i == 0:
            matched = set(x[0])
            continue

        tempX = set(x[i])
        # print('++')
        # print(matched)
        # print(tempX)
        matched = set(list(matched & tempX))
        # print(matched)
        if len(matched) == 0:
            #
            return 0

    return len(matched)


ans = solve()
print(ans)
Problem p03069 (python)

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

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)

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

cnt=N
for i in range(N+1):
    if (S[0:i+1].count("#") + S[i+1:N].count(".")) <= cnt:
        cnt = left.count("#") + right.count(".")
print(cnt)
Problem p03379 (python)

Fixed submission:
import statistics as sta

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

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)

Buggy submission (verdict: Runtime Error):
import statistics as sta

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

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)

Buggy submission (verdict: Runtime Error):
import statistics
import copy

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

for i in range(len(X)):
    A = copy.deepcopy(X)
    del A[i]
    print(statistics.median(A))