Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
s = [list(map(int, input().split())) for i in range(b)]
s = sum(s, [])
L = [-1]*[0]*(a-1)
ans = 0
ab = 10**(a-1)

for i in range(b):
    if L[s[i*2]-1] == 0:
        L[s[i*2]-1] = s[i*2+1]
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] == s[i*2+1]:
        pass
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] != s[i*2+1]:
        ans += 1

if ans == 0:
    if a == 1 and b == 0:
        print(0)
    if a != 1 and b == 0:
        print(ab)
    if b !=0 and L[0] == 0:
        print('-1')
    if b !=0 and L[0] == -1:
        T = ''.join(map(str,L[1:a]))
        ab = ab + int(T)
        print(ab)
    if b !=0 and L[0] != -1:
        T = ''.join(map(str,L))
        print(T)
if ans != 0:
    print('-1')

Fixed submission:
import sys
 
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for f in range(m)]
if n == 1:
    start = 0
    end = 10
else:
    start = 10**(n-1)
    end = 10**n
for i in range(start, end):
  x = False
  for j in sc:
    if str(i)[j[0]-1] != str(j[1]):
      x = True
      break
  if x:
    continue
  print(i)
  sys.exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
s = [list(map(int, input().split())) for i in range(b)]
s = sum(s, [])
L =[0]*a
ans = 0
ab = 10**(a-1)

for i in range(b):
    if L[s[i*2]-1] == 0:
        L[s[i*2]-1] = s[i*2+1]
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] == s[i*2+1]:
        pass
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] != s[i*2+1]:
        ans += 1

if ans == 0:
    if a == 1 and b == 0:
        print(0)
    if a != 1 and b == 0:
        print(ab)
    if b !=0 and L[0] == 0:
        T = ''.join(map(str,L[1:a]))
        ab = ab + int(T)
        print(ab)
    if b !=0 and L[0] != 0:
        T = ''.join(map(str,L))
        print(T)
if ans != 0:
    print('-1')

Fixed submission:
import sys
 
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for f in range(m)]
if n == 1:
    start = 0
    end = 10
else:
    start = 10**(n-1)
    end = 10**n
for i in range(start, end):
  x = False
  for j in sc:
    if str(i)[j[0]-1] != str(j[1]):
      x = True
      break
  if x:
    continue
  print(i)
  sys.exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

def abc(n):
    return (n+1)/2

cb = list(map(abc,c))

s = sum(cb[:b])
l.append(s)

for i in range(b,a+1):
    s = s - cb[i-b] + cb[b]
    l.append(s)

L = sorted(l)
print(L[-1])

Fixed submission:
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

def abc(n):
    return (n+1)/2

cb = list(map(abc,c))

s = sum(cb[:b])
l.append(s)

for i in range(b,a):
    s = s - cb[i-b] + cb[i]
    l.append(s)

L = sorted(l)
print(L[-1])

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

def abc(n):
    return (n+1)/2

cb = list(map(abc,c))

for i in range(a-b+1):
    for k in range(b):
        ans += cb[i+k]
    l.append(ans)
    ans = 0

L = sorted(l)
print(L[-1])

Fixed submission:
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

def abc(n):
    return (n+1)/2

cb = list(map(abc,c))

s = sum(cb[:b])
l.append(s)

for i in range(b,a):
    s = s - cb[i-b] + cb[i]
    l.append(s)

L = sorted(l)
print(L[-1])

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

for i in range(a-b+1):
    for k in range(b):
        ans += (c[i+k]+1)/2
    l.append(ans)
    ans = 0

L = sorted(l)
print(L[-1])

Fixed submission:
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

def abc(n):
    return (n+1)/2

cb = list(map(abc,c))

s = sum(cb[:b])
l.append(s)

for i in range(b,a):
    s = s - cb[i-b] + cb[i]
    l.append(s)

L = sorted(l)
print(L[-1])
Buggy python submission (verdict: Runtime Error):
n= int(input())
k= input()
ans = 0
L = [0]*(n+1)

for i in range(1,n+1):
    f = str(i)
    e = list(f)
    b = len(e) - e.count('0')
    L[i] = b
print(L.count(int(k)))

Fixed submission:
import sys
 
read = sys.stdin.read
 
 
def main():
    N, K = map(int, read().split())
 
    dp1 = [0] * (K + 1)
    dp2 = [0] * (K + 1)
    dp1[0] = 1
 
    for x in map(int, str(N)):
        for j in range(K, -1, -1):
            if j > 0:
                dp2[j] += dp2[j - 1] * 9
                if x != 0:
                    dp2[j] += dp1[j - 1] * (x - 1) + dp1[j]
                    dp1[j] = dp1[j - 1]
            else:
                dp1[j] = 0
                dp2[j] = 1
 
    print(dp1[K] + dp2[K])
    return
 
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, *A = map(int, open(0).read().split())
A = np.array(A, dtype=np.int64)
mod = 10**9 + 7
 
ans = 0
for i in range(60):
    mask = 1 << i
    cnt = np.count_nonzero(A&mask)
    x = cnt * (N-cnt)
    x *= mask % mod
    ans += x
    ans %= mod
 
print(ans)

Fixed submission:
import numpy as np
N, *A = map(int, open(0).read().split())
A = np.array(A, dtype=np.int64)
mod = 10**9 + 7
 
ans = 0
for i in range(60):
    mask = 1 << i
    cnt = np.count_nonzero(A&mask)
    x = cnt * (N-cnt)
    x *= mask % mod
    ans += x
    ans %= mod
 
print(ans)
Buggy python submission (verdict: Runtime Error):
zimport numpy
n = int(input())
l = []

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if is_prime(n) :
    print(n-1)
if is_prime(n) == False:
    for i in range(2,int(numpy.sqrt(n))+1):
        if n%i == 0:
            a = i
            b = n//i
            l.append(a+b-2)
    print(min(l))

Fixed submission:
import numpy
n = int(input())
l = []
ans = n

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if is_prime(n) :
    print(n-1)
if is_prime(n) == False:
    for i in range(2,int(numpy.sqrt(n))+1):
        if n%i == 0:
            a = i
            b = n//i
            ans = min(n,a+b-2)
    print(ans)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(n-1,0,-1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(n-1, 0, -1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count)

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(0, n-1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(n-1, 0, -1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
a=[Counter(list(input()))for _ in range(n)]
ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        if a[i] == a[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
c = Counter([''.join(sorted(input())) for i in range(n)])
 
ans = 0
for k, cnt in c.items():
    ans+=cnt*(cnt-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[sorted(list(str(input())))for _ in range(n)]
ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        if a[i] == a[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
c = Counter([''.join(sorted(input())) for i in range(n)])
 
ans = 0
for k, cnt in c.items():
    ans+=cnt*(cnt-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
 
s = input()
n = len(s)
 
dp = [0]*13
dp[0] = 1
 
for i in range(n):
  dp2 = [0]*13  
  for j in range(10):
    if s[i] == '?' or s[i] == str(j):
      for k in range(13):
        dp2[(k*10 + j)%13] += dp[k]
        dp2[(k*10 + j)%13] %= mod
        
  dp = dp2
 
print(dp[5])

Fixed submission:
mod = 10**9+7
 
s = input()
n = len(s)
 
dp = [0]*13
dp[0] = 1
 
for i in range(n):
  dp2 = [0]*13  
  for j in range(10):
    if s[i] == '?' or s[i] == str(j):
      for k in range(13):
        dp2[(k*10 + j)%13] += dp[k]
        dp2[(k*10 + j)%13] %= mod
        
  dp = dp2
 
print(dp[5])
Buggy python submission (verdict: Runtime Error):
s = input()
l = len(s)
ans = 0

for i in range(l):
    for k in range(i,k) :
        if s[i] == s[k]:
            ans += 1

if ans == 0:
    print('Good')
if ans !=0:
    print('Bad')

Fixed submission:
s = input()
l = len(s)
ans = 0

for i in range(l-1):
    if s[i] == s[i+1]:
        ans +=1

if ans == 0:
    print('Good')
if ans !=0:
    print('Bad')
Buggy python submission (verdict: Runtime Error):
5
2 4
1 9
1 8
4 9
3 12

Fixed submission:
N=int(input())
ba=[list(map(int,input().split()))[::-1]for _ in range(N)]
ba.sort()
 
time=0
ans='Yes'
for b,a in ba:
    time+=a
    if time>b:
        ans='No'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
h, w = map(int, input().split())
S = [input() for _ in range(h)]
L = [[0]*w for _ in range(h)]
R = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    if j > 0:
      if S[i][j-1] == ".":
        L[i][j] = L[i][j-1]+1
      if S[i][w-j] == ".":
        R[i][w-1-j] = R[i][w-j]+1
    if i > 0:
      if S[i-1][j] == ".":
        U[i][j] = U[i-1][j]+1
      if S[h-i][j] == ".":
        D[h-1-i][j] = D[h-i][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    if S[i][j] == ".":
      temp = L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
      ans = max(ans, temp)
print(ans)

Fixed submission:
MOD = 10**9+7
h, w = map(int, input().split())
S = [input() for _ in range(h)]
L = [[0]*w for _ in range(h)]
R = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    if j > 0:
      if S[i][j-1] == ".":
        L[i][j] = L[i][j-1]+1
      if S[i][w-j] == ".":
        R[i][w-1-j] = R[i][w-j]+1
    if i > 0:
      if S[i-1][j] == ".":
        U[i][j] = U[i-1][j]+1
      if S[h-i][j] == ".":
        D[h-1-i][j] = D[h-i][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    if S[i][j] == ".":
      temp = L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
      ans = max(ans, temp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H,W=map(int, input().split())
 
A=[]
que=[]
done=[[-1]*W for _ in range(H)]
for h in range(H):
    a=list(input())
    A.append(a)
    for w in range(W):
        if a[w]=="#":
            que.append((h,w))
            done[h][w]=0
 
d=[(1,0),(-1,0),(0,1),(0,-1)]
que=deque(que)
ans=0
while que:
    h,w=que.popleft()
    now=done[h][w]
    for t in d:
        dh,dw=t
        nh=h+dh
        nw=w+dw
        if 0<=nh<H and 0<=nw<W:
            if done[nh][nw]==-1:
                done[nh][nw]=now+1
                que.append((nh,nw))
                ans=max(ans, now+1)
 
 
 
print(ans)

Fixed submission:
from collections import deque
H,W=map(int, input().split())
 
A=[]
que=[]
done=[[-1]*W for _ in range(H)]
for h in range(H):
    a=list(input())
    A.append(a)
    for w in range(W):
        if a[w]=="#":
            que.append((h,w))
            done[h][w]=0
 
d=[(1,0),(-1,0),(0,1),(0,-1)]
que=deque(que)
ans=0
while que:
    h,w=que.popleft()
    now=done[h][w]
    for t in d:
        dh,dw=t
        nh=h+dh
        nw=w+dw
        if 0<=nh<H and 0<=nw<W:
            if done[nh][nw]==-1:
                done[nh][nw]=now+1
                que.append((nh,nw))
                ans=max(ans, now+1)
 
 
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X,Y,Z,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
D=[]
for i in A:
  for j in B:
    D.append(i+j)
D=sorted(D)[::-1]
if X*Y>K:
  D=D[:K]
E=[]
for i in D:
  for j in C:
    E.append(i+j)
E=sorted(E)[::-1]
E=E[:K]
for i in E:
  print(i)

Fixed submission:
X,Y,Z,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
D=[]
for i in A:
  for j in B:
    D.append(i+j)
D=sorted(D)[::-1]
if X*Y>K:
  D=D[:K]
E=[]
for i in D:
  for j in C:
    E.append(i+j)
E=sorted(E)[::-1]
E=E[:K]
for i in E:
  print(i)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
c=list(map(int, input().split()))
d -= 1
print(a//d)

Fixed submission:
import math
n, k = map(int,input().split())
input()
print(math.ceil((n-1)/(k-1)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
ans = []
 
for i in range(n):
    if d[i] not in ans:
        ans.append(d[i])
 
print(len(ans))

Fixed submission:
S = input()
print("2018"+S[4::])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l = [] 

for i in range(n):
    s = input()
    if s not in l:
        l += [s]
    else:
        l.remove(s)
print(len(l))

Fixed submission:
import collections
n=int(input())
l = [input() for i in range(n)]
c = collections.Counter(l)
ans = 0

for x,y in c.items():
    if y%2 != 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
l = sorted(list(map(int, input().split())) )
c = collections.Counter(l)
L = [0]*10**5
M = [0]*10**5

for x,y in c.items():
    L[x-1] += y

M[0] = L[0]
M[n] = L[n]
for i in range(1,10**5-1):
    M[i] = L[i-1] + L[i] + L[i+1]
print(max(M))

Fixed submission:
import collections
n = int(input())
l = sorted(list(map(int, input().split())) )
c = collections.Counter(l)
L = [0]*(10**5+1)
M = [0]*(10**5+1)
 
for x,y in c.items():
    L[x] += y
 
M[0] = L[0]
M[10**5] = L[10**5]
for i in range(1,10**5):
    M[i] = L[i-1] + L[i] + L[i+1]
print(max(M))

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

l = [0]*n
ans = 0

for i in range(n):
    for j in range(n):
        if abs(c[i]-c[j]) <= 1:
            ans += 1
    l[i] = ans
    ans = 0
print(max(l))

Fixed submission:
import collections
n = int(input())
l = sorted(list(map(int, input().split())) )
c = collections.Counter(l)
L = [0]*(10**5+1)
M = [0]*(10**5+1)
 
for x,y in c.items():
    L[x] += y
 
M[0] = L[0]
M[10**5] = L[10**5]
for i in range(1,10**5):
    M[i] = L[i-1] + L[i] + L[i+1]
print(max(M))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input()) 
c=list(map(int, input().split()))
l = []

if n%2 == 0:
    for i in range(n):
        if i%2 == 0:
            l.append(c[i])
        if i%2 != 0:
            l.insert(0,c[i])
if n%2 != 0:
    for i in range(n):
        if i%2 != 0:
            l.append(c[i])
        if i%2 == 0:
            l.insert(0,c[i])
print(*l)

Fixed submission:
n = int(input())
a = input().split()
 
if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b=map(int, input().split())

if abs(a-b) == 1:
    print(math.factorial(a)*math.factorial(b))
if abs(a-b) == 0:
    print(math.factorial(a)*math.factorial(b)*2)
if abs(a-b) >= 2:
    print(0)

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

if abs(a-b) == 1:
    c = math.factorial(a)%(10**9+7)
    d = math.factorial(b)%(10**9+7)
    print(c*d%(10**9+7))
if abs(a-b) == 0:
    c = math.factorial(a)%(10**9+7)
    d = math.factorial(b)%(10**9+7)
    print(c*d*2%(10**9+7))
if abs(a-b) >= 2:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
s = 0

for i in range(n):
    for j in range(i + 1, n):
        s += a[i] * a[j]

print(s % (10 ** 9 + 7))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a_sum = 0
s = []
ans = 0

for i in range(n):
    a_sum += a[i]
    s.append(a_sum)

for i, j in enumerate(a):
    ans += j * (s[n - 1] - s[i])

print(ans % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
t = 0

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            sum = l[i] + l[j] + l[k]
            if sum - max(l[i], l[j], l[k]) > max(l[i], l[j], l[k]):
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    t += 1

print(t)


Fixed submission:
s = input()
d = 0

if s == "RRR":
    d = 3
elif s in {"RRS", "SRR"}:
    d = 2
elif s in {"RSR", "RSS", "SSR", "SRS"}:
    d = 1
else:
    d = 0

print(d)

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

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            sum = l[i] + l[j] + l[k]
            if sum - max(l[i], l[j], l[k]) > max(l[i], l[j], l[k]):
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    t += 1

print(t)


Fixed submission:
s = input()
d = 0

if s == "RRR":
    d = 3
elif s in {"RRS", "SRR"}:
    d = 2
elif s in {"RSR", "RSS", "SSR", "SRS"}:
    d = 1
else:
    d = 0

print(d)
Buggy python submission (verdict: Runtime Error):
x = input()

if x >= 30:
    print("Yes")
else:
    print("No")


Fixed submission:
x = int(input())

if x >= 30:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    bi, ci = map(int, input().split())
    b.append(bi)
    c.append(ci)

for i in range(q):
    a = [(c[i] if j == b[i] else j) for j in a]
    print(sum(a))


Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    bi, ci = map(int, input().split())
    b.append(bi)
    c.append(ci)

count = collections.Counter(a)
sums = sum(a)

for i in range(q):
    sums += count[b[i]] * (c[i] - b[i])
    print(sums)
    count[c[i]] += count[b[i]]
    count[b[i]] = 0
Buggy python submission (verdict: Runtime Error):
import collections

x, n = map(int, input().split())

if n == 0:
    print(x)
    exit()
    
p = list(map(int, input().split()))
l = [i for i in range(1, 101)]

def calc(a):
    return abs(a - x)

if x in l:
    l.remove(x) 
for i in p:
    if i in l:
        l.remove(i)

l2 = list(map(calc, l))
m = min(l2)

if collections.Counter(l2)[m] == 2:
    print(-m + x)
else:
    print(m + x)


Fixed submission:
x, n = map(int, input().split())
if n != 0:
    l = list(map(int, input().split()))
else:
    l = []

diff = 10**18
ans = 10**18

for i in range(-10000, 10000):
    if i in l:
        continue
    else:
        if abs(x-i) < diff:
            ans = i
            diff = abs(x-i)

print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
import collections

x, n = map(int, input().split())
p = list(map(int, input().split()))
l = [i for i in range(1, 101)]

def calc(a):
    return abs(a - x)

if n == 0:
    print(x)
    exit()

if x in l:
    l.remove(x) 
for i in p:
    if i in l:
        l.remove(i)

l2 = list(map(calc, l))
m = min(l2)

if collections.Counter(l2)[m] == 2:
    print(-m + x)
else:
    print(m + x)


Fixed submission:
x, n = map(int, input().split())
if n != 0:
    l = list(map(int, input().split()))
else:
    l = []

diff = 10**18
ans = 10**18

for i in range(-10000, 10000):
    if i in l:
        continue
    else:
        if abs(x-i) < diff:
            ans = i
            diff = abs(x-i)

print(ans)
Buggy python submission (verdict: Runtime Error):
if l == 'SSS':
	print(0)

elif l == 'SSR' or l == 'RSS' or l == 'SRS' or l == 'RSR':
	print(1)

elif l == 'SRR' or l == 'RRS':
	print(2)
  
elif l == 'RRR':
	print(3)

Fixed submission:
l = input()

if l == 'SSS':
	print(0)

elif l == 'SSR' or l == 'RSS' or l == 'SRS' or l == 'RSR':
	print(1)

elif l == 'SRR' or l == 'RRS':
	print(2)
  
elif l == 'RRR':
	print(3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n >= 30:
  print('Yes')
 else:
  print('No')

Fixed submission:
n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=10**n-2*(9**n)+8**n
ans=ans%1000000007
print(ans)

Fixed submission:
n=int(input())
ans=10**n-2*(9**n)+8**n
ans=ans%1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h_list = [int(i) for i in input().split()]
data = [list(map(int, input().split())) for _ in range(m)]

ten_set =set(np.array(range(1,n+1)))
ans_set =set([])
exist_set = set(np.array(range(1,n+1)))
for i in range(m):
    if h_list[data[i][0]-1] < h_list[data[i][1]-1]:
        ans_set.add(data[i][1])
        if data[i][0] in ans_set:
            ans_set.remove(data[i][0])
    elif h_list[data[i][0]-1] > h_list[data[i][1]-1]:
        
        ans_set.add(data[i][0])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    elif h_list[data[i][0]-1] == h_list[data[i][1]-1]:
        if data[i][0] in ans_set:
            ans_set.remove(data[i][1])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    exist_set.add(data[i][0])
    exist_set.add(data[i][1])

sa_set = ten_set − exist_set
ans_set = ans_set.union(sa_set)
print(len(ans_set))

Fixed submission:
s = input()
if s == 'ARC':
    print('ABC')
else:
    print('ARC')
Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int, input().rstrip().split())
dist_list = list(map(int, input().rstrip().split()))

result = 10000000
for i, v in enumerate(dist_list):
  offset = 1
  total = 0
  while offset < N:
    if total >= result:
      break
    now_pos = dist_list[((i + offset - 1) % N)]
    next_pos = dist_list[((i + offset) % N)]
    if next_pos < now_pos:
      next_pos += K
    total += next_pos - now_pos
    offset += 1

  if result > total:
    result = total

print(result)


Fixed submission:
K, N = map(int, input().rstrip().split())
dist_list = list(map(int, input().rstrip().split()))

maxdist = 0
for i in range(N - 1):
  dist = dist_list[i + 1] - dist_list[i]
  maxdist = max(maxdist, dist)
else:
  dist = (dist_list[0] + K) - dist_list[-1]
  maxdist = max(maxdist, dist)

print(K - maxdist)

Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int, input().rstrip().split())
dist_list = list(map(int, input().rstrip().split()))

result = 0
for i, v in enumerate(dist_list):
  offset = 1
  total = 0
  while offset < N:
    now_pos = dist_list[((i + offset - 1) % N)]
    next_pos = dist_list[((i + offset) % N)]
    if next_pos < now_pos:
      next_pos += K
    total += next_pos - now_pos
    offset += 1

  if (result == 0 or result > total):
    result = total

print(result)


Fixed submission:
K, N = map(int, input().rstrip().split())
dist_list = list(map(int, input().rstrip().split()))

maxdist = 0
for i in range(N - 1):
  dist = dist_list[i + 1] - dist_list[i]
  maxdist = max(maxdist, dist)
else:
  dist = (dist_list[0] + K) - dist_list[-1]
  maxdist = max(maxdist, dist)

print(K - maxdist)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

result = 1

for e in A:
    result *= e

if result > 10**18:
    print(-1)
else:
    print(result)

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

if A.count(0) != 0:
    print(0)
else:
    result = 1
    for e in A:
        result *= e
        if result > 10**18:
            break

    if result > 10**18:
        print(-1)
    else:
        print(result)