Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=input()
f=0
for i in range(len(n)):
    f += n[i]
if int(n) % f == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n=input()
f=0
for i in range(len(n)):
    f += int(n[i])
if int(n) % f == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=len(n)
N=''
for i in range(s[:s+1:-1]):
    a = n % (10**i)
    N.append(a)
al = sum(N)
if n%al == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n=input()
f=0
for i in range(len(n)):
    f += int(n[i])
if int(n) % f == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=len(n)
N=''
for i in range(s[:s+1:-1]):
    a = n % (10**i)
    N.append(a)
al = sum(N)
if al%n == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n=input()
f=0
for i in range(len(n)):
    f += int(n[i])
if int(n) % f == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=len(n)
N=''
for i in range(s[:s+1:-1]):
    a = n % (10**i)
    N.append(a)
al = sum(N)
if al%n == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n=input()
f=0
for i in range(len(n)):
    f += int(n[i])
if int(n) % f == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[]
s.append(2)
s.append(1)
if n==0:
    print('2')
    exit()
elif n==1:
    print('1')
    exit()
else:
    for i in range(2,86):
        k = s[i-2]+s[i-1]
        s.apend(k)
        if i==n-1:
            print(s[i])
            exit()


Fixed submission:
n=int(input())
s=[]
s.append(2)
s.append(1)
if n==1:
    print('1')
    exit()
else:
    for i in range(2,87):
        k = s[i-2]+s[i-1]
        s.append(k)
        if i==n:
            print(s[i])
            exit()

Buggy python submission (verdict: Runtime Error):
 n=input()
s=[]
s.append(2)
s.append(1)
if n==0:
    print('2')
    exit()
elif n==1:
    print('1')
    exit()
else:
    for i in range(2,86):
        k = s[i-2]+s[i-1]
        s.apend(k)
        if i==n-1:
            print(s[i])
            exit()


Fixed submission:
n=int(input())
s=[]
s.append(2)
s.append(1)
if n==1:
    print('1')
    exit()
else:
    for i in range(2,87):
        k = s[i-2]+s[i-1]
        s.append(k)
        if i==n:
            print(s[i])
            exit()

Buggy python submission (verdict: Runtime Error):
n=input()
s=[]
s[0]=2
s[1]=1
for i in range(2,86):
    s[i] = s[i-2]+s[i-1]
    if i==n-1:
        print(s[i])
        exit()


Fixed submission:
n=int(input())
s=[]
s.append(2)
s.append(1)
if n==1:
    print('1')
    exit()
else:
    for i in range(2,87):
        k = s[i-2]+s[i-1]
        s.append(k)
        if i==n:
            print(s[i])
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
for i in range(int(math.sqrt(n))):
    while (i+1)**2 < n:
        pass
print((i+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
k=0
for i in range(int(math.sqrt(n))):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)


Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=0
for i in range((n+1)//2):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Runtime Error):
n=int(input())
k=0
for i in range((n+1)/2):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=0
for i in range(n):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=0
for i in range(10**5):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)


Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
k=0
for i in range(10**9):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)

Buggy python submission (verdict: Runtime Error):
import math
 
n=int(input())
k=0
for i in range(math.sqrt(n)):
    while (i+1)**2 < n:
        k+=1
print((k+1)**2)

Fixed submission:
n=int(input())
print((int(n**0.5))**2)
Buggy python submission (verdict: Runtime Error):

n,k=map(int,input().split())
dis = 1
for i in range(n):
    if dis*2 <= dis+k:
        dis *= 2
    else:
        dis += k
print(dis)

Fixed submission:
n=int(input())
k=int(input())
dis = 1
for i in range(n):
    if dis*2 <= dis+k:
        dis *= 2
    else:
        dis += k
print(dis)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*a-b)

Fixed submission:
a=int(input())
b=int(input())
print(a*a-b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
kei=0
for i in range(n):
    l,r=map(int,input().split())
kei += sum(r)-sum(l)
kei += n
print(kei)

Fixed submission:
N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
kei=0
for i in range(n):
    l,r=map(int,input().split())
    kei += sum(r)-sum(l)
kei += n
print(kei)

Fixed submission:
N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l,r=list(map(int,input().split()))
kei=0
for i in range(n):
    kei += (r[i]-l[i]) + 1
print(kei)

Fixed submission:
N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=0
for i in range(N):
l,r=map(int,input().split())
ans+=r-l+1
print(ans)

Fixed submission:
N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)
Buggy python submission (verdict: Runtime Error):
t=input()
a,*b,c=t
print(a+int(len(b))+c)


Fixed submission:
t=input()
a,*b,c=t
print(a+str(len(b))+c)

Buggy python submission (verdict: Runtime Error):
t=input()
a,*b,c=t
print(a+len(b)+c)

Fixed submission:
t=input()
a,*b,c=t
print(a+str(len(b))+c)

Buggy python submission (verdict: Runtime Error):
t=input()
a,*b,c=t
print(a+len(*b)+c)

Fixed submission:
t=input()
a,*b,c=t
print(a+str(len(b))+c)

Buggy python submission (verdict: Runtime Error):
t=input()
a,*b,c=t
print("a",len(*b),"c")


Fixed submission:
t=input()
a,*b,c=t
print(a+str(len(b))+c)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
for i in range(n-k):
    al = sum(l)-l[i]
print(al)

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al=sum(l)
for i in range(n-k):
    al -= l[i]
print(al)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al = sum(l)-l[:n-k]
print(al)

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al=sum(l)
for i in range(n-k):
    al -= l[i]
print(al)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
for i in range(n):
    l = [input()]
l.sort()
al = sum(l)-l[:n-k]
print(al)

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
al=sum(l)
for i in range(n-k):
    al -= l[i]
print(al)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
    a=list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])
Buggy python submission (verdict: Runtime Error):
print('#'*(w+2))
for i in range(h):    
    print('#'+input()+'#')
print('#'*(w+2))

Fixed submission:
h,w=map(int,input().split())
print('#'*(w+2))
for i in range(h):    
    print('#'+input()+'#')
print('#'*(w+2))

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
for i in range(h):
    for j in range(w):
        a=list(input())

print('#'*(w+2))
for i in range(h):
    for j in range(w):      
        print('#'+a[i][j]+'#')
print('#'*(w+2))

Fixed submission:
h,w=map(int,input().split())
print('#'*(w+2))
for i in range(h):    
    print('#'+input()+'#')
print('#'*(w+2))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
    a.append(input())
    b.append(input())
for j in range(n):
    print(a.count(j+1)+b.count(j+1))
    

Fixed submission:
n,m=map(int,input().split())
A=[]
B=[]
for i in range(m):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
for j in range(n):
    print(A.count(j+1)+B.count(j+1))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
    a.append(input())
    b.append(input())
for j in range(n):
    print(a.count(j)+b.count(j))
    

Fixed submission:
n,m=map(int,input().split())
A=[]
B=[]
for i in range(m):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
for j in range(n):
    print(A.count(j+1)+B.count(j+1))
Buggy python submission (verdict: Runtime Error):
o=input()
e=input()
a=[]
for i in range(max(len(o),len(e))):
    a.append(o[i]+e[i])
b=''.join(a)
print(b)

Fixed submission:
o=input()
e=input()
O=len(o)
E=len(e)
a=[]
if O==E:
    for i in range(O):
        a.append(o[i]+e[i])
    b=''.join(a)
    print(b)
else:
    for i in range(E):
        a.append(o[i]+e[i])
    a.append(o[O-1])
    b=''.join(a)
    print(b)
Buggy python submission (verdict: Runtime Error):
a,b=map(input().split())
if(a =='H' and b=='H') or (a =='D' and b=='D'):
    print('H')
else:
    print('D')

Fixed submission:
a,b=input().split()
print("H"if(a==b) else"D")

Buggy python submission (verdict: Runtime Error):
a,b=input()
print("H"if(a==b) else"D")

Fixed submission:
a,b=input().split()
print("H"if(a==b) else"D")
Buggy python submission (verdict: Runtime Error):
n = int,input()
k = int(n/15)
x = 800*n - 200*k
print(x)

Fixed submission:
n = int(input())
k = int(n/15)
x = 800*n
y = 200*k
print(x-y)

Buggy python submission (verdict: Runtime Error):
n = int,input()
k = n/15
x = 800*n - 200*k
print(x)

Fixed submission:
n = int(input())
k = int(n/15)
x = 800*n
y = 200*k
print(x-y)
Buggy python submission (verdict: Runtime Error):
x = int,input()
if x < 1200:
    print('ABC')
else:
    print("ARC")

Fixed submission:
x = input()
x = int(x)
if x < 1200:
    print('ABC')
else:
    print("ARC")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    t=int(input())
    a.append(t)
m=int(input())
for j in range(m):
    p,x=map(int,input().split())
    for k in range(n):
        if t==k+1:
            a[k]=x
for j in range(m):
    print(sum(a))

    

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for j in range(m):
    ans=0
    p,x=map(int,input().split())
    for k in range(n):
        if p==k+1:
            ans += x
        else:
            ans += t[k]
    print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(input.split())
print('A' + b.head+ 'C',sep="")

Fixed submission:
print("A%sC"%input()[8])
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
for i in range(n):
     list[i] = str(input())
newlist=list.sorted()
print(newlist,sep='')

Fixed submission:
n,l=map(int,input().split())
a=[]
for i in range(n):
    s=input()
    a.append(s)
a.sort()
print(''.join(a))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print("Even" if a*b % == 0 else "Odd")

Fixed submission:
a,b = map(int,input().split())
ans = a*b
if ans%2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
input()
a = list(map(int,input().split()))
while all(i % 2 == 0 for i in a)
    a = [i/2 for i in a]
    count += 1
print(count)

Fixed submission:
input()
a = list(map(int,input().split()))
count = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
def make_divisors(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors+=1
            if i != n // i:
                divisors+=1
    return divisors
a=0
if N<=400000:
    for i in range(1,N):
        a+=make_divisors(i)
elif N<=600000:
    a=5221424
    for i in range(400000,N):
        a+=make_divisors(i)
elif N<=800000:
    a=8075420
    for i in range(600000,N):
        a+=make_divisors(i)
elif N<=900000:
    a=10997400
    for i in range(800000,N):
        a+=make_divisors(i)
else:
    a=12478098
    for i in range(900000,N):
        a+=make_divisors(i)
    
    
print(a)

Fixed submission:
N=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(N-1)))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
def make_divisors(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors+=1
            if i != n // i:
                divisors+=1
    return divisors
a=0
for i in range(1,N):
    a+=make_divisors(i)
print(a)

Fixed submission:
N=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(N-1)))

Buggy python submission (verdict: Runtime Error):
N=int(input())
import sympy
a=0
for i in range(1,N):
    a+=len(sympy.divisors(i))
print(a)

Fixed submission:
N=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(N-1)))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split(" "))
P=list(map(int,input().split(" ")))
C=list(map(int,input().split(" ")))
count=[]
def f (i):
    q=deepcopy(i)
    count1=[]
    count2=0
    for j in range(k):
        count2+=C[i]
        count1.append(count2)
        if i==q and count1<0:
            break
        i=P[i]-1
    return max(count1)
for i in range(n):
    count.append(f(i))
print(max(count))

Fixed submission:
S=input()
if S=="RSR":
    print(1)
else:
    
    print(len(S.replace("S","")))
Buggy python submission (verdict: Runtime Error):
n,m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m

for i in range(m):
    l[i],r[i] = (int(x) for x in input().split())
j = 0
hoge = [0]*(r[0]-l[0]+1)

for i in range(l[0],r[0]+1):
    hoge[j] = i
    j += 1

for i in range(1,m):
    tmp = []
    k = 0
    for j in range(max(hoge[0],l[i]),min(hoge[-1],r[i])+1):
        tmp.append(j)
        k += 1
    hoge = tmp
print(len(hoge))

Fixed submission:
n, m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i], r[i] = [int(x) for x in input().split()]
lmax = max(l)
rmin = min(r)
if rmin >= lmax:
    print(rmin-lmax+1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
hoge = [m]*n
for i in range(m):
    l[i],r[i] = (int(x) for x in input().split())
    
for i in range(m):
    for f in range(l[i]-1,r[i]):
        hoge[f] -= 1
count = 0
for j in hoge:
    if j == 0:
        count+= 1

print(count)


Fixed submission:
n, m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i], r[i] = [int(x) for x in input().split()]
lmax = max(l)
rmin = min(r)
if rmin >= lmax:
    print(rmin-lmax+1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
s = list(input())

Nums = []
now = 1#今見てる数
cnt = 0#nowがいくつ並んでるか

for i in range(0,n):
    if s[i] == str(now):
        cnt += 1
    else:
        Nums.append(cnt)
        now = 1 - now#０と１の切り替え
        cnt = 1#新しいのをカウントし始める
if cnt != 0:Nums.append(cnt)

#長さが２の倍数であるならば任意の数を最後に加える．ながさを奇数倍にしたい
if len(Nums) % 2 == 0:Nums.append(0)

add = 2 * k + 1 #ひっくり返せる範囲を指定
ans = 0
for i in range(0,len(Nums),2):
    tmp = 0
    left = i#(左端)
    right = min(i + add,len(Nums))#みる長さの最大値を調節（右端）

    for j in range(left,right):
        tmp += Nums[j]

    ans = max(tmp,ans)

print(ans)

Fixed submission:
n, k = map(int,input().split())
s = list(input())

Nums = []
now = 1#今見てる数(１を見て判定していくために最初を１として判定を始める)
cnt = 0#nowがいくつ並んでるか

for i in range(0,n):
    if s[i] == str(now):
        cnt += 1
    else:
        Nums.append(cnt)
        now = 1 - now#０と１の切り替え
        cnt = 1#新しいのをカウントし始める
if cnt != 0:Nums.append(cnt)

#長さが２の倍数であるならば任意の数を最後に加える．ながさを奇数倍にしたい
if len(Nums) % 2 == 0:Nums.append(0)
sum = [0]*(len(Nums)+1)

for i in range(len(Nums)):
    sum[i+1] = sum[i] + Nums[i]

add = 2 * k + 1
ans = 0

for i in range(0,len(sum),2):
    tmp = 0
    left = i
    right = min(i+add,len(Nums))
    tmp = sum[right] - sum[left]
    ans = max(ans,tmp)

print(ans)
Buggy python submission (verdict: Runtime Error):
menu = [0]*5
md = 300
time = 0
for i in range(5):
    menu[i] = int(input())
for i in range(5):
    huga = menu[i]%10
    if((huga<md)and(huga!=0)):
        x = menu[i]
        md = menu[i]%10
        index = i
#        print(md,index)
menu.pop(index)
for i in range(4):
    hoge = menu[i] % 10
    if hoge != 0:
        time = time + menu[i] + (10 - hoge)
    else:
        time = time + menu[i]

time  = time + x
print(time)

Fixed submission:
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Buggy python submission (verdict: Runtime Error):
menu = [0]*5
md = 300
time = 0
for i in range(5):
    menu[i] = int(input())
for i in range(5):
    if(((menu[i]%10)<md)and(menu[i]%10)!=0):
        x = menu[i]
        md = menu[i]%10
        index = i
#        print(md,index)
menu.pop(index)
for i in range(4):
    hoge = menu[i] % 10
    if hoge != 0:
        time = time + menu[i] + (10 - hoge)
    else:
        time = time + menu[i]

time  = time + x
print(time)

Fixed submission:
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Buggy python submission (verdict: Runtime Error):
menu = [0]*5
md = 300
time = 0
for i in range(5):
    menu[i] = int(input())
for i in range(5):
    if(((menu[i]%10)<md)and(menu[i]%10)!=0):
        md = menu[i]
        index = i
#        print(md,index)
menu.pop(index)
for i in range(4):
    hoge = menu[i] % 10
    if hoge != 0:
        time = time + menu[i] + (10 - hoge)
    else:
        time = time + menu[i]

time  = time + md
print(time)

Fixed submission:
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
s = [0]+list(input())+[0]
t = [0]*(Q)
d = [0]*(Q)
counter = [0]*(N+2)
for i in range(Q):
    t[i],d[i] = input().split()
for i in range(1,N+1):
    counter[i] = 1

for i in range(Q):
    for j in range(1,N+1):
        if (s[j] == t[i]):
            if d[i] == "R":
                counter[j+1] = counter[j+1] + counter[j]
            else:
                counter[j-1] = counter[j-1] + counter[j]
            counter[j] = 0
print(N-counter[0]-counter[N+1])

Fixed submission:
N,Q = map(int,input().split())
s =input()
td = []
lend = 0
rend = N-1

for i in range(Q):
    t,d = map(str,input().split())
    td.append([t,d])
td = td[::-1]
for i,j in td:
    if j == "L" and i == s[lend]:#左端を1つずらす
        lend += 1
    if j == "R" and i == s[rend]:#右端を1つずらす
        rend -= 1  
    if rend < (N-1) and j == "L" and i == s[rend+1]:#1つ前の位置を参照して右に戻す
        rend += 1
    if lend > 0 and j == "R" and i == s[lend-1]:#1つ前の位置を参照して左に戻す
        lend -= 1
    if lend > rend:
        break

print(rend - lend + 1)
Buggy python submission (verdict: Time Limit Exceeded):
l = []
r = []
n,q = input().split()
N = int(n)
Q = int(q)
S = input()
for i in range(Q):
    L,R = input().split()
    l.append(int(L)-1)
    r.append(int(R)-1)
for j in range(Q):
    count = 0
    for i in range(l[j],r[j]):
        if((S[i] == "A")&(S[i+1] == "C")):
            count = count + 1
    print(count)

Fixed submission:
n,q = (int(x) for x in input().split())
s = input()
l = []
r = []
for i in range(q):
    temp1,temp2 = (int(x) for x in input().split())
    l.append(temp1-1)
    r.append(temp2-1)

bb = []
bb.append(0)
# print(l)
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        bb.append(bb[i-1] + 1)
    else:
        bb.append(bb[i-1])

for i in range(q):
    print(bb[r[i]] - bb[l[i]])

Buggy python submission (verdict: Time Limit Exceeded):
l = []
r = []
n,q = input().split()
N = int(n)
Q = int(q)
S = input()
for i in range(Q):
    L,R = input().split()
    l.append(int(L)-1)
    r.append(int(R)-1)
flag = [0 for i in S]
for i in range(len(S)-1):
    if((S[i] == "A")&(S[i+1] == "C")):
        flag[i] = 1
for j in range(Q):
    count = 0
    for i in range(l[j],r[j]):
        count = count + flag[i]
    print(count)

Fixed submission:
n,q = (int(x) for x in input().split())
s = input()
l = []
r = []
for i in range(q):
    temp1,temp2 = (int(x) for x in input().split())
    l.append(temp1-1)
    r.append(temp2-1)

bb = []
bb.append(0)
# print(l)
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        bb.append(bb[i-1] + 1)
    else:
        bb.append(bb[i-1])

for i in range(q):
    print(bb[r[i]] - bb[l[i]])

Buggy python submission (verdict: Time Limit Exceeded):
l = []
r = []
n,q = input().split()
N = int(n)
Q = int(q)
S = input()
for i in range(Q):
    L,R = input().split()
    l.append(int(L)-1)
    r.append(int(R)-1)
for j in range(Q):
    count = 0
    for i in range(l[j],r[j]):
        if(S[i]=="A")&(S[i+1]=="C"):
            count = count + 1
    print(count)

Fixed submission:
n,q = (int(x) for x in input().split())
s = input()
l = []
r = []
for i in range(q):
    temp1,temp2 = (int(x) for x in input().split())
    l.append(temp1-1)
    r.append(temp2-1)

bb = []
bb.append(0)
# print(l)
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        bb.append(bb[i-1] + 1)
    else:
        bb.append(bb[i-1])

for i in range(q):
    print(bb[r[i]] - bb[l[i]])
Buggy python submission (verdict: Runtime Error):
A, B ,K  = (int(x) for x in input().split())
i = 1
ans = []
while True:
    if min(A,B) < i:
        break
    if A % i == 0 & B % i == 0:
        ans.append(i)
    i = i + 1
print(ans[-K-1])

Fixed submission:
A, B ,K  = (int(x) for x in input().split())
i = 1
ans = []
while True:
    if min(A,B) < i:
        break
    if (A % i == 0) & (B % i == 0):
        ans.append(i)
    i = i + 1
print(ans[len(ans)-K])
Buggy python submission (verdict: Runtime Error):
num1 = input("input num1 :")

num2 = input("input num2 :")

ans = float(num1) / float(num2)

print(ans)

Fixed submission:
num1, num2 = (int(i) for i in input().split())

ans = float(num1) / float(num2)

print(ans)
Buggy python submission (verdict: Runtime Error):
N ,M = input().split()
X = list(map(int, input().split()))
X.sort()
#print(X)
ans = 0
div = []
sliceNo = []
for i in range(int(M)-1):
    #print(i)
    div.append(abs(X[i + 1] - X[i]))
div.sort()
#print(div)
for i in range(int(N)-1):
    div.pop()
#print(div)
for i in div:
    ans += i
print(ans)

Fixed submission:
N ,M = input().split()
X = list(map(int, input().split()))
ans = 0
if int(N) >= int(M):
    print(ans)
else:
    X.sort()
    #print(X)
    div = []
    for i in range(int(M)-1):
        #print(i)
        div.append(abs(X[i + 1] - X[i]))
    div.sort()
    #print(div)
    for i in range(int(N)-1):
        div.pop()
    #print(div)
    for i in div:
        ans += i
    print(ans)
Buggy python submission (verdict: Runtime Error):
ソースコード 

Copy
Copy
side = [int(x) for x in input().split()]
side.sort()
 
print(int(side[0]*side[1]/2))

Fixed submission:
side = [int(x) for x in input().split()]
side.sort()
 
print(int(side[0]*side[1]/2))