Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if N >= 10:
    print(R)
elif N <= 10:
    print(100*(10-N) + R)

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)

Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)

Buggy python submission (verdict: Runtime Error):
if N >= 10:
    print(R)
else:
    print(100*(10-K))
    

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 2b:
  print("0")
else:
  print(a-2b)


Fixed submission:
a, b = map(int, input().split())
if a <= 2*b:
  print(0)
else:
  print(a-2*b)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 2b:
  print(0)
else:
  print(a-2b)

Fixed submission:
a, b = map(int, input().split())
if a <= 2*b:
  print(0)
else:
  print(a-2*b)
Buggy python submission (verdict: Runtime Error):
n = input()
if n = 1:
  print(1/1)
elif n%2 == 0:
  print(n/2/n):
elif n%2 != 0:
  print(((n-1)/2)/n)


Fixed submission:
n = int(input())
if n == 1:
  print(1/1)
elif n%2 == 0:
  print(n/2/n)
else:
  print((((n-1)/2)+1)/n)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if b + c > a:
  print(c-(a-b))
elif b + c =< a:
  print(0)

Fixed submission:
a, b, c = map(int, input().split())
if b + c > a:
  print(c-(a-b))
elif b + c <= a:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())
rc,bc,gc=[0]*N,[0]*N,[0]*N
if S[0]=="R":
  rc[0]+=1
elif S[0]=="B":
  bc[0]+=1
if S[0]=="G":
  gc[0]+=1
for i in range(1,N):
  if S[i]=="R":
    rc[i]=rc[i-1]+1
    bc[i]=bc[i-1]
    gc[i]=gc[i-1]
  elif S[i]=="B":
    bc[i]=bc[i-1]+1
    gc[i]=gc[i-1]
    rc[i]=rc[i-1]
  elif S[i]=="G":
    gc[i]=gc[i-1]+1    
    rc[i]=rc[i-1]
    bc[i]=bc[i-1]

ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    if S[i]==S[j]:
      pass
    else:
      if [S[i],S[j]]==["R","B"] or [S[i],S[j]]==["B","R"]:
        ans+=gc[-1]-gc[j]
        if 2*j-i<N:
          if S[2*j-i]=="G":
            ans-=1
      elif [S[i],S[j]]==["B","G"] or [S[i],S[j]]==["G","B"]:
        ans+=rc[-1]-rc[j]
        if 2*j-i<N:
          if S[2*j-i]=="R":
            ans-=1
      elif [S[i],S[j]]==["G","R"] or [S[i],S[j]]==["R","G"]:
        ans+=bc[-1]-bc[j]
        if 2*j-i<N:
          if S[2*j-i]=="B":
            ans-=1
            
print(ans)

Fixed submission:
N=int(input())
S=list(input())
rc,bc,gc=[0]*N,[0]*N,[0]*N
if S[0]=="R":
  rc[0]+=1
elif S[0]=="B":
  bc[0]+=1
if S[0]=="G":
  gc[0]+=1
for i in range(1,N):
  if S[i]=="R":
    rc[i]=rc[i-1]+1
    bc[i]=bc[i-1]
    gc[i]=gc[i-1]
  elif S[i]=="B":
    bc[i]=bc[i-1]+1
    gc[i]=gc[i-1]
    rc[i]=rc[i-1]
  elif S[i]=="G":
    gc[i]=gc[i-1]+1    
    rc[i]=rc[i-1]
    bc[i]=bc[i-1]

ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    if S[i]==S[j]:
      pass
    else:
      if [S[i],S[j]]==["R","B"] or [S[i],S[j]]==["B","R"]:
        ans+=gc[-1]-gc[j]
        if 2*j-i<N:
          if S[2*j-i]=="G":
            ans-=1
      elif [S[i],S[j]]==["B","G"] or [S[i],S[j]]==["G","B"]:
        ans+=rc[-1]-rc[j]
        if 2*j-i<N:
          if S[2*j-i]=="R":
            ans-=1
      elif [S[i],S[j]]==["G","R"] or [S[i],S[j]]==["R","G"]:
        ans+=bc[-1]-bc[j]
        if 2*j-i<N:
          if S[2*j-i]=="B":
            ans-=1
            
print(ans)
Buggy python submission (verdict: Runtime Error):
 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())-1])

Fixed submission:
print([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][int(input())-1])
Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

dp=[[0]*(H+1) for _ in range(N+1)]
dp[0]=[float("inf")]*(H+1)
dp[0][0]=0

for i in range(1,N+1):
  for j in range(1,H+1):
    if j-AB[i-1][0]>=0:
      dp[i][j]=min(dp[i][j-AB[i-1][0]]+AB[i-1][1],dp[i-1][j])
    else:
      dp[i][j]=min(AB[i-1][1],dp[i-1][j])
      
print(dp[N][H])

Fixed submission:
H,N=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

dp=[[0]*(H+1) for _ in range(N+1)]
dp[0]=[float("inf")]*(H+1)
dp[0][0]=0

for i in range(1,N+1):
  for j in range(1,H+1):
    if j-AB[i-1][0]>=0:
      dp[i][j]=min(dp[i][j-AB[i-1][0]]+AB[i-1][1],dp[i-1][j])
    else:
      dp[i][j]=min(AB[i-1][1],dp[i-1][j])
      
print(dp[N][H])
Buggy python submission (verdict: Time Limit Exceeded):
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())

if B1>A1:
  A1,A2,B1,B2=B1,B2,A1,A2
  
if A2>B2:
  print(0)
  exit()
if A1*T1+A2*T2==B1*T1+B2*T2:
  print("infinity")
  exit()

ans=1
a,b=A1*T1+A2*T2,B1*T1+B2*T2
while b-a<=T1*A1-T1*B1:
  if b-a<T1*A1-T1*B1:
    ans+=2
  else:
    ans+=1
  a+=A1*T1+A2*T2
  b+=B1*T1+B2*T2
  
print(ans)

Fixed submission:
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())

if B1>A1:
  A1,A2,B1,B2=B1,B2,A1,A2
  
if A1*T1+A2*T2>B1*T1+B2*T2:
  print(0)
  exit()
if A1*T1+A2*T2==B1*T1+B2*T2:
  print("infinity")
  exit()

x=(T1*A1-T1*B1)//((B1-A1)*T1+(B2-A2)*T2)+1
ans=2*x-1
if (T1*A1-T1*B1)%((B1-A1)*T1+(B2-A2)*T2)==0:
  ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
path=[[0 if i==j or i==max(j-1,0) else float("inf") for i in range(N)] for j in range(N)]
for _ in range(M):
  l,r,c=map(int,input().split())
  path[l-1][r-1]=c
print(path)
seen=[]
dist=[float("inf")]*N
dist[0]=0
v=-1
while v!=N-1:
  v=-1
  for i in range(N):
    if i not in seen and v==-1:
      v=i
    if i not in seen and dist[i]<dist[v]:
      v=i
  seen.append(v)
  for i in range(N):
    dist[i]=min(dist[v]+path[v][i],dist[i])
    
if dist[N-1]==float("inf"):
  print(-1)
else:
  print(dist[N-1])


Fixed submission:
print((int(input())-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=sorted(map(int,input().split()))
F=sorted(map(int,input().split()),reverse=True)

l=-1
r=A[-1]*F[0]
while l+1<r:
  x=(l+r)//2
  cnt=0
  for i in range(N):
    cnt+=max(A[i]-x//F[i],0)
  if cnt<=K:
    r=x
  else:
    l=x
    
print(r)

Fixed submission:
N,K=map(int,input().split())
A=sorted(map(int,input().split()))
F=sorted(map(int,input().split()),reverse=True)

l=-1
r=A[-1]*F[0]
while l+1<r:
  x=(l+r)//2
  cnt=0
  for i in range(N):
    cnt+=max(A[i]-x//F[i],0)
  if cnt<=K:
    r=x
  else:
    l=x
    
print(r)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))

ans=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1,N-1):
    b=L[j]
    for k in range(j+1,N):
      c=L[k]
      if a<b+c and b<c+a and c<a+b:
        ans+=1
      else:
        break
        
print(ans)

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

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

ans=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1,N-1):
    b=L[j]
    for k in range(j+1,N):
      c=L[k]
      if a<b+c and b<c+a and c<a+b:
        ans+=1
      else:
        break
        
print(ans)

Fixed submission:
A,B=map(int,input().split())
if A<=2*B:
  print(0)
else:
  print(A-2*B)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))

ans=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1,N-1):
    b=L[j]
    for k in range(j+1,N):
      c=L[k]
      if a<b+c and b<c+a and c<a+b:
        ans+=1
        
print(ans)

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

dp=[0]*(N+1)
ans=0
for i in range(3,N+1):
  r=i-2
  l=0
  c=0
  while r>l:
    if L[r]+L[l]>L[i-1]:
      c+=r-l
      r-=1
    else:
      l+=1
  dp[i]=dp[i-1]+c

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

ans=[]
for i in range(1,N+1):
  ans.append(A.index(i)+1)
  
print(" ".join(map(str,ans)))

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

ans=[0]*N
for i in range(1,N+1):
  ans[A[i-1]-1]=i
  
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(input())

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))


Fixed submission:
S=input()
if S=="Sunny":
  print("Cloudy")
elif S=="Cloudy":
  print("Rainy")
elif S=="Rainy":
  print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=list(map(int,input().split()))

for _ in range(M):
  ma=max(A)
  A[A.index(ma)]=ma//2

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
heapq.heapify(A)


for _ in range(M):
  ma=heapq.heappop(A)
  heapq.heappush(A,-((-ma)//2))
  
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=list(map(int,input().split()))

for _ in range(M):
  ma=max(A)
  A[A.index(ma)]//=2

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
heapq.heapify(A)


for _ in range(M):
  ma=heapq.heappop(A)
  heapq.heappush(A,-((-ma)//2))
  
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=list(map(int,input().split()))

for _ in range(M):
  A.sort()
  A[-1]//=2

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
heapq.heapify(A)


for _ in range(M):
  ma=heapq.heappop(A)
  heapq.heappush(A,-((-ma)//2))
  
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))


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

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

dp=[[0 for _ in range(N)] for _ in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N):
  if S[i]==S[N-1]:
    dp[i][N-1]=1
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))

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

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

dp=[[0 for _ in range(N)] for _ in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ

for i in range(N):
  if S[i]==S[N-1]:
    dp[i][N-1]=1
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in reversed(range(N-1)):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if min(i,j)+dp[i][j]-1>=max(i,j):
        dp[i][j]=max(i,j)-min(i,j)

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))

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

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

ans=0
for i in range(1,N):
  ans+=i

print(ans)

Fixed submission:
N=int(input())

print((N*(N-1))//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(input())
mod=10**9+7

rl=["L"]
for i in range(1,2*N):
  if S[i]==S[i-1]:
    if rl[i-1]=="R":
      rl.append("L")
    elif rl[i-1]=="L":
      rl.append("R")
  elif S[i]!=S[i-1]:
    if rl[i-1]=="R":
      rl.append("R")
    elif rl[i-1]=="L":
      rl.append("L")

if rl.count("L")!=N or S[0]=="W" or S[2*N-1]=="W":
  print(0)
  exit()

ans=1
for i in range(2*N):
  if rl[i]=="R":
    if rl[:i].count("L")-rl[:i].count("R")<0:
      print(0)
      exit()
    else:
      ans*=(rl[:i].count("L")-rl[:i].count("R"))%mod

for i in range(1,N+1):
  ans=ans%mod*i

print(ans%mod)

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

cal=[[m+1,d+1] for m in range(M) for d in range(D)]

ans=0
for i in cal:
  day=[(i[1]-i[1]%10)/10,i[1]%10]
  if day[0]>1 and day[1]>1:
    if day[0]*day[1]==i[0]:
      ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=input().split(" ")
A=[int(i) for i in A]
A.sort()

def act(A):
  if len(A)%2==0:
    A_=[]
    for i in range(int(len(A)/2)):
      A_.append((A[2*i]+A[2*i+1])/2)
    return A_
  
  elif len(A)%2==1:
    A_=[]
    for i in range(int((len(A)-1)/2)):
      A_.append((A[2*i]+A[2*i+1])/2)
    A_.append(A[len(A)-1])
    return A_
    
    
while len(A)>1:
  A=act(A)

print(A[0])

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

if a>=3200:
  print(s)
else:
  print("red")
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N,M=map(int,input().split())

ab=[]
for _ in range(N):
  ab.append(list(map(int,input().split())))

sal=0
poss=[]
for i in range(1,M+1):
  for j in range(N):
    if ab[j][0]==i:
      heapq.heappush(poss,-ab[j][1])
  if len(poss)>0:
    sal+=-heapq.heappop(poss)
    
print(sal)

Fixed submission:
import heapq
N,M=map(int,input().split())

ab=[[] for _ in range(M)]
for i in range(N):
  b,a=map(int,input().split())
  if b<=M:
    ab[b-1].append(a)

sal=0
poss=[]
for i in range(1,M+1):
  for j in ab[i-1]:
    heapq.heappush(poss,-j)
  if len(poss)>0:
    sal+=-heapq.heappop(poss)
    
print(sal)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
N=len(S)

pos=[1]*N

for i in range(10**100):
    for j in range(N):
        for k in range(pos[j]):
            if S[j]=="R":
                pos[j]-=1
                pos[j+1]+=1
            elif S[j]=="L":
                pos[j]-=1
                pos[j-1]+=1

print(" ".join(pos))

Fixed submission:
S=list(input())
N=len(S)

ans=[0]*N
r=0
for i in range(N):
  if S[i]=="R":
    r+=1
  else:
    if r%2==0:
      ans[i-1]+=r//2
      ans[i]+=r//2
    else:
      ans[i-1]+=r//2+1
      ans[i]+=r//2
    r=0

S.reverse()
ans.reverse()
l=0
for i in range(N):
  if S[i]=="L":
    l+=1
  else:
    if l%2==0:
      ans[i-1]+=l//2
      ans[i]+=l//2
    else:
      ans[i-1]+=l//2+1
      ans[i]+=l//2
    l=0

ans.reverse()
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
S=list(input())
mod=10**9+7

dp=[[0]*13 for _ in range(len(S)+1)]
#dp[i][j] :先頭 i 文字として考えられるもののうち、13 で割ったあまりが j であるものの数
dp[0][0]=1

for i in range(1,len(S)+1):
  if S[i-1]=="?":
    for k in range(10):
      for j in range(13):
        dp[i][(10*j+k)%13]+=dp[i-1][j]
    
    
  else:
    for j in range(13):
      dp[i][(10*j+int(S[i-1]))%13]+=dp[i-1][j]
      
print(dp[len(S)][5]%mod)

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

K=A+B
if K%2==0:
  print(int(K/2))
else:
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
A,B=input().sprit(" ")
A,B=int(A),int(B)

K=A+B
if K%2==0:
  print(K/2)
else:
  print("IMPOSSIBLE")

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

K=A+B
if K%2==0:
  print(int(K/2))
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

for i in range(N):
  print(max(A[:i]+A[i+1:]))

Fixed submission:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
  
A_=sorted(A,reverse=True)

for i in A:
  if i==A_[0]:
    print(A_[1])
  else:
    print(A_[0])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

d=0
ans=[0]*N
while len(A)>1:
  for i in reversed(range((len(A)+1)//2,len(A))):
    asum=A[i]
    for j in range(len(A)+1,N+1):
      if j%(i+1)==0:
        asum+=ans[j-1]
    if asum%2==1:
      ans[i]=1
    A.pop(i)

if A[0]+sum(ans)%2==1:
  ans[0]=1
  
print(sum(ans))
_ans=[]
for i,e in enumerate(ans):
  if e==1:
    _ans.append(str(i+1))
print(" ".join(_ans))


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

ans=[]
box=[0]*N

for i in reversed(range(1,N+1)):
  asum=sum(box[i-1::i])
  if asum%2+A[i-1]==1:
    box[i-1]=1
    ans.append(i)

print(len(ans))
print(*ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
A=Counter(map(int,input().split()))

if len(A)==1:
  if 0 in A:
    print("Yes")
  else:
    print("No")
elif len(A)==2:
  if A[0]==N/3:
    print("Yes")
  else:
    print("No")
elif len(A)==3:
  if list(A.values())==[N/3]*3 and A.keys()[0]^A.keys()[1]^A.keys()[2]==0:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
from collections import Counter
N=int(input())
A=Counter(map(int,input().split()))

if len(A)==1:
  if 0 in A:
    print("Yes")
  else:
    print("No")
elif len(A)==2:
  if A[0]==N/3:
    print("Yes")
  else:
    print("No")
elif len(A)==3:
  if list(A.values())==[N/3]*3 and list(A.keys())[0]^list(A.keys())[1]^list(A.keys())[2]==0:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))

D=np.array([[0]*N for i in range(N)])
for i in range(N):
  for j in range(N):
    if j==i or j==(i+1)%N:
      D[i][j]=1

X=2*np.dot(np.linalg.inv(D),A)
print(" ".join(map(lambda x:str(int(x)),X)))

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

X=[]
S=sum(A)
x1=S
for i in range(N//2):
  x1-=2*A[2*i+1]
  
X.append(x1)

for i in range(1,N):
  X.append(2*A[i-1]-X[i-1])
print(" ".join(map(str,X)))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N+1)]
for i in range(2,N+1):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  print((C[N-K+1][i]*C[K-1][i-1])%mod)

Fixed submission:
N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N+1)]
for i in range(2,N+1):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
    print((C[N-K+1][i]*C[K-1][i-1])%mod)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N)]
for i in range(2,N):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  print((C[N-K+1][i]*C[K-1][i-1])%mod)

Fixed submission:
N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N+1)]
for i in range(2,N+1):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
    print((C[N-K+1][i]*C[K-1][i-1])%mod)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
xy=[list(map(int,input().split())) for _ in range(N)]
xy.sort()

if N==1:
  print(1)
  exit()

pq=[]
for i in range(N):
  for j in range(i+1,N):
    pq.append([xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]])

print(Counter(map(lambda x:x[0]*10**10+x[1],pq)).most_common())
print(N-Counter(map(lambda x:x[0]*10**10+x[1],pq)).most_common()[0][1])

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

if K==1:
  print(0)
else:
  print(N-K)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
xy=[list(map(int,input().split())) for _ in range(N)]

pq=[]
for i in range(N):
  for j in range(i+1,N):
    pq.append([xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]])

print(N-Counter(map(lambda x:x[0]*10**10+x[1],pq)).most_common()[0][1])

Fixed submission:
from collections import Counter
N=int(input())
xy=[list(map(int,input().split())) for _ in range(N)]
xy.sort()

if N==1:
  print(1)
  exit()

pq=[]
for i in range(N):
  for j in range(i+1,N):
    pq.append([xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]])

print(N-Counter(map(lambda x:x[0]*10**10+x[1],pq)).most_common()[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())

i=0
while i<len(S)-1:
  if S[i]=="B" and S[i+1]=="C":
    S[i]="D"
    S.pop(i+1)
  i+=1
    
t=[]
nl=[]
for i in S:
  if i=="A" or i=="D":
    nl.append(i)
  else:
    t.append(nl)
    nl=[]
t.append(nl)

T=list(filter(lambda x:len(x)>0,t))

ans=0
for i in T:
  dn=0
  for j in range(len(i)):
    if i[j]=="D":
      ans+=j-dn
      dn+=1

print(ans)


Fixed submission:
S=list(input())

nS=[]
i=0
while i<len(S)-1:
  if S[i]=="B" and S[i+1]=="C":
    nS.append("D")
    i+=1
  else:
    nS.append(S[i])
  i+=1
    
t=[]
nl=[]
for i in nS:
  if i=="A" or i=="D":
    nl.append(i)
  else:
    if nl:
      t.append(nl)
      nl=[]
if nl:
  t.append(nl)


ans=0
for i in t:
  dn=0
  for j in range(len(i)):
    if i[j]=="D":
      ans+=j-dn
      dn+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())

i=0
while i<len(S)-1:
  if S[i]=="B" and S[i+1]=="C":
    S[i]="D"
    S.pop(i+1)
  i+=1
    
t=[]
nl=[]
for i in S:
  if i=="A" or i=="D":
    nl.append(i)
  else:
    t.append(nl)
    nl=[]
t.append(nl)

T=list(filter(lambda x:len(x)>0,t))

ans=0
for i in T:
  dn=0
  for j in range(len(i)):
    if i[j]=="D":
      ans+=j-dn
      dn+=1

print(ans)


Fixed submission:
S=list(input())

nS=[]
i=0
while i<len(S)-1:
  if S[i]=="B" and S[i+1]=="C":
    nS.append("D")
    i+=1
  else:
    nS.append(S[i])
  i+=1
    
t=[]
nl=[]
for i in nS:
  if i=="A" or i=="D":
    nl.append(i)
  else:
    if nl:
      t.append(nl)
      nl=[]
if nl:
  t.append(nl)


ans=0
for i in t:
  dn=0
  for j in range(len(i)):
    if i[j]=="D":
      ans+=j-dn
      dn+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()

ans=0
while "ABC" in S:
  ind=S.index("ABC")
  S=list(S)
  S[ind]="B"
  S[ind+1]="C"
  S[ind+2]="A"
  S="".join(S)
  ans+=1
print(ans)

Fixed submission:
S=list(input())

nS=[]
i=0
while i<len(S)-1:
  if S[i]=="B" and S[i+1]=="C":
    nS.append("D")
    i+=1
  else:
    nS.append(S[i])
  i+=1
    
t=[]
nl=[]
for i in nS:
  if i=="A" or i=="D":
    nl.append(i)
  else:
    if nl:
      t.append(nl)
      nl=[]
if nl:
  t.append(nl)


ans=0
for i in t:
  dn=0
  for j in range(len(i)):
    if i[j]=="D":
      ans+=j-dn
      dn+=1

print(ans)