Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
mae = 1
for i in range(k):
    mae *= a[i]
#print(mae)
for j in range(k,n):
    #print(a[j-k],a[j])
    if mae < (mae // a[j-k]) * a[j]:
        print('Yes')
    else:
        print('No')
    mae = (mae // a[j-k]) * a[j]

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
for j in range(k,n):
    if a[j-k] < a[j]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    ans = 0
    x,y = map(int,input().split())
    for j in range(n):
        if a[j] == x:
            a[j] = y
        ans += a[j]
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
tmp = [0] * 100001
ans = 0
for i in range(n):
    tmp[a[i]] += 1
    ans += a[i]
q = int(input())
for i in range(q):
    x,y = map(int,input().split())
    ans -= x * tmp[x]
    ans += y * tmp[x]
    tmp[y] += tmp[x]
    tmp[x] = 0
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    x,y = map(int,input().split())
    for j in range(n):
        if a[j] == x:
            a[j] = y
    print(sum(a))


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
tmp = [0] * 100001
ans = 0
for i in range(n):
    tmp[a[i]] += 1
    ans += a[i]
q = int(input())
for i in range(q):
    x,y = map(int,input().split())
    ans -= x * tmp[x]
    ans += y * tmp[x]
    tmp[y] += tmp[x]
    tmp[x] = 0
    print(ans)
Buggy python submission (verdict: Runtime Error):
x = map(int,input().split())
for i in range(len(x)):
  if x[i] == 0:
    print(i+1)
    

Fixed submission:
x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
ans = [int(i) for i in range(n+1)]
ans[1] = 0
i = 2
sosu = []
while i <= int(math.sqrt(n)):
    if ans[i] != 0:
        j = i
        sosu.append(i)
        for j in range(j,(n//j)+1):
            ans[i*j] = 0
    i += 1
f = []
tmp = n
for i in range(len(sosu)):
    if tmp%sosu[i]==0:
        cnt = 0
        while tmp%sosu[i]==0:
            cnt += 1
            tmp = tmp//sosu[i]
        f.append([sosu[i],cnt])
if tmp != 1:
    f.append([tmp,1])
count = 0
for i in range(len(f)):
    j = 1
    while j <= f[i][1]:
        n = n//(f[i][0]*j)
        f[i][1] -= j
        count += 1
        j += 1
#print(f)
print(count)


Fixed submission:
import collections

#https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def f(n):
    for i in range(1,20):
        if n<(i*(i+1))//2:
            return i-1

n = int(input())
c = collections.Counter(prime_factorize(n))
ans = 0
for i in c.keys():
    ans += f(c[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + list(map(int,input().split()))
ans = 0
for i in range(1,n):
    for j in range(i+1,n+1):
        if abs(i-j)==a[i]+a[j]:
            ans += 1
print(ans)

Fixed submission:
import collections
n = int(input())
a = [0] + list(map(int,input().split()))

a_pos = [a[i]+i for i in range(1,n+1)]
a_neg = [-a[i]+i for i in range(1,n+1)]
#print(a_pos)
#print(a_neg)

c_pos = collections.Counter(a_pos)
c_neg = collections.Counter(a_neg)
#print(c_pos)
#print(c_neg)

ans = 0
for c in c_pos:
    ans += c_pos[c] * c_neg[c]

print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
a,b = map(int,input().split())
ans = 0
for i in range(a//k,b//k+1):
  if a <= k * i <= b:
    ans = 1
if ans = 1:
  print('OK')
else:
  print('NG')

Fixed submission:
k = int(input())
a,b = map(int,input().split())
ans = 0
for i in range(a//k,b//k+1):
  if a <= k * i <= b:
    ans = 1
if ans == 1:
  print('OK')
else:
  print('NG')
Buggy python submission (verdict: Runtime Error):
s,w = map(int,input())
if s < w:
  print('unsafe')
else:
  print('safe')

Fixed submission:
s,w = map(int,input().split())
if s <= w:
  print('unsafe')
else:
  print('safe')

Buggy python submission (verdict: Runtime Error):
s,w = int(input())
if s < w:
  print('unsafe')
else:
  print('safe')

Fixed submission:
s,w = map(int,input().split())
if s <= w:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a == b and b == c and C == a:
    print('No')
elif a != b and b != c and C != a:
    print('No')
else:
    print('Yes')


Fixed submission:
a,b,c = map(int,input().split())
if a == b and b == c and c == a:
    print('No')
elif a != b and b != c and c != a:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
memo = [0] * 100000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))


Fixed submission:
#memo = [0] * 100000000
#memo[1] = 1

def saiki(n):
#    global memo
    tmp = 0
    if n <= 1:
        return 1
#        return memo[1]
    else:
        tmp = int(n/2)
        return saiki(tmp) * 2 + 1
#        if memo[tmp] == 0:
#            memo[tmp] = saiki(tmp)
#        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))

Buggy python submission (verdict: Runtime Error):
memo = [0] * 1000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))


Fixed submission:
#memo = [0] * 100000000
#memo[1] = 1

def saiki(n):
#    global memo
    tmp = 0
    if n <= 1:
        return 1
#        return memo[1]
    else:
        tmp = int(n/2)
        return saiki(tmp) * 2 + 1
#        if memo[tmp] == 0:
#            memo[tmp] = saiki(tmp)
#        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))

Buggy python submission (verdict: Runtime Error):
memo = [0] * 1000000000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))


Fixed submission:
#memo = [0] * 100000000
#memo[1] = 1

def saiki(n):
#    global memo
    tmp = 0
    if n <= 1:
        return 1
#        return memo[1]
    else:
        tmp = int(n/2)
        return saiki(tmp) * 2 + 1
#        if memo[tmp] == 0:
#            memo[tmp] = saiki(tmp)
#        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
ans = 0
for key in range(n):
    cnt = True
    for i in range(key+1):
        if p[i]<p[key]:
            cnt = False
    if cnt:
        ans += 1
print(ans)


Fixed submission:
n = int(input())
p = list(map(int,input().split()))
#ans = 0
#for key in range(n):
#    cnt = True
#    for i in range(key+1):
#        if p[i]<p[key]:
#            cnt = False
#    if cnt:
#        ans += 1
#print(ans)

ans = 0
min_left = 2 * 10**5
for i in range(n):
    min_left = min(min_left,p[i])
    if min_left >= p[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import copy
def func(n):
    result = []
    result.append([1,2])
    result.append([2,1])
    if n == 2:
        return result
    else:
        #for i in range(3,n+1):
        res_list = func(n-1)
        res = []
        for j in range(n):
            for s in res_list:
                st = copy.copy(s)
                st.insert(j,n)
                res.append(st)
        return res

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

s = func(n)
s.sort()
p_i = 0
q_i = 0
for i in range(n):
    #print(s[i])
    if s[i]==p:
        p_i = i
    if s[i]==q:
        q_i = i
print(abs(p_i,q_i))


Fixed submission:
import itertools
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

l = [int(x) for x in range(1,n+1)]
i = 0
p_i = 0
q_i = 0
for v in itertools.permutations(l, len(l)):
    i += 1
    if p==list(v):
        p_i = i
        #print(list(v))
    if q==list(v):
        q_i = i
        #print(i,list(v))
print(abs(p_i-q_i))

Buggy python submission (verdict: Runtime Error):
import copy
def func(n):
    result = []
    result.append([1,2])
    result.append([2,1])
    if n == 2:
        return result
    else:
        #for i in range(3,n+1):
        res_list = func(n-1)
        res = []
        for j in range(n):
            for s in res_list:
                st = copy.copy(s)
                st.insert(j,n)
                res.append(st)
        return res

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

s = func(n)
srt = sorted(s)
p_i = 0
q_i = 0
for i in range(n):
    print(srt[i])
    if srt[i]==p:
        p_i = i
    if srt[i]==q:
        q_i = i
print(abs(p_i,q_i))


Fixed submission:
import itertools
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

l = [int(x) for x in range(1,n+1)]
i = 0
p_i = 0
q_i = 0
for v in itertools.permutations(l, len(l)):
    i += 1
    if p==list(v):
        p_i = i
        #print(list(v))
    if q==list(v):
        q_i = i
        #print(i,list(v))
print(abs(p_i-q_i))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [int(i) for i in range(n)]
print(sum(lst))

Fixed submission:
n = int(input())
tmp = (n * (n - 1))//2
print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    tmp = int(input())
    a.append(tmp)
#print(a)
for i in range(n):
    tmp = a.popleft()
    print(max(a))
    a.append(tmp)

Fixed submission:
n = int(input())
max_1 = 0
max_2 = 0
a_list = []
for i in range(n):
    a = int(input())
    a_list.append(a)
    if max_1 < a:
        max_2 = max_1
        max_1 = a
    elif max_2 < a:
        max_2 = a
#print(max_1,max_2)
for i in range(n):
    if a_list[i] == max_1:
        print(max_2)
    else:
        print(max_1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
#print(a)
for i in range(n):
    tmp = a[:i]+a[i+1:]
    #print(tmp)
    print(max(tmp))

Fixed submission:
n = int(input())
max_1 = 0
max_2 = 0
a_list = []
for i in range(n):
    a = int(input())
    a_list.append(a)
    if max_1 < a:
        max_2 = max_1
        max_1 = a
    elif max_2 < a:
        max_2 = a
#print(max_1,max_2)
for i in range(n):
    if a_list[i] == max_1:
        print(max_2)
    else:
        print(max_1)
Buggy python submission (verdict: Runtime Error):
import collections
W,H,x,y = map(int,input().split())
tmp = []

if W==x*2:
    print(x*H,1)
elif H==y*2:
    print(W*y,1)
else:
    tmp.append(min(H*x,H*(W-x)))
    tmp.append(min(W*y,W*(H-y)))

tmp_cnt = collections.Counter(tmp)
print(tmp_cnt)

if len(tmp_cnt)==1:
    print(max(tmp_cnt.keys()),1)
else:
    print(max(tmp_cnt.keys()),0)


Fixed submission:
import collections
W,H,x,y = map(int,input().split())

if 2 * x == W and 2 * y == H:
    tmp = 1
else:
    tmp = 0
print(W*H/2,tmp)

Buggy python submission (verdict: Runtime Error):
import collections
W,H,x,y = map(int,input().split())
tmp = []

if W==x*2:
    print(x*H,1)
elif H==y*2:
    print(W*y,1)
else:
    tmp.append(min(H*x,H*(W-x)))
    tmp.append(min(W*y,W*(H-y)))

tmp_cnt = collections.Counter(tmp)
tmp_sort = sorted(tmp_cnt.items(),reverse=True)
#print(tmp_sort)
if tmp_sort[0][1]==1:
    print(tmp_sort[0][0],0)
else:
    print(tmp_sort[0][0],1)


Fixed submission:
import collections
W,H,x,y = map(int,input().split())

if 2 * x == W and 2 * y == H:
    tmp = 1
else:
    tmp = 0
print(W*H/2,tmp)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
card = [int(0) for i in range(n+1)]
for i in range(m):
    l,r = map(int,input().split())
    for j in range(l,r+1):
        card[j] += 1
#print(card)
cnt = 0
for i in range(n+1):
    if card[i] == m:
        cnt += 1
print(cnt)

Fixed submission:
n,m = map(int,input().split())
min_card,max_card = 0,n
for i in range(m):
    l,r = map(int,input().split())
    min_card = max(min_card,l)
    max_card = min(max_card,r)
#print(min_card,max_card)
if min_card<=max_card:
    print(max_card-min_card+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[4])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])

    

Fixed submission:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[3])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[2])
elif 0<int(s[:2])<=12:
    print(ans[1])
elif 0<int(s[-2:])<=12:
    print(ans[0])

Buggy python submission (verdict: Runtime Error):
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])
else:
    print(ans[4])
    

Fixed submission:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[3])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[2])
elif 0<int(s[:2])<=12:
    print(ans[1])
elif 0<int(s[-2:])<=12:
    print(ans[0])

Buggy python submission (verdict: Runtime Error):
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if 0<int(s[:2])<=12 and 0<int(s[-2:]<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])
else:
    print(ans[4])
    

Fixed submission:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[3])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[2])
elif 0<int(s[:2])<=12:
    print(ans[1])
elif 0<int(s[-2:])<=12:
    print(ans[0])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
left = s[0]
ans = 10**6
for i in range(1,n):
    right = s[i:]
    count_w = 0
    for j in range(i-1):
        if s[j]=='W':
            count_w += 1
    count_e = 0
    for j in range(len(right)):
        if right[j]=='E':
            count_e += 1
    #print(i,count_w,count_e)
    ans = min(ans,count_w+count_e)

print(ans)

Fixed submission:
n = int(input())
s = str(input())
left = s[0]
ans = 10**6
left = {}
left.setdefault('W',0)
left.setdefault('E',0)
right = {}
right.setdefault('E',0)
right.setdefault('W',0)
for i in range(n):
    right[s[i]] += 1
ans = 10**6
for i in range(n):
    right[s[i]] -= 1
    ans = min(ans,left['W']+right['E'])
    #print(left,right)
    left[s[i]] += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
k = int(input())

dic = {}
for i in range(1,len(s)+1):
    for j in range(len(s)+1-i):
        dic.setdefault(s[j:j+i],0)
        dic[s[j:j+i]] += 1
sort_dic = sorted(dic)
print(sort_dic[k-1])

Fixed submission:
s = str(input())
k = int(input())

dic = {}
for i in range(1,6):
    for j in range(len(s)+1-i):
        dic.setdefault(s[j:j+i],0)
        dic[s[j:j+i]] += 1
sort_dic = sorted(dic)
print(sort_dic[k-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
str_n = str(n)
wa = 0
for i in range(len(str_n)):
    wa += int(str_n[i])
if x%wa==0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
str_n = str(n)
wa = 0
for i in range(len(str_n)):
    wa += int(str_n[i])
if n%wa==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
r = int(input())
g = int(input())
print(g*2-a)

Fixed submission:
r = int(input())
g = int(input())
print(g*2-r)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
myList = []
for i in range(n):
    a = int(input())
    if a in myList:
        myList.remove(a)
    else:
        myList.append(a)
print(len(myList))

Fixed submission:
n = int(input())
dic = {}
for i in range(n):
    a = int(input())
    dic.setdefault(a,0)
    dic[a] += 1
    if dic[a] == 2:
        dic.pop(a)

print(len(dic))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a_to = []
a_from = []
for i in range(m):
    a,b = map(int,input().split())
    if a==1:
        a_to.append(b)
    if b==1:
        a_to.append(a)
    if a==n:
        a_from.append(b)
    if b==n:
        a_from.append(a)
isOK = False
for j in range(len(a_to)):
    if a_to[j] in a_from:
        isOK = True
        break
#print(a_to)
#print(a_from)
if isOK:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Fixed submission:
n,m = map(int,input().split())
#a_to = []
#a_from = []
dic = {}
isOK = False
for i in range(m):
    a,b = map(int,input().split())
    if a in [1,n]:
        dic.setdefault(b,0)
        dic[b] += 1
        if dic[b]==2:
            isOK = True
            break
    elif b in [1,n]:
        dic.setdefault(a,0)
        dic[a] += 1
        if dic[a]==2:
            isOK = True
            break
#    if a==1:
#        a_to.append(b)
#    if b==1:
#        a_to.append(a)
#    if a==n:
#        a_from.append(b)
#    if b==n:
#        a_from.append(a)

#for j in range(len(a_to)):
#    if a_to[j] in a_from:
#        isOK = True
#        break
#print(a_to)
#print(a_from)
if isOK:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = str(a[0])
if n%2==0:
    for i in range(1,n):
        if i%2==1:
            ans = str(a[i])+' '+ans
        else:
            ans = ans+' '+str(a[i])
else:
    for i in range(1,n):
        if i%2==0:
            ans = str(a[i])+' '+ans
        else:
            ans = ans+' '+str(a[i])
    
print(ans)

Fixed submission:
import collections

def f(myList):
    ans = ''
    if len(myList)%2==0:
        for i in range(len(myList)):
            ans += str(myList[i]) + ' '
    else:
        for i in range(len(myList)):
            ans += str(myList[-(i+1)]) + ' '
    return ans[:-1]

n = int(input())
a = list(map(int,input().split()))
b = collections.deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
print(f(b))
Buggy python submission (verdict: Runtime Error):
x,a,b = map(str,input().split())
if a>b:
    print('delicious')
elif x>=b-a:
    print('safe')
else:
    print('dangerous')


Fixed submission:
x,a,b = map(int,input().split())
if a>=b:
    print('delicious')
elif x>=b-a:
    print('safe')
else:
    print('dangerous')
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
dic = {}
for i in range(m):
    a,b = map(int,input().split())
    dic.setdefault(a,0)
    dic[a] += 1
    dic.setdefault(b,0)
    dic[b] += 1
for j in range(1,n+1):
    print(dic[j])

Fixed submission:
n,m = map(int,input().split())
#dic = {}
#for i in range(m):
#    a,b = map(int,input().split())
#    dic.setdefault(a,0)
#    dic[a] += 1
#    dic.setdefault(b,0)
#    dic[b] += 1
#for j in range(1,n+1):
#    print(dic[j])
ans = [int(0) for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    ans[a] += 1
    ans[b] += 1
for i in range(1,n+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
def mh(a,b,c,d):
    return abs(a-c)+abs(b-d)

n,m = map(int,input().split())
stu = []
for i in range(n):
    a,b = map(int,input().split())
    stu.append([a,b])
ans = [[99,1000000000] for i in range(m)]
#ans[1][1] = 0
#print(ans)
for j in range(1,m+1):
    x,y = map(int,input().split())
    for i in range(n):
        tmp = mh(stu[i][0],stu[i][1],x,y)
        if tmp < ans[i][1]:
            ans[i][0] = j
            ans[i][1] = tmp
for i in range(n):
    print(ans[i][0])


Fixed submission:
def f(gx,gy):
    ans = 10**9
    no = 0
    for i in range(m):
        tmp = abs(gx-checkpoint[i][0]) + abs(gy-checkpoint[i][1])
        if tmp < ans:
            ans = tmp
            no = i
    return no+1

n,m = map(int,input().split())
gakusei = []
for i in range(n):
    x,y = map(int,input().split())
    gakusei.append([x,y])
checkpoint = []
for j in range(m):
    x,y = map(int,input().split())
    checkpoint.append([x,y])

#print(gakusei,checkpoint)
for i in range(n):
    print(f(gakusei[i][0],gakusei[i][1]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
for i in range(1,n+1):
    ans *= i
print(ans%(10**9+7))

Fixed submission:
n = int(input())
ans = 1
for i in range(1,n+1):
    ans = (ans * i)%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
Alice,Bob = map(int,input().split())
if Alice = 1:
    ALice = 14
if Bob = 1:
    Bob = 14
if Alice>Bob:
    print('Alice')
elif Alice==Bob:
    print('Draw')
else:
    print('Bob')


Fixed submission:
Alice,Bob = map(int,input().split())
if Alice == 1:
    Alice = 14
if Bob == 1:
    Bob = 14
if Alice>Bob:
    print('Alice')
elif Alice==Bob:
    print('Draw')
else:
    print('Bob')
Buggy python submission (verdict: Runtime Error):
a,op,b = map(str,input().split())
if op = '+':
    print(int(a)+int(b))
else:
    print(int(a)-int(b))

Fixed submission:
a,op,b = map(str,input().split())
if op == '+':
    print(int(a)+int(b))
else:
    print(int(a)-int(b))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
h,w,n = map(int,input().split())
s = [[0 for j in range(w+2)] for i in range(h+2)]
#print(s)
for i in range(0,n):
    x,y = map(int,input().split())
    s[x-1][y-1] += 1
    s[x-1][y] += 1
    s[x-1][y+1] += 1
    s[x][y-1] += 1
    s[x][y] += 1
    s[x][y+1] += 1
    s[x+1][y-1] += 1
    s[x+1][y] += 1
    s[x+1][y+1] += 1

#print(s)
ans = [0] * 10
for i in range(2,h):
    for j in range(2,w):
        ans[s[i][j]] += 1
for i in range(0,10):
    print(ans[i])


Fixed submission:
def add_memo(tate,yoko):
    global memo
    if 2 <= tate <= h-1:
        if 2 <= yoko <= w-1:
            memo.append([tate,yoko])

h,w,n = map(int,input().split())
#print(s)
memo = []
for i in range(0,n):
    x,y = map(int,input().split())
    add_memo(x-1,y-1)
    add_memo(x-1,y)
    add_memo(x-1,y+1)
    add_memo(x,y-1)
    add_memo(x,y)
    add_memo(x,y+1)
    add_memo(x+1,y-1)
    add_memo(x+1,y)
    add_memo(x+1,y+1)

memo.sort()
ans = [0] * 10
ans[0] = (h-2)*(w-2)
tmp_x = 0
tmp_y = 0
count = 0
for i in range(0,len(memo)):
    if tmp_x == memo[i][0] and tmp_y == memo[i][1]:
        ans[count] -= 1
        count += 1
        ans[count] += 1
    else:
        ans[0] -= 1
        count = 1
        ans[count] += 1
    tmp_x = memo[i][0]
    tmp_y = memo[i][1]
#    print(memo[i],count)

for i in range(0,10):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort()
	return len(divisors)

ans = 0
for c in range(1, N):
	ab = N - c
	l = make_divisors(ab)
	ans += l
print(ans)


Fixed submission:
N = int(input())
ans = 0
for a in range(1, N):
	ans += (N - 1) // a
print(ans)