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

Fixed submission:
table = {alphabet: "-" for alphabet in "abcedfghijklmnopqrstuvwxyz"}
rev_table = {alphabet: "-" for alphabet in "abcedfghijklmnopqrstuvwxyz"}

s = str(input())
t = str(input())

flag = True

for i in range(len(s)):
    if table[s[i]] == t[i]:
        continue
    elif table[s[i]] == "-":
        table[s[i]] = t[i]
    else:
        flag = False
        break

for i in range(len(t)):
    if rev_table[t[i]] == s[i]:
        continue
    elif rev_table[t[i]] == "-":
        rev_table[t[i]] = s[i]
    else:
        flag = False
        break

if flag is True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
canChange = {alphabet: True for alphabet in "abcedfghijklmnopqrstuvwxyz"}
 
s = str(input())
t = str(input())
 
for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes)

Buggy submission (verdict: Runtime Error):
canChange = {alphabet:True alphabet in "abcedfghijklmnopqrstuvwxyz"}
 
s = str(input())
t = str(input())
 
for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes")

Buggy submission (verdict: Runtime Error):
canChange = {alphabet:True alphabet in "abcedfghijklmnopqrstuvwxyz"}

s = str(input())
t = str(input())

for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)


def dfs(node, dis, adj_list):

    for next, d in adj_list[node]:
        if dis[next] == float("inf"):
            dis[next] = dis[node] + d
            dfs(next, dis, adj_list)

    return


n = int(input())
adj_list = [[] for _ in range(n)]


for i in range(n - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    adj_list[a].append([b, c])
    adj_list[b].append([a, c])

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

k -= 1
dis = [float("inf")] * n
dis[k] = 0
dfs(k, dis, adj_list)

for i in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(dis[x] + dis[y])

Buggy submission (verdict: Runtime Error):
def dfs(node, dis, adj_list):

    for next, d in adj_list[node]:
        if dis[next] == float("inf"):
            dis[next] = dis[node] + d
            dfs(next, dis, adj_list)

    return


n = int(input())

adj_list = [[] for _ in range(n)]

for i in range(n - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    adj_list[a].append([b, c])
    adj_list[b].append([a, c])

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

k -= 1
dis = [float("inf")] * n
dis[k] = 0
dfs(k, dis, adj_list)

for i in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(dis[x] + dis[y])

Buggy submission (verdict: Runtime Error):
def dfs(node, dis, adj_list):

    for next, d in adj_list[node]:
        if dis[next] == float("inf"):
            dis[next] = dis[node] + d
            dfs(next, dis, adj_list)

    return


n = int(input())

adj_list = [[] for _ in range(n)]

for i in range(n - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    adj_list[a].append([b, c])
    adj_list[b].append([a, c])

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

k -= 1
dis = [float("inf")] * n
dis[k] = 0
dfs(k, dis, adj_list)

for i in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(dis[x] + dis[y])
Problem p03775 (python)

Fixed submission:
def f(a, b):
    digit_a = digit_b = 0

    while a:
        digit_a += 1
        a //= 10

    while b:
        digit_b += 1
        b //= 10

    return max(digit_a, digit_b)


n = int(input())

ans = n

for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        ans = min(ans, f(i, n // i))

print(ans)

Buggy submission (verdict: Runtime Error):
def f(a,b):
  digit_a = digit_b=0
  
  while a:
    digit_a+=1
    a//=10
    
  while b:
    digit_b+=1
    b//=10
    
  return max(digit_a, digit_b)

n = int(input())

ans = n
for i in range(1, int((n+1)**0.5)):
  for n%i==0:
    n = min(n, f(i, n//i))
    
print(ans)
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split(" "))
answer = 0

for i in range(k + 1):
    for j in range(k + 1):
        rem = s - i - j
        if 0 <= rem <= k:
            answer += 1
print(answer)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split(" "))
answer = 0

for i in range(k + 1):
    for j in range(k + 1):
        rem = 3 * k - i - j
        if 0 <= rem <= k:
            answer += 1
print(answer)
Problem p02624 (python)

Fixed submission:
a=int(input())
ans=0
for i in range(1,a+1):
  num=a//i
  ans+=(((num+1)*num)//2)*i
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(1,n+1):
  num=n//i
  ans+=(((num+1)*num)//2)*i
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(1,n+1):
  num=n//i
  ans+=((num+1)//2)*i
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(1,n+1):
  num=n//1
  ans+=((num+1)//2)*i
print(ans)
Problem p02688 (python)

Fixed submission:
import itertools
a,b=map(int,input().split())
c=[]
for i in range(1,b*2+1):
    c.append(list(map(int,input().split())))
n=c[1::2]
n=list(itertools.chain.from_iterable(n))
print(a-len(set(n)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=int(input())
d=list(map(int,input().split()))
e=[input() for _ in range(b)]
f=list(map(int,input().split()))

print(a-c)
Problem p02707 (python)

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

c=collections.Counter(b)
n,m=zip(*c.most_common())
n,m=list(n),list(m)
o=c.most_common()

result=[0]*a
for i in range(len(o)):
    result[o[i][0]-1]=o[i][1]

for i in result:
    print(i)

Buggy submission (verdict: Runtime Error):
import collections
a=int(input())
b=list(map(int,input().split()))
c=[0]*a
d=collections.Counter(b)
n,m=zip(*d.most_common())
n=list(n)
m=list(m)

for i in n:
    c[i-1]=m[i-1]
for i in range(a):
    print(c[i])

Buggy submission (verdict: Runtime Error):
import collections
a=int(input())
b=list(map(int,input().split()))
c=[0]*a
d=collections.Counter(b)
n,m=zip(*d.most_common())
n=list(n)
m=list(m)
for i in n:
    c[i-1]=m[i-1]
print(c)
for i in c:
    print(i)
Problem p02711 (python)

Fixed submission:
p=list(input())
a=int(p[0])
b=int(p[1])
c=int(p[2])
if a==7 or b==7 or c==7:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
p=list(int(input()))
a=(p[0])
b=(p[1])
c=(p[2])
if a==7 or b==7 or c==7:
	print(Yes)
else:
	print(No)

Buggy submission (verdict: Runtime Error):
p=list(input())
a=int(a[0])
b=int(a[1])
c=int(a[2])
if a==7 or b==7 or c==7:
	print(Yes)
else:
	print(No)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(7)
if a in b:
    print('yes')
else a in b:
    print('no')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=(7)
if a in b:
    print('yes')
else a in b:
    print('no')
Problem p02712 (python)

Fixed submission:
a=int(input())
b=((a//3)*(3+(3*(a//3))))*(1/2)
c=((a//5)*(5+(5*(a//5))))*(1/2)
d=((a//15)*(15+(15*(a//15))))*(1/2)
e=(a*(1+a)*(1/2))-(b+c-d)
print(int(e))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=((a//3)*(3+(3*(a//3))))*(1/2)
c=((a//5)*(5+(5*(a//5))))*(1/2)
d=((a//15)*(15+(15*(a//15))))*(1/2)
e=(a(1+a)*(1/2))-(b+c-d)
print(e)
Problem p02729 (python)

Fixed submission:
a,b=map(int,input().split())
n=(a*(a-1))//2
m=(b*(b-1))//2
if b<2 and a<2:
  print(0)
elif b<2:
  print(n)
else:
  print(n+m)

Buggy submission (verdict: Runtime Error):
def uhe(x):
    return x%2

a,b=map(int,input().split())
c=list(range(2,a*2+1,2))
d=list(range(1,b*2+1,2))

e=[(x+y) for x in c for y in d]
f=list(map(uhe,e))

while a!=1:
    g=(a-1)*a
    a=a-1
while b!=1:
    h=(b-1)*b
    b=a-1
print(g,h)
print(f.count(0)+g//a+h//b)
Problem p02753 (python)

Fixed submission:
a=input()
if a=='AAA'or a=='BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
a=input()
if a=='AAA'or'BBB':
  print(No)
else:
  print(Yes)
Problem p02754 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a%(b+c)<=b:
  print((a//(b+c))*b+a%(b+c))
else:
  print((a//(b+c))*b+b)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d=''
while a>len(d):
    d+='b'*b
    d+='r'*c
d=d[:a]
print(d)
print(d.count('b'))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d=''
while a>len(d):
    d+='b'*b
    d+='r'*c
d=d[:a]
print(d)
print(d.count('b'))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a%(b+c)<=b:
  print(((a//b*c)*b)+a%(b+c))
elif b==0:
  print(0)
else:
  print(((a//b*c)*b)+a%(b+c))
Problem p02759 (python)

Fixed submission:
a=int(input())
print(sum(divmod(a,2)))

Buggy submission (verdict: Runtime Error):
print(sum(divmod(input(a),2)))

Buggy submission (verdict: Runtime Error):
print(sum(divmod(input(a),2)))
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b!=c or a!=b==c or a==c!=b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c or a!=b!=c:
  print('No')
else:
  print('Yes')
Problem p02777 (python)

Fixed submission:
a,b=map(str,input().split())
c,d=map(int,input().split())
e=str(input())
if a==e:
    print(c-1,d)
else:
    print(c,d-1)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
c.d=map(int,input().split())
e=str(input())
if a==e:
    print(c-1,d)
else:
    print(c,d-1)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
c.d=map(int,input().split())
e=input()
if a==e:
  print(c-1,d)
else:
  print(c,d-1)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
c.d=map(int,input().split())
e=input()
if c==e:
  print(c-1,d)
else:
  print(c,d-1)
Problem p02819 (python)

Fixed submission:
import math
import bisect
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
result=[]
a=int(input())
for i in range(a-500,a+501):
    if i<0:
        continue
    if is_prime(i):
        result.append(i)
bisect.insort_left(result,a)
n=bisect.bisect_left(result,a)
print(result[n+1])

Buggy submission (verdict: Runtime Error):
import sympy as sym
a=int(input())
b=[]
while len(b)<2:
  for i in sym.primerange(a,10**5):
    b.append(i)
print(b[0])
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
n=[1,2,3]
n.remove(a)
n.remove(b)
print(n[0])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=[1,2,3]
n.remove(a)
n.remove(b)
print(n[0])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=[1,2,3]
n.remove(a)
n.remove(b)
print(n[0])
Problem p02847 (python)

Fixed submission:
a=input()
n=['SUN','MON','TUE','WED','THU','FRI','SAT']
if a!='SAT':
  print(7-n.index(a))
else:
  print(1)

Buggy submission (verdict: Runtime Error):
a=input()
n=['SUN','MON','TUE','WED','THU','FRI','SAT']
if a!='SAT':
  print(n[6]-n.index(a))
else:
  print(7)
Problem p02860 (python)

Fixed submission:
a=int(input())
b=input()
if b[0:a//2]==b[a//2:]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input()
if b[0:a//2-1]==[a//2:a-1]:
  print('Yes')
else:
  print('No')
Problem p02915 (python)

Fixed submission:
a=int(input())
n=list(range(1,a+1))
m=n
o=n
count=0
for i in n:
  for j in m:
    for q in o:
        u=i,j,q
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
a=int(input())
n=list(range(1,a+1))
m=n
o=n
for i in n:
  for j in m:
    for q in o:
      u=list(i,j,k,sep='')
print(len(u))
Problem p03011 (python)

Fixed submission:
a,b,c=map(int,input().split())
n=sorted([a,b,c])
print(n[0]+n[1])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input(),.split())
n=[a,b,c]
d=[]
for i in range(1,len(n)):
  d.append(n[i]+n[i])
print(min(d))
Problem p03315 (python)

Fixed submission:
a=list(input())
c=[]
for i in a:
  if i=='+':
    i=1
    c.append(i)
  else:
    i=-1
    c.append(i)
print(sum(c))

Buggy submission (verdict: Runtime Error):
a=[input() for i in range(4)]
for i in a:
  if i=='+':
    i=1
  else:
    i=-1
print(sum(a))
Problem p03803 (python)

Fixed submission:
a,b = map(int,input().split())
if a != 1 and b != 1:
  if a > b :
   	  print("Alice")
  elif a < b:
      print("Bob")
  else:
      print("Draw")
elif a == 1 and b != 1:
      print("Alice")
elif a != 1 and b == 1:
      print("Bob")
else:
      print("Draw")

Buggy submission (verdict: Runtime Error):
    a,b = map(int,input().split())
    if a != 1 and b != 1:
        if a > b :
            print("Alice")
        elif a < b:
            print("Bob")
        else:
            print("Draw")
    elif a == 1 and b != 1:
        print("Alice")
    elif a != 1 and b == 1:
        print("Bob")
    else:
        print("Draw")
Problem p03834 (python)

Fixed submission:
a=input()
print(a.replace(',',' '))

Buggy submission (verdict: Runtime Error):
a=input()
print(a.replace(',',' ')
Problem p03835 (python)

Fixed submission:
a,b=map(int,input().split())
c=0
for i in range(a+1):
  for j in range(a+1):
    z=b-(i+j)
    if 0<=z<=a:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=0
for i in range(a+1):
  for j in range(a+1):
    z=k-(i+j)
    if 0<=z<=a:
      c+=1
print(c)
Problem p02570 (python)

Fixed submission:
d, t, s = map(int,input().split())
print('Yes' if t*s >=d else 'No')

Buggy submission (verdict: Runtime Error):
d, t, s = map(int,input())
print('Yes' if t*s >=d else 'No')
Problem p02571 (python)

Fixed submission:
s, t = input(), input()

ls = len(s)
lt= len(t)
is_double = False
c = len(s)
for i in range(ls-lt+1):
  _c = 0 
  for j in range(lt):
    if not s[i+j] == t[j]:
      _c +=1
  if c > _c:
    c = _c
    
print(c)

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

ls = len(s)
lt= len(t)
print(ls,lt)
is_double = False

for i in range(0,lt):
  size = lt-i
  for j in range(0,lt-size+1):
    jps = (j+size)
    # 0 j (j+size) lt
    _t = t[j:jps]
    print(i,j,size,_t, f'\t{s[j:ls-(lt-(j+size))]}')
    if _t in s[j:ls-(lt-(j+size))]:
      is_double = True
      break
  if is_double:
    print(i)
    break

if not is_double:
  print(lt)

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

lt= len(t)
for i in range(lt):
  is_double = True
  size = lt-i
  for j in range(0,i+1):
    _t = t[j:j+size]
    print(i,j,size,_t)
    if _t in s:
      is_double = False
      break
  if not is_double:
    print(lt-1)
    break
Problem p02753 (python)

Fixed submission:
a = input()
print('Yes' if 'A' in a and 'B' in a else 'No')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
a = float(a)
b = float(b)
for i in range(-7000, 7000):
	if float(i) * 0.08 == a and float(i) * 0.1 == b:
		print(i)
		exit(0)
print(-1)
Problem p02546 (python)

Fixed submission:
def func(S):
  if S[-1] == "s":
    return S+"es"
  else:
    return S+"s"


if __name__ == "__main__":
    S = input()
    print(func(S))

Buggy submission (verdict: Runtime Error):
from unittest import TestCase, main
from A import func

class test(TestCase):
  def test_with_valid_params(self):
    test_patterns = [
      ("apple","apples"),
      ("bus","buses"),
      ("box","boxs")
    ]

    for S,result in test_patterns:
      with self.subTest(S=S):
        self.assertEqual(func(S),result)

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

Fixed submission:
def func(D):
  comb = 0
  for item in D:
    if item[0]==item[1]:
      comb+=1
    else:
      comb=0
    
    if comb==3:
      return "Yes"  
  return "No"

if __name__ == "__main__":
    N = int(input())
    D = [list(map(int, input().split())) for _ in range(N)]
    print(func(D))

Buggy submission (verdict: Runtime Error):
def func(D):
  comb = 0
  for item in D:
    if item[0]==item[1]:
      comb+=1
    else:
      comb=0
    
    if comb==3:
      return "Yes"  
  return "No"

if __name__ == "__main__":
    N = int(input())
    D = [map(int, input().split()) for _ in range(N)]
    print(func(D))
Problem p02578 (python)

Fixed submission:
def func(A):
  result = 0
  min = 0
  for a in A:
    if a < min:
      result += min - a
    else:
      min = a
  return result

if __name__ == "__main__":
    N = int(input())
    A = list(map(int,input().split()))
    print(func(A))

Buggy submission (verdict: Runtime Error):
def func(A):
  result = 0
  min = 0
  for a in A:
    if a < min:
      result += min - a
    else:
      min = a
  return result

if __name__ == "__main__":
    N = int(input())
    A = list(int,input().split())
    print(func(A))
Problem p02831 (python)

Fixed submission:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b=map(int,input().split())
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b=map(int,input(),split())
print(lcm(a, b))
Problem p02835 (python)

Fixed submission:
a= sum(map(int,input().split()))
if a > 21:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
if sum(map(int,input().split()) > 21:
       print('bust')
else:
       print('win')
Problem p02863 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
 
def main():
    n,t=map(int, input().split())
    dp=[0]*t
    food=[]
    for _ in range(n):
        a,b=map(int, input().split())
        food.append([a,b])
    food.sort(key=lambda x:x[0]*-1)
    for j in range(n):
        a,b=food[j][0],food[j][1]
        dptmp=[0]*t
        for i in range(t):
            if i < a: 
                dptmp[i]=max(b,dp[i])
            else:
                dptmp[i]=max(dp[i-a]+b,dp[i])
        dp=dptmp
    print(dp[t-1])
 
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
def input(): return sys.stdin.readline().rstrip()


def main():
    n, t = map(int, input().split())
    dp = np.zeros(t,dtype=int)
    food = []
    for _ in range(n):
        a, b = map(int, input().split())
        food.append([a, b])
    food.sort(key=lambda x: x[0]*-1)
    for j in range(n):
        a, b = food[j][0], food[j][1]
        dptmp=np.zeros(t,dtype=int)
        dptmp[a:] = np.maximum(dp[a:],dp[:-a]+b)
        dptmp[:a] = np.maximum(np.full(a,b,dtype=int), dp[:a])
        dp=dptmp
    print(dp[-1])


if __name__ == '__main__':
    main()
Problem p02711 (python)

Fixed submission:
N = input()
print('Yes' if '7' in N else 'No')

Buggy submission (verdict: Runtime Error):
N = input()
print('Yes' if 7 in N else 'No')
Problem p02629 (python)

Fixed submission:
N = int(input())

s = []
k = 0
while N > 0:
	l = N % 26 #一番下のけた
	if l == 0:
		l = 26
	s.insert(0,chr(ord('a')+l-1))
	N = N-1
	N = N // 26
	k +=1


print(''.join(s))

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

s = []
k = 0
while N > 0:
	l = N % 26 //一番下のけた
	s.insert(0,chr(ord('a')+l-1))
	N = N // 26
	k +=1

print(s)
print(join(s))
Problem p02693 (python)

Fixed submission:
K = int(input())
A,B =list(map(int,input().split()))
count =0
while count * K<A:
	count +=1
if count *K <=B:
	print("OK")
else:
	print("NG")

Buggy submission (verdict: Runtime Error):
K = int(input())
A,B =list(map(int,input().split()))
count =0
while count * K<A:
	count +=1
if count *K <=B:
	print("OK")
else
	print("NG")
Problem p02759 (python)

Fixed submission:
import math

n = int(input())

n = math.ceil(n/2)

print(n)

Buggy submission (verdict: Runtime Error):
card = []

for _ in range(3):
    card.append(list(map(int, input().split())))

n = int(input())

b = []

for _ in range(n):
    b.append(int(input()))

for i in range(3):
    if card[i][0] in b and card[i][1] in b and card[i][2] in b:
        print('Yes')
        exit()
for i in range(3):
    if card[0][i] in b and card[1][i] in b and card[2][i] in b:
        print('Yes')
        exit()
if card[0][0] and card[1][1] and card[2][2]:
    print('Yes')
    exit()
if card[0][2] and card[1][1] and card[2][0]:
    print('Yes')
    exit()


print('No')
Problem p02773 (python)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
n = int(input())
answer = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        answer[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import OrderedDict
n = int(input())
answer = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        ans[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import OrderedDict
n = int(input())
ans = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        ans[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)
Problem p02835 (python)

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy submission (verdict: Runtime Error):
A: a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")
Problem p02836 (python)

Fixed submission:
s = input()
c = 0
first, second = s[:len(s)//2], s[(len(s)+1)//2:]
if first == reversed(second):
    print(c)
else:
    for x in range(len(first)):
        if first[x] != second[len(second)-x-1]:
            c += 1
    print(c)

Buggy submission (verdict: Runtime Error):
s = input()
c = 0
first, second = s[:len(s)//2], s[(len(s)+1)//2:]
if first == reversed(second):
    print(c)
else:
    for x in range(len(first)):
        if first[x] != second[len(second)-x-1]:
            count += 1
    print(c)

Buggy submission (verdict: Runtime Error):
s = input()
c = 0
first, second = s[:len(s)//2], s[(len(s)+1)//2:]
if f == reversed(second):
    print(c)
else:
    for x in range(len(first)):
        if first[x] != second[len(second)-x-1]:
            count += 1
    print(c)
Problem p03250 (python)

Fixed submission:
a,b,c= map(int,input().split())
print(a+b+c+9 * max(a, b, c))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(a+b+c+9 * max(a, b, c))
Problem p03107 (python)

Fixed submission:
def unification(S: str) -> int:
    c0 = sum([int(c) for c in S])
    c1 = sum([1 - int(c) for c in S])

    return min(c0, c1) * 2


if __name__ == "__main__":
    S = input()
    answer = unification(S)
    print(answer)

Buggy submission (verdict: Runtime Error):
def unification(S: str) -> int:
    q = set([S])
    min_len = len(S)
    while len(q) > 0:
        t = []
        for s in q:
            min_len = len(s)
            for i, c in enumerate(s):
                if i + 1 < len(s) and c != s[i+1]:
                    t.append(s[:i] + s[i+2:])
        q = set(t)

    return len(S) - min_len


if __name__ == "__main__":
    S = input()
    answer = unification(S)
    print(answer)
Problem p03242 (python)

Fixed submission:
s = input()
t = ''
for c in s:
    if c == '1':
        t += '9'
    elif c == '9':
        t += '1'
print(t)

Buggy submission (verdict: Runtime Error):
s = input()
t = ''
for c in s:
    if c = '1':
        t += '9'
    elif c = '9':
        t += '1'
print(t)