problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03696
s427540646
Accepted
n = int(input()) S = input() l = 0 r = 0 for s in S: if s == "(": r += 1 else: if r > 0: r -= 1 else: l += 1 ans = "("*l + S + ")"*r print(ans)
p03073
s834813569
Accepted
def coloring_colorfully(s): ans = 0 color = {"0":"1", "1":"0"} for i in range(1, len(s)): if s[i-1] == s[i]: ans += 1 s[i] = color[s[i]] return ans def main(): s = list(str(input())) print(coloring_colorfully(s)) if __name__ == '__main__': main()
p03071
s690038097
Accepted
A, B = list(map(int, input().split())) if (A == B): print(A + B) else: print(max(A, B) * 2 - 1)
p02678
s848405777
Accepted
N,M = map(int,input().split()) g = [[] for _ in range(N+1)] for _ in range(M): a,b = map(int,input().split()) g[a].append(b) g[b].append(a) from collections import deque queue = deque([1]) d = [None]*(N+1) d[1]=None while queue: now = queue.popleft() for i in g[now]: if d[i] is None: d[i]=now queue.append(i) print("Yes") for i in range(2,N+1): print(d[i])
p02792
s384133441
Wrong Answer
A=int(input()) c=A//10 if A%10==0: print(c**2+8) elif A<10: print(A) else: n=A%10 t=len(str(A)) b=A//10**(t-1) if n>=b: print(c**2+2*c+9) else: print(c**2+2*c+6)
p03163
s519798123
Accepted
def solve(N, W, weightValues): dp = [0] * (W + 1) s = 0 for w, v in weightValues: s += w for j in range(min(W, s), w - 1, -1): if dp[j - w] + v > dp[j]: dp[j] = dp[j - w] + v print(max(dp)) N, W = map(int, input().split()) weightValues = sorted([list(map(int, input().split())) for i in range(N)]) solve(N, W, weightValues)
p03910
s273521284
Accepted
N = int(input()) k = 0 ans = 0 while N >= ans: k += 1 ans = k * (k+1) / 2 exit_num = int(k * (k+1) / 2 - N) for i in range(1,k+1): if i != exit_num: print(i)
p02951
s827186257
Wrong Answer
A, B, C = map(int, input().split()) print(B + C - A)
p03345
s094507561
Accepted
import sys input = sys.stdin.readline def main(): ans = 0 A, B, C, K = map(int, input().split()) if K%2 == 0: ans = A - B else: ans = B - A if ans >= 10**18: ans = 'Unfair' print(ans) if __name__ == '__main__': main()
p03612
s926980951
Wrong Answer
n=int(input()) alis=list(map(int,input().split())) xlis=dict() for i in set(alis): xlis[i-1]=0 xlis[i+1]=0 xlis[i]=0 for i in alis: xlis[i-1]+=1 xlis[i+1]+=1 xlis[i]+=1 print(max(xlis.values()))
p03455
s991323742
Wrong Answer
a,b = map(int,input().split()) print("Even" if (a*b)%2==0 else print("Odd"))
p03659
s056071018
Wrong Answer
n=int(input()) a=list(map(int,input().split())) x=a[0] y=a[1] a.sort(reverse=True ) for i in range(2,n): if a[i]<0: if x>y: x+=a[i] else: y+=a[i] else: if x<y: x+=a[i] else: y+=a[i] print(max(x,y)-min(x,y))
p03544
s284282555
Wrong Answer
L = [2,1] N = int(input()) K = 0 if N == 1: print(1) else: for i in range(N-1): K = L[i+1]+L[i] L.append(K) print(K)
p03555
s225580797
Accepted
c1 = input() c2 = input() if (c1[0] == c2[2]) and (c1[1] == c2[1]) and (c1[2] == c2[0]): print("YES") else: print("NO")
p02972
s674706979
Accepted
n =int(input()) num = list(map(int, input().split())) box =[0]*n sum=0 for i in reversed(range (n)): sum=0 for j in (range(int(n/(i+1))-1)): sum +=box[i+(i+1)*(j+1)] box[i]=(sum+num[i])%2 ans = [] for i in range(n): if box[i]==1: ans.append(i+1) print(len(ans)) ans=[str(a) for a in ans] ans=" ".join(ans) print(ans)
p02993
s263670388
Accepted
s = input() if (s[0] == s[1] or s[1] == s[2] or s[2] == s[3]): print('Bad') else: print('Good')
p04020
s529132899
Wrong Answer
n = int(input()) ans = 0 bef = 0 for _ in range(n): a = int(input()) if a == 0: bef = 0 continue ans += (a + bef) // 2 if (a + bef) % 2 == 1: bef = 1 print(ans)
p03486
s683823351
Wrong Answer
s,t=list(input()),list(input()) s.sort();t.sort(reverse=True) l=[''.join(s),''.join(t)] r=sorted(l) print('Yes' if l==r else 'No')
p03605
s088163229
Wrong Answer
n=int(input()) if (n/10==9 or n%10==9): print("Yes") else : print("No")
p02988
s991666200
Accepted
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range (1, n-1): if p[i-1] < p[i] and p[i] < p[i+1]: cnt += 1 elif p[i-1] > p[i] and p[i] > p[i+1]: cnt += 1 print(cnt)
p03352
s827139259
Accepted
X = int(input()) se = set(n**e for n in range(32) for e in range(2,11) if n**e <= X) answer = max(se) print(answer)
p03487
s560329615
Accepted
from collections import Counter N=int(input()) a=list(map(int,input().split())) ans=0 cnt = Counter(a) for k,v in cnt.items(): if k>v: ans+=v else: ans+=v-k print(ans)
p03071
s251358175
Wrong Answer
a,b = list(map(int,input().split())) if a >= b: print(a*(a-1)) else: print(b*(b-1))
p03592
s820701679
Wrong Answer
n,m,k = map(int, input().split()) for i in range(n+1): for j in range(m+1): if i*(m-j)+j*(n-1): print("Yes") exit() print("No")
p04019
s912550295
Accepted
import numpy as np S = input() NSEW = [S.count("N"), S.count("S"), S.count("E"), S.count("W")] if np.prod(NSEW) > 0: print("Yes") exit() elif NSEW[0] + NSEW[1] > 0 and NSEW[0] * NSEW[1] == 0: print("No") exit() elif NSEW[2] + NSEW[3] > 0 and NSEW[2] * NSEW[3] == 0: print("No") exit() print("Yes")
p03795
s822221923
Accepted
N = int(input()) tmp = N // 15 cost = 800 * N - 200 * tmp print(cost)
p03487
s585173669
Wrong Answer
inputs = [input() for i in range(2)] n = int(inputs[0]) a = map(lambda x: int(x), inputs[1].split(" ")) b = {} for i in a: if i not in b: b[i] = 1 else: b[i] += 1 count = 0 for k in b.keys(): tmp = abs(k - b[k]) if tmp > b[k]: count += b[k] else: count += tmp print(count)
p03387
s160924162
Accepted
a,b,c = [int(x) for x in input().split()] m = max([a,b,c]) if m % 2 == sum([a,b,c]) % 2: print(((3 * m) - sum([a,b,c])) // 2) else: print((((m+1) - a) + ((m+1)-b) + ((m+1)-c)) // 2)
p03835
s292403360
Accepted
import sys k, s = [int(i) for i in sys.stdin.readline().split()] cnt = 0 for x in range(min(k+1, s+1)): for y in range(min(k+1, s - x + 1)): if s - x - y <= k: cnt += 1 print(cnt)
p03773
s689403639
Wrong Answer
from fractions import gcd from collections import Counter, deque, defaultdict from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort from itertools import accumulate, product, permutations, combinations def main(): A, B = map(int, input().split()) print(A + B) if A + B <= 24 else print((A + B) % 24) if __name__ == '__main__': main()
p03543
s923360642
Accepted
a, b, c, d = input() if a == b == c or b == c == d: print('Yes') else: print('No')
p03017
s642294092
Accepted
n,a,b,c,d=map(int,input().split()) s=input() if "##" in s[a:max(c,d)]:print("No") elif c>d and "..." not in s[b-2:d+1]:print("No") else:print("Yes")
p02624
s776508089
Wrong Answer
n=int(input()) ans = 0 for i in range(1, n+1): occ = (n/i); val = int((occ * (occ+1))/2); ans += val*i; print(ans)
p02835
s375374025
Accepted
arr=list(map(int,input().split())) if sum(arr)>=22: print('bust') else: print('win')
p02801
s012060658
Wrong Answer
n=(input()) print(chr(ord(n)+1)) print(n,"is followed by",(chr(ord(n)+1)))
p02792
s913773905
Wrong Answer
N = int(input()) c = [[0]*10 for i in range(10)] for i in range(1,N+1): a = N % 10 b = 0 while N > 0: b = N N = N // 10 c[a][b] += 1 ans = 0 for i in range(10): for j in range(10): ans += c[i][j]*c[j][i] print(ans)
p03035
s192593360
Wrong Answer
a,b=map(int,input().split()) if a>=13: print(b) elif 12<=a<=6: print(b//2) else: print(0)
p02793
s851862353
Accepted
import fractions N = int(input()) A = list(map(int, input().split())) ans = 0 MOD = 10**9 + 7 LCM = A[0] for i in range(1, N): LCM *= A[i]//fractions.gcd(LCM, A[i]) for a in A: ans += LCM//a print(ans%MOD)
p02691
s042397528
Accepted
from collections import Counter n = int(input().strip()) L = list(map(int, input().strip().split())) seen=Counter() ans=0 for j in range(n): ans+=seen[j-L[j]] seen[L[j]+j]+=1 print(ans)
p03293
s642864244
Accepted
s=input() t=input() ans=False for i in range(len(s)): s=s[-1]+s[:-1] if s==t: ans=True break if ans==True: print("Yes") else: print("No")
p03943
s880785767
Wrong Answer
x = list(input().split()) x.sort() if int(x[0]) + int(x[1]) == int(x[2]): print('YES') else: print('FALSE') print(x)
p03380
s802618145
Wrong Answer
n = int(input()) lst = list(map(int, input().split())) m = max(lst) r = m//2 k = float('inf') for i in range(n): if abs(r-lst[i]) < abs(r-k): k = lst[i] print(m, k)
p02791
s465183139
Accepted
n = int(input()) p = list(map(int, input().split())) s = 1 t = p[0] for i in range(1,n): if p[i] <= t: s += 1 t = p[i] print(s)
p02823
s273807156
Wrong Answer
N,A,B=input().split() if (int(B)-int(A))%2==1: print(A) else: print((int(B)-int(A))//2)
p02628
s651917852
Accepted
def main(): n, k = map(int, input().split()) p = list(map(int, input().split())) p.sort() ans = 0 for i in range(k): ans += p[i] print(ans) if __name__ == '__main__': main()
p02899
s054967926
Wrong Answer
n=int(input()) a=list(input().split()) student=[] ans=[] for i in range(n): tmp=[] tmp.append(a[i]) tmp.append(i+1) student.append(tmp) student.sort(key=lambda x:x[0]) for i in range(n): ans.append(str(student[i][1])) print(' '.join(ans))
p03486
s308284719
Accepted
s=input() t=input() ss = sorted(s) tt = sorted(t,reverse=True) if ss < tt: print('Yes') else: print('No')
p03339
s049787679
Accepted
def main(): n = int(input()) s = input() wnum = s.count("W") enum = s.count('E') first = enum ans = first for i in range(n): if s[i] == "E": first -= 1 if i >= 1: if s[i-1] == "W": first += 1 if ans > first: ans = first #print(i, ans, first) print(ans) if __name__ == "__main__": main()
p03944
s006496151
Accepted
W, H, N = map(int, input().split()) XYA = [list(map(int, input().split())) for _ in range(N)] x1, x2, y1, y2 = 0, W, 0, H for xya in XYA: a = xya[2] if a == 1: x1 = max(x1, xya[0]) if a == 2: x2 = min(x2, xya[0]) if a == 3: y1 = max(y1, xya[1]) if a == 4: y2 = min(y2, xya[1]) w = max(0, x2-x1) h = max(0, y2-y1) print(w*h)
p03796
s583900791
Accepted
N=int(input()) power=1 for i in range(1,N+1): power=power*i power=power%(10**9+7) print(power)
p03417
s282131186
Accepted
N,M = map(int,input().split()) if N == 1 and M == 1: ans = 1 elif N == 1 or M == 1: ans = N * M - 2 elif N == 2 or M == 2: ans = 0 else: ans = (N - 2) * (M - 2) print(ans)
p03997
s463102110
Accepted
a = int(input()) b = int(input()) h = int(input()) z =int((a + b)*h/2) print(z)
p03555
s456231318
Wrong Answer
c1 = input() c2 = input() if c1 == c2[-1:] and c2 == c1[-1:]: print("YES") else: print("NO")
p02988
s087004969
Accepted
N = int(input()) Ps = list(map(int,input().split())) cnt = 0 for i in range(1,N-1): if Ps[i-1] < Ps[i]<Ps[i+1] or Ps[i+1] < Ps[i]<Ps[i-1]: cnt+=1 print(cnt)
p02744
s665564966
Wrong Answer
import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) C=[1]*n Ans=[C] cur=n-1 while cur: cur=0 for i in range(n-1): if C[i+1]<i+2: cur=i+1 D=[] for i in range(n): if i<cur: D.append(C[i]) elif i==cur: D.append(C[i]+1) else: D.append(1) if cur!=0: Ans.append(D) C=Ans[-1] for a in Ans: ans="" for i in range(n): ans+=chr(a[i]+96) print(ans)
p02829
s327555955
Wrong Answer
a = int(input()) b = int(input()) if (a==1) and (b==2): print(3) if (a==1) and (b==3): print(2) if (a==2) and (b==3): print(1)
p02702
s283350587
Accepted
mod=2019 a=input() N=len(a) t=[0]*mod t[0]=1 w=1 u=0 for i in range(N): u=int(a[N-1-i]) * w + u v=u % mod t[v] += 1 w *=10 w %= mod ans=0 for i in t: ans += (i-1)*i//2 print(ans)
p03705
s246310745
Accepted
#import sys #import numpy as np import math #from fractions import Fraction import itertools from collections import deque from collections import Counter import heapq from fractions import gcd #input=sys.stdin.readline #import bisect n,a,b=map(int,input().split()) ans=(b*(n-1)+a-a*(n-1)-b)+1 if ans<0: print(0) exit() print(ans)
p02924
s664268200
Accepted
n = int(input()) print(n * (n + 1) // 2 - n)
p02959
s286381215
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] <= b[i]: if a[i+1] >= b[i] - a[i]: ans += b[i] a[i+1] -= b[i] - a[i] a[i] = 0 else: ans += a[i] + a[i+1] a[i+1] = 0 a[i] = 0 else: ans = b[i] a[i] -= b[i] print(ans)
p04044
s689822984
Wrong Answer
N,L =input().split() listA=[] for i in range(int(N)): listA.append(input()) print(sorted(listA))
p02601
s265244509
Accepted
a,b,c = list(map(int, input().split())) k = int(input()) c1=0 while(1): if a<b: break else: c1+=1 b=b*2 c2=0 while(1): if b<c: break else: c2+=1 c=c*2 if c1+c2<=k: print("Yes") else: print("No")
p03971
s685296704
Accepted
N, A, B = map(int, input().split()) S = input() num_win = 0 num_win_f = 0 num_next = A + B for s in S: if s == "a" and num_win < num_next: print("Yes") num_win += 1 elif s == "b" and num_win < num_next and num_win_f < B: print("Yes") num_win += 1 num_win_f += 1 else: print("No")
p02693
s323306661
Wrong Answer
k = int(input()) a, b = map(int, input().split()) ans = 0 if a == b: if a%k == 0: print("OK") else: print("NG") else: for i in range(a,b): if i%k == 0: ans += 1 else: ans += 0 if ans >= 1: print("OK") else: print("NG")
p02717
s089235735
Accepted
B,C,A=map(int, input().split()) print(A,B,C)
p02597
s411843343
Accepted
n = int(input()) C = list(input()) l = 0 r = n-1 ans = 0 while l < r: while C[l] == 'R' and l<r: l += 1 while C[r] == 'W' and l<r: r -= 1 if C[l]=='W' and C[r] == 'R': ans += 1 l += 1 r -= 1 print(ans)
p03274
s099635329
Wrong Answer
N,K = list(map(int,input().split())) X = list(map(int,input().split())) Xrev = X[::-1] ans = abs(X[0]-X[-1]) for i in range(N-K+1): Xdis = abs(X[i])+abs(X[i+K-1]-X[i]) ans = min(ans,Xdis) for i in range(N-K+1): Xdis = abs(Xrev[i])+abs(Xrev[i+K-1]-Xrev[i]) ans = min(ans,Xdis) print(ans)
p03328
s724530668
Accepted
a,b = map(int,input().split()) t = b-a print(t*(t+1)//2-b)
p02647
s516954118
Wrong Answer
n,k,*l=map(int,open(0).read().split()) for _ in range(min(k,20)): s=[0]*(n+1) for i in range(n): s[max(i-l[i],0)]+=1 s[min(i+l[i]+1,n)]-=1 l[0]=min(s[0],n) for i in range(1,n): l[i]=min(l[i-1]+s[i],n) print(*l)
p04043
s989986943
Wrong Answer
A = list(map(int, input().split())) A.sort() print(A) if A == [5,5,7]: print("YES") else: print("NO")
p02613
s983429924
Wrong Answer
n = int(input()) s = [0]*n for i in range(n): s[i] = input() ac = s.count('AC') wa = s.count('WA') tle = s.count('TLE') re = s.count('RE') print('AC x',ac) print('WA x',wa) print('TLE x',tle) print('Re x',re)
p02664
s283813691
Accepted
T = input() for c in T: if c == '?': print('D', end='') else: print(c, end='') print()
p03327
s949011114
Accepted
# A - ABD N = int(input()) if 1 <= N < 1000: print('ABC') elif 1000<= N < 1999: print('ABD') elif N <= 0 or 1999 <= N: print('Out of range')
p03434
s713078610
Accepted
N = input() x = list(map(int, input().split())) x.sort(reverse=True) alice = 0 bob = 0 for i, j in enumerate(x): if i % 2 ==0: alice += j else: bob += j print(alice - bob)
p02748
s401866015
Accepted
a,b,m=map(int,input().split()) ali=list(map(int,input().split())) bli=list(map(int,input().split())) an=min(ali)+min(bli) for i in range(m): x,y,c=map(int,input().split()) if an>((ali[x-1]+bli[y-1])-c): an=((ali[x-1]+bli[y-1])-c) print(an)
p02687
s229479243
Accepted
S = input() if S == "ABC": print("ARC") else: print("ABC")
p04012
s638479842
Wrong Answer
w=input() l='thequickbrownfoxjumpsoverthelazydog' a=0 if len(w)%2!=0: print('No') else: for i in range(len(l)): if w.count(l[i])%2!=0: print('No') a+=1 break else: continue if a==0: print('Yes')
p02910
s146145044
Accepted
def tapdance(s): for i in range(len(s)): if i % 2 == 0: if s[i] != 'R' and s[i] != 'U' and s[i] != 'D': return 'No' else: if s[i] != 'L' and s[i] != 'U' and s[i] != 'D': return 'No' return 'Yes' s = input() print(tapdance(s))
p02835
s238942477
Accepted
a = list(map(int, input().split())) a_sum = sum(a) if a_sum >= 22: print('bust') else: print('win')
p03814
s097331108
Accepted
s = input() for a in range(len(s)): if s[a]=='A': break s = s[::-1] for z in range(len(s)): if s[z] =='Z': break print(len(s)-z-a)
p02602
s870033141
Accepted
import sys input=sys.stdin.readline n,k=map(int,input().split()) a=list(map(int,input().split())) for i in range(k,n): if a[i]>a[i-k]: print('Yes') else: print('No')
p02688
s569962775
Accepted
n, k=map(int, input().split()) a = [] for i in range(k): int(input()) x = list(map(int, input().split())) b = a + x a = list(set(b)) print(n - len(a))
p02832
s350202486
Accepted
N = int(input()) a = list(map(int,input().split())) aset = set(a) if 1 not in aset: print(-1) else: nex = 1 counter = 0 for i in range(N): if a[i] == nex: nex += 1 else: counter += 1 print(counter)
p03679
s394475544
Accepted
def main(): x, a, b = map(int, input().split()) if b <= a: print("delicious") elif a < b and b <= a + x: print("safe") elif a + x < b: print("dangerous") main()
p03371
s160641250
Wrong Answer
def solve(a,b,c,x,y): k_max = min(x,y) l = [] for i in range(k_max): s = a*(x-i)+b*(y-i)+c*i*2 l.append(s) return min(l) A,B,C,X,Y = map(int,input().split()) print(solve(A,B,C,X,Y))
p03162
s322541470
Accepted
n=int(input()) h=[list(map(int,input().split())) for i in range(n)] dp=[[0 for i in range(3)]for j in range(n+1)] for i in range(1,n+1): for j in range(3): for k in range(3): if j == k: continue dp[i][j] = max(dp[i][j],dp[i-1][k]+h[i-1][j]) print(max(dp[n]))
p02727
s310625720
Accepted
import heapq x, y, a, b, c = map(int, input().split()) def max_listup(limit): l = list(map(lambda x:int(x)*-1, input().split())) heapq.heapify(l) cnt = 1 res = [] while l: if cnt > limit: break m = heapq.heappop(l) res.append(m*-1) cnt += 1 return res if __name__ == "__main__": all = sorted(max_listup(x) + max_listup(y) + list(map(int, input().split()))) ans = 0 for _ in range(x+y): ans += all.pop() print(ans)
p02790
s231792158
Wrong Answer
#problem-b a,b = map(int, input().split()) print(str(a)*b if a>=b else str(b)*a)
p02797
s220746884
Accepted
N, K, S = map(int, input().split()) ans = [S] * K if S == 10**9: for _ in range(N-K): ans.append(1) else: for _ in range(N-K): ans.append(S+1) print(*ans)
p02660
s641120365
Wrong Answer
n = int(input()) if n==1: print(0) else: cnt = 0 flg = 0 for i in range(10000001): if n<i: break if i==0 or i==1 or n%i!=0: continue j = i while(n%j==0): if flg==0: flg = 1 n /= j j *= i cnt += 1 if flg==0: print(1) else: print(cnt)
p03239
s704428455
Accepted
n,t = map(int,input().split()) ans = 10**9 l = [] for i in range(n): l.append(list(map(int,input().split()))) for i in range(n): if l[i][1] <= t: ans = min(l[i][0],ans) if ans == 10**9: print("TLE") else: print(ans)
p02817
s958222607
Accepted
S,T = input().split() print(T+S)
p02948
s453658631
Accepted
from sys import stdin from heapq import heapify, heappop, heappush from bisect import bisect_right N, M = map(int, stdin.readline().split()) AB = [None]*N for i in range(N): AB[i] = list(map(int, stdin.readline().split())) AB.sort() salary = 0 hq = [] j = 0 for i in range(1, M+1): while j < N and AB[j][0] == i: heappush(hq, -AB[j][1]) j += 1 if hq: salary -= heappop(hq) print(salary)
p03994
s549297029
Accepted
S = input() K = int(input()) V = [] for e in S: V.append(ord(e)-97) for i in range(len(S)): if S[i] == 'a': continue if K < 26-V[i]: pass else: K -= 26-V[i] V[i] = 0 V[-1] += K V[-1] %= 26 V = [chr(e+97) for e in V] print("".join(V))
p03632
s051428432
Accepted
#!/usr/bin/env python3 a, b, c, d = map(int, input().split()) arr = [0] * 101 for i in range(a, b + 1): arr[i] += 1 for j in range(c, d + 1): arr[j] += 1 ans = len([cnt for cnt in arr if cnt >= 2]) print(ans - 1 if ans != 0 else 0)
p02820
s747310719
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) scoredict = {'r':P, 's':R, 'p':S} T = input() score = 0 for i in range(K): score += scoredict[T[i]] last = T[i] while True: i += K if i >= N: break if T[i] == last: last = None continue else: score += scoredict[T[i]] last = T[i] print(score)
p03042
s220766232
Accepted
s = int(input()) a = s // 100 b = s % 100 if 1 <= a <= 12 and 1 <= b <= 12: print("AMBIGUOUS") elif 1 <= a <= 12: print("MMYY") elif 1 <= b <= 12: print("YYMM") else: print("NA")
p03835
s924567277
Accepted
k,s=map(int,input().split()) count=0 for x in range(k+1): for y in range(k+1): if x+y>=s-k and x+y<=s: count +=1 print(count)
p03456
s471366470
Wrong Answer
N,K = map(str,input().split()) #N = int(input()) #A = list(map(int,input().split())) c=int(N+K) for i in range(1,350): if c//i == i: print('Yes') exit() print('No')
p03061
s777120528
Accepted
from math import gcd def main(): N = int(input()) A = list(map(int, input().split())) R = [0] * (N+1) L = [0] * (N+1) for i in range(N): L[i+1] = gcd(L[i], A[i]) for i in range(N-1,-1,-1): R[i] = gcd(R[i+1], A[i]) ans = 0 for i in range(N): ans = max(ans, gcd(L[i],R[i+1])) print(ans) if __name__ == "__main__": main()