problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03331
s481590623
Accepted
ans=float('inf') n=int(input()) for i in range(1,n): z=0 j=n-i c=str(i)+str(j) for k in c: z+=int(k) ans=min(ans,z) print(ans)
p03087
s757658532
Accepted
a,b=map(int,input().split()) n = input() m = [0]*a for i in range(1,a): if n[i-1:i+1]=="AC": m[i]=m[i-1]+1 else: m[i]=m[i-1] for j in range(b): s,t=map(int,input().split()) print(m[t-1]-m[s-1])
p03544
s688483988
Wrong Answer
n=int(input()) a=2 b=1 if n==1: print(1) for i in range(n-1): if i%2==0: a=a+b else: b=a+b print(max(a,b))
p02727
s413485082
Accepted
x,y,a,b,c = map(int,input().split()) p = list(map(int,input().split())) q = list(map(int,input().split())) r = list(map(int,input().split())) from collections import deque p = sorted(p)[a-x:] q = sorted(q)[b-y:] t = deque(sorted(p+q)) r = deque(reversed(sorted(r))) # print(t,r) while r: if t[0] < r[0]: t.popleft() w = r.popleft() t.append(w) else: break ans = sum(t) print(ans)
p02743
s629827637
Wrong Answer
#https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c # -*- coding: utf-8 -*- import math a,b,c = map(int, input().split()) if a + b + 2*math.sqrt(a*b) < c: print("Yes") else: print("No")
p02923
s171621790
Wrong Answer
N = int(input()) H = list(map(int, input().split())) ans = 0 for i, h_std in enumerate(H): for h in H[i+1+ans:]: if h <= h_std: ans += 1 else: break print(ans)
p02933
s477229059
Wrong Answer
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # ------------------------------------------------------------- A = int(input()) S = input().rstrip() print("red" if A>=3200 else S)
p02682
s814692202
Accepted
A,B,C,K=[int(i) for i in input().split()] if K<A: P=K else: P=A if A+B<K: P-=(K-(A+B)) print(P)
p02646
s365224245
Accepted
A, V = [int(n) for n in input().split()] B, W = [int(n) for n in input().split()] T = int(input()) if V <= W: print('NO') exit() d = abs(A - B) if V > W and d <= (V - W) * T: print('YES') else: print('NO')
p03565
s932004181
Accepted
import re sdash = input().replace('?', '.') t = input() len_t = len(t) isNotUsed = True for i in range(len(sdash) - len_t, -1, -1): if re.match(sdash[i:i+len_t], t): s = sdash[:i] + t + sdash[i+len_t:] isNotUsed = False break if isNotUsed: print('UNRESTORABLE') else: print(s.replace('.', 'a'))
p02706
s217883875
Accepted
n, m = map(int, input().split()) a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。 print(max(n-sum(a),-1))
p02773
s316146572
Accepted
from collections import Counter n=int(input()) s=[input() for _ in range(n)] d=Counter(s) m=max(d.values()) keys = [k for k,v in d.items() if v==m] print("\n".join(sorted(keys)))
p02744
s645676753
Accepted
n = int(input()) words = ['a', 'b', 'c', 'd', 'e', 'f','g','h', 'i', 'j'] ans = [[] for _ in range(n)] ans[0].append(["a", 1]) for i in range(n - 1): for ai in ans[i]: for j in range(ai[1]): ans[i + 1].append([ai[0] + words[j], ai[1]]) ans[i + 1].append([ai[0] + words[ai[1]], ai[1] + 1]) for a in ans[n - 1]: print(a[0])
p02678
s349616637
Accepted
from collections import deque n,m = map(int,input().split()) g = [[] for i in range(n)] for i in range(m): x,y = map(int,input().split()) g[x-1].append(y-1) g[y-1].append(x-1) a = [-1]*n d = deque([0]) while d: f = d.popleft() for o in g[f]: if a[o] == -1: a[o] = f d.append(o) print("Yes") for i in a[1:]:print(i+1)
p03632
s032542239
Wrong Answer
a,b,c,d=map(int,input().split()) if b<=c: print('0') elif b<=d: print(abs(b-c)) else: print(min(b-a,d-c))
p03785
s157538316
Accepted
n,c,k=map(int,input().split()) t=sorted([int(input()) for _ in range(n)]) bc=[1] bt=[t[0]+k] for i in range(1,n): if bc[-1]<c and t[i]<=bt[-1]<=t[i]+k:bc[-1]+=1 else: bc+=[1] bt+=[t[i]+k] print(len(bt))
p03208
s714709595
Accepted
N, K = map(int, input().split()) H = [int(input()) for _ in range(N)] H.sort() minim = 1e10 for i in range(N-K+1): minim = min(minim, H[i+K-1] - H[i]) print(minim)
p03206
s897795115
Wrong Answer
d = input() if d==25: print('Christmas') if d==24: print('Christmas Eve') if d==23: print('Christmas Eve Eve') if d==22: print('Christmas Eve Eve Eve')
p02982
s418740734
Accepted
n, d = map(int, input().split()) A = [] for i in range(n): a = list(map(int, input().split())) A.append(a) def dstnc(X, Y): res = 0 for l, x in enumerate(X): res += (x - Y[l])**2 return res ans = 0 for i in range(n - 1): for j in range(i + 1, n): su = dstnc(A[i], A[j])**0.5 if str(su)[-1] == "0" and str(su)[-2] == ".": ans += 1 print(ans)
p02744
s389106659
Wrong Answer
from operator import itemgetter a = ("a", "b", "c", "d", "e") N = int(input()) L = [0]*N alpha=list('abcdefghij') print('a'*N) for i in range(N,0,-1): for j in range(i,N,1): L[j]+=1 print(''.join([alpha[i] for i in L]))
p02640
s205009590
Wrong Answer
x,y = map(int, input().split()) for i in range(1, x + 1): turu = i kame = x - i if turu * 2 + kame * 4 == y: print('Yes') exit() print('No')
p03264
s996112515
Accepted
print(input()**2//4)
p02663
s371580650
Accepted
def main(): h1, m1, h2, m2, k = map(int, input().split()) a = h1*60+m1 b = h2*60+m2 print(b-a-k) if __name__ == "__main__": main()
p02695
s934895703
Accepted
from itertools import combinations_with_replacement n,m,q=map(int,input().split()) a,b,c,d=[0]*q,[0]*q,[0]*q,[0]*q for i in range(q): x,y,z,w=map(int,input().split()) x-=1 y-=1 a[i],b[i],c[i],d[i]=x,y,z,w ans=0 for v in combinations_with_replacement(range(1,m+1),n): res=0 for i in range(q): if v[b[i]]-v[a[i]]==c[i]: res+=d[i] ans=max(ans,res) print(ans)
p02755
s452780205
Accepted
A,B=tuple(int(i) for i in input().split(" ")) err=lambda X:abs(int(X*0.08)-A)+abs(int(X*0.10)-B) rg=[int(A/0.08),int(B/0.10)] rg.sort() rg[0]-=int(1/0.08) rg[1]+=int(1/0.08) solv=[X for X in range(*rg) if err(X)==0] solv.sort() if(len(solv)==0): print("-1") else: print(solv[0])
p02642
s668281511
Accepted
n=int(input()) a=list(map(int,input().split())) a.sort() amax=max(a) dp=[True]*(amax+1) ans=0 for i in range(n): if dp[a[i]]: ans+=1 for j in range(a[i],amax+1,a[i]): dp[j]=False if i<n-1: if a[i]==a[i+1]: ans-=1 print(ans)
p03681
s388296739
Accepted
import math n, m = map(int, input().split()) ans = 0 if n == m: ans = (math.factorial(n) * math.factorial(m)) * 2 elif n + 1 == m or n == m + 1: ans = (math.factorial(n) * math.factorial(m)) else: ans = 0 ans = ans % (10 ** 9 + 7) print(ans)
p02582
s951609710
Accepted
s = input() record = list(s) n = 0 high_score = 0 yesterday = ' ' for today in record : ####### main if today == 'R': if yesterday == 'R' : n += 1 else : n = 1 ###### ato if high_score < n : high_score = n yesterday = today print(high_score)
p03943
s630979090
Wrong Answer
a,b,c=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき if (a+b+c)%3==0: print('Yes') else: print('No')
p03455
s018796994
Wrong Answer
a, b = map(int, input().split()) if (a % 2 == 0 ) or ( b % 2 == 0 ) : 'even' else : 'odd'
p02951
s845654706
Accepted
a,b,c = map(int,input().split()) print(max(0,c-(a-b)))
p02946
s705165700
Accepted
k, x = list(map(int, input().split())) print(' '.join([str(i) for i in range(x-k+1,x+k)]))
p02608
s260155720
Wrong Answer
from collections import defaultdict N = int(input()) def fun(x, y, z): return x**2 + y**2 + z**2 + x*y + y*z + z*x res = defaultdict(int) for x in range(1, 50): for y in range(1, 50): for z in range(1, 50): res[fun(x, y, z)] += 1 for n in range(1, N+1): print(res[n])
p02660
s456646005
Accepted
N = int(input()) n = N fs = {} f = 2 while n > 1: if f*f > n: if n not in fs: fs[n] = 0 fs[n] += 1 n = 1 elif n%f == 0: if f not in fs: fs[f] = 0 fs[f] += 1 n = n//f else: f += 1 #print(fs) rs = [] for f in fs: n = fs[f] for r in range(1, 256): if (r+1)*(r+2)//2 > n: rs.append(r) break r = sum(rs) print(r)
p03126
s127423932
Accepted
N,M = map(int, input().split()) res = [0]*M for i in range(N): A = list(map(int, input().split())) K = A[0] for j in range(1,K+1): res[A[j]-1] += 1 print(res.count(N))
p03377
s629180811
Accepted
A, B, X = map(int, input().split()) if A > X: print('NO') else: if X >= A + B: print('NO') else: print('YES')
p03487
s800812734
Accepted
N=int(input()) a=list(map(int,input().split())) a.sort() a.append(0) ans=0 b=a[0] c=0 for i in range(N+1): if b!=a[i]: if c<b: ans+=c b=a[i] c=1 else: if c==b: ans+=1 else: c+=1 print(ans)
p03160
s031631248
Accepted
import numpy as np N = int(input()) h = list(map(int, input().split())) memo = np.full(N, 10**4) memo[0] = 0 memo[1] = abs(h[0] - h[1]) for i in range(2, N): memo[i] = min([memo[i-1] + abs(h[i-1] - h[i]), memo[i-2] + abs(h[i-2] - h[i])]) print(memo[N-1])
p02706
s642849907
Accepted
N, M = map(int, input().split()) A = list(map(int, input().split())) days = sum(A) if days <= N: print(N-days) else: print(-1)
p02695
s950059735
Accepted
n,m,q=map(int,input().split()) query=[] for _ in range(q): query.append(list(map(int,input().split()))) ans=0 def rec(a): if len(a)==n+1: temp=0 for qu in query: if a[qu[1]]-a[qu[0]]==qu[2]: temp+=qu[3] global ans ans=max(ans,temp) return for i in range(a[-1],m+1): cp=a[:] cp.append(i) rec(cp) rec([1]) print(ans)
p03338
s893041604
Wrong Answer
n = int(input()) s = list(input()) ans = 0 for i in range(1,n): ans = max(ans,min(len(set(s[:i])),len(set(s[i:])))) print(ans)
p02572
s297140008
Wrong Answer
n=int(input()) a=list(map(int,input().split(" "))) print(int((sum(a)**2-sum([i**2 for i in a]))/2)%(10**9+7))
p02572
s172046412
Accepted
MOD = 10 ** 9 + 7 n = int(input()) a = [int(x) for x in input().split()] sum = 0 for x in a: sum += x sum %= MOD ans = 0 for i in range(n): sum -= a[i] if sum < 0: sum += MOD ans += a[i] * sum ans %= MOD print(ans)
p02627
s375542261
Accepted
a=input() if a.isupper()==True: print("A") else: print("a")
p02912
s881946766
Accepted
import heapq N, M = map(int, input().split()) A = list(map(lambda x: -int(x), input().split())) heapq.heapify(A) for _ in range(M): a = heapq.heappop(A) a *= -1 a //= 2 a *= -1 heapq.heappush(A, a) A = [-1 * a for a in A] print(sum(A))
p02664
s077211362
Accepted
import sys,collections t = sys.stdin.readline().rstrip() print(t.replace('?','D'))
p03331
s658058420
Accepted
n = int(input()) sum = float('inf') for i in range(1, n): k = 0 for j in range(len(str(i))): k += float(str(i)[j]) for l in range(len(str(n-i))): k += float(str(n-i)[l]) sum = min(sum, k) print(int(sum))
p02912
s418931304
Wrong Answer
import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) A = list(map(lambda x:x*(-1), A)) heapq.heapify(A) for i in range(M): x = (heapq.heappop(A))*(-1) heapq.heappush(A, -(x//2)) print(A) print(sum(A)*(-1))
p03475
s788119828
Accepted
N,*L = map(int, open(0).read().split()) ans = 0 inf = [0]*(N-1) for i,(c,s,f) in enumerate(zip(*[iter(L)]*3)): inf[i] = (c,s,f) for i in range(N-1): ans = 0 for j in range(i,N-1): c,s,f = inf[j] m = ((ans-1)//f+1)*f ans = max(m,s) ans += c print(ans) print(0)
p03250
s331797520
Accepted
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collections import deque from operator import itemgetter from itertools import permutations mod = 10**9 + 7 inf = float('inf') def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) x = LI() x.sort(reverse=1) ans = x[0]*10 + x[1] + x[2] print(ans)
p03345
s906095801
Accepted
a, b, c, k = map(int, input().split()) if k % 2 == 1: print(b - a) elif k % 2 == 0: print(a - b)
p03208
s294698791
Accepted
N,K = map(int,input().split()) h = sorted([int(input()) for _ in range(N)]) result = 10**9 for i in range(N-K+1): result = min(result,h[i+K-1]-h[i]) print(result)
p03131
s490752877
Wrong Answer
k,a,b=map(int,input().split()) if b/a<=2 or k-1<=a: print(1+k) else: print((k-a+1)//2*(b-a)+(k-a+1)%2+a)
p02719
s458639475
Accepted
N,K = map(int,input().split()) n = N % K ans = min(n,K-n) print(ans)
p02572
s846352643
Accepted
m=10**9+7 n=int(input()) a=[int(i) for i in input().split()] ans=0 ; s=a[-1] for i in range(n-2,-1,-1): ans=(ans+s*a[i])%m s=(s+a[i])%m print(ans%m)
p02983
s709660910
Accepted
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) l,r = nm() MOD = 2019 ans = 10**9 for i in range(l,min(r,l+2019)+1): for j in range(i+1,min(r,i+MOD)+1): ans=min(ans,((i%MOD)*(j%MOD))%MOD) print(ans)
p03457
s330474825
Accepted
n=int(input()) arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)] for i in range(n): t1,x1,y1=arr[i] t2,x2,y2=arr[i+1] if abs(x1-x2)+abs(y1-y2)>t2-t1: print('No') exit() if (abs(x1-x2)+abs(y1-y2))%2!=(t2-t1)%2: print('No') exit() print('Yes')
p02743
s599373216
Accepted
from decimal import * a,b,c=map(Decimal,input().split()) print("Yes" if a.sqrt()+b.sqrt()<c.sqrt() else "No")
p02676
s587318459
Wrong Answer
k= int(input()) s= input() if len(s)<=k: print(s) else: print(s[1:k]+'...')
p03219
s037328064
Accepted
x, y = map(int, input().split()) ans = x + y//2 print(ans)
p02696
s853511912
Wrong Answer
import math A, B, N = list(map(int, input().split(" "))) res = [] for n,i in enumerate(range(1,N+1)): r = math.floor(A*i/B) - A*math.floor(i/B) res.append(r) if n >= 1: if res[n-1] <= res[n]: break print(max(res))
p02785
s647443852
Accepted
h,n=map(int,input().split()) a = list(map(int,input().split())) a.sort(reverse=True) print(sum(a[n:]))
p02598
s607397476
Accepted
n, k = map(int, input().split()) A = [*map(int, input().split())] ng, ok = 0, max(A) # (ng,ok] = (l,r] while ok - ng > 1: m = (ng + ok) // 2 c = 0 for a in A: c += (a-1) // m if c <= k: ok = m else: ng = m print(ok)
p02900
s940175744
Accepted
# import sys # sys.setrecursionlimit from fractions import gcd getarr = lambda _f: list(map(_f, input().split())) a, b = getarr(int) m = gcd(a, b) i = 2 ans = 1 while i * i <= m: if m % i == 0: ans += 1 while m % i == 0: m //= i i += 1 if m > 1: ans += 1 print(ans)
p02584
s801862997
Accepted
X, K, D = map(int, input().split()) X = abs(X) if X-K*D>=0: print(X-K*D) else: a = X//D if (K-a)%2==0: print(X-D*a) else: print(D*(a+1)-X)
p04044
s592210037
Accepted
N, L = map(int, input().split()) S = sorted([input() for i in range(N)]) print(*S, sep="")
p02959
s922728495
Wrong Answer
n = int(input()) al = list(map(int, input().split())) bl = list(map(int, input().split())) bl.append(0) mons = 0 b0 = 0 for a, b in zip(al, bl): if a >= (b0 + b): mons += b0 + b else: mons += a b0 = b - max(a-b, 0) print(mons)
p03103
s784698840
Wrong Answer
#a値段,b本数 n,m = list(map(int, input().split())) a_lis =[] b_lis = [] for _ in range(n): a,b = list(map(int, input().split())) a_lis.append(a) b_lis.append(b) cp_lis = a_lis.copy() cp_lis.sort() ans = 0 num = 0 for i in cp_lis: ans += b_lis[a_lis.index(i)]*i num += b_lis[a_lis.index(i)] if num >= m: i_stop = cp_lis.index(i) break diff_num = num - m ans -= cp_lis[i_stop]*diff_num print(ans)
p02597
s997589192
Accepted
N = int(input()) C = input() tmp = 0 for i in range(N): if C[i] == "R": tmp += 1 ans = 0 for i in range(tmp): if C[i] == "W": ans += 1 print(ans)
p03695
s332693418
Accepted
n=int(input()) a=list(map(int,input().split())) r=[0]*8 f=0 for i in range(n): if(a[i]>=3200): f+=1 else: r[a[i]//400]=1; c=sum(r) print(1 if(c==0) else c,end=" ") print(f+c)
p03767
s552075360
Accepted
N = int(input()) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(-2, -2 * N - 1, -2): ans += a[i] # print(a[i]) print(ans)
p03131
s228979907
Accepted
k,a,b = map(int,input().split()) ans0 = 1+k #a<bの時のみ交換を行う。1>>aになるまで加算し、そのあとはa-bを繰り返す。 if a+2>=b: print(1+k) else: q=(k-a+1)//2 if q==0: print(1+k) else: print(1+(k-2*q)+q*(b-a))
p02732
s562154522
Wrong Answer
from collections import Counter N = int(input()) A = list(map(int, input().split())) allCount = 0 c = Counter(A) for i, v in c.items(): if (v == 1): continue else: allCount += v * (v - 1) // 2 if (allCount == 0): for i in range(N): print(0) exit() for i in range(N): a = allCount num = c[A[i]] - 1 if (num == 1 or num == 0): print(allCount - num) continue old = A[i] * (A[i] - 1) // 2 count = num * (num - 1) // 2 print(a - old + count)
p02602
s441468139
Accepted
N,K = map(int,input().split()) A = list(map(int,input().split())) for i in range(N-K): if A[i+K] > A[i]: print("Yes") else: print("No")
p03797
s818901755
Accepted
n,m = map(int,input().split()) if(2*n>=m): print(m//2) else: remaining = m- n*2 ans = remaining//4 + n print(ans)
p02732
s015538419
Accepted
from collections import Counter def Get_nC2(n): return int(n*(n-1) / 2) N = int(input()) A_i = list(map(int, input().split())) c = Counter(A_i) total = sum(list(map(Get_nC2, c.values()))) for a_i in A_i: result = total - Get_nC2(c[a_i]) + Get_nC2(c[a_i]-1) print(result)
p02760
s299286803
Wrong Answer
def check(A): if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0: return 1 for i in range(3): if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0: return 1 elif A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0: return 1 return 0 A = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b = [int(input()) for _ in range(n)] for i in range(3): for j in range(3): if A[i][j] in b: A[i][j] = 0 if check(A): print('Yes') else: print('No')
p03042
s136506751
Accepted
s = str(input()) top = int(s[:2]) bottom = int(s[2:]) if 1 <= top <= 12 and 1 <= bottom <= 12: print('AMBIGUOUS') elif top > 12 and bottom > 12: print('NA') elif 1 <= top <= 12: print('MMYY') elif 1 <= bottom <= 12: print('YYMM') else: print('NA')
p03126
s739444957
Wrong Answer
N,M = map(int,input().split()) l = [list(map(int,input().split())) for i in range(N)] del l[0:N][0] #print(l) sum = [] for i in range(N-1): sum += list(set(l[i])&set(l[i+1])) print(len(sum))
p03493
s737825131
Wrong Answer
s = input().split() s.count("1")
p03962
s138637650
Accepted
print(len(set([int(i) for i in input().split()])))
p03673
s693168740
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = [] if n%2 == 0: for i in range(0,(n//2)+2,2): b.append(a[i]) b.insert(0,a[i+1]) else: b.append(a[0]) for h in range(1,(n//2)+1,2): b.append(a[h]) b.insert(0,a[h+1]) print(*b)
p02642
s271200954
Wrong Answer
n = int(input()) A = sorted(map(int, input().split()), reverse=True) b = 0 #print(A) for i in range(n): if i != 0: if A[i] == A[i-1]: continue # j = i+1 if i == n-1: b += 1 continue j = n-1 while j > i: if A[i]%A[j] == 0: break if j == i+1 or 2*A[j] > A[i]: b += 1 break j -= 1 print(b)
p02724
s295168456
Accepted
n = int(input()) ans = 0 ans += 1000 * (n//500) n -= (n//500) * 500 ans += n//5 * 5 print(ans)
p02755
s547781048
Accepted
import math a,b=map(int,input().split()) n=math.ceil((a*100)/8) m=int((a*100)/10) result=[] for i in range(m-100,n+100): if math.floor(i*0.08)==a and math.floor(i*0.1)==b: result.append(i) if result==[]: print(-1) exit() print(min(result))
p03611
s432430239
Wrong Answer
n = int(input()) a = list(map(int,input().split())) cnt = [0] * (max(a)+2) for i in a: cnt[i]+=1 cnt[i-1]+=1 cnt[i+1]+=1 print(max(cnt))
p02659
s520139942
Accepted
from decimal import * getcontext().prec = 20 N = list(map(str, input().split())) A = Decimal(N[0]) B = Decimal(N[1]) print(int(A*B))
p02584
s733441418
Accepted
import math X, K, D = map(int, input().split()) X = abs(X) mini = math.ceil(X/D) if mini >= K: print(abs(X-D*K)) else: if (K-mini)%2 == 0: print(abs(X-D*mini)) else: print(X-D*(mini-1))
p02820
s362212800
Accepted
from collections import Counter n, k = map(int, input().split()) r, s, p = map(int, input().split()) t = str(input()) ans = 0 pre = [0] * k d = Counter(t) for i in range(0, n+(k-1)//k, k): L = list(t[i:i+k]) for j in range(len(L)): if pre[j] == L[j]: d[L[j]] -= 1 L[j] = 'x' pre = L ans = d['r'] * p + d['s'] * r + d['p'] * s print(ans)
p02618
s976493928
Wrong Answer
for i in range(100): print(i%26+1)
p02786
s023525650
Wrong Answer
h_ = int(input()) h = h_ ans = 0 count = 1 for i in range(h): if h <= 1: print(count) break count += 1 h = h//2 print((2 ** count)-1) ''' if h <= 1: print(1) else: for i in range(1, h+1): if h <= 1: #ans += h_ print(ans+1) break else: h = h/2 ans += h_/h print(h_/h, h) #print(ans) '''
p02818
s682530759
Accepted
A,B,K = [int(num) for num in input().split(' ')] if A >= K: print('{} {}'.format(A-K, B)) elif (A < K) and (K-A <= B): print('{} {}'.format(0, B-(K-A))) else: print('{} {}'.format(0, 0))
p03163
s956196836
Accepted
N, W = map(int, input().split()) dp = [[0 for i in range(W+1)] for j in range(N+1)] for i in range(1, N+1): w, v = map(int, input().split()) for j in range(0, W+1): if j >= w: dp[i][j] = max(dp[i][j], dp[i-1][j-w] + v) dp[i][j] = max(dp[i][j], dp[i-1][j]) print(dp[N][W])
p02676
s047057123
Accepted
K=int(input()) S=input() if len(S)<=K: print(S) else: print(S[:K]+'...')
p02963
s330687302
Accepted
import math s=int(input()) thre = math.ceil(s**0.5) left = thre**2 rem = left - s for i in range(1,10**7): if rem%i == 0: a,b = i,rem//i break print(0,0,thre,b,a,thre)
p03206
s363784628
Accepted
d=int(input()) s=" Eve"*(25-d) print("Christmas"+s)
p03427
s861891174
Accepted
n = input() t = n[0] + '0'*(len(n)-1) t = str(int(t)-1) r1 = sum(list(int(d) for d in t)) r2 = sum(list(int(d) for d in n)) print(max(r1,r2))
p02705
s082506807
Wrong Answer
from math import pi r = int(input('Enter a number: ')) print(r*pi*2)
p02577
s528319414
Accepted
num = sum(int(d) for d in input()) a = ['No', 'Yes'][num % 9 == 0] print(a)
p03799
s045988589
Accepted
import math n, m = map(int, input().split()) ans = 0 ans += min(n, m // 2) m -= 2 * min(n, m // 2) ans += math.floor(m / 4) print(ans)