Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

import numpy as np    
arr = np.array(ans) //2
for x in arr:
  print(x)
      


Fixed submission:
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

for x in ans:
  print(x//2)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

import numpy as np    
arr = np.array(ans) //2
for x in arr:
  print(x)
      

Fixed submission:
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

for x in ans:
  print(x//2)
Buggy python submission (verdict: Runtime Error):
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if rev == 1 and y == '2':
      s = s + sr
    else:
      s = sr + s

if rev == -1:
  s = s[::-1]
  
print(s)  

Fixed submission:
s = input()
n = len(s)
sa = 'A'*n
sb = 'B'*n

if s != sa and s != sb:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)



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

if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
d = n//(a+b)
q = n % (a+b)

if q <= a:
  print(a*d+q)
else:
  print(a*d+a)



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

if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
d = n//(a+b)
q = n % (a+b)

if q <= a:
  print(b*d)
else:
  print(b*d+q-a)



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

if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if (rev == 1 and y == '2') or (rev == -1 and y == '1'):
      s = ''.join([s,sr])
    else:
      s = ''.join([sr,s])

if rev == -1:
  s = s[::-1]
  
print(s)  

Fixed submission:
from collections import deque
que1 = deque([])
que2 = deque([])
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if (rev == 1 and y == '2') or (rev == -1 and y == '1'):
      que2.append(sr)
    else:
      que1.appendleft(sr)

s = ''.join(que1+deque([s])+que2)     
if rev == -1:
  s = s[::-1]
  
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if (rev == 1 and y == '2') or (rev == -1 and y == '1'):
      s = s + sr
    else:
      s = sr + s

if rev == -1:
  s = s[::-1]
  
print(s)  
  

Fixed submission:
from collections import deque
que1 = deque([])
que2 = deque([])
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if (rev == 1 and y == '2') or (rev == -1 and y == '1'):
      que2.append(sr)
    else:
      que1.appendleft(sr)

s = ''.join(que1+deque([s])+que2)     
if rev == -1:
  s = s[::-1]
  
print(s)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T= input()
def score(x):
  if x == 'r':
    return P
  elif x == 's':
    return R
  elif x == 'p':
    return S
  else:
    return 0
s = 0
for t in range(len(T)-1):
  if T[t] == T[t+1]:
    T[t+1] = 'z'
  s += score(T[t])
print(s)  

Fixed submission:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T= input()
def score(x):
  if x == 'r':
    return P
  elif x == 's':
    return R
  elif x == 'p':
    return S
  else:
    return 0
s = 0
List = [x for x in T]
for t in range(len(T)-K):
  if List[t] == List[t+K]:
    List[t+K] = 'z' 
for y in List:  
  s += score(y)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
R,S,P = map(int,input().split())
A = input()
List = [[]]*K
for x in range(N):
  y = x % K
  List[y] = List[y] + [A[x]]
 
s = 0
for i in range(K):
  for j in range(len(List[i])-1):
    if List[i][j] == List[i][j+1]:
      List[i][j+1] = 't'
    k = List[i][j]
    if k == 'r':
      s += P
    elif k == 's':
      s += R
    elif k == 'p':
      s += S
    else:
      s = s
  l = List[i][len(List[i])-1]  
  if l == 'r':
      s += P
  elif l == 's':
      s += R
  elif l == 'p':
      s += S
  else:
      s = s
   
print(s)        

Fixed submission:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T= input()
def score(x):
  if x == 'r':
    return P
  elif x == 's':
    return R
  elif x == 'p':
    return S
  else:
    return 0
s = 0
List = [x for x in T]
for t in range(len(T)-K):
  if List[t] == List[t+K]:
    List[t+K] = 'z' 
for y in List:  
  s += score(y)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
height = list(map(int,input().split()))
cost_list = []
for m in range(1,n+1):
  if m <= k:
    cost_list.append(abs(height[m-1]-height[0]))
  else:
    Min = cost_list[-1] + abs(height[m-2]-height[m-1])
    if k > 1:
      for x in range(2,k+1):
        money2 = cost_list[-x] + abs(height[m-x-1]-height[m-1])
        if money2 < Min:
          Min = money2 
    cost_list.append(Min)
print(cost_list[-1])

Fixed submission:
import numpy as np
n,k = map(int,input().split())
height = np.array(list(map(int,input().split())))
cost_list = np.zeros(n,dtype = int)

for m in range(1,n+1):
  if m <= k:
    cost_list[m-1] = abs(height[m-1]-height[0])
  else:
    Min = min(cost_list[m-k-1:m-1] + abs(height[m-k-1:m-1] - height[m-1]))
    cost_list[m-1] = Min
              
print(cost_list[-1])

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

def cost(n):
  if n <= k:
    return abs(height[n-1]-height[0])
  else:
    Min = cost(n-1) + abs(height[n-2]-height[n-1])
    if k > 1:
      for x in range(2,k+1):
        money2 = cost(n-x) + abs(height[n-x-1]-height[n-1])
        if money2 < Min:
          Min = money2 
    return Min      
    
          
print(cost(n)) 

Fixed submission:
import numpy as np
n,k = map(int,input().split())
height = np.array(list(map(int,input().split())))
cost_list = np.zeros(n,dtype = int)

for m in range(1,n+1):
  if m <= k:
    cost_list[m-1] = abs(height[m-1]-height[0])
  else:
    Min = min(cost_list[m-k-1:m-1] + abs(height[m-k-1:m-1] - height[m-1]))
    cost_list[m-1] = Min
              
print(cost_list[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
List = list(map(int,input().split()))
List_ans = []
List.sort()
for x in range(N-1):
  if List[x]==List[x+1]:
    List_ans.append(List[x])
M = max(List_ans)
m = min(List_ans)
print(M*m)

Fixed submission:
N = int(input())
List = list(map(int,input().split()))
List_t = []
List_q = []
List.sort()
for x in range(N-1):
  if List[x]==List[x+1]:
    List_t.append(List[x])
for x in range(N-3):
  if List[x]==List[x+1]==List[x+2]==List[x+3]:
    List_q.append(List[x])

if len(List_q) == 0:
  if len(List_t)<=1:
    print(0)
  else:
    M = sorted(set(List_t))[-1]
    m = sorted(set(List_t))[-2]
    print(M*m)
else:
  M_q = sorted(set(List_q))[-1]
  M_t = sorted(set(List_t))[-1]
  m = sorted(set(List_t))[-2]
  print(max([M_q**2,M_t*m]))
Buggy python submission (verdict: Runtime Error):
x = input()
print(x^1)

Fixed submission:
x = int(input())
print(x^1)

Buggy python submission (verdict: Runtime Error):
print(x^1)

Fixed submission:
x = int(input())
print(x^1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit(0)
print('No') 

Fixed submission:
n = int(input())
count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        times_count += 1

if times_count == 0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit()
print('No')        

Fixed submission:
n = int(input())
count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        times_count += 1

if times_count == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

if a => 0:
  if c=>0:
    ans = b*d
  elif d =>0:
    ans=b*d
  else:
    ans=a*d
else:
  if b=>0:
    if c=>0:
      ans = b*d
    elif d =>0:
      if a*c < b*d:
        ans = b*d
      else:
        ans= a*c
    else:
      ans=a*c
  elif c=>0:
    ans=b*c
  else:
    ans= a*c
print(ans)

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

if a >= 0:
  if c>=0:
    ans = b*d
  elif d >=0:
    ans=b*d
  else:
    ans=a*d
else:
  if b>=0:
    if c>=0:
      ans = b*d
    elif d >=0:
      if a*c < b*d:
        ans = b*d
      else:
        ans= a*c
    else:
      ans=a*c
  elif c>=0:
    ans=b*c
  else:
    ans= a*c
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    d, n = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d**2:
            counter += 1
    return print(counter)
 
main()

Fixed submission:
def main():
    n, d = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d**2:
            counter += 1
    return print(counter)
 
main()

Buggy python submission (verdict: Runtime Error):
def main():
    d, n = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d:
            counter += 1
    return print(str(counter))

main()

Fixed submission:
def main():
    n, d = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d**2:
            counter += 1
    return print(counter)
 
main()
Buggy python submission (verdict: Runtime Error):
s=iuput()
t=input()
ans=0
for i in range(len(s)):
    if s[i]==t[i]:
        ans += 1
print(ans)

Fixed submission:
s=input()
t=input()
ans=0
for i in range(len(s)):
    if s[i]!=t[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n==0:
    print(x)
else:
    P = list(map(int, input().split())
    for i in range(0, 102):
        if x-i not in P or x+i not in P:
            if x-i not in P:
                print(x-i)
                exit(0)
            if x+i not in P:
                print(x+i)
                exit(0)

Fixed submission:
x, n = map(int, input().split())
if n==0:
    print(x)
if n > 0:
    P = list(map(int, input().split()))
    for i in range(0,102):
        if x-i not in P or x+i not in P:
            if x-i not in P:
                print(x-i)
                exit(0)
            if x+i not in P:
                print(x+i)
                exit(0)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
c=a＊b
print(c)

Fixed submission:
a,b=map(int,input().split())
c=a*b
print(c)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))
c = 1
P = [1]
for i in range(1,k+1):
    c = A[c-1]
    if c in P:
        roop_start = P.index(c)
        roop_num = i- roop_start
        break
    P.append(c)
    if i == k:
        roop_start = '8'
        roop_num = 'b'
if roop_start == '8':
    a = k
    roop_start = 0
else:
    a = (k - roop_start) %  roop_num
b = P[a + roop_start]
print(b)

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
ifa + b < k:
    d = 2*a + b - k
    print(d)

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
if a + b < k:
    d = 2*a + b - k
    print(d)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
A = [1 for _ in range(a)]
B = [0 for _ in range(b)]
C = [-1 for _ in range(c)]
D = A + B + C
print(sum(D[:k]))

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
if a + b < k:
    d = 2*a + b - k
    print(d)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
A = [1 for _ in range(a)]
B = [0 for _ in range(b)]
C = [-1 for _ in range(c)]
D = A + B + C
p = 0
for i in range(k):
    p += D[i]
print(p) 

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
if a + b < k:
    d = 2*a + b - k
    print(d)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
D = []
for _ in range(a):
    D.append(1)
for _ in range(b):
    D.append(0)
for _ in range(c):
    D.append(-1)
c = 0
for i in range(k):
    c += D[i]

print(c) 

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
if a + b < k:
    d = 2*a + b - k
    print(d)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m
 
for _  in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c) 

Fixed submission:
s = input()

if s == 'ABC':
    print('ARC')
else:
    print('ABC')
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy python submission (verdict: Runtime Error):
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
A= []
c = []

for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])

for j in range(k):
    for k in range(d[j]):
        c.append(A[j][k])

print(n-len(set(c)))

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
c = []
e = []
for i in range(k):
    d.append(int(input()))
    a = input()
    c.append([a[j:j+1] for j in range(len(a))])
    e[i] = list(map(int, c[i]))

for j in range(k):
    for k in range(d[j]):
        a = set(e[j][k])

print(n-len(a))

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
A = []
d = []
for i in range(k):
    d[i] = int(input())
    A[i] = list(map(int, input().split()))

for j in range(k):
    for k in range(d[j]):
        a = set(A[j][k])

print(n-len(a))

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

while a>=0 and c>=0:
  c=c-b
  if c<=0:
    print("Yes")
    exit("0")
  a=a-d
  if a<=0:
    print("No")
    exit("0")

Fixed submission:
import sys
a,b,c,d = map(int, input().split())

while a>=0 and c>=0:
  c=c-b
  if c<=0:
    print("Yes")
    sys.exit(0)
  a=a-d
  if a<=0:
    print("No")
    sys.exit(0)
Buggy python submission (verdict: Runtime Error):
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
for i in range(N):
    ans += array[i] * (x -arrau[i])
print(int(ans/2)%(10**9+7))

Fixed submission:
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
y = 0
for i in range(N):
  y += array[i]**2

ans = x**2 -y
print((ans//2)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
N = int(input())
array = list(map(int, input().split()))
for i in range(N):
      ans += array[i]*sum(array[i+1:N])
print(ans%(10**9+7))

Fixed submission:
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
y = 0
for i in range(N):
  y += array[i]**2

ans = x**2 -y
print((ans//2)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
N = int(input())
array = list(map(int, input().split()))
for i in range(N):
  for j in range(N):
    if i != j and i < j:
      ans += array[i]*array[j]
print(ans%(10**9+7))
      

Fixed submission:
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
y = 0
for i in range(N):
  y += array[i]**2

ans = x**2 -y
print((ans//2)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
S = input()

if S =="SSS":
  print(0)
elif S[1] == "S":
  print(1)
elif S = "SRS":
  print(1)
elif S == "RRR":
  print(3)
else:
  print(2)

Fixed submission:
S = input()

if S =="SSS":
  print(0)
elif S[1] == "S":
  print(1)
elif S == "SRS":
  print(1)
elif S == "RRR":
  print(3)
else:
  print(2)
Buggy python submission (verdict: Runtime Error):
num_list =[]
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))


Fixed submission:
N = int(input())
L = list(map(int, input().split()))
num_list =[]
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
dist = [[0] * (n+1) for _ in range(n+1)]


def calc_dist(i, j):
    return min(j-i, abs(i-x)+1+abs(j-y))
    # if j <= x or y <= i:
    #     return j - i
    # elif x < i < j < y:
    #     return min(j - i, (i - x) + 1 + (j - y))
    # elif x < i < y:
    #     return min(j - i, (i - x) + 1 + (j - y))
    # elif x < j < y:
    #     return min(j - i, (x - i) + 1 + (y - j))
    # else:
    #     print("{} {} {} {}".format(i, j, x, y))
    #     raise RuntimeError



for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist[i][calc_dist(i, j)] += 1

for k in range(1, n):
    ans = 0
    for node in range(1, n+1):
        ans += dist[node][k]
    print(ans)

Fixed submission:
import sys

def main():
    input = sys.stdin.readline
    n, x, y = map(int, input().strip().split())
    dist = [[0] * (n+1) for _ in range(n+1)]

    def calc_dist(i, j):
        return min(j-i, abs(i-x)+1+abs(j-y))

    for i in range(1, n+1):
        for j in range(i+1, n+1):
            dist[i][calc_dist(i, j)] += 1

    for k in range(1, n):
        ans = 0
        for node in range(1, n+1):
            ans += dist[node][k]
        print(ans)


if __name__ == '__main__':
    main()