Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
s = s[:n]
count = s.count("ABC")
print(count)

Fixed submission:
[k, x] = [int(x) for x in input().split()]
print("Yes") if 500*k >= x else print("No")
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
n,a,b=l[0],l[1],l[2]
count=0
while True:
  for i in range(a):
    if n == 0:
      break
    count += 1
    n -= 1	
  for i in range(b):
    if n == 0:
      break
    n -= 1
  if n == 0:
    break
print(count)		

Fixed submission:
s = input()
if 'A' in s and 'B' in s:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
d=input()
k=len(d)
printf("x"*k)

Fixed submission:
s=input()
l=len(s)
k="x"*l
print(k)
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main()
{
  int n, m;
  
  scanf("%d", &n);
  scanf("%d", &m);
  
  if (n == m)
  	printf("Yes\n");
  else
    printf("No\n");
}

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
r=input()
k=r.split()

t1=t2=0
for i in range(k[1]):
    t1 += k[0]
for i in range(k[0]):
    t2 += k[1]
    
jj=[t1,t2]
jj.sort(reverse=True)
print(jj[0])

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
     
m=int(input())
     
     
if n==m:
    print('Yes')
else:
    print('No')

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())

m=int(input())


if n==m:
    print('Yes')
else:
    print('No')

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())

if n == m:
    print('Yes')
elif n > m:
    print('No')

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = input()
m=input()
if int(n) == int(m):
    print('Yes')
else:
    print('No')

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
r=input()
k=r.split()

t1=t2=0
for i in range(k[2]):
    t1 += k[0]
for i in range(k[0]):
    t2 += k[2]
    
jj=[t1,t2]
jj.sort(reverse=True)
print(jj[0])

Fixed submission:
r = input()
k=r.split()



t1=t2=''

t1=k[0]*int(k[1])
t2=k[1]*int(k[0])



rr = [t1,t2]

rr.sort()

print(rr[0])
Buggy python submission (verdict: Time Limit Exceeded):

N,K=map(int,input().split())

A=list(map(int,input().split()))
B=[]
for i in range(2):
    for j in range(N):
        B.append(A[j])
b=len(B)
count=0
for i in range(b):
    for j in range(b-i):
        if B[i]>B[i+j]:
            count+=1
#print(count)

a=len(A)
counter=0
for i in range(a):
    for j in range(a-i):
        if B[i]>B[i+j]:
            counter+=1
#print(count)
#print(counter)
#print(count-2*counter)

ans=(counter*K+((count-2*counter)*(K-1)*K)//2)%(1000000007)

print(ans)


Fixed submission:

N,K=map(int,input().split())

A=list(map(int,input().split()))
B=[]
for i in range(2):
    for j in range(N):
        B.append(A[j])
b=len(B)


a=len(A)
counter=0
for i in range(a):
    for j in range(a-i):
        if B[i]>B[i+j]:
            counter+=1


count=0
for i in range(b//2):
    for j in range(b//2):
        if B[i]>B[b//2+j]:
            count+=1
#print(count)
#print(count)
#print(counter)
#print(count-2*counter)

#print(counter)
#print(count)
#ans=(counter*K+((count-2*counter)*(K-1)*K)//2)%(1000000007)
answer=(counter*K+(count*(K-1)*K)//2)%(1000000007)
#print(ans)
print(answer)
Buggy python submission (verdict: Runtime Error):

N=int(input())
x=list(map(int,input().split()))
n=N//2

X=sorted(x)
#print(X)

#print(X[n-1])
#print(X[n])

print(X[n]-X[n-1]

Fixed submission:

N=int(input())
x=list(map(int,input().split()))
n=N//2

X=sorted(x)
#print(X)

#print(X[n-1])
#print(X[n])

print(X[n]-X[n-1])
Buggy python submission (verdict: Runtime Error):

N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)
a.append(0)
D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):

        if D[M-j-1][1] > a[k]:
            a[k]=D[M-j-1][1]
            k=k+1
        if l==k:
            break

    if l==k:
        break

print(sum(a)-a[N])



Fixed submission:
N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)
a.append(0)
D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):
        q=max(M-j-1,0)
        if D[q][1] > a[k] and k!=N:
            a[k]=D[q][1]
            k=k+1
        else:
            k=k

        if l==k:
            break

    if l==k:
        break



print(sum(a)-a[N])

Buggy python submission (verdict: Runtime Error):

N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)
a.append(0)
D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):

        if D[M-j-1][1] > a[k]:
            a[k]=D[M-j-1][1]
            k=k+1

    if l==k:
        break

print(sum(a)-a[N])

Fixed submission:
N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)
a.append(0)
D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):
        q=max(M-j-1,0)
        if D[q][1] > a[k] and k!=N:
            a[k]=D[q][1]
            k=k+1
        else:
            k=k

        if l==k:
            break

    if l==k:
        break



print(sum(a)-a[N])

Buggy python submission (verdict: Runtime Error):

N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)

D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):

        if D[M-j-1][1] > a[k]:
            a[k]=D[M-j-1][1]
            k=k+1

    if l==k:
        break
print(sum(a))



Fixed submission:
N,M=map(int,input().split())

a=list(map(int,input().split()))
a=sorted(a)
a.append(0)
D=[]
for i in range(M):

    d=list(map(int,input().split()))

    D.append(d)

D.sort(key=lambda x:x[1])


k=0

for j in range(M):
    l=k
    for i in range(D[M-j-1][0]):
        q=max(M-j-1,0)
        if D[q][1] > a[k] and k!=N:
            a[k]=D[q][1]
            k=k+1
        else:
            k=k

        if l==k:
            break

    if l==k:
        break



print(sum(a)-a[N])
Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline().strip())
word_map = defaultdict(lambda: 0)
maxi = 0
for i in range(n):
  word = stding.readline().strip()
  x = word_map[word]
  word_map[word] = x + 1
  maxi = max(maxi, x+1)
  
word_list = []
for key, value in word_map.items():
  if value == maxi:
    word_list.append(key)
word_list.sort()
for word in word_list:
  stdout.write(word+'\n')
  

Fixed submission:
from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline().strip())
word_map = defaultdict(lambda: 0)
maxi = 0
for i in range(n):
  word = stdin.readline().strip()
  x = word_map[word]
  word_map[word] = x + 1
  maxi = max(maxi, x+1)
  
word_list = []
for key, value in word_map.items():
  if value == maxi:
    word_list.append(key)
word_list.sort()
for word in word_list:
  stdout.write(word+'\n')
Buggy python submission (verdict: Runtime Error):
# -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())

i = 0
while True:
    i += 1
    if A%2:
         A -= 1
    A /= 2
    B += A
    if i == K:
        break
    i += 1
    if B%2:
        B -= 1
    B /= 2
    A += B
    if i == K:
        break
print(A,B)

Fixed submission:
S = input()
if len(S) == 3:
    S = S[::-1]
print(S)

Buggy python submission (verdict: Runtime Error):
# -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())

i = 0
while True:
    i += 1
    if A%2:
         A -= 1
    A /= 2
    B += A
    if i == K:
        break
    i += 1
    if B%2:
        B -= 1
    B /= 2
    A += B
    if i == K:
        break
print(A,B)

Fixed submission:
S = input()
if len(S) == 3:
    S = S[::-1]
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input) for _ in range(5)]

print(N // min(a) + 5)


Fixed submission:
from math import ceil

N = int(input())
a = [int(input()) for _ in range(5)]

print(ceil(N / min(a)) + (5-1))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input) for _ in range(5)]

print(n // min(a) + 5)


Fixed submission:
from math import ceil

N = int(input())
a = [int(input()) for _ in range(5)]

print(ceil(N / min(a)) + (5-1))
Buggy python submission (verdict: Runtime Error):
import bisect, collections

def solution():
    n = input().strip()
    print(n//2)
    

    

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()

Fixed submission:
import bisect, collections

def solution():
    n = input().strip()
    print((int(n)+1)//2)
    

    

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()
Buggy python submission (verdict: Time Limit Exceeded):
import collections

def solution():
    n = int(input().strip())
    d = collections.defaultdict(int)
    for _ in range(n):
        d[input().strip()] += 1
    res = list(d.items())
    res.sort(key=lambda x:(-x[1], x[0]))
    for x in res:
        if x[1] == res[0][1]:
            print(x[0])
        else:
            break

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()

Fixed submission:
import collections

def solution():
    n = int(input().strip())
    d = collections.defaultdict(int)
    for _ in range(n):
        d[input().strip()] += 1
    maxValue = max(d.values())
    res = [x[0] for x in d.items() if x[1] == maxValue]
    res.sort()
    for x in res:
        print(x)

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

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

sum_num = a + b
times = n // sum_num
amari = n % sum_num
if amari >= a:
    print(times * a + amari)
elif:
    print(times * a + a)
    

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

sum_num = a + b
times = n // sum_num
amari = n % sum_num

ans = times * a
if amari <= a:
    ans += amari
else :
    ans += a

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
def main():
    n = int(input())
    h = list(map(int, input().split()))
    start_num = 0
    best_score = 1000
    best_sc = 0

    min_h = h.index(min(h))

    for i in range(n-1):
        score =  h[i] - h[i+1]
        if best_score >= score and score >= 0:
            if best_score == score:
                if h[i] > h[start_num]:
                    start_num = i
                    sc = 0
                    while  i != n - 1 and h[i] >= h[i+1] :
                        sc = sc + 1
                        i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score
            else:
                start_num = i
                sc = 0
                while  i != n - 1 and h[i] >= h[i+1] :
                    sc = sc + 1
                    i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score

    print(best_sc)





if __name__ == '__main__' :
    main()


Fixed submission:
# coding:utf-8
def main():
    a = list(input())
    b = list(input())
    count = 0

    for i in range(3):
        if a[i] == b[i]:
            count = count + 1

    print(count)


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])
def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()

Fixed submission:
import sys

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])


def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    if len(lists)==1:
        print(lists[0])
        sys.exit()

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()

Fixed submission:
import sys

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])


def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    if len(lists)==1:
        print(lists[0])
        sys.exit()

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = list(map(int, input().split()))

    judge = 'Yes'

    H[0] = H[0] - 1

    for i in range(1,N):
        if H[i-1] > H[i] :
            H[i-1] = H[i-1] - 1

    for i in range(1,N):
        if H[i-1] > H[i]:
            judge = 'No'
            
    print(judge)

if __name__ == '__main__' :
    main()

Fixed submission:
def main():
    A,B,C = map(int,input().split())

    ans = C-(A-B)
    if ans <= 0:
        ans = 0

    print(ans)


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8
def main():
    a = int(input())
    lists = []
    lists= [int(input()) for _ in range(a)]

    temp = lists.copy()

    for i in range(a):
        lists = temp.copy()
        lists.pop(i)
        ans = max(lists)
        print(ans)

if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]

    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)

    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
            print(first)

if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# coding:utf-8
def main():
    a = int(input())
    list = []
    for i in range(a):
        list.append(int(input()))
    temp = list.copy()

    for i in range(a):
        list = temp.copy()
        list.pop(i)
        ans = max(list)
        print(ans)

if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
def main():
    a = int(input())
    lists= [int(input()) for _ in range(a)]

    temp = lists.copy()
    first = max(temp)
    temp.remove(first)
    second = max(temp)

    for i in range(a):
        if lists[i] == first:
            print(second)
        else:
            print(first)

if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
count = 0

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

Fixed submission:
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
count = 0

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

gcd_num = lcm(c,d)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

Fixed submission:
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())
count = 0

for i in range(a,b+1):
    if not (i % c == 0) and not (i % d == 0) :
        count = count + 1

print(count)

Fixed submission:
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    L = list(map(int, input().split()))

    s1, s2 = 0,sum(L)
    ans = sum(L)

    for i in range(N):
        s1 += L[i]
        s2 -= L[i]
        ans = min(ans, abs(s1-s2))

    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    p = list(map(int,input().split()))
    ans = []

    p.sort()

    ans = p[0] + p[1]
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    L = list(map(int, input().split()))

    s1, s2 = 0,sum(W)
    ans = sum(W)

    for i in range(N):
        s1 += L[i]
        s2 -= L[i]
        ans = min(ans, abs(s1-s2))

    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    L = list(map(int, input().split()))

    s1, s2 = 0,sum(L)
    ans = sum(L)

    for i in range(N):
        s1 += L[i]
        s2 -= L[i]
        ans = min(ans, abs(s1-s2))

    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = list(map(int, [input() for _ in range(m)]))
dp = [0] * (n+1)

#`dp[i] = i段目にいる通り数`
if not 0 in a:
    dp[0] = 1
if not 1 in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i in a:
        dp[i] = 0
    else: 
        dp[i] += (dp[i-1] + dp[i-2]) % (10 ** 9 + 7)

print(dp[-1])


Fixed submission:
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = set(map(int, [input() for _ in range(m)]))
dp = [0] * (n+1)

#`dp[i] = i段目にいる通り数`
if not 0 in a:
    dp[0] = 1
if not 1 in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i in a:
        dp[i] = 0
    else: 
        dp[i] += (dp[i-1] + dp[i-2]) % (10 ** 9 + 7)

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,m = map(int, input().split())

print(a)
dp = [0] * (n+1)

#`dp[i] = i段目にいる通り数`
dp[0] = 1
dp[1] = 1
for i in range(2,n+1):
    if i in a:
        dp[i] = 0
    else: 
        dp[i] += (dp[i-1] + dp[i-2]) % (10 ** 9 + 7)

print(dp[-1])


Fixed submission:
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = set(map(int, [input() for _ in range(m)]))
dp = [0] * (n+1)

#`dp[i] = i段目にいる通り数`
if not 0 in a:
    dp[0] = 1
if not 1 in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i in a:
        dp[i] = 0
    else: 
        dp[i] += (dp[i-1] + dp[i-2]) % (10 ** 9 + 7)

print(dp[-1])
Buggy python submission (verdict: Runtime Error):

#input
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], int(-x[0][1])) )

for i in range(N):
    print(X[i][0])

Fixed submission:
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], -int(x[0][1])))
for i in range(N):
	print(X[i][1])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
l = [0] 
r = [0]
all_gate_clear = 0


#numcard
#gatenum
N, M = map(int, input().split())
card_count = range(N+1)

#idカードの生成
for i in range(1,M+1):
    l_temp,r_temp = map(int, input().split())
    l.append(l_temp)
    r.append(r_temp)
    
for gate_num in range(1,M+1):
    #1ゲートの処理
    for card in range(1,N+1):
        num = 0
        while r[gate_num] > l[gate_num] + num:
            if l[gate_num] + num == card:
                if card_count[card] == gate_num -1:
                    card_count[card] += 1
                    break
            num += 1

for card in range(1,N+1):
    if card_count[card] == M:
        all_gate_clear += 1

print(all_gate_clear)

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
money = 0

if a >= 13:
    money = b
elif 6 <= a and a <= 12:
    money = b // 2
elif a <= 5:
    money = 0

print(money)
Buggy python submission (verdict: Runtime Error):
N , K = map(int,input().split())
S = str(input())

for i in range(1,N+1):
    if i == K :
        S[i] = S[i].lower()
print(S)

Fixed submission:
N , K = map(int,input().split())
S = list(input())

for i in range(1,N+1):
    if i == K :
        S[i-1] = S[i-1].swapcase()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
N , K = map(int,input().split())
S = str(input())

for i in range(1,N+1):
    if i == K :
        S[i] == S[i].lower()
print(S)

Fixed submission:
N , K = map(int,input().split())
S = list(input())

for i in range(1,N+1):
    if i == K :
        S[i-1] = S[i-1].swapcase()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
N , K = map(int,input().split())
S = str(input())

for i in range(1:N+1):
    if i == K :
        S[i] == S[i].lower()
print(S)

Fixed submission:
N , K = map(int,input().split())
S = list(input())

for i in range(1,N+1):
    if i == K :
        S[i-1] = S[i-1].swapcase()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
N , K = map(int,input().split())
S = str(input())

for i in N:
    if i == K :
        S[i] == S[i].lower()
print(S)

Fixed submission:
N , K = map(int,input().split())
S = list(input())

for i in range(1,N+1):
    if i == K :
        S[i-1] = S[i-1].swapcase()
print(''.join(S))