Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

def answer(in0, in1):
    even = {}
    odd = {}

    list = in1.split(" ")

    for i in range(len(list)):
        n = list[i]
        if i % 2 == 0:
            odd[n] = odd.get(n, 0) + 1
        else:
            even[n] = even.get(n, 0) + 1

    odd = sorted(
        [{'key': k, 'value': odd[k]} for k in odd],
        key=lambda x: (-x['value'], int(x['key'])))

    even = sorted(
        [{'key': k, 'value': even[k]} for k in even],
        key=lambda x: (-x['value'], int(x['key'])))

    oddMax = odd[0]
    evenMax = even[0]

    #print(odd)
    #print(even)

    # 奇数偶数ともにトップのキーが一緒
    if oddMax['key'] == evenMax['key']:
        # 文字列が全部同じだからどっちかを書き換えればOK
        if len(even) == 1 and len(odd) == 1:
            return int(int(in0) / 2)

        if oddMax['value'] > evenMax['value']:
            evenMax = even[1]
        else:
            oddMax = odd[1]

    oddCount = 0
    evenCount = 0

    for v in odd:
        if v['key'] != oddMax['key']:
            oddCount += v['value']

    for v in even:
        if v['key'] != evenMax['key']:
            evenCount += v['value']

    return oddCount + evenCount

print(answer(input(), input()))


Fixed submission:
def answer(in0):

    result = ''

    for ch in str(in0):
        if ch == '9':
            result += '1'
        elif ch == '1':
            result += '9'

    return result


print(answer(input()))
Buggy python submission (verdict: Runtime Error):
def answer(in0, in1, in2, in3):
    x1 = int(in0)
    y1 = int(in1)
    x2 = int(in2)
    y2 = int(in3)

    width = (x2 - x1)
    height = (y2 - y1)

    x3 = x2 - height
    y3 = y2 + width
    x4 = x1 - height
    y4 = y1 + width

    print(x3, y3, x4, y4)

answer(input(), input(), input(), input())


Fixed submission:
def answer(in0):
    nums = [int(n) for n in in0.split(" ")]
    x1 = int(nums[0])
    y1 = int(nums[1])
    x2 = int(nums[2])
    y2 = int(nums[3])

    width = (x2 - x1)
    height = (y2 - y1)

    x3 = x2 - height
    y3 = y2 + width
    x4 = x1 - height
    y4 = y1 + width

    print(x3, y3, x4, y4)

answer(input())
Buggy python submission (verdict: Runtime Error):
#n idカード　m ゲート
n,m = map(int, input().split())
maxlist = []
minlist = []

for i in range(m):
	#l　ゲートの下限　r ゲートの上限
	l , r = list(map(int, input().split()))
	minlist.append(l)
	if r > 0:
		maxlist.append(r)

minid = max(minlist)
maxid = min(maxlist)
okgate = maxid - minid + 1

if okegate >= 0:
	print(okgate)
else:
	print(0)

Fixed submission:
#n idカード　m ゲート
n,m = map(int, input().split())
maxlist = []
minlist = []

for i in range(m):
	#l　ゲートの下限　r ゲートの上限
	l , r = list(map(int, input().split()))
	minlist.append(l)
	if r > 0:
		maxlist.append(r)

minid = max(minlist)
maxid = min(maxlist)
okgate = maxid - minid + 1

if okgate >= 0:
	print(okgate)
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
import sys
a = sys.argv[1]
p = sys.argv[2]
a1 = a*3
print ((a1+p)/2)

Fixed submission:
from sys import stdin
arg = stdin.readline().rstrip().split()
a = int(arg[0])
p = int(arg[1])
a1 = a*3
print (int((a1+p)/2))

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

a, p = map(int, sys.stdin.readlines()[0].strip)
print((p + a * 3) // 2)

Fixed submission:
import sys

a, p = map(int, sys.stdin.readlines()[0].strip().split())
print((p + a * 3) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    a.append((s, -int(p), i))
a.sort()

for _, _, i in a:
    print(i + 1)

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

print((3 * A + P) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    a.append((s, -int(p), i))
a.sort()

for _, _, i in a:
    print(i + 1)

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

print((3 * A + P) // 2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    s, p = list(map(int, input().split()))
    a.append((s, -int(p), i))
a.sort()

for _, _, i in a:
    print(i + 1)


Fixed submission:
n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    a.append((s, -int(p), i))
a.sort()

for _, _, i in a:
    print(i + 1)
Buggy python submission (verdict: Runtime Error):
a, b =(int, input().split())
if 13 <= a:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)

Fixed submission:
a,b=map(int, input().split())
if a <= 5:
    print(0)
elif 6 <= a <= 12:
    print(b//2)
else:
    print(b)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

L = [0 for i in range(max(A) + 1)]

for a in A:
    L[a] += 1
    if a != 0:
        L[a - 1] += 1
    if a != max(A):
        L[a + 1] += 1

print(max(L))




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

L = [0 for i in range(max(A) + 10)]

for a in A:
    L[a] += 1
    L[a - 1] += 1
    L[a + 1] += 1

print(max(L))

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

res = 0
for a in A:
    res = max(res, A.count(a) + A.count(a+1) + A.count(a-1))


print(res)



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

L = [0 for i in range(max(A) + 10)]

for a in A:
    L[a] += 1
    L[a - 1] += 1
    L[a + 1] += 1

print(max(L))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

res = [0]
tmp = -1
for a in A:
    if a == tmp:
        res.append(a)
        tmp = -1
    else:
        tmp = a
    if len(res) > 2:
        break

res = sorted(res, reverse=True)

result = 1
for i in range(2):
    result *= res[i]

print(result)


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

res = [0, 0]
tmp = -1
for a in A:
    if a == tmp:
        res.append(a)
        tmp = -1
    else:
        tmp = a
    if len(res) >= 4:
        break

res = sorted(res, reverse=True)

result = 1
for i in range(2):
    result *= res[i]

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

N = int(input())
T = [int(input()) for n in range(N)]


def lcm(a, b):
    return a * b // math.gcd(a, b)


res = T[0]
for t in T:
    res = lcm(res, t)

print(res)


Fixed submission:
N = int(input())
T = [int(input()) for n in range(N)]


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


def lcm(a, b):
    return a * b // gcd(a, b)


res = T[0]
for t in T:
    res = lcm(res, t)

print(res)
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())


def f(n):
    if n >= 0:
        return n//x+1
    else:
        0

print(f(b)-f(a-1))

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


def f(n):
    if n >= 0:
        return n//x+1
    else:
        return 0

print(f(b)-f(a-1))
Buggy python submission (verdict: Runtime Error):
print(len(set(input().split()))

Fixed submission:
print(len(set(input().split())))
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

while X.find("ST") != -1:
    X = X.replace("ST", "")

print(len(X))

Fixed submission:
X = input()

count = 0
t_count = 0
for x in X:
    if x == "S":
        count += 1
    if x == "T":
        count -= 1
        if count < 0:
            count = 0
            t_count += 1


print(t_count + count)
Buggy python submission (verdict: Runtime Error):
from operator import itemgetter

if __name__ == '__main__':
    n = int(input())
    input_list = [input() for i in range(n)]
    restaurant_list = []
    for index, _input in enumerate(input_list):
        _restaurant_data = {'id': index + 1, 'region': _input.split()[0], 'point': int(_input.split()[1])}
        restaurant_list.append(_restaurant_data)

    restaurant_list.sort(key=itemgetter('point'), reverse=True)
    restaurant_list.sort(key=itemgetter('region'))
    for restaurant in restaurant_list:
        print(restaurant['id'])


Fixed submission:
if __name__ == '__main__':
    _input = input().split()

    pie = int((int(_input[0]) * 3 + int(_input[1]))/2)
    print(pie)
Buggy python submission (verdict: Runtime Error):
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        if 1<=len(S)<=10 and S.islower==1 and 0<=P<=100 and type(P) is int :
            args.append([S,P])
        else :
            print("ERROR")
            exit()

            
def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted


def check_list(seq):
    seen = []
    uniequ_list = [x for x in seq if x not in seen and not seen.append(x)]
    if len(seq) != len(unique_list):
	print("ERORR")
	exit()
    # else :                                                                                         
    #     print("restaurant is ok.")                                                                 


def main():
    num=int(input())
    if 1<=num<=100:
        restaurant=[]
        input_list(num,restaurant)

        check_list(restaurant)

        restaurant_sorted=sort_list(*restaurant)

        for i in range(num):
            for j in range(num):
                if restaurant_sorted[i][1]==restaurant[j][1]:
                    print(j+1)
    else :
        print("ERORR")
        exit()

if __name__ == "__main__":
    main()


Fixed submission:
from operator import itemgetter

def input_list(num,args):
    for i in range(num):
        S,P = input().split()
        P=int(P)
        if 1<=len(S)<=10 and S.islower()==1 and S.isalpha()==1 \
           and 0<=P<=100 and isinstance(P,int)==1:
            args.append([S,P])
        else :
            print("ERROR")
            exit()



def sort_list(*args):
    tmp=sorted(args,key=itemgetter(1),reverse=1)
    dict_sorted=sorted(tmp,key=itemgetter(0))

    return dict_sorted


def check_list(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    if len(seq) != len(unique_list):
        print("ERORR")
        exit()
    # else :                                                                                         
    #     print("restaurant is ok.")           



def main():
    # restaurant=[['N1',88],['N2',85],['N3',92],['N7',21],['N4',34],['N8',45],['N2',24],['N2',35]]   
    # num=8                                                                                          

    num=int(input())
    if 1<=num<=100:
        # [[] for i in range(5)]                                                                     
        restaurant=[]
        input_list(num,restaurant)

        check_list(restaurant)

        # print(restaurant)                                                                          
        restaurant_sorted=sort_list(*restaurant)

        for i in range(num):
            for j in range(num):
                if restaurant_sorted[i][1]==restaurant[j][1]:
                    print(j+1)
    else :
        print("ERORR")
        exit()

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
A=int(A)
B=int(B)

if 0 <=A<=100 and 2<=B<=1000:
    if B%2 == 1:
        print("ERROR")
        exit()
    else :
        if A <=5 :
            fare=0
        elif 6<=A<=12 :
            fare=B//2
        else:
            fare=B
else:
    print("ERROR")
    exit()

print(fare)

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

if 0 <=A<=100 and 2<=B<=1000:
    if B%2 == 1:
        print("ERROR")
        exit()
    else :
        if A <=5 :
            fare=0
        elif 6<=A<=12 :
            fare=B//2
        else:
            fare=B
else:
    print("ERROR")
    exit()

print(fare)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

args=sys.argv
A=int(args[1])
B=int(args[2])


if 0 <=A<=100 and 2<=B<=1000:
    if B%2 == 1:
        print("ERROR")
        exit()
    else :
        if A <=5 :
            fare=0
        elif 6<=A<=12 :
            fare=int(B/2)
        else:
            fare=B
else:
    print("ERROR")
    exit()

print(fare)

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

if 0 <=A<=100 and 2<=B<=1000:
    if B%2 == 1:
        print("ERROR")
        exit()
    else :
        if A <=5 :
            fare=0
        elif 6<=A<=12 :
            fare=B//2
        else:
            fare=B
else:
    print("ERROR")
    exit()

print(fare)
Buggy python submission (verdict: Runtime Error):
!/work/yota509/env_python3/bin/python3                                                              
# -*- coding: utf-8 -*-                                                                              


def read_input():
    a,b,c=map(int, input().split())
    if 2<=a<=5 and 1<=b<=100 and b<c<=200:
        return a,b,c
    else :
        print("Error")
        exit()

def main():
    num = 10
    # r=None                                                                                         
    # d=None                                                                                         
    # x=None                                                                                         

    r,D,x=read_input()
    sum_x=x

    for i in range(num):
        sum_x=r*sum_x-D
        print(sum_x)
        sum_x=sum_x



if __name__ == "__main__":
    main()


Fixed submission:
def read_input():
    a,b,c=map(int, input().split())
    if 2<=a<=5 and 1<=b<=100 and b<c<=200:
        return a,b,c
    else :
        print("Error")
        exit()

def main():
    num = 10

    r,D,x=read_input()
    sum_x=x

    for i in range(num):
        sum_x=r*sum_x-D
        print(sum_x)
        sum_x=sum_x



if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys

N=int(input())
if N<1 or N>20 :
    print("error")
    sys.exit()

V=list(map(int,input().strip().split()))
C=list(map(int,input().strip().split()))
# print(V[0],V[1],V[2])                                                                              

for i in range(N):
    if C[i]<1 or C[i]>20 or V[i]<1 or v[i]>20:
        print("error")
        sys.exit()

    # try:                                                                                           
    #     inp=dic[input('[Y]es/[N]o? >> ').lower()]                                                  
    #     break                                                                                      
    # except:                                                                                        
    #     pass                                                                                       

diff=0
max_profit=0



for i in range(N):
    # print(V[i],type(V[i]),C[i],type(C[i]))                                                         
    diff=V[i]-C[i]
    if diff >=0 :
        max_profit=max_profit+diff

print(max_profit)


Fixed submission:
import sys

N=input()
if N.isdecimal() == 0 or int(N)<1 or int(N)>20 :
    print("error")
    sys.exit()

N=int(N)

V=list(map(int,input().strip().split()))
C=list(map(int,input().strip().split()))
# print(V[0],V[1],V[2])                                                                              

for i in range(N):
    if C[i]<1 or C[i]>50 or V[i]<1 or V[i]>50:
        print("error")
        sys.exit()

diff=0
max_profit=0



for i in range(N):
    # print(V[i],type(V[i]),C[i],type(C[i]))                                                         
    diff=V[i]-C[i]
    if diff >=0 :
        max_profit=max_profit+diff

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


def CheckRangeInt(input_str,_min,_max):

    if input_str.isdecimal()==0 or int(input_str)<_min or int(input_str)>_max:
        print("error")
        sys.exit()

    return int(input_str)


def CheckRangeList(input_list,_min,_max):
    for i in range(len(input_list)) :
        if H[i]<_min or H[i]>_max :
            print("error")
            sys.exit()
    return input_list

N=input()
N=CheckRangeInt(N,1,20)


H=list(map(int,input().strip().split()))
if len(H)!=N :
    print("error")
    sys.exit()
H=CheckRangeList(H,1,100)

highest=0
can_see=0

for i in range(N):
    if H[i]>=highest :
	can_see=can_see+1
        highest=H[i]

print(can_see)


Fixed submission:
import sys


def CheckRangeInt(input_str,_min,_max):

    if input_str.isdecimal()==0 or int(input_str)<_min or int(input_str)>_max:
        print("error")
        sys.exit()

    return int(input_str)


def CheckRangeList(input_list,_min,_max):
    for i in range(len(input_list)) :
        if H[i]<_min or H[i]>_max :
            print("error")
            sys.exit()
    return input_list

N=input()

# if N.isdecimal()==0 or int(N)<1 or int(N)>20:                                                                                                                                                             
#     print("error")                                                                                                                                                                                        
#     sys.exit()                                                                                                                                                                                            

# N=int(N)                                                                                                                                                                                                  
N=CheckRangeInt(N,1,20)


H=list(map(int,input().strip().split()))

if len(H)!=N :
    print("error")
    sys.exit()

# for i in range(N) :                                                                                                                                                                                       
#     if H[i]<1 or H[i]>100 :                                                                                                                                                                               
#         print("error")                                                                                                                                                                                    
#         sys.exit()                                                                                                                                                                                        

H=CheckRangeList(H,1,100)

highest=0
can_see=0

for i in range(N):
    if H[i]>=highest :
        can_see=can_see+1
        highest=H[i]

print(can_see)
Buggy python submission (verdict: Runtime Error):
File Edit Options Buffers Tools Python Help                                                                                                                                              
# -*- coding: utf-8 -*-                                                                                                                                                                  

import sys

b=input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
elif b=='G':
    print('C')
else :
    sys.exit()


Fixed submission:
import sys

b=input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
elif b=='G':
    print('C')
else :
    sys.exit()
Buggy python submission (verdict: Runtime Error):
S = input()
year = int(S[:4])
month = int(S[5:7])
if year < 2019:
    print('Heisei')
elif year == 2019:
    if month > 4:
        print('TBD')
    else:
        print('Heisei')
else:
    print('TBD'

Fixed submission:
S = input()
year = int(S[:4])
month = int(S[5:7])
if year < 2019:
    print('Heisei')
elif month < 5:
    print('Heisei')
else:
    print('TBD')

Buggy python submission (verdict: Runtime Error):
S = input()
year = int(S[:4])
month = int(S[5:7])
if year < 2019:
    print('Heisei')
elif year == 2019:
    if month > 4:
        print('TBD')
    else:
        print('Heisei')
else:
    print('TBD'

Fixed submission:
S = input()
year = int(S[:4])
month = int(S[5:7])
if year < 2019:
    print('Heisei')
elif month < 5:
    print('Heisei')
else:
    print('TBD')
Buggy python submission (verdict: Runtime Error):
a, p = (int(i) for i in input().split())
print(a*3 // p)

Fixed submission:
a, p = (int(i) for i in input().split())  
print((a*3+p) // 2)

Buggy python submission (verdict: Runtime Error):
a, p = map(int, input().split())
print((a * 3 + p) // 2)


Fixed submission:
a, p = map(int, input().split())
print((a * 3 + p) // 2)

Buggy python submission (verdict: Runtime Error):
a, p = map(int, input().split())
print((a * 3 + p) / 2)


Fixed submission:
a, p = map(int, input().split())
print((a * 3 + p) // 2)
Buggy python submission (verdict: Runtime Error):
sequence_size = int(input())
sequence = list(map(int, input().split()))
error = False
error_msg = -1
sequence.sort()
if max(sequence) > sequence_size:
    print(error_msg)
else:
    for index in range(0,sequence_size - 1):
        if sequence[index] <= index + 1:
            error is False
        else:
            error is True
            break
if error is False:
    for num in sequence:
        print(sequence[num])
else:
    print(error_msg)


Fixed submission:
size = int(input())
sequence = list(map(int, input().split()))

answer = []
while len(sequence):
  if not any(sequence[i] == i + 1 for i in range(len(sequence))):
    print(-1)
    exit()
  for i in reversed(range(len(sequence))):
    if sequence[i] == i + 1:
      answer.append(sequence[i])
      sequence.pop(i)
      break

for ans in reversed(answer):
  print(ans)
Buggy python submission (verdict: Runtime Error):
num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd = len([a for a in bags if (a % 2 == 1]))

if congr_factor == 0 and odd == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd == 0:
  print(0)
else:
  print(2 ** (num_bags-1))


Fixed submission:
num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd_bags = len([bag for bag in bags if (bag % 2 == 1)])

if congr_factor == 0 and odd_bags == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd_bags == 0:
  print(0)
else:
  print(2 ** (num_bags-1))

Buggy python submission (verdict: Runtime Error):
num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd_bags = len([bag for bag in bags if (bag % 2 == 1]))

if congr_factor == 0 and odd == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd == 0:
  print(0)
else:
  print(2 ** (num_bags-1))


Fixed submission:
num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd_bags = len([bag for bag in bags if (bag % 2 == 1)])

if congr_factor == 0 and odd_bags == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd_bags == 0:
  print(0)
else:
  print(2 ** (num_bags-1))
Buggy python submission (verdict: Runtime Error):
passengers, bus_size, time_lim = map(int, input().split())
pass_list = [int(input()) for passenger in range(passengers)]
pass_list.sort()
front = 0
now = 0
cnt = 0
ans = 0
for psngr_lst in pass_list:
    if cnt == 0:
        front = i
        now = i
        cnt += 1
    elif cnt == bus_size:
        front = i
        now = i
        cnt = 1
        ans += 1
    elif now - front <= time_lim:
        if i - front <= time_lim:
            now = i
            cnt += 1
        else:
            front = i
            now = i
            cnt = 1
            ans += 1
if cnt:
    ans += 1
print(ans)
        

Fixed submission:
passengers, bus_size, time_lim = map(int, input().split())
pass_list = [int(input()) for passenger in range(passengers)]
pass_list.sort()
front = 0
now = 0
cnt = 0
ans = 0
for psngr_lst in pass_list:
    if cnt == 0:
        front = psngr_lst
        now = psngr_lst
        cnt += 1
    elif cnt == bus_size:
        front = psngr_lst
        now = psngr_lst
        cnt = 1
        ans += 1
    elif now - front <= time_lim:
        if psngr_lst - front <= time_lim:
            now = psngr_lst
            cnt += 1
        else:
            front = psngr_lst
            now = psngr_lst
            cnt = 1
            ans += 1
if cnt:
    ans += 1
print(ans)