problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02719
s676670277
Accepted
string = input() n = int(string.split()[0]) k = int(string.split()[1]) diff = n - k n = n - (diff // k) * k while n > k: n = n - k if n == k: print(0) exit() print(min(n,k-n))
p02691
s163077375
Wrong Answer
n=int(input()) a=input().split() alen=len(a) for i in range(0,alen): a[i]=int(a[i]) ans=0 for i in range(0,n): for j in range(0,i): if a[i-1]+a[j-1]==i-j: ans+=1 print(ans)
p03456
s202511753
Wrong Answer
a,b = input().split() c = int(a+b) ans = "No" for i in range(101): print(i**2) if i**2 == c: ans = "Yes" break print(ans)
p02993
s681898426
Wrong Answer
S = input() ans = 0 for i in range(3): if S[i] != S[i+1]: ans = 1 print('Good' if ans == 1 else 'Bad')
p02598
s312164545
Accepted
N, K = map(int, input().split()) A = [int(a) for a in input().split()] def chk(x): s = 0 for a in A: s += (a - 1) // x return 1 if s <= K else 0 l, r = 0, 1 << 30 while r - l > 1: m = (l + r) // 2 if chk(m): r = m else: l = m print(r)
p03548
s294767350
Wrong Answer
X, Y, Z = list(map(int, input().split())) ans = 0 while True: X -= Z if X <= 0: print(ans) break X -= Y if X <= 0: print(ans) break ans += 1
p02823
s531359438
Accepted
N,A,B=map(int,input().split()) if (A+B)%2==0: ans=(B-A)//2 else: ans=min(A-1,N-B)+1+(B-A-1)//2 print(ans)
p03657
s831109841
Wrong Answer
A, B = map(int,input().split()) print("Possible" if (A + B) % 3 == 0 else "Impossible")
p03679
s018056216
Accepted
X,A,B=map(int,input().split()) x=B-A if x<=0: print("delicious") elif x<=X: print("safe") else: print("dangerous")
p03145
s654565232
Wrong Answer
line = input() sides = [int(n) for n in line.split()] sides.sort() area = round(sides[0] * sides[1])/2 print(area)
p02631
s651509127
Accepted
n=int(input()) a_array=list(map(int,input().split())) all_xor=0 for a in a_array: all_xor^=a print(" ".join([str(all_xor^a) for a in a_array]))
p03145
s746110623
Accepted
a,b,c = map(int,input().split()) print(a*b//2)
p03252
s790340736
Wrong Answer
s=str(input()) t=str(input()) temps=list(set(s)) tempt=list(set(t)) temps=sorted(temps) tempt=sorted(tempt) for i in range(0,len(temps)): temps[i]=s.count(temps[i]) for i in range(0,len(tempt)): tempt[i]=t.count(tempt[i]) if temps==tempt: print("Yes") else: print("No")
p02838
s129700811
Wrong Answer
n = int(input()) a = list(map(int, input().split())) c1_list = [0]*60 for i in range(n): b = format(a[i], '060b') print(b) for j in range(len(b)): if b[j] == "1": c1_list[j] += 1 count = 0 for i in range(60): count = (count + c1_list[i]*(n-c1_list[i])*2**(59-i)) % 1000000007 print(count)
p02676
s739789865
Wrong Answer
k = int(input()) s = input() if len(s) > k: print(s[:7] + "...") else: print(s)
p03862
s459072154
Accepted
N,X = map(int,input().split()) A = list(map(int,input().split())) wa = [] ans = 0 if A[0] > X: ans += A[0]-X A[0] = X for i in range(N-1): wa.append(A[i]+A[i+1]) for j in range(N-2): if wa[j] > X: ans += wa[j]-X wa[j+1] -= wa[j]-X if wa[N-2] > X: ans += wa[N-2]-X print(ans)
p02953
s631648574
Wrong Answer
import sys N=int(input()) L=list(map(int,input().split())) for i in range(N): if i==0: L[i]-=1 elif i==N-1: if L[i-1]>L[i]: print("No") sys.exit() else: if L[i]>L[i+1]: L[i]-=1 if L[i-1]>L[i]: print("No") sys.exit() print("Yes")
p02661
s897674266
Wrong Answer
n = int(input()) x = [list(map(int,input().split())) for i in range(n)] if n%2==0: min_sum = x[(n//2)-1][0]+x[(n//2)][0]/2 max_sum = x[(n//2)-1][1]+x[(n//2)][1]/2 print(int((max_sum-min_sum)*2)) else: tmp = x[n//2] print(tmp[1]-tmp[0]+1)
p03821
s851374626
Accepted
#!/usr/bin/env python3 _, *s = open(0) c = 0 for t in s[::-1]: a, b = map(int, t.split()) c += (-a-c) % b print(c)
p02693
s751863610
Accepted
K = int(input()) A, B = map(int,input().split()) ans = "NG" for i in range(A,B+1): if i % K == 0: ans = "OK" break print(ans)
p02713
s991286281
Accepted
k = int(input()) import math ans = 0 for a in range(1,k+1): for b in range(1, k+1): for c in range(1,k+1): ans += math.gcd(math.gcd(a,b),c) print(ans)
p03639
s614300682
Wrong Answer
x = list(map(int, input().split())) for i in range(len(x)): if x[i] == 0: print(i+1) exit()
p02696
s363501999
Wrong Answer
import math import random A,B,N = map(int,input().split()) def quick(x): pri = math.floor(A * x / B) lat = A * math.floor(x / B) return math.floor(pri - lat) max = quick(N) for i in range(50000): ran = math.floor(random.uniform(0, N)) tem = quick(ran) if(max < tem): max = tem print(max)
p04031
s269784479
Accepted
n = int(input()) a = list(map(int, input().split())) b = round(sum(a) / n) ans = 0 for i in a: ans += (i - b) ** 2 print(ans)
p02678
s359975871
Accepted
f=lambda:map(int,input().split()) n,m=f() g=[[] for _ in range(n)] for _ in range(m): a,b=f() g[a-1]+=[b-1] g[b-1]+=[a-1] p=[0]*n from collections import* q=deque([0]) while q: v=q.popleft() for c in g[v]: if p[c]<1: p[c]=v+1; q.append(c) print('Yes',*p[1:],sep='\n')
p02777
s609183839
Accepted
S, T = input().split() A, B = map(int, input().split()) U = input() if U == S: print(A-1, B) else: print(A, B-1)
p03469
s743744102
Accepted
S = input() print('2018' + S[4:])
p02939
s226170925
Wrong Answer
s=input() l=len(s) s+='?' ans=0 ch = 0 for i in range(l): if s[i]!=s[i+1] or ch==1: ans+=1 ch=0 else: ch=1 print(ans)
p02951
s328202007
Accepted
A,B,C=map(int,input().split()) answer=0 answer=C-(A-B) if answer > 0: print(answer) else: print(0)
p02859
s248235888
Wrong Answer
r=int(input()) print(r^2)
p03639
s754300013
Accepted
from collections import defaultdict from collections import deque import itertools import math def readInt(): return int(input()) def readInts(): return list(map(int, input().split())) def readChar(): return input() def readChars(): return input().split() n = readInt() d = {"2":0,"4":0,"other":0} for i in readInts(): if i%4==0: d["4"]+=1 elif i%2==0: d["2"]+=1 else: d["other"]+=1 if d["2"]>1: if d["4"]>=d["other"]: print("Yes") else: print("No") else: if d["4"]+1>=d["other"]+d["2"]: print("Yes") else: print("No")
p02730
s667183550
Accepted
S = input() N = len(S) res = False P = [] L = [] K = [] for s in range(N): P.append(S[s]) L = P[:(N-1)//2] K = P[(N+3)//2-1:N] if L == K: res = True if res: print('Yes') else: print('No')
p02699
s651111320
Accepted
s, w = map(int, input().split()) if w >= s: print("unsafe") else: print("safe")
p04033
s800505358
Wrong Answer
a,b = map(int,input().split()) if (a+b) == 0 or (b+a) == 0: print("Zero") elif (a+b) > 0: print("Positive") else: print("Negative")
p03417
s692937621
Accepted
n,m = map(int,input().split()) if n == 1 and m == 1: print(1) elif n == 1: print(max(0,m-2)) elif m == 1: print(max(0,n-2)) else: a = max(0,m-2) b = max(0,n-2) print(a*b)
p02982
s593032196
Accepted
N,D=map(int,input().split()) ans=0 A=[] for x in range(N): X=list(map(int,input().split())) for y in range(len(A)): s=0 for z in range(D): s+=(A[y][z]-X[z])**2 if ((s**(1/2))*10)%10==0: ans+=1 A.append(X) print(ans)
p03073
s372522517
Accepted
import collections s = map(int,list(raw_input())) count = 0 for i in range(1,len(s)): if s[i] == s[i - 1]: s[i] = 1 - s[i] count += 1 print count
p03632
s990380345
Wrong Answer
a,b,c,d=list(map(int,input().split())) print(max(max(b,d)-min(a,c),0))
p02724
s287511143
Wrong Answer
import math n=int(input()) t=(n//500)*1000 s=(n-t*500//5)*5 print(t+s)
p03472
s588453372
Accepted
N, H = map(int, input().split()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) A.sort(reverse = True) B.sort(reverse = True) count = 0 for b in B: if b > A[0]: H -= b count += 1 else: break if H <= 0: break if H > 0: count += (H + A[0] - 1) // A[0] print(count)
p03797
s907126033
Accepted
N,M = [int(i) for i in input().split()] S = 0 if N <= M//2: S = N + (M - 2*N)//4 else: if N > M//2: S = M//2 else: S = N print(S)
p02630
s386197787
Wrong Answer
from collections import Counter n = int(input()) aa = tuple(map(int, input().split())) actr = Counter(aa) q = int(input()) tb = {} for i in range(q): b, c = map(int, input().split()) tb[b] = c for k, v in tb.items(): if v == b: tb[k] = c ans = 0 for a, n in actr.items(): ans += tb.get(a, a) * n print(ans)
p03773
s746981537
Accepted
a, b = map(int, input().split()) print((a + b) % 24)
p03274
s659235711
Wrong Answer
[N,K] = list(map(int,input().split())) x = list(map(int,input().split())) #連続する蝋燭を全探索 l=0 r=K-1 ans=2*(10**8)+1 for i in range(N-K+1): ans = min(ans, abs(x[l])+ x[r]-x[l]) l+=1 r+=1 print(ans)
p02583
s622440979
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort(reverse=True) c = 0 for i in range(n-2): for j in range(i+1,n-1): if l[i] != l[j]: for k in range(j+1,n): if l[j] != l[k]: if l[i] < l[j]+l[k]: c += 1 print(c)
p02791
s946014735
Accepted
n = int(input()) p = list(map(int, input().split())) MIN = 10**6 ans = 0 for i in range(n): if p[i] <= MIN: ans += 1 MIN = min(MIN, p[i]) print(ans)
p03657
s234749227
Wrong Answer
a, b = map(int, input().split()) if (a + b) % 3 == 0: print("Possible") else: print("Impossible")
p02862
s203161319
Accepted
x, y = map(int, input().split()) MOD = 10 ** 9 + 7 if (x+y) % 3 != 0: print(0) exit() #m: (i+2, j+1), n (i+1, j+2) m = (2*x - y) // 3 n = (2*y - x) // 3 if m < 0 or n < 0: print(0) exit() ans = 1 i = 1 if n > m: n, m = m, n while i <= n: ans *= (m+i) * pow(i, MOD-2, MOD) ans %= MOD i += 1 print(ans)
p02784
s870360270
Wrong Answer
l1 = input().strip().split() h = int(l1[0]) n = int(l1[1]) a = sorted([int(i) for i in input().strip().split()], reverse=True) if h < sum(a[:n-1]): print("Yes") else: print("No")
p02765
s078083584
Accepted
N,R=map(int, input().split()) if N>=10: print(R) if 0<=N<10: print(R+100*(10-N))
p02775
s926543655
Wrong Answer
n = int(input()) ans = 0 n_dig = len(str(n)) # Nの桁数 carry = 0 for i in range(n_dig): d = n % 10 n //= 10 if carry + d <= 5: ans += d + carry carry = 0 # 繰り上がり else: ans += 10 - d - carry carry = 1 print(ans + carry)
p03284
s035788025
Accepted
N, K = map(int, input().split()) if N%K: print(1) else: print(0)
p03698
s074350376
Accepted
S = input() s = list(set(S)) if len(S) == len(s): print('yes') else: print('no')
p03419
s222111325
Accepted
N,M=map(int,input().split()) if N==M==1: print(1) elif N==1 or M==1: print(N*M-2) elif N==2 or M==2: print(0) else: print((N-2)*(M-2))
p03835
s536982528
Wrong Answer
k, s = map(int, input().split()) count=0 for i in range(k+1): if s-i-2*k >=0: for j in range(k+1): if s-i-j-k>=0: for h in range(k+1): if i+j+h ==s: count+=1 print(count)
p03637
s852713815
Wrong Answer
n=int(input()) a=list(map(int,input().split())) count=0 count2=0 for i in range(n): if a[i]%4==0: count+=1 elif a[i]%2==0: count2+=1 #print(count2) if (n-count2//2)//2<count or n==count2 : print("Yes ") elif 2<=count2 and (n-count2)//2<count: print("Yes ") else: print("No")
p02910
s475367817
Accepted
s=str(input()) s=list(s) for i in range(0,len(s)): if i%2==0: if s[i]!="R" and s[i]!="U" and s[i]!="D": print("No") break else: if s[i]!="L" and s[i]!="U" and s[i]!="D": print("No") break else: print("Yes")
p04043
s889839273
Accepted
a = list(map(int,input().split())) if a.count(5) == 2 and a.count(7) == 1: print("YES") else: print("NO")
p02796
s810638355
Wrong Answer
n = int(input()) xl = [[int(i) for i in input().split()] for j in range(n)] xl.sort() now = xl[0][0] + xl[0][1] count = 1 if(n == 1): print(1) else: for i in range(1, n): if(now <= xl[i][0] - xl[i][1]): count += 1 now <= xl[i][0] - xl[i][1] print(count)
p02953
s989115568
Wrong Answer
from sys import exit N = int(input()) h = list(map(int,input().split())) pre = 0 for i in range(N-1): if h[i] <= h[i+1]: pre = h[i] else: if h[i] - h[i+1] == 1: if pre > h[i]-1: print("No") exit(0) else: pre = h[i]-1 else: print("No") exit(0) print("Yes")
p03206
s857681874
Accepted
n=input() if n=="25": print("Christmas") elif n=="24": print("Christmas Eve") elif n=="23": print("Christmas Eve Eve") elif n=="22": print("Christmas Eve Eve Eve")
p04044
s104430928
Accepted
# coding: utf-8 num, size = map(int,input().split()) data =[] for x in range(num): data.append(input()) print(''.join(sorted(data)))
p02720
s988782833
Accepted
from collections import deque K = int(input()) q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) cnt = 0 while q: x = q.popleft() cnt += 1 if cnt == K: print(x) break y = x % 10 z = 10*x+y if y != 0: q.append(z-1) q.append(z) if y != 9: q.append(z+1)
p02696
s960116483
Wrong Answer
import math ans=-100000000 a,b,n=map(int,input().split()) st=1 if n>1000000: st=b-1 for i in range(st,n+1): keep=math.floor(a*i/b)-a*math.floor(i/b) if ans<keep: ans=keep print(ans)
p03456
s936121070
Accepted
a, b = input().split() num = int(a + b) heihosu = [] for i in range(4, 1000): heihosu.append(i * i) # print(heihosu) if num in heihosu: print('Yes') else: print('No')
p03719
s695885150
Accepted
import sys import math import itertools import bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) def lcm(a,b): return a*b//math.gcd(a,b) sys.setrecursionlimit(10 ** 9) INF = 10**9 mod = 10**9+7 A,B,C = I() if A <= C <= B: print('Yes') else: print('No')
p02678
s277211842
Accepted
from collections import deque n, m = map(int, input().split()) way = [[] for i in range(n + 1)] ans = [-1 for i in range(n + 1)] reached = [0 for i in range(n + 1)] for i in range(m): a, b = map(int, input().split()) way[a].append(b) way[b].append(a) D = deque([1]) while D: go = D.popleft() for i in way[go]: if reached[i] == 0: D.append(i) reached[i] = 1 ans[i] = go print('Yes') for i in range(2, n + 1): print(ans[i])
p02989
s081150025
Accepted
import sys input = sys.stdin.readline N = int(input()) d = list(map(int,input().split())) sd = sorted(d) ss = sd[N//2-1] sb = sd[N//2] print(sb-ss)
p02690
s122984059
Accepted
import sys x=int(input()) for a in range(-1000,1000): for b in range(-1000,1000): if a**5-b**5==x: print(a,b) sys.exit()
p03799
s593212989
Accepted
S, C = map(int, input().split()) if S>=C//2: print(C//2) else: ans = S C -= S*2 ans += C//4 print(ans)
p03329
s701281040
Wrong Answer
import sys n = int(input()) dp=[sys.maxsize]*(n+1) def beki(arg): res=0 t=1 while t < n: t=t*arg res+=1 return res dp[0]=0 a = beki(9) b = beki(6) for i in range(n): dp[i+1]=min(dp[i+1],dp[i]+1) for j in range(1,a): if i+9**j > n: break dp[i+9**j]=min(dp[i+9**j],dp[i]+1) for j in range(1,b): if i+6**j > n: break dp[i+6**j]=min(dp[i+6**j],dp[i]+1) print(dp[n])
p02843
s080235693
Accepted
x = input() x = '000'+x z = x[:-2] y = x[-2:] s = 0 z = int(z) y = int(y) L = [] for i in range(1,21): s +=5 if s>=y and z>=i: print(1) exit() if z>=20: print(1) exit() print(0)
p02983
s403075156
Accepted
import sys a, b = map(int,input().split()) num = int(a*b%2019) for i in range(a, b + 1): for j in range(i + 1, b + 1): if(i >= j): continue num = min(num, (i*j)%2019) if(num == 0): print(0) sys.exit() print(num % 2019)
p03438
s878283932
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c1=0 c2=0 from math import floor for i in range(n): if a[i]>b[i]: c1+=a[i]-b[i] elif a[i]<b[i]: c2+=floor((b[i]-a[i])/2) if c2>=c1: print('Yes') else: print('No')
p02789
s081250475
Wrong Answer
inout=input() if(inout[0]==inout[1]): print("Yes") else: print("No")
p03067
s899372831
Accepted
a, b, c = map(int, input().split()) if a < c < b or a > c > b: print("Yes") else: print("No")
p02578
s119727384
Accepted
n = int(input()) A = list(map(int, input().split())) a=0 result=0 for i in range(n-1): if A[i] > A[i+1]: a = A[i] - A[i+1] A[i+1] += a result += a print(result)
p03408
s988567292
Wrong Answer
#!/usr/bin/env python3 # input n = int(input()) s = [input() for _ in range(n)] m = int(input()) t = [input() for _ in range(m)] # calc d = {} for i in s: if i in d.keys(): d[i] += 1 else: d[i] = 1 for i in t: if i in d.keys(): d[i] -= 1 else: d[i] = -1 #import pdb; pdb.set_trace() if len(d.keys()) != 1: print(max(d.values())) else: print(max(list(d.values())[0], 0))
p03779
s596162698
Wrong Answer
n = int(open(0).read()) i = 0 while i*(i+1)//2 <= n: i += 1 print(n - (i-1)*i//2 + i-1)
p02753
s229330558
Wrong Answer
s = input() if s == "AAA" or "BBB": print("No") else: print("Yes")
p03745
s813092975
Wrong Answer
N = int(input()) A = list(map(int, input().split())) status = 0 # 0 = defalt 1 = up 2 = down cnt = 1 for i in range(1,N): if A[i-1] < A[i]: #up petern if status == 0: status = 1 elif status == 2: status = 0 cnt += 1 elif A[i-1] > A[i]: if status == 0: status = 2 elif status: status = 0 cnt += 1 print(cnt)
p02641
s688481579
Accepted
x, n = map(int, input().split()) p = list(map(int, input().split())) i = 0 while True: if x-i not in p: print(x-i) exit() elif x+i not in p: print(x+i) exit() i += 1
p02713
s082225268
Accepted
import math from functools import reduce K = int(input()) ans = 0 for i in range(1, K-1): for j in range(i+1, K): for k in range(j+1, K+1): n = math.gcd(i, math.gcd(j,k)) ans += 6*n for i in range(1, K+1): for j in range(i+1, K+1): n = math.gcd(i,j) ans += 6*n print(ans+sum(list(i for i in range(K+1))))
p03543
s304815891
Accepted
def actual(n): s = str(n) if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]: return 'Yes' return 'No' # if len(set(str(n))) <= 2: # return 'Yes' # # return 'No' s = input() print(actual(s))
p02747
s325388725
Accepted
n=input() import re n2 = re.split('(..)',n)[1::2] if len(n) % 2 != 0: print('No') else: cnt = 0 for i,s in enumerate(n2): if 'hi' in s: cnt += 1 if cnt == len(n2): print('Yes') else: print('No')
p03803
s980926099
Accepted
a,b=map(int,input().split()) if a==1 and b!=1: print("Alice") elif a!=1 and b==1: print("Bob") elif a==1 and b==1: print("Draw") else: if a>b: print("Alice") elif a<b: print("Bob") else: print("Draw")
p03324
s558551085
Accepted
a,b= map(int,input().split()) if b !=100: print((100 ** a)*b) else: print((100 ** a)*(b+1))
p03986
s653361011
Accepted
S = input() cnt = [] c = S[0] tmp = 0 for i in range(len(S)): if S[i] == c: tmp += 1 else: cnt.append(tmp) c = S[i] tmp = 1 cnt.append(tmp) cnt_S, cnt_T = 0,0 delete = 0 if S[0] != 'S': cnt.pop(0) cnt_S = cnt[0] for i in range(1,len(cnt),2): if cnt_S >= cnt[i]: cnt_S -= cnt[i] delete += cnt[i]*2 else: delete += cnt_S*2 cnt_S = 0 if i+1 >= len(cnt): break cnt_S += cnt[i+1] print(len(S)-delete)
p04029
s123270337
Accepted
n=int(input());print(n*(n+1)//2)
p02924
s372040189
Accepted
n = int(input()) ans=(n*(n-1))//2 print(int(ans))
p03319
s590704794
Accepted
ma = lambda :map(int,input().split()) ni = lambda:int(input()) import collections import math import itertools import heapq as hq gcd = math.gcd n,k = ma() A = list(ma()) mi = min(A) cnt = 0 ans = 0 f = True #これまでにmiが含まれていないか for a in A: if a==mi: if f or cnt==0: f = False continue cnt+=1 if cnt ==k-1: ans+=1 cnt=0 f=True if cnt>0:ans+=1 print(ans)
p03457
s244326677
Accepted
import sys input=sys.stdin.readline n=int(input()) pt=0 pxy=0 for i in range(n): t,x,y=map(int,input().split()) dt=t-pt dxy=abs(x+y-pxy) if dxy>dt or dt%2!=dxy%2: print('No') exit() else: print('Yes')
p03254
s949181899
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) # 小さい数から配っていくと子供の人数を最大化できる a = sorted(a) leftCandy = 0 childrenCnt = 0 for i in range(len(a)): leftCandy = x - a[i] if leftCandy >= 0: childrenCnt += 1 if leftCandy > 0: print(N-1) else: print(childrenCnt)
p03745
s347750625
Accepted
num = int(input()) l = list(map(int, input().split())) count = 1 var = var2 = 0 c = l[0] for i in l[1:]: if c < i: var = 1 elif c > i: var2 = 1 if var == 1 and var2 == 1: count += 1 var = var2 = 0 c = i print(count)
p03150
s545186527
Accepted
S = str(input()) N = len(S) for i in range(N-1): for j in range(i+1, N): tmp = S[:i+1] + S[j:] if tmp == 'keyence': print('YES') quit() print('NO')
p02747
s442152632
Accepted
s = input() if len(s.replace("hi", "")) == 0: print("Yes") else: print("No")
p02645
s423550342
Wrong Answer
print(input()[:2])
p02675
s680110315
Accepted
N=int(input()) a=[2,4,5,7,9] b=[0,1,6,8] f=N%10 if f in a: print("hon") elif f in b: print("pon") else: print("bon")
p02730
s749539495
Accepted
S = input() N = len(S) S_1 = S[0:int((N-1)/2)] S_2 = S[int((N+3)/2-1):N+1] print('Yes' if S[::-1] == S and S_1[::-1] == S_1 and S_2[::-1] == S_2 else 'No')
p03645
s367005287
Accepted
n, m = map(int, input().split()) A = [0] * n B = [0] * n for _ in range(m): a, b = map(int, input().split()) if a == 1: A[b-1] = 1 elif b == 1: A[a-1] = 1 elif a == n: B[b-1] = 1 elif b == n: B[a-1] = 1 for i in range(n): if A[i] == B[i] == 1: print('POSSIBLE') exit() print('IMPOSSIBLE')