Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
a.sort(reverse=True)
ans=0
for i in range(n):
  del a[0]
  ans+=a[0]
  del a[0]
print(ans)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
a.sort(reverse=True)
ans=0
for i in range(n):
  ans+=a[i*2+1]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,c,k=[n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  l=len(i0)
  if l== c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if l != c and i==n-1:
    ans+=1

print(ans)

Fixed submission:
n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  l=len(i0)
  if l== c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if l != c and i==n-1:
    ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
s,c=[int(i) for i in input().split()]

def cul(s,c):
  if s >= c // 2:
    x = s
    c = c - s * 2, 0
    x += c//4
  else:
    x = c//2
  return x
print(cul(s,c))


Fixed submission:
s,c=[int(i) for i in input().split()]

def cul(s,c):
  if s < c // 2:
    x = min(s,c//2)
    x += max(c - s * 2, 0)//4
  else:
    x = min(s,c//2)
  return x
print(cul(s,c))
Buggy python submission (verdict: Runtime Error):
a,b=[int(i) in i for input().split()]
abab=abs(abs(a) - abs(b))
saab=abs(b-a)
if b < a and b * a >0:
  print(saab + 2)
elif b > a and b * a >0:
  print(saab)
elif b < a and b * a <0:
  print(saab + 1)
elif b > a and b * a >0:
  print(max(saab,abab+1))

Fixed submission:
a,b=[int(i) for i in input().split()]
abab=abs(abs(a) - abs(b))
saab=abs(b-a)
if b < a and b * a >0:
  print(saab + 2)
elif b > a and b * a >=0:
  print(saab)
elif b < a and b * a <=0:
  print(min(saab + 1,abab+1))
elif b > a and b * a <0:
  print(min(saab,abab+1))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[0.0,0.0]
for i in range(n):
  a0,b0=x
  a ,b =[int(i) for i in input().split()]
  if a>=b:
    while a0/a!=a0//a or a0==0 or (a0/a)*b<b0 :
      a0+=1
    x=[a0,(a0/a)*b]
  else:
    while b0/b!=b0//b or b0==0 or (b0/b)*a<a0 :
      b0+=1
    x=[(b0/b)*a,b0]
print(int(sum(x)))

Fixed submission:
import math
from fractions import Fraction
n=int(input())
x=[1,1]
for i in range(n):
  a0,b0=x
  a ,b =[int(i) for i in input().split()]
  m=math.ceil(max(Fraction(a0,a),Fraction(b0,b)))
  x=[m*a,m*b]
  
print(int(sum(x)))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
s = [int(input()) for _ in range(N)]
sa=s.copy()
sa.sort()
x=0
for i in s:
  if s.index(i) %2 !=sa.index(i) %2:
    x+=1
print(math.ceil(x/2))
  

Fixed submission:
import numpy as np
import math
N = int(input())
s = [int(input()) for _ in range(N)]
sn=np.array(s)
sa=sn.argsort()
x=0
for i in range(N):
  if i %2 != sa[i] %2:
    x+=1
print(math.ceil(x/2))
Buggy python submission (verdict: Runtime Error):
a=list(input())
x=[]
for ai in a:
  if x !=[] and ai="B":
    l=len(x)
    del x[l-1]
  elif ai in ["0","1"]:
    x.append(ai)
print("".join(x))


Fixed submission:
a=list(input())
x=[]
for ai in a:
  if x !=[] and ai=="B":
    x.pop()
  elif ai in ["0","1"]:
    x.append(ai)
print("".join(x))
Buggy python submission (verdict: Runtime Error):
print("YES" if sorted(input().split())==["5","5","7"] else "NO"]

Fixed submission:
print("YES" if sorted(input().split())==["5","5","7"] else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    for a in A:
        ans *= a
    print(-1 if INF < ans else ans)
    return


main()


Fixed submission:
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if INF < ans:
            print(-1)
            break
    else:
        print(ans)
    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
INF = int(1e18)


def main():
    N, *A = map(int, open(0).read().split())
    ans = reduce(lambda Ai, x: Ai * x, A)
    print(-1 if INF < ans else ans)
    return


main()


Fixed submission:
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if INF < ans:
            print(-1)
            break
    else:
        print(ans)
    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
INF = int(1e18)


def main():
    input()
    *A, = map(int, input().split())
    ans = 1
    for a in A:
        ans *= a
    print(-1 if INF < ans else ans)
    return


main()


Fixed submission:
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if INF < ans:
            print(-1)
            break
    else:
        print(ans)
    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
INF = int(1e18)


def main():
    input()
    *A, = map(int, input().split())
    ans = reduce(lambda Ai, x: Ai * x, A)
    print(-1 if INF < ans else ans)
    return


main()


Fixed submission:
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if INF < ans:
            print(-1)
            break
    else:
        print(ans)
    return


main()
Buggy python submission (verdict: Runtime Error):
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 ln             PIC X(30).
01 N              PIC 9(10).
01 Q              PIC 9(10).
01 R              PIC 9(10).

PROCEDURE DIVISION.
  ACCEPT ln.
  UNSTRING ln DELIMITED BY SPACE INTO N.
  DIVIDE N BY 10 GIVING Q REMAINDER R.
  IF R = 2 OR 4 OR 5 OR 7 OR 9
      DISPLAY "hon"
  ELSE IF R = 0 OR 1 OR 6 OR 8
      DISPLAY "pon"
  ELSE
      DISPLAY "bon"
  END-IF.
  STOP RUN.


Fixed submission:
def main():
    N = input()
    N = int(N[len(N) - 1])
    ans = ""
    if N in {2, 4, 5, 7, 9}:
        ans = "hon"
    elif N in {0, 1, 6, 8}:
        ans = "pon"
    else:
        ans = "bon"
    print(ans)
    return


main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    string line;
    cin >> line;
    cout << (ALL (find, line, '7') == line.end() ? "No" : "Yes") << endl;
    return 0;
}


Fixed submission:
def main():
    line = str(input())
    print("No" if line.find("7") == -1 else "Yes")
    return


main()
Buggy python submission (verdict: Runtime Error):
A = 0
B = 0
C = 0
D = 0


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


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


def f(n):
    return n - n // C - n // D + n // lcm(C, D)


def main():
    global A, B, C, D
    A, B, C, D = map(int, input().split())
    print(f(B) - f(A - 1))
    return


main()


Fixed submission:
def main():
    N, *d = map(int, open(0).read().split())
    d.sort()
    print(d[N // 2] - d[N // 2 - 1])
    return


main()
Buggy python submission (verdict: Runtime Error):
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def main():
    A, B, C, D = map(int, input().split())
    first = B // C - A // C
    first += 1 if A % C == 0 else 0
    second = B // D - A // D
    second += 1 if A % D == 0 else 0
    tmp = lcm(C, D)
    both = B // tmp - A // tmp
    both += 1 if A % tmp == 0 else 0
    print(B - A + 1 - first - second + both)
    return


main()


Fixed submission:
# バージョン 3.4.X 以前
import fractions
# バージョン 3.5 以降
# mport math


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    A, B, C, D = map(int, input().split())
    first = B // C - A // C
    first += 1 if A % C == 0 else 0
    second = B // D - A // D
    second += 1 if A % D == 0 else 0
    tmp = lcm(C, D)
    both = B // tmp - A // tmp
    both += 1 if A % tmp == 0 else 0
    print(B - A + 1 - first - second + both)
    return


main()
Buggy python submission (verdict: Runtime Error):
def main():
    LR = open(0).read().split()[2:]
    max_L = max(map(int, LR[::2]))
    min_R = min(map(int, LR[1::2]))
    print(min_R - max_L + 1 if max_L <= min_M else 0)
    return


main()

Fixed submission:
def main():
    LRm = open(0).read().split()[2:]
    max_L = max(map(int, LRm[::2]))
    min_M = min(map(int, LRm[1::2]))
    print(min_M - max_L + 1 if max_L <= min_M else 0)
    return


main()
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul


def end_of_loop():
    raise StopIteration


def main():
    N, K = map(int, input().split())
    print(sum(reduce(mul, (0.5
                           if i << j < K
                           else end_of_loop()
                           for j in range(bin(K)-2)), 1 / N)
              for i in range(1, N + 1)))
    return


main()


Fixed submission:
from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    ans = []
    lst = []
    for i in range(1, N + 1):
        lst.clear()
        for j in range(K):
            if K <= i << j:
                break
            lst.append(0.5)
        ans.append(reduce(mul, lst, 1 / N))
    print(sum(ans))
    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    print(sum([reduce(mul, [0.5
                            for j in range(K)
                            if i << j < K], 1 / N)
               for i in range(1, N + 1)]))
    return


main()


Fixed submission:
from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    ans = []
    lst = []
    for i in range(1, N + 1):
        lst.clear()
        for j in range(K):
            if K <= i << j:
                break
            lst.append(0.5)
        ans.append(reduce(mul, lst, 1 / N))
    print(sum(ans))
    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    print(sum(reduce(mul, (0.5
                           for j in range(K)
                           if i << j < K), 1 / N)
              for i in range(1, N + 1)))
    return


main()


Fixed submission:
from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    ans = []
    lst = []
    for i in range(1, N + 1):
        lst.clear()
        for j in range(K):
            if K <= i << j:
                break
            lst.append(0.5)
        ans.append(reduce(mul, lst, 1 / N))
    print(sum(ans))
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce


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


def gcd_n(numbers):
    return reduce(gcd, numbers)


def main():
    N, *A = map(int, open(0).read().split())
    print(max(gcd_n(A[:i] + A[i + 1:]) for i in range(N)))
    return


main()


Fixed submission:
def gcd(a, b):
    if not a:
        # a が ゼロ ならば b
        return b
    if not b:
        # b が ゼロ ならば a
        return a
    while b:
        a, b = b, a % b
    return a


def main():
    N, *A = map(int, open(0).read().split())
    A.insert(0, 0)
    A.append(0)
    L = [0] * (N + 2)
    R = L[:]
    for i in range(1, N):
        L[i + 1] = gcd(L[i], A[i])
    for i in range(N, 0, -1):
        R[i] = gcd(R[i + 1], A[i])
    print(max(gcd(L[i], R[i + 1]) for i in range(1, N + 1)))
    return


main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin


def main():
    lines = stdin.readlines()
    S = lines[1]
    lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]]
    AC = []
    cnt = 0
    for c in S:
        if c == "A":
            pre = "A"
        elif pre == "A" and c == "C":
            cnt += 1
        elif pre == "A":
            pre = None
        AC.append(cnt)
    for l, r in lr:
        print(AC[r] - AC[l])
    return


main()


Fixed submission:
from sys import stdin


def main():
    lines = stdin.readlines()
    N = int(lines[0].split()[0])
    S = lines[1]
    lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]]
    AC = [0] * N
    pre = 0
    for i, c1, c2 in zip(range(1, N), S[:], S[1:]):
        AC[i] += pre
        if c1 == "A" and c2 == "C":
            AC[i] += 1
        pre = AC[i]
    for l, r in lr:
        print(AC[r] - AC[l])
    return


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


def main():
    ans = 0

    for i in range(A, B + 1):
        ans ^= i

    print(ans)
    return


main()


Fixed submission:
import math

A, B = map(int, input().split())


def main():
    # 偶数 n と 奇数 n + 1 の ペア の数
    pair = math.floor((B - A) / 2)

    if A % 2 == 0:
        pair = math.ceil((B - A) / 2)

        if B % 2 == 1:
            print(pair % 2)
        else:
            print(pair % 2 ^ B)

    else:
        if B % 2 == 1:
            print(A ^ pair % 2)
        else:
            print(A ^ pair % 2 ^ B)

    return


main()
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())

ct = [int(j) for j in input().split() for i in range(H)]

ct.sort(key=lambda x: x[0])

ans = 1001

for i in range(N):
    if ct[i][1] <= T:
        ans = ct[i][0]
        break

print("TLE" if ans == 1001 else ans)


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

ct = []

for i in range(N):
    ct.append([int(i) for i in input().split()])

ct.sort(key=lambda x: x[0])

ans = 1001

for i in range(N):
    if ct[i][1] <= T:
        ans = ct[i][0]
        break

print("TLE" if ans == 1001 else ans)
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())

    xn = []
    yn = []
    hn = []

    for i in range(N):
        xi, yi, hi = map(int, input().split())
        if hi:
            xn.append(xi)
            yn.append(yi)
            hn.append(hi)

    if N == 1:
        print(xn[0], yn[0], hn[0])
        return

    for Cx in range(101):
        for Cy in range(101):

            last = None

            for i in range(N):
                H = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]

                if H < 0:
                    continue
                if last:
                    if (last != H):
                        break

                last = H
            else:
                print(Cx, Cy, H)
                return


main()


Fixed submission:
import sys

input = sys.stdin.readline

N = int(input())

xn = [0] * N
yn = [0] * N
hn = [0] * N

for i in range(N):
    xi, yi, hi = map(int, input().split())
    xn[i] = xi
    yn[i] = yi
    hn[i] = hi

div = 0

for Cx in range(101):
    for Cy in range(101):
        for i in range(N):

            if 0 < hn[i]:
                h = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]
                if div in [0, 2]:
                    H = h
                    div = 1
                else:
                    if (H != h):
                        div = 2
                        break

        if div == 2:
            continue

        for i in range(N):
            if 0 == hn[i]:
                h = abs(xn[i] - Cx) + abs(yn[i] - Cy)
                if h < H:
                    div = 2
                    break

        if div == 2:
            continue

        print(Cx, Cy, H)
        break

    if div == 1:
        break
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from functools import reduce
import math

input = stdin.readline

N, X = map(int, input().split())

xn = [abs(X - int(i)) for i in input().split()]


def main():
    print(reduce(math.gcd, xn))
    return


main()


Fixed submission:
from sys import stdin

input = stdin.readline


def gcd(a, b):
    result = a
    k = 0
    n = b

    while True:
        k = result % n
        result = n
        n = k
        if k == 0:
            break

    return result


def gcd_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = gcd(l, numbers[i])

    return l


def lcm(a, b):
    g = gcd(a, b)

    return a * (b / g)


def lcm_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = lcm(l, numbers[i])

    return l


N, X = map(int, input().split())

xn = [abs(X - int(i)) for i in input().split()]


def main():
    print(gcd_n(xn))
    return


main()
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

l = [int(input()) for i in range(H)]

y = [False] * H
x = [False] * W

for i in range(H):
    flg = True
    for j in range(W):
        if l[i][j] != '.':
            flg = False
            break
    if flg:
        y[i] = True

for i in range(W):
    flg = True
    for j in range(H):
        if l[j][i] != '.':
            flg = False
            break
    if flg:
        x[i] = True

for i in range(H):
    if y[i]:
        continue
    for j in range(W):
        if x[j]:
            continue
        print(l[i][j], end='')
    print()


Fixed submission:
H, W = map(int, input().split())

l = []

for i in range(H):
    l.append(input())

y = [False] * H
x = [False] * W

for i in range(H):
    flg = True
    for j in range(W):
        if l[i][j] != '.':
            flg = False
            break
    if flg:
        y[i] = True

for i in range(W):
    flg = True
    for j in range(H):
        if l[j][i] != '.':
            flg = False
            break
    if flg:
        x[i] = True

for i in range(H):
    if y[i]:
        continue
    for j in range(W):
        if x[j]:
            continue
        print(l[i][j], end='')
    print()
Buggy python submission (verdict: Runtime Error):
MAX = 300000001

N, K = map(int, input().split())
xn = [int(i) for i in input().split()]


def main():
    ans = MAX

    if 0 < xn[0]:
        ans = xn[K - 1]
        print(ans)
        return

    if xn[N - 1] < 0:
        ans = xn[N - K]
        print(ans)
        return

    for i in range(N):
        if xn[i] <= 0 and 0 <= xn[i + K - 1]:
            ans = min(ans,
                      2 * abs(xn[i]) + abs(xn[i + K - 1]),
                      abs(xn[i]) + 2 * abs(xn[i + K - 1]))

    print(ans)
    return


main()


Fixed submission:
MAX = 300000001

N, K = map(int, input().split())
xn = [int(i) for i in input().split()]


def main():
    if 0 <= xn[0]:
        print(xn[K - 1])
        return

    if xn[N - 1] < 0:
        print(abs(xn[N - K]))
        return

    ans = MAX

    for i in range(N):
        if N - 1 < i + K - 1:
            break

        if xn[i] < 0:
            if xn[i + K - 1] < 0 and i + K <= N - 1 and 0 < xn[i + K]:
                ans = min(ans, abs(xn[i]))

            elif 0 <= xn[i + K - 1]:
                ans = min(ans,
                          2 * abs(xn[i]) + abs(xn[i + K - 1]),
                          abs(xn[i]) + 2 * abs(xn[i + K - 1]))

        elif 0 == xn[i]:
            ans = min(ans, xn[i + K - 1])

        elif 0 != i and xn[i - 1] < 0:
            ans = min(ans, xn[i + K - 1])

    print(ans)
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
import copy

input = open(0).read

N, *X = map(int, input().split())


def main():
    a = copy.copy(X)
    a.sort()

    for i in range(N):
        print(a[N // 2] if a.index(X[i]) < N // 2 else a[N // 2 - 1])

    return


main()


Fixed submission:
import copy

input = open(0).read

N, *X = map(int, input().split())


def main():
    a = copy.copy(X)
    l, r = sorted(a)[N // 2 - 1:N // 2 + 1]

    print('\n'.join([str(r) if x < r else str(l) for x in X]))
    return


main()
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

s = set()

for i in range(A, B + 1):
    if i <= A + K - 1:
        s.add(i)
    elif B - K + 1 <= i:
        s.add(i)

s = sorted(s)

for i in s:
    print(i)


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

s = set()

for i in range(A, min(A + K, B + 1)):
    s.add(i)

for i in range(B, max(A - 1, B - K), -1):
    s.add(i)

s = sorted(s)

for i in s:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    print("\n".join(
        [str(sum(l) - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()


Fixed submission:
def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    num = sum(l)
    print("\n".join(
        [str(num - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()

Buggy python submission (verdict: Time Limit Exceeded):
input = open(0).read

N, *A = [int(i) for i in input().split()]


def main():
    l = [abs(A[i + 1] - A[i]) for i in range(N - 1)]
    print(sum(l) - l[0] + abs(A[1]) + abs(A[-1]))

    if N != 2:
        print("\n".join(
            [str(abs(A[0]) + sum(l) - l[i] - l[i + 1] + abs(A[i] - A[i + 2])
                 + abs(A[-1])) for i in range(N - 2)]))

    print(abs(A[0]) + sum(l) - l[-1] + abs(A[-2]))
    return


main()


Fixed submission:
def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    num = sum(l)
    print("\n".join(
        [str(num - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()
Buggy python submission (verdict: Runtime Error):
N = input()
len = len(N)
cnt = 1
for i in range(0, len, 1):
    cnt = 1
    for j in range(i + 1, len, 1):
        if (N[i] != N[j]):
            break
        else:
            cnt += 1
    num = max(num, cnt)
print("Yes" if 3 <= num else "No")

Fixed submission:
N = list(input())
len = len(N)
num = 0
for i in range(0, len, 1):
    cnt = 1
    for j in range(i + 1, len, 1):
        if (N[i] != N[j]):
            break
        else:
            cnt += 1
    num = max(num, cnt)
print("Yes" if 3 <= num else "No")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, *a = map(int, open(0).read().split())
    print(min(abs(2 * sum(a[:i]) - sum(a)) for i in range(1, N)))
    return


main()


Fixed submission:
INF = float('inf')


def main():
    N, *a = map(int, open(0).read().split())
    ans = INF
    tmp = 0
    total = sum(a)
    for i in range(N - 1):
        tmp += a[i]
        ans = min(ans, abs(2 * tmp - total))
    print(ans)
    return


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

l = [int(i) for i in sys.stdin]

N = l[0]

a = l[1:]

done = [False] * N

i = 0

ans = 0

while True:
    if done[i] == False:
        done[i] = True
        ans += 1
        if a[i] == 1:
            break
        i = a[i]
    else:
        ans = -1
        break

print(ans)


Fixed submission:
N = int(input())

a = []

for i in range(N):
    a.append(int(input()) - 1)

done = [False] * N

i = 0

ans = 0

while True:
    if done[i] == False:
        done[i] = True
        ans += 1
        if a[i] == 1:
            break
        i = a[i]
    else:
        ans = -1
        break

print(ans)