Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print('Yes')

Fixed submission:
N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, key=lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(N):
  a, b = input().split()
  l.append((i+1, a, int(b)))
  
l = sorted(l, key=lambda x: (x[1],x[2]))
for i in l:
  print(i[0])

Fixed submission:
n = int(input())
l = []
for i in range(n):
  a, b = input().split()
  l.append((i+1, a, int(b)))
  
l = sorted(l, key=lambda x: (x[1],-x[2]))
for i in l:
  print(i[0])
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
BC = [[int(i) for i in input().split()] for i in range(M)]
BC = sorted(BC, key=lambda x:-x[1])
ans = 0
for b, c in BC:
    i = bisect(A, c)
    i = min(i, b)
    A = A[i:]
    ans += c * i
print(ans+sum(A))

Fixed submission:
from bisect import bisect
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
BC = [[int(i) for i in input().split()] for i in range(M)]
BC = sorted(BC, key=lambda x:-x[1])
ans = 0
offset=0

for b, c in BC:
    i = bisect(A, c, lo=offset)
    i = min(i-offset, b)
    ans += c * i
    offset += i

print(ans+sum(A[offset:]))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
BC = [[int(i) for i in input().split()] for i in range(M)]
BC = sorted(BC, key=lambda x:-x[1])
ans = 0
for b, c in BC:
    i = bisect(A, c)
    i = min(i, b)
    A = A[i:]
    ans += c * i
print(ans+sum(A))

Fixed submission:
from bisect import bisect
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
BC = [[int(i) for i in input().split()] for i in range(M)]
BC = sorted(BC, key=lambda x:-x[1])
ans = 0
offset=0

for b, c in BC:
    i = bisect(A, c, lo=offset)
    i = min(i-offset, b)
    ans += c * i
    offset += i

print(ans+sum(A[offset:]))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
g = defaultdict(list)
visited = defaultdict(bool)
N = int(input())
ans = [0] * N

def dfs(v, d=0):
    if visited[v]:
        return
    visited[v] = True
    if d % 2:
        ans[v-1] = 1
    for c,w in g[v]:
        dfs(c, d+w)

for j in range(N-1):
    u,v,w = map(int, input().split())
    g[u].append((v, w))
    g[v].append((u, w))

dfs(1)

for a in ans:
    print(a)

Fixed submission:
from sys import setrecursionlimit, getrecursionlimit
setrecursionlimit(getrecursionlimit()*10000)
from collections import defaultdict
g = defaultdict(list)
visited = defaultdict(bool)
N = int(input())
ans = [0] * N

def dfs(v, d=0):
    if visited[v]:
        return
    visited[v] = True
    if d % 2:
        ans[v-1] = 1
    for c,w in g[v]:
        dfs(c, d+w)

for j in range(N-1):
    u,v,w = map(int, input().split())
    g[u].append((v, w))
    g[v].append((u, w))

dfs(1)

for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
g = defaultdict(list)

N, M = map(int, input().split())
for i in range(M):
    X, Y, Z = map(int, input().split())
    g[X].append(Y)
    g[Y].append(X)

ans = 0
not_visited = {i:True for i in range(1, N+1)}

def dfs(v):
    if v in not_visited:
        del not_visited[v]
    for c in g[v]:
        if c in not_visited:
            dfs(c)

s = 1
while True:
    dfs(s)
    ans += 1
    if not len(not_visited):
        break
    for v in not_visited.keys():
        s = v
        break

print(ans)

Fixed submission:
class DisjointSet:
    def __init__(self):
        self.rank = {}
        self.p = {}

    def makeSet(self, x):
        self.p[x] = x
        self.rank[x] = 0

    def same(self, x, y):
        return self.findSet(x) == self.findSet(y)

    def unite(self, x, y):
        self.link(self.findSet(x), self.findSet(y))

    def link(self, x, y):
        if x == y:
            return
        if(self.rank[x] > self.rank[y]):
            self.p[y] = x
        else:
            self.p[x] = y
            if(self.rank[x] == self.rank[y]):
                self.rank[y] += 1

    def findSet(self, x):
        if(x != self.p[x]):
            self.p[x] = self.findSet(self.p[x])
        return self.p[x]



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

ds = DisjointSet()
for i in range(N):
    ds.makeSet(i+1)

for i in range(M):
    X, Y, Z = map(int, input().split())
    ds.unite(X, Y)

ans = set()

for i in range(1, N+1):
    a = ds.findSet(i)
    ans.add(a)

print(len(ans))

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
g = defaultdict(list)

N, M = map(int, input().split())
for i in range(M):
    X, Y, Z = map(int, input().split())
    g[X].append(Y)
    g[Y].append(X)

ans = 0
not_visited = {i:True for i in range(1, N+1)}

def dfs(v):
    if v in not_visited:
        del not_visited[v]
    for c in g[v]:
        if c in not_visited:
            dfs(c)

s = 1
while True:
    dfs(s)
    ans += 1
    if not len(not_visited):
        break
    for v in not_visited.keys():
        s = v
        break

print(ans)

Fixed submission:
class DisjointSet:
    def __init__(self):
        self.rank = {}
        self.p = {}

    def makeSet(self, x):
        self.p[x] = x
        self.rank[x] = 0

    def same(self, x, y):
        return self.findSet(x) == self.findSet(y)

    def unite(self, x, y):
        self.link(self.findSet(x), self.findSet(y))

    def link(self, x, y):
        if x == y:
            return
        if(self.rank[x] > self.rank[y]):
            self.p[y] = x
        else:
            self.p[x] = y
            if(self.rank[x] == self.rank[y]):
                self.rank[y] += 1

    def findSet(self, x):
        if(x != self.p[x]):
            self.p[x] = self.findSet(self.p[x])
        return self.p[x]



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

ds = DisjointSet()
for i in range(N):
    ds.makeSet(i+1)

for i in range(M):
    X, Y, Z = map(int, input().split())
    ds.unite(X, Y)

ans = set()

for i in range(1, N+1):
    a = ds.findSet(i)
    ans.add(a)

print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
mb = N//B+1
for r in range(N//R+1):
    for g in range(N//G+1):
        b = (N - r*R - g*G)/B
        if 0 <= b < mb and int(b) == b:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
mb = N//B+1
for r in range(N//R+1):
    for g in range(N//G+1):
        b = (N - r*R - g*G)/B
        if 0 <= b < mb and int(b) == b:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func ini() {
	var buf = make([]byte, 10000)
	sc.Buffer(buf, 1000000)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	ini()
	N, _ := strconv.Atoi(nextLine())
	S := nextLine()
	b := make([]int, N+1)

	for i, s := range S {
		if s == '#' {
			b[i+1] = b[i] + 1
		} else {
			b[i+1] = b[i]
		}
	}
	ans := N
	for i := 1; i < N+1; i++ {
		ans = min(ans, b[i]+N-i-b[N]+b[i-1])
	}
	fmt.Println(ans)
}


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

b = [0] * N
for i, s in enumerate(S):
    if s == '#':
        b[i] = b[i-1] + 1
    else:
        b[i] = b[i-1]
b = [0] + b + [0]
ans = N
for i in range(N+1):
    ans = min(ans, b[i] + N - i - b[N] + b[i-1])

print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
if a == 'A': print('T')
elif a == 'T':print('A')
else a == 'C': print('G')
else:print('C')

Fixed submission:
a = input()
if a == 'A': print('T')
elif a == 'T':print('A')
elif a == 'C': print('G')
else:print('C')
Buggy python submission (verdict: Runtime Error):
100 1 10

Fixed submission:
A, B, C = map(int, input().split())
print(min(B//A, C))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
l = len(S)
while True:
    s = S.replace('01', '')
    if s == S:
        break
    S = s
while True:
    s = S.replace('10', '')
    if s == S:
        break
    S = s
print(l - len(S))

Fixed submission:
from collections import Counter
c = Counter(input())
print(2*min(c['0'], c['1']))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted([int(i) for i in input().split()])

if A[0] == A[N-1]:
    print(A[0])
elif all([a % A[0] == 0 for a in A]):
    print(A[0])
elif all([a % 2 == 0 for a in A]):
    print(2)
    exit()
a = sorted(list(set(A)))
a1 = a[0] 
a2 = a[1]
a = max(a1,a2)
b = min(a1,a2)
while a != b:
    t = a - b
    a = max(t, b)
    b = min(t, b)
if a != 0:
    print(a)
else:
    print(1)

Fixed submission:
from functools import reduce
from fractions import gcd
N = int(input())
A = sorted([int(i) for i in input().split()])
print(reduce(lambda a, b: gcd(a, b), A))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

# dp[i] = i 本のマッチ棒を使って、条件を満たす整数を作るときの最大桁数
dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(dp[i-h[a]] + 1, dp[i])

digit = dp[N]
ans = ''

n = N
for d in range(digit):
    for a in A:
        if dp[n - h[a]] == digit - 1:
            ans += str(a)
            n -= h[a]
            digit -= 1
            break
print(ans)

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

# dp[i] = i本使ってできる最大の数

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(10*dp[i-h[a]] + a, dp[i])

print(dp[N])

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

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

# dp[i] = i 本のマッチ棒を使って、条件を満たす整数を作るときの最大桁数
dp = [-float('inf')] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(dp[i-h[a]] + 1, dp[i])

digit = dp[N]
ans = ''

n = N
for d in range(digit):
    for a in A:
        if dp[n - h[a]] == digit - 1:
            ans += str(a)
            n -= h[a]
            digit -= 1
            break
print(ans)

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

# dp[i] = i本使ってできる最大の数

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(10*dp[i-h[a]] + a, dp[i])

print(dp[N])

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

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

# dp[i] = i 本のマッチ棒を使って、条件を満たす整数を作るときの最大桁数
dp = [-float('inf')] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        #if i - h[a] < 0: continue
        dp[i] = max(dp[i-h[a]] + 1, dp[i])


digit = dp[N]
ans = ''

n = N
for d in range(digit):
    for a in A:
        if dp[n - h[a]] == digit - 1:
            ans += str(a)
            n -= h[a]
            digit -= 1
            break
print(ans)

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

# dp[i] = i本使ってできる最大の数

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(10*dp[i-h[a]] + a, dp[i])

print(dp[N])
Buggy python submission (verdict: Runtime Error):
print(d)


Fixed submission:
N, M = map(int, input().split())
X = sorted([int(i) for i in input().split()])
d = sorted([X[i] - X[i-1] for i in range(1, M)])
ans = 0
c = 0
for i in d:
    if c > M - N - 1:
        break
    ans += i
    c += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
m = max(K, max(A))
l = len('{0:b}'.format(m))
fs = '{0:0'+str(l)+'b}'
import numpy as np
a = np.array([[int(i) for i in fs.format(a)] for a in A])
ans = ''

for i in range(N):
    ik = a[:, [i]].sum()
    zk = N - ik
    if ik > zk:
        ans += '0'
    else:
        ans += '1'

def f(X):
    return sum([x ^ X for x in A])

print(f(int(ans,2)))


Fixed submission:
from numpy import array
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
k = '{0:040b}'.format(K)
a = array([[int(i) for i in '{0:040b}'.format(a)] for a in A])
ans = list(k)

f = False
for i in range(40):
    if k[i] == '0' and not f:
        continue
    ik = a[:, [i]].sum()
    zk = N - ik
    if ik > zk:
        ans[i] = '0'
        f = True
    else:
        ans[i] = '1'

ans = ''.join(ans)
k = int(ans, 2)
print(sum([x ^ k for x in A]))
Buggy python submission (verdict: Time Limit Exceeded):
class DisjointSet:
    def __init__(self):
        self.rank = {}
        self.p = {}

    def makeSet(self, x):
        self.p[x] = x
        self.rank[x] = 0

    def same(self, x, y):
        return self.findSet(x) == self.findSet(y)

    def unite(self, x, y):
        self.link(self.findSet(x), self.findSet(y))

    def link(self, x, y):
        if(self.rank[x] > self.rank[y]):
            self.p[y] = x
        else:
            self.p[x] = y
            if(self.rank[x] == self.rank[y]):
                self.rank[y] += 1

    def findSet(self, x):
        if(x != self.p[x]):
            self.p[x] = self.findSet(self.p[x])
        return self.p[x]

H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

ds = DisjointSet()
for i in range(H):
    for j in range(W):
        ds.makeSet((i,j))

for i in range(H):
    for j in range(W):
        if i + 1 < H and S[i][j] != S[i+1][j]:
            ds.unite((i,j), (i+1, j))
        if 0 <= i - 1 and S[i][j] != S[i-1][j]:
            ds.unite((i,j), (i-1, j))
        if j + 1 < W and S[i][j] != S[i][j+1]:
            ds.unite((i,j), (i, j+1))
        if 0 <= j - 1 and S[i][j] != S[i][j-1]:
            ds.unite((i,j), (i, j-1))

from collections import defaultdict

c1 = defaultdict(int)
c2 = defaultdict(int)

for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            c1[ds.findSet((i,j))] += 1
        else:
            c2[ds.findSet((i,j))] += 1
ans = 0
for i in c1.keys():
    ans += c1[i] * c2[i]
print(ans)

Fixed submission:
class DisjointSet:
    def __init__(self):
        self.rank = {}
        self.p = {}

    def makeSet(self, x):
        self.p[x] = x
        self.rank[x] = 0

    def same(self, x, y):
        return self.findSet(x) == self.findSet(y)

    def unite(self, x, y):
        self.link(self.findSet(x), self.findSet(y))

    def link(self, x, y):
        if(self.rank[x] > self.rank[y]):
            self.p[y] = x
        else:
            self.p[x] = y
            if(self.rank[x] == self.rank[y]):
                self.rank[y] += 1

    def findSet(self, x):
        if(x != self.p[x]):
            self.p[x] = self.findSet(self.p[x])
        return self.p[x]

H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

ds = DisjointSet()
for i in range(H):
    for j in range(W):
        ds.makeSet((i,j))

for i in range(H):
    for j in range(W):
        if i + 1 < H and S[i][j] != S[i+1][j]:
            ds.unite((i,j), (i+1, j))
        if 0 <= i - 1 and S[i][j] != S[i-1][j]:
            ds.unite((i,j), (i-1, j))
        if j + 1 < W and S[i][j] != S[i][j+1]:
            ds.unite((i,j), (i, j+1))
        if 0 <= j - 1 and S[i][j] != S[i][j-1]:
            ds.unite((i,j), (i, j-1))

from collections import defaultdict

c1 = defaultdict(int)
c2 = defaultdict(int)

for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            c1[ds.findSet((i,j))] += 1
        else:
            c2[ds.findSet((i,j))] += 1
ans = 0
for i in c1.keys():
    ans += c1[i] * c2[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
10 587586158 185430194
894597290 708587790
680395892 306946994
590262034 785368612
922328576 106880540
847058850 326169610
936315062 193149191
702035777 223363392
11672949 146832978
779291680 334178158
615808191 701464268

Fixed submission:
N, H, W = map(int, input().split())
ans = 0
for i in range(N):
    a, b = map(int, input().split())
    if a >= H and b >= W:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = [int(i) for i in input().split()]
e = []
o = []
for i, a in enumerate(v):
    if i % 2:
        o.append(a)
    else:
        e.append(a)
oc = Counter(o)
ec = Counter(e)
h = n//2
if oc.most_common(1)[0][0] != ec.most_common(1)[0][0]:
    a = h - oc.most_common(1)[0][1]
    b = h - ec.most_common(1)[0][1]
    print(a+b)
else:
    E1 = E2 = 0
    for i, (k, v) in ec.most_common(2):
        if i == 0:
            E2 = E1 = k
        else:
            E2 = k
    O1 = O2 = 0
    for i, (k, v) in oc.most_common(2):
        if i == 0:
            O2 = O1 = k
        else:
            O2 = k
    print(min(h-ec[E1] + h - oc[O2], h - ec[E2] + h - oc[O1]))

Fixed submission:
from collections import Counter
n = int(input())
v = [int(i) for i in input().split()]
e = []
o = []
for i, a in enumerate(v):
    if i % 2:
        o.append(a)
    else:
        e.append(a)
oc = Counter(o)
ec = Counter(e)
h = n//2
if oc.most_common(1)[0][0] != ec.most_common(1)[0][0]:
    a = h - oc.most_common(1)[0][1]
    b = h - ec.most_common(1)[0][1]
    print(a+b)
else:
    if len(oc) == 1:
        print(h)
        exit()
    E1 = E2 = 0
    for i, (k, v) in enumerate(ec.most_common(2)):
        if i == 0:
            E2 = E1 = k
        else:
            E2 = k
    O1 = O2 = 0
    for i, (k, v) in enumerate(oc.most_common(2)):
        if i == 0:
            O2 = O1 = k
        else:
            O2 = k
    print(min(h-ec[E1] + h - oc[O2], h - ec[E2] + h - oc[O1]))
Buggy python submission (verdict: Runtime Error):
from math import sqrt, ceil, factorial
from collections import Counter

m = 10**9+7
def is_prime(n):
    if n == 1: return False
    if n == 2: return True
    for i in range(2, ceil(sqrt(n))+1):
        if n % i == 0: return False
    return True

def prime_factorization(n):
    if is_prime(n):return [n]
    factor = []
    f = 2
    while n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

def comb(n, r):
    a = 1
    for i in range(n-r+1, n+1):
        a *= i
    return a//factorial(r)

N, M = map(int, input().split())
p = prime_factorization(M)
c = Counter(p)
ans = 1
for v in c.values():
    ans *= (comb(v + N - 1, v) % m)
print(ans%m)

Fixed submission:
S = input()
T = input()
ans ='Yes'
d = {}
d2 = {}
for s, t in zip(S, T):

    if d.get(s) is not None:
        if d[s] != t:
            ans = 'No'
            break
    else:
        d[s] = t

    if d2.get(t) is not None:
        if d2[t] != s:
            ans = 'No'
            break
    else:
        d2[t] = s

print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
ans ='Yes'
d = {}
for i, (s, t) in enumerate(zip(S, T)):
    if s == t:
        continue
    if d.get(s) is not None or d.get(t) is not None:
        if d[s] != t or d[t] != s:
            ans = 'No'
            break
    d[s] = t
    d[t] = s
    
print(ans)

Fixed submission:
S = input()
T = input()
ans ='Yes'
d = {}
d2 = {}
for s, t in zip(S, T):

    if d.get(s) is not None:
        if d[s] != t:
            ans = 'No'
            break
    else:
        d[s] = t

    if d2.get(t) is not None:
        if d2[t] != s:
            ans = 'No'
            break
    else:
        d2[t] = s

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd

Fixed submission:
from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))

Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
N, X = map(int, input().split())

Fixed submission:
from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))

Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]

Fixed submission:
from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))

Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))


Fixed submission:
from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
from math import gcd
from functools import reduce
def lcm(a, b):
    return a*b//gcd(a, b)
l = [x[i+1] - x[i] for i in range(N)]
print(reduce(lcm, l))

Fixed submission:
from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = [abs(X-int(i)) for i in input().split()]
print(reduce(gcd, x))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
t=[[j for j in input()] for h in range(H)]
h = [False for i in range(H)]
w = [False for i in range(H)]
for i,v in enumerate(t):
    h[i] = v.count('#') != 0
for i, v in enumerate(list(map(list, zip(*t)))):
    w[i] = v.count('#') != 0

for i,x in enumerate(h):
    end=''
    for j,y in enumerate(w):
        if x and y:
            print(t[i][j],end='')
            end='\n'
    print(end=end)

Fixed submission:
H, W = map(int, input().split())
m = []
for i in range(H):
    r = list(input())
    if r == ['.'] * W:continue
    m.append(r)

k = []
for i in range(W):
    if [m[j][i] for j in range(len(m))] == ['.'] * len(m):
        k.append(i)

ans = []    
for r in m:
    t = []
    for i,l in enumerate(r):
        if  not i in k:
            t.append(l)
    ans.append(t)
for l in ans:
    print(''.join(l))