problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02933
s447807173
Wrong Answer
a=int(input()) s=input() if a <3200 and s=='red': print("pink") elif a<3200 and s=='pink': print("red")
p03073
s838953102
Accepted
s = list(map(int,input())) n = int(len(s)/2) a = [0]*len(s) b = [0]*len(s) for i in range(n): a[2*i] = 0 a[2*i+1] = 1 b[2*i] = 1 b[2*i+1] = 0 if len(s)%2 ==1: a[len(s)-1] = 0 b[len(s)-1] = 1 an = 0 bn = 0 for j in range(len(s)): if a[j] != s[j]: an += 1 if b[j] != s[j]: bn += 1 print(min(an, bn))
p03475
s800300955
Accepted
n=int(input());A=[0]*n for i in range(1,n): c,s,f=map(int,input().split()) for j in range(i):A[j]=max(-A[j]//f*-f,s)+c print(*A,sep="\n")
p03944
s234290535
Wrong Answer
w, h, n = map(int, input().split()) sx = [0, w] sy = [0, h] for i in range(n): x, y, a = map(int, input().split()) if a == 1: sx[0] = max(sx[0], x) if a == 2: sx[1] = min(sx[1], x) if a == 3: sy[0] = max(sy[0], y) if a == 4: sy[1] = min(sy[1], y) print(max(0, (sx[1]-sx[0])*(sy[1]-sy[0])))
p02603
s356090301
Accepted
n=int(input()) A=list(map(int,input().split())) s=1000 for i in range(n-1): if A[i+1]>A[i]: s=s//A[i]*A[i+1]+s%A[i] print(s)
p03281
s157582353
Wrong Answer
N=int(input()) ans=0 odd=[] for i in range(1,N+1): if i%2!=0: odd.append(i) if N <104: pass else: for i in range(105,N+1): if i%2!=0: tmp=0 for j in odd: if i%j==0: tmp=+1 if tmp==8: ans+=1 print(ans)
p03817
s190082259
Accepted
time = 0 sum = 0 x = int(input()) sho = x//11 ans = 2*sho mod = x % 11 if mod == 0: print(ans) elif mod <= 6: print(ans+1) else: print(ans+2)
p02594
s196407211
Wrong Answer
X = input() X = int(X) if X >= 30: print("YES") else: print("NO")
p03854
s894033736
Accepted
s = input() s = s.replace('eraser', '') s = s.replace('erase', '') s = s.replace('dreamer', '') s = s.replace('dream', '') if len(s) == 0: print('YES') else: print('NO')
p02628
s286801024
Accepted
n,k=map(int,input().split()) arr=list(map(int,input().split())) arr=sorted(arr) print(sum(arr[:k]))
p02700
s200867295
Wrong Answer
a,b,c,d=map(int,input().split()) a=a-d c=c-b if a>=c: print("Yes") else: print("No")
p03075
s441366964
Accepted
def funcao(lista, reverse, k): for i in lista: for j in reverse: if abs(i-j) > k: return ":(" return "Yay!" lista = [] lista.append(int(input())) lista.append(int(input())) lista.append(int(input())) lista.append(int(input())) lista.append(int(input())) k = int(input()) lista.sort() reverse = [] reverse = lista.copy() reverse.reverse() print(funcao(lista, reverse, k))
p02684
s806665429
Accepted
n, k = map(int, input().split()) a = list(map(int, input().split())) route = [] town = set() now = 1 while True: now = a[now-1] if now in town: break town.add(now) route.append(now) count = route.index(now) if count >= k: print(route[k-1]) else: route = route[count:] num = (k-count)%len(route) print(route[num-1])
p03386
s039600535
Accepted
a,b,k=map(int,input().split()) if b-a+1<=2*k: for i in range(a,b+1): print(i) exit() for i in range(a,a+k): print(i) for i in range(b-k+1,b+1): print(i)
p02657
s536160182
Accepted
A,B=map(int,input().split()) print(A*B)
p03417
s416134700
Accepted
def main(): n, m = map(int, input().split()) count = 0 if n == 1 and m == 1: ans = 1 elif n == 1: ans = m - 2 elif m == 1: ans = n - 2 else: ans = (m - 2) * (n - 2) print(ans) if __name__ == '__main__': main()
p03319
s525486522
Accepted
N, K = map(int,input().split()) A = list(map(int,input().split())) ans = 0 if((N-1)%(K-1)!=0): print((N-1)//(K-1)+1) else: print((N-1)//(K-1))
p03625
s308486370
Accepted
n = int(input()) a = sorted(list(map(int,input().split())),reverse = True) c_ls = [] cnt = 0 for i in range(n-1): if a[i] == a[i+1]: cnt += 1 else: cnt = 0 if cnt == 3: c_ls.append(a[i]) if (a[i] == a[i+1]) and(a[i] not in c_ls): c_ls.append(a[i]) if len(c_ls) == 2: print(c_ls[0]*c_ls[1]) exit() print(0)
p02556
s403165333
Accepted
import sys input = sys.stdin.readline N = int(input()) XY = [tuple(map(int,input().split())) for i in range(N)] A = [] B = [] for x,y in XY: A.append(x+y) B.append(x-y) a = max(A) - min(A) b = max(B) - min(B) print(max(a,b))
p03804
s794258936
Accepted
N, M = map(int, input().split()) A = [input() for _ in range(N)] B = [input() for _ in range(M)] R = range(N-M+1) for i in R: for j in R: for k in range(M): if A[j+k][i:i+M] != B[k]: break else: print('Yes') exit() print('No')
p02678
s222112642
Accepted
import queue N, M = map(int, input().split()) E = [set() for i in range(N)] for i in range(M): A, B = map(int, input().split()) A, B = A-1, B-1 E[A].add(B) E[B].add(A) #print(E) V = [-1]*N q = queue.Queue() q.put(0) while not q.empty(): p = q.get() s = E[p] for i in s: if V[i] < 0: V[i] = p q.put(i) #print(V) print("Yes") for i in range(1, N): print(V[i]+1)
p02645
s346279705
Accepted
S = input() print(S[0:3])
p03943
s582587364
Accepted
candy_packs = sorted(list(map(int, input().split()))) if candy_packs[2] == (candy_packs[0] + candy_packs[1]): print('Yes') else: print('No')
p02970
s525241906
Accepted
from math import ceil N, D = map(int, input().split()) ans = ceil(N/(D*2 + 1)) print(ans)
p03323
s454658986
Wrong Answer
A,B=map(int,input().split()) if A+B<=14: print("Yay!") elif abs(A-B)<=1: print("Yay!") else: print(":(")
p02880
s371494282
Accepted
N = int(input()) xs = list(range(1,10)) xt = [(x*y) for x in xs for y in xs] print('Yes') if N in xt else print('No')
p02607
s806425512
Accepted
N = int(input()) a = list(map(int, input().split())) count = 0 for i in range(0, N, 2): if a[i] % 2 == 1: count += 1 print(str(count))
p03657
s487646259
Accepted
# 入力 A, B = map(int, input().split()) # A,B,A+Bのうちどれか1つでも3で割り切れればPossible if A % 3 == 0: print('Possible') elif B % 3 == 0: print('Possible') elif (A + B) % 3 == 0: print('Possible') else: print('Impossible')
p03262
s975792556
Accepted
import fractions n,X = map(int,input().split()) x_ = list(map(int,input().split())) x_.append(X) x_.sort() if len(x_) == 2: print(x_[1]-x_[0]) else: a = x_[1]-x_[0] for i in range(1,n): b = x_[i+1]-x_[i] a = fractions.gcd(a,b) print(a)
p03208
s207735183
Wrong Answer
n, k = map(int, input().split()) h = [int(input()) for i in range(n)] h.sort() ans = 100000000000000000000000000000000000000 for i in range(n-k+1): ans = min(ans, h[i+k-1] - h[i]) print(i) print(ans)
p03261
s970641255
Wrong Answer
n=int(input()) B=[] S = 0 for i in range(0,n): B.append((input())) for m in range(n-1): if B[m][-1] == B[m+1][0]: S += 1 if S == n-1: print("Yes") else: print("No")
p03779
s915706311
Wrong Answer
x = int(input()) for t in range(1000000000): if 2 * x < t * (t + 1): print(t + 1) break
p02683
s245618675
Wrong Answer
import numpy as np import itertools n,m,x = map(int, input().split()) ca = np.zeros((n,m+1)) for i in range(n): ca[i] = [int(i) for i in input().split()] p = itertools.product([True,False], repeat = n) ans_l = [] for i in p: ca_cut = ca[i,:] if len(ca_cut) == 0: continue ca_cut_sum = ca_cut.sum(axis=0) if all(ca_cut_sum[1:] >= x): ans_l.append(ca_cut_sum[0]) if len(ans_l) == 0: ans = -1 else: ans = min(ans_l) print(ans)
p02548
s483280657
Wrong Answer
import math n = int(input()) k = int(math.sqrt(n)) ans = 0 for i in range(1, k): t = int((n - 1) / i) ans += (t- i + 1) * 2 - 1 print(ans)
p02723
s658213792
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): S = input() print('Yes'if S[2] == S[3] and S[4] == S[5] else 'No') if __name__ == "__main__": main()
p03479
s316029846
Accepted
from math import log x, y = map(int, input().split()) for i in range(64): x *= 2 if x > y: print(i + 1) exit()
p03250
s489517115
Accepted
a = list(map(int, input().split())) a.sort(reverse=True) #print(a) print(str( int(str(a[0])+str(a[1])) + a[2]) )
p03017
s811153081
Wrong Answer
n, a, b, c, d = map(int, input().split()) s = input() e = 1 for i in range(b, min(c, d)-2): if s[i] == "." and s[i+1] == "." and s[i+2] == ".": e = 0 if c < d: e = 0 for i in range(a, max(c, d)-1): if s[i] == "#" and s[i+1] == "#": e = 1 print("Yes") if e == 0 else print("No")
p03767
s328745036
Accepted
n = int(input()) a = list(map(int,input().split())) a.sort(reverse=True) print(sum(a[1:3*n-n:2]))
p03624
s798237400
Wrong Answer
S = input() l = sorted(list(set(S))) for i in range(len(l)): if len(l) == 1 and S == "a": ans = "b" elif ord(l[i]) != 97 + i: ans = chr(97+i) break else: ans = "None" print(ans)
p02723
s662712123
Accepted
S = input() if S[2]==S[3] and S[4]==S[5]: print('Yes') else: print('No')
p03761
s658468527
Wrong Answer
from collections import Counter n = int(input()) abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] res = [[0]*len(abc), [n]*len(abc)] #print(res) for i in range(n): S = [s for s in input()] c = Counter(S) for k in c.keys(): res[0][abc.index(k)] += 1 res[1][abc.index(k)] = min(res[1][abc.index(k)], c[k]) ans = '' for i in range(len(abc)): if res[0][i] == n: ans += abc[i]*res[1][i] print(sorted(ans))
p03095
s747061584
Accepted
from collections import Counter n=int(input()) s=input() mod=10**9+7 ans=1 c=Counter(s) for v in c.values(): ans*=(v+1) ans%=mod print(ans-1)
p03323
s120416267
Accepted
def actual(a, b): if a >= 9 or b >= 9: return ':(' return 'Yay!' a, b = map(int, input().split()) print(actual(a, b))
p03339
s882204341
Accepted
import sys input = sys.stdin.readline N = int(input()) S = input() W_num = [0] * N E_num = [0] * N for i in range(1, N): k = N - (i - 1) - 2 W_num[i] = W_num[i-1] + 1 if S[i-1] == 'W' else W_num[i-1] E_num[k] = E_num[k+1] + 1 if S[k+1] == 'E' else E_num[k+1] print(min([W_num[i] + E_num[i] for i in range(N)]))
p03632
s521002796
Wrong Answer
a, b, c, d = (int(x) for x in input().split()) if a <= c <= b: if d <= b: print(d-c) else: print(b-c) elif c <= a: if d <= b: print(d-a) else: print(b-a) else: print(0)
p02767
s038917217
Accepted
n = int(input()) x = list(map(int,input().split())) ans = 10000000 for i in range(100): result = 0 for j in x: result += (j - i )**2 ans = min(result, ans) print(ans)
p04029
s156193006
Accepted
n = int(input()) print(n*(n+1)//2)
p04043
s736745274
Accepted
A=list(map(int,input().split())) A.sort() #print(A) if A==[5,5,7]: print('YES') else: print('NO')
p02882
s539767661
Accepted
import math a,b,x=map(int,input().split()) if (a**2)*b<=2*x: ans=2*(((a**2)*b)-x) print(math.degrees(math.atan(ans/a**3))) else: ans=2*x q=math.degrees(math.atan(ans/(a*(b**2)))) print(90-q)
p02645
s209673214
Wrong Answer
import random s = input() s_len = s.count(s) start = random.randint(0, s_len) end = start + 3 nickname = s[start:end] print(nickname)
p03061
s297806943
Accepted
n,*a=map(int,open(0).read().split()) from math import * l,r=[0]*n,[0]*n for i in range(1,n): l[i]=gcd(l[i-1],a[i-1]) r[~i]=gcd(r[-i],a[-i]) m=0 for i in range(n): m=max(m,gcd(l[i],r[i])) print(m)
p03796
s885740958
Wrong Answer
n = int(input()) ans = 1 dummy1,dummy2 = divmod(n,2) for i in range(1,dummy1+1): ans *= i ans *= n+1-i ans = ans % (10**9+7) if dummy2 == 1: ans *= ((dummy1+1) % (10**9+7)) print(ans)
p02833
s263465436
Accepted
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() if N%2==1: print(0) exit() ans=0 for i in range(1,100): a=2*pow(5,i) ans+=N//a print(ans) main()
p03069
s122341907
Wrong Answer
N = int(input()) S = input() S = S.replace('#.','') print((N-len(S))//2)
p03795
s752569550
Accepted
N = int(input()) x = N * 800 y = N // 15 * 200 print(x - y)
p03645
s936173016
Wrong Answer
N, M = map(int, input().split()) To_List = [] for _ in range(M): a, b = map(int, input().split()) if a == 1: To_List.append(b) if b == N: if a in To_List: print("POSSIBLE") exit() print("IMPOSSIBLE")
p02777
s400540661
Accepted
s,t = input().split() a,b = map(int,input().split()) u = input() if u == s: print(a-1,b) elif u == t: print(a,b-1) else: print(a,b)
p02916
s147789289
Accepted
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n = ii() A = iil() B = iil() C = iil() ans = sum(B) for i in range(1,n): if A[i-1] == A[i] - 1: ans += C[A[i-1]-1] print(ans)
p02861
s854574000
Accepted
N = int(input()) pts = [(list(map(int,input().split()))) for _ in range(0,N)] from itertools import combinations def f(x1,y1,x2,y2): dx = x2 - x1 dy = y2 - y1 return (dx**2+dy**2)**0.5 dst = 0 for i,j in combinations(range(0,N),2): dst += f(pts[i][0], pts[i][1], pts[j][0], pts[j][1]) print(dst / (N / 2))
p03219
s565269071
Wrong Answer
x,y = map(int,input().split()) print(int(x/y))
p02756
s682479590
Accepted
s = input() q = int(input()) t = '' for i in range(q): query = input().split() if query[0] == '1': s,t = t,s else: if query[1] == '1': t += query[2] else: s += query[2] print(t[::-1] + s)
p02939
s423730511
Wrong Answer
s = input() res = 1 flg = 0 i = 1 while i < len(s)-2: if s[i] == s[i-1]: i += 3 res += 2 else: res += 1 i += 1 if i == len(s): print(res) elif i == len(s)-1: if s[-1] == s[-2]: print(res) else: print(res+1) elif i == len(s)-2: if s[-1] == s[-2] == s[-3]: print(res+1) else: print(res+2)
p02768
s008889151
Accepted
def cmb(n, r, MOD): r = min(r, n - r) n1 = n + 1 numerator = denominator = 1 for i in range(1, r + 1): numerator = (numerator * (n1 - i)) % MOD denominator = (denominator * i) % MOD return (numerator * pow(denominator, MOD - 2, MOD)) % MOD n, a, b = map(int, input().split()) MOD = 10 ** 9 + 7 print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)
p03252
s140642857
Wrong Answer
from collections import defaultdict s = list(map(str, input().rstrip())) t = list(map(str, input().rstrip())) d = defaultdict(set) for x, y in zip(s, t): d[y].add(x) print("Yes" if all([len(x) == 1 for x in list(d.values())]) else "No")
p02939
s894351680
Accepted
s=input() a = '' b = '' c = 0 for i in s: a += i if a == b: continue c += 1 b = a a = '' print(c)
p02693
s986726057
Wrong Answer
import sys from pprint import pprint K = int(sys.stdin.readline().strip()) A, B = map(int, sys.stdin.readline().strip().split()) if K == 1: print("OK") else: if B - A >= K: print("OK") else: print("NG")
p02917
s814692308
Accepted
N = int(input()) B = list(map(int, input().split())) result = B[0] for i in range(N - 2): A = min(B[i], B[i + 1]) result += A result += B[N - 2] print(result)
p03994
s258740170
Wrong Answer
s = input() K = int(input()) ans = [] for i in s: if i == "a": ans.append("a") pass elif ord(i) + K > ord("z") + 1: ans.append("a") K -= ord("z") + 1 - ord(i) else: ans.append(i) last = (K + ord(ans[-1]) - ord('a')) % 26 ans[-1] = chr(ord("a") + last) print(''.join(ans))
p04011
s665659881
Accepted
n=int(input()) k=int(input()) x=int(input()) y=int(input()) if n>=k: a=k*x a+=(n-k)*y else: a=n*x print(a)
p02888
s779690553
Wrong Answer
# https://atcoder.jp/contests/abc143/tasks/abc143_d from bisect import bisect_left, bisect_right import sys input = sys.stdin.readline n = int(input()) # 入力が1つ # map(int, input().split()) # 入力が複数 L = [int(i) for i in input().split()] L.sort() pairs = [] for i in range(n): for j in range(i + 1, n): pairs.append((i, j)) ans = 0 for i, j in pairs: a, b = L[i], L[j] l = bisect_left(L, b - a) r = bisect_left(L, a - 1) if l < r: ans += (r - l) print(ans)
p02882
s783033481
Accepted
import sys import math read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): a, b, x = map(int, readline().split()) V = a * a * b / 2 if V < x: ans = math.degrees(math.atan((2 * (a * a * b - x)) / a ** 3)) else: ans = math.degrees(math.atan((a * b * b) / (2 * x))) print(ans) if __name__ == '__main__': main()
p03997
s534447281
Wrong Answer
a=int(input()) b=int(input()) h=int(input()) ans = (a+b)*h/2 print(ans)
p02818
s128037724
Accepted
a, b, k = map(int, input().split()) a1 = a b1 = b if k <= a: a1 -= k elif k <= a + b: a1 = 0 b1 -= k - a else: a1 = 0 b1 = 0 print(a1, b1)
p03327
s718079409
Wrong Answer
contest_num = int(input()) if contest_num <= 999: # 不等号は=の手前に print('abc') elif contest_num >= 1000: print('abd')
p02951
s174032561
Accepted
a, b, c = list(map(int, input().split())) print(c - a + b) if c - a + b > 0 else print(0)
p03997
s424734023
Accepted
a = int(input()) b = int(input()) h = int(input()) print((a + b) * h // 2)
p02860
s808910980
Accepted
n = int(input()) s = input() if s[:(n//2)]==s[(n//2):]: print("Yes") else: print("No")
p02778
s838620228
Wrong Answer
S = str(input()) print('*'*len(S))
p03241
s154560015
Wrong Answer
import bisect def factor(N): arr=[] for i in range(1,int(N**0.5)+1): if(N%i==0): arr.append(i) if(N//i!=i): arr.append(N//i) return arr N,M=map(int,input().split()) li=sorted(factor(M)) res=1 for i in li: if(i>M//N): break if(M//i>=N): res=i print(res)
p03767
s899208524
Accepted
N = int(input()) A = list(map(int,input().split())) A.sort(reverse=True) ans = 0 for i in range(N): ans += A[i*2+1] print(ans)
p03077
s653098155
Wrong Answer
n = int(input()) trans = [ (int(input()) + n - 1) // n for i in range(5) ] print(max(trans) + 4)
p03071
s076676773
Accepted
a,b=map(int,input().split()) if max(a,b)>min(a,b): print(2*max(a,b)-1) else: print(2*a)
p03095
s597800480
Accepted
n = int(input()) S = list(input()) # aを含む -> 個数通り 含まない-> 1 # bを含む -> 個数通り 含まない-> 1 from collections import defaultdict d = defaultdict(int) for s in S: d[s] += 1 ans = 1 mod = 10**9 + 7 for k in d.keys(): ans *= (d[k]+1) ans %= mod ans -= 1 print(ans)
p03338
s312219465
Accepted
N = int(input()) S = input() cnt = 0 for i in range(1, N): # スライスで部分文字列をつくって、set型に変換し、積集合で共通する英小文字を取得 dup_cnt = set(S[:i]) & set(S[i:]) # 共通する英小文字の数が現時点での最大値より大きいなら最大値を更新 if cnt < len(dup_cnt): cnt = len(dup_cnt) print(cnt)
p03210
s988437975
Wrong Answer
print('YES' if int(input()) == 3 or 5 or 7 else 'NO')
p03679
s191352011
Wrong Answer
x,a,b=map(int,input().split()) t=a-b if t>0: print('delicious') else: if abs(t)<=x: print('safe') else: print('dangerous')
p02912
s773768663
Accepted
import heapq N, M = map(int, input().split()) hq = [] for price in map(int, input().split()): heapq.heappush(hq, -price) for i in range(M): p = -heapq.heappop(hq) p /= 2 heapq.heappush(hq, -p) result = -sum([int(p) for p in hq]) print(result)
p02783
s220629384
Accepted
h,a=map(int,input().split()) print(-(-h//a))
p03469
s978095543
Accepted
a = input() a = list(str(a)) a[3]="8" a="".join(a) print(a)
p03416
s057091553
Accepted
a, b = map(int, input().split()) ans = 0 for i in range(a, b + 1): s = str(i) if s[:2][::-1] == s[3:]: ans += 1 print(ans)
p02547
s523999741
Accepted
n=int(input()) c=0 m=1 for i in [0]*n: a,b=map(int,input().split()) if a==b: c+=1 if c==3: m=0 else: c=0 print('YNeos'[m==1::2])
p02813
s076494389
Accepted
n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) def fact(n): ans = n for i in range(1, n): ans *= i return ans def number(lst, n): numlst = [] ans = 1 for i in range(n): numlst.append(i+1) for i in range(n): for j in range(len(numlst)): if lst[i] == numlst[j]: ans += j*fact(n-i-1) numlst.pop(j) break return ans res = number(q, n) - number(p, n) print(abs(res))
p03000
s270377326
Accepted
n,x = map(int,input().split()) li = list(map(int,input().split())) cnt = 0 num = 1 for i in li: if cnt + i > x: break else: cnt += i num += 1 print(num)
p03545
s240795780
Accepted
import itertools A, B, C, D = input() for i in itertools.product(['+', '-'], repeat=3): if eval(A+i[0]+B+i[1]+C+i[2]+D) ==7: print(A+i[0]+B+i[1]+C+i[2]+D+'=7') exit()
p02909
s712993615
Accepted
def resolve(): s = input() if s == "Sunny": print("Cloudy") elif s == "Cloudy": print("Rainy") else: print("Sunny") resolve()
p02682
s543506465
Accepted
a, b, c, k =map(int, input().split()) #複数数値入力 if a+b >= k: if a < k : print(a) else: print(k) else: print(a-(k-a-b))
p03427
s590407022
Wrong Answer
N = input() n = len(N) ans = int(N[0])-1 + 9*(n-1) print(ans)
p03105
s604320954
Accepted
A, B, C = map(int,input().split()) if B//A >= C: print(C) else: print(B//A)
p03469
s268483042
Accepted
print(input().replace(str(2017), str(2018)))