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

Fixed submission:
n = int(input())
machi = []
li_x = []
li_y = []
for i in range(n):
    x, y = map(int, input().split())
    li_x.append((x, i))
    li_y.append((y, i))
    machi.append((x, y, i))
li_x.sort()
li_y.sort()
edge = [[] for _ in range(n)]
for i in range(n-1):
    edge[li_x[i][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i+1][1]))
    edge[li_x[i+1][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i][1]))
    edge[li_y[i][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i+1][1]))
    edge[li_y[i+1][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i][1]))

import heapq
def prim_heap(edge, n):
    used = [True] * n # True ：　不使用husiyou
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist, e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist, e)
        res += minedge[0]
    return res
print(prim_heap(edge, n))

Buggy submission (verdict: Runtime Error):
n = int(int, input().split())
machi = []
li_x = []
li_y = []
for i in range(n):
    x, y = map(int, input().split())
    li_x.append((x, i))
    li_y.append((y, i))
    machi.append((x, y, i))
li_x.sort()
li_y.sort()
edge = [[] for _ in range(n)]
for i in range(n-1):
    edge[li_x[i][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i+1][1]))
    edge[li_x[i+1][1]].append((li_x[i+1][0]-li_x[i][0], li_x[i][1]))
    edge[li_y[i][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i+1][1]))
    edge[li_y[i+1][1]].append((li_y[i+1][0]-li_y[i][0], li_y[i][1]))

import heapq
def prim_heap(edge, n):
    used = [True] * n # True ：　不使用husiyou
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist, e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist, e)
        res += minedge[0]
    return res
print(prim_heap(edge, n))
Problem p02641 (python)

Fixed submission:
X, N = [int(i) for i in input().split()]
if N==0:
    print(X)
    quit()
P = list(set(range(-10, 110)) - {int(i) for i in input().split()})
# X = 10
# P = list(set(range(-10, 110)) - set(range(1, 101)))

P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])

Buggy submission (verdict: Runtime Error):
X, N = [int(i) for i in input().split()]
if N==0:
    P = list(range(1, 101))
else:
    P = list(set(range(1, 101)) - {int(i) for i in input().split()})
P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])
Problem p02741 (python)

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

Buggy submission (verdict: Runtime Error):
H, W = [int(i) for i in input().split()]

if H==1 or W==1:
    print(1)
    quit()
if H%2==0:
    H //= 2
    print(H*W)
elif W%2==0:
    W //= 2
    print(H*W)
else:
    W -= 1
    c = (W//2)*H
    c += H//2 + 1
    print(c)
Problem p02748 (python)

Fixed submission:
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = mina+minb
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+b[y]-c)


print(minv)

Buggy submission (verdict: Runtime Error):
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = mina+minb
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+a[y]-c)


print(minv)

Buggy submission (verdict: Runtime Error):
A, B ,M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
mina, minb = min(a), min(b)
minv = 10000000000
for _ in range(M):
    x, y, c = [int(i) for i in input().split()]
    x -= 1
    y -= 1
    minv = min(minv, a[x]+a[y]-c)


print(min(minv, mina+minb))
Problem p02812 (python)

Fixed submission:
n = int(input())
S=input()
c=0
for i in range(n-2):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
S=input()
c=0
for i in range(n):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                c+=1
print(c)
Problem p02838 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*64
for i in range(n):
    for j in range(a[i].bit_length()):
        if a[i]>>j & 1: b[j]+=1
c=0
for i in range(64):
    c+=(b[i]*(n-b[i])*2**i) % 1000000007
print(c%1000000007)

Buggy submission (verdict: Runtime Error):
from math import ceil, log2
n=int(input())
a=list(map(int,input().split()))
b=[0]*64
for i in range(n):
    for j in range(ceil(log2(a[i]))):
        if a[i]>>j & 1: b[j]+=1
c=0
for i in range(64):
    c+=b[i]*(n-b[i])*2**i
print(c%(10**9+7))
Problem p02934 (python)

Fixed submission:
import numpy as np
n=int(input())
a=np.array([int(i) for i in input().split()])
a = 1/a
print(1/sum(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array([int(i) for i in input().split()])
a = 1/a
print(1/(sum(a))
Problem p02936 (python)

Fixed submission:
N, Q = [int(i) for i in input().split()]
G = [[] for _ in range(N)]
counter = [0] * N
res = [0] * N
visited = [0] * N

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

for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    p -= 1
    counter[p] += x

# def dfs(G, v, p):
#     visited[v] = 1
#     res[v] = res[p]+counter[v]
#     for nv in G[v]:
#         if visited[nv]: continue
#         dfs(G, nv, v)

stack = [0]
parent = [0]
while stack:
    v = stack.pop()
    p = parent.pop()
    visited[v] = 1
    res[v] = res[p]+counter[v]
    for nv in G[v]:
        if visited[nv]: continue
        stack.append(nv)
        parent.append(v)

# dfs(G, 0, 0)
print(*res)

Buggy submission (verdict: Runtime Error):
N, Q = [int(i) for i in input().split()]
G = [[] for _ in range(N)]
counter = [0] * N
res = [0] * N
visited = [0] * N

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

for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    p -= 1
    counter[p] += x

def dfs(G, v, p):
    visited[v] = 1
    res[v] = res[p]+counter[v]
    for nv in G[v]:
        if visited[nv]: continue
        dfs(G, nv, v)

dfs(G, 0, 0)
print(*res)
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]
aa=sorted(list(set(a[:])),reverse=True)
maxa=aa[0]
f=False if a.count(maxa) != 1 else True
for i in range(n):
    if a[i] == maxa and f:
        print(aa[1] if len(aa) != 1 else maxa)
    else:
        print(maxa)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]
aa=sorted(list(set(a[:])),reverse=True)
maxa=aa[0]
for i in range(n):
    if a[i] == maxa:
        print(aa[1])
    else:
        print(maxa)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]
aa=sorted(a[:])
for i in range(n):
  k=a[i]
  t=-1
  while True:
    if aa[t] != k:
      print(aa[t])
      break
    else: t -= 1

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]
aa=sorted(a[:])
for i in range(n):
  k=a[i]
  t=-1
  while True:
      if aa[t] != k:
          print(aa[t])
          break
      else: t -= 1
Problem p02995 (python)

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

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

a,b,c,d=map(int,input().split())
e=lcm(c,d)

cc=(b//c)-((a-1)//c)
dd=(b//d)-((a-1)//d)
cd=(b//e)-((a-1)//e)
print((b-a+1)-(cc+dd-cd))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a

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

e=lcm(c,d)
a,b,c,d=map(int,input().split())
print((b-a+1)-(b//c-a//c)-(b//d-a//d)+(b//e-a//e))
Problem p03001 (python)

Fixed submission:
W,H,x,y=map(int,input().split())
ways=1 if (W/2 == x) and (H/2 == y) else 0
print(W*H/2,ways)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())

if w/2 == x and h/2 == y:
  way=1
  s=w*h/2

elif (x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h):
  way=0
  s=w*h/2

elif y/x == h/w:
  way=0
  s=w*h/2

else:
  oy,yh,ox,xw=y,h-y,x,w-x
  yoko=min(oy*w,yh*w)
  tate=min(ox*h,xw*h)
  way=0
  s=max(yoko,tate)

print(float(s),way)
Problem p03035 (python)

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

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(b if A >= 13 else int(b/2) if 12 >= A >= 6 else 0)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(b if A >= 13 else int(b/2) if A >= 6 else 0)
Problem p03037 (python)

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

maxL = float("-inf")
minR = float("inf")

for i in range(m):
    l, r = [int(i) for i in input().split()]
    maxL, minR = max(maxL, l), min(minR, r)

print(max(0, minR - maxL + 1))

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
a=[]
for i in range(m):
    l,r=[int(i) for i in input().split()]
    a.append(set(range(l,r+1)))
for i in range(m):
  a[0]=a[0] & a[1]
print(len(a))
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=0
y=0
l=[v[j]-c[j] for j in range(n)]
l.sort(reverse=True)
l=filter(lambda x:x >0,l)
print(sum(l))

Buggy submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [X[i] - Y[i] for i in range(N)]
D = filter(lambda x: x > 0, D)
print(sum(D))
Problem p03068 (python)

Fixed submission:
n = int(input())
s = input()
k = int(input())
m = s[k-1]

for i in range(n):
  if s[i] != m:
    s = s.replace(s[i], "*")
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
m = s[k-1]

for i in range(n):
  if s[i] != m:
    s[i] = "*"
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
m = s[k-1]

for i in range(n):
  if s[i] != m:
    s[i] = "*"
Problem p03071 (python)

Fixed submission:
A,B = map(int, input().split())
c=0
if max(A, B) -2 >= min(A,B):
  c = max(A,B) + max(A,B) - 1
else:
  c = A+B
print(c)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
c=0
if max(A, B) -2 >= min(A,B):
  c = max(A,B) + max(A,B) - 1
else:
  c = sum(A,B)
print(c)
Problem p03126 (python)

Fixed submission:
# 入力
N, M = [int(i) for i in input().split()]

# カウント用の配列
count = [0] * M

for i in range(N):  # 入力しながら
    _, *A = [int(i)-1 for i in input().split()]
    for j in A:     # 数える
        count[j] += 1

res = 0
for i in count:
    if i == N: res += 1

print(res)

Buggy submission (verdict: Runtime Error):
# 入力
N, M = [int(i) for i in input().split()]

# カウント用の配列
count = [0] * (M-1)

for i in range(N):  # 入力しながら
    _, *A = [int(i)-1 for i in input().split()]
    for j in A:     # 数える
        count[j] += 1

res = 0
for i in count:
    if i == N: res += 1

print(res)
Problem p03136 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
print("Yes" if max(L) < sum(L)-max(L) else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int, input().split()))
m=pop(max(l))
print("Yes" if m < sum(l) else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
print("Yes" if pop(index(max(L))) < sum(L) else "No")
Problem p03150 (python)

Fixed submission:
S = [i for i in list(input())]
N = len(S)
k = [i for i in list('keyence')]

for d in range(N-6):
    for i in range(N-(d-1)):
        s = S[:i] + S[i+d:]
        if s==k:
            print('YES')
            quit()
print('NO')

Buggy submission (verdict: Runtime Error):
S=[i for i in list(input())];N=len(S);k=['k','e','y','e','n','c','e']
for d in range(N-6):
    for i in range(N-d+1):
        s=S[:i]+S[i+d:];if s==k:
            print('YES');quit()
print('NO')
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]
dp = [float("inf")]*N

dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1: dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]
dp = [float("inf")]*N

dp[0] = 0

for i in range(1, N):
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]))
    if i > 1: dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]))

print(dp[-1])
Problem p03262 (python)

Fixed submission:
import sys
sys.setrecursionlimit((2**31)-1)
from fractions import gcd
from collections import deque
n,X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.append(X)
x = sorted(x)
k = x[0]
x = deque([i-k for i in x])
x.popleft()

def gcdn():
    if len(x)==1:
        return
    p=x.pop()
    q=x.pop()
    x.append(gcd(p,q))
    gcdn()

gcdn()
print(x[0])

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from collections import deque
n,X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.append(X)
x = sorted(x)
k = x[0]
x = deque([i-k for i in x])
x.popleft()

def gcdn():
    if len(x)==1:
        return
    p=x.pop()
    q=x.pop()
    x.append(gcd(p,q))
    gcdn()

gcdn()
print(x[0])
Problem p03545 (python)

Fixed submission:
A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = "{0}+{1}+{2}+{3}=7".format(A, B, C, D) if A+B+C+D==7 else ans
ans = "{0}+{1}+{2}-{3}=7".format(A, B, C, D) if A+B+C-D==7 else ans
ans = "{0}+{1}-{2}+{3}=7".format(A, B, C, D) if A+B-C+D==7 else ans
ans = "{0}+{1}-{2}-{3}=7".format(A, B, C, D) if A+B-C-D==7 else ans
ans = "{0}-{1}+{2}+{3}=7".format(A, B, C, D) if A-B+C+D==7 else ans
ans = "{0}-{1}+{2}-{3}=7".format(A, B, C, D) if A-B+C-D==7 else ans
ans = "{0}-{1}-{2}+{3}=7".format(A, B, C, D) if A-B-C+D==7 else ans
ans = "{0}-{1}-{2}-{3}=7".format(A, B, C, D) if A-B-C-D==7 else ans

print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = f"{A}+{B}+{C}+{D}=7" if A+B+C+D==7 else ans
ans = f"{A}+{B}+{C}-{D}=7" if A+B+C-D==7 else ans
ans = f"{A}+{B}-{C}+{D}=7" if A+B-C+D==7 else ans
ans = f"{A}+{B}-{C}-{D}=7" if A+B-C-D==7 else ans
ans = f"{A}-{B}+{C}+{D}=7" if A-B+C+D==7 else ans
ans = f"{A}-{B}+{C}-{D}=7" if A-B+C-D==7 else ans
ans = f"{A}-{B}-{C}+{D}=7" if A-B-C+D==7 else ans
ans = f"{A}-{B}-{C}-{D}=7" if A-B-C-D==7 else ans

print(ans)
Problem p03651 (python)

Fixed submission:
N, K = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()], reverse=True)

for v in A:
    if K==v:
        print("POSSIBLE")
        quit()
if K > A[0]:
    print("IMPOSSIBLE")
    quit()

d = []
for i in range(N-1):
    d.append(A[i]-A[i+1])

for v in d:
    if v:
        K %= v

if K:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

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

for v in A:
    if K==v:
        print("POSSIBLE")
        quit()
if K > A[0]:
    print("IMPOSSIBLE")
    quit()

d = []
for i in range(N-1):
    d.append(A[i]-A[i+1])

for v in d:
    K %= v

if K:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Problem p03695 (python)

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

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am) if c>0 else len(Am)+1

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)

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

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am if c>0 else Am+1)

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)
Problem p03721 (python)

Fixed submission:
n, k = [int(i) for i in input().split()]
m = sorted([[int(i) for i in input().split()] for _ in range(n)])

s=0
i=0
while s<k:
    s += m[i][1]
    i += 1
print(m[i-1][0])

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

s=0
i=0
while s<k:
    s += m[i][1]
    i += 1
print(m[i-1][0])
Problem p04043 (python)

Fixed submission:
l=list(map(int,input().split()))
print("YES" if sorted(l) == [5,5,7] else "NO")

Buggy submission (verdict: Runtime Error):
l=list(map(int,input().split()))
if l.sort() =[5,5,7]:
  print("YES")
else:
  print("NO")
Problem p02613 (python)

Fixed submission:
n = int(input())
verdict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict.items():
    print(f'{i} x {j}')

Buggy submission (verdict: Runtime Error):
n = int(input())
verdict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict:
    print(f'{i} x {j}')
Problem p02681 (python)

Fixed submission:
s = input().strip()
s_new = input().strip()
if s == s_new[0:len(s)]:
  if len(s) + 1 == len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input().strip()
s_new = input().strip()
if s == s_new[0:len(s)]:
  if len(s) + 1 = len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input().split()
s_new = input().split()
if s == s_new[0:len(s)]:
  if len(s) + 1 = len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")
Problem p03170 (python)

Fixed submission:
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

dp = [0]*(k+1)
dp[0] = 0

for i in range(1,k+1):
  for j in range(n):
    if i-a[j] >= 0 and dp[i-a[j]] == 0:
      dp[i] = 1
      break
    #dp[i] = 0

if dp[k] == 1:
  print("First")
else:
  print("Second")

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

dp = [False]*(k+1)
dp[0] = 0

for i in range(1,k+1):
  for j in range(n):
    if i-a[j] >= 0 and dp[i-a[j]] == 0:
      dp[i] = 1
      break
    #dp[i] = 0

if dp[k] == 1:
  print("First")
else:
  print("Second")
Problem p03060 (python)

Fixed submission:
input()
print(sum((v-c for v,c in zip(map(int,input().split()),map(int,input().split())) if v-c>0)))

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

diff = [V[i] - C[i] for i in range(N)]
diff.sort(reverse=True)

i, ans = 0,0
while diff[i] > 0:
    ans += diff[i]
    i += 1
print(ans)
Problem p02744 (python)

Fixed submission:
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        ans.append(s)
        return True
    else:
        if len(set(s)) == 1:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
        if len(set(s)) == 2:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
        if len(set(s)) == 3:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
        if len(set(s)) == 4:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
        if len(set(s)) == 5:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
        if len(set(s)) == 6:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
        if len(set(s)) == 7:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
        if len(set(s)) == 8:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
        if len(set(s)) == 9:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
            rec(i+1,s+"j")
rec(1,"a")
print("\n".join(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        print(s)
        return
    else:
        for j in range(len(set(s)) + 1):
            rec(i+1,s+chr(old("a")+j))
rec(1,"a")
Problem p02756 (python)

Fixed submission:
def main():
  from collections import deque
  s=input()
  q=int(input())
  turn = 2
  d=deque(s)

  for _ in [0]*q:
      query = input()
      if query[0] == "1":
          t = int(query)
          turn = 3 - turn
      else:
          t,f,c = map(str,query.split())
          if (int(f) + turn)% 2  == 0:
              d.append(c)
          else:
              d.appendleft(c)
  if turn == 2:
      print("".join(d))
  else:
      print("".join(list(d)[::-1]))
main()

Buggy submission (verdict: Runtime Error):
def main():
  from collections import deque
  s=input()
  q=int(input())
  turn = 2
  d=deque(s)

  for _ in [0]*q:
      query = input()
      if query[0] == "1":
          t = int(query)
          turn = 3 - turn
      else:
          t,f,c = map(str,query.split())
          if (int(f) + turn)% 2  == 0:
              d.append(c)
          else:
              d.appendleft(c)
  if turn == 2:
      print("".join(d))
  else:
      print("".join(d[::-1]))
main()

Buggy submission (verdict: Runtime Error):


#E 
n,p=map(int,input().split())
s=input()



#D
def main():
  s=input()
  q=int(input())
  turn = 2

  for _ in [0]*q:
      query = input()
      try:
          t = int(query)
          turn = 3 - turn
      except ValueError:
          t,f,c = map(str,query.split())
          if (int(f) + turn)% 2  == 0:
              s = s + c
          else:
              s = c + s
  if turn == 2:
      print(s)
  else:
      print(s[::-1])
main()
Problem p02780 (python)

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

ans=0
tmp=0
tmp2=sum(s[0:k])
kukan=[0,n]
for i in range(n-k):
    tmp2 -= s[i]
    tmp2 += s[k+i]
    if tmp < tmp2:
        tmp = tmp2
        kukan = [i+1,i+k+1]

for i in range(kukan[0],kukan[1]):
    ans += (s[i]+1)/2
    
print(ans)

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

ans=0
tmp=0
tmp2=sum(s[0:k])
for i in range(n-k):
    tmp2 -= s[i]
    tmp2 += s[k+i]
    if tmp < tmp2:
        tmp = tmp2
        kukan = [i+1,i+k+1]

for i in range(kukan[0],kukan[1]):
    ans += (s[i]+1)/2
    
print(ans)
Problem p02801 (python)

Fixed submission:
c=input()
l="abcdefghrjklmnopqrstuvwxyz"

for i in range(27):
  if c == l[i]:
    print(l[i+1])
    exit()

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

ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    if(l[i][0] in ac) == False:
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
    

    
print(len(ac),wa)