Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split(" "))
temp = []
for i in range(N):
  temp.append(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*temp[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag)

Fixed submission:
N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*H[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split(" "))
temp = []
for i in range(N):
  temp.append(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*temp[j]
    if k >= A:
      s.append(k - A)
    else:
      s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(j)

Fixed submission:
N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*H[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag+1)
Buggy python submission (verdict: Time Limit Exceeded):
#E問題
N,M=map(int,input().split())
S=str(input())
Slist=list(S)
T=str(input())
Tlist=list(T)
#gcd(二つの数)
def gcd(GCD1,GCD2):
    x = min(GCD1,GCD2)
    y = max(GCD1,GCD2)
    if y%x == 0:
        return x
    else:
        return gcd(x,y%x)
MINA=int(N*M/gcd(N,M))
n=int(MINA/N)
m=int(MINA/M)
SS=["*" for i in range(MINA)]
TT=["*" for i in range(MINA)]
for i in range(N):
    SS[n*i]=Slist[i]
for i in range(M):
    TT[m*i]=Tlist[i]
flag=0
for i in range(MINA):
    if SS[i] == TT[i] or SS[i]=="*" or TT[i]=="*":
        pass
    else:
        flag=1
if flag==0:
    print(MINA)
else:
    print(-1)

Fixed submission:
#E問題
N,M=map(int,input().split())
S=str(input())
Slist=list(S)
T=str(input())
Tlist=list(T)
#gcd(二つの数)
def gcd(GCD1,GCD2):
    x = min(GCD1,GCD2)
    y = max(GCD1,GCD2)
    if y%x == 0:
        return x
    else:
        return gcd(x,y%x)
MINA=int(N*M/gcd(N,M))
n=int(MINA/N)
m=int(MINA/M)
flag=0
nn=int(M/n)
mm=int(N/m)
SS=[]
TT=[]
for i in range(mm):
    SS.append(Slist[i*m])
for i in range(nn):
    TT.append(Tlist[i*n])
if SS != TT:
    flag=1
if flag==0:
    print(MINA)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
shiri = []
flag = 0
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            flag = 1
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                flag = 1
                break
            else:
                shiri,append(tugi)
    else:
        shiri.append(tugi)
if flag == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
shiri = []
flag = 0
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            flag = 1
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                flag = 1
                break
            else:
                shiri.append(tugi)
    else:
        shiri.append(tugi)
if flag == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
shiri = []
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                break
            else:
                shiri,append(tugi)
    else:
        shiri.append(tugi)

Fixed submission:
N = int(input())
shiri = []
flag = 0
for i in range(N):
    tugi = str(input())
    tlist = list(tugi)
    if i!=0:
        if tugi in shiri:
            flag = 1
            break
        else:
            mae = list(shiri[i-1])
            if tlist[0]!=mae[-1]:
                flag = 1
                break
            else:
                shiri.append(tugi)
    else:
        shiri.append(tugi)
if flag == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
ans=[]
for i in range(H):
  for j in range(W):
    if i%2 == 0:
      if j != W-1:
        if A[i][j]%2 == 1:
          A[i][j+1]+=1
          ans.append([i+1,j+1,i+1,j+2])
      else:
        if A[i][j]%2 == 1 and i < H-1:
          A[i+1][j]+=1
          ans.append([i+1,j+1,i+2,j+1])
    else:
      if j != W-1:
        if A[i][W-1-j]%2 == 1:
          A[i][W-j]+=1
          ans.append([i+1,W-j,i+1,W-j+1])
      else:
        if A[i][W-1-j]%2 == 1 and i < H-1:
          A[i+1][W-1-j]+=1
          ans.append([i+1,W-j,i+2,W-j+1])
print(len(ans))
for i in range(len(ans)):
  print(ans[i][0],ans[i][1],ans[i][2],ans[i][3])

Fixed submission:
H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
ans=[]
for i in range(H):
  for j in range(W):
    if i%2 == 0:
      if j != W-1:
        if A[i][j]%2 == 1:
          A[i][j+1]+=1
          ans.append([i+1,j+1,i+1,j+2])
      else:
        if A[i][j]%2 == 1 and i < H-1:
          A[i+1][j]+=1
          ans.append([i+1,j+1,i+2,j+1])
    else:
      if j != W-1:
        if A[i][W-1-j]%2 == 1:
          A[i][W-2-j]+=1
          ans.append([i+1,W-j,i+1,W-j-1])
      else:
        if A[i][W-1-j]%2 == 1 and i < H-1:
          A[i+1][W-1-j]+=1
          ans.append([i+1,W-j,i+2,W-j])
print(len(ans))
for i in range(len(ans)):
  print(ans[i][0],ans[i][1],ans[i][2],ans[i][3])
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
flag = 0
a = 1
while a <= N:
  b = 1
  while b <= a:
    c = 1
    while c <= b:
      if (a+b)%K == 0 and (b+c)%K == 0 and (c+a)%K == 0:
        if a == b and b == c:
          flag = flag + 1
        elif a == b or b == c or c == a:
          flag = flag + 3
        else:
          flag = flag + 6
      c = c + 1
    b = b + 1
  a = a + 1
print(flag)

Fixed submission:
N,K = map(int,input().split())
if K%2==1:
    maxn = int(N/K)
    print(maxn**3)
else:
    maxn=int(N/K)
    if N%K >= int(K/2):
        print(maxn**3+(maxn+1)**3)
    else:
        print(2*maxn**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
flag = 0
a = 1
while a <= N:
  b = 1
  while b <= N:
    c = 1
    while c <= N:
      if (a+b)%K == 0 and (b+c)%K == 0 and (c+a)%K == 0:
        flag = flag + 1
      c = c + 1
    b = b + 1
  a = a + 1
print(flag)

Fixed submission:
N,K = map(int,input().split())
if K%2==1:
    maxn = int(N/K)
    print(maxn**3)
else:
    maxn=int(N/K)
    if N%K >= int(K/2):
        print(maxn**3+(maxn+1)**3)
    else:
        print(2*maxn**3)
Buggy python submission (verdict: Runtime Error):
N,K = (int,input().split(" "))
if N%K == 0:
  print(0)
else:
  print(1)

Fixed submission:
N,K = map(int,input().split(" "))
if N%K == 0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
  print(ABC)
elif R < 2800:
  print(ARC)
else:
  print(AGC)

Fixed submission:
R = int(input())
if R < 1200:
  print("ABC")
elif R < 2800:
  print("ARC")
else:
  print("AGC")
Buggy python submission (verdict: Time Limit Exceeded):
def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged
N,M = map(int,input().split(" "))
isbr = []
for i in range(M):
  isbr.append(list(map(int,input().split(" "))))
isbr = merge_sort(isbr)
rem = []
i = 0
while i < M:
  a = isbr[i][0]
  b = isbr[i][1]
  flag = 0
  while a <= b:
    if b in rem:
      flag = 1
      break
    else:
      b-=1
  if flag == 0:
    rem.append(isbr[i][1]-1)
  i+=1
print(len(rem))

Fixed submission:
#D問題
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]
AB=sorted(AB, key=lambda x: x[1])
bridges=[]
for i in range(M):
    if len(bridges) == 0:
        bridges.append(AB[i][1]-1)
    elif max(bridges)>=AB[i][0]:
        pass
    else:
        bridges.append(AB[i][1]-1)
print(len(bridges))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
isbr = []
for i in range(M):
  isbr.append(list(map(int,input().split(" "))))
isbr.sort(key=lambda x:x[1])
rem = []
i = 0
while i < M:
  a = isbr[i][0]
  b = isbr[i][1]
  flag = 0
  while a <= b:
    if b in rem:
      flag = 1
      break
    else:
      b-=1
  if flag == 0:
    rem.append(isbr[i][1]-1)
  i+=1
print(len(rem))

Fixed submission:
#D問題
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]
AB=sorted(AB, key=lambda x: x[1])
bridges=[]
for i in range(M):
    if len(bridges) == 0:
        bridges.append(AB[i][1]-1)
    elif max(bridges)>=AB[i][0]:
        pass
    else:
        bridges.append(AB[i][1]-1)
print(len(bridges))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split(" "))
isbr = []
for i in range(M):
  isbr.append(list(map(int,input().split(" "))))
isbr = list(sorted(isbr,key = lambda x: x[1]))
rem = []
i = 0
while i < M:
  a = isbr[i][0]
  b = isbr[i][1]
  flag = 0
  while a <= b:
    if b in rem:
      flag = 1
      break
    else:
      b-=1
  if flag == 0:
    rem.append(isbr[i][1]-1)
  i+=1
print(len(rem))

Fixed submission:
#D問題
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]
AB=sorted(AB, key=lambda x: x[1])
bridges=[]
for i in range(M):
    if len(bridges) == 0:
        bridges.append(AB[i][1]-1)
    elif max(bridges)>=AB[i][0]:
        pass
    else:
        bridges.append(AB[i][1]-1)
print(len(bridges))
Buggy python submission (verdict: Runtime Error):
#D問題
K = int(input())
keta = 1
now = 1
def sunuke(n):
    a = 0
    for i in str(n):
        a+=int(i)
    return(n/a)
count=0
while count < k:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta *= 10



Fixed submission:
#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10

Buggy python submission (verdict: Runtime Error):
#D問題
K = int(input())
keta = 1
now = 1
def sunuke(n):
    a = 0
    for i in str(n):
        a+=int(i)
    return(n/a)
count=0
while count < k:
    if sunuke(ima) <= sunuke(ima+keta):
        print(ima)
        ima += keta
        count += 1
    else:
        ima += 9*keta
        keta *= 10



Fixed submission:
#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10

Buggy python submission (verdict: Runtime Error):
K = int(input())
sunuke = [1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99,199,299,399,499,599,699,799,899,999,1999,2999,3999,4999,5999,6999,7999,8999,9999,19999,29999,39999,49999,59999,69999,79999,89999,99999,199999,299999,399999,499999,599999,699999,799999,899999,999999]
i = 0
while i < K:
  print(sunuke[i])
  i+=1

Fixed submission:
#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10

Buggy python submission (verdict: Runtime Error):
K = int(input())
sunuke = [1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99,199,299,399,499,599,699,799,899,999]
i = 0
while i < K:
  print(sunuke[i])
  i+=1

Fixed submission:
#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
slist = list(S)
MIN=N
for i in range(N):
    change=0
    change+=slist[:i].count("W")
    change+=slist[i+1:].count("E")
    MIN=min(MIN,change)
print(MIN)

Fixed submission:
#C
N = int(input())
S = list(str(input()))
look_east = [0]
E = 0
W = 0
for s in S:
    if s == "E":
        look_east.append(look_east[-1]+1)
        E+=1
    else:
        look_east.append(look_east[-1])
        W+=1

ans = N
for i in range(N):
    we = look_east[i]
    if S[i] == "E":
        change = i-we + E-(we+1)
    else:
        change = i-we + E-(we)
        
    ans = min(ans,change)
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
we = list(S)
i = 0
min = N
while i < N:
  west = we[0:i]
  east = we[i+1:N]
  wcount = west.count("W")
  ecount = east.count("E")
  if min >= wcount+ecount:
    min = wcount+ecount
  i+=1
print(min)

Fixed submission:
#C
N = int(input())
S = list(str(input()))
look_east = [0]
E = 0
W = 0
for s in S:
    if s == "E":
        look_east.append(look_east[-1]+1)
        E+=1
    else:
        look_east.append(look_east[-1])
        W+=1

ans = N
for i in range(N):
    we = look_east[i]
    if S[i] == "E":
        change = i-we + E-(we+1)
    else:
        change = i-we + E-(we)
        
    ans = min(ans,change)
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#D問題
N = int(input())
A = list(map(int,input().split()))

srui = [0]
xrui = [0]

for a in A:
    srui.append(srui[-1]+a)
    xrui.append(xrui[-1]^a)
    
#print(srui,xrui)
ans = 0
for i in range(N):
    I = i+1
    for j in range(N-i):
        J = I+j
        if J > N+1:
            break
            
        if (srui[J]-srui[I-1]) == (xrui[J]^xrui[I-1]):
            ans+=1
            #print(I,J)
        else:
            break
            
print(ans)

Fixed submission:
#D問題
N = int(input())
A = list(map(int,input().split()))

srui = [0]
xrui = [0]

for a in A:
    srui.append(srui[-1]+a)
    xrui.append(xrui[-1]^a)
    
#print(srui,xrui)
ans = 0
J = 1
for i in range(N):
    I = i+1
    while J <= N and (srui[J]-srui[I-1]) == (xrui[J]^xrui[I-1]):
        J+=1
    J-=1
    ans += J-I+1
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#D問題
N = int(input())
A = list(map(int,input().split()))

ruixor = [0]
ruisum = [0]
for i in range(N):
    if i == 0:
        ruixor.append(A[0])
        ruisum.append(A[0])
    else:
        ruixor.append(ruixor[-1]^A[i])
        ruisum.append(ruisum[-1]+A[i])
        
count = 0
for i in range(N+1):
    for j in range(N-i):
        l = i
        r = l+j+1
        if ruixor[r]^ruixor[l] == ruisum[r]-ruisum[l]:
            count+=1
            
print(count)

Fixed submission:
#D問題
N = int(input())
A = list(map(int,input().split()))

srui = [0]
xrui = [0]

for a in A:
    srui.append(srui[-1]+a)
    xrui.append(xrui[-1]^a)
    
#print(srui,xrui)
ans = 0
J = 1
for i in range(N):
    I = i+1
    while J <= N and (srui[J]-srui[I-1]) == (xrui[J]^xrui[I-1]):
        J+=1
    J-=1
    ans += J-I+1
            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
b = 1
MAX = 1
flag = 0
while b <= X:
    p = 2
    while p <= 10:
        beki = b**p
        if beki <= X:
            if beki >= MAX:
                MAX = beki
            else:
                p+=1
        else:
            if p == 2:
                flag = 1
            break
    if flag == 1:
        break
    b+=1
print(MAX)

Fixed submission:
X = int(input())
beki=[]
for a in range(X):
    A=a+1
    for i in range(32):
        I=i+1
        j=0
        for j in range(9):
            J=j+2
            if A == I**J:
                beki.append(A)
                break
            elif A<I**J:
                break
print(max(beki))

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
b = 1
MAX = 1
while b <= X:
    p = 2
    while p <= 10:
        beki = b**p
        if beki <= X:
            if beki >= MAX:
                MAX = beki
            else:
                p+=1
        else:
            break
    b+=1
print(MAX)

Fixed submission:
X = int(input())
beki=[]
for a in range(X):
    A=a+1
    for i in range(32):
        I=i+1
        j=0
        for j in range(9):
            J=j+2
            if A == I**J:
                beki.append(A)
                break
            elif A<I**J:
                break
print(max(beki))
Buggy python submission (verdict: Time Limit Exceeded):
#C
S = list(str(input()))
N = len(S)
K = int(input())

cand = []
for i in range(N):
    s = S[i]
    cand.append(s)
    for j in range(K):
        if i+j+1 < N:
            s+=S[i+j+1]
            cand.append(s)
            
shin = []
for c in cand:
    if c not in shin:
        shin.append(c)
        
shin.sort()
print(shin[K-1])


Fixed submission:
#C
S = list(str(input()))
N = len(S)
K = int(input())

cand = []
for i in range(N):
    s = S[i]
    cand.append(s)
    for j in range(K):
        if i+j+1 < N:
            s+=S[i+j+1]
            cand.append(s)
            
cand.sort()
old = ""
shin = []
for c in cand:
    if c != old:
        shin.append(c)
        old = c
        
shin.sort()
print(shin[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
#B問題
N = int(input())
S = [list(str(input())) for i in range(N)]

A = 0
B = 0
T = [[0 for i in range(N)] for j in range(N)]
ans = 0
for i in range(N):
    A+=1
    for j in range(N):
        for k in range(N):
            s = S[j][k]
            T[(j+A)%N][k] = s
            
    flag = 0
    for j in range(N):
        for k in range(N):
            if T[j][k] != T[k][j]:
                flag = 1
    if flag == 0:
        ans+=1
        
print(ans*N)

Fixed submission:
#B問題
N = int(input())
S = [list(str(input())) for i in range(N)]

A = 0
B = 0

ans = 0
for i in range(N):
    A = i
    flag = 0
    for j in range(N):
        for k in range(N):
            if S[(j+A)%N][k] != S[(k+A)%N][j]:
                flag = 1
    
    if flag == 0:
        ans+=1
        
print(ans*N)

Buggy python submission (verdict: Time Limit Exceeded):
#B問題
N = int(input())
S = [list(str(input())) for i in range(N)]

A = 0
B = 0
T = [[0 for i in range(N)] for j in range(N)]
ans = 0
for i in range(N):
    A+=1
    A%=N
    for j in range(N):
        for k in range(N):
            s = S[j][k]
            T[(j+A)%N][k] = s
            
    flag = 0
    for j in range(N):
        for k in range(N):
            if T[j][k] != T[k][j]:
                flag = 1
    if flag == 0:
        ans+=1
        
print(ans*N)


Fixed submission:
#B問題
N = int(input())
S = [list(str(input())) for i in range(N)]

A = 0
B = 0

ans = 0
for i in range(N):
    A = i
    flag = 0
    for j in range(N):
        for k in range(N):
            if S[(j+A)%N][k] != S[(k+A)%N][j]:
                flag = 1
    
    if flag == 0:
        ans+=1
        
print(ans*N)
Buggy python submission (verdict: Time Limit Exceeded):
N,Y = map(int,input().split(" "))
a = 0
flag = 0
while a <= N:
  b = 0
  while b <= N:
    c = N-a-b
    if 10000*a+5000*b+1000*c == Y and c >= 0:
      print(a,b,c)
      flag = 1
      break
    if flag == 1:
      break
    b+=1
  if flag == 1:
    break
  a+=1
if flag == 0:
  print(-1,-1,-1)

Fixed submission:
#C問題
N,Y=map(int,input().split())
flag=0
for x in range(N+1):
    for y in range(N+1):
        if x+y>N:
            pass
        else:
            z=N-(x+y)
            if 10000*x+5000*y+1000*z == Y:
                flag=1
                X,Y,Z=x,y,z
                break
    if flag == 1:
        break
if flag == 0:
    print(-1,-1,-1,)
else:
    print(X,Y,Z)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Num = list(map(int,input().split()))
ki = []
count = 0
for i in range(N):
    if Num[i] in ki:
        pass
    else:
        c = Num.count(Num[i])
        if c > Num[i]:
            count+=(c-Num[i])
        elif c < Num[i]:
            count+=c
        else:
            pass
        ki.append(Num[i])
print(count)

Fixed submission:
N = int(input())
Num = list(map(int,input().split()))
ki = []
count = 0
for i in range(N):
    if Num[i] in ki:
        pass
    elif Num[i] > 100000:
        count+=1
    else:
        c = Num.count(Num[i])
        if c > Num[i]:
            count+=(c-Num[i])
        elif c < Num[i]:
            count+=c
        else:
            pass
        ki.append(Num[i])
print(count)
Buggy python submission (verdict: Runtime Error):
s = str(input())
l = len(s)
x,y = map(int,input().split())
Fs = []
count = 0
for i in range(l):
    if s[i] == "T":
        Fs.append(count)
        count = 0
    else:
        count+=1
if s[-1] == "F":
    Fs.append(count)
xFs = [Fs[j] for j in range(len(Fs)) if j%2 == 0 and j!=0]
yFs = [Fs[k] for k in range(len(Fs)) if k%2 == 1]
x-=Fs[0]

def part_sum(a,A):
    n = len(a)
    dp = [[0 for i in range(A+1)] for j in range(n+1)]
    dp[0][0]=1
    
    for i in range(n):
        for j in range(A+1):
            if a[i]<=j:
                dp[i+1][j]=dp[i][j-a[i]] or dp[i][j]
            else:
                dp[i+1][j]=dp[i][j]
    return dp[n][A]


if sum(xFs) < abs(x) or sum(yFs) < abs(y):
    print("No")
else:
    if sax%2 == 0 and say%2 == 0:
        sax = int((sum(xFs)-x)/2)
        say = int((sum(yFs)-y)/2)
        if part_sum(xFs,sax) == 1 and part_sum(yFs,say) == 1:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Fixed submission:
s = str(input())
l = len(s)
x,y = map(int,input().split())
Fs = []
count = 0
for i in range(l):
    if s[i] == "T":
        Fs.append(count)
        count = 0
    else:
        count+=1
if s[-1] == "F":
    Fs.append(count)
xFs = [Fs[j] for j in range(len(Fs)) if j%2 == 0 and j!=0]
yFs = [Fs[k] for k in range(len(Fs)) if k%2 == 1]
x-=Fs[0]

def part_sum(a,A):
    n = len(a)
    dp = [[0 for i in range(A+1)] for j in range(n+1)]
    dp[0][0]=1
    
    for i in range(n):
        for j in range(A+1):
            if a[i]<=j:
                dp[i+1][j]=dp[i][j-a[i]] or dp[i][j]
            else:
                dp[i+1][j]=dp[i][j]
    return dp[n][A]


if sum(xFs) < abs(x) or sum(yFs) < abs(y):
    print("No")
else:
    sax = (sum(xFs)-abs(x))
    say = (sum(yFs)-abs(y))
    if sax%2 == 0 and say%2 == 0:
        sax = int(sax/2)
        say = int(say/2)
        if part_sum(xFs,sax) == 1 and part_sum(yFs,say) == 1:
            print("Yes")
        else:
            print("No")
    else:
        print("No")