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

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

if abs(c-a)<=d or (abs(a-b)<=d and abs(b-c)<=d):
 print('Yes')
else:
 print('No')

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

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   ans.pop()
  print(ans)
    


answer=ans[K-1]
print(answer)
Problem p03353 (python)

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
   if len(ans)>K:
    if cut_s==s[K]:
      ans.pop()
      break;
    ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
  if len(ans)>K:
    ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
 
answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()

answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   ans.pop()
  print(ans)
    


answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)
si=[]
count=0


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
   if len(ans)>K:
    ans.pop()

answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)
count=0


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
    
ans.sort()

answer=ans[K-1]
print(answer)
Problem p03404 (python)

Fixed submission:
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1

print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)

for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+'#')

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1
 
print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)
 
for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+',')
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1

print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.#'*((A-1)%50)+'#'*(99-2*((A-1)%50))))
 else:
  print(('.#'*49)+'.')
 print('#'*99)

for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('#.'*((B-1)%50)+'.'*(99-2*((B-1)%50))))
 else:
  print(('#.'*49)+'.')
Problem p03452 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**7)
 
N,M=map(int,input().split())
Graph=[[] for i in range(N)]
for i in range(M):
  L,R,D=map(int,input().split())
  Graph[L-1].append((R-1,D))
  Graph[R-1].append((L-1,-D))
visit=[False]*N
dist=[0]*N
 

for i in range(N):
  if not visit[i]:
    visit[i]=True
    A=deque()
    A.append(i)
    while A:
      x=A.pop()
      for y,d in Graph[x]:
        if visit[y] and (dist[y]!=d+dist[x]):
          print('No')
          exit()
        elif not visit[y]:
          visit[y]=True
          A.append(y)
          dist[y]=d+dist[x]
print('Yes')

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())
Graph=[[] for i in range(N)]
for i in range(M):
  L,R,D=map(int,input().split())
  Graph[L-1].append(R-1,D)
  Graph[R-1].append(L-1,-D)
visit=[False]*N
dist=[0]*N

for i in range(N):
  if not visit[i]:
    visit[i]=True
    A=deque()
    A.append(i)
    while A:
      x=A.pop()
      for y,d in Graph[x]:
        if visit[y] and dist[y]!=d+dist[x]
        	print('No')
          	exit()
        elif not visit[y]:
          visit[y]=True
          A.append(y)
          dist[y]=d+dist[x]
print('Yes')
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())
answer=[]

try:
 for i in range(N+1):
   for j in range(N-i+1):
     sum=i*10000+j*5000+(N-i-j)*1000
     if sum==Y:
       raise Exception
except Exception:
  print(i,j,N-i-j)
else:
  print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y=map(int,input().split())
answer=[]

try:
 for i in range(N+1):
   for j in range(N-i+1):
     sum=i*10000+j*5000+(N-i-j)*1000
     if sum==Y:
       raise Exception
except Exception:
  answer=[i,j,N-i-j]
  print(answer)
else:
  print[-1,-1,-1]
Problem p03576 (python)

Fixed submission:
#https://atcoder.jp/contests/abc075/submissions/2242350
N,K=map(int,input().split())

points=[tuple(map(int,input().split())) for i in range(N)]
answer=10**19
sortx=sorted(points)
numberx = list(enumerate(sortx))

#n-k+1以降を左の頂点とすると点の数が明らかに足りない
for left,(x1,y1) in numberx[:N-K+1]:
  #left+K-1以降を右の頂点にしないと間に足りる点の数が入ってない
  for right,(x2,y2) in numberx[left+K-1:]:
    dx=x2-x1
    #left-rightの間でyについてsort
    sorty=sorted(y for x,y in sortx[left:right+1])
    #K個点を入れた状態で面積を求める
    for y3,y4 in zip(sorty,sorty[K-1:]):
      if y3<=y1 and y3<=y2 and y4>=y1 and y4>=y2:
        answer=min(answer,dx*(y4-y3))
         
print(answer)

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

A = [[int(i)-1 for i in input().split()] for i in range(M)]
#print(A)
def dfs(x):
  if visited[x]:
    return
  visited[x]=True
  for i in range(N):
    if edgemat[x][i]:
      dfs(i)
answer=0

for i in range(M):
  visited=[False]*N
  Acopy=copy.deepcopy(A)
  del Acopy[i]
  edgemat=[[0] *N for j in range(N)]
  for m,n in Acopy:
    edgemat[m][n]=1
    edgemat[n][m]=1
  dfs(0)
  if any(visited[y] == False for y in range(N)):
    answer+=1
print(answer)
Problem p03614 (python)

Fixed submission:
N=int(input())

A=list(map(int,input().split()))
answer=0

for i in range(N):
  if A[i]==i+1:
    if i!=N-1 and A[i+1]!=i+1:
      A[i],A[i+1]=A[i+1],A[i]
      answer+=1
    else:
      A[i],A[i-1]=A[i-1],A[i]
      answer+=1
print(answer)

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

A=list(map(int,input().split()))
answer=0

for i in range(N):
  if A[i]==i+1:
    if A[i+1]!=i+1 and i!=N-1:
      A[i],A[i+1]=A[i+1],A[i]
      answer+=1
    else:
      A[i],A[i-1]=A[i-1],A[i]
      answer+=1
print(answer)
Problem p03693 (python)

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

if (r*100+g*10+b)%4==0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(min(sum(flag),1),sum(flag)+count)
Problem p03695 (python)

Fixed submission:
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<=1999:
  flag[4]=1
 if 2000<=a[i]<=2399:
  flag[5]=1
 if 2400<=a[i]<=2799:
  flag[6]=1
 if 2800<=a[i]<=3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(max(1,sum(flag)),sum(flag)+count)

Buggy submission (verdict: Runtime Error):
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(min(sum(flag),1),sum(flag)+count)
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<1999:
  flag[4]=1
 if 2000<=a[i]<2399:
  flag[5]=1
 if 2400<=a[i]<2799:
  flag[6]=1
 if 2800<=a[i]<3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(max(sum(flag),1),sum(flag)+count)
Problem p02732 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
num = [0]*(n+1)
s = 0
for i in a:
    num[i] += 1
for i in num:
    s += i*(i-1)//2
for i in range(n):
    print(s-num[a[i]]+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = [a.count(i+1) for i in range(n)]
d = []
for j in b:
    if j >= 2:
        d.append(factorial(j)//factorial(2)//factorial(j-2))
    else:
        d.append(0)

for k in a:
    if b[k-1] >= 3:
        u = b[k-1] 
        p = factorial(u-1)//factorial(2)//factorial(u-3)
        print(sum(d)-d[k-1]+p)
    else:
        print(sum(d)-d[k-1])
Problem p02791 (python)

Fixed submission:
n = int(input())
p = [int(s) for s in input().split()]
count = 0
M = p[0]
for a in range(n):
     i = p[a]
     if M >=i :
          count+=1
          M = i
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(s) for s in input().split()]
count = 0
m = p[0]
for a in range(n):
     i = p[a]
     if M>=i:
         count+=1
         m = i
        
print(count)
Problem p02811 (python)

Fixed submission:
n,m = map(int,input().split())
if n*500>=m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,m = maps(int,input().split())
if n*500>=m:
  print("Yes")
else:
  print("No")
Problem p03693 (python)

Fixed submission:
#list(map(int, input().split()))
a,b,c=list(map(int, input().split()))
print('YES') if (b*10+c)%4==0 else print('NO')

Buggy submission (verdict: Runtime Error):
#list(map(int, input().split()))
a,b,c,d=list(map(int, input().split()))
print('YES') if (g*10+b)%4==0 else print('NO')
Problem p02684 (python)

Fixed submission:
n, k = list(map(int,input().split()))
a = list(map(int,input().split()))
 
position = 1
exp1 = [0] * n
exp1[0] = 1
exp = [1]
count = 0
 
if n >= k:
  for i in range(k):
    position = a[position - 1]
  print(position)
else:
  for i in range(k):
    position = a[position - 1]
    count += 1
    if exp1[position - 1] == 0:
      exp.append(position)
      exp1[position - 1] += 1
    else:
      break
  init = exp.index(position)
  res = (k - init) % (count - init)
  print(exp[init + res])

Buggy submission (verdict: Runtime Error):
n, k = list(map(int,input().split()))
a = list(map(int,input().split()))
 
position = 1
exp = [1]
count = 0
 
if n >= k:
  for i in range(k):
    position = a[position - 1]
  print(position)
else:
  for i in range(k):
    position = a[position - 1]
    count += 1
    if position in exp:
      exp.append(position)
    else:
      break
  init = exp.index(position)
  res = (k - init) % (count - init)
  print(exp[init + res])
Problem p02741 (python)

Fixed submission:
k = int(input())
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(s[k - 1])

Buggy submission (verdict: Runtime Error):
k = input()
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(s[k - 1])
Problem p02742 (python)

Fixed submission:
h, w = list(map(int, input().split()))
import sys

if w == 1 or h == 1:
  print('1')
  sys.exit()

if w % 2 == 0:
  print(h * w // 2)
else:
  if h % 2 == 0:
    print((w // 2 + w // 2 + 1) * h // 2)
  else:
    print((w // 2 + w // 2 + 1) * (h // 2) + w // 2 + 1)

Buggy submission (verdict: Runtime Error):
h, w = list(map(int, input()))

if w % 2 == 0:
  print(h * 2 // 2)
else:
  if h % 2 == 0:
    print((w // 2 + w // 2 + 1) * h // 2)
  else:
    print((w // 2 + w // 2 + 1) * h // 2 + w // 2)
Problem p02743 (python)

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

if c - a - b > 0 and 4 * a * b < (c - a - b) ** 2:
  print('Yes')
else:
  print('No')

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

if math.sqrtl(a) + math.sqrtl(b) < math.sqrtl(c):
  print('Yes')
else:
  print('No')
Problem p02744 (python)

Fixed submission:
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(max(s)) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)

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

def dfs(str s):
  if len(s) == n:
    print(s)
  else:
    for i in range(int(s[len(s) - 1] - 'a')):
      dfs(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
import sys

a = 'abcdefghij'
s = 'a'
count = 0

if n == 1:
  print('a')
  sys.exit()

for i in range(2):
  s.append(a[i])
  if i == 0:
    count += 1
  if count == n - 1:
    print(s)
    break
  for j in range(i + 1):
    s.append(a[i])
    if i == 0:
      count += 1
    if count == n - 1:
      print(s)
      break
    for k in range(j + 1):
      s.append(a[i])
      if i == 0:
        count += 1
      if count == n - 1:
        print(s)
        break
      for l in range(k + 1):
        s.append(a[i])
        if i == 0:
          count += 1
        if count == n - 1:
          print(s)
          break
        for m in range(l + 1):
          s.append(a[i])
          if i == 0:
            count += 1
          if count == n - 1:
            print(s)
            break
          for o in range(m + 1):
            s.append(a[i])
            if i == 0:
              count += 1
            if count == n - 1:
              print(s)
              break
            for p in range(o + 1):
              s.append(a[i])
              if i == 0:
                count += 1
              if count == n - 1:
                print(s)
                break
              for q in range(p + 1):
                s.append(a[i])
                if i == 0:
                  count += 1
                if count == n - 1:
                  print(s)
                  break

Buggy submission (verdict: Runtime Error):
n = int(input())
import sys

a = 'abcdefghij'
s = 'a'
count = 0

if n == 1:
  print('a')
  sys.exit()

for i in range(2):
  s.append(a[i])
  if i == 0:
    count += 1
  if count == n - 1:
    break
  for j in range(i + 1):
    s.append(a[i])
    if i == 0:
      count += 1
    if count == n - 1:
      break
    for k in range(j + 1):
      s.append(a[i])
      if i == 0:
        count += 1
      if count == n - 1:
        break
      for l in range(k + 1):
        s.append(a[i])
        if i == 0:
          count += 1
        if count == n - 1:
          break
        for m in range(l + 1):
          s.append(a[i])
          if i == 0:
            count += 1
          if count == n - 1:
            break
          for o in range(m + 1):
            s.append(a[i])
            if i == 0:
              count += 1
            if count == n - 1:
              break
            for p in range(o + 1):
              s.append(a[i])
              if i == 0:
                count += 1
              if count == n - 1:
                break
              for q in range(p + 1):
                s.append(a[i])
                if i == 0:
                  count += 1
                if count == n - 1:
                  break
print(s)
Problem p02747 (python)

Fixed submission:
s = input()

count = len(s) // 2

if s == 'hi' * count:
  print('Yes')
else:
  print('No')

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

count = len(s) / 2

if s == 'hi' * count:
  print('Yes')
else:
  print('No')
Problem p02748 (python)

Fixed submission:
aa, bb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
c = []
for i in range(m):
  x1, y1, c1 = list(map(int,input().split()))
  x.append(x1)
  y.append(y1)
  c.append(c1)

price = []
  
for i in range(m):
  price.append(a[x[i] - 1] + b[y[i] - 1] - c[i])
  
  
  
print(min(min(price), min(a) + min(b)))

Buggy submission (verdict: Runtime Error):
aa, bb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
c = []
for i in range(m):
  x1, y1, c1 = list(map(int,input().split()))
  x.append(x1)
  y.append(y1)
  c.append(c1)

price = []
  
for i in range(m):
  price.append(a[x[i] - 1] + b[y[i] - 1] - c[i])
  
  
  
print(min(price, min(a) + min(b)))
Problem p02791 (python)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
answer = 0
minimum = P[0]

for i in range(N):
    if P[i] <= minimum:
        answer += 1
    minimum = min(P[i], minimum)
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
answer = []
count = []

for i in range(N):
    if P[i] <= min(P[0, i + 1]):
        answer.append[i]
print(len(answer))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
answer = []

for i in range(N):
    for j in range(i + 1):
        if P[i] <= P[j]:
            count += 1
    if count == i:
        answer.append(i)
print(answer.count())
Problem p02885 (python)

Fixed submission:
A, B = map(int,input().split())
 
if(A > 2 * B):
  print(A - 2 * B)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
A = int(input(stdin))
B = int(input(stdin))
 
if(A > 2 * B):
  print(A - 2 * B)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
int A = input(stdin)
int B = input(stdin)
 
if(A > 2 * B):
  print(A - 2 * B)
else:
  print("0")

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

if(A > 2 * B):
  return A - 2 * B
else:
  return 0
Problem p02886 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
s = 0

for i in range(N):
  for j in range(i+1):
    if i != j:
      s += d[i]* d[j]
    
print(s)

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

for i in range(N):
  for j in range(i+1):
    sum += d(i) * d(j)
    
print(sum)
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()
d = S[0]

for i in range(1, N):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input().split())
d = S[0]

for i in range(1, N):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input().split())
d = S[0]

for i in range(1, N-1):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()
d = S[0]

for i in range(1, N-1):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
a = [0] * N
start = 0

for i in range(N - 1):
  if H[i] >= H[i+1]:
    a[start] += 1
  else:
    start += 1

      
print(max(a))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
a = [0] * N
start = 0

for i in range(N):
  if H[i] >= H[i+1]:
    a[start] += 1
  else:
    start += 1

      
print(max(a))

Buggy submission (verdict: Runtime Error):

N = int(input())
H = list(map(int, input().split()))
a = [0] * N

for i in range(N):
  for j in range(i:N-1):
    if H[j] >= H[j+1]:
      a[i] = a[i] + 1
    else:
      break
      
print(max(a))

Buggy submission (verdict: Runtime Error):
import sys
from statistics import max

N = int(input())
H = list(map(int, input().split()))
a = [0] * N

for i in range(N):
  for j in range(i:N-1):
    if H[j] >= H[j+1]:
      a[i] += 1
    else:
      break
      
print(max(a))

Buggy submission (verdict: Runtime Error):
import sys
from statistics import max

N = int(input())
H = list(map(int, input()))
a = [0] * N

for i in range(N):
  for j in range(i:N-1):
    if H[j] >= H[j+1]:
      a[i] += 1
    else:
      break
      
print(max(a))
Problem p02687 (python)

Fixed submission:
last_name = input()
last_type = last_name[:3]
 
if last_type == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
last_name = input()
last_type = last_name[:3]

if last_type == "ABC":
  return "ARC"
else:
  return "ABC"
Problem p02690 (python)

Fixed submission:
X = int(input())

result = [0, 0]
powers = [x**5 for x in range(1001)]

end_flag = False
for i in range(1001):
    a5 = powers[i]
    for j in range(i, 1001):
        b5 = powers[j]
        x = a5 - b5
        if (x == X):
            result[0] = i
            result[1] = j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = -j
            end_flag = True
            break
        x = a5 + b5
        if (x == X):
            result[0] = i
            result[1] = -j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = j
            end_flag = True
            break
    if end_flag:
        break

A, B = result
print(f"{A} {B}")

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

result = [0, 0]
powers = [x**5 for x in range(101)]

end_flag = False
for i in range(101):
    a5 = powers[i]
    for j in range(i, 101):
        b5 = powers[j]
        x = a5 - b5
        if (x == X):
            result[0] = i
            result[1] = j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = -j
            end_flag = True
            break
        x = a5 + b5
        if (x == X):
            result[0] = i
            result[1] = -j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = j
            end_flag = True
            break
    if end_flag:
        break

A, B = result
if A*B == 0:
    raise "invalid X"

print(f"{A} {B}")
Problem p02791 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans=0
p_min=n+1
for i in range(n):
    if p[i]<p_min:
        ans+=1
        p_min=p[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
ans=0
p_max=n+1
for i in range(n):
    if p[i]<p_min:
        ans+=1
        p_min=p[i]
print(ans)
Problem p02795 (python)

Fixed submission:
import math
h,w,n=[int(input()) for _ in range(3)]
print(math.ceil(n/max(h,w)))

Buggy submission (verdict: Runtime Error):
import math
h,w,n=map(int,input().split())
print(math.ceil(n/max(h,w)))
Problem p02848 (python)

Fixed submission:
n=int(input())
s=input()
s_len=len(s)
ans=""
for i in range(s_len):
    char=65+(ord(s[i])+n-65)%26
    ans+=chr(char)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
s_len=len(s)
ans=""
for i in range(s_len):
    char=97+(ord(s)+n)%26
    ans+=chr(char)
print(ans)