problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03998
|
s529721257
|
Wrong Answer
|
S = []
for i in range(3):
tmp = list(input())
S.append(tmp)
turn = 0
while True:
if len(S[turn]) == 0:
print(chr(ord('A')+turn))
break
turn = ord(S[turn][0]) - ord('a')
del S[turn][0]
|
p02859
|
s803759867
|
Accepted
|
print(int(input())**2)
|
p02780
|
s673094103
|
Wrong Answer
|
N, K = map(int, input().split())
P = [int(i) for i in input().split()]
s_max = sum(P[:K])
print(s_max)
s = s_max
for i in range(K, N):
print(P[i], P[i - K])
s = s + P[i] - P[i - K]
s_max = max(s_max, s)
print((s_max + K) / 2)
|
p02933
|
s921895541
|
Accepted
|
a=int(input())
s=input()
if a >= 3200 :
print(s)
else :
print('red')
|
p03385
|
s566614413
|
Accepted
|
print('YNeos'[len(set(list(input())))!=3::2])
|
p03815
|
s316729500
|
Accepted
|
x = int(input())
a = x // 11 * 2
b = x % 11
if 0 < b <= 6:
a += 1
elif b > 6:
a += 2
print(a)
|
p03557
|
s565508332
|
Accepted
|
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
i = bisect.bisect_left(A, b)
j = bisect.bisect_right(C, b)
ans += i*(n-j)
print(ans)
|
p03103
|
s132522288
|
Accepted
|
## C - Energy Drink Collector
N, M = map(int, input().split())
val = []
for n in range(N):
val.append( list(map(int, input().split())) )
val = sorted(val, reverse=False, key=lambda x: x[0])
ans = 0
for n in range(N):
if val[n][1] >= M:
ans += val[n][0] * M
break
else:
ans += val[n][0] * val[n][1]
M -= val[n][1]
print(ans)
|
p02924
|
s851298523
|
Accepted
|
n = int(input())
print(n*(n-1)//2)
|
p03761
|
s749399735
|
Accepted
|
N = int(input())
S = [input() for i in range(N)]
from collections import Counter
ctr = Counter(S[0])
for s in S[1:]:
ctr &= Counter(s)
ans = ''
for k,v in sorted(ctr.items()):
ans += k * v
print(ans)
|
p02780
|
s429473915
|
Accepted
|
n, k = map(int, input().split())
p = [(x+1)/2 for x in map(int, input().split())]
ans = sum(p[0:k])
prev = ans
for i in range(1, n - k + 1):
prev = prev - p[i - 1] + p[i + k - 1]
if ans < prev:
ans = prev
print(ans)
|
p02768
|
s411496115
|
Accepted
|
import sys
def input(): return sys.stdin.readline().rstrip()
from functools import reduce
def mod_comb4(n,r,mod=10**9+7):
num=reduce(lambda x,y:x*y%mod,range(n,n-r,-1))
den=reduce(lambda x,y:x*y%mod,range(1,r+1))
return num*pow(den,mod-2,mod)%mod
def main():
n,a,b=map(int,input().split())
mod=10**9+7
print((pow(2,n,mod)-1-mod_comb4(n,a)-mod_comb4(n,b))%mod)
if __name__=='__main__':
main()
|
p04005
|
s475730328
|
Accepted
|
l=list(map(int, input().split()))
l.sort()
if l[0]%2==0 or l[1]%2==0 or l[2]%2==0:
print(0)
else:
print(l[0]*l[1])
|
p03162
|
s374453378
|
Wrong Answer
|
n = int(input())
a = ([list(map(int, input().split())) for _ in range(n)])
dp = [[0,0,0] for _ in range(n)]
for i, a in enumerate(a):
dp_1 = dp[i-1]
dp[i][0] = max(dp_1[1], dp_1[2]) + a[0]
dp[i][1] = max(dp_1[0], dp_1[2]) + a[1]
dp[i][2] = max(dp_1[0], dp_1[1]) + a[2]
print(max(dp[n-1]))
|
p03220
|
s900516930
|
Wrong Answer
|
N=int(input())
T,A = map(int, input().split(' '))
places=[int(x) for x in input().split()]
diff = abs( A - T - places[-1]*0.006)
num = N
for i in range(N-1):
if diff > abs( A - T - places[i]*0.006):
diff = abs( A - T - places[i]*0.006)
num=i+1
print(num)
|
p03250
|
s620521124
|
Wrong Answer
|
a=list(map(int,input().split()))
a.sort()
print(a[0]*10+a[1]+a[2])
|
p02629
|
s928441770
|
Wrong Answer
|
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
INF = float('inf')
def main():
N = int(readline())
alphabet = 'zabcdefghijklmnopqrstuvwxyz'
A = []
ans = ''
while N>0:
ans = alphabet[N%26] + ans
N//=26
print(ans)
if __name__ == '__main__':
main()
|
p03408
|
s180059995
|
Accepted
|
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
Get = {}
for s in S:
if s in Get:
Get[s] += 1
else:
Get[s] = 1
for t in T:
if t in Get:
Get[t] += -1
else:
Get[t] = -1
ans = max(Get.values())
print(ans if ans > 0 else 0)
|
p02801
|
s988230499
|
Wrong Answer
|
# -*- coding: utf-8 -*-
import sys
alist = [
"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",
]
for s in sys.stdin:
i = 0
for a in alist:
if s == a:
print(alist[i+1])
i += 1
|
p02835
|
s172595236
|
Wrong Answer
|
a1,a2,a3 = map(int,input().split())
sum = a1 + a1 + a3
if sum >= 22:
print('bust')
elif sum <= 21:
print('win')
|
p02596
|
s767777202
|
Wrong Answer
|
k = int(input())
n = 0
for i in range(1, k+1):
n = (n * 10 + 7) % k
if n == 0:
print(i)
break
|
p02772
|
s766845152
|
Wrong Answer
|
N = input()
A = map(int,(input().split()))
output = 'APPROVED'
for n in A:
if (n % 2 == 0) and (n % 6 != 0) or (n % 10 != 0):
output = 'DENIED'
print(output)
|
p02951
|
s272212425
|
Accepted
|
a,b,c = map(int,input().split())
if a - b >= c:
print(0)
else:
print(c - a + b)
|
p03760
|
s800379464
|
Accepted
|
o = input()
e = input()
for i in range(len(e)):
print(o[i] + e[i], end="")
if len(o) > len(e):
print(o[-1], end="")
print()
|
p03380
|
s386585820
|
Wrong Answer
|
N=int(input())
A=list(map(int,input().split()))
if N==2:
print(*A)
else:
A=sorted(A)
ans1=A[-1]
del A[-1]
saidai=ans1/2
num=pow(10,9)
for n in range(N-1):
if abs(saidai-A[n])<num:
num=abs(saidai-A[n])
else:
ans2=n-1
print(ans1,A[ans2])
|
p03037
|
s585591473
|
Accepted
|
#!/usr/bin/env python3
n, m = list(map(int, input().split()))
min_, max_ = 0, 10**5
for i in range(m):
a, b = list(map(int, input().split()))
min_ = max(min_, a)
max_ = min(max_, b)
print(max(max_-min_+1, 0))
|
p03433
|
s158307231
|
Accepted
|
n = int(input())
a = int(input())
if n % 500 > a:
print("No")
else:
print("Yes")
|
p02811
|
s844289573
|
Accepted
|
import sys
import numpy as np
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
k,x=map(int,input().split())
if k*500>=x:
print("Yes")
else:
print("No")
|
p03861
|
s147181006
|
Wrong Answer
|
import math
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# ----------------------------------------
a, b, x = map(int, read().split())
'''
num = b - a + 1
arr = np.linspace(a, b, num)
div = np.where(arr % x == 0)
ans = div[0][0]
'''
if (b < x):
ans = 0
else:
if (a == 0):
ans = b // x - a // x + 1
else:
ans = b // x - a // x
print(ans)
|
p03285
|
s689905897
|
Accepted
|
N = int(input())
no_flag = True
for i in range((N//4)+1):
if no_flag == False:
break
for j in range((N//7)+1):
if no_flag == False:
break
if (4*i+7*j) == N:
print("Yes")
no_flag = False
if no_flag == True:
print("No")
|
p02725
|
s169370890
|
Wrong Answer
|
a,b = map(int,input().split())
c = [int(i) for i in input().split()]
result = c[-1] - c[0]
print(result)
|
p02705
|
s410319205
|
Accepted
|
import math
r = int(input())
print(math.pi * r* 2)
|
p03943
|
s242609991
|
Wrong Answer
|
l=list(map(int,input().split()))
print('Yes' if sum(l)%2 == 0 else 'No')
|
p02645
|
s214040353
|
Accepted
|
S = input()
print(S[:3])
|
p02842
|
s272450720
|
Accepted
|
N = int(input())
for i in range(1, N + 1):
if i + (i * 8) // 100 == N:
print(i)
break
else:
print(":(")
|
p02548
|
s950267163
|
Wrong Answer
|
N = int(input())
n=int(N**0.5)
print(n)
cnt=0
for i in range(1,n+1):
a=N//i
if a-i-1>0:
cnt+=(a-i-1)*2
if i**2!=N:
cnt+=1
if a*i<=N-1:
cnt+=2
print(cnt)
|
p03345
|
s031664571
|
Accepted
|
A,B,C,K=map(int,input().split())
if K%2==0:
print(A-B)
else:
print(B-A)
|
p03254
|
s630064177
|
Accepted
|
def resolve():
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
a = sorted(a)
for i in range(n):
if x < 0:
break
x -= a[i]
ans += 1
if x != 0:
ans -= 1
print(ans)
resolve()
|
p03814
|
s880828426
|
Accepted
|
s = input().rstrip('\r')
start = -1
end = -1
for i, c in enumerate(s):
if c == 'A' and start == -1:
start = i
if c == 'Z':
end = i
print(end-start+1)
|
p02641
|
s330282353
|
Accepted
|
import bisect
def main():
X, N = map(int, input().split())
if N == 0:
print(X)
return
P = set(map(int, input().split()))
NP = sorted(list(set(range(102)) - P))
right = bisect.bisect(NP, X)
left = right - 1
if left == -1 or abs(X - NP[left]) > abs(X - NP[right]):
print(NP[right])
else:
print(NP[left])
main()
|
p03773
|
s194863252
|
Accepted
|
A, B = map(int, input().split())
ans = A + B
if ans >= 24:
ans -= 24
print(ans)
|
p03331
|
s097775283
|
Accepted
|
import math
N = int(input())
if math.log10(N)%1 != 0:
K = str(N)
ans = 0
for i in range(len(K)):
ans += int(K[i])
print(ans)
else:
print(10)
|
p02707
|
s747512693
|
Wrong Answer
|
N = int(input())
numbers = input().strip().split(' ')
boss_dict = [0] * N
for i in range(N - 1):
boss_num = int(numbers[i])
boss_dict[boss_num] += 1
for boss in boss_dict:
print(boss)
|
p03730
|
s730379416
|
Accepted
|
a, b, c = map(int, input().split())
ans = "NO"
for i in range(b):
if (a*i)%b == c:
ans = "YES"
print(ans)
|
p02761
|
s352523978
|
Accepted
|
from collections import defaultdict as d
n, m = map(int, input().split())
dico = d(set)
tab = [-1] * n
for _ in range (m):
s, c = map(int, input().split())
dico[s].add(c)
if len(dico[s]) == 2:
print(-1)
exit()
tab[s - 1] = c
if n == 1:
print(max(0, tab[0]))
else:
if tab[0] == 0:
print(-1)
else:
if tab[0] == -1:
tab[0] = 1
f = ''
for i in tab:
if i == -1:
f += '0'
else:
f += str(i)
print (f)
|
p03767
|
s332047006
|
Wrong Answer
|
import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(n,2*n):
ans+=l[i]
print(ans)
resolve()
|
p03360
|
s578716523
|
Wrong Answer
|
ABC=list(map(int,input().split()))
K=int(input())
m=max(ABC)
s=sum(ABC)-m
print(m*2*K+s)
|
p02576
|
s238995783
|
Accepted
|
n,x,t=map(int, input().split())
tako = n//x
amari = n%x
ans = tako*t
if amari != 0:
ans += t
print(ans)
|
p02577
|
s830220742
|
Wrong Answer
|
def sum_digits_string(str1):
sum_digit = 0
for x in str1:
if x.isdigit() == True:
z = int(x)
sum_digit = sum_digit + z
return sum_digit
s=input()
ans=sum_digits_string(s)
if ans%9==0:
print("YES")
else:
print("NO")
|
p03645
|
s964952508
|
Accepted
|
N, M = map(int, input().split())
lst = []
for i in range(M):
a, b = map(int, input().split())
if a == 1:
lst.append(b)
elif b == N:
lst.append(a)
lst.sort()
flg = 0
for i in range(len(lst) - 1):
if lst[i] == lst[i + 1]:
flg = 1
break
if flg:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
p02714
|
s045871399
|
Accepted
|
#!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
n = int(readline())
s = list(readline().rstrip())
r = s.count(ord('R'))
g = s.count(ord('G'))
b = s.count(ord('B'))
count = r * g * b
for i in range(n):
for j in range(1, min(i + 1, n - i)):
if s[i - j] != s[i] and s[i] != s[i + j] and s[i - j] != s[i + j]:
count -= 1
print(count)
|
p02862
|
s460490371
|
Accepted
|
x,y = map(int,input().split())
m = 10**9+7
n = (x+y)//3
c = 0
if x*0.5 <= y <= 2*x and (x+y)%3 == 0:
r = x - n
c = 1
for i in range(1,r+1):
c *= (n-i+1) % m
c *= pow(i,m-2,m)
c = c % m
else:
ans = 0
print(c)
|
p03434
|
s455832900
|
Accepted
|
temp=input()
temp=input()
A=[int(x) for x in temp.split()]
A.sort(reverse=True)
sum=0
for x in range(len(A)):
sum=sum+(-1)**(x)*A[x]
print(sum)
|
p03719
|
s802159063
|
Accepted
|
A, B, C = map(int, input().split())
if A <= C <= B:
print("Yes")
else:
print("No")
|
p02744
|
s071276548
|
Accepted
|
n = int(input())
A = 'a'
S ='abcdefghij'
for _ in range(n-1):
A = [a + s for a in A for s in S[:len(set(a))+1]]
print(*A, sep='\n')
|
p03720
|
s858393255
|
Wrong Answer
|
N,M = map(int,input().split())
A = [0] * (N + 1)
for i in range(M):
a,b = map(int,input().split())
A[a] += 1
A[b] += 1
for a in A:
if a != 0:
print(a)
|
p03281
|
s561445150
|
Accepted
|
N=int(input())
ans=0
for i in range(1,N+1):
count=0
for j in range(1,i+1):
if i%j==0:
count+=1
if i%2==1 and count==8:
ans+=1
print(ans)
|
p03360
|
s115178711
|
Accepted
|
ABC=list(map(int,input().split()))
K=int(input())
m=max(ABC)
s=sum(ABC)-m
print(m*(2**K)+s)
|
p02946
|
s626780582
|
Accepted
|
k,x=[int(s) for s in input().split()]
print(*range(x-k+1,x+k))
|
p03150
|
s843217626
|
Accepted
|
S = input()
ans = "NO"
if S[:7] == "keyence" or S[-7:] == "keyence":
ans = "YES"
else:
w = "keyence"
for i in range(len(S)):
if w[i] == S[i]: continue
break
if w[i:] == S[-len(w[i:]):]: ans = "YES"
print(ans)
|
p03069
|
s055192438
|
Accepted
|
N = int(input())
S = input()
black_cnt = 0
white_cnt = 0
for i in range(N):
if S[i] == '#':
black_cnt += 1
else:
white_cnt += 1
ans = min(black_cnt, white_cnt)
tmp_ans = white_cnt
for i in range(N):
if S[i] == '#':
tmp_ans += 1
else:
tmp_ans -= 1
ans = min(ans, tmp_ans)
print(ans)
|
p03494
|
s006016709
|
Accepted
|
mylist = []
for i in range(0, 2):
val = input()
if ' ' in val:
mylist.append(val)
a = list((map (int,mylist[0].split(' '))))
cnt = 0
while True:
map (int,a)
if all(map(lambda x: x % 2 == 0, a)) == False:
break
a = list(map(lambda x:x//2,a))
cnt +=1
print (cnt)
|
p03455
|
s689915207
|
Accepted
|
a, b = map(int, input().split())
if a*b%2 == 0:
print("Even")
else:
print("Odd")
|
p02973
|
s172170811
|
Accepted
|
#!/usr/bin/env python3
import sys
from bisect import bisect_left
from bisect import bisect_right
INF = float("inf")
def main():
N = int(input())
A = [int(input()) for _ in range(N)]
dp = [INF]*N
for i in range(N):
j = bisect_right(dp, -A[i])
dp[j] = -A[i]
print(bisect_left(dp, INF))
if __name__ == '__main__':
main()
|
p02783
|
s420587325
|
Accepted
|
H, A = map(int, input().split())
print((H + A - 1) // A)
|
p03293
|
s280198448
|
Accepted
|
s=list(input())
t=list(input())
n=len(s)
for _ in range(n):
s=[s[n-1]]+s[:n-1]
if s==t:
print("Yes")
break
else:
print("No")
|
p03105
|
s529715240
|
Accepted
|
a,b,c = map(int,input().split())
count = int(b / a)
if count >= c:
print(c)
else:
print(count)
|
p03827
|
s348599995
|
Accepted
|
x = 0
mx = 0
n = int(input())
s = input()
for c in s:
if c == 'I':
x += 1
else:
x -= 1
mx = max(mx, x)
print(mx)
|
p02624
|
s613768452
|
Accepted
|
def calc(b, e):
cnt = e // b
return (b + e) * cnt // 2
n = int(input())
ans = 0
for i in range(1, n+1):
ans += calc(i, n//i * i)
print(ans)
|
p03041
|
s833055647
|
Accepted
|
N,K = map(int, input().split())
S = input()
T = ""
for i in range(N):
if i == K-1:
T += S[i].lower()
else:
T+= S[i]
print(T)
|
p02819
|
s173902616
|
Accepted
|
def primes(n,thr):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in range(thr, n + 1) if is_prime[i]]
def main():
X = int(input())
arr = primes(X+1000000, X)
print(arr[0])
main()
|
p04029
|
s695194467
|
Wrong Answer
|
N=int(input('子供は何人?'))
a=N*(N+1)/2
print(a)
|
p03328
|
s370153355
|
Accepted
|
a, b = map(int, input().split())
high = (b-a+1)*(b-a)//2
print(high-b)
|
p02773
|
s298975704
|
Accepted
|
N = int(input())
D = {}
ans = []
ansval = 0
for _ in range(N):
s = input()
if s not in D:
D[s] = 1
else:
D[s] += 1
if ansval == D[s]:
ans.append(s)
elif ansval < D[s]:
ans = [s]
ansval = D[s]
ans.sort()
for a in ans:
print(a)
|
p03681
|
s876757413
|
Accepted
|
n,m=map(int,input().split())
import math
a=math.factorial(n)
b=math.factorial(m)
if abs(n-m) > 1:
print(0)
elif abs(n-m)==1:
print((a*b)%(10**9+7))
else:
print((a*b*2)%(10**9+7))
|
p03042
|
s433932397
|
Accepted
|
s = input()
a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
print('AMBIGUOUS')
elif 0 <= a <= 99 and 1 <= b <= 12:
print('YYMM')
elif 0 <= b <= 99 and 1 <= a <= 12:
print('MMYY')
else:
print('NA')
|
p04019
|
s046990700
|
Wrong Answer
|
# coding:utf-8
S = input()
n = S.count('N')
s = -(S.count('S'))
e = S.count('E')
w = -(S.count('W'))
if n + s + e + w == 0:
print('Yes')
else:
print('No')
|
p02719
|
s598568874
|
Wrong Answer
|
N,K = map(int,input().split())
def replace(N,K):
if(N<K):
return N
else:
a = N%K
if (abs(a-K)<K and abs(a-K)<a):
a = abs(a-K)
return a
print(replace(N,K))
|
p02675
|
s351555450
|
Accepted
|
n = input()
if n[-1]=="3":
print("bon")
elif n[-1]=="0" or\
n[-1]=="1" or\
n[-1]=="6" or\
n[-1]=="8" :
print("pon")
else:
print("hon")
|
p02747
|
s189302449
|
Accepted
|
#def main(S, b):
if __name__ == '__main__':
s = input()
flag = 1
while (len(s) > 0):
if (s[:2] == "hi"):
s = s[2:]
else:
flag = 0
s = ""
if (flag):
print("Yes")
else:
print("No")
|
p03705
|
s004034142
|
Accepted
|
n, A, B = map(int, input().split())
if A > B:
print(0)
elif n == 1:
if A != B:
print(0)
else:
print(1)
else:
print((B - A) * (n - 2) + 1)
|
p03061
|
s146657499
|
Wrong Answer
|
import fractions
N=int(input())
A=list(map(int,input().split()))
A.append(A[0])
ans=0
for i in range(N):
val=fractions.gcd(A[i],A[i+1])
ans=max(ans,val)
print(ans)
|
p03821
|
s302825044
|
Accepted
|
N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
at = AB[-1][0]
bt = AB[-1][1]
if at % bt == 0:
cnt = 0
elif at > bt:
cnt = bt - (at % bt)
else:
cnt = bt - at
res = cnt
for tmp, b in reversed(AB[:-1]):
a = tmp + res
if a % b == 0:
continue
if a > b:
res += b - (a % b)
elif a < b:
res += b - a
# res += cnt
print(res)
|
p02768
|
s890185566
|
Wrong Answer
|
from scipy.misc import comb
n, a, b = map(int, input().split())
sum = 0
for i in range(1, n+1):
if i in (a, b):
continue
else:
sum += comb(n, i)
print(int(sum))
|
p03360
|
s928979397
|
Wrong Answer
|
def main():
line = input()
lista = [int(n) for n in line.split()]
k = int(input())
index = lista.index(max(lista))
lista[index] *= 2*k
soma = 0
for i in range(len(lista)):
soma += lista[i]
print(soma)
main()
|
p03799
|
s760692635
|
Accepted
|
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 12:32:15 2020
@author: shinba
"""
import sys
n,m = map(int,input().split())
if n >= int(m/2):
print(int(m/2))
sys.exit()
else:
m -= 2*n
print(n+int(m/4))
|
p02791
|
s291665798
|
Accepted
|
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_right
sys.setrecursionlimit(10**7)
N = int(input())
P = list(map(int, input().split()))
cnt = 0
minv = P[0]
for p in P:
minv = min(minv, p)
if p == minv:
cnt += 1
print(cnt)
|
p02778
|
s179659568
|
Accepted
|
s = input()
s_num = len(list(s))
result = ""
for i in range(s_num):
result += "x"
print(result)
|
p02953
|
s684039657
|
Wrong Answer
|
N = int(input())
Height = list(map(int, input().split()))
judge = 'Yes'
if (N == 1):
print(judge)
exit()
for i in range(N-2):
# if (Height[i] > Height[i+1]+1 or Height[i]+1 < Height[i+1]):
if (abs(Height[i]-Height[i+1]) >= 2):
judge = 'No'
if (Height[-2] > Height[-1]+1):
judge = 'No'
print(judge)
|
p03495
|
s701740254
|
Accepted
|
N, K = map(int,input().split())
A = list(map(int,input().split()))
li = {}
for i in A:
c = li.setdefault(i,0)
li[i] = c + 1
# print(c)
w = len(li.keys()) - K
# print(w)
# print(len(li.keys()))
ans = sorted(li.values())
# print(ans)
if w > 0:
print(sum(ans[:w]))
else:
print(0)
|
p02785
|
s322510466
|
Accepted
|
N, K = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H)[::-1]
ans = sum(H[K:])
print(ans)
|
p02818
|
s088090155
|
Accepted
|
a, b, k = map(int, input().split())
if k > a:
k -= a
a = 0
else:
a -= k
k = 0
if k > b:
b = 0
else:
b -= k
print("{} {}".format(a, b))
|
p02603
|
s637092401
|
Accepted
|
N = int(input())
List = list(map(int,input().split()))
ans = 1000
stock = 0
for i in range(1,N):
if List[i] > List[i-1]:
temp = ans
ans = temp%List[i-1]
stock += temp//List[i-1]
if List[i] < List[i-1]:
ans += stock*List[i-1]
stock = 0
if stock != 0:
ans += stock*List[-1]
print(ans)
|
p02743
|
s761354165
|
Accepted
|
a,b,c = map(int, input().split())
l = 4 * a * b
r = (c - a - b) * (c - a - b)
if c - a - b <= 0:
print("No")
elif c < a or c < b:
print("No")
elif l < r:
print("Yes")
else:
print("No")
|
p03163
|
s928391561
|
Accepted
|
import numpy as np
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
dp = np.zeros((N+1,W+1), int)
r = W+1
for i in range(1,N+1):
w, v = map(int, input().split())
dp[i,:w] = dp[i-1,:w]
dp[i,w:r] = np.maximum(dp[i-1,w:r], dp[i-1,:r-w]+v)
print(dp[N,W])
|
p02917
|
s797885262
|
Wrong Answer
|
def resolve():
n = int(input())
b = list(map(int, input().split()))
b = b[::-1]
blist = [0]*n
blist[0] = b[0]
for i in range(1,n-1):
if b[i] < blist[i-1]:
blist[i] = b[i]
else:
blist[i] = blist[i-1]
blist[n-1] = blist[n-2]
print(sum(blist))
resolve()
|
p02744
|
s286757972
|
Accepted
|
N = int(input())
a_num = 97
def dfs(s, n): #s: 現在の文字列, n: 残りの文字数, cnt: 現在の文字列の最大の値
if n == 0:
print(s)
return
for i in range(ord("a"), ord(max(s))+2):
dfs(s+chr(i), n-1)
dfs("a", N-1)
|
p03633
|
s878219026
|
Wrong Answer
|
n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]
for v in t:
if ans % v != 0:
if ans < v:
ans = v
else:
ans *= v
print(ans)
|
p03035
|
s693261921
|
Accepted
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
A, B = map(int, input().split())
if A >= 13:
print(B)
elif A >= 6:
print(int(B / 2))
else:
print(0)
if __name__ == "__main__":
main()
|
p03434
|
s620120602
|
Accepted
|
N=int(input())
A=sorted(list(map(int, input().split())), reverse=True)
bob=sum(A[1::2])
alice=sum(A[::2])
print(alice-bob)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.