Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else today_wheather == "Rainy":
  print("Sunny")

Fixed submission:
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

Buggy python submission (verdict: Runtime Error):
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else today_wheather == "Rainy":
  print("Sunny")

Fixed submission:
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

Buggy python submission (verdict: Runtime Error):
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else today_wheather == "Rainy":
  print("Sunny")

Fixed submission:
today_wheather = input()
if today_wheather == "Sunny":
  print("Cloudy")
elif today_wheather == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Runtime Error):

Dance = input()
i = 0
flag = 0
for char in Dance:
  if i%2 == 0:
    if char == R:
      flag = 1
      break
  else:
    if char == L:
      flag = 1
      break
  i+=1
  
if flag == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
Dance = input()
i = 0
flag = 0
for char in Dance:
  if i%2 == 1:
    if char == "R":
      flag = 1
      break
  else:
    if char == "L":
      flag = 1
      break
  i+=1
  
if flag == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
dif convert_Arc(x):
  return 1/x

N = int(input())
An = list(map(int,input().split()))
arcAn = map(convert_Arc,An)
sum = 0
for i in range(N):
  sum += arcAn[i]
Arc_sum = convert_Arc(sum)
print(Arc_sum)




Fixed submission:
def convert_Arc(x):
  return 1/x

N = int(input())
An = list(map(int,input().split()))
arcAn = list(map(convert_Arc,An))
sum = 0
for i in range(N):
  sum += arcAn[i]
Arc_sum = convert_Arc(sum)
print(Arc_sum)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())
if N!=1:
    for i in range(N-1):
        if S[i]==S[i+1]:
            S[i]='K'
    while 'K' in S:
        S.remove('K')
print(len(S))


Fixed submission:
N=int(input())
S=list(input())
L=[]
if N!=1:
    for i in range(N-1):
        if S[i]!=S[i+1]:
            L.append(S[i+1])

print(len(L)+1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(input())


while N!=1:
    for i in range(N-1):
        if S[i]==S[i+1]:
            S[i]='K'
            c=1
    if c==0:
        break
    while 'K' in S:
        S.remove('K')
        N-=1
        c=0
print(len(S))


Fixed submission:
N=int(input())
S=list(input())
L=[]
if N!=1:
    for i in range(N-1):
        if S[i]!=S[i+1]:
            L.append(S[i+1])

print(len(L)+1)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
print((A-1)*(B-1))

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

print((A-1)*(B-1))
Buggy python submission (verdict: Runtime Error):
S=int(input())
K=int(input())

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    ans=i
    break

print(a[-ans])

Fixed submission:
S=int(input())
K=int(input())

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    if i>K:
      ans=1
    else:
      ans=i
    break
  else:
    ans=1

print(a[-ans])

Buggy python submission (verdict: Runtime Error):
S=int(input())
K=int(input())
a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0
for i in range(1,len(a)+1):
  m += a[-i]*5000000000000000
  if m>=K:
    ans=i
    break
print(a[-ans])

Fixed submission:
S=int(input())
K=int(input())

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    if i>K:
      ans=1
    else:
      ans=i
    break
  else:
    ans=1

print(a[-ans])
Buggy python submission (verdict: Runtime Error):
n=a[0]
k=a[1]
if n%k==0:
    print('0')
else:
    print('1')

Fixed submission:
a=list(map(int, input().split()))
n=a[0]
k=a[1]
if n%k==0:
    print('0')
else:
    print('1')
Buggy python submission (verdict: Runtime Error):
l=map(int,input().split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
l=map(int,raw_input().split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')


Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
l=map(int(),raw_input().split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
l=map(int(),input().split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
l=map(int(),input.split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
l=map(str(),input.split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=a*b
d=c%2
if d==1:
  print('Odd')
else:
  print('Even')

Fixed submission:
a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=list(map(int, input().split()))

n=0
def power(figure):
    if figure%2==0:
        return True
    else:
        return False

while len(list(filter(power,l)))==N:
    n+=1
    k=map(lambda x: x/2,l)
    l=list(k)


print(n)

Fixed submission:
k=input()
n=0
if int(k[0])==1:
    n+=1
if int(k[1])==1:
    n+=1
if int(k[2])==1:
    n+=1
print(n)

Buggy python submission (verdict: Runtime Error):
N=int(input())
l=list(map(int, input().split()))

n=0
def power(figure):
    if figure%2==0:
        return True
    else:
        return False

while len(list(filter(power,l)))==N:
    n+=1
    k=map(lambda x: x/2,l)
    l=list(k)


print(n)

Fixed submission:
k=input()
n=0
if int(k[0])==1:
    n+=1
if int(k[1])==1:
    n+=1
if int(k[2])==1:
    n+=1
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [collections.Counter(input()) for i in range(n)]

count = 0 
for i in range(n):
  for j in range(i + 1, n):
    if s[i] == s[j]:
      count += 1

print(count)

Fixed submission:
import collections

n = int(input())
ss = [tuple(sorted(collections.Counter(input()).items())) for i in range(n)]

s_dict = dict()

for s in ss:
  if s not in s_dict:
    s_dict[s] = 1
  else:
    s_dict[s] += 1

count = 0 
for i in s_dict.values():
  count += (i * (i - 1)) // 2
    

print(count)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

rs, ls = [0], [0]
for i in range(n-1):
  rs.append(gcd(rs[i], a[i]))
  ls.append(gcd(ls[i], a[-i-1]))

print(max(gcd(r, l) for r, l in zip(rs, ls[::-1])))

Fixed submission:
a, b, t = map(int, input().split())
print(int(((t + 0.5) // a) * b))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce

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

n = int(input())
a = list(map(int, input().split()))
m = max(gcd_list(a[:i] + a[i + 1:]) for i in range(n))
print(m)

Fixed submission:
from fractions import gcd

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

rs, ls = [0], [0]
for i in range(n-1):
  rs.append(gcd(rs[i], a[i]))
  ls.append(gcd(ls[i], a[-i-1]))

print(max(gcd(r, l) for r, l in zip(rs, ls[::-1])))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split()
abs_a = list(map(abs, a)))
print(sum(abs_a) if len([i for i in a if i < 0]) % 2 == 0 else sum(abs_a) - 2 * min(a))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
abs_a = list(map(abs, a))
print(sum(abs_a) if len([i for i in a if i < 0]) % 2 == 0 else sum(abs_a) - 2 * min(abs_a))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
print(sum(a) - 2 * min(a))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
abs_a = list(map(abs, a))
print(sum(abs_a) if len([i for i in a if i < 0]) % 2 == 0 else sum(abs_a) - 2 * min(abs_a))
Buggy python submission (verdict: Runtime Error):
from math import ceil
ts = [int(input()) for _ in range(5)]
m = 10 - min([t % 10 for t in ts if not t % 10 == 0])
tss = [ceil(t / 10) * 10 for t in ts]
print(sum(tss) - m)



Fixed submission:
from math import ceil
ts = [int(input()) for _ in range(5)]
m = 10 - min([t % 10 for t in ts if not t % 10 == 0] + [10])
tss = [ceil(t / 10) * 10 for t in ts]
print(sum(tss) - m)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])
print(min([h[i+K] - h[i] for i in range(N-K+1)]))

Fixed submission:
N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])
print(min([h[i+K-1] - h[i] for i in range(N-K+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])
min_max = lambda x: max(x) - min(x)
print(min([min_max(h[i:i+K]) for i in range(N-K+1)]))




Fixed submission:
N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])
print(min([h[i+K-1] - h[i] for i in range(N-K+1)]))
Buggy python submission (verdict: Runtime Error):
H, M, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())
for z in range(x+1, y+1):
  r = any(i < z for i in x) and any(i < z for i in y)
  if r:
    print("No War")
    break
  else:
    print("War")

Fixed submission:
H, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
 
r = any(all(i < z for i in x) and all(i >= z for i in y) for z in range(X+1, Y+1))
print("No War" if r else "War")
Buggy python submission (verdict: Runtime Error):
a, b, c = sorted(map(int, input().split()), reverse=True)
k = int(intput())
print(a*2**k + b + c)


Fixed submission:
a, b = map(int, input().split())
print(a if a <= b else a - 1)
Buggy python submission (verdict: Runtime Error):
a, b, c = sorted(map(int, input().split()), reverse=True)
k = int(intpu())
print(a*2**k + b + c)


Fixed submission:
a, b, c = sorted(map(int, input().split()), reverse=True)
k = int(input())
print(a*2**k + b + c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
a = map(lambda x: x[(n-1)//2], [sorted(x[:i] + x[i+1:]) for i in range(n)])
for i in a:
  print(i)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
m1, m2 = sorted(x)[n//2-1], sorted(x)[n//2]
for i in x:
  print(m1) if i >= (m1+m2)/2 else print(m2)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if a + k >= b:
  a_k = b
else:
  a_k = a + k

if b - k <= 0:
  b_k = a
else:
  b_k = b - k


result = sort(list(set([i for i in range(a, a_k + 1)] + [i for i in range(b_k, b + 1)])))
for n in result:
  print(n)

Fixed submission:
a, b, k = map(int, input().split())
if a + k > b:
  a_k = b
else:
  a_k = a + k

if b - k < a:
  b_k = a
else:
  b_k = b - k
  
if a == b:
  a_k = a + 1
  b_k = b + 1

result = list(set([i for i in range(a, a_k)] + [i for i in range(b_k + 1, b + 1)]))
result.sort()
for n in result:
  print(n)
Buggy python submission (verdict: Runtime Error):
n = map(int, input().split())
print((max(n)*3-sum(n))/2 if (sum(n)+max(n))%2 == 0 else ((max(n)+1)*3-sum(n))/2)


Fixed submission:
n = list(map(int, input().split()))
print((max(n)*3-sum(n))//2 if (max(n) + sum(n)) % 2 == 0 else ((max(n)+1)*3-sum(n))//2)
Buggy python submission (verdict: Runtime Error):
def fib(n):
   a, b = 2, 1
   for i in range(n):
     a, b = b, a+b
    print(b)

fib(int(input())-1)

Fixed submission:
def fib(n):
   a, b = 2, 1
   for i in range(n):
     a, b = b, a+b
   print(b)
 
fib(int(input())-1)
Buggy python submission (verdict: Runtime Error):
print(sorted(set([chr(i) for i in range(97, 97+26)]) - set(list(input())))[0])

Fixed submission:
a = sorted(set([chr(i) for i in range(97, 97+26)]) - set(list(input())))
print(a[0] if a != [] else None)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = []

for num in a:
    b = b + [num]
    b = b[::-1]

print(" ".join(b))

Fixed submission:
from collections import deque

n = int(input())
a = input().split()
b = deque([])
for i, num in enumerate(a):
  if n%2 == i%2:
    b.append(num)
  else:
    b.appendleft(num)
    

print(" ".join(b))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = []

for i, num in enumerate(a):
  if i%2 == 0:
    b = b + [num]
  else:
    b = [num] + b
    
if n%2 != 0:
  b = b[::-1]

print(" ".join(b))

Fixed submission:
from collections import deque

n = int(input())
a = input().split()
b = deque([])
for i, num in enumerate(a):
  if n%2 == i%2:
    b.append(num)
  else:
    b.appendleft(num)
    

print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = ["#"*(w+2)] + ["#" + input() + "#" for i in h] + ["#"*(w+2)]
for s in a:
  print(s)



Fixed submission:
h, w = map(int, input().split())
a = ["#"*(w+2)] + ["#" + input() + "#" for i in range(h)] + ["#"*(w+2)]
for s in a:
  print(s)
Buggy python submission (verdict: Runtime Error):
print("".join([o, e for o, e zip(input(), input())]))

Fixed submission:
odd, even = input(), input()
p = "".join([o+e for o, e in zip(odd, even)])
if len(odd) != len(even):
  p += odd[-1]
print(p)
Buggy python submission (verdict: Runtime Error):
N, K, X, K = [int(input()) for i in range(4)]
print(X*K+Y*(N-K if N-K > 0 else 0))

Fixed submission:
N, K, X, Y = [int(input()) for i in range(4)]
print(X*K+Y*(N-K) if N-K > 0 else X*N)

Buggy python submission (verdict: Runtime Error):
N, K, X, H = [int(input()) for i in range(4)]
print(X*K+Y*(N-K))

Fixed submission:
N, K, X, Y = [int(input()) for i in range(4)]
print(X*K+Y*(N-K) if N-K > 0 else X*N)
Buggy python submission (verdict: Time Limit Exceeded):
n,q=[int(i) for i in input().split()]
g={}
val=[0]*n
for i in range(n-1):
  a,b=[int(i) for i in input().split()]
  if a-1 in g:g[a-1].append(b-1)
  else:g[a-1]=[b-1,]
for i in range(q):
  a,b=[int(i) for i in input().split()]
  val[a-1]+=b
stack=[]
stack.append(0)
while(len(stack)>0):
  p=stack.pop()
  if p in g:
    for i in g[p]:
      val[i]=val[i]+val[p]
      stack.append(i)
for i in val:print(i,end=" ")
print("")


Fixed submission:
n,q=[int(i) for i in input().split()]
g={}
val=[0]*n
vis=[0]*n
for i in range(n-1):
  a,b=[int(i) for i in input().split()]
  if a-1 in g:g[a-1].append(b-1)
  else:g[a-1]=[b-1,]
for i in range(q):
  a,b=[int(i) for i in input().split()]
  val[a-1]+=b
stack=[]
stack.append(0)
vis[0]=1
while(len(stack)>0):
  p=stack.pop()
  if p in g:
    for i in g[p]:
      if vis[i]==0 :
        val[i]=val[i]+val[p]
        stack.append(i)
        vis[i]=1
for i in val:print(i,end=" ")
print(" ")
Buggy python submission (verdict: Time Limit Exceeded):
l,r = [int(i) for i in input().split()]
dr = r//2019
lr = l//2019
r=r%2019
r+=2019*(dr-lr)
l=l%2019
m=10**10
for i in range(l,r):
  for j in range(i+1,r+1):
    m=min(m,(i*j)%2019)
print(m)
    

Fixed submission:
l,r = [int(i) for i in input().split()]
if(r//2019>l//2019):print(0)
else:
  r=r%2019
  l=l%2019
  if(r<=l):
    print(0)
  else:
    m=10**10
    for i in range(l,r):
      for j in range(i+1,r+1):
        m=min(m,(i*j)%2019)
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
inputData = input().split()
A = [int(x) for x in inputData]

B = [0] * N
ans = ''
for i, num in enumerate(A):
    B[num-1] = i + 1
for j in B:
    ans = ans + ' ' + str(j)
print(ans[1:])

Fixed submission:
N = int(input())
inputData = input().split()
A = [int(x) for x in inputData]

B = [0] * N
ans = ''
for i, num in enumerate(A):
    B[num-1] = i + 1
print(' '.join(map(str, B)))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

inputData = input().split()
N, K, Q = [int(x) for x in inputData]
points = np.array([K]*N)

for i in range(Q):
    A = int(input())
    points -= 1
    points[A-1] += 1

for j in range(N):
    if points[j] > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
import numpy as np

inputData = input().split()
N, K, Q = [int(x) for x in inputData]
points = np.array([K]*N)

for i in range(Q):
    A = int(input())
    points[A-1] += 1
points -= Q
for j in range(N):
    if points[j] > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
inputData = input().split()
N, K, Q = [int(x) for x in inputData]
points = [K]*N

for i in range(Q):
    A = int(input())
    points[A-1] += 1
    for k in range(N):
        points[k] -= 1
for j in range(N):
    if points[j] > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
import numpy as np

inputData = input().split()
N, K, Q = [int(x) for x in inputData]
points = np.array([K]*N)

for i in range(Q):
    A = int(input())
    points[A-1] += 1
points -= Q
for j in range(N):
    if points[j] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
L, R = [int(x) for x in input().split()]


res = []
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        res.append((i * j) % 2019)
print(min(res))

Fixed submission:
L, R = [int(x) for x in input().split()]


res = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):

        tmp = (i * j) % 2019
        if tmp == 0:
            print(0)
            exit()
        if tmp < res:
            res = tmp

print(res)
Buggy python submission (verdict: Runtime Error):
import math
# input process
inputData = input().split()
A = int(inputData[0])
B = int(inputData[1])
C = int(inputData[2])
D = int(inputData[3])

C_q_num = (B // C) - (A // C)
if (B % C) == 0:
    C_q_num += 1
D_q_num = (B // D) - (A // D)
if (B % D) == 0:
    C_q_num += 1
CD_lcm = (C * D) // math.gcd(C, D)
CD_q_num = (B // CD_lcm) - (A // CD_lcm)
if (B % CD_lcm) == 0:
    CD_q_num += 1
print((B - A + 1) - C_q_num - D_q_num + CD_q_num)


Fixed submission:
import fractions
# input process
inputData = input().split()
A = int(inputData[0])
B = int(inputData[1])
C = int(inputData[2])
D = int(inputData[3])

C_q_num = (B // C) - (A // C)
if (A % C) == 0:
    C_q_num += 1
D_q_num = (B // D) - (A // D)
if (A % D) == 0:
    D_q_num += 1
CD_lcm = (C * D) // fractions.gcd(C, D)
CD_q_num = (B // CD_lcm) - (A // CD_lcm)
if (A % CD_lcm) == 0:
    CD_q_num += 1
print((B - A + 1) - C_q_num - D_q_num + CD_q_num)

Buggy python submission (verdict: Runtime Error):
import math
# input process
inputData = input().split()
A = int(inputData[0])
B = int(inputData[1])
C = int(inputData[2])
D = int(inputData[3])

C_q_num = (B // C) - (A // C)
D_q_num = (B // D) - (A // D)
CD_lcm = (C * D) // math.gcd(C, D)
CD_q_num = (B // CD_lcm) - (A // CD_lcm) + 1
print((B-A) - C_q_num - D_q_num + CD_q_num)


Fixed submission:
import fractions
# input process
inputData = input().split()
A = int(inputData[0])
B = int(inputData[1])
C = int(inputData[2])
D = int(inputData[3])

C_q_num = (B // C) - (A // C)
if (A % C) == 0:
    C_q_num += 1
D_q_num = (B // D) - (A // D)
if (A % D) == 0:
    D_q_num += 1
CD_lcm = (C * D) // fractions.gcd(C, D)
CD_q_num = (B // CD_lcm) - (A // CD_lcm)
if (A % CD_lcm) == 0:
    CD_q_num += 1
print((B - A + 1) - C_q_num - D_q_num + CD_q_num)
Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()

for y in cities:
    each_SA = [i for i in SA if y in i]
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)


Fixed submission:
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()

for y in cities:
    each_SA = []
    for i in SA:
        if i.split()[0] == y:
            each_SA.append(i)
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)

Buggy python submission (verdict: Runtime Error):
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()
print(cities)

for y in cities:
    each_SA = [i for i in SA if y in i]
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)


Fixed submission:
# input
N = int(input())
SA = [str(input()) for i in range(N)]

# process
cities = list(set([x.split()[0] for x in SA]))
cities.sort()

for y in cities:
    each_SA = []
    for i in SA:
        if i.split()[0] == y:
            each_SA.append(i)
    each_points = [int(x.split()[1]) for x in each_SA]
    each_points.sort(reverse=True)
    for j in each_points:
        print(SA.index(y + ' ' + str(j)) + 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())

print(N-(K-1))

Fixed submission:
Array = [int(x) for x in input().split()]
N = Array[0]
K = Array[1]

print(N-(K-1))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = list(int(input()) for i in range(Q))
for i in range(N):
    if Q - A.count(i + 1) < K:
        print("Yes")
    else:
        print("No")


Fixed submission:
from collections import Counter

N, K, Q = map(int, input().split())
A = list(int(input()) for i in range(Q))
c = Counter(A)
for i in range(N):
    if Q - c[i + 1] < K:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(1, N):
    ans += i
print(ans)

Fixed submission:
N = int(input())
print(int(N*(N-1)//2))