Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
  for b in range(B+1):
    
  	for c in range(C+1):
      value = 500*a + 100*b + 50*c 
      if value == X:
      	ans += 1
print(ans)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      value = 500*a + 100*b + 50*c 
      if value == X:
      	ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
  　　for b in range(B+1):
    　　　　for c in range(C+1):
      　　　　　　value = 500*a + 100*b + 50*c 
      　　　　　　if value == X :
        　　　　　	ans += 1
        　　　　　	print(a, b, c)
        

print(ans)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      value = 500*a + 100*b + 50*c 
      if value == X:
      	ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
S = list(S)
s = list(reversed(S))
def check(s):
  if len(s) >= 6:

    j1 = ''.join(s[:5])
    j2 = ''.join(s[:6])
    j3 = ''.join(s[:7])
  elif len(s) == 5:
    j1 = ''.join(s[:5])
    j2 = ''.join(s[:6])
    j3 = ''
  else:
    j1 = ''.join(s[:5])
    j2 = ''
    j3 = ''  
  if (j1 == 'esare') or (j1 == 'maerd'):
    x =  ''.join(s[5:])
    return x
  elif j2 == 'resare':
    x = ''.join(s[6:])
    return x
  elif j3 == 'remaerd':
    x = ''.join(s[:7])
    return x
  else:
    return 'no'

while True:
  s = list(check(s))
  if s == list('no'):
    print('NO')
    break
  if s == []:
    print('YES')
    break




Fixed submission:
S = input()
S = list(S)
s = ''.join(list(reversed(S)))
def main(s):
  l = ["resare", "esare","remaerd", "maerd"]
  for i in l:
    s = s.replace(i, '')
  return s
if main(s) == '':
  print('YES')
elif main(s) != '':
  print('NO')
Buggy python submission (verdict: Runtime Error):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(input):
    [A, B] = string_to_int(input)
    return A*B


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(input):
    nums = string_to_int(input)

    def euclid(large, small):
        if small == 0:
            return large
        l = large % small
        return euclid(small, l)

    nums.sort(reverse=True)
    eee = euclid(nums[0], nums[1])
    return int((nums[0] * nums[1]) / eee)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(input())
    print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    count = 0
    for x in range(1, N):
        count += x
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
import math

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        # half_l = math.floor(num / 2)
        # half = (half_l + half_l + 1) / 2
        half = num // 2
        append = num // 2
    else:
        half = (num + 1) // 2
        append = 0
        # half = math.floor(num / 2)
    return half * num + append


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    M = [x for x in range(1, N)]
    return sum(M)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
import math

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        # half_l = math.floor(num / 2)
        # half = (half_l + half_l + 1) / 2
        half = num // 2
        append = num // 2
    else:
        half = (num + 1) // 2
        append = 0
        # half = math.floor(num / 2)
    return half * num + append


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
from math import factorial

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    string_type = {}
    for s in inputs:
        count = {}
        s_list = list(s)
        s_list.sort()
        for c in s_list:
            if c in count:
                count[c] += 1
            else:
                count[c] = 1
        key = ""
        for k in count.keys():
            key += "{}{}".format(k, count[k])
        if key in string_type:
            string_type[key] += 1
        else:
            string_type[key] = 1

    comb_count = 0
    for v in string_type.values():
        if v != 1:
            if v == 2:
                comb_count += 1
            else:
                comb_count += factorial(v) / factorial(2) / factorial(v-2)
    return int(comb_count)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)


Fixed submission:
import sys
from math import factorial

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    string_type = {}
    for s in inputs:
        count = {}
        s_list = list(s)
        s_list.sort()
        for c in s_list:
            if c in count:
                count[c] += 1
            else:
                count[c] = 1
        key = ""
        for k in count.keys():
            key += "{}{}".format(k, count[k])
        if key in string_type:
            string_type[key] += 1
        else:
            string_type[key] = 1

    comb_count = 0
    for v in string_type.values():
        if v != 1:
            if v == 2:
                comb_count += 1
            else:
                comb_count += factorial(v) // factorial(v-2) // factorial(2)
    return comb_count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    H = string_to_int(inputs[0])
    min_h = -1

    if len(H) == 1:
        return "Yes"

    not_operation_start = -1
    for i in range(len(H)-1):
        if H[i] - H[i+1] >= 2:
            return "No"
        elif H[i] - H[i+1] == 1:
            if not_operation_start == -1:
                if i - 1 >= 0:
                    if H[i] - H[i-1] >= 1:
                        H[i] -= 1
                    else:
                        return "No"
                else:
                    H[i] -= 1
            else:
                if not_operation_start - 1 >= 0:
                    if H[not_operation_start] - H[not_operation_start-1] >= 1:
                        H[i] -= 1
                    else:
                        return "No"
                else:
                    H[i] -= 1
            not_operation_start = -1
        else:
            if not_operation_start == -1:
                not_operation_start = i
    return "Yes"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    inputs()
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    H = string_to_int(inputs[0])
    min_h = -1

    if len(H) == 1:
        return "Yes"

    not_operation_start = 0
    for i in range(len(H)-1):
        flg = True
        if H[i] - H[i+1] >= 2:
            return "No"
        elif H[i] - H[i+1] == 1:
            if i - 1 >= 0:
                if H[i] - H[i-1] >= 1:
                    flg = True
                else:
                    flg = False
            else:
                flg = True
            if flg is False and not_operation_start != -1:
                if not_operation_start - 1 >= 0:
                    # if H[not_operation_start] - H[not_operation_start-1] >= 1
                    flg = False
                    for j in range(not_operation_start, i+1):
                        if H[j] - H[j - 1] >= 1:
                            flg = True
                            break
                else:
                    flg = True
            if flg:
                H[i] -= 1
            else:
                return "No"
            not_operation_start = -1
        else:
            if not_operation_start == -1:
                not_operation_start = i
    return "Yes"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
998244353 99824435

Fixed submission:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B] = string_to_int(inputs[0])
    if (A + B) % 2 != 0:
        return "IMPOSSIBLE"
    else:
        return (A+B) // 2


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    p = string_to_int(inputs[0])

    diff_point = []
    for i, num in enumerate(range(1, len(p)+1)):
        if num != p[i]:
            diff_point.append(i)
    if len(diff_point) == 2 | | len(diff_point) == 0:
        return "YES"
    return "NO"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    p = string_to_int(inputs[0])

    diff_point = []
    for i, num in enumerate(range(1, len(p)+1)):
        if num != p[i]:
            diff_point.append(i)
    if len(diff_point) == 2 or len(diff_point) == 0:
        return "YES"
    return "NO"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [a, b] = string_to_int(inputs[0])

    ret = 0
    if a > b:
        ret += a
        a -= 1
    else:
        ret += b
        b -= 1
    if a > b:
        ret += a
    else:
        ret += b

    return ret


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)


Fixed submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [a, b] = string_to_int(inputs[0])

    ret = 0
    if a > b:
        ret += a
        a -= 1
    else:
        ret += b
        b -= 1
    if a > b:
        ret += a
    else:
        ret += b

    return ret


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    ACGT = {"A", "C", "G", "T"}

    max_length = 0
    for i in range(0, len(S)):
        length = 0
        j = i
        while S[j] in ACGT and j < len(S):
            length += 1
            j += 1
        max_length = length if length > max_length else max_length
    return max_length


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    ACGT = {"A", "C", "G", "T"}

    max_length = 0
    for i in range(0, len(S)):
        length = 0
        j = i
        while j < len(S) and S[j] in ACGT:
            length += 1
            j += 1
        max_length = length if length > max_length else max_length
    return max_length


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    BTC_TO_YEN = 380000.0
    result = 0.0
    otoshidama = [i.split() for i in inputs]
    for o in otoshidama:
        if o[1] == "BTC":
            result += float(o[0]) * BTC_TO_YEN
        else:
            result += float(o[0])
    return result


def string_to_float(string):
    return list(map(lambda x: float(x), string.split()))


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N] = string_to_int(inputs(1))
    ret = solve(inputs(N))
    print(ret)


Fixed submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    BTC_TO_YEN = 380000.0
    result = 0.0
    otoshidama = [i.split() for i in inputs]
    for o in otoshidama:
        if o[1] == "BTC":
            result += float(o[0]) * BTC_TO_YEN
        else:
            result += float(o[0])
    return result


def string_to_float(string):
    return list(map(lambda x: float(x), string.split()))


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, A, B, C, inputs):
    bamboos = [int(i) for i in inputs]

    def cost(cursor, a, b, c):
        if cursor == N:
            if min(a, b, c) > 0:
                return abs(A-a) + abs(B-b) + abs(C-c) - 30
            else:
                return 1000000000

        t = bamboos[cursor]
        results = []
        results.append(cost(cursor+1, a, b, c))
        results.append(cost(cursor+1, a + t, b, c) + 10)
        results.append(cost(cursor+1, a, b + t, c) + 10)
        results.append(cost(cursor+1, a, b, c + t) + 10)

        return min(results)

    return cost(0, 0, 0, 0)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, A, B, C] = string_to_int(inputs(1))
    ret = solve(N, A, B, C, inputs(N))
    print(ret)


Fixed submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, A, B, C, inputs):
    bamboos = [int(i) for i in inputs]

    def cost(cursor, a, b, c):
        if cursor == N:
            if min(a, b, c) > 0:
                return abs(A-a) + abs(B-b) + abs(C-c) - 30
            else:
                return 1000000000

        t = bamboos[cursor]
        results = []
        results.append(cost(cursor+1, a, b, c))
        results.append(cost(cursor+1, a + t, b, c) + 10)
        results.append(cost(cursor+1, a, b + t, c) + 10)
        results.append(cost(cursor+1, a, b, c + t) + 10)

        return min(results)

    return cost(0, 0, 0, 0)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, A, B, C] = string_to_int(input())
    ret = solve(N, A, B, C, inputs(N))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) == 1:
        return nums[0]

    ret = math.gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = math.gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd(a, b):
    if a == 0:
        return b
    if b == 0:
        return a

    if a > b:
        return gcd(b, a % b)
    else:
        return gcd(a, b % a)


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) == 1:
        return nums[0]

    ret = gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) <= 2:
        return min(nums)

    ret = math.gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = math.gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def gcd(a, b):
    if a == 0:
        return b
    if b == 0:
        return a

    if a > b:
        return gcd(b, a % b)
    else:
        return gcd(a, b % a)


def gcd_multi(nums):
    if len(nums) == 0:
        return 0
    if len(nums) == 1:
        return nums[0]

    ret = gcd(nums.pop(), nums.pop())
    while len(nums) > 0:
        ret = gcd(ret, nums.pop())
    return ret


def solve(inputs):
    monsters = string_to_int(inputs[0])
    return gcd_multi(monsters)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    [T, A] = string_to_int(inputs[1])
    H = string_to_int(inputs[2])

    min_diff = -1
    min_diff_i = -1
    for i, h in enumerate(H):
        t = T - h * 0.006
        diff = abs(A-t)
        if min_diff == -1 or diff < min_diff:
            min_diff = diff
            min_diff_i = i
    return min_diff_i


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    [T, A] = string_to_int(inputs[1])
    H = string_to_int(inputs[2])

    min_diff = -1
    min_diff_i = -1
    for i, h in enumerate(H):
        t = T - h * 0.006
        diff = abs(A-t)
        if min_diff == -1 or diff < min_diff:
            min_diff = diff
            min_diff_i = i
    return min_diff_i + 1


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(3))
    print(ret)