Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, m, r = read_line(int, int, int)

rs = [int(r) for r in input().split()]

cities = Counter()

routes = {}
costs = {}
for _ in range(m):
    a, b, c = read_line(int, int, int)

    cities[a] = 1
    cities[b] = 1

    if a in routes:
        routes[a][b] = c
    else:
        routes[a] = { b : c }

    if b in routes:
        routes[b][a] = c
    else:
        routes[b] = { a : c }

for a in cities.keys():
    for b in cities.keys():
        if a not in costs:
            costs[a] = {}
        if b not in costs[a]:
            if a in routes and b in routes[a]:
                costs[a][b] = routes[a][b]
            else:
                costs[a][b] = 100000 + 1

# print('*')

keys = list(cities.keys())

for k in keys:
    for i in keys:
        for j in keys:
            c = costs[a][k] + costs[k][b]
            if a != b and costs[a][b] > c:
                costs[a][b] = c

# print('*')

def cost(selected):
    c = 0
    for i in range(len(selected) - 1):
        a = selected[i]
        b = selected[i + 1]
        c += costs[a][b]
    return c

smallest = 100000 + 1

def f(selected, rest):
    global smallest
    if len(rest) == 0:
        c = cost(selected)
        if smallest > c:
            smallest = c
    else:
        for i in range(len(rest)):
            r = rest[i]
            rest_copy = rest[:]
            del rest_copy[i]
            if cost(selected + [r]) < smallest:
                f(selected + [r], rest_copy)

f([], keys)
print(smallest)


Fixed submission:
n = input()

if n[0] == '9' or n[1] == '9':
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    ss = s[0:i]
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)


Fixed submission:
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 1

for i in range(1, len(s)):
    ss = s[0:i]
    # print(ss, s[i])

    n = i - ss.count(s[i])
    count += n
    # print(n, count)

print(count)


Fixed submission:
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 1

for i in range(1, len(s)):
    ss = s[0:i]
    # print(ss, s[i])

    n = len(ss) - ss.count(s[i])
    count += n
    # print(n, count)
print(count)


Fixed submission:
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)

Buggy python submission (verdict: Runtime Error):
s = input()

count = 1

for i in range(1, len(s)):
    ss = s[0:i]
    # print(ss, s[i])

    n = len(ss) - ss.count(s[i])
    count += n
    # print(n, count)
print(n)


Fixed submission:
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)
Buggy python submission (verdict: Runtime Error):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n,  = read_line(int)

m = 1000000007

domino = []
domino.append(input())
domino.append(input())

# print(domino[0])
# print(domino[1])

def compress(line):
    x = [line[0]]
    for c in line[1:]:
        if x[-1] != c:
            x.append(c)
    return x

domino[0] = compress(domino[0])
domino[1] = compress(domino[1])

xs = []
for i in range(len(domino[0])):
    xs.append(domino[0][i] != domino[1][i])
# print(xs)

patterns = None
if xs[0]:
    patterns = 6
else:
    patterns = 3

lastX = xs[0]
for x in xs[1:]:
    if x:
        # T -> T
        if lastX:
            patterns *= 3
        else:
            # F -> T
            patterns *= 2
    else:
        # T -> F
        if lastX:
            patterns *= 1
        else: # F -> F
            patterns *= 2
    lastX = x

print(patterns % m)

# T -> T

# 6 * 4 = 24

# 0|1120
# 1|2002

# 0
# 2

# 1
# 0

# 1
# 2

# 2
# 0

# 2
# 1


# F -> T

# 3 * 2 = 6

# 0|12
# 0|21
# 
# 1|02
# 1|20
# 
# 2|10
# 2|01


# T -> F

# 6 * 1 = 6

# 0|2
# 1|2

# 0|1
# 2|1

# 1|2
# 0|2

# 1|0
# 2|0

# 2|1
# 0|1

# 2|0
# 1|0

# F -> F

# 3 * 2 = 6

# 0 | 12
# 1 | 02
# 2 | 01


Fixed submission:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

x, a, b = read_line(int, int, int)

print('A' if abs(x - a) < abs(x - b) else 'B')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num_list = [(i-1) + (N//i-1) for i in range(1, N+1) if N%i == 0]
print(min(num_list))

Fixed submission:
N = int(input())
num_list = [(i-1) + (N//i-1) for i in range(1, int(N**0.5+1)) if N%i == 0]
print(min(num_list))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(x) for x in input().split()]

for i in range(m):
    x = max(a)
    i = a.index(x)
    x_b = x//2
    a[i] = x_b

print(sum(a))

Fixed submission:
import heapq
import math

n, m = map(int, input().split())
a = [-1*int(x) for x in input().split()]
heapq.heapify(a)
 
for _ in range(m):
    min_a = heapq.heappop(a)
    heapq.heappush(a, math.ceil(min_a / 2))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(x) for x in input().split()]

def discount(items):
    x = max(items)
    i = items.index(x)
    x_b = x//2
    items[i] = x_b
    return items

for i in range(m):
    a = discount(a)

print(sum(a))

Fixed submission:
import heapq
import math

n, m = map(int, input().split())
a = [-1*int(x) for x in input().split()]
heapq.heapify(a)
 
for _ in range(m):
    min_a = heapq.heappop(a)
    heapq.heappush(a, math.ceil(min_a / 2))
    
print(sum(a)*(-1))
Buggy python submission (verdict: Runtime Error):
l, r = [int(x) for x in input().split()]

remainder_list = []

if r - l >= 2019:
  print(0)
else :
  for x in range(l, r):
    remainder_list.append((l * (x + 1)) % 2019)

remainder_list.sort()
print(remainder_list[0])

Fixed submission:
import sys

l, r = [int(x) for x in input().split()]

remainder_list = []

if r - l >= 2019:
    print(0)
    sys.exit()
else :
    for x in range(l, r):
        for y in range(x + 1, r + 1):
            remainder_list.append((x * y) % 2019)

remainder_list.sort()
print(remainder_list[0])

Buggy python submission (verdict: Runtime Error):
l, r = [int(x) for x in input().split()]

remainder_list = []

if r - l >= 2019:
	print(0)
else :
	for x in range(l, r):
    	remainder_list.append((l * (x + 1)) % 2019)

remainder_list.sort()
print(remainder_list[0])
    	

Fixed submission:
import sys

l, r = [int(x) for x in input().split()]

remainder_list = []

if r - l >= 2019:
    print(0)
    sys.exit()
else :
    for x in range(l, r):
        for y in range(x + 1, r + 1):
            remainder_list.append((x * y) % 2019)

remainder_list.sort()
print(remainder_list[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [int(x) for x in input().split()]
d.sort()
print(d[int(n / 2) + 1] - d[int(n / 2)])

Fixed submission:
n = int(input())
d = [int(x) for x in input().split()]
d.sort()
print(d[int(n/2)] - d[int(n/2)-1])
Buggy python submission (verdict: Runtime Error):
import math ##the version before 3.4 : import fractions

d = [int(x) for x in input().split()]
print(d[1] - d[0] + 1 - (int(d[1] // d[2]) - int((d[0] - 1) // d[2]) + int(d[1] // d[3]) - int((d[0] - 1) // d[3]) - int(d[1] // (d[2] * d[3] // math.gcd(d[2], d[3]))) - int((d[0] - 1) // (d[2] * d[3]// math.gcd(d[2], d[3])))))


Fixed submission:
import fractions

d = [int(x) for x in input().split()]
lcm = int(d[2] * d[3] // fractions.gcd(d[2], d[3]))
b = d[1] - int(d[1] // d[2]) - int(d[1] // d[3]) + int(d[1] // lcm)
a_1 = d[0] - 1
a = a_1 - int(a_1 // d[2]) - int(a_1 // d[3]) + int(a_1 // lcm)
print(b - a)

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

d = [int(x) for x in input().split()]
print(d[1] - d[0] + 1 - (int(d[1] / d[2]) - int((d[0] - 1) / d[2]) + int(d[1] / d[3]) - int((d[0] - 1) / d[3]) - int(d[1] / (d[2] * d[3] / fraction.gcd(d[2], d[3]))) - int((d[0] - 1) / (d[2] * d[3]/ fraction.gcd(d[2], d[3])))))


Fixed submission:
import fractions

d = [int(x) for x in input().split()]
lcm = int(d[2] * d[3] // fractions.gcd(d[2], d[3]))
b = d[1] - int(d[1] // d[2]) - int(d[1] // d[3]) + int(d[1] // lcm)
a_1 = d[0] - 1
a = a_1 - int(a_1 // d[2]) - int(a_1 // d[3]) + int(a_1 // lcm)
print(b - a)

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

d = [int(x) for x in input().split()]
print(d[1] - d[0] + 1 - (int(d[1] / d[2]) - int((d[0] - 1) / d[2]) + int(d[1] / d[3]) - int((d[0] - 1) / d[3]) - int(d[1] / (d[2] * d[3] / math.gcd(d[2], d[3]))) - int((d[0] - 1) / (d[2] * d[3]/ math.gcd(d[2], d[3])))))


Fixed submission:
import fractions

d = [int(x) for x in input().split()]
lcm = int(d[2] * d[3] // fractions.gcd(d[2], d[3]))
b = d[1] - int(d[1] // d[2]) - int(d[1] // d[3]) + int(d[1] // lcm)
a_1 = d[0] - 1
a = a_1 - int(a_1 // d[2]) - int(a_1 // d[3]) + int(a_1 // lcm)
print(b - a)

Buggy python submission (verdict: Time Limit Exceeded):
d = [int(x) for x in input().split()]
count = 0
for y in range(d[0], d[1] + 1):
  if y % d[2] != 0 and y % d[3] != 0:
    count += 1
   
print(count)

Fixed submission:
import fractions

d = [int(x) for x in input().split()]
lcm = int(d[2] * d[3] // fractions.gcd(d[2], d[3]))
b = d[1] - int(d[1] // d[2]) - int(d[1] // d[3]) + int(d[1] // lcm)
a_1 = d[0] - 1
a = a_1 - int(a_1 // d[2]) - int(a_1 // d[3]) + int(a_1 // lcm)
print(b - a)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(x) for x in input().split()]
id_range = []
id_card = [0] * n

for x in range(m):
    id_range.append([int(y) for y in input().split()])

for x in range(m):
    for y in range(id_range[x][0], id_range[x][1] + 1):
        id_card[y - 1] += 1

id_card.sort()
cnt = 0
for x in id_card:
    if(x == m):
        cnt += 1

print(cnt)


Fixed submission:
n, m = [int(x) for x in input().split()]
min_num = 0
max_num = n

for x in range(m):
    tmp_min, tmp_max = map(int, input().split())
    min_num = max(min_num, tmp_min)
    max_num = min(max_num, tmp_max)

if max_num - min_num + 1 > 0:
    print(max_num - min_num + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
def solve_dp(p):
    while p < N:
        if p < N - 1:
            if dp[p+1] > (abs(h[p] - h[p+1]) + dp[p]):
                dp[p+1] = abs(h[p] - h[p+1]) + dp[p]

        if p < N - 2:
            if dp[p+2] > (abs(h[p] - h[p+2]) + dp[p]):
                dp[p+2] = abs(h[p] - h[p+2]) + dp[p]

        print(dp)
        p += 1

N = int(input())
h = [int(x) for x in input().split()]
dp = [100000000] * (N + 1)
dp[0] = 0
solve_dp(0)
print(dp[N-1])


Fixed submission:
def solve_dp(p):
    i = 0
    while i < N:
        if p == 0:
            dp[0] = 0
        elif p == 1:
            dp[1] = abs(h[1] - h[0])
        elif p >= 2 and p <= N - 1:
            if abs(h[p] - h[p-1]) + dp[p-1] > abs(h[p] - h[p-2]) + dp[p-2]:
                dp[p] = abs(h[p] - h[p-2]) + dp[p-2]
            else:
                dp[p] = abs(h[p] - h[p-1]) + dp[p-1]
        else:
            return

        p += 1
        i += 1

N = int(input())
h = [int(x) for x in input().split()]

dp = [0] * N
solve_dp(0)

print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
def solve_dp(p):
    if p == 0:
        dp[0] = 0
    elif p == 1:
        dp[1] = abs(h[1] - h[0])
    elif p >= 2 and p <= N - 1:
        if abs(h[p] - h[p-1]) > abs(h[p] - h[p-2]):
            dp[p] = abs(h[p] - h[p-2]) + dp[p-2]
        else:
            dp[p] = abs(h[p] - h[p-1]) + dp[p-1]
    else:
        return

    p += 1
    solve_dp(p)

N = int(input())
h = [int(x) for x in input().split()]

dp = [0] * N
solve_dp(0)

print(dp[N-1])


Fixed submission:
def solve_dp(p):
    i = 0
    while i < N:
        if p == 0:
            dp[0] = 0
        elif p == 1:
            dp[1] = abs(h[1] - h[0])
        elif p >= 2 and p <= N - 1:
            if abs(h[p] - h[p-1]) + dp[p-1] > abs(h[p] - h[p-2]) + dp[p-2]:
                dp[p] = abs(h[p] - h[p-2]) + dp[p-2]
            else:
                dp[p] = abs(h[p] - h[p-1]) + dp[p-1]
        else:
            return

        p += 1
        i += 1

N = int(input())
h = [int(x) for x in input().split()]

dp = [0] * N
solve_dp(0)

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)


Fixed submission:
import fractions
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)


Fixed submission:
import fractions
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
ans = 10^12
for a in range(int(np.sqrt(N))):
  if N % a != 0:
    continue
  step = a + N/a -2
  if step < ans:
    ans = step
    
print(str(ans))

Fixed submission:
import numpy as np
 
N = int(input())
ans = 10**12
for i in range(int(np.sqrt(N)+0.5)):
  a = i+1
  if N % a != 0:
    continue
  step = a + int(N/a) -2
  if step < ans:
    ans = step
print(ans)
Buggy python submission (verdict: Runtime Error):
num = int(input())
lens = [int(a) for a in input().split(' ')]
max_len = max(len)
lens.remove(max_len)
sum_lens = sum(lens)

if max_len < sum_lens:
  print('Yes')
else:
  print('No')  

Fixed submission:
num = int(input())
lens = [int(a) for a in input().split(' ')]
max_len = max(lens)
lens.remove(max_len)
sum_lens = sum(lens)
 
if max_len < sum_lens:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys

koma_num, goal_num = [int(a) for a in input().split(' ')]

if koma_num >= goal_num:
  print(0)
  sys.exit()

goals = [int(a) for a in input().split(' ')]
goals.sort()
dist_diff = [int(goals[i+1] - goals[i]) for i in range(len(goals)-1)]

for i in range(koma_num-1):
  max_dist = max(dist_diff)
  dist_diff.remove(max_dist)

print(sum(dist_diff))

Fixed submission:
import sys

koma_num, goal_num = [int(a) for a in input().split(' ')]

if koma_num >= goal_num:
  print(0)
  sys.exit()

goals = [int(a) for a in input().split(' ')]
goals.sort()
dist_diff = [int(goals[i+1] - goals[i]) for i in range(len(goals)-1)]
dist_diff.sort()
ans_num = goal_num - koma_num
print(sum(dist_diff[:ans_num]))
Buggy python submission (verdict: Runtime Error):
import sys


if __name__ == '__main__':
    # a not yum, bc yum
    a = int(sys.argv[1])
    b = int(sys.argv[2])
    c = int(sys.argv[3])

    if (a+b) >= c:
        print(b+c)
    else:
        print(a+b+1+b)


Fixed submission:
import sys


if __name__ == '__main__':
    # a not yum, bc yum
    a, b, c = [int(i) for i in input().split()]

    if (a+b) >= c:
        print(b+c)
    else:
        print(a+b+1+b)

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

# a not yum, bc yum
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])

if (a+b) >= c:
    return(b+c)
else:
    return(a+b+1+b)


Fixed submission:
import sys


if __name__ == '__main__':
    # a not yum, bc yum
    a, b, c = [int(i) for i in input().split()]

    if (a+b) >= c:
        print(b+c)
    else:
        print(a+b+1+b)

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

# a not yum, bc yum
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])

if (a+b) >= c:
    print(b+c)
else:
    print(a+b+1+b)

Fixed submission:
import sys


if __name__ == '__main__':
    # a not yum, bc yum
    a, b, c = [int(i) for i in input().split()]

    if (a+b) >= c:
        print(b+c)
    else:
        print(a+b+1+b)
Buggy python submission (verdict: Runtime Error):
s = input()

if s%2 == 0:
  a = s/2
  b = s/2
else:
  a = s/2
  b = s/2+1

print(a*b)


Fixed submission:
import math

s = int(input())

print(math.ceil(s/2)*math.floor(s/2))

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

s = input()

print(math.ceil(s/2)*math.floor(s/2))

Fixed submission:
import math

s = int(input())

print(math.ceil(s/2)*math.floor(s/2))

Buggy python submission (verdict: Runtime Error):
import math
s = input()
return math.floor(s/2)*math.ceil(s/2)

Fixed submission:
import math

s = int(input())

print(math.ceil(s/2)*math.floor(s/2))
Buggy python submission (verdict: Runtime Error):
l = raw_input().split()

x1 = int(l[0])
y1 = int(l[1])
x2 = int(l[2])
y2 = int(l[3])

a = max(abs(x1-x2), abs(y1-y2))

if x1 < x2:
  x3 = x2
  y3 = y1 + a
  x4 = x1
  y4 = y1 + a
elif x1 == x2:
  if y1 > y2:
    x3 = x2 + a
    y3 = y2
    x4 = x2 + a
    y4 = y1
  else:
    x3 = x2 - a
    y3 = y2
    x4 = x2 - a
    y4 = y1
elif x1 > x2:
  x3 = x2
  y3 = y1 - a
  x4 = x1
  y4 = y1 - a
  
print(str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4))

Fixed submission:
import math
l = input().split()

x1 = int(l[0])
y1 = int(l[1])
x2 = int(l[2])
y2 = int(l[3])

yoko = x2-x1
tate = y2-y1

x3 = x2 - tate
y3 = y2 + yoko
x4 = x1 - tate
y4 = y1 + yoko

  
print(str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(str(input()))
countlist=[]
for i in range(1,N-1):
    s1 = set(S[0:i])
    s2 = set(S[i:])

    matched_list=list(s1 & s2)
    countlist.append(len(matched_list))

ans = max(countlist)
print(ans)

Fixed submission:
N = int(input())
S = list(str(input()))
countlist=[]
for i in range(0,N):
    s1 = set(S[:i])
    s2 = set(S[i:])

    matched_list=list(s1 & s2)
    countlist.append(len(matched_list))

ans = max(countlist)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(str(input()))
countlist=[]
if N % 2 == 0:
    split = N / 2
    odd = False
else:
    split = N / 2 + 1
    odd = True
for i in range(1,N-1):
    s1 = set(S[0:i])
    s2 = set(S[i:])
    
    matched_list=list(s1 & s2)
    countlist.append(len(matched_list))

ans = sorted(countlist,reverse=True)


print(ans[0])

Fixed submission:
N = int(input())
S = list(str(input()))
countlist=[]
for i in range(0,N):
    s1 = set(S[:i])
    s2 = set(S[i:])

    matched_list=list(s1 & s2)
    countlist.append(len(matched_list))

ans = max(countlist)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(str(input()))
countlist=[]
anslist =[]
if N % 2 == 0:
    split = N / 2
    odd = False
else:
    split = N / 2 + 1
    odd = True
for i in range(1,N-1):
    if i > split:
        check = 0
    else:
        check = 1
    s1 = list(set(S[0:i]))
    s2 = list(set(S[i:]))
   # print(s1)
   # print(s2)
    if check == 0:
        for j in s2:
            if j not in s1:
                s2.remove(j)
    else:
        for j in s1:
            if j not in s2:
                s1.remove(j)
    if(check == 0):
        countlist.append(len(s2))
    else:
        countlist.append(len(s1))

ans = sorted(countlist,reverse=True)


print(ans[0])

Fixed submission:
N = int(input())
S = list(str(input()))
countlist=[]
for i in range(0,N):
    s1 = set(S[:i])
    s2 = set(S[i:])

    matched_list=list(s1 & s2)
    countlist.append(len(matched_list))

ans = max(countlist)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
arr = [list(input()) for i in range(N)]
newmat = [[0 for i in range(M)] for j in range(N)]
nocheck = 0
count = 0
for i in range(N):
    for j in range(M):
        if arr[i][j] is '#':
            newmat[i][j] = 1
        else:
            newmat[i][j] = 0

for i in range(N):
    for j in range(M):
        if newmat[i][j] == 1:
            count += 1
            if i == 0 and j == 0:
                if newmat[i][j+1] == 0 and newmat[i+1][j] == 0:
                    nocheck = 1
                    break
            elif i == 0 and j == (M-1):
                if newmat[i][j-1] == 0 and newmat[i+1][j] == 0:
                    nocheck = 1
                    break
            elif i == (N-1) and j == 0:
                if newmat[i][j+1] == 0 and newmat[i-1][j] == 0:
                    nocheck = 1
                    break
            elif i == (N-1) and j == (M-1):
                if newmat[i][j-1] == 0 and newmat[i-1][j] == 0:
                    nocheck = 1
                    break
            elif i == 0 and j != 0:
                if newmat[i][j+1] == 0 and newmat[i+1][j] == 0 and newmat[i][j-1] == 0:
                    nocheck = 1
                    break
            elif i != 0 and j == 0:
                if newmat[i][j + 1] == 0 and newmat[i + 1][j] == 0 and newmat[i-1][j] == 0:
                    nocheck = 1
                    break
            elif i == (N-1) and j != (M-1):
                if newmat[i][j+1] == 0 and newmat[i-1][j] == 0 and newmat[i][j-1] == 0:
                    nocheck = 1
                    break
            elif i != (N-1) and j == (M-1):
                if newmat[i-1][j] == 0 and newmat[i+1][j] == 0 and newmat[i][j-1] == 0:
                    nocheck = 1
                    break

            else:
                if newmat[i][j + 1] == 0 and newmat[i + 1][j] == 0 and newmat[i][j - 1] == 0 and newmat[i-1][j]:
                    nocheck = 1

if(nocheck == 0 and count != 1):
    print("Yes")
else:
    print("No")



Fixed submission:
a,b = list(map(int,input().split()))
cnt = 0
for m in range(1,a+1):
    if m == a:
        last = b
    else:
        last = 31
    for d in range(1,last+1):
        if m == d :
            cnt += 1
            #print(m,d)

print(cnt)