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

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

n = 62
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    s = [i for i in range(len(s)) if s[i]=='1']
    for j in s:
        D[j] += 1
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)

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

n = 30
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    for j in range(len(s)):
        D[j] += int(s[j])
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)

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

n = len(bin(N))-2
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    for j in range(len(s)):
        D[j] += int(s[j])
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)
Problem p02936 (python)

Fixed submission:
from collections import deque
N,Q = map(int, input().split())
G = [[] for _ in range(N)]
count = [0]*N
for i in range(N-1):
    a,b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
for i in range(Q):
    p,x = map(int, input().split())
    count[p-1]+=x
q = deque([0])
flag = [False]*N
while q:
    v = q.pop()
    flag[v] = True
    for w in G[v]:
        if flag[w]:
            continue
        count[w]+=count[v]
        q.append(w)
print(*count)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,Q = map(int, input().split())
G = [[] for _ in range(N)]
count = [0]*N
for i in range(N-1):
    a,b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
for i in range(Q):
    p,x = map(int, input().split())
    count[p-1]+=x
q = deque([0])
flag = [False]*N
while q:
    v = q.pop()
    flag[v] = True
    for w in G[v]:
        if flag[w]:
            continue
        count[e]+=count[v]
        q.append(e)
print(*count)
Problem p02945 (python)

Fixed submission:
A,B = map(int,input().split())
print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(max(A+B,A-B,A*B)
Problem p02982 (python)

Fixed submission:

N,D = map(int,input().split())
X = []
for i in range(N):
    Xi = list(map(int,input().split()))
    X.append(Xi)
ans = 0
def norm(Xi,Xj):
    return sum([(Xi[i]-Xj[i])**2 for i in range(len(Xi))])
for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        d = norm(X[i],X[j])
        if int(d**0.5)**2==d:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,D = map(int,input().split())
X = []
for i in range(N):
    Xi = np.array(list(map(int,input().split())))
    X.append(Xi)
ans = 0
for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        d = np.linalg.norm(X[i]-X[j])
        if abs(d-int(d)) < 10**(-6):
            ans += 1
print(ans)
Problem p02985 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)

N,K = map(int,input().split())
T = [[]*N for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
visited = [0]*N
ans = 1
def bfs(i,bb,b):
    global ans
    visited[i] = 1
    ans = (ans*(K-bb-b))%(10**9+7)
    cnt = 0
    for j in T[i]:
        if visited[j] == 1:
            continue
        bfs(j,b+cnt,1)
        cnt += 1
bfs(0,0,0)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500000)

N,K = map(int,input().split())
T = [[]*N for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
visited = [0]*N
ans = 1
def bfs(i,bb,b):
    global ans
    visited[i] = 1
    ans = (ans*(K-bb-b))%(10**9+7)
    cnt = 0
    for j in T[i]:
        if visited[j] == 1:
            continue
        bfs(j,b+cnt,1)
        cnt += 1
bfs(1,0,0)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
T = [[]*N for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
visited = [0]*N
ans = 1
def bfs(i,bb,b):
    global ans
    visited[i] = 1
    ans = (ans*(K-bb-b))%(10**9+7)
    cnt = 0
    for j in T[i]:
        if visited[j] == 1:
            continue
        bfs(j,b+cnt,1)
        cnt += 1
bfs(0,0,0)
print(ans)
Problem p02994 (python)

Fixed submission:
N,L = map(int,input().split())
import bisect
A = [i+L for i in range(N)]
ans = sum(A)-A[min(bisect.bisect_left(A,0),len(A)-1)]
print(ans)

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
import bisect
A = [i+L for i in range(N)]
ans = sum(A)-A[bisect.bisect_left(A,0)]
print(ans)
Problem p03006 (python)

Fixed submission:
N = int(input())
X = []
for i in range(N):
    xi,yi = map(int,input().split())
    X.append([xi,yi])

L = []
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
    
        x,y = X[i][0]-X[j][0],X[i][1]-X[j][1]
        #L.append([x,y])
        if not x in d:
            d[x] = {}
        if not y in d[x]:
            d[x][y] = 1
        else:
            d[x][y] += 1
m = 0
for k in list(d.keys()):
    for kk in list(d[k].keys()):
        m = max(m,d[k][kk])
print(N-m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
X = []
for i in range(N):
    xi,yi = map(int,input().split())
    X.append((xi,yi))
L = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        x,y = X[i][0]-X[j][0],X[i][1]-X[j][1]
        L.append((x,y))
m = Counter(L).most_common()[0][1]
print(N-m)
Problem p03014 (python)

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

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int,input().split()))
R = [W[0]]
for i in range(1,N):
    R.append(R[i-1] + W[i])
s = sum(W)

ans = 1000

for i in range(N):
    ans = min(ans,abs(R[i]-(s-R[i])))
print(ans)
"""

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

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)
Problem p03023 (python)

Fixed submission:
N = int(input())
print(180*(N-2))

Buggy submission (verdict: Runtime Error):
from collections import deque

def bfs(neighbor,start):
    order = [0 for i in range(N)]
    visited = [0 for i in range(N)]
    visited[start] = 1
    q = deque([start])
    num = 1
    while q:
        path = q.popleft()
        order[path] = num
        visited[path] = 1
        num += 1
        for v in neighbor[path]:
            if visited[v] == 1:
                continue
            q.append(v)
    order = [[i,order[i]] for i in range(len(neighbor))]
    order.sort(key=lambda x:x[1])
    return [order[i][0] for i in range(len(order))]


N = int(input())
node = [[0,i] for i in range(N)]
ab = []
neigh = [[0 for i in range(N)] for j in range(N)]
for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1][0] += 1
    node[bi-1][0] += 1
    neigh[ai-1][bi-1] = 1
    neigh[bi-1][ai-1] = 1
    ab.append([ai-1,bi-1])
c = list(map(int,input().split()))
c.sort(reverse=True)
node.sort(key=lambda x:x[0],reverse=True)
m = max([node[i][0] for i in range(N)])
max_node = [node[i][1] for i in range(N) if node[i][0] == m]
ans1 = 0
for nn in max_node:
    can = 0
    bbb = bfs(neigh,nn)
    cn = [[c[i],bbb[i]] for i in range(N)]
    #cn.sort(key=lambda x:x[1])
    for i in range(N-1):
        can += min(cn[ab[i][0]][0],cn[ab[i][1]][0])
    if can > ans1:
        ans1 = can
        ans2 = ' '.join([str(cn[i][0]) for i in range(N)])

        
print(ans1)

print(ans2)
Problem p03029 (python)

Fixed submission:
A,P = map(int,input().split())
print((3*A+P)//2)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
V = list(map(int,input().split()))
ans = 0
R = min(N,K)
for A in range(R+1):
    for B in range(R-A+1):
        s = V[:A]+V[N-B:]
        #print(s)
        s.sort()
        S = sum(s)
        for k in range(min(K-A-B,len(s))):
            if s[k] < 0:
                S -= s[k]
        ans = max(ans,S)
print(ans)
Problem p03043 (python)

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

def log2(n):
    res = 0
    while n > 1:
        n /= 2
        res += 1
    return res

def ceil(n): # ceiling関数
    if n > int(n):
        return(int(n)+1)
    else:
        return(int(n))

a = []
for i in range(1,N+1):
    k = ceil(log2(K/i))
    if i < K:
        a.append(k)
    else:
        a.append(0)
m = max(a)
s = sum([2**(m-a[i]) for i in range(len(a))])
print(s/(N*(2**m)))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
import math as ma
a = []
for i in range(1,N+1):
    k = ma.ceil(ma.log2(K/i))
    if i < K:
        a.append(k)
    else:
        a.append(0)
m = max(a)
s = sum([2**(m-a[i]) for i in range(len(a))])
print(s/(N*(2**m)))
Problem p03044 (python)

Fixed submission:
import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
input = sys.stdin.readline # 文字列の入力のとき'/n'まで受け取るので注意!!!
sys.setrecursionlimit(500000)

N = int(input())
T = [defaultdict(int) for i in range(N)]
for i in range(N-1):
    u,v,w = map(int,input().split())
    T[u-1][v-1] = w
    T[v-1][u-1] = w
visited = [0]*N
ans = [0]*N
def dfs(now,col):
    visited[now] = 1
    for i in T[now].keys():
        if visited[i] == 1:
            continue
        if T[now][i]%2==1:
            ans[i] = col^1
            next = col^1
        else:
            ans[i] = col
            next = col
        dfs(i,next)
dfs(0,0)
for i in range(N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
input = sys.stdin.readline # 文字列の入力のとき'/n'まで受け取るので注意!!!
sys.setrecursionlimit(500000)

N = int(input())
T = [defaultdict(int) for i in range(N)]
for i in range(N-1):
    u,v,w = map(int,input().split())
    T[u-1][v-1] = w
    T[v-1][u-1] = w
visited = [0]*N
ans = [0]*N
def dfs(now,col):
    visited[now] = 1
    for i in T[now].keys():
        if visited[i] == 1:
            continue
        if T[now][i]%2==1:
            ans[i] = col^1
            next =  = col^1
        else:
            ans[i] = col
        dfs(i,next)
dfs(0,0)
for i in range(N):
    print(ans[i])
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())
s = S[K-1]

for i in range(N):
    if S[i] == s:
        pass
    else:
        S[i] = '*'

print(''.join(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
K = int(input())
s = S[K-1]

for i in range(N):
    if S[i] == s:
        pass
    else:
        S[i] = '*'

print(''.join(S))


N = int(input())
S = input()
for i in range(N):

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(int(input()))
K = int(input())
s = S[K-1]

for i in range(N):
    if S[i] == s:
        pass
    else:
        S[i] = '*'

print(''.join(S))
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
if len([i for i in l if i != 0]) == 0:
    m = 10
    
else:
    m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10 -10
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10-10
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10
print(ans)
Problem p03095 (python)

Fixed submission:
N = int(input())
S = input()
m = 10**9 + 7
nl = [0 for i in range(26)]
for s in S:
    nl[ord(s)-97] += 1
ans = 1
for i in range(26):
    if nl[i] == 0:
        continue
    else:
        ans *= nl[i] + 1
        ans = ans % m
print(ans-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
m = 10**9 + 7
nl = [0 for i in range(26)]
for s in S:
    nl[ord(s)-97] += 1
ans = 1
for i in range(N):
    if nl[i] == 0:
        continue
    else:
        ans *= nl[i] + 1
        ans = ans % m
print(ans-1)
Problem p03145 (python)

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

L.remove(L[L.index(max(L))])
S = 1
for i in range(2):
  S *= L[i]
  
print(S//2)

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

L.pop(L[L.index(max(L))])
S = 1
for i in range(2):
  S *= L[i]
  
print(S//2)

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

L.pop(L[L.index(max(L))])
S = 1
for i in range(2):
  S *= L[i]
  
print(S)
Problem p03146 (python)

Fixed submission:
s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+2)
        break
    a.append(f(a[i]))

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

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])

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

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])

Buggy submission (verdict: Runtime Error):
s = input()
a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)
i = 0
while True:
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])
    i += 1
Problem p03161 (python)

Fixed submission:

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

dp = [0]*N
for i in range(1,N):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[j]+abs(h[i]-h[j]),dp[i])
print(dp[N-1])

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

dp = [0]*N
for i in range(1,N):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[j]+abs(h[i]-h[j]),dp[i])
print(dp[N-1])
Problem p03206 (python)

Fixed submission:
D = int(input())
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')

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

def rep(N,X):
    if N == 1:
        if X == 1 or X == 5:
            return(0)
        else:
            return(X-1)
    else:
        n = 2**(N+2)-3
        a = n//2-(X-1)
        p = 2**N-1
        if a < -1:
            return(rep(N-1, abs(a)) + p + 1)
        elif a == -1 or a == 0 or a == 1:
            return(p + 1)
        else:
            return(rep(N-1, X-1))
print(rep(N,X))
Problem p03231 (python)

Fixed submission:
N,M = map(int,input().split())
S = input()
T = input()
flag = True
def lcm(a, b): # 最小公倍数
    def gcd(a, b): # 最大公約数
        while b:
            a, b = b, a % b
        return a
    return a * b // gcd(a, b)
L = lcm(N,M)
def gcd(a, b): # 最大公約数
    while b:
        a, b = b, a % b
    return a

flag = True
for i in range(gcd(N,M)):
    if S[i*N//gcd(N,M)] == T[i*M//gcd(N,M)] and flag:
        pass
    else:
        flag = False
if flag:
    print(L)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
S = input()
T = input()
flag = True
def lcm(a, b): # 最小公倍数
    def gcd(a, b): # 最大公約数
        while b:
            a, b = b, a % b
        return a
    return a * b // gcd(a, b)
L = lcm(N,M)
"""
l = [-1 for i in range(L)]
for i in range(N):
    l[L//N*i] = ord(S[i])-97
for i in range(M):
    if l[L//M*i] == -1:
        l[L//M*i] = ord(T[i])-97
    elif l[L//M*i] == ord(T[i])-97:
        pass
    else:
        flag = False
"""
if S[0] == T[0 and S[N-1] == T[M-1]:
    flag = True
else:
    flag = False
if flag:
    print(L)
else:
    print(-1)
Problem p03290 (python)

Fixed submission:
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
ans = 10**9
from math import ceil
for i in range(2**D):
    now = 0
    score = 0
    for j in range(D):
        if i>>j & 1:
            now += pc[j][0]
            score += pc[j][0]*100*(j+1) + pc[j][1]

    if score >= G:
        ans = min(ans,now)
    else:
        for j in reversed(range(D)):
            if i>>j & 1 == 0:
                if ceil((G-score)/(100*(j+1))) < pc[j][0]:
                    now += ceil((G-score)/(100*(j+1)))
                    break
        else:
            continue

        if now==0:
            continue
        ans = min(ans,now)

print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
D, G = map(int, input().split())
p = []
c = []
score = 0
ans = 0
for i in range(D):
    pi, ci = map(int, input().split())
    p.append(pi)
    c.append(ci)
a = [i for i in range(D)]
comp = [[i, 100*(i+1)*p[i]+c[i], (100*(i+1)*p[i]+c[i])//p[i], p[i]] for i in range(D)]
comp.sort(key=itemgetter(2),reverse=True)
for d in range(D):
    if score + comp[d][1] < G:
        #print(comp[d][0])
        score += comp[d][1]
        a.pop(comp[d][0])
        ans += comp[d][3]
    else:
        can = d
        for dd in range(d,D):
            if score + comp[dd][1] >= G and comp[can][3] > comp[dd][3]:
                can = dd

        if 100*(max(a)+1)*p[max(a)] + score >= G and comp[can][3] >= (G-score-1)//(100*(max(a)+1)) + 1:
            #print(ans)
            ans += (G-score-1)//(100*(max(a)+1)) + 1
            #print(ans)
            break
        else:
            ans += comp[can][3]
            break
print(ans)
Problem p03292 (python)

Fixed submission:
A = list(map(int,input().split()))
s = sum(A)
ans = 1000
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        b = abs(A[i]-A[j])+abs(A[j]-(s-(A[i]+A[j])))
        ans = min(ans,b)
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
s = sum(a)
ans = 1000
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        b = abs(A[i]-A[j])+abs(A[j]-(a-(A[i]+A[j])))
        ans = min(ans,b)
print(ans)
Problem p03296 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
ans = 0
now = a[0]
i = 1
while i < N:
    if now == a[i]:
        ans += 1
        if i == N-1:
            break
        now = a[i+1]
        i += 2
        
    else:
        now = a[i]
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
ans = 0
now = a[0]
i = 1
while i < N:
    if now == a[i]:
        ans += 1
        now = a[i+1]
        i += 2
        if i > N-1:
            break
    else:
        now = a[i]
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
ans = 0
now = a[0]
i = 1
while i < N:
    if now == a[i]:
        ans += 1
        i += 2
        if i == N-1:
            break
        now = a[i+1]
    else:
        now = a[i]
        i += 1
print(ans)
Problem p03378 (python)

Fixed submission:
N,M,X = map(int,input().split())
A = list(map(int,input().split()))
import bisect
id = bisect.bisect_left(A,X)
print(min(len(A[:id]),len(A[id:])))

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

print(min(sum(A[:X],sum(A[X:]))))
Problem p03427 (python)

Fixed submission:
N = input()
if len(N) == 1:
    print(int(N))
else:
    print(max(sum([int(i) for i in N]),(len(N)-1)*9+int(N[0])-1))

Buggy submission (verdict: Runtime Error):
N = input()
if len(N) == 1:
    print(int(N))
else:
    print(max(sum(list(N)),(len(N)-1)*9+int(N[0])-1))
Problem p03469 (python)

Fixed submission:
S = list(input())
print('2018/01/'+''.join(S[8:]))

Buggy submission (verdict: Runtime Error):
S = list(input())
print('2017/01/'+S[8:])
Problem p03476 (python)

Fixed submission:
def sieve(n): # エラトステネスの篩
    num = [1]*n
    num[0]=num[1]= 0
    for i in range(int(n**0.5)+1):
        if num[i]:
            for j in range(i**2,n,i):
                num[j] = 0
    return num # list ### 1なら素数0なら合成数

primes = sieve(10**5)
like_2017 = [0]
for i in range(1,len(primes)):
    if i <= 2:
        like_2017.append(like_2017[i-1])
    elif primes[i] == 1 and primes[(i+1)//2] == 1:
        like_2017.append(like_2017[i-1]+1)
    else:
        like_2017.append(like_2017[i-1])
Q = int(input())
for q in range(Q):
    l,r = map(int,input().split())
    print(like_2017[r]-like_2017[l-1])

Buggy submission (verdict: Runtime Error):
def sieve(n): # エラトステネスの篩
    num = [1]*n
    num[0]=num[1]= 0
    for i in range(int(n**0.5)+1):
        if num[i]:
            for j in range(i**2,n,i):
                num[j] = 0
    return num # list ### 1なら素数0なら合成数

primes = sieve(10**5)
like_2017 = [0]
for i in range(1,len(primes)):
    if i <= 2:
        like_2017.append(like_2017[i-1])
    elif primes[i] == 1 and primes[(i+1)//2] == 1:
        like_2017.append(like_2017[i-1]+1)
    else:
        like_2017.append(like_2017[i-1])
Q = int(input())
for q in range(Q):
    l,r = map(int,input().split())
    print(like_2017[r+1]-like_2017[l-1])