Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def check(c):
    return 'WR' in c

def main():
    N = int(input())
    c = list(input())
    ans = 0
    while check(''.join(c)):
        i1 = c.index('W')
        i2 = len(c) - c[::-1].index('R') - 1
        c[i1], c[i2] = c[i2], c[i1]
        ans += 1
    print(ans)

main()


Fixed submission:
def main():
    N = int(input())
    c = list(input())
    print(c[:c.count('R')].count('W'))

main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

comfort = A[0]
wa = [A[0], A[1]]

for ni in A[2:]:
    maxc = -1
    maxi = -1
    for wi in range(len(wa)):
        c = min((wa + [wa[0]])[wi:wi+2])
        if maxc < c:
            maxc = c
            maxi = wi
    wa.insert(maxi + 1, ni)
    comfort += maxc

print(comfort)


Fixed submission:
import heapq

N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

comfort = A[0]
edges = [-A[1], -A[1]]

for ai in A[2:]:
    m = heapq.heappop(edges) * -1
    comfort += m
    heapq.heappush(edges, -ai)
    heapq.heappush(edges, -ai)
print(comfort)
Buggy python submission (verdict: Runtime Error):
int1 = lambda s: int(s)-1

N, K = map(int, input().split())
A = list(map(int1, input().split()))

X = []
visited = set()
now = 0
while now not in visited:
    visited.add(now)
    X.append(now)
    now = A[now]

if K < len(X):
    print(X[k])
else:
    s = X.index(now)
    print(X[s + ((K - s) % (len(X) - s))] + 1)


Fixed submission:
int1 = lambda s: int(s)-1

N, K = map(int, input().split())
A = list(map(int1, input().split()))

X = []
visited = set()
now = 0
while now not in visited:
    visited.add(now)
    X.append(now)
    now = A[now]

if K < len(X):
    print(X[K] + 1)
else:
    s = X.index(now)
    print(X[s + ((K - s) % (len(X) - s))] + 1)
Buggy python submission (verdict: Runtime Error):
def f(x, A, B):
    return ((A*x)//B) - A*(x // B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), -B+1):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def f(x, A, B):
    return ((A*x)//B) - A*(x // B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), min(-B+1, -1)):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def f(x, A, B):
    return ((A*x)//B) - A*(x//B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B, N), max(min(B, N)-N, -1), -1):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def f(x, A, B):
    return ((A*x)//B) - A*(x // B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), min(-B+1, -1)):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    M = 2019
    dp = [0] * M
    s = input()
    x = 0
    for c in s:
        c = int(c)
        dp2 = [0] * M
        for j in range(M):
            index = (j*10 + c) % M
            dp2[index] += dp[j]
        dp = dp2
        dp[c] += 1
        x += dp[0]
    print(x)

main()


Fixed submission:
M = 2019
dp = [0] * M
s = input()
x = 0
for c in s:
    c = int(c)
    dp2 = [0] * M
    for j in range(M):
        index = (j*10 + c) % M
        dp2[index] += dp[j]
    dp = dp2
    dp[c] += 1
    x += dp[0]
print(x)

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    M = 2019
    s = input()

    x = 0
    dp = [0] * M
    for c in s:
        c = int(c)
        dp2 = [0] * M
        for j in range(M):
            dp2[(j*10 + c) % M] += dp[j]
        dp2[c] += 1
        dp = dp2
        x += dp[0]
    print(x)

if __name__ == '__main__':
    main()


Fixed submission:
M = 2019
dp = [0] * M
s = input()
x = 0
for c in s:
    c = int(c)
    dp2 = [0] * M
    for j in range(M):
        index = (j*10 + c) % M
        dp2[index] += dp[j]
    dp = dp2
    dp[c] += 1
    x += dp[0]
print(x)

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    M = 2019
    s = input()

    x = 0
    dp = [0] * M
    for c in s:
        c = int(c)
        dp2 = [0] * M
        for j in range(M):
            dp2[(j*10 + c) % M] += dp[j]
        dp2[c] += 1
        dp = dp2
        x += dp[0]
    print(x)

main()


Fixed submission:
M = 2019
dp = [0] * M
s = input()
x = 0
for c in s:
    c = int(c)
    dp2 = [0] * M
    for j in range(M):
        index = (j*10 + c) % M
        dp2[index] += dp[j]
    dp = dp2
    dp[c] += 1
    x += dp[0]
print(x)

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    M = 2019
    s = input()

    x = 0
    dp = [0] * M
    for c in s:
        dp2 = [0] * M
        for j in range(M):
            dp2[(j*10 + int(c)) % M] += dp[j]
        dp2[int(c)] += 1
        dp = dp2
        x += dp[0]
    print(x)

main()


Fixed submission:
M = 2019
dp = [0] * M
s = input()
x = 0
for c in s:
    c = int(c)
    dp2 = [0] * M
    for j in range(M):
        index = (j*10 + c) % M
        dp2[index] += dp[j]
    dp = dp2
    dp[c] += 1
    x += dp[0]
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import random

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
        if y != n - 1 and t & 1 == 0:
            return False
    return True

def sqrt2(n):
    if is_prime(n):
        return (n, 1)
    start = round(math.sqrt(n))
    i = 0
    while True:
        if n % (start + i) == 0:
            return (start + i), n // (start + i)
        i += 1
    return (0, 0)

N = int(input())
a, b = sqrt2(N)
print(a + b - 2)


Fixed submission:
import math

def sq(n):
    for i in range(math.ceil(math.sqrt(N)), -1, -1):
        if n % i == 0:
            return (i, n//i)

N = int(input())
a, b = sq(N)
print(a + b - 2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
print(sum(i for i in range(1, n)))


Fixed submission:
n = int(input())
print(n*(n-1) // 2)
Buggy python submission (verdict: Runtime Error):
import collections

m = dict()
def f(n):
    if n <= 1:
        return 0
    else:
        if n in m:
            return m[n]
        else:
            m[n] = (n-1) + f(n-1)
            return m[n]

n = int(input())
s = [''.join(sorted(input())) for i in range(n)]

c = 0
for k, v in collections.Counter(s).items():
    if v <= 1:
        continue
    c += f(v)

print(c)


Fixed submission:
import collections

m = [0] * (10**6)
for i in range(1, len(m)):
    m[i] = m[i-1] + i

n = int(input())
s = [''.join(sorted(input())) for i in range(n)]

c = 0
for k, v in collections.Counter(s).items():
    if v <= 1:
        continue
    c += m[v-1]

print(c)

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

m = dict()
def f(n):
    if n == 0:
        return 1
    elif n in m:
        return m[n]
    else:
        m[n] = n * f(n-1)
        return m[n]

n = int(input())
s = [''.join(sorted(input())) for i in range(n)]

c = 0
for k, v in collections.Counter(s).items():
    c += (f(v) // 2)

print(c)


Fixed submission:
import collections

m = [0] * (10**6)
for i in range(1, len(m)):
    m[i] = m[i-1] + i

n = int(input())
s = [''.join(sorted(input())) for i in range(n)]

c = 0
for k, v in collections.Counter(s).items():
    if v <= 1:
        continue
    c += m[v-1]

print(c)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
a = [x+L for x in range(N)]
print(sum(a) - min(a, map(abs, a)))


Fixed submission:
N, L = map(int, input().split())
a = [x+L for x in range(N)]
print(sum(a) - min(a, key=lambda x:abs(x)))
Buggy python submission (verdict: Runtime Error):
import math

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

A, B, C, D = map(int, input().split())
B += 1

X1 = A - ((A // C) + (A // D) - (A // lcm(C, D)))
X2 = B - ((B // C) + (B // D) - (B // lcm(C, D)))
print(X2 - X1)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

A, B, C, D = map(int, input().split())
A -= 1

X1 = A - ((A // C) + (A // D) - (A // lcm(C, D)))
X2 = B - ((B // C) + (B // D) - (B // lcm(C, D)))
print(X2 - X1)
Buggy python submission (verdict: Runtime Error):
x = [int(input()) for _ in range(6)]
print(':(' if x[-2]-[0] > x[-1] else 'Yay!')

Fixed submission:
x = [int(input()) for _ in range(6)]
print(':(' if x[-2]-x[0] > x[-1] else 'Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    mod = 7 % k
    counter = 1
    memo = 1
    while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        counter += 1
        if mod == 0:
            break
    print(counter)


Fixed submission:
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    mod = 7 % k
    counter = 1
    memo = 1
    mod_map = set()
    mod_map.add(mod)
    while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
        counter += 1
        if mod == 0:
            break
    print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
n , k =map(int, input().split())
a = list(map(int, input().split()))
a_mul = [0] * n
mul = 1
for i in range(n):
    if i < k:
        mul *= a[i]
    else:
        mul = mul * a[i] // a[i - k]
    a_mul[i] = mul

for i in range(n - k):
    if a_mul[k + i - 1] < a_mul[k + i]:
        print("Yes")
    else:
        print("No") 

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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n , k =map(int, input().split())
a = list(map(int, input().split()))
a_mul = [0] * n
mul = 1
for i in range(n):
    if i < k:
        mul *= a[i]
    else:
        mul = mul * a[i] // a[i - k]
    a_mul[i] = mul

for i in range(n - k):
    if a_mul[k + i - 1] < a_mul[k + i]:
        print("Yes")
    else:
        print("No") 

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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

state_of_up_or_down = False
money = 1000
min_price = a[0]
for i in range(1, n):
    if a[i] > a[i - 1]:
        # min_price = min(a[i - 1], min_price)
        max_price = a[i]
        state_of_up_or_down = True
        if i == n - 1:
            money = (money // min_price) * max_price + money % min_price
    elif a[i] == a[i - 1]:
        if i == n - 1:
            money = (money // min_price) * max_price + money % min_price        
        pass
    else:
        if state_of_up_or_down:
            money = (money // min_price) * max_price + money % min_price
            state_of_up_or_down = False
        # max_price = a[i]
        min_price = a[i]
    # print(money, min_price, state_of_up_or_down)
print(money)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
money  = 1000
stock = 0
min_price = a[0]
max_price = a[0]
is_first_time_of_drop = False
for i in range(1, n):
    if a[i] > max_price:
        max_price = a[i]
        is_first_time_of_drop = True
        if i == n - 1:
            money = (money // min_price) * max_price + money % min_price
    elif a[i] == max_price:
        if i == n - 1:
            money = (money // min_price) * max_price + money % min_price
        continue
    else:
        if is_first_time_of_drop:
            money = (money // min_price) * max_price + money % min_price
            min_price = a[i]
            max_price = a[i]
            is_first_time_of_drop = False
        else:
            if a[i] < min_price:
                min_price = a[i]
                max_price = a[i]
            elif a[i] == min_price:
                continue
            else:
                is_first_time_of_drop = True
print(money)
Buggy python submission (verdict: Time Limit Exceeded):
#再思考
n, m ,k = map(int, input(). split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum = [0] * (n + 1)
b_sum = [0] * (m + 1)
for i in range(n):
    a_sum[i + 1] = a_sum[i] + a[i]
for i in range(m):
    b_sum[i + 1] = b_sum[i] + b[i]
res = 0
for i in range(n+1):
    for j in range(m+1):
        if a_sum[i] + b_sum[j] <= k:
            res = max(res, i + j)
        else:
            break
print(res)

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

a_num = 0
b_num = 0
book_num = 0
passed_k = 0
for i in range(n):
    if a[i] + passed_k <= k:
        a_num += 1
        passed_k += a[i]
    else:
        break
for i in range(m):
    if b[i] + passed_k <= k:
        b_num += 1
        passed_k += b[i]
    else:
        break
book_num = a_num + b_num

while a_num > 0:
    passed_k -= a[a_num - 1]
    a_num -= 1
    while b_num < m:
        if passed_k + b[b_num] <= k:
            passed_k += b[b_num]
            b_num += 1
        else:
            break
    book_num = max(book_num, a_num + b_num)
    if b_num == m:
        break

print(book_num)

Buggy python submission (verdict: Time Limit Exceeded):
#再思考
n, m ,k = map(int, input(). split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum = [0] * (n + 1)
b_sum = [0] * (m + 1)
for i in range(n):
    a_sum[i + 1] = a_sum[i] + a[i]
for i in range(m):
    b_sum[i + 1] = b_sum[i] + b[i]
res = 0
for i in range(n+1):
    for j in range(m+1):
        if a_sum[i] + b_sum[j] <= k:
            res = max(res, i + j)
        else:
            break
print(res)

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

a_num = 0
b_num = 0
book_num = 0
passed_k = 0
for i in range(n):
    if a[i] + passed_k <= k:
        a_num += 1
        passed_k += a[i]
    else:
        break
for i in range(m):
    if b[i] + passed_k <= k:
        b_num += 1
        passed_k += b[i]
    else:
        break
book_num = a_num + b_num

while a_num > 0:
    passed_k -= a[a_num - 1]
    a_num -= 1
    while b_num < m:
        if passed_k + b[b_num] <= k:
            passed_k += b[b_num]
            b_num += 1
        else:
            break
    book_num = max(book_num, a_num + b_num)
    if b_num == m:
        break

print(book_num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
res = 0
for i in range(1, n+1):
    res += (int(n / i) * (i + int(n / i) * i)) // 2
print(res)

Fixed submission:
n = int(input())
res = 0
for i in range(1, n+1):
    res += (int(n / i) * (i + int(n / i) * i)) // 2
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
num=list(map(int,input().split()))

sum=1
for i in range(n):
    sum*=num[i]
    if sum==0:
        print(0)
        break
else:
    if sum>10**18:
        print(-1)
    else:
        print(sum)

Fixed submission:
n=int(input())
num=list(map(int,input().split()))

sum=1
if 0 in num:
    print(0)
else:
    for i in range(n):
        sum*=num[i]
        if sum>10**18:
            print(-1)
            break
    else:
        print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
res=0
x=n
for x in range(min(b,n+1)):
    res=max(res,int(a*x/b)-a*int(x/b))
print(res)


Fixed submission:
a,b,n=map(int,input().split())
x=min(b-1,n)
max_res=int(a*x/b)-a*int(x/b)
print(max_res)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
res=0
x=n
for x in range(min(b,n+1)):
    res=max(res,int(a*x/b)-a*int(x/b))
print(res)

Fixed submission:
a,b,n=map(int,input().split())
x=min(b-1,n)
max_res=int(a*x/b)-a*int(x/b)
print(max_res)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
counter=0
for i in range(1,a+1):
    for j in range(i,a+1):
        for k in range(j,a+1):
            if i==j and j==k:
                times=1
            elif i!=j and j!=k and k!=i:
                times=6 
            else:
                times=3
            
            for l in range(i,0,-1): 
                if i%l==0 and j%l==0 and k%l==0:
                    counter+=(l*times)
                    break
print(counter)

Fixed submission:
import math
a=int(input())
counter=0
for i in range(1,a+1):
    for j in range(1,a+1):
        tmp=math.gcd(i,j)
        for k in range(1,a+1):
            counter+=math.gcd(tmp,k)
print(counter)
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=[int(i) for i in input().split()]
array=[a[n-1]-a[0]]
array.append(result)
for i in range(1,n):
  array.append(k+a[i-1]-a[i])
print(min(array))


Fixed submission:
k,n=map(int,input().split())
a=[int(i) for i in input().split()]
array=[]
result=a[n-1]-a[0]
array.append(result)
for i in range(1,n):
    result=k+a[i-1]-a[i]
    array.append(result)
print(min(array))

Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=[int(i) for i in input().split()]
array=[a[n-1]-a[0]]
array.append(result)
for i in range(1,n):
    array.append(k+a[i-1]-a[i])
print(min(array))

Fixed submission:
k,n=map(int,input().split())
a=[int(i) for i in input().split()]
array=[]
result=a[n-1]-a[0]
array.append(result)
for i in range(1,n):
    result=k+a[i-1]-a[i]
    array.append(result)
print(min(array))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,x,y=map(int,input().split())
array=[]
array=np.array(array)
for i in range(1,n):
    for j in range(i+1,n+1):
        array=np.append(array,(min(abs(j-i),abs(x-j)+1+abs(y-i),abs(y-j)+1+abs(x-i))))
#array=np.array(array)
for i in range(1,n):
    print(np.sum(array==i))

Fixed submission:
n,x,y=map(int,input().split())
#array=[0 for i in range(n)]
array=[None]*n
for i in range(n):
    array[i]=0
for i in range(1,n):
    for j in range(i+1,n+1):
        res=min(abs(j-i),abs(x-j)+1+abs(y-i),abs(y-j)+1+abs(x-i))
        array[res]+=1
for i in range(1,n):
    print(array[i])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,x,y=map(int,input().split())
array=[]
for i in range(1,n):
    for j in range(i+1,n+1):
        array.append(min(abs(j-i),abs(x-j)+1+abs(y-i),abs(y-j)+1+abs(x-i)))
array=np.array(array)
for i in range(1,n):
    print(np.sum(array==i))


Fixed submission:
n,x,y=map(int,input().split())
#array=[0 for i in range(n)]
array=[None]*n
for i in range(n):
    array[i]=0
for i in range(1,n):
    for j in range(i+1,n+1):
        res=min(abs(j-i),abs(x-j)+1+abs(y-i),abs(y-j)+1+abs(x-i))
        array[res]+=1
for i in range(1,n):
    print(array[i])
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
num=[int(i) for i in input().split()]
num_dict={}
for i in num:
    if i not in num_dict:
        num_dict[i]=1
    else:
        num_dict[i]+=1
for i in range(a):
    counter=0
    tmp=num_dict[num[i]]-1
    for key,value in num_dict.items():
        if key==num[i]:
            value=tmp
        if value>=2:
            counter+=int(value*(value-1)/2)
    print(counter)

Fixed submission:
a=int(input())
num=[int(i) for i in input().split()]
num_dict={}
num_min1_dict={}
sum_num=0
for i in num:
    if i not in num_dict:
        num_dict[i]=1
    else:
        num_dict[i]+=1

num_to_sum_dict={}
for key, value in num_dict.items():
    sum_num+=value*(value-1)/2

for key,value in num_dict.items():
    tmp=sum_num-value*(value-1)/2+(value-1)*(value-2)/2
    num_to_sum_dict[key]=tmp

for i in range(a):
    print(int(num_to_sum_dict[num[i]]))
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import *
import math
getcontext().prec=100000
a,b,c=map(int,input().split())
if Decimal(a).sqrt()+Decimal(b).sqrt()<Decimal(c).sqrt():
  print("Yes")
else:
  print("No")


Fixed submission:
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if a+b+2*Decimal(math.sqrt(a))*Demical(math.sqrt(b))<c:
  print("Yes")
else:
  print("No")


Fixed submission:
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if Demical(str(a))+Demical(str(b))+Decimal(str(2*math.sqrt(a*b)))<Demical(str(c)):
  print("Yes")
else:
  print("No")


Fixed submission:
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if Demical(a)+Demical(b)+Decimal(2*math.sqrt(a*b))<Demical(c):
  print("Yes")
else:
  print("No")


Fixed submission:
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=sorted(moji)
for i in moji:
    print(i)

Fixed submission:
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
# moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=[]
j=max(a_dict.values())
for i,k in a_dict.items():
    if k==j:
        moji.append(i)
moji=sorted(moji)
for i in moji:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=sorted(moji)
for i in moji:
    print(i)

Fixed submission:
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
# moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=[]
j=max(a_dict.values())
for i,k in a_dict.items():
    if k==j:
        moji.append(i)
moji=sorted(moji)
for i in moji:
    print(i)