Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02756 (python)

Fixed submission:
def resolve():
    from collections import deque
    d=deque()
    s=list(input())
    d.extend(s)
    #print(d)
    q=int(input())
    Q=[list(map(str,input().split())) for i in range(q)]

    reverse= False
    for i in range(q):
        if int(Q[i][0])==1:
            reverse=not reverse
        elif int(Q[i][0])==2:
            if int(Q[i][1])==1:
                if reverse:
                    d.append(Q[i][2])
                else:
                    d.appendleft(Q[i][2])
                #print(s)
            else:
                if reverse:
                    d.appendleft(Q[i][2])
                else:
                    d.append(Q[i][2])
                #print(s)

    if reverse:
        print(''.join(list(reversed(d))))
    else:
        print(''.join(list(d)))






resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from collections import deque
    d=deque()
    s=list(input())
    d.extend(s)
    #print(d)
    q=int(input())
    Q=[list(map(str,input().split())) for i in range(q)]

    #print(Q)
    for i in range(q):
        if int(Q[i][0])==1:
            if i!=q-1 and int(Q[i+1][0])==2 and int(Q[i+1][1])==1:
                d.append(int(Q[i+1][2]))
                d.reverse()
                i=i+1
            else:
                d.reverse()
            #print(s)
        elif int(Q[i][0])==2:
            if int(Q[i][1])==1:
                d.appendleft(Q[i][2])
                #print(s)
            else:
                d.append(Q[i][2])
                #print(s)
    print(''.join(list(d)))






resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from collections import deque
    d=deque()
    s=list(input())
    d.extend(s)
    #print(d)
    q=int(input())
    Q=[list(map(str,input().split())) for i in range(q)]

    #print(Q)
    for i in range(q):
        if int(Q[i][0])==1:
            if i!=q-1 and int(Q[i+1][0])==2 and int(Q[i+1][1])==1:
                d.append(int(Q[i+1][2]))
                d.reverse()
                i=i+1
            else:
                d.reverse()
            #print(s)
        elif int(Q[i][0])==2:
            if int(Q[i][1])==1:
                d.appendleft(Q[i][2])
                #print(s)
            else:
                d.append(Q[i][2])
                #print(s)
    print(''.join(list(d)))






resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from collections import deque
    d=deque()
    s=list(input())
    d.extend(s)
    #print(d)
    q=int(input())
    Q=[list(map(str,input().split())) for i in range(q)]

    #print(Q)
    rev=0
    for i in range(q):
        if int(Q[i][0])==1:
            if i!=q-1 and int(Q[i+1][0])==2 and int(Q[i+1][1])==1:
                d.append(int(Q[i+1][2]))
                d.reverse()
                i=i+1
            else:
                d.reverse()
            #print(s)
        elif int(Q[i][0])==2:
            if int(Q[i][1])==1:
                d.appendleft(Q[i][2])
                #print(s)
            else:
                d.append(Q[i][2])
                #print(s)
    print(''.join(list(d)))






resolve()
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
s=[list(map(int,input().split())) for i in range(M)]

#print(A)
def main():
    if N==1 and M==0:
        return 0
    if N==2 and M==0:
        return 10
    if N==3 and M==0:
        return 100

        
    if N==1:
        for i in range(0,10**N):
            for j in range(M):
                if str(i)[s[j][0]-1]!=str(s[j][1]):
                    break
                if j==M-1:
                    return i
            if i==10**N-1:
                return -1
    else:
        for i in range(10**(N-1),10**N):
            for j in range(M):
                if str(i)[s[j][0]-1]!=str(s[j][1]):
                    break
                if j==M-1:
                    return i
            if i==10**N-1:
                return -1
                    

print(main())

Buggy submission (verdict: Runtime Error):
def resolve():
    def main():
        N, M = map(int, input().split())
        S, C = [0] * M, [0] * M

        if N == 1 and M == 1:
            return 0
        elif N == 2 and M == 0:
            return 10
        elif N == 3 and M == 0:
            return 100

        for i in range(M):
            S[i], C[i] = map(int, input().split())
            if i == 0:
                dic = {S[i]: C[i]}
            else:
                if S[i] not in dic.keys():
                    dic[S[i]] = C[i]
                elif dic[S[i]] != C[i]:
                    return -1

        ans = [0] * N
        for i, j in dic.items():
            ans[i - 1] = j

        if len(ans) != 1 and ans[0] == 0:
            return -1
        else:
            return ans

    val = main()
    try:
        int(val)
        print(val)
    except:
        for i in val:
            print(i, end='')
        print()


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    def main():
        N,M=map(int,input().split())
        S, C = [0] * M, [0] * M

        for i in range(M):
            S[i], C[i] = map(int, input().split())
            if i==0:
                dic={S[i]:C[i]}
            else:
                if S[i] not in dic.keys():
                    dic[S[i]]=C[i]
                elif dic[S[i]]!=C[i]:
                    return -1
        #dic=dict(sorted(dic.items(), key=lambda x: x[0]))
        ans=[0]*N
        for i,j in dic.items():
            ans[i-1]=j

        if len(ans)!=1 and ans[0]==0:
            return -1
        else:
            return ans

    val=main()
    if val==-1:
        print(-1)
    else:
        for i in val:
            print(i,end='')
        print()







resolve()
Problem p02767 (python)

Fixed submission:
# coding: utf-8
# Your code here!

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

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import statistics
from scipy.stats.mstats import gmean

N=int(input())
X=list(map(int,input().split()))
X.sort()
import sympy as sym
sym.init_printing()
(x, y) = sym.symbols("x, y")

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)

Buggy submission (verdict: Runtime Error):

N=int(input())
X=list(map(int,input().split()))
X.sort()
#print(X)
med=int(statistics.median(X))
#print(med)

"""
if med-math.floor(med)>math.ceil(med)-med:
    val=math.ceil(med)
else:
    val=math.floor(med)
"""
min=10**10
sum=0
#print(X)
while True:
    sum=0
    for i in range(N):
        sum+=(X[i]-med)**2
    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)
Problem p02811 (python)

Fixed submission:
K,X=map(int,input().split())
if 500*K>=X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0]*n
    for i in range(n):
        B[i] = A[i]//2
    
    for i in range(n):
        cnt=0
        while B[i]%2==0:
            B[i]//2
            cnt+=1
        if i==0:
            temp=cnt
        else:
            if cnt!=temp:
                ok=False
                break
            if i==n-1:
                ok=True
    if ok:
        from functools import reduce
        from fractions import gcd

        def lcm(A, B):
            return A * B // gcd(A, B)

        # リストを引数にとる
        l = reduce(lcm, B)
        print(-(-(m//l) // 2))
        
    else:
        print(0)


resolve()
Problem p02830 (python)

Fixed submission:
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')

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

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

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

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')
Problem p02841 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    M,D=map(int,input().split())
    N,E=map(int,input().split())

    print(1 if M!=N else 0)

resolve()

Buggy submission (verdict: Runtime Error):

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        if i[0] in s:
            s0=s.index(i[0])
            if i[1] in s[s0+1:]:
                s1=s[s0+1:].index(i[1])
                if i[2] in s[s0+1:][s1+1:]:
                    ans.append(i)



    print(len(set(ans)))


resolve()
Problem p02855 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W, K = map(int, input().split())
    grid = [[_ for _ in input()] for _ in range(H)]

    ans = [[0] * W for _ in range(H)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                cnt += 1
                ans[h][w] = cnt

    now = -1
    for h in range(H):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                if now != -1:
                    ans[h][w] = now
        now = -1

    now = -1
    for h in range(H):
        for w in reversed(range(W)):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                if now != -1:
                    ans[h][w] = now
        now = -1

    for h in range(1,H):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h - 1][w]

    for h in reversed(range(H-1)):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h + 1][w]

    for a in ans:
        print(*a)


resolve()

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W, K = map(int, input().split())
    grid = [[_ for _ in input()] for _ in range(H)]

    ans = [[0] * W for _ in range(H)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                ans[h][w] = cnt
                cnt += 1

    now=0
    for h in range(H):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                ans[h][w] = now

    now=0
    for h in reversed(range(H)):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                ans[h][w] = now
    
    for h in range(H):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h - 1][w]

    for h in reversed(range(H)):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h + 1][w]

    for a in ans:
        print(*a)



resolve()
Problem p02887 (python)

Fixed submission:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    N=int(input())
    S=list(input())

    cnt=1
    for i in range(N-1):
        if S[i]!=S[i+1]:
            cnt+=1

    print(cnt)


resolve()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=list(input())
    gr = groupby(A)
    cnt=0
    for key, group in gr: # groupはイテレータ。list(group)でリスト化  
        """ex.
        0: [0, 0, 0]
        1: [1, 1]
        0: [0, 0, 0]
        1: [1, 1]
        0: [0]
        1: [1]
        """
        cnt+=1
    print(cnt)
        

    
resolve()
Problem p02963 (python)

Fixed submission:
def resolve():
    S=int(input())
    i,mod=divmod(S,10**9)
    if mod==0:
        print(0,0,10**9,mod,1,i)
    else:
        print(0,0,10**9,10**9*(i+1)-S,1,i+1)

resolve()

Buggy submission (verdict: Runtime Error):
    S = int(input())
    # S == 10 ** 9 * i + mod
    i, mod = divmod(S, 10 ** 9)
    # 求めたいのは、10 ** 9 * i - modなるiとmodの組
    # mod == 0のときはそのまま
    if mod == 0:
        print(0, 0, 10 ** 9, mod, 1, i)
    # そうでないときはiをインクリしてmodの項を負にしてしまえばいい
    else:
        print(0, 0, 10 ** 9, 10 ** 9 * (i + 1) - S, 1, i + 1)
Problem p02972 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=[0]+list(map(int,input().split()))
    ans=[0]*(N+1)
    s=[0]*(N+1)

    for i in reversed(range(1,N+1)):
        cnt=0
        for j in range(i+i,N+1,i):
            cnt^=s[j]
        if (A[i]==1 and cnt!=1) or (A[i]==0 and cnt!=0): s[i]=1
    
    print(sum(s))
    for i in range(1,N + 1):
        if s[i]==1:
            print(i)






    

resolve()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=[0]+list(map(int,input().split()))
    ans=[0]*(N+1)
    s=[0]*(N+1)

    for i in reversed(range(1,N+1)):
        cnt=0
        for j in range(i+i,N+1,i):
            cnt^=s[j]
        if (A[i]==1 and cnt!=1) or (A[i]==0 and cnt!=0): s[i]=1
    
    print(sum(s))
    for i in range(1,N + 1):
        if s[i]==1:
            print(s.index(i))






    

resolve()
Problem p03032 (python)

Fixed submission:
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    ans = 0
    for l in range(K+1):
        for r in range(K-l+1):
            if l+r > N:
                continue
            now = []
            val = 0
            for i in range(l):
                now.append(V[i])
                val += V[i]
            for j in range(r):
                now.append(V[-j-1])
                val += V[-j-1]

            d = K-l-r
            now.sort()
            for i in range(d):
                if i >= len(now):
                    break
                if now[i] > 0:
                    break
                val -= now[i]
            ans=max(ans,val)

    print(ans)

resolve()

Buggy submission (verdict: Runtime Error):
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    ans = 0
    for l in range(K+1):
        for r in range(K-l+1):
            if l+r > K:
                continue
            now = []
            val = 0
            for i in range(l):
                now.append(V[i])
                val += V[i]
            for j in range(r):
                now.append(V[-j-1])
                val += V[-j-1]

            d = K-l-r
            now.sort()
            for i in range(d):
                if i >= len(now):
                    break
                if now[i] > 0:
                    break
                val -= now[i]
            ans=max(ans,val)

    print(ans)

resolve()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N,K=map(int,input().split())
    V=list(map(int,input().split()))
    ans=0
    for l in range(K+1):
        for r in range(K-l+1):
            if l+r>K: continue
            now=[]
            for i in range(l):
                now.append(V[i])
            for j in range(r):
                now.append(V[-j-1])
            

            now.sort()
            m=K-l-r
            if m==0:
                ans=max(ans,sum(now))
            if range(min(l+r,m)):
                for i in range(min(l+r,m)):
                    if now[i]>=0:
                        temp=i
                        break
                    else: temp=i+1
                ans=max(ans,sum(now[temp:]))

    print(ans)



    
resolve()
Problem p03035 (python)

Fixed submission:
A,B=map(int,input().split())
if A<=5:
    print(0)
elif 6<=A<=12:
    print(B//2)
else:
    print(B)

Buggy submission (verdict: Runtime Error):
def resolve():
    N, M = map(int, input().split())
    d = Counter(list(map(int, input().split())))

    for i in range(M):
        b, c = map(int, input().split())
        d[c] += b

    d = dict(sorted(d.items(), reverse=True))

    def main():
        cnt = 0
        ans = 0

        for k, v in d.items():
            if cnt + v < N:
                ans += v * k
                cnt += v
            else:
                ans += (N - cnt) * k
                return ans

    print(main())



resolve()
Problem p03068 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n=int(input())
    s=list(input())
    k=int(input())
    val=s[k-1]
    for i in range(n):
        if s[i]!=val:
            s[i]='*'
    print(''.join(s))


resolve()

Buggy submission (verdict: Runtime Error):
from sys import stdin
N = int(input())
S = input()
K = int(input())
def search():
  val = S[K]
  for x in range(1, N):
    if S[x] != val:
      S[x] = *
  return S
print(search())
Problem p03069 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    S = list(input())
    bl = [0]*N
    wh = [0]*N

    from itertools import accumulate

    wh_num = 0
    for i in range(N):
        if S[i] == '#':
            bl[i] = 1
        else:
            wh[i] = 1

    bl = [0] + bl
    wh = [0]+wh

    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    bl = list(accumulate(bl))
    wh = list(accumulate(wh))

    # この問題は長さが1-Nの連続部分の和の最大値を出せというものなので以下の通り
    ans = N
    for i in range(N + 1):
        ans = min(ans, bl[i]+(wh[N]-wh[i]))
    print(ans)


resolve()

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())
    if N == 1:
        print(0)
    else:
        S = list(input())

        B = [0] * N
        W = [0] * N

        cntb = 0
        cntw = 0
        for i in range(N):
            if S[i] == '#':
                cntb += 1
                B[i] = cntb
                W[i] = cntw
            else:
                cntw += 1
                B[i] = cntb
                W[i] = cntw
        if cntb == N or cntb == 0:
            print(0)
        else:

            B = [0] + B + B[-1]
            W = [0] + W + W[-1]

            ans = 10 ** 9
            for i in range(1, N + 2):
                ans = min(ans, B[i] + W[-1] - W[i])
            print(ans)


resolve()
Problem p03101 (python)

Fixed submission:
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split())
A = []
 
for i in range(N):
 A.append(list(map(int, input().split())
 
def main():
cnt = 0
for i in range(N):
 val = C
 for j in range(M):
  val += A[i][j] * B[j]
  if val > 0:
  cnt += 1
return cnt
print(main)

Buggy submission (verdict: Runtime Error):
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split())
A = []

for i in range(N):
A.append(list(map(int, input().split())

def main():
cnt = 0
for i in range(N):
val = C
for j in range(M):
 val += A[i][j] * B[j]
if val > 0:
cnt += 1
return cnt
print(main)
Problem p03102 (python)

Fixed submission:
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

def main():
    cnt = 0
    for i in range(N):
        val = C
        for j in range(M):
            val += A[i][j] * B[j]
        if val > 0:
            cnt += 1
    return cnt

print(main())

Buggy submission (verdict: Runtime Error):
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split())
A = []

for i in range(N):
	A.append(list(map(int, input().split())
	
def main():
	cnt = 0
	for i in range(N):
		val = C
		for j in range(M):
			val += A[i][j] * B[j]
		if val > 0:
			cnt += 1
	return cnt
print(main)
Problem p03106 (python)

Fixed submission:
import fractions

A,B,K=map(int,input().split())
gcd=fractions.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
#print(l)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import fractions

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
#print(l)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
#print(l)
print(l[len(l)-K])

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
l=[]
for i in range(1,gcd):
    if gcd%i==0:
        l.append(i)

print(l[K-1])
Problem p03110 (python)

Fixed submission:
N=int(input())
X=[list(map(str,input().split())) for i in range(N)]

ans=0
for i in range(N):
    if X[i][1]=='BTC':
        ans+=float(X[i][0])*380000
    else:
        ans+=float(X[i][0])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())
gcd=math.gcd(A,B)
#print(gcd)
l=[]
for i in range(1,gcd+1):
    if gcd%i==0:
        l.append(i)
print(l)
print(l[len(l)-K])
Problem p03211 (python)

Fixed submission:
S=list(input())
ans=10**10
for i in range(len(S)-2):
    if abs(753-int(''.join(S[i:i+3])))<ans:
        ans=abs(753-int(''.join(S[i:i+3])))
print(ans)

Buggy submission (verdict: Runtime Error):
S=list(input())
ans=10**10
for i in range(8):
    if abs(753-int(''.join(S[i:i+3])))<ans:
        ans=abs(753-int(''.join(S[i:i+3])))
print(ans)