Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def f(x,y):
	if x*y < 0:
		return min(f(-x,y),f(y,-x))
	else:
		return x-y+2 if x>y else x-y
print(f(x,y=map(int,input().split())))

Fixed submission:
x,y = map(int,input().split())
def f(a):
	m = float('inf')
	for i in a:
		if i >= 0:
			m = min(i,m)
	return m
print(f([y-x,y+x+1,-x-y+1,x-y+2]))

Buggy python submission (verdict: Runtime Error):
def f(x,y):
	if x*y < 0:
		return min(f(-x,y),f(y,-x))
	else:
		return x-y+2 if x>y else x-y
print(f(map(int,input().split())))

Fixed submission:
x,y = map(int,input().split())
def f(a):
	m = float('inf')
	for i in a:
		if i >= 0:
			m = min(i,m)
	return m
print(f([y-x,y+x+1,-x-y+1,x-y+2]))

Buggy python submission (verdict: Runtime Error):
def f(x,y):
	if x*y < 0:
		return min(f(-x,y),f(y,-x))
	else:
		return x-y+2 if x>y else x-y
print(f(list(map(int,input().split()))))

Fixed submission:
x,y = map(int,input().split())
def f(a):
	m = float('inf')
	for i in a:
		if i >= 0:
			m = min(i,m)
	return m
print(f([y-x,y+x+1,-x-y+1,x-y+2]))
Buggy python submission (verdict: Runtime Error):
def resolve():
    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n

        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]

        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)

            if x == y:
                return

            if self.parents[x] > self.parents[y]:
                x, y = y, x

            self.parents[x] += self.parents[y]
            self.parents[y] = x

        def size(self, x):
            return -self.parents[self.find(x)]

        def same(self, x, y):
            return self.find(x) == self.find(y)

        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]

        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]

        def group_count(self):
            return len(self.roots())

        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}

        def __str__(self):
            return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    n, m = map(int, input().split())
    UF = UnionFind(n)
    for i in range(m):
        a, b = map(int, input().split())
        UF.union(a,b)
    grp = UF.group_count()
    if grp == 1:
        print(0)
    else:
        print(grp-1)

resolve()

Fixed submission:
def resolve():
    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n

        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]

        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)

            if x == y:
                return

            if self.parents[x] > self.parents[y]:
                x, y = y, x

            self.parents[x] += self.parents[y]
            self.parents[y] = x

        def size(self, x):
            return -self.parents[self.find(x)]

        def same(self, x, y):
            return self.find(x) == self.find(y)

        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]

        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]

        def group_count(self):
            return len(self.roots())

        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}

        def __str__(self):
            return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    n, m = map(int, input().split())
    UF = UnionFind(n)
    for i in range(m):

        a, b = map(int, input().split())
        a -= 1
        b -= 1
        UF.union(a,b)
    grp = UF.group_count()
    if grp == 1:
        print(0)
    else:
        print(grp-1)

resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    n, k = map(int, input().split())
    mod = 998244353
    dp = [0] * (2*n)
    imos = [0] * (2*n)
    lr = []
    for i in range(k):
        l, r = map(int, input().split())
        lr.append((l, r+1))
    for l, r in lr:
        imos[l] = 1
        imos[r] = -1
    now = 0
    for i in range(1, n):
        now += imos[i]
        now %= mod
        dp[i] = now
        for l, r in lr:
            imos[min(i+l, n+2)] += now
            imos[min(i+r, n+2)] += -1*now
    print(dp[n-1]%mod)


resolve()

Fixed submission:
def resolve():
    n, k = map(int, input().split())
    mod = 998244353
    dp = [0] * (3*n)
    imos = [0] * (3*n)
    lr = []
    for i in range(k):
        l, r = map(int, input().split())
        lr.append((l, r+1))
    for l, r in lr:
        imos[l] += 1
        imos[r] += -1
    for i in range(1, n+1):
        dp[i] = (dp[i-1] + imos[i]) %mod
        for l, r in lr:
            imos[min(i+l, n+2)] += dp[i]
            imos[min(i+r, n+2)] += -1*dp[i]
    print(dp[n-1]%mod)

resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    s = input()
    t = input()
    ans = 0

    for i in range(len(t)):
        for j in range(i, len(t)):
            test = t[i:(j + 1)]
            if test in s[i:(len(s) - (len(t) - j) + 1)]:
                print(test)
                ans = max(ans, len(test))
    print(len(t) - ans)

resolve()

Fixed submission:
def resolve():
    s = input()
    t = input()
    ans = 10**4

    for i in range(len(s)-len(t)+1):
        ch = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                ch += 1
        ans = min(ch, ans)
    print(ans)

resolve()
Buggy python submission (verdict: Runtime Error):
d = int(input())
_ = list((map(int, input().split())))
sat = [list((map(int, input().split()))) for _ in range(365)]
for i in range(365):
    if i % 3 != 0:
        print(i%26 + 1)
    else:
        ans = 0
        cost = 0
        for j in range(26):
            if cost < sat[i][j]:
                ans = j+1
                cost = sat[i][j]
        print(ans)
resolve()

Fixed submission:
def resolve():
    D = int(input())
    cost = list(map(int, input().split()))
    sat = [list((map(int, input().split()))) for _ in range(D)]
    last = [0]*26

    for i in range(D):
        maxcost = 0
        ans = 0
        for j in range(26):
            if maxcost <= sat[i][j]:
                ans = j+1
                maxcost = sat[i][j]
        print(ans)
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    from collections import deque
    n,m,k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    a = deque(a)
    b = deque(b)
    min = 0
    ans = 0
    while True:
        if len(a) == 0 and len(b)==0:
            break
        elif len(a) == 0:
            bb = b.popleft()
            read = bb
            if min + read <= k:
                min += read
                ans += 1
            else:
                break
        elif len(b) == 0:
            ab = a.popleft()
            read = ab
            if min + read <= k:
                min += read
                ans += 1
            else:
                break
        else:
            ab = a.popleft()
            bb = b.popleft()
            if ab == bb:
                if a[0] < b[0]:
                    b.appendleft(bb)
                    read = ab
                else:
                    a.appendleft(ab)
                    read = bb

            elif ab < bb:
                b.appendleft(bb)
                read = ab
            else:
                a.appendleft(ab)
                read = bb
            if min + read <= k:
                min += read
                ans += 1
            else:
                break

    print(ans)
resolve()

Fixed submission:

def resolve():
    import bisect
    n,m,k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    cuma = [0]
    cumb = [0]
    for i in range(n):
        cuma.append(cuma[-1]+ a[i])
    for i in range(m):
        cumb.append(cumb[-1] + b[i])

    ans = 0
    for i in range(n+1):
        if k-cuma[i] < 0:
            continue
        ans = max(ans, i + bisect.bisect_right(cumb, k-cuma[i])-1)
    print(ans)
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    import math
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        count = math.floor(n/i)
        last = int(math.floor(n/i) * i)
        ans += (i+last)*count//2
    print(ans)


resolve()

Fixed submission:
def resolve():
    import math
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        count = math.floor(n/i)
        last = int(math.floor(n/i) * i)
        ans += (i+last)*count//2
    print(ans)

resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k):
        nxt = [0]*n
        for j in range(len(a)):
            r = min(j + a[j], n-1) #look right
            l = max(j-a[j], 0) #look left
            for m in range(l, r+1):
                nxt[m] = min(nxt[m]+1,n)
        a, nxt = nxt, a
        if a == nxt:
            break
    print(*a)
resolve()

Fixed submission:
def resolve():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k):
        nxt = [0]*n
        for j in range(len(a)):
            r = min(j + a[j], n-1) #look right
            l = max(j-a[j], 0) #look left
            nxt[l] += 1
            if r+1 < n:
                nxt[r+1] -= 1
        b = [0] *n
        for j in range(len(a)):
            if j== 0:
                b[j] = nxt[j]
            else:
                b[j] = (nxt[j]+b[j-1])
        a, b = b, a
        if a == b:
            break
    print(*a)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k):
        nxt = [1]*n
        for j in range(len(a)):
            if a[j] == 0:
                continue
            r = min(j + a[j], n-1) #look right
            l = max(j-a[j], 0) #look left
            for m in range(j+1, r+1):
                nxt[m] = min(nxt[m]+1,n)

            for m in range(l, j):
                nxt[m] = min(nxt[m]+1,n)


        a, nxt = nxt, a
        if a == nxt:
            break
    print(*a)

resolve()

Fixed submission:
def resolve():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k):
        nxt = [0]*n
        for j in range(len(a)):
            r = min(j + a[j], n-1) #look right
            l = max(j-a[j], 0) #look left
            nxt[l] += 1
            if r+1 < n:
                nxt[r+1] -= 1
        b = [0] *n
        for j in range(len(a)):
            if j== 0:
                b[j] = nxt[j]
            else:
                b[j] = (nxt[j]+b[j-1])
        a, b = b, a
        if a == b:
            break
    print(*a)
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int,input().split()))
    dp = [[0]*(s+10) for _ in range(n+10)]
    dp[0][0] = 1
    mod = 998244353
    for i in range(1,n+1):
        nexta = a[i-1]
        for j in range(0, s+1):
            dp[i][j] += (2 * dp[i - 1][j])% mod
            if j + nexta > s:
                continue
            else:
                dp[i][j+nexta] += (dp[i-1][j])%mod
    print((dp[n][s])%mod)
resolve(()

Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int,input().split()))
    dp = [[0]*(s+10) for _ in range(n+10)]
    dp[0][0] = 1
    mod = 998244353
    for i in range(1,n+1):
        nexta = a[i-1]
        for j in range(0, s+1):
            dp[i][j] += (2 * dp[i - 1][j])% mod
            if j + nexta > s:
                continue
            else:
                dp[i][j+nexta] += (dp[i-1][j])%mod
    print((dp[n][s])%mod)
resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():
    import math
    from fractions import Fraction
    mod = 10**9 + 7
    n = int(input())
    dic1 = {}
    dic1["all0"] = 0
    dic1["b0"] = 0
    dic1[Fraction(0,1)] = 0
    for i in range(n):
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            dic1["all0"] += 1
        elif b == 0:
            dic1["b0"] += 1
        else:
            c = math.gcd(a,b)
            a = a//c
            b = b//c
            if Fraction(a,b) in dic1:
                dic1[Fraction(a,b)] += 1
            else:
                dic1[Fraction(a,b)] = 1

    ans = 1
    all0 = 0
    for i in dic1:
        if i == "all0":
            all0 = dic1["all0"]
            continue
        elif i == "b0":
            counter = Fraction(0, 1)
            ans *= (2 ** dic1[i] + 2 ** dic1[counter] - 1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0
        elif i == Fraction(0,1):
            counter = "b0"
            ans *= (2 ** dic1[i] + 2 ** dic1[counter] - 1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0

        elif -1 * (Fraction(1,i)) in dic1:
            counter = -1 * (Fraction(1,i))
            ans *= (2**dic1[i]+2**dic1[counter]-1)
            ans %= mod
            dic1[i] = 0
            dic1[counter] = 0
        else:
            ans *= (dic1[i]+1)
            ans %= mod
    ans += all0
    print(ans%mod-1)
resolve()



Fixed submission:
def resolve():
    n = int(input())
    n = n%10
    if n == 3:
        print("bon")
    elif n == 0 or n == 1 or n == 6 or n == 8:
        print("pon")
    else:
        print("hon")
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    import collections
    n, m = map(int, input().split())
    hw = [[0]*(n+1) for _ in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        hw[a][b] = 1
        hw[b][a] = 1
    dis = [0] * (n+1)
    arr = [-1] * (n+1)
    que = collections.deque([1])
    while len(que) != 0:
        a = que.popleft()
        test = hw[a]
        for i in range(len(test)):
            if test[i] == 1:
                if arr[i] == -1:
                    arr[i] = a
                    que.append(i)
    if 0 in arr[2:]:
        print("No")
    else:
        print("Yes")
        for i in range(2, len(arr)):
            print(arr[i])
 
resolve()

Fixed submission:
def resolve():
    import collections
    n, m = map(int, input().split())
    hw = [[0] for _ in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        hw[a].append(b)
        hw[b].append(a)

    dis = [0] * (n+1)
    arr = [-1] * (n+1)
    que = collections.deque([1])
    while len(que) != 0:
        a = que.popleft()
        test = hw[a]
        for i in range(len(test)):
            if test[i] != 0:
                goal = test[i]
                if arr[goal] == -1:
                    arr[goal] = a
                    que.append(goal)
    if 0 in arr[2:]:
        print("No")
    else:
        print("Yes")
        for i in range(2, len(arr)):
            print(arr[i])
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    import collections
    n, m = map(int, input().split())
    hw = [[0]*(n+1) for _ in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        hw[a][b] = 1
        hw[b][a] = 1
    dis = [0] * (n+1)
    arr = [-1] * (n+1)
    que = collections.deque([1])
    while len(que) != 0:
        a = que.popleft()
        test = hw[a]
        for i in range(len(test)):
            if test[i] == 1:
                if arr[i] == -1:
                    arr[i] = a
                    que.append(i)
    if 0 in arr[2:]:
        print("No")
    else:
        print("Yes")
        for i in range(2, len(arr)):
            print(arr[i])

resolve()

Fixed submission:
def resolve():
    import collections
    n, m = map(int, input().split())
    hw = [[0] for _ in range(n+1)]
    for i in range(m):
        a, b = map(int, input().split())
        hw[a].append(b)
        hw[b].append(a)

    dis = [0] * (n+1)
    arr = [-1] * (n+1)
    que = collections.deque([1])
    while len(que) != 0:
        a = que.popleft()
        test = hw[a]
        for i in range(len(test)):
            if test[i] != 0:
                goal = test[i]
                if arr[goal] == -1:
                    arr[goal] = a
                    que.append(goal)
    if 0 in arr[2:]:
        print("No")
    else:
        print("Yes")
        for i in range(2, len(arr)):
            print(arr[i])
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    import math
    r = int(input())
    print(r*2*math.pi)
resolve(9

Fixed submission:
def resolve():
    import math
    r = int(input())
    print(r*2*math.pi)
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    s = input()
    rlist = []
    glist = []
    blist = []
    for i in range(n):
        if s[i] == "R":
            rlist.append(i)
        elif s[i] == "G":
            glist.append(i)
        else:
            blist.append(i)
    ans = 0
    for i in range(len(rlist)):

        for j in range(len(glist)):
            r = rlist[i]
            ng = 0
            g = glist[j]
            s = sorted([r, g])
            r = s[0]
            g = s[1]
            if (r-(g-r)) in blist:
                ng += 1
            if (g+(g-r)) in blist:
                ng += 1
            if (r+g) % 2 == 0 and (r+g)//2 in blist:
                ng += 1
            ans += len(blist)-ng
    print(ans)
resolve()

Fixed submission:
def resolve():
    n = int(input())
    s = input()
    rlist = []
    glist = []
    blist = []
    for i in range(n):
        if s[i] == "R":
            rlist.append(i)
        elif s[i] == "G":
            glist.append(i)
        else:
            blist.append(i)
    blist = set(blist)
    ans = 0
    for i in range(len(rlist)):

        for j in range(len(glist)):
            r = rlist[i]
            ng = 0
            g = glist[j]
            s = sorted([r, g])
            r = s[0]
            g = s[1]
            if (r-(g-r)) in blist:
                ng += 1
            if (g+(g-r)) in blist:
                ng += 1
            if (r+g) % 2 == 0 and (r+g)//2 in blist:
                ng += 1
            ans += len(blist)-ng
    print(ans)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    s = input()
    rlist = []
    glist = []
    blist = []
    for i in range(n):
        if s[i] == "R":
            rlist.append(i)
        elif s[i] == "G":
            glist.append(i)
        else:
            blist.append(i)
    ans = 0
    for i in range(len(rlist)):
        r = rlist[i]
        for j in range(len(glist)):
            g = glist[j]
            for k in range(len(blist)):
                b = blist[k]
                count = sorted([r, g, b])
                if count[2]-count[1] != count[1]-count[0]:
                    ans += 1
    print(ans)
resolve()

Fixed submission:
def resolve():
    n = int(input())
    s = input()
    rlist = []
    glist = []
    blist = []
    for i in range(n):
        if s[i] == "R":
            rlist.append(i)
        elif s[i] == "G":
            glist.append(i)
        else:
            blist.append(i)
    blist = set(blist)
    ans = 0
    for i in range(len(rlist)):

        for j in range(len(glist)):
            r = rlist[i]
            ng = 0
            g = glist[j]
            s = sorted([r, g])
            r = s[0]
            g = s[1]
            if (r-(g-r)) in blist:
                ng += 1
            if (g+(g-r)) in blist:
                ng += 1
            if (r+g) % 2 == 0 and (r+g)//2 in blist:
                ng += 1
            ans += len(blist)-ng
    print(ans)
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    l = int(input())
    print((l/3)**3)
resolve(9

Fixed submission:
def resolve():
    l = int(input())
    print((l/3)**3)
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    import sys
    from collections import Counter
    n = int(input())
    s = [sys.stdin.readline().rstrip() for i in range(n)]
    d = Counter(s).most_common()
    e = d[0][1]
    ans = []
    for i in range(len(d)):
        if d[i][1] != e:
            break
        else:
            ans.append(d[i][0])
    for j in sorted(ans):
        print(j)
resolve()

Fixed submission:
def resolve():
    a = set(map(int, input().split()))
    if len(a)==2:
        print("Yes")
    else:
        print("No")
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    import sys
    from collections import Counter
    n = int(input())
    s = [sys.stdin.readline().rstrip() for i in range(n)]
    d = Counter(s).most_common()
    e = d[0][1]
    f = ([i for i in set(s) if s.count(i) == e])
    f = sorted(f)
    for i in f:
        print(i)
resolve()

Fixed submission:
def resolve():
    import sys
    from collections import Counter
    n = int(input())
    s = [sys.stdin.readline().rstrip() for i in range(n)]
    d = Counter(s).most_common()
    e = d[0][1]
    ans = []
    for i in range(len(d)):
        if d[i][1] != e:
            break
        else:
            ans.append(d[i][0])
    for j in sorted(ans):
        print(j)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    from collections import Counter
    n = int(input())
    s = []
    for i in range(n):
        s.append(input())
    d = Counter(s).most_common()
    e = d[0][1]
    f = ([i for i in set(s) if s.count(i) == e])
    f = sorted(set(f))
    for i in f:
        print(i)
resolve()

Fixed submission:
def resolve():
    import sys
    from collections import Counter
    n = int(input())
    s = [sys.stdin.readline().rstrip() for i in range(n)]
    d = Counter(s).most_common()
    e = d[0][1]
    ans = []
    for i in range(len(d)):
        if d[i][1] != e:
            break
        else:
            ans.append(d[i][0])
    for j in sorted(ans):
        print(j)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    from collections import Counter
    n = int(input())
    s = []
    for i in range(n):
        s.append(input())
    d = Counter(s).most_common()
    e = d[0][1]
    f = ([i for i in s if s.count(i) == e])
    f = sorted(set(f))
    for i in f:
        print(i)
resolve()

Fixed submission:
def resolve():
    import sys
    from collections import Counter
    n = int(input())
    s = [sys.stdin.readline().rstrip() for i in range(n)]
    d = Counter(s).most_common()
    e = d[0][1]
    ans = []
    for i in range(len(d)):
        if d[i][1] != e:
            break
        else:
            ans.append(d[i][0])
    for j in sorted(ans):
        print(j)
resolve()