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

Fixed submission:
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

if m == 0:
    if n == 3:
        print(100)
        exit()
    elif n == 2:
        print(10)
        exit()
    elif n== 1:
        print(0)
        exit()

ans = [10 for i in range(n)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

value = 0

for i in range(n):
    if i == 0:
        if ans[i] == 10:
            value += 10 ** (n-i-1)
            continue
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

ans = [10 for i in range(n)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

value = 0

for i in range(n):
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

ans = [10 for i in range(3)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    print(-1)
    exit()

value = 0

for i in range(n):
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

ans = [10 for i in range(3)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    print(-1)
    exit()

value = 0

for i in range(3):
    if ans[i] != 10:
        value += ans[i] * 10 ** (2-i)

print(value)
Problem p02813 (python)

Fixed submission:
import math

n = int(input())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]

a = 0

for i in range(n):
    tmp = 0
    for j in range(n-i-1):
        if p[i] > p[i+j+1]:
            tmp += 1
    a += tmp*math.factorial(n-1-i)


b = 0

for i in range(n):
    tmp = 0
    for j in range(n-i-1):
        if q[i] > q[i+j+1]:
            tmp += 1
    b += tmp*math.factorial(n-1-i)
    
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

n = int(input())
p = tuple(map(int,readline().split()))
q = tuple(map(int,readline().split()))

a = 0

permutations = list(itertools.permutations(range(1, n+1)))
p = permutations.index(p)
q = permutations.index(q)

print(abs(p-q))
Problem p02939 (python)

Fixed submission:
s = input()

ans = 1
cur = 0
tmp = s[0]

for i in range(len(s)-1):
    #print(cur)
    if cur == len(s)-1:
        break
    if cur >= len(s)-2:
        if tmp == s[cur+1]:
            break
        else:
            ans += 1
            break
    if tmp == s[cur+1]:
        tmp = s[cur+1] + s[cur+2]
        cur += 2
        ans += 1
    else:
        tmp = s[cur+1]
        cur += 1
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()

ans = 1
cur = 0
tmp = s[0]

for i in range(len(s)-1):
    #print(cur)
    if cur >= len(s)-2:
        if tmp == s[cur+1]:
            break
        else:
            ans += 1
            break
    if tmp == s[cur+1]:
        tmp = s[cur+1] + s[cur+2]
        cur += 2
        ans += 1
    else:
        tmp = s[cur+1]
        cur += 1
        ans += 1
        
print(ans)
Problem p02985 (python)

Fixed submission:
import queue
import scipy
n,k = map(int,input().split())

ab = [[] for j in range(n+1)]
mod = 10**9 + 7

for i in range(n-1):
    a,b = map(int,input().split())
    ab[a].append(b)
    ab[b].append(a)
    
check = [False] * (n+1)
kazu = [0] * (n+1)

check[0] = True

q = queue.Queue()
q.put(1)

ans = k
#print(ab)

while not q.empty():
    tmp = q.get()
    check[tmp] = True
    kake = 0
    for i in range(len(ab[tmp])):
        if check[ab[tmp][i]] == True:
            continue
        kazu[ab[tmp][i]] += 1
        q.put(ab[tmp][i])
        ans *= k - kake - kazu[tmp] - 1
        ans %= mod
        #print(i,k,ans,tmp,kazu[tmp])
        kake += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
import queue
import scipy
n,k = map(int,input().split())

ab = [[] for j in range(n+1)]
mod = 10**9 + 7

for i in range(n-1):
    a,b = map(int,input().split())
    ab[a].append(b)
    ab[b].append(a)
    
check = [False] * (n+1)
kazu = [0] * (n+1)

check[0] = True

q = queue.Queue()
q.put(1)

ans = k
#print(ab)

while not q.empty():
    tmp = q.get()
    check[tmp] = True
    kake = 0
    for i in range(len(ab[tmp])):
        if check[ab[tmp][i]] == True:
            continue
        kazu[ab[tmp][i]] += 1
        q.put(ab[tmp][i])
        ans *= k - kake - kazu[tmp] - 1
        ans %= mod
        #print(i,k,ans,tmp,kazu[tmp])
        kake += 1
    
print(ans)
Problem p02999 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
 
X,A = map(int,input().split())

if X < A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
 
N,K = map(int,input().split())
a = list(map(int,input().split()))

b = []
b.append(0)

now = 0

for i in range(N):
    now = now + a[i]
    b.append(now)
    
ans = 0
#cur = N

for i in range(N):
    for j in range(i,N+1):
        if N - j < 0:
            break
        if K <= b[N-i] - b[N-j]:
            ans += N - j + 1
            #print(ans)
            break
        else:
            #cur = cur - j
            continue
            
print(ans)
Problem p03032 (python)

Fixed submission:
import sys
import numpy as np
sys.setrecursionlimit(1000000)
 
N,K = map(int,input().split())
VN =  [int(i) for i in input().split()]

ans = 0
temp = 0

for i in range(min(N,K)+1):
    for j in range(min(K-i,N-i)+1):
        now = 0
        if i + j > min(N,K):
            break
       
        tmp_list = []
        
        for l in range(i):
            now += VN[l]
            tmp_list.append(VN[l])
    
        for m in range(j):
            now += VN[N-1-m]
            tmp_list.append(VN[N-1-m])
        
        tmp_list.sort()
        
        for n in range(K-i-j):
            if n >= len(tmp_list):
                break
            if tmp_list[n] >= 0:
                break
            now -= tmp_list[n]
        ans = max(ans,now)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
sys.setrecursionlimit(1000000)
 
N,K = map(int,input().split())
VN =  [int(i) for i in input().split()]

ans = 0
temp = 0

for i in range(K):
    for j in range(K-i):
        now = 0
        if i + j > K:
            break
       
        tmp_list = []
        
        for l in range(i):
            now += VN[l]
            tmp_list.append(VN[l])
    
        for m in range(j):
            now += VN[N-1-m]
            tmp_list.append(VN[N-1-m])
        
        tmp_list.sort()
        
        for n in range(N-i-j-2):
            if n >= len(tmp_list)-1:
                break
            if tmp_list[n] >= 0:
                break
            now -= tmp_list[n]
        ans = max(ans,now)

print(ans)
Problem p03067 (python)

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

if C < B and A < C:
    print('Yes')
elif C < A and B < C:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()


ini_w = 0
for i in range(len(S)):
    if S[i] == '.':
        ini_w = ini_w + 1
    else:
        break
    
if ini_w >= len(S)-1:
    print(0)
    exit()
    


last_b = 0

for i in range(len(S)):
    if S[len(S)-i-1] == '#':
        last_b = last_b + 1
    else:
        break

S = S[ini_w:len(S)-last_b]

if S == '':
    print(0)

all_w = len(S) - S.count(".")
all_b = len(S) - all_w

print(min(all_w,all_b))
Problem p03076 (python)

Fixed submission:
c = [int(input()) for _ in range(5)]

last = 10

idx = 0

for i in range(5):
    if c[i] % 10 ==  0:
        continue
    else:
        if last > c[i] % 10:
            last = c[i] % 10
            idx = i
    
ans = 0


for i in range(5):
    if i == idx:
        ans = ans + c[i]
    else:
        if c[i] % 10 == 0:
            ans = ans + c[i]
        else:
            ans= ans + ( c[i] // 10 + 1 ) * 10


print(ans)

Buggy submission (verdict: Runtime Error):
#c = [list(map(int,input().split())) for _ in range(5)]
c = [int(input()) for _ in range(5)]

last = 10

for i in range(5):
    if c[i] % 10 ==  0:
        continue
    else:
        if last > c[i] % 10:
            last = c[i] % 10
            idx = i
    
ans = 0


for i in range(5):
    if i == idx:
        ans = ans + c[i]
    else:
        if c[i] % 10 == 0:
            ans = ans + c[i]
        else:
            ans= ans + ( c[i] // 10 + 1 ) * 10


print(ans)

Buggy submission (verdict: Runtime Error):
#c = [list(map(int,input().split())) for _ in range(5)]
c = [int(input()) for _ in range(5)]

last = 10

for i in range(5):
    if c[i][0] % 10 ==  0:
        continue
    else:
        if last > c[i][0] % 10:
            last = c[i][0] % 10
            idx = i
    
ans = 0


for i in range(5):
    if i == idx:
        ans = ans + c[i][0]
    else:
        if c[i][0] % 10 == 0:
            ans = ans + c[i][0]
        else:
            ans= ans + ( c[i][0] // 10 + 1 ) * 10


print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

import sys
sys.setrecursionlimit(1000000)

c = [list(map(int,input().split())) for _ in range(5)]

last = 10

for i in range(5):
    if c[i][0] % 10 ==  0:
        continue
    else:
        if last > c[i][0] % 10:
            last = c[i][0] % 10
            idx = i
    
ans = 0


for i in range(5):
    if i == idx:
        ans = ans + c[i][0]
    else:
        if c[i][0] % 10 == 0:
            ans = ans + c[i][0]
        else:
            ans= ans + ( c[i][0] // 10 + 1 ) * 10


print(ans)
Problem p03087 (python)

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

lr = [list(map(int,input().split())) for i in range(Q)]

cnt = 0
li = []

for i in range(len(S)):
    if i == len(S)-1:
        li.append(cnt)
    elif S[i] == "A" and S[i+1] == "C":
        li.append(cnt)
        cnt += 1
    else:
        li.append(cnt)

#print(li)
#exit()

for k in range(Q):
    print(li[lr[k][1]-1] - li[lr[k][0]-1])

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

lr = [list(map(int,input().split())) for i in range(Q)]

cnt = 0
li = []

for i in range(len(S)):
    if S[i] == "A" and S[i+1] == "C":
        li.append(cnt)
        cnt += 1
    else:
        li.append(cnt)

#print(li)
#exit()

for k in range(Q):
    print(li[lr[k][1]-1] - li[lr[k][0]-1])
Problem p03110 (python)

Fixed submission:
n = int(input())

xu = [[i for i in input().split()] for j in range(n)]

ans = 0

for i in range(n):
    if xu[i][1] == 'JPY':
        ans += int(xu[i][0])
    else:
        ans += 380000*float(xu[i][0])
        
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

xu = [[i for i in input().split()] for j in range(n)]

ans = 0

for i in range(n):
    if xu[i][1] == 'JPY':
        ans += int(xu[i][0])
    else:
        ans += 1000*int(xu[i][0])
        
print(ans)
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

sum_v = sum(v)

dp = [[10**18] * (sum_v + 1) for _ in range(N + 1)]

for i in range(N+1):
    dp[i][0] = 0
    
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える
for i in range(N):
    for j in range(sum_v + 1):
		# 品物(w[i],v[i])を選ぶとき、j-w[i]>=0に限って、価値v[i]が加算される
        if j - v[i] == 0:
            dp[i + 1][j] = min(w[i],dp[i][j])
        if dp[i][j] != 10**18:
            dp[i+1][j+v[i]] = min(dp[i][j+v[i]],dp[i][j]+w[i])
		# 品物(w[i],v[i])を選ばないとき、何も加算しない
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

for i in range(sum_v + 1):
    #print(dp[N][sum_v - i],i)
    if dp[N][sum_v - i] <= W and dp[N][sum_v - i] != 0:
        print(sum_v - i)
        exit()

print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np

import sys
sys.setrecursionlimit(1000000)

n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')
for i in range(n):
  w, v = map(int, input().split())
  #print(dp[w:],dp[:-w],dp)
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
  #print(dp[w:],dp[:-w],dp)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')
for i in range(n):
  w, v = map(int, input().split())
  #print(dp[w:],dp[:-w],dp)
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
  #print(dp[w:],dp[:-w],dp)
print(dp[-1])
Problem p03240 (python)

Fixed submission:
n = int(input())

xyh = [[int(i) for i in input().split()] for j in range(n)]

xyh.sort(key=lambda x: -x[2])

cxy = 101

flag = 0

H = 0
cx = 0
cy = 0

for i in range(cxy):
    for j in range(cxy):
        flag = 0
        for k in range(n):
            if xyh[k][2] == 0:
                tmp = H - abs(xyh[k][0] - i ) - abs(xyh[k][1] - j )
                if tmp <= 0 and k == n-1:
                    print(cx,cy,H)
                    exit()
                elif tmp <= 0:
                    continue
                else:
                    break
                
            H = xyh[k][2] + abs(xyh[k][0] - i ) + abs(xyh[k][1] - j )
            
            flag += 1
            
            if flag == 1:
                H_old = H
            
            if flag > 1:
                if H != H_old:
                    break
            
            cx = i
            cy = j
            
            #print(i,j,k,H,n-1)
            
            if k == n-1:
                print(cx,cy,H)
                exit()
                break
        """
        if k == n-1:
            break
    if k == n-1:
        break
    """

#print(cx,cy,H)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors


cnd = make_divisors(m)

for i in range(len(cnd)):
    if m // cnd[i] >= n:
        print(cnd[i])
        exit()
Problem p03262 (python)

Fixed submission:
import fractions

N,X = map(int,input().split())
x = [int(i) for i in input().split()]

for i in range(N):
    x[i] = abs(X-x[i])

if N == 1:
    print(x[0])
    exit()

ans = fractions.gcd(x[0],x[1])

if N == 2:
    print(ans)
    exit()
    
for i in range(N-2):
    ans = fractions.gcd(ans,x[i+2])
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N,X = map(int,input().split())
x = [int(i) for i in input().split()]

for i in range(N):
    x[i] = abs(X-x[i])

if N == 1:
    print(x[0])
    exit()

ans = math.gcd(x[0],x[1])

if N == 2:
    print(ans)
    exit()
    
for i in range(N-2):
    ans = math.gcd(ans,x[i+2])
    
print(ans)
Problem p03280 (python)

Fixed submission:
a,b = map(int,input().split())
print(a*b-a-b+1)

Buggy submission (verdict: Runtime Error):
n,m,q = map(int,input().split())

lr = [[0 for i in range(n+1)] for j in range(n+1)]
#lr = [[int(i) for i in input().split()]for j in range(m)]

st = [0] * (n+1)
ed = [0] * (n+1)

for i in range(m):
    l,r = map(int,input().split())
    lr[l][r] += 1

pq = [[int(i) for i in input().split()]for j in range(q)]

dp = [[0 for i in range(n+1)] for j in range(n+1)]

#print(lr)

for i in range(1,n+1):
    #print(i)
    for j in range(i,n+1):
        #print(i,j)
        dp[i][j] = dp[i][j-1]+lr[i][j]

for i in range(q):
    st = pq[i][0]
    ed = pq[i][1]
    tmp = 0
    for j in range(ed-st+1):
        tmp += dp[st+j][ed]
    print(tmp)
#print(dp)
Problem p03287 (python)

Fixed submission:
n,m = map(int,input().split())
ai = [int(i) for i in input().split()]

for i in range(n):
    ai[i] = ai[i]%m

a = [0]*(n+1)
tmp = 0

for i in range(n):
    tmp += ai[i]
    tmp %= m
    a[i+1] = tmp
    
ans = 0

#li = [0]*(m)

d = dict()

for i in range(n+1):
    if a[i] in d:
        ans += d[a[i]]
        d[a[i]] += 1
    else:
        d[a[i]] = 1
    #print(ans,d)

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ai = [int(i) for i in input().split()]

for i in range(n):
    ai[i] = ai[i]%m

a = [0]*(n+1)
tmp = 0

for i in range(n):
    tmp += ai[i]
    tmp %= m
    a[i+1] = tmp
    
ans = 0

li = [0]*(m)

for i in range(n+1):
    ans += li[a[i]]
    li[a[i]] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ai = [int(i) for i in input().split()]

for i in range(n):
    ai[i] = ai[i]%m

a = [0]*(n+1)
tmp = 0

for i in range(n):
    tmp += ai[i]
    tmp %= m
    a[i+1] = tmp
    
ans = 0

li = [0]*(m)

for i in range(n+1):
    ans += li[a[i]]
    li[a[i]] += 1

print(ans)
Problem p03356 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,m = map(int,input().split())
pi = [int(i) for i in input().split()]

xy = [[] for j in range(n+1)]

for i in range(m):
    x,y = map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)
    
path = [[] for i in range(n+1)]
#check = [0] * (n+1)

check = [-1]*(n+1)

def dfs(x,check):
    #if check[x] != -1:
    #    return
    for i in range(len(xy[x])):
        cho = xy[x][i]
        #print(cho,x)
        if check[cho] != -1:
            continue
        check[cho] = num
        dfs(cho,check)
    
    return

num = 0
for i in range(1,n+1):
    #print(i,check[i])
    if check[i] != -1:
        continue
    if len(xy[i]) == 0:
        continue
    dfs(i,check)
    num += 1
#print(check)
ans = 0

for i in range(1,n+1):
    if pi[i-1] == i:
        ans += 1
    elif check[pi[i-1]] == -1:
        continue
    elif check[i] == check[pi[i-1]]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import queue
n,m = map(int,input().split())
pi = [int(i) for i in input().split()]

xy = [[] for j in range(n+1)]

for i in range(m):
    x,y = map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)
    
path = [[] for i in range(n+1)]
#check = [0] * (n+1)

check = [-1]*(n+1)

def dfs(x,check):
    #if check[x] != -1:
    #    return
    for i in range(len(xy[x])):
        cho = xy[x][i]
        #print(cho,x)
        if check[cho] != -1:
            continue
        check[cho] = num
        dfs(cho,check)
    
    return

num = 0
for i in range(1,n+1):
    #print(i,check[i])
    if check[i] != -1:
        continue
    if len(xy[i]) == 0:
        continue
    dfs(i,check)
    num += 1
#print(check)
ans = 0

for i in range(1,n+1):
    if pi[i-1] == i:
        ans += 1
    elif check[i] == check[pi[i-1]]:
        ans += 1
print(ans)
Problem p03407 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b >= c:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
if a+b >= c:
  print('Yes')
else:
  print('No')
Problem p03425 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

march = [0] * 5

for i in range(n):
    if s[i][0] == 'M':
        march[0] += 1
    elif s[i][0] == 'A':
        march[1] += 1
    elif s[i][0] == 'R':
        march[2] += 1
    elif s[i][0] == 'C':
        march[3] += 1
    elif s[i][0] == 'H':
        march[4] += 1
        
ans = 0

for i in range(5):
    for j in range(5):
        for k in range(5):
            if i >= j or i >= k or j >= k:
                continue
            ans += march[i] * march[j] * march[k]
            
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

march = [0] * 5

for i in range(n):
    if s[i][0] == 'M':
        march[0] += 1
    elif s[i][0] == 'A':
        march[1] += 1
    elif s[i][0] == 'R':
        march[2] += 1
    elif s[i][0] == 'C':
        march[3] += 1
    elif s[i][0] == 'H':
        march[4] += 1
        
ans = 0
        
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i >= j or i >= k or j >= k:
                continue
            ans += march[i] * march[j] * march[k]
            
print(ans)
Problem p03469 (python)

Fixed submission:
s = input()
t = '2018'

for i in range(len(s)):
  if i > 3:
    print(s[i],sep='',end='')
  else:
    print(t[i],sep='',end='')

Buggy submission (verdict: Runtime Error):
s = input()
t = '2018'

for i in range(len(s))
  if i > 3:
    print(s[i],sep='',end='')
  else:
    print(t[i],sep='',end='')

Buggy submission (verdict: Runtime Error):
s = input()
t = '2018'

for i in range(len(s))
  if i > 4:
    print(s[i],sep='',end='')
  else:
    print(t[i],sep='',end='')