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

Fixed submission:
n = int(input())
arr = [input() for _ in range(n)]
dict = {}
alpha = "abcdefghijklmnopqrstuvwxyz"

for s in arr:
    count = [0]*26
    for i in range(10):
        for j in range(26):
            if s[i] == alpha[j]:
                count[j] += 1
                break
    count = tuple(count)
    if count not in dict:
        dict[count] = 1
    else:
        dict[count] += 1
ans = 0
for val in dict.values():
    ans += val * ( val - 1 ) / 2
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [input() for _ in range(n)]
ans_dict = {}

for s in arr:
    tmp = sorted(s)
    if tmp in ans_dict:
        ans_dict[tmp] += 1
    else:
        ans_dict[tmp] = 1

ans = 0
for i in ans_dict.values():
    ans += i * ( i - 1) / 2
print( int(ans) )
Problem p02934 (python)

Fixed submission:
d = input()
a = input().split()
r = 0
for i in a:
    r += 1 / int(i)
print(1 / r)

Buggy submission (verdict: Runtime Error):
d = input()
a = input().split()
r = 0
for i in a:
    r += 1 / i
print(1 / r)

Buggy submission (verdict: Runtime Error):
d = input()
a = input().split()
r = 0
for i in a:
    r += 1 / i
print(1/r)

Buggy submission (verdict: Runtime Error):
a = input().split()
r = 0
for i in a:
    r += 1 / i
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(float,input().split())
r = 0
for i in range(n):
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(float,input().split())
for i in range(n):
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = map(float,input().split())
s = fractions.gcd(a)
for i in range(n)
    ans += s / a[i]
print(s/ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = map(float,input().split())
s = fractions.gcd(a)
for i in range(n-1)
    ans += a[i] / s
print(max(a)/ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = map(float,input().split())
s = fractions.gcd(a)
for i in range(n)
    ans += a[i] / s
print(max(a)/ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = map(float,input().split())
s = fractions.gcd(a)
for i in range(n)
    ans += a[i] / s
print(ans/s)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(float,input().split())
for i in range(n)
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(froat,input().split())
for i in range(n-1)
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
for i in range(n-1)
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
for i in range(n)
    r += 1 / a[i]
print(1/r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
for i in range(n)
    r = 1 / a[i]
print(1/r)
Problem p03962 (python)

Fixed submission:
c=list(input().split())
print(len(set(c)))

Buggy submission (verdict: Runtime Error):
c=list(map(input().split()))
print(len(set(c)))
Problem p02945 (python)

Fixed submission:
A,B=[int(i) for i in input().split(" ")]
print(max([A+B,A-B,A*B]))

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())

print(max[A+B,A-B,A*B])
Problem p02934 (python)

Fixed submission:
N = input()
A = list(map(int,input().split()))
A = sum(list(map(lambda x: 1/x, A)))
print(1/A)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
A = sum(list(map(lambda x: 1/x, A))
print(1/A)
Problem p03721 (python)

Fixed submission:
N,K = map(int, input().split())
ab_list = []
for i in range(N):
    a = list(map(int, input().split()))
    ab_list.append(a)
    
ab_list.sort()
    
count =0
for i in ab_list:
    count+=i[1]
    if (count >= K):
        print(i[0])
        break

Buggy submission (verdict: Runtime Error):

N,K = map(int, input().split())
ab_list = {}
for i in range(N):
    a,b = map(int, input().split())
    akagi=str(a)
    if akagi in ab_list:
        ab_list[akagi] += b
        print("if")
        print(ab_list)
    else:
        ab_list[akagi] = b
        print("else")
        print(ab_list)
        

  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break
Problem p03729 (python)

Fixed submission:


ABC = input().split()


if ABC[0][-1] ==ABC[1][0]:
    if ABC[1][-1] == ABC[2][0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = 1000


for index in range(count+1):
    if (A*index)%B ==C:
        print("Yes")
        break
    elif index ==800:
        print("NO")
Problem p03730 (python)

Fixed submission:
ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = A*B


for index in range(count+1):
    if (A*index)%B==C:
        print("YES")
        break
    elif index ==count:
        print("NO")

Buggy submission (verdict: Runtime Error):
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 100
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
        break
    elif index == (count):
        print("NO")
    else:
        N+=1

Buggy submission (verdict: Runtime Error):
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 50
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
    elif index == (count):
        print("NO")
    else:
        N+=1
Problem p03731 (python)

Fixed submission:
if __name__ == '__main__':
    N, T = map(int, input().split())
    ts = list(map(int, input().split()))
    
    
amount =0


    
for index in range(N-1):
    t_sub = ts[index+1]-ts[index]
    amount+=min(t_sub,T)

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):

N, T =map(int, input().split())
ts =map(int, input().split())



amount =0


    
for index in range(N-1):
    t_sub = ts[index+1]-ts[index]
    amount+=min(t_sub,T)

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):
N,T =map(int,input().split())
t = map(int,input().split())
amount =0


    
for index in range(N-1):
    t_sub = t[index+1]-t[index]
    amount+=min(t_sub,T)

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):
N,T =map(int,input().split())
t = map(int,input().split())
amount =0


    
for index in range(N-1):
    t_sub = t[index+1]-t[index]
    if t_sub <= T:
        amount+=t_sub
    else:
        amount+=T

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):

N,T =map(int,input().split())
t = input().split()
amount =0


    
for index in range(N-1):
    t_sub = t[index+1]-t[index]
    if t_sub <= T:
        amount+=t_sub
    else:
        amount+=T

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
t = input().split()
amount =0

if t[0] <= T:
    amount+=t[0]
else:
    amount+=T
    
for index in range(N-1):
    t_sub = int(t[index+1])-int(t[index])
    if t_sub <= T:
        amount+=t_sub
    else:
        amount+=T

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split)
t = input().split()
int(amount) =0

if t[0] <= T:
    amount+=t[0]
else:
    amount+=T
    
for index in range(N-1):
    t_sub = int(t[index+1])-int(t[index])
    if t_sub <= T:
        amount+=t_sub
    else:
        amount+=T

        
amount +=T

print(amount)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split)
t = input().split()
amount =0

if t[0] <= T:
    amount+=t[0]
else:
    amount+=T
    
for index in range(N-1):
    t_sub = t[index+1]-t[index]
    if t_sub <= T:
        amount+=t_sub
    else:
        amount+=T

        
amount +=T

print(amount)
Problem p03059 (python)

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

print(t//a * b)

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

print(id)

pre_num=[0]*(n+1)
ans=[""]*m

id.sort(key=lambda x:x[1])

for p,y,i in id:
    pre_num[p]+=1
    ans[i]=str(p).zfill(6)+str(pre_num[p]).zfill(6)
    
print("\n".join(ans))
Problem p03086 (python)

Fixed submission:

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)

Buggy submission (verdict: Runtime Error):

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(max_count, count)
    else:
        count = 0

print(ans)
Problem p03240 (python)

Fixed submission:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()

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

li.sort(key=lambda x: x[2])
a, b, c = li[-1]

for x in range(101):
    for y in range(101):
        h=c+abs(a-x)+abs(b-y)
        if all(k==max(h-abs(i-x)-abs(j-y),0) for i,j,k in li):
        print(x,y,h)
        exit()
Problem p03282 (python)

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

a = 0
b = 0

for i in range(len(S)):
    if S[i] == "1":
        a = i+1
    else:
        b = S[i]
        break

if K <= a:
    print(1)
else:
    print(b)

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

a = 0
b = 0

for i in range(len(S)):
    if S[i] = 1:
        a = i+1
    else:
        b = S[i]
        break

if K <= a:
    print(1)
else:
    print(b)
Problem p03308 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split))
print(max(A)- min(A))
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) < K:
        for m in li:
            if l+m in s:
                return substring(l+m)
    else:
        pass

for l in li:
    substring(l)

print(result[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) >= K:
        pass
    for m in li:
        if l+m in s:
            return substring(l+m)

for l in li:
    substring(l)

print(result[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) >= K:
        pass
    for m in li:
        if l+m in s:
            return substring(l+m)

for l in li:
    substring(l)
print(result)

print(result[K-1])
Problem p03331 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def sum_digits(val):
    work = 0
    while True:
        work += val % 10
        val //= 10
        if val == 0:
            break
    return work
   
n = int(input())

values = []
for a in range(1, n + 1):
    b = n - a
    if b < 1:
        continue
    # print("{}, {} / {}, {}".format(a, sum_digits(a), b, sum_digits(b)))
    values.append(sum_digits(a) + sum_digits(b))

values.sort()
# print(values)
print("0" if len(values) == 0 else values[0])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def sum_digits(val):
    work = 0
    while True:
        work += val % 10
        val //= 10
        if val == 0:
            break
    return work
   
n = int(input())

values = []
for a in range(2, n + 1):
    b = n - a
    if b < 2:
        continue
    # print("{}, {} / {}, {}".format(a, sum_digits(a), b, sum_digits(b)))
    values.append(sum_digits(a) + sum_digits(b))

values.sort()
# print(values)
print(values[0])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def sum_digits(val):
    work = 0
    while True:
        work += val % 10
        val //= 10
        if val == 0:
            break
    return work
   
n = int(input())

values = []
for a in range(2, n + 1):
    b = n - a
    if b < 2:
        continue
    # print("{}, {} / {}, {}".format(a, sum_digits(a), b, sum_digits(b)))
    values.append(sum_digits(a) + sum_digits(b))

values.sort()
# print(values)
print(values[0])
Problem p02934 (python)

Fixed submission:
n = int(input())
values = input().split()
before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1 / int(values[_])
after_reverse_num = 1 / before_reverse_num
print(str(round(after_reverse_num,5)))

Buggy submission (verdict: Runtime Error):
n = int(input())
 
before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1.0 / int(input())
after_reverse_num = 1.0 / before_reverse_num
print(str(round(after_reverse_num,5)))

Buggy submission (verdict: Runtime Error):
n = int(input())

before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1 / int(input())
after_reverse_num = 1 / before_reverse_num
print(str(round(after_reverse_num,5)))

Buggy submission (verdict: Runtime Error):
n = int(input())
 
before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1 / int(input())

after_reverse_num = 1 / before_reverse_num

print(after_reverse_num)

Buggy submission (verdict: Runtime Error):
n = int(input())

before_reverse_num = 0
for _ in range(n):
  before_reverse_num += 1 / int(input())
 
after_reverse_num = 1 / before_reverse_num

print(after_reverse_num)
Problem p03085 (python)

Fixed submission:
b = input()
c = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(c[b])

Buggy submission (verdict: Runtime Error):
b = str(inut())

if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')

Buggy submission (verdict: Runtime Error):
b = str(inut())

if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
  s += 1/a[i]

print(1/s)

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
s = 0
for i in range(n):
  s += 1/a[i]

print(1/s)
Problem p03240 (python)

Fixed submission:
n = int(input())
x = []
y = []
h = []
for i in range(n):
    xi,yi,hi = map(int, input().split())
    x.append(xi)
    y.append(yi)
    h.append(hi)


cxyl = []
for i in range(101):
    for j in range(101):
        cxyl.append((i,j))
cxy = set(cxyl)
hd = {}
hzero = set([])
for i in range(n):
    for c in list(cxy):
        H = abs(x[i]-c[0]) + abs(y[i]-c[1]) + h[i]
        if h[i] == 0:
            hzero.add((x[i],y[i]))
            if 1 > H:
                cxy.remove(c)
                continue
        else:
            if c in hd:
                if hd[c] != H:
                    cxy.remove(c)
                    continue
            else:
                hd[c] = H

for xy in list(hzero):
    xi = xy[0]
    yi = xy[1]
    for c in list(cxy):
        H = abs(xi-c[0]) + abs(yi-c[1])
        if hd[c] - H > 0:
            cxy.remove(c)

ret = cxy.pop()
print(str(ret[0]) + ' ' + str(ret[1]) + ' ' + str(hd[ret]))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = []
y = []
h = []
for i in range(n):
    xi,yi,hi = map(int, input().split())
    x.append(xi)
    y.append(yi)
    h.append(hi)


cxyl = []
for i in range(101):
    for j in range(101):
        cxyl.append((i,j))
cxy = set(cxyl)
hd = {}
for i in range(n):
    for c in list(cxy):
        if h[i] == 0:
            if 1 > abs(x[i]-c[0]) + abs(y[i]-c[1]):
                cxy.remove(c)
                continue
        else:
            H = abs(x[i]-c[0]) + abs(y[i]-c[1]) + h[i]
            if H < 1:
                cxy.remove(c)
                continue
            if c in hd:
                if hd[c] != H:
                    cxy.remove(c)
                    continue
            else:
                hd[c] = H
if len(cxy) != 1:
    raise ValueError
ret = cxy.pop()
print(str(ret[0]) + ' ' + str(ret[1]) + ' ' + str(hd[ret]))
Problem p03680 (python)

Fixed submission:
n = int(input())
a = {i+1:int(input()) for i in range(n)}
nexti = 1
for i in range(n):
    if a[nexti] == 2:
        print(i+1)
        exit()
    nexti = a[nexti]
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = {i+1:int(input()) for i in range(n)}

def find(ad, nexti, cnt, s):
    cnt += 1
    s.add(nexti)
    if ad[nexti] == 2:
        return cnt
    elif ad[nexti] in s:
        return -1
    else:
        return find(ad, ad[nexti], cnt, s)

print(find(a, 1, 0, set()))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = {i+1:int(input()) for i in range(n)}

def find(a, nexti, cnt, s):
    global n
    if cnt > n:
        return -1
    cnt += 1
    s.add(nexti)
    if a[nexti] == 2:
        return cnt
    elif a[nexti] in s:
        return -1
    else:
        return find(a, a[nexti], cnt, s)

print(find(a, 1, 0, set()))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = {i+1:int(input()) for i in range(n)}

def find(a, nexti, cnt, s):
    cnt += 1
    s.add(nexti)
    if a[nexti] == 2:
        return cnt
    elif a[nexti] in s:
        return -1
    else:
        return find(a, a[nexti], cnt, s)

print(find(a, 1, 0, set()))
Problem p03730 (python)

Fixed submission:
from fractions import gcd
a,b,c = map(int, input().split())
r = gcd(a,b)
if c % r == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int, input().split())
r = math.gcd(a,b)
if c % r == 0:
    print('YES')
else:
    print('NO')
Problem p03739 (python)

Fixed submission:
n = int(input())
sa = input().split()

a = [0 for i in range(n)]
sumeven = 0
sumodd = 0
for i,sai in enumerate(sa):
    a[i] = int(sai)

    if i % 2 == 0:
        sumeven += a[i]
    else:
        sumodd += a[i]

ret = 0
sm = 0
for i,ai in enumerate(a):
    if i % 2 == 1:
        ret += max(-sm+1-ai,0)
        sm += max(ai, -sm+1)
    else:
        ret += max(sm+1 + ai, 0)
        sm += min(ai, -(sm+1))
ret2 = 0
sm = 0
for i,ai in enumerate(a):
    if i % 2 == 0:
        ret2 += max(-sm+1-ai,0)
        sm += max(ai, -sm+1)
    else:
        ret2 += max(sm+1 + ai, 0)
        sm += min(ai, -(sm+1))
        
print(min(ret,ret2))

Buggy submission (verdict: Runtime Error):
n = int(input())
sa = input().split()

a = [0 for i in range(n)]
sumeven = 0
sumodd = 0
for i,sai in enumerate(sa):
    a[i] = int(sai)

    if i % 2 == 0:
        sumeven += a[i]
    else:
        sumodd += a[i]

ret = 0
sm = 0
for i,ai in enumerate(a):
    if i % 2 == 1:
            ret += max(-sm+1-ai,0)
            sm += max(ai, -sm+1)
        else:
            ret += max(sm+1 + ai, 0)
            sm += min(ai, -(sm+1))
ret2 = 0
sm = 0
for i,ai in enumerate(a):
    if i % 2 == 0:
        ret2 += max(-sm+1-ai,0)
        sm += max(ai, -sm+1)
    else:
        ret2 += max(sm+1 + ai, 0)
        sm += min(ai, -(sm+1))
        
print(max(ret,ret2))
Problem p03796 (python)

Fixed submission:
import math
n = int(input())
print(math.factorial(n)%(10**9+7))

Buggy submission (verdict: Runtime Error):
s = input().split()
h = int(s[0])
w = int(s[1])
s = []
for i in range(h):
    s.append(input())

for i in range(h):
    row = ''
    for j in range(w):
        cnt = 0
        if s[i][j] == '#':
            row += '#'
            continue
        if i > 0 and j > 0 and s[i-1][j-1] == '#':
            cnt += 1
        if i > 0 and s[i-1][j] == '#':
            cnt += 1
        if i > 0 and j < w - 1 and s[i-1][j+1] == '#':
            cnt += 1
        if j > 0 and s[i][j-1] == '#':
            cnt += 1
        if j < w - 1 and s[i][j+1] == '#':
            cnt += 1
        if i < h - 1 and s[i+1][j-1] == '#':
            cnt += 1
        if i < h - 1 and s[i+1][j] == '#':
            cnt += 1
        if  i < h - 1 and j < w - 1 and s[i+1][j+1] == '#':
            cnt += 1
        row += str(cnt)
    print(row)
Problem p03860 (python)

Fixed submission:
st = input().split()
A = (st[0])
B = (st[1])
C = (st[2])
ret = A[0] + B[0] + C[0]

    
print(ret)

Buggy submission (verdict: Runtime Error):
st = input().split()
N = int(st[0])
x = int(st[1])
A = input().split()
a = []
for i in range(N):
     a.append(int(A[i]))   
a.append(0)
a.append(0)
ret = 0
for i in range(N):
    if a[i] + a[i + 1] > x :
        d1 = max((a[i] + a[i + 1]) - x,0)
        ret +=  min(a[i+1],d1)
        a[i+1] -=  min(a[i+1],d1)
        d1 = max((a[i] + a[i + 1]) - x,0)
        ret +=  min(a[i],d1)
        a[i] -=  min(a[i],d1)
print(ret)
Problem p03919 (python)

Fixed submission:
h,w=map(int,input().split())
b=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for k in range(h):
    a=list(input().split())
    for l in range(w):
        if a[l]=='snuke':
            print(b[l]+str(k+1))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
b=['A','B','C','D','E','F','G','H']
for k in range(h):
    a=list(input().split())
    for l in range(w):
        if a[l]=='snuke':
            print(b[l]+str(k+1))
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
a=[]
b=''
for k in range(n):
    a.append(input())
a.sort()
for i in range(n):
   b+=a[i]
print(b)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
a=[]
b=''
for k in range(n):
    a.append(input())
a.sort()
for i in range(l):
   b+=a[i]
print(b)
Problem p02975 (python)

Fixed submission:
size = int(input())
nums = list(map(int, input().split()))
# 
# size = 6
# nums = [0, 2, 2, 0, 2, 2]

numu = list(set(nums))
if len(numu) == 1 and numu[0] == 0:
  print("Yes")
  quit()


if len(numu) == 2 \
    and nums.count(0) != 0 \
    and nums.count(0) * 3 == size:
  print("Yes")
  quit()

if len(numu) == 3:
  if nums.count(0) == 1:
    print("No")
    quit()

  if not nums.count(numu[0]) == nums.count(numu[1]) == nums.count(numu[2]):
    print("No")
    quit()

  if numu[0] ^ numu[2] == numu[1] \
      and numu[1] ^ numu[0] == numu[2] \
      and numu[2] ^ numu[1] == numu[0]:
    print("Yes")
    quit()

print("No")

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

# size = 3
# nums = [1, 2, 3]

numu = list(set(nums))
if len(numu) == 1 and numu[0] == 0:
  print("Yes")
  quit()

if len(numu) == 2 and nums.count(0) == 1 \
    and nums.count(0) * 3 == size:
  print("Yes")
  quit()

if not nums.count(numu[0]) == nums.count(numu[1]) == nums.count(numu[2]):
  print("No")
  quit()

if len(numu) == 3:
  if numu[0] ^ numu[2] == numu[1] \
      and numu[1] ^ numu[0] == numu[2] \
      and numu[2] ^ numu[1] == numu[0]:
    print("Yes")
    quit()

print("No")

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

# size = 3
# nums = [0, 0, 0]

if size % 3 != 0:
  print("No")
  quit()

numu = list(set(nums))
if len(numu) == 1 and numu[0] == 0:
  print("Yes")
  quit()

if len(numu) == 2 and numu.count(0) > 0:
  print("Yes")
  quit()


num = nums.count(numu[0])
if nums.count(nums[1]) != num or nums.count(nums[2]) != num:
  print("No")
  quit()

if numu[0] ^ numu[2] == numu[1] \
    and numu[1] ^ numu[0] == numu[2] \
    and numu[2] ^ numu[1] == numu[0]:
  print("Yes")
  quit()

print("No")

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

# size = 4
# nums = [1, 2, 3, 1, 2, 3]

numu = list(set(nums))
if size % 3 != 0:
  print("No")
  quit()

num = nums.count(numu[0])
if nums.count(nums[1]) != num or nums.count(nums[2]) != num:
  print("No")
  quit()

if numu[0] ^ numu[2] == numu[1] \
    and numu[1] ^ numu[0] == numu[2] \
    and numu[2] ^ numu[1] == numu[0]:
  print("Yes")
  quit()

print("No")