Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=[int(i) for i in input().split()]
a=[]
for i in range(n):
    if p[i]==i+1:
        a.append(i+1)
i=0
b=0
while(i<len(a)):
 if a[i]+2 in a:
   b+=2
   i=a.index(a[i]+2)+1
 else:
   b+=1
   if a[i]+1 in a:
     i+=2
   else:
     i+=1
print(b)


Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]

a=0
b=0
for i in range(n):
    if p[i]==i+1:
        if a==0 or t==i:
           a+=1
        else:
           b+=(a+1)//2
           a=1
        t=i+1
b+=(a+1)//2

print(b)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
sys.setrecursionlimit(10**6)
n=int(input())
p=[int(i) for i in input().split()]
a=[]
for i in range(n):
    if p[i]==i+1:
        a.append(i+1)
i=0
b=0
while(i<len(a)):
 if a[i]+2 in a:
   b+=2
   i=a.index(a[i]+2)+1
 else:
   b+=1
   if a[i]+1 in a:
     i+=2
   else:
     i+=1
print(b)

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]

a=0
b=0
for i in range(n):
    if p[i]==i+1:
        if a==0 or t==i:
           a+=1
        else:
           b+=(a+1)//2
           a=1
        t=i+1
b+=(a+1)//2

print(b)
Buggy python submission (verdict: Time Limit Exceeded):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i2()
import heapq
q=a[:n]
rq=[-a[i] for i in range(2*n,3*n)[::-1]]
d=[sum(q)]
rd=[sum(rq)]

heapq.heapify(q)
heapq.heapify(rq)

for i in range(n,2*n):
 heapq.heappush(q, a[i])
 heapq.heappop(q)
 d.append(sum(q))
for i in range(n,2*n)[::-1]:
 heapq.heappush(rq, -a[i])
 heapq.heappop(rq)
 rd.append(sum(rq))
c=-float("inf")
for i in range(len(d)):
  c=max(c,d[i]+rd[len(rd)-1-i])
print(c)

Fixed submission:
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i2()
import heapq
q=a[:n]
rq=[-a[i] for i in range(2*n,3*n)[::-1]]
dd=sum(q)
rdd=sum(rq)
d=[dd]
rd=[rdd]

heapq.heapify(q)
heapq.heapify(rq)

for i in range(n,2*n):
 heapq.heappush(q, a[i])
 x=heapq.heappop(q)
 dd=dd+a[i]-x
 d.append(dd)
for i in range(n,2*n)[::-1]:
 heapq.heappush(rq, -a[i])
 x=heapq.heappop(rq)
 rdd=rdd-a[i]-x
 rd.append(rdd)
c=-float("inf")
for i in range(len(d)):
  c=max(c,d[i]+rd[len(rd)-1-i])
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a=[int(i) for i in input().split()]
s=[]
sa=n*(n+1)/2

s.append(a)
for i in range(1,n):
  s.append([])
  for j in range(len(s[i-1])-1):
    if s[i-1][j]<s[i-1][j+1]:
        s[i].append(s[i-1][j])
        sa+=s[i-1][j]
    else:
        s[i].append(s[i-1][j+1])
        sa+=s[i-1][j+1]
print(int(sa))

Fixed submission:
s = input()

a=[]
for i in range(len(s)):
 if s[i]=="S":
     a.append("S")
 if s[i]=="T":
     if len(a)==0 or a[-1]=="T":
         a.append("T")
     if a[-1]=="S":
         a.pop()
print (len(a))
Buggy python submission (verdict: Time Limit Exceeded):
a=[int(i) for i in input().split()]
b=[]
for i in range(a[2]):
  b.append([int(j) for j in input().split()])
count=[0 for j in range(9)]
suma=[0 for j in range(10)]
han=0
for i in range(len(b)):
  for (j,jj) in enumerate([[-2,-1,0],[-1,0,1],[0,1,2]]):
    for (k,kk) in enumerate([[-2,-1,0],[-1,0,1],[0,1,2]]):
      count[j+3*k]=1
      for n in range(3):
        for m in range(3):
         if 0<b[i][0]+jj[n]<a[0]+1 and 0<b[i][1]+kk[m]<a[1]+1:
          if [b[i][0]+jj[n],b[i][1]+kk[m]] in b:
           if not (jj[n]==0 and kk[m]==0):
            count[j+3*k]+=1
         else:
           han=1
      if han==1:
        han=0
        count[j+3*k]=0
      suma[count[j+3*k]]+=1
      count[j+3*k]=0
su=0
for i in range(1,10):
    suma[i]=int(suma[i]/i)
    su+=suma[i]
suma[0]=(a[0]-2)*(a[1]-2)-su
for i in range(10):
 print(suma[i])

Fixed submission:
a=[int(i) for i in input().split()]
b=[]
for i in range(a[2]):
  b.append([int(j) for j in input().split()])
import collections
import time
c=[]
d=[0 for i in range(10)]
for i in range(len(b)):
  for jj in [-2,-1,0]:
    for kk in [-2,-1,0]:
      if 0<b[i][0]+jj<a[0]-1 and 0<b[i][1]+kk<a[1]-1:
       c.append((b[i][0]+jj,b[i][1]+kk))
count_dict = collections.Counter(c)
n=count_dict.values()
for i in n:
  d[i]+=1
d[0]=(a[0]-2)*(a[1]-2)-len(n)
for j in range(10):
 print(d[j])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import math

p = set([2])


def isPrime(x):
    if x < 2:
        return False
    elif x in p:
        return True
    elif x % 2 == 0:
        return False

    sqrt = math.sqrt(x)
    for i in range(3, int(sqrt)+1, 2):
        if x % i == 0:
            return False

    p.add(x)
    return True


q = int(input())
pairs = []
for i in range(q):
    s, e = map(int, input().split())
    pairs.append((s, e))

for i in range(q):
    s, e = pairs[i]
    r = 0
    for j in range(s, e+1):
        if isPrime(j) and isPrime((j + 1) / 2):
            r += 1
    print(str(r))

Fixed submission:
# -*- coding: utf-8 -*-
u = 100000

f = [False]*(u+1)
for i in range(2, u+1):
    if not f[i]:
        for j in range(i+i, u+1, i):
            f[j] = True

c = [0]*(u+2)
for i in range(3, u+1, 2):
    if not f[i] and not f[int((i+1)/2)]:
        c[i] += 1
for i in range(3, u+1):
    c[i] += c[i-1]

q = int(input())
for i in range(q):
    s, e = map(int, input().split())
    print(c[e] - c[s-1])
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
printf(a-min(a,k),b-min(b,a-min(a,k))

Fixed submission:
a,b,k=map(int,input().split())
print(a-min(a,k),b-min(b,k-min(a,k)))

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input.split())
printf(a-min(a,k),b-min(b,a-min(a,k)))

Fixed submission:
a,b,k=map(int,input().split())
print(a-min(a,k),b-min(b,k-min(a,k)))

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input.split())
printf(a-min(a,k),b-min(b,a-min(a,k))

Fixed submission:
a,b,k=map(int,input().split())
print(a-min(a,k),b-min(b,k-min(a,k)))
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(int(ceil((B-A) / (A-1))) if B > A else 1)


Fixed submission:
from math import ceil
A,B = map(int,input().split())
count = 0 
num = 1
while num < B:
    num -= 1
    num += A
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
#from functools import reduce

N = int(input())
As = map(int,input().split())

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))

Fixed submission:
from functools import reduce

N = int(input())
As = list(map(int,input().split()))

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))

Buggy python submission (verdict: Runtime Error):
from functools import reduce

N = int(input())
As = map(int,input().split())

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))

Fixed submission:
from functools import reduce

N = int(input())
As = list(map(int,input().split()))

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))

Buggy python submission (verdict: Runtime Error):
from functools import reduce

N = int(input())
As = map(int,input().split())

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))

Fixed submission:
from functools import reduce

N = int(input())
As = list(map(int,input().split()))

P = reduce(lambda a,b:a*b,As)

print(P/sum([P/a for a in As]))
Buggy python submission (verdict: Runtime Error):
#from functools import reduce
N = int(input())
Xs = list(map(int,input().split()))
Xs_ = sorted(Xs)
print(sum([Xs_[i]* (2**(-n+i-1)) if i != 0 else Xs_[i]*(2**(-n)) for i in range(N)]))

Fixed submission:
#from functools import reduce
N = int(input())
Xs_ = sorted(map(int,input().split()))
print(sum([Xs_[i]*(2**(-N+1)) if i == 0 else Xs_[i]* (2**(-N+i)) for i in range(N)]))
Buggy python submission (verdict: Runtime Error):
from collection import Counter
N = int(input())
c = Counter(''.join(sorted(input())) for _ in range(N))
sum_ = lambda n: int(n*(n-1)/2)
print(sum(map(sum_,c.values())))

Fixed submission:
from collections import Counter
N = int(input())
c = Counter(''.join(sorted(input())) for _ in range(N))
sum_ = lambda n: int(n*(n-1)/2)
print(sum(map(sum_,c.values())))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
anagram = [''.join(sorted(input())) for _ in range(N)]
anagram_set = set(anagram)
test = lambda a: lambda b: a==b
print(sum({i:sum(range(sum(map(test(i),anagram)))) for i in anagram_set}.values()))

Fixed submission:
from collections import Counter
N = int(input())
c = Counter(''.join(sorted(input())) for _ in range(N))
sum_ = lambda n: int(n*(n-1)/2)
print(sum(map(sum_,c.values())))
Buggy python submission (verdict: Runtime Error):
import heapq
N,M = map(int,input().split())
dic = {}
for i in range(N):
  A,B = map(int,input().split())
  if A <= M:
    if dic[A]:
      dic[A].append(B)
    else:
      dic[A] = [B]
      
ans = 0
plan = heapq()
for i in range(1,M+1):
  for w in dic[i]:
    heapq.heappush(plan,-w)
  if len(plan) != 0:
    ans += heappop(plan)

print(-ans)
	

Fixed submission:
import heapq
N,M = map(int,input().split())
dic = {}
for i in range(N):
  A,B = map(int,input().split())
  if A <= M:
    if A in dic.keys():
      dic[A].append(B)
    else:
      dic[A] = [B]
      
ans = 0
plan = []
for i in range(1,M+1):
  if i in dic.keys():
    for w in dic[i]:
        heapq.heappush(plan,-w)
  if len(plan) != 0:
    ans += heapq.heappop(plan)

print(-ans)
Buggy python submission (verdict: Runtime Error):
def main():
    W,H,N = map(int , raw_input().split())
    white = {"l_bottom":[0,0],"r_top":[W,H]}
    
    areaZero = False
    
    for i in xrange(N):
        x,y,a = map(int,raw_input().split())
        if a == 1:
            if x > white['r_top'][0]:
                areaZero = True 
                continue
            if x > white['l_bottom'][0]:
                white['l_bottom'][0] = x
                continue
        if a == 2:
            if x <  white['l_bottom'][0]:
                areaZero = True 
                continue
            if x < white['r_top'][0]:
                white['r_top'][0] = x
                continue
        if a ==3 :
            if y > white['r_top'][1]:
                areaZero = True 
                continue
            if y > white['l_bottom'][1]:
                white['l_bottom'][1] = y
                continue
        if a == 4 :
            if y < white['l_bottom'][1]:
                areaZero = True 
                continue
            if y < white['r_top'][1]:
                white['r_top'][1] = y
                continue
    if areaZero == True:
        print 0
    else:
        print (white['r_top'][0]  - white['l_bottom'][0]) * (white['r_top'][1]  - white['l_bottom'][1])

if __name__ == '__main__'
    main()

Fixed submission:
W,H,N = map(int , raw_input().split())
white = {"l_bottom":[0,0],"r_top":[W,H]}

areaZero = False

for i in xrange(N):
    x,y,a = map(int,raw_input().split())
    if a == 1:
        if x > white['r_top'][0]:
            areaZero = True 
            continue
        if x > white['l_bottom'][0]:
            white['l_bottom'][0] = x
            continue
    if a == 2:
        if x <  white['l_bottom'][0]:
            areaZero = True 
            continue
        if x < white['r_top'][0]:
            white['r_top'][0] = x
            continue
    if a ==3 :
        if y > white['r_top'][1]:
            areaZero = True 
            continue
        if y > white['l_bottom'][1]:
            white['l_bottom'][1] = y
            continue
    if a == 4 :
        if y < white['l_bottom'][1]:
            areaZero = True 
            continue
        if y < white['r_top'][1]:
            white['r_top'][1] = y
            continue
if areaZero == True:
    print 0
else:
    print (white['r_top'][0]  - white['l_bottom'][0]) * (white['r_top'][1]  - white['l_bottom'][1])
Buggy python submission (verdict: Runtime Error):
def decoder(str_int):
    s_=''
    for a in str_int:
        s_ = s_+(alpbet[a])
    return s_

def encoder(s):
    return [alpbet.index(a) for a in s]

s = raw_input()
K = input()

alpbet = 'abcdefghijklmnopqrstuvwxyz'
encoder = lambda s: [alpbet.index(a) for a in s]
inc_count = K
str_int = encoder(s)
for i in range(len(str_int)):
    if i != len(str_int)-1:
        if str_int[i] > 0:
            cost = 26 - str_int[i]
            if inc_count > cost:
                inc_count -= cost
                str_int[i] = 0
    else:
        str_int[i] = (str_int[i] + inc_count) % 26
        
print decoder(str_int)

Fixed submission:
s = raw_input()
s = s[:4]+" "+s[4:]
print s

Buggy python submission (verdict: Runtime Error):
def decoder(str_int):
    s_=''
    for a in str_int:
        s_ = s_+(alpbet[a])
    return s_

def encoder(s):
    return [alpbet.index(a) for a in s]

s = raw_input()
K = input()

alpbet = 'abcdefghijklmnopqrstuvwxyz'
encoder = lambda s: [alpbet.index(a) for a in s]
inc_count = K
str_int = encoder(s)
for i in range(len(str_int)):
    #末尾文字でない
    if i != len(str_int)-1:
        #b~zの間でかつデクリメントできる
        if str_int[i] > 0:
            #aになるまで必要なインクリメント回数
            cost = 26 - str_int[i]
            if inc_count > cost:
                inc_count -= cost
                str_int[i] = 0
    else:
        str_int[i] = (str_int[i] + inc_count) % 26
        
print decoder(str_int)

Fixed submission:
s = raw_input()
s = s[:4]+" "+s[4:]
print s
Buggy python submission (verdict: Runtime Error):
N=input()
lenN=len(N)
N=int(N)


if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
print(count)

Fixed submission:
N=input()
lenN=len(N)
N=int(N)




if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop):
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
    print(count)

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

else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
            print(count)

Fixed submission:
N=input()
lenN=len(N)
N=int(N)




if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop):
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
    print(count)
Buggy python submission (verdict: Runtime Error):
import heapq

N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[-int(n) for n in A]

heapq.heapify(A)

for i in range(M):
    a=((-1*heapq.heappop(A))//2)*(-1)
    print(A)
    heapq.heappush(A,a)
    print(A)
sum=0
for i in range(N):
    sum+=A[i]
print(-sum)


Fixed submission:
import heapq

N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[-int(n) for n in A]

heapq.heapify(A)

for i in range(M):
    a=((-1*heapq.heappop(A))//2)*(-1)
    heapq.heappush(A,a)
sum=0
for i in range(N):
    sum+=A[i]
print(-sum)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[int(n) for n in A]

A.sort(reverse=True)

for i in range(M):
    a=A[0]//2
    del A[0]
    flag=True
    for j in range(N-1):
        #print(A,a,A[j])
        if A[j]<a:
            A.insert(j,a)
            #print('inserted',A)
            flag=False
            break
    if flag:
        A.insert(N-1,a)
        #print('inserted',A)

sum=0
for i in range(N):
    sum+=A[i]
print(sum)


Fixed submission:
import heapq

N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[-int(n) for n in A]

heapq.heapify(A)

for i in range(M):
    a=((-1*heapq.heappop(A))//2)*(-1)
    heapq.heappush(A,a)
sum=0
for i in range(N):
    sum+=A[i]
print(-sum)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
L=len(S)
children={}

for i in range(L):
    children[i]=0

for i in range(L):
    count=0
    d=S[i]
    if d=='R':
        j=1
        while(1):
            if S[i+j]==d:
                count+=1
                j=j+1
                continue
            else:
                if j%2==0:
                    children[i+j]+=1
                else:
                    children[i+j-1]+=1
                break
    if d=='L':
        j=1
        while(1):
            if S[i-j]==d:
                count+=1
                j=j+1
                continue
            else:
                if j%2==0:
                    children[i-j]+=1
                else:
                    children[i-j+1]+=1
                break
    #print(children[i])

s=''
for i in range(L):
    s+=str(children[i])+' '
print(s.rstrip())

Fixed submission:
S=input()

num={}
for i in range(len(S)):
    num[i]=0

for i in range(1,len(S)):
    even=1
    odd=1
    if S[i]=='L' and S[i-1]=='R':

        j=1
        while(1):
            if i+j>(len(S)-1):
                break
            if S[i+j]=='L':
                if j%2==1:
                    odd+=1
                else:
                    even+=1
            else:
                break
            j+=1
        
        j=1
        while(1):
            if i-1-j<0:
                break
            if S[i-1-j]=='R':
                if j%2==1:
                    even+=1
                else:
                    odd+=1
            else:
                break
            j+=1

        num[i]=even
        num[i-1]=odd

for i in range(len(S)):
    print(num[i],end=' ')
print('')
Buggy python submission (verdict: Runtime Error):
n , k , q = map(int , input().split())
a = [0] * (n + 1)
b = list(map ( int , input().split()))
for i in range(1 , n + 1):
	a[i] = b[i - 1];
def check( l , r):
	cnt = 0;
	ln = 0;
	res = 0;
	for i in range(1 , n + 1):
		if a[i] < l:
			res += min(cnt , max(0 , ln - k + 1))
			ln = 0;
			cnt = 0;
		else :
			ln += 1;
			if a[i] <= r:
				cnt += 1;
	res += min(cnt , max(0 , ln - k + 1))
	if(res >= q):
		return True;
	return False;						

l = 0;
r = 1000000000;
res = 1000000000;
while(l <= r):
	m = (l + r) // 2;
	ok = 0;
	for i in range(1 , n + 1):
		ok |= check(a[i] - m , a[i]);
	if ok == 1:
		r = m - 1;
		res = m;
	else :
		l = m + 1;
print(res)

Fixed submission:
n , k , q = map(int , input().split())
a = [0] * (n + 1)
b = list(map ( int , input().split()))
for i in range(1 , n + 1):
	a[i] = b[i - 1];
def check( l , r):
	cnt = 0;
	ln = 0;
	res = 0;
	for i in range(1 , n + 1):
		if a[i] < l:
			res += min(cnt , max(0 , ln - k + 1))
			ln = 0;
			cnt = 0;
		else :
			ln += 1;
			if a[i] <= r:
				cnt += 1;
	res += min(cnt , max(0 , ln - k + 1))
	if(res >= q):
		return True;
	return False;						

l = 0;
r = 1000000000;
res = 1000000000;
while(l <= r):
	m = (l + r) // 2;
	ok = 0;
	for i in range(1 , n + 1):
		ok |= check(a[i] - m , a[i]);
	if ok == 1:
		r = m - 1;
		res = m;
	else :
		l = m + 1;
print(res)
Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
 
for i in range(A,A+K):
    if i <= B-K:
        print(i)
for i in range(B-K,B):
    print(i)

Fixed submission:
X=input()
A=X[0]
B=X[1]
C=X[2]
if A!=B and B!=C and C!=A:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())

for i in range(A,A+K):
    if i <= B-K:
        print(i)
for i in range(B-K,B):
    print(i)


Fixed submission:
X=input()
A=X[0]
B=X[1]
C=X[2]
if A!=B and B!=C and C!=A:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A==1 and B==1:
    print(1)
elif A==1:
    print(A-2)
elif B==1:
    print(A-2)
else:
    print((A-2)*(B-2))

Fixed submission:
A=input()
B=input()
C=input()
print(A[0]+B[1]+C[2])
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
cnt=0
for i in range(A,B+1):
    if  A/10000 == A%10 and  A/1000%10 == A/10%10:
        cnt+=1
print(cnt)

Fixed submission:
A,B=map(int, input().split())
cnt=0
for i in range(A,B+1):
    if  i//10000 == i%10 and  i//1000%10 == i//10%10:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
def f(a,b,c,d):
    if a<0 or b<0 or c<0 or d<0:
        return 0
    if d==0:
        return 1
    return f(a-1,b,c,d-10) + f(a,b-1,c,d-2)+f(a,b,c-1,d-1)
A=int(input())
B=int(input())
C=int(input())
D=int(input())
A//=50
B//=50
C//=50
D//=50
print(f(A,B,C,D))

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
print((A-B)%C)
Buggy python submission (verdict: Runtime Error):
s=intput()
s[3]='8'
print(s)

Fixed submission:
s=list(input())
s[3]='8'
print("".join(s))
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=input().split()
ans=111111111
for i in range(A):
    C=B[i]
    cnt=0
    while C%2==0:
        C//=2
        cnt+=1
    if ans>cnt:
        ans=cnt
print(ans)

Fixed submission:
A=input()
cnt=0
if A[0]=='1':
    cnt+=1
if A[1]=='1':
    cnt+=1
if A[2]=='1':
    cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
A=input()
cnt=0
if A[0]=='1':
    cnt++
if A[1]=='1':
    cnt++
if A[2]=='1':
    cnt++
print(cnt)

Fixed submission:
A=input()
cnt=0
if A[0]=='1':
    cnt+=1
if A[1]=='1':
    cnt+=1
if A[2]=='1':
    cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=input()
A=int(input())
B=0
for i in N:
    B+=int(i)
if A%B==0:
    print("Yes")
else:
    print("No")

Fixed submission:
N=input()
A=int(N)
B=0
for i in N:
	B+=int(i)
	
if A%B==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A=input()
if A[0]==A[1] and A[1]==A[2]:
    print("Yes")
elif if A[1]==A[2] and A[2]==A[3]:
    print("Yes")
else:
    print("No")

Fixed submission:
A=input()
if A[0]==A[1] and A[1]==A[2]:
    print("Yes")
elif A[1]==A[2] and A[2]==A[3]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,intpu().split())
if A==B:
    print(C)
if B==C:
    print(B)
if A==C:
    print(A)

Fixed submission:
A,B,C=map(int,input().split())
if A==B:
    print(C)
if B==C:
    print(A)
if A==C:
    print(B)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main(){
    char c;
    for(int i=1;cin>>c;i++){
        if(c=='A'&&!a)a=i;
        if(c=='Z')b=i;
    }
    cout<<b-a+1<<endl;
    return 0;
}


Fixed submission:
N=int(input())
if N<1200:
    print("ABC")
else:
    print("ARC")
Buggy python submission (verdict: Runtime Error):
import heapq
N,M=(int(i) for i in input().split())



tasks=[[] for i in range(10**5+1)]
for i in range(N):
    a,b=(int(i) for i in input().split())
    tasks[a-1].append(b)

pq=[]
ans=0
for i in range(M):
    for b in tasks[i]:
        heappush(pq,b)
    if len(pq)!=0:
        ans+=heappop(pq)

print(ans)



Fixed submission:
import heapq
N,M=(int(i) for i in input().split())



tasks=[[] for i in range(10**5+1)]
for i in range(N):
    a,b=(int(i) for i in input().split())
    tasks[a-1].append(b)

pq=[]
ans=0
for i in range(M):
    for b in tasks[i]:
        heapq.heappush(pq,-b)
    if len(pq)!=0:
        temp=heapq.heappop(pq)
        ans-=temp

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

MOD=10**9+7
s=input()
s.rstrip()
s=s[::-1]
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1

coef=1
for i in range(len(s)):
    if s[i]=='?':
        for j in range(13):
            for k in range(10):
                ind=(j+coef*k)%13
                temp=dp[i+1][ind]+dp[i][j]
                dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    else:
        si=int(s[i])
        for j in range(13):
            ind=(j+coef*si)%13
            temp=dp[i+1][ind]+dp[i][j]
            dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    coef=coef*10%13


print(dp[len(s)][5])

Fixed submission:

MOD=10**9+7
s=input()
s.rstrip()
s=s[::-1]
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1

coef=1
for i in range(len(s)):
    if s[i]=='?':
        for j in range(13):
            for k in range(10):
                ind=(j+coef*k)%13
                temp=dp[i+1][ind]+dp[i][j]
                dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    else:
        si=int(s[i])
        for j in range(13):
            ind=(j+coef*si)%13
            temp=dp[i+1][ind]+dp[i][j]
            dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    coef=coef*10%13


print(dp[len(s)][5])