problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02755 | s142459697 | Accepted | import math
a, b = map(int, input().split())
for i in range(1, 1250):
if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
print(i)
exit()
else:
print(-1) |
p02994 | s780721670 | Accepted | import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input()... |
p03077 | s094523127 | Accepted | n = int(input())
ns = [int(input()) for _ in range(5)]
print((n-1)//min(ns)+5) |
p04011 | s890853763 | Wrong Answer | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = K*X+(N-K)*Y
print(ans) |
p03241 | s886880352 | Accepted | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
n,m=map(int,input().split())
ans=1
for i in make_divisors(m):
if i>=n:
... |
p03799 | s766462569 | Wrong Answer | n, m = map(int, input().split())
c = n*2+m
print(c//4) |
p03481 | s646930907 | Wrong Answer | import math
x, y = map(int, input().split())
ans = int(math.log2(y) - math.log2(x))
print(ans + 1) |
p02712 | s566664571 | Accepted | n = int(input())
arr = [0 for i in range(n)]
for i in range(n):
it = i+1
if not ((it %3 == 0 and it%5==0) or it%3 == 0 or it%5 == 0):
arr[i] = i+1
# print(arr)
print(sum(arr)) |
p02959 | s985992168 | Wrong Answer | N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
B.append(0)
ans = 0
for i in range(N+1):
taosukazu1 = min(A[i],B[i])
B[i] -= taosukazu1
ans += taosukazu1
if B[i] > 0:
taosukazu2 = min(A[i+1],B[i])
B[i] -= taosukazu2
ans += taosukazu2
print(ans) |
p03339 | s822017992 | Wrong Answer | n=int(input())
s=input()
x=[0]*n
t=0
for i in range(n):
if s[i]=="E":
t+=1
x[i]=t
M=x[n-1]
c=0
ans=10**9
print(x)
for i in range(n):
ans=min(ans,i-c+M-x[i])
c=x[i]
print(ans) |
p02584 | s322417178 | Accepted | X, K, D = map(int,input().split())
res = 0
X = abs(X)
if X >= K * D:
res = X - K * D
else:
i = X // D
j = K - i
if j % 2 == 0:
res = X - D * i
else:
res = X - D * (i + 1)
print(abs(res)) |
p02820 | s364948675 | Accepted | from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)
from heapq import heapify, heappush, heappop, heappushpop, heapreplace
n, k = map(int, input().split())
r, s, p = map(int, input().split())
point = {'r':p, 's':r, 'p': s}
t = input()
ans = 0
for i in range(k):
j = i
prev = False
while j... |
p02657 | s839255390 | Accepted | A,B = map(int,input().split())
print(A*B) |
p02859 | s477568925 | Accepted | r = int(input())
print(r*r) |
p04043 | s026614250 | Wrong Answer | b = input().split() #aの文字列を空白で区切る
c = [int(s) for s in b] #bのそれぞれの要素に対して数値にしてリストに格納
print(c)
num5 = 0
num7 = 0
for i in range(len(c)):
if c[i] == 5:
num5 += 1
continue
if c[i] == 7:
num7 +=1
continue
if num5 == 2 and num7 == 1:
print("YES")
else:
print("NO") |
p03241 | s320854297 | Accepted | N,M = list(map(int,input().split()))
f=[]
for m in range(1,int(M**(1/2))+3):
if M % m == 0:
f.extend([m,M//m])
f.sort(reverse=True)
for f_ in f:
if N <= M/f_:
ans=f_
break
print(ans) |
p03331 | s525955640 | Accepted | n = input()
if int(n) % 10 == 0:
print(10)
else:
ans = 0
for i in n:
ans += int(i)
print(ans)
|
p03071 | s591890089 | Wrong Answer | A,B = list(map(int,input().split()))
if A >= B:
print(A*(A-1))
else:
print(B*(B-1)) |
p03221 | s359748075 | Accepted | import sys
n,m = map(int, sys.stdin.readline().rstrip("\n").split())
city = {}
yton = {}
for i in range(m):
p,y = map(int, sys.stdin.readline().rstrip("\n").split())
if p not in city.keys():
city[p] = []
city[p].append(y)
yton[y] = i
else:
city[p].append(y)
yton[y] = ... |
p02780 | s043784594 | Wrong Answer | n,k = map(int,input().split())
sai = sorted(list(map(int,input().split())),reverse=True)
for x in range(len(sai)):
sai[x] = ((sai[x]+1)*sai[x])/2/sai[x]
print(sum(sai[:k])) |
p04031 | s768168249 | Wrong Answer | from math import ceil
n = int(input())
numeros = list(map(int, input().split()))
y = ceil((max(numeros) + min(numeros))/2)
soma = 0
for v in numeros:
soma += (v-y)**2
print(soma)
|
p03086 | s219276689 | Accepted | import re
S = input()
m = re.findall(r"[ACGT]+", S)
if m:
print(max(map(len, m)))
else:
print(0) |
p02909 | s826593390 | Accepted | S=input()
if S=="Sunny" :
print("Cloudy")
else :
if S=="Cloudy" :
print("Rainy")
else :
print("Sunny")
|
p02817 | s540267400 | Accepted | s,t=input().split()
print(t+s) |
p02882 | s940661126 | Accepted | import math
a,b,x = map(int,input().split())
if 0.5*b*(a**2)<=x:
t = math.degrees(math.atan(2*(a**2*b-x)/(a**3)))
print(t)
else:
t = 90-math.degrees(math.atan(2*x/(a*(b**2))))
print(t) |
p03721 | s800810656 | Accepted | N,K=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N)]
A=sorted(A, key=lambda x: x[0])
cnt=0
for i in range(N):
a,b=A[i]
A[i][1]+=cnt
cnt=A[i][1]
for i in range(N):
a,b=A[i]
if K<=b:break
print(a)
|
p03472 | s444705355 | Wrong Answer | from collections import defaultdict,deque
import math
def main():
n,h=map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
tmp = max([int(i[0]) for i in ab])
bs = [int(i[1]) for i in ab]
bs.sort(reverse = True)
i = 0
while(bs[i] > tmp):
h-=bs[i]
... |
p03835 | s803926922 | Wrong Answer | k, s = map(int, input().split())
ans = 0
for x in range(k+1):
for y in range(k+1):
for z in range(s-x-y):
if 0<=z<=k and x+y+z==s:
ans += 1
print(ans) |
p03699 | s321813977 | Accepted | n = int(input())
s = list(int(input()) for i in range(n))
s.sort()
ans = sum(s)
if ans % 10 != 0:
print(ans)
exit()
else:
for x in s:
if x % 10 != 0:
ans -= x
print(ans)
exit()
print(0) |
p02621 | s138488589 | Accepted | a=int(input())
print(a+(a*a)+(a*a*a)) |
p02663 | s770937993 | Wrong Answer | h1,m1,h2,m2,k = map(int,input().split())
if m2 < m1:
m2 += 60
h1 -= 1
time = (h2 - h1) * 60 + (m2 - m1)
print(time - k)
|
p02881 | s534618004 | Wrong Answer | import math
n = int(input())
mx = math.ceil(n ** 0.5)
for i in reversed(range(1, mx)):
if n % i == 0:
print(int(i + n / i - 2))
break |
p02873 | s826894098 | Accepted | s=input()
#左に>が続く個数、右に<が続く個数
l=[0]
r=[0]
l_,r_=0,0
for i in range(len(s)):
if s[i]=='<':
l_+=1
else:
l_=0
l.append(l_)
if s[-1-i]=='>':
r_+=1
else:
r_=0
r.append(r_)
r.reverse()
ans=0
for i in range(len(s)+1):
ans+=max(l[i],r[i])
print(ans)
|
p02547 | s326447767 | Wrong Answer | N = int(input())
count = 0
for i in range(N):
D1, D2 = map(int, input().split())
if D1 == D2:
count += 1
if count == 3:
print('Yes')
break
if i == N-1:
print('No') |
p02576 | s763653145 | Wrong Answer | N,X,T = map(int, input().split())
print(((N+X-1)/X)*T) |
p03211 | s629989166 | Wrong Answer | s=input()
ans=10**10
for i in range(len(s)):
try:
ans=min(ans,abs(int(s[i:i+1])-753))
ans=min(ans,abs(int(s[i:i+2])-753))
ans=min(ans,abs(int(s[i:i+3])-753))
ans=min(ans,abs(int(s[i:i+4])-753))
except:pass
print(ans) |
p02627 | s128702534 | Accepted | s = input()
if s in ['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']:
ans = 'a'
else:
ans = 'A'
print(ans) |
p02881 | s417836803 | Accepted | from math import sqrt as s
N = int(input())
x, y = [], []
for i in range(1, int(s(N))+1):
if N % i == 0:
x.append(i)
y.append(N // i)
ans, M = float("INF"), len(x)
for i in range(M):
ans = min(ans, x[i] + y[i] - 2)
print(ans) |
p02702 | s344379582 | Accepted |
from collections import defaultdict
S = input()
n = len(S)
mod = 2019
d = defaultdict(int)
d[0] = 1
num = 0
for i in reversed(range(n)):
num += int(S[i]) * pow(10, n - i - 1, mod)
num %= mod
d[num] += 1
ans = 0
for v in d.values():
ans += v * (v - 1) // 2
print(ans)
|
p03146 | s402860779 | Wrong Answer | N=int(input())
L=[]
L.append(N)
i=0
while(1):
if L[i]==4:
break
if L[i]%2==0:
L.append(L[i]//2)
if L[i]%2==1:
L.append(L[i]*3+1)
i+=1
print(i+4) |
p03433 | s737469946 | Accepted | n = int(input())
a = int(input())
if n%500 > a:
print('No')
else:
print('Yes') |
p02553 | s166097857 | Wrong Answer | a, b, c, d = map(int, input().split())
L = [a*b, a*c, a*d, b*c, b*d, c*d]
print(max(L)) |
p03486 | s896517607 | Accepted | s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
print('Yes' if s < t else 'No')
|
p03695 | s741672472 | Accepted | from collections import defaultdict
N=int(input())
a=list(map(int,input().split()))
count=defaultdict(int)
count3200=0
for i in range(N):
if a[i] < 3200:
count[a[i] // 400] += 1
else:
count3200 += 1
print(max(len(count),1),len(count)+count3200) |
p03377 | s127332388 | Accepted | a,b,x = map(int,input().split())
if a > x or a+b < x:
print("NO")
else:
print("YES") |
p03657 | s953729581 | Accepted | a,b=map(int,input().split())
print('Possible' if a%3==0 or b%3==0 or (a+b)%3==0 else 'Impossible')
|
p03680 | s849279082 | Accepted | n = int(input())
a = [int(input()) for _ in range(n)]
count = 1
i = 0
while count < n:
i = a[i] - 1
if i == 1:
print(count)
break
count += 1
if count >= n:
print(-1) |
p02631 | s478552754 | Accepted | #!/usr/bin/python3
# -*- coding:utf-8 -*-
from functools import reduce
def main():
n = int(input())
la = list(map(int, input().strip().split()))
x = reduce(lambda x, y: x ^ y, la)
print(' '.join([str(x ^ a) for a in la]))
if __name__=='__main__':
main()
|
p03281 | s096960424 | Accepted | n=int(input())
ans=0
for i in range(1,n+1):
p=0
for j in range(1,i+1):
if i%j==0:
p+=1
if p==8 and j%2!=0:
ans+=1
print(ans) |
p02676 | s222792397 | Wrong Answer | k = int(input())
s = input()
slist = list(s)
if len(slist) > k:
l = ''
for i in range(k):
l += slist[i]
print('...' + l)
else:
print(s)
|
p03457 | s558311392 | Accepted | N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]
ans = 'Yes'
for t, x, y in P:
if x + y > t:
ans = 'No'
break
if (x + y) % 2 != t % 2:
ans = 'No'
break
print(ans) |
p03862 | s935732433 | Wrong Answer | n,x = map(int,input().split())
A = list(map(int,input().split()))
B = A.copy()
B = reversed(B)
ans = 0
tmp = 0
for i in range(n-1):
if A[i] + A[i+1] >x:
d = A[i] + A[i+1]
tmp+= d-x
if A[i+1] >=d:
A[i+1] -=d
else:
A[i] = A[i] - (d-A[i+1])
A[i+1] = 0... |
p03317 | s370690631 | Wrong Answer | n,k = map(int,input().split())
A = list(input().split())
place_1 = A.index("1")
L = place_1
R = n - L - 1
print(-(-L//(k-1)) + -(-R//(k-1))) |
p02683 | s462595297 | Accepted | n, m, x = map(int, input().split())
c = [0] * n
a = [[]] * n
for i in range(n):
c[i], *a[i] = map(int, input().split())
ans = 2**32
for mask in range(1 << n):
res = [0] * m
cost = 0
for i in range(n):
if mask >> i & 1:
cost += c[i]
for j in range(m):
res[j] += a[i][j]
if all(v >= x for v in res):
ans... |
p03282 | s549495586 | Accepted | S,K=list(input()),int(input())
for i in S:
K-=1
if i!='1'or K==0:
print(i)
exit() |
p03239 | s738143843 | Wrong Answer | n,lim = map(int,input().split())
ans = 10000
for i in range(n):
cost,time = map(int,input().split())
if time <= lim and cost < ans:
ans = cost
if ans != 10000:
print("TLE")
else:
print(ans) |
p03472 | s048808053 | Wrong Answer | N, H = map(int, input().split())
A = 0
B = []
for i in range(N):
a, b = map(int, input().split())
A = max(A, a)
B.append(b)
B = sorted(B, reverse=True) + [0]
i = 0
while B[i] >= A:
i += 1
B = B[:i]
for i in range(len(B)):
H -= B[i]
if H < 0:
print(i + 1)
exit()
print(i + 1 + ... |
p02922 | s242584371 | Wrong Answer | a,b = map(int,input().split())
cnt = a
ans = 1
while(True):
if(cnt >= b):
break
cnt -= 1
cnt += a
ans += 1
print(ans) |
p03264 | s396618718 | Accepted | k=int(input())
print((k//2)*(k//2+k%2))
|
p03720 | s307055014 | Accepted | N,M = map(int, input().split())
t=[0 for _ in range(N)]
for i in range(M):
a,b = map(int, input().split())
t[a-1]+=1
t[b-1]+=1
for i in range(N):
print(t[i]) |
p03657 | s866734520 | Accepted | a,b = map(int,input().split())
print("Possible" if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0 else "Impossible") |
p03017 | s289321819 | Accepted | n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a-1:c] or '##' in s[b-1:d]:
print('No')
else:
if d<c and '...' not in s[b-2:d+1]:
print('No')
else:
print('Yes')
|
p02958 | s878084572 | Accepted | n = int(input())
p = list(map(int, input().split()))
p2 = sorted(p)
num_diff = 0
for i in range(n):
if p[i] != p2[i]:
num_diff += 1
if num_diff == 0 or num_diff == 2:
print('YES')
else:
print('NO') |
p03107 | s190526127 | Accepted | s=input()
ans=int(0)
n=len(s)
b=int(0)
w=int(0)
for i in range(n):
if s[i]=='0':
b+=1
else:
w+=1
if b<w:
print(2*b)
else:
print(2*w) |
p03821 | s155564474 | Wrong Answer | n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
ans = 0
li = li[::-1]
for l in li:
x = l[0]
y = l[1]
x += ans
ans += y - x%y
#print(ans)
print(ans) |
p02767 | s996025449 | Wrong Answer | N = int(input())
x_list = list(map(int, input().split()))
max_x = max(x_list)
min_x = min(x_list)
each_value_list = []
min_value = 10e1000
for i in range(min_x, max_x + 1):
print(i)
tmp_sum = 0
for x in x_list:
tmp_sum += (x - i)**2
if min_value > tmp_sum:
min_value = tmp_sum
print(m... |
p02881 | s507710590 | Wrong Answer | from math import ceil, sqrt
n = int(input())
ans = n - 1
for i in range(2, ceil(sqrt(n))):
j, mod = divmod(n, i)
if mod == 0:
temp = i + j - 2
if temp < ans:
ans = temp
print(ans) |
p03264 | s420811884 | Accepted | k = int(input())
odd = 0
even = 0
for i in range(k + 1)[1:]:
if i % 2 == 0:
even += 1
elif i % 2 == 1:
odd += 1
print(odd * even) |
p03719 | s209446146 | Wrong Answer | a,b,c = map(int,input().split())
if a>= c and c<=b:
print("Yes")
else:
print("No") |
p04005 | s682084279 | Accepted | # A - Divide a Cuboid
a, b, c = map(int, input().split())
if (a*b*c)%2==0:
print(0)
else:
print(min(a*b,b*c,c*a)) |
p03339 | s291269278 | Accepted | n=int(input())
s=input()
W=[0]*(n+1) #Wについての累積和
E=[0]*(n+1) #Eについての累積和
e=0
w=0
for i in range(n):
if s[i]=="W":
w += 1
else:
e += 1
W[i+1] = w
E[i+1] = e
ans = 10**10
for i in range(n):
tmp = W[i] + (E[n]-E[i+1])
ans = min(ans,tmp)
print(ans)
|
p03281 | s587747174 | Accepted | N = int(input())
count = 0
for i in range(1,N+1,2):
temp = 0
for j in range (1,i+1):
if i%j == 0:
temp+=1
if temp == 8:
count+=1
print(count)
|
p02755 | s506482764 | Accepted | import math
a, b = input().split() # a = result * 0.08, b = result * 0.1
a, b = int(a), int(b)
result_a = int(math.ceil(a / 0.08))
result_b = int(math.ceil(b / 0.1))
if result_a < 0 or result_b < 0:
print(-1)
elif result_a > result_b:
c = int(result_a * 0.1)
if b == c:
print(result_a)
else:
print(-... |
p03456 | s531935620 | Accepted | import math
a = int(input().replace(' ', ''))
b = math.sqrt(a)
r = 'Yes' if (b.is_integer()) else 'No'
print(r) |
p03854 | s405319297 | Accepted | def main():
S = input()
while len(S)>=5:
if len(S)>=7 and S[-7:]=="dreamer":
S = S[:-7]
continue
elif len(S)>=6 and S[-6:]=="eraser":
S = S[:-6]
continue
elif S[-5:]=="dream" or S[-5:]=="erase":
S = S[:-5]
continue
else:
break
if len(S)==0:
print(... |
p03836 | s125800440 | Wrong Answer | sx,sy,tx,ty = map(int,input().split())
going1 = ''
returning1 = ''
going2 = ''
returning2 = ''
going1 = 'R' * (tx - sx) + 'U' * (ty - sy)
returning1 = 'L' * (tx -sy) + 'D' * (ty - sy)
going2 = 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
returning2 = 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'
print... |
p03761 | s337455307 | Accepted | n=int(input())
S=list(input() for _ in range(n))
T="abcdefghijklmnopqrstuvwxyz"
for c in T:
x=50
for s in S:
x=min(x,s.count(c))
print(c*x,end='')
print()
|
p03944 | s849311915 | Wrong Answer | W, H, N = map(int, input().split())
min_H = 0
min_W = 0
max_H = H
max_W = W
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
min_W = x
elif a == 2:
max_W = x
elif a == 3:
min_H = y
else:
max_H = y
print((max_H - min_H) * (max_W - min_W))
|
p03038 | s518348158 | Accepted | N, M = map(int, input().split())
from collections import*
c = Counter(map(int, input().split()))
for _ in range(M):
B, C = map(int, input().split())
c[C] = c[C] + B if C in c else B
c = sorted(c.items(), reverse=True)
s = 0
for i in c:
s += i[0] * min(i[1],N)
N -= min(i[1],N)
print(s)
|
p02866 | s999478110 | Accepted | n = int(input())
d = list(map(int, input().split()))
mod = 998244353
a = [0] * n
for d_ in d:
a[d_] += 1
res = d[0] == 0 and a[0] == 1
for i, j in zip(a, a[1:]):
res = res * i ** j % mod
print(res) |
p02777 | s197891237 | Accepted | s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
print(a-1, b)
else:
print(a, b-1)
|
p03385 | s970434300 | Accepted | S = input()
if 'a' in S and 'b' in S and 'c' in S:
print('Yes')
else:
print('No') |
p02916 | s513848876 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(N-1):
ans+=B[int(A[i])-1]
if int(A[i])+1==int(A[i+1]):
ans+=C[int(A[i])-1]
print(ans+B[int(A[N-1])-1]) |
p03345 | s299874929 | Wrong Answer | a, b, c, k = map(int, input().split())
flag = True
for i in range(10**18):
if k == 0:
break
if a == b and b == c:
break
A = a
B = b
C = c
a = B + C
b = A + C
c = A + B
if i == k - 1:
break
if a > 10**18:
flag = False
break
if flag:
pri... |
p03106 | s606556461 | Accepted | A,B,K=map(int,input().split())
ans=[]
for i in range (1,min(A,B)+1):
if A%i==0 and B%i==0:
ans.append(i)
print(ans[-K]) |
p02696 | s154327574 | Wrong Answer | a, b, n = map(int, input().split())
n = b if n > b else n
ans = 0
for x in range(n, 0, -1):
if x > b:
continue
ans = max(a * x // b - a * (x // b), ans)
break
print(ans) |
p03360 | s888305182 | Wrong Answer | a, b, c = map(int, input().split())
k = int(input())
ans = 0
sub = a + b + c
ans = max(a * (2 * k) + sub, b * (2 * k) + sub, c * (2 * k) + sub)
print(ans) |
p03241 | s578886232 | Accepted | def p_d():
n, m = map(int, input().split())
max_candidate = m // n
for i in reversed(range(1, max_candidate + 1)):
diff = m - n * i
if diff % i == 0:
print(i)
break
p_d() |
p03723 | s758852218 | Wrong Answer | A,B,C = map(int,input().split())
def main(a,b,c):
if a == b and b == c:
return -1
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
return 0
cnt = 0
while True:
#print(a,b,c)
a1,b1,c1 = a,b,c
a = (b1+c1)//2
b = (a1+c1)//2
c = (a1+b1)//2
cnt += 1
if a % 2 == 1 or b % 2 == 1 ... |
p03681 | s504893868 | Accepted | def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))
MOD = 10 ** 9 + 7
N, M = MI()
if abs(N - M) > 1:
print(0)
exit(0)
f = [1]
for n in range(1, max(N, M) + 1):
f.append(f[n - 1] * n % MOD)
print(f[N] * f[M] * (2 if abs(N - M) == 0 else... |
p02707 | s101663015 | Accepted | def main():
N = int(input())
A = list(map(int, input().split()))
l = [0]*N
for a in A:
l[a-1] += 1
ans = "\n".join([str(x) for x in l])
print(ans)
if __name__=="__main__":
main() |
p02664 | s243488531 | Accepted | t=input()
t=t.replace('?','D')
print(t) |
p03557 | s263285353 | Accepted | import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for i in range(N):
a=bisect.bisect_left(A,B[i])
b=N-bisect.bisect_right(C,B[i])
if b==0:
break
ans+=a*b
print(ans) |
p03745 | s472543159 | Accepted | n=int(input())
a=list(map(int,input().split()))
ans=1
c=0
pas=a[0]
for i in range(1,n):
now=a[i]
if c==0:
if pas<now:
c=1
if pas>now:
c=2
if c==1:
if pas>now:
ans+=1
c=0
if c==2:
if pas<now:
ans+=1
c=0
pas=now
print(ans) |
p03617 | s309598191 | Wrong Answer | q, h, s, d = map(int, input().split())
n = int(input())
q /= 0.25
h /= 0.5
s /= 1
d /= 2
li = [(q, 0.25), (h, 0.5), (s, 1), (d, 2)]
li.sort()
ans = 0
for i in range(len(li)):
if n < li[i][1]:
continue
n, r = divmod(n, li[i][1])
ans += n * li[i][0] * li[i][1]
if r == 0:
break
print(int... |
p03017 | s727470303 | Wrong Answer | import sys
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
N, A, B, C, D = map(int, input().split())
log(N, A, B, C, D)
S = input()
if "##" in S:
print("No")
return
if C < D:
print("Yes")
return
if "..." in S[B-2:D+1]:
... |
p03127 | s330831975 | Wrong Answer | n = int(input())
a = [int(i) for i in input().split()]
mn1 = min(a)
a.remove(mn1)
mn2 = min(a)
if mn2%mn1==0:
print(mn1)
else:
print(1) |
p03778 | s424504656 | Accepted | W, a, b = map(int, input().split())
if a+W < b:
print(b-(a+W))
elif b < a-W:
print((a-W)-b)
else:
print(0)
|
p03827 | s287316468 | Accepted | n = int(input())
s = input()
x = 0
ans = 0
for i in range(n):
if s[i] == "I":
x += 1
elif s[i] == "D":
x -= 1
ans = max(ans, x)
print(ans)
|
p02577 | s688884108 | Accepted | N = input()
sumRes = sum(list(map(int, N)))
print('Yes' if sumRes % 9 == 0 else 'No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.