problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02618
s262551648
Accepted
D = int(input()) c = list(map(int, input().split())) s = [] for k in range(D): s.append(list(map(int, input().split()))) #print(s) ans = [s[k].index(max(s[k]))+1 for k in range(D)] for k in range(D): print(ans[k])
p02576
s656902094
Wrong Answer
n, x, t = map(int, input().split()) print(((n // x) + 1)*t)
p02690
s842297573
Accepted
from itertools import product X = int(input()) for a, b in product(range(-200, 201), repeat=2): if a**5 - b**5 == X: print(a, b); break
p02554
s678930746
Accepted
n=int(input()) x=(10**n)%(10**9+7) y=(9**n)%(10**9+7) z=(8**n)%(10**9+7) print((x-2*y+z)%(10**9+7))
p03106
s510956182
Accepted
A,B,K=map(int,input().split()) while A%B!=0: C=A%B A=B B=C cnt=0 for i in range(B+1,0,-1): if B%i==0: cnt+=1 if cnt==K: print(i) exit()
p02768
s125636256
Accepted
n, a, b = map(int, input().split()) mod = 10**9+7 sum = pow(2, n, mod) - 1 #(2**n-1)%modと同じ def comb(m): x = 1 y = 1 for i in range(m): x = x*(n-i)%mod #コンビネーションの分子 y = y*(i+1)%mod #コンビネーションの分母 return (x * pow(y, mod-2, mod) % mod) print((sum-comb(a)-comb(b))%mod)
p02624
s962554935
Wrong Answer
import itertools import functools import math from collections import Counter from itertools import combinations import re def main_chk(): N = int(input()) ans = 0 for i in range(1,N+1): m = N // i ans += ( m + 1 ) * m * i / 2 print(ans) main_chk()
p03815
s332808681
Accepted
n = int(input()) tot = n//11 rem = n%11 tot = tot*2 if rem==0: print(tot) elif rem<=6: print(tot+1) else: print(tot+2)
p03760
s285162536
Accepted
o = list(input()) s = list(input()) + [''] print(*[o + s for o, s in zip(o, s)], sep='')
p03475
s576454915
Accepted
n=int(input()) l=[list(map(int,input().split())) for i in range(n-1)] for i in range(n-1): t=l[i][1] t+=l[i][0] for j in range(i+1,n-1): if t<l[j][1]: t=l[j][1] elif t%l[j][2]!=0: t+=l[j][2]-t%l[j][2] t+=l[j][0] print(t) print(0)
p02814
s423788843
Accepted
from functools import reduce def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) def div_ceil(x, y): return (x + y - 1) // y N, M = map(int, input().split()) *A, = map(int, input().split()) A = list(set([a // 2 for a in A])) L = reduce(lcm, A) for a in A: if (L // a) % 2 == 0: ans = 0 break else: ans = div_ceil(M // L, 2) print(ans)
p02582
s586432033
Wrong Answer
S = input() cnt = 1 for i in range(len(S)-1): if S[i] == S[i+1] and S[i] == "R": cnt += 2 elif S[i] != S[i+1] and S[i+1] == "R": cnt += 1 else: cnt = 0 print(cnt)
p03565
s476606879
Wrong Answer
s = input() t = input() import fnmatch if set(s) == {'?'} and set(t) =={'?'}: print('UNRESTORABLE') else: for i in range(len(s) - len(t)+1): if fnmatch.fnmatch(t, s[i:i+len(t)]): x = s[0:i] + t + s[i+len(t):] print(x.replace('?', 'a')) break else: print('UNRESTORABLE')
p04034
s537229782
Accepted
N, M = map(int, input().split()) ball_count = [1 for _ in range(N)] if_red_exists = [1] + [0 for _ in range(N-1)] count = 1 for _ in range(M): x, y = map(int, input().split()) if if_red_exists[x-1]: # 赤が存在する場合 if_red_exists[y-1] = 1 if ball_count[x-1] <= 1: if_red_exists[x-1] = 0 ball_count[x-1] -= 1 ball_count[y-1] += 1 count = 0 for e in if_red_exists: if e == 1: count += 1 print(count)
p03698
s782127450
Accepted
s=input() for i in range(len(s)): for j in range(len(s)): if s[i]==s[j] and i!=j: print("no") exit() print("yes")
p02630
s637326295
Accepted
from collections import Counter def main(): N = int(input()) A = list(map(int,input().split())) Q = int(input()) Co = Counter(A) # print(Co) SUM = sum(A) for _ in range(Q): b,c = map(int,input().split()) SUM += (c-b) * Co[b] Co[c] += Co[b] Co[b] = 0 # print(Co) print(SUM) main()
p02916
s920405532
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) m = 0 for i in range(N): print(i) if A[i-1] == A[i]-1 and i != 0: print(B[A[i]-1]) m += B[A[i]-1] + C[A[i-1]-1] else: m += B[A[i]-1] print(m) print(m)
p03274
s140897353
Accepted
n, k = map(int, input().split()) x = list(map(int, input().split())) ans = [] for j in range(n-k+1): if x[j] > 0: ans.append(x[j+k-1]) elif x[j] <= 0 <= x[j+k-1]: ans.append(min(2*abs(x[j])+x[j+k-1], abs(x[j])+2*x[j+k-1])) else: ans.append(-x[j]) print(min(ans))
p03627
s031572004
Accepted
import collections N = int(input()) A = list(map(int,input().split())) c = collections.Counter(A) c = collections.OrderedDict(sorted(c.items(), key=lambda x:x[0],reverse=True)) high=0 low=0 for i,j in zip(c.keys(),c.values()): if(j>=4): if(high==0): high=i if(low==0): low =i break elif(j>=2): if(high==0): high=i else: low=i break print(high*low)
p03696
s996168590
Wrong Answer
from collections import deque N=int(input()) S=input() stack= deque([]) ans="" for i in range(N): if S[i]=="(": stack.append(S[i]) else: if len(stack)>0: ans += stack.pop()+")" else: ans = "(" + ans + ")" nokori=len(stack) ans += nokori * "(" + nokori * ")" print(ans)
p02676
s508670858
Wrong Answer
k = int(input()) s_num = input() s = list(s_num) if len(s) < k: ans = s_num else: ans = s_num[0:k] + "..." print(ans)
p03062
s027569742
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = sum([a<0 for a in A]) C = sum([abs(a) for a in A]) if B%2==0: print(C) else: print(C-2*min(A,key=abs))
p02994
s704424944
Accepted
import math n, l = map(int, input().split()) t = [] for i in range(1, n+1): t.append(l+i-1) fab = [] sum_t = sum(t) tmp = 0 if n+l > 0: for i in range(n): fab.append(sum_t-t[i]) ans = [] for i in range(n): ans.append(math.fabs(sum_t-fab[i])) print(int(sum_t-min(ans))) else: for i in range(n-1): tmp += t[i] print(tmp)
p02578
s570165075
Wrong Answer
n = int(input()) a = input() a = a.split() count = 0 boo = False for i in a: if int(i) >= n: boo = True if(boo): print(n - 1) else: print(0)
p02631
s871267756
Wrong Answer
input() print(input())
p02731
s348549956
Accepted
l = int(input()) r = l / 3 print(r**3)
p04044
s902186304
Accepted
n , m = map(int,input().split()) mojiretsu ='' str_list = [input() for _ in range(n)] str_listss = sorted(str_list) for i in str_listss: mojiretsu += i print(mojiretsu)
p02597
s520364663
Accepted
n=int(input()) s=input() wcount=0 for i in range(n): if s[i]=="R" : wcount+=1 wwcount=0 for i in range(wcount): if s[i]=="R" : wwcount+=1 print(wcount-wwcount)
p03556
s448864311
Accepted
print(int(int(input())**.5)**2)
p03150
s754840735
Accepted
s=input() n=len(s) a=str() b=str() k='keyence' l='ecneyek' j=0 for i in range(n): if a+s[i] in k: a+=s[i] j=i+1 else: break for i in range(7-j): if b+s[n-i-1] in l: b+=s[n-i-1] else: break if a+b[::-1]==k: print('YES') else: print('NO')
p02916
s736794254
Wrong Answer
n = int(input()) a_input = input() a = a_input.split(" ") b_input = input() b = b_input.split(" ") c_input = input() c = c_input.split(" ") b_sum = 0 for i in range(n): b_sum += int(b[i]) c_sum = 0 for i in range(n-1): if int(a[i]) != n: c_sum += int(c[int(a[i])-1]) else: continue sum = b_sum + c_sum print(sum)
p02607
s729658726
Wrong Answer
n=input() x=list(map(int,input().split())) ans=0 for i in x[1::2]: if i%2==1: ans+=1
p03838
s007604071
Accepted
x,y=map(int,input().split()) x_=-x y_=-y ans=10**9+6 if x<=y: ans=min(ans,y-x) if x_<=y: ans=min(ans,y-x_+1) if x_<=y_: ans=min(ans,y_-x_+2) if x<=y_: ans=min(ans,y_-x+1) print(ans)
p02797
s656887992
Accepted
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N,K,S=map(int,input().split()) if S<10**9: L=[S]*K+[S+1]*(N-K) else: L=[S]*K+[S-1]*(N-K) print(*L) resolve()
p03352
s304163326
Wrong Answer
from bisect import * A = {1} for p in range(2,11): for b in range(1,33): A.add(p**b) A = list(A) A.sort() X = int(input()) print(A[bisect_right(A,X)-1])
p03860
s380116242
Accepted
s = list(map(str, input().split())) print("A",s[1][0],"C",sep="")
p02724
s483078935
Wrong Answer
X = int(input()) u = 1000*(X//500) + 5*((X%1000)//5) print(u)
p03495
s340071266
Accepted
__DEUBG__ = 0 from collections import Counter N, K = map(int, input().split()) balls = map(int, input().split()) balls = Counter(balls) b2 = sorted(balls.items(), key=lambda item: item[1], reverse=True) uniq_num = len(balls) if __DEUBG__: print('\n'*2) print(len(balls)) print(balls) print(b2) if uniq_num <= K: print(0) else: total = 0 for i in range(uniq_num-K): tmp = b2.pop() if __DEUBG__: print(tmp) total += tmp[-1] print(total)
p03778
s223792836
Wrong Answer
w,a,b = map(int,input().split()) #print(w,a,b) if a+w == b: print(0) elif a+w < b: print(b-(a+w)) elif a < b and b < a+w: print(0) elif a == b: print(0)
p03067
s104624534
Wrong Answer
a,b,c= map(int, input().split()) if a<c<b or b<c<b: print("Yes") else: print("No")
p03331
s400053767
Wrong Answer
N = int(input()) cmin = 10**5 for x in range(1,N-1): y = str(N-x) x = str(x) cnt = 0 for i in range(len(x)): cnt += int(x[i]) for j in range(len(y)): cnt += int(y[j]) cmin = min(cmin,cnt) print(cmin)
p03544
s567970888
Wrong Answer
N = int(input()) L_0 = 2 L_1 = 1 cur = 0 for i in range(N): if i==0: cur = L_0 elif i==1: prev = L_1 cur += L_1 else: tmp = cur cur += prev prev = tmp print(cur)
p02789
s981976854
Accepted
n, m = map(int, input().split()) if n == m: print('Yes') else: print('No')
p03785
s211078520
Wrong Answer
N,C,K = map(int,input().split()) T = [] for _ in range(N): t = int(input()) T.append(t) T.sort() angry = 0 ans = 0 c = 0 for i in T: if angry == 0: angry = i + K c += 1 if i >= angry : #print(i,angry) angry = i + K ans += 1 c = 1 if c == C: angry = 0 ans += 1 c = 0 #print(ans,angry,c) if c > 0: ans += 1 print(ans)
p03282
s730978947
Wrong Answer
s = input() k = int(input()) all1 = True if len(s) > k: for i in range(k): if s[i] != '1': all1 = False if all1: print(s[k-1]) exit() if s[0] == '1': if len(s) == 1: print(s[0]) else: print(s[1]) else: print(s[0])
p02598
s137763126
Accepted
import math n,k=map(int,input().split()) a=list(map(int,input().split())) l,r=0,10**9 f=0 while r-l>1: m=(l+r)//2 count=0 for i in a: count+=math.ceil(i/m)-1 if count<=k: r=m else: l=m print(r)
p02657
s383525994
Accepted
a, b = map(int, input().split()) answer = (a * b) print(answer)
p03331
s602305415
Wrong Answer
def soma(n): x = sum(int(digit) for digit in str(n)) if x < 10: return x else: return soma(x) def main(): n = int(input()) somad = soma(n) # soma(n)+soma(0) n-=n%10 while(n>=1): somaf=soma(n-1)+1 if(somaf>somad): somad=somaf n=n//10 print(somad,"\n") main()
p02983
s263952911
Accepted
L,R=map(int,input().split()) left,right=L%2019,R%2019 print(0 if R-L>=2019 else min([i*j%2019 for i in range(left,right+1) for j in range(i+1,right+1)]))
p03836
s059976821
Wrong Answer
# dijkstraで解く # 格子上の最短経路,障害なし,なのでまっすぐ行って帰るを繰り返す sx, sy, tx, ty = map(int, input().split()) dx = tx - sx dy = ty - sy ans = "" # s -> t ans += "U" * dy ans += "R" * dx # t -> s ans += "D" * dy ans += "L" * dx # 1マス外側 s -> t ans += "L" ans += "U" * (dy + 1) ans += "R" * (dx + 1) ans += "D" # 1マス外側 t -> s ans += "R" ans +=" D" * (dy + 1) ans += "L" * (dx + 1) ans += "U" print(ans)
p03487
s273611284
Wrong Answer
n = int(input()) a = list(map(int, input().split())) delete = 0 for i in range(n): if a.count(i) < i: delete += a.count(i) elif a.count(i) > i: delete += a.count(i) - i print(delete)
p02916
s762104114
Accepted
n = int(input()) a = list(map(int, input().split())) result = sum(map(int, input().split())) c = list(map(int, input().split())) for i in range(n-1): if a[i] == a[i+1]-1: result += c[a[i]-1] print(result)
p02678
s798748967
Accepted
from collections import deque n,m=map(int,input().split()) maze=[[]for i in range(n)] for i in range(m): r,l=map(int,input().split()) maze[r-1].append(l-1) maze[l-1].append(r-1) stamp=[-1]*n queue=deque([0]) while queue: d=queue.popleft() for i in maze[d]: if stamp[i]==-1: stamp[i]=d queue.append(i) print("Yes") for i in range(1,n,1): print(stamp[i]+1)
p02597
s083346612
Accepted
N=int(input()) c=input() C=[] for i in range(N): C.append(c[i]) num= C.count("W") CC=C[(N-num):] numnum=CC.count("W") print(num-numnum)
p03795
s946957381
Accepted
N = int(input()) print(N*800-N//15*200)
p03379
s117470539
Wrong Answer
n=int(input()) x=list(map(int,input().split())) X = sorted(x) for i in range(n): if x[i] <= X[n//2-1]: print(X[n//2]) elif x[i] >= x[n//2]: print(X[n//2-1])
p03835
s634821781
Wrong Answer
K, S = map(int, input().split()) ans = 0 for X in range(K+1): for Y in range(K+1): Z = K -(X + Y) if 0 <= Z <= K: ans += 1 print(ans)
p02862
s827527158
Wrong Answer
def fact(n,mod): ret=1 for i in range(2,n+1): ret=(ret*i)%mod return ret def pCq(p,q,mod): pCq=1 for i in range(q): pCq*=p-i pCq=pCq%mod den=fact(q,mod) inv=pow(den,mod-2,mod) pCq=(pCq*inv)%mod return pCq X,Y=map(int,input().split()) MOD=10**9+7 ans=0 n,m=2*X-Y,2*Y-X if n%3==0 and m%3==0: n//=3 m//=3 ans=pCq(m+n,min(m,n),MOD) print(ans)
p03319
s432878009
Wrong Answer
n,k=map(int,input().split()) a=list(map(int,input().split())) import numpy as np a=np.array(a) temp=np.argmin(a) import math ans=math.ceil(temp/(k-1))+math.ceil((n-temp)/(k-1)) print(ans)
p03943
s070028942
Wrong Answer
a,b,c = map(int,input().split()) #print(a,b,c) if a+b == c or b+c == a or c+a == b: print("YES") else: print("NO")
p03681
s907079182
Accepted
n,m = map(int, input().split()) if abs(n-m) > 1: print(0) exit() mod = 10**9+7 ans = 1 for i in range(1,n+1): ans *= i ans %= mod for i in range(1,m+1): ans *= i ans %= mod if (n+m)%2 == 0: ans *= 2 ans %= mod print(ans)
p03211
s746496857
Accepted
S=input() N=len(S) lst=[abs(int(S[i:i+3])-753) for i in range(N-2)] print(min(lst))
p02988
s222610696
Accepted
n=int(input()) p=list(map(int,input().split())) ans=0 for i in range(1,n-1): if sorted([p[i-1],p[i],p[i+1]])[1]==p[i]:ans+=1 print(ans)
p03565
s288140193
Accepted
S = input() N = len(S) T = input() M = len(T) st = -1 for i in range(N-M, -1, -1): if all(S[i+j] in (T[j], "?") for j in range(M)): st = i break newS = S.replace("?", "a") if st == -1: print("UNRESTORABLE") else: ans = "" for i in range(N): if st <= i <= st+M-1: ans += T[i-st] else: ans += newS[i] print(ans)
p04012
s610163442
Accepted
from collections import defaultdict w = input() d = defaultdict(int) for key in w: d[key] += 1 for value in d.values(): if value % 2 != 0: print('No') exit() print('Yes')
p02768
s648931575
Wrong Answer
n, a, b = map(int, input().split()) law = 10 ** 9 + 7 def fermat(n, r, law): x = 1 y = 1 for i in range(r): x = x * (n - i) % law y = y * (i + 1) % law ans = x * pow(y, law - 2, law) return ans print((pow(2,n,law)- fermat(n,a,law)-fermat(n,b,law))%law)
p03659
s279958715
Wrong Answer
N = int(input()) A = list(map(int, input().split())) s = sum(A) ans = abs(s - A[0]*2) for i in range(1,N-1): ans = min(ans, abs(ans - 2*A[i])) print(ans)
p03106
s061635316
Wrong Answer
A,B,K=map(int,input().split()) S=[] for i in range(1,101): if A%i==0 and B%i==0: S.append(i) S.sort(reverse=True) print(S) print(S[K-1])
p03910
s126739917
Accepted
from collections import deque n = int(input()) s = lambda i: i * (i+1) // 2 ans = deque() for i in range(1, 10**7): ans.append(i) if s(i) >= n: ans = list(ans) if s(i) > n: ans.pop(s(i) - n - 1) break print(*ans, sep="\n")
p03012
s456050894
Accepted
N = int(input()) W = list(map(int, input().split())) m = 10**10 for i in range(1, N): a, b = 0, 0 for j in range(i): a += W[j] for j in range(i, N): b += W[j] m = min(m, abs(a-b)) print(m)
p02725
s926455014
Wrong Answer
class atcorder: K,N=map(int,input().split()) A=list(map(int,input().split())) ans=0 i=N-1 if A[i]-A[i-1]<K-A[i]+A[0]: for n in range(i): ans+=A[i-n]-A[i-n-1] else: ans+=K-A[i]-A[0] for n in range(i-1): ans+=abs(A[n]-A[n+1]) print(ans)
p02777
s924702655
Accepted
def get_ints(): return map(int, input().split()) s, t = input().split() a, b = get_ints() u = input() if u == s: print(str(a - 1) + ' ' + str(b)) else: print(str(a) + ' ' + str(b - 1))
p02660
s088544795
Accepted
n = int(input()) p = 2 ans = 0 while n > 1: if p > 10 ** 6: ans += 1 break e = 1 while n % (p ** e) == 0: n = n // (p ** e) e += 1 ans += 1 while n % p == 0: n = n // p p += 1 print(ans)
p02658
s863914378
Accepted
N = int(input()) A = list(map(int, input().split())) ans = 1 if 0 in A: print(0) exit() for i in range(len(A)): ans *= A[i] if ans > 10 ** 18: print(-1) exit() print(ans)
p02742
s956452672
Accepted
h, w = map(int, input().split()) if h == 1 or w == 1: print(1) elif h * w % 2 == 0: print(h * w // 2) else: print(h * w // 2 + 1)
p02795
s010657418
Accepted
H=int(input()) W=int(input()) N=int(input()) import math print(math.ceil(N/(max(H,W))))
p03799
s719713568
Wrong Answer
N, M = map(int, input().split()) ans = 0 x = (M-2*N) // 4 r = min(10, M//2) for i in range(max(0, x-r), x+r): tmp = min(N+i, (M-2*i)//2) ans = max(ans, tmp) print(ans)
p03698
s525697061
Accepted
# import bisect # import copy # import fractions # import math # import numpy as np # from collections import Counter, deque # from itertools import accumulate,permutations, combinations,combinations_with_replacement,product def resolve(): S=str(input()) print('yes' if len(S)==len(set(S)) else 'no') resolve()
p03377
s906017908
Accepted
a,b,x = map(int,input().split()) if a <= x <= a+b: print("YES") else: print("NO")
p03419
s383335628
Accepted
n,m = map(int,input().split()) n, m = min(n,m),max(n,m) if n == 1 and m == 1: print(1) elif n == 1: print(m-2) elif n == 2: print(0) else: print((n*m)-(2*n)-(2*m)+4)
p03327
s072172394
Wrong Answer
print(['ABD', 'ABC'][int(input())//1000])
p03380
s537426153
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() candi = a[-1] middle = (candi - 1) / 2 tmp = float("inf") ans = 0 for i in range(len(a) - 1): if tmp >= abs(a[i] - middle): tmp = abs(a[i] - middle) ans = i print(candi, a[ans])
p02697
s226040931
Accepted
N, M = list(map(int, input().split())) if N % 2 == 1: for i in range(1, M+1): print(i, N-i+1) else: for i in range(1, M+1): if i % 2 == 1: print(N//2+M//2 -i//2, N//2+ M//2 - i//2 + i) else: print(M//2 + 1 - i//2, M//2 + 1 - i//2 + i)
p03494
s052824594
Accepted
n=int(input()) nums=list(map(int,input().split())) cnt=0 flag=0 while flag is 0: for i in range(n): num=nums[0]/2 key=nums[0]%2 if key==1: flag=1 break else: del nums[0] nums.append(num) if flag==0: cnt+=1 print(cnt)
p03705
s609828729
Accepted
N, A, B = map(int, input().split()) if A > B: print(0) exit() elif A == B: print(1) exit() else: if N == 1: print(0) exit() ans = (B * (N - 1) + A) - (A * (N - 1) + B) + 1 print(ans)
p03659
s781561938
Accepted
n = int(input()) a = [int(i) for i in input().split()] x, y = a[0], sum(a) - a[0] r = abs(x-y) for i in range(1, n-1): x += a[i] y -= a[i] r = min(r, abs(x-y)) print(r)
p02547
s220589891
Accepted
def get_pair(): return map(int, input().split()) cnt = 0 ans = "No" for idx in range(int(input())): D1, D2 = get_pair() if D1 == D2: cnt += 1 else: cnt = 0 if cnt >= 3: ans = "Yes" break print(ans)
p02553
s521146913
Accepted
# -*- coding: utf-8 -*- a, b, c, d = map(int, input().split()) print(max(a*c, a*d, b*c, b*d))
p03474
s696935940
Accepted
A,B=map(int,input().split()) s=input() S=[s[i] for i in range(len(s))] N=A+B+1 c=0 num={str(i) for i in range(10)} if S[A]=='-' and len(S)==N: c=1 S.pop(A) for i in range(N-1): if 1-(S[i] in num): c=0 if c==1: print('Yes') else: print('No')
p03062
s634314179
Wrong Answer
n=int(input()) l=[*map(int,input().split())] c=0 for e,i in enumerate(l): if i<0: c+=1 l[e]=-i print(sum(l)-[0,min(l)*2][i%2 and l.count(0)>0])
p03163
s972594167
Accepted
import sys input = sys.stdin.readline n,w = map(int,input().split()) wv = [tuple(map(int,input().split())) for i in range(n)] dp = [0]*(w+1) for i in range(n): for j in range(w,wv[i][0]-1,-1): dp[j] = max(dp[j],dp[j-wv[i][0]]+wv[i][1]) print(max(dp))
p03705
s972896787
Accepted
#template from collections import Counter def inputlist(): return [int(j) for j in input().split()] #template N,A,B = inputlist() if A>B: print(0) exit() ans = (B-A)*(N-2) +1 if ans <=0: ans = 0 print(ans)
p03069
s190363007
Accepted
n = int(input()) s = input() black = [] white = [] cb=0 cw=0 for l in s: if l =="#": cb+=1 else: cw+=1 black.append(cb) white.append(cw) if n == 1: print(0) else: ans = [white[-1],black[-1]] for i in range(n): ans.append(black[i-1]+white[-1]-white[i-1]) print(min(ans))
p02963
s015531538
Accepted
from math import ceil S = int(input()) ax, ay = 10 ** 9 , 1 by = ceil(S / 10 ** 9) bx = 10 ** 9 * by - S print(0, 0, ax, ay, bx, by)
p03264
s273435371
Accepted
n = int(input()) pares=0 for i in range(1, n): for j in range(0, n-i): if((i%2==0 and (n-j)%2!=0) or (i%2!=0 and (n-j)%2==0)): pares+=1 print(pares)
p03137
s407007008
Accepted
N, M = map(int, input().split()) x = sorted(list(map(int, input().split()))) dis = sorted([x[i] - x[i-1] for i in range(1, M)]) if N < M: print(sum(dis[:M-N])) else: print(0)
p02554
s732228716
Wrong Answer
mod=10**9+7 def Ch(n,r): res=1 for i in range (n,n-r,-1): res*=(i%mod) res%=mod return res n=int(input()) ans=0 for zero in range(1,9): for nine in range(1,10-zero): ans+=((Ch(n,zero)*Ch(n-zero,nine))%mod)*(8**(n-zero-nine)%mod) ans%=mod
p02847
s561013040
Accepted
s=input() if s=='SUN': print(7) elif s=='MON': print(6) elif s=='TUE': print(5) elif s=='WED': print(4) elif s=='THU': print(3) elif s=='FRI': print(2) elif s=='SAT': print(1)
p02657
s191979608
Wrong Answer
print(2*5) print(100*100)
p03243
s698145432
Accepted
#ABC111 n = int(input()) for i in range(10): if i * 111 < n <= (i+1)*111: print((i+1)*111) break