problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02639 | s559469358 | Accepted | A= list(map(int, input().split()))
for i in range(5):
if A[i] == 0:
print(i+1) |
p03282 | s234535564 | Accepted | S = [int(n) for n in list(input())]
K = int(input())
c = 0
for i in range(len(S)):
s = S[i]
if s == 1:
c += 1
else:
k = 0
while c < K:
c += k ** s
k += 1
if c >= K:
print(s)
break |
p03759 | s402876313 | Accepted | a,b,c=map(int,input().split())
print("YES" if b-a==c-b else "NO") |
p03624 | s506738368 | Accepted | S=input()
dp=[0]*26
for i in S:
dp[ord(i)-97]=1
for i in range(26):
if dp[i]==0:
print(chr(i+97))
exit()
print('None') |
p03745 | s802076798 | Accepted | n = int(input())
a = list(map(int,input().split()))
cnt,i = 0,0
while i<n:
while i+1<n and a[i]==a[i+1]: i+=1
if i+1<n and a[i]<a[i+1]:
while i+1<n and a[i]<=a[i+1]: i+=1
elif i+1<n and a[i]>a[i+1]:
while i+1<n and a[i]>=a[i+1]: i+=1
cnt+=1
i+=1
print(cnt) |
p03274 | s261206891 | Accepted | n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**9
for i in range(n-k+1):
l=x[i]
r=x[i+k-1]
a=abs(l)+abs(l-r)
b=abs(r)+abs(l-r)
c=min(a,b)
ans=min(c,ans)
print(ans) |
p02832 | s339527952 | Accepted | #python3
def main():
n = int(input())
a = [int(i) for i in input().split()]
k = 1
for i in range(n):
if a[i] == k:
k += 1
k -= 1
print(n - k) if k else print(-1)
main() |
p02697 | s555050346 | Accepted | N,M=map(int,input().split())
if N%2==1:
for i in range(1,M+1):
a,b=i,N-i+1
print(a,b)
else:
t=0
for i in range(1,M+1):
a,b=i,N-i
if (a-1)+(N+1-b)>=b-a:
t=1
a+=t
print(a,b) |
p02912 | s200036275 | Wrong Answer | N,M=map(int,input().split())
a = [0]+list(map(int,input().split()))
a.sort(reverse=True)
for i in range(N):
while M > 0 and 2*a[i]>=a[i+1]:
a[i] //= 2
M -= 1
if M == 0:
break
print(sum(a)) |
p02848 | s153485245 | Accepted | n=int(input())
S=input()
print("".join(chr(65+(ord(s)-65+n)%26)for s in S)) |
p03073 | s160681371 | Wrong Answer | from collections import Counter
S = str(input())
S_ = Counter(S)
v,c =zip(*S_.most_common())
ans = 0
if len(c) == 1 and len(S) == 1:
ans = 0
elif len(c) == 1 and len(S) > 1:
ans = c[0]//2
elif len(c) > 1 and abs(c[1]-c[0]) == 1:
ans = 0
elif len(c) > 1 and abs(c[1]-c[0]) != 1:
ans = abs(c[1] - c[0])
print(ans) |
p03633 | s043735113 | Accepted | import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
t=int(input())
ans=(ans*t)//fractions.gcd(t,ans)
print(ans)
|
p02972 | s321535689 | Wrong Answer | import numpy as np
N = int(input())
A = [0]
A += list(map(int,input().split()))
searchedMax = N
ans = 0
while searchedMax>=1:
half = int(searchedMax/2)+1
#ans += sum(A[half:searchedMax])
for i,a in enumerate(A[half:searchedMax+1]):
ind = i+half
ans += a
if ind%2 == 0:
A... |
p02785 | s473842120 | Accepted | import math
n,k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
if n <= k:
print(0)
else:
x = n - k
del h[0:k]
ans = sum(h)
print(ans) |
p02829 | s025697427 | Accepted | f = int(input())
s = int(input())
lst = [1, 2, 3]
lst.remove(f)
lst.remove(s)
print(lst[0]) |
p03633 | s761958608 | Accepted | from fractions import gcd
N = int(input())
rows = [int(input()) for _ in range(N)]
def lcm(x, y):
return (x * y) // gcd(x, y)
ans = 1
for num in rows:
ans = lcm(ans,num)
print(ans) |
p03698 | s910077761 | Accepted | s = list(input().strip())
s.sort()
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
print('no')
exit()
print('yes')
|
p02602 | s071025773 | Wrong Answer | #dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]
n,k = ip()
x = ip()
prev = 1
for i in range(k):
prev *= x[i]
ans = []
for i in range(k,n):
now = prev*x[i]//x[i-k-1]
if now > prev:
ans.append('Ye... |
p02688 | s725672199 | Accepted | N,K = map(int, input().split())
A=[]
d=[0 for i in range(K)]
recode={}
for i in range(K):
d[i]=int(input())
a=list(map(int, input().split()))
A.append(a)
for i in range(K):
for j in range(d[i]):
recode[A[i][j]]=1
count=0
for i in range(1,N+1):
if i in recode.keys():
continue
else... |
p02702 | s783644212 | Accepted | from collections import Counter
S = input()
N = len(S)
dp = [0] * N
dp[N-1] = int(S[N-1])
times = 10
for i in reversed(range(1, N)):
dp[i-1] = (dp[i] + times * int(S[i-1])) % 2019
times *= 10
times %= 2019
T = Counter(dp)
ans = T[0]
for t in T.values():
ans += t*(t-1)//2
print(ans) |
p02630 | s075975678 | Accepted | N = int(input())
A = list(map(int,input().split()))
Q = int(input())
bcs = []
for i in range(Q):
j,k = map(int,input().split())
bcs.append([j,k])
s = sum(A)
cnts = [0]*100000
for a in A:
cnts[a-1]+=1
for b,c in bcs:
t = cnts[b-1]
s -= t * b
cnts[b-1]=0
cnts[c-1]+=t
s += t*c
print(s) |
p03281 | s866512291 | Accepted | N = int(input())
ans = 0
for i in range(1, N + 1, 2):
c = 0
for j in range(1, i + 1):
if i % j == 0:
c += 1
if c == 8:
ans += 1
print(ans) |
p02640 | s026377386 | Accepted | N, M = map(int,input().split())
kameasi = 4 * N
if M == kameasi:
print('Yes')
exit()
for i in range(1,N+1):
# 足の数
f = kameasi - 2*i
if f == M:
print('Yes')
break
else:
print('No') |
p03471 | s821412206 | Wrong Answer | n,y=map(int,input().split())
flag=0
total = 0
flag = 0
for i in range(n+1):
for j in range(n+1):
k=n-i-j
if k<0:
break
total=10000*i-5000*j+1000*k
if total==y:
print(i,j,k)
flag=1
break
if flag == 1:
break
if flag==0:
... |
p02597 | s891244538 | Accepted | n=int(input())
p = input()
w, r = 0,0
for i in range(n):
if p[i] == "W":
w += 1
else:
r += 1
ans = n
noww , nowr = 0,0
for i in range(n+1):
ans = min ( ans , max(noww , r - nowr))
if i < n and p[i] == "W":
noww += 1
else:
nowr += 1
print(ans) |
p03774 | s787199874 | Accepted | n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
for a,b in ab:
ans = []
for c,d in cd:
ans.append(abs(a-c)+abs(b-d))
print(ans.index(min(ans))+1) |
p03087 | s776992590 | Wrong Answer | n,m=map(int,input().split())
q=input()
l=[list(map(int,input().split())) for _ in range(m)]
print(n,m,q,l)
ans=0
lst_j=[0]*(n+1)
for i in range(n-1):
cnt=0
if q[i]+q[i+1]=="AC":
cnt=1
lst_j[i+1]=cnt+lst_j[i]
else:lst_j[i+1]=lst_j[i]
for i,j in l:
ans=lst_j[j-1]-lst_j[i-1]
print(ans) |
p03665 | s691012067 | Accepted | N,P=map(int, input().split())
*A,=map(int, input().split())
even=sum(1 for a in A if a&1==0)
odd =sum(1 for a in A if a&1==1)
def comb(n, r):
p, q = 1, 1
for i in range(min(r,n-r)):
p *= n-i
q *= i+1
return p // q
ans=0
for i in range(P,odd+1,2):
ans+=comb(odd, i)
ans *= 1<<even
prin... |
p02663 | s388390264 | Accepted | a,b,c,d,e=map(int,input().split())
hour = int(e/60)
mint = e-hour*60
f = c-hour
g = d-mint
if f<0:
f=f-1
g=g+60
res = f*60 + g - a*60 - b
print(res) |
p03971 | s185530563 | Wrong Answer | N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
S = []
S = list(input())
print(S)
JS = 0
AS = 0
OT = 0
for i in range(N):
if S[i] == 'a' and A+B > JS+AS:
print('Yes')
JS += 1
elif S[i] == 'b' and A+B > JS+AS and AS < B:
print('Yes')
AS += 1
else:
print('No') |
p03607 | s867830030 | Wrong Answer | n=int(input())
A=[int(input()) for _ in range(n)]
B={}
for i in A:
if i in B:
B[i]=0
else:
B[i]=1
print(sum(B.values())) |
p03944 | s339763901 | Wrong Answer | w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
x, y, a = zip(*xya)
xl, xr, yb, yt = 0, w, 0, h
for i in range(n):
if a[i] == 1:
xl = max(xl, x[i])
elif a[i] == 2:
xr = min(xr, x[i])
elif a[i] == 3:
yb = max(yb, y[i])
else:
yt... |
p02701 | s253314032 | Accepted | N = int(input())
s = {input() for i in range(N)}
print(len(s)) |
p02899 | s573197092 | Accepted | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in range(n):
dic.setdefault(a[i],i+1)
ans = []
for i in range(1,n+1):
print(str(dic[i]),end='')
print(' ',end='')
|
p03241 | s404128837 | Accepted | n, m = map(int, input().split())
ans = 1
for i in range(1,int(m**0.5)+1):
if m%i: continue
if m//i>=n and i>ans: ans=i
if i>=n and m//i>=ans: ans=m//i
print(ans) |
p03773 | s774314891 | Accepted | a = list(map(int, input().split()))
b = a[0] + a[1]
print(b if b < 24 else b-24) |
p02778 | s864034866 | Accepted | s = str(input())
n = len(s)
print('x'*n) |
p02973 | s027594481 | Wrong Answer | def resolve():
import heapq
n = int(input())
a = [int(input()) for i in range(n)]
maxlist = [-1 * a[n-1]]
heapq.heapify(maxlist)
for i in range(n-2, -1, -1):
maxel = heapq.heappop(maxlist)
if -1 * a[i] > maxel:
heapq.heappush(maxlist, -1*a[i])
elif -1 * a[i] <... |
p03086 | s314676610 | Accepted | import re
ans = max(map(len, re.findall("[ACGT]*", input())))
print(ans) |
p03417 | s904649969 | Wrong Answer | # coding: utf-8
# https://atcoder.jp/contests/abc090/tasks/arc091_a
# 15:17-15:22 done
def main():
n, m = map(int, input().split())
return (n-2)*(m-2)
print(main())
|
p03971 | s633157175 | Accepted | N, A, B = [int(i) for i in input().split(" ")]
S = input()
cnt = 0
cnt_abroad = 0
for s in S:
if A + B <= cnt:
print("No")
continue
if s == "c":
print("No")
continue
if s == "a":
cnt += 1
print("Yes")
continue
if s == "b":
if B <= cnt_abroad:
print("No")
continue
... |
p03565 | s534417454 | Accepted | sd = input()
t = input()
n = len(sd)
m = len(t)
#s = []
for i in range(n - m, -1, -1):
t_kamo = sd[i : i + m]
for j in range(m + 1):
if j == m:
print((sd[: i] + t + sd[i + len(t):]).replace('?', 'a'))
quit()
if t_kamo[j] == '?':
continue
elif t_kamo[... |
p04011 | s119634195 | Accepted | # 044A
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
print(X * N)
else:
print(X * K + Y * (N - K)) |
p02640 | s442839289 | Wrong Answer | x, y = map(int, input().split())
for i in range(x+1):
for j in range(x+1):
if i + j <= x:
if i * 2 + j * 4 == y:
print("Yes")
exit()
print("No")
|
p02879 | s400726468 | Accepted | #1<=A<=20
#1<=B<=20
a, b = map(int, input( ).split())
if a<=9 and b<=9:
print(a*b)
#elseはifの条件ではないときに使う。
else:
print(-1) |
p04033 | s926263532 | Accepted | import sys
a,b=map(int,input().split())
if a>=0:
print("Positive")
sys.exit()
if b>=0:
print("Zero")
sys.exit()
if abs(a-b)%2==0:
print("Negative")
else:
print("Positive") |
p02957 | s578362335 | Accepted | A,B = [ int(i) for i in input().split() ]
print(int((A+B)//2) if (A+B)%2 == 0 else "IMPOSSIBLE")
|
p02778 | s891452503 | Accepted | s=input()
a=len(s)
b=str("x")*a
print(b) |
p03329 | s095101822 | Accepted | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
ans = float("inf")
def sub(x, base):
if x==0:
return 0
i = 0
while pow(base, i+1)<=x:
i += 1
return sub(x-pow(base,i), base) + 1... |
p03994 | s491869466 | Accepted | import string
abc = string.ascii_lowercase
s = list(input())
K = int(input())
index = 0
while K > 0:
if index == len(s) - 1:
s[index] = abc[(abc.index(s[index]) + K) % 26]
break
tmp = 26 - abc.index(s[index])
if tmp == 26:
index += 1
continue
if K >= tmp:
s[index]... |
p03705 | s251963219 | Accepted | n, a, b = map(int, input().split())
print(max(0,(a + (b * (n - 1))) - (b + (a * (n - 1))) + 1))
|
p02546 | s581208140 | Accepted | s = input()
if s[-1] == "s":
print(s + 'es')
else:
print(s + 's') |
p02775 | s359595334 | Wrong Answer | #!/usr/bin/env python3
# https://atcoder.jp/contests/abc155/tasks/abc155_e
n = int(input())
# n = 1198
# print(n)
d = []
keta = len(str(n))
cnt = 0
for i in range(1, keta + 1):
# print(f"{i} keta")
kazu = (n % (10 ** i)) // 10 ** (i -1)
if 0 <= kazu <= 5:
cnt += kazu
else:
cnt += (10 -... |
p02753 | s433497432 | Wrong Answer | S = [input()]
for i in range(len(S)-1):
if s[i] != s[i+1]:
print("Yes")
else:
print("No") |
p03338 | s925284162 | Accepted |
N = int(input())
S = list(input()) #1文字ずつ
ans=0
for i in range(1,N):
X = S[0:i]
Y = S[i:N]
cnt=0
# print('X.,Y:', X,Y)
als=[chr(ord('a') + i) for i in range(26)]
for al in als:
if (al in X) and (al in Y):
cnt+=1
ans=max(ans,cnt)
print(ans)
|
p02639 | s462745018 | Wrong Answer | x=list(map(int,input().split()))
for i in range(5):
if x[i]==0:
print(i) |
p02983 | s755797379 | Accepted | l, r = map(int, input().split())
mod = 2019
ans = 2222
if (r - l) // mod > 0:
ans = 0
else:
ans = 2020
for i in range(l, r + 1):
for j in range(i + 1, r + 1):
ans = min(ans, (i % mod) * (j % mod) % mod)
print(ans) |
p02916 | s054177277 | Accepted | mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys... |
p03208 | s615832695 | Accepted | N,K=map(int,input().split())
lst=[]
for i in range (N):
h=int(input())
lst.append(h)
lst.sort()
ans=10000000000
for i in range (N-K+1):
ans=min(ans,lst[i+K-1]-lst[i])
print(ans) |
p03836 | s954074591 | Accepted | import sys
import math
sx,sy,tx,ty = list(map(int,input().split()))
dy=ty-sy
dx=tx-sx
a=""
a+="U"*dy
a+="R"*dx
a+="D"*dy
a+="L"*dx
a+="L"
a+="U"*(dy+1)
a+="R"*(dx+1)
a+="D"
a+="R"
a+="D"*(dy+1)
a+="L"*(dx+1)
a+="U"
print(a) |
p02939 | s867576166 | Wrong Answer | s = input()
N = len(s)
i = 0
count = 0
while i < N-1:
if i == 0:
word = s[i]
i += 1
count += 1
last = 1
if s[i-1] == s[i]:
word = s[i:i+2]
i += 2
count += 1
last = 2
else:
word = s[i]
i += 1
count += 1
last = 1
... |
p04020 | s935737267 | Wrong Answer | import sys
from collections import Counter
from collections import deque
import math
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
n=int(input())
l=[0]*(n+1)
for i in range(n):
l[i+1]=int(input())
ans=0
for... |
p03943 | s639217079 | Accepted | l= sorted(list(map(int,input().split())))
if l[0] + l[1] == l[2]:
print('Yes')
else:
print('No') |
p03043 | s556042691 | Accepted | n,k=map(int, input().split())
ans=0
import math
for i in range(1,n+1):
sikou=math.ceil(math.log((k/i),2))
if sikou<0:
sikou=0
ans+=(1/n)*0.5**sikou
print(ans) |
p02630 | s122998372 | Accepted | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
n=int(input().rstrip())
a=[0]*(10**5+1)
now=0
for i in input().split():
a[int(i)]+=1
now+=int(i)
for _ in range(int(input().rstrip())):
b,c=map(int,input().split())
now-=b*a[b]
now+=c*a[b]
print(now)
a[b],a[c]=0,a[c]+a[b]
|
p03136 | s502939529 | Wrong Answer | n = int(input())
l = list(map(int, input().split()))
terms = (max(l) - (sum(l) - max(l)))
if terms:
print('Yes')
else:
print('No') |
p02705 | s932168353 | Wrong Answer | r = int(input())
pi = 3.1415926535
length = r * pi
print(length) |
p02598 | s938538625 | Accepted | import numpy as np
N, K = [int(x) for x in input().split()]
A = np.array([int(x) for x in input().split()])
I = np.array([1] * N)
L = np.max(A)
ans = L
low = 1
high = L
while 1:
if low == high:
ans = low
break
mid = (low + high) // 2
if np.sum((A - I) // mid) <= K:
high = mid... |
p03951 | s491062354 | Wrong Answer | n = int(input())
s = list(str(input()))
t = list(str(input()))
p = 0
ans = n * 2
for i in range(n):
if s[i] == t[0]:
for x in range(n-i):
if s[i + x] == t[x]:
p += 1
else:
ans -= p
break
print(ans)
|
p03434 | s420874231 | Accepted | N = input()
a = sorted(map(int, input().split()))[::-1]
print(sum(a[::2]) - sum(a[1::2])) |
p02946 | s539659771 | Wrong Answer | a,b=map(int,input().split())
c=[]
import sys
if a==1:
print(b)
sys.exit()
for i in range(a*2-1):
c+=str(b-a+i+1)
for i in range(a*2-1):
print(c[i],end=" ") |
p04033 | s613443175 | Wrong Answer | a = list(map(int,input().split()))
if a[0] != abs(a[0]) and a[1] != abs(a[1]):
print("Negative")
elif a[0] == abs(a[0]) and a[1] == abs(a[1]):
print("Positive")
elif a[0] == 0 or a[1] == 0:
print("Zero") |
p02817 | s146232656 | Wrong Answer | def string(s, t):
summ1 = 0
summ2 = 0
for i in range(len(s)):
summ1 += ord(s[i])
for j in range(len(t)):
summ2 += ord(t[j])
if summ1 > summ2:
print(t, end="")
print(s)
else:
print(s, end="")
print(t)
s, t = map(str, input().split())
string(s, t) |
p03095 | s896173283 | Accepted | n = int(input())
s = input()
count = [0]*26
for i in s:
count[ord(i)-ord("a")] += 1
mod = 10**9+7
ans = 1
for i in count:
ans *= (i+1)
ans %= mod
print(ans-1) |
p02677 | s556379423 | Accepted | import math
A,B,H,M = map(int,input().split())
c1 = (H/12+M/(60*12))*360
c2 = (M/60)*360
th = min(abs(c1-c2),abs(360-(c1-c2)))
th = (th / 180) * math.pi
print(math.sqrt((A**2)+(B**2)-2*A*B*math.cos(th)))
|
p02594 | s389893241 | Wrong Answer | t = 25
if (t >= 30):
print('Yes')
else:
print('No') |
p04019 | s762077275 | Accepted | # import collections
S = input()
# CS = collections.Counter(S)
# print(CS)
cn = S.count('N')
ce = S.count('E')
cs = S.count('S')
cw = S.count('W')
# print(cn, cs, cw, ce)
if cn > 0 and cs > 0 and ce == 0 and cw == 0:
print('Yes')
elif cn == 0 and cs == 0 and ce > 0 and cw > 0:
print('Yes')
elif cn > 0 and cs > ... |
p03327 | s417804961 | Accepted | n = int(input())
if n <= 999:
print('ABC')
else:
print('ABD') |
p02640 | s870253408 | Wrong Answer | x,y=map(int,input().split())
if x>1:
x=x-1
f=x*2+(x-1)*4
if f==y:
print("Yes")
else:
print("No")
exit()
if x==1:
if x*2==y or x*4==y:
print("Yes")
else:
print("No")
|
p03371 | s319078188 | Wrong Answer | a,b,c,x,y=map(int,input().split())
ans=100000
for i in range(1,100001):
tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
ans=min(ans,tmp)
print(ans) |
p03339 | s204045133 | Wrong Answer | N = int(input())
S = input()
cnt = S.count('E')
for i in S:
if i == 'E':
cnt += 1
if i == 'W':
cnt -= 1
print(cnt) |
p03261 | s190913357 | Accepted | n = int(input())
before = ''
said = set([])
f = True
for i in range(n):
if i==0:
before = input()
said.add(before)
continue
s = input()
if before[-1] != s[0] or s in said:
f = False
before = s
said.add(s)
print('Yes' if f else 'No')
|
p03407 | s738362727 | Wrong Answer | a,b,c=map(int,input().split())
if a==c or b==c or a+b==c:
print("Yes")
else:
print("No") |
p03327 | s259644463 | Accepted | N=int(input())
if N<=999:
print("ABC")
else:
print("ABD") |
p02633 | s580894227 | Wrong Answer | import math
n=int(input())
n=180-n
ans=360//(180-n)
print(ans)
|
p03069 | s158543690 | Wrong Answer | N = int(input())
S = input()
if '.' not in S:
print(0)
exit()
elif '#' not in S:
print(0)
exit()
black_sum = 0
white_sum = 0
for i in range(N):
if S[i] == '#':
black_sum += 1
else:
white_sum += 1
left_black = 0
right_white = white_sum
min_sum = 10 ** 9
for i in range(N):
i... |
p02789 | s356008663 | Wrong Answer | M, N = input().split()
M = int(M)
N = int(N)
if M == N:
print("YES")
else:
print("NO") |
p02689 | s452283184 | Accepted | n,m = map(int,input().split())
h = list(map(int,input().split()))
ma = [0]*(n)
for i in range(m):
a,b = map(lambda x: int(x)-1,input().split())
ma[a] = max(ma[a], h[b])
ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
if h[i]>ma[i]:
ans+=1
print(ans)
|
p02676 | s627025036 | Accepted | num = int(input())
s = input()
if len(s) <= num:
print(s)
else:
print(s[:num] + '...') |
p03419 | s994444998 | Accepted | def main():
N, M = map(int, input().split())
if N >= 3 and M >= 3:
ans = (N-2)*(M-2)
elif N == 2 or M == 2:
ans = 0
elif N == 1 and M == 1:
ans = 1
else:
S = max(N, M)
ans = max(0, S-2)
print(ans)
if __name__ == "__main__":
main()
|
p02658 | s767782250 | Accepted | n=int(input())
a=1
l=list(map(int,input().split()))
l.sort()
p=10**18
for i in l:
a*=i
if a>p:
print(-1)
exit()
print(a) |
p03067 | s200627384 | Accepted | a, b, c = map(int, input().split())
if a < c < b or b < c <a:
print("Yes")
else:
print("No") |
p02866 | s217627857 | Wrong Answer | from collections import Counter
N = int(input())
D = list(map(int, input().split()))
rank = []
C = Counter(D)
numberList = tuple(sorted(C))
MOD = 998244353
if numberList[-1] != len(numberList)-1:
print(0)
elif C[0] > 1:
print(0)
else:
ans = 1
for i in range(len(numberList)):
if i > 0:
... |
p03767 | s546813599 | Accepted | N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(N):
print
ans += a[i * 2 + 1]
print(ans) |
p02787 | s024400839 | Wrong Answer | import sys
h, n = map(int, input().split())
magic = []
a_max = 0
for i in range(n):
a, b = map(int, input().split())
a_max = max(a, a_max)
magic.append((a, b))
dp = [float('inf')] * (h + a_max)
dp[0] = 0
for i in range(h):
for a, b in magic:
if i + a > h + a_max:
continue
d... |
p03471 | s718692512 | Accepted | N, Y = map(int, input().split())
result = [-1, -1, -1]
# a = 0, 1, ..., N
for a in range(0, N + 1):
# b = 0, 1, ..., N-a
for b in range(0, N - a + 1):
c = N - a - b
if 10000 * a + 5000 * b + 1000 * c == Y:
result = [a, b, c]
print(*result) |
p02813 | s470917654 | Accepted | from itertools import permutations
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perm = list(permutations(range(1, N + 1)))
print(abs(perm.index(P) - perm.index(Q)))
|
p02695 | s802216241 | Wrong Answer | import itertools
n,m,q = map(int,input().split())
sc = []
for i in range(q):
a,b,c,d = map(int,input().split())
sc.append([a,b,c,d])
nums = [(i+1) for i in range(m+1)]
ans = 0
for balls in itertools.combinations_with_replacement(nums, n):
tp = 0
for i in range(q):
if balls[sc[i][1]-1]-balls[sc... |
p04044 | s989461410 | Accepted | n,l=map(int,input().split())
S=sorted([input() for i in range(n)])
for s in S:
print(s,end="") |
p03206 | s519899498 | Accepted |
D = int(input())
print("Christmas" + " Eve" * (25-D))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.