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

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)

v = [-1] * (N + 1)
n = 1
f = 0

for i in range(N):
    v[n] = i
    n = A[n]
    if v[n] != -1:
        f = 1
        s = n #ループのスタート
        t = i
        l = t - v[s] + 1
        break

if t >= K:
    print(v.index(K))
else:
    K = (K - v[s]) % l
    print(v.index(K + v[s]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)

v = [-1] * (N + 1)
n = 1
f = 0

for i in range(N):
    v[n] = i
    n = A[n]
    if v[n] != -1:
        f = 1
        s = n #ループのスタート
        t = i
        l = t - v[s] + 1
        break

if t >= K:
    print(v.index(K))
else:
    K = (K - s) % l
    print(v.index(K + s))
Problem p02768 (python)

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

mod = 10**9 + 7

ans = pow(2, n, mod)

ans -= 1

aa = 1
for i in range(1, a+1):
    aa = (aa * (n - i + 1) * pow(i, -1, mod)) % mod

bb = 1
for i in range(1, b+1):
    bb = (bb * (n - i + 1) * pow(i, -1, mod)) % mod

ans = (ans - aa - bb) % mod

print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

mod = 10**9 + 7

ans = pow(2, n, mod)

ans -= 1

aa = 1
for i in range(1, a+1):
    aa = (aa * (n - i + 1) * pow(i, -1, mod)) % mod

bb = 1
for i in range(1, b+1):
    bb = (bb * (n - i + 1) * pow(i, -1, mod)) % mod

ans = (ans - aa - bb) % mod

print(ans)
Problem p03282 (python)

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


for i in range(K):
    if S[i] != "1":
        print(S[i])
        break
    if i == K-1:
        print(S[K-1])

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

if K > 100:
    print(S[0])
else:
    for i in range(K + 1):
        if S[i] != "1":
            print(S[i])
            break
        if i == K:
            print(S[K])
Problem p04015 (python)

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

dp = [[[0] * 2550 for i in range(55)] for i in range(55)]

dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for k in range(2451):
            dp[i+1][j+1][k+x[i]] += dp[i][j][k]
            dp[i+1][j][k] += dp[i][j][k]

ans = 0
for i in range(1, N+1):
    ans += dp[N][i][A*i]

print(ans)

Buggy submission (verdict: Runtime Error):
N, A = map(int, input().split())
x = list(map(int, input().split()))

dp = [[[0] * 2500 for i in range(51)] for i in range(51)]

dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for k in range(2451):
            dp[i+1][j+1][k+x[i]] += dp[i][j][k]
            dp[i+1][j][k] += dp[i][j][k]

ans = 0
for i in range(1, N+1):
    ans += dp[N][i][A*i]

print(ans)
Problem p02600 (python)

Fixed submission:
X=int(input())
a=0
if X >= 400 and X < 600:
    a = 8
elif X >= 600 and X < 800:
    a = 7
elif X >= 800 and X < 1000:
    a = 6
elif X >= 1000 and X < 1200:
    a = 5
elif X >= 1200 and X < 1400:
    a = 4
elif X >= 1400 and X < 1600:
    a = 3
elif X >= 1600 and X < 1800:
    a = 2
elif X >= 1800 and X < 2000:
    a = 1
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

s = (1000, 0, 0)
mmax = 1000

q = []
q.append(s)
while len(q) > 0:
    m,k,d = q.pop()
    if d == N-1:
        m += k*A[d]
        if mmax < m:
            mmax = m
    else:
        q.append((m,k,d+1))
        if m > A[d]:
            x = m // A[d]
            nm = m-x*A[d]
            nk = k+x
            q.append((nm,nk,d+1))
        if k > 0:
            nm = m+k*A[d]
            q.append((nm, 0, d+1))
            x = nm // A[d]
            if x > 0:
                q.append((nm - x*A[d], x, d+1))
print(mmax)
Problem p02675 (python)

Fixed submission:
n=int(input())
m=n%10
if m == 3:
    s = 'bon'
elif m == 0 or m == 1 or m == 6 or m == 8:
    s = 'pon'
else:
    s = 'hon'
print(s)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
room = [[] for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    room[a-1].append(b-1)
    room[b-1].append(a-1)
mark = [-1] * n
mark[0] = 0
q = []
q.append(0)

while len(q):
    now = q.pop(0)
    for i in room[now]:
        if mark[i] == -1:
            mark[i] = now
            q.append(i)

print("Yes")
for i in mark[1:]:
    print(i+1)
Problem p03076 (python)

Fixed submission:
a = []
for i in range(5):
    a.append(int(input()))
y = 0
x = [i%10 for i in a]
if max(x) > 0:
    y = 10 - min(filter(lambda i:i!= 0, x))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - y)

Buggy submission (verdict: Runtime Error):
a = []
for i in range(5):
    a.append(int(input()))
x = min(filter(lambda x:x!= 0, map(lambda x:x%10, a)))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - (10 - x))
Problem p03323 (python)

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

if a > 8 or b > 8:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a=[]
for i in range(n):
    a.append(tuple(map(int, input().split())))

dp = []
for i in range(m+1):
    dp.append([0 for j in range(n+1)])

def f(fn):
    global dp, a
    for i in range(1,m+1):
        for j in range(1,n+1):
            dp[i][j] = max(dp[i][j-1], dp[i-1][j-1] + fn(a[j-1]))

ans = []
f(lambda x: x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]-x[2])
ans.append(dp[m][n])

print(max(ans))
Problem p02645 (python)

Fixed submission:
full = input()
num = 0
for i in full:
  if num < 3:
    num += 1
    print(i, end="")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
li_light = list(map(int, input().split()))
 
def func(tuyosa):
  basho = [0] * n
  # 光が当たっている部分
  for i in range(n):
    min = i + 1 - tuyosa[i]
    max = i + 1 + tuyosa[i]
    a = 0
    while a <= n:
      if 1 <= min <= n:
        basho[min - 1] += 1
      min += 1
      if min > max:
        break
  return basho

if k > 41:
  k = 41
for i in range(k):
  li_light = (func(li_light))
  if li_light.count(n) == n:
    break
 
for k in li_light:
  print(k, end=" ")
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
len_t = len(t)
if t[0:len_t-1] == s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
li_card = []
for i in range(a):
  li_card.append(1)
for i in range(b):
  li_card.append(0)
for i in range(c):
  li_card.append(-1)

li_select = li_card[0:k]

print(sum(li_select))
Problem p02601 (python)

Fixed submission:
a, b, c = map(int, input().split())
k = int(input())
 
n = 0
while b <= a:
  b = b*2
  n += 1
while c <= b:
  c = c*2
  n += 1
if n <= k:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input())
k = int(input())

n = 0
while b <= a:
  b = b*2
  n += 1
while c <= b:
  c = c*2
  n += 1
if n <= k:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
7 4 2
3
Problem p02603 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))

money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i-1]-a[i]) * (money//a[i])
print(money)
Problem p02724 (python)

Fixed submission:
s = int(input())
r = s% 500
print(s//500 * 1000 + r // 5 * 5)

Buggy submission (verdict: Runtime Error):
Y = input()
X = int(Y)
if(X >= 500):
  a = X // 500
  b = X % 500
  if(b >= 5):
    c = (b//5)*5
  e = (a*1000) + c
  print(e)
Problem p02582 (python)

Fixed submission:
S = str(input())
a = 0
w = 0
for i in range(len(S)):
    if S[i] == 'R':
        w = w + 1
    else:
        if (w > a):
          a = w
        w = 0
if (w > a):
  a = w
print(a)

Buggy submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
if X == 0:
  if (K % 2 == 0):
    a = 0
  else:
    a = D
else:
  if X < 0:
    X = -X
  s = int(X/D)
  if K <= s:
    a = X - K * D
  else:
    if (K - s) % 2 == 1:
      a = abs(X - (s + 1) * D)
    else:
      a = abs(X - s * D)
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
a = 0
if N > 2:
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                    a = a + 1
print(a)
Problem p02628 (python)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=[]

p.sort()

for i in range(K):
  l.append(p[i])
print(sum(l))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=[]

p.sort()

for i in range(K+1):
  l.append(p[i])
print(sum(l))
Problem p02639 (python)

Fixed submission:
a,b,c,d,e=map(str,input().split())

s=str(a+b+c+d+e)

print(s.find('0')+1)

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split()))

for i in x:
    if x[i]==0:
        print(i+1)
Problem p02658 (python)

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

if 0 in a:
  print(0)

else:
  ans = 1
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      print(-1)
      exit()
  print(ans)

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

for i in range(N):
  ans*=int(input())
  if ans>10**18:
    break
    print(-1)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

N=int(input())
A=list(map(int,input().split()))
l=[]

if 0 not in A:
  for i in A:
    l.append(math.log10(A[i]))
  if sum(l)<18: 
    print(int(10**sum(l)))
  else:
    print(str(-1))
else:
  print(str(0))

Buggy submission (verdict: Runtime Error):
import math

N=int(input())
A=list(map(int,input().split()))
l=[]

if 0 not in A:
  for i in A:
  l.append(math.log10(A[i]))
  if sum(l)<18: 
    print(int(10**sum(l)))
  else:
    print(‘-1’)
else:
  print(‘0’)

Buggy submission (verdict: Runtime Error):
import math

N=int(input())
A=list(map(int,input().split()))
l=[]

for i in A:
  l.append(math.log10(A[i]))
  
if sum(l)<18:
  print(int(10**sum(l)))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import.math

N=int(input())
A=list(map(int,input().split()))
l=[]

for _ in A:
  l.append(math.log10(A))
  
if sum(l)<18:
  print(math.exp(sum(l)))
else:
  print(-1)
Problem p02687 (python)

Fixed submission:
S=input()

if S[1]=='B':
  print('ARC')
else:
  print('ABC')

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

if S[1]==B:
  print('ARC')
else:
  print('ABC')
Problem p02713 (python)

Fixed submission:
from math import gcd

k = int(input())
ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        gcd_ab = gcd(a, b)
        for c in range(1, k + 1):
            ans += gcd(gcd_ab, c)
print(ans)

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

k = int(input())
gcd_sum = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            gcd_sum += gcd(a, b, c)

print(gcd_sum)
Problem p02730 (python)

Fixed submission:
s = input()
t = s[::-1]
n = len(s)
a = s[:(n - 1) // 2]
b = t[:(n - 1) // 2]

if s == t and a == a[::-1] and b == b[::-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = s[::-1]
n = len(s)
a = s[:(N - 1) // 2]
b = t[:(n + 3) // 2]

if s == t and a == a[::-1] and b == b[::-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = s[::-1]
n = len(S)
a = s[:(N - 1) // 2]
b = t[:(n + 3) // 2]

if s == t and a == a[::-1] and b == b[::-1]:
    print('Yes')
else:
    print('No')
Problem p02765 (python)

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

if n >= 10 :
  print(r)
else:
  print(r + 100 * (10 - n))

Buggy submission (verdict: Runtime Error):
n, r = map(int, input().split())

if n >= 10 :
  pint(r)
else:
  print(r - 100 * (10 - n))
Problem p02812 (python)

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

for i in range(N):
    if S[i] == 'C' and S[i - 1] == 'B' and S[i - 2] == 'A':
        cnt += 1
print(cnt)

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

for i in range(0, N-1):
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        cnt += 1
print(cnt)

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

cnt=0

for i in range(N-1):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        cnt+=1
print(cnt)

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

list=[]

for i in range(N-1):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        list.append(i)
print(len(list))

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

list=[]

for i in range(N-1):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        list.append(i)
print(len(list))
Problem p02844 (python)

Fixed submission:
N=int(input())
S=input()
cnt=0
 
for i in range(10):
    a=S.find(str(i))
    if a==-1:
        continue
    for j in range(10):
        b=S.find(str(j),a+1)
        if b==-1:
            continue
        for k in range(10):
            if S.find(str(k),b+1)!=-1:
                cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools

N=int(input())
S=input

print(len(list(itertools.combinations_with_replacement(S, 3)))
Problem p02861 (python)

Fixed submission:
n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]

d = 0
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        d += ((x[i][0] - x[j][0]) ** 2 + (x[i][1] - x[j][1]) ** 2) ** 0.5
        cnt += 1

print(d * (n - 1) / cnt)

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]

r = 1
for i in range(n):
    r *= i + 1

d = []
for j in range(n - 1):
    for k in range(j + 1, n):
        d.append(((x[j][0] - x[k][0]) ** 2 + (x[j][1] - x[k][1]) ** 2) ** 0.5 / r)

p = list(itertools.permutations(d, n - 1))

ans = []
for l in range(r):
    ans.append(sum(list(p[l])))
        
print(sum(ans))
Problem p02952 (python)

Fixed submission:
N=int(input())
cnt=0

for i in range(1,N+1):
    if len(str(i))%2==1:
        cnt+=1
print(cnt)

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

if N%2==0:
  for i in range(0,N+1,2):
    n=len(str(i))
    if n%2==1:
      l.append(n)
print(len(l))

Else:
  for j in range(1,N+1,2):
    n=len(str(i))
    if n%2==1:
      l.append(n)
print(len(l))
Problem p03106 (python)

Fixed submission:
A,B,K=map(int,input().split())
l=[]

for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
l=sorted(l)[::-1]
print(l[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
l=[]

for i in range(2,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
sorted(l)[::-1]
print(l[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
l=[]

for i in range(2,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
print(sorted(l)[K-1])
Problem p03371 (python)

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

if A+B<=2*C:
    print(A*X+B*Y)
    
else:
    if X>=Y:
        print(min(A*(X-Y)+C*Y*2,C*X*2))
    else:
        print(min(B*(Y-X)+C*X*2,C*Y*2))

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y=map(int,input().split())

if A<=2*C amd B<=2*C:
    print(A*X+B*Y)
    
else:
    if X>=Y:
        print(min(A*(X-Y)+2*C*Y,2*C*X))
    else:
        print(min(B*(Y-X)+2*C*X,2*C*Y))

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y=map(int,input().split())

if A<=2*C amd B<=2*C:
    print(A*X+B*Y)
    
else:
    if X>=Y:
        print(min(A*(X-Y)+2*C*Y),2*C*X)
    else:
        print(min(B*(Y-X)+2*C*X,2*C*Y))

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y=map(int,input().split())

if A<=2*C amd B<=2*C:
    print(A*X+B*Y)
    
else:
    if X>=Y:
        print(min(A*(X-Y)+2*C*Y),2*C*X)
    else:
        print(B*(Y-X)+2*C*X,2*C*Y)
Problem p03814 (python)

Fixed submission:
s=input()

a=s.find('A')
z=s.rfind('Z')

print(z-a+1)

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

a=s.find('A')
z=s.rfind('Z')

print(z-a)
Problem p02626 (python)

Fixed submission:
import random

N = int(input())
A = list(map(int, input().split()))

S = A[0]+A[1]
X = 0
for a in A[2:]:
  X ^= a

D = (S-X)>>1
if S!=X+(D<<1) or D>A[0] or (X&D)!=0:
  print(-1)
  exit(0)

a = 0
b = 2**64
while b>0:
  if (D&b)!=0:
    a |= b
  elif (X&b)!=0:
    if (a|b|D&(b-1))<=A[0]:
      a |= b
  b >>= 1
if a==0:
  print(-1)
  exit(0)
print(A[0]-a)

Buggy submission (verdict: Runtime Error):
import random

N = int(input())
A = list(map(int, input().split()))

X = A[0]
Y = A[1]
Z = 0
for a in A[2:]:
  Z ^= a

if ((X^Y)&1)!=(Z&1):
  print(-1)
  exit(1)

def solve(X2, Y2):
  if ((X2^Y2)&1)!=(Z&1):
    return -1
  d = 0
  for i in range(1, 100):
    if (((X2-d)^(Y2+d))>>i&1)!=(Z>>i&1):
      d += 1<<(i-1)
  if d<X2:
    return d
  else:
    return -1

ans = solve(X, Y)
for i in range(10000):
  if ans<=2:
    break
  r = random.randint(1, ans-1)
  a = solve(X-r, Y+r)
  if a!=-1 and r+a<ans:
    ans = r+a
print(ans)
Problem p02678 (python)

Fixed submission:
N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = [-1]*N
T = [0]
while len(T)>0:
  P = T
  T = []
  for x in P:
    for e in E[x]:
      if ans[e]==-1:
        T += [e]
        ans[e] = x

print("Yes")
for a in ans[1:]:
  print(a+1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = [-1]*N
T = [0]
while len(T)>0:
  P = T
  T = []
  for x in P:
    for e in E[x]:
      if ans[e]==-1:
        T += [e]
        ans[e] = x

print "Yes"
for a in ans[1:]:
  print(a+1)
Problem p02993 (python)

Fixed submission:
S = raw_input()
print "Bad" if S[0]==S[1] or S[1]==S[2] or S[2]==S[3] else "Good"

Buggy submission (verdict: Runtime Error):
S = raw_input()
print "Bad" if A[0]==A[1] or A[1]==A[2] or A[2]==A[3] else "Good"
Problem p02997 (python)

Fixed submission:
N, K = map(int, raw_input().split())

if K<=(N-1)*(N-2)/2:
  E = []
  for i in range(N-1):
    for j in range(i):
      E += [(j, i)]
  E = E[:(N-1)*(N-2)/2-K]
  for i in range(N-1):
    E += [(i, N-1)]
  print len(E)
  for e in E:
    print e[0]+1, e[1]+1
else:
  print "-1"

Buggy submission (verdict: Runtime Error):
N, K = map(int, raw_input().split())

if K<=(N-1)*(N-2)/2:
  exit(-1)
else:
  print "-1"

Buggy submission (verdict: Runtime Error):
N, K = map(int, raw_input().split())

if N-2<=K<=(N-1)*(N-2)/2:
  exit(-1)
else:
  print "-1"
Problem p03035 (python)

Fixed submission:
A, B = map(int, raw_input().split())
if A<=5:
  print 0
elif A<=12:
  print B/2
else:
  print B

Buggy submission (verdict: Runtime Error):
A, B = map(int, raw_input())
if A<=5:
  print 0
elif A<=12:
  print B/2
else:
  print B
Problem p03086 (python)

Fixed submission:
s=-1
S=raw_input()+"!"
ans=0
for i in range(len(S)):
  if S[i]in "ATCG":
    if s==-1:
      s=i
  elif s!=-1:
    ans=max(ans, i-s)
    s=-1
print ans

Buggy submission (verdict: Runtime Error):
ans=0
for s not in raw_input():
  if s in "ACGT":
    ans+=1
print ans

Buggy submission (verdict: Runtime Error):
ans=0
for s in raw_input():
  if s in “ACGT”:
    ans+=1
print ans
Problem p03091 (python)

Fixed submission:
N, M = map(int, raw_input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(int, raw_input().split())
  E[a-1] += [b-1]
  E[b-1] += [a-1]

ok = True
for e in E:
  if len(e)%2!=0:
    ok = False
if not ok:
  print "No"
  exit(0)

ok = False
for e in E:
  if len(e)>=6:
    ok = True
if ok:
  print "Yes"
  exit(0)

c = 0
for e in E:
  if len(e)==4:
    c += 1
if c>=3:
  print "Yes"
  exit(0)
if c<=1:
  print "No"
  exit(0)

for i in range(len(E)):
  if len(E[i])==4:
    c = 0
    for v in E[i]:
      p = i
      while len(E[v])==2:
        if E[v][0]==p:
          p = v
          v = E[v][1]
        else:
          p = v
          v = E[v][0]
      if v==i:
        c += 1
    if c==2:
      print "Yes"
      exit(0)
    else:
      print "No"
      exit(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(int, raw_input().split())
  E[a-1] += [b-1]
  E[b-1] += [a-1]

ok = True
for e in E:
  if len(e)%2!=0:
    ok = False
if not ok:
  print "No"
  exit(0)

ok = False
for e in E:
  if len(e)>=6:
    ok = True
if ok:
  print "Yes"
  exit(0)

c = 0
for e in E:
  if len(e)==4:
    c += 1
if c>=3:
  print "Yes"
  exit(0)
if c<=1:
  print "No"
  exit(0)

for i in range(len(E)):
  if len(E[i])==4:
    c = 0
    for v in E[i]:
      p = i
      while len(v)==2:
        if E[v][0]==p:
          p = v
          v = E[v][1]
        else:
          p = v
          v = E[v][0]
      if v==i:
        c += 1
    if c==2:
      print "Yes"
      exit(0)
    else:
      print "No"
      exit(0)
Problem p03128 (python)

Fixed submission:
N,M = map(int, raw_input().split())
A = map(int, raw_input().split())

C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

T = [(-10**8,0)]*(N+1)
T[0] = (0, 0)
for i in range(1, N+1):
  for a in A:
    if i-C[a]>=0:
      T[i] = max(T[i], (T[i-C[a]][0]+1, a))

ans = ""
p = N
while p>0:
  ans += str(T[p][1])
  p -= C[T[p][1]]
print ans

Buggy submission (verdict: Runtime Error):
N,M = map(int, raw_input().split())
A = map(int, raw_input().split())

C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

T = [(-10**8,0)]*(N+1)
T[0] = (0, 0)
for i in range(1, N+1):
  for a in A:
    if C[a]>=0:
      T[i] = max(T[i], (T[i-C[a]][0]+1, a))

ans = ""
p = N
while p>0:
  ans += str(T[p][1])
  p -= C[T[p][1]]
print ans

Buggy submission (verdict: Runtime Error):
N,M = map(int, raw_input().split())
A = sorted(map(int, raw_input().split()))

C = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

T = [(-10**8,0)]*(N+1)
T[0] = (0, 0)
for i in range(1, N+1):
  for a in A:
    if C[a]>=0 and T[i-C[a]][0]+1 >= T[i][0]:
      T[i] = (T[i-C[a]][0]+1, a)

ans = ""
p = N
while p>0:
  ans += str(T[p][1])
  p -= C[T[p][1]]
print ans
Problem p03132 (python)

Fixed submission:
# coding: utf-8

"""

o 999
o 2 3
x 2 0 2
o 2 1 2
x 2 1 2 1
o 2 1 3 1
o 2 1 3 2
o 3 1 3
x 3 2 3
o 3 2 2

- 0は両端のみ
- 偶奇の切り替わりが2回以下

0 zzoo
1 zzee
2 zzooee
3 zzeeoo
4 zzeeooee
5 zz
6 ???zz
"""

L = input()
A = [input() for _ in range(L)]

T = [L,L,L,L,L,0,L]
for a in A:
  P = T
  o = 1-a%2
  e = 1-o
  if a==0:
    e = 2
  T = [
    min(P[0]+o, P[5]+o),
    min(P[1]+e, P[5]+e),
    min(P[2]+e, P[0]+e),
    min(P[3]+o, P[1]+o),
    min(P[4]+e, P[3]+e),
    P[5]+a,
    min(P)+a,
  ]
  #print a, T
print min(T)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

"""

o 999
o 2 3
x 2 0 2
o 2 1 2
x 2 1 2 1
o 2 1 3 1
o 2 1 3 2
o 3 1 3
x 3 2 3
o 3 2 2

- 0は両端のみ
- 偶奇の切り替わりが2回以下

zzoo
zzee
zzooee
zzeeoo
zzooeeoo xxx
zzeeooee
zz
???zz
"""

ooeeooee
L = input()
A = [input() for _ in range(L)]

T = [L,L,L,L,L,L,0,L]
for a in A:
  P = T
  o = 1-a%2
  e = 1-o
  if a==0:
    e = 2
  T = [
    min(P[0]+o, P[6]+o),
    min(P[1]+e, P[6]+e),
    min(P[2]+e, P[0]+e),
    min(P[3]+o, P[1]+o),
    min(P[4]+o, P[2]+o),
    min(P[5]+e, P[3]+e),
    P[6]+a,
    min(P)+a,
  ]
  #print a, T
print min(T[4:]+T[5:])
Problem p03280 (python)

Fixed submission:
A,B = map(int, raw_input().split())
print (A-1)*(B-1)

Buggy submission (verdict: Runtime Error):
import os
A,B = map(int, os.system("dd").split())
print (A-1)*(B-1)