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

Fixed submission:
c = [list(input()) for _ in range(2)]
if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
    print('YES')
else: 
    print('NO')

Buggy submission (verdict: Runtime Error):
c = [list(input().split()) for _ in range(2)]
if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
    print('YES')
else: 
    print('No')
Problem p03563 (python)

Fixed submission:
r, g = [int(input()) for _ in range(2)]
print(int(g * 2 - r))

Buggy submission (verdict: Runtime Error):
r, g = map(int, input().split())
print(int(g * 2 - r))
Problem p03573 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b:
    print(c)
elce:
    print(b)
Problem p03597 (python)

Fixed submission:
n, a = [int(input()) for _ in range(2)]
print(n*n - a)

Buggy submission (verdict: Runtime Error):
n, a = [int(input) for _ in range(2)]
print(n*n - a)
Problem p03777 (python)

Fixed submission:
a, b = input().split()
if a == 'H':
    if b == 'H':
        print('H')
    elif b == 'D':
        print('D')
elif a == 'D':
    if b == 'H':
        print('D')
    elif b == 'D':
        print('H')

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if a == 'H':
    if b == 'H':
        print('H')
    elif b == 'D':
        print('D')
elif a == 'D':
    if b == 'H':
        print('D')
    elif b == 'D'
        print('H')
Problem p03826 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if a * b > c * d:
    print(a * b)
elif a * b < c * d:
    print(c * d)
else:
    print(a * b)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if a * b > c * d:
    print(a * b)
elif a * b < c * d:
    pritn(c * d)
else:
    print(a * b)

Buggy submission (verdict: Runtime Error):
a, b, c, b = map(int, input().split())
if a * b > c * d:
    print(a * b)
elif a * b < c * d:
    pritn(c * d)
else:
    print(a * b)

Buggy submission (verdict: Runtime Error):
a, b, c, b = map(int, input().split())
if a * b > c * b:
    print(a * b)
elif a * b < c * b:
    pritn(c * d)
else:
    print(a * b)

Buggy submission (verdict: Runtime Error):
a, b, c, b = map(int, input().split())
if a * b > c * b:
    print(a * b)
elif a * b < c * b:
    pritn(c * b)
else:
    print(a * b)
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
if op == "+":
    print(int(a) + int(b))
elif op == '-':
    print(int(a) - int(b))

Buggy submission (verdict: Runtime Error):
a op b = input().split()
if op == "+":
    print(int(a) + int(b))
elif op == '-':
    print(int(a) - int(b))
Problem p03860 (python)

Fixed submission:
s = input().replace('AtCoder ','').replace(' Contest','')
print('A' + s[0] + 'C')

Buggy submission (verdict: Runtime Error):
s = input().replace('AtCoder ').replace(' Contest')
print('A' + s[0] + 'C')
Problem p03943 (python)

Fixed submission:
pack = sorted(list(map(int,input().split())))
if pack[0] + pack[1] == pack[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
pack = list(map(int,input().split())).sort()
if pack[0] + pack[1] == pack[2]:
    print('Yes')
else:
    print('No')
Problem p03997 (python)

Fixed submission:
a, b, h = [int(input()) for _ in range(3)]
print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a + b) * h / 2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a + b) * h / 2))
Problem p04011 (python)

Fixed submission:
n, k, x, y = [int(input()) for _ in range(4)]
if n > k:
    print(k * x + (n-k) * y)
else:
    print(n * x)

Buggy submission (verdict: Runtime Error):
n, k, x, y = [int(iput()) for _ in range(4)]
print(k * x + (n-k) * y)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(a+pow(a,2)+pow(a,3)
Problem p02613 (python)

Fixed submission:
import numpy as np

N = int(input())
var = [str(input()) for i in range(N)]

judges = ['AC', 'WA', 'TLE', 'RE']
for j in judges:
    print('{} x {}'.format(j, (np.array(var) == j).sum()))

Buggy submission (verdict: Runtime Error):
N = int(input())
var = [str(input()) for i in range(N)]
judges = ['AC', 'WA', 'TLE', 'RE']
for j in judges:
    print('{} x {}'.format(j, (np.array(var) == j).sum()))
Problem p02994 (python)

Fixed submission:
from sys import stdin

# N, L = stdin.readline().rstrip()
N, L = map(int, input().split(' '))
# print(N, L)
# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
    
print(summation)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N, L = stdin.readline().rstrip()

# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
    
print(summation)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N, L = stdin.readline().rstrip()

# N, L = 5, 2
# N, L = 3, -1
# N, L = 30, -50

min_value = L
max_value = L + N - 1

summation = L * N + sum(range(N))

if (min_value < 0) and (0 < max_value):
    pass
elif (min_value > 0):
    summation -= min_value
elif (max_value < 0):
    summation -= max_value
Problem p02613 (python)

Fixed submission:
n=int(input())
d={'AC':0,'RE':0,'WA':0,'TLE':0}
for i in range(n):
    s=input().strip()
    d[s]=d[s]+1
print('AC x '+str(d['AC']))
print('WA x '+str(d['WA']))
print('TLE x '+str(d['TLE']))
print('RE x '+str(d['RE']))

Buggy submission (verdict: Runtime Error):
n=int(input())
d={AC:0,RE:0,WA:0,TLE:0}
for i in range(n):
    s=input().strip()
    d[s]=d[s]+1
print('AC x '+str(d[AC]))
print('WA x '+str(d[WA]))
print('TLE x '+str(d[TLE]))
print('RE x '+str(d[RE]))
Problem p02683 (python)

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

A = []
for i in range(n):
    A.append(list(map(int, input().split())))

# print(A)

ans = float("inf")
for i in range(2 ** n):
    skill = [0] * (m+1)
    for j in range(n):
        if ((i >> j) & 1):
            for k in range(m+1):
                skill[k] += A[j][k]


    # print(ans, skill)

    if skill:
        for i in range(1, m+1):
            if x > skill[i]:
                break
        else:
            ans = min(ans, skill[0])

if ans == float("inf"):
    print(-1)
else:
    print(ans)

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

A = [[] for _ in range(n)]
C = [0] * n

for i in range(n):
    c_as = list(map(int, input().split()))
    C[i], A[i] = c_as[0], c_as[1:]

INF = 10 ** 9
ans = INF

for s in range(1<<n):
    smart = [0] * m
    cost_sum = 0
    for i in range(n):
        if (s >> i) % 2 == 0: continue
        cost_sum += C[i]
        for j in range(m):
            smart[j] += A[i][j]

    ok = True
    for i in range(n):
        if x > smart[i]:
            ok = False
    
    if ok:
        ans = min(ans, cost_sum)

print(ans)
Problem p02708 (python)

Fixed submission:
MOD = 10 ** 9 + 7

def calc(a):
    smallest = a * (a-1) // 2
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1 

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

ans = 0
for a in range(k, n+2):
    ans += calc(a)
    ans %= MOD

print(ans)

Buggy submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7

def gauss(n):
    ans = int (n * (n + 1) / 2)
    return(ans) 

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


if k - n == 1:
    print(1)
else:
    a = [0] * (gauss(n)+2)
    t = k
    for i in range(n):
        l = gauss(t-1)
        r = gauss(n) - gauss(n-t)
        a[l] += 1
        a[r+1] -= 1
        t += 1

    for i in range(1, len(a)):
        a[i] += a[i-1]

    print(sum(a) % MOD)
Problem p02719 (python)

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

if n >= k:
    n %= k

print(min(n, k-n))

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

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

if n == 1 or k == 1:
	print(1)
else:
	print(gcd(n, k))

Buggy submission (verdict: Runtime Error):
import math

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

if n == 1 or k == 1:
	print(1)
else:
	print(math.gcd(n, k))
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

# print(sc)

a = ["0" for _ in range(n)]

for i in range(m):
    s, c = sc[i]
    if n == 3 and s == 1 and c == 0:
        print(-1)
        exit()
    if n == 2 and s == 1 and c == 0:
        print(-1)
        exit()
    s -= 1
    c = str(c)
    if a[s] != "0" and a[s] != c:
        print(-1)
        exit()
    a[s] = c

# print(a)
if n == 1 and a[0] == "0":
    pass
elif a[0] == "0":
    a[0] = "1"
ans = int("".join(a))
print(ans)

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

# print(sc)

a = ["0" for _ in range(n)]

for i in range(m):
    s, c = sc[i]
    s -= 1
    if n == 3 and s == 0 and c == 0:
        print(-1)
        exit()
    if n == 2 and s == 1 and c == 0:
        print(-1)
        exit()
    if n == 1 and s == 2 and c == 0:
        print(-1)
        exit()
    c = str(c)
    if i == s and a[i] != "0" and a[i] != c:
        print(-1)
        exit()
    a[s] = c

# print(a)
if a[0] == "0":
    a[0] = 1 
ans = int("".join(a))
print(ans)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
PN = 0
AC_list = [0 for i in range(n)] 
WA_list = [0 for i in range(n)] 

for i in range(m):
    p, s = input().split()
    p = int(p)

    if s == "AC" and AC_list[p-1] == 0:
        PN += WA_list[p-1]
        AC_list[p-1] = 1
    
    else:
        WA_list[p-1] += 1


print(AC_list.count(1), PN)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
PS = {}

for i in range(m):
    res = input()
    res_list = list(res.split())
    if res not in PS:
        PS[res] = 0
        PS[res] += 1
    elif res_list[1] == "WA" and PS[res_list[0]+ " AC"] >= 1:
        pass
    elif res_list[1] == "AC" and PS[res_list[0]+ " AC"] >= 1:
        pass
    else:
        PS[res] += 1


ans = 0
pn = 0
for k, v in PS.items():
    if k[-2:] == "AC":
        ans += 1
    elif k[-2:] == "WA":
        pn += 1

print(ans, pn)
Problem p02814 (python)

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

def f(x):
    res = 0
    while x % 2 == 0:
        x//= 2
        res += 1
    return res

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

def lcm(a, b):
    return a * b // gcd (a, b)

for i in range(n):
    a[i] //= 2

t = f(a[0])

ans = 0
for i in range(n):
    if f(a[i]) != t:
        print(0)
        exit()
    a[i] >>= t

m >>= t

l = 1
for i in range(n):
    l = lcm(l, a[i])
    if l > m:
        print(0)
        exit()

m //= l
ans = (m + 1)//2
print(ans)

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

def f(x):
    res = 0
    while x % 2 == 0:
        x/= 2
        res += 1
    return res

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

def lcm(a, b):
    return a * b // gcd (a, b)

for i in range(n):
    a[i] //= 2

t = f(a[0])

ans = 0
for i in range(n):
    if f(a[i] != t):
        print(0)
        exit()
    a[i] >>= t

m >>= t

l = 1
for i in range(n):
    l = lcm(l, a[i])
    if l > m:
        print(0)
        exit()

m //= l
ans = (m + 1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def f(x):
    res = 0
    while x % 2 == 0:
        x/= 2
        res += 1
    return res

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

for i in range(n):
    a[i] //= 2

t = f(a[0])

ans = 0
for i in range(n):
    if f(a[i] != t):
        print(0)
        exit()
    a[i] >>= t

m >>= t

l = 1
for i in range(n):
    l = lcm(l, a[i])
    if l > m:
        print(0)
        exit()

m //= l
ans = (m + 1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sys

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

def f(x):
    res = 0
    while x % 2 == 0:
        x/= 2
        res += 1
    return res

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

for i in range(n):
    a[i] //= 2

t = f(a[0])

ans = 0
for i in range(n):
    if f(a[i] != t):
        print(0)
        sys.exit(0)
    a[i] >>= t

m >>= t

l = 1
for i in range(n):
    l = lcm(l, a[i])
    if l > m:
        print(0)
        sys.exit(0)

m //= l
ans = (m + 1)//2
print(ans)
Problem p02838 (python)

Fixed submission:
import numpy as np

N = int(input())
A = np.array(input().split(),np.int64)
MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
    c = np.count_nonzero((A>>i)&1)
    ans += (2 ** i) * c * (N - c)

print(ans%MOD)

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

N = int(input())
A = np.array(input().split(),np.int64)
MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
    c = np.count_nonzero((A>>i)&1)
    ans += (2 ** i) * c * (N - c)

print(ans%MOD)
Problem p02865 (python)

Fixed submission:
n = int(input())

if n % 2 == 0:
  ans = n / 2 - 1
else:
  ans = n / 2
  
print(int(ans))

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
d = list(map(int, input().split()))

c = collections.Counter(d)

jug = True
for i in range(max(d) + 1):
    if i not in c:
        jug = False

c = sorted(c.items(), key=lambda x:x[0])

if c[0][0] != 0:
    jug = False

ans = 1

for i in range(1, len(c)):
    if c[i][0] < 0:
        jug == False
    m = c[i-1][1]
    r = c[i][1]
    ans *= m ** r
    ans %= 998244353
    if ans == 0:
        jug = False
    
if jug == False:
    print(0)
else:
    print(ans)
Problem p02866 (python)

Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))

c = collections.Counter(d)

ans = 1

if c[0] != 1 or d[0] !=0:
    ans = 0

for i in range(max(d) + 1):
    if i == 0:
        continue
    ans *= c[i-1] ** c[i]

print(ans%998244353)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
d = list(map(int, input().split()))

c = collections.Counter(d)

jug = True
for i in range(max(d) + 1):
    if i not in c:
        jug = False

c = sorted(c.items(), key=lambda x:x[0])

ans = 1

if c[0][0] != 0:
    jug = False
else:
    for i in range(max(d)):
        if c[i][0] < 0:
            jug == False
        else:
            m = c[i][1]
            r = c[i+1][1]
            ans *= m ** r
            ans %= 998244353
            if ans == 0:
                jug = False
  
if jug == False:
    print(0)
else:
    print(ans)
Problem p02901 (python)

Fixed submission:
N, M = map(int, input().split())
INF = 1001001001
key = []

for i in range(M):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    s = 0
    for j in range(b):
        c[j] -= 1
        s |= 1 << c[j]
    key.append([s, a])

dp = [INF] * (1<<N)
dp[0] = 0
for s in range(1<<N):
    for i in range(M):
        t = s | key[i][0]
        cost = dp[s] + key[i][1]
        dp[t] = min(dp[t], cost)

if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
INF = 1001001001
key = []

for i in range(M):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    s = 0
    for j in range(b):
        c[j] -= 1
        s |= 1 << c[j]
    key.append([s, a])

dp = [INF] * (1<<N)
dp[0] = 0
for s in range(1<<N):
    for i in range(M):
        print(dp)
        t = s | key[i][0]
        cost = dp[s] + key[i][1]
        dp[t] = min(dp[t], cost)
ans = dp[-1]
print(ans)
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
m = list(range(1, n+1))

print(sum(m)-m[-1])
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, Q = map(int, input().split())
 
AB = [[int(x) for x in input().split()] for _ in range(N-1)] 
PX = [[int(x) for x in input().split()] for _ in range(Q)] 
 
graph = [[] for _ in range(N+1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p, x in PX:
    value[p] +=x
 
def dfs(v, parent, add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x, v, value[v])
 
dfs(1, 0, 0)
ans = ' '.join(map(str,value[1:]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
 
AB = [[int(x) for x in input().split()] for _ in range(N-1)] 
PX = [[int(x) for x in input().split()] for _ in range(Q)] 
 
graph = [[] for _ in range(N+1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p, x in PX:
    value[p] +=x
 
def dfs(v, parent, add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x, v, value[v])
 
dfs(1, 0, 0)
ans = ' '.join(map(str,value[1:]))
print(ans)

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

AB = [[int(x) for x in input().split()] for _ in range(N-1)] 
PX = [[int(x) for x in input().split()] for _ in range(Q)] 

graph = [[] for _ in range(N+1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p, x in PX:
    value[p] +=x

def dfs(v, parent, add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x, v, value[v])

dfs(1, 0, 0)
ans = ' '.join(map(str,value[1:]))
print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())

print(3 * r ** 2)

Buggy submission (verdict: Runtime Error):
n =int(input())
a = list()
 
for _ in range(n):
    a.append(int(input()))
 
b = sorted(a)
 
for i in range(n):
    if a[i] == max(a):
        print(b[-2]) 
    else:
        print(max(a))
Problem p02982 (python)

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

a = [list(map(int, input().split())) for _ in range(n)]


ans = 0
for i in range(n):
    for j in range(i+1, n):
        l = 0
        for k in range(d):
            l += (a[i][k] - a[j][k]) ** 2
        if (l ** .5).is_integer(): ans += 1

print(ans)

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

a = [list(map(int, input().split())) for _ in range(n)]


ans = 0
for i in range(n):
    for j in range(i+1, n):
        l = 0
        for k in range(d):
            l += (a[i][k] - a[j][k]) ** 2
        l = sympy.sqrt(l)
        if l.is_Integer: ans += 1

print(ans)
Problem p02988 (python)

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

ans = 0
for i in range(1, n-1):
	if p[i-1] < p[i] and p[i] < p[i+1]:
		ans += 1
	elif p[i-1] > p[i] and p[i] > p[i+1]:
		ans += 1
	
print(ans)

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

ans = 0
for i in range(1, n):
	if p[i-1] < p[i] and p[i] < p[i+1]:
		ans += 1
		
print(ans)
Problem p03103 (python)

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

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

AB = sorted(AB)


sum = 0
ans = 0
for i in range(N):
    sum += AB[i][1]
    ans += AB[i][1] * AB[i][0]
    if sum >= M:
        ans -= (sum - M) * AB[i][0]
        break

print(ans)

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

for _ in range(N):
    a, b = map(int, input().split())
    AB.setdefault(a, b)

AB = sorted(AB.items(), key=lambda x:x[0])

sum = 0
ans = 0
for i in range(N):
    sum += AB[i][1]
    ans += AB[i][1] * AB[i][0]
    if sum > M:
        ans -= (sum - M) * AB[i][0]
        break

print(ans)
Problem p03282 (python)

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

ans = "1"
for i in range(K):
    if S[i] != "1":
        ans = S[i]
        break

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
INF = 5 * 10 ** 16

if S[0] == "1":
    if K <= int(S[1]) * 5 * 10 ** 15 + 1:
        print(S[1])
    else:
        print(S[2])
else:
    if K <= int(S[0]) * 5 * 10 ** 15:
        print(S[0])
    else:
        print(S[1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
INF = 5 * 10 ** 16

if S[0] == "1":
    if K <= int(S[1]) * 5 * 10 ** 16 + 1:
        print(S[1])
    else:
        print(S[2])
else:
    if K <= int(S[0]) * 5 * 10 ** 16 + 1:
        print(S[0])
    else:
        print(S[1])
Problem p03369 (python)

Fixed submission:
S = input()

price = 700

if S[0] == "o": price += 100
if S[1] == "o": price += 100
if S[2] == "o": price += 100

print(price)

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
M = []
S = 0
mini = X
for i in range(N):
    M.append(int(input()))
    S += M[i]
    if mini > M[i]:
        mini = M[i]

ans = 0
ans = N + int((X - S) / mini)

print(ans)
Problem p03393 (python)

Fixed submission:
s = input()

if len(s) < 26:
    a = [0 for _ in range(26)]

    for i in range(len(s)):
        a[ord(s[i]) - ord("a")] += 1

    ans = s
    for i in range(26):
        if a[i] == 0:
            ans += chr(i+ord("a"))
            break

    print(ans)
    exit()


for i in range(24,-1,-1):
    for j in range(25,i,-1):
        if s[i]<s[j]:
            print(s[:i]+s[j])
            exit()

print(-1)

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

if len(s) > 26:
    a = [0 for _ in range(26)]

    for i in range(len(s)):
        a[ord(s[i]) - ord("a")] += 1

    ans = s
    for i in range(26):
        if a[i] == 0:
            ans += chr(i+ord("a"))
            break

    print(ans)
    exit()


for i in range(24,-1,-1):
    for j in range(25,i,-1):
        if s[i]<s[j]:
            print(s[:i]+s[j])
            exit()

print(-1)

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

if len(s) > 26:
    a = [0 for _ in range(26)]

    for i in range(len(s)):
        a[ord(s[i]) - ord("a")] += 1

    ans = s
    for i in range(26):
        if a[i] == 0:
            ans += chr(i+ord("a"))
            break

    print(ans) 


for i in range(24,-1,-1):
    for j in range(25,i,-1):
        if s[i]<s[j]:
            print(s[:i]+s[j])
            exit()

print(-1)
Problem p03403 (python)

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

b = [0] + a + [0]
c = []
for i in range(n+1):
    c.append(abs(b[i] - b[i+1]))

l = sum(c)

for i in range(n):
    ans = l - c[i] - c[i+1]
    ans += abs(b[i] - b[i+2])
    print(ans)

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

b = [0] + a + [0]
c = []
for i in range(n+1):
    c.append(abs(b[i] - b[i+1]))

for i in range(n):
    ans = l - c[i] - c[i+1]
    ans += abs(b[i] - b[i+2])
    print(ans)