problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03544
s386599921
Accepted
N=int(input()) num=[2,1] for i in range(2,87): num.append(num[-1]+num[-2]) print(num[N])
p02618
s990566394
Accepted
import sys #sys.setrecursionlimit(10**6) input=sys.stdin.readline from random import randint d=int(input().rstrip()) c=[int(i)for i in input().split()] s=[[int(i)for i in input().split()]for _ in range(d)] last=[0]*26 for i in range(d): print(randint(1,26))
p03456
s796385430
Accepted
import math a, b = input().split() num = int(a + b) li = [] for i in range(1000): li.append(i ** 2) if (num in li): print('Yes') else: print('No')
p03239
s167081248
Accepted
n, T = map(int, input().split()) index = -1 min_c = 9999 for i in range(n): c, t = map(int, input().split()) # print(f'{c} {t}') if t <= T and min_c > c: index = i + 1 min_c = c # print(min_c) if index == -1: print('TLE') else: print(min_c)
p02717
s401720175
Accepted
C = list(map(int, input().split())) a = C[0] b = C[1] c = C[2] print(str(c) + " " + str(a) + " " + str(b))
p03494
s083489266
Wrong Answer
n = int(input()) a = list(map(int, input().split())) cnt = 0 flag = True while flag == True: for i in range(n): if a[i]%2: flag = False cnt -= 1 a[i] = a[i]//2 cnt += 1 print(cnt)
p03862
s438263442
Accepted
N, x = map(int,input().split()) a = list(map(int,input().split())) ans = 0 if a[0] > x: ans += a[1] a[1] = 0 ans += (a[0] - x) a[0] = x elif (a[0] + a[1]) > x: ans += (a[0] + a[1] - x) a[1] = x - a[0] for i in range(2,N): if (a[i - 1] + a[i]) > x: ans += (a[i - 1] + a[i] - x) a[i] = x - a[i - 1] print(ans)
p02785
s973011471
Accepted
N, K = map(int, input().split()) hhh = list(map(int, input().split())) hhh.sort() print(sum(hhh[:-K]) if K > 0 else sum(hhh))
p03345
s102562304
Accepted
a, b, c, k = map(int, input().split()) print(a - b if k % 2 == 0 else b - a)
p02623
s116591875
Accepted
import bisect def LI(): return list(map(int,input().split())) N,M,K = map(int,input().split()) A = LI() B = LI() cumA = [0] for a in A: cumA.append(cumA[-1]+a) cumB = [0] for b in B: cumB.append(cumB[-1]+b) res = 0 for i in range(N+1): cuma = cumA[i] if cuma > K: continue rem = K-cuma deskb = bisect.bisect_right(cumB, rem)-1 res = max(res, i+deskb) print(res)
p03241
s768950236
Accepted
n, m = map(int,input().split()) if m//n == m/n: print(m//n) else: ans = 1 for i in range(2,min(m,10**8+1)): if m-i*(n-1) < i: break if m%i == 0:#from (M-i*(N-1))%i==0 ans = i print(ans)
p03062
s556524196
Wrong Answer
n = int(input()) a = list(map(int, input().split())) for i in range(n-1): #if a[i] < 0 and abs(a[i]) > abs(a[i+1]): # a[i] *= -1 # a[i+1] *= -1 if a[i] < 0: a[i] *= -1 a[i+1] *= -1 #if abs(a[-1]) > abs(a[-2]): # a[-1] *= -1 # a[-2] *= -1 print(sum(a))
p03804
s398003947
Wrong Answer
n,m=map(int,input().split()) a=[input() for i in range(n)] b=[input() for i in range(m)] #print(a,b) ans=0 cnt=0 for i in range(n-m+1): for j in range(n-m+1): cnt=0 for k in range(m): if b[k]!=a[i+k][j:j+m]: break cnt+=1 #print(a[i+k][j:j+m],b[k],a[i+k][j:j+m]==b[k]) if cnt==m: ans+=1 if ans>0: break if ans>0: break print("Yes" if ans>0 else "No",ans)
p03416
s161802664
Accepted
a,b = map(int,input().split()) ans=0 for i in range(a,b+1): if i==int(str(i)[::-1]): ans+=1 print(ans)
p02584
s368429407
Wrong Answer
x,k,d= map(int,input().split()) import sys z = abs(x) // d if z <= k: y = abs(x) - d * z else: y = abs(x) - d * k if x == d: if k % 2 == 0: y = x else: y = 0 print(y)
p03994
s398241672
Accepted
S = input() K = int(input()) N = len(S) A = [0]*N ans = "" for i in range(N): A[i] = (ord("z") - ord(S[i]) + 1) % 26 if i != N-1: if K >= A[i]: K -= A[i] ans += "a" else: ans += S[i] else: K = K % 26 s = ord(S[i]) + K if s > ord("z"): s -= 26 ans += chr(s) print(ans)
p02811
s679143149
Accepted
k,x = map(int,input().split()) if k*500>=x: print("Yes") else: print("No")
p03449
s707481160
Accepted
n = int(input()) A1 = list(map(int, input().split())) A2 = list(map(int, input().split())) ans = 0 for i in range(n): tmp = sum(A1[:i+1]) tmp += sum(A2[i:]) ans = max(ans, tmp) print(ans)
p03419
s828978935
Wrong Answer
N, M = map(int,input().split()) if N == 1: if M == 1: print(1) else: print(M-2) else: print((N-2)*(M-2))
p03252
s974694350
Accepted
S = input() T = input() s = sorted(map(S.count, set(S))) t = sorted(map(T.count, set(T))) print("Yes" if(s == t) else "No")
p02755
s473144399
Accepted
A,B=map(int,input().split()) for x in range(B*20): if int(0.08*x)==A and int(0.1*x)==B: print(x) break if x==B*20-1: print(-1)
p03219
s116073083
Wrong Answer
X,Y=map(int,input().split()) print(X+Y/2)
p02818
s191503351
Accepted
a,b,k = map(int,input().split()) if a+b <= k: print(0,0) elif a < k: print(0,a+b-k) else: print(a-k,b)
p02817
s586117321
Wrong Answer
a,b=input().split() print(a+b)
p02879
s196130143
Wrong Answer
a,b=map(int, input().split()) if (9-a)*(9-b)*(a-1)*(b-1)<0: print(-1) else: print(a*b)
p03711
s901991515
Accepted
d = [-1, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1] x, y = tuple(map(int, input().split())) if d[x] == d[y]: print('Yes') else: print('No')
p03827
s708620575
Accepted
N = int(input()) S = input() ans = 0 tmp = 0 for i in S: if i == 'I': tmp += 1 else: tmp -= 1 ans = max(ans, tmp) print(ans)
p03239
s560587740
Accepted
def p_b(): N, T = map(int, input().split()) ans = 10 ** 9 for _ in range(N): c, t = map(int, input().split()) if t <= T: ans = min(ans, c) print(ans if ans != 10 ** 9 else "TLE") p_b()
p03289
s413398130
Wrong Answer
S = list(input()) C = S[2:-1] if S[0] == "A" and "C" in C and C.count("C") == 1: S.remove("A") S.remove("C") print(S) T="".join(S) print(T) Y=T.lower() if T == Y: print("AC") else: print("WA") else: print("WA")
p03548
s032661810
Accepted
a, b, c = map(int, input().split()) print((a-c)//(b+c))
p03211
s766045628
Accepted
s=input() ans=753 for i in range(0,len(s)-3+1): ans=min(abs(int(s[i:i+3])-753),ans) print(ans)
p04043
s531811700
Accepted
a = input('') if a.count('5') == 2 and a.count('7') ==1: print('YES') else: print('NO')
p02777
s802757096
Wrong Answer
S,T = map(str,input().split()) A,B = map(int,input().split()) U = input() if S == U: print(str(A-1) + '' + str(B)) else: print(str(A) + '' + str(B-1))
p02602
s836570564
Accepted
N,K = map(int, input().split()) A = list(map(int, input().split())) count = 0 for i in range(N - K): kake_A = A[i] kake_B = A[i + K] if kake_A >= kake_B: print('No') else: print('Yes')
p03815
s794292639
Accepted
x = int(input()) y = x // 11 z = x % 11 if z == 0: print(y * 2) elif z <= 6: print(y * 2 + 1) else: print(y * 2 + 2)
p03478
s168191787
Accepted
N, A, B = map(int, input().split()) cnt = 0 for i in range(1, N+1): sum = 0 num = i while num > 0: sum += num % 10 num //= 10 if A <= sum <= B: cnt += i print(cnt)
p03836
s219818915
Accepted
sx,sy,tx,ty = map(int,input().split()) x = tx - sx y = ty - sy print("U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")
p03469
s347410331
Accepted
s=input() print("2018"+s[4:])
p03254
s841180946
Wrong Answer
from itertools import accumulate from bisect import bisect_left def main(): children, cookies = map(int, input().split()) target = sorted(list(map(int, input().split()))) sum_target = sum(target) if sum_target < cookies: print(children - 1) elif cookies < target[0]: print(0) else: accumulate_target = list(accumulate(target)) print(bisect_left(accumulate_target, cookies) + 1) if __name__ == '__main__': main()
p03986
s514074837
Accepted
X = input() s_cnt = 0 ans = 0 for s in X: if s=='S': s_cnt += 1 else: if s_cnt > 0: ans += 1 s_cnt -= 1 print(len(X) - 2*ans)
p03449
s965592664
Wrong Answer
n = int(input()) a = [list(map(int,input().split())) for i in range(2)] ans = 0 for i in range(n): ans = max(ans , sum(a[0][0:i]) + sum(a[0][i:n-1])) print(ans)
p03434
s418933230
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=sorted(a) alice=sum(b[::2]) Bob=sum(b[1::2]) print(alice-Bob)
p02909
s630688639
Wrong Answer
s=input() a=['Sunny','Cloudy','Rainy'] for i in range(2): if s==a[i]: print(a[i+1])
p02727
s584015821
Accepted
import sys input = sys.stdin.readline x, y, a, b, c = map(int, input().split()) p = sorted(map(int, input().split()), reverse=True) q = sorted(map(int, input().split()), reverse=True) r = list(map(int, input().split())) C = p[:x] + q[:y] + r C.sort(reverse=True) print(sum(C[:x + y]))
p02583
s905262144
Accepted
from itertools import combinations _, l = input(), sorted(int(i) for i in input().split()) if len(l) < 3: print(0) else: ans = 0 for v in combinations(l, 3): if v[0] + v[1] > v[2] and len(set(v)) == 3: ans += 1 print(ans)
p03243
s132712548
Wrong Answer
n=int(input()) if 100<=n>=111: print(111) elif 112<=n>=222:print(222) elif 223<=n>=333:print(333) elif 334<=n>=444:print(444) elif 445<=n>=555:print(555) elif 556<=n>=666:print(666) elif 667<=n>=777:print(777) elif 778<=n>=888:print(888) else:print(999)
p02833
s201078145
Accepted
N = int(input()) def solve_function(N): if N % 2 == 1: return 0 it_can_be_divisible = 10 ans = 0 while True: if it_can_be_divisible > N: break ans += N//it_can_be_divisible it_can_be_divisible *= 5 return ans if solve_function(N): print(solve_function(N)) else: print(0)
p03339
s273075703
Wrong Answer
N = int(input()) S = str(input()) west = 0 for i in range(N): if S[i] == "W": west += 1 ans_list = [0] * N for i in range(N): if S[i] == "W": west -= 1 if i != 0: if S[i - 1] == "E": west += 1 #ans_list[i] = min(west, N - west) ans_list[i] = west #print(ans_list) print(min(ans_list))
p03160
s337058640
Accepted
def main(): N = int(input()) H = list(map(int, input().split())) dp = [float('inf')] * (N + 5) dp[0] = 0 for i in range(N): if i + 1 <= N - 1: dp[i+1] = min(dp[i+1], dp[i] + abs(H[i+1] - H[i])) if i + 2 <= N - 1: dp[i+2] = min(dp[i+2], dp[i] + abs(H[i+2] - H[i])) print(dp[N-1]) if __name__ == "__main__": main()
p03150
s305007728
Wrong Answer
s = input() if s == "keyence": print("YES") exit() for i in range(len(s)+1): for j in range(i,len(s)+1): if s[:i] + s[i + j:] == "keyence": print("YES") exit() print("NO")
p02641
s244359276
Accepted
x,N = list(map(int,input().split(" "))) if N != 0: p = list(map(int,input().split(" "))) sa = 0 ans = -100 else: ans = x while True: if ans != -100: break for i in range(N): if x-sa == p[i]: break if i == N-1: if x-sa != p[i]: ans = x-sa if ans != -100: break for i in range(N): if x+sa == p[i]: break if i == N-1: if x+sa != p[i]: ans = x+sa if ans != -100: break sa += 1 print(ans)
p02697
s816820668
Wrong Answer
n,m = map(int,input().split()) for i in range(m): print(i+1,n-i)
p03860
s357408175
Accepted
A, x, C = map(str, input().split()) print("A" + x[0] + "C")
p03163
s513143930
Accepted
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(input()) N, W = geta(int) cur = [0] * (W+1) for i in range(N): w, v = geta(int) update = cur[:] for j in range(w,W+1): tmp = cur[j-w] + v if tmp > cur[j]: update[j] = tmp cur = update print(cur[W])
p02939
s681044892
Accepted
s = input() now = '' pre = '' ans = 0 for i in s: now += i if pre != now: ans += 1 pre = now now = '' print(ans)
p02548
s587320476
Accepted
N=int(input()) result=0 for A in range(1,N): result+=int((N-1)/A) print(result)
p02784
s421190495
Accepted
H, N = input().split() A = list(input().split()) H = int(H) N = int(N) A = [int(a) for a in A] if H > sum(A): print('No') else: print('Yes')
p02732
s106660951
Wrong Answer
import sys def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) N = II() A = LI() def comb(k): if k == 1: return 1 else: return int(k*(k-1)/2) result = 0 kind = list(set(A)) for k in kind: result += comb(A.count(k)) for a in A: n = A.count(a) print(result-n+1)
p03351
s013299198
Accepted
n,m,k,j = list(map(int,input().split())) if (abs(m-n)<=j and abs(k-m)<=j) or abs(k-n)<=j: print("Yes") else: print("No")
p03795
s705996511
Accepted
def discount(x): return (x // 15) * 200 def cost(x): return x * 800 N = int(input()) Sum = cost(N) - discount(N) print(Sum)
p02993
s041645386
Accepted
S = input() D =[] for i in range(3): if S[i] == S[i+1]: D.append(1) break if 1 in D: print("Bad") else: print("Good")
p02720
s692738051
Accepted
from collections import deque k = int(input()) l = deque([i for i in range(1, 10)]) # print(l) for i in range(k): x = l.popleft() mod = x % 10 if mod != 0: l.append(x*10 + mod - 1) l.append(x*10 + mod) if mod != 9: l.append(x*10 + mod + 1) print(x)
p03545
s580739770
Accepted
s = input() n = len(s) def dfs(i, s_str, sum): if i == n - 1: if sum == 7: print(s_str + '=7') exit() else: dfs(i+1, s_str + '+' + s[i+1], sum + int(s[i+1])) dfs(i+1, s_str + '-' + s[i+1], sum - int(s[i+1])) dfs(0, s[0], int(s[0]))
p02838
s895044377
Accepted
n = int(input()) a = list(map(int, input().split())) mod = 10**9+7 ans = 0 p = 1 for i in range(60): s = sum(1 for b in a if b&p) ans += s*(n-s)*p ans %= mod p <<= 1 print(ans)
p03760
s794303179
Accepted
o = input() e = input() ans = "" for i in range(len(e)): ans += o[i] + e[i] if len(o) > len(e): ans += o[-1] print(ans)
p03103
s959755630
Wrong Answer
n,m=list(map(int,input().split())) d={} for _ in range(n): a, b = list(map(int, input().split())) d[a]=b sd=dict(sorted(d.items())) result=0 ans=0 for i in sd: result+=d[i] ans+=i*d[i] if result>m: ans-=i*(result-m) break print(ans)
p03657
s232668902
Accepted
A, B = map(int, input().split()) if 0 in [A%3, B%3, (A+B)%3]: print('Possible') else: print('Impossible')
p02594
s106070932
Accepted
x = int(input()) if(x>=30): print("Yes") else: print("No")
p03617
s667446916
Accepted
# https://atcoder.jp/contests/agc019/tasks/agc019_a q, h, s, d = map(int, input().split()) n = int(input()) ans = (n // 2) * min([q * 8, h * 4, s * 2, d]) + (n % 2) * min([q * 4, h * 2, s]) print(ans)
p03711
s655389535
Accepted
import sys input = sys.stdin.readline x,y= [int(i) for i in input().split()] a1 = [1,3,5,7,8,10,12] a2 = [4,6,9,11] a3 = [2] if x in a1 : if y in a1 : print("Yes") else : print("No") elif x in a2 : if y in a2 : print("Yes") else : print("No") elif x == 2 : if y == 2: print("Yes") else : print("No")
p03105
s302617785
Accepted
a,b,c=map(int,input().split()) print(b//a if b//a<c else c)
p02687
s562336255
Wrong Answer
s = input().rstrip() if s[2]=='B': s='ARC' print(s)
p02730
s121420185
Accepted
def IsPalindrome(S): l = len(S) for i in range(l >> 1): if S[i] != S[-(i + 1)]: return False return True S = input() m = len(S) >> 1 L, R = [""] * (m), [""] * (m) for i in range(m): L[i] = S[i] R[i] = S[i + m + 1] if not (IsPalindrome(L) and IsPalindrome(S) and IsPalindrome(R)): print("No") else: print("Yes")
p02866
s398333365
Wrong Answer
from collections import Counter MOD = 998244353 N = int(input()) D = list(map(int, input().split())) cnt_D = Counter(D) if D[0] != 0: print(0) else: prev = 1 ans = 1 for i in range(1, max(D) + 1): v = cnt_D.get(i, 0) ans *= pow(prev, v, MOD) ans %= MOD prev = v print(ans)
p03380
s269047042
Wrong Answer
import math n = int(input()) a = list(map(int,input().split())) a = sorted(a, reverse = True) mid = a[0]//2 diff = abs(mid - a[0]) if n == 2: print(max(a[0],a[1]),min(a[0],a[1])) else: for i in range(n): if abs(a[i] - mid) <= diff: diff = abs(a[i] - mid) ans = i print(a[0], a[ans])
p02708
s163667374
Wrong Answer
n,k = map(int,input().split()) p = 10 ** 9 + 7 ans = 0 max=0 min=0 a=[0]*(n+1) b=[0]*(n+2) for i in range(n+1): a[i]=i b[i+1]=a[i]+b[i] if n>k: for i in range(k,n+2): min=b[i] max=b[n+1]-b[n+1-i] ans=ans+max-min+1 else: ans=1 ans = ans % p print(ans)
p02678
s136069020
Wrong Answer
from collections import deque n, m = map(int, input().split()) graph = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) print(graph) ans = [-1] * (n - 1) used = [0]*n used[0] = 1 que = deque([0]) while que: posi = que.popleft() for p in graph[posi]: if not used[p]: que.append(p) ans[p-1] = posi+1 used[p] = 1 print('Yes') print(*ans, sep='\n')
p02707
s514976896
Accepted
Num = int(input()) bossNumsList = list(map(int, input().split())) bossNums=[] for i in range(Num): bossNums.append(0) for i in range(Num-1): bossNums[bossNumsList[i]-1] += 1 for i in range(Num): print(bossNums[i])
p02785
s050776958
Wrong Answer
n, k = [int(i) for i in input().split()] h = [int(j) for j in input().split()] h = sorted(h) del h[n-k:n] print(sum(h))
p04020
s219062501
Accepted
n=int(input()) A=[int(input()) for _ in range(n)]+[0] cnt=0 for i in range(n): cnt +=A[i]//2 if A[i+1]!=0: cnt +=A[i]%2 A[i+1] -=A[i]%2 print(cnt)
p03659
s279514094
Accepted
import numpy as np N = int(input()) a = list(map(int, input().split())) a = np.array(a) cum = np.cumsum(a)[:-1] rcum = np.cumsum(a[::-1])[:-1] ans = abs(cum - rcum[::-1]) print(np.min(ans))
p03427
s703112558
Accepted
n = list(str(input())) maxi = 0 #print(n) for i in range(len(n)): #print(int(n[i])-1, int(n[i])-1 + (len(n)-i-1)*9) maxi = max(maxi, int(n[i])-1 + (len(n)-i-1)*9) print(max(sum(map(int, n)), maxi))
p03416
s225229394
Wrong Answer
A,B = map(int,input().split()) ans = 0 for i in range(A,B+1): tmp = str(i) L = len(str(i)) l = L//2 if L%2 == 0: if tmp[:l] == tmp[l:]: ans += 1 else: if tmp[:l] == tmp[l+1:]: ans += 1 print(ans)
p03037
s531967047
Accepted
n,m = map(int, input().split()) ls = [] rs = [] for _ in range(m): l,r = map(int, input().split()) ls.append(l) rs.append(r) ls.sort() rs.sort() ans = rs[0] - ls[-1] + 1 ans = max(0,ans) print(ans)
p02814
s643815941
Accepted
import fractions def lcm(x, y): return x * y // fractions.gcd(x, y) N, M = [int(x) for x in input().split()] l = [int(x) // 2 for x in input().split()] ans = l[0] for i in reversed(range(30)): if ans % 2 ** i == 0: numof2 = 2 ** i break for i in range(1, N): if l[i] % numof2 == 0 and (l[i] // numof2) % 2 == 1: ans = lcm(ans, l[i]) else: ans = M + 1 break ans2 = M // ans print(ans2 // 2 + ans2 % 2)
p02660
s157399559
Accepted
N = int(input()) ans = 0 for i in range(2, 10**6+1): if N % i != 0: continue ans += 1 cnta = 0 cntb = 2 while N % i == 0: N //= i cnta += 1 if cnta > cntb: cnta -= cntb cntb += 1 ans += 1 if N == 1: break if N != 1: ans += 1 print(ans)
p03417
s753036258
Accepted
n,m = map(int,input().split()) print(abs((n-2)*(m-2)))
p02706
s449866377
Accepted
N,M=map(int,input().split()) A=list(map(int,input().split())) ans=N-sum(A) if ans<0: print(-1) else: print(ans)
p02725
s546712734
Accepted
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:05:17 2020 """ import sys #import numpy as np sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 #N = int(input()) K, N = map(int,input().split()) A = list(map(int,input().split())) #A.append() B = [] for i in range(N-1): B.append(A[i+1] - A[i]) B.append(A[0] + (K - A[-1])) ans = K - max(B) print(ans)
p03721
s313116167
Accepted
n, k = map(int, input().split()) nums = [list(map(int, input().split())) for _ in range(n)] nums.sort(key=lambda x: x[0]) cnt = 0 for a, b in nums: cnt += b if cnt >= k: print(a) break
p03475
s727567125
Accepted
from sys import stdin input=stdin.readline def main(): n=int(input()) l=tuple(tuple(map(int,input().split())) for i in range(n-1)) for i in range(n): now=0 for a,s,d in l[i:]: if now<=s:now=s+a else:now=(now+d-1)//d*d+a print(now) if __name__=="__main__": main()
p02584
s524827739
Accepted
import math x,k,d=map(int,input().split()) count=int(math.sqrt(x*x)/d) if k<=count: count=k k=2 else: k=k-count ans=int(math.sqrt(x*x)-d*count) if k%2==1: ans=math.sqrt((d-ans)**2) print(int(ans))
p03544
s610771348
Accepted
N = int(input()) L = [2, 1] for i in range(1, N): L += [L[-1] + L[-2]] print(L[N])
p03673
s810989362
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(readline()) a = list(map(int, readline().split())) odd = a[0::2] even = a[1::2] if n % 2 == 0: res = even[::-1] + odd print(*res) else: res = odd[::-1] + even print(*res) if __name__ == '__main__': main()
p02688
s859384299
Wrong Answer
N, K = map(int, input().split()) tmp = set() for i in range(K): input() tmp |= set(input()) print(N - len(tmp) + 1)
p03261
s526380378
Accepted
n = int(input()) w = [input() for i in range(n)] if len(w) != len(set(w)): print("No") exit() h, b = [], [] for i in range(n): if i != 0: h.append(w[i][0]) if i != n-1: b.append(w[i][-1]) for i, j in zip(h, b): if i != j: print("No") exit() print("Yes")
p03210
s240120076
Accepted
n = int(input()) if n==3 or n==5 or n==7: print("YES") else: print("NO")
p02879
s193280308
Accepted
a,b=map(int,input().split()) if a >= 10 or b>=10: print(-1) else: print(a*b)
p02987
s870360591
Accepted
S = sorted(list(input())) if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]: print('Yes') else: print('No')
p02861
s072019721
Wrong Answer
n = int(input()) l, l1, l2 = list(""), list(""), list("") for i in range(n): x, y = map(int, input().split()) l1.append(x) l2.append(y) for i in range(n - 1): for j in range(i + 1, n): l.append(((l1[i] -l1[j]) ** 2 + (l2[i] - l2[j]) ** 2) ** 0.5) print('{:.10f}'.format(2 * sum(l) / len(l)))