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

Fixed submission:
N = int(input())
writing = set()
for n in range(N):
    A = int(input())
    if A in writing:
        writing.remove(A)
    else:
        writing.add(A)
print(len(writing))

Buggy submission (verdict: Runtime Error):
N = int(input())
writing = [0 for i in range(1 << 9)]
for n in range(N):
    A = int(input()) - 1
    writing[A] += 1
    writing[A] %= 2
print(sum(writing))
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    """Return greatest common divisor using Euclid's Algorithm."""
    while b:      
        a, b = b, a % b
    return a

def lcm(a, b):
    """Return lowest common multiple."""
    return a * b // gcd(a, b)

N = int(input())
T = int(input())
for i in range(1, N):
    T = lcm(int(input()), T)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    """Return greatest common divisor using Euclid's Algorithm."""
    while b:      
        a, b = b, a % b
    return a

def lcm(a, b):
    """Return lowest common multiple."""
    return a * b // gcd(a, b)

N = int(input())
if N > 1:
    T = int(input())
for i in range(1, N):
    T = lcm(int(input()), T)
print(T)
Problem p03962 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
print(K*((K-1)**(N-1)))
Problem p02642 (python)

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

l = [0] * 1000001

ans = 0

for i in range(n):
    l[a[i]] += 1

for i in range(1, 1000001):
    if l[i] > 0:
        if l[i] == 1:
            ans += 1
        for j in range(2, 1000000//i + 1):
            l[i * j] = 0

print(ans)

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

l = [0] * 1000001

ans = 0

for i in range(n):
    l[a[i]] += 1

for i in range(1, 1000001):
    if l[i] > 0:
        if l[i] == 1:
            ans += 1
        for j in range(2, 1000001//i + 1):
            l[i * j] = 0

print(ans)
Problem p02775 (python)

Fixed submission:
n = input()

dp1 = [0] * (len(n) + 1)
dp2 = [1] * (len(n) + 1)

for i in range(1, len(n) + 1):
    m = int(n[i - 1])
    dp1[i] = min(dp1[i - 1] + m, dp2[i - 1] + 10 - m)
    dp2[i] = min(dp1[i - 1] + m + 1, dp2[i - 1] + 9 - m)

print(dp1[-1])

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

def kuriage(x):
    if x == "":
        return "1"
    elif x[-1] != "9":
        return x[:-1] + str(int(x[-1]) + 1)
    else:
        return kuriage(x[:-1])


ans = 0

while n != "":
    m = int(n[-1])
    if m <= 5:
        ans += m
        n = n[:-1]
    else:
        ans += 10 - m
        n = kuriage(n[:-1])

print(ans)
Problem p03044 (python)

Fixed submission:
import queue

n = int(input())
go = [[]for _ in range(n)]
ge = [[]for _ in range(n)]
 
for _ in range(n-1):
    x,y,z = map(int, input().split())
    if z % 2 == 0:
        ge[x-1].append(y-1)
        ge[y-1].append(x-1)
    else:
        go[x-1].append(y-1)
        go[y-1].append(x-1)

color = [0] * n
color[0] = 1

q = queue.Queue()

q.put(0)

while not q.empty():
    v = q.get()
    for i in range(len(go[v])):
        if color[go[v][i]] == 0:
            color[go[v][i]] = - color[v]
            q.put(go[v][i])
    for i in range(len(ge[v])):
        if color[ge[v][i]] == 0:
            color[ge[v][i]] = color[v]
            q.put(ge[v][i])

for i in range(n):
    if color[i] == -1:
        print(0)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
go = [[]for _ in range(n)]
ge = [[]for _ in range(n)]

for _ in range(n-1):
    x,y,z = map(int, input().split())
    if z % 2 == 0:
        ge[x-1].append(y-1)
        ge[y-1].append(x-1)
    else:
        go[x-1].append(y-1)
        go[y-1].append(x-1)

color = [0] * n

def dfs(v, c):
    color[v] = c
    for i in range(len(go[v])):
        if color[go[v][i]] == 0:
            dfs(go[v][i], -c)
    for i in range(len(ge[v])):
        if color[ge[v][i]] == 0:
            dfs(ge[v][i], c)

dfs(0, 1)

for i in range(n):
    if color[i] == -1:
        print(0)
    else:
        print(1)
Problem p03085 (python)

Fixed submission:
def change(x):
  if x == "A":
    return("T")
  elif x == "T":
    return("A")
  elif x == "C":
    return("G")
  elif x == "G":
    return("C")
  
b = input()
print(change(b))

Buggy submission (verdict: Runtime Error):
if b="A":
  return{"T"}
elif b="T":
  return{"A"}
elif b="G":
  return{"C"}
else:
  return{"G"}
Problem p03109 (python)

Fixed submission:
S = input()
 
if S <= "2019/04/30":
  print("Heisei")
else:
  print("TBD")

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

if S <= 2019/04/30:
  print("Heisei")
else:
  print("TBD")
Problem p03828 (python)

Fixed submission:
import math
 
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append([b, e])
        b, e = b + 1, 0
    if n > 1:
        fct.append([n, 1])
    return fct
 
n = int(input())
mod = 10 ** 9 + 7
 
l = [0] * (n + 1)
 
for i in range(1, n + 1):
  soi = factorize(i)
  for j in range(len(soi)):
    l[soi[j][0]] += soi[j][1]
 
ans = 1
for i in range(1, n + 1):
  ans = ans * (l[i] + 1) % mod
 
print(ans)

Buggy submission (verdict: Runtime Error):
import math

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append([b, e])
        b, e = b + 1, 0
    if n > 1:
        fct.append([n, 1])
    return fct

n = int(input())
mod = 10 ** 9 + 7

l = [0] * (n + 1)

for i in ranfge(1, n + 1):
  soi = factorize(i)
  for j in range(len(soi)):
    l[soi[j][0]] += soi[j][1]

ans = 1
for i in range(1, n + 1):
  ans = ans * (l[i] + 1) % mod

print(ans)
Problem p02573 (python)

Fixed submission:
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uni = UnionFind(N)
for i in range(M):
  uni.union(List[i][0]-1,List[i][1]-1)
res = 0
for i in range(N):
  res = max(res,uni.size(i))
print(res)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uni = UnionFind(N)
for i in range(M):
  uni.union(List[i][0],List[i][1])
res = 0
for i in range(N):
  res = max(res,uni.size(i))
print(res)
Problem p02630 (python)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
Row = int(input())
QList = []
for i in range (Row):
  QList.append(list(map(int, input().split())))
dictA ={}
res = 0
for i in range (N):
  dictA.setdefault(List[i],0) 
  dictA[List[i]] += 1
  res += List[i]
num = 0
for i in range(Row):
  if QList[i][0] not in dictA:
    pass
  else:
    num = dictA[QList[i][0]] 
    res = res - dictA[QList[i][0]] * QList[i][0]
    dictA[QList[i][0]] = 0
    dictA.setdefault(QList[i][1],0) 
    dictA[QList[i][1]] += num
    res += QList[i][1] * num
  print(res)

Buggy submission (verdict: Runtime Error):
N=int(input())
List = list(map(int, input().split()))
Row = int(input())
QList = []
for i in range (Row):
  QList.append(list(map(int, input().split())))
dictA ={}
res = 0
for i in range (N):
  dictA.setdefault(List[i],0) 
  dictA[List[i]] += 1
  res += List[i]
for i in range(Row):
  num = dictA[QList[i][0]] 
  res = res - dictA[QList[i][0]] * QList[i][0]
  dictA[QList[i][0]] = 0
  dictA[QList[i][1]] += num
  res += QList[i][1] * num
  print(res)
Problem p02642 (python)

Fixed submission:
N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in range(N):
  if Flag[List[i]] ==1:
    res +=1
    for j in range(List[i],K,List[i]):
      Flag[j] = 0
    if i != N-1 and List[i] == List[i+1]:
      res += -1
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in range(N):
  if Flag[List[i]] ==1:
    res +=1
    for j in range(List[i],K,List[i]):
      Flag[j] = 0
    if List[i] == List[i+1]:
      res += -1
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in List:
  if Flag[i] ==1:
    res +=1
    for j in range(i,K,i):
      Flag[j] = 0
    if i == List[List.index(i)+1]:
      res += -1
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = list(map(int, input().split()))
res = 0
New_List = sorted(List)
Flag = [1]*N
for i in range(N):
  if Flag[i] ==1:
    for j in range(i+1,N):
      if Flag[j] ==1:
        if New_List[i] == New_List[j]:
          Flag[i] = 0
          Flag[j] = 0
        elif New_List[j] % New_List[i] ==0:
          Flag[j] = 0
        else:
          pass
      elif Flag[j] ==0:
        pass
  else:
    pass
res = Flag.count(1)
print(res)
N = int(input())
List = list(map(int, input().split()))
res = 0
New_List = sorted(List)
Flag = [1]*N
for i in range(N):
  if Flag[i] ==1:
    for j in range(i+1,N):
      if Flag[j] ==1:
        if New_List[i] == New_List[j]:
          Flag[i] = 0
          Flag[j] = 0
        elif New_List[j] % New_List[i] ==0:
          Flag[j] = 0
        else:
          pass
      elif Flag[j] ==0:
        pass
  else:
    pass
res = Flag.count(1)
print(res)
Problem p02647 (python)

Fixed submission:
N,K=map(int,input().split())
List = list(map(int, input().split()))
 
def imosu(x,k):
  data = [0]*k
  for i in range(k):
    first = i-x[i]
    last = i+x[i]
    if first < 0:
      first = 0
    data[first] += 1
    if last+1 < k:
      data[last+1] +=-1
  ruiseki = [0]*k
  ruiseki[0] = data[0]
  for i in range(k-1):
    ruiseki[i+1] = ruiseki[i] + data[i+1]
  return ruiseki
 
for i in range(K):
  List = imosu(List,N)
  if List.count(N) == N:
    break
print(*List)

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

for i in range(K):
  Flag = False
  data = [0]*N
  for j in range(N):
    if i-List[i] < 0:
      i-List[i] = 0
    data[i-List[i]] += 1
    if i+List[i]+1 < N:
      data[i+List[i]+1] +=-1
  List[0] = data[0]
  for j in range(N-1):
    List[i+1] = List[i] + data[i+1]
  if List.count(N) == N:
    break
print(*List)
Problem p02675 (python)

Fixed submission:
N= int(input())
num = N % 10

if num == 3:
  print("bon")
elif num == 0 or num == 1 or num == 6 or num == 8:
  print("pon")
else:
  print("hon")

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

if num == 3:
  print("bon")
elif num == 0 or num == 1 or num == 6 or num == 8:
  print("pon")
else
 print("hon")
Problem p02687 (python)

Fixed submission:
s=input()
if s == "ARC":
  print("ABC")
elif s == "ABC":
  print("ARC")
else:
  print("input is wrong")

Buggy submission (verdict: Runtime Error):
s=input()
if s == ARC:
  print("ABC")
elif s == ABC:
  print("ARC")
else:
  print("input is wrong")
Problem p02690 (python)

Fixed submission:
x = int(input())
resA = 0
resB = 0
for a in range(500):
  for b in range(-500,500):
    A = a**5
    B = b**5
    N= A-B
    if A-B==x:
      resA = a
      resB = b
      break
    else:
      pass
  if A-B==x:
    break
print(resA,resB)

Buggy submission (verdict: Runtime Error):
x = int(input())
a = 0
b = 0
i = 0
flag = 0
while i < 100 :
  c = i**5
  d = (x-c)**0.2
  e = d.is_integer()
  if e == True:
    flag = 1
    b = int(d)
    a = int(i)
    break
  else:
    pass
  i = i + 1
if flag == 0:
  print("impossible")
elif flag == 1:
  print(a,b)
Problem p02780 (python)

Fixed submission:
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1001
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
m=K-1
for j in range(N-m):
  if j == 0:
    mid = midList[j+m]
  else:
    mid = midList[j+m]- midList[j-1] 
  res = max(res,mid)
print(res)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1000
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
for j in range(N-K+1):
  if j == 0:
    mid = midList[j+K-1]
  else:
    mid = midList[j+K-1]- midList[j-1] 
  res = max(res,mid)
print(res)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1000
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
for j in range(N-K+1):
  if j == 0:
    mid = midList[j+K]
  else:
    mid = midList[j+K-1]- midList[j-1] 
  res = max(res,mid)
print(res)
Problem p02837 (python)

Fixed submission:
N = int(input())
ListN=[0]
List = []
res =0
flag = True
mid =0
n =0
for i in range(N):
  k = int(input())
  n += k
  ListN.append(n)
  for j in range(k):
    List.append(list(map(int, input().split())))
#print(List)
for bits in range(2**N):
  mid=0
  flag= True
  for j in range(N):
    #print(bits,j,((bits>>j) & 1))
    if((bits>>j) & 1): 
      mid+= 1
      #print(ListN[j],ListN[j+1])
      for k in range(ListN[j],ListN[j+1]):
        mynum = bits
        #print(bits,List[k][0],(mynum>>List[k][0])&1, List[k][1])
        if ((mynum>>List[k][0]-1)&1) != List[k][1]:
          flag = False
          break
  #print(bits,flag,mid)
  if flag:
    res = max(res,mid)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
ListN=[]*
List = []
keepOrder
for i in range(N):
  k = int(input())
  ListN.append(k)
  for j in range(k):
    List.append(list(map(int, input().split())))
for bits in range(2**N):
  keepOrder = list(bin(bits))
  flag= True
  print(bits,keepOrder)
  for j in range(N):
    if((bits>>j) & 1): 
      for k in range(ListN[j]):
        if keepOrder[List[k][0]-1]!=List[k][1]:
          flag = False
    else:
        if keepOrder[List[k][0]-1]==List[k][1]:
          flag = False
  if flag:
    res = max(res,keepOrder.count("1")
print(res)
Problem p02886 (python)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
wa = 0
for i in range(N):
  for j in range(N):
    if j == i:
      pass
    else:
      wa += List[i]*List[j]
wa = wa //2
print(wa)

Buggy submission (verdict: Runtime Error):
N=int(input())
List = list(map(int, input().split()))
wa = 0
k = 0
for i in range(N):
  if i + 1 == N:
    wa += List[0]*List[N-1]
  else:
    wa += List[i]*List[i+1]
print(res)
Problem p02909 (python)

Fixed submission:
S = input()
List = ["Sunny", "Cloudy", "Rainy"]
res = 0
for i in range(3):
  if S == List[i]:
    res = i+1
if res == 3:
  res = 0
print(List[res])

Buggy submission (verdict: Runtime Error):
S = input()
List = ["Sunny", "Cloudy", "Rainy"]
res = 0
for i in range(3):
  if S == List[i]:
    res = i+1
if res == 2:
  res = 0
print(List[res])
Problem p02958 (python)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
flag = 0
for i in range(N):
  if List[i] == i+1:
    pass
  else:
    flag += 1
if flag==2 or flag == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N=int(input)
List = list(map(int, input().split()))
mid = -1
flag = True
for i in range(N):
  if List[i] == i+1:
    pass
  else:
    flag = False
    if mid == -1:
      mid = List[i]
    else:
      if mid == List[i]:
        print("YES")
      else:
        print("NO")
if flag:
  print("YES")
Problem p02993 (python)

Fixed submission:
s =input()
flag = False
for i in range(3):
  if s[i] == s[i+1]:
    flag = True
if flag:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
s = input()
flag = False
for i in range(3):
  if List[i] == List[i+1]:
    flag = True
if flag:
  print("Bad")
else:
  print("Good")
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
List = list(map(int, input().split()))
height = 0
res = 1
def checkF(k,x):
  if k>x:
    return True
  else:
    return False
    
for i in range(N):
  height += List[i]
  res +=1
  if checkF(height,X):
    res = res-1
    break
print(res)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
List = list(map(int, input().split()))
height = 0
res = 1
def checkF(k,x):
  if k>x:
    return True
  else:
    return False
    
for i in range(N+1):
  height += List[i]
  res +=1
  if checkF(height,X):
    res = res-1
    break
print(res)
Problem p03085 (python)

Fixed submission:
S = input()
mydict = {"A":"T","T":"A","G":"C","C":"G"}
print(mydict[S])

Buggy submission (verdict: Runtime Error):
S = input()
mydict = {"A":"T","T":"A","G":"C","c":"G"}
print(mydict[S])
Problem p03106 (python)

Fixed submission:
A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100,0,-1):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res)
Problem p03109 (python)

Fixed submission:
s = input()
m = int(s[5:7])
if m <=4:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
s = input()
m = int(s[5:7])
if m <=4:
  print("Heisei")
else:
  prit("TBD")
Problem p03110 (python)

Fixed submission:
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(str, input().split())))
res = 0
for i in range(Row):
  if List[i][1] == "JPY":
    res += float(List[i][0])
  else:
    res += float(List[i][0])*380000
print(res)

Buggy submission (verdict: Runtime Error):
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(str, input().split())))
res = 0
for i in range(Row):
  if List[i][1] = "JPY":
    res += int(List[i][0])
  else:
    res += int(List[i][0])*380000
print(res)
Problem p03251 (python)

Fixed submission:
N,M,X,Y=map(int,input().split())
ListX = list(map(int, input().split()))
ListY = list(map(int, input().split()))
ListX.sort()
ListY.sort()
threX = max(X,ListX[N-1])
threY = min(Y,ListY[0])
Z = threX+1
if threY >= Z:
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
N,M,X,Y=map(int,input().split())
ListX = list(map(int, input().split()))
ListY = list(map(int, input().split()))
ListX.sort()
ListX.sort()
threX = max(X,List[N-1])
threY = min(Y,List[0])
Z = threX+1
if threY >= Z:
  print("No War")
else:
  print("War")
Problem p03261 (python)

Fixed submission:
Row = int(input())
flag = True
List = []
for i in range (Row):
  List.append(input())
s_l = set(List)
if len(List) != len(s_l):
  print("No")
else:
  for i in range(Row-1):
    n = len(List[i])-1
    if List[i][n] != List[i+1][0]:
      flag = False
  if flag:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
Row = int(input())
flag = True
List = []
for i in range (Row):
  List.append(int(input()))
s_l = set(List)
if len(List) != len(s_l):
  print("No")
for i in range(Row-1):
  n = len(List[i])-1
  if List[i][n] != List[i+1][0]:
    flag = False
if flag:
  print("Yes")
else:
  print("No")
Problem p03282 (python)

Fixed submission:
S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
    break
print(res)

Buggy submission (verdict: Runtime Error):
S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
print(res)
Problem p03289 (python)

Fixed submission:
S = input()
flag = True
count = 0
if not S[0] == "A":
  flag = False
for i in range(2,len(S)-1):
  if S[i] == "C":
    count += 1
  else:
    if not S[i].islower():
      flag = False
if not S[1].islower():
  flag = False
if not S[len(S)-1].islower():
  flag = False
if not count == 1:
  flag = False
if flag:
  print("AC")
else:
  print("WA")

Buggy submission (verdict: Runtime Error):
S = input()
flag = True
count = 0
if not S[0] == "A":
  flag = False
for i in range(2,len(S)-1):
  if S[i] == "C":
    count += 1
  else:
    if not S[len(S)].islower():
      flag = False 
if not S[len(S)].islower():
  flag = False
if not count == 1:
  flag = False
if flag:
  print("AC")
else:
  print("WA")
Problem p03308 (python)

Fixed submission:
N = int(input())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for j in range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for j range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for i range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)
Problem p03387 (python)

Fixed submission:
List = list(map(int, input().split()))
List.sort()
res = List[2]-List[1]
List[1] = List[2]
List[0] += res
mid = List[2] - List[0]
if mid % 2 == 1:
  res += mid // 2 +2
else:
  res += mid //2
print(res)

Buggy submission (verdict: Runtime Error):
List = list(map(int, input().split()))
List.sort()
res = List[2]-List[1]
Litt[1] = List[2]
List[0] += res
mid = List[2] - List[0]
if mid % 2 == 1:
  res += mid //2 +1
else:
  res += mid //2
print(res)