Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl

def get_median(arr) :
	
	idx = len(arr) + 1
	idx = int(idx / 2) - 1
	return arr[idx]

N = int(input())
X = [int(i) for i in input().split()]
X2 = X[:]
X2.sort(reverse=True)
dic = {}

for i in range(len(X)) :
	l = X2[:]
	key = l.pop(i)
	if (key not in dic) :
		dic[key] = get_median(l)

for i in X :
	print(dic[i])

Fixed submission:
N = int(input())
X = [int(i) for i in input().split()]
X2 = sorted(X)
mapper = {}

for i in range(N//2) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[len(X2)//2]

for i in range(N//2,N) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[(len(X2)//2) - 1]

for x in X :
    print(mapper[x])

Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl

def get_median(arr) :
	arr.sort(reverse=True)
	
	idx = len(arr) + 1
	idx = int(idx / 2) - 1
	return arr[idx]

N = int(input())
X = [int(i) for i in input().split()]

for i in range(len(X)) :
	l = X[:]
	l.pop(i)
	print(get_median(l))

Fixed submission:
N = int(input())
X = [int(i) for i in input().split()]
X2 = sorted(X)
mapper = {}

for i in range(N//2) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[len(X2)//2]

for i in range(N//2,N) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[(len(X2)//2) - 1]

for x in X :
    print(mapper[x])
Buggy python submission (verdict: Time Limit Exceeded):
def main() :
    X,Y = [int(i) for i in input().split()]

    if (X == Y or Y == 1) :
        print(-1)
        return
    
    if (X == 1) :
        print(Y+1)
        return
    
    n = X
    while (n < 1000000000000000000) :
        if (n % X == 0 and n % Y != 0) :
            print(n)
            return
        
        n += X
    
    print(-1)

main()



Fixed submission:
def main() :
    X,Y = [int(i) for i in input().split()]
    if (X % Y == 0) :
        print(-1)    
    else :
        print(X)
    

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main() :
    X,Y = [int(i) for i in input().split()]

    if (X == Y) :
        print(-1)
        return
    
    n = X
    while (n < 1000000000000000000) :
        if (n % X == 0 and n % Y != 0) :
            print(n)
            return
        
        n += X
    
    print(-1)

main()



Fixed submission:
def main() :
    X,Y = [int(i) for i in input().split()]
    if (X % Y == 0) :
        print(-1)    
    else :
        print(X)
    

main()
Buggy python submission (verdict: Runtime Error):
n,a,b = [int(i) for i in input().split()]
if (a＊n < b) :
  print(a＊n)
else :
  print(b)

Fixed submission:
n,a,b = [int(i) for i in input().split()]
if (a*n < b) :
  print(a*n)
else :
  print(b)
Buggy python submission (verdict: Runtime Error):
R = int(input())
G = int(input())

print(2G-R)

Fixed submission:
R = int(input())
G = int(input())

print(2*G-R)
Buggy python submission (verdict: Runtime Error):
a,b,c = [int(i) for i in input().split()]

if ([a,b,c].count(a) = 1) :
	print(a)
elif ([a,b,c].count(b) = 1) :
	print(b)
else :
	print(c)


Fixed submission:
a,b,c = [int(i) for i in input().split()]

if ([a,b,c].count(a) == 1) :
	print(a)
elif ([a,b,c].count(b) == 1) :
	print(b)
else :
	print(c)
Buggy python submission (verdict: Runtime Error):
def draw_map(count_map, row_index, col_index) :
	for i in range(row_index-1, row_index+2) :
		if (i < 0 or len(count_map) <= i) :
			continue
		for j in range(col_index-1, col_index+2) :
			if (j < 0 or len(count_map[0]) <= j) :
				continue
			count_map[i][j] += 1
	
	return count_map
    				
    			

H,W = [int(i) for i in input().split()]
mines = []
for i in range(H) :
	mines.append(input())

# 白地図を用意して、1ずつ足す
# 空きマスだったら数字に置き換える
count_map = [[0 for i in range(W)] for j in range(H)]
for i in range(H) :
	for j in range(W) :
		if (mines[i][j] == "#") :
			mine_map = draw_map(count_map,i,j)

for i in range(H) :
	out_line = ""
	for j in range(H) :
		if (mines[i][j] == ".") :
			out_line += str(count_map[i][j])
		else :
			out_line += "#"
	print(out_line)
    		


Fixed submission:
def draw_map(count_map, row_index, col_index) :
	for i in range(row_index-1, row_index+2) :
		if (i < 0 or len(count_map) <= i) :
			continue
		for j in range(col_index-1, col_index+2) :
			if (j < 0 or len(count_map[0]) <= j) :
				continue
			count_map[i][j] += 1
	
	return count_map
    				
    			

H,W = [int(i) for i in input().split()]
mines = []
for i in range(H) :
	mines.append(input())

# 白地図を用意して、1ずつ足す
# 空きマスだったら数字に置き換える
count_map = [[0 for i in range(W)] for j in range(H)]
for i in range(H) :
	for j in range(W) :
		if (mines[i][j] == "#") :
			mine_map = draw_map(count_map,i,j)

for i in range(H) :
	out_line = ""
	for j in range(W) :
		if (mines[i][j] == ".") :
			out_line += str(count_map[i][j])
		else :
			out_line += "#"
	print(out_line)
Buggy python submission (verdict: Time Limit Exceeded):
def main() :
    N = int(input())
    # N = float(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    # for h in range(1,3501) :
    for h in range(3500,0,-1) :
        for n in range(1,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n) / bo * 1.0
            if (omega > 0 and omega.is_integer() == True) :
                print(h,n,int(omega))
                return

main()

Fixed submission:
def main() :
    N = int(input())
    # N = float(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    # for h in range(1,3501) :
    for h in range(1,3500) :
        # 組み合わせでみればいいので1からじゃなくてよい
        for n in range(h,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n) / bo * 1.0
            if (omega > 0 and omega.is_integer() == True) :
                print(h,n,int(omega))
                return

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main() :
    N = int(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    for h in range(1,3501) :
        for n in range(1,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n * 1.0) / (bo * 1.0)
            if (omega.is_integer() == True and omega > 0) :
                print(h,n,int(omega))
                return

main()

Fixed submission:
def main() :
    N = int(input())
    # N = float(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    # for h in range(1,3501) :
    for h in range(1,3500) :
        # 組み合わせでみればいいので1からじゃなくてよい
        for n in range(h,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n) / bo * 1.0
            if (omega > 0 and omega.is_integer() == True) :
                print(h,n,int(omega))
                return

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main() :
    N = int(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    for h in range(1,3501) :
        for n in range(1,3501) :
            if ((4*h*n - N*n - N*h) == 0) :
                continue

            omega = (N * h * n * 1.0) / ((4*h*n - N*n - N*h) * 1.0)
            if (omega.is_integer() == True and omega >= 0) :
                print(h,n,int(omega))
                return

main()

Fixed submission:
def main() :
    N = int(input())
    # N = float(input())

    # 式変形していいかんじに下ごしらえして、
    # 2変数分のループで全探索する。O(3500^2)なら間に合うはず。

    # for h in range(1,3501) :
    for h in range(1,3500) :
        # 組み合わせでみればいいので1からじゃなくてよい
        for n in range(h,3501) :
            bo = 4*h*n - N*n - N*h
            if (bo == 0) :
                continue

            omega = (N * h * n) / bo * 1.0
            if (omega > 0 and omega.is_integer() == True) :
                print(h,n,int(omega))
                return

main()
Buggy python submission (verdict: Runtime Error):
import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)

keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
    print(1)
elif (len(c) == 2) :
    if (abs(a_li[0] - a_li[1]) <= 1 ) :
        print(2)
    else :
        print(1)
else :
    for k in range(len(c) -2 ) :
        sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
        if (max_sum < sum_v) :
            max_sum = sum_v
    
    print(max_sum)





Fixed submission:
X ,t = [int(i) for i in input().split()]
if (X > t) :
    print(X-t)
else :
    print(0)
Buggy python submission (verdict: Runtime Error):
import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)

keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
    print(1)
elif (len(c) == 2) :
    if (abs(a_li[0] - a_li[1]) <= 1 ) :
        print(2)
    else :
        print(1)
else :
    for k in range(len(c) -2 ) :
        sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
        if (max_sum < sum_v) :
            max_sum = sum_v
    
    print(max_sum)





Fixed submission:
import collections as cl
N = int(input())
a_li = [int(i) for i in input().split()]
a_li2 = [i-1 for i in a_li]
a_li3 = [i+1 for i in a_li]
a_li.extend(a_li2)
a_li.extend(a_li3)
c = cl.Counter(a_li)
print(c.most_common()[0][1])

# keys = list(c.keys())
# max_sum = 0
# if (len(c) == 1) :
#     # 1種類しかない
#     print(len(a_li))
# elif (len(c) == 2) :
#     # 2種類ある
#     if (abs(int(keys[0]) - int(keys[1])) <= 2 ) :
#         # 差が2以下なら全部同じ値にできる
#         print(len(a_li))
#     else :
#         # 差が2より大きいなら多いほうの個数が最大
#         if (int(c[keys[0]]) > int(c[keys[1]])) :
#             print(c[keys[0]])
#         else :
#             print(c[keys[1]])
# else :
#     # この思想はNG。keys[k]からkeys[k+2]の差が2以下じゃないと成り立たない。
#     for k in range(len(c) -2 ) :
#         sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
#         if (max_sum < sum_v) :
#             max_sum = sum_v
    
#     print(max_sum)

Buggy python submission (verdict: Runtime Error):
import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)
print(c)
# for k in list(c.keys())[:-2] :
keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
    print(1)
elif (len(c) == 2) :
    if (abs(a_li[0] - a_li[1]) <= 1 ) :
        print(2)
    else :
        print(1)
else :
    for k in range(len(c) -2 ) :
        sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
        if (max_sum < sum_v) :
            max_sum = sum_v
    
    print(max_sum)





Fixed submission:
import collections as cl
N = int(input())
a_li = [int(i) for i in input().split()]
a_li2 = [i-1 for i in a_li]
a_li3 = [i+1 for i in a_li]
a_li.extend(a_li2)
a_li.extend(a_li3)
c = cl.Counter(a_li)
print(c.most_common()[0][1])

# keys = list(c.keys())
# max_sum = 0
# if (len(c) == 1) :
#     # 1種類しかない
#     print(len(a_li))
# elif (len(c) == 2) :
#     # 2種類ある
#     if (abs(int(keys[0]) - int(keys[1])) <= 2 ) :
#         # 差が2以下なら全部同じ値にできる
#         print(len(a_li))
#     else :
#         # 差が2より大きいなら多いほうの個数が最大
#         if (int(c[keys[0]]) > int(c[keys[1]])) :
#             print(c[keys[0]])
#         else :
#             print(c[keys[1]])
# else :
#     # この思想はNG。keys[k]からkeys[k+2]の差が2以下じゃないと成り立たない。
#     for k in range(len(c) -2 ) :
#         sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
#         if (max_sum < sum_v) :
#             max_sum = sum_v
    
#     print(max_sum)
Buggy python submission (verdict: Runtime Error):
n = int(input()) -1
m = int(input()) -1
print(n * m)

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

Buggy python submission (verdict: Runtime Error):
n = int(input()) -1
m = int(input()) -1
print(n * m)

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

Buggy python submission (verdict: Runtime Error):
print((int(input()) -1) * (int(input()) -1))

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

Buggy python submission (verdict: Runtime Error):
print((int(input()) -1) * (int(input()) -1))

Fixed submission:
n,m = [int(i) -1 for i in input().split()]
print(n * m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

power = 1
for i in range(1,N+1) :
    power *= i

print(power % 1000000007)


Fixed submission:
N = int(input())

power = 1
for i in range(1,N+1) :
    power = i * (power % 1000000007)

print(power % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = [int(i) for i in input().split()]
patterns = 0

for x in range(K+1) :
    x = int(x)
    for y in range(K+1) :
        y = int(y)
        z = S - x - y
        if (0 <= z and z <= K) :
            patterns += 1

print(patterns)


Fixed submission:
K,S = [int(i) for i in input().split()]
patterns = 0

for x in range(K+1) :
    for y in range(K+1) :
        z = S - x - y
        if (0 <= z and z <= K) :
            patterns += 1

print(patterns)
Buggy python submission (verdict: Runtime Error):
a,b,c = [int(i) for i in input().split()]

if (sum(a,b,c) == max(a,b,c) * 2) :
	print("Yes")
else :
	print("No")

Fixed submission:
a,b,c = [int(i) for i in input().split()]

if (sum([a,b,c]) == max(a,b,c) * 2) :
	print("Yes")
else :
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = [int(i) for i in input().split()]

# タプルを作って裏返したペアが存在するかどうか
tupple = []
for i in range(N) :
    s = str(i+1) + ' ' + str(li[i])
    tupple.append(s)

c = 0
for tup in tupple :
    t = tup.split()
    needle = t[1] + ' ' + t[0]
    if needle in tupple :
        c += 1

print(c//2)

Fixed submission:
N = int(input())
li = [int(i) for i in input().split()]

c = 0
for i in range(1,N+1) :
    # iを基準に行って帰ってこれればOK
    if (i == li[li[i-1]-1]) :
        c += 1

print(c//2)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int, input().split())
if Y%2==1:
    print('No')
else:
    kame=Y//4
    Y=Y-(kame*4)
    turu=Y//2
    if (turu+kame)==X:
        print('Yes')
    else:
        print('No')


Fixed submission:
def main():
  input_number = list(map(int, input().split()))
  for i in range(5):
    if input_number[i]==0:
      print(i+1)
      exit()

if __name__=='__main__':
  main()

Buggy python submission (verdict: Runtime Error):
X,Y = map(int, input().split())
if Y%2==1:
    print("No")
else:
    kame=Y//4
    Y=Y-(kame*4)
    turu=Y//2
    if (turu+kame)==X:
        print("Yes")
    else:
        print('No')


Fixed submission:
def main():
  input_number = list(map(int, input().split()))
  for i in range(5):
    if input_number[i]==0:
      print(i+1)
      exit()

if __name__=='__main__':
  main()

Buggy python submission (verdict: Runtime Error):
def main():
  input_number=list(map(int, input().split()))
  for i in input:
    if i==0:
      print(i)
      break

if __name__=='__main__':
  main()

Fixed submission:
def main():
  input_number = list(map(int, input().split()))
  for i in range(5):
    if input_number[i]==0:
      print(i+1)
      exit()

if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
N = []
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))

Fixed submission:
N = int(input())
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))

Buggy python submission (verdict: Runtime Error):
N = []
N.append(input())

print("AC" + " x "+ N.count("AC"))
print("WA" + " x "+ N.count("WA"))
print("TLE" + " x "+ N.count("TLE"))
print("RE" + " x "+ N.count("RE"))

Fixed submission:
N = int(input())
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))

Buggy python submission (verdict: Runtime Error):
N = []
N.append(input())

print("AC" + " x "+ count("AC"))
print("WA" + " x "+ count("WA"))
print("TLE" + " x "+ count("TLE"))
print("RE" + " x "+ count("RE"))

Fixed submission:
N = int(input())
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

j =0
for i in S:
  if i != T[j]:
    count +=1
  j+=1

print(count)

Fixed submission:
S = input()
T = input()
count = 0
j =0
for i in S:
  if i != T[j]:
    count +=1
  j+=1

print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
 
count = 0
for i in S:
  if S[i] != T[i]:
    count +=1
 
print(count)

Fixed submission:
S = input()
T = input()
count = 0
j =0
for i in S:
  if i != T[j]:
    count +=1
  j+=1

print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
 
count = 0
for i in range(S):
  if S[i] != T[i]:
    count +=1

print(count)
    
 


Fixed submission:
S = input()
T = input()
count = 0
j =0
for i in S:
  if i != T[j]:
    count +=1
  j+=1

print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(S):
  if S[i] != T[i]:
    T[i] = S[i]

print(S)
print(T)

Fixed submission:
S = input()
T = input()
count = 0
j =0
for i in S:
  if i != T[j]:
    count +=1
  j+=1

print(count)
Buggy python submission (verdict: Runtime Error):
IN = input()
if str.isupper(IN):
  return "A"
else:
  return "a"

Fixed submission:
s = input()
if s.isupper():
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
IN = input()
if IN.str.isupper():
  return "A"
else:
  return "a"

Fixed submission:
s = input()
if s.isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
X,Y =input().split()

if (Y % 2 == 0) and (4*X >= Y >=2*X):
    print('Yes')

else:
    print('No')

Fixed submission:
X,Y =map(int,input().split())

if (Y % 2 == 0) and (4*X >= Y >=2*X):
    print('Yes')

else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
print(int(a * b))

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

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
printint(a * b)

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

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(str(a * b))

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

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a * b)

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

Buggy python submission (verdict: Runtime Error):
N =int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

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

Buggy python submission (verdict: Runtime Error):
N =int(input())
A = list(map(int, input().split()))
 
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

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

Buggy python submission (verdict: Runtime Error):
ans = A * B
print(ans)

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

Buggy python submission (verdict: Runtime Error):
ans = a * b
print(ans)

Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
K = int(input())
Sub = input()

if len(Sub) <= K:
  print(Sub)
elif len(Sub) > K:
  print(Sub[0:K]+"...")

Fixed submission:
num = int(input()[-1])
 
if num == 3:
  print("bon")
elif num == 0 or num ==1 or num ==6 or num ==8:
  print("pon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
K = int(input())
Subj = input()
 
if len(Subj) <= K:
  print(Subj)
elif len(Subj) > K:
  print(Subj[0:K-1]+"...")

Fixed submission:
num = int(input()[-1])
 
if num == 3:
  print("bon")
elif num == 0 or num ==1 or num ==6 or num ==8:
  print("pon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
num = int(input())

if num[-1] == 2 or 4 or 5 or 7 or 9:
  print("hon")
elif num[-1] == 0 or 1 or 6 or 8:
  print("pon")
else:
  print("bon")

Fixed submission:
num = int(input()[-1])
 
if num == 3:
  print("bon")
elif num == 0 or num ==1 or num ==6 or num ==8:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
import collections

NO_OF_DIMENSIONS = 2
no_of_edges_by_dim = [0] * NO_OF_DIMENSIONS
n, no_of_edges_by_dim[0], no_of_edges_by_dim[1] = (int(x) for x in input().split())

graph_by_dimension = [[[] for _ in range(n + 1)] for _ in range(NO_OF_DIMENSIONS)]

for dimension, no_of_edges in enumerate(no_of_edges_by_dim):
    graph = graph_by_dimension[dimension]
    for _ in range(no_of_edges):
        p, q = (int(x) for x in input().split())
        graph[p].append(q)
        graph[q].append(p)

components_ids_by_vertex = [[None] * NO_OF_DIMENSIONS for _ in range(n + 1)]

def dfs(dimension_id, vertex_id, colour):
    components_ids_by_vertex[vertex_id][dimension_id] = colour
    for s in graph_by_dimension[dimension_id][vertex_id]:
        if not components_ids_by_vertex[s][dimension_id]:
            dfs(dimension_id, s, colour)

for i in range(NO_OF_DIMENSIONS):
    for j in range(1, n + 1):
        if not components_ids_by_vertex[j][i]:
            dfs(i, j, j)

components_ids_by_vertex = [tuple(x) for x in components_ids_by_vertex]

results = collections.Counter(components_ids_by_vertex)

for i in range(1, n + 1):
    print(results[components_ids_by_vertex[i]], end=' ')
print()


Fixed submission:
import collections

NO_OF_DIMENSIONS = 2
no_of_edges_by_dim = [None] * NO_OF_DIMENSIONS
n, no_of_edges_by_dim[0], no_of_edges_by_dim[1] = (int(x) for x in input().split())

graph_by_dimension = [[[] for _ in range(n + 1)] for _ in range(NO_OF_DIMENSIONS)]

for dimension, no_of_edges in enumerate(no_of_edges_by_dim):
    graph = graph_by_dimension[dimension]
    for _ in range(no_of_edges):
        p, q = (int(x) for x in input().split())
        graph[p].append(q)
        graph[q].append(p)

components_ids_by_vertex = [[None] * NO_OF_DIMENSIONS for _ in range(n + 1)]

def dfs(dimension_id, vertex_id, colour):
    stack = [vertex_id]
    while len(stack):
        vertex_id = stack.pop()
        components_ids_by_vertex[vertex_id][dimension_id] = colour
        for s in graph_by_dimension[dimension_id][vertex_id]:
            if not components_ids_by_vertex[s][dimension_id]:
                stack.append(s)

for i in range(NO_OF_DIMENSIONS):
    for j in range(1, n + 1):
        if not components_ids_by_vertex[j][i]:
            dfs(i, j, j)

components_ids_by_vertex = [tuple(x) for x in components_ids_by_vertex]

results = collections.Counter(components_ids_by_vertex)

for i in range(1, n + 1):
    print(results[components_ids_by_vertex[i]], end=' ')
print()
Buggy python submission (verdict: Runtime Error):
s = raw_input()
abc = " ABC "
arc = " ARC "
if s = abc:
  print " ARC"
elif s = arc:
  print " ABC "

Fixed submission:
s = raw_input()
if s == "ABC":
    print "ARC"
if s == "ARC":
    print"ABC"