Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    A = list(map(int, input().split()))
    allB = exc = 1
    for i in n:
        allB *= 3
        if i%2 == 0:
            exc *= 2
    ans = allB - exc
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    A = list(map(int, input().split()))
    allB = 3**n
    exc = 1
    for i in range(n):
        if A[i]%2 == 0:
            exc *= 2
    ans = allB - exc
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
t = l[0]
for i in l[1:]:
  if t == i:
    c += 1
  else:
    ans += c%2
    c = 1
    t = i
print(ans)
  

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) _ for in range(n)]
l.sort()
c = 1
t = l[0]
for i in l[1:]:
  if t == i:
    c += 1
  else:
    ans += c%2
    c = 1
    t = i
print(ans)
  

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
n = int(input())
l = [input() for _ in range(n)]
s = set(l)
for i in s:
  if l.count(i)%2 != 0:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
n = int(input())
l = [int(input()) for _ in range(n)]
s = set(l)
for i in s:
  if l.count(i)%2 != 0:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
n = int(input())
l = [int(input()) for _ in range(n)]
s = set(l)
for i in s:
  if l.count(i)%2 != 0:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    ans = 0
    n = int(input())
    l = list(map(int, input().split()))
    for i in range(n):
        if l[i] == i+1:
            l[i] = l[i+1]
            l[i+1] = i+1
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    ans = 0
    n = int(input())
    l = list(map(int, input().split()))
    for i in range(n-1):
        if l[i] == i+1:
            l[i] = l[i+1]
            l[i+1] = i+1
            ans += 1
    if l[n-1] == n:
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import string

input = sys.stdin.readline

def main():
    ans = 'None'
    S = list(set(input()))
    s = list(string.ascii_lowercase)
    for i in S:
        s.remove(i)
    if s:
        ans = s[0]
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import string

input = sys.stdin.readline

def main():
    ans = 'None'
    S = input()
    s = string.ascii_lowercase
    for i in s:
        if i not in S:
            ans = i
            break
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
import string

input = sys.stdin.readline

def main():
    ans = 'None'
    S = set(input())
    s = list(string.ascii_lowercase)
    for i in S:
        s.remove(i)
    if s:
        ans = s[0]
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import string

input = sys.stdin.readline

def main():
    ans = 'None'
    S = input()
    s = string.ascii_lowercase
    for i in s:
        if i not in S:
            ans = i
            break
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
l2 = list(set(l))
l2.sort(reverse=True)
a = 0
for i in range(len(l2)-1):
  if 2 <= l.count(l2[i]) <= 3:
    a = l2[i]
    for j in range(i+1, len(l2)):
      if 2 <= l.count(l2[j]):
        print(a * l2[j])
        sys.exit()
  elif l.count(l2[i]) >= 4:
    print(l2[i]**2)
    sys.exit()
print(0)

Fixed submission:
import collections as c

n = int(input())
co = c.Counter(list(map(int, input().split())))
cm = sorted(co.items(), key=lambda x:x[0], reverse=True)
a = 0
b = 0
for v,m in cm:
  if m >= 4:
    if a == 0:
      a = b = v
    else:
      b = v
    break
  elif m >= 2 and a == 0:
    a = v
  elif m >= 2 and a != 0:
    b = v
    break
print(a*b)
Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
l = [int(input()) for _ in range(n)]
ans = l[i]
for i in range(n):
  ans = ans * l[i] // fractions.gcd(ans, l[i])
print(ans)

Fixed submission:
import fractions
n = int(input())
l = [int(input()) for _ in range(n)]
ans = l[0]
for i in range(n):
  ans = ans * l[i] // fractions.gcd(ans, l[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l =[64,32,16,8,4,2,1]
for i ib l:
  if i <= n:
    print(i)
    break;

Fixed submission:
n = int(input())
l = [64,32,16,8,4,2,1]
for i in l:
  if i <= n:
    print(i)
    break
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    s = [int(input()) for _ in range(n)]
    for i in range(2**n):
        tmp = 0
        for j in range(n):
            if i>>j&1:
                tmp += s[j]
        if tmp%10 != 0:
            ans = max(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    s = []   
    for i in range(n):
        t = int(input())
        ans += t
        s.append(t)
    s.sort()
    
    if ans%10 == 0:
        for i in range(n):
            if s[i]%10 != 0:
                ans -= s[i]
                break
    if ans%10 == 0:
      ans = 0
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline

def main():
    ans = 1
    N = int(input())
    for i in range(1,N+1):
        ans *= i 
    print(ans%(10**9+7))

if __name__ == '__main__':
    main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    ans = 1
    N = int(input())
    for i in range(1,N+1):
        ans = ans*i%(10**9+7)
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

#BGR, BRG, GBR, GRB, RBG, RGB
ans = 0
for j in range(N):
  for i in range(j):
    for k in range(j+1, N):
      if (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]) and (j - i != k - j):
        ans += 1
print(ans)    

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

#BGR, BRG, GBR, GRB, RBG, RGB
r, g, b = 0, 0, 0
for i in range(N):
    if S[i] == 'R':
        r += 1
    elif S[i] == 'G':
        g += 1
    else:
        b += 1

ans = r*g*b #条件1を満たす組みの総和

for i in range(N):
    for j in range(i+1, N):
        if 2*j - i < N:
            if S[i] != S[j] and S[i] != S[2*j-i] and S[j] != S[2*j-i]:
                ans -= 1
        else:
          continue
          
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [a for a in map(int, input().split())]

#N個のボールに対して、書かれている数字は1~Nまで

dic1 = {}
for i in range(N):
    dic1[i] = 0

#dicにkeyとなる数字の個数を入れていく
for i in A:
    if i in dic1.keys():
        dic1[i] += 1

dic2 = {}
#組み合わせの数を入れる   
for i in range(N):
    dic2[i] = dic1[i]*(dic1[i]-1)/2

ans1 = 0
for i in range(N):
    ans1 += dic2[i]

for i in range(N):
    ans2 = ans1
    ans2 -= dic2[A[i]] #組み合わせの数を引く
    ans2 += (dic1[A[i]]-1)*(dic1[A[i]]-2)/2 #新たな組み合わせの数を足す
    print(int(ans2))

Fixed submission:
N = int(input())
A = [a for a in map(int, input().split())]

#N個のボールに対して、書かれている数字は1~Nまで

dic1 = {}
for i in range(N):
    dic1[i+1] = 0

#dicにkeyとなる数字の個数を入れていく
for i in range(N):
    if A[i] in dic1.keys():
        dic1[A[i]] += 1

dic2 = {}
#組み合わせの数を入れる   
for i in range(N):
    dic2[i+1] = dic1[i+1]*(dic1[i+1]-1)/2

ans1 = 0
for i in range(N):
    ans1 += dic2[i+1]

for i in range(N):
    ans2 = ans1
    ans2 -= dic2[A[i]] #組み合わせの数を引く
    ans2 += (dic1[A[i]]-1)*(dic1[A[i]]-2)/2 #新たな組み合わせの数を足す
    print(int(ans2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [a for a in map(int, input().split())]

#N個のボールに対して、書かれている数字は1~Nまで

dic1 = {}
for i in range(N):
    dic1[i] = 0

#dicにkeyとなる数字の個数を入れていく
for i in A:
    if i in dic1.keys():
        dic1[i] += 1

dic2 = {}
#組み合わせの数を入れる   
for i in range(N):
    dic2[i] = dic1[i]*(dic1[i]-1)/2

ans1 = 0
for i in range(N):
    ans1 += dic2[i]

for i in range(N):
    ans2 = ans1
    ans2 -= dic2[A[i]] #組み合わせの数を引く
    ans2 += (dic1[A[i]]-1)*(dic1[A[i]]-2)/2
    print(ans2)

Fixed submission:
N = int(input())
A = [a for a in map(int, input().split())]

#N個のボールに対して、書かれている数字は1~Nまで

dic1 = {}
for i in range(N):
    dic1[i+1] = 0

#dicにkeyとなる数字の個数を入れていく
for i in range(N):
    if A[i] in dic1.keys():
        dic1[A[i]] += 1

dic2 = {}
#組み合わせの数を入れる   
for i in range(N):
    dic2[i+1] = dic1[i+1]*(dic1[i+1]-1)/2

ans1 = 0
for i in range(N):
    ans1 += dic2[i+1]

for i in range(N):
    ans2 = ans1
    ans2 -= dic2[A[i]] #組み合わせの数を引く
    ans2 += (dic1[A[i]]-1)*(dic1[A[i]]-2)/2 #新たな組み合わせの数を足す
    print(int(ans2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt1 = 0
cnt2 = 0
for i in range(n):
    if s[i] == '0':
        cnt1 += 1
    else:
        cnt2 += 1
print(min(cnt1, cnt2)*2)

Fixed submission:
S = input()
z_cnt = 0
o_cnt = 0
for i in S:
    if i == '0':
        z_cnt += 1
    if i == '1':
        o_cnt += 1
print(len(S)-(max(z_cnt,o_cnt)-min(z_cnt,o_cnt)))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_list = []
b_list = []
for i in range(M):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N+1)]
        self.rank = [0]*(N+1)
        self.size = [1] * (N + 1)
    
    def find(self, x):
        if self.par[x] == x:
            return self.par[x]
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def fsize(self, x):
        return self.size[self.par[x]]


    def unite(self, x, y):
        x_par = self.find(x)
        y_par = self.find(y)
        if x_par == y_par:
            return
        if self.rank[x_par] < self.rank[y_par]:
            self.par[x_par] = y_par
            self.size[y_par] += self.size[x_par]
        else:
            self.par[y_par] = x_par
            self.size[x_par] += self.size[y_par]
            if self.rank[x_par] == self.rank[y_par]:
                self.rank[x_par] += 1


    def isunite(self, x, y):
        if self.find(x) == self.find(y):
            return True
        else:
            return False


uf = UnionFind(N)
ans_list = []      
ans = int(N*(N-1)/2)
for i in range(M):
    ans_list.append(ans)
    a = a_list[M-1-i]
    b = b_list[M-1-i]
    if uf.isunite(a, b):
        pass
    else:
        p = uf.fsize(a)
        q = uf.fsize(b)
        ans -= p*q
        uf.unite(a, b)

for i in range(M):

Fixed submission:
N, M = map(int, input().split())
a_list = []
b_list = []
for i in range(M):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

par = [i for i in range(N+1)]
rank = [0]*(N+1)
size = [1] * (N + 1)

def find(x):
    if par[x] == x:
        return par[x]
    else:
        par[x] = find(par[x])
        return par[x]


def unite(x, y):
    x_par = find(x)
    y_par = find(y)
    if x_par == y_par:
        return
    if rank[x_par] < rank[y_par]:
        par[x_par] = y_par
        size[y_par] += size[x_par]
    else:
        par[y_par] = x_par
        size[x_par] += size[y_par]
        if rank[x_par] == rank[y_par]:
            rank[x_par] += 1


def bool_func(x, y):
    if find(x) == find(y):
        return True
    else:
        return False


ans_list = []      
ans = int(N*(N-1)/2)
for i in range(M):
    ans_list.append(ans)
    a = a_list[M-1-i]
    b = b_list[M-1-i]
    p = size[find(a)]
    q = size[find(b)]
    if bool_func(a, b):
        pass
    else:
        ans -= p*q
        unite(a, b)

for i in range(M):
    print(ans_list[M-1-i])
Buggy python submission (verdict: Time Limit Exceeded):
#dp[i]:i番目の足場に達した時のコストの最小値
#dp[i] = min(dp[i-k]+abs(h[i]-h[i-k])) (1<=k<=K)
#このままだとO(NK)で間に合わない?

N, K = map(int, input().split())
h = list(map(int, input().split()))
inf = 10**18

dp = [inf for i in range(N)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])

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

print(dp[N-1])

Fixed submission:
#dp[i]:i番目の足場に達した時のコストの最小値
#dp[i] = min(dp[i-k]+abs(h[i]-h[i-k])) (1<=k<=K)
#このままだとO(NK)で間に合わない?

import numpy as np

N, K = map(int, input().split())

h = np.array(input().split(), dtype=np.int64)
 
dp = np.zeros(N, dtype=np.int64)

for i in range(1, N):
    L = max(0, i-K)
    dp[i] = np.min(dp[L:i] + np.abs(h[i]-h[L:i]))

print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, W = map(int, input().split())
inf = 10**18
M = 10**5
#dp = [0 for i in range(10**5+1)]


dp = [[inf for i in range(M+1)] for j in range(N+1)]
dp[0][0] = 0
for i in range(N):
    w, val = map(int, input().split())
    for v in range(M+1):
        if v >= val:
            dp[i+1][v] = min(dp[i][v-val] + w, dp[i][v])
        else:
            dp[i+1][v] = dp[i][v]

for i in range(M+1):
    if dp[N][M-i] <= W:
        print(M-i)
        break

Fixed submission:
import numpy as np

N, W = map(int, input().split())
inf = 10**18
M = 10**5
#dp = [0 for i in range(10**5+1)]


dp = np.array([inf for i in range(M+1)])
dp[0] = 0
for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[:-v]+w, dp[v:])
    
for i in range(M+1):
    if dp[M-i] <= W:
        print(M-i)
        break
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
s = [0 for i in range(N+1)]
for i in range(N):
    s[i+1] = s[i] + a[i]
#s[i+1]にはa[0]からa[i]までの総和

nums = [0 for i in range(N+1)]
for i in range(N+1):
    nums[s[i]] += 1

ans = 0
for i in range(N+1):
    ans += nums[i]*(nums[i]-1)/2

print(int(ans))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
s = [0 for i in range(N+1)]
for i in range(N):
    s[i+1] = s[i] + a[i]
#s[i+1]にはa[0]からa[i]までの総和

dic = {}
for i in range(N+1):
    if dic.get(s[i]) == None:
        dic[s[i]] = 1
    else:
        dic[s[i]] += 1

ans = 0
for k in dic:
    ans += dic[k]*(dic[k]-1)/2

print(int(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum1 = 0
sum2 = 0
ans_list = []
for i in range(n):
    sum2 += a2[i]
for i in range(n-1):
    sum1 += a1[i]
    sum2 -= a2[i]
    ans1 = sum1 + sum2 + a1[i+1]
    ans2 = sum1 + sum2 + a2[i]
    ans_list.append(ans1)
    ans_list.append(ans2)       
print(max(ans_list))    

Fixed submission:
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum1 = 0
sum2 = 0
ans_list = []
for i in range(n):
    sum2 += a2[i]
if n != 1:    
    for i in range(n-1):
        sum1 += a1[i]
        sum2 -= a2[i]
        ans1 = sum1 + sum2 + a1[i+1]
        ans2 = sum1 + sum2 + a2[i]
        ans_list.append(ans1)
        ans_list.append(ans2)   
else:
    ans_list.append(a1[0]+a2[0])
print(max(ans_list))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
    if dic[a] = 1:
        i_list.append(a)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
    if dic[a] == 1:
        i_list.append(a)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
for i in a_list:
    if i not in i_list:
        i_list.append(i)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
    dic[a] = 0
for a in a_list:
    dic[a] += 1
    if dic[a] == 1:
        i_list.append(a)
ans = 0
for i in i_list:
    p = dic[i] - i 
    if p >= 0:
        ans += p
    else:
        ans += dic[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p_list = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if p_list[i] == i+1:
        p_list[i+1] = p_list[i]
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
p_list = list(map(int, input().split()))
cnt = 0
for i in range(n-1):
    if p_list[i] == i+1:
        p_list[i+1] = p_list[i]
        cnt += 1
if p_list[n-1] == n:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
else:
    if a <= c:
        print(min(b-c,d-c))
    else:
        print(min(d-a,b-a)
    

Fixed submission:
a,b,c,d = map(int, input().split())
if c >= b or a >= d:
    print(0)
else:
    if a <= c:
        print(min(b-c,d-c))
    else:
        print(min(d-a,b-a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = list(map(int, input().split()))
b = []
for a in num_list:
    b.append(a)
    b = [i for i in (reversed(b))]
for i in range(len(b)):
    if i != len(b)-1:
        print(b[i],end="")
        print(" ", end="")
    else:
        print(b[i])
    

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
a1_list = []
a2_list = []
n_list = [0]*n
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a2_list):
        print(i, end="")
        print(" ", end="")
    for i in a1_list:
        if i != a1_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
else:
    for i in range(1,n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a1_list):
        print(i, end="")
        print(" ", end="")
    print(a_list[0], end="")
    print(" ", end="")
    for i in a2_list:
        if i != a2_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
home_list = input().split()
home_list.sort()
print(home_list[n-1] - home_list[0])

Fixed submission:
n = int(input())
home_list = list(map(int, input().split()))
home_list.sort()
print(home_list[n-1] - home_list[0])

Buggy python submission (verdict: Runtime Error):
n = int(input())
home_list = input().split()
home_list.sort()
print(hpme_list[n-1] - home_list[0])

Fixed submission:
n = int(input())
home_list = list(map(int, input().split()))
home_list.sort()
print(home_list[n-1] - home_list[0])
Buggy python submission (verdict: Runtime Error):
#A*n = B*m + C
#Ax-By = Cを満たすx,yを求めよ
import fraction
a, b, c = map(int, input().split())
gcd = fraction.gcd(a, b)
if c % gcd == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
a, b, c = map(int, input().split())
def gcd(x,y):
    p = max(x,y)
    q = min(x,y)
    while p % q != 0:
        r = p % q
        p = q
        q = r
    c = q
    return q
if c % gcd(a,b) == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
count = int(input())
ent_list = []
for i in range(count):
    org_list = [j for j in input()]
    new_list = sorted(org_list)
    ent_list.append(new_list)
if count == 1:
    result = "".join(ent_list[0])
    print(result)
else:    
    for i in range(count-1):
        for j in range(len(ent_list[i+1])):
            if ent_list[i+1][j] in ent_list[i] == True:           
                ent_list[i].remove(ent_list[i+1][j])
            else:
                ent_list[i+1].remove(ent_list[i+1][j])
result = "".join(ent_list[count-1])
print(result)
#3
#cbaa
#daacc
#acacac                 

Fixed submission:
n = int(input())
#文字列を一列ごとにリストに入れる
S = [input() for _ in range(n)]
alphabet_str = "abcdefghijklmnopqrstuvwxyz"
#alphbetの文字列をリスト化
alphabets = list(alphabet_str)

s_maps = []
for s in S:
#sはSの文字列の一つ一つ
#文字列sをリスト化    
    strs = list(s)
#辞書を作る
    m = {}
#各alphbetの初期値を0にする
    for alphabet in alphabets:
        m[alphabet] = 0
#文字列の中にあるalphabetがあれば、辞書のvalueに1を追加
    for _str in strs:
        m[_str] += 1
#辞書をリストに突っ込む      
    s_maps.append(m) 
#print(s_maps)
ans = ""
#alphabetリストからalphabetを取り出す
for alphabet in alphabets:
    min_num = 51
#リストから辞書を一つずつ取り出す    
    for s_map in s_maps:
#n個の辞書の中から最小のvalueを取り出す
        min_num = min(s_map[alphabet], min_num)
    for i in range(min_num):
        ans += alphabet
print(ans)
#taku689さんのコードを大いに参考
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mul_list = []
for i in range(1, n+1):
    if n % i == 0:
        if i <= n / i:
            mul = [i, n/i]
            mul_list.append(mul)
        else:
            break
length = 10000000000000
result = 0
for line in mul_list:
    dif = len(str(line[1]))-len(str(line[0]))
    if dif < length:
       result = len(str(int(line[1])))
print(result)    

Fixed submission:
n = int(input())
mul_list = []
for i in range(1, n+1):
    if i <= n / i:
        if n % i == 0:
            mul = [i, n/i]
            mul_list.append(mul)
    else:
        break
length = 10000000000000
result = 0
for line in mul_list:
    dif = len(str(line[1]))-len(str(line[0]))
    if dif < length:
       result = len(str(int(line[1])))
print(result)
Buggy python submission (verdict: Runtime Error):
line = input().split()
if line[0] = "H" and line[1] = "H":
    print("H")
elif line[0] = "H" and line[1] = "D":
    print("D")
elif line[0] = "D" and line[1] = "H":
    print("D")
else:
    print("H")
    

Fixed submission:
line = input().split()
if line[0] == "H" and line[1] == "H":
    print("H")
elif line[0] == "H" and line[1] == "D":
    print("D")
elif line[0] == "D" and line[1] == "H":
    print("D")
else:
    print("H")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m >= n*2:
    leave_c = m - n*2
    available = leave_c // 4
    print(n + available)
else:
    availabe_c = m // 2
    print(available_c)

Fixed submission:
n, m = map(int, input().split())
if m >= n*2:
    leave_c = m - n*2
    available = leave_c // 4
    print(n + available)
else:
    available_c = m // 2
    print(available_c)