Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
for i in range(M):
    A.sort()
    A[len(A)-1] = A[len(A)-1] // 2
print(sum(A))

Fixed submission:
import heapq
N,M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
heapq.heapify(A)
ans = 0
for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
B - A = C
if C % (A-1) == 0:
  print(C//(A-1)+1)
else:
  print(C//(A-1)+2)

Fixed submission:
A,B = list(map(int,input().split()))
C = B - A
if C % (A-1) == 0:
  print(C//(A-1)+1)
else:
  print(C//(A-1)+2)
Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
print(max(c-a+b,0)

Fixed submission:
a,b,c = list(map(int,input().split()))
print(max(c-a+b,0))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
S = list(input())
N = len(S)
C = [1]*N
D = [1]*N
for j in range(10000):
    for i in range(N):
        if S[i] == 'R':
            D[i+1] += C[i]
            D[i] -= C[i]
        else:
            D[i-1] += C[i]
            D[i] -= C[i]
    C = copy.copy(D)
for i in range(N):
    D[i] = str(D[i])
print(' '.join(D))

Fixed submission:
S =list(input())
N = len(S)
ans = [0]*N
A = []
cnt = 0
for i in range(N-1):
    if S[i:i+2] == ['R','L']:
        for j in range(i,-1,-1):
            if S[j] == 'R':
                cnt += 1
            else:
                break
        even =  cnt//2
        odd = cnt-even
        ans[i+1] += even
        ans[i] += odd
        cnt = 0
        for j in range(i+1,N):
            if S[j] == 'L':
                cnt += 1
            else:
                break
        even =  cnt//2
        odd = cnt-even
        ans[i] += even
        ans[i+1] += odd
        cnt = 0
for a in ans:
    A.append(str(a))
print(' '.join(A))
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(input().split())
q = sorted(p)
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans <= 2:
  print('YES')
else:
  print('NO')

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
ans = 0
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans == 2:
  print('YES')
elif ans == 0:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
a,b = int(input().split())
if a % b == 0:
  print(a//b)
else:
  print(a//b+1)

Fixed submission:
a,b = list(map(int,input().split()))
if a % (b*2+1)== 0:
  print(a//(b*2+1))
else:
  print(a//(b*2+1)+1)
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
input = sys.stdin.readline
A = [int(input()) for i in range(N)]
B = sorted(A)
B.reverse()
for j in range(N):
  if A[j] == B[0]:
    print(B[1])
  else:
    print(B[0

Fixed submission:
import sys
N = int(input())
input = sys.stdin.readline
A = [int(input()) for i in range(N)]
B = sorted(A)
B.reverse()
for j in range(N):
  if A[j] == B[0]:
    print(B[1])
  else:
    print(B[0])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R = list(map(int,input().split()))
N_list = [i for i in range(L,R+1)]
P = itertools.combinations(N_list,2)
P = list(P)
ans = L*(L+1)%2019
for p in P[1:]:
    ans = min(ans,p[0]*p[1]%2019)
print(ans)

Fixed submission:
import itertools
L,R = list(map(int,input().split()))
if R-L >= 2020:
  print(0)
  exit()
N_list = [i for i in range(L,R+1)]
P = itertools.combinations(N_list,2)
P = list(P)
ans = L*(L+1)%2019
for p in P[1:]:
    ans = min(ans,p[0]*p[1]%2019)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N,K = I()
ans = 0
f1 = fact(N-K+1)
f2 = fact(K-1)
for i in range(1,K+1):
    print((f1*f2//(fact(i)**2//i*fact(N-K-i+1)*fact(K-i)))%mod)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N,K = I()
ans = 0
f1 = fact(N-K+1)
f2 = fact(K-1)
for i in range(1,K+1):
    if N-K-i+1 < 0:
        print(0)
        continue
    print((f1*f2//(fact(i)**2//i*fact(N-K-i+1)*fact(K-i)))%mod)
Buggy python submission (verdict: Runtime Error):
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < L:
        print(cnt)
        exit()
    cnt += 1
print(cnt)

Fixed submission:
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = [0]+list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < l:
        print(cnt)
        exit()
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int,input().split()))
weight= sum(W)
cnt = 0
for i in range(N):
    weight -= W[i]
  cnt += W[i]
  if weight <= cnt:
    print(cnt-weight)
    exit()


Fixed submission:
N = int(input())
W = list(map(int,input().split()))
weight= sum(W)
cnt = 0
for i in range(N):
  if weight <= cnt:
    print(min(cnt-weight,abs((cnt-W[i-1])-(weight+W[i-1]))))
    exit()
  weight -= W[i]
  cnt += W[i]
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math
N,M = list(map(int,input().split()))
A = np.array([-1]+[int(input()) for _ in range(M)]+[N+1])
A = np.diff(A, n= 1)
cnt = 0
ans = 1
for d in A:
  d -= 2
  cnt = 0
  for j in range(d//2+1):
    cnt += math.factorial(d-j)//(math.factorial(d-j*2)*math.factorial(j))
  ans *= cnt
print(ans%1000000007)

Fixed submission:
N,M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
A=[int(input()) for _ in range(M)]
B=[1]*(N+1)
for i in range(M):
    B[A[i]] = 0
for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*B[i]+dp[i-1]*B[i-1]
    else:
        dp[i+1] = dp[i]*B[i]
    dp[i+1] %= 10**9+7
print(dp[N])

Buggy python submission (verdict: Runtime Error):
import math
N,M = list(map(int,input().split()))
A = set([-1])+set([int(input()) for _ in range(M)])+set([N+1])
cnt = 0
ans = 1
for i in range(M+1):
  cnt = 0
  d = A[i+1]-A[i]-2
  for j in range(d//2+1):
    cnt += math.factorial(d-j)//(math.factorial(d-j*2)*math.factorial(j))
  ans *= cnt
print(ans%1000000007)

Fixed submission:
N,M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
A=[int(input()) for _ in range(M)]
B=[1]*(N+1)
for i in range(M):
    B[A[i]] = 0
for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*B[i]+dp[i-1]*B[i-1]
    else:
        dp[i+1] = dp[i]*B[i]
    dp[i+1] %= 10**9+7
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N,M = list(map(int,input().split()))
A = [-1]+[int(input()) for _ in range(M)]+[N+1]
cnt = 0
ans = 1
for i in range(M+1):
  cnt = 0
  d = A[i+1]-A[i]-2
  for j in range(d//2+1):
    cnt += math.factorial(d-j)//(math.factorial(d-j*2)*math.factorial(j))
  ans *= cnt
print(ans%1000000007)


Fixed submission:
N,M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
A=[int(input()) for _ in range(M)]
B=[1]*(N+1)
for i in range(M):
    B[A[i]] = 0
for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*B[i]+dp[i-1]*B[i-1]
    else:
        dp[i+1] = dp[i]*B[i]
    dp[i+1] %= 10**9+7
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N,M = list(map(int,input().split()))
A = [-1]+[int(input()) for _ in range(M)]+[N+1]
cnt = 0
ans = 1
for i in range(M+1):
  cnt = 0
  d = A[i+1]-A[i]-2
  for j in range(d//2+1):
    cnt += math.factorial(d-j)//(math.factorial(d-j*2)*math.factorial(j))
  ans *= cnt
print(ans%1000000007)

Fixed submission:
N,M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
A=[int(input()) for _ in range(M)]
B=[1]*(N+1)
for i in range(M):
    B[A[i]] = 0
for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*B[i]+dp[i-1]*B[i-1]
    else:
        dp[i+1] = dp[i]*B[i]
    dp[i+1] %= 10**9+7
print(dp[N])
Buggy python submission (verdict: Runtime Error):
from collections import deque
N,K = list(map(int,input().split()))
K = deque()
for i in range(M):
    A = deque(map(int,input().split()))
    K.append(A[0])
    A.popleft()
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in ks[j][1:]:
            s += (i >> (k - 1)) & 1
            print((i >> (k - 1)) & 1,(i >> (k - 1)))
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1

Fixed submission:
from collections import Counter
N = int(input())
A = []
B = []
E = []
for i in range(N):
  l = list(input().split())
  l[1] = int(l[1])
  A.append(l)
  B.append(l[0])
  E.append(l[1])
A.sort()
C = Counter(B)
C = sorted(C.items(), key=lambda x:x[0])
cnt = 0
for c in C:
  c = c[1]
  D = reversed(A[cnt:cnt+c])
  cnt += c
  for d in D:
    print(E.index(d[1])+1)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N,K = list(map(int,input().split()))
K = deque()
for i in range(M):
    A = deque(map(int,input().split()))
    K.append(A[0])
    A.popleft()
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in ks[j][1:]:
            s += (i >> (k - 1)) & 1
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1
print(ans)

Fixed submission:
from collections import deque
N,M = list(map(int,input().split()))
K = []
for i in range(M):
    A = list(map(int,input().split()))
    K.append(A)
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in K[j][1:]:
            s += (i >> (k - 1)) & 1
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
    A.sort()
    B,C = map(int,input().split())
    D = bisect.bisect_left(A,C)
    if D <= B:
        for j in range(D):
            A[j] = C
    else:
        for j in range(B):
            A[j] = C
print(sum(A))

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [(A[i],1) for i in range(N)]
for j in range(M):
    a, b = map(int, input().split())
    B.append((b,a))
B.sort()
B.reverse()
ans, cnt = 0, N
for (c, d) in B:
    use = min(d,cnt)
    ans += use*c
    cnt -= use
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,M = I()
links = [[] for _ in range(N)]
for i in range(M):
    x,y,z = I()
    links[x-1].append(y-1)
    links[y-1].append(x-1)
ans = 0
visited = [0]*N
def dfs(n):
    if visited[n]:
        return
    visited[n] = 1
    for l in links[n]:
        dfs(l)
for i in range(N):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,M = I()
links = [[] for _ in range(N)]
for i in range(M):
    x,y,z = I()
    links[x-1].append(y-1)
    links[y-1].append(x-1)
ans = 0
visited = [0]*N
def dfs(n):
    if visited[n]:
        return
    visited[n] = 1
    for l in links[n]:
        dfs(l)
for i in range(N):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
N = int(input())
A = list(map(int,input().split()))
l=[]
cnt = 0
for i in set(dv(A[0])+dv(A[1])):
    cnt = 0
    for j in range(len(A)):
        if A[j]%i == 0:
            cnt += 1
    if cnt >= N-1:
        l.append(i)
print(max(l))

Fixed submission:
def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
N = int(input())
A = list(map(int,input().split()))
l=[]
cnt = 0
for i in set(dv(A[0])+dv(A[1])):
    cnt = 0
    for j in range(len(A)):
        if A[j]%i == 0:
            cnt += 1
    if cnt >= N-1:
        l.append(i)
print(max(l))
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Fixed submission:
print({'A':'T','T':'A','G':'C','C':'G'}[input()])
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Fixed submission:
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Fixed submission:
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N-1)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Fixed submission:
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N-1)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
print(R)
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Fixed submission:
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])
Buggy python submission (verdict: Runtime Error):
S = list(input())
A = 0
B = 0
for s in S:
    if s == '0':
        A += 1
    else:
        B += 1
print(min(A,B)

Fixed submission:
S = list(input())
A = 0
B = 0
for s in S:
    if s == '0':
        A += 1
    else:
        B += 1
print(min(A,B)*2)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
A = []
for i in range(M-1):
    A.append(X[i+1]-X[i])
A.sort()
print(sum(A[:M-N]))

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
if max(L) < sum(L)-max(L):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
A = []
for i in range(M-1):
A.sort()
print(sum(A[:M-N]))

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
if N >= M:
    print(0)
    exit()
X.sort()
A = []
for i in range(M-1):
    A.append(X[i+1]-X[i])
A.sort()
print(sum(A[:M-N]))
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
h = l()
ans = 0
start = 0
Flag = 0
for i in range(N-1):
    if h[i] > h[i+1]:
        Flag = 1
    if h[i] < h[i+1] and Flag == 1:
        kukan = h[start:i+1]
        ans -= h[i]
        ans += max(kukan)
        start = i+1
        Flag = 0
kukan = h[start:-1]
ans += max(kukan)
print(ans)

Fixed submission:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
h = l()
ans = 0
start = 0
Flag = 0
for i in range(N-1):
    if h[i] > h[i+1]:
        Flag = 1
    if h[i] < h[i+1] and Flag == 1:
        kukan = h[start:i+1]
        ans -= h[i]
        ans += max(kukan)
        start = i+1
        Flag = 0
kukan = h[start:N]
ans += max(kukan)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = I()
if max(A,B,C) == A:
    print(A*10+B+C)
if max(A,B,C) == B:
    print(B*10+A+C)
else:
    print(C*10+A+B)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
if max(A,B,C) == A:
    print(A*10+B+C)
elif max(A,B,C) == B:
    print(B*10+A+C)
else:
    print(C*10+A+B)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
for i in range(K):
    if S[i] != 1:
        print(S[i])
        exit()
print(1)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = i()
ans = 0
for i in range(1,N+1,2):
    if len(dv(i)) == 8:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
R=int(input())
if R<1200:S='B'
elif R<2800:S='R'
else:S='G'
print('A'+S+'C')

Fixed submission:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
S[0] = 'a'
if S.count('C') != 1:
    print('WA')
    exit()
i = S.index('C')
if i == 1 or i == len(S)-1:
    print('WA')
    exit()
S[S.index('C')] = 'c'
if ''.join(S) == ''.join(S).lower():
    print('AC')
else:
    print('WA')
Buggy python submission (verdict: Runtime Error):
D,N = I()
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(N*100)
else:
    if N == 100:
        print(1010000)
    else:
        print(N*10000)

Fixed submission:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

D,N = I()
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(N*100)
else:
    if N == 100:
        print(1010000)
    else:
        print(N*10000)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N = int(input())
A = list(map(int,input().split()))
R = [0]+list(accumulate(A))
ans = 0
for i in range(N):
    for j in range(i+1,N+1):
        if R[j]-R[i] == 0:
            ans += 1
print(ans)

Fixed submission:
from itertools import accumulate
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
R = [0]+list(accumulate(A))
C = sorted(list(Counter(R).values()))
C.reverse()
ans = 0
for c in C:
  if c == 1:
    break
  ans += c*(c-1)//2
print(ans)