Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

l = [0]*(10**9+10)
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

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

ans1 = len(set(a))
ans2 = len(a)
if ans1 == ans2:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

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

ans1 = len(set(a))
ans2 = len(a)
if ans1 == ans2:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
if bool:
    print('YES')
else:
    print('NO')

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

ans1 = len(set(a))
ans2 = len(a)
if ans1 == ans2:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
print('YES' if bool else 'NO')

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

ans1 = len(set(a))
ans2 = len(a)
if ans1 == ans2:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h_ = sorted(h)

for i in range(k):
    h_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
 
h_ = sorted(h)
 
for i in range(k):
    if len(h_) > 0:
        h_.pop()
    
s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h_ = sorted(h)

for i in range(k):
    h_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[i+1] = s[i] + h_[i]

print(s[-1])

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
 
h_ = sorted(h)
 
for i in range(k):
    if len(h_) > 0:
        h_.pop()
    
s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h_ = sorted(h)

for i in range(k):
  h_.pop()

print(sum(h_))


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
 
h_ = sorted(h)
 
for i in range(k):
    if len(h_) > 0:
        h_.pop()
    
s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

m = [10**6]
for j in range(1, n):
    m.append(min(p[:j]))

ans = 1
for i in range(1, n):
    if m[i] >= p[i]:
        ans += 1
        
print(ans)

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

m = []
a = p[0]
for j in range(n):
    if a >= p[j]:
        a = p[j]
        m.append(a)
    else:
        m.append(a)

ans = 1
for i in range(n-1):
    if m[i] > m[i+1]:
        ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

ans = 1
for i in range(1, n):
    if min(p[:i]) >= p[i]:
        ans += 1
        
print(ans)

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

m = []
a = p[0]
for j in range(n):
    if a >= p[j]:
        a = p[j]
        m.append(a)
    else:
        m.append(a)

ans = 1
for i in range(n-1):
    if m[i] > m[i+1]:
        ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(3000)
n = int(input())
x = list(map(int, input().split()))

dx = [0]*(n-1)
for i in range(n-1):
    dx[i] = x[i+1] - x[i]

def fact(n):
    if n <= 1:
        return n
    else:
        return n*fact(n-1)
    
r = fact(n-1)//2
res = 0
for j in range(n-1):
    if j == 0:
        res += dx[j]*fact(n-1)
    else:
        res += dx[j]*fact(n-1) + r
        r = r + r//(j+1)
        
ans = res%(10**9+7)
print(ans)

Fixed submission:
n = int(input())
s = []
t = []
for i in range(n):
    ss, tt = map(str, input().split())
    s.append(ss)
    t.append(int(tt))
x =input()

song= s.index(x)
res = 0
for i in range(song+1, n):
    res += t[i]
    
print(res)
Buggy python submission (verdict: Runtime Error):
A,B,K =map(int,input().split())
if A >= K:
  print(A-K,B)
elif B-(K-A) >= 0:
  print(0,B-(K-A))
else:
  print(0,0)

Fixed submission:
s = list(map(str, input().split()))

print(s[1]+s[0])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

import math
ans = a*b // math.gcd(a, b)
print(ans)

Fixed submission:
a, b = map(int, input().split())

def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a*b/gcd(a, b)

print(int(lcm(a, b)))
Buggy python submission (verdict: Runtime Error):
n = int(input())

l = []
for i in range(n-1, 0, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

Fixed submission:
n = int(input())
bool = False
for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        if i*j == n:
            bool = True
            break
        else: 
            continue
            
if bool == True:
    print("Yes")
else: 
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())

l = []
for i in range(n-1, 0, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
print(l)        
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

Fixed submission:
n = int(input())
bool = False
for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        if i*j == n:
            bool = True
            break
        else: 
            continue
            
if bool == True:
    print("Yes")
else: 
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())

l = []
for i in range(n-1, 1, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
        
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

Fixed submission:
n = int(input())
bool = False
for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        if i*j == n:
            bool = True
            break
        else: 
            continue
            
if bool == True:
    print("Yes")
else: 
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())

l = []
for i in range(n-1, 1, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
        
if l[0] < 10 and l[i] < 10:
    print('Yes')
else:
    print("No")

Fixed submission:
n = int(input())
bool = False
for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        if i*j == n:
            bool = True
            break
        else: 
            continue
            
if bool == True:
    print("Yes")
else: 
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

for i in range(1, int(n**(1/2)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

Fixed submission:
n = int(input())

for i in range(1, int(n**(1/2))+2 , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

import math
for i in range(1, int(math.sqrt(n)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

Fixed submission:
n = int(input())

for i in range(1, int(n**(1/2))+2 , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a-2b >= 0:
  print(a-2b)
else:
  print(0)

Fixed submission:
a, b = map(int, input().split())
if a-2*b >= 0:
    print(a-2*b)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split())) 

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

Fixed submission:
N = int(input())
odd = 0
for i in range(0, N+1, 1):
    if i % 2 == 0:
        continue
    elif i % 2 == 1:
        odd += 1
print(float(odd/N))

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

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

Fixed submission:
N = int(input())
odd = 0
for i in range(0, N+1, 1):
    if i % 2 == 0:
        continue
    elif i % 2 == 1:
        odd += 1
print(float(odd/N))
Buggy python submission (verdict: Runtime Error):
s = input()
l = ['Sunny', 'Cloudy', 'Rainy']
if s == l[0]:
    print(l[1])
elif s == l[1]:
    print(l[2]):
elif s == l[2]:
    print(l[0])

Fixed submission:
s = input()
if s == "Sunny":
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')

Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'Sunny':
    print('Cloudy')
elif s = 'Cloudy':
    print('Rainy')
elif s = 'Rainy':
    print('Sunny')

Fixed submission:
s = input()
if s == "Sunny":
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input()))
for i in range(len(s)):
    if i%2 == 0 and s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
        bool = True
    elif i%2 == 1 and s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
        bool = True
    else:
        bool = False
        break
        
if bool == True:
    print('Yes')
elif bool == False:
    print('No')

Fixed submission:
S = list(map(str, input()))

bool = True
i = 0
while i != len(S):
    if i%2 == 0 and S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
        bool = True
        i += 1
    elif i%2 == 1 and S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
        bool = True
        i += 1
    else:
        bool = False
        i = len(S)
        
if bool:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
s = list(map(str, input()))
bool = True
while bool == True:
    for i in range(len(s)):
        if i%2 == 0 and s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            bool = True
        elif i%2 == 1 and s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            bool = True
        else:
            bool = False
        
if bool == True:
    print('Yes')
elif bool == False:
    print('No')

Fixed submission:
S = list(map(str, input()))

bool = True
i = 0
while i != len(S):
    if i%2 == 0 and S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
        bool = True
        i += 1
    elif i%2 == 1 and S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
        bool = True
        i += 1
    else:
        bool = False
        i = len(S)
        
if bool:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
A = []
for _ in range(q):
    a = int(input())
    A.append(a)

p = [k]*n
for i in range(len(A)):
    ele = A[i]-1
    for j in range(len(p)):
        if j != ele:
            p[j] = p[j]-1
    
for l in range(len(p)):
    if p[l] > 0:
        print('Yes')
    elif p[l] <= 0:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
A = []
for _ in range(q):
    a = int(input())
    A.append(a)
    
p = [k-q]*n
for i in range(len(A)):
    val = A[i]-1
    p[val] += 1

for l in range(len(p)):
    if p[l] > 0:
        print('Yes')
    elif p[l] <= 0:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i+1] == a[i]+1:
        ans += c[i-1]
        
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i] == a[i-1]+1 and i > 0:
        ans += c[val-1]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

s = a-1
t = b-1
ans = int((s+t-1)/t)
        
print(ans)

Fixed submission:
a, b = map(int, input().split())

s = a-1
t = b-1
ans = int((s+t-1)/s)
        
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
v = list(map(int, input().split()))
vsort = sorted(v)
ans = (vsort[0]+vsort[1])/2

for i in range(N):
    if N <= 2:
        break
    else:
        ans = (ans + vsort[i])/2
        
print(ans)

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

if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split())
ans = []
for i in range(N):
    ans.append(k-i)
for j in range(1, N, 1):
    ans.append(k+i)
ans = sorted(ans)
 
for k in ans:
    print(ans[k])

Fixed submission:
k, x = map(int, input().split())
l = []
for i in range(k):
    l.append(x+i)
    if i > 0:
        l.append(x-i)
l = sorted(l)
for j in range(2*k-1):
    print(l[j], end=" ")

Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split())
ans = []
for i in range(N):
  ans.append(k-i)
for j in range(1, N, 1):
  ans.append(k+i)
  
ans = sorted(ans)

for k in ans:
  print(ans[k])

Fixed submission:
k, x = map(int, input().split())
l = []
for i in range(k):
    l.append(x+i)
    if i > 0:
        l.append(x-i)
l = sorted(l)
for j in range(2*k-1):
    print(l[j], end=" ")

Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split())
l = []
for i in range(k):
    l.append(x+i)
    if i > 0:
        l.append(x-i)
l = sorted(l)
for j in range(10000):
    print(l[j], end=" ")

Fixed submission:
k, x = map(int, input().split())
l = []
for i in range(k):
    l.append(x+i)
    if i > 0:
        l.append(x-i)
l = sorted(l)
for j in range(2*k-1):
    print(l[j], end=" ")
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = 0
for i in range(1, n+1):
  x = len(i)
  if x%2 == 1:
    ans += 1
    
print(ans)

Fixed submission:
N = int(input())

import math
ans = 0
for i in range(1, N+1, 1):
    order = int(math.log10(i))+1
    if order%2 == 1:
        ans += 1
    else:
        continue

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

for i in range(1, N):
    if H[i] > H[i+1]:
        H[i] -= 1

if H == sorted(H):
    print('Yes')
else:
    print('No')

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

for i in range(N):
    H[i] -= 1

for j in range(N-1):
    if H[j] > H[j+1]:
        H[j+1] += 1

if H == sorted(H):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if max(a) == a[i]:
        print(s[-2])
    else:
        print(max(a))

Fixed submission:
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if a[i] == s[-1]:
        print(s[-2])
    else:
        print(s[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if max(a) == a[i]:
        print(ans[-2])
    else:
        print(max(a))

Fixed submission:
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if a[i] == s[-1]:
        print(s[-2])
    else:
        print(s[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)

for i in range(n):
    d = a[i]
    del a[i]
    print(max(a))
    a.insert(i, d)

Fixed submission:
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if a[i] == s[-1]:
        print(s[-2])
    else:
        print(s[-1])
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())

item = l-r+1
if item >= 2019:
    print(0)
else:
    lt = []
    for j in range(l, r+1):
        for i in range(l, j):
            lt.append((i*j)%2019)
    print(min(lt))

Fixed submission:
l, r = map(int, input().split())

item = r-l+1
if item >= 2019:
    print(0)
else:
    lt = []
    for j in range(l, r+1):
        for i in range(l, j):
            lt.append((i*j)%2019)
    print(min(lt))

Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())

lt = []
for j in range(l, r+1, 1):
    for i in range(l, j):
        lt.append((i*j)%2019)
        
print(min(lt))

Fixed submission:
l, r = map(int, input().split())

item = r-l+1
if item >= 2019:
    print(0)
else:
    lt = []
    for j in range(l, r+1):
        for i in range(l, j):
            lt.append((i*j)%2019)
    print(min(lt))
Buggy python submission (verdict: Runtime Error):
s = sorted(list(input()))
if s[0] == s[1] and s[2] == s[3]:
    print('Yes')
elif s[0] == s[1] and s[0] == s[2]
    print('No')
else:
    print('No')

Fixed submission:
s = sorted(list(input()))
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[2] == s[3]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = [0]*(n+1)
for i in range(n):
    d[i+1] = d[i] + l[i]
    
ans = 0
for j in range(n+2):
    if d[j] <= x:
        ans += 1
    else:
        break

print(ans)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = [0]*(n+1)
for i in range(n):
    d[i+1] = d[i] + l[i]
    
ans = 0
for j in range(n+1):
    if d[j] <= x:
        ans += 1
    else:
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if a => 13:
  print(b)
elif 12 >= a and a >= 6:
  print(b/2)
elif a <= 5:
  print(0)

Fixed submission:
a, b = map(int, input().split())

if 13 <= a:
  print(b)
elif 6 <= a and a <= 12:
  print(int(b/2))
elif a <= 5:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
count = [0]*(n+1)
for i in range(m):
    l, r = map(int, input().split())
    for j in range(l, r+1):
        count[j] += 1
        
print(count.count(m))

Fixed submission:
N, M = map(int, input().split())
l, r = -1, N+1
for _ in range(M):
    L, R = map(int, input().split())
    l = max(l, L)
    r = min(r, R)
ans = max(0, r-l+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
def mod(x):
  if x % 10 == 0:
    return x
  else:
    while True:
      x += 1
      if x % 10 == 0:
        break
    return x
      
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = min(A%10, B%10, C%10, D%10, E%10)

if M = A%10:
  ans = A + mod(B) + mod(C) + mod(D) + mod(E)
elif M = B%10:
  ans = mod(A) + B + mod(C) + mod(D) + mod(E)
elif M = C%10:
  ans = mod(A) + mod(B) + C + mod(D) + mod(E)
elif M = D%10:
  ans = mod(A) + mod(B) + mod(C) + D + mod(E)
else:
  ans = mod(A) + mod(B) + mod(C) + mode(D) + E

Fixed submission:
L = []
x = []
for _ in range(5):
    l = int(input())
    L.append(l)
    x.append((10-(l%10))%10)

ans = 0
for i in range(len(L)):
    ans += L[i]+x[i]

ans = ans - max(x)
print(ans)
Buggy python submission (verdict: Runtime Error):
# B
s = list(input())

count = 0
l = []
for i in range(len(s)):
    if s[i] == 'A':
        count += 1
        continue
    elif s[i] == 'C':
        count += 1
        continue
    elif s[i] == 'G':
        count += 1
        continue
    elif s[i] == 'T':
        count += 1
        continue
    else:
        l.append(count)
        count = 0

print(max(l))

Fixed submission:
# B
s = list(input())

count = 0
l = []
for i in range(len(s)):
    if s[i] == 'A':
        count += 1
        continue
    elif s[i] == 'C':
        count += 1
        continue
    elif s[i] == 'G':
        count += 1
        continue
    elif s[i] == 'T':
        count += 1
        continue
    else:
        l.append(count)
        count = 0
l.append(count)

print(max(l))
Buggy python submission (verdict: Time Limit Exceeded):
# C
n, q = map(int, input().split())
a = input()
s = [0]*(n+1)

for i in range(n+1):
    s[i] = a[:i].count('AC')
    
ans = []
for j in range(q):
    l, r = map(int, input().split())
    ans.append(s[r]-s[l])
    
for v in ans:
    print(v)

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

a = [0]*(n)
for j in range(1, n):
    if s[j-1] == 'A' and s[j] == 'C':
        a[j] += 1
        
csum = [0]*(n+1)
for i in range(n):
    csum[i+1] = csum[i] + a[i]

for i in range(q):
    l, r = map(int, input().split())
    print(csum[r]-csum[l])

Buggy python submission (verdict: Time Limit Exceeded):
# C
n, q = map(int, input().split())
s = input()
ans = []
for i in range(q):
    l, r = map(int, input().split())
    ans.append(s[l-1:r].count('AC'))
    
for v in ans:
    print(v)

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

a = [0]*(n)
for j in range(1, n):
    if s[j-1] == 'A' and s[j] == 'C':
        a[j] += 1
        
csum = [0]*(n+1)
for i in range(n):
    csum[i+1] = csum[i] + a[i]

for i in range(q):
    l, r = map(int, input().split())
    print(csum[r]-csum[l])
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().split('/')))

if s[1] > 5:
    print('TBD')
elif s[i] <= 4:
    print('Heisei')

Fixed submission:
s = list(map(int, input().split('/')))

if s[1] >= 5:
    print('TBD')
elif s[1] <= 4:
    print('Heisei')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print(a)
if max(a) > sum(a.remove(max(a))):
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
M = max(a)
a.remove(M)

if M < sum(a):
  print('Yes')
else:
  print('No')