Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S:
	print('No')
elif d<c:
	if not '...' in S:
    	print ('No')
	if d <= n and S[d]=='#' and d-2 >= 0 and S[d-2]=='#':
		print('No')
else:
	print('Yes')



Fixed submission:
n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S[a-1:c] or '##' in S[b-1:d] :
	print('No')
elif d < c and not '...' in S[b-2:d+1]:
        print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S:
	print('No')
elif d<c:
	if not '...' in S:
    	print ('No')
	if d <= n and S[d]=='#' and d-2 >= 0 and s[d-2]=='#':
		print('No')
else:
	print('Yes')



Fixed submission:
n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S[a-1:c] or '##' in S[b-1:d] :
	print('No')
elif d < c and not '...' in S[b-2:d+1]:
        print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n, a, b, c, d = (map(int, input().split()))
S = input()
import re
if '##' in S:
  return 'No'
elif d>c and not '...' in S:
  return 'No'
elif c==d:
  return 'No'
else:
  return 'Yes'

Fixed submission:
n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S[a-1:c] or '##' in S[b-1:d] :
	print('No')
elif d < c and not '...' in S[b-2:d+1]:
        print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [[input()] for _ in range(h)]
row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end='')
        print()


Fixed submission:
h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()

row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True

for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [[input().split()] for _ in range(h)]
row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end='')
        print()


Fixed submission:
h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()

row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True

for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
int a = 0
if n >= 105:
    a += 1
if n >= 165:
  a += 1
if n >= 195:
  a += 1
print(a)


Fixed submission:
n = int(input())
a = 0
if n >= 105:
    a += 1
if n >= 135:
    a += 1
if n >= 165:
    a += 1
if n >= 189:
    a += 1
if n >= 195:
    a += 1
print(a)

Buggy python submission (verdict: Runtime Error):
n = int(input().split())
if n >= 105:
    print(1)
else:
  print(0)


Fixed submission:
n = int(input())
a = 0
if n >= 105:
    a += 1
if n >= 135:
    a += 1
if n >= 165:
    a += 1
if n >= 189:
    a += 1
if n >= 195:
    a += 1
print(a)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
t2 = t[-1] + t[1:]
while t2 != t:
  if s == t2:
    print("yes")
    return 0
  t2 = t[-1] + t[1:]
print("no")

Fixed submission:
s = input()
t = input()
for _ in range(len(t)):
  if s == t:
    print("Yes")
    exit()
  t = t[-1] + t[:-1]
print("No")

Buggy python submission (verdict: Runtime Error):
import copy
s = input()
t = input()
t2 = t[-1] + t[1:]
while t2 != t:
  if s = t2:
    print("yes")
    return 0
  t2 = t[-1] + t[1:]
print("no")

Fixed submission:
s = input()
t = input()
for _ in range(len(t)):
  if s == t:
    print("Yes")
    exit()
  t = t[-1] + t[:-1]
print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) - 1 for _ in range(n)]
print(sum(a))

Fixed submission:
_ = input()
a = list(map(int,input().split()))
print(sum(a) - len(a))
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
n, m = map(int, input().split())
bridge = [True] * (n-1)  
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if all(bridge[a-1:a-1 + (b-a)]):
    bridge[b-2] = False
    count += 1
print(count)


Fixed submission:
from operator import itemgetter
n, m = map(int, input().split())
bridge = 0
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if not a <= bridge <= b:
    count += 1
    bridge = b-1
print(count)

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
n, m = map(int, input().split())
bridge = 0
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if not a <= bridge <= b:
    counr += 1
    bridge = b
print(count)


Fixed submission:
from operator import itemgetter
n, m = map(int, input().split())
bridge = 0
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if not a <= bridge <= b:
    count += 1
    bridge = b-1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
n, m = map(int, input().split())
bridge = [True] * (n-1)  
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if all(bridge[a-1:a-1 + (b-a)]):
    bridge[b-2] = False
    count += 1
print(count)

Fixed submission:
from operator import itemgetter
n, m = map(int, input().split())
bridge = 0
ab = []
for _ in range(m):
  a, b = map(int, input().split())
  ab.append((a,b))
ab = sorted(ab, key=itemgetter(1))
count = 0
for a, b in ab:
  if not a <= bridge <= b:
    count += 1
    bridge = b-1
print(count)
Buggy python submission (verdict: Runtime Error):
a = input().split()
if a[0]* a[1] % 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a = input().split()
if int(a[0])* int(a[1]) % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if NM >= sum(A):
  print(NM-sum(A))
else:
  print(-1)


Fixed submission:
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if NM => sum(A):
  print(NM-sum(A))
else:
  print(-1)


Fixed submission:
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]

N = NM[0]
M = NM[1]

if NM => sum(A):
  print(NM-sum(A))
else:
  print(-1)


Fixed submission:
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split()]
A = [int(i) fot i in input().split()]

N = NM[0]
M = NM[1]

if NM => sum(A):
  print(NM-sum(A))
else:
  print(-1)


Fixed submission:
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
NM = [int(i) for i in input().split(" ")]
A = [int(i) fot i in input().split(" ")]

N = NM[0]
M = NM[1]

if NM => sum(A):
  print(NM-sum(A))
else:
  print(-1)

Fixed submission:
NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
num_str = input().split(" ")
S = input()

N = int(num_str[0])
K = int(num_str[1])

if S[K-1] == "A":
  S[K-1] = "a"
elif S[K-1] == "B":
  S[K-1] = "b"
elif S[K-1] == "C":
  S[K-1] = "c"
  
print(S)

Fixed submission:
num_str = input().split(" ")
S = input()

N = int(num_str[0])
K = int(num_str[1])
s = list(S)

if s[K-1] == "A":
  s[K-1] = "a"
elif s[K-1] == "B":
  s[K-1] = "b"
elif s[K-1] == "C":
  s[K-1] = "c"

S = "".join(s)
print(S)

Buggy python submission (verdict: Runtime Error):
num_str = input()
num_str = num_str.split("")

Fixed submission:
num_str = input().split(" ")
S = input()

N = int(num_str[0])
K = int(num_str[1])
s = list(S)

if s[K-1] == "A":
  s[K-1] = "a"
elif s[K-1] == "B":
  s[K-1] = "b"
elif s[K-1] == "C":
  s[K-1] = "c"

S = "".join(s)
print(S)

Buggy python submission (verdict: Runtime Error):
num_str = input()
num_str = num_str.split("")
N = int(num_str[0])
K = int(num_str[2])

S = input()

if S[K-1] == "A":
  S[K-1] = "a"
elif S[K-1] == "B":
  S[K-1] = "b"
elif S[K-1] == "C":
  S[K-1] = "c"
  
print(S)


Fixed submission:
num_str = input().split(" ")
S = input()

N = int(num_str[0])
K = int(num_str[1])
s = list(S)

if s[K-1] == "A":
  s[K-1] = "a"
elif s[K-1] == "B":
  s[K-1] = "b"
elif s[K-1] == "C":
  s[K-1] = "c"

S = "".join(s)
print(S)

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

if S[K] == "A":
  S[K] = "a"
elif S[K] == "B":
  S[K] = "b"
elif S[K] == "C":
  S[K] = "c"

Fixed submission:
num_str = input().split(" ")
S = input()

N = int(num_str[0])
K = int(num_str[1])
s = list(S)

if s[K-1] == "A":
  s[K-1] = "a"
elif s[K-1] == "B":
  s[K-1] = "b"
elif s[K-1] == "C":
  s[K-1] = "c"

S = "".join(s)
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
n = [list(map(int, input().split())) for i in range(2)]

N = n[0].pop(0)
A = n[1]

for i in range(1,N+1):
    p=A.count(i)
    print(p)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

mem = [0]*(n)
for i in range(n-1):
    mem[a[i]-1] += 1

for i in mem:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = [list(map(int, input().split())) for i in range(2)]

N = n[0].pop(0)
A = n[1]

for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

mem = [0]*(n)
for i in range(n-1):
    mem[a[i]-1] += 1

for i in mem:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
    s.append(sorted(input()))

#ans = []
#for i in range(n):
    #ans.append(sorted(s[i]))

x = 0
for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            x = x + 1

print(x)

Fixed submission:
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
    
v = list(Counter(s).values())
ans = []
for i in range(len(v)):
    if v[i] >= 2:
        ans.append((v[i] * (v[i]-1))/2)

print(int(sum(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
    s.append(input())

ans = []
for i in range(n):
    ans.append(sorted(s[i]))

x = 0
for i in range(n):
    for j in range(i+1, n):
        if ans[i] == ans[j]:
            x = x + 1

print(x)

Fixed submission:
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
    
v = list(Counter(s).values())
ans = []
for i in range(len(v)):
    if v[i] >= 2:
        ans.append((v[i] * (v[i]-1))/2)

print(int(sum(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
s=str(input())
K=int(input())
l=len(s)
a=[]
for i in range(0,l):
    for j in range(i,l):
        a.append(s[i:j+1])
a=sorted(list(set(a)))
print(a[K-1])

Fixed submission:
s=str(input())
K=int(input())
l=len(s)
a=[]
for i in range(0,l):
    for j in range(i,min(l,i+5)):
        a.append(s[i:j+1])
a=sorted(list(set(a)))
print(a[K-1])
Buggy python submission (verdict: Runtime Error):
#入力
S_prime = str(input())
T = str(input())
ans = []

if len(S_prime) >= len(T):
    times = len(S_prime) - len(T) + 1
    for i in range(times):
        count = 0
        for j in range(len(T)):
            if S_prime[i+j] == '?':
                count = count + 1
            elif S_prime[i+j] != T[j]:
                continue
            else:
                count = count + 1
            
        if count == len(T):
            S_prime = S_prime[:i] + T + S_prime[(i+len(T)+1):]
            S = S_prime.replace('?', 'a')
            ans.append(S)


if len(ans) != 0:
    print(min(ans))
else:
    print('UNRESTORABLE')

Fixed submission:
#入力
S_prime = str(input())
T = str(input())
ans = []

if len(S_prime) >= len(T):
    times = len(S_prime) - len(T) + 1
    for i in range(times):
        count = 0
        for j in range(len(T)):
            if S_prime[i+j] == '?':
                count = count + 1
            elif S_prime[i+j] != T[j]:
                continue
            else:
                count = count + 1
            
        if count == len(T):
            S = S_prime[:i] + T + S_prime[(i+len(T)):]
            S = S.replace('?', 'a')
            ans.append(S)


if len(ans) != 0:
    print(min(ans))
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
r=input()#入力を受け取る
ans = r*2*3.14
print(ans)

Fixed submission:
r=int(input())#入力を受け取る
ans = r*2*3.14
print(ans)
Buggy python submission (verdict: Runtime Error):
import functools
import math

n = int(input())
a = list(map(int, input().split()))

gcd = functools.reduce(math.gcd, a)
print(gcd)


Fixed submission:
n = int(input())
x = list(map(int, input().split()))

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

if n==1:
    print(x[0])
else:
    element = gcd(x[0], x[1])
    if n==2:print(element)
    else:
        for i in range(2,n):
            element=gcd(element,x[i])
        print(element)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
while True:
    a[0] = a[0] % a[1]
    if a[0] <= 0:
        a = a[1:]
    a.sort(reverse=True)
    if len(a) == 1:
        print(a[0])
        break


Fixed submission:
n = int(input())
x = list(map(int, input().split()))

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

if n==1:
    print(x[0])
else:
    element = gcd(x[0], x[1])
    if n==2:print(element)
    else:
        for i in range(2,n):
            element=gcd(element,x[i])
        print(element)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = input()
M = {X[0:3]:1}
result = {}

for i in range(3,N):
    i = X[i]
    keys = M.keys()
    for j in tuple(keys):
        if (j, i) in result:
            continue
        M[j[0]+j[1]+i] = 1
        M[j[0]+j[2]+i] = 1
        M[j[1]+j[2]+i] = 1
        result[(j,i)] = True

print (len(M))

Fixed submission:
M1, D1 = [int(_) for _ in input().split(" ")]
M2, D2 = [int(_) for _ in input().split(" ")]
if M1 == M2:
    print (0)
else:
    print (1)
Buggy python submission (verdict: Runtime Error):
X = int(input())

V = (100, 101, 102, 103, 104, 105)
#V = (3, 4, 8, 11)
Memo = [0] * (X+1)

if X < min(V):
    print (0)
    exit()

for i in range(len(V)):
    Memo[V[i]] = 1
    for j in range(1, X+1):
        if j - V[i] > 0:
            Memo[j] |= Memo[j-V[i]]

print (Memo[X])
#print (Memo)


Fixed submission:
X = int(input())

V = (100, 101, 102, 103, 104, 105)
#V = (3, 4, 8, 11)
Memo = [0] * (X+1)

if X < min(V):
    print (0)
    exit()

for i in range(len(V)):
    if V[i] > X:
      continue
    Memo[V[i]] = 1
    for j in range(1, X+1):
        if j - V[i] > 0:
            Memo[j] |= Memo[j-V[i]]

print (Memo[X])
#print (Memo)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = input()
M = { X[0:3]:1 }
result = {}

for i in range(3, N) :
	i = X[i]
	keys = M.keys()
	for j in tuple(keys) :
		if (j, i) in result :
			continue
		M[j[0] + j[1] + i] = 1
		M[j[0] + j[2] + i] = 1
		M[j[1] + j[2] + i] = 1
		result[(j, i)] = True
	if len(M) == 1000:
		break

print(len(M))


Fixed submission:
N = int(input())
X = input()
#X = "196341362415710923461093419237419237417234162348162390471092374190237410982374901"*300
#N = len(X)
M = { }
A = set()
A.add(X[0]+X[1])
for i in range(2, N) :
    i = X[i]
    for j in tuple(A):
        M[j + i] = 1
        A.add(j[0]+i)
        A.add(j[1]+i)

    if len(M) == 1000:
        break
print(len(M))

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = input()
M = {X[0:3]:1}
result = {}

for i in range(3,N):
    i = X[i]
    keys = M.keys()
    for j in tuple(keys):
        if (j, i) in result:
            continue
        M[j[0]+j[1]+i] = 1
        M[j[0]+j[2]+i] = 1
        M[j[1]+j[2]+i] = 1
        result[(j,i)] = True
	if len(M) == 729:
      break
print (len(M))

Fixed submission:
N = int(input())
X = input()
#X = "196341362415710923461093419237419237417234162348162390471092374190237410982374901"*300
#N = len(X)
M = { }
A = set()
A.add(X[0]+X[1])
for i in range(2, N) :
    i = X[i]
    for j in tuple(A):
        M[j + i] = 1
        A.add(j[0]+i)
        A.add(j[1]+i)

    if len(M) == 1000:
        break
print(len(M))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = input()
M = {X[0:3]:1}
result = {}

for i in range(3,N):
    i = X[i]
    keys = M.keys()
    for j in tuple(keys):
        if (j, i) in result:
            continue
        M[j[0]+j[1]+i] = 1
        M[j[0]+j[2]+i] = 1
        M[j[1]+j[2]+i] = 1
        result[(j,i)] = True

print (len(M))

Fixed submission:
N = int(input())
X = input()
#X = "196341362415710923461093419237419237417234162348162390471092374190237410982374901"*300
#N = len(X)
M = { }
A = set()
A.add(X[0]+X[1])
for i in range(2, N) :
    i = X[i]
    for j in tuple(A):
        M[j + i] = 1
        A.add(j[0]+i)
        A.add(j[1]+i)

    if len(M) == 1000:
        break
print(len(M))
Buggy python submission (verdict: Runtime Error):
N, L = [int(_) for _ in raw_input()]
if L == 1:
  print 0
else:
  print N - L 

Fixed submission:
N, K = [int(_) for _ in raw_input().split(" ")]
if K == 1:
  print 0
else:
  print (N - K)
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
ret = ()

for i in range(N):
  ret += (tuple([int(_) for _ in raw_input().split(" ")]),)

t = [[0]*N for _ in range(N)]
d = {}
for i in range(N):
  for j in range(i+1, N):    
    x = ret[i][0] - ret[j][0]
    y = ret[i][1] - ret[j][1]
    if not (x,y) in d:
      d[(x,y)] = []
    if not (-x, -y) in d:
      d[(-x, -y)] = []

    d[(x,y)] += [(i,j)]
    d[(-x,-y)] += [(j, i)]

d = [(len(d[_]), _, d[_]) for  _ in d]
d.sort(reverse=True)
d = d[0][2]
ans = [1] * N
current = d[0]
count = 0
while(len(d) > 0):
  count += 1
  current = d[0]
  ans[current[0]] = 0
  ans[current[1]] = 0
  d.remove(current)
  t = [current[0], current[1]]
  c1 = t[0]
  c2 = t[1]

  while(len(d) > 0):
    for i in d:
      if i[1] == c1:
        d.remove(i)
        c1 = i[0]
        ans[c1] = 0
        t = [c1] + t
        break
    else:
      break

  while(len(d) > 0):
    for i in d:
      if c2 == i[0]:
        d.remove(i)
        c2 = i[1]
        ans[c2] = 0
        t = t + [c2]
        break
    else:
      break
  
  #print t
print sum(ans) + count

Fixed submission:
N = int(raw_input())
ret = ()

for i in range(N):
  ret += (tuple([int(_) for _ in raw_input().split(" ")]),)

t = [[0]*N for _ in range(N)]
d = {}
for i in range(N):
  for j in range(i+1, N):    
    x = ret[i][0] - ret[j][0]
    y = ret[i][1] - ret[j][1]
    if not (x,y) in d:
      d[(x,y)] = []
    if not (-x, -y) in d:
      d[(-x, -y)] = []

    d[(x,y)] += [(i,j)]
    d[(-x,-y)] += [(j, i)]

d = [(len(d[_]), _, d[_]) for  _ in d]
if len(d) == 0:
  print 1
  exit()
d.sort(reverse=True)
d = d[0][2]
ans = [1] * N
current = d[0]
count = 0
while(len(d) > 0):
  count += 1
  current = d[0]
  ans[current[0]] = 0
  ans[current[1]] = 0
  d.remove(current)
  t = [current[0], current[1]]
  c1 = t[0]
  c2 = t[1]

  while(len(d) > 0):
    for i in d:
      if i[1] == c1:
        d.remove(i)
        c1 = i[0]
        ans[c1] = 0
        t = [c1] + t
        break
    else:
      break

  while(len(d) > 0):
    for i in d:
      if c2 == i[0]:
        d.remove(i)
        c2 = i[1]
        ans[c2] = 0
        t = t + [c2]
        break
    else:
      break
  
  #print t
print sum(ans) + count
Buggy python submission (verdict: Runtime Error):
AB, BC, AC = [int(_) for _ in raw_input().split(" ")]

M = [[0, AB, AC],
     [AB, 0, BC],
     [AC, BC, 0]]

def A(l):
    t = [0] * l
    def Sub(targetList, n):
        if 1:
            if len(targetList) == 1:
                t[n] = targetList[0]
                yield t
                t[n] = 0
            for i in range(len(targetList)):
                p = targetList[:i] + targetList[i+1:]
                t[n] = targetList[i]
                for j in Sub(p, n+1):
                    yield j
        else:
            pass
    
    for i in (Sub(tuple(range(l)), 0)):
        yield i

_min = 10**100
for i in A(3):
    _sum = 0
    for j in range(1, len(i)):
        _from = i[j-1]
        _to = i[j]        
        _sum += M[_from][_to]
    #print (_sum)
    if _min > _sum:
        _min = _sum
print (_sum)
        

Fixed submission:
l = [int(_) for _ in raw_input().split(" ")]
l.sort()
print l[0] + l[1]
Buggy python submission (verdict: Time Limit Exceeded):
#4
#1 3 1 1
G, N = [int(_) for _ in input().split(" ")]
ret = ()
for i in range(N):
  ret += (int(input()),)

T = [0]*(G+1)

T[0] = 1
T[1] = 1

if 1 in ret:
  T[1] = 0

for i in range(2, G+1):
	if i in ret:
		T[i] = 0
		continue
	T[i] = (T[i-1] + T[i-2]) % 1000000007

print (T[G])

Fixed submission:
G, N = [int(_) for _ in input().split(" ")]
ret = ()
T = [-1]*(G+1)
T[0] = 1
T[1] = 1
for i in range(N):
  t = int(input())
  T[t] = 0

for i in range(2, G+1):
	if T[i] == -1:
		T[i] = (T[i-1] + T[i-2]) % 1000000007

print (T[G])

Buggy python submission (verdict: Time Limit Exceeded):
#4
#1 3 1 1
G, N = [int(_) for _ in input().split(" ")]
ret = ()
for i in range(N):
  ret += (int(input()),)

T = [0]*(G+1)

T[0] = 1
T[1] = 1

if 1 in ret:
  T[1] = 0

for i in range(2, G+1):
	if i in ret:
		T[i] = 0
		continue
	T[i] = T[i-1] + T[i-2]

print (T[G] % 1000000007)

Fixed submission:
G, N = [int(_) for _ in input().split(" ")]
ret = ()
T = [-1]*(G+1)
T[0] = 1
T[1] = 1
for i in range(N):
  t = int(input())
  T[t] = 0

for i in range(2, G+1):
	if T[i] == -1:
		T[i] = (T[i-1] + T[i-2]) % 1000000007

print (T[G])