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

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
def inpl(): return map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

C = Counter(A)

if len(C) >= 3:
    print("No")
elif len(C) == 1:
    for k, v in C.items():
        if k == N-1 or N >= 2*k:
            print("Yes")
        else:
            print("No")
else:
    k = sorted(C.keys())[0]
    v = C[k]
    X = N - v
    if (k+1-v) * 2 <= C[k+1] and v <= k:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from queue import Queue

N = int(input())
a = sorted([int(n) for n in input().split()], reverse=True)

alone = a.count(max(a) - 1)

if alone:
    a = [a_ - alone for a_ in a][alone:]
    if len(a) == 2 and a[0] == 1:
        print("Yes")
    elif 2*a[0] <= len(a) and a[0] <= len(a)//a[0]:
        print("Yes")
    else:
        print("No")

else:
    if a[0] == N - 1:
        print("Yes")
    elif 2*a[0] <= len(a) and a[0] <= len(a)//a[0]:
        print("Yes")
    else:
        print("No")
Problem p03746 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def inpl(): return map(int, input().split())

N, M = inpl()
G = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = inpl()
    G[a].append(b)
    G[b].append(a)

searched = [False] * (N+1)

m = 1
searched[m] = True

ans = []
def dfs(c):
    global ans
    searched[c] = True
    for d in G[c]:
        if not searched[d]:
            ans.append(c)
            dfs(d)
            break 
    else:
        ans.append(c)
    
dfs(1)
ans = ans[:0:-1]
dfs(1)

print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from queue import Queue

N, M = [int(n) for n in input().split()]
graph = {n: [] for n in range(1, N+1)}
for m in range(M):
    A, B = [int(n) for n in input().split()]
    graph[A].append(B)
    graph[B].append(A)

starts_ = sorted(graph.keys(), key=lambda x: len(graph[x]))
starts = iter(starts_)

result_path = []
for start in starts:
    q = Queue()
    needs_start = graph[start]
    q.put([start])
    while not q.empty():
        path = q.get()            
        for t in graph[path[-1]]:
            if t in path:
                continue
            if len(set(needs_start + graph[t]) - set(path + [t])) == 0:
                result_path = path + [t]
                q = Queue()
                break
            else:
                if len(path + t) < N:
                    q.put(path+[t])
                
    if len(result_path) > 0:
        break
print(len(result_path))
result = ""
for r in result_path:
    result += " {}".format(r)
print(result[1:])
Problem p03781 (python)

Fixed submission:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from math import ceil

X = int(input())
print(ceil((2*X+1/4)**(1/2) - 1/2))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from copy import deepcopy
from operator import add
from itertools import accumulate

N, K = inpl()
A = sorted(inpl())
S = list(accumulate(A, add))
A = A[::-1]
DP = [False for _ in range(K)]
DP[0] = 1
OK = [False for _ in range(N)]

for i, a in enumerate(A):
    DP0 = deepcopy(DP)
    if a >= K:
        OK[i] = True
        continue
    for j, d in enumerate(DP0[-S[::-1][i]:], max(0, K-S[::-1][i])):
        if d:
            if j + a >= K:
                OK[i] = True
                break
            else:
                DP[j+a] = True

if sum(OK) == 0:
    print(N)
else:
    print(OK[::-1].index(True))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from copy import deepcopy

N, K = inpl()
A = sorted(inpl(), reverse=True)

DP = [False for _ in range(K)]
DP[0] = 1
OK = [False for _ in range(N)]

for i, a in enumerate(A):
    DP0 = deepcopy(DP)
    if a >= K:
        OK[i] = True
        continue
    for j, d in enumerate(DP0):
        if d:
            if j + a >= K:
                OK[i] = True
                break
            else:
                DP[j+a] = True

if sum(OK) == 0:
    print(N)
else:
    print(OK[::-1].index(True))
Problem p03782 (python)

Fixed submission:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
 
N, K = inpl()
A = sorted(inpl())
S = []
s = 0
for a in A:
    s += a
    S.append(s)

A = A[::-1]
DP = [True]+[False for _ in range(K-1)]

OK = [False for _ in range(N)]
 
for i, a in enumerate(A):
    DP1 = [False] * K
    if a >= K:
        OK[i] = True
        continue
    for j, d in enumerate(DP[-S[::-1][i]:], max(0, K-S[::-1][i])):
        if d:
            DP1[j] = True
            if j + a >= K:
                OK[i] = True
                break
            else:
                DP1[j+a] = True
    DP = DP1 
if sum(OK) == 0:
    print(N)
else:
    print(OK[::-1].index(True))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from copy import deepcopy
from operator import add
from itertools import accumulate
 
N, K = inpl()
A = sorted(inpl())
S = list(accumulate(A, add))
A = A[::-1]
DP = [False for _ in range(K)]
DP[0] = 1
OK = [False for _ in range(N)]
 
for i, a in enumerate(A):
    DP0 = deepcopy(DP)
    if a >= K:
        OK[i] = True
        continue
    for j, d in enumerate(DP0[-S[::-1][i]:], max(0, K-S[::-1][i])):
        if d:
            if j + a >= K:
                OK[i] = True
                break
            else:
                DP[j+a] = True
 
if sum(OK) == 0:
    print(N)
else:
    print(OK[::-1].index(True))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from copy import deepcopy
from operator import add
from itertools import accumulate

N, K = inpl()
A = sorted(inpl())
S = list(accumulate(A, add))
A = A[::-1]
DP = [False for _ in range(K)]
DP[0] = 1
OK = [False for _ in range(N)]

for i, a in enumerate(A):
    DP0 = deepcopy(DP)
    if a >= K:
        OK[i] = True
        continue
    for j, d in enumerate(DP0[-S[::-1][i]:], max(0, K-S[::-1][i])):
        if d:
            if j + a >= K:
                OK[i] = True
                break
            else:
                DP[j+a] = True

if sum(OK) == 0:
    print(N)
else:
    print(OK[::-1].index(True))
Problem p03819 (python)

Fixed submission:
from bisect import bisect
from operator import itemgetter

import sys
input = sys.stdin.readline

def inpl(): return list(map(int, input().split()))


class BIT:
    def __init__(self, N):
        self.size = 2 ** (int.bit_length(N)+1)
        self.tree = [0]*(self.size + 1)

    def sum(self, i):
        res = 0
        while i:
            res += self.tree[i]
            i -= (i & -(i))
        return res

    def add(self, i, x):
        if i == 0:
            return
        while i <= self.size:
            self.tree[i] += x
            i += (i & -(i))


class RABIT():
    # range add BIT
    def __init__(self, N):
        self.bit0 = BIT(N)
        self.bit1 = BIT(N)

    def sum(self, i):
        return i*self.bit1.sum(i) + self.bit0.sum(i)

    def add_range(self, l, r, x):
        self.bit0.add(l, -x*(l-1))
        self.bit1.add(l, x)
        self.bit0.add(r+1, x*r)
        self.bit1.add(r+1, -x)

    def get_range(self, l, r):
        return self.sum(r) - self.sum(l-1)


N, M = inpl()
R, L, S = [], [], []
Q = []
for _ in range(N):
    l, r = inpl()
    Q.append((l, r, (r-l+1)))

Q = sorted(Q, key=itemgetter(2), reverse=True)
rabit = RABIT(M+1)

Lmin = M
Rmax = 0
for i in range(1, M+1):
    while Q and Q[-1][2] < i:
        l, r, _ = Q.pop()
        rabit.add_range(l, r, 1)
        Lmin = min(Lmin, l)
        Rmax = max(Rmax, r)
    ans = len(Q)
    for j in range(-(-Lmin//i) * i, Rmax+1, i):
        ans += rabit.get_range(j, j)
    print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect
from operator import itemgetter
inpl = lambda: list(map(int, input().split()))


class BIT:
    from math import log2

    def __init__(self, N):
        self.size = 2 ** (-int(-log2(N)//1))
        self.tree = [0]*(self.size + 1)

    def sum(self, i):
        res = 0
        while i:
            res += self.tree[i]
            i -= (i & -(i))
        return res

    def add(self, i, x):
        while 1 <= i <= self.size:
            self.tree[i] += x
            i += (i & -(i))


class RABIT():
    # range add BIT
    def __init__(self, N):
        self.bit0 = BIT(N)
        self.bit1 = BIT(N)

    def sum(self, i):
        return i*self.bit1.sum(i) + self.bit0.sum(i)

    def add_range(self, l, r, x):
        self.bit0.add(l, -x*(l-1))
        self.bit1.add(l, x)
        self.bit0.add(r+1, x*r)
        self.bit1.add(r+1, -x)

    def get_range(self, l, r):
        return self.sum(r) - self.sum(l-1)


N, M = inpl()
R, L, S = [], [], []
Q = []
for _ in range(N):
    l, r = inpl()
    Q.append((l, r, (r-l+1)))

Q = sorted(Q, key=itemgetter(2), reverse=True)
rabit = RABIT(M+1)

for i in range(1, M+1):
    while Q and Q[-1][2] < i:
        l, r, _ = Q.pop()
        rabit.add_range(l, r, 1)
    ans = len(Q)
    for j in range(i, M+1, i):
        ans += rabit.get_range(j, j)
    print(ans)
Problem p03866 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
def inpl(): return map(int, input().split())

sx, sy, tx, ty = inpl()
N = int(input())
X = np.zeros((1, N+2), dtype=np.float64)
Y = np.zeros((1, N+2), dtype=np.float64)
R = np.zeros((1, N+2), dtype=np.float64)

X[0][0] = sx
Y[0][0] = sy
X[0][N+1] = tx
Y[0][N+1] = ty

for i in range(N):
    X[0][i+1], Y[0][i+1], R[0][i+1] = inpl()

G = np.maximum(np.sqrt(np.square(X-X.T) + np.square(Y-Y.T)) - (R+R.T),
               np.zeros((N+2, N+2), dtype=np.float64)) 
G += np.diag(np.ones(N+2, dtype=np.float64)*np.inf)
G = csgraph_from_dense(G, null_value=np.inf)
print(dijkstra(G, indices=0)[-1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
def inpl(): return map(int, input().split())

sx, sy, tx, ty = inpl()
N = int(input())
X = np.zeros((1, N+2), dtype=np.float64)
Y = np.zeros((1, N+2), dtype=np.float64)
R = np.zeros((1, N+2), dtype=np.float64)

X[0][0] = sx
Y[0][0] = sy
X[0][N+1] = tx
Y[0][N+1] = ty

for i in range(N):
    X[0][i+1], Y[0][i+1], R[0][i+1] = inpl()

G = np.maximum(np.sqrt(np.square(X-X.T) + np.square(Y-Y.T)) - (R+R.T),
               np.zeros((N+2, N+2), dtype=np.float64))
Gsp = csgraph_from_dense(G, null_value=np.inf)

print(dijkstra(Gsp, indices=0)[-1])
Problem p03937 (python)

Fixed submission:
def inpl(): return list(map(int, input().split()))

H, W = inpl()
A = []
for _ in range(H):
    A.append([x=="#" for x in input()] + [False])

A.append([False] * (W+1))

Q = [[0, 0]]
visited = [[False]*(W+1) for _ in range(H+1)]
visited[0][0] = True

while Q:
    h, w = Q.pop()
    for dh, dw in [[0, 1], [1, 0]]:
        nh, nw = h+dh, w+dw
        if A[nh][nw] and not visited[nh][nw]:
            visited[nh][nw] = True
            Q.append([nh, nw])

plength = sum([sum(a) for a in A])

if plength == (H+W-1) and visited[H-1][W-1]:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
from random import shuffle
from collections import Counter
def inpl(): return list(map(int, input().split()))

#N = 20000
#P = list(range(1, N+1))
#shuffle(P)

N = int(input())
P = inpl()

A = [0]*N
B = [0]*N
S = [10**9 - N] * (N)
for i, p in enumerate(P):
    S[p-1] += i

A[0] = 1
B[0] = S[0] - 1

for i in range(1, N):
    A[i] = max(A[i-1] + 1, S[i] - B[i-1] + 1)
    B[i] = S[i] - A[i]

for i in range(N-1):
    assert A[i] < A[i+1]
    assert B[i] > B[i+1]

assert B[-1] > 0
print(*A)
print(*B)

Buggy submission (verdict: Runtime Error):
from random import shuffle
from collections import Counter
def inpl(): return list(map(int, input().split()))

#N = 20000
#P = list(range(1, N+1))
#shuffle(P)

N = int(input())
P = inpl()

A = [0]*N
B = [0]*N
S = [10**9 - N] * (N)
for i, p in enumerate(P):
    S[p-1] += i

A[0] = 1
B[0] = S[0] - 1

for i in range(1, N):
    A[i] = max(A[i-1] + 1, S[i] - B[i-1] + 1)
    B[i] = S[i] - A[i]

for i in range(N-1):
    assert A[i] < A[i+1]
    assert B[i] > B[i+1]

assert B[-1] > 0
print(*A)
print(*B)
Problem p03944 (python)

Fixed submission:
def inpl(): return list(map(int, input().split()))

W, H, N = inpl()
l, r, d, u = 0, W, 0, H

for _ in range(N):
    x, y, a = inpl()
    if a == 1:
        l = max(l, x)
    elif a == 2:
        r = min(r, x)
    elif a == 3:
        d = max(d, y)
    else:
        assert a == 4
        u = min(u, y)
print(max((r-l), 0)*max((u-d), 0))

Buggy submission (verdict: Runtime Error):
def inpl(): return list(map(int, input().split()))

W, H, N = inpl()
l, r, d, u = 0, W, 0, H

for _ in range(N):
    x, y, a = inpl()
    if a == 0:
        l = max(l, a)
    elif a == 1:
        r = min(r, a)
    elif a == 2:
        d = max(d, a)
    else:
        assert a == 3
        u = min(u, a)
print((r-l)*(u-d))
Problem p04016 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from math import sqrt
n = int(input())
s = int(input())

def f(b, n):
    ans = 0
    while n >= b:
        ans += n%b
        n = n//b
    return ans + n

if n==s:
    print(n+1)
    exit()

for b in range(2, int(sqrt(n))+1):
    if f(b, n) == s:
        print(b)
        break
else:
    for p in range(1, int(sqrt(n))+1)[::-1]:
        d, m = divmod(p+n-s, p)
        if m == 0 and d >= 2 and f(d, n) == s:
            print(d)
            break
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
from math import sqrt, factorial
from sys import setrecursionlimit
setrecursionlimit(100000)

def inpl(): return list(map(int, input().split()))
N = int(input())
S = int(input())

RN = int(sqrt(N))
RN += ((RN+1)**2 == N)

def func(b, N):
    tmp = 0
    while N:
        N, d = divmod(N, b)
        tmp += d
    return tmp

for b in range(2, RN+1):
    tmp = func(b, N)
    if tmp == S:
        print(b)
        break
else:
    for x in range(1, RN+1):
        num = N-S+x
        if num%x:
            continue
        b = num//x
        if N//b + N%b == S:
            print(b)
            break
    else:
        print(-1)
Problem p02657 (python)

Fixed submission:
x,y = map(int, input().split())
ans = x*y
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a_lis = list(input().split())

# 10^18を超えたら駄目

ans=1
rough_power=0
for i in a_lis:
    rough_power+=len(i)-1

if rough_power>18:
    print("-1")
elif 0 in a_lis:
    print(0)
else:
    for j in a_lis:
        ans=ans*int(j)

    if ans>pow(10,18):
        print("-1")
    else:
        print(ans)
Problem p02681 (python)

Fixed submission:
S=input()
T=input()

if S==T[0:-1] and len(S)<=10:
    print('Yes') 
else:
    print('No')

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

list1=[1]*A
list2=[0]*B
list3=[-1]*C

num_list.extend(list1)
num_list.extend(list2)
num_list.extend(list3)

print(sum(num_list[0:K]))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int, input().split())
num_list=[]
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)
print(sum(num_list[0:K]))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int, input().split())
num_list=[]
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)

print(sum(num_list[0:K-1]))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int, input().split())
num_list=[]
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)

print(sum(num_list[0:K-1]))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int, input().split())
num_list=()
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)

print(sum(num_list[0:K-1]))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int, input().split())
num_list=()
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)

print(sum(num_list[0:K-1]))
Problem p02640 (python)

Fixed submission:
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
    ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
  ans = 'Yes'
print(ans)
Problem p02640 (python)

Fixed submission:

x,y=map(int,input().split())

for a in range(x+1):
	if 2*a + 4* (x-a)==y:
      
		print("Yes")
		exit()
    
print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
z=0
for a in range(x+1):
	for b in range(x-a+1):
		if 2*a + 4*b == y:
			z+=1
if z = 0:
	print("No")
else:
	print("Yes")
Problem p03455 (python)

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

x = a*b

if x%2 == 0:
    print('Even')
else:
    print('Odd')

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

x = a*b

if x%2 == 0:
    print('Even')
else:
    print('Odd')
Problem p03547 (python)

Fixed submission:
x,y = input().split()

print("<" if x<y else "=" if x==y else ">")

Buggy submission (verdict: Runtime Error):
x,y = input().split()

print("<" if x<y else "=" if x=y else ">")
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()

print("YES" if c1==c2[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()

print("YES" if c1=c2[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()

print("YES" if c1=c2[::-1] "NO")
Problem p03563 (python)

Fixed submission:
r=int(input())
g=int(input())

print(g*2-r)

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

print(g*2-r)
Problem p03597 (python)

Fixed submission:
n=int(input())
a=int(input())

print(n**2-a)

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

print(n**2-a)

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

print(n*n-a)
Problem p03693 (python)

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


print("YES" if (g*10+a)%4==0 else "NO")

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


print("YES" if (g*10+b)%4===0 else "NO")

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


print("YES" if (g*10+a)%4===0 else "NO")
Problem p03729 (python)

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

print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split

print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split

print("YES" if a[0]==b[0] and b[0]==c[0] else "NO")
Problem p03773 (python)

Fixed submission:
a, b = map(int,input().split())
 
print((a+b)%24)

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

print((a+b)%24)
Problem p03844 (python)

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

 
print(int(a)+int(b) if op == "+" else int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
op = input()
 
print(a+b if op == "+" else a-b)

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

print(a+b if op = "+" else a-b)
Problem p03860 (python)

Fixed submission:
x=input().split()
print(x[0][0]+x[1][0]+x[2][0])

Buggy submission (verdict: Runtime Error):
x = map(int, input().split())
print(x[0][0]+x[1][0]+x[2][0])

Buggy submission (verdict: Runtime Error):
x = map(int, input().split())
print(x[0]+x[1]+x[2])

Buggy submission (verdict: Runtime Error):
x=map(int, input().split())
print(x[0]+x[1]+x[2])
Problem p03943 (python)

Fixed submission:
a, b, c = sorted(map(int, input().split()))
print("Yes" if a+b == c else "No")

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

print("YES" if a+b == c else "No")
Problem p03962 (python)

Fixed submission:
abc = list(input().split())
print(len(set(abc)))

Buggy submission (verdict: Runtime Error):
abc = list(input().split())

print(lens(set(abc)))
Problem p04011 (python)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(x*n if n<=k else y*(n-k)+x*k)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

print(x*n if n=<k else k*x+(n-k)*y)
Problem p02612 (python)

Fixed submission:
N=int(input())

if N%1000==0:
    print("0")
else:
    print((1000-(N%1000)))

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

if N%1000==0:
    print("0")
elif:
    print((1000-(N%1000))
Problem p03261 (python)

Fixed submission:
n=int(input())
w=list()
for i in range(n):
    w.append(input())
ws=set(w)
if len(ws)!=n:
    print("No")
    exit()
x=0
for i in range(n-1):
    x=i+1
    if w[i][-1]!=w[x][0]:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
w=list()
for i in range(n):
    w.append(input())
ws=set(w)
if len(ws)!=n:
    print("No")
    exit()
for i in range(n):
    x=i+1
    if w[i][-1]!=w[x][0]:
        print("No")
        exit()
print("Yes")
Problem p02612 (python)

Fixed submission:
print((10000-int(input()))%1000)

Buggy submission (verdict: Runtime Error):
counter = {}
judge = ['AC', 'WA', 'TLE', 'RE']
for c in judge:
    counter[c] = 0

num = int(input())
for i in range(num):
    counter[input()] += 1

for c in judge:
    print('%s x %d' % (c, counter[c]))
Problem p02613 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
  S.append(input())
 
A = S.count("AC")
B = S.count("WA")
C = S.count("TLE")
D = S.count("RE")
 
print("AC x "+str(A))
print("WA x "+str(B))
print("TLE x "+str(C))
print("RE x "+str(D))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
  S.append(input())

A = S.count("AC")
B = S.count("WA")
C = S.count("TLE")
D = S.count("RE")

print("AC × "+A)
print("WA × "+B)
print("TLE × "+C)
print("RE × "+D)
Problem p02628 (python)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
S = 0
 
for i in range(K):
  S = S + p[i]
  
print(S)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
S = 0

for i in range(K):
  S = S + p[K]
  
print(S)
Problem p02705 (python)

Fixed submission:
print(int(input())*6.3)

Buggy submission (verdict: Runtime Error):
def a(R)
    b = 6.28 * {}.format(R)
    return b
 
print(b)
Problem p02657 (python)

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

print(A*B)

Buggy submission (verdict: Runtime Error):
A, B = int(input())

print(A*B)
Problem p02687 (python)

Fixed submission:
S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')

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

if S is 'ARC':
  print('ABC')
else:
  print('ARC')

Buggy submission (verdict: Runtime Error):
if S is 'ABC':
	print('ARC')
elif S is 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
def next_contest(x):
  if x is 'ABC':
    return 'ARC'
  elif x is 'ARC':
    return 'ABC'
  else:
    return 'not defined contest'

next_contest(S)
Problem p02639 (python)

Fixed submission:
A=list(map(int,input().split()))
for i in range(len(A)):
  if A[i] == 0:
    print(i+1)
    break

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

for i in range(x+1):
  if i*2+(x-i)*4 == y:
    print("Yes")
    exit()
    
print("No")