Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k = int(input())
a_b = input().split()[1].split(" ")
a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    print("NG")
    break
else:
    print("NG")


Fixed submission:
k = int(input())
a_b = input()
a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    print("NG")
    break
else:
    print("NG")

Buggy python submission (verdict: Runtime Error):
_input = input()
k = _input.split()[0]
a = _input.split()[1].split(" ")[0]
b = _input.split()[1].split(" ")[1]

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    break
    print("NG")




Fixed submission:
k = int(input())
a_b = input()
a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

for i in range(1, 1000):
  if a<= (i* k) <= b:
    print("OK")
    break
  elif (i* k) > b:
    print("NG")
    break
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
t = int(input())
a = 0
b = 100
while b < t:
    b = b * 1.01
    b = int(b)
    a = a + 1
print(k)

Fixed submission:
T = int(input())
a = 0
n = 100
while n < T:
    n = n * 1.01
    n = int(n)
    a = a + 1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  N = int(input())
  As = list(map(int, input().split()))
  for i in range(1, N+1):
    print(As.count(i))

if __name__ == "__main__":
  main()

Fixed submission:
def main():
  N = int(input())
  As = list(map(int, input().split()))
  
  ans_list = [0] * N
  
  for i in As:
    ans_list[i - 1] += 1
   
  for i in range(N):
    ans = ans_list[i]
    print(ans)

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse.csgraph import shortest_path

def main():
    n, x, y = map(int, input().split(" "))
    graph = np.zeros([n, n])
    for i in range(n-1):
        graph[i, i+1] = 1
        graph[x-1, y-1] = 1
    
    s_path = shortest_path(graph, method='D', directed=False)
    #print(s_path)
    for k in range(n-1):
        k += 1
        ans = int(np.count_nonzero(s_path == k) / 2)
        print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
from scipy.sparse.csgraph import shortest_path
import collections

def main():
    n, x, y = map(int, input().split(" "))
    graph = np.zeros([n, n])
    for i in range(n-1):
        graph[i, i+1] = 1
        graph[x-1, y-1] = 1
    
    s_path = shortest_path(graph, method='D', directed=False)
    
    c = collections.Counter(s_path.flatten())
    for k in range(n-1):
        k += 1
        ans = int(c[k] / 2)
        print(ans)


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

    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                ans = "APPROVED"
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    As = list(map(int, input().split(" ")))

    ans = "APPROVED"
    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    ps = list(map(int, input().split(" ")))

    ans = 0
    for i in range(N):
        part = ps[:i+1]
        if min(part) >= ps[i]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

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

    ans = 1
    minnum = ps[0]
    for i in range(N):
        if minnum > ps[i]:
            minnum = ps[i]
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    X = input()
    under2 = int(X[-2] + X[-1])
    X = int(X)

    if X < 100:
        ans = 0
    else:
        if under2 <= 5:
            ans = 1
        else:
            cnt = 0
            while under2 > 5:
                under2 -= 5
                cnt += 1
            cnt += 1

            if X >= cnt * 100:
                ans = 1
            else:
                ans = 0
    
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    X = input()
    X = int(X)

    if X < 100:
        ans = 0
    else:
        X = str(X)
        under2 = int(X[-2] + X[-1])
        X = int(X)
        if under2 <= 5:
            ans = 1
        else:
            cnt = 0
            while under2 > 5:
                under2 -= 5
                cnt += 1
            cnt += 1

            if X >= cnt * 100:
                ans = 1
            else:
                ans = 0
    
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import re

def main():
    S = input()
    N = len(S) + 1

    ans = 0
    s_list = re.split("><", S)
    nelem = len(s_list)
    for i in range(nelem):
        elem = s_list[i]
        ln = elem.count(">") + 1
        rn = elem.count("<") + 1
        if i == 0:
            rn -= 1
        if i == nelem - 1:
            ln -= 1
        nmax = np.max([ln, rn])
        nmin = np.min([ln, rn])
        ans += np.sum(np.arange(start=0, stop=nmax+1, step=1))
        ans += np.sum(np.arange(start=0, stop=nmin, step=1))
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import re
 
def main():
    S = input()
    N = len(S) + 1
 
    ans = 0
    s_list = re.split("><", S)
    nelem = len(s_list)
    for i in range(nelem):
        elem = s_list[i]
        ln = elem.count(">") + 1
        rn = elem.count("<") + 1
        if i == 0:
            rn -= 1
        if i == nelem - 1:
            ln -= 1
        nmax = max([ln, rn])
        nmin = min([ln, rn])
        ans += (0 + nmax) * (nmax + 1) / 2
        ans += (0 + nmin - 1) * (nmin) / 2
    print(int(ans))
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import re

def main():
    S = input()
    N = len(S) + 1

    ans = 0
    s_list = re.split("(><)", S)
    nelem = len(s_list)
    for i in range(nelem):
        elem = s_list[i]
        if elem == "><":
            pass
        else:
            ln = elem.count(">") + 1
            rn = elem.count("<") + 1
            if i == 0:
                rn -= 1
            if i == nelem - 1:
                ln -= 1
            nmax = np.max([ln, rn])
            nmin = np.min([ln, rn])
            #print("===")
            #print([rn, ln])
            #print(np.arange(start=0, stop=nmax+1, step=1))
            #print(np.arange(start=0, stop=nmin-1, step=1))
            ans += np.sum(np.arange(start=0, stop=nmax+1, step=1))
            ans += np.sum(np.arange(start=0, stop=nmin, step=1))
    #print(s_list)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import re
 
def main():
    S = input()
    N = len(S) + 1
 
    ans = 0
    s_list = re.split("><", S)
    nelem = len(s_list)
    for i in range(nelem):
        elem = s_list[i]
        ln = elem.count(">") + 1
        rn = elem.count("<") + 1
        if i == 0:
            rn -= 1
        if i == nelem - 1:
            ln -= 1
        nmax = max([ln, rn])
        nmin = min([ln, rn])
        ans += (0 + nmax) * (nmax + 1) / 2
        ans += (0 + nmin - 1) * (nmin) / 2
    print(int(ans))
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    As = list(map(int, input().split()))
    #print(As)
    #print([As.index(i+1)+1 for i in range(N)])
    ans = " ".join([str(As.index(i+1)+1) for i in range(N)])
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    As = list(map(int, input().split()))
    ans = " ".join(list((np.argsort(As)+1).astype("str")))
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def main():
    input = sys.stdin.readline
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"
    print(ans)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"
    print(ans)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
def main():
    input = sys.stdin.readline
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"
    print(ans)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"
    print(ans)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
def main():
    input = sys.stdin.readline
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"

    print(ans)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()
    if S == "Sunny":
        ans = "Cloudy"
    elif S == "Cloudy":
        ans = "Rainy"
    elif S == "Rainy":
        ans = "Sunny"
    print(ans)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    Hs = list(map(int, input().split()))

    cnt = 0
    cnts = []
    for i in range(N-1):
        #print(Hs[i])
        #print(Hs[i+1])
        if Hs[i] >= Hs[i + 1]:
            cnt += 1
            #print("==")
        else:
            #print("P")
            cnts.append(cnt)
            cnt = 0
        cnts.append(cnt)
        #print(cnts)
    ans = max(cnts)
    #print(cnts)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    Hs = list(map(int, input().split()))

    cnt = 0
    ans = 0
    [cnt for i in range(N-1)]
    for i in range(N-1):
        if Hs[i] >= Hs[i + 1]:
            cnt += 1
        else:
            if ans < cnt:
                ans = cnt
            cnt = 0
        if ans < cnt:
            ans = cnt
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):

import sys
#import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    Hs= list(map(int, input().split()))
    HsProc = Hs.copy()
 
    #proc = np.array(N)
    ans = ""
    for i in range(N):
        #print(Hs)
        h_tmp = Hs[i]
        if i < N - 1:
            h_next = Hs[i + 1]
            if h_tmp < h_next:
                Hs[i+1] -= 1
                pass
            elif h_tmp == h_next:
                pass
            elif h_tmp - 1 == h_next:
                if i > 0:
                    h_before = Hs[i - 1]

                    if h_before <= h_tmp - 1:
                        #proc[i] = 1
                        pass
                    else:
                        ans = "No"
                        break
                elif i == 0:
                    #proc[i] = 1
                    pass
            else:
                ans = "No"
                break
    if ans == "":
        ans = "Yes"

    print(ans)
 
if __name__ == '__main__':
    main()

Fixed submission:
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    Hs= list(map(int, input().split()))
    hs = [0]
    ans = ""
    for i in range(N):
        hs.append(0)
        #print(Hs)
        h_tmp = Hs[i]
        if i < N - 1:
            h_next = Hs[i + 1]
            if h_tmp < h_next:
                hs[i + 1] = 1
                Hs[i + 1] -= 1
                pass
            elif h_tmp == h_next:
                pass
            elif h_tmp - 1 == h_next and hs[i] == 0:
                if i > 0:
                    h_before = Hs[i - 1]
                    if h_before <= h_tmp - 1:
                        pass
                    else:
                        ans = "No"
                        break
                elif i == 0:
                    pass
            else:
                ans = "No"
                break
    if ans == "":
        ans = "Yes"
 
    print(ans)
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline

    AB = input().split(" ")
    A = int(AB[0])
    B = int(AB[1])
    if (A + B) % 2 == 1:
        res = 'IMPOSSIBLE'
    elif:
        res = int((A + B) / 2)
    print(res)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline

    AB = input().split(" ")
    A = int(AB[0])
    B = int(AB[1])
    if (A + B) % 2 == 1:
        res = 'IMPOSSIBLE'
    else:
        res = int((A + B) / 2)
    print(res)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
an = np.array(input().split(" ")).astype("int64")
if an[0] == 0:
    if n % 2 == 0:
        print("0")
    elif n % 2 == 1:
        print("1")
        print("1")
elif an[0] == 1:
    if n % 2 == 0:
        print("1")
        print("1")
    elif n % 2 == 1:
        print("0")

Fixed submission:
r = int(input())
print(3 * (r ** 2))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
an = np.array(input().split(" ")).astype("int64")


if an[0] == 0:
    if n % 2 == 0:
        print("0")
    elif n % 2 == 1:
        print("1")
        print("1")
elif an[0] == 1:
    if n % 2 == 0:
        print("1")
        print("1")
    elif n % 2 == 1:
        print("0")

Fixed submission:
r = int(input())
print(3 * (r ** 2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
an = []
for i in range(n):
    an.append(int(input()))

import numpy as np
an = np.array(an)
for i in range(n):
	ind = np.ones(n, dtype=bool)
	ind[i] = False
	res = np.max(an[ind])
	print(res)

Fixed submission:
n = int(input())
an = []
for i in range(n):
    an.append(int(input()))

import numpy as np
an = np.array(an)
_an = an.argsort()[::-1]
_max = np.max(an[_an[0]])
_max_next = np.max(an[_an[1]])
an[an < _max] = _max
an[_an[0]] = _max_next
an = an.astype("str")
print("\n".join(list(an)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
an = []
for i in range(n):
    an.append(int(input()))
import copy
for i in range(n):
    an_tmp = copy.copy(an)
    del an_tmp[i]
    res = max(an_tmp)
    print(res)

Fixed submission:
n = int(input())
an = []
for i in range(n):
    an.append(int(input()))

import numpy as np
an = np.array(an)
_an = an.argsort()[::-1]
_max = np.max(an[_an[0]])
_max_next = np.max(an[_an[1]])
an[an < _max] = _max
an[_an[0]] = _max_next
an = an.astype("str")
print("\n".join(list(an)))
Buggy python submission (verdict: Runtime Error):
age = int(input())

if age == 1:
    print(Hello World)
else:
    a = int(input())
    b = int(input())
    print(a + b)

Fixed submission:
age = int(input())

if age == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split(' ')))
c=0
for i in range(len(l)):
    for j in range(i+1,len(l)):
        if(l[i]==l[j]):
            print("NO")
            c=1
            break
    if(c==1):break
if(c==0):print("YES")

Fixed submission:
n=int(input())
l=list(map(int,input().split(' ')))
l.sort()
c=0
for i in range(len(l)-1):
    if(l[i]==l[i+1]):
        c=1 
        break
if(c==0):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split(' ')))
c=0
for i in l:
    c+=l.count(i)
if(c<=len(l)):
    print("YES")
else:
    print("NO")

Fixed submission:
n=int(input())
l=list(map(int,input().split(' ')))
l.sort()
c=0
for i in range(len(l)-1):
    if(l[i]==l[i+1]):
        c=1 
        break
if(c==0):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        string = data[i][2] + string
    else:
        string = string + data[i][2]

if(key == 0):
    print(string)
else:
    print(string[::-1])


Fixed submission:
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start
former = []
latter = []

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        former.append(data[i][2])
    else:
        latter.append(data[i][2])

string = ''.join(former[::-1]) + string + ''.join(latter)
if(key == 0):
    print(string)
else:
    print(string[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif(data[i][1] == '1'):
        if(key == 0):
            string = data[i][2] + string
        else:
            string = string + data[i][2]
    elif(key == 0):
        string = string + data[i][2]
    else:
        string = data[i][2] + string
if(key == 0):
    print(string)
else:
    print(string[::-1])


Fixed submission:
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start
former = []
latter = []

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        former.append(data[i][2])
    else:
        latter.append(data[i][2])

string = ''.join(former[::-1]) + string + ''.join(latter)
if(key == 0):
    print(string)
else:
    print(string[::-1])

Buggy python submission (verdict: Runtime Error):
string = input()
num = int(input())
data = [input().split(' ') for i in range(kai)]

for i in range(num):
    if(data[i][0] == '1'):
        if(len(string) == 2):
            string = string[1] + string[0]
        elif(len(string) >= 3):
            string = string[-1] + string[1:-1] + string[0]
        
    else:
        if(data[i][1] == '1'):
            string = data[i][2] + string
        else:
            string = string + data[i][2]

print(string)


Fixed submission:
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start
former = []
latter = []

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        former.append(data[i][2])
    else:
        latter.append(data[i][2])

string = ''.join(former[::-1]) + string + ''.join(latter)
if(key == 0):
    print(string)
else:
    print(string[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
data = input().split(' ')
n = 1
key = 0
while(str(n) in data):
    key = 1
    data = data[data.index(str(n)):]
    n += 1
if(key == 0):
    print(-1)
else:
    print(num - n + 1)


Fixed submission:
num = int(input())
input_data = input().split(' ')
if("1" in input_data):
    input_data = input_data[input_data.index('1'):]
    ref = 1
    for i in range(len(input_data)):
        if(int(input_data[i]) - ref == 1):
            ref += 1

    print(num - ref)
else:
    print('-1')

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
input_data = input().split(' ')
data = [int(input_data[i]) for i in range(len(input_data))]
n = 1
key = 0
while(n in data):
    key = 1
    data = data[data.index(n):]
    n += 1

if(key == 0):
    print(-1)
else:
    print(num - n + 1)


Fixed submission:
num = int(input())
input_data = input().split(' ')
if("1" in input_data):
    input_data = input_data[input_data.index('1'):]
    ref = 1
    for i in range(len(input_data)):
        if(int(input_data[i]) - ref == 1):
            ref += 1

    print(num - ref)
else:
    print('-1')
Buggy python submission (verdict: Runtime Error):
import itertools

N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
res = 0
ls=list(range(1,M+1))

for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]]-a[c[0]]==c[2]:
            p += c[3]
        res = max(res,p)

print(res)

Fixed submission:
N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
import itertools
res = 0
ls=list(range(1,M+1))
for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]-1]-a[c[0]-1]==c[2]:
            p += c[3]
        res = max(res,p)
print(res)

Buggy python submission (verdict: Runtime Error):
N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
import itertools
res = 0
ls=list(range(1,M+1))
for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]]-a[c[0]]==c[2]:
            p += c[3]
        res = max(res,p)
print(res)

Fixed submission:
N,M,Q = list(map(int, input().split()))
C = []
for i in range(Q):
    C.append(list(map(int, input().split())))
    
import itertools
res = 0
ls=list(range(1,M+1))
for a in itertools.combinations_with_replacement(ls, N):
    p = 0
    for c in C:
        if a[c[1]-1]-a[c[0]-1]==c[2]:
            p += c[3]
        res = max(res,p)
print(res)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
sd=sorted(d)
print(sd[(n//2)]-sd[(n//2)-1])