Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 17:22:42 2018
ABC080
@author: maezawa
"""
import itertools as itr

n = int(input())
f = []
for i in range(n):
    f.append(list(map(int, input().split())))
p = []
for i in range(n):
    p.append(list(map(int, input().split())))
    
#print(f)
#print(p)
profit = -10**8
for oph in itr.product([0,1], repeat=10):
    if oph == (0,0,0,0,0,0,0,0,0,0):
        continue
    c = [0]*n
    for i in range(n):
        c[i] = sum([f[i][j] for j in range(10) if oph[j]==1])
    pcurrent = sum([p[i][c[i]] for i in range(n+1)])
    if pcurrent > profit:
        profit = pcurrent
        #print(oph)

print(profit)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 17:22:42 2018
ABC080
@author: maezawa
"""
import itertools as itr

n = int(input())
f = []
for i in range(n):
    f.append(list(map(int, input().split())))
p = []
for i in range(n):
    p.append(list(map(int, input().split())))
    
#print(f)
#print(p)
profit = -10**10
for oph in itr.product([0,1], repeat=10):
    if oph == (0,0,0,0,0,0,0,0,0,0):
        continue
    c = [0]*n
    for i in range(n):
        c[i] = sum([f[i][j]*oph[j] for j in range(10)])
    pcurrent = sum([p[i][c[i]] for i in range(n)])
    if pcurrent > profit:
        profit = pcurrent
        #print(oph)

print(profit)
Buggy python submission (verdict: Time Limit Exceeded):
def luka(n):
  if n==0:
    return 2
  if n==1:
    return 1
  return luka(n-1)+luka(n-2)

n = int(input())
print(luka(n))


Fixed submission:
def luka(n):
  global lk
  if n==0:
    return 2
  if n==1:
    return 1
  if lk[n] != -1:
    return lk[n]
  lk[n] = luka(n-1)+luka(n-2)
  return lk[n]

lk = [-1]*100
n = int(input())
print(luka(n))
Buggy python submission (verdict: Runtime Error):
a, b, c, d = list(map(int, input().split()))
ops = ['+', '-']
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
      s = str(a)+op1+str(b)+op2+str(c)+op3+str(d)
      res = eval(s)
      if res == 7:
        print(s+'=7')
        break

Fixed submission:
a, b, c, d = list(input())
ops = ['+', '-']
fin = False
for op1 in ops:
    for op2 in ops:
        for op3 in ops:
            s = a+op1+b+op2+c+op3+d
            res = eval(s)
            if res == 7:
                print(s+'=7')
                fin = True
                break
        if fin == True:
            break
    if fin == True:
        break
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 20 10:21:00 2018
ABC077C
@author: maezawa
"""
import bisect

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

a.sort()
b.sort()
c.sort()

cnt = 0
for ci in c:
    j = bisect.bisect_left(b, ci)
    for bi in b[:j]:
        k = bisect.bisect_left(a, bi)
        #print(ci, bi, k, cnt)
        cnt += k
print(cnt)
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 20 10:21:00 2018
ABC077C
@author: maezawa
"""
import bisect

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

a.sort()
b.sort()
c.sort()

bcnt = [0]*n
for i, bi in enumerate(b):
    j = bisect.bisect_left(a, bi)
    if i == 0:
        bcnt[i] = j
    else:
        bcnt[i] = bcnt[i-1] + j
cnt = 0
for i, ci in enumerate(c):
    j = bisect.bisect_left(b, ci)
    if j == 0:
        continue
    else:
        cnt += bcnt[j-1]
    #print(ci, j, bcnt[j-1], cnt)
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
sset = set(s)
ans = 'None'
for c in (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z):
  if c not in sset:
    ans = c
    break
print(ans)

Fixed submission:
s = input()
sset = set(s)
ans = 'None'
abc = 'abcdefghijklmnopqrstuvwxyz'
for c in abc:
  if c not in sset:
    ans = c
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 10:49:33 2018
ABC071C
@author: maezawa
"""
import collections
n = int(input())
a = list(map(int,input().split()))
acount = collections.Counter(a)
auniq = acount.keys()
auniq.sort(reverse=True)
edge1 = 0
ans = 0
for edge in auniq:
    if acount[edge] >= 4:
        if edge1 == 0:
            ans = edge*edge
            break
        else:
            ans = edge1*edge
            break
    if acount[edge] >= 2:
        if edge1 == 0:
            edge1 = edge
        else:
            ans = edge1*edge
            break
print(ans)       



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 10:49:33 2018
ABC071C
@author: maezawa
"""
import collections
n = int(input())
a = list(map(int,input().split()))
acount = collections.Counter(a)
auniq = list(acount.keys())
auniq.sort(reverse=True)
edge1 = 0
ans = 0
for edge in auniq:
    if acount[edge] >= 4:
        if edge1 == 0:
            ans = edge*edge
            break
        else:
            ans = edge1*edge
            break
    if acount[edge] >= 2:
        if edge1 == 0:
            edge1 = edge
        else:
            ans = edge1*edge
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input()))
a.sort()
print(sum(a[:-1]))

Fixed submission:
a = list(map(int, input().split()))
a.sort()
print(sum(a[:-1]))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 20 21:40:30 2018
ABC065D
@author: maezawa
i=0...n (0-origin)
"""
import heapq

n = int(input())
a = []
b = []
for i in range(n): # i is a name of the city (0-origin)
    xy = list(map(int, input().split()))
    a.append([i,xy[0]])
    b.append([i,xy[1]])

a.sort(key=lambda x: x[1])
b.sort(key=lambda x: x[1])
#print(a) 
#print(b)

# making adj list
adj = [[] for _ in range(n)]
for i, [j, x] in enumerate(a[:-1]):
    adj[j].append([a[i+1][1]-x, a[i+1][0]])
    adj[a[i+1][0]].append([a[i+1][1]-x, j])
for i, [j, y] in enumerate(b[:-1]):
    adj[j].append([b[i+1][1]-y, b[i+1][0]])
    adj[b[i+1][0]].append([b[i+1][1]-y, j])

#print(adj)
    
# Prim's algorithm
d = [10**10]*n
visited = [False]*n
h = []
s = 0
heapq.heappush(h, [0, s])
cnt = 0
while h:
    cost, node = heapq.heappop(h)
    #if visited[node] != True and cost < d[node]:
    if visited[node] != True:        
        d[node] = cost
        visited[node] = True
        cnt += 1
        if cnt == n:
            break
        for edge in adj[node]:
            if visited[edge[1]] == True:
                continue
            heapq.heappush(h, edge)
            
#print(d)
print(sum(d))
        


Fixed submission:
x, a, b = list(map(int, input().split()))
if -a+b <= 0:
  print('delicious')
elif -a+b <= x:
  print('safe')
else:
  print('dangerous')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 20 21:40:30 2018
ABC065D
@author: maezawa
i=0...n (0-origin)
"""
import heapq

n = int(input())
a = []
b = []
for i in range(n): # i is a name of the city (0-origin)
    xy = list(map(int, input().split()))
    a.append([i,xy[0]])
    b.append([i,xy[1]])

a.sort(key=lambda x: x[1])
b.sort(key=lambda x: x[1])
#print(a) 
#print(b)

# making adj list
adj = [[] for _ in range(n)]
for i, [j, x] in enumerate(a[:-1]):
    adj[j].append([a[i+1][1]-x, a[i+1][0]])
    adj[a[i+1][0]].append([a[i+1][1]-x, j])
for i, [j, y] in enumerate(b[:-1]):
    adj[j].append([b[i+1][1]-y, b[i+1][0]])
    adj[b[i+1][0]].append([b[i+1][1]-y, j])

#print(adj)
    
# Prim's algorithm
d = [10**10]*n
visited = [False]*n
h = []
s = 0
heapq.heappush(h, [0, s])
cnt = 0
while h:
    cost, node = heapq.heappop(h)
    #if visited[node] != True and cost < d[node]:
    if visited[node] != True:        
        d[node] = cost
        visited[node] = True
        cnt += 1
        if cnt == n:
            break
        for edge in adj[node]:
            if visited[edge[1]] == True:
                continue
            heapq.heappush(h, edge)
            
#print(d)
print(sum(d))
        


Fixed submission:
x, a, b = list(map(int, input().split()))
if -a+b <= 0:
  print('delicious')
elif -a+b <= x:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [0]
for _ in range(n+1):
  a.append(int(input()))
visited = [False]*(n+1)
visited[1] = True
cnt = 0
but = 1
while True:
  nextb = a[but]
  if visited[nextb]:
    cnt = -1
    break
  elif nextb == 2:
    cnt += 1
    break
  else:
    but = nextb
    cnt += 1
    visited[but] = True
print(cnt)
    

Fixed submission:
n = int(input())
a = [0]
for _ in range(n):
  a.append(int(input()))
visited = [False]*(n+1)
visited[1] = True
cnt = 0
but = 1
while True:
  nextb = a[but]
  if visited[nextb]:
    cnt = -1
    break
  elif nextb == 2:
    cnt += 1
    break
  else:
    but = nextb
    cnt += 1
    visited[but] = True
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def f(h, a, b, t):
    y = 0
    for hi in h:
        if hi-b*t <= 0:
            break
        else:
            y += math.ceil((hi-b*t)/(a-b))
    if y <= t:
        return True
    else:
        return False

n, a, b = list(map(int, input().split()))
h = []
for _ in range(n):
    h.append(int(input()))
h.sort(reverse=True)

low = 1
high = math.ceil(h[0]/b)

while True:
    m = (low+high)//2
    if f(h,a,b,m):
        high = m
    else:
        low = m
    if low +1 == high:
        break

print(high)

Fixed submission:
import math

def f(h, a, b, t):
    y = 0
    for hi in h:
        if hi-b*t <= 0:
            break
        else:
            y += math.ceil((hi-b*t)/(a-b))
    if y <= t:
        return True
    else:
        return False

n, a, b = list(map(int, input().split()))
h = []
for _ in range(n):
    h.append(int(input()))
h.sort(reverse=True)

low = 0
high = math.ceil(h[0]/b)

while True:
    m = (low+high)//2
    if f(h,a,b,m):
        high = m
    else:
        low = m
    if low +1 == high:
        break

print(high)
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
if a > b:
  print('GREATER')
else:
  print('LESS')
  

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep  8 15:34:42 2018

@author: maezawa
"""

a = int(input())
b = int(input())
if a > b:
    print('GREATER')
elif a == b:
    print('EQUAL')
else:
    print('LESS')
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))
if a-b = b-c:
  print('YES')
else:
  print('NO')

Fixed submission:
a, b, c = list(map(int, input().split()))
if a-b == b-c:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
if a == 'H':
  print(b)
elif b == 'H':
  print('D')
else:
  print('H')

Fixed submission:
a, b = input().split()
if a == 'H':
  print(b)
elif b == 'H':
  print('D')
else:
  print('H')
Buggy python submission (verdict: Runtime Error):
a, op, b = input().split()
if op = '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Fixed submission:
a, op, b = input().split()
if op == '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Buggy python submission (verdict: Runtime Error):
i = len(s)
ans = 'YES'
while True:
    if s[-5:] == a[0] or s[-5:] == a[2]:
        i -= 5
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=6 and s[-6:] == a[3]:
        i -= 6
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=7 and s[-7:] == a[1]:
        i -= 7
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    else:
        ans = 'NO'
        break
    #print(s)
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 12:43:21 2018
ABC049C
@author: maezawa
"""

s = input()
a = ('dream', 'dreamer', 'erase', 'eraser')

i = len(s)
ans = 'YES'
while True:
    if s[-5:] == a[0] or s[-5:] == a[2]:
        i -= 5
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=6 and s[-6:] == a[3]:
        i -= 6
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=7 and s[-7:] == a[1]:
        i -= 7
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    else:
        ans = 'NO'
        break
    #print(s)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=[]
s.append[list(input())]
s.append[list(input())]
s.append[list(input())]
name = 'ABC'
i = 0
while True:
  if len(s[i]) == 0:
    print(name[i])
    break
  c = s[i].pop(0)  
  if c == 'a':
    i = 0
  elif c == 'b':
    i = 1
  else:
    i = 2

  

Fixed submission:
s = [[] for _ in range(3)]
s[0]=list(input())
s[1]=list(input())
s[2]=list(input())
name = 'ABC'
i = 0
while True:
  if len(s[i]) == 0:
    print(name[i])
    break
  c = s[i].pop(0)  
  if c == 'a':
    i = 0
  elif c == 'b':
    i = 1
  else:
    i = 2
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as itr
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))

#print(n,a)
#print(x)

cnt=0
for i in range(1,n+1):
    for y in itr.combinations(x,i):
        #print(y)
        if sum(y) == i*a:
            cnt += 1
print(cnt)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  5 12:20:16 2018
ABC44C
@author: maezawa
"""

def f(i, j):
    global xa
    global dp
    if i==0:
        cnt = 0
        if j==0:
            cnt += 1
        if j==xa[0]:
            cnt += 1
        return cnt
    if (i, j) in dp:
        return dp[(i,j)]
    else:
        dp[(i,j)] = f(i-1,j-xa[i]) + f(i-1,j)
        #print(i,j, dp[(i,j)])
        return dp[(i,j)]


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

xa = [x[i]-a for i in range(n)]
dp = dict([])

print(f(n-1, 0)-1)
Buggy python submission (verdict: Runtime Error):
import numpy as np

h, w, a, b = list(map(int, input().split()))

nmod = 10**9+7
board = np.zeros((h+1, w+1), dtype=int)
board[1,1] = 1

for x in range(1, h+1):
    for y in range(1, w+1):
        if x >= h-a+1 and y <= b:
            continue
        board[x,y] += board[x-1,y] + board[x,y-1]
        if board[x,y] >= nmod:
            board[x,y] = board[x,y] % nmod
print(board[h,w])

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 17:33:45 2019
ABC042D
@author: maezawa
"""

MAX = 5*10**5+1
MOD = 10**9+7

fac = [0] * MAX
finv = [0]*MAX
inv = [0]*MAX

# テーブルを作る前処理
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2,MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

# 二項係数計算
def COM(n, k):
    if (n < k):
        return 0
    if (n < 0 or k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

def HCOM(n,k):
    return COM(n+k-1,k)


#n, r = list(map(int, input().split()))
#ans = COM(n, r)
#print(ans)

h, w, a, b = list(map(int, input().split()))
cnt = 0
for i in range(h-a):
    p0 = HCOM(b, i) * HCOM(w-b,h-i-1)
    cnt = (cnt+p0)%MOD
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int,input().split()))
ans = 0
for i in range(N):
  se = 0
  for j in range(i):
    if li[j] >= li[i]:
      se += 1
    if se == i:
      ans += 1
print(ans+1)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
ans = 0
mi = N
for i in range(N):
    mi= min(mi,li[i])
    if mi == li[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,K = int(input())
ans = 'win'
if N+M+K >= 22:
  ans = 'bust'
print(ans)

Fixed submission:
N,M,K = map(int,input().split())
ans = 'win'
if N+M+K >= 22:
  ans = 'bust'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
for w in 'abcdefghijklmnopqrstuvwxyz':
  if S.find(w) != -1:
    while S.count(w) != 1:
      if S[S.find(w) + 1] == w:
        S.replace(w + w,w)
print(len(S))

Fixed submission:
N = int(input())
S = input()
ans = 1
for i in range(N):
  if i <= len(S)-2:
    if S[i] !=S[i+1]:
      ans = ans + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
for w in 'abcdefghijklmnopqrstuvwxyz':
  if S.find(w) != -1:
    while S.count(w) != 1:
   		 if S[S.find(w) + 1] == w:
    	 	 S.replace(w + w,w)
print(len(S))

Fixed submission:
N = int(input())
S = input()
ans = 1
for i in range(N):
  if i <= len(S)-2:
    if S[i] !=S[i+1]:
      ans = ans + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input())
li = [int(input()) for i in range(N)]
ans = 0
for i in li:
  if i >= K:
    ans += 1
print(ans)

Fixed submission:
N,K = map(int,input().split())
li = list(map(int,input().split()))
ans = 0
for i in li:
  if i >= K:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = int(input())
li = [int(input()) for i in range(N)]
ans = 0
for i in li:
  if i >= K:
    ans += 1
print(ans)

Fixed submission:
N,K = map(int,input().split())
li = list(map(int,input().split()))
ans = 0
for i in li:
  if i >= K:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
for i in range(N):
  print((li.index(i+1)+1),end=' ')

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
for i in range(N):
  print((li.index(i+1)+1),end=' ')

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int,input().split()))
ans = []
for i in range(N):
  for j in range(N):
    if li[j] == i+1:
      print(j+1,end=' ')

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int,input().split()))
ans = []
for i in range(N):
  for j in range(N):
    if li[j] == i+1:
      ans.append(j+1)
for i in range(N):
  print(ans[i],end=' ')

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int,input().split()))
ans = []
for i in range(N):
  ans.append(li.index(i+1) + 1)
for i in range(N):
  print(ans[i],end=' ')

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')

Buggy python submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
ans = []
for i in range(N):
  ans.append(li.find(i+1) + 1)
for i in range(N):
  print(ans[i],end=' ')


Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
li = [int(input()) for i in range(Q)]
ans = [K]*N
for i in range(Q):
    for j in range(N):
        if li[i]-1 != j:
            ans[j] -= 1
for i in range(N):
    if ans[i] <= 0:
        ans[i] = 'No'
    else:
        ans[i] = 'Yes'
    print(ans[i])


Fixed submission:
import collections

N,K,Q = map(int,input().split())
li = [int(input()) for i in range(Q)]
ans = [0]*N
lis = collections.Counter(li)
for w in lis:
    ans[w-1] = K-(Q-lis[w])
for i in range(N):
    if i+1 not in lis:
        ans[i] = K-Q
for i in range(N):
    if ans[i] <= 0:
        ans[i] = 'No'
    else:
        ans[i] = 'Yes'
    print(ans[i])
Buggy python submission (verdict: Runtime Error):

    import collections

N = int(input())
S = input()
A = ''
B = S
ans = 0
for i in range(N):
  A += B[0]
  B = B[1:]
  C = collections.Counter(A)
  D = 0
  for w in C:
    if w in B:
      D += 1
  if D > ans:
    ans = D
print(ans)

Fixed submission:
import collections

N = int(input())
S = input()
A = ''
B = S
ans = 0
for i in range(N):
  A += B[0]
  B = B[1:]
  C = collections.Counter(A)
  D = 0
  for w in C:
    if w in B:
      D += 1
  if D > ans:
    ans = D
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

c = [list(map(int,input().split())) for i in range(3)]

A = np.array([
    [1,0,0,1,0,0],
    [1,0,0,0,1,0],
    [1,0,0,0,0,1],
    [0,1,0,1,0,0],
    [0,1,0,0,1,0],
    [0,1,0,0,0,1],
    [0,0,1,1,0,0],
    [0,0,1,0,1,0],
    [0,0,1,0,0,1]])

B = np.array([
    [1,0,0,1,0,0,c[0][0]],
    [1,0,0,0,1,0,c[0][1]],
    [1,0,0,0,0,1,c[0][2]],
    [0,1,0,1,0,0,c[1][0]],
    [0,1,0,0,1,0,c[1][1]],
    [0,1,0,0,0,1,c[1][2]],
    [0,0,1,1,0,0,c[2][0]],
    [0,0,1,0,1,0,c[2][1]],
    [0,0,1,0,0,1,c[2][2]]])

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np

c = [list(map(int,input().split())) for i in range(3)]

A = np.array([
    [1,0,0,1,0,0],
    [1,0,0,0,1,0],
    [1,0,0,0,0,1],
    [0,1,0,1,0,0],
    [0,1,0,0,1,0],
    [0,1,0,0,0,1],
    [0,0,1,1,0,0],
    [0,0,1,0,1,0],
    [0,0,1,0,0,1]])

B = np.array([
    [1,0,0,1,0,0,c[0][0]],
    [1,0,0,0,1,0,c[0][1]],
    [1,0,0,0,0,1,c[0][2]],
    [0,1,0,1,0,0,c[1][0]],
    [0,1,0,0,1,0,c[1][1]],
    [0,1,0,0,0,1,c[1][2]],
    [0,0,1,1,0,0,c[2][0]],
    [0,0,1,0,1,0,c[2][1]],
    [0,0,1,0,0,1,c[2][2]]])

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import numpy as np

c = [list(map(int,input().split())) for i in range(3)]

A = np.array([
    [1,0,0,1,0,0],
    [1,0,0,0,1,0],
    [1,0,0,0,0,1],
    [0,1,0,1,0,0],
    [0,1,0,0,1,0],
    [0,1,0,0,0,1],
    [0,0,1,1,0,0],
    [0,0,1,0,1,0],
    [0,0,1,0,0,1]])

B = np.array([
    [1,0,0,1,0,0,c[0][0]],
    [1,0,0,0,1,0,c[0][1]],
    [1,0,0,0,0,1,c[0][2]],
    [0,1,0,1,0,0,c[1][0]],
    [0,1,0,0,1,0,c[1][1]],
    [0,1,0,0,0,1,c[1][2]],
    [0,0,1,1,0,0,c[2][0]],
    [0,0,1,0,1,0,c[2][1]],
    [0,0,1,0,0,1,c[2][2]]])

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np

c = [list(map(int,input().split())) for i in range(3)]

A = np.array([
    [1,0,0,1,0,0],
    [1,0,0,0,1,0],
    [1,0,0,0,0,1],
    [0,1,0,1,0,0],
    [0,1,0,0,1,0],
    [0,1,0,0,0,1],
    [0,0,1,1,0,0],
    [0,0,1,0,1,0],
    [0,0,1,0,0,1]])

B = np.array([
    [1,0,0,1,0,0,c[0][0]],
    [1,0,0,0,1,0,c[0][1]],
    [1,0,0,0,0,1,c[0][2]],
    [0,1,0,1,0,0,c[1][0]],
    [0,1,0,0,1,0,c[1][1]],
    [0,1,0,0,0,1,c[1][2]],
    [0,0,1,1,0,0,c[2][0]],
    [0,0,1,0,1,0,c[2][1]],
    [0,0,1,0,0,1,c[2][2]]])

rankA = np.linalg.matrix_rank(A)
rankB = np.linalg.matrix_rank(B)

if rankA == rankB:
    print('Yes')
else:
    print('No')