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

Fixed submission:
input()
a=[int(i) for i in input().split()]
b=0
for i in a:b^=i
print(*[i^b for i in a])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=(int(i) for i input().split())
b=0
for i in a:b^=i
print(*(i^b for i in a))
Problem p02708 (python)

Fixed submission:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True

ans=0

n,k=LI()

for i in range(k,n+1+1):
    #r=(n+n-k+1)*k//2-(k-1)*k//2+1
    r=(n+n-i+1)*i//2-(i-1)*i//2+1
    r%=mo
    ans+=r
    #show(i,r)


print(ans%mo)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
for i in rep(k,n+1+1):
    l=(i-1)*i//2
    r=(n-i+1+n)*i//2
    ans+=(r-l+1)
    ans%=10**9+7
print(ans)
Problem p02747 (python)

Fixed submission:
print('YNeos'[1-(input()in['hi'*i for i in range(11)])::2])

Buggy submission (verdict: Runtime Error):
K=4000
S=[input()for i in R(3)]
A,B,C=S
a,b,c=len(A),len(B),len(C)
def F(S,T):
 R=[1]*(K*2+1)
 for i in R(-len(T),len(S)):
  for j in range(max(i,0),min(len(S),len(T)+i)):
   if S[j]!=T[j-i]and S[j]!="?"and T[j-i]!="?":
    R[i]=0
    break
 return R
AB=F(A,B)
AC=F(A,C)
BC=F(B,C)
i=K*3
for i in range(-K,K+1):
 if A[i]!=0:
  for i in range(-K,K+1):
   if A[c]==0 or B[i-i]==0:
    m=min(m,max(b+b,c+c,a)-min(b,c,0))
print(m)

Buggy submission (verdict: Runtime Error):
K=4000
S=[input()for i in R(3)]
A,B,C=S
la,lb,lc=len(A),len(B),len(C)
def F(S,T):
 R=[1]*(K*2+1)
 for i in R(-len(T),len(S)):
  for j in range(max(i,0),min(len(S),len(T)+i)):
   if S[j]!=T[j-i]and S[j]!="?"and T[j-i]!="?":
    R[i]=0
    break
 return R
AB=F(A,B)
AC=F(A,C)
BC=F(B,C)
mi=K*3
for ib in range(-K,K+1):
 if AB[ib]!=0:
  for ic in range(-K, K+1):
   if AC[ic]==0 or BC[ic-ib]==0:
    mi=min(mi,max(ib+lb,ic+lc,la)-min(ib,ic,0))
print(mi)
Problem p02786 (python)

Fixed submission:
a=int(input())
k=2
while a>=k:k*=2
print(k-1)

Buggy submission (verdict: Runtime Error):
print 2**len(bin(input()))//4-1

Buggy submission (verdict: Runtime Error):
print 2**len(bin(input()))/4-1
Problem p02850 (python)

Fixed submission:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
g=[[] for i in range(n)]
c=[]
dc={}
for i in range(n-1):
    a,b=LI_()
    c.append((a,b))
    g[a].append(b)
    g[b].append(a)
    dc[(a,b)]=0

mxd=0
mxi=0
for i in range(n):
    m=len(g[i])
    if m==1:
        mxd=m
        mxi=i
        
#vには最短距離をセット & -1 で未訪問フラグ

v=[-1]*(n)

def bfs(x):
    p=deque()
    p.append(x)
    v[x]=0
    while p:
        c=p.popleft()
        col=0
        for i in g[c]:
            if v[i]==-1:
                if v[c]==col and c!=x:col+=1
                p.append(i)
                v[i]=col
                dc[(c,i)]=col
                dc[(i,c)]=col
#                show(i,c,col)
                col+=1
    return

bfs(mxi)
print(max(v)+1)
for i,j in c:
    print(dc[(i,j)]+1)
    
#show(v)

Buggy submission (verdict: Runtime Error):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
g=[[] for i in range(n)]
c=[]
dc={}
for i in range(n-1):
    a,b=LI_()
    c.append((a,b))
    g[a].append(b)
    g[b].append(a)
    dc[(a,b)]=0

mxd=0
mxi=0
for i in range(n):
    m=len(g[i])
    if m=1:
        mxd=m
        mxi=i
        
#vには最短距離をセット & -1 で未訪問フラグ

v=[-1]*(n)

def bfs(x):
    p=deque()
    p.append(x)
    v[x]=0
    while p:
        c=p.popleft()
        col=0
        for i in g[c]:
            if v[i]==-1:
                if v[c]==col:col+=1
                p.append(i)
                v[i]=col
                dc[(c,i)]=col
                col+=1
    return

bfs(mxi)
print(mxd)
for i,j in c:
    print(dc[(i,j)]+1)
    
#show(v)
Problem p02856 (python)

Fixed submission:
m=int(input())
s,k=0,0
for i in range(m):
  d,c=map(int,input().split())
  s+=d*c
  k+=c
print(k-1+(s-1)//9)

Buggy submission (verdict: Runtime Error):
m=int(input())
s,c=0,0
for i in range(m):
  d,c=map(int,input().split())
  s+=d*c
  k+=c
print(k-1+(s-1)//9)
Problem p02885 (python)

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

a,b=MI()
print(max(0,a-2*b))

Buggy submission (verdict: Runtime Error):
0from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

a,b=MI()
print(max(0,a-2*b))
Problem p02900 (python)

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
og=g
ans=set()
ans.add(1)



for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.add(i)
        while g%i==0:
            g//=i

x=len(ans)
if g>int(og**0.5) and og!=1:
    x+=1
    
print(x)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


a,b=MI()
g=math.gcd(a,b)
ans=[1]

for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.append(i)
        while g%i==0:
            g//=i
    
    
print(len(ans))

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


a,b=MI()
g=math.gcd(a,b)
ans=[1]

for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.append(i)
        while g%i==0:
            g//=i
    
    
print(len(ans))
Problem p02901 (python)

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
#show_flg=True

n,m=MI()
t=1<<n
key=[]
for i in range(m):
    a,b=MI()
    c=0
    for j in LI_():
        c+=1<<j
    key.append((a,c))
inf=float('inf')
dp=[[inf]*(m+1) for _ in range(t)]
#dp[stat][m] # min value using up to m and open stat
dp[0][0]=0

for j in range(1,m+1):
    for i in range(t):
        cost,ck=key[j-1]
        show(i,j,'|',dp[ck|i][j],min(dp[ck|i][j-1],dp[i][j-1]+cost))
        dp[ck|i][j]=min(dp[ck|i][j],dp[ck|i][j-1],dp[i][j-1]+cost)
        dp[i][j]=min(dp[i][j],dp[i][j-1])
        
for i in dp:
    show(*i)

ans=dp[t-1][m] if dp[t-1][m]!=inf else -1
print(ans)

Buggy submission (verdict: Runtime Error):
from subprocess import*
with open('e.cpp','w')as f:f.write(r"""
#include <bits/stdc++.h>
using namespace std;

constexpr const int maxs = 4096;
int dp[maxs];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	memset(dp, 0x3f, 16384);
	dp[0] = 0;
	int n, m;
	cin >> n >> m;
	while (m--) {
		int a, b, s = 0;
		cin >> a >> b;
		while (b--) {
			int c;
			cin >> c;
			s ^= 1 << c - 1;
		}
		dp[s] = min(dp[s], a);
	}
	for (int i = 0; i != n; ++i) for (int all = (1 << n) - 1 ^ 1 << i, sub = all; sub; sub = sub - 1 & all)
		dp[sub] = min(dp[sub], dp[sub ^ 1 << i]);
	for (int s = 0; s != (1 << n); ++s) if (s != (s & -s))
		for (int t = s - 1 & s; t != s; t = t - 1 & s)
			dp[s] = min(dp[s], dp[t] + dp[s ^ t]);
	int mask = (1 << n) - 1;
	if (dp[mask] == 0x3f3f3f3f) dp[mask] = -1;
	cout << dp[mask] << endl;
}""")
call(('g++','e.cpp'))
call('./a.out')
Problem p02909 (python)

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True

an=0
k=0
s=input()
d=dict()
d['Sunny']='Cloudy'
d['Cloudy']='Rainy'
d['Rainy']='Sunny'
print(d[s])

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
show_flg=True

an=0
k=0
s=input()
d=['Sunny','Cloudy','Rainy','Sunny']
print(d[d.index(s)+1])
Problem p02928 (python)

Fixed submission:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
from itertools import permutations,groupby
import sys
import bisect
import string
alp=string.ascii_lowercase
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7
#mo=998244353
#input=sys.stdin.readline

n,k=MI()
a=LI()
c=[0]*(2000+10)
t=[0]*(2000+10)
for i in range(n):
    c[a[i]]+=1
    tmp=0
    for j in range(i):
        tmp+=1 if a[j]>a[i] else 0
    t[i]=tmp

A=[0]
for i in c:
    A+=[i+A[-1]]
q=0
for i in range(n):
    q+=A[a[i]]
#q=sum(A[:-1])
q%=mo
q*=k*(k-1)//2
q%=mo

ans=k*sum(t)%mo
ans+=q
print(ans%mo)
#print(c,A,t,ans%mo)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
from itertools import permutations,groupby
import sys
import bisect
import string
alp=string.ascii_lowercase
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7
#mo=998244353
#input=sys.stdin.readline

n,k=MI()
a=LI()
c=[0]*(n+1)
t=[0]*(2000+10)
for i in range(n):
    c[a[i]]+=1
    tmp=0
    for j in range(i):
        tmp+=1 if a[j]>a[i] else 0
    t[i]=tmp

A=[0]
for i in c:
    A+=[i+A[-1]]
q=0
for i in range(n):
    q+=A[a[i]]
#q=sum(A[:-1])
q%=mo
q*=k*(k-1)//2
q%=mo

ans=k*sum(t)%mo
ans+=q
print(ans%mo)
#print(c,A,t,ans%mo)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
from itertools import permutations,groupby
import sys
import bisect
import string
alp=string.ascii_lowercase
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7
#mo=998244353
#input=sys.stdin.readline

n,k=MI()
a=LI()
c=[0]*(n+1)
t=[0]*(n+1)
for i in range(n):
    c[a[i]]+=1
    tmp=0
    for j in range(i):
        tmp+=1 if a[j]>a[i] else 0
    t[i]=tmp

A=[0]
for i in c:
    A+=[i+A[-1]]
q=0
for i in range(n):
    q+=A[a[i]]
#q=sum(A[:-1])
q%=mo
q*=k*(k-1)//2
q%=mo

ans=k*sum(t)%mo
ans+=q
print(ans%mo)
#print(c,A,t,ans%mo)
Problem p02939 (python)

Fixed submission:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=1

s=StoI()
n=len(s)
dp=[[0]*n for i in range(2)]

for i in range(n):
    if i==0:
        dp[0][i]=1
    elif i==1:
        if s[1]==s[0]:
            dp[0][i]=0
            dp[1][i]=1
        else:
            dp[0][i]=2
            dp[1][i]=1
    else:
        if s[i]==s[i-1]:
            dp[0][i]=dp[1][i-1]+1
            dp[1][i]=max(dp[0][i-2],dp[1][i-2])+1
        else:
            dp[0][i]=max(dp[0][i-1],dp[1][i-1])+1
            dp[1][i]=max(dp[0][i-2],dp[1][i-2])+1

ans=max(dp[0][n-1],dp[1][n-1])
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
a=0
i=0
p=s[0]
while i<n-1:
  if s[i+1]==p:
    i+=2
  else:
    if i==n-2:a+=1
    i+=1
  a+=1
  p=s[i]
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
a=0
p=''
while i<n:
  if s[i]==p:
    i+=2
  else:
    i+=1
  a+=1
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
a=0
p=''
while i<n:
  if s[i]==p:
    i+=2
  else:
    i+=1
  a+=1
print(a)
Problem p02972 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]

n=I()
a=[0]+LI()
b=[0]*(n+1)
c=[0]*(n+1)
for i in range(n,0,-1):
    if c[i]!=a[i]:
        b[i]=1 #-b[i]
        c[i]=1-c[i]
        for j in range(2,int(i**0.5+1)):
            if i%j==0:
                c[j]=1-c[j]
                if j!=i//j: c[i//j]=1-c[i//j]
                #print('i=',i,'change',j,i//j)

s=sum(b)
if s%2!=a[1]:
    b[1]=1-b[1]
s=sum(b)    
print(s)

ans=[]
for i in range(1,n+1):
    if b[i]==1:
        #print(i,end=' ')
        ans.append(i)
if s!=0:
    print(*ans)

Buggy submission (verdict: Runtime Error):
5
0 0 0 0 0
Problem p03006 (python)

Fixed submission:
from collections import defaultdict
n=int(input())
m=[[(0,0) for j in range(n)] for i in range(n)]
b=[]
if n==1:
    ans=1
else:
    for i in range(n):
        x,y=map(int,input().split())
        b.append((x,y))
    C=defaultdict(int)
    for i in range(n):
        for j in range(i+1,n):
            p,q=b[i][0]-b[j][0],b[i][1]-b[j][1]
            C[(p,q)]+=1
            C[(-p,-q)]+=1
                
    l=[]
    for i in C.items():
        l.append(i)
    l.sort(key=lambda x:x[1],reverse=True)

    ans=n-l[0][1]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n=int(input())
b=[]
for i in range(n):
    x,y=map(int,input().split())
    b.append((x,y))
C=defaultdict(int)
for i in range(n):
    for j in range(i+1,n):
        p,q=b[i][0]-b[j][0],b[i][1]-b[j][1]
        C[(p,q)]+=1
        C[(-p,-q)]+=1

l=[]
for i in C.items():
    l.append(i)
l.sort(key=lambda x:x[1],reverse=True)
print(n-l[0][1])