problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02880
s442939776
Accepted
N=int(input()) for a in range(1,10): for b in range(1,10): if a*b==N: print('Yes') exit() print('No')
p02695
s947754354
Accepted
import itertools N, M, Q = list(map(int,input().split())) numbers = [i for i in range(1, M+1)] array = itertools.combinations_with_replacement(numbers, N) input_data = [list(map(int,input().split())) for _ in range(Q)] max_score = 0 for A in array: score = 0 for _ in range(Q): a, b, c, d = input_data[_] a = a - 1 b = b - 1 if A[b] - A[a] == c: score += d if score > max_score: max_score = score print(max_score)
p02546
s464968786
Wrong Answer
import sys input = sys.stdin.readline().strip() last_alpha = input[-1] if last_alpha == 's': print(input[0:-1] + 'es') else: print(input + 's')
p03243
s008852290
Accepted
n = int(input()) for i in range(n, 1000): s = str(i) if s[0] == s[1] and s[1] == s[2]: print(i) break
p03524
s884905333
Wrong Answer
s = list(input()) a = b = c = 0 for i in s: if i == "a": a += 1 elif i == "b": b += 1 else: c += 1 if a*b*c == 0 and a+b+c !=2: print("NO") elif max(a,b,c)-min(a,b,c) >= 2: print("NO") else: print("YES")
p02744
s453194696
Accepted
import itertools import sys n = int(input()) S = [0]*n while True: print("".join(map(lambda x:chr(ord('a')+x),S))) for i in range(n-1,0,-1): if(i>0 and max(S[:i])>=S[i]): S[i] += 1 for j in range(i+1,n): S[j] = 0 break else: break
p03695
s320845972
Accepted
n = int(input()) a = list(map(int, input().split())) list_over_3200 = [] list_under_3200 = [] for num in a: if num < 3200: list_under_3200.append(num // 400) else: # 3200以上の人を別のリストにいれる。 list_over_3200.append(num) maxAns = len(set(list_under_3200)) + len(list_over_3200) if len(set(list_under_3200)) == 0: minAns = 1 else: minAns = len(set(list_under_3200)) print(minAns, maxAns)
p03672
s146573214
Wrong Answer
s=input() while True: s=s.replace(s[-1],'') if len(s)%2==0: if s[:len(s)//2]==s[len(s)//2:]: print(len(s)) break
p02629
s540629906
Accepted
n = int(input()) a = "abcdefghijklmnopqrstuvwxyz" s = "" while n > 0: if n%26 == 0: s = a[n%26-1] + s n //= 26 n -= 1 else: s = a[n%26-1] + s n //= 26 print(s)
p02775
s555323790
Wrong Answer
N=input() a=[] s=len(N) for i in range(s-1,-1,-1): a.append(int(N[i])) a.append(0) #print(a) p=sum(a) t=0 f=0 c=0 for i in range(len(a)-1): if a[i] <= 5: t+=a[i] if a[i] == 5 and a[i+1]>=5:a[i+1]+=1 f=0 else: c+=10-a[i] a[i+1] += 1 f=1 print(t+f+c)
p03338
s032721257
Accepted
def count(a,b): c = 0 for i in set(a): if i in b: c += 1 return c n = int(input()) s = input() lmax = 0 i = n-1 while i>=0: left = s[:i] right = s[i:] c = count(left,right) lmax = max(lmax,c) i-=1 print(lmax)
p03352
s886354821
Accepted
x = int(input()) ans = [1] for i in range(2, 100): n = 2 while i**n <= x: ans.append(i**n) n += 1 print(max(ans))
p02613
s203289062
Wrong Answer
N = int(input()) S = [] count_AC = 0 count_WA = 0 count_TLE = 0 count_RE = 0 for _ in range(N): S.append(input()) for i in S: if i == "AC": count_AC += 1 elif i == "WA": count_WA += 1 elif i == "TLE": count_TLE += 1 elif i == "RE": count_RE += 1 else: pass a = "AC" + "x" + str(count_AC) b = "WA" + "x" + str(count_WA) c = "TLE" + "x" + str(count_TLE) d = "RE" + "x" + str(count_RE) print(a, b, c, d, sep="\n")
p02814
s333990542
Accepted
from fractions import gcd def lcm(a,b): return a*b//gcd(a,b) N,M = map(int,input().split()) A = [int(i) for i in input().split()] a = 0 b = A[0] while b % 2 == 0: a += 1 b = b//2 for i in range(1,N): if A[i] % (2**a) != 0 or A[i] % (2**(a+1)) == 0: print(0) exit() c = A[0] for i in range(N-1): c = lcm(c,A[i+1]) print((M+c//2)//c)
p02862
s079340441
Accepted
x,y=map(int,input().split()) if (2*y-x)%3==0 and(2*x-y)%3==0 and (2*y-x)>=0 and (2*x-y)>=0: a=(2*y-x)//3 b=(2*x-y)//3 numerator=1 denominator=1 for i in range(a): numerator=(numerator*(a+b-i))%(10**9+7) denominator=(denominator*(a-i))%(10**9+7) print((numerator*pow(denominator,10**9+5,10**9+7))%(10**9+7)) else: print(0)
p03672
s383549654
Wrong Answer
s=list(input()) from copy import copy t=s.copy() for i in range(len(t)): if len(s)%2==0 and s[:len(s)%2]==s[len(s)%2:]: print(len(s)%2) exit() else: s.pop(-1)
p03785
s402006553
Accepted
import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda x: [ni() for _ in range(x)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda x: [na() for _ in range(x)] ns = lambda: stdin.readline().rstrip() nsn = lambda x: [ns() for _ in range(x)] nas = lambda: stdin.readline().split() from math import ceil n, c, k = na() T = nin(n) T.sort() ans = 0 i = 0 while i < n: m = T[i] + k cnt = 0 while i < n and T[i] <= m and cnt < c: i += 1 cnt += 1 ans += 1 print(ans)
p03087
s741594688
Wrong Answer
n,q = map(int,input().split()) S = input() a = [0 for i in range(n)] count = 0 for i in range(1,n): if S[i] == 'C' and S[i-1] == 'A': count += 1 a[i] = count for i in range(q): l,r = map(int,input().split()) print(a[r-1]-a[l-1]) print(a)
p03433
s259362532
Wrong Answer
N = int(input()) A = int(input()) B = N - N//500 if B <= A: print("Yes") else: print("No")
p02601
s576041473
Wrong Answer
A,B,C=list(map(int,input().split())) K=int(input()) for i in range(K): if A>=B: B=2*B elif B>=C: C=2*C else: print('Yes') break if A<B and B<C: print('Yes') else: print('No')
p03408
s976963090
Accepted
import collections N = int(input()) s = [input() for i in range(N)] M = int(input()) t = [input() for j in range(M)] S = collections.Counter(s) T = collections.Counter(t) S.most_common() T.most_common() ans = S - T try: print(ans.most_common()[0][1]) except: print('0')
p02729
s498351449
Accepted
n,m=map(int,input().split()) print((n*(n-1))//2 + (m*(m-1))//2)
p02766
s427935572
Wrong Answer
n,k=map(int,input().split()) l=[] if k<=9 : while True: a=n%k n//=k if n>=k: l.append(a) if n<k : l.append(n) break print(len(l)) else: print(len(str(n)))
p03285
s677826769
Accepted
N = int(input()) for i in range(14): for j in range(25): if 7*i + 4*j == N: print("Yes") exit() print("No")
p03086
s768288387
Wrong Answer
max_len = 0 tmp = 0 S = input() atcg = ['A', 'T', 'C', 'G'] for i in range(len(S)): if S[i] in atcg: tmp += 1 else: max_len = max(max_len, tmp) tmp = 0 print(max_len)
p02970
s093448720
Accepted
import math N,D = map(int,input().split()) print(math.ceil(N/(2*D+1)))
p02597
s163892165
Accepted
N = int(input()) C = input() r = C.count('R') w = C.count('W') if len(C) == r or len(C) == w or C[:r].count('R') == r: print(0) else: print(C[:r].count('W'))
p02606
s902192022
Accepted
L,R,d=input().split() L,R,d=int(L),int(R),int(d) cnt=0 for i in range(L,R+1): if i%d==0: cnt+=1 print(cnt)
p03556
s033097275
Accepted
N = int(input()) for i in range(1, 10**6): if i**2 > N: print((i-1)**2) exit()
p03103
s628143742
Wrong Answer
N, M = map(int, input().split()) d = {} for i in range(N): a, b = map(int, input().split()) d[a] = b d = sorted(d.items(), key=lambda x:x[0]) sum_ = 0 cnt = 0 for ab in d: if cnt + ab[1] > M: sum_ += ab[0] * (M-cnt) break else: cnt += ab[1] sum_ += ab[0]*ab[1] print(sum_)
p03759
s443589338
Accepted
a,b,c = map(int,input().split()) if (b-a == c-b): print("YES") else: print("NO")
p03001
s468658399
Accepted
W,H,x,y=map(int,input().split()) print(W*H/2,1 if x==W/2 and y==H/2 else 0)
p02602
s496131544
Wrong Answer
#C N, K = map(int, input().split()) A = list(map(int, input().split())) p=[] import numpy as np for i in range(N-K+1): ans=np.prod(A[i:i+K]) p.append(ans) for j in range(len(p)-1): if p[j]<p[j+1]: print('Yes') else: print('No')
p02862
s275323721
Accepted
x, y = map(int, input().split()) mod = 10**9+7 if (2*y-x < 0) or (2*x-y < 0): print(0) exit() if (2*y-x)%3 != 0 or (2*x-y)%3 != 0: print(0) exit() xc = (2*y-x)//3 yc = (2*x-y)//3 p = 1 k = 1 for i in range(1, xc+1): p *= (yc+i) k *= i p %= mod k %= mod ans = p*pow(k, mod-2, mod)%mod print(ans)
p02779
s974087305
Wrong Answer
from collections import Counter n = int(input()) c = Counter(list(map(int, input().split()))) if len(c) == n: print('Yes') else: print('No')
p03723
s701409070
Accepted
A, B, C = list(map(int, input().split())) if A == B == C and A % 2 == 0 and B % 2 == 0 and C % 2 == 0: print(-1) exit() ans = 0 while True: if A % 2 == 0 and B % 2 == 0 and C % 2 == 0: ans += 1 A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2 else: break print(ans)
p03860
s447529810
Wrong Answer
x="AtCoder"+input()+"Contest" print(x) print("A"+x[8]+"C")
p03146
s076148178
Wrong Answer
s=int(input()) def collatz(n): if n%2==0: n=n/2 else: n=3*n+1 return int(n) l=[s] while s!=1: s=collatz(s) l.append(s) if s==1: print(4) elif s==2: print(4) else: print(len(l)+1)
p02691
s947483590
Wrong Answer
n=int(input()) l=list(map(int,input().split(" "))) c=0 for i in range(n): for j in range(i+1,n): if l[j]>n-1-j: continue if l[i]+l[j]==j-i: c+=1 print(c)
p03730
s128797413
Wrong Answer
import sys A,B,C = map(int,input().split()) ln = 100//A+1 for i in range(1,ln+1): if (A*i+C)% B == 0: print('YES') sys.exit() print('NO')
p03041
s039964175
Accepted
def readinput(): n,k=map(int,input().split()) s=input() return n,k,s def main(n,k,s): ans=s[:k-1]+s[k-1].lower()+s[k:] return ans if __name__=='__main__': n,k,s=readinput() ans=main(n,k,s) print(ans)
p02970
s478354537
Accepted
n,d = map(int,input().split()) if n % (2*d+1) == 0: print(int(n/(2*d+1))) else: print(int(n/(2*d+1))+1)
p03416
s843766705
Wrong Answer
def main(): a, b = map(int, input().split()) ans = (b-a)//100 if int(str(a)[-2:]) <= int(str(a)[:2]) and int(str(b)[:2]) <= int(str(b)[-2:]): ans += 1 print(ans) if __name__ == "__main__": main()
p03360
s899994719
Wrong Answer
ABC = list(map(int, input().split())) K = int(input()) ABC[ABC.index(max(ABC))] *= 2 * K print(sum(ABC))
p03075
s241287076
Wrong Answer
import itertools aList = [] for i in range(5): aList.append(int(input())) k = int(input()) aiList = list(itertools.combinations(aList,2)) for j in aiList: if j[1] - j[0] >k: print(":(") exit(0) print("Yay")
p03456
s547423281
Wrong Answer
import math ina=input().split() i=int(ina[0]+ina[1]) if math.sqrt(i)**2 == i: print("Yes") else: print("No")
p02639
s491291696
Wrong Answer
X = map(int, input().split()) for i in X: if X == 0: print(i + 1)
p03339
s613614021
Wrong Answer
N = int(input()) S = str(input()) WtoE=0 EtoW=S[1:N+1].count('E') min_ans = WtoE + EtoW for i in range(1, N+1): print(i) if S[i-1] == 'W': WtoE += 1 if S[i-1] == 'E': EtoW -= 1 ans = WtoE + EtoW if min_ans > ans: min_ans = ans print(min_ans)
p03162
s854558560
Accepted
n = int(input()) a = [] for i in range(n): arr = list(map(int, input().split())) a.append(arr) INF = -10 ** 18 dp = [ [INF] * 3 for i in range(0, n+1)] dp[0] = [0] * 3 for i in range(0, n): for j in range(0, 3): for k in range(3): if (j == k): continue dp[i+1][k] = max(dp[i+1][k], dp[i][j] + a[i][k]) print(max(dp[-1]))
p02731
s389925285
Accepted
L=int(input()) print((L/3)**3)
p02583
s684547695
Accepted
n = int(input()) l = list(map(int, input().split())) ans = 0 for i in range(0, n): for j in range(i+1, n): for k in range(j+1, n): if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]: continue if l[i]+l[j] > l[k] and l[k]+l[j] > l[i] and l[k]+l[i] > l[j]: ans += 1 print(ans)
p03160
s360668392
Accepted
n = int(input()) h = list(map(int, input().split())) dp = [float('inf')]*n dp[0] = 0 for i in range(n): if i+1 < n: dp[i+1] = min(dp[i+1], abs(h[i] - h[i+1]) + dp[i]) if i+2 < n: dp[i+2] = min(dp[i+2], abs(h[i] - h[i+2]) + dp[i]) print(dp[-1])
p02793
s528129799
Wrong Answer
import math n = int(input()) a = list(map(int, input().split())) mod = 10**9 + 7 def lcm(a, b): return (a * b) // math.gcd(a, b) a_gcd = 1 a_seki = 1 for i in range(n): a_gcd = math.gcd(a_gcd, a[i]) a_seki = a_seki * a[i] a_lcm = a_seki//a_gcd b_sum = 0 for i in range(n): b_sum = (b_sum + (a_lcm // a[i])) % mod print(b_sum)
p03644
s726284338
Accepted
import math print(2 ** int(math.log2(int(input()))))
p02820
s654201855
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() count = {"r": 0, "s": 0, "p": 0} win = [-1 for i in range(N)] for i in range(N): if i < K: count[T[i]] += 1 win[i] = 1 else: if T[i] == T[i-K] and win[i-K] == 1: win[i] = 0 else: count[T[i]] += 1 win[i] = 1 score = R*count["s"] + S*count["p"] + P*count["r"] print(score)
p03495
s655339478
Accepted
from collections import Counter n, k = map(int, input().split()) a = list(map(int, input().split())) print(sum(sorted(Counter(a).values())[0:len(set(a)) - k]))
p02996
s689137987
Accepted
class Work: require = 0 limit = 0 def __init__(self, require, limit) -> None: self.require = require self.limit = limit def from_list(xs) -> Work: return Work(xs[0], xs[1]) N = int(input()) works = [from_list([int(_) for _ in input().split()]) for i in range(N)] def solve(works): works.sort(key=lambda x: x.limit) acc = 0 for w in works: acc += w.require if acc > w.limit: return "No" return "Yes" print(solve(works))
p02699
s848325419
Accepted
S, W = map(int, input().split()) if S>W: print('safe') else: print('unsafe')
p03407
s208534128
Wrong Answer
a, b, c = map(int, input().split()) print("Yes" if a+b>=c else "NO")
p02823
s803877148
Accepted
def main(): N, A, B = map(int, input().split()) if abs(A-B) % 2 == 0: print(abs(A-B)//2) else: print(min([A-1, N-B])+1+(B-A-1)//2) if __name__ == "__main__": main()
p02615
s817795021
Accepted
N = int(input()) A = sorted(list(map(int, input().split())), reverse=True) ans = -A[0] for i in range(N): ans += A[i//2] print(ans)
p02682
s677127479
Wrong Answer
a,b,c,k = map(int,input().split()) if a>k: print(a) elif a+b >= k: print(a) else: print(a-(k-a-b))
p02730
s566340976
Wrong Answer
s = input() flag = True n = len(s) for i in range(n//4): if s[i] == s[(n-1)//2 -1 - i] == s[(n+3)//2 -1 + i] == s[n-1 - i]: break else: flag = False if flag == True: print('Yes') else: print('No')
p03013
s358824176
Accepted
n, m = map(int, input().split()) a = set(map(int, [input() for _ in range(m)])) dp = [0] * (n+1) # 0段目と1段目は1通り(但し、1段目が壊れていない場合)(0 段目は「なにもしない」という から1 通り) dp[:2] = 1, 1 if 1 not in a else 0 for i in range(2, n+1): if i not in a: dp[i] = ((dp[i-1] + dp[i-2]) % (10**9+7)) print(dp[-1])
p02817
s760654019
Accepted
s, t = input().split() print(t+s)
p02982
s770367697
Wrong Answer
import math n, d = map(int, input().split()) x = [list(map(int, input().split())) for i in range(n)] cnt = 0 for i in range(n): for j in range(i+1, n): for k in range(d): dis = 0 dis += (x[i][k]-x[j][k])**2 if math.sqrt(dis) % 1 == 0: cnt += 1 print(cnt)
p02676
s607904632
Accepted
from sys import stdin import sys K=int(input()) S=input() if len(S)<=K: print(S) else: print(S[:K]+'...')
p03038
s002784237
Wrong Answer
n,m=[int(x) for x in input().rstrip().split()] A=[int(x) for x in input().rstrip().split()] now=[] bc=[] for i in range(m): BC=[int(x) for x in input().rstrip().split()] bc.append(BC) bc=sorted(bc,key=lambda x:x[1]) A.sort(reverse=True) d=[] for b,c in bc: d.extend([c]*b) if n<=len(d): break A+=d A.sort(reverse=True) print(sum(A[:n]))
p03803
s516518462
Accepted
a,b = map(int,input().split()) if a == b: print('Draw') elif a < b: if a == 1: print('Alice') else: print('Bob') else: if b == 1: print('Bob') else: print('Alice')
p02682
s080818910
Accepted
a,b,c,k=map(int,input().split()) if(k<=a): print(k) else: print(a-(k-a-b))
p03723
s517784254
Wrong Answer
def mapint_inp(): return map(int, input().split()) A, B, C = mapint_inp() print(-1)
p02629
s118882335
Accepted
n = int(input()) h = [] tmp = ["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"] name = "" while n != 0: mod = n % 26 h.append(mod) n //= 26 if mod == 0: n -= 1 h.reverse() for i in h: name += tmp[i - 1] print(name)
p03760
s670548430
Accepted
O = list(input()) lo = len(O) E = list(input()) le = len(E) w = lo + le X = ['*']*w for i in range(le): X[2*i] =O[i] X[2*i+1] = E[i] if lo > le: X[-1] = O[-1] print(''.join(X))
p02631
s811818134
Wrong Answer
def main(): N=int(input()) a=list(map(int,input().split())) p=max(a) m=len(bin(p))-2 for i in range(N): b=len(bin(a[i]))-2 ans=0 for j in range(b): if a[i]>>j&1==1: if j==m-1 or j==0: ans+=pow(2,j) else: if j==m-1 or j==0: continue ans+=pow(2,j) print(ans,end=' ') if __name__=='__main__': main()
p03408
s944052336
Accepted
n = int(input()) score = {} for _ in range(n): blue = input() if blue in score: score[blue] += 1 else: score[blue] = 1 m = int(input()) for _ in range(m): red = input() if red in score: score[red] -= 1 else: score[red] = -1 dict_max = max(score.values()) print(max(dict_max,0))
p03612
s562517625
Accepted
n = int(input()) p = list(map(int,input().split())) count = 0 for i in range(n-1): if p[i] == i+1: tmp = p[i] p[i] = p[i+1] p[i+1] = tmp count += 1 if p[-1] == n: count += 1 print(count)
p02615
s420754151
Accepted
N=int(input()) A=sorted(list(map(int,input().split())))[::-1] i=1 t=1 score=A[0] while i<=N-1: if i+2<=N-1: score+=2*A[t] i+=2 t+=1 elif i+1<=N-1: score+=A[t] break else: break #print(i,t,score) print(score)
p03105
s593033117
Wrong Answer
a,b,c=map(int,input().split()) print(c if a//b>=c else a//b)
p02723
s942170122
Wrong Answer
s = list(input()) if s[4] == s[5]: if s[2]==s[3]: print("Yes") else: print("No") else: print("NO")
p03037
s178663260
Accepted
n,m = map(int,input().split()) l = [list(map(int,input().split())) for i in range(m)] left = [i[0] for i in l] right = [i[1] for i in l] max_left = max(left) min_right = min(right) ans = min_right - max_left if ans < 0: print(0) else: print(ans+1)
p02820
s589979006
Accepted
n,k=map(int,input().split()) s,p,r=map(int,input().split()) #筐体の手に対する勝利ポイント t=list(input()) ans=0 for i in range(n): if t[i]=="s": tmp=s elif t[i]=="p": tmp=p else: tmp=r if i>=k: if t[i]==t[i-k]: tmp=0 t[i]=None ans+=tmp print(ans)
p03795
s385982688
Accepted
n=int(input()) print(800*n-200*(n//15))
p02717
s273362347
Accepted
X,Y,Z = map(int,input().split()) print(Z,X,Y)
p02687
s670658958
Accepted
s = str(input()) if s == 'ABC': print('ARC') else: print('ABC')
p02939
s185593774
Wrong Answer
def main(): import itertools s=itertools.groupby(str(input())) ans=0 for k,v in s: l=len(list(v)) if l<=2: ans+=1 else: ans+=l//2+1 print(ans) if __name__=="__main__": main()
p02818
s667453472
Accepted
#k = int(input()) #s = input() #a, b = map(int, input().split()) #s, t = map(str, input().split()) #l = list(map(int, input().split())) a, b, k = map(int, input().split()) if (a > 0): if (a >= k): a -= k print (a,b) exit() else: k -= a a = 0 if (b > 0): if (b >= k): b -= k print(a,b) exit() else: b = 0 print(a,b)
p03243
s670535979
Wrong Answer
import sys N = int(input()) sum_N = sum(map(int,str(N))) for i in range(1,9): comp = 3*(i) if sum_N <= comp: print(str(i)*3) sys.exit()
p03241
s785462105
Accepted
#!/usr/bin/env python3 import sys def solve(N: int, M: int): for d in reversed(range(1, M // N + 1)): if M % d == 0: print(d) return def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int M = int(next(tokens)) # type: int solve(N, M) if __name__ == '__main__': main()
p03457
s773849852
Wrong Answer
n = int(input()) txy = [list(map(int, input().split())) for _ in range(n)] print(txy[0]) for i in range(n): if txy[i][1] + txy[i][2] >txy[i][0]: status = "No" break elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2: status = "No" break else: status = "Yes" print(status)
p02707
s675376612
Accepted
n = int(input()) a = list(map(int, input().split())) ans = [0 for i in range(n+1)] for i in range(n-1): ans[a[i]] += 1 for i in ans[1:]: print(i)
p02584
s119066739
Accepted
x, k, d = map(int, input().split()) if abs(x) - k * d > 0: print(abs(x) - k * d) else: kk = abs(x) // d l = (k - kk) % 2 print(abs(abs(x) - (kk + l) * d))
p03274
s393985528
Accepted
n, k = map(int, input().split()) *x, = map(int, input().split()) ans = float("inf") for i in range(n-k+1): l, r = x[i], x[i+k-1] ans = min(ans, min(abs(l), abs(r)) + r - l) print(ans)
p02772
s214802616
Wrong Answer
N = int(input()) A = list(map(int,input().split())) A_even =list() for i in range(len(A)): if A[i] % 2 == 0: A_even.append(A[i]) miss = True for i in range(len(A_even)): if A_even[i]%3 == 0 or A_even[i]%5 == 0: pass else: miss = False break if miss: print("DENIED") else: print("APPROVED")
p02690
s378012839
Wrong Answer
X = int(input()) j = 1 for i in range(1,X//2+2): if X%i == 0: if i != 1: j = i break a_b=j tmp = X//i for k in range(-100000,100000): b = -k a = a_b + b if a**5 - b**5 == X: print(a,b) exit() elif -a**5 + b**5 == X: print(a,b) exit() for k in range(-100000,100000): b = -k a = tmp + b if a**5 - b**5 == X: print(a,b) exit() elif -a**5 + b**5 == X: print(a,b) exit()
p04029
s221632998
Wrong Answer
N = int(input()) sum = (1+ N)*N/2 print(sum)
p02787
s342090417
Wrong Answer
import math H,N=map(int,input().split()) A=[] B=[] eff=[] mp=0 for i in range(N): a,b=map(int,input().split()) A.append(a) B.append(b) eff.append(math.ceil(H/a)*b) while H>0: eff_min_index=eff.index(min(eff)) tmp=math.floor(H/A[eff_min_index]) H-=A[eff_min_index] mp+=B[eff_min_index] for i in range(N): eff[i]=math.ceil(H/A[i])*B[i] print(mp)
p02724
s371418997
Accepted
s = int(input()) print((s//500)*1000 + ((s%500)//5)*5 )
p02760
s835494722
Accepted
A = [list(map(int, input().split(' '))) for i in range(3)] N = int(input()) B = set([int(input()) for i in range(N)]) X = [] X += [set(A[i]) for i in range(3)] X += [set([A[j][i] for j in range(3)]) for i in range(3)] X += [set([A[0][2], A[1][1], A[2][0]]), set([A[2][2], A[1][1], A[0][0]])] for x in X: if x <= B: #setの場合は、順不同で比較する。 <=は部分重合 print('Yes') break else: print('No')
p02918
s536337658
Wrong Answer
N, K = map(int, input().split()) S = input() happy = 0 for i in range(N-1): if S[i] == S[i+1]: happy += 1 m = 0 for i in range(1, N-1): if S[i] == 'R' and S[i+1] == 'L': m += 1 if K <= m: happy += 2*K else: happy += 2*m if S[0] != S[N-1]: happy += 1 print(happy)
p03206
s298293914
Accepted
d = int(input()) if d == 25: print("Christmas") elif d == 24: print("Christmas Eve") elif d == 23: print("Christmas Eve Eve") else: print("Christmas Eve Eve Eve")