Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#  --*-coding:utf-8-*--

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    for c in str:
        pat ^= 2**(ord(c)-97)
        s[pat] = min(
            min(s.get(pat^2**i, len(str)) + 1 for i in range(26)),
            s.get(pat, len(str)))

    if pat == 0:
        return 1

    return s[pat]
            

def test():
    assert f('aabxyyzz') == 2
    assert f('byebye') == 1
    assert f('abcdefghijklmnopqrstuvwxyz') == 26
    assert f('abcabcxabcx') == 3


def main():
    str = input()
    print(f(str))


if __name__ == '__main__':
    main()


Fixed submission:
#  --*-coding:utf-8-*--

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    bits = [2**i for i in range(26)]
    lenOfStr = len(str)

    for c in str:
        pat ^= bits[ord(c)-97]
        s[pat] = min(
            min(s.get(pat^bit, lenOfStr) + 1 for bit in bits),
            s.get(pat, lenOfStr))

    if pat == 0:
        return 1

    return s[pat]
            
str = input()
print(f(str))

Buggy python submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--

import math

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    for c in str:
        pat ^= 2**(ord(c)-97)
        s[pat] = min(
            min(s.get(pat^2**i, math.inf) + 1 for i in range(26)),
            s.get(pat, math.inf))

    if pat == 0:
        return 1

    return s[pat]
            

def test():
    assert f('aabxyyzz') == 2
    assert f('byebye') == 1
    assert f('abcdefghijklmnopqrstuvwxyz') == 26
    assert f('abcabcxabcx') == 3


def main():
    str = input()
    print(f(str))


if __name__ == '__main__':
    main()


Fixed submission:
#  --*-coding:utf-8-*--

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    bits = [2**i for i in range(26)]
    lenOfStr = len(str)

    for c in str:
        pat ^= bits[ord(c)-97]
        s[pat] = min(
            min(s.get(pat^bit, lenOfStr) + 1 for bit in bits),
            s.get(pat, lenOfStr))

    if pat == 0:
        return 1

    return s[pat]
            
str = input()
print(f(str))
Buggy python submission (verdict: Time Limit Exceeded):
d={}
n=int(input())
a=list(map(int,input().strip().split(" ")))
for i in a:
    if i not in d:
        d[i]=1
    else:
        d[i]=d[i]+1

for j in a:
    ans=0
    d[j]-=1
    for ii in d.values():
        ans+=(ii*(ii-1)//2)
    print(ans)
    d[j]+=1

        


Fixed submission:
d={}
n=int(input())
a=list(map(int,input().strip().split(" ")))
ans=0
for i in a:
    if i not in d:
        d[i]=1
    else:
        d[i]=d[i]+1
for i in d.values():
    ans+=(i*(i-1))//2

for j in a:
    d[j]-=1
    
    if ans>0:
        ans-=d[j]
        print(ans)
        ans+=d[j]
        d[j]+=1
    elif ans==0:
        print(0)
Buggy python submission (verdict: Runtime Error):
s=input()
p=s.count("hi")
if p=len(s)//2 and len(s)%2==0:
  print("Yes")
else:
  print("No")

Fixed submission:
s=input()
p=s.count("hi")
if p==len(s)//2 and len(s)%2==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from collections import deque
H, W = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "#" else 0 for a in input()] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2
 
def BFS(i0=0):
    Q = deque([i0])
    D = [-1] * (H * W)
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for y in (x+W, x-W, x+1, x-1):
            if X[y] == 0:
                if D[y] == -1:
                    D[y] = D[x] + 1
                    Q.append(y)
    return D
 
ma = 0
for i in range(H):
    for j in range(W):
        if X[i*W+j] == 0:
            ma = max(ma, max(BFS(i*W+j)))
print(ma)
from collections import deque
H, W = map(int, input().split())

Fixed submission:
from collections import deque
H, W = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "#" else 0 for a in input()] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2
 
def BFS(i0=0):
    Q = deque([i0])
    D = [-1] * (H * W)
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for y in (x+W, x-W, x+1, x-1):
            if X[y] == 0:
                if D[y] == -1:
                    D[y] = D[x] + 1
                    Q.append(y)
    return D
 
ma = 0
for i in range(H):
    for j in range(W):
        if X[i*W+j] == 0:
            ma = max(ma, max(BFS(i*W+j)))
print(ma)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
x=[0 for _ in range(3)]
x[a-1]=1
x[b-1]=1
for i in range(3):
  if x[i]==0:
    print(i+1)
    break


Fixed submission:
a=int(input())
b=int(input())
x=[0 for _ in range(3)]
x[a-1]=1
x[b-1]=1
for i in range(3):
  if x[i]==0:
    print(i+1)
    break
Buggy python submission (verdict: Runtime Error):
from math import gcd
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)


Fixed submission:
def gcd(x, y):
# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)


Fixed submission:
def gcd(x, y):
# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)
Buggy python submission (verdict: Runtime Error):
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[x-1-i]:
    c+=1
print(c)


Fixed submission:
a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)

Buggy python submission (verdict: Runtime Error):
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)


Fixed submission:
a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)

Buggy python submission (verdict: Runtime Error):
a=input().strip()
x=len(a)
c=0
for i in range((x//2)+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)
a=input().strip()

Fixed submission:
a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)

Buggy python submission (verdict: Runtime Error):
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)

Fixed submission:
a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)

Buggy python submission (verdict: Runtime Error):
a=input()
x=len(a)
c=0
if x%2:
  for i in range(x+1):
    if a[i]!=a[n-i-1]:
      c+=1
else:
  for i in range(x):
    if a[i]!=a[n-i-1]:
      c+=1
print(c)

Fixed submission:
a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=input().strip()
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))


Fixed submission:
n=int(input())
a=input().strip()
x=""
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))
Buggy python submission (verdict: Runtime Error):
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
cn=0
c=[int(x) for x in input().split(' ')]
for i in c:
  if i>=c:
    cn+=1
print(cn)

Fixed submission:
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
co=0
c=list(map(int,input().strip().split(' ')))
for i in c:
  if i>=b:
    co+=1
print(co)
Buggy python submission (verdict: Runtime Error):
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
c=input().strip()
d=0
if c[0]=='R':
  if c[1]=='R':
    d+=1
  
for i in range(1,a-1):
  if c[i]=='L':
    if c[i-1]=='L':
      d+=1
  elif c[i]=='R':
    if c[i+1]=='R':
      d+=1
if c[a-1]=='L':
  if c[a-2]=='L':
    d+=1
d=d+2*k
if d>(a-1):
  print (a-1)
else:
  print(d)
  
  

Fixed submission:
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
c=input().strip()
d=0
if c[0]=='R':
  if c[1]=='R':
    d+=1
  
for i in range(1,a-1):
  if c[i]=='L':
    if c[i-1]=='L':
      d+=1
  elif c[i]=='R':
    if c[i+1]=='R':
      d+=1
if c[a-1]=='L':
  if c[a-2]=='L':
    d+=1
d=d+2*b
if d>(a-1):
  print (a-1)
else:
  print(d)
Buggy python submission (verdict: Runtime Error):
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print (c)



Fixed submission:
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(i)
  if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
    c+=1
print (c)

Buggy python submission (verdict: Runtime Error):
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print c

Fixed submission:
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(i)
  if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
    c+=1
print (c)
Buggy python submission (verdict: Time Limit Exceeded):
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

tot = 0
for i in range(N):
    for j in range(i+1, N):
        tot += A[i] * A[j]
        
print(tot % (10 ** 9 + 7))

Fixed submission:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

sum_A = sum(A)

tot = 0
for i in range(N):
    sum_A -= A[i]
    tot += A[i] * sum_A
        
print(tot % 1000000007)
Buggy python submission (verdict: Runtime Error):
import random
D = int(input())
C = list(map(int, input().split()))

for i in range(D):
    input()

# 0以下無視 -> ALL0を省く
flg = list()
if max(C) == 0:
    for i in range(len(C)):
        flg.append(1)
else:
    for i in range(len(C)):
        if C[i] <= 0:
            flg.append(0)
        else:
            flg.append(1)

j = 27
for i in range(D):
  while(True):
      j -= 1
      if flg[j-1] == 1:
          break
  print(j)
  if j == 1:
    j = 27


Fixed submission:
for i in range(365):
  print("1")

Buggy python submission (verdict: Runtime Error):
import random
D = int(input())
C = list(map(int, input().split()))

for i in range(D):
    input()

# 0以下無視
flg = list()
for i in range(len(C)):
    if C[i] <= 0:
        flg.append(0)
    else:
        flg.append(1)

j = 27
for i in range(D):
  while(True):
      j -= 1
      if flg[j-1] == 1:
          break
  print(j)
  if j == 1:
    j = 27


Fixed submission:
for i in range(365):
  print("1")

Buggy python submission (verdict: Runtime Error):
import random

for i in range(365):
  print(random.randint(1, 26)

Fixed submission:
for i in range(365):
  print("1")
Buggy python submission (verdict: Runtime Error):
input()
A = list(map(int, input().split()))
A = A.sorted()
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)

Fixed submission:
input()
A = list(map(int, input().split()))
A = sorted(A)
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b = b[0] + b[2:]
print(a*b//100)


Fixed submission:
a, b = input().split()
a = int(a)
b = int(b[0] + b[2:])
print(a*b//100)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(int(a*b))

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b[0] + b[2:])
print(a*b//100)
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = {}
for i in range(N):
  d[input()] = 0
print(len(dict))

Fixed submission:
N = int(input())
d = {}
for i in range(N):
    d[input()] = 0
print(len(d))
Buggy python submission (verdict: Time Limit Exceeded):
# import itertools
import math
# import sys
# import numpy as np

K = int(input())
# S = input()
# n, *a = map(int, open(0))
# K, N = map(int, input().split())
# A = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()

# d = sorted(d.items(), key=lambda x:x[0]) # keyでsort

tot = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            tot += math.gcd(math.gcd(a, b), c)

print(tot)

Fixed submission:
# import itertools
import math
# import sys
# import numpy as np

K = int(input())
# S = input()
# n, *a = map(int, open(0))
# K, N = map(int, input().split())
# A = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()

# d = sorted(d.items(), key=lambda x:x[0]) # keyでsort

tot = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, K + 1):
            tot += math.gcd(gcd_ab, c)

print(tot)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
print(min[N%K,K-N%K])

Fixed submission:
N, K = map(int, input().split())
print(min([N%K,K-N%K]))
Buggy python submission (verdict: Runtime Error):
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

# N = int(input())
S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

Q = int(input())
direction = 1
for i in range(Q):
    l = input().split()
    if l[0] == "1":
        direction *= -1
    else:
        if (l[1] == "1" and direction == 1) or (l[1] == "2" and direction == -1):
            S = l[2] + S
        else:
            S += l[2]

if direction == 1:
    print(S)
else:
    print(S[::-1])

Fixed submission:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

# N = int(input())
S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

A = S.count("A")
B = S.count("B")

if 0 < A < 3:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(math.lcm(a, b))


Fixed submission:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = map(int, input().split())
print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
L.sort()
import numpy as np
L = np.array(L)
m = [0] * (L[-1] + 10)
for i in range(L[-1] + 10):
    m[i] = np.count_nonzero(L <= i)
print(L)
print(m)
cnt = 0
for i in range(N):
    for j in range(i + 1, N):
        tot = L[i] + L[j]
        if tot >= len(m) + 1:
            tot = len(m) - 2
        cnt += m[tot + 1] - m[L[j] + 1]
        print(i,j,tot,m[tot + 1],m[L[j] + 1])
print(cnt)


Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
i = 0
while i < N - 2:
    j = i + 1
    k = j + 1
    while j < N - 1:
        while k < N:
            if L[i] + L[j] <= L[k]:
                ans += k - j - 1
                break
            k += 1
        if k == N:
            ans += k - 1 - j
        j += 1
    i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
# n, *a = map(int, open(0))
# M, D = map(int, input().split())
L = list(map(int, input().split()))
# S = input()
cnt = 0
import itertools
import numpy as np
l = list(itertools.combinations(L, 2))
l2 = []
for t in l:
    l2.append(sum(t))
ary = np.array(l2)
# ary = np.array(L)
for i in L:
    # if t[0] + t[1] > t[2] and t[1] + t[2] > t[0] and t[0] + t[2] > t[1]:
    cnt += np.count_nonzero(ary <= i)
tot = (N * (N-1) * (N-2)) // 6
print(tot - cnt)


Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
i = 0
while i < N - 2:
    j = i + 1
    k = j + 1
    while j < N - 1:
        while k < N:
            if L[i] + L[j] <= L[k]:
                ans += k - j - 1
                break
            k += 1
        if k == N:
            ans += k - 1 - j
        j += 1
    i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
# n, *a = map(int, open(0))
# M, D = map(int, input().split())
L = list(map(int, input().split()))
# S = input()
cnt = 0
import itertools
l = list(itertools.combinations(L, 2))
import numpy as np
ary = np.array(L)
for t in l:
    # if t[0] + t[1] > t[2] and t[1] + t[2] > t[0] and t[0] + t[2] > t[1]:
    cnt += np.count_nonzero(ary >= sum(t))
tot = (N * (N-1) * (N-2)) // 6
print(tot - cnt)


Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
i = 0
while i < N - 2:
    j = i + 1
    k = j + 1
    while j < N - 1:
        while k < N:
            if L[i] + L[j] <= L[k]:
                ans += k - j - 1
                break
            k += 1
        if k == N:
            ans += k - 1 - j
        j += 1
    i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

S_list = [*S]
T_list = [*T]

Correct = 0
Count = 0

for i in S_list :
    if i == T_list[Count] :
        Correct += 1
    Count += 1

print(Correct)


Fixed submission:
S = input()
T = input()

cnt = 0
for i in range(3):
  if S[i] == T[i]:
    cnt += 1
    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
cnt = 0
for i in range(N):
    s = sorted(input())
    for s_tmp in S:
        if s_tmp == s:
            cnt += 1
    S.append(s)

print(cnt)

Fixed submission:
N = int(input())
S = []
cnt = 0
for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    S.append(new_str)

# print(S)

import collections

c = collections.Counter(S)

# print(c)

ary = c.values()

import math

def combinations_count(n, r = 2):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in ary:
    if i != 1:
        cnt += combinations_count(i)


print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))
import sys
for i in range(N):
    if i > 0:
        if H[i-1] > H[i]:
            if max(H[:i]) > H[i]+1:
                print("No")
                sys.exit()
print("Yes")

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
max_H = 0
import sys
for i in range(N):
    if max_H > H[i]+1:
        print("No")
        sys.exit()
    if max_H < H[i]:
        max_H = H[i]
print("Yes")
Buggy python submission (verdict: Runtime Error):
N,D=map(int,input().split());print(-(-N//(2*D+1)))

Fixed submission:
r=int(input());print(3*r**2)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
min = 2020
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if min > (i * j) % 2019:
            min = (i * j) % 2019
        if j == L + 2020:
            break
    if i == L + 2020:
        break
print(min)

Fixed submission:
L, R = map(int, input().split())
m = 2020
import sys
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if m > (i * j) % 2019:
            m = (i * j) % 2019
        if m == 0:
            print(0)
            sys.exit()
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
min = 2020
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if min > (i * j) % 2019:
            min = (i * j) % 2019
    if i == L + 2020:
        break
print(min)

Fixed submission:
L, R = map(int, input().split())
m = 2020
import sys
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if m > (i * j) % 2019:
            m = (i * j) % 2019
        if m == 0:
            print(0)
            sys.exit()
print(m)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
max_cnt = B - A + 1
import math
lcm = int(C * D / math.gcd(C, D))
cnt_2 = int(B/C) - int((A-1)/C)
cnt_3 = int(B/D) - int((A-1)/D)
cnt_4 = int(B/lcm) - int((A-1)/lcm)
print(max_cnt - cnt_2 - cnt_3 + cnt_4)

Fixed submission:
A, B, C, D = map(int, input().split())
max_cnt = B - A + 1
import fractions
lcm = int(C * D / fractions.gcd(C, D))
cnt_2 = B//C - (A-1)//C
cnt_3 = B//D - (A-1)//D
cnt_4 = B//lcm - (A-1)//lcm
print(max_cnt - cnt_2 - cnt_3 + cnt_4)

Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
max_cnt = B - A + 1
import math
lcm = int(C * D / math.gcd(C, D))
cnt_2 = B//C - (A-1)//C
cnt_3 = B//D - (A-1)//D
cnt_4 = B//lcm - (A-1)//lcm
print(max_cnt - cnt_2 - cnt_3 + cnt_4)

Fixed submission:
A, B, C, D = map(int, input().split())
max_cnt = B - A + 1
import fractions
lcm = int(C * D / fractions.gcd(C, D))
cnt_2 = B//C - (A-1)//C
cnt_3 = B//D - (A-1)//D
cnt_4 = B//lcm - (A-1)//lcm
print(max_cnt - cnt_2 - cnt_3 + cnt_4)