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

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

D_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

for i in range(N):
    d = D[i]
    if D_dic[d]:
        a = D_dic[d] + 1
        D_dic[d] = a
    else:
        D_dic[d] = 1
    
for j in range(M):
    t = T[j]
    if T_dic[t]:
        b = T_dic[t] + 1
        T_dic[t] = b
    else:
        T_dic[t] = 1

cou = 0
if N >= M:
    for k in range(M):
        tk = T[k]
        try:
            if D_dic[tk]:
                c = D_dic[tk] - 1
                D_dic[tk] = c
                cou += 1
            else:
                x = 'NO'
                break
        except KeyError:
            x = 'NO'
            break
            
    if cou == M:
        x = 'YES'
else:
    x = 'NO'

print(x)

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

D_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

for i in range(N):
    if D_dic[D[i]]:
        a = D_dic[D[i]] + 1
        D_dic[D[i]] = a
    else:
        D_dic[D[i]] = 1
    
for j in range(M):
    if T_dic[T[j]]:
        b = T_dic[T[j]] + 1
        T_dic[T[j]] = b
    else:
        T_dic[T[j]] = 1

cou = 0
if N >= M:
    for k in range(M):
        if D_dic[T[k]]:
            c = D_dic[T[k]] - 1
            D_dic[T[k]] = c
            cou += 1
        else:
            x = 'NO'
            break
            
    if cou == M:
        x = 'YES'
else:
    x = 'NO'

print(x)
Problem p04047 (python)

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

L.sort()
ans = 0
for i in range(0, 2*n, 2):
    ans += min(L[i], L[i+1])

print(ans)

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

L.sort()
ans = 0
for i in range(0, 2*N, 2):
    ans += min(L[i], L[i+1])

print(ans)
Problem p03455 (python)

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

if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

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

if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03472 (python)

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

max_a = max(l, key=lambda x: x[0])[0]
l = [[a, b] for a, b in l if b > max_a]
l.sort(key=lambda x: x[1], reverse=True)

c = 0
for a, b in l:
  h -= b
  c += 1
  if h <= 0:
    print(c)
    exit()

print(c + h // max_a + (h % max_a != 0))

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

max_a = max(l, key=lambda x: x[0])[0]

l = [[a, b] for a, b in l if b > max_a]
l.sort(key=lambda x: x[1], reverse=True)
n = len(l)

c = 0
for i in range(n - 1):
  a, b = l[i]
  if a == max_a and l[i + 1][0] < max_a:
    l = l[i:]
    break
  h -= b
  c += 1
  if h <= 0:
    print(c)
    exit()
else:
  l = l[-1:]

last_a = l[0][0]
if l[0][1] >= h:
  print(c + 1)
else:
  for a, b in l[1:]:
    if b < last_a:
      break
    else:
      h -= b
      c += 1
      if h <= 0:
        print(c)
        exit()
  h -= l[0][1]
  c += 1
  print(c + h // last_a + (h % last_a != 0))
Problem p03504 (python)

Fixed submission:
N, C = map(int, input().split())
TV = [list(map(int, input().split())) for _ in range(N)]

TV = sorted(TV, key=lambda x: x[1])

rec = [0] * (10 ** 5 + 1)
cs =  [set() for _ in range(10 ** 5 + 1)]

for s, t, c in TV:
    rec[t] -= 1
    if c not in cs[s]:
        rec[s - 1] += 1
    else:
        rec[s] += 1
    cs[t].add(c)

rec_s = [rec[0]]
for r in rec[1:]:
    rec_s.append(rec_s[-1] + r)

print(max(rec_s))

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
TV = [list(map(int, input().split())) for _ in range(N)]

TV = sorted([l for l in TV], key=lambda x: x[0])

X = []
for c in range(1, C + 1):
    TV_temp = [l for l in TV if l[2] == c]
    TV_T = list(zip(*TV_temp))
    l = []
    for tv in TV_temp:
        if tv[1] in TV_T[0]:
            i = TV_T[0].index(tv[1])
            l.append([tv[0], TV_T[1][i], c])
            TV_temp.pop(i)
        else:
            l.append(tv)
    
    X.extend(l)

TV = sorted([[l[0] - 0.5, l[1], l[2]] for l in X], key=lambda x: x[1])

c = 0
while TV:
    c += 1
    end = 0
    l_rem = []
    for i, tv in enumerate(TV):
        if tv[0] >= end:
            end = tv[1]
            l_rem.append(i)
    for i in reversed(l_rem):
        TV.pop(i)

print(c)
Problem p03682 (python)

Fixed submission:
import heapq

N = int(input())
iXY = [[i] + list(map(int, input().split())) for i in range(N)]
G = [set() for _ in range(N)]

iXY.sort(key=lambda a: a[1])
for i in range(1, N):
  i0, x0, y0 = iXY[i - 1]
  i1, x1, y1 = iXY[i]
  G[i0].add((i1))
  G[i1].add((i0))

iXY.sort(key=lambda a: a[2])
for i in range(1, N):
  i0, x0, y0 = iXY[i - 1]
  i1, x1, y1 = iXY[i]
  G[i0].add((i1))
  G[i1].add((i0))

Q = [(0, 0)]
B = set()
a = 0
iXY.sort()

while True:
  d, v = heapq.heappop(Q)
  while v in B:
     d, v = heapq.heappop(Q)
  a += d
  B.add(v)
  if len(B) == N:
    break
  for i in G[v]:
    if i not in B:
      heapq.heappush(Q, (min(abs(iXY[v][1] - iXY[i][1]), abs(iXY[v][2] - iXY[i][2])), i))
print(a)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix

N = int(input())
iXY = [[i] + list(map(int, input().split())) for i in range(N)]

P = []
for j in [1, 2]:
  iXY.sort(key=lambda a: a[j])
  for i in range(1, N):
    i0, x0, y0 =  iXY[i - 1]
    i1, x1, y1 =  iXY[i]
    P.append((min(abs(x1 - x0), abs(y1 - y0)), i0, i1))

d, i, j = zip(*P)
G = csr_matrix((d, (i, j)))
mst = minimum_spanning_tree(G)
print(int(mst.sum()))
Problem p03732 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [{} for i in range(N + 1)]
def cal(i, w):
  if w in M[i]:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

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

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

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

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Buggy submission (verdict: Runtime Error):
N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	min1 = min(a,b)
	min2 = min(c,d)
	print(min1+min2)

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	min1 = min(a,b)
	min2 = min(c,d)
	print(min1+min2)

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	print(min(a,b)+min(c,d))

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
data = list(map(int(),input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]
 
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]

print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]

print(min(a,b)+min(c,d))
Problem p03280 (python)

Fixed submission:
n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()

Buggy submission (verdict: Runtime Error):
n,m=input().split("  ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)

Buggy submission (verdict: Runtime Error):
m=int(input())
n=int(input())
multi=(m*n)-(m+n)+1
print(multi)
print()

Buggy submission (verdict: Runtime Error):
m=int(input("縦の長さ:"))
n=int(input("横の長さ:"))
multi=(m-1)*(n-1)
print(multi)
print()

Buggy submission (verdict: Runtime Error):
m=int(input("縦の長さ:"))
n=int(input("横の長さ:"))
multi=(m-1)*(n-1)
print(multi)
Problem p03674 (python)

Fixed submission:
def power(x, n):
    y = 1
    while n > 0:
        if n % 2 == 0:
            x = (x * x) % (10 ** 9 + 7)
            n = n // 2
        else:
            y = (y * x) % (10 ** 9 + 7)
            n = n - 1
    return y


MOD = 10 ** 9 + 7

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

fact = [1] * (n + 2)
inv = [1] * (n + 3)

for i in range(1, n + 2):
    fact[i] = (i * fact[i - 1]) % MOD
    inv[i] = power(fact[i], MOD - 2) % MOD


def nCm(n, m):
    global fact
    global inv
    return fact[n] * inv[m] % MOD * inv[n - m] % MOD


saw = [-1] * n
left = 0
right = 0
for i in range(n):
    if saw[a[i] - 1] == -1:
        saw[a[i] - 1] = i
    else:
        left, right = saw[a[i] - 1], n - i
        break

for i in range(1, n + 2):
    if i == 1:
        print(n)
    elif left + right >= i - 1:
        print((nCm(n + 1, i) - nCm(left + right, i - 1)) % MOD)
    else:
        print(nCm(n + 1, i))

Buggy submission (verdict: Runtime Error):
import math

def nCm(n, m):
    return math.factorial(n) // (math.factorial(m) * (math.factorial(n - m)))


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

saw = [-1] * n
left = 0
right = 0
for i in range(n):
    if saw[a[i] - 1] == -1:
        saw[a[i] - 1] = i
    else:
        left, right = saw[a[i] -1], n - i
        break
print(left, right)

for i in range(1, n+2):
    if i == 1:
        print(n)
    else:
        print((nCm(n+1, i) - nCm(left+right, i - 1) % 1000000007))

Buggy submission (verdict: Runtime Error):
import math

def nCm(n, m):
    return fact(n) // (fact(m) * (fact(n - m)))


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

saw = [-1] * n
left = 0
right = 0
for i in range(n):
    if saw[a[i] - 1] == -1:
        saw[a[i] - 1] = i
    else:
        left, right = saw[a[i] -1], n - i
        break
print(left, right)

for i in range(1, n+2):
    if i == 1:
        print(n)
    else:
        print((nCm(n+1, i) - nCm(left+right, i - 1) % 1000000007))

Buggy submission (verdict: Runtime Error):
import math

def nCm(n, m):
    return fact(n) // (fact(m) * (fact(n - m)))


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

saw = [-1] * n
left = 0
right = 0
for i in range(n):
    if saw[a[i] - 1] == -1:
        saw[a[i] - 1] = i
    else:
        left, right = saw[a[i] -1], n - i
        break
print(left, right)

for i in range(1, n+2):
    if i == 1:
        print(n)
    else:
        print((nCm(n+1, i) - nCm(left+right, i - 1) % 1000000007)
Problem p03682 (python)

Fixed submission:
import sys

import numpy as np


class Graph:
    def __init__(self, N):
        self.townarrow = [i for i in range(N)]

    def find(self, x):
        if x == self.townarrow[x]:
            return x
        else:
            self.townarrow[x] = self.find(self.townarrow[x])
            return self.townarrow[x]

    def union(self, x, y):
        self.link(self.find(x), self.find(y))

    def link(self, x, y):
        self.townarrow[y] = x


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

useful_road = []

l = sorted(range(N), key=lambda j: x[j])
for i in range(len(l) - 1):
    cost = min(abs(x[l[i]] - x[l[i + 1]]), abs(y[l[i]] - y[l[i + 1]]))
    useful_road.append((cost, l[i], l[i + 1]))

l = sorted(range(N), key=lambda j: y[j])
for i in range(len(l) - 1):
    cost = min(abs(x[l[i]] - x[l[i + 1]]), abs(y[l[i]] - y[l[i + 1]]))
    useful_road.append((cost, l[i], l[i + 1]))


m = 0
cost = 0
towngroup = Graph(N)
for c, i, j in sorted(useful_road):
    if towngroup.find(i) == towngroup.find(j):
        continue
    cost += c
    m += 1

    towngroup.union(i, j)

    if m == N - 1:
        print(cost)
        sys.exit()

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

import sys

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

howmuch = np.zeros((N, N))

towngroup = np.array(list(range(N)))

for i in range(N):
    for j in range(i, N):
        howmuch[i][j] = min(abs(x[i] - x[j]), abs(y[i] - y[j]))

cheapbridge = np.argsort(howmuch.flatten())

cost = 0

for i in cheapbridge[(N*(N+1))//2:]:
    a = i // N
    b = i % N
    if towngroup[a] == towngroup[b]:
        continue

    cost += min(abs(x[a] - x[b]), abs(y[a] - y[b]))

    towngroup[towngroup == towngroup[b]] = towngroup[a]

    if len(set(towngroup)) == 1:
        print(cost)
        sys.exit()

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

import sys

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

howmuch = np.zeros((N, N))

towngroup = np.array(list(range(N)))

for i in range(N):
    for j in range(i, N):
        howmuch[i][j] = min(abs(x[i] - x[j]), abs(y[i] - y[j]))

cheapbridge = np.argsort(howmuch.flatten())

cost = 0

for i in cheapbridge[(N*(N+1))//2:]:
    a = i // N
    b = i % N
    if towngroup[a] == towngroup[b]:
        print('hoooo')
        continue

    cost += min(abs(x[a] - x[b]), abs(y[a] - y[b]))

    towngroup[towngroup == towngroup[b]] = towngroup[a]

    if len(set(towngroup)) == 1:
        print(cost)
        sys.exit()
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())

if (g * 10 + b) % 4 == 0:
    print('YES')
else:
    print('NO')

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

output = ''

start = 0
end = 0
for i in S:
    if i == '(':
        if end > 0:
            output = '(' * end + output
            output += ')' * end
            end = 0
            start += 1
            output += i
        else:
            start += 1
            output += i
    else:
        if start > 0:
            start -= 1
            output += i
        else:
            end += 1

for i in range(start):
    output += ')'

for i in range(end):
    output += ')'

output = '(' * end + output

print(output)
Problem p03827 (python)

Fixed submission:
N = int(input())
S = input()
x = 0
 
max = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    if x > max:
        max = x
 
print(max)

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

max = 0
for i in range(N):
    if S[i] == ‘I’:
        x += 1
    else:
        x -= 1
    if x > max:
        max = x

print(max)
Problem p02911 (python)

Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):
    p[a[i] - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):

    p[a - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')
Problem p02921 (python)

Fixed submission:
s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().sprit()))
t = list(map(int, input().sprit()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 0
print(ans)
Problem p02922 (python)

Fixed submission:
a, b = list(map(int, input().split()))
ans = 0
cnt = 1;
while cnt < b:
    cnt += a-1
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
ans = 1
cnt = a;
while True:
  	if ans == 21:
        break
    if cnt >= b:
        break
    cnt += a-1
    ans += 1
print(ans)
Problem p03037 (python)

Fixed submission:
n, m = list(map(int, input().split()))
maxl = 0
minr = 1000000
for i in range(m):
    l, r = list(map(int, input().split()))
    maxl = max(maxl, l)
    minr = min(minr, r)
if minr < maxl:
    print(0)
else:
    print(minr - maxl + 1)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
l = []
r = []
for i in range(m):
    x, y=[int(i) for i in input().split()]
    l.append(x)
    r.append(y)
ans = 0
for i in range(n):
    cnt = 0
    for j in range(m):

        for k in range(l[j], r[j]+1):S
            if i + 1 == k:
                cnt += 1
        if cnt == m:
            ans += 1
print(ans)
Problem p02886 (python)

Fixed submission:
N=int(input())
d=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)

Buggy submission (verdict: Runtime Error):
N=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)
Problem p02909 (python)

Fixed submission:
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
elif S=='Rainy':
    print('Sunny')

Buggy submission (verdict: Runtime Error):
input(S)
if S=Sunny:
  print('Cloudy')
elif S=Cloudy:
  print('Rainy')
elif S=Rainy:
  print('Sunny')
Problem p02885 (python)

Fixed submission:
### A - Curtain ###
A, B = map(int, input().split())
print(A-B*2 if A-B*2 > 0 else 0)

Buggy submission (verdict: Runtime Error):
### D - Triangles ###

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

# N = 7
# L = [218, 786, 704, 233, 645, 728, 389]

L.sort()

from itertools import combinations

cb = combinations(L, 2)
cb = list(map(sorted, cb))

rslt = 0

for el_cb in cb:
    for v in L:
        if el_cb[1] - el_cb[0] <= v and el_cb[0] >= v:
            rslt = rslt + 1

# if のところに2分探索入れる

print(rslt)

Buggy submission (verdict: Runtime Error):
from multiprocessing import Pool

### D - Triangles ###
 
N = int(input())
L = list(map(int, input().split()))
 
from itertools import combinations
 
cb = combinations(L, 3)
 
def my_def(x):
    if x[1] + x[2] > x[0]:
        if x[0] + x[2] > x[1]:
            if x[0] + x[1] > x[2]:
                return(1)
    return(0)
 
print(sum(list(map(my_def, cb))))

Buggy submission (verdict: Runtime Error):
### D - Triangles ###

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

# N = 7
# L = [218, 786, 704, 233, 645, 728, 389]

from itertools import combinations

cb = list(combinations(L, 3))

my_lambda = lambda x : x[0] + x[1] > x[2] and x[1] + x[2] > x[0] and x[0] + x[2] > x[1]

print(sum(
        list(
            map(my_lambda, cb)
        )
    )
)
Problem p02887 (python)

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

rslt = [S[0]]
S = [i for i in S[1:]]

for i in S:
    if rslt[-1] != i:
        rslt.extend(i)

print(len(rslt))

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

rslt = [S[0]]
S = [i for i in S[1:]]

for i in S:
    if rslt[-1] != i:
        rslt.extend(i)

len(rslt)'abcd'[-1]
Problem p03035 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
C=int(b/2)
if a>=13:
  print(b)
elif a<13 and a>=6:
  print(C)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  z=x*z-y
  print(z)

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  z=x*z-y
  print(z)

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  d=x*z-y
  print(d)
  z=d

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  d=x*z-y
  print(d)
  z=d

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(11):
  d=x*z-y
  print(d)
  z=d

Buggy submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
i=0
while i<10:
  d=x*z*-y
  print(d)
  i+=1
Problem p03087 (python)

Fixed submission:
n,q = map(int, input().split())
s = list(input())
lr_list = [list(map(int,input().split())) for _ in range(q)]
tmp_list = [0]*(n+1)

for i in range(1,n):
    if s[i-1]=='A' and s[i]=='C':
        tmp_list[i] = tmp_list[i-1]+1
    else:
        tmp_list[i] = tmp_list[i-1]

for l,r in lr_list:
    print(tmp_list[r-1]-tmp_list[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = list(input())
lr_list = [list(map(int,input().split())) for _ in range(q)]
tmp_list = [0]*(n+1)
 
for i in range(n):
    if s[i]=='A' and s[i+1]=='C':
        tmp_list[i+1] = tmp_list[i]+1
    else:
        tmp_list[i+1] = tmp_list[i]
        
for l,r in lr_list:
    print(tmp_list[r-1]-tmp_list[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = list(input())
lr_list = [list(map(int,input().split())) for _ in range(q)]
tmp_list = [0]*(n+1)

for i in range(n):
    if s[i]=='A' and s[i+1]=='C':
        tmp_list[i+1] = tmp_list[i]+1
    else:
        tmp_list[i+1] = tmp_list[i]
        
for l,r in lr_list:
    print(tmp_list[r-1]-tmp_list[l-1])
Problem p03139 (python)

Fixed submission:
n,a,b = map(int, input().split())
min_num = 0
max_num = 0

if a == n or b == n:
    min_num = min(a,b)
    max_num = min(a,b)
elif a == b and a == n:
    min_num = n
    max_num = n
elif a == 0 or b == 0:
    pass
elif n >= a + b:
    max_num = min(a,b)
elif n < a + b:
    min_num = abs(n-a-b)
    max_num = min(a,b)

print(max_num, min_num)

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

if a == b and a == n:
    min_num = n
    max_num = n
elif a == n or b == n
    min_num = min(a,b)
    max_num = min(a,b)
elif a == 0 or b == 0:
    pass
elif n >= a + b:
    max_num = min(a,b)
elif n < a + b:
    min_num = abs(int(n/2)-max(a,b))
    max_num = min(a,b)

print(max_num, min_num)