Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#coding: utf-8

def yis(z):
    for i in range(1000):
        if i * i > e - z * z * z:
            y = i - 1
            break
    return y


while True:
    e = int(raw_input())
    y = 0
    z = 0
    if e == 0:
        break
    for i in range(100):
        if i * i * i > e:
            z = i - 1
            break
    n = z
    m = e
    for i in range(n + 1):
        y = yis(z)
        m = min(m,e - y * y - z * z * z + y + z)
        z = z - 1
    print m

    

Fixed submission:
#coding: utf-8
import math

def yis(z):
    y = int(math.floor(math.sqrt(e - z * z * z)))
    return y

while True:
    e = int(raw_input())
    y = 0
    z = 0
    if e == 0:
        break
    for i in range(102):
        if i * i * i > e:
            z = i - 1
            break
    n = z
    m = e
    for i in range(n + 1):
        y = yis(z)
        m = min(m,e - y * y - z * z * z + y + z)
        z = z - 1
    print m
Buggy python submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append([int(x) for x in line.split(' ')])
        if len(data) == 2:
            choice_a = data[0]
            choice_b = data[1]
            data = []

            #print(choice_a)
            #print(choice_b)

            # hit&blow?????????
            hit = 0
            blow = 0
            for i, d in enumerate(choice_a):
                if d in choice_b:
                    if d == choice_b[i]:
                        hit += 1
                    else:
                        blow += 1

            # ???????????¨???
            print('{0} {1}'.format(hit, blow))

Fixed submission:
import sys

if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append([int(x) for x in line.strip().split(' ')])
        if len(data) == 2:
            choice_a = data[0]
            choice_b = data[1]
            data = []

            #print(choice_a)
            #print(choice_b)

            # hit&blow?????????
            hit = 0
            blow = 0
#            for i, d in enumerate(choice_a):
#                if d in choice_b:
#                    if choice_a[i] == choice_b[i]:
#                        hit += 1
#                    else:
#                        blow += 1


            for i, d in enumerate(choice_a):
                if d in choice_b:
                    if d == choice_b[i]:
                        hit += 1
                    else:
                        blow += 1

            # ???????????¨???
            print('{0} {1}'.format(hit, blow))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0057
"""
import sys


Area_memo = [0 for _ in range(10002)]         #  n??¬???????????????????????????????????° (0???????¨????)
Area_memo[0] = 1
def count_area(num):
    """
    ????????°??¨???????????°?????¢????????\????????????????????£????????????
    0 -> 1
    1 -> 2
    2 -> 4
    3 -> 7
    4 -> 11
    ?????£??????i??¬???????????????????????????????????°??????(i-1)??¬????????????????????° + ????????° ??¨?????????
    n?????°????????§??§10,000????????§????????¢???????????????????????????
    :param num:????????°
    :return: ???????????°
    """
    global Area_memo
    if Area_memo[num] == 0:
        Area_memo[num] = num + count_area(num-1)
    return Area_memo[num]


def main(args):
    for line in sys.stdin:
        num = int(line.strip())
        result = count_area(num)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0057
"""
import sys


Area_memo = [0 for _ in range(10002)]         #  n??¬???????????????????????????????????° (0???????¨????)
Area_memo[0] = 1
def count_area(num):
    """
    ????????°??¨???????????°?????¢????????\????????????????????£????????????
    0 -> 1
    1 -> 2
    2 -> 4
    3 -> 7
    4 -> 11
    ?????£??????i??¬???????????????????????????????????°??????(i-1)??¬????????????????????° + ????????° ??¨?????????
    n?????°????????§??§10,000????????§????????¢???????????????????????????
    ??? ?????????????????¨???n?????§????????¨?????°????????????????????°????¢???????????????¨???????????????
    :param num:????????°
    :return: ???????????°
    """
    global Area_memo
    if Area_memo[num] == 0:
        Area_memo[num] = num + count_area(num-1)
    return Area_memo[num]


def count_area2(num):
    wa = num * (1 + num) // 2
    return wa + 1



def main(args):
    for line in sys.stdin:
        num = int(line.strip())
        result = count_area2(num)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0086

"""
import sys
from sys import stdin

input = stdin.readline


def main(args):
    while True:
        routes = []
        while True:
            a, b = map(int, input().split())
            if a == 0 and b == 0:
                break
            routes.append([a, b])
        if len(routes) < 1:
            quit()

        degree = [0] * 101
        for a, b in routes:
            degree[a] += 1
            degree[b] += 1
        odds = [x for x in degree if x%2==1]
        evens = [x for x in degree if x%2==0]

        if len(odds) == 0 or len(odds) == 2:
            print('OK')
        else:
            print('NG')






if __name__ == '__main__':
    main(sys.argv[1:])
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0086

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    for line in sys.stdin:
        routes = []
        a, b = map(int, line.split())
        if a == 0 and b == 0:
            break
        while a != 0 or b!= 0:
            routes.append([a, b])
            a, b = map(int, input().split())

        degrees = [0] * 101
        for a, b in routes:
            degrees[a] += 1
            degrees[b] += 1
        odds = [x for x in degrees if x%2==1]
        # evens = [x for x in degrees if x%2==0]
        # print(degrees)

        if len(odds) == 2 and degrees[1]%2==1 and degrees[2]%2==1:
            print('OK')
        else:
            print('NG')


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Sum of 4 Integers II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0096

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def main(args):
    lut = defaultdict(list)
    for a in range(1001):
        for b in range(1001):
            lut[a+b].append((a, b))

    for line in sys.stdin:
        n = int(line)
        ans = 0
        for i in range(n+1):
            for a, b in lut[i]:
                for c, d in lut[n-i]:
                    ans += 1
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



Fixed submission:
# -*- coding: utf-8 -*-
"""
Sum of 4 Integers II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0096

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def main(args):
    lut = defaultdict(int)
    for a in range(1001):
        for b in range(1001):
            lut[a+b] += 1

    for line in sys.stdin:
        n = int(line)
        ans = 0
        for i in range(n+1):
            ans += lut[i] * lut[n-i]
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135
WA
"""
import sys
from sys import stdin
from math import sqrt, acos, cos, sin, radians, degrees
input = stdin.readline


def solve(time):
    # 12????????????90???
    short_hand_angle = time[1] * -6 + 90
    x_s = cos(radians(short_hand_angle))
    y_s = sin(radians(short_hand_angle))

    long_hand_angle = (time[0]*60+time[1])/(12*60) * -360 + 90
    x_l = cos(radians(long_hand_angle))
    y_l = sin(radians(long_hand_angle))
    c = (x_s * x_l + y_s * y_l) / (sqrt(x_s**2 + y_s**2) * sqrt(x_l**2 + y_l**2))
    ans = degrees(acos(c))

    if ans < 30:
        return 'alert'
    elif ans >= 90:
        return 'safe'
    else:
        return 'warning'


def main(args):
    # n = int(input())
    n = 1
    for _ in range(n):
        time = [int(x) for x in input().split(':')]
        result = solve(time)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0135
WA
"""
import sys
from sys import stdin
from math import sqrt, acos, cos, sin, radians, degrees
input = stdin.readline


def solve(time):
    # 12????????????90???
    short_hand_angle = time[1] * -6 + 90
    x_s = cos(radians(short_hand_angle))
    y_s = sin(radians(short_hand_angle))

    long_hand_angle = (time[0]*60+time[1])/(12*60) * -360 + 90
    x_l = cos(radians(long_hand_angle))
    y_l = sin(radians(long_hand_angle))
    c = (x_s * x_l + y_s * y_l) / (sqrt(x_s**2 + y_s**2) * sqrt(x_l**2 + y_l**2))
    ans = degrees(acos(c))

    if ans < 30:
        return 'alert'
    elif ans >= 90:
        return 'safe'
    else:
        return 'warning'


def main(args):
    n = int(input())
    # n = 1
    for _ in range(n):
        time = [int(x) for x in input().split(':')]
        result = solve(time)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0141

"""
import sys
from sys import stdin
input = stdin.readline
from itertools import cycle


def guruguru(n):
    if n < 5:
        return

    line = 0
    dirs = cycle([(0, -1), (1, 0), (0, 1), (-1, 0)])

    M = [[' '] * n for _ in range(n)]
    cx = 0
    cy = n - 1

    while line < n:
        line += 1
        dx, dy = dirs.__next__()
        while True:
            M[cy][cx] = '#'
            nx = cx + dx
            ny = cy + dy
            nnx = nx + dx
            nny = ny + dy

            if nx < 0 or nx >= n:
                break
            if ny < 0 or ny >= n:
                break
            if nny < 0 or nny >= n or nnx < 0 or nnx >= n:
                pass
            else:
                if M[nny][nnx] != ' ':
                    break
            cx = nx
            cy = ny

    for l in M:
        print(''.join(map(str, l)))


def main(args):
    for line in sys.stdin:
        n = int(line)
        guruguru(n)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0141

"""
import sys
from sys import stdin
input = stdin.readline


M = []
def guruguru(n):
    global M
    dirs = [(0, -1), (1, 0), (0, 1), (-1, 0)] #  x, y???????????? (???????????????????????????)

    M = [[' '] * n for _ in range(n)] #  ??????????????¨?????????????????§?????????
    cx = 0                      #  ??????????????°???
    cy = n - 1
    line = 0                    #  ???????????§??????????????????n??¨???????????°??????????????¨??????

    while line < n:
        dx, dy = dirs[line % 4]
        line += 1
        while True:
            M[cy][cx] = '#'

            nx = cx + dx        #  ?¬???????????????¨???????????????
            if not 0 <= nx < n: #  ??????????????????????????????????????§???????????¢?????????
                break
            ny = cy + dy
            if not 0 <= ny < n:
                break
                
            nnx = nx + dx       #  ?¬?????¬???????????????¨???????????????
            nny = ny + dy
            if 0 <= nny < n and 0 <= nnx < n:
                if M[nny][nnx] != ' ': #  ??????????????????????????????????????¢??????????????????????????£??????????????´??????????????¢?????????
                    break
            cx = nx
            cy = ny

    # ?????????????????????????????????
    for l in M:
        print(''.join(l))


def main(args):
    n = int(input())
    for i in range(n):
        size = int(input())
        guruguru(size)
        if i != (n - 1):        #  ????????\?????????????????????????????????????????\??????
            print()


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0185

"""
import sys
from sys import stdin
from bisect import bisect_left
input = stdin.readline


def create_prime_list(limit):
    """ ??¨??????????????????????????§limit?????§????´???°?????????????±???????
    https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9
    """
    x = limit**0.5
    primes = []
    nums = [x for x in range(2, limit+1)]
    while nums[0] <= x:
        primes.append(nums[0])
        current_prime = nums[0]
        nums = [x for x in nums if x % current_prime != 0]
    primes.extend(nums)
    return primes


def main(args):
    primes = create_prime_list(500000)

    while True:
        # n = 98792
        n = int(input())
        if n == 0:
            break

        ans = 0                 #  ????????????????????????????????°
        for i in range(n):
            a = primes[i]
            if a > n/2:
                break
            i = bisect_left(primes, n - a)
            if i != len(primes) and primes[i] == n-a:
                ans += 1
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0185

"""
import sys
from sys import stdin
from bisect import bisect_left
input = stdin.readline


def create_prime_list(limit):
    """ ??¨??????????????????????????§limit?????§????´???°?????????????±???????
    https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9
    """
    x = limit**0.5
    primes = []
    nums = [x for x in range(2, limit+1)]
    while nums[0] <= x:
        primes.append(nums[0])
        current_prime = nums[0]
        nums = [x for x in nums if x % current_prime != 0]
    primes.extend(nums)
    return primes


def main(args):
    primes = create_prime_list(1000000)

    while True:
        n = int(input())
        if n == 0:
            break

        ans = 0                 #  ????????????????????????????????°
        for i in range(n):
            a = primes[i]
            if a > n/2:
                break
            i = bisect_left(primes, n - a)
            if i != len(primes) and primes[i] == n-a:
                ans += 1
        print(ans)



if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0301
WA
"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def main(args):
    # members = deque(list(range(10)))
    # numbers = [2, 6, 5, 18, 3]
    # queries = [3, 0, 5]

    N, M, Q = map(int, input().split(' '))
    members = list(range(N))
    numbers = [int(x) for x in input().split(' ')]
    queries = [int(x) for x in input().split(' ')]


    for n in numbers:
        if n % 2 == 0:
            members.rotate(-n)
            members.popleft()
        else:
            members.rotate(n)
            members.popleft()


    for q in queries:
        ans = 1 if q in members else 0
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0301

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def main(args):
    # members = deque(list(range(10)))
    # numbers = [2, 6, 5, 18, 3]
    # queries = [3, 0, 5]

    N, M, Q = map(int, input().split(' '))
    members = deque(list(range(N)))
    numbers = [int(x) for x in input().split(' ')]
    queries = [int(x) for x in input().split(' ')]

    for n in numbers:
        if n % 2 == 0:
            # n = n % N
            members.rotate(-n)
            members.popleft()
        else:
            # n = n % N
            members.rotate(n)
            members.popleft()
        N -= 1

    for q in queries:
        ans = 1 if q in members else 0
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539

"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline




def main(args):
    while True:
        d = int(input())
        if d == 0:
            break
        n = int(input())
        m = int(input())
        cw_pos = [int(input()) for _ in range(n-1)]
        dests = [int(input()) for _ in range(m)]

        cw_pos.append(0)
        cw_pos.append(d)
        cw_pos.sort()

        ccw_pos = [d-x for x in cw_pos]
        ccw_pos.sort()


        total_distance = 0
        for t in dests:
            i = bisect_right(cw_pos, t)
            a1 = min(t-cw_pos[i-1], cw_pos[i]-t)

            j = bisect_right(ccw_pos, d-t)
            a2 = min(d-t-ccw_pos[j-1], ccw_pos[j]-(d-t))

            ans = min(a1, a2)
            total_distance += ans

        print(total_distance)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
AC
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline


def main(args):
    while True:
        d = int(input())        #  ??°??¶????????????
        if d == 0:
            break
        n = int(input())        #  ??¬????????????????????°
        m = int(input())        #  ??¨????????°
        cw_pos = [int(input()) for _ in range(n-1)]
        dests = [int(input()) for _ in range(m)]

        cw_pos.append(0)        #  ??¬????????????
        cw_pos.append(d)        #  ??°??¶??????1??¨??????????????¬????????????(??????)
        cw_pos.sort()

#        ccw_pos = [d-x for x in cw_pos] #  ??°??¶?????????????????£????????????????????????
#        ccw_pos.sort()


        total_distance = 0
        for t in dests:
            if t == 0:          #  ?????????????????????0?????\??£????????????bisect_right?????¨????????????????????§??????
                continue
            i = bisect_right(cw_pos, t)          #  ????¨?????????§??????????????????
            a1 = min(t-cw_pos[i-1], cw_pos[i]-t) #  ?????????????????????????????¢

#            j = bisect_right(ccw_pos, d-t)       #  ???????¨?????????§???????????¨?????????
#            a2 = min(d-t-ccw_pos[j-1], ccw_pos[j]-(d-t))

#            ans = min(a1, a2)
            total_distance += a1 #  ?????????????????????????????°OK

        print(total_distance)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
class Fibonacci(object):
    memo = [1, 1]
    def __init__(self):
        pass

    def get_nth(self, n):
        if n <= len(Fibonacci.memo):
            return Fibonacci.memo[n]
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    f = Fibonacci()
    result = f.get_nth(num)

    # ???????????????
    print('{0}'.format(result))

Fixed submission:
from functools import lru_cache


@lru_cache(maxsize=None)
def fib(n):
    """ http://docs.python.jp/3/library/functools.html """
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)


class Fibonacci(object):
    memo = [1, 1]

    def get_nth(self, n):
        if n < len(Fibonacci.memo):
            return Fibonacci.memo[n]
        # print('fib({0}) not found'.format(n))
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
            # print('fib({0})={1} append'.format(i, result))
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    # f = Fibonacci()
    # result = f.get_nth(num)
    result = fib(num+1)

    # ???????????????
    print('{0}'.format(result))

Buggy python submission (verdict: Runtime Error):
class Fibonacci(object):
    memo = [1, 1]

    def get_nth(self, n):
        if n <= len(Fibonacci.memo):
            return Fibonacci.memo[n]
        # print('fib({0}) not found'.format(n))
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
            # print('fib({0})={1} append'.format(i, result))
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    f = Fibonacci()
    result = f.get_nth(num)

    # ???????????????
    print('{0}'.format(result))

Fixed submission:
from functools import lru_cache


@lru_cache(maxsize=None)
def fib(n):
    """ http://docs.python.jp/3/library/functools.html """
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)


class Fibonacci(object):
    memo = [1, 1]

    def get_nth(self, n):
        if n < len(Fibonacci.memo):
            return Fibonacci.memo[n]
        # print('fib({0}) not found'.format(n))
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
            # print('fib({0})={1} append'.format(i, result))
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    # f = Fibonacci()
    # result = f.get_nth(num)
    result = fib(num+1)

    # ???????????????
    print('{0}'.format(result))