Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
Letter=[]
list=[0]*N
for i in range(N):
  Letter.append(S[i])

R_sum=0
L_sum=0
Leftl=0

for i in range(Leftl,N-2):

  R_sum=0
  while S[i]=="R":
    R_sum=R_sum+1
    i=i+1
  else:
    L_sum=0
    if R_sum>=1:
      while S[i]=="L":
        L_sum=L_sum+1
        if i!=N-1:
          i=i+1
        else:
          break
      else:
        print(Leftl,R_sum,L_sum)

        if R_sum%2==1:
          list[Leftl+R_sum-1]=(R_sum+L_sum+1)//2
          list[Leftl+R_sum]=(R_sum+L_sum)//2          
        else:
          list[Leftl+R_sum-1]=(R_sum+L_sum)//2
          #print(Leftl,R_sum)
          list[Leftl+R_sum]=(R_sum+L_sum+1)//2          
        Leftl=i          
        
        
        
print(list)


  
#  if S[i]=="R" and S[i+1]=="L":
#    list.append(i)

#print(Letter)
#print(list)
#for j in list:
#  print(j)

Fixed submission:
S=input()
N=len(S)
ans=[]

def calc(R_count,L_count,ans):
  ans += [0]*(R_count-1)
  ans.append( (R_count+1)//2 + (L_count//2) )  
  ans.append( (L_count+1)//2 + (R_count//2) )
  ans += [0]*(L_count-1)
  return

R_count=0
L_count=0
i=0

while i<N:
  #print(i,S[i])
  if S[i]=="R":
    R_count += 1
    i += 1
  else:
    while i<N and S[i]=="L":
      #print(i,S[i])
      L_count +=1
      i += 1
    calc(R_count,L_count,ans)
    R_count=0
    L_count=0

#print(ans)
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split()) 
a=[0]*M
for i in range(M):
  a[i]=int(input())

dp=[0]*(N+1)
dp[0]=1
if 1 in a:
  dp[1]=0
else:
  dp[1]=1
  
for j in range(2,N+1):
  if j in a:
    dp[j]=0
  else:
    dp[j]=dp[j-2]+dp[j-1]

#print(dp)
print(dp[-1]%1000000007)

Fixed submission:
N,M=map(int, input().split()) 
a=[0]*M
for i in range(M):
  a[i]=int(input())
b=set(a)

dp=[0]*(N+1)
dp[0]=1
if 1 in b:
  dp[1]=0
else:
  dp[1]=1
  
for j in range(2,N+1):
  if j in b:
    dp[j]=0
  else:
    dp[j]=dp[j-2]+dp[j-1]

#print(dp)
print(dp[-1]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int, input().split()) 
S=[[0 for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
  S[i+1]= ["#"] + list(input()) + ["#"]
for j in range(W+2):
  S[0][j]="#"
  S[-1][j]="#"
  
t=[[-1 for _ in range(W)] for _ in range(H)]
y=[[-1 for _ in range(W)] for _ in range(H)]

for i in range(H):
  for j in range(W):
    if S[i+1][j+1]==".":
      if t[i][j]==-1:
        k=1
        while True:
          if S[i+k+1][j+1]==".":
            k +=1
          else:
            break
        for l in range(k):
          t[i+l][j]=k       
      if y[i][j]==-1:
        m=1
        while True:
          if S[i+1][j+1+m]==".":
            m +=1
          else:
            break
        for n in range(m):
          y[i][j+n]=m       

maxi=0          
for i in range(H):
  for j in range(W):
    maxi=max(maxi, t[i][j]+y[i][j])
print(maxi-1)

Fixed submission:
H,W=map(int, input().split()) 
S=[[0 for _ in range(W+2)] for _ in range(H+2)]
for i in range(H):
  S[i+1]= ["#"] + list(input()) + ["#"]
for j in range(W+2):
  S[0][j]="#"
  S[-1][j]="#"
  
t=[[-1 for _ in range(W)] for _ in range(H)]
y=[[-1 for _ in range(W)] for _ in range(H)]

for i in range(H):
  for j in range(W):
    if S[i+1][j+1]==".":
      if t[i][j]==-1:
        k=1
        while True:
          if S[i+k+1][j+1]==".":
            k +=1
          else:
            break
        for l in range(k):
          t[i+l][j]=k       
      if y[i][j]==-1:
        m=1
        while True:
          if S[i+1][j+1+m]==".":
            m +=1
          else:
            break
        for n in range(m):
          y[i][j+n]=m       

maxi=0          
for i in range(H):
  for j in range(W):
    maxi=max(maxi, t[i][j]+y[i][j])
print(maxi-1)
Buggy python submission (verdict: Runtime Error):
print(180*(int(input())-2)

Fixed submission:
print(180*( int(input())-2 ))
Buggy python submission (verdict: Runtime Error):
S=input()
if S.count("o")+(15-len(S)>=8:
  print("YES")
else:
  print("NO")

Fixed submission:
S=input()
if S.count("o")+(15-len(S))>=8:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
S=input()

left=int(S[:2])
right=int(S[2:])

YYMM=True
MMYY=True
AMBIGUOUS=True
NA=True


if leftL<=0 or left>12:
  MMYY=False
  AMBIGUOUS=False
else:
  NA=False
  
if right<=0 or right>12:
  YYMM=False
  AMBIGUOUS=False
else:
  NA=False

if YYMM==True:
  if MMYY==True:
    print("AMBIGOUS")
  else:
    print("YYMM")
else:
  if MMYY==True:
    print("MMYY")
  else:
    print("NA")

Fixed submission:
S=input()

left=int(S[:2])
right=int(S[2:])

YYMM=True
MMYY=True
AMBIGUOUS=True
NA=True


if left<=0 or left>12:
  MMYY=False
  AMBIGUOUS=False
else:
  NA=False
  
if right<=0 or right>12:
  YYMM=False
  AMBIGUOUS=False
else:
  NA=False


if YYMM==True:
  if MMYY==True:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if MMYY==True:
    print("MMYY")
  else:
    print("NA")
Buggy python submission (verdict: Runtime Error):
N=int(input())
S = input()

if N==1:
  print(0)
  exit()
else:
  W=[1 if S[0]=="." else 0]
  ans=float("inf")

  for i in range(1,N):
    if S[i]==".":
      W.append(W[-1]+1)
    else:
      W.append(W[-1])
      
  if W[-1]==0 or W[-1]==N:
    print(0)
    eixt()

  for i in range(N):
    cost_W = i+1-W[i]
    cost_B = W[-1]-W[i]
    cost=cost_W+cost_B
    #print(N, W[-1], i+1, W[i])
    #print("cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
    ans=min(ans,cost)
    print(ans)

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

W=[1 if S[0]=="." else 0]
ans=float("inf")

for i in range(1,N):
  if S[i]==".":
    W.append(W[-1]+1)
  else:
    W.append(W[-1])
    
if W[-1]==0 or W[-1]==N:
  print(0)
  exit()

for i in range(N):
  cost_W = i+1-W[i]
  cost_B = W[-1]-W[i]
  cost=cost_W+cost_B
  #print(N, W[-1], i+1, W[i])
  #print(i,"cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
  ans=min(ans,cost)
ans=min(W[-1],N-W[-1],ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=list(input())
T=[int(a) for a in S]
U=[]

tmp=T[0]
cnt=1
for i in range(1,N):
  if i==N-1:
    if T[i]==T[i-1]:
      cnt+=1
      U.append((tmp,cnt) )
    else:
      U.append((tmp,cnt) )
      U.append((T[i],1))
  else:
    if T[i]==T[i-1]:
      cnt+=1
    else:
      U.append((tmp,cnt) )
      tmp=T[i]
      cnt=1
    
print(U)

for _ in range(K):
  maxi=0
  for i,kumi in enumerate(U):
    if kumi[0]==0:
      if i==0:
        if len(U)>1:
          tmp = kumi[1]+U[i+1][1]
        else:
          tmp= kumi[1]
      elif 0<i<len(U)-1:
        tmp = U[i-1][1] + kumi[1]+ U[i+1][1]
      else: # i=len(U)-1
        tmp= U[i-1][1] + kumi[1]
      maxi=max(maxi,tmp)
  print("search:",maxi)
  for i,kumi in enumerate(U):
    if kumi[0]==0 and kumi[1]==maxi:
      if i==0:
        if len(U)>1:
          U[1][1] += kumi[1]
          U.pop(0)
        else:
          kumi[0]=1
      elif 0<i<len(U)-1:
        U[i-1][1] += kumi[1]+U[i+1][1]
        U.pop(i)
        U.pop(i)
      else: # i=len(U)-1
        U[i-1][1] += kumi[1]
        U.pop()
  print(U)

Fixed submission:
N,K=map(int,input().split())
S=list(input())
T=[int(a) for a in S]
U=[]

if N==1:
  U=[ [T[0],1] ]
else:
  tmp=T[0]
  cnt=1
  for i in range(1,N):
    if i==N-1:
      if T[i]==T[i-1]:
        cnt+=1
        U.append([tmp,cnt] )
      else:
        U.append([tmp,cnt] )
        U.append([T[i],1])
    else:
      if T[i]==T[i-1]:
        cnt+=1
      else:
        U.append([tmp,cnt] )
        tmp=T[i]
        cnt=1

summ=0
for j in range(len(U)):
  summ += U[j][1]
  U[j][1]=summ
if U[0][0]==0:
  U.insert(0,[1,0])
  U.insert(0,[0,0])
else:
  U.insert(0,[0,0])

#print(U)
maxi=0
  
for p,q in enumerate(U):
  if q[0]==1:
    pass
  else:
    right=min(p+K*2+1,len(U)-1)
    diff=U[right][1]-U[p][1]
    maxi=max(diff,maxi)
    #print(p,right,diff)
print(maxi)
Buggy python submission (verdict: Runtime Error):
def main():
  b=int(input())

  if b=="A":
    return "T"
  elif b=="C":
    return "G"
  elif b="G":
    return "C"
  elif b=="T":
    return "A"

main()


Fixed submission:
def main():
  b=input()

  if b=="A":
    print("T")
  elif b=="C":
    print("G")
  elif b=="G":
    print("C")
  elif b=="T":
    print("A")

main()
Buggy python submission (verdict: Time Limit Exceeded):
N,Q= map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
for i in range(Q):
  l[i],r[i] = map(int,input().split())
  cnt=0
  for j in range(l[i]-1,r[i]-1):
    #print(S[j]+S[j+1])
    if S[j]+S[j+1]=="AC":
      cnt +=1
  print(cnt)

Fixed submission:
N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
T=[0]

for j in range(0,N-1):
  if S[j]+S[j+1]=="AC":
    T.append(T[-1]+1)
  else:
    T.append(T[-1])
T.append(T[-1])
#print(T)

for i in range(Q):
  l[i],r[i] = map(int,input().split())
  print( T[r[i]-1] - T[l[i]-1] )
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
{ % if prediction_success % }
{ % endif % }
{ % if mod or yes_str or no_str % }

{ % endif % }
{ % if mod % }
MOD = None  # type: int
{ % endif % }
{ % if yes_str % }
YES = "None"  # type: str
{ % endif % }
{ % if no_str % }
NO = "None"  # type: str
{ % endif % }
{ % if prediction_success % }


def solve(A: int, B: int, C: int):
    return
{ % endif % }


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    { % if prediction_success % }

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)
    { % else % }
    # Failed to predict input format
    pass
    { % endif % }


if __name__ == '__main__':
    main()


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

  if B>= A*C:
    print(C)
  else:
    print(B//A)

main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]-B[i],B[i]-A[i])

t=0
a=0

for i in range(N):
  if i%2==0: #高橋くんの番
    C.sort(key= lambda x: x[3],reverse=True)
    C.sort(key= lambda x: x[0],reverse=True)
    #print(i,C)
    t += C.pop(0)[0]
  if i%2==1: #青木さんの番
    C.sort(key= lambda x: x[2],reverse=True)
    C.sort(key= lambda x: x[1],reverse=True)
    #print(i,C)
    a += C.pop(0)[1]
  #print(i,C)
print(t-a)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]+B[i])

t=0
a=0

C.sort(key= lambda x: x[2],reverse=True)
#print(C)
#C.sort(key= lambda x: x[0],reverse=True)
for i in range(N):
  if i%2==0:
    t += C[i][0]
  else:
    a += C[i][1]

print(t-a)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]-B[i],B[i]-A[i])

t=0
a=0

for i in range(N):
  if i%2==0: #高橋くんの番
    C.sort(key= lambda x: x[3],reverse=True)
    C.sort(key= lambda x: x[0],reverse=True)
    #print(i,C)
    t += C.pop(0)[0]
  if i%2==1: #青木さんの番
    C.sort(key= lambda x: x[2],reverse=True)
    C.sort(key= lambda x: x[1],reverse=True)
    #print(i,C)
    a += C.pop(0)[1]
  #print(i,C)
print(t-a)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]+B[i])

t=0
a=0

C.sort(key= lambda x: x[2],reverse=True)
#print(C)
#C.sort(key= lambda x: x[0],reverse=True)
for i in range(N):
  if i%2==0:
    t += C[i][0]
  else:
    a += C[i][1]

print(t-a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]-B[i],B[i]-A[i])

t=0
a=0

for i in range(N):
  if i%2==0: #高橋くんの番
    C.sort(key= lambda x: x[3],reverse=True)
    C.sort(key= lambda x: x[0],reverse=True)
    #print(i,C)
    t += C.pop(0)[0]
  if i%2==1: #青木さんの番
    C.sort(key= lambda x: x[2],reverse=True)
    C.sort(key= lambda x: x[1],reverse=True)
    #print(i,C)
    a += C.pop(0)[1]
  #print(i,C)
print(t-a)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]+B[i])

t=0
a=0

C.sort(key= lambda x: x[2],reverse=True)
#print(C)
#C.sort(key= lambda x: x[0],reverse=True)
for i in range(N):
  if i%2==0:
    t += C[i][0]
  else:
    a += C[i][1]

print(t-a)
Buggy python submission (verdict: Time Limit Exceeded):
N,K= map(int,input().split())
h=[1000000000]+list(map(int,input().split()))
dp=[0]*(N+1)

dp[1]=0
dp[2]=abs(h[2]-h[1])

if N>=3:
  for i in range(3,N+1):
    mini=1000000000
    for j in range(1,K+1):
      if i-j <1:
        pass
      else:
        mini=min(mini, dp[i-j] + abs(h[i]-h[i-j]) )
    dp[i]=mini
    
#print(dp)
print(dp[-1])

Fixed submission:
N,K= map(int,input().split())
h=[1000000000]+list(map(int,input().split()))
dp=[0]*(N+1)

dp[1]=0
dp[2]=abs(h[2]-h[1])

if N>=3:
  for i in range(3,N+1):
    mini=1000000000
    for j in range(1,K+1):
      if i-j <1:
        pass
      else:
        mini=min(mini, dp[i-j] + abs(h[i]-h[i-j]) )
    dp[i]=mini
    
#print(dp)
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W= map(int,input().split())
w=[0]*N
v=[0]*N

for i in range(N):
  w[i],v[i]=map(int,input().split())
  
dp=[[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(1,N+1):
  for j in range(0,W+1):
    if j<w[i-1]:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max( dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1] )
      
print(dp[N][W])

Fixed submission:
N,W= map(int,input().split())
w=[0]*N
v=[0]*N

for i in range(N):
  w[i],v[i]=map(int,input().split())
  
dp=[[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(1,N+1):
  for j in range(0,W+1):
    if j<w[i-1]:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max( dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1] )
      
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
    
dp=[[0 for _ in range(N+1) ] for _ in range(W+1)]

for i in range(1,N+1):    #i番目の荷物
    for j in range(1,W+1):   #上限の重さ
        if j>=w[i-1]:
            dp[j][i]=max(dp[j-w[i-1]][i-1]+v[i-1],dp[j][i-1])
        else:
            dp[j][i]=dp[j][i-1]
            
print(dp[-1][-1])

Fixed submission:
N,W=map(int,input().split())
w=[0]*(N+1)
v=[0]*(N+1)
for i in range(N):
    w[i],v[i] = map(int,input().split())
maxi=sum(v)
    
dp=[[float("inf") for _ in range(N+1)] for _ in range(maxi+1)]
for _ in range(N+1):
    dp[0][_]=0
    
last=0
for i in range(1,N+1):
    for j in range(1,maxi+1):
        if j<v[i-1]:
            dp[j][i]=min(w[i-1], dp[j][i-1])
        else:
            tmp=w[i-1]+dp[j-v[i-1]][i-1]
            if tmp<=W:
                dp[j][i]=min(tmp, dp[j][i-1])
            else:
                dp[j][i]=dp[j][i-1]

#print(dp)
for j in range(maxi,-1,-1):
    if dp[j][-1]!=float("inf"):
        k=j
        break

ans=0
for i in range(N,0,-1):
    if dp[k][i]==dp[k-v[i-1]][i-1]+w[i-1]:
        k = k-v[i-1]
        ans += v[i-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()

a=len(s)
b=len(t)

dp=[ [0 for _ in range(a+1)] for _ in range(b+1)]

for j in range(1,b+1):
    for i in range(1,a+1):
        if s[i-1]==t[j-1]:
            dp[j][i]= dp[j-1][i-1]+1
        else:
            dp[j][i]= max(dp[j-1][i],dp[j][i-1])

#print(dp)

ans=""
x=a
y=b
while dp[y][x]!=0:
    if dp[y][x]==dp[y-1][x]:
        y -=1
    elif dp[y][x]==dp[y][x-1]:
        x -=1
    else:
        ans += s[x-1]
        y -=1
        x -=1
print(ans[::-1])

Fixed submission:
s=input()
t=input()

a=len(s)
b=len(t)

dp=[ [0 for _ in range(a+1)] for _ in range(b+1)]

for j in range(1,b+1):
    for i in range(1,a+1):
        if s[i-1]==t[j-1]:
            dp[j][i]= dp[j-1][i-1]+1
        else:
            dp[j][i]= max(dp[j-1][i],dp[j][i-1])

#print(dp)

ans=""
x=a
y=b
while dp[y][x]!=0:
    if dp[y][x]==dp[y-1][x]:
        y -=1
    elif dp[y][x]==dp[y][x-1]:
        x -=1
    else:
        ans += s[x-1]
        y -=1
        x -=1
print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
cnt=0
flag=True
N=len(S)

while flag:
  for i in range(0,N-1):
    if S[i]=="B" and S[i+1]=="W":
      S[i],S[i+1]="W","B"
      cnt += 1
      break
  else:
    flag=False
    
print(cnt)

Fixed submission:
S=list(input())
N=len(S)
sumB=0
ans=0

for i in range(N):
  if S[i]=="B":
    sumB +=1
  else:
    ans +=sumB
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
cnt=0
flag=True
N=len(S)

while flag:
  for i in range(0,N-1):
    if S[i]=="B" and S[i+1]=="W":
      S[i],S[i+1]="W","B"
      cnt += 1
      break
  else:
    flag=False
    
print(cnt)

Fixed submission:
S=list(input())
N=len(S)
sumB=0
ans=0

for i in range(N):
  if S[i]=="B":
    sumB +=1
  else:
    ans +=sumB
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_d
# D - Crossing

N=int(input())
a=set()
b={}

for i in range(1000):
    if i*(i+1)%2==0:
        s= i*(i+1)//2
        if s<=10**5:
            a.add(s)
            b[s]=i
        else:
            break
            
if N not in a:
    print("No")
else:
    print("Yes")
    print(b[N]+1)
    r=[0 for _ in range(N)] #kaisuu
    t=[ [] for _ in range(b[N]+1)]
    for i in range(b[N]):
        r[i] +=1
    t[0]= [i+1 for i in range(b[N])]
    print(b[N],*t[0])

    for i in range(1,b[N]+1):
        for j in range(i):
            for k,num in enumerate(t[j]):
                if r[num-1]==1:
                    t[i].append(num)
                    r[num-1]+=1
                    break
        for k in range(N):
            if r[k]==0:
                r[k] +=1
                t[i].append(k+1)
                if len(t[i])>=b[N]:
                    break
        print(b[N],*t[i])

        
        
        
        
        #print("i=",i)
        #print(r)
#        for j,num in enumerate(r):
#            if num==1:
#                t[i].append(j+1)
#                r[j]+=1
#                break
        #print("t",t)
        #print(r)
#        for k,num in enumerate(r):
#            if num==0:
#                t[i].append(k+1)
#                r[k]+=1
#            if len(t[i])==b[N]:   
#                break
#        else:
#            pass
#        print(b[N],*t[i])

Fixed submission:
# https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_d
# D - Crossing

N=int(input())
a=set()
b={}

for i in range(1000):
    if i*(i+1)%2==0:
        s= i*(i+1)//2
        if s<=10**5:
            a.add(s)
            b[s]=i
        else:
            break
            
if N not in a:
    print("No")
else:
    print("Yes")
    print(b[N]+1)
    r=[0 for _ in range(N)] #kaisuu
    t=[ [] for _ in range(b[N]+1)]
    for i in range(b[N]):
        r[i] +=1
    t[0]= [i+1 for i in range(b[N])]
    print(b[N],*t[0])

    for i in range(1,b[N]+1):
        for j in range(i):
            for k,num in enumerate(t[j]):
                if r[num-1]==1:
                    t[i].append(num)
                    r[num-1]+=1
                    break
        for k in range(N):
            if r[k]==0:
                r[k] +=1
                t[i].append(k+1)
                if len(t[i])>=b[N]:
                    break
        print(b[N],*t[i])

        
        
        
        
        #print("i=",i)
        #print(r)
#        for j,num in enumerate(r):
#            if num==1:
#                t[i].append(j+1)
#                r[j]+=1
#                break
        #print("t",t)
        #print(r)
#        for k,num in enumerate(r):
#            if num==0:
#                t[i].append(k+1)
#                r[k]+=1
#            if len(t[i])==b[N]:   
#                break
#        else:
#            pass
#        print(b[N],*t[i])
Buggy python submission (verdict: Runtime Error):
def main():
    N= int(input())
    A= int(input())
    B= int(input())

    if N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()

Fixed submission:
def main():
    N= int(input())
    if N==1:
        print("Hello World") 
    else:
        A= int(input())
        B= int(input())
        print(A+B)

        
main()

Buggy python submission (verdict: Runtime Error):
def main():
    N= input()
    A= int(input())
    B= int(input())

    if N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()

Fixed submission:
def main():
    N= int(input())
    if N==1:
        print("Hello World") 
    else:
        A= int(input())
        B= int(input())
        print(A+B)

        
main()

Buggy python submission (verdict: Runtime Error):
def main()
    N= input()
    A= input()
    B= input()

    If N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()

Fixed submission:
def main():
    N= int(input())
    if N==1:
        print("Hello World") 
    else:
        A= int(input())
        B= int(input())
        print(A+B)

        
main()
Buggy python submission (verdict: Runtime Error):
def main():
    N,T= (int(i) for i in input().split())
    A=[]
    B=[]
    
    for i in range(N):
        ai,bi= (int(j) for j in input().split())  
        A.append(ai)
        B.append(bi)

    if (min(A)) <= T:
        print(min((A))
    else:
        print("TLE")
    
          
main()

Fixed submission:
def main():
    N,T= (int(i) for i in input().split())
    a_min=1001

    for i in range(N):
        ai,bi= (int(j) for j in input().split())  
        if bi<= T:
            if ai <= a_min:
                a_min = ai

    if a_min==1001:
        print("TLE")
    else:
        print(a_min)
          
     
main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
v=list(map(int,input().split()))

A=v[0::2]
B=v[1::2]
a=len(A)
b=len(B)

#print(Counter(A).most_common()[0][0])
#print(Counter(B).most_common()[0][0])

if Counter(A).most_common()[0][0] !=Counter(B).most_common()[0][0]:
    s=Counter(A).most_common()[0][1]
    t=Counter(B).most_common()[0][1]
    print( (a-s)+(b-t))
else:
    o=Counter(A).most_common()[1][1]
    p=Counter(B).most_common()[0][1]
    r= (a-o)+(b-p)
    w=Counter(A).most_common()[0][1]
    x=Counter(B).most_common()[1][1]
    s= (a-w)+(b-x)
    print(min( r, s))


Fixed submission:
from collections import Counter
n=int(input())
v=list(map(int,input().split()))

A=v[0::2]
B=v[1::2]
a=len(A)
b=len(B)

#print(Counter(A).most_common()[0][0])
#print(Counter(B).most_common()[0][0])

if Counter(A).most_common()[0][0] !=Counter(B).most_common()[0][0]:
    s=Counter(A).most_common()[0][1]
    t=Counter(B).most_common()[0][1]
    print( (a-s)+(b-t))
else:
  r=a
  s=b
  if Counter(A).most_common()[0][1]<a:
    o=Counter(A).most_common()[1][1]
    p=Counter(B).most_common()[0][1]
    r= (a-o)+(b-p)
  if Counter(B).most_common()[0][1]<b:
    w=Counter(A).most_common()[0][1]
    x=Counter(B).most_common()[1][1]
    s= (a-w)+(b-x)
  print(min( r, s))
Buggy python submission (verdict: Runtime Error):
def main():
	l = map(int, input().split())
	A=l[0]
	B=l[1]
	C=l[2]

	l_max=max(A,B,C)
	l_min=min(A,B,C)
	l_mid=(A+B+C)-(l_max+l_min)

	ans=10*l_max+l_mid+l_min
	print(ans)
    
main()

Fixed submission:
def main():
	A, B, C = [int(_) for _ in input().split()]

	l_max=max(A,B,C)
	l_min=min(A,B,C)
	l_mid=(A+B+C)-(l_max+l_min)

	ans=10*l_max+l_mid+l_min
	print(ans)
    
main()